axis2_http_simple_response.h

00001 /*
00002  * Copyright 2004,2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef AXIS2_HTTP_SIMPLE_RESPONSE_H
00018 #define AXIS2_HTTP_SIMPLE_RESPONSE_H
00019 
00031 #include <axis2_const.h>
00032 #include <axis2_defines.h>
00033 #include <axis2_env.h>
00034 #include <axis2_array_list.h>
00035 #include <axis2_http_status_line.h>
00036 #include <axis2_http_header.h>
00037 #include <axis2_stream.h>
00038 
00039 
00040 #ifdef __cplusplus
00041 extern "C"
00042 {
00043 #endif
00044 
00046     typedef struct axis2_http_simple_response_ops
00047                 axis2_http_simple_response_ops_t;
00049     typedef struct axis2_http_simple_response axis2_http_simple_response_t;
00050 
00055     AXIS2_DECLARE_DATA struct axis2_http_simple_response_ops
00056     {
00065         axis2_status_t (AXIS2_CALL *
00066                 set_status_line)(
00067           struct axis2_http_simple_response *simple_response,
00068                     const axis2_env_t *env,
00069                     const axis2_char_t *http_ver,
00070                     const int status_code,
00071                     const axis2_char_t *phrase);
00072 
00077         axis2_char_t* (AXIS2_CALL *
00078                 get_phrase)(
00079                     axis2_http_simple_response_t *simple_response,
00080                     const axis2_env_t *env);
00081 
00086         int (AXIS2_CALL *
00087                 get_status_code)(
00088                     axis2_http_simple_response_t *simple_response,
00089                     const axis2_env_t *env);
00090 
00095         axis2_char_t* (AXIS2_CALL *
00096                 get_http_version)(
00097                     axis2_http_simple_response_t *simple_response,
00098                     const axis2_env_t *env);
00099 
00104         axis2_char_t* (AXIS2_CALL *
00105                 get_status_line)(
00106                     axis2_http_simple_response_t *simple_response,
00107                     const axis2_env_t *env);
00108 
00114         axis2_bool_t (AXIS2_CALL *
00115                 contains_header)(
00116                     axis2_http_simple_response_t *simple_response,
00117                     const axis2_env_t *env,
00118                     const axis2_char_t *name);
00119 
00124         axis2_array_list_t* (AXIS2_CALL *
00125                 get_headers)(
00126                     axis2_http_simple_response_t *simple_response,
00127                     const axis2_env_t *env);
00128 
00134         axis2_http_header_t* (AXIS2_CALL *
00135                 get_first_header)(
00136                     axis2_http_simple_response_t *simple_response,
00137                     const axis2_env_t *env,
00138                     const axis2_char_t *str);
00139 
00146         axis2_status_t (AXIS2_CALL *
00147                 remove_headers)(
00148                     axis2_http_simple_response_t *simple_response,
00149                     const axis2_env_t *env,
00150                     const axis2_char_t *str);
00151 
00158         axis2_status_t (AXIS2_CALL *
00159                 set_header)(
00160                     axis2_http_simple_response_t *simple_response,
00161                     const axis2_env_t *env,
00162                     axis2_http_header_t* header);
00163 
00171         axis2_status_t (AXIS2_CALL *
00172                 set_headers)(
00173                     axis2_http_simple_response_t *simple_response,
00174                     const axis2_env_t *env,
00175                     axis2_http_header_t** headers,
00176                     axis2_ssize_t array_size);
00177 
00182         const axis2_char_t* (AXIS2_CALL *
00183                 get_charset)(
00184                     axis2_http_simple_response_t *simple_response,
00185                     const axis2_env_t *env);
00186 
00191         axis2_ssize_t (AXIS2_CALL *
00192                 get_content_length)(
00193                     axis2_http_simple_response_t *simple_response,
00194                     const axis2_env_t *env);
00195 
00200         const axis2_char_t* (AXIS2_CALL *
00201                 get_content_type)(
00202                     axis2_http_simple_response_t *simple_response,
00203                     const axis2_env_t *env);
00204 
00211         axis2_status_t (AXIS2_CALL *
00212                 set_body_string)(
00213                     axis2_http_simple_response_t *simple_response,
00214                     const axis2_env_t *env,
00215                     axis2_char_t *str);
00216 
00223         axis2_status_t (AXIS2_CALL *
00224                 set_body_stream)(
00225                     axis2_http_simple_response_t *simple_response,
00226                     const axis2_env_t *env,
00227                     axis2_stream_t *stream);
00228 
00233         axis2_stream_t* (AXIS2_CALL *
00234                 get_body)(
00235                     axis2_http_simple_response_t *simple_response,
00236                     const axis2_env_t *env);
00237 
00243         axis2_ssize_t (AXIS2_CALL *
00244                 get_body_bytes)(
00245                     axis2_http_simple_response_t *simple_response,
00246                     const axis2_env_t *env,
00247                     axis2_char_t **buf);
00248 
00254         axis2_status_t (AXIS2_CALL *
00255                 free)(
00256                     axis2_http_simple_response_t *simple_response,
00257                     const axis2_env_t *env);
00258 
00259     };
00260 
00264     AXIS2_DECLARE_DATA struct axis2_http_simple_response
00265     {
00267         axis2_http_simple_response_ops_t *ops;
00268     };
00269 
00270 
00278     AXIS2_EXTERN axis2_http_simple_response_t * AXIS2_CALL
00279     axis2_http_simple_response_create (
00280             const axis2_env_t *env,
00281             axis2_http_status_line_t *status_line,
00282             const axis2_http_header_t **http_headers,
00283             const axis2_ssize_t http_hdr_count,
00284             axis2_stream_t *content);
00285 
00289     AXIS2_EXTERN axis2_http_simple_response_t * AXIS2_CALL
00290     axis2_http_simple_response_create_default(
00291         const axis2_env_t *env);
00292 
00293 /************************** Start of function macros **************************/
00294 
00297 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_STATUS_LINE(\
00298                simple_response, env, http_version, status_code, phrase)\
00299                     ((simple_response)->ops->set_status_line\
00300                     (simple_response, env, http_version, status_code, phrase))
00301 
00304 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_PHRASE\
00305                     (simple_response, env) ((simple_response)->ops->get_phrase\
00306                     (simple_response, env))
00307 
00310 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_HTTP_VERSION(simple_response, env)\
00311                     ((simple_response)->ops->get_http_version\
00312                     (simple_response, env))
00313 
00316 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_STATUS_CODE(simple_response, env)\
00317                     ((simple_response)->ops->get_status_code\
00318                     (simple_response, env))
00319 
00322 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_STATUS_LINE(simple_response, env) \
00323                     ((simple_response)->ops->get_status_line\
00324                     (simple_response, env))
00325 
00328 #define AXIS2_HTTP_SIMPLE_RESPONSE_CONTAINS_HEADER(simple_response, env, name)\
00329                     ((simple_response)->ops->contains_header\
00330                     (simple_response, env, name))
00331 
00334 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_HEADERS(simple_response, env) \
00335                     ((simple_response)->ops->get_headers\
00336                     (simple_response, env))
00337 
00340 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_FIRST_HEADER(simple_response, env, str) \
00341                     ((simple_response)->ops->get_first_header\
00342                     (simple_response, env, str))
00343 
00346 #define AXIS2_HTTP_SIMPLE_RESPONSE_REMOVE_HEADERS(simple_response, env, str)\
00347                     ((simple_response)->ops->remove_headers\
00348                     (simple_response, env, str))
00349 
00352 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_HEADER(simple_response, env, header) \
00353                     ((simple_response)->ops->set_header\
00354                     (simple_response, env, header))
00355 
00358 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_HEADERS(simple_response, env, headers) \
00359                     ((simple_response)->ops->set_headers\
00360                     (simple_response, env, headers))
00361 
00364 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_CHARSET(simple_response, env) \
00365                     ((simple_response)->ops->get_charset(simple_response, env))
00366 
00369 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_CONTENT_LENGTH(simple_response, env) \
00370                     ((simple_response)->ops->get_content_length\
00371                     (simple_response, env))
00372 
00375 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_CONTENT_TYPE(simple_response, env) \
00376                     ((simple_response)->ops->get_content_type\
00377                     (simple_response, env))
00378 
00381 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STRING(simple_response, env, str)\
00382                     ((simple_response)->ops->set_body_string\
00383                     (simple_response, env, str))
00384 
00387 #define AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STREAM(simple_response, env, stream)\
00388                     ((simple_response)->ops->set_body_stream\
00389                     (simple_response, env, stream))
00390 
00393 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_BODY(simple_response, env)\
00394                     ((simple_response)->ops->get_body\
00395                     (simple_response, env))
00396 
00399 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_BODY_BYTES(simple_response, env, buf)\
00400                     ((simple_response)->ops->get_body_bytes\
00401                     (simple_response, env, buf))
00402 
00405 #define AXIS2_HTTP_SIMPLE_RESPONSE_FREE(simple_response, env)\
00406                     ((simple_response)->ops->free(simple_response, env))
00407 
00408 /************************** End of function macros ****************************/
00409 
00411 #ifdef __cplusplus
00412 }
00413 #endif
00414 
00415 #endif                          /* AXIS2_HTTP_SIMPLE_RESPONSE_H */

Generated on Thu Aug 31 17:32:36 2006 for Axis2/C by  doxygen 1.4.6