sock/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 #include "net/sock.h"
277 
278 #ifdef __cplusplus
279 extern "C" {
280 #endif
281 
282 typedef struct _sock_tl_ep sock_udp_ep_t;
290 typedef struct sock_udp sock_udp_t;
291 
334  const sock_udp_ep_t *remote, uint16_t flags);
335 
343 void sock_udp_close(sock_udp_t *sock);
344 
357 
369 
399 ssize_t sock_udp_recv(sock_udp_t *sock, void *data, size_t max_len,
400  uint32_t timeout, sock_udp_ep_t *remote);
401 
433 ssize_t sock_udp_send(sock_udp_t *sock, const void *data, size_t len,
434  const sock_udp_ep_t *remote);
435 
436 #include "sock_types.h"
437 
438 #ifdef __cplusplus
439 }
440 #endif
441 
442 #endif /* NET_SOCK_UDP_H */
443 
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:74
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.
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.
signed int ssize_t
Used for a count of bytes or an error indication.
Definition: msp430_types.h:89
sock_udp_ep_t local
local end-point
Definition: sock_types.h:73
GNRC-specific types and function definitions.
Common IP-based transport layer end point.
Definition: sock.h:195
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:75
UDP sock type.
Definition: sock_types.h:71
stdlib.h wrapper for MSP430