Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
net_context Struct Reference

Note that we do not store the actual source IP address in the context because the address is already set in the network interface struct. More...

#include <net_context.h>

Data Fields

void * fifo_reserved
 First member of the structure to allow to put contexts into a FIFO.
 
void * user_data
 User data associated with a context.
 
atomic_t refcount
 Reference count.
 
struct k_mutex lock
 Internal lock for protecting this context from multiple access.
 
struct sockaddr_ptr local
 Local endpoint address.
 
struct sockaddr remote
 Remote endpoint address.
 
struct net_conn_handle * conn_handler
 Connection handle.
 
net_context_recv_cb_t recv_cb
 Receive callback to be called when desired packet has been received.
 
net_context_send_cb_t send_cb
 Send callback to be called when the packet has been sent successfully.
 
net_context_connect_cb_t connect_cb
 Connect callback to be called when a connection has been established.
 
void * tcp
 TCP connection information.
 
struct { 
 
options 
 Option values.
 
uint16_t proto
 Protocol (UDP, TCP or IEEE 802.3 protocol value)
 
uint16_t flags
 Flags for the context.
 
int8_t iface
 Network interface assigned to this context.
 
union { 
 
   struct { 
 
      uint8_t   ipv6_hop_limit 
 IPv6 hop limit. More...
 
      uint8_t   ipv6_mcast_hop_limit 
 IPv6 multicast hop limit. More...
 
   }  
 
   struct { 
 
      uint8_t   ipv4_ttl 
 IPv4 TTL. More...
 
      uint8_t   ipv4_mcast_ttl 
 IPv4 multicast TTL. More...
 
   }  
 
};  
 IPv6 hop limit or IPv4 ttl for packets sent via this context.
 

Detailed Description

Note that we do not store the actual source IP address in the context because the address is already set in the network interface struct.

If there is no such source address there, the packet cannot be sent anyway. This saves 12 bytes / context in IPv6.

Field Documentation

◆ [union]

union { ... } net_context

IPv6 hop limit or IPv4 ttl for packets sent via this context.

◆ conn_handler

struct net_conn_handle* net_context::conn_handler

Connection handle.

◆ connect_cb

net_context_connect_cb_t net_context::connect_cb

Connect callback to be called when a connection has been established.

◆ fifo_reserved

void* net_context::fifo_reserved

First member of the structure to allow to put contexts into a FIFO.

◆ flags

uint16_t net_context::flags

Flags for the context.

◆ iface

int8_t net_context::iface

Network interface assigned to this context.

◆ ipv4_mcast_ttl

uint8_t net_context::ipv4_mcast_ttl

IPv4 multicast TTL.

◆ ipv4_ttl

uint8_t net_context::ipv4_ttl

IPv4 TTL.

◆ ipv6_hop_limit

uint8_t net_context::ipv6_hop_limit

IPv6 hop limit.

◆ ipv6_mcast_hop_limit

uint8_t net_context::ipv6_mcast_hop_limit

IPv6 multicast hop limit.

◆ local

struct sockaddr_ptr net_context::local

Local endpoint address.

Note that the values are in network byte order.

◆ lock

struct k_mutex net_context::lock

Internal lock for protecting this context from multiple access.

◆ [struct]

struct { ... } net_context::options

Option values.

◆ proto

uint16_t net_context::proto

Protocol (UDP, TCP or IEEE 802.3 protocol value)

◆ recv_cb

net_context_recv_cb_t net_context::recv_cb

Receive callback to be called when desired packet has been received.

◆ refcount

atomic_t net_context::refcount

Reference count.

◆ remote

struct sockaddr net_context::remote

Remote endpoint address.

Note that the values are in network byte order.

◆ send_cb

net_context_send_cb_t net_context::send_cb

Send callback to be called when the packet has been sent successfully.

◆ tcp

void* net_context::tcp

TCP connection information.

◆ user_data

void* net_context::user_data

User data associated with a context.


The documentation for this struct was generated from the following file: