Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
net_context Struct Reference

#include <net_context.h>

Data Fields

voiduser_data
 
atomic_t refcount
 
struct k_mutex lock
 
struct sockaddr_ptr local
 
struct sockaddr remote
 
struct net_conn_handle * conn_handler
 
net_context_recv_cb_t recv_cb
 
net_context_send_cb_t send_cb
 
net_context_connect_cb_t connect_cb
 
struct {
options
 
uint16_t proto
 
uint16_t flags
 
int8_t iface
 
union {
   uint8_t   ipv6_hop_limit
 
   uint8_t   ipv4_ttl
 
}; 
 

Detailed Description

Note that we do not store the actual source IP address in the context because the address is already be 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 { ... } net_context::@163

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.

◆ flags

uint16_t net_context::flags

Flags for the context

◆ iface

int8_t net_context::iface

Network interface assigned to this context

◆ ipv4_ttl

uint8_t net_context::ipv4_ttl

◆ ipv6_hop_limit

uint8_t net_context::ipv6_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 { ... } 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.

◆ user_data

void* net_context::user_data

User data.

First member of the structure to let users either have user data associated with a context, or put contexts into a FIFO.


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