Add a unittest program for clock synchronization modules
[lttv.git] / lttv / lttv / sync / data_structures_tcp.h
CommitLineData
70407e86
BP
1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca>
3 *
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;
7 *
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.
12 *
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,
16 * MA 02111-1307, USA.
17 */
18
19#ifndef DATA_STRUCTURES_TCP_H
20#define DATA_STRUCTURES_TCP_H
21
22#include <glib.h>
23#include <stdbool.h>
24#include <stdint.h>
25
26#include <ltt/ltt.h>
27
28typedef struct
29{
30 uint32_t saddr, daddr;
31 uint16_t source, dest;
32} ConnectionKey;
33
34typedef struct
35{
36 ConnectionKey connectionKey;
37 uint8_t ihl;
38 uint16_t tot_len;
39 uint32_t seq, ack_seq;
40 uint8_t doff;
41 uint8_t ack, rst, syn, fin;
42} PacketKey;
43
44typedef struct
45{
46 // lttng metainformation
47 unsigned long traceNum;
48 LttCycleCount tsc;
49
50 // kernel metainformation
51 void* skb;
52
53 // packet header fields
54 PacketKey* packetKey;
55} NetEvent;
56
57typedef struct
58{
59 NetEvent* inE, * outE;
60 GQueue* acks;
61} Packet;
62
63typedef struct
64{
65 double drift, offset;
66} Factors;
67
68typedef enum
69{
70 OUT,
71 IN
72} EventType;
73
74
75void convertIP(char* const str, const uint32_t addr);
76void printPacket(const Packet* const packet);
77
78// ConnectionKey-related functions
79bool connectionKeyEqual(const ConnectionKey* const a, const ConnectionKey*
80 const b);
81
82// NetEvent-related functions
83void destroyNetEvent(NetEvent* const event);
84
85// Packet-related functions
86bool isAcking(const Packet* const ackPacket, const Packet* const ackedPacket);
87void destroyPacket(Packet* const packet);
88
89// ConnectionKey-related Glib functions
90guint ghfConnectionKeyHash(gconstpointer key);
91gboolean gefConnectionKeyEqual(gconstpointer a, gconstpointer b);
92void gdnConnectionKeyDestroy(gpointer data);
93
94// PacketKey-related Glib functions
95guint ghfPacketKeyHash(gconstpointer key);
96gboolean gefPacketKeyEqual(gconstpointer a, gconstpointer b);
97
98// NetEvent-related Glib functions
99void gdnDestroyNetEvent(gpointer data);
100
101// Packet-related Glib functions
102void gdnPacketListDestroy(gpointer data);
103void gfPacketDestroy(gpointer data, gpointer user_data);
104gint gcfPacketAckCompare(gconstpointer a, gconstpointer b);
105
106#endif
This page took 0.026826 seconds and 4 git commands to generate.