This file is indexed.

/usr/include/ns3.26/ns3/ipv6.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
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 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
 *
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
 */

/* taken from src/node/ipv4.h and adapted to IPv6 */

#ifndef IPV6_H
#define IPV6_H

#include <stdint.h>

#include "ns3/object.h"
#include "ns3/socket.h"
#include "ns3/callback.h"

#include "ns3/ipv6-address.h"
#include "ipv6-interface-address.h"

namespace ns3 {

class Node;
class NetDevice;
class Packet;
class Ipv6RoutingProtocol;
class IpL4Protocol;
class Ipv6Route;

/**
 * \ingroup internet
 * \defgroup ipv6 IPv6 classes and sub-modules
 */

/**
 * \ingroup ipv6
 * \brief Access to the IPv6 forwarding table, interfaces, and configuration
 *
 * This class defines the API to manipulate the following aspects of
 * the IPv6 implementation:
 * -# set/get an Ipv6RoutingProtocol 
 * -# register a NetDevice for use by the IPv6 layer (basically, to
 * create IPv6-related state such as addressing and neighbor cache that 
 * is associated with a NetDevice)
 * -# manipulate the status of the NetDevice from the IPv6 perspective, 
 * such as marking it as Up or Down, 
 * -# adding, deleting, and getting addresses associated to the IPv6 
 * interfaces.
 * -# exporting IPv6 configuration attributes
 * 
 * Each NetDevice has conceptually a single IPv6 interface associated
 * with it (the corresponding structure in the Linux IPv6 implementation
 * is struct in_device).  Each interface may have one or more IPv6
 * addresses associated with it.  Each IPv6 address may have different
 * subnet mask, scope, etc., so all of this per-address information 
 * is stored in an Ipv6InterfaceAddress class (the corresponding 
 * structure in Linux is struct in6_ifaddr)
 *
 * IPv6 attributes such as whether IP forwarding is enabled and disabled
 * are also stored in this class
 *
 * TO DO:  Add API to allow access to the IPv6 neighbor table
 *
 * \see Ipv6RoutingProtocol
 * \see Ipv6InterfaceAddress
 */
class Ipv6 : public Object
{
public:
  /**
   * \brief Get the type ID.
   * \return the object TypeId
   */
  static TypeId GetTypeId (void);

  /**
   * \brief Constructor.
   */
  Ipv6 ();

  /**
   * \brief Destructor.
   */
  virtual ~Ipv6 ();

  /**
   * \brief Register a new routing protocol to be used by this IPv6 stack
   *
   * This call will replace any routing protocol that has been previously 
   * registered.  If you want to add multiple routing protocols, you must
   * add them to a Ipv6ListRoutingProtocol directly.
   * 
   * \param routingProtocol smart pointer to Ipv6RoutingProtocol object
   */
  virtual void SetRoutingProtocol (Ptr<Ipv6RoutingProtocol> routingProtocol) = 0;

  /**
   * \brief Get the routing protocol to be used by this IPv6 stack
   * 
   * \returns smart pointer to Ipv6RoutingProtocol object, or null pointer if none
   */
  virtual Ptr<Ipv6RoutingProtocol> GetRoutingProtocol (void) const = 0;

  /**
   * \brief Add a NetDevice interface.
   *
   * Once a device has been added, it can never be removed: if you want
   * to disable it, you can invoke Ipv6::SetDown which will
   * make sure that it is never used during packet forwarding.
   * \param device device to add to the list of IPv6 interfaces
   *        which can be used as output interfaces during packet forwarding.
   * \returns the index of the IPv6 interface added.
   */
  virtual uint32_t AddInterface (Ptr<NetDevice> device) = 0;

  /**
   * \brief Get number of interfaces.
   * \returns the number of interfaces added by the user.
   */
  virtual uint32_t GetNInterfaces (void) const = 0;

  /**
   * \brief Return the interface number of the interface that has been
   *        assigned the specified IP address.
   *
   * \param address The IP address being searched for
   * \returns The interface number of the IPv6 interface with the given 
   *          address or -1 if not found.
   *
   * Each IP interface has one or more IP addresses associated with it.
   * This method searches the list of interfaces for one that holds a
   * particular address.  This call takes an IP address as a parameter and
   * returns the interface number of the first interface that has been assigned
   * that address, or -1 if not found.  There must be an exact match.
   */
  virtual int32_t GetInterfaceForAddress (Ipv6Address address) const = 0;

  /**
   * \brief Return the interface number of first interface found that 
   *  has an IPv6 address within the prefix specified by the input
   *  address and mask parameters
   *
   * \param address The IP address assigned to the interface of interest.
   * \param mask The IP prefix to use in the mask
   * \returns The interface number of the IPv6 interface with the given 
   *          address or -1 if not found.
   *
   * Each IP interface has one or more IP addresses associated with it.
   * This method searches the list of interfaces for the first one found
   * that holds an address that is included within the prefix 
   * formed by the input address and mask parameters.  The value -1 is
   * returned if no match is found.
   */
  virtual int32_t GetInterfaceForPrefix (Ipv6Address address,
                                         Ipv6Prefix mask) const = 0;

  /**
   * \brief Get the NetDevice of the specified interface number.
   * \param interface The interface number of an IPv6 interface.
   * \returns The NetDevice associated with the IPv6 interface number.
   */
  virtual Ptr<NetDevice> GetNetDevice (uint32_t interface) = 0;

  /**
   * \brief Get the interface index of the specified NetDevice.
   * \param device The NetDevice for an Ipv6Interface
   * \returns The interface number of an IPv6 interface or -1 if not found.
   */
  virtual int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const = 0;

  /**
   * \brief Add an address on the specified IPv6 interface.
   * \param interface Interface number of an IPv6 interface
   * \param address Ipv6InterfaceAddress address to associate with the underlying IPv6 interface
   * \returns true if the operation succeeded
   */
  virtual bool AddAddress (uint32_t interface, Ipv6InterfaceAddress address) = 0;

  /**
   * \brief Get number of addresses on specified IPv6 interface.
   * \param interface Interface number of an IPv6 interface
   * \returns the number of Ipv6InterfaceAddress entries for the interface.
   */
  virtual uint32_t GetNAddresses (uint32_t interface) const = 0;

  /**
   * \brief Get IPv6 address on specified IPv6 interface.
   *
   * Because addresses can be removed, the addressIndex is not guaranteed
   * to be static across calls to this method.
   * 
   * \param interface Interface number of an IPv6 interface
   * \param addressIndex index of Ipv6InterfaceAddress 
   * \returns the Ipv6InterfaceAddress associated to the interface and addressIndex
   */
  virtual Ipv6InterfaceAddress GetAddress (uint32_t interface, uint32_t addressIndex) const = 0;

  /**
   * \brief Remove an address on specified IPv6 interface.
   *
   * Remove the address at addressIndex on named interface.  The addressIndex
   * for all higher indices will decrement by one after this method is called;
   * so, for example, to remove 5 addresses from an interface i, one could
   * call RemoveAddress (i, 0); 5 times.
   * 
   * \param interface Interface number of an IPv6 interface
   * \param addressIndex index of Ipv6InterfaceAddress to remove 
   * \returns true if the operation succeeded
   */
  virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex) = 0;

  /**
   * \brief Remove the given address on named Ipv6 interface
   *
   * \param interface Interface number of an IPv6 interface
   * \param address the address to remove
   * \returns true if the operation succeeded
   */
  virtual bool RemoveAddress (uint32_t interface, Ipv6Address address) = 0;

  /**
   * \brief Set metric on specified Ipv6 interface.
   *
   * \param interface The interface number of an IPv6 interface
   * \param metric routing metric (cost) associated to the underlying 
   *          IPv6 interface
   */
  virtual void SetMetric (uint32_t interface, uint16_t metric) = 0;

  /**
   * \brief Get metric for the specified IPv6 interface.
   *
   * \param interface The interface number of an IPv6 interface
   * \returns routing metric (cost) associated to the underlying 
   *          IPv6 interface
   */
  virtual uint16_t GetMetric (uint32_t interface) const = 0;

  /**
   * \brief Get MTU for the specified IPv6 interface.
   * \param interface Interface number of IPv6 interface
   * \returns the Maximum Transmission Unit (in bytes) associated
   *          to the underlying IPv6 interface
   */
  virtual uint16_t GetMtu (uint32_t interface) const = 0;

  /**
   * \brief Set the Path MTU for the specified IPv6 destination address.
   * \param dst Ipv6 destination address
   * \param pmtu the Path MTU
   */
  virtual void SetPmtu (Ipv6Address dst, uint32_t pmtu) = 0;

  /**
   * \brief If the specified interface index is in "up" state.
   * \param interface Interface number of IPv6 interface
   * \returns true if the underlying interface is in the "up" state,
   *          false otherwise.
   */
  virtual bool IsUp (uint32_t interface) const = 0;

  /**
   * \brief Set the interface into the "up" state. 
   *
   * In this state, it is considered valid during IPv6 forwarding.
   * \param interface Interface number of IPv6 interface
   */
  virtual void SetUp (uint32_t interface) = 0;

  /**
   * \brief Set the interface into the "down" state.
   *
   * In this state, it is ignored during IPv6 forwarding.
   * \param interface Interface number of IPv6 interface
   */
  virtual void SetDown (uint32_t interface) = 0;

  /**
   * \brief If the specified IPv6 interface has forwarding enabled.
   * \param interface Interface number of IPv6 interface
   * \returns true if IPv6 forwarding enabled for input datagrams on this device
   */
  virtual bool IsForwarding (uint32_t interface) const = 0;

  /**
   * \brief Set forwarding on specified IPv6 interface.
   * \param interface Interface number of IPv6 interface
   * \param val Value to set the forwarding flag
   * 
   * If set to true, IPv6 forwarding is enabled for input datagrams on this device
   */
  virtual void SetForwarding (uint32_t interface, bool val) = 0;

  /**
   * \brief Choose the source address to use with destination address.
   * \param interface interface index
   * \param dest IPv6 destination address
   * \return IPv6 source address to use
   */
  virtual Ipv6Address SourceAddressSelection (uint32_t interface, Ipv6Address dest) = 0;

  /**
   * \brief Add a L4 protocol.
   * \param protocol L4 protocol
   */
  virtual void Insert (Ptr<IpL4Protocol> protocol) = 0;

  /**
   * \brief Add a L4 protocol to a specific interface.
   *
   * This may be called multiple times for multiple interfaces for the same
   * protocol.  To insert for all interfaces, use the separate
   * Insert (Ptr<IpL4Protocol> protocol) method.
   *
   * Setting a protocol on a specific interface will overwrite the
   * previously bound protocol.
   *
   * \param protocol L4 protocol.
   * \param interfaceIndex interface index.
   */
  virtual void Insert (Ptr<IpL4Protocol> protocol, uint32_t interfaceIndex) = 0;

  /**
   * \brief Remove a L4 protocol.
   * \param protocol L4 protocol to remove.
   */
  virtual void Remove (Ptr<IpL4Protocol> protocol) = 0;

  /**
   * \brief Remove a L4 protocol from a specific interface.
   * \param protocol L4 protocol to remove.
   * \param interfaceIndex interface index.
   */
  virtual void Remove (Ptr<IpL4Protocol> protocol, uint32_t interfaceIndex) = 0;

  /**
   * \brief Get L4 protocol by protocol number.
   * \param protocolNumber protocol number
   * \return corresponding IpL4Protocol or 0 if not found
   */
  virtual Ptr<IpL4Protocol> GetProtocol (int protocolNumber) const = 0;

  /**
   * \brief Get L4 protocol by protocol number for the specified interface.
   * \param protocolNumber protocol number
   * \param interfaceIndex interface index, -1 means "any" interface.
   * \return corresponding IpL4Protocol or 0 if not found
   */
  virtual Ptr<IpL4Protocol> GetProtocol (int protocolNumber, int32_t interfaceIndex) const = 0;

  /**
   * \brief Higher-level layers call this method to send a packet
   * down the stack to the MAC and PHY layers.
   *
   * \param packet packet to send
   * \param source source address of packet
   * \param destination address of packet
   * \param protocol number of packet
   * \param route route to take
   */
  virtual void Send (Ptr<Packet> packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr<Ipv6Route> route) = 0;

  /**
   * \brief Register the IPv6 Extensions.
   */
  virtual void RegisterExtensions () = 0;

  /**
   * \brief Register the IPv6 Options.
   */
  virtual void RegisterOptions () = 0;

  /**
   * \brief Any interface magic number.
   */
  static const uint32_t IF_ANY = 0xffffffff;

private:
  // Indirect the IPv6 attributes through private pure virtual methods
  /**
   * \brief Set IPv6 forwarding state.
   * \param forward IPv6 forwarding enabled or not
   */
  virtual void SetIpForward (bool forward) = 0;

  /**
   * \brief Get IPv6 forwarding state.
   * \return forwarding state (enabled or not)
   */
  virtual bool GetIpForward (void) const = 0;

  /**
   * \brief Set IPv6 MTU discover state.
   * \param mtuDiscover IPv6 MTU discover enabled or not
   */
  virtual void SetMtuDiscover (bool mtuDiscover) = 0;

  /**
   * \brief Get IPv6 MTU discover state.
   * \return MTU discover state (enabled or not)
   */
  virtual bool GetMtuDiscover (void) const = 0;
};

} // namespace ns3 

#endif /* IPV6_H */