tinydtls  0.8.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
session.h
Go to the documentation of this file.
1 /* dtls -- a very basic DTLS implementation
2  *
3  * Copyright (C) 2011--2014 Olaf Bergmann <bergmann@tzi.org>
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without
8  * restriction, including without limitation the rights to use, copy,
9  * modify, merge, publish, distribute, sublicense, and/or sell copies
10  * of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25 
26 #ifndef _DTLS_SESSION_H_
27 #define _DTLS_SESSION_H_
28 
29 #include <string.h>
30 
31 #include "tinydtls.h"
32 #include "global.h"
33 
34 #ifdef WITH_CONTIKI
35 #include "ip/uip.h"
36 typedef struct {
37  unsigned char size;
38  uip_ipaddr_t addr;
39  unsigned short port;
40  int ifindex;
41 } session_t;
42 
43 #else /* WITH_CONTIKI */
44 
45 #include <sys/socket.h>
46 #include <netinet/in.h>
47 #include <arpa/inet.h>
48 
49 typedef struct {
50  socklen_t size;
51  union {
52  struct sockaddr sa;
53  struct sockaddr_storage st;
54  struct sockaddr_in sin;
55  struct sockaddr_in6 sin6;
56  } addr;
57  uint8_t ifindex;
58 } session_t;
59 #endif /* WITH_CONTIKI */
60 
68 void dtls_session_init(session_t *sess);
69 
74 int dtls_session_equals(const session_t *a, const session_t *b);
75 
76 #endif /* _DTLS_SESSION_H_ */
public tinydtls API
socklen_t size
Definition: session.h:50
uint8_t ifindex
Definition: session.h:57
void dtls_session_init(session_t *sess)
Definition: session.c:73
int dtls_session_equals(const session_t *a, const session_t *b)
Definition: session.c:80