udp.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Alexander Aring <aar@pengutronix.de>
3  * Freie Universit├Ąt Berlin
4  * HAW Hamburg
5  * Kaspar Schleiser <kaspar@schleiser.de>
6  *
7  * This file is subject to the terms and conditions of the GNU Lesser
8  * General Public License v2.1. See the file LICENSE in the top level
9  * directory for more details.
10  */
11 
268 #ifndef NET_SOCK_UDP_H
269 #define NET_SOCK_UDP_H
270 
271 #include <assert.h>
272 #include <stdint.h>
273 #include <stdlib.h>
274 #include <sys/types.h>
275 
276 /* net/sock/async/types.h included by net/sock.h needs to re-typedef the
277  * `sock_ip_t` to prevent cyclic includes */
278 #if defined (__clang__)
279 # pragma clang diagnostic push
280 # pragma clang diagnostic ignored "-Wtypedef-redefinition"
281 #endif
282 
283 #include "net/sock.h"
284 
285 #ifdef __cplusplus
286 extern "C" {
287 #endif
288 
289 typedef struct _sock_tl_ep sock_udp_ep_t;
297 typedef struct sock_udp sock_udp_t;
298 
299 #if defined (__clang__)
300 # pragma clang diagnostic pop
301 #endif
302 
346  const sock_udp_ep_t *remote, uint16_t flags);
347 
356 
369 
381 
413 ssize_t sock_udp_recv(sock_udp_t *sock, void *data, size_t max_len,
414  uint32_t timeout, sock_udp_ep_t *remote);
415 
458 ssize_t sock_udp_recv_buf(sock_udp_t *sock, void **data, void **buf_ctx,
459  uint32_t timeout, sock_udp_ep_t *remote);
460 
494 ssize_t sock_udp_send(sock_udp_t *sock, const void *data, size_t len,
495  const sock_udp_ep_t *remote);
496 
497 #include "sock_types.h"
498 
499 #ifdef __cplusplus
500 }
501 #endif
502 
503 #endif /* NET_SOCK_UDP_H */
504 
int sock_udp_get_remote(sock_udp_t *sock, sock_udp_ep_t *ep)
Gets the remote end point of a UDP sock object.
sock_udp_ep_t remote
remote end-point
Definition: sock_types.h:115
int sock_udp_create(sock_udp_t *sock, const sock_udp_ep_t *local, const sock_udp_ep_t *remote, uint16_t flags)
Creates a new UDP sock object.
const void * data
data of received packet
Definition: sock_types.h:58
void sock_udp_close(sock_udp_t *sock)
Closes a UDP sock object.
ssize_t sock_udp_send(sock_udp_t *sock, const void *data, size_t len, const sock_udp_ep_t *remote)
Sends a UDP message to remote end point.
int sock_udp_get_local(sock_udp_t *sock, sock_udp_ep_t *ep)
Gets the local end point of a UDP sock object.
POSIX.1-2008 compliant version of the assert macro.
sock_udp_ep_t local
local end-point
Definition: sock_types.h:114
ssize_t sock_udp_recv_buf(sock_udp_t *sock, void **data, void **buf_ctx, uint32_t timeout, sock_udp_ep_t *remote)
Provides stack-internal buffer space containing a UDP message from a remote end point.
Common IP-based transport layer end point.
Definition: sock.h:213
Common sock API definitions.
ssize_t sock_udp_recv(sock_udp_t *sock, void *data, size_t max_len, uint32_t timeout, sock_udp_ep_t *remote)
Receives a UDP message from a remote end point.
uint16_t flags
option flags
Definition: sock_types.h:116
UDP sock API definition for emb6
Definition: sock_types.h:50
stdlib.h wrapper for MSP430
struct udp_socket sock
emb6 internal socket
Definition: sock_types.h:51