1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19 #ifndef DATA_STRUCTURES_H
20 #define DATA_STRUCTURES_H
37 TYPE_COUNT
// This must be the last field
40 // Stage 1 to 2: These structures are passed from processing to matching modules
44 uint32_t saddr
, daddr
;
45 uint16_t source
, dest
;
50 ConnectionKey connectionKey
;
53 uint32_t seq
, ack_seq
;
55 uint8_t ack
, rst
, syn
, fin
;
60 enum Direction direction
;
61 SegmentKey
* segmentKey
;
67 uint32_t saddr
, daddr
;
68 uint16_t source
, dest
;
75 enum Direction direction
;
76 DatagramKey
* datagramKey
;
88 unsigned long traceNum
;
92 // specific event structures and functions could be in separate files and
93 // type could be an int
95 // event could be a void*, this union is to avoid having to cast
101 void (*copy
)(const struct _Event
* const event
, struct _Event
** const newEvent
);
102 void (*destroy
)(struct _Event
* const event
);
105 // Stage 2 to 3: These structures are passed from matching to analysis modules
106 typedef struct _Message
110 void (*print
)(const struct _Message
* const message
);
126 // One set of factors for each trace, this is the result of synchronization
129 double drift
, offset
;
133 // ConnectionKey-related functions
134 guint
ghfConnectionKeyHash(gconstpointer key
);
136 gboolean
gefConnectionKeyEqual(gconstpointer a
, gconstpointer b
);
137 bool connectionKeyEqual(const ConnectionKey
* const a
, const ConnectionKey
*
140 void gdnConnectionKeyDestroy(gpointer data
);
142 // SegmentKey-related functions
143 guint
ghfSegmentKeyHash(gconstpointer key
);
144 gboolean
gefSegmentKeyEqual(gconstpointer a
, gconstpointer b
);
146 // DatagramKey-related functions
147 guint
ghfDatagramKeyHash(gconstpointer key
);
148 gboolean
gefDatagramKeyEqual(gconstpointer a
, gconstpointer b
);
149 void gdnDestroyDatagramKey(gpointer data
);
151 // Event-related functions
152 void gdnDestroyEvent(gpointer data
);
153 void copyEvent(const Event
* const event
, Event
** const newEvent
);
154 void copyTCPEvent(const Event
* const event
, Event
** const newEvent
);
155 void copyUDPEvent(const Event
* const event
, Event
** const newEvent
);
156 void destroyEvent(Event
* const event
);
157 void destroyTCPEvent(Event
* const event
);
158 void destroyUDPEvent(Event
* const event
);
159 void gfDestroyEvent(gpointer data
, gpointer user_data
);
160 double wallTimeSub(const WallTime
const* tA
, const WallTime
const* tB
);
162 // Message-related functions
163 void printTCPSegment(const Message
* const segment
);
164 void convertIP(char* const str
, const uint32_t addr
);
166 gint
gcfTCPSegmentAckCompare(gconstpointer a
, gconstpointer b
);
167 bool isAcking(const Message
* const ackSegment
, const Message
* const ackedSegment
);
169 void gdnTCPSegmentListDestroy(gpointer data
);
170 void gfTCPSegmentDestroy(gpointer data
, gpointer user_data
);
171 void destroyTCPSegment(Message
* const segment
);
173 // Exchange-related functions
174 void destroyTCPExchange(Exchange
* const exchange
);
176 // Broadcast-related functions
177 void gdnDestroyBroadcast(gpointer data
);
178 void destroyBroadcast(Broadcast
* const broadcast
);