Imported Upstream version 3.2
[platform/upstream/libwebsockets.git] / include / libwebsockets / lws-optee.h
1 /*
2  * libwebsockets - small server side websockets and web server implementation
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (C) 2019 Akira Tsukamoto <akira.tsukamoto@gmail.com>
6  *
7  *  This library is free software; you can redistribute it and/or
8  *  modify it under the terms of the GNU Lesser General Public
9  *  License as published by the Free Software Foundation:
10  *  version 2.1 of the License.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public
18  *  License along with this library; if not, write to the Free Software
19  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  *  MA  02110-1301  USA
21  *
22  * included from libwebsockets.h
23  */
24
25 #ifndef __LWS_OPTEE_H
26 #define __LWS_OPTEE_H
27
28 /* 128-bit IP6 address */
29 struct in6_addr {
30         union {
31                 uint8_t   u6_addr8[16];
32                 uint16_t  u6_addr16[8];
33                 uint32_t  u6_addr32[4];
34         };
35 };
36
37 #define         _SS_MAXSIZE     128U
38 #define         _SS_ALIGNSIZE   (sizeof(int64_t))
39 #define         _SS_PAD1SIZE    (_SS_ALIGNSIZE - \
40                         sizeof(sa_family_t))
41 #define         _SS_PAD2SIZE    (_SS_MAXSIZE - \
42                         sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE)
43
44 struct sockaddr_storage {
45         sa_family_t     ss_family;      /* address family */
46         char            __ss_pad1[_SS_PAD1SIZE];
47         int64_t         __ss_align;     /* force desired struct alignment */
48         char            __ss_pad2[_SS_PAD2SIZE];
49 };
50
51 #define __SOCK_SIZE__   16              /* sizeof(struct sockaddr)      */
52 struct sockaddr {
53         sa_family_t     sa_family;      /* address family */
54         uint8_t         sa_data[__SOCK_SIZE__   /* address value */
55                                 - sizeof(sa_family_t)];
56 };
57
58 /* 16 bytes */
59 struct sockaddr_in {
60         sa_family_t     sin_family;
61         in_port_t       sin_port;
62         struct in_addr  sin_addr;
63         uint8_t         sin_zero[__SOCK_SIZE__  /* padding until 16 bytes */
64                                 - sizeof(sa_family_t)
65                                 - sizeof(in_port_t)
66                                 - sizeof(struct  in_addr)];
67 };
68
69 struct sockaddr_in6 {
70         sa_family_t     sin6_family;    /* AF_INET6 */
71         in_port_t       sin6_port;      /* Transport layer port # */
72         uint32_t        sin6_flowinfo;  /* IP6 flow information */
73         struct in6_addr sin6_addr;      /* IP6 address */
74         uint32_t        sin6_scope_id;  /* scope zone index */
75 };
76
77 #endif /* __LWS_OPTEE_H */