Add some TRACE messages
[MonkeyD.git] / src / include / iov.h
blobab1741cf2709d7465e77c0e47c626839b46befe1
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /* Monkey HTTP Daemon
4 * ------------------
5 * Copyright (C) 2008, Eduardo Silva P.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Library General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef MK_IOV_H
23 #define MK_IOV_H
25 #include <sys/uio.h>
27 #define MK_IOV_FREE_BUF 1
28 #define MK_IOV_NOT_FREE_BUF 0
30 /* iov separators */
31 #define MK_IOV_CRLF "\r\n"
32 #define MK_IOV_CRLFCRLF "\r\n\r\n"
33 #define MK_IOV_LF "\n"
34 #define MK_IOV_SPACE " "
35 #define MK_IOV_HEADER_VALUE ": "
36 #define MK_IOV_SLASH "/"
37 #define MK_IOV_NONE ""
38 #define MK_IOV_EQUAL "="
40 #define MK_IOV_SEND_TO_SOCKET 0
41 #define MK_IOV_SEND_TO_PIPE 1
43 #include "memory.h"
45 mk_pointer mk_iov_crlf;
46 mk_pointer mk_iov_crlfcrlf;
47 mk_pointer mk_iov_lf;
48 mk_pointer mk_iov_space;
49 mk_pointer mk_iov_header_value;
50 mk_pointer mk_iov_slash;
51 mk_pointer mk_iov_none;
52 mk_pointer mk_iov_equal;
54 struct mk_iov
56 struct iovec *io;
57 char **buf_to_free;
58 int iov_idx;
59 int buf_idx;
60 int size;
61 unsigned long total_len;
64 struct mk_iov *mk_iov_create(int n, int offset);
65 int mk_iov_add_entry(struct mk_iov *mk_io, char *buf,
66 int len, mk_pointer sep, int free);
68 int mk_iov_add_separator(struct mk_iov *mk_io, mk_pointer sep);
70 ssize_t mk_iov_send(int fd, struct mk_iov *mk_io, int to);
72 void mk_iov_free(struct mk_iov *mk_io);
74 int _mk_iov_add(struct mk_iov *mk_io, char *buf, int len,
75 mk_pointer sep, int free, int idx);
77 void _mk_iov_set_free(struct mk_iov *mk_io, char *buf);
79 int mk_iov_set_entry(struct mk_iov *mk_io, char *buf, int len,
80 int free, int idx);
82 void mk_iov_separators_init();
83 void mk_iov_free_marked(struct mk_iov *mk_io);
84 void mk_iov_print(struct mk_iov *mk_io);
86 #endif