- add first version of package2.xml
[m6w6/ext-http] / php_http_message_object.h
1 /*
2 +----------------------------------------------------------------------+
3 | PECL :: http |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.0 of the PHP license, that |
6 | is bundled with this package in the file LICENSE, and is available |
7 | through the world-wide-web at http://www.php.net/license/3_0.txt. |
8 | If you did not receive a copy of the PHP license and are unable to |
9 | obtain it through the world-wide-web, please send a note to |
10 | license@php.net so we can mail you a copy immediately. |
11 +----------------------------------------------------------------------+
12 | Copyright (c) 2004-2005 Michael Wallner <mike@php.net> |
13 +----------------------------------------------------------------------+
14 */
15
16 /* $Id$ */
17
18 #ifndef PHP_HTTP_MESSAGE_OBJECT_H
19 #define PHP_HTTP_MESSAGE_OBJECT_H
20 #ifdef ZEND_ENGINE_2
21
22 #include "php_http_message_api.h"
23
24 typedef struct {
25 zend_object zo;
26 http_message *message;
27 zend_object_value parent;
28 } http_message_object;
29
30 extern zend_class_entry *http_message_object_ce;
31 extern zend_function_entry http_message_object_fe[];
32
33 #define http_message_object_init() _http_message_object_init(INIT_FUNC_ARGS_PASSTHRU)
34 extern void _http_message_object_init(INIT_FUNC_ARGS);
35 #define http_message_object_new _http_message_object_new
36 extern zend_object_value _http_message_object_new(zend_class_entry *ce TSRMLS_DC);
37 #define http_message_object_new_ex(ce, msg) _http_message_object_new_ex(ce, msg TSRMLS_CC)
38 #define http_message_object_from_msg(msg) _http_message_object_new_ex(http_message_object_ce, msg TSRMLS_CC)
39 extern zend_object_value _http_message_object_new_ex(zend_class_entry *ce, http_message *msg TSRMLS_DC);
40 #define http_message_object_clone(zobj) _http_message_object_clone(zobj TSRMLS_CC)
41 extern zend_object_value _http_message_object_clone(zval *object TSRMLS_DC);
42 #define http_message_object_free _http_message_object_free
43 extern void _http_message_object_free(zend_object *object TSRMLS_DC);
44
45 #define HTTP_MSG_PROPHASH_TYPE 276192743LU
46 #define HTTP_MSG_PROPHASH_HTTP_VERSION 1138628683LU
47 #define HTTP_MSG_PROPHASH_BODY 254474387LU
48 #define HTTP_MSG_PROPHASH_HEADERS 3199929089LU
49 #define HTTP_MSG_PROPHASH_PARENT_MESSAGE 2105714836LU
50 #define HTTP_MSG_PROPHASH_REQUEST_METHOD 1669022159LU
51 #define HTTP_MSG_PROPHASH_REQUEST_URI 3208695486LU
52 #define HTTP_MSG_PROPHASH_RESPONSE_STATUS 3857097400LU
53 #define HTTP_MSG_PROPHASH_RESPONSE_CODE 1305615119LU
54
55 #define HTTP_MSG_CHECK_OBJ(obj, dofail) \
56 if (!(obj)->message) { \
57 http_error(E_WARNING, HTTP_E_MSG, "HttpMessage is empty"); \
58 dofail; \
59 }
60 #define HTTP_MSG_CHECK_STD() HTTP_MSG_CHECK_OBJ(obj, RETURN_FALSE)
61
62 #define HTTP_MSG_INIT_OBJ(obj) \
63 if (!(obj)->message) { \
64 (obj)->message = http_message_new(); \
65 }
66 #define HTTP_MSG_INIT_STD() HTTP_MSG_INIT_OBJ(obj)
67
68 PHP_METHOD(HttpMessage, __construct);
69 PHP_METHOD(HttpMessage, getBody);
70 PHP_METHOD(HttpMessage, setBody);
71 PHP_METHOD(HttpMessage, getHeaders);
72 PHP_METHOD(HttpMessage, setHeaders);
73 PHP_METHOD(HttpMessage, addHeaders);
74 PHP_METHOD(HttpMessage, getType);
75 PHP_METHOD(HttpMessage, setType);
76 PHP_METHOD(HttpMessage, getResponseCode);
77 PHP_METHOD(HttpMessage, setResponseCode);
78 PHP_METHOD(HttpMessage, getRequestMethod);
79 PHP_METHOD(HttpMessage, setRequestMethod);
80 PHP_METHOD(HttpMessage, getRequestUri);
81 PHP_METHOD(HttpMessage, setRequestUri);
82 PHP_METHOD(HttpMessage, getHttpVersion);
83 PHP_METHOD(HttpMessage, setHttpVersion);
84 PHP_METHOD(HttpMessage, getParentMessage);
85 PHP_METHOD(HttpMessage, send);
86 PHP_METHOD(HttpMessage, toString);
87
88 PHP_METHOD(HttpMessage, fromString);
89
90 #endif
91 #endif
92
93 /*
94 * Local variables:
95 * tab-width: 4
96 * c-basic-offset: 4
97 * End:
98 * vim600: noet sw=4 ts=4 fdm=marker
99 * vim<600: noet sw=4 ts=4
100 */
101