Skip to content

Commit

Permalink
IPv4/IPv6: renamed IPvXAddress to Address, RoutingTable to IPv4Routin…
Browse files Browse the repository at this point in the history
…gTable, etc.

IPvXAddress          -> Address
IPvXAddressResolver  -> AddressResolver
IRoutingTable        -> IIPv4RoutingTable
RoutingTable         -> IPv4RoutingTable
RoutingTable6        -> IPv6RoutingTable
RoutingTableAccess   -> IPv4RoutingTableAccess
  • Loading branch information
ZoltanBojthe committed Sep 27, 2013
1 parent 92dee2a commit 5f200f5
Show file tree
Hide file tree
Showing 220 changed files with 1,108 additions and 1,114 deletions.
4 changes: 2 additions & 2 deletions examples/bgpv4/BGPOpen/BGPRouterSimple.ned
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package inet.examples.bgpv4.BGPOpen;
import inet.util.MessageChecker;
import inet.transport.ITCP;
import inet.nodes.inet.NetworkLayer;
import inet.networklayer.ipv4.RoutingTable;
import inet.networklayer.ipv4.IPv4RoutingTable;
import inet.networklayer.common.InterfaceTable;
import inet.networklayer.bgpv4.BGPRouting;
import inet.linklayer.IWiredNic;
Expand Down Expand Up @@ -48,7 +48,7 @@ module BGPRouterSimple
parameters:
@display("p=52,108;i=block/table_s");
}
routingTable: RoutingTable {
routingTable: IPv4RoutingTable {
parameters:
IPForward = true;
routerId = "auto";
Expand Down
4 changes: 2 additions & 2 deletions examples/bgpv4/BGPUpdate/BGPRouter.ned
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import inet.util.MessageChecker;
import inet.transport.ITCP;
import inet.nodes.inet.NetworkLayer;
import inet.networklayer.ospfv2.OSPFRouting;
import inet.networklayer.ipv4.RoutingTable;
import inet.networklayer.ipv4.IPv4RoutingTable;
import inet.networklayer.common.InterfaceTable;
import inet.networklayer.bgpv4.BGPRouting;
import inet.linklayer.IWiredNic;
Expand Down Expand Up @@ -51,7 +51,7 @@ module BGPRouter
parameters:
@display("p=52,108;i=block/table_s");
}
routingTable: RoutingTable {
routingTable: IPv4RoutingTable {
parameters:
IPForward = true;
routerId = "auto";
Expand Down
4 changes: 2 additions & 2 deletions examples/traci/Car.ned
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import inet.networklayer.autorouting.ipv4.HostAutoConfigurator;
import inet.networklayer.common.InterfaceTable;
import inet.applications.traci.TraCIDemo;
import inet.mobility.models.TraCIMobility;
import inet.networklayer.ipv4.RoutingTable;
import inet.networklayer.ipv4.IPv4RoutingTable;
import inet.transport.udp.UDP;
import inet.nodes.inet.NetworkLayer;
import inet.linklayer.ieee80211.Ieee80211Nic;
Expand Down Expand Up @@ -58,7 +58,7 @@ module Car
parameters:
@display("p=60,459");
}
routingTable: RoutingTable {
routingTable: IPv4RoutingTable {
parameters:
IPForward = true;
routerId = "";
Expand Down
4 changes: 2 additions & 2 deletions examples/traci_launchd/Car.ned
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import inet.networklayer.autorouting.ipv4.HostAutoConfigurator;
import inet.networklayer.common.InterfaceTable;
import inet.applications.traci.TraCIDemo;
import inet.mobility.models.TraCIMobility;
import inet.networklayer.ipv4.RoutingTable;
import inet.networklayer.ipv4.IPv4RoutingTable;
import inet.transport.udp.UDP;
import inet.nodes.inet.NetworkLayer;
import inet.linklayer.ieee80211.Ieee80211Nic;
Expand Down Expand Up @@ -58,7 +58,7 @@ module Car
parameters:
@display("p=60,459");
}
routingTable: RoutingTable {
routingTable: IPv4RoutingTable {
parameters:
IPForward = true;
routerId = "";
Expand Down
6 changes: 3 additions & 3 deletions src/applications/dhcp/DHCPClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include "ModuleAccess.h"
#include "NodeStatus.h"
#include "NotifierConsts.h"
#include "RoutingTableAccess.h"
#include "NodeOperations.h"
#include "IPv4RoutingTableAccess.h"

Define_Module(DHCPClient);

Expand Down Expand Up @@ -102,7 +102,7 @@ void DHCPClient::initialize(int stage)
}

// get the routing table to update and subscribe it to the blackboard
irt = RoutingTableAccess().get();
irt = IPv4RoutingTableAccess().get();

// grab the interface mac address
client_mac_address = ie->getMacAddress();
Expand Down Expand Up @@ -600,7 +600,7 @@ cModule *DHCPClient::getContainingNode()
}

// Overwrite the sendToUDP in order to add the interface to use to allow the packet be routed by the IP stack
void DHCPClient::sendToUDP(cPacket *msg, int srcPort, const IPvXAddress& destAddr, int destPort)
void DHCPClient::sendToUDP(cPacket *msg, int srcPort, const Address& destAddr, int destPort)
{

EV << "Sending packet: ";
Expand Down
6 changes: 3 additions & 3 deletions src/applications/dhcp/DHCPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "DHCP_m.h"
#include "DHCPLease.h"
#include "InterfaceTable.h"
#include "RoutingTable.h"
#include "IPv4RoutingTable.h"
#include "UDPSocket.h"
#include "INotifiable.h"
#include "ILifecycle.h"
Expand Down Expand Up @@ -66,7 +66,7 @@ class INET_API DHCPClient : public cSimpleModule, public INotifiable, public ILi

NotificationBoard* nb; // Notification board
InterfaceEntry* ie; // interface to configure
IRoutingTable* irt; // Routing table to update
IIPv4RoutingTable* irt; // Routing table to update

DHCPLease* lease; // leased ip information

Expand All @@ -83,7 +83,7 @@ class INET_API DHCPClient : public cSimpleModule, public INotifiable, public ILi
virtual void handleDHCPMessage(DHCPMessage* msg);
virtual void receiveChangeNotification(int category, const cPolymorphic *details);
virtual cModule* getContainingNode();
virtual void sendToUDP(cPacket *msg, int srcPort, const IPvXAddress& destAddr, int destPort);
virtual void sendToUDP(cPacket *msg, int srcPort, const Address& destAddr, int destPort);

// internal client methods
virtual void changeFSMState(CLIENT_STATE new_state);
Expand Down
4 changes: 2 additions & 2 deletions src/applications/dhcp/DHCPServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <algorithm>
#include "UDPControlInfo_m.h"
#include "IPvXAddressResolver.h"
#include "AddressResolver.h"
#include "InterfaceTableAccess.h"
#include "InterfaceTable.h"
#include "IPv4InterfaceData.h"
Expand Down Expand Up @@ -403,7 +403,7 @@ DHCPLease* DHCPServer::getAvailableLease()
return (NULL);
}

void DHCPServer::sendToUDP(cPacket *msg, int srcPort, const IPvXAddress& destAddr, int destPort)
void DHCPServer::sendToUDP(cPacket *msg, int srcPort, const Address& destAddr, int destPort)
{
// Overwrite the sendToUDP in order to add the interface to use to allow the packet be routed by the IP stack
msg->setKind(UDP_C_DATA);
Expand Down
4 changes: 2 additions & 2 deletions src/applications/dhcp/DHCPServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ class INET_API DHCPServer : public cSimpleModule, public INotifiable, public ILi
virtual void processPacket(DHCPMessage *packet);
virtual void sendOffer(DHCPLease* lease);
virtual void sendACK(DHCPLease* lease);
virtual void sendToUDP(cPacket *msg, int srcPort, const IPvXAddress& destAddr, int destPort);
virtual void receiveChangeNotification(int category, const cPolymorphic *details);
virtual void sendToUDP(cPacket *msg, int srcPort, const Address& destAddr, int destPort);

public:
DHCPServer();
virtual ~DHCPServer();

virtual bool handleOperationStage(LifecycleOperation *operation, int stage, IDoneCallback *doneCallback);
virtual void receiveChangeNotification(int category, const cPolymorphic *details);
};

#endif
Expand Down
14 changes: 7 additions & 7 deletions src/applications/generic/IPvXTrafGen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "ModuleAccess.h"
#include "NodeOperations.h"
#include "IPvXAddressResolver.h"
#include "AddressResolver.h"
#include "IPv4ControlInfo.h"
#include "IPv6ControlInfo.h"

Expand Down Expand Up @@ -87,8 +87,8 @@ void IPvXTrafGen::handleMessage(cMessage *msg)
const char *token;
while ((token = tokenizer.nextToken()) != NULL)
{
IPvXAddress result;
IPvXAddressResolver().tryResolve(token, result);
Address result;
AddressResolver().tryResolve(token, result);
if (result.isUnspecified())
EV << "cannot resolve destination address: " << token << endl;
else
Expand Down Expand Up @@ -164,7 +164,7 @@ bool IPvXTrafGen::isEnabled()
return (numPackets == -1 || numSent < numPackets);
}

IPvXAddress IPvXTrafGen::chooseDestAddr()
Address IPvXTrafGen::chooseDestAddr()
{
int k = intrand(destAddresses.size());
return destAddresses[k];
Expand All @@ -178,14 +178,14 @@ void IPvXTrafGen::sendPacket()
cPacket *payload = new cPacket(msgName);
payload->setByteLength(packetLengthPar->longValue());

IPvXAddress destAddr = chooseDestAddr();
Address destAddr = chooseDestAddr();
const char *gate;

if (!destAddr.isIPv6())
{
// send to IPv4
IPv4ControlInfo *controlInfo = new IPv4ControlInfo();
controlInfo->setDestAddr(destAddr.get4());
controlInfo->setDestAddr(destAddr.toIPv4());
controlInfo->setProtocol(protocol);
payload->setControlInfo(controlInfo);
gate = "ipOut";
Expand All @@ -194,7 +194,7 @@ void IPvXTrafGen::sendPacket()
{
// send to IPv6
IPv6ControlInfo *controlInfo = new IPv6ControlInfo();
controlInfo->setDestAddr(destAddr.get6());
controlInfo->setDestAddr(destAddr.toIPv6());
controlInfo->setProtocol(protocol);
payload->setControlInfo(controlInfo);
gate = "ipv6Out";
Expand Down
6 changes: 3 additions & 3 deletions src/applications/generic/IPvXTrafGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "INETDefs.h"

#include "IPvXAddress.h"
#include "Address.h"
#include "IPvXTrafSink.h"
#include "ILifecycle.h"
#include "NodeStatus.h"
Expand All @@ -41,7 +41,7 @@ class INET_API IPvXTrafGen : public IPvXTrafSink
int numPackets;
simtime_t startTime;
simtime_t stopTime;
std::vector<IPvXAddress> destAddresses;
std::vector<Address> destAddresses;
cPar *sendIntervalPar;
cPar *packetLengthPar;
NodeStatus *nodeStatus;
Expand All @@ -61,7 +61,7 @@ class INET_API IPvXTrafGen : public IPvXTrafSink
virtual bool isEnabled();

// chooses random destination address
virtual IPvXAddress chooseDestAddr();
virtual Address chooseDestAddr();
virtual void sendPacket();

virtual int numInitStages() const {return 4;}
Expand Down
2 changes: 1 addition & 1 deletion src/applications/generic/IPvXTrafGen.ned
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package inet.applications.generic;
// If the destAddresses parameter contains more than one address, one
// of them is randomly for each packet. An address may be given in the
// dotted decimal notation (or, for IPv6, in the usual notation with colons),
// or with the module name. (The IPvXAddressResolver class is used to resolve
// or with the module name. (The AddressResolver class is used to resolve
// the address.) To disable the model, set destAddresses to "".
//
// The peer can be ~IPvXTrafSink or another ~IPvXTrafGen (it handles received packets
Expand Down
4 changes: 2 additions & 2 deletions src/applications/generic/IPvXTrafSink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "IPvXTrafGen.h"

#include "IPvXAddressResolver.h"
#include "AddressResolver.h"
#include "IPv4ControlInfo.h"
#include "IPv6ControlInfo.h"
#include "ModuleAccess.h"
Expand Down Expand Up @@ -75,7 +75,7 @@ bool IPvXTrafSink::handleOperationStage(LifecycleOperation *operation, int stage

void IPvXTrafSink::printPacket(cPacket *msg)
{
IPvXAddress src, dest;
Address src, dest;
int protocol = -1;

if (dynamic_cast<IPv4ControlInfo *>(msg->getControlInfo()) != NULL)
Expand Down
2 changes: 1 addition & 1 deletion src/applications/generic/IPvXTrafSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <vector>

#include "INETDefs.h"
#include "IPvXAddress.h"
#include "Address.h"
#include "ILifecycle.h"


Expand Down
2 changes: 1 addition & 1 deletion src/applications/httptools/HttpBrowser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void HttpBrowser::submitToSocket(const char* moduleName, int connectPort, HttpRe
socket->setCallbackObject(this, sockdata);

// Issue a connect to the socket for the specified module and port.
socket->connect(IPvXAddressResolver().resolve(moduleName), connectPort);
socket->connect(AddressResolver().resolve(moduleName), connectPort);
}


2 changes: 1 addition & 1 deletion src/applications/httptools/HttpBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "TCPSocket.h"
#include "TCPSocketMap.h"
#include "IPvXAddressResolver.h"
#include "AddressResolver.h"
#include "HttpBrowserBase.h"


Expand Down
20 changes: 10 additions & 10 deletions src/applications/pingapp/PingApp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "PingApp.h"

#include "IPvXAddressResolver.h"
#include "AddressResolver.h"
#include "PingPayload_m.h"
#include "IPv4ControlInfo.h"
#include "IPv6ControlInfo.h"
Expand Down Expand Up @@ -156,7 +156,7 @@ void PingApp::stopSendingPingRequests()
pid = -1;
lastStart = -1;
sendSeqNo = expectedReplySeqNo = 0;
srcAddr = destAddr = IPvXAddress();
srcAddr = destAddr = Address();
cancelNextPingRequest();
}

Expand Down Expand Up @@ -190,8 +190,8 @@ void PingApp::sendPingRequest()
{
if (destAddr.isUnspecified())
{
srcAddr = IPvXAddressResolver().resolve(par("srcAddr"));
destAddr = IPvXAddressResolver().resolve(par("destAddr"));
srcAddr = AddressResolver().resolve(par("srcAddr"));
destAddr = AddressResolver().resolve(par("destAddr"));
EV << "Starting up: destination = " << destAddr << " source = " << srcAddr << "\n";
}

Expand Down Expand Up @@ -219,14 +219,14 @@ void PingApp::sendPingRequest()
sentCount++;
}

void PingApp::sendToICMP(cMessage *msg, const IPvXAddress& destAddr, const IPvXAddress& srcAddr, int hopLimit)
void PingApp::sendToICMP(cMessage *msg, const Address& destAddr, const Address& srcAddr, int hopLimit)
{
if (!destAddr.isIPv6())
{
// send to IPv4
IPv4ControlInfo *ctrl = new IPv4ControlInfo();
ctrl->setSrcAddr(srcAddr.get4());
ctrl->setDestAddr(destAddr.get4());
ctrl->setSrcAddr(srcAddr.toIPv4());
ctrl->setDestAddr(destAddr.toIPv4());
ctrl->setTimeToLive(hopLimit);
msg->setControlInfo(ctrl);
send(msg, "pingOut");
Expand All @@ -235,8 +235,8 @@ void PingApp::sendToICMP(cMessage *msg, const IPvXAddress& destAddr, const IPvXA
{
// send to IPv6
IPv6ControlInfo *ctrl = new IPv6ControlInfo();
ctrl->setSrcAddr(srcAddr.get6());
ctrl->setDestAddr(destAddr.get6());
ctrl->setSrcAddr(srcAddr.toIPv6());
ctrl->setDestAddr(destAddr.toIPv6());
ctrl->setHopLimit(hopLimit);
msg->setControlInfo(ctrl);
send(msg, "pingv6Out");
Expand Down Expand Up @@ -266,7 +266,7 @@ void PingApp::processPingResponse(PingPayload *msg)
}

// get src, hopCount etc from packet, and print them
IPvXAddress src, dest;
Address src, dest;
int msgHopCount = -1;
if (dynamic_cast<IPv4ControlInfo *>(msg->getControlInfo()) != NULL)
{
Expand Down
8 changes: 4 additions & 4 deletions src/applications/pingapp/PingApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include "INETDefs.h"

#include "IPvXAddress.h"
#include "Address.h"
#include "ILifecycle.h"
#include "NodeStatus.h"

Expand Down Expand Up @@ -54,14 +54,14 @@ class INET_API PingApp : public cSimpleModule, public ILifecycle
virtual bool isNodeUp();
virtual bool isEnabled();
virtual void sendPingRequest();
virtual void sendToICMP(cMessage *payload, const IPvXAddress& destAddr, const IPvXAddress& srcAddr, int hopLimit);
virtual void sendToICMP(cMessage *payload, const Address& destAddr, const Address& srcAddr, int hopLimit);
virtual void processPingResponse(PingPayload *msg);
virtual void countPingResponse(int bytes, long seqNo, simtime_t rtt);

protected:
// configuration
IPvXAddress destAddr;
IPvXAddress srcAddr;
Address destAddr;
Address srcAddr;
int packetSize;
cPar *sendIntervalPar;
int hopLimit;
Expand Down
Loading

0 comments on commit 5f200f5

Please sign in to comment.