-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathconf.h
executable file
·171 lines (131 loc) · 4.59 KB
/
conf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#ifndef __CONF_H__
#define __CONF_H__
#include <inttypes.h>
#include <stdint.h>
typedef uint8_t u8_t;
typedef uint16_t u16_t;
typedef uint32_t u32_t;
typedef int32_t s32_t;
#ifndef UIP_LITTLE_ENDIAN
#define UIP_LITTLE_ENDIAN 3412
#endif /* UIP_LITTLE_ENDIAN */
#ifndef UIP_BIG_ENDIAN
#define UIP_BIG_ENDIAN 1234
#endif /* UIP_BIG_ENDIAN */
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
#ifdef UIP_CONF_BYTE_ORDER
#define UIP_BYTE_ORDER (UIP_CONF_BYTE_ORDER)
#else /* UIP_CONF_BYTE_ORDER */
#define UIP_BYTE_ORDER (UIP_LITTLE_ENDIAN)
#endif /* UIP_CONF_BYTE_ORDER */
/**
* Convert 16-bit quantity from host byte order to network byte order.
*
*/
# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN
# define UIP_HTONS(n) (n)
# define UIP_HTONL(n) (n)
# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
# define UIP_HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
# define UIP_HTONL(n) (((u32_t)UIP_HTONS(n) << 16) | UIP_HTONS((u32_t)(n) >> 16))
# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
/**
* Convert 16-bit quantity from network byte order to host byte order.
*/
#ifndef UIP_NTOHS
#define UIP_NTOHS UIP_HTONS
#endif
#define UIP_CONF_IPV6 1
#define UIP_CONF_UDP 1
#define UIP_CONF_UDP_CONNS 1
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
#define UIP_CONF_BUFFER_SIZE 420
#define UIP_CONF_TCP 0
#define UIP_CONF_MAX_CONNECTIONS 3
#define UIP_CONF_MAX_LISTENPORTS 1
#define UIP_CONF_TCP_SPLIT 1
#define UIP_CONF_LOGGING 0
#define UIP_CONF_UDP_CHECKSUMS 1
#if UIP_CONF_IPV6
#define UIP_CONF_IPV6_CHECKS 1
#define UIP_CONF_IPV6_QUEUE_PKT 0
#define UIP_CONF_IPV6_REASSEMBLY 0
#define UIP_CONF_NETIF_MAX_ADDRESSES 10
#define UIP_CONF_ND6_MAX_PREFIXES 2
#define UIP_CONF_ND6_MAX_NEIGHBORS 3
#define UIP_CONF_ND6_MAX_DEFROUTERS 1
#define UIP_CONF_ICMP6 1
#endif /* UIP_CONF_ICMP6 */
#define SICSLOWPAN_CONF_FRAG 0
#define SICSLOWPAN_CONF_COMPRESSION_IPV6 0
#define SICSLOWPAN_CONF_COMPRESSION_HC1 1
#define SICSLOWPAN_CONF_COMPRESSION_HC06 2
#define SICSLOWPAN_CONF_COMPRESSION 2//SICSLOWPAN_COMPRESSION_HC06
/* Specify a minimum packet size for 6lowpan compression to be
enabled. This is needed for ContikiMAC, which needs packets to be
larger than a specified size, if no ContikiMAC header should be
used. */
#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 64 // 0: Always Compress a Packet Using SICSLOWPAN
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
#define RPL_CONF_DAO_ACK 1
#define UIP_PROTO_ICMP 1
#define UIP_PROTO_TCP 6
#define UIP_PROTO_UDP 17
#define UIP_PROTO_ICMP6 58
#define UIP_IPH_LEN 40 /* Size of IPv6 header */
#define UIP_FRAGH_LEN 8
#define UIP_UDPH_LEN 8 /* Size of UDP header */
#define UIP_ICMPH_LEN 4 /* Size of ICMP header */
#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) /* Size of IP + UDP header */
#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN
#define UIP_IPICMPH_LEN (UIP_IPH_LEN + UIP_ICMPH_LEN) /* size of ICMP + IP header */
#define uip_l3_hdr_len (UIP_IPH_LEN)
#define uip_l3_icmp_hdr_len (UIP_IPH_LEN + UIP_ICMPH_LEN)
typedef union uip_ip6addr_t {
u8_t u8[16]; /* Initializer, must come first!!! */
u16_t u16[8];
} uip_ip6addr_t;
typedef uip_ip6addr_t uip_ipaddr_t;
/*
* In IPv6 the length of the L3 headers before the transport header is
* not fixed, due to the possibility to include extension option headers
* after the IP header. hence we split here L3 and L4 headers
*/
/* The IP header */
struct uip_ip_hdr {
/* IPV6 header */
u8_t vtc;
u8_t tcflow;
u16_t flow;
u8_t len[2];
u8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr;
};
/* The ICMP headers. */
struct uip_icmp_hdr {
u8_t type, icode;
u16_t icmpchksum;
};
/* The UDP headers. */
struct uip_udp_hdr {
u16_t srcport;
u16_t destport;
u16_t udplen;
u16_t udpchksum;
};
typedef uint32_t clock_time_t;
#define CLOCK_CONF_SECOND 32
#define UIP_802154_LONGADDR_LEN 8
#define UIP_802154_SHORTADDR_LEN 2
#define UIP_LLADDR_LEN UIP_802154_LONGADDR_LEN
typedef struct uip_802154_longaddr {
u8_t addr[UIP_LLADDR_LEN];
} uip_802154_longaddr;
typedef uip_802154_longaddr uip_lladdr_t;
#define UIP_LLH_LEN 0 //no additional Link Layer headers
#define UIP_LLIPH_LEN (UIP_LLH_LEN + UIP_IPH_LEN) /* size of L2
+ IP header */
#define UIP_BUFSIZE 160 // The size of the uIP packet buffer.
#define UIP_UDP_PAYLOAD_MAX_BUFSIZE (UIP_BUFSIZE - UIP_IPUDPH_LEN) // The max size of the UDP datagram payload buffer. ( 160 - 48 )
#define CHAR_BIT 8
#endif