Zephyr API Documentation
3.6.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_ASYNC_DEFINE(name, work_q, cb, count) __z_net_socket_service_define(name, work_q, cb, count, 1) |
Statically define a network socket service. | |
#define | NET_SOCKET_SERVICE_ASYNC_DEFINE_STATIC(name, work_q, cb, count) __z_net_socket_service_define(name, work_q, cb, count, 1, static) |
Statically define a network socket service in a private (static) scope. | |
#define | NET_SOCKET_SERVICE_SYNC_DEFINE(name, work_q, cb, count) __z_net_socket_service_define(name, work_q, cb, count, 0) |
Statically define a network socket service. | |
#define | NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(name, work_q, cb, count) __z_net_socket_service_define(name, work_q, cb, count, 0, static) |
Statically define a network socket service in a private (static) scope. | |
Typedefs | |
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_ASYNC_DEFINE | ( | name, | |
work_q, | |||
cb, | |||
count | |||
) | __z_net_socket_service_define(name, work_q, cb, count, 1) |
#include <zephyr/net/socket_service.h>
Statically define a network socket service.
The user callback is called asynchronously for this service meaning that the service API will not 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. |
work_q | Pointer to workqueue where the work is done. Can be null in which case system workqueue is used. |
cb | Callback function that is called for socket activity. |
count | How many pollable sockets is needed for this service. |
#define NET_SOCKET_SERVICE_ASYNC_DEFINE_STATIC | ( | name, | |
work_q, | |||
cb, | |||
count | |||
) | __z_net_socket_service_define(name, work_q, cb, count, 1, static) |
#include <zephyr/net/socket_service.h>
Statically define a network socket service in a private (static) scope.
The user callback is called asynchronously for this service meaning that the service API will not wait until the user callback returns before continuing with next socket service.
name | Name of the service. |
work_q | Pointer to workqueue where the work is done. Can be null in which case system workqueue is used. |
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 | ( | name, | |
work_q, | |||
cb, | |||
count | |||
) | __z_net_socket_service_define(name, work_q, cb, count, 0) |
#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. |
work_q | Pointer to workqueue where the work is done. Can be null in which case system workqueue is used. |
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, | |
work_q, | |||
cb, | |||
count | |||
) | __z_net_socket_service_define(name, work_q, cb, count, 0, static) |
#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. |
work_q | Pointer to workqueue where the work is done. Can be null in which case system workqueue is used. |
cb | Callback function that is called for socket activity. |
count | How many pollable sockets is needed for this service. |
net_socket_service_cb_t |
#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 |
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. |