fred-mod-eppd-2.14.1
Enumerations | Functions
epp_parser.h File Reference

Interface to component which parses xml documents and returns document's content in form of a structure. More...

Go to the source code of this file.

Enumerations

enum  parser_status {
  PARSER_CMD_LOGIN, PARSER_CMD_LOGOUT, PARSER_CMD_OTHER, PARSER_NOT_VALID,
  PARSER_HELLO, PARSER_NOT_COMMAND, PARSER_NOT_XML, PARSER_ESCHEMA,
  PARSER_EINTERNAL
}
 EPP parser status values. More...
enum  epp_red_command_type {
  EPP_RED_UNKNOWN_CMD, EPP_RED_LOGIN, EPP_RED_LOGOUT, EPP_RED_CHECK,
  EPP_RED_INFO, EPP_RED_POLL, EPP_RED_TRANSFER, EPP_RED_CREATE,
  EPP_RED_DELETE, EPP_RED_RENEW, EPP_RED_UPDATE, EPP_RED_EXTCMD,
  EPP_RED_HELLO
}
 Enumeration of all implemented EPP commands as defined in rfc. More...

Functions

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.
void epp_parser_init_cleanup (void *schema)
 This will cleanup command hash table, libxml's parser and release parsed xml schema.
parser_status epp_parse_command (epp_context *epp_ctx, int loggedin, void *schema, const char *request, unsigned bytes, epp_command_data **cdata, epp_red_command_type *cmd_type)
 This is the main workhorse of parser component.
void epp_parser_request_cleanup (void *cdata_arg)
 This will cleanup xpath context and parsed document tree.

Detailed Description

Interface to component which parses xml documents and returns document's content in form of a structure.


Enumeration Type Documentation

Enumeration of all implemented EPP commands as defined in rfc.

It is REDuced form - without object suffix. And is used as hash value in command hash table for fast recognition of commands.

EPP parser status values.

The ordering of items in enumeration is important, because relation greater, smaller is used for resolution between cases when connection should be closed and when it shouldn't.

Enumerator:
PARSER_CMD_LOGIN 

Login command.

PARSER_CMD_LOGOUT 

Logout command.

PARSER_CMD_OTHER 

A command other than login and logout.

PARSER_NOT_VALID 

Request does not validate.

PARSER_HELLO 

Request is not command but <hello> frame this indicates that greeting should be generated.

PARSER_NOT_COMMAND 

Request is not a command nor hello frame.

PARSER_NOT_XML 

Request is not xml.

PARSER_ESCHEMA 

Error when parsing xml schema.

PARSER_EINTERNAL 

Internal parser error (e.g.

malloc failed). This error is esspecialy serious, therefor its log severity SHOULD be higher than of the other errors.


Function Documentation

parser_status epp_parse_command ( epp_context epp_ctx,
int  loggedin,
void *  schema,
const char *  request,
unsigned  bytes,
epp_command_data **  cdata,
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.

Parameters:
epp_ctxEpp context (pool, connection and session id).
loggedinTrue if client is logged in.
schemaParsed xml schema used for validation.
requestRequest to be processed.
bytesLength of the request.
cdataOutput of parsing stage (xml data converted to structure).
cmd_typeOutput of commnad type (used also by logging)
Returns:
Status of parsing.

References epp_calloc(), EPP_DEBUG, epp_malloc(), epplog(), epp_command_data::errors, NS_CONTACT, NS_DOMAIN, NS_ENUMVAL, NS_EPP, NS_FRED, NS_KEYSET, NS_NSSET, parse_command(), parse_extension(), epp_command_data::parsed_doc, PARSER_CMD_OTHER, PARSER_EINTERNAL, PARSER_ESCHEMA, PARSER_HELLO, PARSER_NOT_COMMAND, PARSER_NOT_VALID, PARSER_NOT_XML, epp_context::pool, epp_command_data::rc, epp_command_data::type, VAL_EINTERNAL, VAL_ESCHEMA, VAL_NOT_VALID, epp_command_data::xml_in, XML_IN_ENC, and epp_command_data::xpath_ctx.

Referenced by epp_request_loop().

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.

Parameters:
url_schemaXML schema location.
Returns:
Parsed xml schema.

References cmd_hash_clean(), and cmd_hash_insert().

Referenced by set_schema().

void epp_parser_init_cleanup ( void *  schema)

This will cleanup command hash table, libxml's parser and release parsed xml schema.

Parameters:
schemaParsed xml schema.

References cmd_hash_clean().

Referenced by epp_cleanup_xml().

void epp_parser_request_cleanup ( void *  cdata_arg)

This will cleanup xpath context and parsed document tree.

Parameters:
cdata_argcdata structure containing items to be cleaned up.

References epp_command_data::parsed_doc, and epp_command_data::xpath_ctx.

Referenced by epp_cleanup_request().