1 /* dtls -- a very basic DTLS implementation
3 * Copyright (C) 2011--2014 Olaf Bergmann <bergmann@tzi.org>
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:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
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
26 #ifndef _DTLS_SESSION_H_
27 #define _DTLS_SESSION_H_
31 #include "dtls_config.h"
44 #else /* WITH_CONTIKI */
46 #ifdef HAVE_SYS_SOCKET_H
47 #include <sys/socket.h>
49 #ifdef HAVE_NETINET_IN_H
50 #include <netinet/in.h>
52 #ifdef HAVE_ARPA_INET_H
53 #include <arpa/inet.h>
55 #ifdef HAVE_WINSOCK2_H
58 #ifdef HAVE_WS2TCPIP_H
64 socklen_t size; /**< size of addr */
70 struct sockaddr_storage st;
71 struct sockaddr_in sin;
72 struct sockaddr_in6 sin6;
76 #endif /* WITH_CONTIKI */
79 * Resets the given session_t object @p sess to its default
80 * values. In particular, the member rlen must be initialized to the
81 * available size for storing addresses.
83 * @param sess The session_t object to initialize.
85 void dtls_session_init(session_t *sess);
88 * Compares the given session objects. This function returns @c 0
89 * when @p a and @p b differ, @c 1 otherwise.
91 int dtls_session_equals(const session_t *a, const session_t *b);
93 #endif /* _DTLS_SESSION_H_ */