Change synchronization code license to LGPLv2.1
[lttv.git] / lttv / lttv / sync / event_processing_lttng_null.c
1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2009, 2010 Benjamin Poirier <benjamin.poirier@polymtl.ca>
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 2.1 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12 * License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifdef HAVE_CONFIG_H
19 #include <config.h>
20 #endif
21
22 #include <stdarg.h>
23 #include <stdlib.h>
24
25 #include "sync_chain.h"
26 #include "event_processing_lttng_common.h"
27
28 #include "event_processing_lttng_null.h"
29
30
31 // Functions common to all processing modules
32 static void initProcessingLTTVNull(SyncState* const syncState, ...);
33 static void destroyProcessingLTTVNull(SyncState* const syncState);
34
35 static void finalizeProcessingLTTVNull(SyncState* const syncState);
36
37 // Functions specific to this module
38 static gboolean processEventLTTVNull(void* hookData, void* callData);
39
40
41 static ProcessingModule processingModuleLTTVNull = {
42 .name= "LTTV-null",
43 .initProcessing= &initProcessingLTTVNull,
44 .destroyProcessing= &destroyProcessingLTTVNull,
45 .finalizeProcessing= &finalizeProcessingLTTVNull,
46 };
47
48
49
50 /*
51 * Processing Module registering function
52 */
53 void registerProcessingLTTVNull()
54 {
55 g_queue_push_tail(&processingModules, &processingModuleLTTVNull);
56
57 createQuarks();
58 }
59
60
61 /*
62 * Allocate and initialize data structures for synchronizing a traceset.
63 * Register event hooks.
64 *
65 * Args:
66 * syncState: container for synchronization data.
67 * This function allocates these processingData members:
68 * hookListList
69 * traceSetContext: LttvTracesetContext*, set of LTTV traces
70 */
71 static void initProcessingLTTVNull(SyncState* const syncState, ...)
72 {
73 ProcessingDataLTTVNull* processingData;
74 va_list ap;
75
76 processingData= malloc(sizeof(ProcessingDataLTTVNull));
77 syncState->processingData= processingData;
78 va_start(ap, syncState);
79 processingData->traceSetContext= va_arg(ap, LttvTracesetContext*);
80 va_end(ap);
81 syncState->traceNb=
82 lttv_traceset_number(processingData->traceSetContext->ts);
83 processingData->hookListList= g_array_sized_new(FALSE, FALSE,
84 sizeof(GArray*), syncState->traceNb);
85
86 registerHooks(processingData->hookListList,
87 processingData->traceSetContext, &processEventLTTVNull, syncState,
88 syncState->matchingModule->canMatch);
89 }
90
91
92 /*
93 * Nothing to do
94 *
95 * Args:
96 * syncState container for synchronization data.
97 */
98 static void finalizeProcessingLTTVNull(SyncState* const syncState)
99 {
100 return;
101 }
102
103
104 /*
105 * Unregister event hooks. Deallocate processingData.
106 *
107 * Args:
108 * syncState: container for synchronization data.
109 * This function deallocates these members:
110 * hookListList
111 */
112 static void destroyProcessingLTTVNull(SyncState* const syncState)
113 {
114 ProcessingDataLTTVNull* processingData;
115
116 processingData= (ProcessingDataLTTVNull*) syncState->processingData;
117
118 if (processingData == NULL)
119 {
120 return;
121 }
122
123 unregisterHooks(processingData->hookListList,
124 processingData->traceSetContext);
125
126 free(syncState->processingData);
127 syncState->processingData= NULL;
128 }
129
130
131 /*
132 * Lttv hook function that will be called for network events
133 *
134 * Args:
135 * hookData: LttvTraceHook* for the type of event that generated the call
136 * callData: LttvTracefileContext* at the moment of the event
137 *
138 * Returns:
139 * FALSE Always returns FALSE, meaning to keep processing hooks for
140 * this event
141 */
142 static gboolean processEventLTTVNull(void* hookData, void* callData)
143 {
144 return FALSE;
145 }
This page took 0.032766 seconds and 4 git commands to generate.