/Zephyr-latest/drivers/wifi/esp_at/ |
D | esp_socket.c | 24 struct esp_socket *sock = data->sockets; in esp_socket_get() local 25 struct esp_socket *sock_end = sock + ARRAY_SIZE(data->sockets); in esp_socket_get() 27 for (; sock < sock_end; sock++) { in esp_socket_get() 28 if (!esp_socket_flags_test_and_set(sock, ESP_SOCK_IN_USE)) { in esp_socket_get() 30 sock->context = context; in esp_socket_get() 31 context->offload_context = sock; in esp_socket_get() 33 sock->connect_cb = NULL; in esp_socket_get() 34 sock->recv_cb = NULL; in esp_socket_get() 35 memset(&sock->src, 0x0, sizeof(sock->src)); in esp_socket_get() 36 memset(&sock->dst, 0x0, sizeof(sock->dst)); in esp_socket_get() [all …]
|
D | esp_offload.c | 28 static int _sock_connect(struct esp_data *dev, struct esp_socket *sock) in _sock_connect() argument 46 k_mutex_lock(&sock->lock, K_FOREVER); in _sock_connect() 47 src = sock->src; in _sock_connect() 48 dst = sock->dst; in _sock_connect() 49 k_mutex_unlock(&sock->lock); in _sock_connect() 59 if (esp_socket_ip_proto(sock) == IPPROTO_TCP) { in _sock_connect() 62 sock->link_id, dst_addr_str, in _sock_connect() 99 sock->link_id, dst_addr_str, in _sock_connect() 105 sock->link_id, dst_addr_str, in _sock_connect() 110 LOG_DBG("link %d, ip_proto %s, addr %s", sock->link_id, in _sock_connect() [all …]
|
D | esp.h | 275 int esp_socket_put(struct esp_socket *sock); 277 void esp_socket_close(struct esp_socket *sock); 278 void esp_socket_rx(struct esp_socket *sock, struct net_buf *buf, 280 void esp_socket_workq_stop_and_flush(struct esp_socket *sock); 281 struct esp_socket *esp_socket_ref(struct esp_socket *sock); 282 void esp_socket_unref(struct esp_socket *sock); 295 static inline atomic_val_t esp_socket_flags_update(struct esp_socket *sock, in esp_socket_flags_update() argument 302 flags = atomic_get(&sock->flags); in esp_socket_flags_update() 303 } while (!atomic_cas(&sock->flags, flags, (flags & ~mask) | value)); in esp_socket_flags_update() 309 atomic_val_t esp_socket_flags_clear_and_set(struct esp_socket *sock, in esp_socket_flags_clear_and_set() argument [all …]
|
/Zephyr-latest/drivers/modem/ |
D | modem_socket.c | 22 uint16_t modem_socket_next_packet_size(struct modem_socket_config *cfg, struct modem_socket *sock) in modem_socket_next_packet_size() argument 28 if (!sock || !sock->packet_count) { in modem_socket_next_packet_size() 32 total = sock->packet_sizes[0]; in modem_socket_next_packet_size() 39 static uint16_t modem_socket_packet_get_total(struct modem_socket *sock) in modem_socket_packet_get_total() argument 44 if (!sock || !sock->packet_count) { in modem_socket_packet_get_total() 48 for (i = 0; i < sock->packet_count; i++) { in modem_socket_packet_get_total() 49 total += sock->packet_sizes[i]; in modem_socket_packet_get_total() 55 static int modem_socket_packet_drop_first(struct modem_socket *sock) in modem_socket_packet_drop_first() argument 59 if (!sock || !sock->packet_count) { in modem_socket_packet_drop_first() 63 sock->packet_count--; in modem_socket_packet_drop_first() [all …]
|
D | wncm14a2a.c | 241 struct wncm14a2a_socket *sock = NULL; in socket_get() local 245 sock = &ictx.sockets[i]; in socket_get() 250 return sock; in socket_get() 256 struct wncm14a2a_socket *sock = NULL; in socket_from_id() local 264 sock = &ictx.sockets[i]; in socket_from_id() 269 return sock; in socket_from_id() 272 static void socket_put(struct wncm14a2a_socket *sock) in socket_put() argument 274 if (!sock) { in socket_put() 278 sock->context = NULL; in socket_put() 279 sock->socket_id = 0; in socket_put() [all …]
|
D | modem_socket.h | 72 uint16_t modem_socket_next_packet_size(struct modem_socket_config *cfg, struct modem_socket *sock); 73 int modem_socket_packet_size_update(struct modem_socket_config *cfg, struct modem_socket *sock, 82 int modem_socket_poll_update(struct modem_socket *sock, struct zsock_pollfd *pfd, 84 int modem_socket_poll_prepare(struct modem_socket_config *cfg, struct modem_socket *sock, 87 void modem_socket_wait_data(struct modem_socket_config *cfg, struct modem_socket *sock); 88 void modem_socket_data_ready(struct modem_socket_config *cfg, struct modem_socket *sock); 124 const struct modem_socket *sock); 139 const struct modem_socket *sock); 153 struct modem_socket *sock,
|
/Zephyr-latest/tests/net/socket/ |
D | socket_helpers.h | 21 int ret, sock; in prepare_listen_sock_udp_v4() local 28 sock = ret; in prepare_listen_sock_udp_v4() 32 ret = zsock_bind(sock, (struct sockaddr *)addr, sizeof(*addr)); in prepare_listen_sock_udp_v4() 35 return sock; in prepare_listen_sock_udp_v4() 40 int ret, sock; in prepare_listen_sock_udp_v6() local 47 sock = ret; in prepare_listen_sock_udp_v6() 51 ret = zsock_bind(sock, (struct sockaddr *)addr, sizeof(*addr)); in prepare_listen_sock_udp_v6() 54 return sock; in prepare_listen_sock_udp_v6() 58 int *sock, struct sockaddr_in *sockaddr) in prepare_sock_udp_v4() argument 63 zassert_not_null(sock, "null sock"); in prepare_sock_udp_v4() [all …]
|
/Zephyr-latest/subsys/net/lib/sockets/ |
D | sockets.c | 20 #define VTABLE_CALL(fn, sock, ...) \ argument 27 obj = get_sock_vtable(sock, &vtable, &lock); \ 47 static inline void *get_sock_vtable(int sock, in get_sock_vtable() argument 53 ctx = zvfs_get_fd_obj_and_vtable(sock, in get_sock_vtable() 70 NET_DBG("Invalid access on sock %d by thread %p (%s)", sock, in get_sock_vtable() 90 void *z_impl_zsock_get_context_object(int sock) in z_impl_zsock_get_context_object() argument 94 return get_sock_vtable(sock, &ignored, NULL); in z_impl_zsock_get_context_object() 98 void *z_vrfy_zsock_get_context_object(int sock) in z_vrfy_zsock_get_context_object() argument 101 return z_impl_zsock_get_context_object(sock); in z_vrfy_zsock_get_context_object() 152 int z_impl_zsock_close(int sock) in z_impl_zsock_close() argument [all …]
|
D | sockets_internal.h | 18 int zsock_close_ctx(struct net_context *ctx, int sock); 83 int sock_obj_core_alloc(int sock, struct net_socket_register *reg, 85 int sock_obj_core_alloc_find(int sock, int new_sock, int type); 86 int sock_obj_core_dealloc(int sock); 87 void sock_obj_core_update_send_stats(int sock, int bytes); 88 void sock_obj_core_update_recv_stats(int sock, int bytes); 90 static inline int sock_obj_core_alloc(int sock, in sock_obj_core_alloc() argument 94 ARG_UNUSED(sock); in sock_obj_core_alloc() 103 static inline int sock_obj_core_alloc_find(int sock, int new_sock, int type) in sock_obj_core_alloc_find() argument 105 ARG_UNUSED(sock); in sock_obj_core_alloc_find() [all …]
|
D | socket_obj_core.c | 30 static void sock_obj_core_init_and_link(struct sock_obj *sock); 33 static int sock_obj_core_get_reg_and_proto(int sock, 57 static void sock_obj_core_init_and_link(struct sock_obj *sock) in sock_obj_core_init_and_link() argument 69 k_obj_core_init_and_link(K_OBJ_CORE(sock), &sock_obj_type); in sock_obj_core_init_and_link() 70 k_obj_core_stats_register(K_OBJ_CORE(sock), &sock->stats, in sock_obj_core_init_and_link() 76 if (sock->init_done) { in sock_obj_core_init_and_link() 77 k_obj_core_stats_reset(K_OBJ_CORE(sock)); in sock_obj_core_init_and_link() 80 sock->init_done = true; in sock_obj_core_init_and_link() 97 static int sock_obj_core_get_reg_and_proto(int sock, struct net_socket_register **reg) in sock_obj_core_get_reg_and_proto() argument 104 if (sock_objects[i].fd == sock) { in sock_obj_core_get_reg_and_proto() [all …]
|
/Zephyr-latest/include/zephyr/posix/sys/ |
D | socket.h | 30 int accept(int sock, struct sockaddr *addr, socklen_t *addrlen); 31 int bind(int sock, const struct sockaddr *addr, socklen_t addrlen); 32 int connect(int sock, const struct sockaddr *addr, socklen_t addrlen); 33 int getpeername(int sock, struct sockaddr *addr, socklen_t *addrlen); 34 int getsockname(int sock, struct sockaddr *addr, socklen_t *addrlen); 35 int getsockopt(int sock, int level, int optname, void *optval, socklen_t *optlen); 36 int listen(int sock, int backlog); 37 ssize_t recv(int sock, void *buf, size_t max_len, int flags); 38 ssize_t recvfrom(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, 40 ssize_t recvmsg(int sock, struct msghdr *msg, int flags); [all …]
|
/Zephyr-latest/samples/net/cellular_modem/server/ |
D | te_udp_echo.py | 21 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 22 sock.setblocking(False) 23 sock.bind(('0.0.0.0', 7780)) 27 ready_to_read, _, _ = select.select([sock], [sock], [], 0.5) 32 data, address = sock.recvfrom(4096) 34 sock.sendto(data, address) 40 sock.close()
|
/Zephyr-latest/subsys/tracing/ctf/ |
D | tracing_ctf.h | 448 #define sys_port_trace_socket_init(sock, family, type, proto) \ argument 449 sys_trace_socket_init(sock, family, type, proto) 450 #define sys_port_trace_socket_close_enter(sock) \ argument 451 sys_trace_socket_close_enter(sock) 452 #define sys_port_trace_socket_close_exit(sock, ret) \ argument 453 sys_trace_socket_close_exit(sock, ret) 454 #define sys_port_trace_socket_shutdown_enter(sock, how) \ argument 455 sys_trace_socket_shutdown_enter(sock, how) 456 #define sys_port_trace_socket_shutdown_exit(sock, ret) \ argument 457 sys_trace_socket_shutdown_exit(sock, ret) [all …]
|
D | ctf_top.c | 347 void sys_trace_socket_init(int sock, int family, int type, int proto) in sys_trace_socket_init() argument 349 ctf_top_socket_init(sock, family, type, proto); in sys_trace_socket_init() 352 void sys_trace_socket_close_enter(int sock) in sys_trace_socket_close_enter() argument 354 ctf_top_socket_close_enter(sock); in sys_trace_socket_close_enter() 357 void sys_trace_socket_close_exit(int sock, int ret) in sys_trace_socket_close_exit() argument 359 ctf_top_socket_close_exit(sock, ret); in sys_trace_socket_close_exit() 362 void sys_trace_socket_shutdown_enter(int sock, int how) in sys_trace_socket_shutdown_enter() argument 364 ctf_top_socket_shutdown_enter(sock, how); in sys_trace_socket_shutdown_enter() 367 void sys_trace_socket_shutdown_exit(int sock, int ret) in sys_trace_socket_shutdown_exit() argument 369 ctf_top_socket_shutdown_exit(sock, ret); in sys_trace_socket_shutdown_exit() [all …]
|
D | ctf_top.h | 431 static inline void ctf_top_socket_init(int32_t sock, uint32_t family, in ctf_top_socket_init() argument 434 CTF_EVENT(CTF_LITERAL(uint8_t, CTF_EVENT_SOCKET_INIT), sock, family, type, proto); in ctf_top_socket_init() 437 static inline void ctf_top_socket_close_enter(int32_t sock) in ctf_top_socket_close_enter() argument 439 CTF_EVENT(CTF_LITERAL(uint8_t, CTF_EVENT_SOCKET_CLOSE_ENTER), sock); in ctf_top_socket_close_enter() 442 static inline void ctf_top_socket_close_exit(int32_t sock, int32_t ret) in ctf_top_socket_close_exit() argument 444 CTF_EVENT(CTF_LITERAL(uint8_t, CTF_EVENT_SOCKET_CLOSE_EXIT), sock, ret); in ctf_top_socket_close_exit() 447 static inline void ctf_top_socket_shutdown_enter(int32_t sock, int32_t how) in ctf_top_socket_shutdown_enter() argument 449 CTF_EVENT(CTF_LITERAL(uint8_t, CTF_EVENT_SOCKET_SHUTDOWN_ENTER), sock, how); in ctf_top_socket_shutdown_enter() 452 static inline void ctf_top_socket_shutdown_exit(int32_t sock, int32_t ret) in ctf_top_socket_shutdown_exit() argument 454 CTF_EVENT(CTF_LITERAL(uint8_t, CTF_EVENT_SOCKET_SHUTDOWN_EXIT), sock, ret); in ctf_top_socket_shutdown_exit() [all …]
|
/Zephyr-latest/lib/posix/options/ |
D | net.c | 245 int getpeername(int sock, struct sockaddr *addr, socklen_t *addrlen) in getpeername() argument 247 return zsock_getpeername(sock, addr, addrlen); in getpeername() 312 int accept(int sock, struct sockaddr *addr, socklen_t *addrlen) in accept() argument 314 return zsock_accept(sock, addr, addrlen); in accept() 317 int bind(int sock, const struct sockaddr *addr, socklen_t addrlen) in bind() argument 319 return zsock_bind(sock, addr, addrlen); in bind() 322 int connect(int sock, const struct sockaddr *addr, socklen_t addrlen) in connect() argument 324 return zsock_connect(sock, addr, addrlen); in connect() 327 int getsockname(int sock, struct sockaddr *addr, socklen_t *addrlen) in getsockname() argument 329 return zsock_getsockname(sock, addr, addrlen); in getsockname() [all …]
|
/Zephyr-latest/samples/net/sockets/websocket_client/src/ |
D | main.c | 52 int *sock, struct sockaddr *addr, socklen_t addr_len) in setup_socket() argument 74 *sock = socket(family, SOCK_STREAM, IPPROTO_TLS_1_2); in setup_socket() 75 if (*sock >= 0) { in setup_socket() 76 ret = setsockopt(*sock, SOL_TLS, TLS_SEC_TAG_LIST, in setup_socket() 85 ret = setsockopt(*sock, SOL_TLS, TLS_HOSTNAME, in setup_socket() 96 *sock = socket(family, SOCK_STREAM, IPPROTO_TCP); in setup_socket() 99 if (*sock < 0) { in setup_socket() 107 if (*sock >= 0) { in setup_socket() 108 close(*sock); in setup_socket() 109 *sock = -1; in setup_socket() [all …]
|
/Zephyr-latest/samples/net/sockets/http_get/src/ |
D | http_get.c | 64 int st, sock; in main() local 95 sock = socket(res->ai_family, res->ai_socktype, IPPROTO_TLS_1_2); in main() 97 sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); in main() 99 CHECK(sock); in main() 100 printf("sock = %d\n", sock); in main() 106 CHECK(setsockopt(sock, SOL_TLS, TLS_SEC_TAG_LIST, in main() 109 CHECK(setsockopt(sock, SOL_TLS, TLS_HOSTNAME, in main() 113 CHECK(connect(sock, res->ai_addr, res->ai_addrlen)); in main() 114 CHECK(send(sock, REQUEST, SSTRLEN(REQUEST), 0)); in main() 119 int len = recv(sock, response, sizeof(response) - 1, 0); in main() [all …]
|
/Zephyr-latest/drivers/net/ |
D | nsos_sockets.c | 169 struct nsos_socket *sock; in nsos_socket_create() local 198 sock = k_malloc(sizeof(*sock)); in nsos_socket_create() 199 if (!sock) { in nsos_socket_create() 204 sock->fd = fd; in nsos_socket_create() 205 sock->recv_timeout = K_FOREVER; in nsos_socket_create() 206 sock->send_timeout = K_FOREVER; in nsos_socket_create() 208 sock->poll.mid.fd = nsos_adapt_socket(family_mid, type_mid, proto_mid); in nsos_socket_create() 209 if (sock->poll.mid.fd < 0) { in nsos_socket_create() 210 errno = errno_from_nsos_mid(-sock->poll.mid.fd); in nsos_socket_create() 214 zvfs_finalize_typed_fd(fd, sock, &nsos_socket_fd_op_vtable.fd_vtable, ZVFS_MODE_IFSOCK); in nsos_socket_create() [all …]
|
/Zephyr-latest/subsys/net/lib/mqtt/ |
D | mqtt_transport_socket_tls.c | 27 client->transport.tls.sock = zsock_socket(broker->sa_family, in mqtt_client_tls_connect() 29 if (client->transport.tls.sock < 0) { in mqtt_client_tls_connect() 33 NET_DBG("Created socket %d", client->transport.tls.sock); in mqtt_client_tls_connect() 37 ret = setsockopt(client->transport.tls.sock, in mqtt_client_tls_connect() 47 ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, TLS_PEER_VERIFY, in mqtt_client_tls_connect() 55 ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, in mqtt_client_tls_connect() 64 ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, in mqtt_client_tls_connect() 75 ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, in mqtt_client_tls_connect() 86 ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, in mqtt_client_tls_connect() 95 ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, in mqtt_client_tls_connect() [all …]
|
/Zephyr-latest/subsys/net/lib/tftp/ |
D | tftp_client.c | 53 static int send_data(int sock, struct tftpc *client, uint32_t block_no, const uint8_t *data_buffer, in send_data() argument 59 .fd = sock, in send_data() 76 ret = zsock_send(sock, client->tftp_buf, data_size + TFTP_HEADER_SIZE, 0); in send_data() 96 ret = zsock_recv(sock, client->tftp_buf, TFTPC_MAX_BUF_SIZE, 0); in send_data() 145 static inline int send_err(int sock, struct tftpc *client, int err_code, char *err_msg) in send_err() argument 169 return zsock_send(sock, client->tftp_buf, req_size, 0); in send_err() 175 static inline int send_ack(int sock, struct tftphdr_ack *ackhdr) in send_ack() argument 179 return zsock_send(sock, ackhdr, sizeof(struct tftphdr_ack), 0); in send_ack() 182 static int send_request(int sock, struct tftpc *client, in send_request() argument 199 ret = zsock_sendto(sock, client->tftp_buf, req_size, 0, &client->server, in send_request() [all …]
|
/Zephyr-latest/samples/net/sockets/echo_service/src/ |
D | main.c | 115 int ret, sock, opt; in setup_tcp_socket() local 117 sock = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); in setup_tcp_socket() 118 if (sock < 0) { in setup_tcp_socket() 123 ret = getsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &opt, &optlen); in setup_tcp_socket() 128 ret = setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &opt, optlen); in setup_tcp_socket() 136 if (bind(sock, (struct sockaddr *)addr, sizeof(*addr)) < 0) { in setup_tcp_socket() 141 if (listen(sock, 5) < 0) { in setup_tcp_socket() 146 return sock; in setup_tcp_socket() 152 int ret, sock, opt; in setup_udp_socket() local 154 sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); in setup_udp_socket() [all …]
|
/Zephyr-latest/tests/net/socket/service/src/ |
D | main.c | 71 struct zsock_pollfd sock[2] = { in run_test_service() local 81 sock[0].fd = s_sock_udp; in run_test_service() 82 sock[0].events = ZSOCK_POLLIN; in run_test_service() 84 ret = net_socket_service_register(udp_service, sock, ARRAY_SIZE(sock), NULL); in run_test_service() 87 sock[0].fd = s_sock_tcp; in run_test_service() 88 sock[0].events = ZSOCK_POLLIN; in run_test_service() 90 ret = net_socket_service_register(tcp_service_small, sock, ARRAY_SIZE(sock) + 1, NULL); in run_test_service() 93 ret = net_socket_service_register(tcp_service, sock, ARRAY_SIZE(sock), NULL); in run_test_service() 136 sock[1].fd = new_sock; in run_test_service() 137 sock[1].events = ZSOCK_POLLIN; in run_test_service() [all …]
|
/Zephyr-latest/subsys/net/lib/zperf/ |
D | zperf_tcp_uploader.c | 23 static ssize_t sendall(int sock, const void *buf, size_t len) in sendall() argument 26 ssize_t out_len = zsock_send(sock, buf, len, 0); in sendall() 39 static int tcp_upload(int sock, in tcp_upload() argument 69 ret = sendall(sock, sample_packet, packet_size); in tcp_upload() 128 int sock; in zperf_tcp_upload() local 135 sock = zperf_prepare_upload_sock(¶m->peer_addr, param->options.tos, in zperf_tcp_upload() 138 if (sock < 0) { in zperf_tcp_upload() 139 return sock; in zperf_tcp_upload() 142 ret = tcp_upload(sock, param->duration_ms, param->packet_size, result); in zperf_tcp_upload() 144 zsock_close(sock); in zperf_tcp_upload() [all …]
|
/Zephyr-latest/include/zephyr/net/ |
D | socket.h | 329 __syscall void *zsock_get_context_object(int sock); 369 __syscall int zsock_close(int sock); 382 __syscall int zsock_shutdown(int sock, int how); 394 __syscall int zsock_bind(int sock, const struct sockaddr *addr, 407 __syscall int zsock_connect(int sock, const struct sockaddr *addr, 420 __syscall int zsock_listen(int sock, int backlog); 432 __syscall int zsock_accept(int sock, struct sockaddr *addr, socklen_t *addrlen); 444 __syscall ssize_t zsock_sendto(int sock, const void *buf, size_t len, 458 static inline ssize_t zsock_send(int sock, const void *buf, size_t len, in zsock_send() argument 461 return zsock_sendto(sock, buf, len, flags, NULL, 0); in zsock_send() [all …]
|