1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 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.
27 #define MK_IOV_FREE_BUF 1
28 #define MK_IOV_NOT_FREE_BUF 0
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
45 mk_pointer mk_iov_crlf
;
46 mk_pointer mk_iov_crlfcrlf
;
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
;
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
,
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
);