[asterisk-commits] mmichelson: branch group/CCSS r230044 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 13 14:17:23 CST 2009


Author: mmichelson
Date: Fri Nov 13 14:17:19 2009
New Revision: 230044

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=230044
Log:
Change some function names to more specifically refer to
an ESC as opposed to SIP PUBLISH in general.

Also fixed a problem with an int that was being used uninitialized.


Modified:
    team/group/CCSS/channels/chan_sip.c

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=230044&r1=230043&r2=230044
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Fri Nov 13 14:17:19 2009
@@ -1828,38 +1828,38 @@
 
 struct event_state_compositor;
 
-typedef int (* const publish_callback)(struct sip_pvt *, struct sip_request *, struct event_state_compositor *, struct sip_esc_entry *);
-
-struct sip_publish_callbacks {
-	const publish_callback initial_handler;
-	const publish_callback refresh_handler;
-	const publish_callback modify_handler;
-	const publish_callback remove_handler;
+typedef int (* const esc_publish_callback)(struct sip_pvt *, struct sip_request *, struct event_state_compositor *, struct sip_esc_entry *);
+
+struct sip_esc_publish_callbacks {
+	const esc_publish_callback initial_handler;
+	const esc_publish_callback refresh_handler;
+	const esc_publish_callback modify_handler;
+	const esc_publish_callback remove_handler;
 };
 
 /* These function are stubbed out for now since I'm focusing solely on PUBLISH support for now. When I go back and actually
  * implement the CC ESC, I'll fill these out with for-real logic :)
  */
-static int cc_publish_initial_handler(struct sip_pvt *pvt, struct sip_request *req, struct event_state_compositor *esc, struct sip_esc_entry *esc_entry)
+static int cc_esc_publish_initial_handler(struct sip_pvt *pvt, struct sip_request *req, struct event_state_compositor *esc, struct sip_esc_entry *esc_entry)
 {
 	/*XXX STUB */
 	return 0;
 }
-static int cc_publish_modify_handler(struct sip_pvt *pvt, struct sip_request *req, struct event_state_compositor *esc, struct sip_esc_entry *esc_entry)
+static int cc_esc_publish_modify_handler(struct sip_pvt *pvt, struct sip_request *req, struct event_state_compositor *esc, struct sip_esc_entry *esc_entry)
 {
 	/*XXX STUB */
 	return 0;
 }
-static int cc_publish_remove_handler(struct sip_pvt *pvt, struct sip_request *req, struct event_state_compositor *esc, struct sip_esc_entry *esc_entry)
+static int cc_esc_publish_remove_handler(struct sip_pvt *pvt, struct sip_request *req, struct event_state_compositor *esc, struct sip_esc_entry *esc_entry)
 {
 	/*XXX STUB */
 	return 0;
 }
 
-static const struct sip_publish_callbacks cc_publish_callbacks = {
-	.initial_handler = cc_publish_initial_handler,
-	.modify_handler = cc_publish_modify_handler,
-	.remove_handler = cc_publish_remove_handler,
+static const struct sip_esc_publish_callbacks cc_esc_publish_callbacks = {
+	.initial_handler = cc_esc_publish_initial_handler,
+	.modify_handler = cc_esc_publish_modify_handler,
+	.remove_handler = cc_esc_publish_remove_handler,
 };
 
 /*!
@@ -1877,10 +1877,10 @@
 static struct event_state_compositor {
 	enum subscriptiontype event;
 	const char * name;
-	const struct sip_publish_callbacks *callbacks;
+	const struct sip_esc_publish_callbacks *callbacks;
 	struct ao2_container *compositor;
 } event_state_compositors [] = {
-	{CALL_COMPLETION, "call-completion", &cc_publish_callbacks},
+	{CALL_COMPLETION, "call-completion", &cc_esc_publish_callbacks},
 };
 
 static const int ESC_MAX_BUCKETS = 37;
@@ -22601,23 +22601,24 @@
 	return 1;
 }
 
-static enum sip_publish_type determine_sip_publish_type(struct sip_request *req, const char * const event, const char * const etag, const char * const expires)
-{
-	int expires_int;
+static enum sip_publish_type determine_sip_publish_type(struct sip_request *req, const char * const event, const char * const etag, const char * const expires, int *expires_int)
+{
 	int etag_present = !ast_strlen_zero(etag);
 	int body_present = req->lines > 0;
+
+	ast_assert(expires_int != NULL);
 
 	if (ast_strlen_zero(expires)) {
 		/* Section 6, item 4, second bullet point of RFC 3903 says to
 		 * use a locally-configured default expiration if none is provided
 		 * in the request
 		 */
-		expires_int = DEFAULT_PUBLISH_EXPIRES;
-	} else if (sscanf(expires, "%30d", &expires_int) != 1) {
+		*expires_int = DEFAULT_PUBLISH_EXPIRES;
+	} else if (sscanf(expires, "%30d", expires_int) != 1) {
 		return SIP_PUBLISH_UNKNOWN;
 	}
 
-	if (expires_int == 0) {
+	if (*expires_int == 0) {
 		return SIP_PUBLISH_REMOVE;
 	} else if (!etag_present && body_present) {
 		return SIP_PUBLISH_INITIAL;
@@ -22769,7 +22770,7 @@
 		return 0;
 	}
 
-	publish_type = determine_sip_publish_type(req, event, etag, expires_str);
+	publish_type = determine_sip_publish_type(req, event, etag, expires_str, &expires_int);
 
 	/* It is the responsibility of these handlers to formulate any response
 	 * sent for a PUBLISH




More information about the asterisk-commits mailing list