BSD socket service API .
More...
BSD socket service API .
- Since
- 3.6
- Version
- 0.1.0
◆ NET_SOCKET_SERVICE_SYNC_DEFINE
#define NET_SOCKET_SERVICE_SYNC_DEFINE |
( |
| name, |
|
|
| work_q, |
|
|
| cb, |
|
|
| count ) |
#include <zephyr/net/socket_service.h>
Value: __z_net_socket_service_define(name, work_q, cb, count)
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:
Main structure holding socket service configuration information.
Definition socket_service.h:62
- Note
- This macro cannot be used together with a static keyword. If such a use-case is desired, use NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC instead.
- Parameters
-
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_SYNC_DEFINE_STATIC
#define NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC |
( |
| name, |
|
|
| work_q, |
|
|
| cb, |
|
|
| count ) |
#include <zephyr/net/socket_service.h>
Value: __z_net_socket_service_define(name, work_q, cb, count, static)
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.
- Parameters
-
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.
- Parameters
-
svc | Pointer to current socket service. |
user_data | A valid pointer to user data or NULL |
◆ net_socket_service_foreach()
#include <zephyr/net/socket_service.h>
Go through all the socket services and call callback for each service.
- Parameters
-
cb | User-supplied callback function to call |
user_data | User specified data |
◆ net_socket_service_register()
#include <zephyr/net/socket_service.h>
Register pollable sockets.
- Parameters
-
service | Pointer to a service description. |
fds | Socket array to poll. |
len | Length of the socket array. |
user_data | User specific data. |
- Return values
-
0 | No error |
-ENOENT | Service is not found. |
-ENINVAL | Invalid parameter. |
◆ net_socket_service_unregister()
#include <zephyr/net/socket_service.h>
Unregister pollable sockets.
- Parameters
-
service | Pointer to a service description. |
- Return values
-
0 | No error |
-ENOENT | Service is not found. |
-ENINVAL | Invalid parameter. |