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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 2 16:11:54 CDT 2013


Author: mmichelson
Date: Tue Apr  2 16:11:51 2013
New Revision: 384598

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384598
Log:
And now the stubs compile :)


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=384598&r1=384597&r2=384598
==============================================================================
--- team/mmichelson/pub_sub/include/asterisk/res_sip_pubsub.h (original)
+++ team/mmichelson/pub_sub/include/asterisk/res_sip_pubsub.h Tue Apr  2 16:11:51 2013
@@ -18,6 +18,14 @@
 
 #ifndef _RES_SIP_PUBSUB_H
 #define _RES_SIP_PUBSUB_H
+
+/* Forward declarations */
+struct pjsip_rx_data;
+struct pjsip_tx_data;
+struct pjsip_evsub;
+struct ast_sip_endpoint;
+struct ast_datastore;
+struct ast_datastore_info;
 
 /*!
  * \brief Opaque structure representing an RFC 3265 SIP subscription
@@ -33,7 +41,131 @@
     /* Sending NOTIFYs, receiving SUBSCRIBEs */
     AST_SIP_NOTIFIER,
 };
- 
+
+#define AST_SIP_MAX_ACCEPT 10
+
+struct ast_sip_subscription_handler {
+    /*! The name of the event this handler deals with */
+    const char *event_name;
+    /*! The types of body this handler accepts */
+    const char *accept[AST_SIP_MAX_ACCEPT];
+ 
+    /*!
+     * \brief Called when a subscription is to be destroyed
+     *
+     * This is a subscriber and notifier callback.
+     *
+     * The handler is not expected to send any sort of requests or responses
+     * during this callback. This callback is useful for performing any
+     * necessary cleanup
+     */
+    void (*subscription_shutdown)(struct ast_sip_subscription *subscription);
+ 
+    /*!
+     * \brief Called when a SUBSCRIBE arrives in order to create a new subscription
+     *
+     * This is a notifier callback.
+     *
+     * If the notifier wishes to accept the subscription, then it can create
+     * a new ast_sip_subscription to do so. 
+     *
+     * If the notifier chooses to create a new subscription, then it must accept
+     * the incoming subscription using pjsip_evsub_accept() and it must also
+     * send an initial NOTIFY with the current subscription state.
+     *
+     * \param endpoint The endpoint from which we received the SUBSCRIBE
+     * \param rdata The SUBSCRIBE request
+     * \retval NULL The SUBSCRIBE has not been accepted
+     * \retval non-NULL The newly-created subscription
+     */
+    struct ast_sip_subscription *(*new_subscribe)(struct ast_sip_endpoint *endpoint,
+            pjsip_rx_data *rdata);
+ 
+    /*!
+     * \brief Called when an endpoint renews a subscription.
+     *
+     * This is a notifier callback.
+     *
+     * Because of the way that the PJSIP evsub framework works, it will automatically
+     * send a response to the SUBSCRIBE.
+     *
+     * \param sub The subscription that is being renewed
+     * \param rdata The SUBSCRIBE request in question
+     * \retval NULL Allow the default 200 OK response to be sent
+     * \retval non-NULL Send a response with the specified data present
+     */
+    struct ast_sip_subscription_response_data *(*resubscribe)(struct ast_sip_subscription *sub,
+            pjsip_rx_data *rdata);
+ 
+    /*!
+     * \brief Called when a subscription times out.
+     *
+     * This is a notifier callback
+     *
+     * This indicates that the subscription has timed out. The subscription handler is
+     * expected to send a NOTIFY that terminates the subscription.
+     *
+     * \param sub The subscription that has timed out
+     */
+    void (*subscription_timeout)(struct ast_sip_subscription *sub);
+ 
+    /*!
+     * \brief Called when a subscription is terminated via a SUBSCRIBE request
+     *
+     * This is a notifier callback.
+     *
+     * The PJSIP subscription framework will automatically send the response to the
+     * SUBSCRIBE. The subscription handler is expected to send a final NOTIFY to
+     * terminate the subscription.
+     *
+     * \param sub The subscription being terminated
+     * \param rdata The SUBSCRIBE request that terminated the subscription
+     */
+    void (*subscription_terminated)(struct ast_sip_subscription *sub, pjsip_rx_data *rdata);
+ 
+    /*!
+     * \brief Called when a subscription handler's outbound NOTIFY receives a response
+     *
+     * This is a notifier callback.
+     *
+     * \param sub The subscription
+     * \param rdata The NOTIFY response
+     */
+    void (*notify_response)(struct ast_sip_subscription *sub, pjsip_rx_data *rdata);
+ 
+    /*!
+     * \brief Called when a subscription handler receives an inbound NOTIFY
+     *
+     * This is a subscriber callback.
+     *
+     * Because of the way that the PJSIP evsub framework works, it will automatically
+     * send a response to the NOTIFY. By default this will be a 200 OK response, but
+     * this callback can change details of the response by returning response data
+     * to use.
+     *
+     * \param sub The subscription
+     * \param rdata The NOTIFY request
+     * \retval NULL Have the framework send the default 200 OK response
+     * \retval non-NULL Send a response with the specified data
+     */
+    struct ast_sip_subscription_response_data *(*notify_request)(struct ast_sip_subscription *sub,
+            pjsip_rx_data *rdata);
+ 
+    /*!
+     * \brief Called when it is time for a subscriber to resubscribe
+     *
+     * This is a subscriber callback.
+     *
+     * The subscriber can reresh the subscription using the pjsip_evsub_initiate()
+     * function.
+     *
+     * \param sub The subscription to refresh
+     * \retval 0 Success
+     * \retval non-zero Failure
+     */
+    int (*refresh_subscription)(struct ast_sip_subscription *sub);
+};
+
 /*!
  * \brief Create a new ast_sip_subscription structure
  *
@@ -171,127 +303,6 @@
     struct ast_sip_body *body;
 };
  
-struct ast_sip_subscription_handler {
-    /*! The name of the event this handler deals with */
-    const char *event_name;
-    /*! The types of body this handler accepts */
-    const char *accept[];
- 
-    /*!
-     * \brief Called when a subscription is to be destroyed
-     *
-     * This is a subscriber and notifier callback.
-     *
-     * The handler is not expected to send any sort of requests or responses
-     * during this callback. This callback is useful for performing any
-     * necessary cleanup
-     */
-    void (*subscription_shutdown)(struct ast_sip_subscription *subscription);
- 
-    /*!
-     * \brief Called when a SUBSCRIBE arrives in order to create a new subscription
-     *
-     * This is a notifier callback.
-     *
-     * If the notifier wishes to accept the subscription, then it can create
-     * a new ast_sip_subscription to do so. 
-     *
-     * If the notifier chooses to create a new subscription, then it must accept
-     * the incoming subscription using pjsip_evsub_accept() and it must also
-     * send an initial NOTIFY with the current subscription state.
-     *
-     * \param endpoint The endpoint from which we received the SUBSCRIBE
-     * \param rdata The SUBSCRIBE request
-     * \retval NULL The SUBSCRIBE has not been accepted
-     * \retval non-NULL The newly-created subscription
-     */
-    struct ast_sip_subscription *(*new_subscribe)(struct ast_sip_endpoint *endpoint,
-            pjsip_rx_data *rdata);
- 
-    /*!
-     * \brief Called when an endpoint renews a subscription.
-     *
-     * This is a notifier callback.
-     *
-     * Because of the way that the PJSIP evsub framework works, it will automatically
-     * send a response to the SUBSCRIBE.
-     *
-     * \param sub The subscription that is being renewed
-     * \param rdata The SUBSCRIBE request in question
-     * \retval NULL Allow the default 200 OK response to be sent
-     * \retval non-NULL Send a response with the specified data present
-     */
-    struct ast_sip_subscription_response_data *(*resubscribe)(struct ast_sip_subscription *sub,
-            pjsip_rx_data *rdata);
- 
-    /*!
-     * \brief Called when a subscription times out.
-     *
-     * This is a notifier callback
-     *
-     * This indicates that the subscription has timed out. The subscription handler is
-     * expected to send a NOTIFY that terminates the subscription.
-     *
-     * \param sub The subscription that has timed out
-     */
-    void (*subscription_timeout)(struct ast_sip_subscription *sub);
- 
-    /*!
-     * \brief Called when a subscription is terminated via a SUBSCRIBE request
-     *
-     * This is a notifier callback.
-     *
-     * The PJSIP subscription framework will automatically send the response to the
-     * SUBSCRIBE. The subscription handler is expected to send a final NOTIFY to
-     * terminate the subscription.
-     *
-     * \param sub The subscription being terminated
-     * \param rdata The SUBSCRIBE request that terminated the subscription
-     */
-    void (*subscription_terminated)(struct ast_sip_subscription *sub, pjsip_rx_data *rdata);
- 
-    /*!
-     * \brief Called when a subscription handler's outbound NOTIFY receives a response
-     *
-     * This is a notifier callback.
-     *
-     * \param sub The subscription
-     * \param rdata The NOTIFY response
-     */
-    void (*notify_response)(struct ast_sip_subscription *sub, pjsip_rx_data *rdata);
- 
-    /*!
-     * \brief Called when a subscription handler receives an inbound NOTIFY
-     *
-     * This is a subscriber callback.
-     *
-     * Because of the way that the PJSIP evsub framework works, it will automatically
-     * send a response to the NOTIFY. By default this will be a 200 OK response, but
-     * this callback can change details of the response by returning response data
-     * to use.
-     *
-     * \param sub The subscription
-     * \param rdata The NOTIFY request
-     * \retval NULL Have the framework send the default 200 OK response
-     * \retval non-NULL Send a response with the specified data
-     */
-    struct ast_sip_subscription_response_data *(*notify_request)(struct ast_sip_subscription *sub,
-            pjsip_rx_data *rdata);
- 
-    /*!
-     * \brief Called when it is time for a subscriber to resubscribe
-     *
-     * This is a subscriber callback.
-     *
-     * The subscriber can reresh the subscription using the pjsip_evsub_initiate()
-     * function.
-     *
-     * \param sub The subscription to refresh
-     * \retval 0 Success
-     * \retval non-zero Failure
-     */
-    int (*refresh_subscription)(struct ast_sip_subscription *sub);
-};
  
 /*!
  * \brief Register a subscription handler

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=384598&r1=384597&r2=384598
==============================================================================
--- team/mmichelson/pub_sub/res/res_sip_pubsub.c (original)
+++ team/mmichelson/pub_sub/res/res_sip_pubsub.c Tue Apr  2 16:11:51 2013
@@ -1,7 +1,32 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2013, Digium, Inc.
+ *
+ * Mark Michelson <mmichelson at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
 /*!
  * \brief Opaque structure representing an RFC 3265 SIP subscription
  */
-struct ast_sip_subscription;
+
+#include "asterisk.h"
+
+#include <pjsip.h>
+#include <pjsip_ua.h>
+#include <pjlib.h>
+
+#include "asterisk/res_sip_pubsub.h"
+#include "asterisk/module.h"
  
 struct ast_sip_subscription *ast_sip_create_subscription(const struct ast_sip_subscription_handler *handler,
         enum ast_sip_subscription_role role, struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata)




More information about the asterisk-commits mailing list