00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef AXIS2_HTTP_SIMPLE_RESPONSE_H
00018 #define AXIS2_HTTP_SIMPLE_RESPONSE_H
00019
00020
00026 #include <axis2_const.h>
00027 #include <axis2_defines.h>
00028 #include <axis2_env.h>
00029 #include <axis2_array_list.h>
00030 #include <axis2_http_status_line.h>
00031 #include <axis2_http_header.h>
00032 #include <axis2_stream.h>
00033
00034
00035 #ifdef __cplusplus
00036 extern "C"
00037 {
00038 #endif
00039
00044 typedef struct axis2_http_simple_response_ops
00045 axis2_http_simple_response_ops_t;
00046 typedef struct axis2_http_simple_response axis2_http_simple_response_t;
00047
00052 AXIS2_DECLARE_DATA struct axis2_http_simple_response_ops
00053 {
00054 axis2_status_t (AXIS2_CALL *
00055 set_status_line)(struct axis2_http_simple_response *simple_response,
00056 const axis2_env_t *env,
00057 const axis2_char_t *http_ver,
00058 const int status_code,
00059 const axis2_char_t *phrase);
00060
00061 axis2_char_t* (AXIS2_CALL *
00062 get_phrase)(axis2_http_simple_response_t *simple_response,
00063 const axis2_env_t *env);
00064
00065 int (AXIS2_CALL *
00066 get_status_code)(axis2_http_simple_response_t *simple_response,
00067 const axis2_env_t *env);
00068
00069 axis2_char_t* (AXIS2_CALL *
00070 get_http_version)(axis2_http_simple_response_t *simple_response,
00071 const axis2_env_t *env);
00072
00073 axis2_char_t* (AXIS2_CALL *
00074 get_status_line)(axis2_http_simple_response_t *simple_response,
00075 const axis2_env_t *env);
00076
00077 axis2_bool_t (AXIS2_CALL *
00078 contains_header)(axis2_http_simple_response_t *simple_response,
00079 const axis2_env_t *env,
00080 const axis2_char_t *name);
00081
00082 axis2_array_list_t* (AXIS2_CALL *
00083 get_headers)(axis2_http_simple_response_t *simple_response,
00084 const axis2_env_t *env);
00085
00086 axis2_http_header_t* (AXIS2_CALL *
00087 get_first_header)(axis2_http_simple_response_t *simple_response,
00088 const axis2_env_t *env,
00089 const axis2_char_t *str);
00090
00091 axis2_status_t (AXIS2_CALL *
00092 remove_headers)(axis2_http_simple_response_t *simple_response,
00093 const axis2_env_t *env,
00094 const axis2_char_t *str);
00095
00096 axis2_status_t (AXIS2_CALL *
00097 set_header)(axis2_http_simple_response_t *simple_response,
00098 const axis2_env_t *env,
00099 axis2_http_header_t* header);
00100
00101 axis2_status_t (AXIS2_CALL *
00102 set_headers)(axis2_http_simple_response_t *simple_response,
00103 const axis2_env_t *env,
00104 axis2_http_header_t** headers,
00105 axis2_ssize_t array_size);
00106
00107 const axis2_char_t* (AXIS2_CALL *
00108 get_charset)(axis2_http_simple_response_t *simple_response,
00109 const axis2_env_t *env);
00110
00111 axis2_ssize_t (AXIS2_CALL *
00112 get_content_length)(axis2_http_simple_response_t *simple_response,
00113 const axis2_env_t *env);
00114
00115 const axis2_char_t* (AXIS2_CALL *
00116 get_content_type)(axis2_http_simple_response_t *simple_response,
00117 const axis2_env_t *env);
00118
00119 axis2_status_t (AXIS2_CALL *
00120 set_body_string)(axis2_http_simple_response_t *simple_response,
00121 const axis2_env_t *env,
00122 axis2_char_t *str);
00123
00124 axis2_status_t (AXIS2_CALL *
00125 set_body_stream)(axis2_http_simple_response_t *simple_response,
00126 const axis2_env_t *env,
00127 axis2_stream_t *stream);
00128
00129 axis2_stream_t* (AXIS2_CALL *
00130 get_body)(axis2_http_simple_response_t *simple_response,
00131 const axis2_env_t *env);
00132
00133 axis2_ssize_t (AXIS2_CALL *
00134 get_body_bytes)(axis2_http_simple_response_t *simple_response,
00135 const axis2_env_t *env,
00136 axis2_char_t **buf);
00137
00138 axis2_status_t (AXIS2_CALL *
00139 free)(axis2_http_simple_response_t *simple_response,
00140 const axis2_env_t *env);
00141
00142 };
00143
00148 AXIS2_DECLARE_DATA struct axis2_http_simple_response
00149 {
00150 axis2_http_simple_response_ops_t *ops;
00151 };
00152
00153
00154 AXIS2_EXTERN axis2_http_simple_response_t * AXIS2_CALL
00155 axis2_http_simple_response_create (const axis2_env_t *env,
00156 axis2_http_status_line_t *status_line,
00157 const axis2_http_header_t **http_headers,
00158 const axis2_ssize_t http_hdr_count,
00159 axis2_stream_t *content);
00160
00161 AXIS2_EXTERN axis2_http_simple_response_t * AXIS2_CALL
00162 axis2_http_simple_response_create_default(const axis2_env_t *env);
00163
00164
00165
00166
00167 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_STATUS_LINE(\
00168 simple_response, env, http_version, status_code, phrase)\
00169 ((simple_response)->ops->set_status_line\
00170 (simple_response, env, http_version, status_code, phrase))
00171 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_PHRASE\
00172 (simple_response, env) ((simple_response)->ops->get_phrase\
00173 (simple_response, env))
00174 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_HTTP_VERSION(simple_response, env)\
00175 ((simple_response)->ops->get_http_version\
00176 (simple_response, env))
00177 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_STATUS_CODE(simple_response, env)\
00178 ((simple_response)->ops->get_status_code\
00179 (simple_response, env))
00180 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_STATUS_LINE(simple_response, env) \
00181 ((simple_response)->ops->get_status_line\
00182 (simple_response, env))
00183 #define AXIS2_HTTP_SIMPLE_RESPONSE_CONTAINS_HEADER(simple_response, env, name)\
00184 ((simple_response)->ops->contains_header\
00185 (simple_response, env, name))
00186 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_HEADERS(simple_response, env) \
00187 ((simple_response)->ops->get_headers\
00188 (simple_response, env))
00189 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_FIRST_HEADER(simple_response, env, str) \
00190 ((simple_response)->ops->get_first_header\
00191 (simple_response, env, str))
00192 #define AXIS2_HTTP_SIMPLE_RESPONSE_REMOVE_HEADERS(simple_response, env, str)\
00193 ((simple_response)->ops->remove_headers\
00194 (simple_response, env, str))
00195 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_HEADER(simple_response, env, header) \
00196 ((simple_response)->ops->set_header\
00197 (simple_response, env, header))
00198 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_HEADERS(simple_response, env, headers) \
00199 ((simple_response)->ops->set_headers\
00200 (simple_response, env, headers))
00201 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_CHARSET(simple_response, env) \
00202 ((simple_response)->ops->get_charset(simple_response, env))
00203 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_CONTENT_LENGTH(simple_response, env) \
00204 ((simple_response)->ops->get_content_length\
00205 (simple_response, env))
00206 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_CONTENT_TYPE(simple_response, env) \
00207 ((simple_response)->ops->get_content_type\
00208 (simple_response, env))
00209 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STRING(simple_response, env, str)\
00210 ((simple_response)->ops->set_body_string\
00211 (simple_response, env, str))
00212 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STREAM(simple_response, env, stream)\
00213 ((simple_response)->ops->set_body_stream\
00214 (simple_response, env, stream))
00215 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_BODY(simple_response, env)\
00216 ((simple_response)->ops->get_body\
00217 (simple_response, env))
00218 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_BODY_BYTES(simple_response, env, buf)\
00219 ((simple_response)->ops->get_body_bytes\
00220 (simple_response, env, buf))
00221 #define AXIS2_HTTP_SIMPLE_RESPONSE_FREE(simple_response, env)\
00222 ((simple_response)->ops->free(simple_response, env))
00223
00224
00225
00227 #ifdef __cplusplus
00228 }
00229 #endif
00230
00231 #endif