This file is indexed.

/usr/include/ns3.26/ns3/ipv4-interface-address.h is in libns3-dev 3.26+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
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2008 University of Washington
 *
 * 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
 *
 */

#ifndef IPV4_INTERFACE_ADDRESS_H
#define IPV4_INTERFACE_ADDRESS_H

#include <stdint.h>
#include <ostream>
#include "ns3/ipv4-address.h"

namespace ns3 {

/**
 * \ingroup address
 * \ingroup ipv4
 *
 * \brief a class to store IPv4 address information on an interface
 *
 * Corresponds to Linux struct in_ifaddr.  A list of these addresses
 * is stored in Ipv4Interface.  This class is modelled after how current
 * Linux handles IP aliasing for IPv4.  Notably, aliasing of IPv4 
 * interfaces (e.g., "eth0:1") is not used, and instead an interface
 * is assigned possibly multiple addresses, with each address being
 * classified as being primary and secondary.  See the iproute2 
 * documentation for this distinction.
 */
class Ipv4InterfaceAddress 
{
public:
  /**
   * \enum InterfaceAddressScope_e
   * \brief Address scope.
   */
  enum InterfaceAddressScope_e {
    HOST,
    LINK,
    GLOBAL
  };

  Ipv4InterfaceAddress ();

  /**
   * \brief Configure local address, mask and broadcast address
   * \param local the local address
   * \param mask the network mask
   */
  Ipv4InterfaceAddress (Ipv4Address local, Ipv4Mask mask);
  /**
   * Copy constructor
   * \param o the object to copy
   */
  Ipv4InterfaceAddress (const Ipv4InterfaceAddress &o);

  /**
   * \brief Set local address
   * \param local the address
   */
  void SetLocal (Ipv4Address local);
  /**
   * \brief Get the local address
   * \returns the local address
   */
  Ipv4Address GetLocal (void) const;
  /**
   * \brief Set the network mask
   * \param mask the network mask
   */
  void SetMask (Ipv4Mask mask);
  /**
   * \brief Get the network mask
   * \returns the network mask
   */
  Ipv4Mask GetMask (void) const;
  /**
   * \brief Set the broadcast address
   * \param broadcast the broadcast address
   */
  void SetBroadcast (Ipv4Address broadcast);
  /**
   * \brief Get the broadcast address
   * \returns the broadcast address
   */
  Ipv4Address GetBroadcast (void) const;
 
  /**
   * \brief Set the scope.
   * \param scope the scope of address
   */
  void SetScope (Ipv4InterfaceAddress::InterfaceAddressScope_e scope);

  /**
   * \brief Get address scope.
   * \return scope
   */
  Ipv4InterfaceAddress::InterfaceAddressScope_e GetScope (void) const;

  /**
   * \brief Check if the address is a secondary address
   *
   * Secondary address is used for multihoming
   * \returns true if the address is secondary
   */
  bool IsSecondary (void) const;

  /**
   * \brief Make the address secondary (used for multihoming)
   */
  void SetSecondary (void);
  /**
   * \brief Make the address primary
   */
  void SetPrimary (void);

private:

  Ipv4Address m_local;     //!< Interface address
  // Note:  m_peer may be added in future when necessary
  // Ipv4Address m_peer;   // Peer destination address (in Linux:  m_address)
  Ipv4Mask m_mask;         //!< Network mask
  Ipv4Address m_broadcast; //!< Broadcast address

  InterfaceAddressScope_e m_scope; //!< Address scope
  bool m_secondary;        //!< For use in multihoming

  /**
   * \brief Equal to operator.
   *
   * \param a the first operand
   * \param b the first operand
   * \returns true if the operands are equal
   */
  friend bool operator == (Ipv4InterfaceAddress const &a, Ipv4InterfaceAddress const &b);

  /**
   * \brief Not equal to operator.
   *
   * \param a the first operand
   * \param b the first operand
   * \returns true if the operands are not equal
   */
  friend bool operator != (Ipv4InterfaceAddress const &a, Ipv4InterfaceAddress const &b);
};

/**
 * \brief Stream insertion operator.
 *
 * \param os the reference to the output stream
 * \param addr the Ipv4InterfaceAddress
 * \returns the reference to the output stream
 */
std::ostream& operator<< (std::ostream& os, const Ipv4InterfaceAddress &addr);

inline bool operator == (const Ipv4InterfaceAddress &a, const Ipv4InterfaceAddress &b)
{
  return (a.m_local == b.m_local && a.m_mask == b.m_mask &&
          a.m_broadcast == b.m_broadcast && a.m_scope == b.m_scope && a.m_secondary == b.m_secondary);
}
inline bool operator != (const Ipv4InterfaceAddress &a, const Ipv4InterfaceAddress &b)
{
  return (a.m_local != b.m_local || a.m_mask != b.m_mask ||
          a.m_broadcast != b.m_broadcast || a.m_scope != b.m_scope || a.m_secondary != b.m_secondary);
}


} // namespace ns3

#endif /* IPV4_ADDRESS_H */