fred-mod-eppd-2.14.0
Defines | Functions
epp_gen.c File Reference

Component for generating greeting frame and responses to EPP commands in form of xml documents. More...

#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <libxml/parser.h>
#include <libxml/xmlschemas.h>
#include <libxml/xmlwriter.h>
#include "epp_common.h"
#include "epp_xmlcommon.h"
#include "epp_gen.h"

Defines

#define START_ELEMENT(writer, err_handler, elem)
 Wrapper around libxml's xmlTestWriterStartElement() function.
#define WRITE_ELEMENT(writer, err_handler, elem, str)
 Wrapper around libxml's xmlTestWriterWriteElement() function.
#define WRITE_STRING(writer, err_handler, str)
 Wrapper around libxml's xmlTestWriterWriteString() function.
#define WRITE_ATTRIBUTE(writer, err_handler, attr_name, attr_value)
 Wrapper around libxml's xmlTestWriterWriteAttribute() function.
#define END_ELEMENT(writer, err_handler)
 Wrapper around libxml's xmlTestWriterEndElement() function.

Functions

gen_status epp_gen_greeting (void *pool, const char *svid, const char *date, char **greeting)
 Routine makes up epp greeting frame.
static char gen_info_contact (xmlTextWriterPtr writer, epp_command_data *cdata)
 This is assistant function for generating info contact <resData> xml subtree.
static char gen_info_domain (xmlTextWriterPtr writer, epps_info_domain *info_domain)
 This is assistant function for generating info domain <resData> xml subtree.
static char gen_info_nsset (xmlTextWriterPtr writer, epps_info_nsset *info_nsset)
 This is assistant function for generating info nsset <resData> xml subtree.
static char gen_info_keyset (xmlTextWriterPtr writer, epps_info_keyset *info_keyset)
 This is assistant function for generating info keyset <resData> xml subtree.
static char gen_poll_message (xmlTextWriterPtr writer, epps_poll_req *msgdata)
 This is assistant function for generating poll message.
static char * get_bad_xml (void *pool, epp_command_data *cdata, epp_error *e)
 Function gets element (including its content) from input XML document which caused an error.
gen_status epp_gen_response (epp_context *epp_ctx, int validate, void *schema, epp_lang lang, epp_command_data *cdata, char **response, qhead *valerr)
 Generate command response in XML format.

Detailed Description

Component for generating greeting frame and responses to EPP commands in form of xml documents.

Result of generator is the generated string and validation errors if validation of responses is turned on. Greeting frame is not validated, therefore only string is returned (without the list of validation errors).


Function Documentation

gen_status epp_gen_greeting ( void *  pool,
const char *  svid,
const char *  date,
char **  greeting 
)

Routine makes up epp greeting frame.

Parameters:
poolPool to allocate memory from.
svidPart of server ID used in svid tag.
dateCurrent date as returned from server.
greetingGreeting string.
Returns:
Generator status.

References END_ELEMENT, epp_strdup(), GEN_EBUFFER, GEN_EBUILD, GEN_EWRITER, GEN_OK, LOC_EPP, NS_CONTACT, NS_DOMAIN, NS_ENUMVAL, NS_EPP, NS_KEYSET, NS_NSSET, START_ELEMENT, WRITE_ATTRIBUTE, WRITE_ELEMENT, and XSI.

Referenced by epp_process_connection(), and epp_request_loop().

gen_status epp_gen_response ( epp_context epp_ctx,
int  validate,
void *  schema,
epp_lang  lang,
epp_command_data cdata,
char **  response,
qhead valerr 
)

Generate command response in XML format.

There is option that response can be validated, the validation errors are then returned together with generated string in form of a list.

Parameters:
epp_ctxEpp context (session id, connection and pool).
validateTells if response should be validated or not (boolean).
schemaSchema against which to validate.
langLanguage selected by the client.
cdataInput values
responseResult of generation phase = generated string.
valerrList of validation errors if validation is turned on.
Returns:
Generator status.

References epp_avail::avail, epps_check::avails, qhead::body, epp_command_data::clTRID, epps_poll_req::count, epps_poll_ack::count, epps_info::count, epps_create_contact::crDate, epps_create_domain::crDate, epps_create_nsset::crDate, epps_create_keyset::crDate, epp_zonecredit::credit, epp_command_data::data, END_ELEMENT, epp_strdup(), epp_command_data::errors, epps_create_domain::exDate, epps_renew::exDate, epp_ext_item::ext, epp_ext_item::ext_enum, epp_ext_enum::ext_enumval, epps_info_domain::extensions, epp_ext_item::extType, GEN_EBUFFER, GEN_EBUILD, GEN_EINTERNAL, GEN_ESCHEMA, GEN_EWRITER, gen_info_contact(), gen_info_domain(), gen_info_keyset(), gen_info_nsset(), GEN_NOT_VALID, GEN_NOT_XML, GEN_OK, gen_poll_message(), get_bad_xml(), epps_list::handles, epps_create_contact::id, epps_create_nsset::id, epps_create_keyset::id, epps_check::ids, LOC_CONTACT, LOC_DOMAIN, LOC_ENUMVAL, LOC_EPP, LOC_FRED, LOC_KEYSET, LOC_NSSET, epp_command_data::msg, epps_poll_req::msgid, epps_create_domain::name, epps_renew::name, epps_poll_ack::newmsgid, epp_command_data::noresdata, NS_CONTACT, NS_DOMAIN, NS_ENUMVAL, NS_EPP, NS_FRED, NS_KEYSET, NS_NSSET, epp_context::pool, epp_ext_enum::publish, q_content, q_foreach, q_next, q_reset, epps_poll_req::qdate, epp_command_data::rc, epp_error::reason, epp_avail::reason, epp_error::spec, START_ELEMENT, epp_command_data::svTRID, epp_command_data::type, VAL_EINTERNAL, VAL_ESCHEMA, VAL_NOT_VALID, VAL_OK, epp_error::value, WRITE_ATTRIBUTE, WRITE_ELEMENT, WRITE_STRING, XSI, epp_zonecredit::zone, and epps_creditInfo::zonecredits.

Referenced by gen_response().

static char gen_info_contact ( xmlTextWriterPtr  writer,
epp_command_data cdata 
) [static]
static char gen_info_domain ( xmlTextWriterPtr  writer,
epps_info_domain info_domain 
) [static]
static char gen_info_keyset ( xmlTextWriterPtr  writer,
epps_info_keyset info_keyset 
) [static]
static char gen_info_nsset ( xmlTextWriterPtr  writer,
epps_info_nsset info_nsset 
) [static]
static char gen_poll_message ( xmlTextWriterPtr  writer,
epps_poll_req msgdata 
) [static]
static char* get_bad_xml ( void *  pool,
epp_command_data cdata,
epp_error e 
) [static]

Function gets element (including its content) from input XML document which caused an error.

This must be done according to EPP standard.

Parameters:
poolPool to allocate memory from.
cdataCommand data containing xpath context and parsed document.
eError specification.

References epp_strdup(), epp_error::position, and epp_error::spec.

Referenced by epp_gen_response().