This file is indexed.

/usr/include/ns3.17/ns3/ethernet-trailer.h is in libns3-dev 3.17+dfsg-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2007 Emmanuelle Laprise
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
 */

#ifndef ETHERNET_TRAILER_H
#define ETHERNET_TRAILER_H

#include "ns3/trailer.h"
#include "ns3/packet.h"
#include <string>

namespace ns3 {


/**
 * \ingroup network
 *
 * \brief Packet trailer for Ethernet
 *
 * This class can be used to add and verify the FCS at the end of an
 * Ethernet packet.
 */
class EthernetTrailer : public Trailer 
{
public:
  /**
   * \brief Construct a null ethernet trailer
   */
  EthernetTrailer ();

  /**
   * \brief Enable or disable FCS checking and calculations
   * \param enable If true, enables FCS calculations.
   */
  void EnableFcs (bool enable);

  /**
   * \brief Updates the Fcs Field to the correct FCS
   * \param p Reference to a packet on which the FCS should be
   * calculated. The packet should not currently contain an 
   * EthernetTrailer.
   */
  void CalcFcs (Ptr<const Packet> p);

  /**
   * \brief Sets the FCS to a new value
   * \param fcs New FCS value
   */
  void SetFcs (uint32_t fcs);

  /**
   * \return the FCS contained in this trailer
   */
  uint32_t GetFcs ();

  /**
   * Calculate an FCS on the provided packet and check this value against
   * the FCS found when the trailer was deserialized (the one in the transmitted
   * packet).
   *
   * If FCS checking is disabled, this method will always
   * return true.
   *
   * \param p Reference to the packet on which the FCS should be
   * calculated. The packet should not contain an EthernetTrailer.
   *
   * \return Returns true if the Packet FCS matches the FCS in the trailer, 
   * false otherwise.
   */
  bool CheckFcs (Ptr<const Packet> p) const;

  /**
   *\return Returns the size of the trailer
   */ 
  uint32_t GetTrailerSize () const;

  static TypeId GetTypeId (void);
  virtual TypeId GetInstanceTypeId (void) const;
  virtual void Print (std::ostream &os) const;
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator end) const;
  virtual uint32_t Deserialize (Buffer::Iterator end);
private:
  /**
   * Enabled FCS calculations. If false, m_fcs is set to 0 and CheckFcs
   * returns true.
   */
  bool m_calcFcs;
  uint32_t m_fcs; /// Value of the fcs contained in the trailer

  uint32_t DoCalcFcs (uint8_t const *buffer, size_t len) const;

};

} // namespace ns3

#endif /* ETHERNET_TRAILER_H */