src/node/l3-protocol.h
changeset 234 6124bda39cb3
child 236 5673656dc2e7
equal deleted inserted replaced
233:6b60d7b27ae4 234:6124bda39cb3
       
     1 // -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
       
     2 //
       
     3 // Copyright (c) 2006 Georgia Tech Research Corporation
       
     4 // All rights reserved.
       
     5 //
       
     6 // This program is free software; you can redistribute it and/or modify
       
     7 // it under the terms of the GNU General Public License version 2 as
       
     8 // published by the Free Software Foundation;
       
     9 //
       
    10 // This program is distributed in the hope that it will be useful,
       
    11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13 // GNU General Public License for more details.
       
    14 //
       
    15 // You should have received a copy of the GNU General Public License
       
    16 // along with this program; if not, write to the Free Software
       
    17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    18 //
       
    19 // Author: George F. Riley<riley@ece.gatech.edu>
       
    20 //
       
    21 
       
    22 // NS3 - Layer 3 Protocol base class
       
    23 // George F. Riley, Georgia Tech, Spring 2007
       
    24 
       
    25 #ifndef L3_PROTOCOL_H
       
    26 #define L3_PROTOCOL_H
       
    27 
       
    28 namespace ns3 {
       
    29 
       
    30 class Packet;
       
    31 class NetDevice;
       
    32 
       
    33 
       
    34 /**
       
    35  * ::Send is always defined in subclasses.
       
    36  */
       
    37 class L3Protocol {
       
    38 public:
       
    39   L3Protocol(int protocolNumber, int version);
       
    40   virtual ~L3Protocol ();
       
    41     
       
    42   int GetProtocolNumber (void) const;
       
    43   int GetVersion() const;
       
    44 
       
    45   virtual L3Protocol* Copy() const = 0;
       
    46   /**
       
    47    * Lower layer calls this method after calling L3Demux::Lookup
       
    48    * The ARP subclass needs to know from which NetDevice this
       
    49    * packet is coming to:
       
    50    *    - implement a per-NetDevice ARP cache
       
    51    *    - send back arp replies on the right device
       
    52    */
       
    53   virtual void Receive(Packet& p, NetDevice &device) = 0;
       
    54 
       
    55  private:
       
    56   int m_protocolNumber;
       
    57   int m_version;
       
    58 };
       
    59 
       
    60 } // Namespace ns3
       
    61 
       
    62 #endif