source: trunk/include/sh_ipvx.h@ 317

Last change on this file since 317 was 315, checked in by katerina, 14 years ago

Fix for ticket #236 (blocking on NFS mounts).

File size: 1.9 KB
Line 
1#ifndef SH_IPVX_H
2#define SH_IPVX_H
3
4#include <sys/types.h>
5#include <sys/socket.h>
6#include <netdb.h>
7#include <netinet/in.h>
8#include <arpa/inet.h>
9
10#if defined(USE_IPVX)
11#define SH_SSP_LEN(a) ((a)->ss_family == AF_INET) ? \
12 sizeof(struct sockaddr_in) : \
13 sizeof(struct sockaddr_in6)
14
15#define SH_SS_LEN(a) ((a).ss_family == AF_INET) ? \
16 sizeof(struct sockaddr_in) : \
17 sizeof(struct sockaddr_in6)
18#else
19#define SH_SSP_LEN(a) sizeof(struct sockaddr_in)
20#define SH_SS_LEN(a) sizeof(struct sockaddr_in)
21#endif
22
23struct sh_sockaddr {
24 int ss_family;
25
26 struct sockaddr_in sin;
27#if defined(USE_IPVX)
28 struct sockaddr_in6 sin6;
29#endif
30};
31
32/* Cast a sockaddress
33 */
34struct sockaddr * sh_ipvx_sockaddr_cast (struct sh_sockaddr * ss);
35
36/* Compare with any_address
37 */
38int sh_ipvx_isany (struct sh_sockaddr * a);
39
40/* Compare two addresses
41 */
42int sh_ipvx_cmp(struct sh_sockaddr * a, struct sh_sockaddr * b);
43
44/* Set the port
45 */
46int sh_ipvx_set_port(struct sh_sockaddr * ss, int port);
47
48/* Get the port
49 */
50int sh_ipvx_get_port(struct sockaddr * ss, int sa_family);
51
52/* Save a sockaddress
53 */
54void sh_ipvx_save(struct sh_sockaddr * ss, int sa_family, struct sockaddr * sa);
55
56/* Ascii numerical sockaddress
57 */
58char * sh_ipvx_print_sockaddr (struct sockaddr * sa, int sa_family);
59
60/* Determine whether the given address is numeric
61 */
62int sh_ipvx_is_numeric (const char * addr);
63
64/* Convert a network address to an ascii numeric address
65 */
66int sh_ipvx_ntoa (char * name, size_t name_size, struct sh_sockaddr * ss);
67
68/* Convert an ascii numeric address to a network address
69 */
70int sh_ipvx_aton (const char * name, struct sh_sockaddr * ss);
71
72/* Try to find canonical hostname
73 */
74char * sh_ipvx_canonical(const char * hostname, char * numeric, size_t nlen);
75
76/* Convert address to hostname
77 */
78char * sh_ipvx_addrtoname(struct sh_sockaddr * ss);
79
80/* Try a reverse lookup
81 */
82int sh_ipvx_reverse_check_ok (char * peer, int port, struct sh_sockaddr * ss);
83#endif
Note: See TracBrowser for help on using the repository browser.