2004-09-28 16:34:51 +08:00
|
|
|
|
|
|
|
/*
|
2004-09-30 00:00:49 +08:00
|
|
|
* Copyright (C) Igor Sysoev
|
2004-09-28 16:34:51 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-08-16 23:27:03 +08:00
|
|
|
#ifndef _NGX_SOCKET_H_INCLUDED_
|
|
|
|
#define _NGX_SOCKET_H_INCLUDED_
|
|
|
|
|
|
|
|
|
|
|
|
#include <ngx_config.h>
|
2003-06-03 23:42:58 +08:00
|
|
|
#include <ngx_core.h>
|
|
|
|
|
2002-08-16 23:27:03 +08:00
|
|
|
|
2002-09-16 23:01:44 +08:00
|
|
|
#define NGX_WRITE_SHUTDOWN SD_SEND
|
|
|
|
|
2002-09-02 22:48:24 +08:00
|
|
|
|
2002-08-20 22:48:28 +08:00
|
|
|
typedef SOCKET ngx_socket_t;
|
2002-09-02 22:48:24 +08:00
|
|
|
typedef int socklen_t;
|
2002-08-16 23:27:03 +08:00
|
|
|
|
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
#define ngx_socket(af, type, proto) \
|
|
|
|
WSASocket(af, type, proto, NULL, 0, WSA_FLAG_OVERLAPPED)
|
2003-06-11 23:28:34 +08:00
|
|
|
|
2002-08-26 23:18:19 +08:00
|
|
|
#define ngx_socket_n "WSASocket()"
|
|
|
|
|
2002-09-02 22:48:24 +08:00
|
|
|
int ngx_nonblocking(ngx_socket_t s);
|
2003-02-07 01:21:13 +08:00
|
|
|
int ngx_blocking(ngx_socket_t s);
|
|
|
|
|
2002-08-26 23:18:19 +08:00
|
|
|
#define ngx_nonblocking_n "ioctlsocket(FIONBIO)"
|
2003-02-07 01:21:13 +08:00
|
|
|
#define ngx_blocking_n "ioctlsocket(!FIONBIO)"
|
2002-08-16 23:27:03 +08:00
|
|
|
|
2002-09-16 23:01:44 +08:00
|
|
|
#define ngx_shutdown_socket shutdown
|
|
|
|
#define ngx_shutdown_socket_n "shutdown()"
|
|
|
|
|
2002-08-20 22:48:28 +08:00
|
|
|
#define ngx_close_socket closesocket
|
2002-08-26 23:18:19 +08:00
|
|
|
#define ngx_close_socket_n "closesocket()"
|
2002-08-16 23:27:03 +08:00
|
|
|
|
|
|
|
|
2004-03-10 03:47:07 +08:00
|
|
|
#ifndef WSAID_ACCEPTEX
|
|
|
|
|
|
|
|
typedef BOOL (PASCAL FAR * LPFN_ACCEPTEX)(
|
|
|
|
IN SOCKET sListenSocket,
|
|
|
|
IN SOCKET sAcceptSocket,
|
|
|
|
IN PVOID lpOutputBuffer,
|
|
|
|
IN DWORD dwReceiveDataLength,
|
|
|
|
IN DWORD dwLocalAddressLength,
|
|
|
|
IN DWORD dwRemoteAddressLength,
|
|
|
|
OUT LPDWORD lpdwBytesReceived,
|
|
|
|
IN LPOVERLAPPED lpOverlapped
|
|
|
|
);
|
|
|
|
|
|
|
|
#define WSAID_ACCEPTEX \
|
|
|
|
{0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef WSAID_GETACCEPTEXSOCKADDRS
|
|
|
|
|
|
|
|
typedef VOID (PASCAL FAR * LPFN_GETACCEPTEXSOCKADDRS)(
|
|
|
|
IN PVOID lpOutputBuffer,
|
|
|
|
IN DWORD dwReceiveDataLength,
|
|
|
|
IN DWORD dwLocalAddressLength,
|
|
|
|
IN DWORD dwRemoteAddressLength,
|
|
|
|
OUT struct sockaddr **LocalSockaddr,
|
|
|
|
OUT LPINT LocalSockaddrLength,
|
|
|
|
OUT struct sockaddr **RemoteSockaddr,
|
|
|
|
OUT LPINT RemoteSockaddrLength
|
|
|
|
);
|
|
|
|
|
|
|
|
#define WSAID_GETACCEPTEXSOCKADDRS \
|
|
|
|
{0xb5367df2,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef LPFN_TRANSMITFILE
|
|
|
|
|
|
|
|
typedef BOOL (PASCAL FAR * LPFN_TRANSMITFILE)(
|
|
|
|
IN SOCKET hSocket,
|
|
|
|
IN HANDLE hFile,
|
|
|
|
IN DWORD nNumberOfBytesToWrite,
|
|
|
|
IN DWORD nNumberOfBytesPerSend,
|
|
|
|
IN LPOVERLAPPED lpOverlapped,
|
|
|
|
IN LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
|
|
|
|
IN DWORD dwReserved
|
|
|
|
);
|
|
|
|
|
|
|
|
#define WSAID_TRANSMITFILE \
|
|
|
|
{0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2003-02-07 01:21:13 +08:00
|
|
|
extern LPFN_ACCEPTEX acceptex;
|
|
|
|
extern LPFN_GETACCEPTEXSOCKADDRS getacceptexsockaddrs;
|
|
|
|
extern LPFN_TRANSMITFILE transmitfile;
|
|
|
|
|
2002-09-02 22:48:24 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
int ngx_tcp_push(ngx_socket_t s);
|
2003-06-11 23:28:34 +08:00
|
|
|
#define ngx_tcp_push_n "tcp_push()"
|
|
|
|
|
|
|
|
|
2002-08-16 23:27:03 +08:00
|
|
|
#endif /* _NGX_SOCKET_H_INCLUDED_ */
|