pdcomm_gem_program_at
Function
Copies one stored program by position.
PdcommStatus pdcomm_gem_program_at(PdcommTcpEndpoint *endpoint, size_t index, PdcommSecsItem **out_id, PdcommSecsItem **out_body)Programs keep insertion order; replacing a program keeps its position.
Parameters
| Name | Description |
|---|---|
endpoint | Endpoint with a program store. |
index | Zero-based program index. |
out_id | Receives a new PPID item; set to NULL first. Must not be NULL. |
out_body | Receives a new PPBODY item; set to NULL first. Must not be NULL. |
Returns
#PDCOMM_OK on success; #PDCOMM_INVALID_ARGUMENT when an output or endpoint is NULL; #PDCOMM_INVALID_STATE when no program store is configured; #PDCOMM_OUT_OF_RANGE when index is past the end; #PDCOMM_BACKPRESSURE when a staged TCP event is pending; #PDCOMM_LIMIT_EXCEEDED, #PDCOMM_ALLOCATION_FAILED, or #PDCOMM_POISONED.
Notes
- Ownership: release both items with pdcomm_secs_destroy(). On failure neither output holds an item.