Change synchronization code license to LGPLv2.1
[lttv.git] / lttv / lttv / sync / event_processing_lttng_standard.c
index 76a754b82e2a9650109d86944a2220b67dde2cdf..99086fe5e68a7ec5b6f72e468750862574d821d2 100644 (file)
@@ -1,19 +1,18 @@
 /* This file is part of the Linux Trace Toolkit viewer
- * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca>
+ * Copyright (C) 2009, 2010 Benjamin Poirier <benjamin.poirier@polymtl.ca>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License Version 2 as
- * published by the Free Software Foundation;
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at
+ * your option) any later version.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #define _ISOC99_SOURCE
@@ -22,7 +21,6 @@
 #include <config.h>
 #endif
 
-#include <linux/if_ether.h>
 #include <math.h>
 #include <netinet/in.h>
 #include <stdarg.h>
 
 #include "event_processing_lttng_standard.h"
 
+/* IPv4 Ethertype, taken from <linux/if_ether.h>, unlikely to change as it's
+ * defined by IANA: http://www.iana.org/assignments/ethernet-numbers
+ */
+#define ETH_P_IP    0x0800
+
 
 // Functions common to all processing modules
 static void initProcessingLTTVStandard(SyncState* const syncState, ...);
@@ -50,7 +53,6 @@ static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState* const
        syncState, const unsigned int i, const unsigned int j);
 
 // Functions specific to this module
-static void registerProcessingLTTVStandard() __attribute__((constructor (102)));
 static gboolean processEventLTTVStandard(void* hookData, void* callData);
 static void partialDestroyProcessingLTTVStandard(SyncState* const syncState);
 
@@ -72,7 +74,7 @@ static ProcessingModule processingModuleLTTVStandard = {
 /*
  * Processing Module registering function
  */
-static void registerProcessingLTTVStandard()
+void registerProcessingLTTVStandard()
 {
        g_queue_push_tail(&processingModules, &processingModuleLTTVStandard);
 
@@ -113,7 +115,8 @@ static void initProcessingLTTVStandard(SyncState* const syncState, ...)
        for(i= 0; i < syncState->traceNb; i++)
        {
                g_hash_table_insert(processingData->traceNumTable,
-                       processingData->traceSetContext->traces[i]->t, (gpointer) i);
+                       processingData->traceSetContext->traces[i]->t,
+                       GUINT_TO_POINTER(i));
        }
 
        processingData->pendingRecv= malloc(sizeof(GHashTable*) *
@@ -384,6 +387,7 @@ static gboolean processEventLTTVStandard(void* hookData, void* callData)
        struct marker_info* info;
        SyncState* syncState;
        ProcessingDataLTTVStandard* processingData;
+       gpointer traceNumP;
 
        traceHook= (LttvTraceHook*) hookData;
        tfc= (LttvTracefileContext*) callData;
@@ -398,7 +402,8 @@ static gboolean processEventLTTVStandard(void* hookData, void* callData)
        wTime.nanosec= time.tv_nsec;
 
        g_assert(g_hash_table_lookup_extended(processingData->traceNumTable,
-                       trace, NULL, (gpointer*) &traceNum));
+                       trace, NULL, &traceNumP));
+       traceNum= GPOINTER_TO_INT(traceNumP);
 
        g_debug("Process event: time: %ld.%09ld trace: %ld (%p) name: %s ",
                time.tv_sec, time.tv_nsec, traceNum, trace,
This page took 0.030491 seconds and 4 git commands to generate.