- Fixed build on php-trunk
[m6w6/ext-http] / php_http_request_body_api.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id$ */
14
15 #ifndef PHP_HTTP_REQUEST_BODY_API_H
16 #define PHP_HTTP_REQUEST_BODY_API_H
17
18 #ifdef HTTP_HAVE_CURL
19
20 #define HTTP_REQUEST_BODY_EMPTY 0
21 #define HTTP_REQUEST_BODY_CSTRING 1
22 #define HTTP_REQUEST_BODY_CURLPOST 2
23 #define HTTP_REQUEST_BODY_UPLOADFILE 3
24 typedef struct _http_request_body_t {
25 void *data;
26 size_t size;
27 uint type:3;
28 uint free:1;
29 uint priv:28;
30 } http_request_body;
31
32
33 #define http_request_body_new() http_request_body_init(NULL)
34 #define http_request_body_init(b) http_request_body_init_ex((b), 0, NULL, 0, 0)
35 #define http_request_body_init_ex(b, t, d, l, f) _http_request_body_init_ex((b), (t), (d), (l), (f) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC TSRMLS_CC)
36 #define http_request_body_init_rel(b, t, d, l, f) _http_request_body_init_ex((b), (t), (d), (l), (f) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC TSRMLS_CC)
37 PHP_HTTP_API http_request_body *_http_request_body_init_ex(http_request_body *body, int type, void *data, size_t len, zend_bool free ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC TSRMLS_DC);
38
39 #define http_request_body_fill(b, fields, files) _http_request_body_fill((b), (fields), (files) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC TSRMLS_CC)
40 PHP_HTTP_API http_request_body *_http_request_body_fill(http_request_body *body, HashTable *fields, HashTable *files ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC TSRMLS_DC);
41
42 #define http_request_body_encode(b, s, l) _http_request_body_encode((b), (s), (l) TSRMLS_CC)
43 PHP_HTTP_API STATUS _http_request_body_encode(http_request_body *body, char **buf, size_t *len TSRMLS_DC);
44
45 #define http_request_body_dtor(b) _http_request_body_dtor((b) TSRMLS_CC)
46 PHP_HTTP_API void _http_request_body_dtor(http_request_body *body TSRMLS_DC);
47
48 #define http_request_body_free(b) _http_request_body_free((b) TSRMLS_CC)
49 PHP_HTTP_API void _http_request_body_free(http_request_body **body TSRMLS_DC);
50
51 #endif
52 #endif
53
54 /*
55 * Local variables:
56 * tab-width: 4
57 * c-basic-offset: 4
58 * End:
59 * vim600: noet sw=4 ts=4 fdm=marker
60 * vim<600: noet sw=4 ts=4
61 */
62