@@ -69,9 +69,9 @@ extern const uint8_t COAP_MULTICAST_ADDR_SITE_LOCAL[16]; //!> ff05::fd, COAP sit
69
69
*
70
70
* Function that handles CoAP service message receiving and parsing
71
71
*
72
- * \param msg_id Id number of the current message .
72
+ * \param service_id Service handle .
73
73
* \param source_address IPv6 source address.
74
- * \param source_port Source port
74
+ * \param source_port Source port.
75
75
* \param response_ptr Pointer to CoAP header structure.
76
76
*
77
77
* \return 0 for success / -1 for failure
@@ -85,10 +85,11 @@ typedef int coap_service_response_recv(int8_t service_id, uint8_t source_address
85
85
*
86
86
* \param service_id Id number of the current service.
87
87
* \param source_address IPv6 source address.
88
- * \param source_port Source port
88
+ * \param source_port Source port.
89
89
* \param request_ptr Pointer to CoAP header structure.
90
90
*
91
- * \return Status
91
+ * \return -1 = Message ignored, no response will be sent. Transaction will be deleted.
92
+ * 0 = Response is either already sent or will be send. Transaction is not deleted.
92
93
*/
93
94
typedef int coap_service_request_recv_cb (int8_t service_id , uint8_t source_address [static 16 ], uint16_t source_port , sn_coap_hdr_s * request_ptr );
94
95
@@ -98,8 +99,10 @@ typedef int coap_service_request_recv_cb(int8_t service_id, uint8_t source_addre
98
99
* Starts security service handling and fetches device password.
99
100
*
100
101
* \param service_id Id number of the current service.
101
- * \param address Address of sender
102
- * \param port Port of the device
102
+ * \param address Address of sender.
103
+ * \param port Port of the device.
104
+ * \param pw Pointer where to write the ecjpake password.
105
+ * \param pw_len Pointer where to write length of the ecjpake password.
103
106
*
104
107
* \return 0 for success / -1 for failure
105
108
*/
@@ -111,8 +114,8 @@ typedef int coap_service_security_start_cb(int8_t service_id, uint8_t address[st
111
114
* CoAP service security done callback function.
112
115
*
113
116
* \param service_id Id number of the current service.
114
- * \param address Address of sender
115
- * \param keyblock Security key (40 bits)
117
+ * \param address Address of sender.
118
+ * \param keyblock Security key (40 bits).
116
119
*
117
120
* \return 0 for success / -1 for failure
118
121
*/
@@ -147,23 +150,12 @@ extern void coap_service_delete( int8_t service_id );
147
150
*
148
151
* Closes secure connection (if present), but leaves socket open.
149
152
*
150
- * \param service_id Id number of the current service.
153
+ * \param service_id Id number of the current service.
154
+ * \param destimation_addr_ptr Connection destination address.
155
+ * \param port Connection destination port.
151
156
*/
152
157
extern void coap_service_close_secure_connection (int8_t service_id , uint8_t destination_addr_ptr [static 16 ], uint16_t port );
153
158
154
- /**
155
- * \brief Sets password for device
156
- *
157
- * \param service_id Service id
158
- * \param address Device address
159
- * \param port Device port
160
- * \param pw_ptr Pointer to password.
161
- * \param pw_len Lenght of password.
162
- *
163
- * \return 0 for success / -1 for failure
164
- */
165
- //int coap_service_security_key_set(int8_t service_id, uint8_t address[static 16], uint16_t port, uint8_t *pw_ptr, uint8_t pw_len);
166
-
167
159
/**
168
160
* \brief Virtual socket sent callback.
169
161
*
@@ -213,7 +205,6 @@ extern int16_t coap_service_virtual_socket_set_cb(int8_t service_id, coap_servic
213
205
*
214
206
* \param service_id Id number of the current service.
215
207
* \param *uri Uri address.
216
- * \param port port that Application wants to use for communicate with coap server.
217
208
* \param allowed_method Informs method that is allowed to use (used defines described above).
218
209
* \param *request_recv_cb CoAP service request receive callback function pointer.
219
210
*
@@ -240,7 +231,7 @@ extern int8_t coap_service_unregister_uri(int8_t service_id, const char *uri);
240
231
*
241
232
* \param service_id Id number of the current service.
242
233
* \param options Options defined above.
243
- * \param destination_addr IPv6 address.
234
+ * \param destination_addr IPv6 address.
244
235
* \param destination_port Destination port
245
236
* \param msg_type Message type can be found from sn_coap_header.
246
237
* \param msg_code Message code can be found from sn_coap_header.
@@ -261,15 +252,39 @@ extern uint16_t coap_service_request_send(int8_t service_id, uint8_t options, co
261
252
* Build and sends CoAP service response message.
262
253
*
263
254
* \param service_id Id number of the current service.
264
- * \param msg_id Message ID number.
265
255
* \param options Options defined above.
266
- * \param response_ptr Pointer to CoAP header structure.
256
+ * \param request_ptr Pointer to CoAP request message header structure.
257
+ * \param message_code Message code can be found from sn_coap_header.
258
+ * \param content_type Content type can be found from sn_coap_header.
259
+ * \param payload_ptr Pointer to message content.
260
+ * \param payload_len Lenght of the message.
267
261
*
268
262
* \return -1 For failure
269
263
*- 0 For success
270
264
*/
271
265
extern int8_t coap_service_response_send (int8_t service_id , uint8_t options , sn_coap_hdr_s * request_ptr , sn_coap_msg_code_e message_code , sn_coap_content_format_e content_type , const uint8_t * payload_ptr ,uint16_t payload_len );
272
266
267
+ /**
268
+ * \brief Sends CoAP service response
269
+ *
270
+ * Build and sends CoAP service response message based on CoAP request message id.
271
+ *
272
+ * \param service_id Id number of the current service.
273
+ * \param options Options defined above.
274
+ * \param msg_id Request messages ID.
275
+ * \param msg_type Message type can be found from sn_coap_header.
276
+ * \param message_code Message code can be found from sn_coap_header.
277
+ * \param content_type Content type can be found from sn_coap_header.
278
+ * \param payload_ptr Pointer to message content.
279
+ * \param payload_len Lenght of the message.
280
+ *
281
+ * \return -1 For failure
282
+ *- 0 For success
283
+ */
284
+ extern int8_t coap_service_response_send_by_msg_id (int8_t service_id , uint8_t options , uint16_t msg_id , sn_coap_msg_code_e message_code , sn_coap_content_format_e content_type , const uint8_t * payload_ptr ,uint16_t payload_len );
285
+
286
+
287
+
273
288
/**
274
289
* \brief Delete CoAP request transaction
275
290
*
@@ -297,18 +312,48 @@ extern int8_t coap_service_request_delete(int8_t service_id, uint16_t msg_id);
297
312
*/
298
313
extern int8_t coap_service_set_handshake_timeout (int8_t service_id , uint32_t min , uint32_t max );
299
314
315
+ /**
316
+ * \brief Set DTLS handshake limit values
317
+ *
318
+ * Configures the limits for DTLS sessions. Values must be > 0.
319
+ *
320
+ * \param handshakes_max Maximum amount of simultaneous handshakes.
321
+ * \param connections_max Maximum amount of sessions.
322
+ *
323
+ * \return -1 For failure
324
+ *- 0 For success
325
+ */
326
+ extern int8_t coap_service_handshake_limits_set (uint8_t handshakes_max , uint8_t connections_max );
327
+
300
328
/**
301
329
* \brief Set CoAP duplication message buffer size
302
330
*
303
331
* Configures the CoAP duplication message buffer size.
304
332
*
305
333
* \param service_id Id number of the current service.
306
- * \param size Buffer size (messages)
334
+ * \param size Buffer size (messages).
307
335
*
308
336
* \return -1 For failure
309
337
*- 0 For success
310
338
*/
311
339
extern int8_t coap_service_set_duplicate_message_buffer (int8_t service_id , uint8_t size );
340
+
341
+ /**
342
+ * \brief Set DTLS certificates
343
+ *
344
+ * Set DTLS certificates.
345
+ *
346
+ * \param service_id Id number of the current service.
347
+ * \param cert Pointer to certificate chain.
348
+ * \param cert_len Certificate length.
349
+ * \param priv_key pointer to private key.
350
+ * \param priv_key_len length of private key.
351
+ *
352
+ * \return -1 For failure
353
+ *- 0 For success
354
+ */
355
+
356
+ extern int8_t coap_service_certificate_set (int8_t service_id , const unsigned char * cert , uint16_t cert_len , const unsigned char * priv_key , uint8_t priv_key_len );
312
357
#ifdef __cplusplus
313
358
}
314
359
#endif
0 commit comments