Files
unison/src/internet-stack/arp-l3-protocol.h

100 lines
2.8 KiB
C
Raw Normal View History

2007-02-12 15:55:49 +01:00
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
2007-06-04 18:25:43 +02:00
#ifndef ARP_L3_PROTOCOL_H
#define ARP_L3_PROTOCOL_H
2007-02-12 15:55:49 +01:00
#include <list>
2007-05-04 15:04:07 +02:00
#include "ns3/ipv4-address.h"
2007-07-26 17:36:53 +02:00
#include "ns3/address.h"
#include "ns3/ptr.h"
2008-05-25 14:58:22 -07:00
#include "ns3/traced-callback.h"
2007-02-12 15:55:49 +01:00
#include "ipv4-interface.h"
2007-02-12 15:55:49 +01:00
namespace ns3 {
class ArpCache;
class NetDevice;
2007-06-04 16:17:01 +02:00
class Node;
2007-02-12 15:55:49 +01:00
class Packet;
2007-05-16 16:39:32 -04:00
/**
2008-09-12 16:12:58 -07:00
* \ingroup internetStack
* \defgroup arp Arp
*
* This is an overview of Arp capabilities (write me).
*/
/**
* \ingroup arp
2007-05-16 16:39:32 -04:00
* \brief An implementation of the ARP protocol
*/
class ArpL3Protocol : public Object
2007-02-12 15:55:49 +01:00
{
public:
2008-01-15 12:43:07 +01:00
static TypeId GetTypeId (void);
2007-02-17 09:35:50 +01:00
static const uint16_t PROT_NUMBER;
2008-03-12 09:31:50 -07:00
2008-02-27 19:44:22 +01:00
ArpL3Protocol ();
virtual ~ArpL3Protocol ();
2008-03-11 13:30:12 -07:00
void SetNode (Ptr<Node> node);
Ptr<ArpCache> CreateCache (Ptr<NetDevice> device, Ptr<Ipv4Interface> interface);
2007-05-16 16:39:32 -04:00
/**
2008-07-30 06:30:42 -07:00
* \brief Receive a packet
2007-05-16 16:39:32 -04:00
*/
2008-08-25 09:13:05 -07:00
void Receive(Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from, const Address &to,
NetDevice::PacketType packetType);
2007-05-16 16:39:32 -04:00
/**
* \brief Perform an ARP lookup
* \param p
* \param destination
* \param device
2008-05-30 10:38:59 -07:00
* \param cache
2007-05-16 16:39:32 -04:00
* \param hardwareDestination
* \return
*/
bool Lookup (Ptr<Packet> p, Ipv4Address destination,
Ptr<NetDevice> device,
Ptr<ArpCache> cache,
2007-07-26 17:36:53 +02:00
Address *hardwareDestination);
2007-05-03 12:33:08 +02:00
protected:
virtual void DoDispose (void);
/*
* This function will notify other components connected to the node that a new stack member is now connected
* This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
*/
virtual void NotifyNewAggregate ();
2007-02-12 15:55:49 +01:00
private:
2008-05-25 10:27:34 -07:00
typedef std::list<Ptr<ArpCache> > CacheList;
Ptr<ArpCache> FindCache (Ptr<NetDevice> device);
void SendArpRequest (Ptr<const ArpCache>cache, Ipv4Address to);
void SendArpReply (Ptr<const ArpCache> cache, Ipv4Address toIp, Address toMac);
2007-02-12 15:55:49 +01:00
CacheList m_cacheList;
2007-06-04 16:17:01 +02:00
Ptr<Node> m_node;
2008-05-25 14:58:22 -07:00
TracedCallback<Ptr<const Packet> > m_dropTrace;
2007-02-12 15:55:49 +01:00
};
}//namespace ns3
2007-06-04 18:25:43 +02:00
#endif /* ARP_L3_PROTOCOL_H */