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