3 * Authors: Charles Bailey bailey@genetics.upenn.edu
4 * David Denholm denholm@conmat.phys.soton.ac.uk
5 * Last Revised: 4-Mar-1997
7 * This file should include any other header files and procide any
8 * declarations, typedefs, and prototypes needed by perl for TCP/IP
11 * This version is set up for perl5 with socketshr 0.9D TCP/IP support.
14 #ifndef __SOCKADAPT_INCLUDED
15 #define __SOCKADAPT_INCLUDED 1
17 #if defined(DECCRTL_SOCKETS)
18 /* Use builtin socket interface in DECCRTL and
19 * UCX emulation in whatever TCP/IP stack is present.
20 * Provide prototypes for missing routines; stubs are
28 void endhostent(void);
31 void setprotoent(int);
32 void endprotoent(void);
34 void endservent(void);
37 /* Pull in SOCKETSHR's header, and set up structures for
38 * gcc, whose basic header file set doesn't include the
45 /* we may not have netdb.h etc, so lets just do this here - div */
46 /* no harm doing this for all .c files - needed only by pp_sys.c */
49 char *h_name; /* official name of host */
50 char **h_aliases; /* alias list */
51 int h_addrtype; /* host address type */
52 int h_length; /* length of address */
53 char **h_addr_list; /* address */
58 #define h_addr h_addr_list[0]
61 char *p_name; /* official protocol name */
62 char **p_aliases; /* alias list */
63 int p_proto; /* protocol # */
67 char *s_name; /* official service name */
68 char **s_aliases; /* alias list */
69 int s_port; /* port # */
70 char *s_proto; /* protocol to use */
78 unsigned short sa_family; /* address family */
79 char sa_data[14]; /* up to 14 bytes of direct address */
83 * Socket address, internet style.
87 unsigned short sin_port;
88 struct in_addr sin_addr;
104 /* Since socketshr.h won't declare function prototypes unless it thinks
105 * the system headers have already been included, we convince it that
113 # define IPPROTO_TCP 6
115 #ifndef __INET_LOADED
116 # define __INET_LOADED
118 #ifndef __NETDB_LOADED
119 # define __NETDB_LOADED
122 /* Finally, we provide prototypes for routines not supported by SocketShr,
123 * so that the stubs in sockadapt.c won't cause complaints about
124 * undeclared routines.
127 struct netent *getnetbyaddr( long net, int type);
128 struct netent *getnetbyname( char *name);
129 struct netent *getnetent();
133 #else /* !__GNU_CC__ */
135 /* DECC and VAXC have socket headers in the system set; they're for UCX, but
136 * we'll assume that the actual calling sequence is identical across the
137 * various TCP/IP stacks; these routines are pretty standard.
144 /* SocketShr doesn't support these routines, but the DECC RTL contains
145 * stubs with these names, designed to be used with the UCX socket
146 * library. We avoid linker collisions by substituting new names.
148 #define getnetbyaddr no_getnetbyaddr
149 #define getnetbyname no_getnetbyname
150 #define getnetent no_getnetent
151 #define setnetent no_setnetent
152 #define endnetent no_endnetent
155 /* We don't have these two in the system headers. */
159 #include <socketshr.h>
160 /* socketshr.h from SocketShr 0.9D doesn't alias fileno; its comments say
161 * that the CRTL version works OK. This isn't the case, at least with
162 * VAXC, so we use the SocketShr version.
163 * N.B. This means that sockadapt.h must be included *after* stdio.h.
164 * This is presently the case for Perl.
169 #define fileno si_fileno
170 int si_fileno(FILE *);
173 /* Catch erroneous results for UDP sockets -- see sockadapt.c */
177 #define getpeername my_getpeername
178 int my_getpeername _((int, struct sockaddr *, int *));
180 #endif /* SOCKETSHR stuff */
181 #endif /* include guard */