Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
RAW
["raw" APIs]
Implementation of raw protocol PCBs for low-level handling of different types of protocols besides (or overriding) those already available in lwIP. More...
Functions | |
err_t | raw_bind (struct raw_pcb *pcb, const ip_addr_t *ipaddr) |
Bind a RAW PCB. | |
void | raw_bind_netif (struct raw_pcb *pcb, const struct netif *netif) |
Bind an RAW PCB to a specific netif. | |
err_t | raw_connect (struct raw_pcb *pcb, const ip_addr_t *ipaddr) |
Connect an RAW PCB. | |
void | raw_disconnect (struct raw_pcb *pcb) |
Disconnect a RAW PCB. | |
void | raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg) |
Set the callback function for received packets that match the raw PCB's protocol and binding. | |
err_t | raw_sendto (struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr) |
Send the raw IP packet to the given address. | |
err_t | raw_sendto_if_src (struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, struct netif *netif, const ip_addr_t *src_ip) |
Send the raw IP packet to the given address, using a particular outgoing netif and source IP address. | |
err_t | raw_send (struct raw_pcb *pcb, struct pbuf *p) |
Send the raw IP packet to the address given by raw_connect() | |
void | raw_remove (struct raw_pcb *pcb) |
Remove an RAW PCB. | |
struct raw_pcb * | raw_new (u8_t proto) |
Create a RAW PCB. | |
struct raw_pcb * | raw_new_ip_type (u8_t type, u8_t proto) |
Create a RAW PCB for specific IP type. |
Detailed Description
Implementation of raw protocol PCBs for low-level handling of different types of protocols besides (or overriding) those already available in lwIP.
- See also:
- APIs
Function Documentation
Bind a RAW PCB.
- Parameters:
-
pcb RAW PCB to be bound with a local address ipaddr. ipaddr local IP address to bind with. Use IP4_ADDR_ANY to bind to all local interfaces.
- Returns:
- lwIP error code.
- ERR_OK. Successful. No error occurred.
- ERR_USE. The specified IP address is already bound to by another RAW PCB.
- See also:
- raw_disconnect()
Definition at line 221 of file lwip_raw.c.
Bind an RAW PCB to a specific netif.
After calling this function, all packets received via this PCB are guaranteed to have come in via the specified netif, and all outgoing packets will go out via the specified netif.
- Parameters:
-
pcb RAW PCB to be bound with netif. netif netif to bind to. Can be NULL.
- See also:
- raw_disconnect()
Definition at line 253 of file lwip_raw.c.
Connect an RAW PCB.
This function is required by upper layers of lwip. Using the raw api you could use raw_sendto() instead
This will associate the RAW PCB with the remote address.
- Parameters:
-
pcb RAW PCB to be connected with remote address ipaddr and port. ipaddr remote IP address to connect with.
- Returns:
- lwIP error code
- See also:
- raw_disconnect() and raw_sendto()
Definition at line 278 of file lwip_raw.c.
void raw_disconnect | ( | struct raw_pcb * | pcb ) |
Disconnect a RAW PCB.
- Parameters:
-
pcb the raw pcb to disconnect.
Definition at line 304 of file lwip_raw.c.
struct raw_pcb* raw_new | ( | u8_t | proto ) | [read] |
Create a RAW PCB.
- Returns:
- The RAW PCB which was created. NULL if the PCB data structure could not be allocated.
- Parameters:
-
proto the protocol number of the IPs payload (e.g. IP_PROTO_ICMP)
- See also:
- raw_remove()
Definition at line 595 of file lwip_raw.c.
struct raw_pcb* raw_new_ip_type | ( | u8_t | type, |
u8_t | proto | ||
) | [read] |
Create a RAW PCB for specific IP type.
- Returns:
- The RAW PCB which was created. NULL if the PCB data structure could not be allocated.
- Parameters:
-
type IP address type, see lwip_ip_addr_type definitions. If you want to listen to IPv4 and IPv6 (dual-stack) packets, supply IPADDR_TYPE_ANY as argument and bind to IP_ANY_TYPE. proto the protocol number (next header) of the IPv6 packet payload (e.g. IP6_NEXTH_ICMP6)
- See also:
- raw_remove()
Definition at line 634 of file lwip_raw.c.
void raw_recv | ( | struct raw_pcb * | pcb, |
raw_recv_fn | recv, | ||
void * | recv_arg | ||
) |
Set the callback function for received packets that match the raw PCB's protocol and binding.
The callback function MUST either
- eat the packet by calling pbuf_free() and returning non-zero. The packet will not be passed to other raw PCBs or other protocol layers.
- not free the packet, and return zero. The packet will be matched against further PCBs and/or forwarded to another protocol layers.
Definition at line 334 of file lwip_raw.c.
void raw_remove | ( | struct raw_pcb * | pcb ) |
Remove an RAW PCB.
- Parameters:
-
pcb RAW PCB to be removed. The PCB is removed from the list of RAW PCB's and the data structure is freed from memory.
- See also:
- raw_new()
Definition at line 561 of file lwip_raw.c.
Send the raw IP packet to the address given by raw_connect()
- Parameters:
-
pcb the raw pcb which to send p the IP payload to send
Definition at line 546 of file lwip_raw.c.
Send the raw IP packet to the given address.
An IP header will be prepended to the packet, unless the RAW_FLAGS_HDRINCL flag is set on the PCB. In that case, the packet must include an IP header, which will then be sent as is.
- Parameters:
-
pcb the raw pcb which to send p the IP payload to send ipaddr the destination address of the IP packet
Definition at line 354 of file lwip_raw.c.
err_t raw_sendto_if_src | ( | struct raw_pcb * | pcb, |
struct pbuf * | p, | ||
const ip_addr_t * | dst_ip, | ||
struct netif * | netif, | ||
const ip_addr_t * | src_ip | ||
) |
Send the raw IP packet to the given address, using a particular outgoing netif and source IP address.
An IP header will be prepended to the packet, unless the RAW_FLAGS_HDRINCL flag is set on the PCB. In that case, the packet must include an IP header, which will then be sent as is.
- Parameters:
-
pcb RAW PCB used to send the data p chain of pbufs to be sent dst_ip destination IP address netif the netif used for sending src_ip source IP address
Definition at line 420 of file lwip_raw.c.
Generated on Tue Jul 12 2022 13:55:23 by
