NSDL C library
Dependents: NSDL_HelloWorld_WiFi UbloxModemNanoServiceClient IOT-NSDL_HelloWorld LWM2M_NanoService_Ethernet ... more
Fork of nsdl_lib by
Note that use of this software requires acceptance of the Sensinode EULA: http://mbed.org/teams/Sensinode/code/nsdl_lib/wiki/EULA
Revision 1:01d723824294, committed 2013-10-09
- Comitter:
- screamer
- Date:
- Wed Oct 09 14:18:21 2013 +0000
- Parent:
- 0:58c4f13c4b9a
- Child:
- 2:ab50a2ab6ec9
- Commit message:
- Added doxygen markup
Changed in this revision
--- a/sn_coap_header.h Wed Oct 09 09:20:29 2013 +0000 +++ b/sn_coap_header.h Wed Oct 09 14:18:21 2013 +0000 @@ -24,23 +24,29 @@ /* * * * ENUMERATIONS * * * */ /* * * * * * * * * * * * * * */ -/* Enumeration for CoAP Version */ +/** + * Enumeration for CoAP Version + */ typedef enum coap_version_ { COAP_VERSION_1 = 0x40, COAP_VERSION_UNKNOWN = 0xFF } coap_version_e; -/* Enumeration for CoAP Message type, used in CoAP Header */ +/** + * Enumeration for CoAP Message type, used in CoAP Header + */ typedef enum sn_coap_msg_type_ { - COAP_MSG_TYPE_CONFIRMABLE = 0x00, /* User uses this for Reliable Request messages */ - COAP_MSG_TYPE_NON_CONFIRMABLE = 0x10, /* User uses this for Non-reliable Request and Response messages */ - COAP_MSG_TYPE_ACKNOWLEDGEMENT = 0x20, /* User uses this for Response to a Confirmable Request */ - COAP_MSG_TYPE_RESET = 0x30 /* User uses this to answer a Bad Request */ + COAP_MSG_TYPE_CONFIRMABLE = 0x00, /**< User uses this for Reliable Request messages */ + COAP_MSG_TYPE_NON_CONFIRMABLE = 0x10, /**< User uses this for Non-reliable Request and Response messages */ + COAP_MSG_TYPE_ACKNOWLEDGEMENT = 0x20, /**< User uses this for Response to a Confirmable Request */ + COAP_MSG_TYPE_RESET = 0x30 /**< User uses this to answer a Bad Request */ } sn_coap_msg_type_e; -/* Enumeration for CoAP Message code, used in CoAP Header */ +/** + * Enumeration for CoAP Message code, used in CoAP Header + */ typedef enum sn_coap_msg_code_ { COAP_MSG_CODE_EMPTY = 0, @@ -73,7 +79,9 @@ COAP_MSG_CODE_RESPONSE_PROXYING_NOT_SUPPORTED = 165 } sn_coap_msg_code_e; -/* Enumeration for CoAP Option number, used in CoAP Header */ +/** + * Enumeration for CoAP Option number, used in CoAP Header + */ typedef enum sn_coap_option_numbers_ { COAP_OPTION_IF_MATCH = 1, @@ -99,7 +107,9 @@ // 136 = (Reserved) } sn_coap_option_numbers_e; -/* Enumeration for CoAP Content Format codes */ +/** + * Enumeration for CoAP Content Format codes + */ typedef enum sn_coap_content_format_ { COAP_CT_NONE = -1, @@ -111,18 +121,20 @@ COAP_CT_JSON = 50, } sn_coap_content_format_e; -/* Enumeration for CoAP status, used in CoAP Header */ +/** + * Enumeration for CoAP status, used in CoAP Header + */ typedef enum sn_coap_status_ { - COAP_STATUS_OK = 0, /* Default value is OK */ - COAP_STATUS_PARSER_ERROR_IN_HEADER = 1, /* CoAP will send Reset message to invalid message sender */ - COAP_STATUS_PARSER_DUPLICATED_MSG = 2, /* CoAP will send Acknowledgement message to duplicated message sender */ - COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVING = 3, /* User will get whole message after all message blocks received. - User must release messages with this status. */ - COAP_STATUS_PARSER_BLOCKWISE_ACK = 4, /* Acknowledgement for sent Blockwise message received */ - COAP_STATUS_PARSER_BLOCKWISE_MSG_REJECTED = 5, /* Blockwise message received but not supported by compiling switch */ - COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVED = 6 /* Blockwise message fully received and returned to app. */ - /* User must take care of releasing whole payload of the blockwise messages */ + COAP_STATUS_OK = 0, /**< Default value is OK */ + COAP_STATUS_PARSER_ERROR_IN_HEADER = 1, /**< CoAP will send Reset message to invalid message sender */ + COAP_STATUS_PARSER_DUPLICATED_MSG = 2, /**< CoAP will send Acknowledgement message to duplicated message sender */ + COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVING = 3, /**< User will get whole message after all message blocks received. + User must release messages with this status. */ + COAP_STATUS_PARSER_BLOCKWISE_ACK = 4, /**< Acknowledgement for sent Blockwise message received */ + COAP_STATUS_PARSER_BLOCKWISE_MSG_REJECTED = 5, /**< Blockwise message received but not supported by compiling switch */ + COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVED = 6 /**< Blockwise message fully received and returned to app. + User must take care of releasing whole payload of the blockwise messages */ } sn_coap_status_e; @@ -130,7 +142,9 @@ /* * * * STRUCTURES * * * */ /* * * * * * * * * * * * * */ -/* Structure for CoAP Options */ +/** + * Structure for CoAP Options + */ typedef struct sn_coap_options_list_ { @@ -139,58 +153,63 @@ /* Size */ /* Proxy-Scheme */ - uint8_t max_age_len; /* 0-4 bytes. */ - uint8_t *max_age_ptr; /* Must be set to NULL if not used */ + uint8_t max_age_len; /**< 0-4 bytes. */ + uint8_t *max_age_ptr; /**< Must be set to NULL if not used */ - uint16_t proxy_uri_len; /* 1-1034 bytes. */ - uint8_t *proxy_uri_ptr; /* Must be set to NULL if not used */ + uint16_t proxy_uri_len; /**< 1-1034 bytes. */ + uint8_t *proxy_uri_ptr; /**< Must be set to NULL if not used */ - uint8_t etag_len; /* 1-8 bytes. Repeatable */ - uint8_t *etag_ptr; /* Must be set to NULL if not used */ + uint8_t etag_len; /**< 1-8 bytes. Repeatable */ + uint8_t *etag_ptr; /**< Must be set to NULL if not used */ - uint16_t uri_host_len; /* 1-255 bytes. */ - uint8_t *uri_host_ptr; /* Must be set to NULL if not used */ + uint16_t uri_host_len; /**< 1-255 bytes. */ + uint8_t *uri_host_ptr; /**< Must be set to NULL if not used */ - uint16_t location_path_len; /* 0-255 bytes. Repeatable */ - uint8_t *location_path_ptr; /* Must be set to NULL if not used */ + uint16_t location_path_len; /**< 0-255 bytes. Repeatable */ + uint8_t *location_path_ptr; /**< Must be set to NULL if not used */ - uint8_t uri_port_len; /* 0-2 bytes. */ - uint8_t *uri_port_ptr; /* Must be set to NULL if not used */ + uint8_t uri_port_len; /**< 0-2 bytes. */ + uint8_t *uri_port_ptr; /**< Must be set to NULL if not used */ - uint16_t location_query_len; /* 0-255 bytes. Repeatable */ - uint8_t *location_query_ptr; /* Must be set to NULL if not used */ + uint16_t location_query_len; /**< 0-255 bytes. Repeatable */ + uint8_t *location_query_ptr; /**< Must be set to NULL if not used */ uint8_t observe; - uint8_t observe_len; /* 0-2 bytes. */ - uint8_t *observe_ptr; /* Must be set to NULL if not used */ + uint8_t observe_len; /**< 0-2 bytes. */ + uint8_t *observe_ptr; /**< Must be set to NULL if not used */ - uint8_t accept_len; /* 0-2 bytes. Repeatable */ - uint8_t *accept_ptr; /* Must be set to NULL if not used */ + uint8_t accept_len; /**< 0-2 bytes. Repeatable */ + uint8_t *accept_ptr; /**< Must be set to NULL if not used */ - uint16_t uri_query_len; /* 1-255 bytes. Repeatable */ - uint8_t *uri_query_ptr; /* Must be set to NULL if not used */ + uint16_t uri_query_len; /**< 1-255 bytes. Repeatable */ + uint8_t *uri_query_ptr; /**< Must be set to NULL if not used */ - uint8_t block1_len; /* 0-3 bytes. */ - uint8_t *block1_ptr; /* Not for User */ + uint8_t block1_len; /**< 0-3 bytes. */ + uint8_t *block1_ptr; /**< Not for User */ - uint8_t block2_len; /* 0-3 bytes. */ - uint8_t *block2_ptr; /* Not for User */ + uint8_t block2_len; /**< 0-3 bytes. */ + uint8_t *block2_ptr; /**< Not for User */ } sn_coap_options_list_s; + /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ /* !!! Main CoAP message struct !!! */ /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +/** + * Main CoAP message struct + */ typedef struct sn_coap_hdr_ { - sn_coap_status_e coap_status; /* Used for telling to User special cases when parsing message */ + sn_coap_status_e coap_status; /**< Used for telling to User special cases when parsing message */ /* * * * * * * * * * * */ /* * * * Header * * * */ /* * * * * * * * * * * */ - sn_coap_msg_type_e msg_type; /* Confirmable, Non-Confirmable, Acknowledgement or Reset */ - sn_coap_msg_code_e msg_code; /* Empty: 0; Requests: 1-31; Responses: 64-191 */ - uint16_t msg_id; /* Message ID. Parser sets parsed message ID, builder sets message ID of built coap message */ + sn_coap_msg_type_e msg_type; /**< Confirmable, Non-Confirmable, Acknowledgement or Reset */ + sn_coap_msg_code_e msg_code; /**< Empty: 0; Requests: 1-31; Responses: 64-191 */ + uint16_t msg_id; /**< Message ID. Parser sets parsed message ID, builder sets message ID of built coap message */ /* * * * * * * * * * * */ /* * * * Options * * * */ @@ -198,25 +217,25 @@ /* Here are most often used Options */ - uint16_t uri_path_len; /* 0-255 bytes. Repeatable. */ - uint8_t *uri_path_ptr; /* Must be set to NULL if not used. E.g: temp1/temp2 */ + uint16_t uri_path_len; /**< 0-255 bytes. Repeatable. */ + uint8_t *uri_path_ptr; /**< Must be set to NULL if not used. E.g: temp1/temp2 */ - uint8_t token_len; /* 1-8 bytes. */ - uint8_t *token_ptr; /* Must be set to NULL if not used */ + uint8_t token_len; /**< 1-8 bytes. */ + uint8_t *token_ptr; /**< Must be set to NULL if not used */ /* todo: COAP12 - content type ptr as a content_type_e */ - uint8_t content_type_len; /* 0-2 bytes. */ - uint8_t *content_type_ptr; /* Must be set to NULL if not used */ + uint8_t content_type_len; /**< 0-2 bytes. */ + uint8_t *content_type_ptr; /**< Must be set to NULL if not used */ /* Here are not so often used Options */ - sn_coap_options_list_s *options_list_ptr; /* Must be set to NULL if not used */ + sn_coap_options_list_s *options_list_ptr; /**< Must be set to NULL if not used */ /* * * * * * * * * * * */ /* * * * Payload * * * */ /* * * * * * * * * * * */ - uint16_t payload_len; /* Must be set to zero if not used */ - uint8_t *payload_ptr; /* Must be set to NULL if not used */ + uint16_t payload_len; /**< Must be set to zero if not used */ + uint8_t *payload_ptr; /**< Must be set to NULL if not used */ } sn_coap_hdr_s; /* * * * * * * * * * * * * * * * * * * * * * */
--- a/sn_coap_protocol.h Wed Oct 09 09:20:29 2013 +0000 +++ b/sn_coap_protocol.h Wed Oct 09 14:18:21 2013 +0000 @@ -35,10 +35,8 @@ #define SN_COAP_RESENDING_BUFFER_MAX_SIZE 0 /* These parameters sets maximum values application can set with API */ -/* Maximum allowed count of re-sending */ -#define SN_COAP_MAX_ALLOWED_RESENDING_COUNT 6 -/* Maximum allowed number of saved re-sending messages */ -#define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE 6 +#define SN_COAP_MAX_ALLOWED_RESENDING_COUNT 6 /**< Maximum allowed count of re-sending */ +#define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE 6 /**< Maximum allowed number of saved re-sending messages */ /* * For Message duplication detecting * */ @@ -58,13 +56,12 @@ /* Note: Current Coap implementation supports Blockwise transfers specification version draft-ietf-core-block-03 */ /* Note: This define is common for both received and sent Blockwise messages */ #ifndef SN_COAP_BLOCKWISE_MAX_PAYLOAD_SIZE -#define SN_COAP_BLOCKWISE_MAX_PAYLOAD_SIZE 0 /* Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024 */ +#define SN_COAP_BLOCKWISE_MAX_PAYLOAD_SIZE 0 /**< Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024 */ #endif -/* Maximum time in seconds of data (messages and payload) to be stored for blockwising */ #ifndef SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED -#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED 10 +#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED 10 /**< Maximum time in seconds of data (messages and payload) to be stored for blockwising */ #endif
--- a/sn_nsdl.h Wed Oct 09 09:20:29 2013 +0000 +++ b/sn_nsdl.h Wed Oct 09 14:18:21 2013 +0000 @@ -68,7 +68,9 @@ /* * * * STRUCTURES * * * */ /* * * * * * * * * * * * * */ -/* Address structure of Packet data */ +/** + * Address structure of Packet data + */ typedef struct sn_nsdl_addr_ { sn_nsdl_addr_type_e type; @@ -82,7 +84,9 @@ } sn_nsdl_addr_s; -/* This structure is returned by sn_coap_exec() for sending */ +/** + * This structure is returned by sn_coap_exec() for sending + */ typedef struct sn_nsdl_transmit_ { sn_nsdl_addr_s *dst_addr_ptr;
--- a/sn_nsdl_lib.h Wed Oct 09 09:20:29 2013 +0000 +++ b/sn_nsdl_lib.h Wed Oct 09 14:18:21 2013 +0000 @@ -210,10 +210,11 @@ */ int8_t sn_nsdl_is_ep_registered(void); -/* +/** * A function to inform NSDL-C library if application detects a fault in NSP registration. After calling this function * , sn_nsdl_is_ep_registered() will return "not registered". */ + void sn_nsdl_nsp_lost(void); /** * \fn extern int8_t sn_nsdl_send_observation_notification(uint8_t *token_ptr, uint8_t token_len,