NSDL library for Cortex M0 platforms
sn_coap_header.h@0:cbf069c4db24, 2015-02-22 (annotated)
- Committer:
- ansond
- Date:
- Sun Feb 22 04:39:16 2015 +0000
- Revision:
- 0:cbf069c4db24
initial checkin;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:cbf069c4db24 | 1 | /** |
ansond | 0:cbf069c4db24 | 2 | * \file sn_coap_header.h |
ansond | 0:cbf069c4db24 | 3 | * |
ansond | 0:cbf069c4db24 | 4 | * \brief CoAP C-library User header interface header file |
ansond | 0:cbf069c4db24 | 5 | * |
ansond | 0:cbf069c4db24 | 6 | * Created on: Jun 30, 2011 |
ansond | 0:cbf069c4db24 | 7 | * Author: tero |
ansond | 0:cbf069c4db24 | 8 | * |
ansond | 0:cbf069c4db24 | 9 | * \note Supports draft-ietf-core-coap-18 |
ansond | 0:cbf069c4db24 | 10 | */ |
ansond | 0:cbf069c4db24 | 11 | |
ansond | 0:cbf069c4db24 | 12 | #ifndef SN_COAP_HEADER_H_ |
ansond | 0:cbf069c4db24 | 13 | #define SN_COAP_HEADER_H_ |
ansond | 0:cbf069c4db24 | 14 | |
ansond | 0:cbf069c4db24 | 15 | #ifdef __cplusplus |
ansond | 0:cbf069c4db24 | 16 | extern "C" { |
ansond | 0:cbf069c4db24 | 17 | #endif |
ansond | 0:cbf069c4db24 | 18 | |
ansond | 0:cbf069c4db24 | 19 | /* * * * * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 20 | /* * * * ENUMERATIONS * * * */ |
ansond | 0:cbf069c4db24 | 21 | /* * * * * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 22 | |
ansond | 0:cbf069c4db24 | 23 | /** |
ansond | 0:cbf069c4db24 | 24 | * \brief Enumeration for CoAP Version |
ansond | 0:cbf069c4db24 | 25 | */ |
ansond | 0:cbf069c4db24 | 26 | typedef enum coap_version_ |
ansond | 0:cbf069c4db24 | 27 | { |
ansond | 0:cbf069c4db24 | 28 | COAP_VERSION_1 = 0x40, |
ansond | 0:cbf069c4db24 | 29 | COAP_VERSION_UNKNOWN = 0xFF |
ansond | 0:cbf069c4db24 | 30 | } coap_version_e; |
ansond | 0:cbf069c4db24 | 31 | |
ansond | 0:cbf069c4db24 | 32 | /** |
ansond | 0:cbf069c4db24 | 33 | * \brief Enumeration for CoAP Message type, used in CoAP Header |
ansond | 0:cbf069c4db24 | 34 | */ |
ansond | 0:cbf069c4db24 | 35 | typedef enum sn_coap_msg_type_ |
ansond | 0:cbf069c4db24 | 36 | { |
ansond | 0:cbf069c4db24 | 37 | COAP_MSG_TYPE_CONFIRMABLE = 0x00, /**< Reliable Request messages */ |
ansond | 0:cbf069c4db24 | 38 | COAP_MSG_TYPE_NON_CONFIRMABLE = 0x10, /**< Non-reliable Request and Response messages */ |
ansond | 0:cbf069c4db24 | 39 | COAP_MSG_TYPE_ACKNOWLEDGEMENT = 0x20, /**< Response to a Confirmable Request */ |
ansond | 0:cbf069c4db24 | 40 | COAP_MSG_TYPE_RESET = 0x30 /**< Answer a Bad Request */ |
ansond | 0:cbf069c4db24 | 41 | } sn_coap_msg_type_e; |
ansond | 0:cbf069c4db24 | 42 | |
ansond | 0:cbf069c4db24 | 43 | /** |
ansond | 0:cbf069c4db24 | 44 | * \brief Enumeration for CoAP Message code, used in CoAP Header |
ansond | 0:cbf069c4db24 | 45 | */ |
ansond | 0:cbf069c4db24 | 46 | typedef enum sn_coap_msg_code_ |
ansond | 0:cbf069c4db24 | 47 | { |
ansond | 0:cbf069c4db24 | 48 | COAP_MSG_CODE_EMPTY = 0, |
ansond | 0:cbf069c4db24 | 49 | COAP_MSG_CODE_REQUEST_GET = 1, |
ansond | 0:cbf069c4db24 | 50 | COAP_MSG_CODE_REQUEST_POST = 2, |
ansond | 0:cbf069c4db24 | 51 | COAP_MSG_CODE_REQUEST_PUT = 3, |
ansond | 0:cbf069c4db24 | 52 | COAP_MSG_CODE_REQUEST_DELETE = 4, |
ansond | 0:cbf069c4db24 | 53 | |
ansond | 0:cbf069c4db24 | 54 | COAP_MSG_CODE_RESPONSE_CREATED = 65, |
ansond | 0:cbf069c4db24 | 55 | COAP_MSG_CODE_RESPONSE_DELETED = 66, |
ansond | 0:cbf069c4db24 | 56 | COAP_MSG_CODE_RESPONSE_VALID = 67, |
ansond | 0:cbf069c4db24 | 57 | COAP_MSG_CODE_RESPONSE_CHANGED = 68, |
ansond | 0:cbf069c4db24 | 58 | COAP_MSG_CODE_RESPONSE_CONTENT = 69, |
ansond | 0:cbf069c4db24 | 59 | COAP_MSG_CODE_RESPONSE_BAD_REQUEST = 128, |
ansond | 0:cbf069c4db24 | 60 | COAP_MSG_CODE_RESPONSE_UNAUTHORIZED = 129, |
ansond | 0:cbf069c4db24 | 61 | COAP_MSG_CODE_RESPONSE_BAD_OPTION = 130, |
ansond | 0:cbf069c4db24 | 62 | COAP_MSG_CODE_RESPONSE_FORBIDDEN = 131, |
ansond | 0:cbf069c4db24 | 63 | COAP_MSG_CODE_RESPONSE_NOT_FOUND = 132, |
ansond | 0:cbf069c4db24 | 64 | COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED = 133, |
ansond | 0:cbf069c4db24 | 65 | COAP_MSG_CODE_RESPONSE_NOT_ACCEPTABLE = 134, |
ansond | 0:cbf069c4db24 | 66 | COAP_MSG_CODE_RESPONSE_REQUEST_ENTITY_INCOMPLETE = 136, |
ansond | 0:cbf069c4db24 | 67 | COAP_MSG_CODE_RESPONSE_PRECONDITION_FAILED = 140, |
ansond | 0:cbf069c4db24 | 68 | COAP_MSG_CODE_RESPONSE_REQUEST_ENTITY_TOO_LARGE = 141, |
ansond | 0:cbf069c4db24 | 69 | COAP_MSG_CODE_RESPONSE_UNSUPPORTED_CONTENT_FORMAT = 143, |
ansond | 0:cbf069c4db24 | 70 | COAP_MSG_CODE_RESPONSE_INTERNAL_SERVER_ERROR = 160, |
ansond | 0:cbf069c4db24 | 71 | COAP_MSG_CODE_RESPONSE_NOT_IMPLEMENTED = 161, |
ansond | 0:cbf069c4db24 | 72 | COAP_MSG_CODE_RESPONSE_BAD_GATEWAY = 162, |
ansond | 0:cbf069c4db24 | 73 | COAP_MSG_CODE_RESPONSE_SERVICE_UNAVAILABLE = 163, |
ansond | 0:cbf069c4db24 | 74 | COAP_MSG_CODE_RESPONSE_GATEWAY_TIMEOUT = 164, |
ansond | 0:cbf069c4db24 | 75 | COAP_MSG_CODE_RESPONSE_PROXYING_NOT_SUPPORTED = 165 |
ansond | 0:cbf069c4db24 | 76 | } sn_coap_msg_code_e; |
ansond | 0:cbf069c4db24 | 77 | |
ansond | 0:cbf069c4db24 | 78 | /** |
ansond | 0:cbf069c4db24 | 79 | * \brief Enumeration for CoAP Option number, used in CoAP Header |
ansond | 0:cbf069c4db24 | 80 | */ |
ansond | 0:cbf069c4db24 | 81 | typedef enum sn_coap_option_numbers_ |
ansond | 0:cbf069c4db24 | 82 | { |
ansond | 0:cbf069c4db24 | 83 | COAP_OPTION_IF_MATCH = 1, |
ansond | 0:cbf069c4db24 | 84 | COAP_OPTION_URI_HOST = 3, |
ansond | 0:cbf069c4db24 | 85 | COAP_OPTION_ETAG = 4, |
ansond | 0:cbf069c4db24 | 86 | COAP_OPTION_IF_NONE_MATCH = 5, |
ansond | 0:cbf069c4db24 | 87 | COAP_OPTION_OBSERVE = 6, |
ansond | 0:cbf069c4db24 | 88 | COAP_OPTION_URI_PORT = 7, |
ansond | 0:cbf069c4db24 | 89 | COAP_OPTION_LOCATION_PATH = 8, |
ansond | 0:cbf069c4db24 | 90 | COAP_OPTION_URI_PATH = 11, |
ansond | 0:cbf069c4db24 | 91 | COAP_OPTION_CONTENT_FORMAT = 12, |
ansond | 0:cbf069c4db24 | 92 | COAP_OPTION_MAX_AGE = 14, |
ansond | 0:cbf069c4db24 | 93 | COAP_OPTION_URI_QUERY = 15, |
ansond | 0:cbf069c4db24 | 94 | COAP_OPTION_ACCEPT = 17, |
ansond | 0:cbf069c4db24 | 95 | COAP_OPTION_LOCATION_QUERY = 20, |
ansond | 0:cbf069c4db24 | 96 | COAP_OPTION_BLOCK2 = 23, |
ansond | 0:cbf069c4db24 | 97 | COAP_OPTION_BLOCK1 = 27, |
ansond | 0:cbf069c4db24 | 98 | COAP_OPTION_PROXY_URI = 35, |
ansond | 0:cbf069c4db24 | 99 | COAP_OPTION_PROXY_SCHEME = 39, |
ansond | 0:cbf069c4db24 | 100 | COAP_OPTION_SIZE1 = 60 |
ansond | 0:cbf069c4db24 | 101 | // 128 = (Reserved) |
ansond | 0:cbf069c4db24 | 102 | // 132 = (Reserved) |
ansond | 0:cbf069c4db24 | 103 | // 136 = (Reserved) |
ansond | 0:cbf069c4db24 | 104 | } sn_coap_option_numbers_e; |
ansond | 0:cbf069c4db24 | 105 | |
ansond | 0:cbf069c4db24 | 106 | /** |
ansond | 0:cbf069c4db24 | 107 | * \brief Enumeration for CoAP Content Format codes |
ansond | 0:cbf069c4db24 | 108 | */ |
ansond | 0:cbf069c4db24 | 109 | typedef enum sn_coap_content_format_ |
ansond | 0:cbf069c4db24 | 110 | { |
ansond | 0:cbf069c4db24 | 111 | COAP_CT_NONE = -1, |
ansond | 0:cbf069c4db24 | 112 | COAP_CT_TEXT_PLAIN = 0, |
ansond | 0:cbf069c4db24 | 113 | COAP_CT_LINK_FORMAT = 40, |
ansond | 0:cbf069c4db24 | 114 | COAP_CT_XML = 41, |
ansond | 0:cbf069c4db24 | 115 | COAP_CT_OCTET_STREAM = 42, |
ansond | 0:cbf069c4db24 | 116 | COAP_CT_EXI = 47, |
ansond | 0:cbf069c4db24 | 117 | COAP_CT_JSON = 50, |
ansond | 0:cbf069c4db24 | 118 | } sn_coap_content_format_e; |
ansond | 0:cbf069c4db24 | 119 | |
ansond | 0:cbf069c4db24 | 120 | /** |
ansond | 0:cbf069c4db24 | 121 | * \brief Enumeration for CoAP status, used in CoAP Header |
ansond | 0:cbf069c4db24 | 122 | */ |
ansond | 0:cbf069c4db24 | 123 | typedef enum sn_coap_status_ |
ansond | 0:cbf069c4db24 | 124 | { |
ansond | 0:cbf069c4db24 | 125 | COAP_STATUS_OK = 0, /**< Default value is OK */ |
ansond | 0:cbf069c4db24 | 126 | COAP_STATUS_PARSER_ERROR_IN_HEADER = 1, /**< CoAP will send Reset message to invalid message sender */ |
ansond | 0:cbf069c4db24 | 127 | COAP_STATUS_PARSER_DUPLICATED_MSG = 2, /**< CoAP will send Acknowledgement message to duplicated message sender */ |
ansond | 0:cbf069c4db24 | 128 | COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVING = 3, /**< User will get whole message after all message blocks received. |
ansond | 0:cbf069c4db24 | 129 | User must release messages with this status. */ |
ansond | 0:cbf069c4db24 | 130 | COAP_STATUS_PARSER_BLOCKWISE_ACK = 4, /**< Acknowledgement for sent Blockwise message received */ |
ansond | 0:cbf069c4db24 | 131 | COAP_STATUS_PARSER_BLOCKWISE_MSG_REJECTED = 5, /**< Blockwise message received but not supported by compiling switch */ |
ansond | 0:cbf069c4db24 | 132 | COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVED = 6 /**< Blockwise message fully received and returned to app. |
ansond | 0:cbf069c4db24 | 133 | User must take care of releasing whole payload of the blockwise messages */ |
ansond | 0:cbf069c4db24 | 134 | } sn_coap_status_e; |
ansond | 0:cbf069c4db24 | 135 | |
ansond | 0:cbf069c4db24 | 136 | |
ansond | 0:cbf069c4db24 | 137 | /* * * * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 138 | /* * * * STRUCTURES * * * */ |
ansond | 0:cbf069c4db24 | 139 | /* * * * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 140 | |
ansond | 0:cbf069c4db24 | 141 | /** |
ansond | 0:cbf069c4db24 | 142 | * \brief Structure for CoAP Options |
ansond | 0:cbf069c4db24 | 143 | */ |
ansond | 0:cbf069c4db24 | 144 | typedef struct sn_coap_options_list_ |
ansond | 0:cbf069c4db24 | 145 | { |
ansond | 0:cbf069c4db24 | 146 | |
ansond | 0:cbf069c4db24 | 147 | uint8_t max_age_len; /**< 0-4 bytes. */ |
ansond | 0:cbf069c4db24 | 148 | uint8_t *max_age_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 149 | |
ansond | 0:cbf069c4db24 | 150 | uint16_t proxy_uri_len; /**< 1-1034 bytes. */ |
ansond | 0:cbf069c4db24 | 151 | uint8_t *proxy_uri_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 152 | |
ansond | 0:cbf069c4db24 | 153 | uint8_t etag_len; /**< 1-8 bytes. Repeatable */ |
ansond | 0:cbf069c4db24 | 154 | uint8_t *etag_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 155 | |
ansond | 0:cbf069c4db24 | 156 | uint16_t uri_host_len; /**< 1-255 bytes. */ |
ansond | 0:cbf069c4db24 | 157 | uint8_t *uri_host_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 158 | |
ansond | 0:cbf069c4db24 | 159 | uint16_t location_path_len; /**< 0-255 bytes. Repeatable */ |
ansond | 0:cbf069c4db24 | 160 | uint8_t *location_path_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 161 | |
ansond | 0:cbf069c4db24 | 162 | uint8_t uri_port_len; /**< 0-2 bytes. */ |
ansond | 0:cbf069c4db24 | 163 | uint8_t *uri_port_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 164 | |
ansond | 0:cbf069c4db24 | 165 | uint16_t location_query_len; /**< 0-255 bytes. Repeatable */ |
ansond | 0:cbf069c4db24 | 166 | uint8_t *location_query_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 167 | |
ansond | 0:cbf069c4db24 | 168 | uint8_t observe; |
ansond | 0:cbf069c4db24 | 169 | uint8_t observe_len; /**< 0-2 bytes. */ |
ansond | 0:cbf069c4db24 | 170 | uint8_t *observe_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 171 | |
ansond | 0:cbf069c4db24 | 172 | uint8_t accept_len; /**< 0-2 bytes. Repeatable */ |
ansond | 0:cbf069c4db24 | 173 | uint8_t *accept_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 174 | |
ansond | 0:cbf069c4db24 | 175 | uint16_t uri_query_len; /**< 1-255 bytes. Repeatable */ |
ansond | 0:cbf069c4db24 | 176 | uint8_t *uri_query_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 177 | |
ansond | 0:cbf069c4db24 | 178 | uint8_t block1_len; /**< 0-3 bytes. */ |
ansond | 0:cbf069c4db24 | 179 | uint8_t *block1_ptr; /**< Not for User */ |
ansond | 0:cbf069c4db24 | 180 | |
ansond | 0:cbf069c4db24 | 181 | uint8_t block2_len; /**< 0-3 bytes. */ |
ansond | 0:cbf069c4db24 | 182 | uint8_t *block2_ptr; /**< Not for User */ |
ansond | 0:cbf069c4db24 | 183 | } sn_coap_options_list_s; |
ansond | 0:cbf069c4db24 | 184 | |
ansond | 0:cbf069c4db24 | 185 | |
ansond | 0:cbf069c4db24 | 186 | /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
ansond | 0:cbf069c4db24 | 187 | /* !!! Main CoAP message struct !!! */ |
ansond | 0:cbf069c4db24 | 188 | /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ |
ansond | 0:cbf069c4db24 | 189 | |
ansond | 0:cbf069c4db24 | 190 | /** |
ansond | 0:cbf069c4db24 | 191 | * \brief Main CoAP message struct |
ansond | 0:cbf069c4db24 | 192 | */ |
ansond | 0:cbf069c4db24 | 193 | typedef struct sn_coap_hdr_ |
ansond | 0:cbf069c4db24 | 194 | { |
ansond | 0:cbf069c4db24 | 195 | sn_coap_status_e coap_status; /**< Used for telling to User special cases when parsing message */ |
ansond | 0:cbf069c4db24 | 196 | |
ansond | 0:cbf069c4db24 | 197 | /* * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 198 | /* * * * Header * * * */ |
ansond | 0:cbf069c4db24 | 199 | /* * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 200 | |
ansond | 0:cbf069c4db24 | 201 | sn_coap_msg_type_e msg_type; /**< Confirmable, Non-Confirmable, Acknowledgement or Reset */ |
ansond | 0:cbf069c4db24 | 202 | sn_coap_msg_code_e msg_code; /**< Empty: 0; Requests: 1-31; Responses: 64-191 */ |
ansond | 0:cbf069c4db24 | 203 | uint16_t msg_id; /**< Message ID. Parser sets parsed message ID, builder sets message ID of built coap message */ |
ansond | 0:cbf069c4db24 | 204 | |
ansond | 0:cbf069c4db24 | 205 | /* * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 206 | /* * * * Options * * * */ |
ansond | 0:cbf069c4db24 | 207 | /* * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 208 | |
ansond | 0:cbf069c4db24 | 209 | /* Here are most often used Options */ |
ansond | 0:cbf069c4db24 | 210 | |
ansond | 0:cbf069c4db24 | 211 | uint16_t uri_path_len; /**< 0-255 bytes. Repeatable. */ |
ansond | 0:cbf069c4db24 | 212 | uint8_t *uri_path_ptr; /**< Must be set to NULL if not used. E.g: temp1/temp2 */ |
ansond | 0:cbf069c4db24 | 213 | |
ansond | 0:cbf069c4db24 | 214 | uint8_t token_len; /**< 1-8 bytes. */ |
ansond | 0:cbf069c4db24 | 215 | uint8_t *token_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 216 | |
ansond | 0:cbf069c4db24 | 217 | uint8_t content_type_len; /**< 0-2 bytes. */ |
ansond | 0:cbf069c4db24 | 218 | uint8_t *content_type_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 219 | |
ansond | 0:cbf069c4db24 | 220 | /* Here are not so often used Options */ |
ansond | 0:cbf069c4db24 | 221 | sn_coap_options_list_s *options_list_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 222 | |
ansond | 0:cbf069c4db24 | 223 | /* * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 224 | /* * * * Payload * * * */ |
ansond | 0:cbf069c4db24 | 225 | /* * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 226 | |
ansond | 0:cbf069c4db24 | 227 | uint16_t payload_len; /**< Must be set to zero if not used */ |
ansond | 0:cbf069c4db24 | 228 | uint8_t *payload_ptr; /**< Must be set to NULL if not used */ |
ansond | 0:cbf069c4db24 | 229 | } sn_coap_hdr_s; |
ansond | 0:cbf069c4db24 | 230 | |
ansond | 0:cbf069c4db24 | 231 | /* * * * * * * * * * * * * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 232 | /* * * * EXTERNAL FUNCTION PROTOTYPES * * * */ |
ansond | 0:cbf069c4db24 | 233 | /* * * * * * * * * * * * * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 234 | |
ansond | 0:cbf069c4db24 | 235 | /** |
ansond | 0:cbf069c4db24 | 236 | * \brief Sets the memory allocation and deallocation functions the library will use, and must be called first. |
ansond | 0:cbf069c4db24 | 237 | */ |
ansond | 0:cbf069c4db24 | 238 | extern void sn_coap_builder_and_parser_init(void* (*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void*)); |
ansond | 0:cbf069c4db24 | 239 | |
ansond | 0:cbf069c4db24 | 240 | /** |
ansond | 0:cbf069c4db24 | 241 | * \brief Parses an incoming message buffer to a CoAP header structure. |
ansond | 0:cbf069c4db24 | 242 | */ |
ansond | 0:cbf069c4db24 | 243 | extern sn_coap_hdr_s *sn_coap_parser(uint16_t packet_data_len, uint8_t *packet_data_ptr, coap_version_e *coap_version_ptr); |
ansond | 0:cbf069c4db24 | 244 | |
ansond | 0:cbf069c4db24 | 245 | /** |
ansond | 0:cbf069c4db24 | 246 | * \brief Releases any memory allocated by a CoAP message structure. |
ansond | 0:cbf069c4db24 | 247 | */ |
ansond | 0:cbf069c4db24 | 248 | extern void sn_coap_parser_release_allocated_coap_msg_mem(sn_coap_hdr_s *freed_coap_msg_ptr); |
ansond | 0:cbf069c4db24 | 249 | |
ansond | 0:cbf069c4db24 | 250 | /** |
ansond | 0:cbf069c4db24 | 251 | * \brief Builds an outgoing message buffer from a CoAP header structure. |
ansond | 0:cbf069c4db24 | 252 | */ |
ansond | 0:cbf069c4db24 | 253 | extern int16_t sn_coap_builder(uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr); |
ansond | 0:cbf069c4db24 | 254 | |
ansond | 0:cbf069c4db24 | 255 | /** |
ansond | 0:cbf069c4db24 | 256 | * \brief Calculates the needed message buffer size from a CoAP message structure. |
ansond | 0:cbf069c4db24 | 257 | */ |
ansond | 0:cbf069c4db24 | 258 | extern uint16_t sn_coap_builder_calc_needed_packet_data_size(sn_coap_hdr_s *src_coap_msg_ptr); |
ansond | 0:cbf069c4db24 | 259 | |
ansond | 0:cbf069c4db24 | 260 | /** |
ansond | 0:cbf069c4db24 | 261 | * \brief Automates the building of a response to an incoming request. |
ansond | 0:cbf069c4db24 | 262 | */ |
ansond | 0:cbf069c4db24 | 263 | extern sn_coap_hdr_s *sn_coap_build_response(sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code); |
ansond | 0:cbf069c4db24 | 264 | |
ansond | 0:cbf069c4db24 | 265 | /** |
ansond | 0:cbf069c4db24 | 266 | * \brief CoAP packet debugging. |
ansond | 0:cbf069c4db24 | 267 | */ |
ansond | 0:cbf069c4db24 | 268 | extern void sn_coap_packet_debug(sn_coap_hdr_s *coap_packet_ptr); |
ansond | 0:cbf069c4db24 | 269 | |
ansond | 0:cbf069c4db24 | 270 | #endif /* SN_COAP_HEADER_H_ */ |
ansond | 0:cbf069c4db24 | 271 | |
ansond | 0:cbf069c4db24 | 272 | #ifdef __cplusplus |
ansond | 0:cbf069c4db24 | 273 | } |
ansond | 0:cbf069c4db24 | 274 | #endif |
ansond | 0:cbf069c4db24 | 275 |