40 #ifndef COAP_OBSERVING_CLIENT_H_
41 #define COAP_OBSERVING_CLIENT_H_
46 #ifndef COAP_OBSERVE_CLIENT
47 #define COAP_OBSERVE_CLIENT 0
50 #ifdef COAP_CONF_MAX_OBSERVEES
51 #define COAP_MAX_OBSERVEES COAP_CONF_MAX_OBSERVEES
53 #define COAP_MAX_OBSERVEES 4
56 #if COAP_MAX_OPEN_TRANSACTIONS < COAP_MAX_OBSERVEES
57 #warning "COAP_MAX_OPEN_TRANSACTIONS smaller than COAP_MAX_OBSERVEES: " \
58 "this may be a problem"
61 #define IS_RESPONSE_CODE_2_XX(message) (64 < message->code \
62 && message->code < 128)
68 OBSERVE_NOT_SUPPORTED,
71 } coap_notification_flag_t;
74 typedef struct coap_observee_s coap_observee_t;
76 typedef void (*notification_callback_t)(coap_observee_t *subject,
78 coap_notification_flag_t);
80 struct coap_observee_s {
81 coap_observee_t *next;
86 uint8_t token[COAP_TOKEN_LEN];
88 notification_callback_t notification_callback;
89 uint32_t last_observe;
93 coap_observee_t *coap_obs_add_observee(uip_ipaddr_t *
addr, uint16_t port,
94 const uint8_t *token,
size_t token_len,
96 notification_callback_t
97 notification_callback,
void *data);
99 void coap_obs_remove_observee(coap_observee_t *o);
101 coap_observee_t *coap_obs_get_observee_by_token(
const uint8_t *token,
104 int coap_obs_remove_observee_by_token(uip_ipaddr_t *
addr, uint16_t port,
105 uint8_t *token,
size_t token_len);
107 int coap_obs_remove_observee_by_url(uip_ipaddr_t *
addr, uint16_t port,
110 void coap_handle_notification(uip_ipaddr_t *, uint16_t port,
111 coap_packet_t *notification);
113 coap_observee_t *coap_obs_request_registration(uip_ipaddr_t *
addr,
114 uint16_t port,
char *uri,
115 notification_callback_t
116 notification_callback,
119 uint8_t coap_generate_token(uint8_t **token_ptr);
static uip_ds6_addr_t * addr
Pointer to a router list entry.
CoAP module for reliable transport
An implementation of the Constrained Application Protocol (RFC).