1 // -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- |
|
2 // |
|
3 // Copyright (c) 2006 Georgia Tech Research Corporation |
|
4 // |
|
5 // This program is free software; you can redistribute it and/or modify |
|
6 // it under the terms of the GNU General Public License version 2 as |
|
7 // published by the Free Software Foundation; |
|
8 // |
|
9 // This program is distributed in the hope that it will be useful, |
|
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 // GNU General Public License for more details. |
|
13 // |
|
14 // You should have received a copy of the GNU General Public License |
|
15 // along with this program; if not, write to the Free Software |
|
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 // |
|
18 // Author: George F. Riley<riley@ece.gatech.edu> |
|
19 // |
|
20 |
|
21 // NS3 - Layer 4 Protocol base class |
|
22 // George F. Riley, Georgia Tech, Spring 2007 |
|
23 |
|
24 #ifndef IPV4_L4_PROTOCOL_H |
|
25 #define IPV4_L4_PROTOCOL_H |
|
26 |
|
27 #include "ns3/object.h" |
|
28 #include "ipv4-interface.h" |
|
29 |
|
30 namespace ns3 { |
|
31 |
|
32 class Packet; |
|
33 class Ipv4Address; |
|
34 |
|
35 /** |
|
36 * \brief L4 Protocol base class |
|
37 * |
|
38 * If you want to implement a new L4 protocol, all you have to do is |
|
39 * implement a subclass of this base class and add it to an L4Demux. |
|
40 */ |
|
41 class Ipv4L4Protocol : public Object |
|
42 { |
|
43 public: |
|
44 static TypeId GetTypeId (void); |
|
45 |
|
46 virtual ~Ipv4L4Protocol (); |
|
47 |
|
48 /** |
|
49 * \returns the protocol number of this protocol. |
|
50 */ |
|
51 virtual int GetProtocolNumber (void) const = 0; |
|
52 /** |
|
53 * \returns the version number of this protocol. |
|
54 */ |
|
55 virtual int GetVersion (void) const = 0; |
|
56 |
|
57 /** |
|
58 * \param p packet to forward up |
|
59 * \param source source address of packet received |
|
60 * \param destination address of packet received |
|
61 * \param incomingInterface the Ipv4Interface on which the packet arrived |
|
62 * |
|
63 * Called from lower-level layers to send the packet up |
|
64 * in the stack. |
|
65 */ |
|
66 virtual void Receive(Ptr<Packet> p, |
|
67 Ipv4Address const &source, |
|
68 Ipv4Address const &destination, |
|
69 Ptr<Ipv4Interface> incomingInterface) = 0; |
|
70 }; |
|
71 |
|
72 } // Namespace ns3 |
|
73 |
|
74 #endif |
|