NetWare tweaks from Guruprasad.
[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/*
11 * FILENAME : nw5sck.h
12 * DESCRIPTION : Socket related functions.
13 * Author : SGP
14 * Date : January 2001.
15 *
16 */
17
18
19
20#ifndef _INC_NW_SOCKET
21#define _INC_NW_SOCKET
22
23
24#include <sys/socket.h>
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29typedef u_int SOCKET;
30
31struct nwsockent local_context;
32
33# undef gethostbyname
34# undef gethostbyaddr
35
36# undef endhostent
37# undef endnetent
38# undef endprotoent
39# undef endservent
40# undef gethostent
41# undef getprotoent
42# undef getnetbyaddr
43# undef getnetbyname
44# undef gethostbyaddr
45# undef getprotobyname
46# undef getprotobyname
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)
68# define getprotobyname(name) NWgetprotobyname(&local_context,name)
69# define getservbyname(n,p) NWgetservbyname(&local_context,n,p)
70# define getservbyport(n,p) NWgetservbyport(&local_context,n,p)
71# define getservent() NWgetservent(&local_context)
72# define sethostent() NWsethostent(&local_context, stayopen)
73# define setnetent() NWsetnetent(&local_context, stayopen)
74# define setprotoent() NWsetprotoent(&local_context, stayopen)
75# define setservent() NWsetservent(&local_context, stayopen)
76
77u_long nw_htonl(u_long hostlong);
78u_short nw_htons(u_short hostshort);
79u_long nw_ntohl(u_long netlong);
80u_short nw_ntohs(u_short netshort);
81
82SOCKET nw_accept(SOCKET s, struct sockaddr *addr, int *addrlen);
83int nw_bind(SOCKET s, const struct sockaddr *addr, int addrlen);
84int nw_connect(SOCKET s, const struct sockaddr *addr, int addrlen);
85
86struct hostent * nw_gethostbyname(const char * name);
87struct hostent * nw_gethostbyaddr(const char *addr, int len, int type);
88int nw_gethostname(char *name, int len);
89struct netent * nw_getnetbyaddr(long net, int type);
90struct netent *nw_getnetbyname(char *name);
91int nw_getpeername(SOCKET s, struct sockaddr *addr, int *addrlen);
92struct protoent * nw_getprotobyname(const char *name);
93struct protoent * nw_getprotobynumber(int num);
94struct servent * nw_getservbyname(const char *name, const char *proto);
95struct servent * nw_getservbyport(int port, const char *proto);
96struct servent * nw_getservent(void);
97void nw_sethostent(int stayopen);
98void nw_setnetent(int stayopen);
99void nw_setprotoent(int stayopen);
100void nw_setservent(int stayopen);
225a5dca 101int nw_setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen);
2986a63f 102
103int nw_getsockname(SOCKET s, struct sockaddr *addr, int *addrlen);
104int nw_getsockopt(SOCKET s, int level, int optname, char *optval, int *optlen);
105
106unsigned long nw_inet_addr(const char *cp);
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