tinydtls  0.8.6
session.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  *
15  *******************************************************************************/
16 
17 #ifndef _DTLS_SESSION_H_
18 #define _DTLS_SESSION_H_
19 
20 #include <string.h>
21 
22 #include "tinydtls.h"
23 #include "global.h"
24 
25 #ifdef WITH_CONTIKI
26 #include "ip/uip.h"
27 typedef struct {
28  unsigned char size;
29  uip_ipaddr_t addr;
30  unsigned short port;
31  int ifindex;
32 } session_t;
33 
34 #else /* WITH_CONTIKI */
35 
36 #include <sys/socket.h>
37 #include <netinet/in.h>
38 #include <arpa/inet.h>
39 
40 typedef struct {
41  socklen_t size;
42  union {
43  struct sockaddr sa;
44  struct sockaddr_storage st;
45  struct sockaddr_in sin;
46  struct sockaddr_in6 sin6;
47  } addr;
49 } session_t;
50 #endif /* WITH_CONTIKI */
51 
59 void dtls_session_init(session_t *sess);
60 
65 int dtls_session_equals(const session_t *a, const session_t *b);
66 
67 #endif /* _DTLS_SESSION_H_ */
public tinydtls API
socklen_t size
Definition: session.h:41
uint8_t ifindex
Definition: session.h:48
void dtls_session_init(session_t *sess)
Definition: session.c:63
unsigned char uint8_t
Definition: uthash.h:79
int dtls_session_equals(const session_t *a, const session_t *b)
Definition: session.c:70