author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Fri, 04 May 2007 15:04:07 +0200 | |
changeset 524 | 082ffdd8fbd7 |
parent 457 | src/node/pcap-trace.h@a468fac09924 |
child 1866 | e7dbcc4df546 |
permissions | -rw-r--r-- |
456
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 INRIA |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* All rights reserved. |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
*/ |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
#ifndef PCAP_TRACE_H |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
#define PCAP_TRACE_H |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
|
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include <string> |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include <vector> |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
|
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
namespace ns3 { |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
|
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
class Packet; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
class TraceContext; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
class PcapWriter; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
|
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
class PcapTrace |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
{ |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
public: |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
PcapTrace (std::string filename); |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
~PcapTrace (); |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
|
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
39 |
void TraceAllIp (void); |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
private: |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
PcapWriter *GetStream (uint32_t nodeId, uint32_t interfaceId); |
457
a468fac09924
add context information to tx and rx trace callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
456
diff
changeset
|
42 |
void LogIp (TraceContext const &context, Packet const &p, uint32_t interfaceIndex); |
456
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
43 |
std::string m_filename; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
44 |
struct Trace { |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
45 |
uint32_t nodeId; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
uint32_t interfaceId; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
PcapWriter *writer; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
}; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
std::vector<Trace> m_traces; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
}; |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
|
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
}//namespace ns3 |
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
|
5361882cc2f3
put together a PcapTrace and test it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
#endif /* PCAP_TRACE_H */ |