[svn-commits] mmichelson: branch mmichelson/pubsub_bodies r406002 - in /team/mmichelson/pub...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 20 18:28:57 CST 2014


Author: mmichelson
Date: Mon Jan 20 18:28:53 2014
New Revision: 406002

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=406002
Log:
Improve documentation on presence XML methods.


Added:
    team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_presence_xml.h
      - copied, changed from r405986, team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_xml.h
Removed:
    team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_xml.h
Modified:
    team/mmichelson/pubsub_bodies/res/res_pjsip_pidf.c

Copied: team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_presence_xml.h (from r405986, team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_xml.h)
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_presence_xml.h?view=diff&rev=406002&p1=team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_xml.h&r1=405986&p2=team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_presence_xml.h&r2=406002
==============================================================================
--- team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_xml.h (original)
+++ team/mmichelson/pubsub_bodies/include/asterisk/res_pjsip_presence_xml.h Mon Jan 20 18:28:53 2014
@@ -16,20 +16,67 @@
  * at the top of the source tree.
  */
 
-enum state {
+/*!
+ * PIDF state
+ */
+enum ast_sip_pidf_state {
+	/*! Device is not in use */
 	NOTIFY_OPEN,
+	/*! Device is in use or ringing */
 	NOTIFY_INUSE,
+	/*! Device is unavailable, on hold, or busy */
 	NOTIFY_CLOSED
 };
 
+/*
+ * \brief Convert extension state to relevant PIDF strings
+ *
+ * \param state The extension state
+ * \param[out] statestring 
+ * \param[out] pidfstate
+ * \param[out] pidfnote
+ * \param[out] local_state
+ */
 void exten_state_to_str(int state, char **statestring, char **pidfstate,
-			       char **pidfnote, int *local_state);
+			       char **pidfnote, enum ast_sip_pidf_state *local_state);
 
-pj_xml_attr *create_attr(pj_pool_t *pool, pj_xml_node *node,
-				const char *name, const char *value);
+/*!
+ * \brief Create XML attribute
+ *
+ * \param pool Allocation pool
+ * \param node Node to add attribute to
+ * \param name The attribute name
+ * \param value The attribute value
+ *
+ * \return The created attribute
+ */
+pj_xml_attr *ast_pjsip_presence_xml_create_attr(pj_pool_t *pool,
+		pj_xml_node *node, const char *name, const char *value);
 
-pj_xml_node *create_node(pj_pool_t *pool, pj_xml_node *parent,
-				const char* name);
+/*!
+ * \brief Create XML node
+ *
+ * \param pool Allocation pool
+ * \param parent Node that will be parent to the created node
+ * \param name The name for the new node
+ * \return The created node
+ */
+pj_xml_node *ast_pjsip_presence_xml_create_node(pj_pool_t *pool,
+		pj_xml_node *parent, const char* name);
 
-pj_xml_attr *find_node_attr(pj_pool_t* pool, pj_xml_node *parent,
-				   const char *node_name, const char *attr_name);
+/*!
+ * \brief Find an attribute within a given node
+ *
+ * Given a starting node, this will find an attribute that belongs
+ * to a specific node. If the node does not exist, it will be created
+ * under the passed-in parent. If the attribute does not exist, then
+ * it will be created on the node with an empty string as its value.
+ *
+ * \param pool Allocation pool
+ * \param parent Starting node for search
+ * \param node_name Name of node where to find attribute
+ * \param attr_name Name of attribute to find
+ * \return The found attribute
+ */
+pj_xml_attr *ast_pjsip_presence_xml_find_node_attr(pj_pool_t* pool, 
+		pj_xml_node *parent, const char *node_name, const char *attr_name);

Modified: team/mmichelson/pubsub_bodies/res/res_pjsip_pidf.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pubsub_bodies/res/res_pjsip_pidf.c?view=diff&rev=406002&r1=406001&r2=406002
==============================================================================
--- team/mmichelson/pubsub_bodies/res/res_pjsip_pidf.c (original)
+++ team/mmichelson/pubsub_bodies/res/res_pjsip_pidf.c Mon Jan 20 18:28:53 2014
@@ -33,11 +33,11 @@
 #include "asterisk/module.h"
 #include "asterisk/res_pjsip.h"
 #include "asterisk/res_pjsip_pubsub.h"
-#include "asterisk/res_pjsip_xml.h"
+#include "asterisk/res_pjsip_presence_xml.h"
 #include "asterisk/res_pjsip_body_generator_types.h"
 
 void exten_state_to_str(int state, char **statestring, char **pidfstate,
-			       char **pidfnote, int *local_state)
+			       char **pidfnote, enum ast_sip_pidf_state *local_state)
 {
 	switch (state) {
 	case AST_EXTENSION_RINGING:
@@ -77,13 +77,12 @@
 		*local_state = NOTIFY_OPEN;
 		*pidfstate = "--";
 		*pidfnote ="Ready";
-
 		break;
 	}
 }
 
-pj_xml_attr *create_attr(pj_pool_t *pool, pj_xml_node *node,
-				const char *name, const char *value)
+pj_xml_attr *ast_pjsip_presence_xml_create_attr(pj_pool_t *pool,
+		pj_xml_node *node, const char *name, const char *value)
 {
 	pj_xml_attr *attr = PJ_POOL_ALLOC_T(pool, pj_xml_attr);
 
@@ -94,8 +93,8 @@
 	return attr;
 }
 
-pj_xml_node *create_node(pj_pool_t *pool, pj_xml_node *parent,
-				const char* name)
+pj_xml_node *ast_pjsip_presence_xml_create_node(pj_pool_t *pool,
+		pj_xml_node *parent, const char* name)
 {
 	pj_xml_node *node = PJ_POOL_ALLOC_T(pool, pj_xml_node);
 
@@ -111,19 +110,19 @@
 	return node;
 }
 
-pj_xml_attr *find_node_attr(pj_pool_t* pool, pj_xml_node *parent,
-				   const char *node_name, const char *attr_name)
+pj_xml_attr *ast_pjsip_presence_xml_find_node_attr(pj_pool_t* pool,
+		pj_xml_node *parent, const char *node_name, const char *attr_name)
 {
 	pj_str_t name;
 	pj_xml_node *node;
 	pj_xml_attr *attr;
 
 	if (!(node = pj_xml_find_node(parent, pj_cstr(&name, node_name)))) {
-		node = create_node(pool, parent, node_name);
+		node = ast_pjsip_presence_xml_create_node(pool, parent, node_name);
 	}
 
 	if (!(attr = pj_xml_find_attr(node, pj_cstr(&name, attr_name), NULL))) {
-		attr = create_attr(pool, node, attr_name, "");
+		attr = ast_pjsip_presence_xml_create_attr(pool, node, attr_name, "");
 	}
 
 	return attr;




More information about the svn-commits mailing list