OpenWSN Firmware
opencoap.h File Reference
#include "opentimers.h"

Go to the source code of this file.

Data Structures

struct  coap_header_iht
 
struct  coap_option_iht
 
struct  coap_resource_desc_t
 
struct  opencoap_vars_t
 

Macros

#define MAX_COAP_OPTIONS   10
 the maximum number of options in a RX'ed CoAP message More...
 
#define COAP_MAX_TKL   8
 
#define COAP_PAYLOAD_MARKER   0xFF
 
#define COAP_VERSION   1
 

Typedefs

typedef owerror_t(* callbackRx_cbt )(OpenQueueEntry_t *msg, coap_header_iht *coap_header, coap_option_iht *coap_options)
 
typedef void(* callbackSendDone_cbt )(OpenQueueEntry_t *msg, owerror_t error)
 
typedef struct coap_resource_desc_t coap_resource_desc_t
 

Enumerations

enum  coap_type_t { COAP_TYPE_CON = 0, COAP_TYPE_NON = 1, COAP_TYPE_ACK = 2, COAP_TYPE_RES = 3 }
 
enum  coap_code_t {
  COAP_CODE_EMPTY = 0, COAP_CODE_REQ_GET = 1, COAP_CODE_REQ_POST = 2, COAP_CODE_REQ_PUT = 3,
  COAP_CODE_REQ_DELETE = 4, COAP_CODE_RESP_CREATED = 65, COAP_CODE_RESP_DELETED = 66, COAP_CODE_RESP_VALID = 67,
  COAP_CODE_RESP_CHANGED = 68, COAP_CODE_RESP_CONTENT = 69, COAP_CODE_RESP_BADREQ = 128, COAP_CODE_RESP_UNAUTHORIZED = 129,
  COAP_CODE_RESP_BADOPTION = 130, COAP_CODE_RESP_FORBIDDEN = 131, COAP_CODE_RESP_NOTFOUND = 132, COAP_CODE_RESP_METHODNOTALLOWED = 133,
  COAP_CODE_RESP_PRECONDFAILED = 140, COAP_CODE_RESP_REQTOOLARGE = 141, COAP_CODE_RESP_UNSUPPMEDIATYPE = 143, COAP_CODE_RESP_SERVERERROR = 160,
  COAP_CODE_RESP_NOTIMPLEMENTED = 161, COAP_CODE_RESP_BADGATEWAY = 162, COAP_CODE_RESP_UNAVAILABLE = 163, COAP_CODE_RESP_GWTIMEOUT = 164,
  COAP_CODE_RESP_PROXYINGNOTSUPP = 165
}
 
enum  coap_option_t {
  COAP_OPTION_NONE = 0, COAP_OPTION_NUM_IFMATCH = 1, COAP_OPTION_NUM_URIHOST = 3, COAP_OPTION_NUM_ETAG = 4,
  COAP_OPTION_NUM_IFNONEMATCH = 5, COAP_OPTION_NUM_URIPORT = 7, COAP_OPTION_NUM_LOCATIONPATH = 8, COAP_OPTION_NUM_URIPATH = 11,
  COAP_OPTION_NUM_CONTENTFORMAT = 12, COAP_OPTION_NUM_MAXAGE = 14, COAP_OPTION_NUM_URIQUERY = 15, COAP_OPTION_NUM_ACCEPT = 16,
  COAP_OPTION_NUM_LOCATIONQUERY = 20, COAP_OPTION_NUM_PROXYURI = 35, COAP_OPTION_NUM_PROXYSCHEME = 39
}
 
enum  coap_media_type_t {
  COAP_MEDTYPE_TEXTPLAIN = 0, COAP_MEDTYPE_APPLINKFORMAT = 40, COAP_MEDTYPE_APPXML = 41, COAP_MEDTYPE_APPOCTETSTREAM = 42,
  COAP_MEDTYPE_APPEXI = 47, COAP_MEDTYPE_APPJSON = 50
}
 

Functions

void opencoap_init (void)
 Initialize this module. More...
 
void opencoap_receive (OpenQueueEntry_t *msg)
 Indicate a CoAP messages was received. More...
 
void opencoap_sendDone (OpenQueueEntry_t *msg, owerror_t error)
 Indicates that the CoAP response has been sent. More...
 
void opencoap_writeLinks (OpenQueueEntry_t *msg)
 Writes the links to all the resources on this mote into the message. More...
 
void opencoap_register (coap_resource_desc_t *desc)
 Register a new CoAP resource. More...
 
owerror_t opencoap_send (OpenQueueEntry_t *msg, coap_type_t type, coap_code_t code, uint8_t numOptions, coap_resource_desc_t *descSender)
 Send a CoAP request. More...