1999-08-13 09:37:52 +04:00
|
|
|
/************************************************
|
|
|
|
|
|
|
|
sockport.h -
|
|
|
|
|
|
|
|
$Author$
|
|
|
|
created at: Fri Apr 30 23:19:34 JST 1999
|
|
|
|
|
|
|
|
************************************************/
|
|
|
|
|
|
|
|
#ifndef SOCKPORT_H
|
|
|
|
#define SOCKPORT_H
|
|
|
|
|
2009-03-02 15:39:47 +03:00
|
|
|
#ifdef SA_LEN
|
|
|
|
# define SS_LEN(ss) (ss)->ss_len
|
|
|
|
#else
|
1999-08-13 09:37:52 +04:00
|
|
|
# ifdef HAVE_SA_LEN
|
|
|
|
# define SA_LEN(sa) (sa)->sa_len
|
2009-02-27 18:21:23 +03:00
|
|
|
# define SS_LEN(ss) (ss)->ss_len
|
1999-08-13 09:37:52 +04:00
|
|
|
# else
|
2009-01-12 20:59:45 +03:00
|
|
|
# ifdef AF_INET6
|
1999-08-13 09:37:52 +04:00
|
|
|
# define SA_LEN(sa) \
|
|
|
|
(((sa)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \
|
|
|
|
: sizeof(struct sockaddr))
|
2009-02-27 18:21:23 +03:00
|
|
|
# define SS_LEN(ss) \
|
|
|
|
(((ss)->ss_family == AF_INET6) ? sizeof(struct sockaddr_in6) \
|
|
|
|
: sizeof(struct sockaddr))
|
1999-08-13 09:37:52 +04:00
|
|
|
# else
|
|
|
|
/* by tradition, sizeof(struct sockaddr) covers most of the sockaddrs */
|
|
|
|
# define SA_LEN(sa) (sizeof(struct sockaddr))
|
2009-02-27 18:21:23 +03:00
|
|
|
# define SS_LEN(ss) (sizeof(struct sockaddr))
|
1999-08-13 09:37:52 +04:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SA_LEN
|
2009-02-13 20:21:53 +03:00
|
|
|
# define SET_SA_LEN(sa, len) (void)((sa)->sa_len = (len))
|
2009-02-27 18:21:23 +03:00
|
|
|
# define SET_SS_LEN(ss, len) (void)((ss)->ss_len = (len))
|
1999-08-13 09:37:52 +04:00
|
|
|
#else
|
2009-02-13 20:21:53 +03:00
|
|
|
# define SET_SA_LEN(sa, len) (void)(len)
|
2009-02-27 18:21:23 +03:00
|
|
|
# define SET_SS_LEN(ss, len) (void)(len)
|
1999-08-13 09:37:52 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SIN_LEN
|
|
|
|
# define SIN_LEN(si) (si)->sin_len
|
|
|
|
# define SET_SIN_LEN(si,len) (si)->sin_len = (len)
|
|
|
|
#else
|
|
|
|
# define SIN_LEN(si) sizeof(struct sockaddr_in)
|
2000-05-12 13:07:57 +04:00
|
|
|
# define SET_SIN_LEN(si,len)
|
1999-08-13 09:37:52 +04:00
|
|
|
#endif
|
|
|
|
|
2000-05-13 20:13:31 +04:00
|
|
|
#ifndef IN_MULTICAST
|
|
|
|
# define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
|
|
|
|
# define IN_MULTICAST(i) IN_CLASSD(i)
|
|
|
|
#endif
|
|
|
|
|
2000-07-10 08:49:24 +04:00
|
|
|
#ifndef IN_EXPERIMENTAL
|
|
|
|
# define IN_EXPERIMENTAL(i) ((((long)(i)) & 0xe0000000) == 0xe0000000)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef IN_CLASSA_NSHIFT
|
|
|
|
# define IN_CLASSA_NSHIFT 24
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef IN_LOOPBACKNET
|
|
|
|
# define IN_LOOPBACKNET 127
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AF_UNSPEC
|
|
|
|
# define AF_UNSPEC 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PF_UNSPEC
|
|
|
|
# define PF_UNSPEC AF_UNSPEC
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PF_INET
|
|
|
|
# define PF_INET AF_INET
|
|
|
|
#endif
|
|
|
|
|
2000-08-24 10:29:30 +04:00
|
|
|
#if defined(HOST_NOT_FOUND) && !defined(h_errno) && !defined(__CYGWIN__)
|
|
|
|
extern int h_errno;
|
|
|
|
#endif
|
|
|
|
|
1999-08-13 09:37:52 +04:00
|
|
|
#endif
|