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
28 // Stage 1 to 2: These structures are passed from processing to matching modules
32 uint32_t saddr
, daddr
;
33 uint16_t source
, dest
;
38 ConnectionKey connectionKey
;
41 uint32_t seq
, ack_seq
;
43 uint8_t ack
, rst
, syn
, fin
;
61 enum Direction direction
;
62 SegmentKey
* segmentKey
;
68 uint32_t saddr
, daddr
;
69 uint16_t source
, dest
;
76 enum Direction direction
;
77 DatagramKey
* datagramKey
;
83 unsigned long traceNum
;
86 // specific event structures and functions could be in separate files and
87 // type could be an int
89 // event could be a void*, this union is to avoid having to cast
95 void (*destroy
)(struct _Event
* const event
);
98 // Stage 2 to 3: These structures are passed from matching to analysis modules
99 typedef struct _Message
103 void (*print
)(const struct _Message
* const message
);
117 // One set of factors for each trace, this is the result of synchronization
120 double drift
, offset
;
124 // ConnectionKey-related functions
125 guint
ghfConnectionKeyHash(gconstpointer key
);
127 gboolean
gefConnectionKeyEqual(gconstpointer a
, gconstpointer b
);
128 bool connectionKeyEqual(const ConnectionKey
* const a
, const ConnectionKey
*
131 void gdnConnectionKeyDestroy(gpointer data
);
133 // SegmentKey-related functions
134 guint
ghfSegmentKeyHash(gconstpointer key
);
135 gboolean
gefSegmentKeyEqual(gconstpointer a
, gconstpointer b
);
137 // Event-related functions
138 void gdnDestroyEvent(gpointer data
);
139 void destroyEvent(Event
* const event
);
140 void destroyTCPEvent(Event
* const event
);
141 void destroyUDPEvent(Event
* const event
);
142 void gfDestroyEvent(gpointer data
, gpointer user_data
);
144 // Message-related functions
145 void printTCPSegment(const Message
* const segment
);
146 void convertIP(char* const str
, const uint32_t addr
);
148 gint
gcfTCPSegmentAckCompare(gconstpointer a
, gconstpointer b
);
149 bool isAcking(const Message
* const ackSegment
, const Message
* const ackedSegment
);
151 void gdnTCPSegmentListDestroy(gpointer data
);
152 void gfTCPSegmentDestroy(gpointer data
, gpointer user_data
);
153 void destroyTCPSegment(Message
* const segment
);
155 // Exchange-related functions
156 void destroyTCPExchange(Exchange
* const exchange
);
158 // Broadcast-related functions
159 void gdnDestroyBroadcast(gpointer data
);
160 void destroyBroadcast(Broadcast
* const broadcast
);