jabberd2  2.3.1
util_compat.h
Go to the documentation of this file.
1 /*
2  * jabberd - Jabber Open Source Server
3  * Copyright (c) 2002 Jeremie Miller, Thomas Muldowney,
4  * Ryan Eatmon, Robert Norris
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
19  */
20 
21 #ifdef HAVE_CONFIG_H
22 # include <config.h>
23 #endif
24 
25 #ifndef INCL_UTIL_COMPAT_H
26 #define INCL_UTIL_COMPAT_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
37 #ifndef PF_INET6
38 # define PF_INET6 10
39 #endif
40 
41 #ifndef AF_INET6
42 # define AF_INET6 PF_INET6
43 #endif
44 
45 #ifndef INET6_ADDRSTRLEN
46 # define INET6_ADDRSTRLEN 46
48 #endif
49 
50 
51 #ifndef IN6_IS_ADDR_V4MAPPED
52 
53 #define IN6_IS_ADDR_V4MAPPED(a) \
54  ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
55  (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
56  (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
57 #endif
58 
59 #ifndef HAVE_SA_FAMILY_T
60 typedef unsigned short sa_family_t;
61 #endif
62 
63 #ifndef HAVE_STRUCT_IN6_ADDR
64 
68 struct in6_addr {
69  uint8_t s6_addr[16];
70 };
71 #endif /* NO_IN6_ADDR */
72 
73 #ifndef HAVE_STRUCT_SOCKADDR_IN6
74 
78 struct sockaddr_in6 {
79 #ifdef SIN6_LEN
80  uint8_t sin6_len;
81 #endif /* SIN6_LEN */
82  sa_family_t sin6_family;
83  in_port_t sin6_port;
84  uint32_t sin6_flowinfo;
86  uint32_t sin6_scope_id;
87 };
88 #endif /* NO_SOCKADDR_IN6 */
89 
90 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
91 
96 #define _SS_PADSIZE (128-sizeof(sa_family_t))
98  sa_family_t ss_family;
100 };
101 #endif /* NO_SOCKADDR_STORAGE */
102 
103 #ifndef SSL_OP_NO_TICKET
104 #define SSL_OP_NO_TICKET 0x00004000L
105 #endif
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* INCL_UTIL_H */
uint8_t s6_addr[16]
IPv6 address.
Definition: util_compat.h:70
char __ss_pad[_SS_PADSIZE]
padding to a size of 128 bytes
Definition: util_compat.h:100
uint32_t sin6_flowinfo
IPv6 traffic class and flow info.
Definition: util_compat.h:85
sa_family_t ss_family
address family
Definition: util_compat.h:99
uint32_t sin6_scope_id
set of interfaces for a scope
Definition: util_compat.h:87
structure that contains a plain IPv6 address (only defined if not contained in the libc ...
Definition: util_compat.h:69
#define _SS_PADSIZE
container for sockaddr_in and sockaddr_in6 structures, handled like an object in jabberd2 code (this ...
Definition: util_compat.h:97
structure that contains an IPv6 including some additional attributes (only defined if not contained i...
Definition: util_compat.h:79
sa_family_t sin6_family
address family (AF_INET6)
Definition: util_compat.h:83
unsigned short sa_family_t
Definition: util_compat.h:61
in_port_t sin6_port
transport layer port #
Definition: util_compat.h:84
struct in6_addr sin6_addr
IPv6 address.
Definition: util_compat.h:86