src/common/pcap-file-object.cc
author Craig Dowell <craigdo@ee.washington.edu>
Wed, 03 Feb 2010 13:26:39 -0800
changeset 6041 b65c6d6794f8
parent 6035 ecd8840c3573
child 6043 fe4ec1033fec
permissions -rw-r--r--
Review feedback
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
/*
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     3
 * Copyright (c) 2009 University of Washington
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     4
 *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
 *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
 *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    17
 */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    18
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
    19
#include "ns3/log.h"
6041
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    20
#include "ns3/uinteger.h"
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
    21
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
    22
#include "buffer.h"
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
    23
#include "header.h"
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
#include "pcap-file-object.h"
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
NS_LOG_COMPONENT_DEFINE ("PcapFileObject");
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    28
namespace ns3 {
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
NS_OBJECT_ENSURE_REGISTERED (PcapFileObject);
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    31
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
TypeId 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    33
PcapFileObject::GetTypeId (void)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    34
{
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    35
  static TypeId tid = TypeId ("ns3::PcapFileObject")
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
    .SetParent<Object> ()
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    37
    .AddConstructor<PcapFileObject> ()
6041
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    38
    .AddAttribute ("CaptureSize",
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    39
                   "Maximum length of captured packets (cf. pcap snaplen)",
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    40
                   UintegerValue (PcapFile::SNAPLEN_DEFAULT),
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    41
                   MakeUintegerAccessor (&PcapFileObject::m_snapLen),
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    42
                   MakeUintegerChecker<uint32_t> (0, PcapFile::SNAPLEN_DEFAULT))
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    43
    ;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
  return tid;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    45
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    46
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    47
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    48
PcapFileObject::PcapFileObject ()
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    49
{
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    50
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    52
PcapFileObject::~PcapFileObject ()
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    53
{
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    54
  Close ();
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    55
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    56
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    57
void
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    58
PcapFileObject::Close (void)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    59
{
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
    60
  m_file.Close ();
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    61
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    62
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    63
bool
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    64
PcapFileObject::Open (std::string const &filename, std::string const &mode)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    65
{
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
    66
  return m_file.Open (filename, mode);
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    67
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    68
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    69
bool
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    70
PcapFileObject::Init (uint32_t dataLinkType, uint32_t snapLen, int32_t tzCorrection)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    71
{
6041
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    72
  //
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    73
  // If the user doesn't provide a snaplen, the default value will come in.  If
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    74
  // this happens, we use the "CaptureSize" Attribute.  If the user does provide
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    75
  // a snaplen, we use the one provided.
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    76
  //
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    77
  if (snapLen != std::numeric_limits<uint32_t>::max ())
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    78
    {
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    79
      return m_file.Init (dataLinkType, snapLen, tzCorrection);
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    80
    } 
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    81
  else
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    82
    {
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    83
      return m_file.Init (dataLinkType, m_snapLen, tzCorrection);
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    84
    } 
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    85
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    86
  //
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    87
  // Quiet the compiler
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    88
  //
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6035
diff changeset
    89
  return true;
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    90
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    91
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    92
bool
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    93
PcapFileObject::Write (Time t, Ptr<const Packet> p)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    94
{
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    95
  uint64_t current = t.GetMicroSeconds ();
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    96
  uint64_t s = current / 1000000;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    97
  uint64_t us = current % 1000000;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    98
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    99
  uint32_t bufferSize = p->GetSize ();
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   100
  uint8_t *buffer = new uint8_t[bufferSize];
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   101
  p->CopyData (buffer, bufferSize);
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   102
  bool rc = m_file.Write (s, us, buffer, bufferSize);
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   103
  delete [] buffer;
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   104
  return rc;
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   105
}
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   106
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   107
bool
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   108
PcapFileObject::Write (Time t, Header &header, Ptr<const Packet> p)
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   109
{
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   110
  uint64_t current = t.GetMicroSeconds ();
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   111
  uint64_t s = current / 1000000;
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   112
  uint64_t us = current % 1000000;
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   113
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   114
  Buffer headerBuffer;
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   115
  uint32_t headerSize = header.GetSerializedSize ();
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   116
  uint32_t packetSize = p->GetSize ();
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   117
  uint32_t bufferSize = headerSize + packetSize;
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   118
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   119
  headerBuffer.AddAtStart (headerSize);
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   120
  header.Serialize (headerBuffer.Begin ());
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   121
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   122
  uint8_t *buffer = new uint8_t[bufferSize];
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   123
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   124
  headerBuffer.Begin ().Read (buffer, headerSize);
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   125
  p->CopyData (&buffer[headerSize], packetSize);
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   126
  bool rc = m_file.Write (s, us, buffer, bufferSize);
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   127
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   128
  delete [] buffer;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   129
  return rc;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   130
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   131
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   132
bool
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   133
PcapFileObject::Write (Time t, uint8_t const *buffer, uint32_t length)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   134
{
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   135
  uint64_t current = t.GetMicroSeconds ();
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   136
  uint64_t s = current / 1000000;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   137
  uint64_t us = current % 1000000;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   138
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   139
  return m_file.Write (s, us, buffer, length);
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   140
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   141
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   142
uint32_t
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   143
PcapFileObject::GetMagic (void)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   144
{
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   145
  return m_file.GetMagic ();
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   146
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   147
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   148
uint16_t
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   149
PcapFileObject::GetVersionMajor (void)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   150
{
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   151
  return m_file.GetVersionMajor ();
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   152
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   153
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   154
uint16_t
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   155
PcapFileObject::GetVersionMinor (void)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   156
{
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   157
  return m_file.GetVersionMinor ();
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   158
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   159
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   160
int32_t
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   161
PcapFileObject::GetTimeZoneOffset (void)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   162
{
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   163
  return m_file.GetTimeZoneOffset ();
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   164
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   165
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   166
uint32_t
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   167
PcapFileObject::GetSigFigs (void)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   168
{
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   169
  return m_file.GetSigFigs ();
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   170
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   171
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   172
uint32_t
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   173
PcapFileObject::GetSnapLen (void)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   174
{
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   175
  return m_file.GetSnapLen ();
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   176
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   177
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   178
uint32_t
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   179
PcapFileObject::GetDataLinkType (void)
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   180
{
6035
ecd8840c3573 add ability to pass a header to pcap file object
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   181
  return m_file.GetDataLinkType ();
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   182
}
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   183
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   184
} //namespace ns3