[Initng-svn] r3703 - initng/trunk/plugins/nge

svn at initng.thinktux.net svn at initng.thinktux.net
Thu Apr 6 11:57:42 CEST 2006


Author: danne
Date: Thu Apr  6 11:57:41 2006
New Revision: 3703

Modified:
   initng/trunk/plugins/nge/initng_nge.c
   initng/trunk/plugins/nge/libngeclient.c
   initng/trunk/plugins/nge/libngeclient.h
   initng/trunk/plugins/nge/nge.c
Log:
I'm trying to make a new nge hook (initial_state_finished) that will be called after all initial_system_state and initial_service_state so that clients will know that the initial state is finished. Can't seem to get it to work though. Can someone please help me out?


Modified: initng/trunk/plugins/nge/initng_nge.c
==============================================================================
--- initng/trunk/plugins/nge/initng_nge.c	(original)
+++ initng/trunk/plugins/nge/initng_nge.c	Thu Apr  6 11:57:41 2006
@@ -262,6 +262,20 @@
 			string = NULL;
 		}
 	}
+	
+	/* tell client initialization is finished */
+	{
+		string = i_calloc(40, sizeof(char));
+		len = sprintf(string, "<event type=\"initial_state_finished\" />\n");
+
+		/* send the init string to this socket */
+		send(lisseners[lis], string, sizeof(char) * len, 0);
+
+		/* free the initial string */
+		free(string);
+		string = NULL;
+	}
+
 }
 
 

Modified: initng/trunk/plugins/nge/libngeclient.c
==============================================================================
--- initng/trunk/plugins/nge/libngeclient.c	(original)
+++ initng/trunk/plugins/nge/libngeclient.c	Thu Apr  6 11:57:41 2006
@@ -462,6 +462,17 @@
 
 }
 
+/* called on a <event type="initial_state_finished"  */
+static void ngeclient_handle_initial_state_finished(nge_event * event,
+						  char *tag, int chars)
+{
+	if (event->initial_state_finished)
+		(*event->initial_state_finished) (event);
+
+	/*printf("event-tag \"%s\", %i chars.\n", tag, chars); */
+
+}
+
 /* called on a <event type="service_output"  */
 static void ngeclient_handle_service_output(nge_event * event, char *tag,
 											int chars)
@@ -537,6 +548,10 @@
 	{
 		ngeclient_handle_initial_system_state(event, tag, chars);
 	}
+	else if (strcmp(type, "initial_state_finished") == 0)
+	{
+		ngeclient_handle_initial_state_finished(event, tag, chars);
+	}
 	else if (strcmp(type, "ping") == 0)
 	{
 		ngeclient_handle_ping(event, tag, chars);

Modified: initng/trunk/plugins/nge/libngeclient.h
==============================================================================
--- initng/trunk/plugins/nge/libngeclient.h	(original)
+++ initng/trunk/plugins/nge/libngeclient.h	Thu Apr  6 11:57:41 2006
@@ -40,6 +40,7 @@
 	void (*initial_service_state) (nge_event * event, char *service, e_is is,
 								   char *state_name);
 	void (*initial_system_state) (nge_event * event, h_sys_state state);
+	void (*initial_state_finished) (nge_event * event);
 
 	/* standard variables to have */
 	int sock;

Modified: initng/trunk/plugins/nge/nge.c
==============================================================================
--- initng/trunk/plugins/nge/nge.c	(original)
+++ initng/trunk/plugins/nge/nge.c	Thu Apr  6 11:57:41 2006
@@ -73,6 +73,11 @@
 	}
 }
 
+static void initial_state_finished(nge_event * e)
+{
+	fprintf(stdout, "Initial initng state finished.");
+}
+
 static void ping(nge_event * e)
 {
 	fprintf(stdout, "Got an ping from initng.");
@@ -129,6 +134,7 @@
 	e.system_state_change = &sys_state;
 	e.initial_service_state = &service_change;
 	e.initial_system_state = &sys_state;
+	e.initial_state_finished = &initial_state_finished;
 	e.service_output = &service_output;
 	e.err_msg = &err_msg;
 	e.ping = &ping;


More information about the Initng-svn mailing list