[asterisk-commits] mmichelson: branch group/CCSS r232819 - in /team/group/CCSS: include/asterisk...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 3 13:30:16 CST 2009


Author: mmichelson
Date: Thu Dec  3 13:30:12 2009
New Revision: 232819

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=232819
Log:
Add API call to xml.h to read an XML document from memory.

For SIP call-completion support, incoming PUBLISH messages
will be in PIDF, which is XML. What's to come here is a
simple set of function calls within chan_sip to read
specific elements from a PIDF document.


Modified:
    team/group/CCSS/include/asterisk/xml.h
    team/group/CCSS/main/xml.c

Modified: team/group/CCSS/include/asterisk/xml.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/xml.h?view=diff&rev=232819&r1=232818&r2=232819
==============================================================================
--- team/group/CCSS/include/asterisk/xml.h (original)
+++ team/group/CCSS/include/asterisk/xml.h Thu Dec  3 13:30:12 2009
@@ -44,6 +44,14 @@
  *  \retval The ast_xml_doc reference to the open document.
  */
 struct ast_xml_doc *ast_xml_open(char *filename);
+
+/*! \brief Open an XML document that resides in memory.
+ * \param buffer The address where the document is stored
+ * \size The number of bytes in the document
+ * \retval NULL on error.
+ * \retval The ast_xml_doc reference to the open document.
+ */
+struct ast_xml_doc *ast_xml_read_memory(char *buffer, size_t size);
 
 /*! \brief Close an already open document and free the used
  *        structure.

Modified: team/group/CCSS/main/xml.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/xml.c?view=diff&rev=232819&r1=232818&r2=232819
==============================================================================
--- team/group/CCSS/main/xml.c (original)
+++ team/group/CCSS/main/xml.c Thu Dec  3 13:30:12 2009
@@ -57,6 +57,25 @@
 
 	doc = xmlReadFile(filename, NULL, XML_PARSE_RECOVER);
 	if (doc) {
+		/* process xinclude elements. */
+		if (xmlXIncludeProcess(doc) < 0) {
+			xmlFreeDoc(doc);
+			return NULL;
+		}
+	}
+
+	return (struct ast_xml_doc *) doc;
+}
+
+struct ast_xml_doc *ast_xml_read_memory(char *buffer, size_t size)
+{
+	xmlDoc *doc;
+
+	if (!buffer) {
+		return NULL;
+	}
+
+	if (!(doc = xmlReadMemory(buffer, (int) size, "asterisk.xml", NULL, XML_PARSE_RECOVER))) {
 		/* process xinclude elements. */
 		if (xmlXIncludeProcess(doc) < 0) {
 			xmlFreeDoc(doc);




More information about the asterisk-commits mailing list