1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
3 * Copyright (c) 2006 INRIA
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;
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.
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
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20 #ifndef ARP_L3_PROTOCOL_H
21 #define ARP_L3_PROTOCOL_H
24 #include "ns3/ipv4-address.h"
25 #include "ns3/address.h"
27 #include "ns3/traced-callback.h"
29 #include "ipv4-interface.h"
39 * \ingroup internetStack
42 * This is an overview of Arp capabilities (write me).
46 * \brief An implementation of the ARP protocol
48 class ArpL3Protocol : public Object
51 static TypeId GetTypeId (void);
52 static const uint16_t PROT_NUMBER;
55 virtual ~ArpL3Protocol ();
57 void SetNode (Ptr<Node> node);
59 Ptr<ArpCache> CreateCache (Ptr<NetDevice> device, Ptr<Ipv4Interface> interface);
62 * \brief Receive a packet
64 void Receive(Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from, const Address &to,
65 NetDevice::PacketType packetType);
67 * \brief Perform an ARP lookup
72 * \param hardwareDestination
75 bool Lookup (Ptr<Packet> p, Ipv4Address destination,
76 Ptr<NetDevice> device,
78 Address *hardwareDestination);
80 virtual void DoDispose (void);
82 * This function will notify other components connected to the node that a new stack member is now connected
83 * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
85 virtual void NotifyNewAggregate ();
87 typedef std::list<Ptr<ArpCache> > CacheList;
88 Ptr<ArpCache> FindCache (Ptr<NetDevice> device);
89 void SendArpRequest (Ptr<const ArpCache>cache, Ipv4Address to);
90 void SendArpReply (Ptr<const ArpCache> cache, Ipv4Address myIp, Ipv4Address toIp, Address toMac);
91 CacheList m_cacheList;
93 TracedCallback<Ptr<const Packet> > m_dropTrace;
99 #endif /* ARP_L3_PROTOCOL_H */