libonion
|
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <regex.h>
#include <onion/handler.h>
#include <onion/response.h>
#include <onion/low.h>
#include "opack.h"
Data Structures | |
struct | onion_handler_opack_data_t |
Typedefs | |
typedef struct onion_handler_opack_data_t | onion_handler_opack_data |
Functions | |
int | onion_handler_opack_handler (onion_handler_opack_data *d, onion_request *request, onion_response *res) |
void | onion_handler_opack_delete (onion_handler_opack_data *data) |
onion_handler * | onion_handler_opack (const char *path, onion_opack_renderer render, unsigned int length) |
Creates an opack handler that calls the onion_opack_renderer with length data. |
typedef struct onion_handler_opack_data_t onion_handler_opack_data |
onion_handler* onion_handler_opack | ( | const char * | path, |
onion_opack_renderer | render, | ||
unsigned int | length | ||
) |
Creates an opack handler that calls the onion_opack_renderer with length data.
Creates a opak handler.
If on the inside level nobody answers, it just returns NULL, so ->next can answer.
path | Path of the current data, for example /. It is a normal string; no regular expressions are allowed. |
render | Function to call to render the response. |
length | Lenght of the data, or 0 if unknown. Needed to keep alive. |
References onion_handler_opack_data_t::length, onion_handler_t::onion_handler_new(), onion_handler_opack_delete(), onion_handler_opack_handler(), onion_low_malloc(), onion_low_strdup(), onion_handler_opack_data_t::path, and onion_handler_opack_data_t::render.
void onion_handler_opack_delete | ( | onion_handler_opack_data * | data | ) |
References onion_low_free(), and onion_handler_opack_data_t::path.
Referenced by onion_handler_opack().
int onion_handler_opack_handler | ( | onion_handler_opack_data * | d, |
onion_request * | request, | ||
onion_response * | res | ||
) |
References onion_handler_opack_data_t::length, OCS_PROCESSED, onion_request_t::onion_request_get_path(), onion_response_t::onion_response_set_length(), onion_response_t::onion_response_write_headers(), onion_handler_opack_data_t::path, and onion_handler_opack_data_t::render.
Referenced by onion_handler_opack().