tinydtls  0.8.6
netq.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Copyright (c) 2011, 2012, 2013, 2014, 2015 Olaf Bergmann (TZI) and others.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
7  *
8  * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
9  * and the Eclipse Distribution License is available at
10  * http://www.eclipse.org/org/documents/edl-v10.php.
11  *
12  * Contributors:
13  * Olaf Bergmann - initial API and implementation
14  * Hauke Mehrtens - memory optimization, ECC integration
15  *
16  *******************************************************************************/
17 
18 #ifndef _DTLS_NETQ_H_
19 #define _DTLS_NETQ_H_
20 
21 #include "tinydtls.h"
22 #include "global.h"
23 #include "dtls.h"
24 #include "dtls_time.h"
25 
34 #ifndef NETQ_MAXCNT
35 #ifdef DTLS_ECC
36 #define NETQ_MAXCNT 5
37 #elif defined(DTLS_PSK)
38 #define NETQ_MAXCNT 3
39 #endif
40 #endif
41 
45 typedef unsigned char netq_packet_t[DTLS_MAX_BUF];
46 
47 typedef struct netq_t {
48  struct netq_t *next;
49 
51  unsigned int timeout;
54  uint16_t epoch;
56  unsigned char retransmit_cnt;
58  size_t length;
59 #ifndef WITH_CONTIKI
60  unsigned char data[];
61 #else
63 #endif
64 } netq_t;
65 
66 #ifndef WITH_CONTIKI
67 static inline void netq_init(void)
68 { }
69 #else
70 void netq_init(void);
71 #endif
72 
82 int netq_insert_node(netq_t **queue, netq_t *node);
83 
86 void netq_node_free(netq_t *node);
87 
89 void netq_delete_all(netq_t **queue);
90 
92 netq_t *netq_node_new(size_t size);
93 
98 netq_t *netq_head(netq_t **queue);
99 
100 netq_t *netq_next(netq_t *p);
101 void netq_remove(netq_t **queue, netq_t *p);
102 
108 netq_t *netq_pop_first(netq_t **queue);
109 
112 #endif /* _DTLS_NETQ_H_ */
int netq_insert_node(netq_t **queue, netq_t *node)
Definition: netq.c:66
unsigned char retransmit_cnt
Definition: netq.h:56
netq_t * netq_pop_first(netq_t **queue)
Definition: netq.c:109
public tinydtls API
struct netq_t * next
Definition: netq.h:48
netq_t * netq_next(netq_t *p)
Definition: netq.c:94
unsigned char data[]
Definition: netq.h:60
Definition: netq.h:47
netq_t * netq_node_new(size_t size)
Definition: netq.c:119
static void netq_init(void)
Definition: netq.h:67
void netq_delete_all(netq_t **queue)
Definition: netq.c:141
netq_t * netq_head(netq_t **queue)
Definition: netq.c:89
uint32_t clock_time_t
Definition: dtls_time.h:46
unsigned char netq_packet_t[DTLS_MAX_BUF]
Definition: netq.h:45
struct netq_t netq_t
Clock Handling.
clock_time_t t
Definition: netq.h:50
dtls_peer_t * peer
Definition: netq.h:53
uint16_t epoch
Definition: netq.h:54
High level DTLS API and visible structures.
unsigned int timeout
Definition: netq.h:51
uint8_t type
Definition: netq.h:55
void netq_remove(netq_t **queue, netq_t *p)
Definition: netq.c:102
void netq_node_free(netq_t *node)
Definition: netq.c:135
#define DTLS_MAX_BUF
Definition: global.h:56
size_t length
Definition: netq.h:58
unsigned char uint8_t
Definition: uthash.h:79