network byte order + state multitraces fix
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 22 Feb 2006 21:12:29 +0000 (21:12 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 22 Feb 2006 21:12:29 +0000 (21:12 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1553 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/ChangeLog
ltt/branches/poly/configure.in
ltt/branches/poly/facilities/network.xml
ltt/branches/poly/ltt/event.c
ltt/branches/poly/ltt/facility.c
ltt/branches/poly/ltt/ltt-private.h
ltt/branches/poly/ltt/parser.c
ltt/branches/poly/ltt/parser.h
ltt/branches/poly/ltt/tracefile.c
ltt/branches/poly/lttv/lttv/state.c

index 4487761a9384d1035a7b05bcd3303c5fecf07dac..e65da2f3b11255ae9f50f6edc0a1dd92e7e8c80e 100644 (file)
@@ -1,5 +1,7 @@
 LinuxTraceToolkit ChangeLog
 
+15/02/2006     LTTV 0.8.21
+                                               Add support for data with network byte order.
 15/02/2006     LTTV 0.8.20
                                                Fix end of trace NULL pointer problem in debug output of
                                                lttvwindow.
index 9d0ca79328d8e4c51dc9ac3fdcede81af36bebdf..c226b39a11a07cbb43813a21c8e3959d62b6e0b6 100644 (file)
@@ -23,7 +23,7 @@
 AC_PREREQ(2.57)
 AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
 #AC_WITH_LTDL  # not needed ?
-AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.20-15022006)
+AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.21-22022006)
 AM_CONFIG_HEADER(config.h)
 AM_PROG_LIBTOOL
 
index 41a4ba913ae2f9620fc381382ae153154c05697b..a7dd7286629cc9a1ccf1b0668fd2c654f9af5fa2 100644 (file)
@@ -3,7 +3,8 @@
 
   <event name=packet_in>
     <description>A packet is arriving</description>
-    <field name="skbuff"> <description>Socket buffer pointer : identify the socket buffer</description> <pointer/> </field>
+    <field name="skbuff"> <description>Socket buffer pointer : identify the
+               socket buffer</description> <pointer/> </field>
     <field name="protocol"> <description>Protocol of the packet</description> <uint size=2/> </field>
   </event>
 
index 8011782a6be589617d8cd7f830163e296fe614a7..67c689b67ee9e6a4d77708e5ace2b9c9e7c3547e 100644 (file)
@@ -373,8 +373,13 @@ off_t ltt_event_field_offset(LttEvent *e, LttField *f)
  ****************************************************************************/
 guint32 ltt_event_get_unsigned(LttEvent *e, LttField *f)
 {
-  gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
-  
+  gboolean reverse_byte_order;
+       if(unlikely(f->field_type.network)) {
+               reverse_byte_order = (g_ntohs(0x1) != 0x1);
+       } else {
+       reverse_byte_order = LTT_GET_BO(e->tracefile);
+       }
+
   switch(f->field_size) {
   case 1:
     {
@@ -398,8 +403,13 @@ guint32 ltt_event_get_unsigned(LttEvent *e, LttField *f)
 
 gint32 ltt_event_get_int(LttEvent *e, LttField *f)
 {
-  gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
-  
+  gboolean reverse_byte_order;
+       if(unlikely(f->field_type.network)) {
+               reverse_byte_order = (g_ntohs(0x1) != 0x1);
+       } else {
+       reverse_byte_order = LTT_GET_BO(e->tracefile);
+       }
+
   switch(f->field_size) {
   case 1:
     {
@@ -423,7 +433,12 @@ gint32 ltt_event_get_int(LttEvent *e, LttField *f)
 
 guint64 ltt_event_get_long_unsigned(LttEvent *e, LttField *f)
 {
-  gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
+       gboolean reverse_byte_order;
+       if(unlikely(f->field_type.network)) {
+               reverse_byte_order = (g_ntohs(0x1) != 0x1);
+       } else {
+       reverse_byte_order = LTT_GET_BO(e->tracefile);
+       }
   
   switch(f->field_size) {
   case 1:
@@ -450,7 +465,12 @@ guint64 ltt_event_get_long_unsigned(LttEvent *e, LttField *f)
 
 gint64 ltt_event_get_long_int(LttEvent *e, LttField *f)
 {
-  gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
+       gboolean reverse_byte_order;
+       if(unlikely(f->field_type.network)) {
+               reverse_byte_order = (g_ntohs(0x1) != 0x1);
+       } else {
+       reverse_byte_order = LTT_GET_BO(e->tracefile);
+       }
   
   switch(f->field_size) {
   case 1:
@@ -477,8 +497,13 @@ gint64 ltt_event_get_long_int(LttEvent *e, LttField *f)
 
 float ltt_event_get_float(LttEvent *e, LttField *f)
 {
-  g_assert(LTT_HAS_FLOAT(e->tracefile));
-  gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
+       gboolean reverse_byte_order;
+       if(unlikely(f->field_type.network)) {
+               reverse_byte_order = (g_ntohs(0x1) != 0x1);
+       } else {
+         g_assert(LTT_HAS_FLOAT(e->tracefile));
+       reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
+       }
 
   g_assert(f->field_type.type_class == LTT_FLOAT && f->field_size == 4);
 
@@ -492,8 +517,13 @@ float ltt_event_get_float(LttEvent *e, LttField *f)
 
 double ltt_event_get_double(LttEvent *e, LttField *f)
 {
-  g_assert(LTT_HAS_FLOAT(e->tracefile));
-  gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
+       gboolean reverse_byte_order;
+       if(unlikely(f->field_type.network)) {
+               reverse_byte_order = (g_ntohs(0x1) != 0x1);
+       } else {
+         g_assert(LTT_HAS_FLOAT(e->tracefile));
+       reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
+       }
 
   if(f->field_size == 4)
     return ltt_event_get_float(e, f);
index e3ed40ee96661b0731f4a694a8cda8337c84a187..9a302d2a1c6c0bbe739c7e2ca40922cd288e67f6 100644 (file)
@@ -294,6 +294,7 @@ void construct_fields(LttFacility *fac,
   type->enum_map = NULL;
   type->fields = NULL;
   type->fields_by_name = NULL;
+       type->network = td->network;
 
   switch(td->type) {
     case INT_FIXED:
index 6d51afbb73a753936c5a9ec4fb76c62a35669e6a..c7c4deef3bcdc027a5542b5f30325d99939d1874 100644 (file)
@@ -226,6 +226,7 @@ struct _LttType{
   GHashTable *enum_map;                 //maps enum labels to numbers.
   GArray *fields;     // Array of LttFields, for array, sequence, union, struct.
   GData *fields_by_name;
+       guint   network;        // Is the type in network byte order ?
 };
 
 struct _LttEventType{
index 55d7c96cce9f945aa7becd4eea3a7a88b2afd8ac..2d8c9c4ae2f992d4f4252181caeb11747b140bd9 100644 (file)
@@ -183,6 +183,7 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
   t->fmt = NULL;
   t->size = 0;
   t->custom_write = 0;
+       t->network = 0;
   
   while(1) {
     token = getToken(in); 
@@ -205,7 +206,9 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
       t->size = getSize(in);
     } else if(!strcmp("custom_write", token)) {
       t->custom_write = 1;
-    }
+    } else if(!strcmp("network", token)) {
+                       t->network = 1;
+               }
   }
 }
 
@@ -327,7 +330,7 @@ void getFieldAttributes(parse_file_t *in, field_t *f)
       else if(car == '\"') f->name = allocAndCopy(getQuotedString(in));
       else f->name = allocAndCopy(getName(in));
     }
-  }
+       }
 }
 
 char *getNameAttribute(parse_file_t *in)
index 5a4c5b02cb1e41fd884be1de3de633508d9a45d6..c3a0c5eec7efcedd4f5174ad874270535f0f4224 100644 (file)
@@ -111,7 +111,8 @@ typedef struct _type_descriptor {
        sequence_t labels_description;
        int     already_printed;
   sequence_t fields; // for structure, array and sequence (field_t type)
-  int  custom_write;  /* Should we use a custom write function ? */
+  int custom_write;  /* Should we use a custom write function ? */
+       int network;    /* Is the type a in network byte order ? */
 } type_descriptor_t;
 
 
index c1001c25b157abf8d6a967c065b0a0b0fd6351cc..3fbf3b2e05b5d735ee06159cff33c0fc93f4df0e 100644 (file)
@@ -2658,6 +2658,10 @@ gint check_fields_compatibility(LttEventType *event_type1,
     different = 1;
     goto end;
   }
+       if(type1->network != type2->network) {
+               different = 1;
+               goto end;
+       }
  
   switch(type1->type_class) {
     case LTT_INT_FIXED:
index 3602c677f746c8330fe9a1df798eb6a26238fc7c..05a6aa53683536d5669dbbb6072b190271f80258 100644 (file)
@@ -1685,7 +1685,7 @@ void lttv_state_add_event_hooks(LttvTracesetState *self)
         }
       }
     }
-    lttv_attribute_find(self->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val);
+    lttv_attribute_find(ts->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val);
     *(val.v_pointer) = hooks;
   }
 }
@@ -1720,7 +1720,7 @@ void lttv_state_remove_event_hooks(LttvTracesetState *self)
   nb_trace = lttv_traceset_number(traceset);
   for(i = 0 ; i < nb_trace ; i++) {
     ts = LTTV_TRACE_STATE(self->parent.traces[i]);
-    lttv_attribute_find(self->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val);
+    lttv_attribute_find(ts->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val);
     hooks = *(val.v_pointer);
 
     /* Remove these hooks from each event_by_id hooks list */
This page took 0.028491 seconds and 4 git commands to generate.