|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (c) 2015 Dipl.-Ing. Tobias Rohde, http://www.lobaro.com |
| 3 | + * |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | + * of this software and associated documentation files (the "Software"), to deal |
| 6 | + * in the Software without restriction, including without limitation the rights |
| 7 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 | + * copies of the Software, and to permit persons to whom the Software is |
| 9 | + * furnished to do so, subject to the following conditions: |
| 10 | + * |
| 11 | + * The above copyright notice and this permission notice shall be included in |
| 12 | + * all copies or substantial portions of the Software. |
| 13 | + * |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 20 | + * THE SOFTWARE. |
| 21 | + *******************************************************************************/ |
| 22 | + |
| 23 | +#ifndef COAP_H_ |
| 24 | +#define COAP_H_ |
| 25 | + |
| 26 | +#ifdef __cplusplus |
| 27 | +extern "C" { |
| 28 | +#endif |
| 29 | + |
| 30 | +//"glue" and actual system related functions |
| 31 | +//go there to see what to do adapting the library to your platform |
| 32 | +#include "interface/coap_interface.h" |
| 33 | +#include "liblobaro_coap.h" |
| 34 | + |
| 35 | +//Internal stack functions |
| 36 | + |
| 37 | +/* Determine if time a is "after" time b. |
| 38 | + * Times a and b are unsigned, but performing the comparison |
| 39 | + * using signed arithmetic automatically handles wrapping. |
| 40 | + * The disambiguation window is half the maximum value. */ |
| 41 | +#if (configUSE_16_BIT_TICKS == 1) |
| 42 | +#define timeAfter(a,b) (((int16_t)(a) - (int16_t)(b)) >= 0) |
| 43 | +#else |
| 44 | +#define timeAfter(a,b) (((int32_t)(a) - (int32_t)(b)) >= 0) |
| 45 | +#endif |
| 46 | + |
| 47 | +#define MAX_PAYLOAD_SIZE (256) //should not exceed 1024 bytes (see 4.6 RFC7252) (must be power of 2 to fit with blocksize option!) |
| 48 | + |
| 49 | +#define COAP_VERSION (1) |
| 50 | + |
| 51 | +//V1.2 |
| 52 | +#define LOBARO_COAP_VERSION_MAJOR (1) |
| 53 | +#define LOBARO_COAP_VERSION_MINOR (2) |
| 54 | + |
| 55 | +#include "coap_options.h" |
| 56 | +#include "coap_message.h" |
| 57 | +#include "option-types/coap_option_blockwise.h" |
| 58 | +#include "option-types/coap_option_ETag.h" |
| 59 | +#include "option-types/coap_option_cf.h" |
| 60 | +#include "option-types/coap_option_uri.h" |
| 61 | +#include "option-types/coap_option_observe.h" |
| 62 | +#include "coap_resource.h" |
| 63 | +#include "coap_interaction.h" |
| 64 | +#include "coap_main.h" |
| 65 | +#include "diagnostic.h" |
| 66 | + |
| 67 | + |
| 68 | +#ifdef __cplusplus |
| 69 | + } |
| 70 | + #endif |
| 71 | + |
| 72 | +#endif /* COAP_H_ */ |
0 commit comments