Kannel: Open Source WAP and SMS gateway  svn-r5335
wap_push_si_compiler.h File Reference
#include "gwlib/gwlib.h"

Go to the source code of this file.

Functions

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

Function Documentation

◆ 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
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.