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

Go to the source code of this file.

Functions

int sl_compile (Octstr *sl_doc, Octstr *charset, Octstr **sl_binary)
 

Function Documentation

◆ sl_compile()

int sl_compile ( Octstr sl_doc,
Octstr charset,
Octstr **  sl_binary 
)

Definition at line 163 of file wap_push_sl_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_sl_to_slc(), and main().

164 {
165  simple_binary_t *slbxml;
166  int ret;
167  xmlDocPtr pDoc;
168  size_t size;
169  char *sl_c_text;
170 
171  *sl_binary = octstr_create("");
172  slbxml = simple_binary_create();
173 
174  octstr_strip_blanks(sl_doc);
175  set_charset(sl_doc, charset);
176  size = octstr_len(sl_doc);
177  sl_c_text = octstr_get_cstr(sl_doc);
178  pDoc = xmlParseMemory(sl_c_text, size);
179 
180  ret = 0;
181  if (pDoc) {
182  ret = parse_document(pDoc, charset, &slbxml);
183  simple_binary_output(*sl_binary, slbxml);
184  xmlFreeDoc(pDoc);
185  } else {
186  xmlFreeDoc(pDoc);
187  octstr_destroy(*sl_binary);
188  simple_binary_destroy(slbxml);
189  error(0, "SL: No document to parse. Probably an error in SL source");
190  return -1;
191  }
192 
193  simple_binary_destroy(slbxml);
194 
195  return ret;
196 }
void error(int err, const char *fmt,...)
Definition: log.c:648
int size
Definition: wsasm.c:84
static int parse_document(xmlDocPtr document, Octstr *charset, simple_binary_t **slbxml)
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
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.