diff options
author | Laurent Ghigonis <laurent@p1sec.com> | 2012-07-22 04:47:51 +0200 |
---|---|---|
committer | Laurent Ghigonis <laurent@p1sec.com> | 2012-07-22 04:47:51 +0200 |
commit | 9ffa1183300efd25fff883a4a1f59c0509ff0601 (patch) | |
tree | 727a0647ef68c8df18f9a726fe5be6eaef6f8948 /glouglou_efl/glouglou_efl.c | |
parent | when going through a LIST and removing elements in the loop, you need to (diff) | |
download | glouglou-9ffa1183300efd25fff883a4a1f59c0509ff0601.tar.xz glouglou-9ffa1183300efd25fff883a4a1f59c0509ff0601.zip |
better printing of received data
Diffstat (limited to 'glouglou_efl/glouglou_efl.c')
-rw-r--r-- | glouglou_efl/glouglou_efl.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/glouglou_efl/glouglou_efl.c b/glouglou_efl/glouglou_efl.c index a7f0292..a56e7ee 100644 --- a/glouglou_efl/glouglou_efl.c +++ b/glouglou_efl/glouglou_efl.c @@ -5,16 +5,24 @@ static Eina_Bool _cb_conn_data(void *data, int type, Ecore_Con_Event_Server_Data *ev) { - char fmt[128]; + struct packet *p; + int i; - snprintf(fmt, sizeof(fmt), - "connection received %i bytes from server:\n" - "========\n" - "%%.%is\n" - "========\n", - ev->size, ev->size); + printf("connection receive:\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 ) + printf("\n"); + } - printf(fmt, ev->data); + p = ev->data; + switch(p->type) { + 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; + } return ECORE_CALLBACK_RENEW; } |