aboutsummaryrefslogtreecommitdiffstats
path: root/glouglou_efl
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2012-07-22 05:48:07 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2012-07-22 05:48:07 +0200
commit1952c38d0fbf824e94b57a337e3571f105665423 (patch)
treea0b89115c0cac156f25355753219231e7a6a4086 /glouglou_efl
parentbetter printing of received data (diff)
downloadglouglou-1952c38d0fbf824e94b57a337e3571f105665423.tar.xz
glouglou-1952c38d0fbf824e94b57a337e3571f105665423.zip
quick hack to display new connections in window
Diffstat (limited to 'glouglou_efl')
-rw-r--r--glouglou_efl/glouglou_efl.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/glouglou_efl/glouglou_efl.c b/glouglou_efl/glouglou_efl.c
index a56e7ee..625ba5d 100644
--- a/glouglou_efl/glouglou_efl.c
+++ b/glouglou_efl/glouglou_efl.c
@@ -2,26 +2,56 @@
#include <libglouglou.h>
+Evas_Object *win, *connbox;
+
static Eina_Bool
_cb_conn_data(void *data, int type, Ecore_Con_Event_Server_Data *ev)
{
+ Evas_Object *btn;
struct packet *p;
+ char name[32];
int i;
- printf("connection receive:\n");
+ printf("data received:\n");
for (i=0; i < ev->size; i++){
printf("%2.2x ", ((u_char *)ev->data)[i]);
- if( (i%16 == 0 && i!=0) || i==ev->size-1 )
+ if( (i%15 == 0 && i!=0) || i==ev->size-1 )
printf("\n");
}
p = ev->data;
switch(p->type) {
+ case PACKET_NEWCONN:
+ printf(" type PACKET_NEWCONN\n");
+ printf(" newconn_id %d\n", p->newconn_id);
+ printf(" newconn_src %4x\n", ntohl(p->newconn_src));
+ printf(" newconn_dst %4x\n", ntohl(p->newconn_dst));
+ printf(" newconn_proto %d\n", p->newconn_proto);
+ printf(" newconn_size %d\n", ntohs(p->newconn_size));
+
+ btn = elm_button_add(win);
+ snprintf(name, sizeof(name), "%d: %x -> %x - %d",
+ p->newconn_id, ntohl(p->newconn_src), ntohl(p->newconn_dst), p->newconn_proto);
+ elm_object_text_set(btn, name);
+ elm_box_pack_end(connbox, btn);
+ evas_object_show(btn);
+
+ break;
+ case PACKET_DELCONN:
+ printf(" type PACKET_DELCONN\n");
+ printf(" delconn_id %d\n", p->delconn_id);
+ break;
case PACKET_DATA:
printf(" type PACKET_DATA\n");
printf(" data_connid %d\n", p->data_connid);
printf(" data_size %d\n", ntohs(p->data_size));
break;
+ case PACKET_NAME:
+ printf(" type PACKET_NAME\n");
+ printf(" name_addr %4x\n", ntohl(p->name_addr));
+ printf(" name_len %d\n", p->name_len);
+ printf(" name_name_fqdn %s\n", p->name_fqdn);
+ break;
}
return ECORE_CALLBACK_RENEW;
@@ -36,7 +66,7 @@ _cb_on_done(void *data, Evas_Object *obj, void *event_info)
EAPI_MAIN int
elm_main(int argc, char **argv)
{
- Evas_Object *win, *box, *lab, *btn, *bg;
+ Evas_Object *box, *lab, *btn, *bg;
Ecore_Con_Server *conn;
win = elm_win_util_standard_add("hello", "Hello");
@@ -58,11 +88,14 @@ elm_main(int argc, char **argv)
evas_object_show(lab);
btn = elm_button_add(win);
- elm_object_text_set(btn, "OK");
+ elm_object_text_set(btn, "Quit");
elm_box_pack_end(box, btn);
evas_object_show(btn);
evas_object_smart_callback_add(btn, "clicked", _cb_on_done, NULL);
+ connbox = elm_box_add(win);
+ evas_object_show(connbox);
+
evas_object_show(win);
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,