Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
connection.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Copyright (c) 2013, 2014 Intel Corporation and others.
4  * Copyright (c) 2021, 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 and OpenThread
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 "openthread/ip6.h"
26 #include "openthread/udp.h"
27 
28 #include "ca821x_error.h"
29 
30 #define LWM2M_STANDARD_PORT_STR "5683"
31 #define LWM2M_STANDARD_PORT 5683
32 #define LWM2M_DTLS_PORT_STR "5684"
33 #define LWM2M_DTLS_PORT 5684
34 #define LWM2M_BSSERVER_PORT_STR "5685"
35 #define LWM2M_BSSERVER_PORT 5685
36 
37 enum
38 {
40  LINK_MTU = 1280,
41 };
42 
46 typedef struct connection_t
47 {
48  otUdpSocket socket;
50  lwm2m_context_t *lwm2mH;
51  bool inUse;
53 
67 connection_t *connection_create(otInstance *aInstance,
68  lwm2m_context_t *lwm2mH,
69  lwm2m_object_t *secObjectP,
70  uint16_t secObjInstID);
71 
76 void connection_free(connection_t *con);
77 
82 void connection_rx_info_callback(uint16_t aPktLen);
83 
88 void connection_tx_info_callback(uint16_t aPktLen);
89 
90 #endif
Global error declarations for use across the Cascoda SDK.
void connection_rx_info_callback(uint16_t aPktLen)
Callback that can be implemented by the application to track receive statistics.
Definition: lwm2mclient.c:670
void connection_free(connection_t *con)
Free a connection created with connection_create.
Definition: connection.c:195
connection_t * connection_create(otInstance *aInstance, lwm2m_context_t *lwm2mH, lwm2m_object_t *secObjectP, uint16_t secObjInstID)
Connect to the server defined in the security object.
Definition: connection.c:144
struct connection_t connection_t
The struct for holding information about each connection the lwm2m stack uses.
@ LINK_MTU
Maximum Transmission Unit for link.
Definition: connection.h:40
@ CONPOOL_SIZE
Maximum number of concurrent connections.
Definition: connection.h:39
void connection_tx_info_callback(uint16_t aPktLen)
Callback that can be implemented by the application to track transmit statistics.
Definition: lwm2mclient.c:675
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
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