author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 14 May 2007 10:06:12 +0200 | |
changeset 607 | 1b7abeccfcda |
parent 568 | e1660959ecbb |
child 632 | 1e419ebb4012 |
permissions | -rw-r--r-- |
242 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2006 INRIA |
|
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
20 |
*/ |
|
21 |
#ifndef ARP_H |
|
22 |
#define ARP_H |
|
23 |
||
24 |
#include <list> |
|
524
082ffdd8fbd7
move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
513
diff
changeset
|
25 |
#include "ns3/ipv4-address.h" |
082ffdd8fbd7
move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
513
diff
changeset
|
26 |
#include "ns3/mac-address.h" |
552
b5f29caf9d8c
convert Arp code to use Ptr<Node> instead of Node *
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
551
diff
changeset
|
27 |
#include "ns3/ptr.h" |
294
aba9a34108d2
remove ArpL3Protocol object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
242
diff
changeset
|
28 |
#include "l3-protocol.h" |
242 | 29 |
|
30 |
namespace ns3 { |
|
31 |
||
32 |
class ArpCache; |
|
33 |
class NetDevice; |
|
607
1b7abeccfcda
rename Node to INode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
568
diff
changeset
|
34 |
class INode; |
242 | 35 |
class Packet; |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
294
diff
changeset
|
36 |
class TraceResolver; |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
294
diff
changeset
|
37 |
class TraceContext; |
242 | 38 |
|
294
aba9a34108d2
remove ArpL3Protocol object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
242
diff
changeset
|
39 |
class Arp : public L3Protocol |
242 | 40 |
{ |
41 |
public: |
|
294
aba9a34108d2
remove ArpL3Protocol object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
242
diff
changeset
|
42 |
static const uint16_t PROT_NUMBER; |
aba9a34108d2
remove ArpL3Protocol object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
242
diff
changeset
|
43 |
|
607
1b7abeccfcda
rename Node to INode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
568
diff
changeset
|
44 |
Arp (Ptr<INode> node); |
242 | 45 |
~Arp (); |
46 |
||
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
294
diff
changeset
|
47 |
virtual TraceResolver *CreateTraceResolver (TraceContext const &context); |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
294
diff
changeset
|
48 |
|
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
552
diff
changeset
|
49 |
virtual void Receive(Packet& p, Ptr<NetDevice> device); |
242 | 50 |
bool Lookup (Packet &p, Ipv4Address destination, |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
552
diff
changeset
|
51 |
Ptr<NetDevice> device, |
242 | 52 |
MacAddress *hardwareDestination); |
513
b7c7ea629de9
make L3Demux an NsUnknown object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
504
diff
changeset
|
53 |
protected: |
b7c7ea629de9
make L3Demux an NsUnknown object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
504
diff
changeset
|
54 |
virtual void DoDispose (void); |
242 | 55 |
private: |
56 |
typedef std::list<ArpCache *> CacheList; |
|
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
552
diff
changeset
|
57 |
ArpCache *FindCache (Ptr<NetDevice> device); |
242 | 58 |
void SendArpRequest (ArpCache const *cache, Ipv4Address to); |
59 |
void SendArpReply (ArpCache const *cache, Ipv4Address toIp, MacAddress toMac); |
|
60 |
CacheList m_cacheList; |
|
607
1b7abeccfcda
rename Node to INode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
568
diff
changeset
|
61 |
Ptr<INode> m_node; |
242 | 62 |
}; |
63 |
||
64 |
}//namespace ns3 |
|
65 |
||
66 |
||
67 |
#endif /* ARP_H */ |