libonion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Enumerations | Functions
url.c File Reference
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <regex.h>
#include <stdio.h>
#include "log.h"
#include "handler.h"
#include "response.h"
#include "url.h"
#include "types_internal.h"
#include "dict.h"
#include "low.h"

Data Structures

struct  onion_url_data_t
 Internal onion_url data for each known url.
struct  onion_url_static_data
 Simple data needed for static data write.

Typedefs

typedef enum onion_url_data_flags_e onion_url_data_flags

Enumerations

enum  onion_url_data_flags_e { OUD_REGEXP = 1, OUD_STRCMP = 2 }

Functions

int onion_url_handler (onion_url_data **dd, onion_request *request, onion_response *response)
 Performs the real request: checks if its for me, and then calls the inside level.
void onion_url_free_data (onion_url_data **d)
 Removes internal data for this handler.
onion_urlonion_url_new ()
 Creates the URL handler to map regex urls to handlersThe onion_url object can be used to add urls as needed using onion_url_add_*.
void onion_url_free (onion_url *url)
 Frees the url.
int onion_url_add_handler (onion_url *url, const char *regexp, onion_handler *next)
 Adds a new handler with the given regexp.Adds the given handler.
int onion_url_add (onion_url *url, const char *regexp, void *handler)
 Helper to simple add basic handlers.
int onion_url_add_with_data (onion_url *url, const char *regexp, void *handler, void *data, void *f)
 Helper to simple add a basic handler with data.
int onion_url_add_url (onion_url *url, const char *regexp, onion_url *handler)
 Adds a regex url, with another url as handler.
int onion_url_add_static (onion_url *url, const char *regexp, const char *text, int http_code)
 Adds a simple handler, it has static data and a default return code.
onion_handleronion_url_to_handler (onion_url *url)
 Returns the related handler for this url object.

Typedef Documentation

Enumeration Type Documentation

Enumerator:
OUD_REGEXP 
OUD_STRCMP 

Function Documentation

void onion_url_free_data ( onion_url_data **  d)

Removes internal data for this handler.

References onion_handler_t::onion_handler_free(), onion_low_free(), and OUD_REGEXP.

Referenced by onion_root_url(), and onion_url_new().