xref: /onnv-gate/usr/src/cmd/ssh/include/fake-socket.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /* $Id: fake-socket.h,v 1.3 2002/04/12 03:35:40 tim Exp $ */
2*0Sstevel@tonic-gate 
3*0Sstevel@tonic-gate #ifndef	_FAKE_SOCKET_H
4*0Sstevel@tonic-gate #define	_FAKE_SOCKET_H
5*0Sstevel@tonic-gate 
6*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
7*0Sstevel@tonic-gate 
8*0Sstevel@tonic-gate #ifdef __cplusplus
9*0Sstevel@tonic-gate extern "C" {
10*0Sstevel@tonic-gate #endif
11*0Sstevel@tonic-gate 
12*0Sstevel@tonic-gate #include "includes.h"
13*0Sstevel@tonic-gate #include "sys/types.h"
14*0Sstevel@tonic-gate 
15*0Sstevel@tonic-gate #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
16*0Sstevel@tonic-gate # define	_SS_MAXSIZE	128	/* Implementation specific max size */
17*0Sstevel@tonic-gate # define       _SS_PADSIZE     (_SS_MAXSIZE - sizeof (struct sockaddr))
18*0Sstevel@tonic-gate 
19*0Sstevel@tonic-gate struct sockaddr_storage {
20*0Sstevel@tonic-gate 	struct	sockaddr ss_sa;
21*0Sstevel@tonic-gate 	char		__ss_pad2[_SS_PADSIZE];
22*0Sstevel@tonic-gate };
23*0Sstevel@tonic-gate # define ss_family ss_sa.sa_family
24*0Sstevel@tonic-gate #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate #ifndef IN6_IS_ADDR_LOOPBACK
27*0Sstevel@tonic-gate # define IN6_IS_ADDR_LOOPBACK(a) \
28*0Sstevel@tonic-gate 	(((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \
29*0Sstevel@tonic-gate 	 ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1))
30*0Sstevel@tonic-gate #endif /* !IN6_IS_ADDR_LOOPBACK */
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifndef HAVE_STRUCT_IN6_ADDR
33*0Sstevel@tonic-gate struct in6_addr {
34*0Sstevel@tonic-gate 	u_int8_t		s6_addr[16];
35*0Sstevel@tonic-gate };
36*0Sstevel@tonic-gate #endif /* !HAVE_STRUCT_IN6_ADDR */
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #ifndef HAVE_STRUCT_SOCKADDR_IN6
39*0Sstevel@tonic-gate struct sockaddr_in6 {
40*0Sstevel@tonic-gate    unsigned short sin6_family;
41*0Sstevel@tonic-gate 	u_int16_t sin6_port;
42*0Sstevel@tonic-gate 	u_int32_t sin6_flowinfo;
43*0Sstevel@tonic-gate 	struct in6_addr sin6_addr;
44*0Sstevel@tonic-gate };
45*0Sstevel@tonic-gate #endif /* !HAVE_STRUCT_SOCKADDR_IN6 */
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate #ifndef AF_INET6
48*0Sstevel@tonic-gate /* Define it to something that should never appear */
49*0Sstevel@tonic-gate #define AF_INET6 AF_MAX
50*0Sstevel@tonic-gate #endif
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate #ifdef __cplusplus
53*0Sstevel@tonic-gate }
54*0Sstevel@tonic-gate #endif
55*0Sstevel@tonic-gate 
56*0Sstevel@tonic-gate #endif /* _FAKE_SOCKET_H */
57