3 * Authors: Charles Bailey bailey@newman.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
27 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
30 void endhostent(void);
33 void setprotoent(int);
34 void endprotoent(void);
36 void endservent(void);
38 # if defined(__DECC) && defined(__DECC_VER) && (__DECC_VER >= 50200000) && !defined(Sock_size_t)
39 # define Sock_size_t unsigned int
43 /* Pull in SOCKETSHR's header, and set up structures for
44 * gcc, whose basic header file set doesn't include the
51 /* we may not have netdb.h etc, so lets just do this here - div */
52 /* no harm doing this for all .c files - needed only by pp_sys.c */
55 char *h_name; /* official name of host */
56 char **h_aliases; /* alias list */
57 int h_addrtype; /* host address type */
58 int h_length; /* length of address */
59 char **h_addr_list; /* address */
64 #define h_addr h_addr_list[0]
67 char *p_name; /* official protocol name */
68 char **p_aliases; /* alias list */
69 int p_proto; /* protocol # */
73 char *s_name; /* official service name */
74 char **s_aliases; /* alias list */
75 int s_port; /* port # */
76 char *s_proto; /* protocol to use */
84 unsigned short sa_family; /* address family */
85 char sa_data[14]; /* up to 14 bytes of direct address */
89 * Socket address, internet style.
93 unsigned short sin_port;
94 struct in_addr sin_addr;
110 /* Since socketshr.h won't declare function prototypes unless it thinks
111 * the system headers have already been included, we convince it that
119 # define IPPROTO_TCP 6
121 #ifndef __INET_LOADED
122 # define __INET_LOADED
124 #ifndef __NETDB_LOADED
125 # define __NETDB_LOADED
128 /* Finally, we provide prototypes for routines not supported by SocketShr,
129 * so that the stubs in sockadapt.c won't cause complaints about
130 * undeclared routines.
133 struct netent *getnetbyaddr( long net, int type);
134 struct netent *getnetbyname( char *name);
135 struct netent *getnetent();
139 #else /* !__GNU_CC__ */
141 /* DECC and VAXC have socket headers in the system set; they're for UCX, but
142 * we'll assume that the actual calling sequence is identical across the
143 * various TCP/IP stacks; these routines are pretty standard.
149 /* SocketShr doesn't support these routines, but the DECC RTL contains
150 * stubs with these names, designed to be used with the UCX socket
151 * library. We avoid linker collisions by substituting new names.
153 #define getnetbyaddr no_getnetbyaddr
154 #define getnetbyname no_getnetbyname
155 #define getnetent no_getnetent
156 #define setnetent no_setnetent
157 #define endnetent no_endnetent
162 /* We don't have these two in the system headers. */
166 #include <socketshr.h>
167 /* socketshr.h from SocketShr 0.9D doesn't alias fileno; its comments say
168 * that the CRTL version works OK. This isn't the case, at least with
169 * VAXC, so we use the SocketShr version.
170 * N.B. This means that sockadapt.h must be included *after* stdio.h.
171 * This is presently the case for Perl.
176 #define fileno si_fileno
177 int si_fileno(FILE *);
180 /* Catch erroneous results for UDP sockets -- see sockadapt.c */
184 #define getpeername my_getpeername
185 int my_getpeername (int, struct sockaddr *, int *);
187 #endif /* SOCKETSHR stuff */
188 #endif /* include guard */