source: gsdl/trunk/src/w32server/d_winsock.h@ 15852

Last change on this file since 15852 was 2286, checked in by sjboddie, 23 years ago

Had a bit of a tidy up in the fnord webserver code. The main change of note
was the removal of our reliance on the MAX_URL_SIZE constant. URLs and post
data of any length should now work.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1/**********************************************************************
2 *
3 * d_winsock.h
4 * Copyright (C) 1996
5 *
6 * A component of the fnord webserver written by [email protected].
7 *
8 * Altered for use with the Greenstone digital library software by the
9 * New Zealand Digital Library Project at the University of Waikato,
10 * New Zealand.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 *********************************************************************/
27
28#ifndef D_WINSOCK_H
29#define D_WINSOCK_H
30
31/* get most definitions from the real winsock */
32#include <winsock.h>
33
34#define D_NOERROR 0
35#define D_ERR_UNEXPECTED 1
36#define D_ERR_LOADFAILED 2
37#define D_ERR_FREELIBFAILED 3
38
39// d_LoadWinsock must be called before an normal winsock
40// functions
41
42// expects path to be NULL, a empty string, or a path which ends in a slash
43// returns D_NOERROR on success,
44// D_ERR_UNEXPECTED or D_ERR_LOADFAILED on failure
45int d_LoadWinsock (char *path);
46
47// returns D_NOERROR on success,
48// D_ERR_FREELIBFAILED on failure
49int d_UnloadWinsock ();
50
51// dynamically loaded versions of the winsock functions
52
53SOCKET d_accept (SOCKET s, struct sockaddr *addr, int *addrlen);
54int d_bind (SOCKET s, const struct sockaddr *addr, int namelen);
55int d_closesocket (SOCKET s);
56int d_connect (SOCKET s, const struct sockaddr *name, int namelen);
57int d_ioctlsocket (SOCKET s, long cmd, u_long *argp);
58int d_getpeername (SOCKET s, struct sockaddr *name, int *namelen);
59int d_getsockname (SOCKET s, struct sockaddr *name, int *namelen);
60int d_getsockopt (SOCKET s, int level, int optname, char *optval, int *optlen);
61u_long d_htonl (u_long hostlong);
62u_short d_htons (u_short hostshort);
63unsigned long d_inet_addr (const char *cp);
64char *d_inet_ntoa (struct in_addr in);
65int d_listen (SOCKET s, int backlog);
66u_long d_ntohl (u_long netlong);
67u_short d_ntohs (u_short netshort);
68int d_recv (SOCKET s, char *buf, int len, int flags);
69int d_recvfrom (SOCKET s, char *buf, int len, int flags,
70 struct sockaddr *from, int *fromlen);
71int d_select (int nfds, fd_set *readfds, fd_set *writefds,
72 fd_set *exceptfds, const struct timeval *timeout);
73int d_send (SOCKET s, const char *buf, int len, int flags);
74int d_sendto (SOCKET s, const char *buf, int len, int flags,
75 const struct sockaddr *to, int tolen);
76int d_setsockopt (SOCKET s, int level, int optname,
77 const char *optval, int optlen);
78int d_shutdown (SOCKET s, int how);
79SOCKET d_socket (int af, int type, int protocol);
80
81hostent *d_gethostbyaddr(const char *addr, int len, int type);
82hostent *d_gethostbyname(const char *name);
83int d_gethostname (char *name, int namelen);
84servent *d_getservbyport(int port, const char *proto);
85servent *d_getservbyname(const char *name, const char *proto);
86protoent *d_getprotobynumber(int proto);
87protoent *d_getprotobyname(const char *name);
88
89int d_WSAStartup(WORD wVersionRequired, LPWSADATA lpWSAData);
90int d_WSACleanup(void);
91void d_WSASetLastError(int iError);
92int d_WSAGetLastError(void);
93BOOL d_WSAIsBlocking(void);
94int d_WSAUnhookBlockingHook(void);
95FARPROC d_WSASetBlockingHook(FARPROC lpBlockFunc);
96int d_WSACancelBlockingCall(void);
97HANDLE d_WSAAsyncGetServByName(HWND hWnd, u_int wMsg,
98 const char *name,
99 const char *proto,
100 char *buf, int buflen);
101HANDLE d_WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, int port,
102 const char *proto, char *buf,
103 int buflen);
104HANDLE d_WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg,
105 const char *name, char *buf,
106 int buflen);
107HANDLE d_WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg,
108 int number, char *buf,
109 int buflen);
110HANDLE d_WSAAsyncGetHostByName(HWND hWnd, u_int wMsg,
111 const char *name, char *buf,
112 int buflen);
113HANDLE d_WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg,
114 const char *addr, int len, int type,
115 char *buf, int buflen);
116int d_WSACancelAsyncRequest(HANDLE hAsyncTaskHandle);
117int d_WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg,
118 long lEvent);
119
120#endif
Note: See TracBrowser for help on using the repository browser.