tinydtls
0.8.1
|
#include <dtls.h>
Data Fields | |
int(* | write )(struct dtls_context_t *ctx, session_t *session, uint8 *buf, size_t len) |
int(* | read )(struct dtls_context_t *ctx, session_t *session, uint8 *buf, size_t len) |
int(* | event )(struct dtls_context_t *ctx, session_t *session, dtls_alert_level_t level, unsigned short code) |
This structure contains callback functions used by tinydtls to communicate with the application. At least the write function must be provided. It is called by the DTLS state machine to send packets over the network. The read function is invoked to deliver decrypted and verfified application data. The third callback is an event handler function that is called when alert messages are encountered or events generated by the library have occured.
int(* dtls_handler_t::event)(struct dtls_context_t *ctx, session_t *session, dtls_alert_level_t level, unsigned short code) |
The event handler is called when a message from the alert protocol is received or the state of the DTLS session changes.
ctx | The current dtls context. |
session | The session object that was affected. |
level | The alert level or 0 when an event ocurred that is not an alert. |
code | Values less than 256 indicate alerts, while 256 or greater indicate internal DTLS session changes. |
int(* dtls_handler_t::read)(struct dtls_context_t *ctx, session_t *session, uint8 *buf, size_t len) |
Called from dtls_handle_message() deliver application data that was received on the given session. The data is delivered only after decryption and verification have succeeded.
ctx | The current DTLS context. |
session | The session object, including the address of the data's origin. |
buf | The received data packet. |
len | The actual length of buf . |
int(* dtls_handler_t::write)(struct dtls_context_t *ctx, session_t *session, uint8 *buf, size_t len) |
Called from dtls_handle_message() to send DTLS packets over the network. The callback function must use the network interface denoted by session->ifindex to send the data.
ctx | The current DTLS context. |
session | The session object, including the address of the remote peer where the data shall be sent. |
buf | The data to send. |
len | The actual length of buf . |