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

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


Author: mmichelson
Date: Fri Nov 13 14:40:08 2009
New Revision: 230110

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=230110
Log:
Write some code to create a sip_epa entry. Also fill
in hash and cmp functions for the CC EPA.


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=230110&r1=230109&r2=230110
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Fri Nov 13 14:40:08 2009
@@ -1660,18 +1660,6 @@
 	/*XXX STUB */
 };
 
-static int cc_epa_hash_fn(const void *obj, const int flags)
-{
-	/*XXX STUB */
-	return 0;
-}
-
-static int cc_epa_cmp_fn(void *obj, void *arg, int flags)
-{
-	/*XXX STUB*/
-	return 0;
-}
-
 struct cc_epa_entry {
 	/* The core ID of the CC transaction
      * for which this EPA entry belongs. This
@@ -1711,6 +1699,29 @@
 	void *event_specific_data;
 };
 
+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 int cc_epa_init(struct sip_epa_entry *epa_entry, struct sip_request *req)
+{
+	/* XXX STUB */
+	return 0;
+}
 
 static struct event_publication_agent {
 	enum subscriptiontype event;
@@ -1723,6 +1734,29 @@
 	{.event = CALL_COMPLETION, .name = "call-completion",
 	 .hash_fn = cc_epa_hash_fn, .cmp_fn = cc_epa_cmp_fn,},
 };
+
+static struct sip_epa_entry *create_epa_entry(struct event_publication_agent *epa, struct sip_request *req)
+{
+	struct sip_epa_entry *epa_entry;
+	int res;
+
+	if (!(epa_entry = ao2_alloc(sizeof(*epa_entry), NULL))) {
+		return NULL;
+	}
+
+	epa_entry->event = epa->name;
+
+	switch (epa->event) {
+	case CALL_COMPLETION:
+		res = cc_epa_init(epa_entry, req);
+		break;
+	default:
+		break;
+	}
+
+	ao2_link(epa->entries, epa_entry);
+	return epa_entry;
+}
 
 static int initialize_epas(void)
 {




More information about the asterisk-commits mailing list