Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : apps/efsd

Dir     : e17/apps/efsd/efsd


Modified Files:
        Makefile.am efsd.h efsd_main.c 


Log Message:
Added the start of the ecore_ipc stuff - use ./configure --enable-ecore to use 
the 
ecore_ipc main loop.  doesn't really do much now, unless you have some debug 
tools :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/Makefile.am,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- Makefile.am 2 Aug 2005 13:30:21 -0000       1.30
+++ Makefile.am 4 Aug 2005 05:30:22 -0000       1.31
@@ -7,7 +7,7 @@
 
 DEBUGFLAGS = -DDEBUG -DDEBUG_NEST -W -Wall
 
-INCLUDES = @edb_cflags@ @xml2_cflags@ $(DEBUGFLAGS)
+INCLUDES = @edb_cflags@ @xml2_cflags@ $(DEBUGFLAGS) @ecore_cflags@
 
 if USE_THREADS_FILES
 efsd_threadstuff = efsd_lock.c
@@ -44,7 +44,7 @@
        efsd_types.h efsd_types.c               \
        $(efsd_threadstuff)
 
-efsd_LDADD = @edb_libs@ @xml2_libs@
+efsd_LDADD = @edb_libs@ @xml2_libs@ @ecore_libs@
 
 lib_LTLIBRARIES = libefsd.la
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- efsd.h      26 Nov 2001 01:06:38 -0000      1.22
+++ efsd.h      4 Aug 2005 05:30:22 -0000       1.23
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 
 #define EFSD_CLIENTS      100
+#define IPC_TITLE "EFSD"
 
 /* Miscellaneous, needed below. */
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_main.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- efsd_main.c 3 Aug 2005 01:39:48 -0000       1.54
+++ efsd_main.c 4 Aug 2005 05:30:22 -0000       1.55
@@ -27,6 +27,11 @@
 # include <config.h>
 #endif
 
+#if HAVE_ECORE
+#include <Ecore.h>
+#include <Ecore_Ipc.h>
+#endif
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
@@ -125,6 +130,50 @@
 static void   main_check_options(int argc, char**argv);
 
 
+/* *********************************** */
+/* IPC Functions */
+
+int
+ipc_client_add(void *data, int type, void *event)
+{
+      Ecore_Ipc_Event_Client_Add *e;
+                                                                               
                                    
+      e = (Ecore_Ipc_Event_Client_Add *) event;
+      printf("ERR: EFSD Client Connected!!!\n");
+      return (1);
+}
+
+int
+ipc_client_del(void *data, int type, void *event)
+{
+   Ecore_Ipc_Event_Client_Del *e;
+                                                                               
                          
+   e = (Ecore_Ipc_Event_Client_Del *) event;
+    printf("ERR: Client Disconnected!!!\n");
+   return (1);
+}
+
+int
+ipc_client_data(void *data, int type, void *event)
+{
+   Ecore_Ipc_Event_Client_Data *e;
+                                                                               
                          
+   printf ("Got message!\n");
+   if ((e = (Ecore_Ipc_Event_Client_Data *) event))
+   {
+           printf ("Got message!\n");
+           ecore_ipc_client_send(e->client, 1, 6, e->ref, e->ref_to, 5, NULL, 
0);
+   }
+}
+                                                                               
                          
+                                                                               
                          
+
+
+
+
+/* *********************************** */
+
+
 static void   
 main_thread_launch(EfsdCommand *ecmd, int client)
 {
@@ -672,10 +721,15 @@
   struct timeval  tv;
   int             rebuild_fdset = FALSE;
 
+  #if HAVE_ECORE
+  Ecore_Ipc_Server *server = NULL;
+  #endif
+
   D_ENTER;
 
   ev_q = efsd_queue_new();
 
+
   for (i = 0; i < EFSD_CLIENTS; i++)
     clientfd[i] = -1;
     
@@ -722,6 +776,41 @@
 
   /* Handle connections: */
 
+  #if HAVE_ECORE
+  printf("ERR: Support using eCore/IPC!\n");
+
+  /*Init the ipc server*/
+  if (ecore_ipc_init() < 1)
+                return (1);
+
+
+  if ((server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, IPC_TITLE, 0, 
NULL))) {
+      ecore_ipc_server_del(server);
+      printf ("ERR: Server already running...\n");
+      return (1);
+   } else {
+      printf ("ERR: Server created..\n");
+
+      server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, IPC_TITLE, 0, NULL);
+
+      ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, ipc_client_add,
+                 NULL);
+
+      ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, ipc_client_del,
+                 NULL);
+
+       ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, ipc_client_data,
+                 NULL);
+
+
+   }
+
+  ecore_main_loop_begin();
+
+  
+  #else
+  
+ 
   for ( ; ; )
     {
       rebuild_fdset = FALSE;
@@ -890,6 +979,9 @@
        }
     }
 
+ #endif
+
+
   D_RETURN;
 }
 
@@ -1238,8 +1330,10 @@
 int 
 main(int argc, char **argv)
 {
+       
   D_ENTER;
 
+  
   main_check_permissions();
   main_check_options(argc, argv);
 




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to