Provides a network API for applications and library. More...
This module provides a set of functions to establish connections or send and receive datagrams using different types of protocols. Together, they serve as an API that allows an application or library to connect to a network.
It was designed with the following priorities in mind
Currently the following
sock types are defined:
Note that there might be no relation between the different
sock types. So casting e.g.
sock_udp_t might not be as straight forward, as you think depending on the networking architecture.
A RIOT application uses the functions provided by one or more of the
sock type headers (for example sock_udp_t), regardless of the network stack it uses. The network stack used under the bonnet is specified by including the appropriate module (for example
USEMODULE += gnrc_sock_udp for GNRC's version of this API).
This allows for network stack agnostic code on the application layer. The application code to establish a connection is always the same, allowing the network stack underneath to be switched simply by changing the
USEMODULE definitions in the application's Makefile.
The actual code very much depends on the used
sock type. Please refer to their documentation for specific examples.
For simplicity and modularity this API doesn't put any restriction on the actual implementation of the type. For example, one implementation might choose to have all
sock types having a common base class or use the raw IP
sock type to send e.g. UDP packets, while others will keep them completely separate from each other.
|DNS sock API|
|Sock DNS client. |
|Raw IPv4/IPv6 sock API|
|Sock submodule for raw IPv4/IPv6. |
|TCP sock API|
|Sock submodule for TCP. |
|UDP sock API|
|Sock submodule for UDP. |
|sock utility functions|
|sock utility function |
|Common sock API definitions. |
|Abstract IP end point and end point for a raw IP sock object. More...|
|Common IP-based transport layer end point. More...|
|Special netif ID for "any interface". More...|
|Address to bind to any IPv4 address. More...|
|Address to bind to any IPv6 address. More...|
|Special value meaning "wait forever" (don't timeout) |
|activate IPv6 support |
Common flags for Sock API
|allow to reuse end point on bind |
|#define SOCK_ADDR_ANY_NETIF (0)|