Kannel: Open Source WAP and SMS gateway  svn-r5335
wap_push_si_compiler.c File Reference
#include <ctype.h>
#include <inttypes.h>
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/debugXML.h>
#include <libxml/encoding.h>
#include "shared.h"
#include "xml_shared.h"
#include "wap_push_si_compiler.h"
#include "xml_definitions.h"

Go to the source code of this file.

Data Structures

struct  si_2table_t
 
struct  si_3table_t
 

Macros

#define NUMBER_OF_ELEMENTS   sizeof(si_elements)/sizeof(si_elements[0])
 
#define NUMBER_OF_ATTRIBUTES   sizeof(si_attributes)/sizeof(si_attributes[0])
 
#define NUMBER_OF_URL_VALUES   sizeof(si_URL_values)/sizeof(si_URL_values[0])
 

Typedefs

typedef struct si_2table_t si_2table_t
 
typedef struct si_3table_t si_3table_t
 

Functions

static int parse_document (xmlDocPtr document, Octstr *charset, simple_binary_t **si_binary)
 
static int parse_node (xmlNodePtr node, simple_binary_t **sibxml)
 
static int parse_element (xmlNodePtr node, simple_binary_t **sibxml)
 
static int parse_text (xmlNodePtr node, simple_binary_t **sibxml)
 
static int parse_cdata (xmlNodePtr node, simple_binary_t **sibxml)
 
static int parse_attribute (xmlAttrPtr attr, simple_binary_t **sibxml)
 
static int url (int hex)
 
static int action (int hex)
 
static int date (int hex)
 
static Octstrtokenize_date (Octstr *date)
 
static void octstr_drop_trailing_zeros (Octstr **date_token)
 
static void flag_date_length (Octstr **token)
 
static void parse_url_value (Octstr *value, simple_binary_t **sibxml)
 
int si_compile (Octstr *si_doc, Octstr *charset, Octstr **si_binary)
 

Variables

static si_2table_t si_elements []
 
static si_3table_t si_attributes []
 
static si_2table_t si_URL_values []
 

Macro Definition Documentation

◆ NUMBER_OF_ATTRIBUTES

#define NUMBER_OF_ATTRIBUTES   sizeof(si_attributes)/sizeof(si_attributes[0])

Definition at line 137 of file wap_push_si_compiler.c.

Referenced by parse_attribute().

◆ NUMBER_OF_ELEMENTS

#define NUMBER_OF_ELEMENTS   sizeof(si_elements)/sizeof(si_elements[0])

Definition at line 113 of file wap_push_si_compiler.c.

Referenced by parse_element().

◆ NUMBER_OF_URL_VALUES

#define NUMBER_OF_URL_VALUES   sizeof(si_URL_values)/sizeof(si_URL_values[0])

Definition at line 150 of file wap_push_si_compiler.c.

Referenced by parse_url_value().

Typedef Documentation

◆ si_2table_t

typedef struct si_2table_t si_2table_t

Definition at line 88 of file wap_push_si_compiler.c.

◆ si_3table_t

typedef struct si_3table_t si_3table_t

Definition at line 100 of file wap_push_si_compiler.c.

Function Documentation

◆ action()

static int action ( int  hex)
static

Definition at line 434 of file wap_push_si_compiler.c.

Referenced by fdset_listen(), fdset_register(), fdset_set_timeout(), fdset_unregister(), parse_attribute(), and poller().

435 {
436  switch ((unsigned char) hex) {
437  case 0x05: case 0x06: /* action signal-none, action signal-low */
438  case 0x07: case 0x08: /* action signal-medium, action signal-high */
439  case 0x09: /* action delete */
440  return 1;
441  }
442  return 0;
443 }

◆ date()

static int date ( int  hex)
static

Definition at line 451 of file wap_push_si_compiler.c.

Referenced by check_reversible(), date_convert_universal(), date_parse_http(), http_send_reply(), parse_attribute(), parse_date(), parse_http_date(), soap_parse_mo(), soap_write_date(), and tokenize_date().

452 {
453  switch ((unsigned char) hex) {
454  case 0x0a: case 0x10: /* created, si-expires */
455  return 1;
456  }
457  return 0;
458 }

◆ flag_date_length()

static void flag_date_length ( Octstr **  token)
static

Definition at line 513 of file wap_push_si_compiler.c.

References octstr_destroy(), octstr_format(), octstr_insert(), octstr_len(), and token.

Referenced by tokenize_date().

514 {
515  Octstr *lenos;
516 
517  lenos = octstr_format("%c", octstr_len(*token) - 1);
518  octstr_insert(*token, lenos, 1);
519 
520  octstr_destroy(lenos);
521 }
void octstr_insert(Octstr *ostr1, const Octstr *ostr2, long pos)
Definition: octstr.c:1303
int token
Definition: wslexer.c:159
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
Definition: octstr.c:118

◆ octstr_drop_trailing_zeros()

static void octstr_drop_trailing_zeros ( Octstr **  date_token)
static

Definition at line 503 of file wap_push_si_compiler.c.

References octstr_delete(), octstr_get_char(), and octstr_len().

Referenced by tokenize_date().

504 {
505  while (1) {
506  if (octstr_get_char(*date_token, octstr_len(*date_token) - 1) == '\0')
507  octstr_delete(*date_token, octstr_len(*date_token) - 1, 1);
508  else
509  return;
510  }
511 }
void octstr_delete(Octstr *ostr1, long pos, long len)
Definition: octstr.c:1527
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
int octstr_get_char(const Octstr *ostr, long pos)
Definition: octstr.c:406

◆ parse_attribute()

static int parse_attribute ( xmlAttrPtr  attr,
simple_binary_t **  sibxml 
)
static

Definition at line 342 of file wap_push_si_compiler.c.

References action(), create_octstr_from_node, date(), error(), name, NUMBER_OF_ATTRIBUTES, octstr_compare(), octstr_create, octstr_delete(), octstr_destroy(), octstr_imm(), octstr_len(), octstr_ncompare(), output_char(), output_octet_string(), parse_inline_string(), parse_url_value(), si_attributes, si_3table_t::token, tokenize_date(), url(), and si_3table_t::value_part.

Referenced by parse_element().

343 {
344  Octstr *name,
345  *value,
346  *valueos,
347  *tokenized_date;
348  unsigned char si_hex;
349  size_t i,
350  value_len;
351 
352  name = octstr_create((char *)attr->name);
353 
354  if (attr->children != NULL)
355  value = create_octstr_from_node((char *)attr->children);
356  else
357  value = NULL;
358 
359  if (value == NULL)
360  goto error;
361 
362  i = 0;
363  valueos = NULL;
364  while (i < NUMBER_OF_ATTRIBUTES) {
366  if (si_attributes[i].value_part == NULL) {
367  break;
368  } else {
369  value_len = octstr_len(valueos =
370  octstr_imm(si_attributes[i].value_part));
371  if (octstr_ncompare(value, valueos, value_len) == 0) {
372  break;
373  }
374  }
375  }
376  ++i;
377  }
378 
379  if (i == NUMBER_OF_ATTRIBUTES)
380  goto error;
381 
382  tokenized_date = NULL;
383  si_hex = si_attributes[i].token;
384  if (action(si_hex)) {
385  output_char(si_hex, sibxml);
386  } else if (url(si_hex)) {
387  output_char(si_hex, sibxml);
388  octstr_delete(value, 0, octstr_len(valueos));
389  parse_url_value(value, sibxml);
390  } else if (date(si_hex)) {
391  if ((tokenized_date = tokenize_date(value)) == NULL)
392  goto error;
393  output_char(si_hex, sibxml);
394  output_octet_string(tokenized_date, sibxml);
395  } else {
396  output_char(si_hex, sibxml);
397  parse_inline_string(value, sibxml);
398  }
399 
400  octstr_destroy(tokenized_date);
402  octstr_destroy(value);
403  return 0;
404 
405 error:
407  octstr_destroy(value);
408  return -1;
409 }
void error(int err, const char *fmt,...)
Definition: log.c:648
void output_octet_string(Octstr *os, simple_binary_t **sibxml)
Definition: xml_shared.c:349
static void parse_url_value(Octstr *value, simple_binary_t **sibxml)
static si_3table_t si_attributes[]
void parse_inline_string(Octstr *temp, simple_binary_t **binary)
Definition: xml_shared.c:339
Octstr * octstr_imm(const char *cstr)
Definition: octstr.c:283
void octstr_delete(Octstr *ostr1, long pos, long len)
Definition: octstr.c:1527
int octstr_ncompare(const Octstr *ostr1, const Octstr *ostr2, long n)
Definition: octstr.c:952
static int action(int hex)
char * name
Definition: smsc_cimd2.c:212
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define octstr_create(cstr)
Definition: octstr.h:125
unsigned char token
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
Definition: octstr.c:118
void output_char(int byte, simple_binary_t **binary)
Definition: xml_shared.c:326
static int date(int hex)
#define create_octstr_from_node(node)
#define NUMBER_OF_ATTRIBUTES
static Octstr * tokenize_date(Octstr *date)
static int url(int hex)
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
Definition: octstr.c:871

◆ parse_cdata()

static int parse_cdata ( xmlNodePtr  node,
simple_binary_t **  sibxml 
)
static

Definition at line 596 of file wap_push_si_compiler.c.

References create_octstr_from_node, octstr_destroy(), and parse_octet_string().

Referenced by parse_node().

597 {
598  int ret = 0;
599  Octstr *temp;
600 
601  temp = create_octstr_from_node((char *)node);
602  parse_octet_string(temp, sibxml);
603  octstr_destroy(temp);
604 
605  return ret;
606 }
void parse_octet_string(Octstr *os, simple_binary_t **binary)
Definition: xml_shared.c:331
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
Definition: octstr.c:118
#define create_octstr_from_node(node)

◆ parse_document()

static int parse_document ( xmlDocPtr  document,
Octstr charset,
simple_binary_t **  si_binary 
)
static

Definition at line 221 of file wap_push_si_compiler.c.

References charset, octstr_create, octstr_destroy(), parse_charset(), and parse_node().

Referenced by si_compile().

223 {
224  xmlNodePtr node;
225 
226  (*sibxml)->wbxml_version = 0x02; /* WBXML Version number 1.2 */
227  (*sibxml)->public_id = 0x05; /* SI 1.0 Public ID */
228 
229  charset = octstr_create("UTF-8");
230  (*sibxml)->charset = parse_charset(charset);
232 
233  node = xmlDocGetRootElement(document);
234  return parse_node(node, sibxml);
235 }
static int parse_node(xmlNodePtr node, simple_binary_t **sibxml)
Octstr * charset
Definition: test_ota.c:68
int parse_charset(Octstr *os)
Definition: xml_shared.c:189
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define octstr_create(cstr)
Definition: octstr.h:125

◆ parse_element()

static int parse_element ( xmlNodePtr  node,
simple_binary_t **  sibxml 
)
static

Definition at line 245 of file wap_push_si_compiler.c.

References element_check_content(), name, NUMBER_OF_ELEMENTS, octstr_compare(), octstr_create, octstr_destroy(), octstr_duplicate, octstr_get_cstr, octstr_imm(), octstr_len(), output_char(), output_octet_string(), parse_attribute(), parse_end(), si_elements, si_2table_t::token, warning(), WBXML_CONTENT_BIT, and WBXML_LITERAL.

Referenced by parse_node().

246 {
247  Octstr *name,
248  *outos;
249  size_t i;
250  unsigned char status_bits,
251  si_hex;
252  int add_end_tag;
253  xmlAttrPtr attribute;
254 
255  name = octstr_create((char *)node->name);
256  outos = NULL;
257  if (octstr_len(name) == 0) {
259  return -1;
260  }
261 
262  i = 0;
263  while (i < NUMBER_OF_ELEMENTS) {
265  break;
266  ++i;
267  }
268 
269  status_bits = 0x00;
270  si_hex = 0x00;
271  add_end_tag = 0;
272 
273  if (i != NUMBER_OF_ELEMENTS) {
274  si_hex = si_elements[i].token;
275  if ((status_bits = element_check_content(node)) > 0) {
276  si_hex = si_hex | status_bits;
277 
278  if ((status_bits & WBXML_CONTENT_BIT) == WBXML_CONTENT_BIT)
279  add_end_tag = 1;
280  }
281  output_char(si_hex, sibxml);
282  } else {
283  warning(0, "unknown tag %s in SI source", octstr_get_cstr(name));
284  si_hex = WBXML_LITERAL;
285  if ((status_bits = element_check_content(node)) > 0) {
286  si_hex = si_hex | status_bits;
287  /* If this node has children, the end tag must be added after
288  them. */
289  if ((status_bits & WBXML_CONTENT_BIT) == WBXML_CONTENT_BIT)
290  add_end_tag = 1;
291  }
292  output_char(si_hex, sibxml);
293  output_octet_string(outos = octstr_duplicate(name), sibxml);
294  }
295 
296  if (node->properties != NULL) {
297  attribute = node->properties;
298  while (attribute != NULL) {
299  parse_attribute(attribute, sibxml);
300  attribute = attribute->next;
301  }
302  parse_end(sibxml);
303  }
304 
305  octstr_destroy(outos);
307  return add_end_tag;
308 }
void output_octet_string(Octstr *os, simple_binary_t **sibxml)
Definition: xml_shared.c:349
static si_2table_t si_elements[]
unsigned char element_check_content(xmlNodePtr node)
Definition: xml_shared.c:242
#define NUMBER_OF_ELEMENTS
#define octstr_get_cstr(ostr)
Definition: octstr.h:233
Octstr * octstr_imm(const char *cstr)
Definition: octstr.c:283
#define WBXML_LITERAL
#define octstr_duplicate(ostr)
Definition: octstr.h:187
static int parse_attribute(xmlAttrPtr attr, simple_binary_t **sibxml)
char * name
Definition: smsc_cimd2.c:212
void warning(int err, const char *fmt,...)
Definition: log.c:660
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define octstr_create(cstr)
Definition: octstr.h:125
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
Definition: octstr.c:118
void parse_end(simple_binary_t **binary)
Definition: xml_shared.c:321
void output_char(int byte, simple_binary_t **binary)
Definition: xml_shared.c:326
#define WBXML_CONTENT_BIT
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
Definition: octstr.c:871
unsigned char token

◆ parse_node()

static int parse_node ( xmlNodePtr  node,
simple_binary_t **  sibxml 
)
static

Definition at line 530 of file wap_push_si_compiler.c.

References error(), parse_cdata(), parse_element(), parse_end(), parse_text(), and warning().

Referenced by parse_document().

531 {
532  int status = 0;
533 
534  /* Call for the parser function of the node type. */
535  switch (node->type) {
536  case XML_ELEMENT_NODE:
537  status = parse_element(node, sibxml);
538  break;
539  case XML_TEXT_NODE:
540  status = parse_text(node, sibxml);
541  break;
542  case XML_CDATA_SECTION_NODE:
543  status = parse_cdata(node, sibxml);
544  break;
545  case XML_COMMENT_NODE:
546  case XML_PI_NODE:
547  /* Comments and PIs are ignored. */
548  break;
549  /*
550  * XML has also many other node types, these are not needed with
551  * SI. Therefore they are assumed to be an error.
552  */
553  default:
554  error(0, "SI compiler: Unknown XML node in the SI source.");
555  return -1;
556  break;
557  }
558 
559  /*
560  * If node is an element with content, it will need an end tag after it's
561  * children. The status for it is returned by parse_element.
562  */
563  switch (status) {
564  case 0:
565 
566  if (node->children != NULL)
567  if (parse_node(node->children, sibxml) == -1)
568  return -1;
569  break;
570  case 1:
571  if (node->children != NULL)
572  if (parse_node(node->children, sibxml) == -1)
573  return -1;
574  parse_end(sibxml);
575  break;
576 
577  case -1: /* Something went wrong in the parsing. */
578  return -1;
579  default:
580  warning(0,"SI compiler: undefined return value in a parse function.");
581  return -1;
582  break;
583  }
584 
585  if (node->next != NULL)
586  if (parse_node(node->next, sibxml) == -1)
587  return -1;
588 
589  return 0;
590 }
void error(int err, const char *fmt,...)
Definition: log.c:648
static int parse_cdata(xmlNodePtr node, simple_binary_t **sibxml)
static int parse_node(xmlNodePtr node, simple_binary_t **sibxml)
static int parse_text(xmlNodePtr node, simple_binary_t **sibxml)
void warning(int err, const char *fmt,...)
Definition: log.c:660
void parse_end(simple_binary_t **binary)
Definition: xml_shared.c:321
static int parse_element(xmlNodePtr node, simple_binary_t **sibxml)

◆ parse_text()

static int parse_text ( xmlNodePtr  node,
simple_binary_t **  sibxml 
)
static

Definition at line 316 of file wap_push_si_compiler.c.

References create_octstr_from_node, octstr_destroy(), octstr_len(), octstr_shrink_blanks(), octstr_strip_blanks(), and parse_inline_string().

Referenced by parse_node().

317 {
318  Octstr *temp;
319 
320  temp = create_octstr_from_node((char *)node);
321 
322  octstr_shrink_blanks(temp);
323  octstr_strip_blanks(temp);
324 
325  if (octstr_len(temp) == 0) {
326  octstr_destroy(temp);
327  return 0;
328  }
329 
330  parse_inline_string(temp, sibxml);
331  octstr_destroy(temp);
332 
333  return 0;
334 }
void octstr_strip_blanks(Octstr *text)
Definition: octstr.c:1346
void parse_inline_string(Octstr *temp, simple_binary_t **binary)
Definition: xml_shared.c:339
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
Definition: octstr.c:118
#define create_octstr_from_node(node)
void octstr_shrink_blanks(Octstr *text)
Definition: octstr.c:1433

◆ parse_url_value()

void parse_url_value ( Octstr value,
simple_binary_t **  sibxml 
)
static

Definition at line 615 of file wap_push_si_compiler.c.

References name, NUMBER_OF_URL_VALUES, octstr_delete(), octstr_destroy(), octstr_duplicate, octstr_imm(), octstr_len(), octstr_search(), output_char(), parse_inline_string(), si_URL_values, and token.

Referenced by parse_attribute().

616 {
617  size_t i;
618  long pos;
619  Octstr *urlos,
620  *first_part,
621  *last_part;
622  size_t first_part_len;
623 
624  i = 0;
625  first_part_len = 0;
626  first_part = NULL;
627  last_part = NULL;
628  while (i < NUMBER_OF_URL_VALUES) {
629  pos = octstr_search(value,
630  urlos = octstr_imm(si_URL_values[i].name), 0);
631  if (pos >= 0) {
632  first_part = octstr_duplicate(value);
633  octstr_delete(first_part, pos, octstr_len(first_part) - pos);
634  first_part_len = octstr_len(first_part);
635  parse_inline_string(first_part, sibxml);
636  output_char(si_URL_values[i].token, sibxml);
637  last_part = octstr_duplicate(value);
638  octstr_delete(last_part, 0, first_part_len + octstr_len(urlos));
639  parse_inline_string(last_part, sibxml);
640  octstr_destroy(first_part);
641  octstr_destroy(last_part);
642  break;
643  }
644  octstr_destroy(urlos);
645  ++i;
646  }
647 
648  if (pos < 0)
649  parse_inline_string(value, sibxml);
650 
651 }
long octstr_search(const Octstr *haystack, const Octstr *needle, long pos)
Definition: octstr.c:1070
static si_2table_t si_URL_values[]
void parse_inline_string(Octstr *temp, simple_binary_t **binary)
Definition: xml_shared.c:339
Octstr * octstr_imm(const char *cstr)
Definition: octstr.c:283
int token
Definition: wslexer.c:159
void octstr_delete(Octstr *ostr1, long pos, long len)
Definition: octstr.c:1527
#define octstr_duplicate(ostr)
Definition: octstr.h:187
char * name
Definition: smsc_cimd2.c:212
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
Definition: octstr.c:118
void output_char(int byte, simple_binary_t **binary)
Definition: xml_shared.c:326
#define NUMBER_OF_URL_VALUES

◆ si_compile()

int si_compile ( Octstr si_doc,
Octstr charset,
Octstr **  si_binary 
)

Definition at line 178 of file wap_push_si_compiler.c.

References charset, error(), octstr_create, octstr_destroy(), octstr_get_cstr, octstr_len(), octstr_strip_blanks(), parse_document(), set_charset(), simple_binary_create(), simple_binary_destroy(), simple_binary_output(), and size.

Referenced by convert_si_to_sic(), and main().

179 {
180  simple_binary_t *sibxml;
181  int ret;
182  xmlDocPtr pDoc;
183  size_t size;
184  char *si_c_text;
185 
186  *si_binary = octstr_create("");
187  sibxml = simple_binary_create();
188 
189  octstr_strip_blanks(si_doc);
190  set_charset(si_doc, charset);
191  size = octstr_len(si_doc);
192  si_c_text = octstr_get_cstr(si_doc);
193  pDoc = xmlParseMemory(si_c_text, size);
194 
195  ret = 0;
196  if (pDoc) {
197  ret = parse_document(pDoc, charset, &sibxml);
198  simple_binary_output(*si_binary, sibxml);
199  xmlFreeDoc(pDoc);
200  } else {
201  xmlFreeDoc(pDoc);
202  octstr_destroy(*si_binary);
203  simple_binary_destroy(sibxml);
204  error(0, "SI: No document to parse. Probably an error in SI source");
205  return -1;
206  }
207 
208  simple_binary_destroy(sibxml);
209 
210  return ret;
211 }
void error(int err, const char *fmt,...)
Definition: log.c:648
int size
Definition: wsasm.c:84
void octstr_strip_blanks(Octstr *text)
Definition: octstr.c:1346
#define octstr_get_cstr(ostr)
Definition: octstr.h:233
Octstr * charset
Definition: test_ota.c:68
void simple_binary_destroy(simple_binary_t *binary)
Definition: xml_shared.c:298
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define octstr_create(cstr)
Definition: octstr.h:125
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
void simple_binary_output(Octstr *os, simple_binary_t *binary)
Definition: xml_shared.c:311
void set_charset(Octstr *document, Octstr *charset)
Definition: xml_shared.c:111
static int parse_document(xmlDocPtr document, Octstr *charset, simple_binary_t **si_binary)
simple_binary_t * simple_binary_create(void)
Definition: xml_shared.c:284

◆ tokenize_date()

static Octstr * tokenize_date ( Octstr date)
static

Definition at line 465 of file wap_push_si_compiler.c.

References date(), flag_date_length(), octstr_append_char(), octstr_create, octstr_destroy(), octstr_drop_trailing_zeros(), octstr_get_char(), octstr_len(), octstr_set_bits(), parse_date(), and WBXML_OPAQUE.

Referenced by parse_attribute().

466 {
467  Octstr *date_token;
468  long j;
469  size_t i,
470  date_len;
471  unsigned char c;
472 
473  if (!parse_date(date)) {
474  return NULL;
475  }
476 
477  date_token = octstr_create("");
478  octstr_append_char(date_token, WBXML_OPAQUE);
479 
480  i = 0;
481  j = 0;
482  date_len = octstr_len(date);
483  while (i < date_len) {
484  c = octstr_get_char(date, i);
485  if (c != 'T' && c != 'Z' && c != '-' && c != ':') {
486  if (isdigit(c)) {
487  octstr_set_bits(date_token, 4*j + 8, 4, c & 0x0f);
488  ++j;
489  } else {
490  octstr_destroy(date_token);
491  return NULL;
492  }
493  }
494  ++i;
495  }
496 
497  octstr_drop_trailing_zeros(&date_token);
498  flag_date_length(&date_token);
499 
500  return date_token;
501 }
Octstr * parse_date(Octstr *date)
Definition: shared.c:232
void octstr_set_bits(Octstr *ostr, long bitpos, int numbits, unsigned long value)
Definition: octstr.c:1849
void octstr_append_char(Octstr *ostr, int ch)
Definition: octstr.c:1517
static void flag_date_length(Octstr **token)
#define WBXML_OPAQUE
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define octstr_create(cstr)
Definition: octstr.h:125
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
Definition: octstr.c:118
static void octstr_drop_trailing_zeros(Octstr **date_token)
static int date(int hex)
int octstr_get_char(const Octstr *ostr, long pos)
Definition: octstr.c:406

◆ url()

static int url ( int  hex)
static

Definition at line 417 of file wap_push_si_compiler.c.

Referenced by parse_attribute().

418 {
419  switch ((unsigned char) hex) {
420  case 0x0b: /* href */
421  case 0x0c: case 0x0e: /* href http://, href https:// */
422  case 0x0d: case 0x0f: /* href http://www., href https://www. */
423  return 1;
424  }
425  return 0;
426 }

Variable Documentation

◆ si_attributes

si_3table_t si_attributes[]
static
Initial value:
= {
{ "action", "signal-none", 0x05 },
{ "action", "signal-low", 0x06 },
{ "action", "signal-medium", 0x07 },
{ "action", "signal-high", 0x08 },
{ "action", "delete", 0x09 },
{ "created", NULL, 0x0a },
{ "href", "https://www.", 0x0f },
{ "href", "http://www.", 0x0d },
{ "href", "https://", 0x0e },
{ "href", "http://", 0x0c },
{ "href", NULL, 0x0b },
{ "si-expires", NULL, 0x10 },
{ "si-id", NULL, 0x11 },
{ "class", NULL, 0x12 }
}

Definition at line 120 of file wap_push_si_compiler.c.

Referenced by parse_attribute().

◆ si_elements

si_2table_t si_elements[]
static
Initial value:
= {
{ "si", 0x05 },
{ "indication", 0x06 },
{ "info", 0x07 },
{ "item", 0x08 }
}

Definition at line 106 of file wap_push_si_compiler.c.

Referenced by parse_element().

◆ si_URL_values

si_2table_t si_URL_values[]
static
Initial value:
= {
{ ".com/", 0x85 },
{ ".edu/", 0x86 },
{ ".net/", 0x87 },
{ ".org/", 0x88 }
}

Definition at line 143 of file wap_push_si_compiler.c.

Referenced by parse_url_value().

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.