00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef AXIS2_HTTP_SIMPLE_RESPONSE_H
00019 #define AXIS2_HTTP_SIMPLE_RESPONSE_H
00020
00032 #include <axis2_const.h>
00033 #include <axis2_defines.h>
00034 #include <axis2_env.h>
00035 #include <axis2_array_list.h>
00036 #include <axis2_http_status_line.h>
00037 #include <axis2_http_header.h>
00038 #include <axis2_stream.h>
00039
00040
00041 #ifdef __cplusplus
00042 extern "C"
00043 {
00044 #endif
00045
00047 typedef struct axis2_http_simple_response_ops
00048 axis2_http_simple_response_ops_t;
00050 typedef struct axis2_http_simple_response axis2_http_simple_response_t;
00051
00056 struct axis2_http_simple_response_ops
00057 {
00066 axis2_status_t (AXIS2_CALL *
00067 set_status_line)(
00068 struct axis2_http_simple_response *simple_response,
00069 const axis2_env_t *env,
00070 const axis2_char_t *http_ver,
00071 const int status_code,
00072 const axis2_char_t *phrase);
00073
00078 axis2_char_t* (AXIS2_CALL *
00079 get_phrase)(
00080 axis2_http_simple_response_t *simple_response,
00081 const axis2_env_t *env);
00082
00087 int (AXIS2_CALL *
00088 get_status_code)(
00089 axis2_http_simple_response_t *simple_response,
00090 const axis2_env_t *env);
00091
00096 axis2_char_t* (AXIS2_CALL *
00097 get_http_version)(
00098 axis2_http_simple_response_t *simple_response,
00099 const axis2_env_t *env);
00100
00105 axis2_char_t* (AXIS2_CALL *
00106 get_status_line)(
00107 axis2_http_simple_response_t *simple_response,
00108 const axis2_env_t *env);
00109
00115 axis2_bool_t (AXIS2_CALL *
00116 contains_header)(
00117 axis2_http_simple_response_t *simple_response,
00118 const axis2_env_t *env,
00119 const axis2_char_t *name);
00120
00125 axis2_array_list_t* (AXIS2_CALL *
00126 get_headers)(
00127 axis2_http_simple_response_t *simple_response,
00128 const axis2_env_t *env);
00129
00135 axis2_http_header_t* (AXIS2_CALL *
00136 get_first_header)(
00137 axis2_http_simple_response_t *simple_response,
00138 const axis2_env_t *env,
00139 const axis2_char_t *str);
00140
00147 axis2_status_t (AXIS2_CALL *
00148 remove_headers)(
00149 axis2_http_simple_response_t *simple_response,
00150 const axis2_env_t *env,
00151 const axis2_char_t *str);
00152
00159 axis2_status_t (AXIS2_CALL *
00160 set_header)(
00161 axis2_http_simple_response_t *simple_response,
00162 const axis2_env_t *env,
00163 axis2_http_header_t* header);
00164
00172 axis2_status_t (AXIS2_CALL *
00173 set_headers)(
00174 axis2_http_simple_response_t *simple_response,
00175 const axis2_env_t *env,
00176 axis2_http_header_t** headers,
00177 axis2_ssize_t array_size);
00178
00183 const axis2_char_t* (AXIS2_CALL *
00184 get_charset)(
00185 axis2_http_simple_response_t *simple_response,
00186 const axis2_env_t *env);
00187
00192 axis2_ssize_t (AXIS2_CALL *
00193 get_content_length)(
00194 axis2_http_simple_response_t *simple_response,
00195 const axis2_env_t *env);
00196
00201 const axis2_char_t* (AXIS2_CALL *
00202 get_content_type)(
00203 axis2_http_simple_response_t *simple_response,
00204 const axis2_env_t *env);
00205
00212 axis2_status_t (AXIS2_CALL *
00213 set_body_string)(
00214 axis2_http_simple_response_t *simple_response,
00215 const axis2_env_t *env,
00216 axis2_char_t *str);
00217
00224 axis2_status_t (AXIS2_CALL *
00225 set_body_stream)(
00226 axis2_http_simple_response_t *simple_response,
00227 const axis2_env_t *env,
00228 axis2_stream_t *stream);
00229
00234 axis2_stream_t* (AXIS2_CALL *
00235 get_body)(
00236 axis2_http_simple_response_t *simple_response,
00237 const axis2_env_t *env);
00238
00244 axis2_ssize_t (AXIS2_CALL *
00245 get_body_bytes)(
00246 axis2_http_simple_response_t *simple_response,
00247 const axis2_env_t *env,
00248 axis2_char_t **buf);
00249
00255 axis2_status_t (AXIS2_CALL *
00256 free)(
00257 axis2_http_simple_response_t *simple_response,
00258 const axis2_env_t *env);
00259
00260 };
00261
00265 struct axis2_http_simple_response
00266 {
00268 axis2_http_simple_response_ops_t *ops;
00269 };
00270
00271
00279 AXIS2_EXTERN axis2_http_simple_response_t * AXIS2_CALL
00280 axis2_http_simple_response_create (
00281 const axis2_env_t *env,
00282 axis2_http_status_line_t *status_line,
00283 const axis2_http_header_t **http_headers,
00284 const axis2_ssize_t http_hdr_count,
00285 axis2_stream_t *content);
00286
00290 AXIS2_EXTERN axis2_http_simple_response_t * AXIS2_CALL
00291 axis2_http_simple_response_create_default(
00292 const axis2_env_t *env);
00293
00294
00295
00298 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_STATUS_LINE(\
00299 simple_response, env, http_version, status_code, phrase)\
00300 ((simple_response)->ops->set_status_line\
00301 (simple_response, env, http_version, status_code, phrase))
00302
00305 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_PHRASE\
00306 (simple_response, env) ((simple_response)->ops->get_phrase\
00307 (simple_response, env))
00308
00311 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_HTTP_VERSION(simple_response, env)\
00312 ((simple_response)->ops->get_http_version\
00313 (simple_response, env))
00314
00317 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_STATUS_CODE(simple_response, env)\
00318 ((simple_response)->ops->get_status_code\
00319 (simple_response, env))
00320
00323 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_STATUS_LINE(simple_response, env) \
00324 ((simple_response)->ops->get_status_line\
00325 (simple_response, env))
00326
00329 #define AXIS2_HTTP_SIMPLE_RESPONSE_CONTAINS_HEADER(simple_response, env, name)\
00330 ((simple_response)->ops->contains_header\
00331 (simple_response, env, name))
00332
00335 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_HEADERS(simple_response, env) \
00336 ((simple_response)->ops->get_headers\
00337 (simple_response, env))
00338
00341 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_FIRST_HEADER(simple_response, env, str) \
00342 ((simple_response)->ops->get_first_header\
00343 (simple_response, env, str))
00344
00347 #define AXIS2_HTTP_SIMPLE_RESPONSE_REMOVE_HEADERS(simple_response, env, str)\
00348 ((simple_response)->ops->remove_headers\
00349 (simple_response, env, str))
00350
00353 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_HEADER(simple_response, env, header) \
00354 ((simple_response)->ops->set_header\
00355 (simple_response, env, header))
00356
00359 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_HEADERS(simple_response, env, headers) \
00360 ((simple_response)->ops->set_headers\
00361 (simple_response, env, headers))
00362
00365 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_CHARSET(simple_response, env) \
00366 ((simple_response)->ops->get_charset(simple_response, env))
00367
00370 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_CONTENT_LENGTH(simple_response, env) \
00371 ((simple_response)->ops->get_content_length\
00372 (simple_response, env))
00373
00376 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_CONTENT_TYPE(simple_response, env) \
00377 ((simple_response)->ops->get_content_type\
00378 (simple_response, env))
00379
00382 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STRING(simple_response, env, str)\
00383 ((simple_response)->ops->set_body_string\
00384 (simple_response, env, str))
00385
00388 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STREAM(simple_response, env, stream)\
00389 ((simple_response)->ops->set_body_stream\
00390 (simple_response, env, stream))
00391
00394 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_BODY(simple_response, env)\
00395 ((simple_response)->ops->get_body\
00396 (simple_response, env))
00397
00400 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_BODY_BYTES(simple_response, env, buf)\
00401 ((simple_response)->ops->get_body_bytes\
00402 (simple_response, env, buf))
00403
00406 #define AXIS2_HTTP_SIMPLE_RESPONSE_FREE(simple_response, env)\
00407 ((simple_response)->ops->free(simple_response, env))
00408
00409
00410
00412 #ifdef __cplusplus
00413 }
00414 #endif
00415
00416 #endif