2004-09-28 16:34:51 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2002-2004 Igor Sysoev
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-08-16 23:27:03 +08:00
|
|
|
#ifndef _NGX_SOCKET_H_INCLUDED_
|
|
|
|
#define _NGX_SOCKET_H_INCLUDED_
|
|
|
|
|
|
|
|
|
|
|
|
#include <ngx_config.h>
|
|
|
|
|
2003-02-07 01:21:13 +08:00
|
|
|
|
2002-09-12 22:42:29 +08:00
|
|
|
#define NGX_WRITE_SHUTDOWN SHUT_WR
|
2002-08-16 23:27:03 +08:00
|
|
|
|
|
|
|
typedef int ngx_socket_t;
|
|
|
|
|
2002-08-26 23:18:19 +08:00
|
|
|
#define ngx_socket(af, type, proto, flags) socket(af, type, proto)
|
|
|
|
#define ngx_socket_n "socket()"
|
|
|
|
|
2003-02-07 01:21:13 +08:00
|
|
|
|
2003-06-05 01:28:33 +08:00
|
|
|
#if (HAVE_FIONBIO)
|
2003-02-07 01:21:13 +08:00
|
|
|
|
|
|
|
int ngx_nonblocking(ngx_socket_t s);
|
|
|
|
int ngx_blocking(ngx_socket_t s);
|
|
|
|
|
|
|
|
#define ngx_nonblocking_n "ioctl(FIONBIO)"
|
|
|
|
#define ngx_blocking_n "ioctl(!FIONBIO)"
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2002-08-16 23:27:03 +08:00
|
|
|
#define ngx_nonblocking(s) fcntl(s, F_SETFL, O_NONBLOCK)
|
2002-08-26 23:18:19 +08:00
|
|
|
#define ngx_nonblocking_n "fcntl(O_NONBLOCK)"
|
2002-08-16 23:27:03 +08:00
|
|
|
|
2003-02-07 01:21:13 +08:00
|
|
|
#endif
|
|
|
|
|
2003-06-05 01:28:33 +08:00
|
|
|
int ngx_tcp_nopush(ngx_socket_t s);
|
|
|
|
int ngx_tcp_push(ngx_socket_t s);
|
2003-11-26 04:44:56 +08:00
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
|
|
|
|
#define ngx_tcp_nopush_n "setsockopt(TCP_CORK)"
|
|
|
|
#define ngx_tcp_push_n "setsockopt(!TCP_CORK)"
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define ngx_tcp_nopush_n "setsockopt(TCP_NOPUSH)"
|
2003-06-05 01:28:33 +08:00
|
|
|
#define ngx_tcp_push_n "setsockopt(!TCP_NOPUSH)"
|
|
|
|
|
2003-11-26 04:44:56 +08:00
|
|
|
#endif
|
2003-06-05 01:28:33 +08:00
|
|
|
|
2003-02-07 01:21:13 +08:00
|
|
|
|
2002-09-12 22:42:29 +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 close
|
2002-08-26 23:18:19 +08:00
|
|
|
#define ngx_close_socket_n "close()"
|
2002-08-20 22:48:28 +08:00
|
|
|
|
2002-08-16 23:27:03 +08:00
|
|
|
|
|
|
|
#endif /* _NGX_SOCKET_H_INCLUDED_ */
|