Commit | Line | Data |
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 |
27 | extern "C" { |
28 | #endif |
29 | |
30 | typedef u_int SOCKET; |
31 | |
32 | struct 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 | |
76 | u_long nw_htonl(u_long hostlong); |
77 | u_short nw_htons(u_short hostshort); |
78 | u_long nw_ntohl(u_long netlong); |
79 | u_short nw_ntohs(u_short netshort); |
80 | |
81 | SOCKET nw_accept(SOCKET s, struct sockaddr *addr, int *addrlen); |
82 | int nw_bind(SOCKET s, const struct sockaddr *addr, int addrlen); |
83 | int nw_connect(SOCKET s, const struct sockaddr *addr, int addrlen); |
84 | |
85 | struct hostent * nw_gethostbyname(const char * name); |
86 | struct hostent * nw_gethostbyaddr(const char *addr, int len, int type); |
87 | int nw_gethostname(char *name, int len); |
88 | struct netent * nw_getnetbyaddr(long net, int type); |
89 | struct netent *nw_getnetbyname(char *name); |
90 | int nw_getpeername(SOCKET s, struct sockaddr *addr, int *addrlen); |
91 | struct protoent * nw_getprotobyname(const char *name); |
92 | struct protoent * nw_getprotobynumber(int num); |
93 | struct servent * nw_getservbyname(const char *name, const char *proto); |
94 | struct servent * nw_getservbyport(int port, const char *proto); |
95 | struct servent * nw_getservent(void); |
96 | void nw_sethostent(int stayopen); |
97 | void nw_setnetent(int stayopen); |
98 | void nw_setprotoent(int stayopen); |
99 | void nw_setservent(int stayopen); |
225a5dca |
100 | int nw_setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen); |
2986a63f |
101 | |
102 | int nw_getsockname(SOCKET s, struct sockaddr *addr, int *addrlen); |
103 | int nw_getsockopt(SOCKET s, int level, int optname, char *optval, int *optlen); |
104 | |
105 | unsigned long nw_inet_addr(const char *cp); |
106 | |
107 | void nw_endhostent(); |
108 | void nw_endnetent(); |
109 | void nw_endprotoent(); |
110 | void nw_endservent(); |
111 | struct hostent *nw_gethostent(); |
112 | struct netent *nw_getnetent(); |
113 | struct protoent * nw_getprotoent(); |
114 | |
115 | SOCKET nw_socket(int af, int type, int protocol); |
116 | int nw_listen(SOCKET s, int backlog); |
117 | int nw_send(SOCKET s, const char *buf, int len, int flags); |
118 | int nw_recv(SOCKET s, char *buf, int len, int flags); |
119 | int nw_sendto(SOCKET s, const char *buf, int len, int flags,const struct sockaddr *to, int tolen); |
120 | int nw_recvfrom(SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen); |
121 | int nw_select(int nfds, fd_set* rd, fd_set* wr, fd_set* ex, const struct timeval* timeout); |
122 | int nw_shutdown(SOCKET s, int how); |
123 | #ifdef __cplusplus |
124 | } |
125 | #endif |
126 | |
127 | |
128 | #endif // _INC_NW_SOCKET |
129 | |