67 #include <libxml/xmlmemory.h>    68 #include <libxml/tree.h>    69 #include <libxml/debugXML.h>    70 #include <libxml/encoding.h>   108     { 
"indication", 0x06 },
   113 #define NUMBER_OF_ELEMENTS sizeof(si_elements)/sizeof(si_elements[0])   121     { 
"action", 
"signal-none", 0x05 },
   122     { 
"action", 
"signal-low", 0x06 },
   123     { 
"action", 
"signal-medium", 0x07 },
   124     { 
"action", 
"signal-high", 0x08 },
   125     { 
"action", 
"delete", 0x09 },
   126     { 
"created", NULL, 0x0a },
   127     { 
"href", 
"https://www.", 0x0f },
   128     { 
"href", 
"http://www.", 0x0d },
   129     { 
"href", 
"https://", 0x0e },
   130     { 
"href", 
"http://", 0x0c },
   131     { 
"href", NULL, 0x0b },
   132     { 
"si-expires", NULL, 0x10 },
   133     { 
"si-id", NULL, 0x11 },
   134     { 
"class", NULL, 0x12 }
   137 #define NUMBER_OF_ATTRIBUTES sizeof(si_attributes)/sizeof(si_attributes[0])   150 #define NUMBER_OF_URL_VALUES sizeof(si_URL_values)/sizeof(si_URL_values[0])   165 static int url(
int hex);   
   166 static int action(
int hex);
   167 static int date(
int hex);
   193     pDoc = xmlParseMemory(si_c_text, 
size);
   204         error(0, 
"SI: No document to parse. Probably an error in SI source");
   226     (*sibxml)->wbxml_version = 0x02; 
   227     (*sibxml)->public_id = 0x05; 
   233     node = xmlDocGetRootElement(document);
   250     unsigned char status_bits,
   253     xmlAttrPtr attribute;
   276         si_hex = si_hex | status_bits;
   286         si_hex = si_hex | status_bits;
   296     if (node->properties != NULL) {
   297     attribute = node->properties;
   298     while (attribute != NULL) {
   300         attribute = attribute->next;
   348     unsigned char si_hex;
   354     if (attr->children != NULL)
   382     tokenized_date = NULL;
   386     } 
else if (
url(si_hex)) {
   390     } 
else if (
date(si_hex)) {
   419     switch ((
unsigned char) hex) {
   421     case 0x0c: 
case 0x0e: 
   422     case 0x0d: 
case 0x0f: 
   436     switch ((
unsigned char) hex) {
   437     case 0x05: 
case 0x06: 
   438     case 0x07: 
case 0x08: 
   453     switch ((
unsigned char) hex) {
   454     case 0x0a: 
case 0x10: 
   483     while (i < date_len) {
   485         if (c != 
'T' && c != 
'Z' && c != 
'-' && c != 
':') {
   535     switch (node->type) {
   536     case XML_ELEMENT_NODE:
   542     case XML_CDATA_SECTION_NODE:
   545     case XML_COMMENT_NODE:
   554     error(0, 
"SI compiler: Unknown XML node in the SI source.");
   566     if (node->children != NULL)
   571     if (node->children != NULL)
   580     warning(0,
"SI compiler: undefined return value in a parse function.");
   585     if (node->next != NULL)
   622     size_t first_part_len;
 void error(int err, const char *fmt,...)
 
static int parse_cdata(xmlNodePtr node, simple_binary_t **sibxml)
 
void output_octet_string(Octstr *os, simple_binary_t **sibxml)
 
static si_2table_t si_elements[]
 
unsigned char element_check_content(xmlNodePtr node)
 
#define NUMBER_OF_ELEMENTS
 
static int parse_node(xmlNodePtr node, simple_binary_t **sibxml)
 
Octstr * parse_date(Octstr *date)
 
void octstr_set_bits(Octstr *ostr, long bitpos, int numbits, unsigned long value)
 
static void parse_url_value(Octstr *value, simple_binary_t **sibxml)
 
void octstr_append_char(Octstr *ostr, int ch)
 
long octstr_search(const Octstr *haystack, const Octstr *needle, long pos)
 
static void flag_date_length(Octstr **token)
 
void parse_octet_string(Octstr *os, simple_binary_t **binary)
 
void octstr_strip_blanks(Octstr *text)
 
#define octstr_get_cstr(ostr)
 
int si_compile(Octstr *si_doc, Octstr *charset, Octstr **si_binary)
 
static si_3table_t si_attributes[]
 
static int parse_text(xmlNodePtr node, simple_binary_t **sibxml)
 
void simple_binary_destroy(simple_binary_t *binary)
 
static si_2table_t si_URL_values[]
 
void parse_inline_string(Octstr *temp, simple_binary_t **binary)
 
Octstr * octstr_imm(const char *cstr)
 
void octstr_insert(Octstr *ostr1, const Octstr *ostr2, long pos)
 
int parse_charset(Octstr *os)
 
void octstr_delete(Octstr *ostr1, long pos, long len)
 
int octstr_ncompare(const Octstr *ostr1, const Octstr *ostr2, long n)
 
static int action(int hex)
 
#define octstr_duplicate(ostr)
 
static int parse_attribute(xmlAttrPtr attr, simple_binary_t **sibxml)
 
void warning(int err, const char *fmt,...)
 
Octstr * octstr_format(const char *fmt,...)
 
void octstr_destroy(Octstr *ostr)
 
#define octstr_create(cstr)
 
long octstr_len(const Octstr *ostr)
 
void simple_binary_output(Octstr *os, simple_binary_t *binary)
 
void set_charset(Octstr *document, Octstr *charset)
 
static void octstr_drop_trailing_zeros(Octstr **date_token)
 
void parse_end(simple_binary_t **binary)
 
static int parse_document(xmlDocPtr document, Octstr *charset, simple_binary_t **si_binary)
 
void output_char(int byte, simple_binary_t **binary)
 
#define WBXML_CONTENT_BIT
 
#define create_octstr_from_node(node)
 
simple_binary_t * simple_binary_create(void)
 
#define NUMBER_OF_ATTRIBUTES
 
int octstr_get_char(const Octstr *ostr, long pos)
 
void octstr_shrink_blanks(Octstr *text)
 
static Octstr * tokenize_date(Octstr *date)
 
#define NUMBER_OF_URL_VALUES
 
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
 
static int parse_element(xmlNodePtr node, simple_binary_t **sibxml)