lwIP 2.1.0 Lightweight IP stack

Functions
ext arguments
APIs » "raw" APIs » TCP

## Functions
u8_t | tcp_ext_arg_alloc_id (void)
void | tcp_ext_arg_set_callbacks (struct tcp_pcb *pcb, uint8_t id, const struct tcp_ext_arg_callbacks *const callbacks)
void | tcp_ext_arg_set (struct tcp_pcb *pcb, uint8_t id, void *arg)
void * | tcp_ext_arg_get (const struct tcp_pcb *pcb, uint8_t id)

## 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

## ◆ tcp_ext_arg_alloc_id()

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

## ◆ tcp_ext_arg_get()

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

  pcb | tcp_pcb for which to set the data
  id | ext_args index to set (allocated via tcp_ext_arg_alloc_id)

Returns
  data pointer at the given index

## ◆ tcp_ext_arg_set()

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

  pcb | tcp_pcb for which to set the data
  id | ext_args index to set (allocated via tcp_ext_arg_alloc_id)
  arg | data pointer to set

## ◆ tcp_ext_arg_set_callbacks()

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

  pcb | tcp_pcb for which to set the callback
  id | ext_args index to set (allocated via tcp_ext_arg_alloc_id)
  callbacks | callback table (const since it is referenced, not copied!)