Chip noticed that the intended optionality of the 'IV' was
[p5sagit/p5-mst-13.2.git] / NetWare / nw5sck.h
CommitLineData
2986a63f 1
2/*
3 * Copyright © 2001 Novell, Inc. All Rights Reserved.
4 *
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
7 *
8 */
9
10/*
8dbfbba0 11 * FILENAME : nw5sck.h
12 * DESCRIPTION : Socket related functions.
13 * Author : SGP
14 * Date : January 2001.
15 * Date Modified: June 26th 2001.
2986a63f 16 *
17 */
18
19
20
21#ifndef _INC_NW_SOCKET
22#define _INC_NW_SOCKET
23
24
25#include <sys/socket.h>
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30typedef u_int SOCKET;
31
32struct nwsockent local_context;
33
34# undef gethostbyname
35# undef gethostbyaddr
36
37# undef endhostent
38# undef endnetent
39# undef endprotoent
40# undef endservent
41# undef gethostent
42# undef getprotoent
43# undef getnetbyaddr
44# undef getnetbyname
45# undef gethostbyaddr
46# undef getprotobyname
2986a63f 47# undef getservbyname
48# undef getservbyport
49# undef getservent
50# undef sethostent
51# undef setnetent
52# undef setprotoent
53# undef setservent
54
55# define gethostbyname(name) NetDBgethostbyname(&local_context,name)
56# define gethostbyaddr(a,l,t) NetDBgethostbyaddr(&local_context,a,l,t)
57
58# define endhostent() NetDBendhostent(&local_context)
59# define endnetent() NWendnetent(&local_context)
60# define endprotoent() NWendprotoent(&local_context)
61# define endservent() NWendservent(&local_context)
62# define gethostent() NetDBgethostent(&local_context,NULL)
63# define getprotoent() NWgetprotoent(&local_context)
64# define gethostbyaddr(a,l,t) NetDBgethostbyaddr(&local_context,a,l,t)
65# define getnetbyaddr(net,typ) NWgetnetbyaddr(&local_context,net,typ)
66# define getnetbyname(name) NWgetnetbyname(&local_context,name)
67# define getprotobyname(name) NWgetprotobyname(&local_context,name)
2986a63f 68# define getservbyname(n,p) NWgetservbyname(&local_context,n,p)
69# define getservbyport(n,p) NWgetservbyport(&local_context,n,p)
70# define getservent() NWgetservent(&local_context)
71# define sethostent() NWsethostent(&local_context, stayopen)
72# define setnetent() NWsetnetent(&local_context, stayopen)
73# define setprotoent() NWsetprotoent(&local_context, stayopen)
74# define setservent() NWsetservent(&local_context, stayopen)
75
76u_long nw_htonl(u_long hostlong);
77u_short nw_htons(u_short hostshort);
78u_long nw_ntohl(u_long netlong);
79u_short nw_ntohs(u_short netshort);
80
81SOCKET nw_accept(SOCKET s, struct sockaddr *addr, int *addrlen);
82int nw_bind(SOCKET s, const struct sockaddr *addr, int addrlen);
83int nw_connect(SOCKET s, const struct sockaddr *addr, int addrlen);
84
85struct hostent * nw_gethostbyname(const char * name);
86struct hostent * nw_gethostbyaddr(const char *addr, int len, int type);
87int nw_gethostname(char *name, int len);
88struct netent * nw_getnetbyaddr(long net, int type);
89struct netent *nw_getnetbyname(char *name);
90int nw_getpeername(SOCKET s, struct sockaddr *addr, int *addrlen);
91struct protoent * nw_getprotobyname(const char *name);
92struct protoent * nw_getprotobynumber(int num);
93struct servent * nw_getservbyname(const char *name, const char *proto);
94struct servent * nw_getservbyport(int port, const char *proto);
95struct servent * nw_getservent(void);
96void nw_sethostent(int stayopen);
97void nw_setnetent(int stayopen);
98void nw_setprotoent(int stayopen);
99void nw_setservent(int stayopen);
225a5dca 100int nw_setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen);
2986a63f 101
102int nw_getsockname(SOCKET s, struct sockaddr *addr, int *addrlen);
103int nw_getsockopt(SOCKET s, int level, int optname, char *optval, int *optlen);
104
105unsigned long nw_inet_addr(const char *cp);
4d76e4b4 106char * nw_inet_ntoa(struct in_addr in);
2986a63f 107
108void nw_endhostent();
109void nw_endnetent();
110void nw_endprotoent();
111void nw_endservent();
112struct hostent *nw_gethostent();
113struct netent *nw_getnetent();
114struct protoent * nw_getprotoent();
115
116SOCKET nw_socket(int af, int type, int protocol);
117int nw_listen(SOCKET s, int backlog);
118int nw_send(SOCKET s, const char *buf, int len, int flags);
119int nw_recv(SOCKET s, char *buf, int len, int flags);
120int nw_sendto(SOCKET s, const char *buf, int len, int flags,const struct sockaddr *to, int tolen);
121int nw_recvfrom(SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen);
122int nw_select(int nfds, fd_set* rd, fd_set* wr, fd_set* ex, const struct timeval* timeout);
123int nw_shutdown(SOCKET s, int how);
124#ifdef __cplusplus
125}
126#endif
127
128
129#endif // _INC_NW_SOCKET
130