• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef COAP_CONFIG_H_
2 #define COAP_CONFIG_H_
3 
4 #include "contiki.h"
5 #include "contiki-lib.h"
6 #include "contiki-net.h"
7 
8 #define WITH_CONTIKI 1
9 
10 #ifndef COAP_CONSTRAINED_STACK
11 #define COAP_CONSTRAINED_STACK 1
12 #endif
13 
14 #ifndef COAP_DISABLE_TCP
15 #define COAP_DISABLE_TCP 1
16 #endif
17 
18 #define PACKAGE_STRING "libcoap"
19 #define PACKAGE_NAME "libcoap"
20 
21 #ifndef COAP_DEFAULT_PDU_SIZE
22 #define COAP_DEFAULT_PDU_SIZE 64
23 #endif /* COAP_DEFAULT_PDU_SIZE */
24 #ifndef COAP_RXBUFFER_SIZE
25 #define COAP_RXBUFFER_SIZE 64
26 #endif /* COAP_RXBUFFER_SIZE */
27 
28 /** Number of resources that can be handled by a CoAP server in addition to
29  * @c /.well-known/core */
30 #ifndef COAP_MAX_RESOURCES
31 #define COAP_MAX_RESOURCES 3
32 #endif /* COAP_MAX_RESOURCES */
33 
34 /** Number of attributes that can be handled (should be at least
35  * @c 2 * COAP_MAX_RESOURCES. to carry the content type and the
36  * resource type. */
37 #ifndef COAP_MAX_ATTRIBUTES
38 #define COAP_MAX_ATTRIBUTES 4
39 #endif /* COAP_MAX_ATTRIBUTES */
40 
41 /**
42  * Number of PDUs that can be stored simultaneously. This number
43  * includes both, the PDUs stored for retransmission as well as the
44  * PDUs received. Beware that choosing a too small value can lead to
45  * many retransmissions to be dealt with.
46  */
47 #ifndef COAP_PDU_MAXCNT
48 #define COAP_PDU_MAXCNT 4
49 #endif /* COAP_PDU_MAXCNT */
50 
51 /**
52  * Maximum number of sessions.
53  */
54 #ifndef COAP_MAX_SESSIONS
55 #define COAP_MAX_SESSIONS 2
56 #endif /* COAP_MAX_SESSIONS */
57 
58 /**
59  * Maximum number of subscriptions. Every additional subscriber costs
60  * 36 B.
61  */
62 #ifndef COAP_MAX_SUBSCRIBERS
63 #define COAP_MAX_SUBSCRIBERS 3
64 #endif /* COAP_MAX_SUBSCRIBERS */
65 
66 /**
67  * The maximum number of cache-key entries that allocate
68  * fixed-size memory blocks.
69  */
70 #ifndef COAP_MAX_CACHE_KEYS
71 #define COAP_MAX_CACHE_KEYS        (2U)
72 #endif /* COAP_MAX_CACHE_KEYS */
73 
74 /**
75  * The maximum number of cache-entry entries that allocate
76  * fixed-size memory blocks.
77  */
78 #ifndef COAP_MAX_CACHE_ENTRIES
79 #define COAP_MAX_CACHE_ENTRIES        (2U)
80 #endif /* COAP_MAX_CACHE_ENTRIES */
81 
82 /**
83  * Maximum number of large body transmissions.
84  */
85 #ifndef COAP_MAX_LG_XMIT
86 #define COAP_MAX_LG_XMIT 2
87 #endif /* COAP_MAX_LG_XMIT */
88 
89 /**
90  * Maximum number of large body client receives.
91  */
92 #ifndef COAP_MAX_LG_CRCV
93 #define COAP_MAX_LG_CRCV 2
94 #endif /* COAP_MAX_LG_CRCV */
95 
96 /**
97  * Maximum number of large body server receives.
98  */
99 #ifndef COAP_MAX_LG_SRCV
100 #define COAP_MAX_LG_SRCV 2
101 #endif /* COAP_MAX_LG_SRCV */
102 
103 /**
104  * Number of notifications that may be sent non-confirmable before a
105  * confirmable message is sent to detect if observers are alive. The
106  * maximum allowed value here is @c 15.
107  */
108 #ifndef COAP_OBS_MAX_NON
109 #define COAP_OBS_MAX_NON   5
110 #endif /* COAP_OBS_MAX_NON */
111 
112 /**
113  * Number of confirmable notifications that may fail (i.e. time out
114  * without being ACKed) before an observer is removed. The maximum
115  * value for COAP_OBS_MAX_FAIL is @c 3.
116  */
117 #ifndef COAP_OBS_MAX_FAIL
118 #define COAP_OBS_MAX_FAIL  3
119 #endif /* COAP_OBS_MAX_FAIL */
120 
121 #ifndef DEBUG
122 # define DEBUG DEBUG_PRINT
123 #endif
124 
125 #define HAVE_STRNLEN 1
126 #define HAVE_SNPRINTF 1
127 #define HAVE_STRINGS_H 1
128 
129 /* there is no file-oriented output */
130 #define COAP_DEBUG_FD NULL
131 #define COAP_ERR_FD   NULL
132 
133 #include "contiki-conf.h"
134 
135 #if (defined(PLATFORM) && PLATFORM == PLATFORM_MC1322X) || defined(CONTIKI_TARGET_ECONOTAG)
136 /* Redbee econotags get a special treatment here: endianness is set
137  * explicitly, and
138  */
139 
140 #define BYTE_ORDER UIP_LITTLE_ENDIAN
141 
142 #define HAVE_ASSERT_H
143 #define HAVE_UNISTD_H
144 #define HAVE_SYS_TYPES_H
145 #define HAVE_LIMITS_H
146 #endif /* PLATFORM_MC1322X || CONTIKI_TARGET_ECONOTAG */
147 
148 #if defined(TMOTE_SKY) || defined(CONTIKI_TARGET_SKY) || defined(CONTIKI_TARGET_WISMOTE)
149 /* Need to set the byte order for TMote Sky explicitely */
150 
151 #define BYTE_ORDER UIP_LITTLE_ENDIAN
152 #undef COAP_DEFAULT_PDU_SIZE
153 #undef COAP_RXBUFFER_SIZE
154 #define COAP_DEFAULT_PDU_SIZE 100
155 #define COAP_RXBUFFER_SIZE 100
156 
157 #define COAP_MAX_BLOCK_SZX 2
158 
159 typedef int ssize_t;
160 typedef void FILE;
161 
162 #define HAVE_LIMITS_H 1
163 #undef HAVE_ASSERT_H
164 #define HAVE_VPRINTF 1
165 #endif /* defined(TMOTE_SKY) */
166 
167 #ifdef CONTIKI_TARGET_MINIMAL_NET
168 #undef COAP_DEFAULT_PDU_SIZE
169 #undef COAP_RXBUFFER_SIZE
170 #define COAP_DEFAULT_PDU_SIZE 1152
171 #define COAP_RXBUFFER_SIZE 1472
172 #define HAVE_ASSERT_H 1
173 #define HAVE_VPRINTF 1
174 #define HAVE_SYS_TYPES_H 1
175 #endif /* CONTIKI_TARGET_MINIMAL_NET */
176 
177 #ifdef CONTIKI_TARGET_CC2538DK
178 #define BYTE_ORDER UIP_LITTLE_ENDIAN
179 #undef COAP_DEFAULT_PDU_SIZE
180 #undef COAP_RXBUFFER_SIZE
181 #define COAP_DEFAULT_PDU_SIZE 100
182 #define COAP_RXBUFFER_SIZE 100
183 
184 #undef COAP_MAX_BLOCK_SZX
185 #define COAP_MAX_BLOCK_SZX 2
186 
187 #define HAVE_LIMITS_H 1
188 #endif /* CONTIKI_TARGET_CC2538DK */
189 
190 #ifndef BYTE_ORDER
191 # ifdef UIP_CONF_BYTE_ORDER
192 #  define BYTE_ORDER UIP_CONF_BYTE_ORDER
193 # else
194 #  error "UIP_CONF_BYTE_ORDER not defined"
195 # endif /* UIP_CONF_BYTE_ORDER */
196 #endif /* BYTE_ORDER */
197 
198 /* Define assert() as empty directive unless HAVE_ASSERT_H is given. */
199 #ifndef HAVE_ASSERT_H
200 # define assert(x)
201 #endif
202 
203 #define ntohs uip_ntohs
204 
205 #include <stdio.h>
206 #define coap_log(fd, ...) printf(__VA_ARGS__)
207 
208 #endif /* COAP_CONFIG_H_ */
209 
210