SDK3.5
This document shows Ameba SDK 3.5 APIs
Data Structures | Typedefs | Enumerations | Functions
sn_coap_header.h File Reference

CoAP C-library User header interface header file. More...

Data Structures

struct  sn_coap_options_list_
 Structure for CoAP Options. More...
 
struct  sn_coap_hdr_
 Main CoAP message struct. More...
 
struct  registration_info_
 Used for creating manually registration message with sn_coap_register() More...
 
struct  sn_nsdl_addr_
 Address structure of Packet data. More...
 

Typedefs

typedef enum coap_version_ coap_version_e
 Enumeration for CoAP Version.
 
typedef enum sn_coap_msg_type_ sn_coap_msg_type_e
 Enumeration for CoAP Message type, used in CoAP Header.
 
typedef enum sn_coap_msg_code_ sn_coap_msg_code_e
 Enumeration for CoAP Message code, used in CoAP Header.
 
typedef enum sn_coap_option_numbers_ sn_coap_option_numbers_e
 Enumeration for CoAP Option number, used in CoAP Header.
 
typedef enum sn_coap_content_format_ sn_coap_content_format_e
 Enumeration for CoAP Content Format codes.
 
typedef enum sn_coap_observe_ sn_coap_observe_e
 Enumeration for CoAP Observe option values. More...
 
typedef enum sn_coap_status_ sn_coap_status_e
 Enumeration for CoAP status, used in CoAP Header.
 
typedef struct sn_coap_options_list_ sn_coap_options_list_s
 Structure for CoAP Options.
 
typedef struct sn_coap_hdr_ sn_coap_hdr_s
 Main CoAP message struct.
 
typedef enum sn_nsdl_capab_ sn_nsdl_capab_e
 Used protocol.
 
typedef struct registration_info_ registration_info_t
 Used for creating manually registration message with sn_coap_register()
 
typedef enum sn_nsdl_addr_type_ sn_nsdl_addr_type_e
 Address type of given address.
 
typedef struct sn_nsdl_addr_ sn_nsdl_addr_s
 Address structure of Packet data.
 

Enumerations

enum  coap_version_ { COAP_VERSION_1 = 0x40, COAP_VERSION_UNKNOWN = 0xFF }
 Enumeration for CoAP Version.
 
enum  sn_coap_msg_type_ { COAP_MSG_TYPE_CONFIRMABLE = 0x00, COAP_MSG_TYPE_NON_CONFIRMABLE = 0x10, COAP_MSG_TYPE_ACKNOWLEDGEMENT = 0x20, COAP_MSG_TYPE_RESET = 0x30 }
 Enumeration for CoAP Message type, used in CoAP Header. More...
 
enum  sn_coap_msg_code_ {
  COAP_MSG_CODE_EMPTY = 0, COAP_MSG_CODE_REQUEST_GET = 1, COAP_MSG_CODE_REQUEST_POST = 2, COAP_MSG_CODE_REQUEST_PUT = 3,
  COAP_MSG_CODE_REQUEST_DELETE = 4, COAP_MSG_CODE_RESPONSE_CREATED = 65, COAP_MSG_CODE_RESPONSE_DELETED = 66, COAP_MSG_CODE_RESPONSE_VALID = 67,
  COAP_MSG_CODE_RESPONSE_CHANGED = 68, COAP_MSG_CODE_RESPONSE_CONTENT = 69, COAP_MSG_CODE_RESPONSE_CONTINUE = 95, COAP_MSG_CODE_RESPONSE_BAD_REQUEST = 128,
  COAP_MSG_CODE_RESPONSE_UNAUTHORIZED = 129, COAP_MSG_CODE_RESPONSE_BAD_OPTION = 130, COAP_MSG_CODE_RESPONSE_FORBIDDEN = 131, COAP_MSG_CODE_RESPONSE_NOT_FOUND = 132,
  COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED = 133, COAP_MSG_CODE_RESPONSE_NOT_ACCEPTABLE = 134, COAP_MSG_CODE_RESPONSE_REQUEST_ENTITY_INCOMPLETE = 136, COAP_MSG_CODE_RESPONSE_PRECONDITION_FAILED = 140,
  COAP_MSG_CODE_RESPONSE_REQUEST_ENTITY_TOO_LARGE = 141, COAP_MSG_CODE_RESPONSE_UNSUPPORTED_CONTENT_FORMAT = 143, COAP_MSG_CODE_RESPONSE_INTERNAL_SERVER_ERROR = 160, COAP_MSG_CODE_RESPONSE_NOT_IMPLEMENTED = 161,
  COAP_MSG_CODE_RESPONSE_BAD_GATEWAY = 162, COAP_MSG_CODE_RESPONSE_SERVICE_UNAVAILABLE = 163, COAP_MSG_CODE_RESPONSE_GATEWAY_TIMEOUT = 164, COAP_MSG_CODE_RESPONSE_PROXYING_NOT_SUPPORTED = 165
}
 Enumeration for CoAP Message code, used in CoAP Header.
 
enum  sn_coap_option_numbers_ {
  COAP_OPTION_IF_MATCH = 1, COAP_OPTION_URI_HOST = 3, COAP_OPTION_ETAG = 4, COAP_OPTION_IF_NONE_MATCH = 5,
  COAP_OPTION_OBSERVE = 6, COAP_OPTION_URI_PORT = 7, COAP_OPTION_LOCATION_PATH = 8, COAP_OPTION_URI_PATH = 11,
  COAP_OPTION_CONTENT_FORMAT = 12, COAP_OPTION_MAX_AGE = 14, COAP_OPTION_URI_QUERY = 15, COAP_OPTION_ACCEPT = 17,
  COAP_OPTION_LOCATION_QUERY = 20, COAP_OPTION_BLOCK2 = 23, COAP_OPTION_BLOCK1 = 27, COAP_OPTION_SIZE2 = 28,
  COAP_OPTION_PROXY_URI = 35, COAP_OPTION_PROXY_SCHEME = 39, COAP_OPTION_SIZE1 = 60
}
 Enumeration for CoAP Option number, used in CoAP Header.
 
enum  sn_coap_content_format_ {
  COAP_CT_NONE = -1, COAP_CT_TEXT_PLAIN = 0, COAP_CT_LINK_FORMAT = 40, COAP_CT_XML = 41,
  COAP_CT_OCTET_STREAM = 42, COAP_CT_EXI = 47, COAP_CT_JSON = 50, COAP_CT__MAX = 0xffff
}
 Enumeration for CoAP Content Format codes.
 
enum  sn_coap_observe_ { COAP_OBSERVE_NONE = -1, COAP_OBSERVE_REGISTER = 0, COAP_OBSERVE_DEREGISTER = 1, COAP_OBSERVE__MAX = 0xffffff }
 Enumeration for CoAP Observe option values. More...
 
enum  sn_coap_status_ {
  COAP_STATUS_OK = 0, COAP_STATUS_PARSER_ERROR_IN_HEADER = 1, COAP_STATUS_PARSER_DUPLICATED_MSG = 2, COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVING = 3,
  COAP_STATUS_PARSER_BLOCKWISE_ACK = 4, COAP_STATUS_PARSER_BLOCKWISE_MSG_REJECTED = 5, COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVED = 6, COAP_STATUS_BUILDER_MESSAGE_SENDING_FAILED = 7
}
 Enumeration for CoAP status, used in CoAP Header. More...
 
enum  sn_nsdl_capab_ { SN_NSDL_PROTOCOL_HTTP = 0x01, SN_NSDL_PROTOCOL_HTTPS = 0x02, SN_NSDL_PROTOCOL_COAP = 0x04 }
 Used protocol. More...
 
enum  sn_nsdl_addr_type_ { SN_NSDL_ADDRESS_TYPE_IPV6 = 0x01, SN_NSDL_ADDRESS_TYPE_IPV4 = 0x02, SN_NSDL_ADDRESS_TYPE_HOSTNAME = 0x03, SN_NSDL_ADDRESS_TYPE_NONE = 0xFF }
 Address type of given address. More...
 

Functions

sn_coap_hdr_ssn_coap_parser (struct coap_s *handle, uint16_t packet_data_len, uint8_t *packet_data_ptr, coap_version_e *coap_version_ptr)
 Parses CoAP message from given Packet data. More...
 
void sn_coap_parser_release_allocated_coap_msg_mem (struct coap_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr)
 Releases memory of given CoAP message. More...
 
int16_t sn_coap_builder (uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr)
 Builds an outgoing message buffer from a CoAP header structure. More...
 
uint16_t sn_coap_builder_calc_needed_packet_data_size (sn_coap_hdr_s *src_coap_msg_ptr)
 Calculates needed Packet data memory size for given CoAP message. More...
 
int16_t sn_coap_builder_2 (uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size)
 Builds an outgoing message buffer from a CoAP header structure. More...
 
uint16_t sn_coap_builder_calc_needed_packet_data_size_2 (sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size)
 Calculates needed Packet data memory size for given CoAP message. More...
 
sn_coap_hdr_ssn_coap_build_response (struct coap_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code)
 Prepares generic response packet from a request packet. This function allocates memory for the resulting sn_coap_hdr_s. More...
 
sn_coap_hdr_ssn_coap_parser_init_message (sn_coap_hdr_s *coap_msg_ptr)
 Initialise a message structure to empty. More...
 
sn_coap_hdr_ssn_coap_parser_alloc_message (struct coap_s *handle)
 Allocate an empty message structure. More...
 
sn_coap_options_list_ssn_coap_parser_alloc_options (struct coap_s *handle, sn_coap_hdr_s *coap_msg_ptr)
 Allocates and initializes options list structure. More...
 

Detailed Description

CoAP C-library User header interface header file.