GNU libmicrohttpd
0.9.29
|
Functions for handling most of the structures in defined in structures.h. More...
#include "platform.h"
#include "structures.h"
#include "internal.h"
#include "session.h"
#include <ctype.h>
Go to the source code of this file.
Functions | |
int | SPDYF_name_value_is_empty (struct SPDY_NameValue *container) |
struct SPDY_NameValue * | SPDY_name_value_create () |
int | SPDY_name_value_add (struct SPDY_NameValue *container, const char *name, const char *value) |
const char *const * | SPDY_name_value_lookup (struct SPDY_NameValue *container, const char *name, int *num_values) |
void | SPDY_name_value_destroy (struct SPDY_NameValue *container) |
int | SPDY_name_value_iterate (struct SPDY_NameValue *container, SPDY_NameValueIterator iterator, void *iterator_cls) |
void | SPDY_destroy_response (struct SPDY_Response *response) |
struct SPDYF_Response_Queue * | SPDYF_response_queue_create (bool is_data, void *data, size_t data_size, struct SPDY_Response *response, struct SPDYF_Stream *stream, bool closestream, SPDYF_ResponseQueueResultCallback frqcb, void *frqcb_cls, SPDY_ResponseResultCallback rrcb, void *rrcb_cls) |
void | SPDYF_response_queue_destroy (struct SPDYF_Response_Queue *response_queue) |
_MHD_EXTERN ssize_t | SPDYF_name_value_to_stream (struct SPDY_NameValue *container[], int num_containers, void **stream) |
_MHD_EXTERN int | SPDYF_name_value_from_stream (void *stream, size_t size, struct SPDY_NameValue **container) |
Functions for handling most of the structures in defined in structures.h.
Definition in file structures.c.
void SPDY_destroy_response | ( | struct SPDY_Response * | response | ) |
Destroy a response structure. It should be called for all objects returned by SPDY_build_response*() functions to free the memory associated with the prepared response. It is safe to call this function not before being sure that the response will not be used by the lib anymore, this means after SPDY_ResponseResultCallback callbacks were called for all calls to SPDY_queue_response() passing this response.
response | to destroy |
Definition at line 279 of file structures.c.
References SPDY_Response::data, SPDY_Response::headers, and NULL.
Referenced by curl_header_cb(), response_done_callback(), run(), and spdy_callback_response_done().
int SPDY_name_value_add | ( | struct SPDY_NameValue * | container, |
const char * | name, | ||
const char * | value | ||
) |
Add name/value pair to a NameValue structure. SPDY_NO will be returned if the name/value pair is already in the structure. It is legal to add different values for the same name.
container | structure to which the new pair is added |
name | for the value. Null-terminated string. |
value | the value itself. Null-terminated string. |
Definition at line 56 of file structures.c.
References SPDY_NameValue::name, SPDY_NameValue::next, NULL, SPDY_NameValue::num_values, SPDY_NameValue::prev, SPDY_INPUT_ERROR, SPDY_NO, SPDY_YES, SPDYF_name_value_is_empty(), and SPDY_NameValue::value.
Referenced by curl_header_cb(), SPDY_build_response(), spdy_handler_new_stream(), and SPDYF_name_value_from_stream().
struct SPDY_NameValue* SPDY_name_value_create | ( | void | ) |
Create a new NameValue structure. It is needed for putting inside the HTTP headers and their values for a response. The user should later destroy alone the structure.
Definition at line 42 of file structures.c.
References NULL.
Referenced by SPDY_build_response(), spdy_handler_new_stream(), SPDYF_name_value_from_stream(), and standard_request_handler().
void SPDY_name_value_destroy | ( | struct SPDY_NameValue * | container | ) |
Destroy a NameValue structure. Use this function to destroy only objects which, after passed to, will not be destroied by other functions.
Definition at line 218 of file structures.c.
References SPDY_NameValue::name, SPDY_NameValue::next, NULL, SPDY_NameValue::num_values, and SPDY_NameValue::value.
Referenced by curl_header_cb(), run(), SPDY_build_response(), SPDY_destroy_request(), spdy_handler_new_stream(), SPDYF_name_value_from_stream(), and SPDYF_stream_destroy().
int SPDY_name_value_iterate | ( | struct SPDY_NameValue * | container, |
SPDY_NameValueIterator | iterator, | ||
void * | iterator_cls | ||
) |
Iterate over name/value structure.
container | structure which to iterate over |
iterator | callback to call on each name/value pair; maybe NULL (then just count headers) |
iterator_cls | extra argument to iterator |
Definition at line 237 of file structures.c.
References SPDY_NameValue::name, SPDY_NameValue::next, NULL, SPDY_NameValue::num_values, SPDY_INPUT_ERROR, SPDY_YES, SPDYF_name_value_is_empty(), and SPDY_NameValue::value.
Referenced by standard_request_handler().
const char* const* SPDY_name_value_lookup | ( | struct SPDY_NameValue * | container, |
const char * | name, | ||
int * | num_values | ||
) |
Lookup value for a name in a name/value structure.
container | structure in which to lookup |
name | the name to look for |
num_values | length of the returned array with values |
Definition at line 190 of file structures.c.
References SPDY_NameValue::name, SPDY_NameValue::next, NULL, SPDY_NameValue::num_values, SPDYF_name_value_is_empty(), and SPDY_NameValue::value.
Referenced by curl_header_cb().
_MHD_EXTERN int SPDYF_name_value_from_stream | ( | void * | stream, |
size_t | size, | ||
struct SPDY_NameValue ** | container | ||
) |
Transforms raw binary decomressed stream of headers into SPDY_NameValue, containing all of the headers and values.
stream | that is to be transformed |
size | length of the stream |
container | will contain the newly created SPDY_NameValue container. Should point to NULL. |
Definition at line 554 of file structures.c.
References SPDY_NameValue::name, NULL, SPDY_INPUT_ERROR, SPDY_name_value_add(), SPDY_name_value_create(), SPDY_name_value_destroy(), SPDY_NO, SPDY_YES, and SPDY_NameValue::value.
Referenced by spdyf_handler_read_syn_stream().
int SPDYF_name_value_is_empty | ( | struct SPDY_NameValue * | container | ) |
Checks if the container is empty, i.e. created but no values were added to it.
container |
Definition at line 35 of file structures.c.
References SPDY_NameValue::name, NULL, SPDY_NO, SPDY_YES, SPDYF_ASSERT, and SPDY_NameValue::value.
Referenced by SPDY_build_response(), SPDY_name_value_add(), SPDY_name_value_iterate(), and SPDY_name_value_lookup().
_MHD_EXTERN ssize_t SPDYF_name_value_to_stream | ( | struct SPDY_NameValue * | container[], |
int | num_containers, | ||
void ** | stream | ||
) |
Transforms array of objects of name/values tuples, containing HTTP headers, into raw binary stream. The resulting stream is ready to be compressed and sent.
container | one or more SPDY_NameValue objects. Each object contains multiple number of name/value tuples. |
num_containers | length of the array |
stream | will contain the resulting stream. Should point to NULL. |
Definition at line 457 of file structures.c.
References SPDY_NameValue::name, SPDY_NameValue::next, NULL, SPDY_NameValue::num_values, SPDYF_ASSERT, and SPDY_NameValue::value.
Referenced by SPDY_build_response().
struct SPDYF_Response_Queue* SPDYF_response_queue_create | ( | bool | is_data, |
void * | data, | ||
size_t | data_size, | ||
struct SPDY_Response * | response, | ||
struct SPDYF_Stream * | stream, | ||
bool | closestream, | ||
SPDYF_ResponseQueueResultCallback | frqcb, | ||
void * | frqcb_cls, | ||
SPDY_ResponseResultCallback | rrcb, | ||
void * | rrcb_cls | ||
) |
Creates one or more new SPDYF_Response_Queue object to be put on the response queue.
is_data | whether new data frame or new control frame will be crerated |
data | the row stream which will be used as the body of the frame |
data_size | length of data |
response | object, part of which is the frame |
stream | on which data is to be sent |
closestream | TRUE if the frame must close the stream (with flag) |
frqcb | callback to notify application layer when the frame has been sent or discarded |
frqcb_cls | closure for frqcb |
rrcb | callback used by the application layer to notify the application when the frame has been sent or discarded. frqcb will call it |
rrcb_cls | closure for rrcb |
Definition at line 290 of file structures.c.
References SPDYF_Response_Queue::control_frame, SPDYF_Response_Queue::data, SPDYF_Response_Queue::data_frame, SPDYF_Response_Queue::data_size, SPDYF_Response_Queue::frqcb, SPDYF_Response_Queue::frqcb_cls, SPDYF_Response_Queue::is_data, SPDYF_Response_Queue::next, NULL, SPDYF_Response_Queue::prev, SPDYF_Response_Queue::process_response_handler, SPDY_Response::rcb, SPDYF_Response_Queue::response, SPDYF_Response_Queue::rrcb, SPDYF_Response_Queue::rrcb_cls, SPDY_CONTROL_FRAME_TYPES_SYN_REPLY, SPDY_DATA_FLAG_FIN, SPDY_MAX_SUPPORTED_FRAME_SIZE, SPDY_SYN_REPLY_FLAG_FIN, SPDY_VERSION, SPDYF_ASSERT, SPDYF_handler_write_data(), SPDYF_handler_write_syn_reply(), SPDYF_Response_Queue::stream, and SPDYF_Stream::stream_id.
Referenced by SPDY_queue_response(), and SPDYF_handler_write_data().
void SPDYF_response_queue_destroy | ( | struct SPDYF_Response_Queue * | response_queue | ) |
Destroys SPDYF_Response_Queue structure and whatever is in it.
response_queue | to destroy |
Definition at line 435 of file structures.c.
References SPDYF_Response_Queue::control_frame, SPDYF_Response_Queue::data, SPDYF_Response_Queue::data_frame, SPDYF_Response_Queue::is_data, SPDY_CONTROL_FRAME_TYPES_GOAWAY, and SPDY_CONTROL_FRAME_TYPES_RST_STREAM.
Referenced by SPDY_queue_response(), SPDYF_session_destroy(), and SPDYF_session_write().