The friendly Operating System for the Internet of Things
conn/udp.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef NET_CONN_UDP_H
22 #define NET_CONN_UDP_H
23 
24 #include <stdint.h>
25 #include <stdlib.h>
26 
27 #ifdef MODULE_GNRC_CONN_UDP
28 #include "net/gnrc/conn.h"
29 #endif
30 
31 #ifdef MODULE_LWIP_CONN_UDP
32 #include "lwip/conn.h"
33 #endif
34 
35 #ifdef MODULE_EMB6_CONN_UDP
36 #include "emb6/conn/udp.h"
37 #endif
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
46 struct conn_udp;
47 
51 typedef struct conn_udp conn_udp_t;
52 
71 int conn_udp_create(conn_udp_t *conn, const void *addr, size_t addr_len, int family,
72  uint16_t port);
73 
79 void conn_udp_close(conn_udp_t *conn);
80 
94 int conn_udp_getlocaladdr(conn_udp_t *conn, void *addr, uint16_t *port);
95 
119 int conn_udp_recvfrom(conn_udp_t *conn, void *data, size_t max_len, void *addr, size_t *addr_len,
120  uint16_t *port);
121 
142 int conn_udp_sendto(const void *data, size_t len, const void *src, size_t src_len,
143  const void *dst, size_t dst_len, int family, uint16_t sport,
144  uint16_t dport);
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif /* NET_CONN_UDP4_H */
151 
int conn_udp_create(conn_udp_t *conn, const void *addr, size_t addr_len, int family, uint16_t port)
Creates a new UDP connection object.
UDP connection type.
Definition: gnrc/conn.h:64
void conn_udp_close(conn_udp_t *conn)
Closes a UDP connection.
int conn_udp_getlocaladdr(conn_udp_t *conn, void *addr, uint16_t *port)
Gets the local address of a UDP connection.
int conn_udp_recvfrom(conn_udp_t *conn, void *data, size_t max_len, void *addr, size_t *addr_len, uint16_t *port)
Receives a UDP message.
GNRC-specific types and function definitions.
int conn_udp_sendto(const void *data, size_t len, const void *src, size_t src_len, const void *dst, size_t dst_len, int family, uint16_t sport, uint16_t dport)
Sends a UDP message.
stdlib.h wrapper for MSP430