Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
BSD socket service API . More...
Data Structures | |
struct | net_socket_service_event |
This struct contains information which socket triggered calls to the callback function. More... | |
struct | net_socket_service_desc |
Main structure holding socket service configuration information. More... | |
Macros | |
#define | NET_SOCKET_SERVICE_SYNC_DEFINE(name, cb, count) |
Statically define a network socket service. | |
#define | NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(name, cb, count) |
Statically define a network socket service in a private (static) scope. | |
Typedefs | |
typedef void(* | net_socket_service_handler_t) (struct net_socket_service_event *pev) |
The signature for a net socket service handler function. | |
typedef void(* | net_socket_service_cb_t) (const struct net_socket_service_desc *svc, void *user_data) |
Callback used while iterating over socket services. | |
Functions | |
int | net_socket_service_register (const struct net_socket_service_desc *service, struct zsock_pollfd *fds, int len, void *user_data) |
Register pollable sockets. | |
static int | net_socket_service_unregister (const struct net_socket_service_desc *service) |
Unregister pollable sockets. | |
void | net_socket_service_foreach (net_socket_service_cb_t cb, void *user_data) |
Go through all the socket services and call callback for each service. | |
BSD socket service API .
#define NET_SOCKET_SERVICE_SYNC_DEFINE | ( | name, | |
cb, | |||
count ) |
#include <zephyr/net/socket_service.h>
Statically define a network socket service.
The user callback is called synchronously for this service meaning that the service API will wait until the user callback returns before continuing with next socket service.
The socket service can be accessed outside the module where it is defined using:
name | Name of the service. |
cb | Callback function that is called for socket activity. |
count | How many pollable sockets is needed for this service. |
#define NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC | ( | name, | |
cb, | |||
count ) |
#include <zephyr/net/socket_service.h>
Statically define a network socket service in a private (static) scope.
The user callback is called synchronously for this service meaning that the service API will wait until the user callback returns before continuing with next socket service.
name | Name of the service. |
cb | Callback function that is called for socket activity. |
count | How many pollable sockets is needed for this service. |
typedef void(* net_socket_service_cb_t) (const struct net_socket_service_desc *svc, void *user_data) |
#include <zephyr/net/socket_service.h>
Callback used while iterating over socket services.
svc | Pointer to current socket service. |
user_data | A valid pointer to user data or NULL |
typedef void(* net_socket_service_handler_t) (struct net_socket_service_event *pev) |
#include <zephyr/net/socket_service.h>
The signature for a net socket service handler function.
The function will be invoked by the socket service.
pev | the socket service event that provided the handler. |
void net_socket_service_foreach | ( | net_socket_service_cb_t | cb, |
void * | user_data ) |
#include <zephyr/net/socket_service.h>
Go through all the socket services and call callback for each service.
cb | User-supplied callback function to call |
user_data | User specified data |
int net_socket_service_register | ( | const struct net_socket_service_desc * | service, |
struct zsock_pollfd * | fds, | ||
int | len, | ||
void * | user_data ) |
#include <zephyr/net/socket_service.h>
Register pollable sockets.
service | Pointer to a service description. |
fds | Socket array to poll. |
len | Length of the socket array. |
user_data | User specific data. |
0 | No error |
-ENOENT | Service is not found. |
-ENINVAL | Invalid parameter. |
|
inlinestatic |
#include <zephyr/net/socket_service.h>
Unregister pollable sockets.
service | Pointer to a service description. |
0 | No error |
-ENOENT | Service is not found. |
-ENINVAL | Invalid parameter. |