Contiki-NG
coap-conf.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the Institute nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * This file is part of the Contiki operating system.
30 */
31
32/**
33 * \file
34 * Collection of default configuration values.
35 * \author
36 * Matthias Kovatsch <kovatsch@inf.ethz.ch>
37 */
38
39/**
40 * \addtogroup coap
41 * @{
42 */
43
44#ifndef COAP_CONF_H_
45#define COAP_CONF_H_
46
47#include "contiki.h"
48
49/*
50 * The maximum buffer size that is provided for resource responses and must be
51 * respected due to the limited IP buffer. Larger data must be handled by the
52 * resource and will be sent chunk-wise through a TCP stream or CoAP blocks.
53 */
54#ifndef COAP_MAX_CHUNK_SIZE
55#ifdef REST_MAX_CHUNK_SIZE
56#define COAP_MAX_CHUNK_SIZE REST_MAX_CHUNK_SIZE
57#else /* REST_MAX_CHUNK_SIZE */
58#define COAP_MAX_CHUNK_SIZE 64
59#endif /* REST_MAX_CHUNK_SIZE */
60#endif /* COAP_MAX_CHUNK_SIZE */
61
62/* Define REST_MAX_CHUNK_SIZE for backward compatibility */
63#ifndef REST_MAX_CHUNK_SIZE
64#define REST_MAX_CHUNK_SIZE COAP_MAX_CHUNK_SIZE
65#endif /* REST_MAX_CHUNK_SIZE */
66
67/* Features that can be disabled to achieve smaller memory footprint */
68#ifndef COAP_LINK_FORMAT_FILTERING
69#define COAP_LINK_FORMAT_FILTERING 0
70#endif /* COAP_LINK_FORMAT_FILTERING */
71
72#ifndef COAP_PROXY_OPTION_PROCESSING
73#define COAP_PROXY_OPTION_PROCESSING 0
74#endif /* COAP_PROXY_OPTION_PROCESSING */
75
76/* Listening port for the CoAP REST Engine */
77#ifndef COAP_SERVER_PORT
78#define COAP_SERVER_PORT COAP_DEFAULT_PORT
79#endif /* COAP_SERVER_PORT */
80
81/* The number of concurrent messages that can be stored for retransmission in the transaction layer. */
82#ifndef COAP_MAX_OPEN_TRANSACTIONS
83#define COAP_MAX_OPEN_TRANSACTIONS 4
84#endif /* COAP_MAX_OPEN_TRANSACTIONS */
85
86/* Maximum number of failed request attempts before action */
87#ifndef COAP_MAX_ATTEMPTS
88#define COAP_MAX_ATTEMPTS 4
89#endif /* COAP_MAX_ATTEMPTS */
90
91/* Conservative size limit, as not all options have to be set at the same time. Check when Proxy-Uri option is used */
92#ifndef COAP_MAX_HEADER_SIZE /* Hdr CoF If-Match Obs Blo strings */
93#define COAP_MAX_HEADER_SIZE (4 + COAP_TOKEN_LEN + 3 + 1 + COAP_ETAG_LEN + 4 + 4 + 30) /* 65 */
94#endif /* COAP_MAX_HEADER_SIZE */
95
96/* Number of observer slots (each takes abot xxx bytes) */
97#ifndef COAP_MAX_OBSERVERS
98#define COAP_MAX_OBSERVERS COAP_MAX_OPEN_TRANSACTIONS - 1
99#endif /* COAP_MAX_OBSERVERS */
100
101/* Interval in notifies in which NON notifies are changed to CON notifies to check client. */
102#ifdef COAP_CONF_OBSERVE_REFRESH_INTERVAL
103#define COAP_OBSERVE_REFRESH_INTERVAL COAP_CONF_OBSERVE_REFRESH_INTERVAL
104#else
105#define COAP_OBSERVE_REFRESH_INTERVAL 20
106#endif /* COAP_OBSERVE_REFRESH_INTERVAL */
107
108/* Maximal length of observable URL */
109#ifdef COAP_CONF_OBSERVER_URL_LEN
110#define COAP_OBSERVER_URL_LEN COAP_CONF_OBSERVER_URL_LEN
111#else
112#define COAP_OBSERVER_URL_LEN 20
113#endif
114
115#endif /* COAP_CONF_H_ */
116/** @} */