[asterisk-commits] russell: branch russell/events r103438 - in /team/russell/events: include/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 12 10:39:31 CST 2008


Author: russell
Date: Tue Feb 12 10:39:30 2008
New Revision: 103438

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103438
Log:
expose ast_eid_cmp()

Modified:
    team/russell/events/include/asterisk/dundi.h
    team/russell/events/include/asterisk/utils.h
    team/russell/events/main/event.c
    team/russell/events/main/netsock.c
    team/russell/events/pbx/dundi-parser.c
    team/russell/events/res/ais/evt.c

Modified: team/russell/events/include/asterisk/dundi.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/include/asterisk/dundi.h?view=diff&rev=103438&r1=103437&r2=103438
==============================================================================
--- team/russell/events/include/asterisk/dundi.h (original)
+++ team/russell/events/include/asterisk/dundi.h Tue Feb 12 10:39:30 2008
@@ -174,6 +174,7 @@
 
 #define DUNDI_COMMAND_STATUS		15		/*!< Status command */
 
+/*! A system event */
 #define DUNDI_COMMAND_EVENT			16
 
 /*
@@ -210,6 +211,9 @@
 
 #define DUNDI_IE_PEERSTATUS		30 	/*!< Peer/peer status (struct dundi_peer_status) */
 
+/*! All data in the frame after this IE is event data */
+#define DUNDI_IE_EVENTMARKER	31
+
 #define DUNDI_FLUFF_TIME		2000	/*!< Amount of time for answer */
 #define DUNDI_TTL_TIME			200	/*!< Incremental average time */
 

Modified: team/russell/events/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/include/asterisk/utils.h?view=diff&rev=103438&r1=103437&r2=103438
==============================================================================
--- team/russell/events/include/asterisk/utils.h (original)
+++ team/russell/events/include/asterisk/utils.h Tue Feb 12 10:39:30 2008
@@ -672,4 +672,6 @@
 
 int ast_str_to_eid(struct ast_eid *eid, const char *s);
 
+int ast_eid_cmp(struct ast_eid *eid1, struct ast_eid *eid2);
+
 #endif /* _ASTERISK_UTILS_H */

Modified: team/russell/events/main/event.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/event.c?view=diff&rev=103438&r1=103437&r2=103438
==============================================================================
--- team/russell/events/main/event.c (original)
+++ team/russell/events/main/event.c Tue Feb 12 10:39:30 2008
@@ -649,13 +649,10 @@
 	}
 
 	if (!ast_event_get_ie_raw(event, AST_EVENT_IE_EID)) {
-		char buf[32] = "";
 		/* If the event is originating on this server, add the server's
 		 * entity ID to the event. */
-		ast_eid_to_str(buf, sizeof(buf), &g_eid);
-		ast_event_append_ie_str(&event, AST_EVENT_IE_EID, buf);
-	}
-
+		ast_event_append_ie_raw(&event, AST_EVENT_IE_EID, &g_eid, sizeof(g_eid));
+	}
 
 	return event;
 }

Modified: team/russell/events/main/netsock.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/netsock.c?view=diff&rev=103438&r1=103437&r2=103438
==============================================================================
--- team/russell/events/main/netsock.c (original)
+++ team/russell/events/main/netsock.c Tue Feb 12 10:39:30 2008
@@ -286,4 +286,7 @@
 	return 0;
 }
 
-
+int ast_eid_cmp(struct ast_eid *eid1, struct ast_eid *eid2)
+{
+	return memcmp(eid1, eid2, sizeof(*eid1));
+}

Modified: team/russell/events/pbx/dundi-parser.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/pbx/dundi-parser.c?view=diff&rev=103438&r1=103437&r2=103438
==============================================================================
--- team/russell/events/pbx/dundi-parser.c (original)
+++ team/russell/events/pbx/dundi-parser.c Tue Feb 12 10:39:30 2008
@@ -69,11 +69,6 @@
 	for (x=0;x<sizeof(eid->eid) / sizeof(eid->eid[0]);x++)
 		if (eid->eid[x]) return 0;
 	return 1;
-}
-
-int dundi_eid_cmp(dundi_eid *eid1, dundi_eid *eid2)
-{
-	return memcmp(eid1, eid2, sizeof(dundi_eid));
 }
 
 static void dump_string(char *output, int maxlen, void *value, int len)
@@ -630,19 +625,23 @@
 	int len;
 	int ie;
 	char tmp[256];
+	int eventmarker = 0;
+
 	memset(ies, 0, (int)sizeof(struct dundi_ies));
+
 	ies->ttl = -1;
 	ies->expiration = -1;
 	ies->unknowncmd = -1;
 	ies->cause = -1;
-	while(datalen >= 2) {
+
+	while (datalen >= 2) {
 		ie = data[0];
 		len = data[1];
 		if (len > datalen - 2) {
 			errorf("Information element length exceeds message size\n");
 			return -1;
 		}
-		switch(ie) {
+		switch (ie) {
 		case DUNDI_IE_EID:
 		case DUNDI_IE_EID_DIRECT:
 			if (len != (int)sizeof(dundi_eid)) {
@@ -785,10 +784,18 @@
 		case DUNDI_IE_CACHEBYPASS:
 			ies->cbypass = 1;
 			break;
+		case DUNDI_IE_EVENTMARKER:
+			eventmarker = 1;
+			// ies->eventdata = (struct ast_event *) data + 2;
+			break;
 		default:
 			snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", dundi_ie2str(ie), ie, len);
 			outputf(tmp);
 		}
+		
+		if (eventmarker)
+			break;
+
 		/* Overwrite information element with 0, to null terminate previous portion */
 		data[0] = 0;
 		datalen -= (len + 2);

Modified: team/russell/events/res/ais/evt.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/res/ais/evt.c?view=diff&rev=103438&r1=103437&r2=103438
==============================================================================
--- team/russell/events/res/ais/evt.c (original)
+++ team/russell/events/res/ais/evt.c Tue Feb 12 10:39:30 2008
@@ -156,7 +156,7 @@
 		return;
 	}
 
-	if (!strcasecmp(g_eid_str, ast_event_get_ie_str(event, AST_EVENT_IE_EID))) {
+	if (!ast_eid_cmp(&g_eid, ast_event_get_ie_raw(event, AST_EVENT_IE_EID))) {
 		/* Don't feed events back in that originated locally. */
 		return;
 	}
@@ -198,7 +198,7 @@
 
 	ast_log(LOG_DEBUG, "Got an event to forward\n");
 
-	if (strcasecmp(g_eid_str, ast_event_get_ie_str(ast_event, AST_EVENT_IE_EID))) {
+	if (ast_eid_cmp(&g_eid, ast_event_get_ie_raw(ast_event, AST_EVENT_IE_EID))) {
 		/* If the event didn't originate from this server, don't send it back out. */
 		ast_log(LOG_DEBUG, "Returning here\n");
 		return;




More information about the asterisk-commits mailing list