sock_types.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Freie Universit├Ąt Berlin
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 
20 #ifndef SOCK_TYPES_H
21 #define SOCK_TYPES_H
22 
23 #include <stdatomic.h>
24 
25 #include "mbox.h"
26 #include "mutex.h"
27 #include "net/ipv6/addr.h"
28 
29 #include "uip.h"
30 #include "udp-socket.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
39 #ifndef SOCK_MBOX_SIZE
40 #define SOCK_MBOX_SIZE (2)
41 #endif
42 
43 #ifndef SOCK_HAS_IPV6
44 #error "emb6 only runs with IPv6 support"
45 #endif
46 
50 struct sock_udp {
51  struct udp_socket sock;
56  struct {
57  const ipv6_addr_t *src;
58  const void *data;
59  size_t datalen;
60  uint16_t src_port;
61  } recv_info;
62 };
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif /* SOCK_TYPES_H */
69 
mbox_t mbox
mbox for receiving
Definition: sock_types.h:53
Definitions for IPv6 addresses.
Mailbox struct definition.
Definition: mbox.h:39
Mailbox API.
const void * data
data of received packet
Definition: sock_types.h:58
struct sock_udp::@210 recv_info
info on received packet
const ipv6_addr_t * src
source address
Definition: sock_types.h:57
atomic_int receivers
current number of recv calls
Definition: sock_types.h:55
msg_t mbox_queue[SOCK_MBOX_SIZE]
queue for mbox
Definition: sock_types.h:54
Describes a message object which can be sent between threads.
Definition: msg.h:184
Type with the same alignment and size as atomic_int
UDP sock API definition for emb6
Definition: sock_types.h:50
Mutex for thread synchronization.
mutex_t mutex
mutex for the connection
Definition: sock_types.h:52
#define SOCK_MBOX_SIZE
Size for struct sock_udp::mbox_queue.
Definition: sock_types.h:40
size_t datalen
length of received packet data
Definition: sock_types.h:59
Data type to represent an IPv6 address.
Definition: addr.h:74
Mutex structure.
Definition: mutex.h:36
struct udp_socket sock
emb6 internal socket
Definition: sock_types.h:51
uint16_t src_port
source port
Definition: sock_types.h:60