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);
35 # if defined(__DECC) && defined(__DECC_VER) && (__DECC_VER >= 50200000)
36 # define Sock_size_t unsigned int
40 /* Pull in SOCKETSHR's header, and set up structures for
41 * gcc, whose basic header file set doesn't include the
48 /* we may not have netdb.h etc, so lets just do this here - div */
49 /* no harm doing this for all .c files - needed only by pp_sys.c */
52 char *h_name; /* official name of host */
53 char **h_aliases; /* alias list */
54 int h_addrtype; /* host address type */
55 int h_length; /* length of address */
56 char **h_addr_list; /* address */
61 #define h_addr h_addr_list[0]
64 char *p_name; /* official protocol name */
65 char **p_aliases; /* alias list */
66 int p_proto; /* protocol # */
70 char *s_name; /* official service name */
71 char **s_aliases; /* alias list */
72 int s_port; /* port # */
73 char *s_proto; /* protocol to use */
81 unsigned short sa_family; /* address family */
82 char sa_data[14]; /* up to 14 bytes of direct address */
86 * Socket address, internet style.
90 unsigned short sin_port;
91 struct in_addr sin_addr;
107 /* Since socketshr.h won't declare function prototypes unless it thinks
108 * the system headers have already been included, we convince it that
116 # define IPPROTO_TCP 6
118 #ifndef __INET_LOADED
119 # define __INET_LOADED
121 #ifndef __NETDB_LOADED
122 # define __NETDB_LOADED
125 /* Finally, we provide prototypes for routines not supported by SocketShr,
126 * so that the stubs in sockadapt.c won't cause complaints about
127 * undeclared routines.
130 struct netent *getnetbyaddr( long net, int type);
131 struct netent *getnetbyname( char *name);
132 struct netent *getnetent();
136 #else /* !__GNU_CC__ */
138 /* DECC and VAXC have socket headers in the system set; they're for UCX, but
139 * we'll assume that the actual calling sequence is identical across the
140 * various TCP/IP stacks; these routines are pretty standard.
147 /* SocketShr doesn't support these routines, but the DECC RTL contains
148 * stubs with these names, designed to be used with the UCX socket
149 * library. We avoid linker collisions by substituting new names.
151 #define getnetbyaddr no_getnetbyaddr
152 #define getnetbyname no_getnetbyname
153 #define getnetent no_getnetent
154 #define setnetent no_setnetent
155 #define endnetent no_endnetent
158 /* We don't have these two in the system headers. */
162 #include <socketshr.h>
163 /* socketshr.h from SocketShr 0.9D doesn't alias fileno; its comments say
164 * that the CRTL version works OK. This isn't the case, at least with
165 * VAXC, so we use the SocketShr version.
166 * N.B. This means that sockadapt.h must be included *after* stdio.h.
167 * This is presently the case for Perl.
172 #define fileno si_fileno
173 int si_fileno(FILE *);
176 /* Catch erroneous results for UDP sockets -- see sockadapt.c */
180 #define getpeername my_getpeername
181 int my_getpeername _((int, struct sockaddr *, int *));
183 #endif /* SOCKETSHR stuff */
184 #endif /* include guard */