/Users/maurits/Documents/studie/afstuderen/biosphere/common/http_common.h File Reference

#include <biosphere.h>
#include <apr_time.h>

Include dependency graph for http_common.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  http_header_info

Defines

#define HTTP_BUFFER_SIZE   512
#define HTTP_CORRECT(info)   ((info)->http_code == 200)

Functions

bs_bool received_full_headers (const char *headerbuf)
bs_status parse_http_headers (const char *headerbuf, apr_size_t headerlen, http_header_info **info, apr_pool_t *mp)
bs_status connect_and_post (const bs_service_request *request, bs_service_response **response, const char *addr, bs_uint16 port, apr_pool_t *mp)
bs_status connect_and_get (bs_definition **result, const char *addr, bs_uint16 port, apr_pool_t *mp)


Define Documentation

#define HTTP_BUFFER_SIZE   512

Definition at line 41 of file http_common.h.

Referenced by get_remaining_content(), receive_response(), and worker_thread_main().

#define HTTP_CORRECT ( info   )     ((info)->http_code == 200)

Macro to determine if the received HTTP response was correct, ie. 'HTTP 200 OK'. Please note that only responses by an HTTP server return such a status code.

Definition at line 61 of file http_common.h.

Referenced by receive_response().


Function Documentation

bs_status connect_and_get ( bs_definition **  result,
const char *  addr,
bs_uint16  port,
apr_pool_t *  mp 
)

Connect to a Bio-SPHERE daemon a make a HTTP GET request, in order to retrieve the bs_definitions.

Parameters:
result Result pointer for the definitions
addr The address (IP or hostname) to connect to
port TCP/IP port on which the daemon is listening
mp Memory pool to allocate from
Returns:
Status code.

Definition at line 265 of file http_common.c.

References BIOSPHERE_VERSION_STRING, BS_ERROR, BS_OK, len(), receive_response(), runtestsuite::rv, SERVICE_DEF_FROM_XML, and xlate_from_xml().

Referenced by add_node(), and get_services_list().

Here is the call graph for this function:

bs_status connect_and_post ( const bs_service_request request,
bs_service_response **  response,
const char *  addr,
bs_uint16  port,
apr_pool_t *  mp 
)

Connect to a Bio-SPHERE daemon and post a request.

Parameters:
request The request to make
response The received response (result pointer)
addr The address (IP or hostname) to connect to
port The port on which the local biosphered is listening
mp The memory pool to allocate from
Returns:
Status code

Definition at line 216 of file http_common.c.

References BIOSPHERE_VERSION_STRING, BS_ERROR, BS_OK, BS_UINT64_FMT, receive_response(), runtestsuite::rv, xlate_from_xml(), and xlate_request_to_xml().

Referenced by handle_service_request_remotely(), and make_service_request().

Here is the call graph for this function:

bs_status parse_http_headers ( const char *  headerbuf,
apr_size_t  headerlen,
http_header_info **  info,
apr_pool_t *  mp 
)

Extract header information from the given buffer and filling a http_header_info structure. Returns status code. Assume that appropriate http headers and an ending are present in the given buffer.

Definition at line 105 of file http_common.c.

References BS_HTTP_ERROR, BS_OK, http_header_info::content_length, http_header_info::content_offset, extract_http_header_info(), and runtestsuite::rv.

Referenced by handle_http_post(), and receive_response().

Here is the call graph for this function:

bs_bool received_full_headers ( const char *  headerbuf  ) 

True iff a double line-ending is encountered in the buffer (

or

).

Parameters:
headerbuf Buffer containing the http headers
headerlen The length of that buffer
Returns:
True iff HTTP headers were encountered in the buffer.

Definition at line 45 of file http_common.c.

References FALSE, and TRUE.

Referenced by receive_response(), and worker_thread_main().


Generated on Tue Jul 17 09:50:57 2007 for Bio-SPHERE by  doxygen 1.5.1