[asterisk-commits] mmichelson: branch mmichelson/pub_sub r384607 - in /team/mmichelson/pub_sub: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 2 17:37:50 CDT 2013


Author: mmichelson
Date: Tue Apr  2 17:37:47 2013
New Revision: 384607

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384607
Log:
Fill in the subscription structure a bit more.


Modified:
    team/mmichelson/pub_sub/include/asterisk/res_sip_pubsub.h
    team/mmichelson/pub_sub/res/res_sip_pubsub.c

Modified: team/mmichelson/pub_sub/include/asterisk/res_sip_pubsub.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/include/asterisk/res_sip_pubsub.h?view=diff&rev=384607&r1=384606&r2=384607
==============================================================================
--- team/mmichelson/pub_sub/include/asterisk/res_sip_pubsub.h (original)
+++ team/mmichelson/pub_sub/include/asterisk/res_sip_pubsub.h Tue Apr  2 17:37:47 2013
@@ -199,7 +199,7 @@
  * \retval NULL Failure
  * \retval non-NULL The subscription's serializer
  */
-struct ast_sip_serializer *ast_sip_subscription_get_serializer(struct ast_sip_subscription *sub);
+struct ast_taskprocessor *ast_sip_subscription_get_serializer(struct ast_sip_subscription *sub);
  
 /*!
  * \brief Get the underlying PJSIP evsub structure

Modified: team/mmichelson/pub_sub/res/res_sip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/res/res_sip_pubsub.c?view=diff&rev=384607&r1=384606&r2=384607
==============================================================================
--- team/mmichelson/pub_sub/res/res_sip_pubsub.c (original)
+++ team/mmichelson/pub_sub/res/res_sip_pubsub.c Tue Apr  2 17:37:47 2013
@@ -31,9 +31,14 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/datastore.h"
 #include "asterisk/uuid.h"
+#include "asterisk/taskprocessor.h"
+#include "asterisk/res_sip.h"
 
 struct ast_sip_subscription {
 	struct ao2_container *datastores;
+	struct ast_sip_endpoint *endpoint;
+	struct ast_taskprocessor *serializer;
+	pjsip_evsub *evsub;
 };
 
 #define DATASTORE_BUCKETS 53
@@ -64,6 +69,8 @@
 {
 	struct ast_sip_subscription *sub = obj;
 	ao2_cleanup(sub->datastores);
+	ao2_cleanup(sub->endpoint);
+	ast_taskprocessor_unreference(sub->serializer);
 }
 
 struct ast_sip_subscription *ast_sip_create_subscription(const struct ast_sip_subscription_handler *handler,
@@ -78,19 +85,27 @@
 		ao2_ref(sub, -1);
 		return NULL;
 	}
+	sub->serializer = ast_sip_create_serializer();
+	if (!sub->serializer) {
+		ao2_ref(sub, -1);
+		return NULL;
+	}
+	ao2_ref(endpoint, +1);
+	sub->endpoint = endpoint;
 	return sub;
 }
  
 struct ast_sip_endpoint *ast_sip_subscription_get_endpoint(struct ast_sip_subscription *sub)
 {
-	/* XXX STUB */
-	return NULL;
-}
- 
-struct ast_sip_serializer *ast_sip_subscription_get_serializer(struct ast_sip_subscription *sub)
-{
-	/* XXX STUB */
-	return NULL;
+	ast_assert(sub->endpoint != NULL);
+	ao2_ref(sub->endpoint, +1);
+	return sub->endpoint;
+}
+ 
+struct ast_taskprocessor *ast_sip_subscription_get_serializer(struct ast_sip_subscription *sub)
+{
+	ast_assert(sub->serializer != NULL);
+	return sub->serializer;
 }
 
 pjsip_evsub *ast_sip_subscription_get_evsub(struct ast_sip_subscription *sub)




More information about the asterisk-commits mailing list