libcoap
4.2.1
|
#include "coap_config.h"
#include "address.h"
#include "coap_debug.h"
#include "mem.h"
#include "coap_dtls.h"
#include "coap_keystore.h"
#include "utlist.h"
#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | queue_t |
struct | coap_dtls_session_t |
struct | coap_dtls_context_t |
Macros | |
#define | UNUSED |
#define | COAP_COPY_ADDRESS(DST, SRC) |
#define | ITEM_SIZE (sizeof(struct queue_t) + data_length) |
#define | CONTEXT_SIZE (sizeof(struct coap_dtls_context_t)) |
Typedefs | |
typedef enum CertificateFormat_ | CertificateFormat |
typedef struct coap_dtls_context_t | coap_dtls_context_t |
Functions | |
void | dtls_set_psk (struct coap_dtls_context_t *ctx, const char *identity, const uint8_t *key, int key_length) |
int | coap_dtls_is_supported (void) |
Returns 1 if support for DTLS is enabled, or 0 otherwise. More... | |
void | coap_dtls_set_log_level (int level) |
Sets the log level to the specified value. More... | |
int | coap_dtls_get_log_level (void) |
Returns the current log level. More... | |
static int | push_data_item (struct coap_dtls_session_t *session, coap_tid_t id, const unsigned char *data, size_t data_length) |
struct coap_dtls_context_t * | coap_dtls_new_context (struct coap_context_t *coap_context) |
Creates a new DTLS context for the given coap_context . More... | |
void | coap_dtls_free_context (struct coap_dtls_context_t *dtls_context) |
Releases the storage allocated for dtls_context . More... | |
static ssize_t | decrypt_callback (gnutls_transport_ptr_t context, void *receive_buffer, size_t receive_buffer_length) |
static ssize_t | dtls_send_to_peer (gnutls_transport_ptr_t context, const void *send_buffer, size_t send_buffer_length) |
static int | psk_client_callback (gnutls_session_t session, char **username, gnutls_datum_t *key) |
static int | psk_callback (gnutls_session_t session, const char *username, gnutls_datum_t *key) |
struct coap_dtls_session_t * | coap_dtls_new_session (struct coap_dtls_context_t *dtls_context, const coap_endpoint_t *local_interface, const coap_address_t *remote) |
void | coap_dtls_free_session (struct coap_dtls_context_t *dtls_context, struct coap_dtls_session_t *session) |
static struct coap_dtls_session_t * | coap_dtls_find_session (coap_dtls_context_t *dtls_context, const coap_endpoint_t *local_interface, const coap_address_t *dst) |
struct coap_dtls_session_t * | coap_dtls_get_session (struct coap_context_t *coap_context, const coap_endpoint_t *local_interface, const coap_address_t *dst) |
int | coap_dtls_send (struct coap_context_t *coap_context, struct coap_dtls_session_t *session, const coap_pdu_t *pdu) |
int | coap_dtls_handle_message (struct coap_context_t *coap_context, const coap_endpoint_t *local_interface, const coap_address_t *dst, const unsigned char *data, size_t data_len) |
#define COAP_COPY_ADDRESS | ( | DST, | |
SRC | |||
) |
Definition at line 89 of file coap_dtls_gnutls.c.
#define CONTEXT_SIZE (sizeof(struct coap_dtls_context_t)) |
#define ITEM_SIZE (sizeof(struct queue_t) + data_length) |
#define UNUSED |
Definition at line 27 of file coap_dtls_gnutls.c.
typedef enum CertificateFormat_ CertificateFormat |
typedef struct coap_dtls_context_t coap_dtls_context_t |
enum CertificateFormat_ |
Enumerator | |
---|---|
CERTIFICATE_FORMAT_NONE | |
CERTIFICATE_FORMAT_ASN1 | |
CERTIFICATE_FORMAT_PEM |
Definition at line 40 of file coap_dtls_gnutls.c.
enum CredentialType |
Enumerator | |
---|---|
CREDENTIAL_TYPE_NOT_SET | |
CREDENTIAL_TYPE_CLIENT_PSK | |
CREDENTIAL_TYPE_SERVER_PSK |
Definition at line 33 of file coap_dtls_gnutls.c.
|
static |
Definition at line 484 of file coap_dtls_gnutls.c.
void coap_dtls_free_context | ( | struct coap_dtls_context_t * | dtls_context | ) |
Releases the storage allocated for dtls_context
.
Definition at line 195 of file coap_dtls_gnutls.c.
void coap_dtls_free_session | ( | struct coap_dtls_context_t * | dtls_context, |
struct coap_dtls_session_t * | session | ||
) |
struct coap_dtls_session_t* coap_dtls_get_session | ( | struct coap_context_t * | coap_context, |
const coap_endpoint_t * | local_interface, | ||
const coap_address_t * | dst | ||
) |
int coap_dtls_handle_message | ( | struct coap_context_t * | coap_context, |
const coap_endpoint_t * | local_interface, | ||
const coap_address_t * | dst, | ||
const unsigned char * | data, | ||
size_t | data_len | ||
) |
struct coap_dtls_session_t* coap_dtls_new_session | ( | struct coap_dtls_context_t * | dtls_context, |
const coap_endpoint_t * | local_interface, | ||
const coap_address_t * | remote | ||
) |
Definition at line 363 of file coap_dtls_gnutls.c.
int coap_dtls_send | ( | struct coap_context_t * | coap_context, |
struct coap_dtls_session_t * | session, | ||
const coap_pdu_t * | pdu | ||
) |
Definition at line 520 of file coap_dtls_gnutls.c.
|
static |
Definition at line 232 of file coap_dtls_gnutls.c.
|
static |
Definition at line 283 of file coap_dtls_gnutls.c.
void dtls_set_psk | ( | struct coap_dtls_context_t * | ctx, |
const char * | identity, | ||
const uint8_t * | key, | ||
int | key_length | ||
) |
|
static |
|
static |
|
static |
Definition at line 140 of file coap_dtls_gnutls.c.