Little Palm fixes
[MonkeyD.git] / src / include / socket.h
blobad31e549cfbaff941c050c7fbbde2b4ff2570984
1 /* Monkey HTTP Daemon
2 * ------------------
3 * Copyright (C) 2001-2010, Eduardo Silva P. <edsiper@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef MK_SOCKET_H
21 #define MK_SOCKET_H
23 #include <sys/uio.h>
24 #include <netinet/in.h>
25 #include <sys/socket.h>
27 #include "iov.h"
28 #include "request.h"
30 /* Socket_Timeout() */
31 #define ST_RECV 0
32 #define ST_SEND 1
34 #define TCP_CORK_ON 1
35 #define TCP_CORK_OFF 0
37 int mk_socket_set_cork_flag(int fd, int state);
38 int mk_socket_set_tcp_nodelay(int sockfd);
39 int mk_socket_set_nonblocking(int sockfd);
41 int mk_socket_get_ip(int socket, char *ipv4);
42 int mk_socket_close(int socket);
43 int mk_socket_timeout(int s, char *buf, int len, int timeout, int recv_send);
45 int mk_socket_create();
46 int mk_socket_connect(int socket_fd, char *host, int port);
47 void mk_socket_reset(int socket);
48 int mk_socket_server(int port, char *listen_addr);
50 int mk_socket_accept(int server_fd, struct sockaddr_in sock_addr);
51 int mk_socket_sendv(int socket_fd, struct mk_iov *mk_io, int to);
52 int mk_socket_send(int socket_fd, const void *buf, size_t count);
53 int mk_socket_read(int socket_fd, void *buf, int count);
54 int mk_socket_send_file(int socket_fd, int file_fd, off_t *file_offset,
55 size_t file_count);
56 #endif