Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ota_compiler.h File Reference

#include "gwlib/gwlib.h"

Include dependency graph for ota_compiler.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int ota_compile (Octstr *ota_doc, Octstr *charset, Octstr **ota_binary)


Function Documentation

int ota_compile Octstr ota_doc,
Octstr charset,
Octstr **  ota_binary
 

Definition at line 472 of file ota_compiler.c.

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

Referenced by main(), and ota_pack_message().

00473 {
00474     simple_binary_t *otabxml;
00475     int ret;
00476     xmlDocPtr pDoc;
00477     size_t size;
00478     char *ota_c_text;
00479 
00480     *ota_binary = octstr_create(""); 
00481     otabxml = simple_binary_create();
00482 
00483     octstr_strip_blanks(ota_doc);
00484     octstr_shrink_blanks(ota_doc);
00485     set_charset(ota_doc, charset);
00486     size = octstr_len(ota_doc);
00487     ota_c_text = octstr_get_cstr(ota_doc);
00488     pDoc = xmlParseMemory(ota_c_text, size);
00489 
00490     ret = 0;
00491     if (pDoc) {
00492         ret = parse_document(pDoc, charset, &otabxml);
00493         simple_binary_output(*ota_binary, otabxml);
00494         xmlFreeDoc(pDoc);
00495     } else {
00496         xmlFreeDoc(pDoc);
00497         octstr_destroy(*ota_binary);
00498         simple_binary_destroy(otabxml);
00499         error(0, "OTA: No document to parse. Probably an error in OTA source");
00500         return -1;
00501     }
00502 
00503     simple_binary_destroy(otabxml);
00504 
00505     return ret;
00506 }

Here is the call graph for this function:

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