Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Loading...
Searching...
No Matches
mbedtlsconnection.h
Go to the documentation of this file.
1/*******************************************************************************
2 *
3 * Copyright (c) 2013, 2014 Intel Corporation and others.
4 * Copyright (c) 2020, Cascoda Ltd.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Distribution License v1.0
7 * which accompanies this distribution.
8 *
9 * The Eclipse Distribution License is available at
10 * http://www.eclipse.org/org/documents/edl-v10.php.
11 *
12 * Contributors:
13 * David Navarro, Intel Corporation - initial API and implementation
14 * Ciaran Woodward, Cascoda Ltd - modification for Cascoda SDK, OpenThread and mbedtls
15 *
16 *******************************************************************************/
17
18#ifndef CONNECTION_H_
19#define CONNECTION_H_
20
21#include <liblwm2m.h>
22#include <stdio.h>
23#include <unistd.h>
24
25#include "mbedtls/certs.h"
26#include "mbedtls/error.h"
27#include "mbedtls/net_sockets.h"
28#include "mbedtls/ssl.h"
29#include "mbedtls/timing.h"
30
31#include "openthread/ip6.h"
32#include "openthread/random_crypto.h"
33#include "openthread/udp.h"
34
36#include "ca821x_error.h"
37
38#define LWM2M_STANDARD_PORT_STR "5683"
39#define LWM2M_STANDARD_PORT 5683
40#define LWM2M_DTLS_PORT_STR "5684"
41#define LWM2M_DTLS_PORT 5684
42#define LWM2M_BSSERVER_PORT_STR "5685"
43#define LWM2M_BSSERVER_PORT 5685
44
45enum
46{
49 LINK_MTU = 1280,
50};
51
55typedef struct connection_t
56{
57 otUdpSocket socket;
58 mbedtls_ssl_context ssl;
59 mbedtls_ssl_config conf;
62 lwm2m_context_t *lwm2mH;
63 lwm2m_object_t *securityObj;
67 bool inUse;
69 bool isSecure;
71
84connection_t *connection_create(otInstance *aInstance,
85 lwm2m_context_t *lwm2mH,
86 lwm2m_object_t *securityObj,
87 int instanceId);
88
94
99void connection_rx_info_callback(uint16_t aPktLen);
100
105void connection_tx_info_callback(uint16_t aPktLen);
106
107#endif
Global error declarations for use across the Cascoda SDK.
Helper 'tasklet' framework for scheduling simple events for the future.
void connection_rx_info_callback(uint16_t aPktLen)
Callback that can be implemented by the application to track receive statistics.
Definition lwm2mclient.c:670
connection_t * connection_create(otInstance *aInstance, lwm2m_context_t *lwm2mH, lwm2m_object_t *securityObj, int instanceId)
Called from example code directly to create a connection when connecting to a server.
Definition mbedtlsconnection.c:419
void connection_free(connection_t *con)
Free a connection created with connection_create.
Definition connection.c:195
@ CIPHERSUITE_COUNT
We only configure one ciphersuite on the client, based on authentication method.
Definition mbedtlsconnection.h:47
@ LINK_MTU
Maximum Transmission Unit for link.
Definition mbedtlsconnection.h:49
@ CONPOOL_SIZE
Maximum number of concurrent connections.
Definition mbedtlsconnection.h:48
void connection_tx_info_callback(uint16_t aPktLen)
Callback that can be implemented by the application to track transmit statistics.
Definition lwm2mclient.c:675
Internal tasklet state structure.
Definition cascoda_tasklet.h:66
The struct for holding information about each connection the lwm2m stack uses.
Definition connection.h:47
lwm2m_context_t * lwm2mH
Pointer to instance of lwm2m.
Definition connection.h:50
int cipherSuites[CIPHERSUITE_COUNT+1]
List of the cipher suites in use.
Definition mbedtlsconnection.h:64
uint32_t intermediateTime
Used with mbedtls_tasklet to implement the intermediate time.
Definition mbedtlsconnection.h:66
bool isSecure
Used to determine whether this connection is secured with dtls.
Definition mbedtlsconnection.h:69
mbedtls_ssl_config conf
mbedtls ssl config info
Definition mbedtlsconnection.h:59
int securityInstId
lwm2m security instance ID
Definition mbedtlsconnection.h:65
mbedtls_ssl_context ssl
mbedtls ssl context and state
Definition mbedtlsconnection.h:58
lwm2m_object_t * securityObj
Pointer to lwm2m security instance.
Definition mbedtlsconnection.h:63
ca_tasklet mbedtls_tasklet
Tasklet for managing mbedtls timing.
Definition mbedtlsconnection.h:60
bool isTimerPassed
Used in with mbedtls_tasklet to determine expired or cancelled.
Definition mbedtlsconnection.h:68
otUdpSocket socket
Openthread socket structure, used for UDP communications.
Definition connection.h:48
otInstance * otInstance
Pointer to openthread instance.
Definition connection.h:49
bool inUse
Used internally to determine whether this connection structure is in use.
Definition connection.h:51