jabberd2  2.3.3
inaddr.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 #ifndef INCL_INADDR_H
22 #define INCL_INADDR_H
23 
24 #ifdef HAVE_CONFIG_H
25 # include <config.h>
26 #endif
27 
28 #include "ac-stdint.h"
29 
30 #ifdef HAVE_STRING_H
31 #include <string.h>
32 #endif
33 
34 #ifdef HAVE_NETINET_IN_H
35 #include <netinet/in.h>
36 #endif
37 
38 #ifdef HAVE_ARPA_INET_H
39 #include <arpa/inet.h>
40 #endif
41 
42 #ifdef HAVE_SYS_SOCKET_H
43 #include <sys/socket.h>
44 #endif
45 
46 #ifdef USE_LIBSUBST
47 #include "subst/subst.h"
48 #endif
49 
50 /* jabberd2 Windows DLL */
51 #ifndef JABBERD2_API
52 # ifdef _WIN32
53 # ifdef JABBERD2_EXPORTS
54 # define JABBERD2_API __declspec(dllexport)
55 # else /* JABBERD2_EXPORTS */
56 # define JABBERD2_API __declspec(dllimport)
57 # endif /* JABBERD2_EXPORTS */
58 # else /* _WIN32 */
59 # define JABBERD2_API extern
60 # endif /* _WIN32 */
61 #endif /* JABBERD2_API */
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
67 /*
68  * helpers for ip addresses
69  */
70 
71 #include <util/util_compat.h>
72 
73 JABBERD2_API int j_inet_pton(const char *src, struct sockaddr_storage *dst);
74 JABBERD2_API const char *j_inet_ntop(struct sockaddr_storage* src, char* dst, size_t size);
76 JABBERD2_API int j_inet_setport(struct sockaddr_storage *sa, in_port_t port);
77 JABBERD2_API socklen_t j_inet_addrlen(struct sockaddr_storage *sa);
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif /* INCL_UTIL_H */
84 
85 
#define JABBERD2_API
Definition: inaddr.h:59
JABBERD2_API socklen_t j_inet_addrlen(struct sockaddr_storage *sa)
calculate the size of an address structure (on some unices the stdlibc functions for socket handling ...
Definition: inaddr.c:203
JABBERD2_API int j_inet_getport(struct sockaddr_storage *sa)
get the port number out of a struct sockaddr_storage
Definition: inaddr.c:148
JABBERD2_API const char * j_inet_ntop(struct sockaddr_storage *src, char *dst, size_t size)
get the string representation of an address in struct sockaddr_storage (modeled after the stdlib func...
Definition: inaddr.c:97
JABBERD2_API int j_inet_pton(const char *src, struct sockaddr_storage *dst)
set the address of a struct sockaddr_storage (modeled after the stdlib function inet_pton) ...
Definition: inaddr.c:46
define the structures that could be missing in old libc implementations
JABBERD2_API int j_inet_setport(struct sockaddr_storage *sa, in_port_t port)
set the port number in a struct sockaddr_storage
Definition: inaddr.c:173