cpl_parser.c File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include "../../parser/parse_uri.h"
#include "../../dprint.h"
#include "../../str.h"
#include "../../ut.h"
#include "CPL_tree.h"
#include "sub_list.h"
#include "cpl_log.h"

Include dependency graph for cpl_parser.c:

Go to the source code of this file.

Defines

#define append_double_str_attr(_p_, _s1_, _s2_, _end_, _error_)
#define append_short_attr(_p_, _n_, _end_, _error_)
#define append_str_attr(_p_, _s_, _end_, _error_)
#define BAD_CPL   "CPL script doesn't respect CPL grammar"
#define BAD_CPL_LEN   (sizeof(BAD_CPL)-1)
#define BAD_XML   "CPL script is not a valid XML document"
#define BAD_XML_LEN   (sizeof(BAD_XML)-1)
#define check_overflow(_p_, _offset_, _end_, _error_)
#define ENC_ERR   "Encoding of the CPL script failed"
#define ENC_ERR_LEN   (sizeof(ENC_ERR)-1)
#define ENCONDING_BUFFER_SIZE   65536
#define FOR_ALL_ATTR(_node, _attr)   for( (_attr)=(_node)->properties ; (_attr) ; (_attr)=(_attr)->next)
#define get_attr_val(_attr_name_, _val_, _error_)
#define MAX_EMAIL_BODY_SIZE   512
#define MAX_EMAIL_HDR_SIZE   7
#define MAX_EMAIL_SUBJECT_SIZE   32
#define NULL_CPL   "Empty CPL script"
#define NULL_CPL_LEN   (sizeof(NULL_CPL)-1)
#define set_attr_type(_p_, _type_, _end_, _error_)

Typedefs

typedef unsigned short length_type
typedef length_typelength_type_ptr

Enumerations

enum  { EMAIL_TO, EMAIL_HDR_NAME, EMAIL_KNOWN_HDR_BODY, EMAIL_UNKNOWN_HDR_BODY }

Functions

static char * decode_mail_url (char *p, char *p_end, char *url, unsigned char *nr_attr)
static int encode_address_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_address_switch_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_lang_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_location_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_log_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_lookup_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_mail_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
int encode_node (xmlNodePtr node, char *p, char *p_end)
static int encode_priority_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_proxy_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_redirect_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_reject_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_rmvloc_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_string_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_string_switch_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_sub_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_subaction_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_time_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
static int encode_time_switch_attr (xmlNodePtr node, char *node_ptr, char *buf_end)
int encodeCPL (str *xml, str *bin, str *log)
int init_CPL_parser (char *DTD_filename)

Variables

static xmlValidCtxt cvp
static xmlDtdPtr dtd
static struct nodelist = 0


Define Documentation

#define append_double_str_attr ( _p_,
_s1_,
_s2_,
_end_,
_error_   ) 

Definition at line 93 of file cpl_parser.c.

Referenced by encode_time_switch_attr().

#define append_short_attr ( _p_,
_n_,
_end_,
_error_   ) 

#define append_str_attr ( _p_,
_s_,
_end_,
_error_   ) 

#define BAD_CPL   "CPL script doesn't respect CPL grammar"

Definition at line 1471 of file cpl_parser.c.

Referenced by encodeCPL().

#define BAD_CPL_LEN   (sizeof(BAD_CPL)-1)

Definition at line 1472 of file cpl_parser.c.

Referenced by encodeCPL().

#define BAD_XML   "CPL script is not a valid XML document"

Definition at line 1469 of file cpl_parser.c.

Referenced by encodeCPL().

#define BAD_XML_LEN   (sizeof(BAD_XML)-1)

Definition at line 1470 of file cpl_parser.c.

Referenced by encodeCPL().

#define check_overflow ( _p_,
_offset_,
_end_,
_error_   ) 

Definition at line 60 of file cpl_parser.c.

Referenced by encode_node().

#define ENC_ERR   "Encoding of the CPL script failed"

Definition at line 1475 of file cpl_parser.c.

Referenced by encodeCPL().

#define ENC_ERR_LEN   (sizeof(ENC_ERR)-1)

Definition at line 1476 of file cpl_parser.c.

Referenced by encodeCPL().

#define ENCONDING_BUFFER_SIZE   65536

Definition at line 55 of file cpl_parser.c.

Referenced by encodeCPL().

#define FOR_ALL_ATTR ( _node,
_attr   )     for( (_attr)=(_node)->properties ; (_attr) ; (_attr)=(_attr)->next)

#define get_attr_val ( _attr_name_,
_val_,
_error_   ) 

#define MAX_EMAIL_BODY_SIZE   512

Definition at line 121 of file cpl_parser.c.

Referenced by decode_mail_url().

#define MAX_EMAIL_HDR_SIZE   7

Definition at line 120 of file cpl_parser.c.

Referenced by decode_mail_url().

#define MAX_EMAIL_SUBJECT_SIZE   32

Definition at line 122 of file cpl_parser.c.

Referenced by decode_mail_url().

#define NULL_CPL   "Empty CPL script"

Definition at line 1473 of file cpl_parser.c.

Referenced by encodeCPL().

#define NULL_CPL_LEN   (sizeof(NULL_CPL)-1)

Definition at line 1474 of file cpl_parser.c.

Referenced by encodeCPL().

#define set_attr_type ( _p_,
_type_,
_end_,
_error_   ) 


Typedef Documentation

typedef unsigned short length_type

Definition at line 49 of file cpl_parser.c.

Definition at line 50 of file cpl_parser.c.


Enumeration Type Documentation

anonymous enum

Enumerator:
EMAIL_TO 
EMAIL_HDR_NAME 
EMAIL_KNOWN_HDR_BODY 
EMAIL_UNKNOWN_HDR_BODY 

Definition at line 52 of file cpl_parser.c.


Function Documentation

static char* decode_mail_url ( char *  p,
char *  p_end,
char *  url,
unsigned char *  nr_attr 
) [inline, static]

static int encode_address_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_address_switch_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_lang_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_location_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_log_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_lookup_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_mail_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

Definition at line 1173 of file cpl_parser.c.

References ATTR_PTR, decode_mail_url(), FOR_ALL_ATTR, LM_ERR, and NR_OF_ATTR.

Referenced by encode_node().

int encode_node ( xmlNodePtr  node,
char *  p,
char *  p_end 
)

static int encode_priority_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_proxy_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_redirect_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_reject_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_rmvloc_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_string_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_string_switch_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_sub_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_subaction_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

Definition at line 1204 of file cpl_parser.c.

References append_to_list(), FOR_ALL_ATTR, get_attr_val, LM_ERR, and _str::s.

Referenced by encode_node().

static int encode_time_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

static int encode_time_switch_attr ( xmlNodePtr  node,
char *  node_ptr,
char *  buf_end 
) [inline, static]

int encodeCPL ( str xml,
str bin,
str log 
)

int init_CPL_parser ( char *  DTD_filename  ) 

Definition at line 1537 of file cpl_parser.c.

References cvp, dtd, LM_ERR, and NULL.

Referenced by cpl_init().


Variable Documentation

xmlValidCtxt cvp [static]

Definition at line 46 of file cpl_parser.c.

Referenced by encodeCPL(), and init_CPL_parser().

xmlDtdPtr dtd [static]

Definition at line 45 of file cpl_parser.c.

Referenced by encodeCPL(), and init_CPL_parser().

struct node* list = 0 [static]

Definition at line 44 of file cpl_parser.c.


Generated on Mon May 21 18:00:38 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6