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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 12 09:50:42 CST 2008


Author: russell
Date: Tue Feb 12 09:50:41 2008
New Revision: 103389

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103389
Log:
check in some progress so i can work from my laptop, instead

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

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=103389&r1=103388&r2=103389
==============================================================================
--- team/russell/events/include/asterisk/utils.h (original)
+++ team/russell/events/include/asterisk/utils.h Tue Feb 12 09:50:41 2008
@@ -661,6 +661,8 @@
 	unsigned char eid[6];
 } __attribute__ ((__packed__));
 
+extern struct ast_eid g_eid;
+
 /*!
  * \brief Fill in an ast_eid with the default eid of this machine
  */
@@ -668,4 +670,6 @@
 
 char *ast_eid_to_str(char *s, int maxlen, struct ast_eid *eid);
 
+int ast_str_to_eid(struct ast_eid *eid, const char *s);
+
 #endif /* _ASTERISK_UTILS_H */

Modified: team/russell/events/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/asterisk.c?view=diff&rev=103389&r1=103388&r2=103389
==============================================================================
--- team/russell/events/main/asterisk.c (original)
+++ team/russell/events/main/asterisk.c Tue Feb 12 09:50:41 2008
@@ -166,6 +166,8 @@
 
 /*! @} */
 
+struct ast_eid g_eid;
+
 /* XXX tmpdir is a subdir of the spool directory, and no way to remap it */
 char record_cache_dir[AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR;
 
@@ -382,6 +384,7 @@
 {
 	char buf[BUFSIZ];
 	struct ast_tm tm;
+	char eid_str[128];
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -392,6 +395,8 @@
 	case CLI_GENERATE:
 		return NULL;
 	}
+
+	ast_eid_to_str(eid_str, sizeof(eid_str), &g_eid);
 
 	ast_cli(a->fd, "\nPBX Core settings\n");
 	ast_cli(a->fd, "-----------------\n");
@@ -420,6 +425,7 @@
 	}
 	ast_cli(a->fd, "  System:                      %s/%s built by %s on %s %s\n", ast_build_os, ast_build_kernel, ast_build_user, ast_build_machine, ast_build_date);
 	ast_cli(a->fd, "  System name:                 %s\n", ast_config_AST_SYSTEM_NAME);
+	ast_cli(a->fd, "  Entity ID:                   %s\n", eid_str);
 	ast_cli(a->fd, "  Default language:            %s\n", defaultlanguage);
 	ast_cli(a->fd, "  Language prefix:             %s\n", ast_language_is_prefix ? "Enabled" : "Disabled");
 	ast_cli(a->fd, "  User name and group:         %s/%s\n", ast_config_AST_RUN_USER, ast_config_AST_RUN_GROUP);
@@ -2531,6 +2537,8 @@
 	ast_copy_string(cfg_paths.socket_path, DEFAULT_SOCKET, sizeof(cfg_paths.socket_path));
 	ast_copy_string(cfg_paths.run_dir, DEFAULT_RUN_DIR, sizeof(cfg_paths.run_dir));
 
+	ast_set_eid(&g_eid);
+
 	/* no asterisk.conf? no problem, use buildtime config! */
 	if (!cfg) {
 		return;
@@ -2696,6 +2704,13 @@
 				option_minmemfree = 0;
 			}
 #endif
+		} else if (!strcasecmp(v->name, "entityid")) {
+			struct ast_eid tmp_eid;
+			if (!ast_str_to_eid(&tmp_eid, v->value)) {
+				ast_verbose("Successfully set global EID to '%s'\n", v->value);
+				g_eid = tmp_eid;
+			} else
+				ast_verbose("Invalid Entity ID '%s' provided\n", v->value);
 		}
 	}
 	ast_config_destroy(cfg);

Modified: team/russell/events/main/event.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/event.c?view=diff&rev=103389&r1=103388&r2=103389
==============================================================================
--- team/russell/events/main/event.c (original)
+++ team/russell/events/main/event.c Tue Feb 12 09:50:41 2008
@@ -33,6 +33,7 @@
 #include "asterisk/lock.h"
 #include "asterisk/utils.h"
 #include "asterisk/unaligned.h"
+#include "asterisk/utils.h"
 
 /* Only use one thread for now to ensure ordered delivery */
 #define NUM_EVENT_THREADS 1
@@ -124,9 +125,6 @@
  * needs to know this state, it can get the last known state from the cache. */
 static AST_RWLIST_HEAD(ast_event_ref_list, ast_event_ref) ast_event_cache[AST_EVENT_TOTAL];
 
-/*! \brief The server EID */
-static struct ast_eid g_eid;
-
 size_t ast_event_get_size(const struct ast_event *event)
 {
 	size_t res;
@@ -942,8 +940,6 @@
 {
 	int i;
 
-	ast_set_eid(&g_eid);
-
 	for (i = 0; i < AST_EVENT_TOTAL; i++)
 		AST_RWLIST_HEAD_INIT(&ast_event_subs[i]);
 

Modified: team/russell/events/main/netsock.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/netsock.c?view=diff&rev=103389&r1=103388&r2=103389
==============================================================================
--- team/russell/events/main/netsock.c (original)
+++ team/russell/events/main/netsock.c Tue Feb 12 09:50:41 2008
@@ -215,7 +215,7 @@
 		if (s && (maxlen > 0))
 			*s = '\0';
 	} else {
-		for (x=0;x<5;x++) {
+		for (x = 0; x < 5; x++) {
 			sprintf(s, "%02x:", eid->eid[x]);
 			s += 3;
 		}
@@ -271,4 +271,19 @@
 		ast_log(LOG_ERROR, "No ethernet interface found for seeding default EID.  You will have to set it manually.\n");
 }
 
-
+int ast_str_to_eid(struct ast_eid *eid, const char *s)
+{
+	unsigned int eid_int[6];
+	int x;
+
+	if (sscanf(s, "%x:%x:%x:%x:%x:%x", &eid_int[0], &eid_int[1], &eid_int[2],
+		 &eid_int[3], &eid_int[4], &eid_int[5]) != 6)
+		 	return -1;
+	
+	for (x = 0; x < 6; x++)
+		eid->eid[x] = eid_int[x];
+
+	return 0;
+}
+
+

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=103389&r1=103388&r2=103389
==============================================================================
--- team/russell/events/pbx/dundi-parser.c (original)
+++ team/russell/events/pbx/dundi-parser.c Tue Feb 12 09:50:41 2008
@@ -49,18 +49,7 @@
 static void (*errorf)(const char *str) = internalerror;
 
 #define dundi_eid_to_str(a,b,c) ast_eid_to_str(a,b,c)
-
-int dundi_str_to_eid(dundi_eid *eid, const char *s)
-{
-	unsigned int eid_int[6];
-	int x;
-	if (sscanf(s, "%x:%x:%x:%x:%x:%x", &eid_int[0], &eid_int[1], &eid_int[2],
-		 &eid_int[3], &eid_int[4], &eid_int[5]) != 6)
-		 	return -1;
-	for (x=0;x<6;x++)
-		eid->eid[x] = eid_int[x];
-	return 0;
-}
+#define dundi_str_to_eid(a,b) ast_str_to_eid(a,b)
 
 int dundi_str_short_to_eid(dundi_eid *eid, const char *s)
 {

Modified: team/russell/events/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/pbx/pbx_dundi.c?view=diff&rev=103389&r1=103388&r2=103389
==============================================================================
--- team/russell/events/pbx/pbx_dundi.c (original)
+++ team/russell/events/pbx/pbx_dundi.c Tue Feb 12 09:50:41 2008
@@ -323,6 +323,7 @@
 static int dundi_xmit(struct dundi_packet *pack);
 
 #define dundi_eid_to_str(a,b,c) ast_eid_to_str(a,b,c)
+#define dundi_str_to_eid(a,b) ast_str_to_eid(a,b)
 
 static void dundi_debug_output(const char *data)
 {

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=103389&r1=103388&r2=103389
==============================================================================
--- team/russell/events/res/ais/evt.c (original)
+++ team/russell/events/res/ais/evt.c Tue Feb 12 09:50:41 2008
@@ -546,7 +546,6 @@
 {
 	SaAisErrorT ais_res;
 
-	ast_set_eid(&g_eid);
 	ast_eid_to_str(g_eid_str, sizeof(g_eid_str), &g_eid);
 
 	ais_res = saEvtInitialize(&evt_handle, &evt_callbacks, &ais_version);




More information about the asterisk-commits mailing list