[asterisk-commits] mmichelson: branch group/manager2 r113593 - in /team/group/manager2: include/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 8 19:08:20 CDT 2008


Author: mmichelson
Date: Tue Apr  8 19:08:19 2008
New Revision: 113593

URL: http://svn.digium.com/view/asterisk?view=rev&rev=113593
Log:
Everything compiles now!


Modified:
    team/group/manager2/include/asterisk/event.h
    team/group/manager2/main/event.c
    team/group/manager2/main/manager.c
    team/group/manager2/res/res_manager2.c

Modified: team/group/manager2/include/asterisk/event.h
URL: http://svn.digium.com/view/asterisk/team/group/manager2/include/asterisk/event.h?view=diff&rev=113593&r1=113592&r2=113593
==============================================================================
--- team/group/manager2/include/asterisk/event.h (original)
+++ team/group/manager2/include/asterisk/event.h Tue Apr  8 19:08:19 2008
@@ -64,6 +64,16 @@
 #include "asterisk/event_defs.h"
 
 /*!
+ * \brief accessor function to get an ast_event_type given the event's
+ * name
+ *
+ * \param event_name the string representation of the event type
+ *
+ * \return The ast_event_type which corresponds to event_name is returned
+ */
+enum ast_event_type ast_event_get_type_by_name(const char *event_name);
+
+/*!
  * \brief accessor function to get an ast_event_ie_type's payload type
  *
  * \param ie the ast_event_ie_type to be looked up

Modified: team/group/manager2/main/event.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/main/event.c?view=diff&rev=113593&r1=113592&r2=113593
==============================================================================
--- team/group/manager2/main/event.c (original)
+++ team/group/manager2/main/event.c Tue Apr  8 19:08:19 2008
@@ -141,7 +141,7 @@
 	{AST_EVENT_QUEUE_MEMBER_PAUSED, "QueueMemberPaused"},
 	{AST_EVENT_QUEUE_MEMBER_PENALTY, "QueueMemberPenalty"},
 	{AST_EVENT_TOTAL, "Total"},
-}
+};
 
 struct ast_event_ie_map {
 	enum ast_event_ie_type ie;
@@ -185,7 +185,7 @@
 	{AST_EVENT_IE_USERNAME, AST_EVENT_IE_PLTYPE_STR,	"Username"},                    /*!< AST_EVENT_IE_USERNAME 34 */
 };
 
-enum ast_event_type ast_event_get_event_by_name(const char *event_name)
+enum ast_event_type ast_event_get_type_by_name(const char *event_name)
 {
 	enum ast_event_type iterator;
 	int found = 0;

Modified: team/group/manager2/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/main/manager.c?view=diff&rev=113593&r1=113592&r2=113593
==============================================================================
--- team/group/manager2/main/manager.c (original)
+++ team/group/manager2/main/manager.c Tue Apr  8 19:08:19 2008
@@ -1595,7 +1595,6 @@
 
 static int action_login(struct mansession *s, const struct message *m)
 {
-	struct ast_event *event;
 	if (authenticate(s, m)) {
 		sleep(1);
 		astman_send_error(s, m, "Authentication failed");
@@ -1607,12 +1606,6 @@
 	ast_log(LOG_EVENT, "%sManager '%s' logged on from %s\n", (s->managerid ? "HTTP " : ""), s->username, ast_inet_ntoa(s->sin.sin_addr));
 	astman_send_ack(s, m, "Authentication accepted");
 
-	event = ast_event_new (AST_EVENT_MANAGER_LOGIN,
-			AST_EVENT_IE_FD, s->fd,
-			AST_EVENT_IE_USERNAME, s->username,
-			AST_EVENT_IE_END);
-
-	ast_event_queue(event);
 	return 0;
 }
 

Modified: team/group/manager2/res/res_manager2.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/res/res_manager2.c?view=diff&rev=113593&r1=113592&r2=113593
==============================================================================
--- team/group/manager2/res/res_manager2.c (original)
+++ team/group/manager2/res/res_manager2.c Tue Apr  8 19:08:19 2008
@@ -37,6 +37,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/tcptls.h"
+#include "asterisk/config.h"
 
 struct info_event {
 	AST_LIST_ENTRY(info_event) list;
@@ -67,7 +68,12 @@
 	ast_cond_t cond;
 	ast_mutex_t lock;
 	AST_LIST_HEAD_NOLOCK(, info_event) info_events;
-}
+};
+
+struct subscriber_filter {
+	enum ast_event_type events[800];     /* Totally arbitrary number for the time being */
+	int num_events;                      /* Number of events we're subscribed to. Used for iteration purposes */
+};
 
 /* Each of these represents an event subscriber defined
  * in the subscribers.conf file. These probably should be
@@ -78,11 +84,6 @@
 	char name[80];
 	struct subscriber_filter *filter;
 	AST_LIST_ENTRY(subscriber) list;
-};
-
-struct subscriber_filter {
-	enum ast_event_type[800]; /* Totally arbitrary number for the time being */
-	int num_events;           /* Number of events we're subscribed to. Used for iteration purposes */
 };
 
 AST_LIST_HEAD_STATIC(subscribers, subscriber);
@@ -183,7 +184,7 @@
  * dammit I feel like doing it this way in case more
  * thread setup enters into here later, you jerk
  */
-static void setup_thread(struct subscriber *sub)
+static void setup_thread(struct subscriber_instance *sub)
 {
 	sub->thread = AST_PTHREADT_NULL;
 	ast_mutex_init(&sub->lock);
@@ -203,7 +204,7 @@
 static void *subscribe_start(void *data)
 {
 	struct ast_tcptls_session_instance *ser = data;
-	struct subscriber *sub;
+	struct subscriber_instance *sub;
 
 	if (!(sub = ast_calloc(1, sizeof(*sub)))) {
 		/* OH CRAP */
@@ -211,18 +212,9 @@
 		return NULL;
 	}
 
-	/* For now, hard code "mark" as the name */
-	ast_copy_string(sub->name, "mark", sizeof(sub->name));
-	sub->filter = get_filter_info(sub->name);
 	sub->f = ser->f;
 
-	ast_debug(3, "Event subscriber %s logged in\n", sub->name);
-
 	setup_thread(sub);
-
-	AST_LIST_LOCK(&subscribers);
-	AST_LIST_INSERT_HEAD(&subscribers, sub, list);
-	AST_LIST_UNLOCK(&subscribers);
 
 	/* Just for testing purposes, let's subscribe to queue member device state changes */
 	ast_event_subscribe(AST_EVENT_QUEUE_MEMBER_STATUS, info_cb, sub, AST_EVENT_IE_END);
@@ -230,6 +222,7 @@
 	return NULL;
 }
 
+#if 0
 static struct subscriber *remove_subscriber(const char *name, const int fd)
 {
 	struct subscriber *sub = NULL;
@@ -254,7 +247,7 @@
  */
 static void  __attribute__ ((unused)) subscribe_end(const struct ast_event *event, void *ignore)
 {
-	struct subscriber *sub;
+	struct subscriber_instance *sub;
 	const char *name = ast_event_get_ie_str(event, AST_EVENT_IE_USERNAME);
 	int fd = ast_event_get_ie_uint(event, AST_EVENT_IE_FD);
 	
@@ -266,6 +259,8 @@
 		pthread_join(sub->thread, NULL);
 	}
 }
+
+#endif
 
 static void start_socket(void)
 {
@@ -363,8 +358,8 @@
 	}
 
 	while ((cat = ast_category_browse(cfg, cat))) {
-		struct subscriber sub = NULL;
-		if (!(sub = sub_init(cat))) {
+		struct subscriber *sub = NULL;
+		if (!(sub = sub_init(cfg, cat))) {
 			/* OH CRAP */
 			continue;
 		}
@@ -383,7 +378,7 @@
 
 static int load_module(void)
 {
-	setup_filters();
+	load_config();
 	start_socket();
 	return AST_MODULE_LOAD_SUCCESS;
 }




More information about the asterisk-commits mailing list