[svn-commits] mmichelson: branch group/CCSS r230513 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Nov 19 15:34:50 CST 2009


Author: mmichelson
Date: Thu Nov 19 15:34:46 2009
New Revision: 230513

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=230513
Log:
Simplify the event_publication_agent a bit.

After thinking through the use-cases a bit, there's not a good reason
to maintain a container of EPA entries within an EPA.

When an application needs to transmit a SIP PUBLISH, it can maintain a
reference to the EPA entry that it has created. When a response to a
PUBLISH comes back, the sip_pvt will have a reference to the EPA entry.

In other words, whenever something needs to refer to an EPA entry, it will
or at least should have the reference handy. It's not like the ESC, which will
need to look up an entry based on information in an incoming request.


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=230513&r1=230512&r2=230513
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Thu Nov 19 15:34:46 2009
@@ -1705,37 +1705,16 @@
 	void (*handle_error)(struct sip_pvt *, const int resp, struct sip_request *, struct sip_epa_entry *);
 };
 
-static int cc_epa_hash_fn(const void *obj, const int flags)
-{
-	const struct sip_epa_entry *epa_entry = obj;
-	struct cc_epa_entry *cc_entry = epa_entry->event_specific_data;
-
-	return abs(cc_entry->core_id);
-}
-
-static int cc_epa_cmp_fn(void *obj, void *arg, int flags)
-{
-	struct sip_epa_entry *epa_entry1 = obj;
-	struct sip_epa_entry *epa_entry2 = arg;
-	struct cc_epa_entry *cc_entry1 = epa_entry1->event_specific_data;
-	struct cc_epa_entry *cc_entry2 = epa_entry2->event_specific_data;
-
-	return cc_entry1->core_id == cc_entry2->core_id ? CMP_MATCH | CMP_STOP : 0;
-}
-
 static struct event_publication_agent {
 	enum subscriptiontype event;
 	const char *name;
 	struct ao2_container *entries;
 	struct sip_epa_callbacks *callbacks;
-	ao2_hash_fn *hash_fn;
-	ao2_callback_fn *cmp_fn;
 } event_publication_agents [] = {
-	{.event = CALL_COMPLETION, .name = "call-completion",
-	 .hash_fn = cc_epa_hash_fn, .cmp_fn = cc_epa_cmp_fn,},
+	{.event = CALL_COMPLETION, .name = "call-completion",},
 };
 
-static struct sip_epa_entry *create_epa_entry(struct event_publication_agent *epa, struct sip_request *req)
+static struct sip_epa_entry *create_epa_entry(struct event_publication_agent *epa, struct sip_request *req, const char * const destination)
 {
 	struct sip_epa_entry *epa_entry;
 
@@ -1744,14 +1723,7 @@
 	}
 
 	epa_entry->event = epa->name;
-	
-	/* We don't do any event-package-specific setup here because the necessary input
-	 * will not be present. It's up to the caller of create_epa_entry to initialize whatever
-	 * event-specific data they need. Note that this differs from the ESC, which is able
-	 * to get whatever it needs based on the content of the incoming SIP request.
-	 */
-
-	ao2_link(epa->entries, epa_entry);
+	ast_copy_string(epa_entry->destination, destination, sizeof(epa_entry->destination));
 	return epa_entry;
 }
 
@@ -1763,19 +1735,6 @@
 		}
 	}
 	return NULL;
-}
-
-static int initialize_epas(void)
-{
-	int i, res = 0;
-	for (i = 0; i < ARRAY_LEN(event_publication_agents); i++) {
-		if (!((event_publication_agents[i].entries) = ao2_container_alloc(EPA_MAX_BUCKETS, 
-				event_publication_agents[i].hash_fn, 
-				event_publication_agents[i].cmp_fn))) {
-			res = -1;
-		}
-	}
-	return res;
 }
 
 /*!
@@ -27639,7 +27598,6 @@
 	sip_send_all_registers();
 	sip_send_all_mwi_subscriptions();
 	initialize_escs();
-	initialize_epas();
 
 	/* And start the monitor for the first time */
 	restart_monitor();




More information about the svn-commits mailing list