Skip to content
Start free evaluation

pdcomm_gem_program_grant

Function

Sends an S7F1 process program load inquire.

PdcommStatus pdcomm_gem_program_grant(PdcommTcpEndpoint *endpoint, const PdcommSecsItem *id, uint32_t length, PdcommTcpToken *out_token)

Declared in: #include <pdcomm_gem_programs.h>

Asks the peer for permission to send a program of length body bytes. The S7F2 grant (PPGNT) arrives as a #PDCOMM_GEM_PROGRAM_GRANT_RECEIVED result.

Every outgoing program request requires a program store and GEM Communicating. It occupies one of the 32 shared pending slots, follows the normal TCP token, cancel, and T3 behavior, and charges its PPIDs against max_pending_ids and max_pending_identifier_bytes (and, for a Host, against the shared PdcommGemHostOptions::max_pending_ids). Success means the request was queued, not that it was granted, acknowledged, or answered.

Parameters

NameDescription
endpointCommunicating GEM endpoint with a program store.
idPPID item: nonempty ASCII or Binary.
lengthLENGTH: the PPBODY payload size in bytes.
out_tokenReceives the request token; zeroed first, so it is zero after every failure. Must not be NULL.

Returns

#PDCOMM_OK when the request was queued; #PDCOMM_INVALID_ARGUMENT when an argument is NULL or the PPID is not a nonempty ASCII or Binary item; #PDCOMM_INVALID_STATE when no program store is configured or GEM is not Communicating; #PDCOMM_BACKPRESSURE when a staged TCP event is pending, no pending slot is free, or the send queue is full; #PDCOMM_LIMIT_EXCEEDED when the PPID is longer than 120 bytes, the message exceeds the GEM item limits, or a pending PPID budget is exceeded; #PDCOMM_ALLOCATION_FAILED, a TCP status, or #PDCOMM_POISONED.