src/internet/model/ipv6-extension.cc
author Tom Henderson <tomh@tomh.org>
Fri, 25 Feb 2011 10:32:35 -0800
changeset 6834 036f9a0b9899
parent 6552 src/internet-stack/ipv6-extension.cc@e1a18247fa9c
child 7176 9f2663992e99
permissions -rw-r--r--
Rename internet-stack to internet, and organize module
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     1
/*  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     2
/*
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     3
 * Copyright (c) 2007-2009 Strasbourg University
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     4
 *
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     8
 *
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    13
 *
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    17
 *
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    18
 * Author: David Gross <gdavid.devel@gmail.com>
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    19
 */
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    20
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    21
#include <list>
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    22
#include <ctime>
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    23
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    24
#include "ns3/log.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    25
#include "ns3/assert.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    26
#include "ns3/uinteger.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    27
#include "ns3/object-vector.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    28
#include "ns3/ipv6-address.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    29
#include "ns3/ipv6-header.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    30
#include "ns3/ipv6-l3-protocol.h"
5793
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
    31
#include "ns3/ipv6-static-routing.h"
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
    32
#include "ns3/ipv6-list-routing.h"
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
    33
#include "ns3/ipv6-route.h"
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    34
#include "ns3/trace-source-accessor.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    35
#include "ns3/random-variable.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    36
#include "icmpv6-l4-protocol.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    37
#include "ipv6-extension-demux.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    38
#include "ipv6-extension.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    39
#include "ipv6-extension-header.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    40
#include "ipv6-option-demux.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    41
#include "ipv6-option.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    42
#include "udp-header.h"
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    43
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    44
NS_LOG_COMPONENT_DEFINE ("Ipv6Extension");
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    45
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    46
namespace ns3
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    47
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    48
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    49
NS_OBJECT_ENSURE_REGISTERED (Ipv6Extension);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    50
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    51
TypeId Ipv6Extension::GetTypeId ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    52
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    53
  static TypeId tid = TypeId ("ns3::Ipv6Extension")
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    54
    .SetParent<Object> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    55
    .AddAttribute ("ExtensionNumber", "The IPv6 extension number.",
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
    56
                   UintegerValue (0),
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
    57
                   MakeUintegerAccessor (&Ipv6Extension::GetExtensionNumber),
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
    58
                   MakeUintegerChecker<uint8_t> ())
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    59
    .AddTraceSource ("Drop", "Drop ipv6 packet",
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
    60
                     MakeTraceSourceAccessor (&Ipv6Extension::m_dropTrace))
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    61
    ;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    62
  return tid;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    63
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    64
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    65
Ipv6Extension::~Ipv6Extension ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    66
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    67
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    68
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    69
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    70
void Ipv6Extension::SetNode (Ptr<Node> node)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    71
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    72
  NS_LOG_FUNCTION (this << node);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    73
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    74
  m_node = node;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    75
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    76
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    77
Ptr<Node> Ipv6Extension::GetNode () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    78
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    79
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    80
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    81
  return m_node;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    82
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
    83
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    84
uint8_t Ipv6Extension::ProcessOptions (Ptr<Packet>& packet, uint8_t offset, uint8_t length, Ipv6Header const& ipv6Header, Ipv6Address dst, uint8_t *nextHeader, bool& isDropped)
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
    85
{
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
    86
  NS_LOG_FUNCTION (this << packet << offset << length << ipv6Header << dst << nextHeader << isDropped);
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
    87
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    88
  // For ICMPv6 Error packets
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    89
  Ptr<Packet> malformedPacket = packet->Copy ();
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    90
  malformedPacket->AddHeader (ipv6Header);
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    91
  Ptr<Icmpv6L4Protocol> icmpv6 = GetNode ()->GetObject<Ipv6L3Protocol> ()->GetIcmpv6 ();
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
    92
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    93
  Ptr<Packet> p = packet->Copy ();
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    94
  p->RemoveAtStart (offset);
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
    95
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    96
  Ptr<Ipv6OptionDemux> ipv6OptionDemux = GetNode ()->GetObject<Ipv6OptionDemux> ();
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    97
  Ptr<Ipv6Option> ipv6Option;
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
    98
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
    99
  uint8_t processedSize = 0;
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   100
  uint32_t size = p->GetSize();
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   101
  uint8_t *data = new uint8_t[size];
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   102
  p->CopyData (data, size);
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   103
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   104
  uint8_t optionType = 0;
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   105
  uint8_t optionLength = 0;
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   106
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   107
  while (length > processedSize && !isDropped)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   108
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   109
      optionType = *(data + processedSize);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   110
      ipv6Option = ipv6OptionDemux->GetOption (optionType);
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   111
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   112
      if (ipv6Option == 0)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   113
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   114
          optionType >>= 6;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   115
          switch (optionType)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   116
            {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   117
            case 0:
5862
8f126818f691 Bug 770: IPv6 size calculation for unknown options is wrong.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5810
diff changeset
   118
              optionLength = *(data + processedSize + 1) + 2;
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   119
              break;
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   120
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   121
            case 1:
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   122
              NS_LOG_LOGIC ("Unknown Option. Drop!");
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   123
              m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   124
              optionLength = 0;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   125
              isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   126
              break;
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   127
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   128
            case 2:
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   129
              NS_LOG_LOGIC ("Unknown Option. Drop!");
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   130
              icmpv6->SendErrorParameterError (malformedPacket, ipv6Header.GetSourceAddress (), Icmpv6Header::ICMPV6_UNKNOWN_OPTION, offset + processedSize);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   131
              m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   132
              optionLength = 0;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   133
              isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   134
              break;
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   135
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   136
            case 3:
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   137
              NS_LOG_LOGIC ("Unknown Option. Drop!");
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   138
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   139
              if (!ipv6Header.GetDestinationAddress ().IsMulticast ())
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   140
                {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   141
                  icmpv6->SendErrorParameterError (malformedPacket, ipv6Header.GetSourceAddress (), Icmpv6Header::ICMPV6_UNKNOWN_OPTION, offset + processedSize);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   142
                  m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   143
                  optionLength = 0;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   144
                  isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   145
                  break;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   146
                }
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   147
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   148
              m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   149
              optionLength = 0;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   150
              isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   151
              break;
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   152
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   153
            default:
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   154
              break;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   155
            }
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   156
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   157
        }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   158
      else
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   159
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   160
          optionLength = ipv6Option->Process (packet, offset + processedSize, ipv6Header, isDropped);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   161
        }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   162
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   163
      processedSize += optionLength;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   164
      p->RemoveAtStart (optionLength);
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   165
    }
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   166
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   167
  delete [] data;
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   168
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   169
  return processedSize;
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   170
}
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   171
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   172
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   173
NS_OBJECT_ENSURE_REGISTERED (Ipv6ExtensionHopByHop);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   174
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   175
TypeId Ipv6ExtensionHopByHop::GetTypeId ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   176
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   177
  static TypeId tid = TypeId ("ns3::Ipv6ExtensionHopByHop")
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   178
    .SetParent<Ipv6Extension> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   179
    .AddConstructor<Ipv6ExtensionHopByHop> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   180
    ;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   181
  return tid;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   182
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   183
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   184
Ipv6ExtensionHopByHop::Ipv6ExtensionHopByHop ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   185
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   186
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   187
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   188
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   189
Ipv6ExtensionHopByHop::~Ipv6ExtensionHopByHop ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   190
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   191
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   192
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   193
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   194
uint8_t Ipv6ExtensionHopByHop::GetExtensionNumber () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   195
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   196
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   197
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   198
  return EXT_NUMBER;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   199
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   200
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   201
uint8_t Ipv6ExtensionHopByHop::Process (Ptr<Packet>& packet, uint8_t offset, Ipv6Header const& ipv6Header, Ipv6Address dst, uint8_t *nextHeader, bool& isDropped)
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   202
{
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   203
  NS_LOG_FUNCTION (this << packet << offset << ipv6Header << dst << nextHeader << isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   204
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   205
  Ptr<Packet> p = packet->Copy ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   206
  p->RemoveAtStart (offset);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   207
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   208
  Ipv6ExtensionHopByHopHeader hopbyhopHeader;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   209
  p->RemoveHeader (hopbyhopHeader);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   210
  if (nextHeader)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   211
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   212
      *nextHeader = hopbyhopHeader.GetNextHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   213
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   214
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   215
  uint8_t processedSize = hopbyhopHeader.GetOptionsOffset ();
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   216
  offset += processedSize;
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   217
  uint8_t length = hopbyhopHeader.GetLength () - hopbyhopHeader.GetOptionsOffset ();
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   218
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   219
  processedSize += ProcessOptions (packet, offset, length, ipv6Header, dst, nextHeader, isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   220
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   221
  return processedSize;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   222
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   223
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   224
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   225
NS_OBJECT_ENSURE_REGISTERED (Ipv6ExtensionDestination);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   226
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   227
TypeId Ipv6ExtensionDestination::GetTypeId ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   228
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   229
  static TypeId tid = TypeId ("ns3::Ipv6ExtensionDestination")
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   230
    .SetParent<Ipv6Extension> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   231
    .AddConstructor<Ipv6ExtensionDestination> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   232
    ;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   233
  return tid;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   234
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   235
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   236
Ipv6ExtensionDestination::Ipv6ExtensionDestination ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   237
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   238
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   239
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   240
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   241
Ipv6ExtensionDestination::~Ipv6ExtensionDestination ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   242
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   243
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   244
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   245
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   246
uint8_t Ipv6ExtensionDestination::GetExtensionNumber () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   247
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   248
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   249
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   250
  return EXT_NUMBER;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   251
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   252
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   253
uint8_t Ipv6ExtensionDestination::Process (Ptr<Packet>& packet, uint8_t offset, Ipv6Header const& ipv6Header, Ipv6Address dst, uint8_t *nextHeader, bool& isDropped)
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   254
{
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   255
  NS_LOG_FUNCTION (this << packet << offset << ipv6Header << dst << nextHeader << isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   256
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   257
  Ptr<Packet> p = packet->Copy ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   258
  p->RemoveAtStart (offset);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   259
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   260
  Ipv6ExtensionDestinationHeader destinationHeader;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   261
  p->RemoveHeader (destinationHeader);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   262
  if (nextHeader)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   263
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   264
      *nextHeader = destinationHeader.GetNextHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   265
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   266
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   267
  uint8_t processedSize = destinationHeader.GetOptionsOffset ();
5801
86b47c42316c Ipv6Extension-Option link
Fabian Mauchle <fabian.mauchle@hsr.ch>
parents: 5793
diff changeset
   268
  offset += processedSize;
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   269
  uint8_t length = destinationHeader.GetLength () - destinationHeader.GetOptionsOffset ();
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   270
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   271
  processedSize += ProcessOptions (packet, offset, length, ipv6Header, dst, nextHeader, isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   272
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   273
  return processedSize;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   274
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   275
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   276
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   277
NS_OBJECT_ENSURE_REGISTERED (Ipv6ExtensionFragment);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   278
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   279
TypeId Ipv6ExtensionFragment::GetTypeId ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   280
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   281
  static TypeId tid = TypeId ("ns3::Ipv6ExtensionFragment")
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   282
    .SetParent<Ipv6Extension> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   283
    .AddConstructor<Ipv6ExtensionFragment> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   284
    ;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   285
  return tid;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   286
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   287
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   288
Ipv6ExtensionFragment::Ipv6ExtensionFragment ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   289
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   290
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   291
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   292
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   293
Ipv6ExtensionFragment::~Ipv6ExtensionFragment ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   294
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   295
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   296
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   297
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   298
void Ipv6ExtensionFragment::DoDispose ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   299
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   300
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   301
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   302
  for (MapFragments_t::iterator it = m_fragments.begin (); it != m_fragments.end (); it++)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   303
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   304
      it->second = 0;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   305
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   306
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   307
  m_fragments.clear ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   308
  Ipv6Extension::DoDispose ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   309
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   310
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   311
uint8_t Ipv6ExtensionFragment::GetExtensionNumber () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   312
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   313
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   314
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   315
  return EXT_NUMBER;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   316
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   317
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   318
uint8_t Ipv6ExtensionFragment::Process (Ptr<Packet>& packet, uint8_t offset, Ipv6Header const& ipv6Header, Ipv6Address dst, uint8_t *nextHeader, bool& isDropped)
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   319
{
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   320
  NS_LOG_FUNCTION (this << packet << offset << ipv6Header << dst << nextHeader << isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   321
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   322
  Ptr<Packet> p = packet->Copy ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   323
  p->RemoveAtStart (offset);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   324
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   325
  Ipv6ExtensionFragmentHeader fragmentHeader;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   326
  p->RemoveHeader (fragmentHeader);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   327
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   328
  if (nextHeader)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   329
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   330
      *nextHeader = fragmentHeader.GetNextHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   331
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   332
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   333
  bool moreFragment = fragmentHeader.GetMoreFragment ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   334
  uint16_t fragmentOffset = fragmentHeader.GetOffset ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   335
  uint32_t identification = fragmentHeader.GetIdentification ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   336
  Ipv6Address src = ipv6Header.GetSourceAddress ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   337
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   338
  std::pair<Ipv6Address, uint32_t> fragmentsId = std::make_pair<Ipv6Address, uint32_t> (src, identification);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   339
  Ptr<Fragments> fragments;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   340
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   341
  MapFragments_t::iterator it = m_fragments.find (fragmentsId);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   342
  if (it == m_fragments.end ())
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   343
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   344
      fragments = Create<Fragments> ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   345
      m_fragments.insert (std::make_pair (fragmentsId, fragments));
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   346
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   347
  else
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   348
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   349
      fragments = it->second;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   350
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   351
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   352
  if (fragmentOffset == 0)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   353
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   354
      Ptr<Packet> unfragmentablePart = packet->Copy ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   355
      unfragmentablePart->RemoveAtEnd (packet->GetSize () - offset);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   356
      fragments->SetUnfragmentablePart (unfragmentablePart);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   357
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   358
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   359
  fragments->AddFragment (p, fragmentOffset, moreFragment);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   360
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   361
  if (fragments->IsEntire ())
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   362
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   363
      packet = fragments->GetPacket ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   364
      isDropped = false;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   365
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   366
  else 
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   367
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   368
      NS_LOG_LOGIC ("Fragment. Drop!");
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   369
      m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   370
      isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   371
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   372
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   373
  return 0;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   374
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   375
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   376
void Ipv6ExtensionFragment::GetFragments (Ptr<Packet> packet, uint32_t maxFragmentSize, std::list<Ptr<Packet> >& listFragments)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   377
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   378
  Ptr<Packet> p = packet->Copy ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   379
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   380
  Ipv6Header ipv6Header;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   381
  p->RemoveHeader (ipv6Header);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   382
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   383
  uint8_t nextHeader = ipv6Header.GetNextHeader ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   384
  uint8_t ipv6HeaderSize = ipv6Header.GetSerializedSize ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   385
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   386
  uint8_t type;
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   387
  p->CopyData (&type, sizeof(type));
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   388
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   389
  bool moreHeader = true;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   390
  if (!(nextHeader == Ipv6Header::IPV6_EXT_HOP_BY_HOP || nextHeader == Ipv6Header::IPV6_EXT_ROUTING
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   391
        || (nextHeader == Ipv6Header::IPV6_EXT_DESTINATION && type == Ipv6Header::IPV6_EXT_ROUTING)))
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   392
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   393
      moreHeader = false;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   394
      ipv6Header.SetNextHeader (Ipv6Header::IPV6_EXT_FRAGMENTATION);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   395
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   396
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   397
  std::list<std::pair<Ipv6ExtensionHeader *, uint8_t> > unfragmentablePart;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   398
  uint32_t unfragmentablePartSize = 0;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   399
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   400
  Ptr<Ipv6ExtensionDemux> extensionDemux = GetNode ()->GetObject<Ipv6ExtensionDemux> ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   401
  Ptr<Ipv6Extension> extension = extensionDemux->GetExtension (nextHeader);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   402
  uint8_t extensionHeaderLength;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   403
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   404
  while (moreHeader) 
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   405
    {
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   406
      if (nextHeader == Ipv6Header::IPV6_EXT_HOP_BY_HOP) 
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   407
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   408
          Ipv6ExtensionHopByHopHeader *hopbyhopHeader = new Ipv6ExtensionHopByHopHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   409
          p->RemoveHeader (*hopbyhopHeader);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   410
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   411
          nextHeader = hopbyhopHeader->GetNextHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   412
          extensionHeaderLength = hopbyhopHeader->GetLength ();
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   413
6552
e1a18247fa9c fix some indentation
Andrey Mazo <mazo@iitp.ru>
parents: 6549
diff changeset
   414
          uint8_t type;
e1a18247fa9c fix some indentation
Andrey Mazo <mazo@iitp.ru>
parents: 6549
diff changeset
   415
          p->CopyData (&type, sizeof(type));
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   416
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   417
          if (!(nextHeader == Ipv6Header::IPV6_EXT_HOP_BY_HOP || nextHeader == Ipv6Header::IPV6_EXT_ROUTING
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   418
                || (nextHeader == Ipv6Header::IPV6_EXT_DESTINATION && type == Ipv6Header::IPV6_EXT_ROUTING)))
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   419
            {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   420
              moreHeader = false;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   421
              hopbyhopHeader->SetNextHeader (Ipv6Header::IPV6_EXT_FRAGMENTATION);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   422
            }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   423
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   424
          unfragmentablePart.push_back (std::make_pair<Ipv6ExtensionHeader *, uint8_t> (hopbyhopHeader, Ipv6Header::IPV6_EXT_HOP_BY_HOP));
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   425
          unfragmentablePartSize += extensionHeaderLength;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   426
        }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   427
      else if (nextHeader == Ipv6Header::IPV6_EXT_ROUTING) 
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   428
        {
6552
e1a18247fa9c fix some indentation
Andrey Mazo <mazo@iitp.ru>
parents: 6549
diff changeset
   429
          uint8_t buf[2];
e1a18247fa9c fix some indentation
Andrey Mazo <mazo@iitp.ru>
parents: 6549
diff changeset
   430
          p->CopyData (buf, sizeof(buf));
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   431
          uint8_t numberAddress = buf[1] / 2;
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   432
          Ipv6ExtensionLooseRoutingHeader *routingHeader = new Ipv6ExtensionLooseRoutingHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   433
          routingHeader->SetNumberAddress (numberAddress);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   434
          p->RemoveHeader (*routingHeader);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   435
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   436
          nextHeader = routingHeader->GetNextHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   437
          extensionHeaderLength = routingHeader->GetLength ();
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   438
6552
e1a18247fa9c fix some indentation
Andrey Mazo <mazo@iitp.ru>
parents: 6549
diff changeset
   439
          uint8_t type;
e1a18247fa9c fix some indentation
Andrey Mazo <mazo@iitp.ru>
parents: 6549
diff changeset
   440
          p->CopyData (&type, sizeof(type));
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   441
          if (!(nextHeader == Ipv6Header::IPV6_EXT_HOP_BY_HOP || nextHeader == Ipv6Header::IPV6_EXT_ROUTING
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   442
                || (nextHeader == Ipv6Header::IPV6_EXT_DESTINATION && type == Ipv6Header::IPV6_EXT_ROUTING)))
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   443
            {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   444
              moreHeader = false;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   445
              routingHeader->SetNextHeader (Ipv6Header::IPV6_EXT_FRAGMENTATION);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   446
            }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   447
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   448
          unfragmentablePart.push_back (std::make_pair<Ipv6ExtensionHeader *, uint8_t> (routingHeader, Ipv6Header::IPV6_EXT_ROUTING));
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   449
          unfragmentablePartSize += extensionHeaderLength;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   450
        }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   451
      else if (nextHeader == Ipv6Header::IPV6_EXT_DESTINATION) 
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   452
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   453
          Ipv6ExtensionDestinationHeader *destinationHeader = new Ipv6ExtensionDestinationHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   454
          p->RemoveHeader (*destinationHeader);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   455
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   456
          nextHeader = destinationHeader->GetNextHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   457
          extensionHeaderLength = destinationHeader->GetLength ();
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   458
6552
e1a18247fa9c fix some indentation
Andrey Mazo <mazo@iitp.ru>
parents: 6549
diff changeset
   459
          uint8_t type;
e1a18247fa9c fix some indentation
Andrey Mazo <mazo@iitp.ru>
parents: 6549
diff changeset
   460
          p->CopyData (&type, sizeof(type));
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   461
          if (!(nextHeader == Ipv6Header::IPV6_EXT_HOP_BY_HOP || nextHeader == Ipv6Header::IPV6_EXT_ROUTING 
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   462
                || (nextHeader == Ipv6Header::IPV6_EXT_DESTINATION && type == Ipv6Header::IPV6_EXT_ROUTING)))
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   463
            {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   464
              moreHeader = false;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   465
              destinationHeader->SetNextHeader (Ipv6Header::IPV6_EXT_FRAGMENTATION);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   466
            }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   467
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   468
          unfragmentablePart.push_back (std::make_pair<Ipv6ExtensionHeader *, uint8_t> (destinationHeader, Ipv6Header::IPV6_EXT_DESTINATION));
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   469
          unfragmentablePartSize += extensionHeaderLength;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   470
        }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   471
    }
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   472
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   473
  Ipv6ExtensionFragmentHeader fragmentHeader;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   474
  uint8_t fragmentHeaderSize = fragmentHeader.GetSerializedSize ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   475
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   476
  uint32_t maxFragmentablePartSize = maxFragmentSize - ipv6HeaderSize - unfragmentablePartSize - fragmentHeaderSize;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   477
  uint32_t currentFragmentablePartSize = 0;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   478
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   479
  bool moreFragment = true;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   480
  UniformVariable uvar;
5790
4917b74101f0 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5789
diff changeset
   481
  uint32_t identification = (uint32_t) uvar.GetValue (0, (uint32_t)-1);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   482
  uint16_t offset = 0;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   483
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   484
  do 
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   485
    {
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   486
      if (p->GetSize () > offset + maxFragmentablePartSize)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   487
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   488
          moreFragment = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   489
          currentFragmentablePartSize = maxFragmentablePartSize;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   490
        }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   491
      else 
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   492
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   493
          moreFragment = false;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   494
          currentFragmentablePartSize = p->GetSize () - offset;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   495
        }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   496
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   497
      currentFragmentablePartSize -= currentFragmentablePartSize % 8;
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   498
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   499
      fragmentHeader.SetNextHeader (nextHeader);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   500
      fragmentHeader.SetLength (currentFragmentablePartSize);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   501
      fragmentHeader.SetOffset (offset);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   502
      fragmentHeader.SetMoreFragment (moreFragment);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   503
      fragmentHeader.SetIdentification (identification);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   504
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   505
      Ptr<Packet> fragment = p->CreateFragment (offset, currentFragmentablePartSize);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   506
      offset += currentFragmentablePartSize;
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   507
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   508
      fragment->AddHeader (fragmentHeader);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   509
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   510
      for (std::list<std::pair<Ipv6ExtensionHeader *, uint8_t> >::iterator it = unfragmentablePart.begin (); it != unfragmentablePart.end (); it++)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   511
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   512
          if (it->second == Ipv6Header::IPV6_EXT_HOP_BY_HOP)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   513
            {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   514
              fragment->AddHeader (*dynamic_cast<Ipv6ExtensionHopByHopHeader *>(it->first));
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   515
            }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   516
          else if (it->second == Ipv6Header::IPV6_EXT_ROUTING)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   517
            {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   518
              fragment->AddHeader (*dynamic_cast<Ipv6ExtensionLooseRoutingHeader *>(it->first));
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   519
            }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   520
          else if (it->second == Ipv6Header::IPV6_EXT_DESTINATION)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   521
            {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   522
              fragment->AddHeader (*dynamic_cast<Ipv6ExtensionDestinationHeader *>(it->first));
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   523
            }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   524
        }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   525
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   526
      ipv6Header.SetPayloadLength (fragment->GetSize ());
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   527
      fragment->AddHeader (ipv6Header);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   528
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   529
      std::ostringstream oss;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   530
      fragment->Print (oss);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   531
      listFragments.push_back (fragment);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   532
    } while (moreFragment);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   533
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   534
  for (std::list<std::pair<Ipv6ExtensionHeader *, uint8_t> >::iterator it = unfragmentablePart.begin (); it != unfragmentablePart.end (); it++)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   535
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   536
      delete it->first;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   537
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   538
5790
4917b74101f0 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5789
diff changeset
   539
  unfragmentablePart.clear ();
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   540
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   541
5805
db141a163ef3 Merge with ns-3-dev and fix doxygen.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5802
diff changeset
   542
Ipv6ExtensionFragment::Fragments::Fragments ()
5891
09a575cdf8db Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5862
diff changeset
   543
  : m_moreFragment (0)
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   544
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   545
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   546
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   547
Ipv6ExtensionFragment::Fragments::~Fragments ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   548
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   549
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   550
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   551
void Ipv6ExtensionFragment::Fragments::AddFragment (Ptr<Packet> fragment, uint16_t fragmentOffset, bool moreFragment)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   552
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   553
  std::list<std::pair<Ptr<Packet>, uint16_t> >::iterator it;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   554
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   555
  for (it = m_fragments.begin (); it != m_fragments.end (); it++)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   556
    {
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   557
      if (it->second > fragmentOffset)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   558
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   559
          break;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   560
        }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   561
    }
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   562
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   563
  if (it == m_fragments.end ())
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   564
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   565
      m_moreFragment = moreFragment;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   566
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   567
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   568
  m_fragments.insert (it, std::make_pair<Ptr<Packet>, uint16_t> (fragment, fragmentOffset));
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   569
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   570
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   571
void Ipv6ExtensionFragment::Fragments::SetUnfragmentablePart (Ptr<Packet> unfragmentablePart) 
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   572
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   573
  m_unfragmentable = unfragmentablePart;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   574
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   575
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   576
bool Ipv6ExtensionFragment::Fragments::IsEntire () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   577
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   578
  bool ret = !m_moreFragment && m_fragments.size () > 0;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   579
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   580
  if (ret)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   581
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   582
      uint16_t lastEndOffset = 0;
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   583
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   584
      for (std::list<std::pair<Ptr<Packet>, uint16_t> >::const_iterator it = m_fragments.begin (); it != m_fragments.end (); it++)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   585
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   586
          if (lastEndOffset != it->second)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   587
            {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   588
              ret = false;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   589
              break;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   590
            }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   591
6552
e1a18247fa9c fix some indentation
Andrey Mazo <mazo@iitp.ru>
parents: 6549
diff changeset
   592
          lastEndOffset += it->first->GetSize ();
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   593
        }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   594
    }
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   595
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   596
  return ret;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   597
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   598
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   599
Ptr<Packet> Ipv6ExtensionFragment::Fragments::GetPacket () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   600
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   601
  Ptr<Packet> p =  m_unfragmentable->Copy ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   602
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   603
  for (std::list<std::pair<Ptr<Packet>, uint16_t> >::const_iterator it = m_fragments.begin (); it != m_fragments.end (); it++)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   604
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   605
      p->AddAtEnd (it->first);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   606
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   607
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   608
  return p;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   609
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   610
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   611
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   612
NS_OBJECT_ENSURE_REGISTERED (Ipv6ExtensionRouting);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   613
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   614
TypeId Ipv6ExtensionRouting::GetTypeId ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   615
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   616
  static TypeId tid = TypeId ("ns3::Ipv6ExtensionRouting")
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   617
    .SetParent<Ipv6Extension> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   618
    .AddConstructor<Ipv6ExtensionRouting> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   619
    ;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   620
  return tid;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   621
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   622
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   623
Ipv6ExtensionRouting::Ipv6ExtensionRouting ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   624
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   625
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   626
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   627
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   628
Ipv6ExtensionRouting::~Ipv6ExtensionRouting ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   629
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   630
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   631
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   632
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   633
uint8_t Ipv6ExtensionRouting::GetExtensionNumber () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   634
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   635
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   636
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   637
  return EXT_NUMBER;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   638
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   639
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   640
uint8_t Ipv6ExtensionRouting::GetTypeRouting () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   641
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   642
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   643
  return 0;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   644
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   645
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   646
uint8_t Ipv6ExtensionRouting::Process (Ptr<Packet>& packet, uint8_t offset, Ipv6Header const& ipv6Header, Ipv6Address dst, uint8_t *nextHeader, bool& isDropped)
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   647
{
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   648
  NS_LOG_FUNCTION (this << packet << offset << ipv6Header << dst << nextHeader << isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   649
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   650
  // For ICMPv6 Error Packets
5790
4917b74101f0 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5789
diff changeset
   651
  Ptr<Packet> malformedPacket = packet->Copy ();
4917b74101f0 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5789
diff changeset
   652
  malformedPacket->AddHeader (ipv6Header);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   653
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   654
  Ptr<Packet> p = packet->Copy ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   655
  p->RemoveAtStart (offset);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   656
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   657
  uint8_t buf[4];
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   658
  packet->CopyData(buf, sizeof(buf));
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   659
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   660
  uint8_t routingNextHeader = buf[0];
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   661
  uint8_t routingLength = buf[1];
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   662
  uint8_t routingTypeRouting = buf[2];
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   663
  uint8_t routingSegmentsLeft = buf[3];
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   664
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   665
  if (nextHeader)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   666
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   667
      *nextHeader = routingNextHeader; 
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   668
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   669
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   670
  Ptr<Icmpv6L4Protocol> icmpv6 = GetNode ()->GetObject<Ipv6L3Protocol> ()->GetIcmpv6 ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   671
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   672
  Ptr<Ipv6ExtensionRoutingDemux> ipv6ExtensionRoutingDemux = GetNode ()->GetObject<Ipv6ExtensionRoutingDemux> ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   673
  Ptr<Ipv6ExtensionRouting> ipv6ExtensionRouting = ipv6ExtensionRoutingDemux->GetExtensionRouting (routingTypeRouting);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   674
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   675
  if (ipv6ExtensionRouting == 0)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   676
    {
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   677
      if (routingSegmentsLeft == 0)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   678
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   679
          isDropped = false;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   680
        }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   681
      else
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   682
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   683
          NS_LOG_LOGIC ("Malformed header. Drop!");
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   684
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   685
          icmpv6->SendErrorParameterError (malformedPacket, ipv6Header.GetSourceAddress (), Icmpv6Header::ICMPV6_MALFORMED_HEADER, offset + 1);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   686
          m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   687
          isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   688
        }
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   689
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   690
      return routingLength;
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   691
    }
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   692
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   693
  return ipv6ExtensionRouting->Process (packet, offset, ipv6Header, dst, (uint8_t *)0, isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   694
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   695
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   696
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   697
NS_OBJECT_ENSURE_REGISTERED (Ipv6ExtensionRoutingDemux);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   698
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   699
TypeId Ipv6ExtensionRoutingDemux::GetTypeId ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   700
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   701
  static TypeId tid = TypeId ("ns3::Ipv6ExtensionRoutingDemux")
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   702
    .SetParent<Object> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   703
    .AddAttribute ("Routing Extensions", "The set of IPv6 Routing extensions registered with this demux.",
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   704
                   ObjectVectorValue (),
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   705
                   MakeObjectVectorAccessor (&Ipv6ExtensionRoutingDemux::m_extensionsRouting),
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   706
                   MakeObjectVectorChecker<Ipv6ExtensionRouting> ())
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   707
    ;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   708
  return tid;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   709
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   710
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   711
Ipv6ExtensionRoutingDemux::Ipv6ExtensionRoutingDemux ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   712
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   713
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   714
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   715
Ipv6ExtensionRoutingDemux::~Ipv6ExtensionRoutingDemux ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   716
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   717
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   718
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   719
void Ipv6ExtensionRoutingDemux::DoDispose ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   720
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   721
  for (Ipv6ExtensionRoutingList_t::iterator it = m_extensionsRouting.begin (); it != m_extensionsRouting.end (); it++)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   722
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   723
      (*it)->Dispose ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   724
      *it = 0;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   725
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   726
  m_extensionsRouting.clear ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   727
  m_node = 0;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   728
  Object::DoDispose ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   729
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   730
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   731
void Ipv6ExtensionRoutingDemux::SetNode (Ptr<Node> node)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   732
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   733
  m_node = node;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   734
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   735
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   736
void Ipv6ExtensionRoutingDemux::Insert (Ptr<Ipv6ExtensionRouting> extensionRouting)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   737
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   738
  m_extensionsRouting.push_back (extensionRouting);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   739
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   740
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   741
Ptr<Ipv6ExtensionRouting> Ipv6ExtensionRoutingDemux::GetExtensionRouting (uint8_t typeRouting)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   742
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   743
  for (Ipv6ExtensionRoutingList_t::iterator i = m_extensionsRouting.begin (); i != m_extensionsRouting.end (); i++)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   744
    {
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   745
      if ((*i)->GetTypeRouting () == typeRouting)
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   746
        {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   747
          return *i;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   748
        }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   749
    }
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   750
  return 0;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   751
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   752
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   753
void Ipv6ExtensionRoutingDemux::Remove (Ptr<Ipv6ExtensionRouting> extensionRouting)
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   754
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   755
  m_extensionsRouting.remove (extensionRouting);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   756
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   757
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   758
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   759
NS_OBJECT_ENSURE_REGISTERED (Ipv6ExtensionLooseRouting);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   760
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   761
TypeId Ipv6ExtensionLooseRouting::GetTypeId ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   762
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   763
  static TypeId tid = TypeId ("ns3::Ipv6ExtensionLooseRouting")
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   764
    .SetParent<Ipv6ExtensionRouting> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   765
    .AddConstructor<Ipv6ExtensionLooseRouting> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   766
    ;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   767
  return tid;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   768
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   769
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   770
Ipv6ExtensionLooseRouting::Ipv6ExtensionLooseRouting ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   771
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   772
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   773
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   774
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   775
Ipv6ExtensionLooseRouting::~Ipv6ExtensionLooseRouting ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   776
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   777
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   778
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   779
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   780
uint8_t Ipv6ExtensionLooseRouting::GetTypeRouting () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   781
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   782
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   783
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   784
  return TYPE_ROUTING;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   785
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   786
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   787
uint8_t Ipv6ExtensionLooseRouting::Process (Ptr<Packet>& packet, uint8_t offset, Ipv6Header const& ipv6Header, Ipv6Address dst, uint8_t *nextHeader, bool& isDropped)
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   788
{
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   789
  NS_LOG_FUNCTION (this << packet << offset << ipv6Header << dst << nextHeader << isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   790
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   791
  // For ICMPv6 Error packets
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   792
  Ptr<Packet> malformedPacket = packet->Copy ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   793
  malformedPacket->AddHeader (ipv6Header);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   794
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   795
  Ptr<Packet> p = packet->Copy ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   796
  p->RemoveAtStart (offset);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   797
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   798
  // Copy IPv6 Header : ipv6Header -> ipv6header
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   799
  Buffer tmp;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   800
  tmp.AddAtStart (ipv6Header.GetSerializedSize ());
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   801
  Buffer::Iterator it = tmp.Begin ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   802
  Ipv6Header ipv6header;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   803
  ipv6Header.Serialize (it);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   804
  ipv6header.Deserialize (it);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   805
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   806
  // Get the number of routers' address field
6549
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   807
  uint8_t buf[2];
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   808
  p->CopyData (buf, sizeof(buf));
487146fc889e get rid of about a zillion PeekData
Craig Dowell <craigdo@ee.washington.edu>
parents: 5891
diff changeset
   809
  uint8_t numberAddress = buf[1] / 2;
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   810
  Ipv6ExtensionLooseRoutingHeader routingHeader;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   811
  routingHeader.SetNumberAddress (numberAddress);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   812
  p->RemoveHeader (routingHeader);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   813
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   814
  if (nextHeader)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   815
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   816
      *nextHeader = routingHeader.GetNextHeader ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   817
    }
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   818
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   819
  Ptr<Icmpv6L4Protocol> icmpv6 = GetNode ()->GetObject<Ipv6L3Protocol> ()->GetIcmpv6 ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   820
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   821
  Ipv6Address srcAddress = ipv6header.GetSourceAddress ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   822
  Ipv6Address destAddress = ipv6header.GetDestinationAddress ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   823
  uint8_t hopLimit = ipv6header.GetHopLimit ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   824
  uint8_t segmentsLeft = routingHeader.GetSegmentsLeft ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   825
  uint8_t length = (routingHeader.GetLength () >> 3) - 1;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   826
  uint8_t nbAddress = length / 2;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   827
  uint8_t nextAddressIndex;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   828
  Ipv6Address nextAddress;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   829
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   830
  if (segmentsLeft == 0)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   831
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   832
      isDropped = false;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   833
      return routingHeader.GetSerializedSize ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   834
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   835
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   836
  if (length % 2 != 0)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   837
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   838
      NS_LOG_LOGIC ("Malformed header. Drop!");
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   839
      icmpv6->SendErrorParameterError (malformedPacket, srcAddress, Icmpv6Header::ICMPV6_MALFORMED_HEADER, offset + 1);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   840
      m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   841
      isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   842
      return routingHeader.GetSerializedSize ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   843
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   844
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   845
  if (segmentsLeft > nbAddress)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   846
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   847
      NS_LOG_LOGIC ("Malformed header. Drop!");
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   848
      icmpv6->SendErrorParameterError (malformedPacket, srcAddress, Icmpv6Header::ICMPV6_MALFORMED_HEADER, offset + 3);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   849
      m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   850
      isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   851
      return routingHeader.GetSerializedSize ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   852
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   853
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   854
  routingHeader.SetSegmentsLeft (segmentsLeft - 1);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   855
  nextAddressIndex = nbAddress - segmentsLeft;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   856
  nextAddress = routingHeader.GetRouterAddress (nextAddressIndex);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   857
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   858
  if (nextAddress.IsMulticast () || destAddress.IsMulticast ()) 
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   859
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   860
      m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   861
      isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   862
      return routingHeader.GetSerializedSize ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   863
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   864
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   865
  routingHeader.SetRouterAddress (nextAddressIndex, destAddress);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   866
  ipv6header.SetDestinationAddress (nextAddress);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   867
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   868
  if (hopLimit <= 1)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   869
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   870
      NS_LOG_LOGIC ("Time Exceeded : Hop Limit <= 1. Drop!");
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   871
      icmpv6->SendErrorTimeExceeded (malformedPacket, srcAddress, Icmpv6Header::ICMPV6_HOPLIMIT);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   872
      m_dropTrace (packet);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   873
      isDropped = true;
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   874
      return routingHeader.GetSerializedSize ();
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   875
    }
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   876
5790
4917b74101f0 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5789
diff changeset
   877
  routingHeader.SetLength (88);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   878
  ipv6header.SetHopLimit (hopLimit - 1);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   879
  p->AddHeader (routingHeader);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   880
5796
cd4576c14476 Update.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5793
diff changeset
   881
  /* short-circuiting routing stuff 
cd4576c14476 Update.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5793
diff changeset
   882
   * 
cd4576c14476 Update.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5793
diff changeset
   883
   * If we process this option,
cd4576c14476 Update.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5793
diff changeset
   884
   * the packet was for us so we resend it to 
cd4576c14476 Update.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5793
diff changeset
   885
   * the new destination (modified in the header above).
5793
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
   886
   */
5802
e93f45bb4bdf Merge with Fabian's repository.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5800 5801
diff changeset
   887
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   888
  Ptr<Ipv6L3Protocol> ipv6 = GetNode ()->GetObject<Ipv6L3Protocol> ();
5793
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
   889
  Ptr<Ipv6RoutingProtocol> ipv6rp = ipv6->GetRoutingProtocol ();
5800
082bd197b99a Use RouteOutput instead of getting Ipv6StaticRouting and call LookupStatic.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5796
diff changeset
   890
  Socket::SocketErrno err;
082bd197b99a Use RouteOutput instead of getting Ipv6StaticRouting and call LookupStatic.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5796
diff changeset
   891
  NS_ASSERT (ipv6rp);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   892
5800
082bd197b99a Use RouteOutput instead of getting Ipv6StaticRouting and call LookupStatic.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5796
diff changeset
   893
  Ptr<Ipv6Route> rtentry = ipv6rp->RouteOutput (p, ipv6header, 0, err);
5793
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
   894
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
   895
  if (rtentry)
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   896
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   897
      /* we know a route exists so send packet now */
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   898
      ipv6->SendRealOut (rtentry, p, ipv6header);
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   899
    }
5793
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
   900
  else
5809
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   901
    {
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   902
      NS_LOG_INFO ("No route for next router");
597070be3549 Coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5805
diff changeset
   903
    }
5793
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
   904
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
   905
  /* as we directly send packet, mark it as dropped */
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
   906
  isDropped = true; 
da33f0c8ade4 Routing type 0 support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5790
diff changeset
   907
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   908
  return routingHeader.GetSerializedSize ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   909
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   910
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   911
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   912
NS_OBJECT_ENSURE_REGISTERED (Ipv6ExtensionESP);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   913
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   914
TypeId Ipv6ExtensionESP::GetTypeId ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   915
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   916
  static TypeId tid = TypeId ("ns3::Ipv6ExtensionESP")
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   917
    .SetParent<Ipv6Extension> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   918
    .AddConstructor<Ipv6ExtensionESP> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   919
    ;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   920
  return tid;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   921
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   922
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   923
Ipv6ExtensionESP::Ipv6ExtensionESP ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   924
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   925
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   926
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   927
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   928
Ipv6ExtensionESP::~Ipv6ExtensionESP ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   929
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   930
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   931
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   932
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   933
uint8_t Ipv6ExtensionESP::GetExtensionNumber () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   934
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   935
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   936
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   937
  return EXT_NUMBER;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   938
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   939
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   940
uint8_t Ipv6ExtensionESP::Process (Ptr<Packet>& packet, uint8_t offset, Ipv6Header const& ipv6Header, Ipv6Address dst, uint8_t *nextHeader, bool& isDropped)
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   941
{
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   942
  NS_LOG_FUNCTION (this << packet << offset << ipv6Header << dst << nextHeader << isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   943
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   944
  /* TODO */
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   945
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   946
  return 0;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   947
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   948
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   949
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   950
NS_OBJECT_ENSURE_REGISTERED (Ipv6ExtensionAH);
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   951
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   952
TypeId Ipv6ExtensionAH::GetTypeId ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   953
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   954
  static TypeId tid = TypeId ("ns3::Ipv6ExtensionAH")
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   955
    .SetParent<Ipv6Extension> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   956
    .AddConstructor<Ipv6ExtensionAH> ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   957
    ;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   958
  return tid;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   959
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   960
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   961
Ipv6ExtensionAH::Ipv6ExtensionAH ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   962
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   963
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   964
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   965
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   966
Ipv6ExtensionAH::~Ipv6ExtensionAH ()
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   967
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   968
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   969
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   970
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   971
uint8_t Ipv6ExtensionAH::GetExtensionNumber () const
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   972
{
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   973
  NS_LOG_FUNCTION_NOARGS ();
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   974
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   975
  return EXT_NUMBER;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   976
}
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   977
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   978
uint8_t Ipv6ExtensionAH::Process (Ptr<Packet>& packet, uint8_t offset, Ipv6Header const& ipv6Header, Ipv6Address dst, uint8_t *nextHeader, bool& isDropped)
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   979
{
5784
512909f442f7 More on IPv6 extensions support.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 5782
diff changeset
   980
  NS_LOG_FUNCTION (this << packet << offset << ipv6Header << dst << nextHeader << isDropped);
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   981
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   982
  /* TODO */
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   983
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   984
  return true;
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   985
}
5785
5d433b13a9c1 IPv6 Fragmentation support.
Sebastien Vincent <sebastien.vincent@turnserver.org>
parents: 5784
diff changeset
   986
5782
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   987
} /* namespace ns3 */
f5299c974f1b Add IPv6 extension files from old ns-3-ipv6 repository (not working yet).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff changeset
   988