Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : apps/efsd
Dir : e17/apps/efsd/efsd
Modified Files:
efsd_commands.c efsd_event_queue.c efsd_event_queue.h
efsd_io.c efsd_io.h efsd_main.c libefsd.c
Log Message:
First work on the client side of the IPC stuff. Clients can now receive
file_type events
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_commands.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- efsd_commands.c 6 Aug 2005 12:28:23 -0000 1.16
+++ efsd_commands.c 6 Aug 2005 13:51:54 -0000 1.17
@@ -84,11 +84,14 @@
{
EfsdEvent ee;
+
int sockfd;
D_ENTER;
+ #ifndef HAVE_ECORE
sockfd = efsd_main_get_fd(client);
+ #endif
if (sockfd < 0)
D_RETURN_(-1);
@@ -104,6 +107,10 @@
*/
ee.efsd_reply_event.data = data;
+ #if HAVE_ECORE
+ printf("ERR: Writing event..\n");
+ efsd_io_write_event(client, &ee);
+ #else
if (efsd_io_write_event(sockfd, &ee) < 0)
{
if (errno == EPIPE)
@@ -113,6 +120,7 @@
D_RETURN_(-1);
}
+ #endif
D_RETURN_(0);
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_event_queue.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- efsd_event_queue.c 6 Dec 2001 23:06:04 -0000 1.4
+++ efsd_event_queue.c 6 Aug 2005 13:51:54 -0000 1.5
@@ -50,17 +50,34 @@
typedef struct efsd_event_q_item
{
- int client;
+ #if HAVE_ECORE
+ Ecore_Ipc_Client* client;
+ #else
+ int client;
+ #endif
EfsdEvent *ee;
}
EfsdEventQItem;
-static EfsdEventQItem *event_queue_item_new(int client, EfsdEvent *ee);
+#if HAVE_ECORE
+static EfsdEventQItem *
+event_queue_item_new(Ecore_Ipc_Client* client, EfsdEvent *ee);
+#else
+static EfsdEventQItem *
+event_queue_item_new(int client, EfsdEvent *ee);
+#endif
+
static void event_queue_item_free(EfsdEventQItem *eqi);
+#if HAVE_ECORE
+static EfsdEventQItem *
+event_queue_item_new(Ecore_Ipc_Client* client, EfsdEvent *ee)
+#else
static EfsdEventQItem *
event_queue_item_new(int client, EfsdEvent *ee)
+#endif
+
{
EfsdEventQItem *result;
@@ -138,9 +155,16 @@
for (eqi = efsd_queue_it_new(q); efsd_queue_it_valid(eqi);
efsd_queue_it_next(eqi))
{
qi = (EfsdEventQItem*) efsd_queue_it_item(eqi);
- fd = efsd_main_get_fd(qi->client);
+
+
+ #if HAVE_ECORE
+
+ /*ecore_ipc_client_send() */
+
+ #else
- if (fd < 0)
+ fd = efsd_main_get_fd(qi->client);
+ if (fd < 0)
{
efsd_queue_it_remove(eqi);
event_queue_item_free(qi);
@@ -175,6 +199,7 @@
efsd_queue_it_remove(eqi);
event_queue_item_free(qi);
}
+ #endif
}
efsd_queue_it_free(eqi);
@@ -183,8 +208,13 @@
}
+#if HAVE_ECORE
+efsd_event_queue_add_event(EfsdQueue *q, Ecore_Ipc_Client* client, EfsdEvent
*ee)
+#else
void
efsd_event_queue_add_event(EfsdQueue *q, int client, EfsdEvent *ee)
+#endif
+
{
EfsdEvent *ee_copy;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_event_queue.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- efsd_event_queue.h 6 Dec 2001 23:06:04 -0000 1.2
+++ efsd_event_queue.h 6 Aug 2005 13:51:54 -0000 1.3
@@ -45,6 +45,11 @@
/* Adds an event that is supposed to be delivered to SOCKFD,
making a copy of event EE.
*/
+
+#if HAVE_ECORE
+void efsd_event_queue_add_event(EfsdQueue *q, Ecore_Ipc_Client* client,
EfsdEvent *ee);
+#else
void efsd_event_queue_add_event(EfsdQueue *q, int client, EfsdEvent *ee);
+#endif
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_io.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- efsd_io.c 6 Aug 2005 12:28:23 -0000 1.43
+++ efsd_io.c 6 Aug 2005 13:51:54 -0000 1.44
@@ -962,9 +962,22 @@
}
+#if HAVE_ECORE
+int
+efsd_io_write_event(Ecore_Ipc_Client* sockfd, EfsdEvent *ee)
+#else
int
efsd_io_write_event(int sockfd, EfsdEvent *ee)
+#endif
{
+
+ #if HAVE_ECORE
+
+ printf("ERR: Sending event..\n");
+ ecore_ipc_client_send(sockfd, ee->type, 1, 0,0,0,
ee->efsd_reply_event.data,strlen(ee->efsd_reply_event.data)+1);
+
+
+ #else
EfsdIOV iov;
struct msghdr msg;
int n;
@@ -987,6 +1000,7 @@
D_RETURN_(-1);
D_RETURN_(0);
+ #endif
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_io.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- efsd_io.h 6 Aug 2005 08:43:22 -0000 1.5
+++ efsd_io.h 6 Aug 2005 13:51:54 -0000 1.6
@@ -35,7 +35,14 @@
int efsd_io_read_command(int sockfd, EfsdCommand *ecom);
-int efsd_io_write_event(int sockfd, EfsdEvent *ee);
+#if HAVE_ECORE
+int
+efsd_io_write_event(Ecore_Ipc_Client* sockfd, EfsdEvent *ee);
+#else
+int
+efsd_io_write_event(int sockfd, EfsdEvent *ee);
+#endif
+
int efsd_io_read_event(int sockfd, EfsdEvent *ee);
int efsd_io_write_option(int sockfd, EfsdOption *eo);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_main.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- efsd_main.c 6 Aug 2005 12:28:23 -0000 1.57
+++ efsd_main.c 6 Aug 2005 13:51:54 -0000 1.58
@@ -145,6 +145,8 @@
static void main_check_options(int argc, char**argv);
+static Ecore_Ipc_Client* cl;
+
/* *********************************** */
/* IPC Functions */
@@ -246,6 +248,9 @@
ec->efsd_file_cmd.num_options++;
} else if (e->minor == 100) {
+ /*ecore_ipc_client_send(e->client, 1, 1, 0,0,0, NULL,0);
+ cl = e->client;*/
+
/*Command finished.. process..*/
printf("Command finished..processing..\n");
@@ -290,7 +295,7 @@
container = NEW(EfsdCommandClientContainer);
container->ecmd = ecmd;
container->client = client;
- container->threaded = 1;
+ container->threaded = FALSE;
#if USE_THREADS
@@ -308,6 +313,7 @@
{
pthread_t thread;
+ /*ecore_ipc_client_send(container->client, 1, 1, 0,0,0, NULL,0);*/
if (pthread_create(&thread, NULL, main_handle_client_command, container)
!= 0)
{
printf("No threads\n");
@@ -317,6 +323,7 @@
main_handle_client_command(container);
}
+
}
else
{
@@ -365,8 +372,8 @@
{
EfsdCommandClientContainer *container = (EfsdCommandClientContainer *)data;
EfsdCommand *command;
-
- printf ("0.6: Filename is '%s'\n", container->ecmd->efsd_file_cmd.files[0]);
+
+
#if HAVE_ECORE
Ecore_Ipc_Client* client;
@@ -462,6 +469,8 @@
break;
case EFSD_CMD_GETFILETYPE:
D("Handling GETFILETYPE\n");
+
+
efsd_command_get_filetype(command, client);
break;
case EFSD_CMD_CLOSE:
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/libefsd.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- libefsd.c 6 Aug 2005 08:43:22 -0000 1.58
+++ libefsd.c 6 Aug 2005 13:51:54 -0000 1.59
@@ -102,6 +102,41 @@
static void libefsd_callbacks_init(void);
+
+/*Ecore Event callbacks*/
+#if HAVE_ECORE
+int
+ipc_server_data(void *data, int type, void *event)
+{
+ Ecore_Ipc_Event_Server_Data *e;
+
+ printf("Received event from server..\n");
+
+ if ((e = (Ecore_Ipc_Event_Server_Data *) event))
+ {
+
+ switch (e->major) {
+ case EFSD_EVENT_REPLY:
+ printf ("it's a reply!\n");
+
+
+ switch(e->minor) {
+ case 1:
+ printf ("It's a data section..\n");
+ printf ("Data is: %s\n", e->data);
+ }
+
+ break;
+ }
+
+
+ }
+
+
+}
+
+#endif
+
static char*
libefsd_get_full_path(char *file)
{
@@ -431,6 +466,9 @@
fprintf(stderr, "libefsd: Ecore_Ipc error. Cannot see daemon\n");
D_RETURN_(NULL);
}
+
+ /*Register the event callbacks*/
+ ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, ipc_server_data, NULL);
#else
if ( (ec->fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
-------------------------------------------------------
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