fred-mod-eppd
|
#include "epp_common.h"
#include "epp_parser.h"
#include "epp_xmlcommon.h"
#include "xml-in-out-log.h"
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <apr.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlmemory.h>
#include <libxml/xmlschemas.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
Classes | |
struct | cmd_hash_item_t |
Macros | |
#define | HASH_SIZE_CMD 30 |
#define | XML_IN_ENC "UTF-8" |
#define | XERR_OK 0 |
#define | XERR_LIBXML 1 |
#define | XERR_ALLOC 2 |
#define | XERR_CONSTR 3 |
#define | CHK_XERR(_var, _label) |
#define | RESET_XERR(_var) ((_var) = XERR_OK) |
#define | TEXT_CONTENT(_xpathObj, _i) |
Typedefs | |
typedef struct cmd_hash_item_t | cmd_hash_item |
Functions | |
int | read_epp_dnskey (void *pool, xmlXPathContextPtr xpathCtx, epp_dnskey *key) |
int | parse_boolean (char *str) |
void * | epp_parser_init (const char *url_schema) |
void | epp_parser_init_cleanup (void *schema) |
void | epp_parser_request_cleanup (void *cdata_arg) |
parser_status | epp_parse_command (epp_context *epp_ctx, int loggedin, void *schema, const char *request, unsigned bytes, epp_command_data **cdata_arg, const eppd_server_xml_conf *xml_schema, epp_red_command_type *cmd_type) |
Component for parsing EPP requests in form of xml documents.
The product is a data structure which contains data from xml document. This file also contains routine which handles deallocation of this structure. Currently the component is based on libxml library.
#define HASH_SIZE_CMD 30 |
Size of hash table used for hashing command names. The size is tradeof between size of hash table and lookup speed, it should be less than 255 since hash value is unsigned char.
#define TEXT_CONTENT | ( | _xpathObj, | |
_i | |||
) |
Get text content of an element.
You have to copy the string from returned pointer if you want to manipulate with string. Note that if element is empty (e.g.
the child of this element is not empty string but NULL. This makes macro a bit more complicated.
#define XML_IN_ENC "UTF-8" |
Encoding for input xml in epp_command_data structure
parser_status epp_parse_command | ( | epp_context * | epp_ctx, |
int | loggedin, | ||
void * | schema, | ||
const char * | request, | ||
unsigned | bytes, | ||
epp_command_data ** | cdata, | ||
const eppd_server_xml_conf * | xml_schema, | ||
epp_red_command_type * | cmd_type | ||
) |
This is the main workhorse of parser component. It's task is to parse request and get data saved in structure.
epp_ctx | Epp context (pool, connection and session id). |
loggedin | True if client is logged in. |
schema | Parsed xml schema used for validation. |
request | Request to be processed. |
bytes | Length of the request. |
cdata | Output of parsing stage (xml data converted to structure). |
cmd_type | Output of commnad type (used also by logging) |
void* epp_parser_init | ( | const char * | url_schema | ) |
This routine initializes libxml's parser, hash table for command recognition and parses xml schema, which is returned.
url_schema | XML schema location. |
void epp_parser_init_cleanup | ( | void * | schema | ) |
This will cleanup command hash table, libxml's parser and release parsed xml schema.
schema | Parsed xml schema. |
void epp_parser_request_cleanup | ( | void * | cdata_arg | ) |
This will cleanup xpath context and parsed document tree.
cdata_arg | cdata structure containing items to be cleaned up. |
int read_epp_dnskey | ( | void * | pool, |
xmlXPathContextPtr | xpathCtx, | ||
epp_dnskey * | key | ||
) |
Read DNSKEY information from xml into epp_dnskey structure
pool | Pool for allocating memory |
xpathCtx | XML parsing context |
key | DNSKEY structure filled with data |