This file is indexed.

/usr/include/ns3.27/ns3/ipv4-interface.h is in libns3-dev 3.27+dfsg-1.

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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2005,2006,2007 INRIA
 *
 * 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
 *
 * Authors: 
 *  Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
 *  Tom Henderson <tomh@tomh.org>
 */
#ifndef IPV4_INTERFACE_H
#define IPV4_INTERFACE_H

#include <list>
#include "ns3/ptr.h"
#include "ns3/object.h"

namespace ns3 {

class NetDevice;
class Packet;
class Node;
class ArpCache;
class Ipv4InterfaceAddress;
class Ipv4Address;
class Ipv4Header;
class TrafficControlLayer;

/**
 * \ingroup ipv4
 *
 * \brief The IPv4 representation of a network interface
 *
 * This class roughly corresponds to the struct in_device
 * of Linux; the main purpose is to provide address-family
 * specific information (addresses) about an interface.
 *
 * By default, Ipv4 interface are created in the "down" state
 * no IP addresses.  Before becoming usable, the user must
 * add an address of some type and invoke Setup on them.
 */
class Ipv4Interface  : public Object
{
public:
  /**
   * \brief Get the type ID
   * \return type ID
   */
  static TypeId GetTypeId (void);

  Ipv4Interface ();
  virtual ~Ipv4Interface();

  /**
   * \brief Set node associated with interface.
   * \param node node
   */
  void SetNode (Ptr<Node> node); 
  /**
   * \brief Set the NetDevice.
   * \param device NetDevice
   */
  void SetDevice (Ptr<NetDevice> device);
  /**
   * \brief Set the TrafficControlLayer.
   * \param tc TrafficControlLayer object
   */
  void SetTrafficControl (Ptr<TrafficControlLayer> tc);
  /**
   * \brief Set ARP cache used by this interface
   * \param arpCache the ARP cache
   */
  void SetArpCache (Ptr<ArpCache> arpCache);

  /**
   * \returns the underlying NetDevice. This method cannot return zero.
   */
  Ptr<NetDevice> GetDevice (void) const;

  /**
   * \return ARP cache used by this interface
   */
  Ptr<ArpCache> GetArpCache () const;

  /**
   * \param metric configured routing metric (cost) of this interface
   *
   * Note:  This is synonymous to the Metric value that ifconfig prints
   * out.  It is used by ns-3 global routing, but other routing daemons
   * choose to ignore it. 
   */
  void SetMetric (uint16_t metric);

  /**
   * \returns configured routing metric (cost) of this interface
   *
   * Note:  This is synonymous to the Metric value that ifconfig prints
   * out.  It is used by ns-3 global routing, but other routing daemons 
   * may choose to ignore it. 
   */
  uint16_t GetMetric (void) const;

  /**
   * These are IP interface states and may be distinct from 
   * NetDevice states, such as found in real implementations
   * (where the device may be down but IP interface state is still up).
   */
  /**
   * \returns true if this interface is enabled, false otherwise.
   */
  bool IsUp (void) const;

  /**
   * \returns true if this interface is disabled, false otherwise.
   */
  bool IsDown (void) const;

  /**
   * Enable this interface
   */
  void SetUp (void);

  /**
   * Disable this interface
   */
  void SetDown (void);

  /**
   * \returns true if this interface is enabled for IP forwarding of input datagrams
   */
  bool IsForwarding (void) const;

  /**
   * \param val Whether to enable or disable IP forwarding for input datagrams
   */
  void SetForwarding (bool val);

  /**
   * \param p packet to send
   * \param hdr IPv4 header
   * \param dest next hop address of packet.
   *
   * This method will eventually call the private
   * SendTo method which must be implemented by subclasses.
   */ 
  void Send (Ptr<Packet> p, const Ipv4Header & hdr, Ipv4Address dest);

  /**
   * \param address The Ipv4InterfaceAddress to add to the interface
   * \returns true if succeeded
   */
  bool AddAddress (Ipv4InterfaceAddress address);

  /**
   * \param index Index of Ipv4InterfaceAddress to return
   * \returns The Ipv4InterfaceAddress address whose index is i
   */
  Ipv4InterfaceAddress GetAddress (uint32_t index) const;

  /**
   * \returns the number of Ipv4InterfaceAddresss stored on this interface
   */
  uint32_t GetNAddresses (void) const;

  /**
   * \param index Index of Ipv4InterfaceAddress to remove
   * \returns The Ipv4InterfaceAddress address whose index is index 
   */
  Ipv4InterfaceAddress RemoveAddress (uint32_t index);

  /**
   * \brief Remove the given Ipv4 address from the interface.
   * \param address The Ipv4 address to remove
   * \returns The removed Ipv4 interface address 
   * \returns The null interface address if the interface did not contain the 
   * address or if loopback address was passed as argument
   */
  Ipv4InterfaceAddress RemoveAddress (Ipv4Address address);

protected:
  virtual void DoDispose (void);
private:
  /**
   * \brief Copy constructor
   * \param o object to copy
   *
   * Defined and unimplemented to avoid misuse
   */
  Ipv4Interface (const Ipv4Interface &o);

  /**
   * \brief Assignment operator
   * \param o object to copy
   * \returns the copied object
   *
   * Defined and unimplemented to avoid misuse
   */
  Ipv4Interface &operator = (const Ipv4Interface &o);

  /**
   * \brief Initialize interface.
   */
  void DoSetup (void);


  /**
   * \brief Container for the Ipv4InterfaceAddresses.
   */
  typedef std::list<Ipv4InterfaceAddress> Ipv4InterfaceAddressList;

  /**
   * \brief Container Iterator for the Ipv4InterfaceAddresses.
   */
  typedef std::list<Ipv4InterfaceAddress>::const_iterator Ipv4InterfaceAddressListCI;

  /**
   * \brief Const Container Iterator for the Ipv4InterfaceAddresses.
   */
  typedef std::list<Ipv4InterfaceAddress>::iterator Ipv4InterfaceAddressListI;



  bool m_ifup; //!< The state of this interface
  bool m_forwarding;  //!< Forwarding state.
  uint16_t m_metric;  //!< Interface metric
  Ipv4InterfaceAddressList m_ifaddrs; //!< Address list
  Ptr<Node> m_node; //!< The associated node
  Ptr<NetDevice> m_device; //!< The associated NetDevice
  Ptr<TrafficControlLayer> m_tc; //!< The associated TrafficControlLayer
  Ptr<ArpCache> m_cache; //!< ARP cache
};

} // namespace ns3

#endif