Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(226)

Unified Diff: src/routing/click/ipv4-external-routing.h

Issue 1690056: NS-3 Click Integration Code Review (Closed)
Patch Set: Full Patch Set Created 13 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/routing/click/ipv4-click-routing-test.cc ('k') | src/routing/click/ipv4-external-routing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/routing/click/ipv4-external-routing.h
===================================================================
new file mode 100644
--- /dev/null
+++ b/src/routing/click/ipv4-external-routing.h
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 Lalith Suresh
+ *
+ * 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
+ *
+ * Authors: Lalith Suresh <suresh.lalith@gmail.com>
+ */
+
+#ifndef __IPV4_EXTERNAL_ROUTING_H__
+#define __IPV4_EXTERNAL_ROUTING_H__
+
+#include "ns3/mac48-address.h"
+#include "ns3/ipv4-routing-protocol.h"
+#include "ns3/ipv4-route.h"
+#include "ns3/ipv4.h"
+
+namespace ns3 {
+
+/**
+* \ingroup click
+* \brief Generic routing class for External Routers like Click.
+* This class enforces the use of Send() and Receive() methods
+* for external routers.
+*/
+
+class Ipv4ExternalRouting : public Ipv4RoutingProtocol
+{
+public:
+ static TypeId GetTypeId (void);
+
+ Ipv4ExternalRouting ();
+ virtual ~Ipv4ExternalRouting ();
+
+public:
+ /**
+ * \brief Receive a packet from L2. To be implemented by subclass.
+ * \param packet Packet to be received.
+ * \param receiverAddr Receiving interface's Address.
+ * \param dest Destination Address.
+ */
+ virtual void Receive (Ptr<Packet> packet, Mac48Address receiverAddr, Mac48Address dest) = 0;
+
+ /**
+ * \brief Send a packet down from L4. To be implemented by subclass.
+ * \param packet Packet to be sent.
+ * \param src Source interface's Address.
+ * \param dest Destination Address.
+ */
+ virtual void Send (Ptr<Packet> packet, Ipv4Address src, Ipv4Address dest) = 0;
+
+ // Methods from Ipv4RoutingProtocol
+ virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
+ virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
+ UnicastForwardCallback ucb, MulticastForwardCallback mcb,
+ LocalDeliverCallback lcb, ErrorCallback ecb);
+ virtual void NotifyInterfaceUp (uint32_t interface);
+ virtual void NotifyInterfaceDown (uint32_t interface);
+ virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
+ virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
+ virtual void SetIpv4 (Ptr<Ipv4> ipv4) = 0;
+};
+
+/**
+* \ingroup click
+* \brief Generic class for External Routers from original nsclick.
+*/
+class ExtRouter
+{
+public:
+ enum {
+ IFID_NONE = -1,
+ IFID_KERNELTAP = 0,
+ IFID_FIRSTIF = 1,
+ IFID_LASTIF = 32,
+ IFID_FIRSTIFDROP = 33,
+ IFID_LASTIFDROP = 64
+ };
+ virtual ~ExtRouter();
+};
+
+
+} // namespace ns3
+
+#endif // __IPV4_EXTERNAL_ROUTING_H__
« no previous file with comments | « src/routing/click/ipv4-click-routing-test.cc ('k') | src/routing/click/ipv4-external-routing.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b