Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

ext arguments

ext arguments
[TCP]

Additional data storage per tcp pcb
. More...

Functions

u8_t tcp_ext_arg_alloc_id (void)
 Allocate an index to store data in ext_args member of struct tcp_pcb.
void tcp_ext_arg_set_callbacks (struct tcp_pcb *pcb, uint8_t id, const struct tcp_ext_arg_callbacks *const callbacks)
 Set callbacks for a given index of ext_args on the specified pcb.
void tcp_ext_arg_set (struct tcp_pcb *pcb, uint8_t id, void *arg)
 Set data for a given index of ext_args on the specified pcb.
void * tcp_ext_arg_get (const struct tcp_pcb *pcb, uint8_t id)
 Set data for a given index of ext_args on the specified pcb.

Detailed Description

Additional data storage per tcp pcb
.

See also:
TCP

When LWIP_TCP_PCB_NUM_EXT_ARGS is > 0, every tcp pcb (including listen pcb) includes a number of additional argument entries in an array.

To support memory management, in addition to a 'void *', callbacks can be provided to manage transition from listening pcbs to connections and to deallocate memory when a pcb is deallocated (see struct tcp_ext_arg_callbacks).

After allocating this index, use tcp_ext_arg_set and tcp_ext_arg_get to store and load arguments from this index for a given pcb.


Function Documentation

u8_t tcp_ext_arg_alloc_id ( void   )

Allocate an index to store data in ext_args member of struct tcp_pcb.

Returned value is an index in mentioned array. The index is *global* over all pcbs!

When LWIP_TCP_PCB_NUM_EXT_ARGS is > 0, every tcp pcb (including listen pcb) includes a number of additional argument entries in an array.

To support memory management, in addition to a 'void *', callbacks can be provided to manage transition from listening pcbs to connections and to deallocate memory when a pcb is deallocated (see struct tcp_ext_arg_callbacks).

After allocating this index, use tcp_ext_arg_set and tcp_ext_arg_get to store and load arguments from this index for a given pcb.

Returns:
a unique index into struct tcp_pcb.ext_args

Definition at line 2571 of file lwip_tcp.c.

void* tcp_ext_arg_get ( const struct tcp_pcb pcb,
uint8_t  id 
)

Set data for a given index of ext_args on the specified pcb.

Parameters:
pcbtcp_pcb for which to set the data
idext_args index to set (allocated via tcp_ext_arg_alloc_id)
Returns:
data pointer at the given index

Definition at line 2631 of file lwip_tcp.c.

void tcp_ext_arg_set ( struct tcp_pcb pcb,
uint8_t  id,
void *  arg 
)

Set data for a given index of ext_args on the specified pcb.

Parameters:
pcbtcp_pcb for which to set the data
idext_args index to set (allocated via tcp_ext_arg_alloc_id)
argdata pointer to set

Definition at line 2613 of file lwip_tcp.c.

void tcp_ext_arg_set_callbacks ( struct tcp_pcb pcb,
uint8_t  id,
const struct tcp_ext_arg_callbacks *const   callbacks 
)

Set callbacks for a given index of ext_args on the specified pcb.

Parameters:
pcbtcp_pcb for which to set the callback
idext_args index to set (allocated via tcp_ext_arg_alloc_id)
callbackscallback table (const since it is referenced, not copied!)

Definition at line 2594 of file lwip_tcp.c.