From 5f200f552219bfc22a13ad6238755e440db7e425 Mon Sep 17 00:00:00 2001 From: Zoltan Bojthe Date: Thu, 25 Jul 2013 15:48:14 +0200 Subject: [PATCH] IPv4/IPv6: renamed IPvXAddress to Address, RoutingTable to IPv4RoutingTable, etc. IPvXAddress -> Address IPvXAddressResolver -> AddressResolver IRoutingTable -> IIPv4RoutingTable RoutingTable -> IPv4RoutingTable RoutingTable6 -> IPv6RoutingTable RoutingTableAccess -> IPv4RoutingTableAccess --- examples/bgpv4/BGPOpen/BGPRouterSimple.ned | 4 +- examples/bgpv4/BGPUpdate/BGPRouter.ned | 4 +- examples/traci/Car.ned | 4 +- examples/traci_launchd/Car.ned | 4 +- src/applications/dhcp/DHCPClient.cc | 6 +- src/applications/dhcp/DHCPClient.h | 6 +- src/applications/dhcp/DHCPServer.cc | 4 +- src/applications/dhcp/DHCPServer.h | 4 +- src/applications/generic/IPvXTrafGen.cc | 14 +-- src/applications/generic/IPvXTrafGen.h | 6 +- src/applications/generic/IPvXTrafGen.ned | 2 +- src/applications/generic/IPvXTrafSink.cc | 4 +- src/applications/generic/IPvXTrafSink.h | 2 +- src/applications/httptools/HttpBrowser.cc | 2 +- src/applications/httptools/HttpBrowser.h | 2 +- src/applications/pingapp/PingApp.cc | 20 ++-- src/applications/pingapp/PingApp.h | 8 +- src/applications/pingapp/PingApp.ned | 2 +- src/applications/pingapp/PingTestApp.cc | 26 ++--- src/applications/pingapp/PingTestApp.h | 13 +-- src/applications/rtpapp/RTPApplication.cc | 6 +- src/applications/rtpapp/RTPApplication.ned | 2 +- src/applications/sctpapp/SCTPClient.cc | 14 +-- src/applications/sctpapp/SCTPClient.h | 6 +- src/applications/sctpapp/SCTPPeer.cc | 6 +- src/applications/sctpapp/SCTPPeer.h | 4 +- src/applications/sctpapp/SCTPServer.cc | 4 +- src/applications/tcpapp/TCPEchoApp.cc | 2 +- .../tcpapp/TCPGenericCliAppBase.cc | 8 +- src/applications/tcpapp/TCPGenericSrvApp.cc | 4 +- src/applications/tcpapp/TCPSessionApp.cc | 6 +- src/applications/tcpapp/TCPSinkApp.cc | 4 +- src/applications/tcpapp/TCPSrvHostApp.cc | 4 +- src/applications/udpapp/UDPBasicApp.cc | 12 +- src/applications/udpapp/UDPBasicApp.h | 4 +- src/applications/udpapp/UDPBasicApp.ned | 2 +- src/applications/udpapp/UDPBasicBurst.cc | 22 ++-- src/applications/udpapp/UDPBasicBurst.h | 6 +- src/applications/udpapp/UDPBasicBurst.ned | 2 +- src/applications/udpapp/UDPEchoApp.cc | 2 +- src/applications/udpapp/UDPVideoStreamCli.cc | 4 +- src/applications/udpapp/UDPVideoStreamSvr.h | 2 +- src/applications/voip/SimpleVoIPReceiver.h | 2 +- src/applications/voip/SimpleVoIPSender.cc | 2 +- src/applications/voip/SimpleVoIPSender.h | 4 +- .../voipstream/VoIPStreamReceiver.h | 6 +- .../voipstream/VoIPStreamSender.cc | 2 +- .../voipstream/VoIPStreamSender.h | 4 +- src/base/InterfaceOperations.cc | 4 +- src/base/LifecycleController.cc | 2 +- src/base/ModuleAccess.h | 2 +- src/base/NotificationBoard.ned | 2 +- src/inet-doc.ned | 20 ++-- src/inet-index.ned | 4 +- src/networklayer/arp/ARP.cc | 6 +- src/networklayer/arp/ARP.h | 5 +- src/networklayer/arp/ARP.ned | 2 +- .../ipv4/FlatNetworkConfigurator.cc | 14 +-- .../ipv4/FlatNetworkConfigurator.h | 4 +- .../ipv4/FlatNetworkConfigurator.ned | 4 +- .../autorouting/ipv4/HostAutoConfigurator.cc | 8 +- .../ipv4/IPv4NetworkConfigurator.cc | 31 ++--- .../ipv4/IPv4NetworkConfigurator.h | 12 +- .../ipv4/IPv4NetworkConfigurator.ned | 6 +- .../autorouting/ipv4/IPv4NodeConfigurator.cc | 4 +- .../autorouting/ipv4/IPv4NodeConfigurator.h | 4 +- .../ipv6/FlatNetworkConfigurator6.cc | 26 ++--- src/networklayer/bgpv4/BGPFSM.cc | 2 +- src/networklayer/bgpv4/BGPRouting.cc | 13 +-- src/networklayer/bgpv4/BGPRouting.h | 12 +- src/networklayer/bgpv4/BGPRoutingTableEntry.h | 2 +- src/networklayer/bgpv4/BGPSession.cc | 2 +- src/networklayer/bgpv4/BGPSession.h | 2 +- src/networklayer/common/InterfaceTable.h | 2 +- src/networklayer/common/InterfaceTable.ned | 2 +- .../contract/{IPvXAddress.cc => Address.cc} | 8 +- .../contract/{IPvXAddress.h => Address.h} | 54 ++++----- ...XAddressResolver.cc => AddressResolver.cc} | 110 +++++++++--------- ...PvXAddressResolver.h => AddressResolver.h} | 54 ++++----- .../diffserv/BehaviorAggregateClassifier.cc | 4 +- .../diffserv/MultiFieldClassifier.cc | 14 +-- .../diffserv/MultiFieldClassifier.h | 4 +- src/networklayer/icmpv6/ICMPv6.ned | 2 +- .../icmpv6/IPv6NeighbourDiscovery.cc | 4 +- .../icmpv6/IPv6NeighbourDiscovery.h | 4 +- .../icmpv6/IPv6NeighbourDiscovery.ned | 2 +- src/networklayer/ipv4/ICMP.h | 4 +- src/networklayer/ipv4/IGMPv2.cc | 4 +- src/networklayer/ipv4/IGMPv2.h | 4 +- .../{IRoutingTable.h => IIPv4RoutingTable.h} | 12 +- src/networklayer/ipv4/IPv4.cc | 4 +- src/networklayer/ipv4/IPv4.h | 4 +- src/networklayer/ipv4/IPv4.ned | 12 +- src/networklayer/ipv4/IPv4Route.cc | 2 +- src/networklayer/ipv4/IPv4Route.h | 22 ++-- .../{RoutingTable.cc => IPv4RoutingTable.cc} | 94 +++++++-------- .../{RoutingTable.h => IPv4RoutingTable.h} | 8 +- ...{RoutingTable.ned => IPv4RoutingTable.ned} | 2 +- ...TableAccess.h => IPv4RoutingTableAccess.h} | 8 +- src/networklayer/ipv4/NetworkInfo.cc | 6 +- src/networklayer/ipv4/RoutingTableParser.cc | 2 +- src/networklayer/ipv4/RoutingTableParser.h | 6 +- src/networklayer/ipv4/RoutingTableRecorder.cc | 4 +- src/networklayer/ipv4/RoutingTableRecorder.h | 4 +- .../ipv4/RoutingTableRecorder.ned | 2 +- src/networklayer/ipv6/IPv6.cc | 5 +- src/networklayer/ipv6/IPv6.h | 4 +- src/networklayer/ipv6/IPv6.ned | 10 +- src/networklayer/ipv6/IPv6InterfaceData.cc | 6 +- src/networklayer/ipv6/IPv6InterfaceData.h | 4 +- .../{RoutingTable6.cc => IPv6RoutingTable.cc} | 86 +++++++------- .../{RoutingTable6.h => IPv6RoutingTable.h} | 16 +-- ...RoutingTable6.ned => IPv6RoutingTable.ned} | 2 +- ...able6Access.h => IPv6RoutingTableAccess.h} | 8 +- .../ipv6tunneling/IPv6Tunneling.cc | 4 +- .../ipv6tunneling/IPv6Tunneling.h | 4 +- src/networklayer/ldp/LDP.cc | 8 +- src/networklayer/ldp/LDP.h | 4 +- .../manetrouting/aodv/aodv-uu/aodv_socket.cc | 4 - .../manetrouting/aodv/aodv_msg_struct.cc | 2 +- .../manetrouting/aodv/aodv_uu_omnet.cc | 6 +- .../manetrouting/base/ManetAddress.cc | 28 ++--- .../manetrouting/base/ManetAddress.h | 16 +-- .../manetrouting/base/ManetRoutingBase.cc | 4 +- .../manetrouting/base/ManetRoutingBase.h | 6 +- .../manetrouting/batman/BatmanMain.cc | 10 +- src/networklayer/manetrouting/dsdv/DSDV_2.cc | 6 +- src/networklayer/manetrouting/dsdv/DSDV_2.h | 8 +- .../manetrouting/dsr/dsr-uu-omnetpp.cc | 2 +- .../manetrouting/dsr/dsr-uu-omnetpp.h | 6 +- .../manetrouting/dymo/dymo_um_omnet.cc | 6 +- src/networklayer/manetrouting/dymo_fau/DYMO.h | 4 +- .../manetrouting/dymo_fau/DYMO_DataQueue.h | 4 +- .../manetrouting/dymo_fau/DYMO_RoutingEntry.h | 2 +- .../dymo_fau/DYMO_RoutingTable.cc | 4 +- .../manetrouting/dymo_fau/DYMO_RoutingTable.h | 2 +- .../manetrouting/dymo_fau/DYMO_TokenBucket.h | 4 +- src/networklayer/manetrouting/olsr/OLSR.cc | 2 +- src/networklayer/manetrouting/olsr/OLSROPT.cc | 2 +- .../manetrouting/olsr/OLSR_ETX.cc | 2 +- src/networklayer/mpls/LIBTable.cc | 6 +- src/networklayer/mpls/MPLS.cc | 2 +- src/networklayer/ospfv2/OSPFConfigReader.cc | 4 +- src/networklayer/ospfv2/OSPFConfigReader.h | 2 +- src/networklayer/ospfv2/OSPFRouting.cc | 4 +- src/networklayer/ospfv2/OSPFRouting.h | 2 +- src/networklayer/ospfv2/router/OSPFRouter.cc | 12 +- .../ospfv2/router/OSPFRoutingTableEntry.cc | 6 +- .../ospfv2/router/OSPFRoutingTableEntry.h | 2 +- src/networklayer/ospfv2/router/OSPFcommon.h | 6 +- src/networklayer/rsvp_te/RSVP.cc | 10 +- src/networklayer/rsvp_te/RSVP.h | 4 +- src/networklayer/rsvp_te/SimpleClassifier.cc | 6 +- src/networklayer/ted/LinkStateRouting.cc | 4 +- src/networklayer/ted/LinkStateRouting.h | 2 +- src/networklayer/ted/TED.cc | 6 +- src/networklayer/ted/TED.h | 4 +- src/networklayer/xmipv6/xMIPv6.cc | 4 +- src/networklayer/xmipv6/xMIPv6.h | 4 +- src/nodes/inet/NodeBase.ned | 4 +- src/nodes/internetcloud/InternetCloud.ned | 4 +- src/nodes/ipv6/NodeBase6.ned | 4 +- src/nodes/mpls/LDP_LSR.ned | 4 +- src/nodes/mpls/RSVP_LSR.ned | 4 +- src/nodes/ospfv2/OSPFRouter.ned | 2 +- src/transport/contract/SCTPCommand.msg | 26 ++--- src/transport/contract/SCTPSocket.cc | 10 +- src/transport/contract/SCTPSocket.h | 22 ++-- src/transport/contract/TCPCommand.msg | 16 +-- src/transport/contract/TCPSocket.cc | 6 +- src/transport/contract/TCPSocket.h | 16 +-- src/transport/contract/UDPControlInfo.msg | 22 ++-- src/transport/contract/UDPSocket.cc | 18 +-- src/transport/contract/UDPSocket.h | 16 +-- src/transport/rtp/RTP.cc | 4 +- src/transport/rtp/RTP.h | 3 +- src/transport/sctp/SCTP.cc | 34 +++--- src/transport/sctp/SCTP.h | 26 ++--- src/transport/sctp/SCTPAssociation.h | 56 ++++----- src/transport/sctp/SCTPAssociationAddIP.cc | 22 ++-- src/transport/sctp/SCTPAssociationBase.cc | 22 ++-- .../sctp/SCTPAssociationEventProc.cc | 8 +- .../sctp/SCTPAssociationRcvMessage.cc | 30 ++--- src/transport/sctp/SCTPAssociationUtil.cc | 44 +++---- src/transport/sctp/SCTPMessage.msg | 52 ++++----- src/transport/sctp/SCTPQueue.cc | 4 +- src/transport/sctp/SCTPQueue.h | 6 +- src/transport/tcp/TCP.cc | 22 ++-- src/transport/tcp/TCP.h | 16 +-- src/transport/tcp/TCPConnection.h | 24 ++-- src/transport/tcp/TCPConnectionBase.cc | 2 +- src/transport/tcp/TCPConnectionEventProc.cc | 6 +- src/transport/tcp/TCPConnectionRcvSegment.cc | 8 +- src/transport/tcp/TCPConnectionUtil.cc | 22 ++-- src/transport/tcp_common/TCPSpoof.cc | 14 +-- src/transport/tcp_common/TCPSpoof.h | 4 +- src/transport/tcp_lwip/LwipTcpLayer.cc | 6 +- src/transport/tcp_lwip/LwipTcpStackIf.h | 6 +- src/transport/tcp_lwip/TCP_lwIP.cc | 26 ++--- src/transport/tcp_lwip/TCP_lwIP.h | 6 +- src/transport/tcp_lwip/TcpLwipConnection.cc | 8 +- src/transport/tcp_lwip/TcpLwipConnection.h | 6 +- .../tcp_lwip/lwip/include/ipv4/lwip/ip_addr.h | 6 +- src/transport/tcp_nsc/TCP_NSC.cc | 26 ++--- src/transport/tcp_nsc/TCP_NSC.h | 18 +-- src/transport/tcp_nsc/TCP_NSC_Connection.cc | 2 +- src/transport/tcp_nsc/TCP_NSC_Connection.h | 4 +- src/transport/udp/UDP.cc | 54 ++++----- src/transport/udp/UDP.h | 30 ++--- src/util/XMLUtils.cc | 6 +- .../headerserializers/sctp/SCTPSerializer.cc | 48 ++++---- .../headerserializers/tcp/TCPSerializer.cc | 4 +- .../headerserializers/tcp/TCPSerializer.h | 6 +- tests/misc/dlltest/SomeUDPApp.cc | 10 +- tests/misc/dlltest/SomeUDPApp.h | 4 +- tests/module/DHCP_2.test | 4 +- tests/module/UDPSocket_1.test | 4 +- tests/module/lib/TcpTestClient.cc | 4 +- tests/module/lib/TestIGMP.cc | 2 +- tests/traci/Car.ned | 4 +- 220 files changed, 1108 insertions(+), 1114 deletions(-) rename src/networklayer/contract/{IPvXAddress.cc => Address.cc} (84%) rename src/networklayer/contract/{IPvXAddress.h => Address.h} (80%) rename src/networklayer/contract/{IPvXAddressResolver.cc => AddressResolver.cc} (71%) rename src/networklayer/contract/{IPvXAddressResolver.h => AddressResolver.h} (73%) rename src/networklayer/ipv4/{IRoutingTable.h => IIPv4RoutingTable.h} (95%) rename src/networklayer/ipv4/{RoutingTable.cc => IPv4RoutingTable.cc} (90%) rename src/networklayer/ipv4/{RoutingTable.h => IPv4RoutingTable.h} (98%) rename src/networklayer/ipv4/{RoutingTable.ned => IPv4RoutingTable.ned} (99%) rename src/networklayer/ipv4/{RoutingTableAccess.h => IPv4RoutingTableAccess.h} (80%) rename src/networklayer/ipv6/{RoutingTable6.cc => IPv6RoutingTable.cc} (90%) rename src/networklayer/ipv6/{RoutingTable6.h => IPv6RoutingTable.h} (96%) rename src/networklayer/ipv6/{RoutingTable6.ned => IPv6RoutingTable.ned} (98%) rename src/networklayer/ipv6/{RoutingTable6Access.h => IPv6RoutingTableAccess.h} (79%) diff --git a/examples/bgpv4/BGPOpen/BGPRouterSimple.ned b/examples/bgpv4/BGPOpen/BGPRouterSimple.ned index 16ee7ce2dd3..048886bfe6f 100644 --- a/examples/bgpv4/BGPOpen/BGPRouterSimple.ned +++ b/examples/bgpv4/BGPOpen/BGPRouterSimple.ned @@ -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; @@ -48,7 +48,7 @@ module BGPRouterSimple parameters: @display("p=52,108;i=block/table_s"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { parameters: IPForward = true; routerId = "auto"; diff --git a/examples/bgpv4/BGPUpdate/BGPRouter.ned b/examples/bgpv4/BGPUpdate/BGPRouter.ned index 7652fbe2747..27c270efd48 100644 --- a/examples/bgpv4/BGPUpdate/BGPRouter.ned +++ b/examples/bgpv4/BGPUpdate/BGPRouter.ned @@ -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; @@ -51,7 +51,7 @@ module BGPRouter parameters: @display("p=52,108;i=block/table_s"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { parameters: IPForward = true; routerId = "auto"; diff --git a/examples/traci/Car.ned b/examples/traci/Car.ned index beec366bd1e..050df141a11 100644 --- a/examples/traci/Car.ned +++ b/examples/traci/Car.ned @@ -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; @@ -58,7 +58,7 @@ module Car parameters: @display("p=60,459"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { parameters: IPForward = true; routerId = ""; diff --git a/examples/traci_launchd/Car.ned b/examples/traci_launchd/Car.ned index 818ab3cf75c..5b6dfa789c9 100644 --- a/examples/traci_launchd/Car.ned +++ b/examples/traci_launchd/Car.ned @@ -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; @@ -58,7 +58,7 @@ module Car parameters: @display("p=60,459"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { parameters: IPForward = true; routerId = ""; diff --git a/src/applications/dhcp/DHCPClient.cc b/src/applications/dhcp/DHCPClient.cc index 30c2416c584..b5da5e8456f 100644 --- a/src/applications/dhcp/DHCPClient.cc +++ b/src/applications/dhcp/DHCPClient.cc @@ -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); @@ -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(); @@ -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: "; diff --git a/src/applications/dhcp/DHCPClient.h b/src/applications/dhcp/DHCPClient.h index c76aa4124f0..951a4f38168 100644 --- a/src/applications/dhcp/DHCPClient.h +++ b/src/applications/dhcp/DHCPClient.h @@ -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" @@ -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 @@ -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); diff --git a/src/applications/dhcp/DHCPServer.cc b/src/applications/dhcp/DHCPServer.cc index 22cb340cff8..124bd20aefb 100644 --- a/src/applications/dhcp/DHCPServer.cc +++ b/src/applications/dhcp/DHCPServer.cc @@ -19,7 +19,7 @@ #include #include "UDPControlInfo_m.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "InterfaceTableAccess.h" #include "InterfaceTable.h" #include "IPv4InterfaceData.h" @@ -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); diff --git a/src/applications/dhcp/DHCPServer.h b/src/applications/dhcp/DHCPServer.h index 609c4ccc4d8..7f45ca78f73 100644 --- a/src/applications/dhcp/DHCPServer.h +++ b/src/applications/dhcp/DHCPServer.h @@ -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 diff --git a/src/applications/generic/IPvXTrafGen.cc b/src/applications/generic/IPvXTrafGen.cc index 599711157f4..a02154f5fb8 100644 --- a/src/applications/generic/IPvXTrafGen.cc +++ b/src/applications/generic/IPvXTrafGen.cc @@ -21,7 +21,7 @@ #include "ModuleAccess.h" #include "NodeOperations.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "IPv4ControlInfo.h" #include "IPv6ControlInfo.h" @@ -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 @@ -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]; @@ -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"; @@ -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"; diff --git a/src/applications/generic/IPvXTrafGen.h b/src/applications/generic/IPvXTrafGen.h index 45dba56e25c..c71d789ea61 100644 --- a/src/applications/generic/IPvXTrafGen.h +++ b/src/applications/generic/IPvXTrafGen.h @@ -24,7 +24,7 @@ #include "INETDefs.h" -#include "IPvXAddress.h" +#include "Address.h" #include "IPvXTrafSink.h" #include "ILifecycle.h" #include "NodeStatus.h" @@ -41,7 +41,7 @@ class INET_API IPvXTrafGen : public IPvXTrafSink int numPackets; simtime_t startTime; simtime_t stopTime; - std::vector destAddresses; + std::vector
destAddresses; cPar *sendIntervalPar; cPar *packetLengthPar; NodeStatus *nodeStatus; @@ -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;} diff --git a/src/applications/generic/IPvXTrafGen.ned b/src/applications/generic/IPvXTrafGen.ned index b4e2cea121b..a9a7af30a3d 100644 --- a/src/applications/generic/IPvXTrafGen.ned +++ b/src/applications/generic/IPvXTrafGen.ned @@ -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 diff --git a/src/applications/generic/IPvXTrafSink.cc b/src/applications/generic/IPvXTrafSink.cc index 977350a3a82..4e4a8bace73 100644 --- a/src/applications/generic/IPvXTrafSink.cc +++ b/src/applications/generic/IPvXTrafSink.cc @@ -19,7 +19,7 @@ #include "IPvXTrafGen.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "IPv4ControlInfo.h" #include "IPv6ControlInfo.h" #include "ModuleAccess.h" @@ -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(msg->getControlInfo()) != NULL) diff --git a/src/applications/generic/IPvXTrafSink.h b/src/applications/generic/IPvXTrafSink.h index 6a68243f6d9..72d41b8864d 100644 --- a/src/applications/generic/IPvXTrafSink.h +++ b/src/applications/generic/IPvXTrafSink.h @@ -23,7 +23,7 @@ #include #include "INETDefs.h" -#include "IPvXAddress.h" +#include "Address.h" #include "ILifecycle.h" diff --git a/src/applications/httptools/HttpBrowser.cc b/src/applications/httptools/HttpBrowser.cc index ccf3be5f83e..2a2721a4bf8 100644 --- a/src/applications/httptools/HttpBrowser.cc +++ b/src/applications/httptools/HttpBrowser.cc @@ -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); } diff --git a/src/applications/httptools/HttpBrowser.h b/src/applications/httptools/HttpBrowser.h index f770a61a5bd..45f41f0ebe5 100644 --- a/src/applications/httptools/HttpBrowser.h +++ b/src/applications/httptools/HttpBrowser.h @@ -34,7 +34,7 @@ #include "TCPSocket.h" #include "TCPSocketMap.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "HttpBrowserBase.h" diff --git a/src/applications/pingapp/PingApp.cc b/src/applications/pingapp/PingApp.cc index f4c9e452d9b..76a40e66803 100644 --- a/src/applications/pingapp/PingApp.cc +++ b/src/applications/pingapp/PingApp.cc @@ -20,7 +20,7 @@ #include "PingApp.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "PingPayload_m.h" #include "IPv4ControlInfo.h" #include "IPv6ControlInfo.h" @@ -156,7 +156,7 @@ void PingApp::stopSendingPingRequests() pid = -1; lastStart = -1; sendSeqNo = expectedReplySeqNo = 0; - srcAddr = destAddr = IPvXAddress(); + srcAddr = destAddr = Address(); cancelNextPingRequest(); } @@ -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"; } @@ -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"); @@ -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"); @@ -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(msg->getControlInfo()) != NULL) { diff --git a/src/applications/pingapp/PingApp.h b/src/applications/pingapp/PingApp.h index b0240f84da7..bfd838fcca9 100644 --- a/src/applications/pingapp/PingApp.h +++ b/src/applications/pingapp/PingApp.h @@ -18,7 +18,7 @@ #include "INETDefs.h" -#include "IPvXAddress.h" +#include "Address.h" #include "ILifecycle.h" #include "NodeStatus.h" @@ -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; diff --git a/src/applications/pingapp/PingApp.ned b/src/applications/pingapp/PingApp.ned index 61d78a109b1..8b13165631b 100644 --- a/src/applications/pingapp/PingApp.ned +++ b/src/applications/pingapp/PingApp.ned @@ -28,7 +28,7 @@ import inet.applications.IPingApp; // Start/stop time, sendInterval etc. can be specified via parameters. 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 the address.) +// (The AddressResolver class is used to resolve the address.) // To disable send, specify empty destAddr. // // Every ping request is sent out with a sequence number, and replies are diff --git a/src/applications/pingapp/PingTestApp.cc b/src/applications/pingapp/PingTestApp.cc index d19d3660163..86bf8875c04 100644 --- a/src/applications/pingapp/PingTestApp.cc +++ b/src/applications/pingapp/PingTestApp.cc @@ -21,7 +21,7 @@ #include "InterfaceEntry.h" #include "IInterfaceTable.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "PingPayload_m.h" #ifdef WITH_IPv4 @@ -109,7 +109,7 @@ void PingTestApp::handleMessage(cMessage *msg) { if (sendSeqNo == 0) { - srcAddr = IPvXAddressResolver().resolve(par("srcAddr")); + srcAddr = AddressResolver().resolve(par("srcAddr")); const char *destAddrs = par("destAddresses"); if (!strcmp(destAddrs, "*")) { @@ -122,7 +122,7 @@ void PingTestApp::handleMessage(cMessage *msg) while ((token = tokenizer.nextToken()) != NULL) { - IPvXAddress addr = IPvXAddressResolver().resolve(token); + Address addr = AddressResolver().resolve(token); destAddresses.push_back(addr); } } @@ -157,9 +157,9 @@ void PingTestApp::handleMessage(cMessage *msg) } } -std::vector PingTestApp::getAllAddresses() +std::vector
PingTestApp::getAllAddresses() { - std::vector result; + std::vector
result; for (int i=0; i<=simulation.getLastModuleId(); i++) { @@ -176,7 +176,7 @@ std::vector PingTestApp::getAllAddresses() { IPv4Address address = ie->ipv4Data()->getIPAddress(); if (!address.isUnspecified()) - result.push_back(IPvXAddress(address)); + result.push_back(Address(address)); } #endif #ifdef WITH_IPv6 @@ -186,7 +186,7 @@ std::vector PingTestApp::getAllAddresses() { IPv6Address address = ie->ipv6Data()->getAddress(k); if (!address.isUnspecified() && address.isGlobal()) - result.push_back(IPvXAddress(address)); + result.push_back(Address(address)); } } #endif @@ -229,15 +229,15 @@ void PingTestApp::scheduleNextPing(cMessage *timer) delete timer; } -void PingTestApp::sendToICMP(cMessage *msg, const IPvXAddress& destAddr, const IPvXAddress& srcAddr, int hopLimit) +void PingTestApp::sendToICMP(cMessage *msg, const Address& destAddr, const Address& srcAddr, int hopLimit) { if (!destAddr.isIPv6()) { #ifdef WITH_IPv4 // 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"); @@ -250,8 +250,8 @@ void PingTestApp::sendToICMP(cMessage *msg, const IPvXAddress& destAddr, const I #ifdef WITH_IPv6 // 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"); @@ -264,7 +264,7 @@ void PingTestApp::sendToICMP(cMessage *msg, const IPvXAddress& destAddr, const I void PingTestApp::processPingResponse(PingPayload *msg) { // get src, hopCount etc from packet, and print them - IPvXAddress src, dest; + Address src, dest; int msgHopCount = -1; ASSERT(msg->getOriginatorId() == getId()); // ICMP module error diff --git a/src/applications/pingapp/PingTestApp.h b/src/applications/pingapp/PingTestApp.h index 6f31b328cf8..b585011617d 100644 --- a/src/applications/pingapp/PingTestApp.h +++ b/src/applications/pingapp/PingTestApp.h @@ -16,8 +16,7 @@ // #include "INETDefs.h" - -#include "IPvXAddress.h" +#include "Address.h" #include "ILifecycle.h" #include "LifecycleOperation.h" @@ -45,18 +44,18 @@ class INET_API PingTestApp : public cSimpleModule, public ILifecycle virtual void finish(); protected: - virtual std::vector getAllAddresses(); + virtual std::vector
getAllAddresses(); virtual void sendPing(); virtual void scheduleNextPing(cMessage *timer); - 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; - std::vector destAddresses; + Address destAddr; + Address srcAddr; + std::vector
destAddresses; int packetSize; cPar *sendIntervalp; int hopLimit; diff --git a/src/applications/rtpapp/RTPApplication.cc b/src/applications/rtpapp/RTPApplication.cc index 77812b8dfb1..6b25c4a0637 100644 --- a/src/applications/rtpapp/RTPApplication.cc +++ b/src/applications/rtpapp/RTPApplication.cc @@ -18,7 +18,7 @@ #include "RTPApplication.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "LifecycleOperation.h" #include "ModuleAccess.h" #include "NodeStatus.h" @@ -29,7 +29,7 @@ Define_Module(RTPApplication) void RTPApplication::initialize(int stage) { - // because of IPvXAddressResolver, we need to wait until interfaces are registered, + // because of AddressResolver, we need to wait until interfaces are registered, // address auto-assignment takes place etc. if (stage == 0) { @@ -72,7 +72,7 @@ void RTPApplication::initialize(int stage) else if (stage == 3) { // the ip address to connect to (unicast or multicast) - _destinationAddress = IPvXAddressResolver().resolve(par("destinationAddress").stringValue()).get4(); + _destinationAddress = AddressResolver().resolve(par("destinationAddress").stringValue()).toIPv4(); EV << "commonName" << _commonName << endl; EV << "profileName" << _profileName << endl; diff --git a/src/applications/rtpapp/RTPApplication.ned b/src/applications/rtpapp/RTPApplication.ned index 550e152a414..f2f95f17468 100644 --- a/src/applications/rtpapp/RTPApplication.ned +++ b/src/applications/rtpapp/RTPApplication.ned @@ -12,7 +12,7 @@ simple RTPApplication string commonName; // the common name (CNAME) of this host string profileName; // which rtp profile is to be used (usually RTPAVProfile) double bandwidth; // bandwidth in bytes per second for this session - string destinationAddress; // destination address (the IPvXAddressResolver class is used to resolve the address) + string destinationAddress; // destination address (the AddressResolver class is used to resolve the address) int portNumber; // used port string fileName; // fileName of file to be transmitted, "" means this system acts only as a receiver int payloadType; // payload type of file to transmit diff --git a/src/applications/sctpapp/SCTPClient.cc b/src/applications/sctpapp/SCTPClient.cc index 4c908ec5fa3..b661f20830e 100644 --- a/src/applications/sctpapp/SCTPClient.cc +++ b/src/applications/sctpapp/SCTPClient.cc @@ -19,7 +19,7 @@ #include "SCTPClient.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "ModuleAccess.h" #include "NodeStatus.h" #include "SCTPAssociation.h" @@ -59,7 +59,7 @@ void SCTPClient::initialize(int stage) // parameters const char *addressesString = par("localAddress"); - AddressVector addresses = IPvXAddressResolver().resolve(cStringTokenizer(addressesString).asVector()); + AddressVector addresses = AddressResolver().resolve(cStringTokenizer(addressesString).asVector()); int32 port = par("localPort"); echo = par("echo").boolValue(); ordered = par("ordered").boolValue(); @@ -145,7 +145,7 @@ void SCTPClient::connect() setStatusString("connecting"); EV << "connect to address " << connectAddress << "\n"; bool streamReset = par("streamReset"); - socket.connect(IPvXAddressResolver().resolve(connectAddress, 1), connectPort, streamReset, (int32)par("prMethod"), (uint32)par("numRequestsPerSession")); + socket.connect(AddressResolver().resolve(connectAddress, 1), connectPort, streamReset, (int32)par("prMethod"), (uint32)par("numRequestsPerSession")); if (!streamReset) streamReset = false; @@ -590,17 +590,17 @@ void SCTPClient::setPrimaryPath(const char* str) if (strcmp(str, "") != 0) { - pinfo->setRemoteAddress(IPvXAddress(str)); + pinfo->setRemoteAddress(Address(str)); } else { str = (const char*)par("newPrimary"); if (strcmp(str, "") != 0) - pinfo->setRemoteAddress(IPvXAddress(str)); + pinfo->setRemoteAddress(Address(str)); else { str = (const char*)par("connectAddress"); - pinfo->setRemoteAddress(IPvXAddress(str)); + pinfo->setRemoteAddress(Address(str)); } } @@ -673,7 +673,7 @@ void SCTPClient::sendqueueAbatedArrived(int32 assocId, uint64 buffer) } } -void SCTPClient::addressAddedArrived(int32 assocId, IPvXAddress remoteAddr) +void SCTPClient::addressAddedArrived(int32 assocId, Address remoteAddr) { } diff --git a/src/applications/sctpapp/SCTPClient.h b/src/applications/sctpapp/SCTPClient.h index 169ff4b7d9e..2f2c4bca883 100644 --- a/src/applications/sctpapp/SCTPClient.h +++ b/src/applications/sctpapp/SCTPClient.h @@ -76,10 +76,10 @@ class INET_API SCTPClient : public cSimpleModule, public SCTPSocket::CallbackInt { bool active; bool primaryPath; - IPvXAddress pid; + Address pid; }; - typedef std::map SCTPPathStatus; + typedef std::map SCTPPathStatus; SCTPPathStatus sctpPathStatus; virtual bool handleOperationStage(LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) @@ -156,7 +156,7 @@ class INET_API SCTPClient : public cSimpleModule, public SCTPSocket::CallbackInt void shutdownReceivedArrived(int32 connId); void sendqueueFullArrived(int32 connId); void sendqueueAbatedArrived(int32 connId, uint64 buffer); - void addressAddedArrived(int32 assocId, IPvXAddress remoteAddr); + void addressAddedArrived(int32 assocId, Address remoteAddr); void msgAbandonedArrived(int32 assocId); void sendStreamResetNotification(); }; diff --git a/src/applications/sctpapp/SCTPPeer.cc b/src/applications/sctpapp/SCTPPeer.cc index acf2374f3a7..12364d96c48 100644 --- a/src/applications/sctpapp/SCTPPeer.cc +++ b/src/applications/sctpapp/SCTPPeer.cc @@ -18,7 +18,7 @@ #include "SCTPPeer.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "ModuleAccess.h" #include "NodeStatus.h" #include "SCTPAssociation.h" @@ -87,7 +87,7 @@ void SCTPPeer::initialize(int stage) // parameters const char *addressesString = par("localAddress"); - AddressVector addresses = IPvXAddressResolver().resolve(cStringTokenizer(addressesString).asVector()); + AddressVector addresses = AddressResolver().resolve(cStringTokenizer(addressesString).asVector()); int port = par("localPort"); echo = par("echo"); delay = par("echoDelay"); @@ -191,7 +191,7 @@ void SCTPPeer::connect() sctpEV3 << "Assoc " << clientSocket.getConnectionId() << "::connect to address " << connectAddress << ", port " << connectPort << "\n"; numSessions++; bool streamReset = par("streamReset"); - clientSocket.connect(IPvXAddressResolver().resolve(connectAddress, 1), connectPort, streamReset, (int32)par("prMethod"), (uint32)par("numRequestsPerSession")); + clientSocket.connect(AddressResolver().resolve(connectAddress, 1), connectPort, streamReset, (int32)par("prMethod"), (uint32)par("numRequestsPerSession")); if (!streamReset) streamReset = false; diff --git a/src/applications/sctpapp/SCTPPeer.h b/src/applications/sctpapp/SCTPPeer.h index 45dd3a40973..9fe2145a090 100644 --- a/src/applications/sctpapp/SCTPPeer.h +++ b/src/applications/sctpapp/SCTPPeer.h @@ -91,7 +91,7 @@ class INET_API SCTPPeer : public cSimpleModule, public SCTPSocket::CallbackInter bool primaryPath; IPv4Address pid; }; - typedef std::map SCTPPathStatus; + typedef std::map SCTPPathStatus; SCTPPathStatus sctpPathStatus; public: @@ -141,7 +141,7 @@ class INET_API SCTPPeer : public cSimpleModule, public SCTPSocket::CallbackInter void sendStreamResetNotification(); void setStatusString(const char *s); - void addressAddedArrived(int32 assocId, IPvXAddress remoteAddr); + void addressAddedArrived(int32 assocId, Address remoteAddr); }; #endif diff --git a/src/applications/sctpapp/SCTPServer.cc b/src/applications/sctpapp/SCTPServer.cc index 25f90e0557b..b117744278b 100644 --- a/src/applications/sctpapp/SCTPServer.cc +++ b/src/applications/sctpapp/SCTPServer.cc @@ -28,7 +28,7 @@ #include "SCTPCommand_m.h" #include "SCTPMessage_m.h" #include "SCTPSocket.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" Define_Module(SCTPServer); @@ -49,7 +49,7 @@ void SCTPServer::initialize(int stage) // parameters finishEndsSimulation = (bool)par("finishEndsSimulation"); const char *addressesString = par("localAddress"); - AddressVector addresses = IPvXAddressResolver().resolve(cStringTokenizer(addressesString).asVector()); + AddressVector addresses = AddressResolver().resolve(cStringTokenizer(addressesString).asVector()); int32 port = par("localPort"); echo = par("echo"); delay = par("echoDelay"); diff --git a/src/applications/tcpapp/TCPEchoApp.cc b/src/applications/tcpapp/TCPEchoApp.cc index d1263f855dc..7cb7fdb362f 100644 --- a/src/applications/tcpapp/TCPEchoApp.cc +++ b/src/applications/tcpapp/TCPEchoApp.cc @@ -61,7 +61,7 @@ void TCPEchoApp::startListening() const char *localAddress = par("localAddress"); int localPort = par("localPort"); socket.renewSocket(); - socket.bind(localAddress[0] ? IPvXAddress(localAddress) : IPvXAddress(), localPort); + socket.bind(localAddress[0] ? Address(localAddress) : Address(), localPort); socket.listen(); } diff --git a/src/applications/tcpapp/TCPGenericCliAppBase.cc b/src/applications/tcpapp/TCPGenericCliAppBase.cc index bd53f6aea7f..fff5c745fa7 100644 --- a/src/applications/tcpapp/TCPGenericCliAppBase.cc +++ b/src/applications/tcpapp/TCPGenericCliAppBase.cc @@ -15,7 +15,7 @@ #include "TCPGenericCliAppBase.h" #include "GenericAppMsg_m.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" simsignal_t TCPGenericCliAppBase::connectSignal = SIMSIGNAL_NULL; @@ -46,7 +46,7 @@ void TCPGenericCliAppBase::initialize(int stage) const char *localAddress = par("localAddress"); int localPort = par("localPort"); socket.readDataTransferModePar(*this); - socket.bind(*localAddress ? IPvXAddressResolver().resolve(localAddress) : IPvXAddress(), localPort); + socket.bind(*localAddress ? AddressResolver().resolve(localAddress) : Address(), localPort); socket.setCallbackObject(this); socket.setOutputGate(gate("tcpOut")); @@ -74,8 +74,8 @@ void TCPGenericCliAppBase::connect() EV << "issuing OPEN command\n"; setStatusString("connecting"); - IPvXAddress destination; - IPvXAddressResolver().tryResolve(connectAddress, destination); + Address destination; + AddressResolver().tryResolve(connectAddress, destination); if (destination.isUnspecified()) EV << "cannot resolve destination address: " << connectAddress << endl; else { diff --git a/src/applications/tcpapp/TCPGenericSrvApp.cc b/src/applications/tcpapp/TCPGenericSrvApp.cc index 2382e811f40..9927950c1d9 100644 --- a/src/applications/tcpapp/TCPGenericSrvApp.cc +++ b/src/applications/tcpapp/TCPGenericSrvApp.cc @@ -44,12 +44,12 @@ void TCPGenericSrvApp::initialize(int stage) WATCH(bytesRcvd); WATCH(bytesSent); - //TODO should use IPvXAddressResolver in stage 3 + //TODO should use AddressResolver in stage 3 const char *localAddress = par("localAddress"); TCPSocket socket; socket.setOutputGate(gate("tcpOut")); socket.setDataTransferMode(TCP_TRANSFER_OBJECT); - socket.bind(localAddress[0] ? IPvXAddress(localAddress) : IPvXAddress(), localPort); + socket.bind(localAddress[0] ? Address(localAddress) : Address(), localPort); socket.listen(); } else if (stage == 1) diff --git a/src/applications/tcpapp/TCPSessionApp.cc b/src/applications/tcpapp/TCPSessionApp.cc index a733fad1e7c..d8213111280 100644 --- a/src/applications/tcpapp/TCPSessionApp.cc +++ b/src/applications/tcpapp/TCPSessionApp.cc @@ -16,7 +16,7 @@ #include "ByteArrayMessage.h" #include "GenericAppMsg_m.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "ModuleAccess.h" #include "NodeStatus.h" @@ -197,7 +197,7 @@ void TCPSessionApp::activity() waitUntil(tOpen); socket.readDataTransferModePar(*this); - socket.bind(*localAddress ? IPvXAddress(localAddress) : IPvXAddress(), localPort); + socket.bind(*localAddress ? Address(localAddress) : Address(), localPort); EV << "issuing OPEN command\n"; @@ -205,7 +205,7 @@ void TCPSessionApp::activity() getDisplayString().setTagArg("t", 0, active ? "connecting" : "listening"); if (active) - socket.connect(IPvXAddressResolver().resolve(connectAddress), connectPort); + socket.connect(AddressResolver().resolve(connectAddress), connectPort); else socket.listenOnce(); diff --git a/src/applications/tcpapp/TCPSinkApp.cc b/src/applications/tcpapp/TCPSinkApp.cc index a7f301e1047..f28e73af00f 100644 --- a/src/applications/tcpapp/TCPSinkApp.cc +++ b/src/applications/tcpapp/TCPSinkApp.cc @@ -35,11 +35,11 @@ void TCPSinkApp::initialize(int stage) WATCH(bytesRcvd); rcvdPkSignal = registerSignal("rcvdPk"); - //TODO should use IPvXAddressResolver in stage 3 + //TODO should use AddressResolver in stage 3 TCPSocket socket; socket.setOutputGate(gate("tcpOut")); socket.readDataTransferModePar(*this); - socket.bind(localAddress[0] ? IPvXAddress(localAddress) : IPvXAddress(), localPort); + socket.bind(localAddress[0] ? Address(localAddress) : Address(), localPort); socket.listen(); } else if (stage == 1) diff --git a/src/applications/tcpapp/TCPSrvHostApp.cc b/src/applications/tcpapp/TCPSrvHostApp.cc index 0188c59a5b5..19b3ed88663 100644 --- a/src/applications/tcpapp/TCPSrvHostApp.cc +++ b/src/applications/tcpapp/TCPSrvHostApp.cc @@ -26,13 +26,13 @@ void TCPSrvHostApp::initialize(int stage) if (stage == 0) { - //TODO should use IPvXAddressResolver in stage 3 + //TODO should use AddressResolver in stage 3 const char *localAddress = par("localAddress"); int localPort = par("localPort"); serverSocket.setOutputGate(gate("tcpOut")); serverSocket.readDataTransferModePar(*this); - serverSocket.bind(localAddress[0] ? IPvXAddress(localAddress) : IPvXAddress(), localPort); + serverSocket.bind(localAddress[0] ? Address(localAddress) : Address(), localPort); serverSocket.listen(); } else if (stage == 1) diff --git a/src/applications/udpapp/UDPBasicApp.cc b/src/applications/udpapp/UDPBasicApp.cc index 9ffba299501..ff1b6250fa5 100644 --- a/src/applications/udpapp/UDPBasicApp.cc +++ b/src/applications/udpapp/UDPBasicApp.cc @@ -19,8 +19,8 @@ #include "UDPBasicApp.h" +#include "AddressResolver.h" #include "InterfaceTableAccess.h" -#include "IPvXAddressResolver.h" #include "NodeOperations.h" #include "UDPControlInfo_m.h" @@ -44,7 +44,7 @@ void UDPBasicApp::initialize(int stage) { AppBase::initialize(stage); - // because of IPvXAddressResolver, we need to wait until interfaces are registered, + // because of AddressResolver, we need to wait until interfaces are registered, // address auto-assignment takes place etc. if (stage == 0) { @@ -101,7 +101,7 @@ void UDPBasicApp::setSocketOptions() socket.joinLocalMulticastGroups(); } -IPvXAddress UDPBasicApp::chooseDestAddr() +Address UDPBasicApp::chooseDestAddr() { int k = intrand(destAddresses.size()); return destAddresses[k]; @@ -114,7 +114,7 @@ void UDPBasicApp::sendPacket() cPacket *payload = new cPacket(msgName); payload->setByteLength(par("messageLength").longValue()); - IPvXAddress destAddr = chooseDestAddr(); + Address destAddr = chooseDestAddr(); emit(sentPkSignal, payload); socket.sendTo(payload, destAddr, destPort); @@ -132,8 +132,8 @@ void UDPBasicApp::processStart() 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 diff --git a/src/applications/udpapp/UDPBasicApp.h b/src/applications/udpapp/UDPBasicApp.h index 6e68648d4b2..b6825f92f74 100644 --- a/src/applications/udpapp/UDPBasicApp.h +++ b/src/applications/udpapp/UDPBasicApp.h @@ -38,7 +38,7 @@ class INET_API UDPBasicApp : public AppBase UDPSocket socket; int localPort, destPort; - std::vector destAddresses; + std::vector
destAddresses; simtime_t startTime; simtime_t stopTime; cMessage *selfMsg; @@ -51,7 +51,7 @@ class INET_API UDPBasicApp : public AppBase static simsignal_t rcvdPkSignal; // chooses random destination address - virtual IPvXAddress chooseDestAddr(); + virtual Address chooseDestAddr(); virtual void sendPacket(); virtual void processPacket(cPacket *msg); virtual void setSocketOptions(); diff --git a/src/applications/udpapp/UDPBasicApp.ned b/src/applications/udpapp/UDPBasicApp.ned index d527a75fe94..8bc4e4ced89 100644 --- a/src/applications/udpapp/UDPBasicApp.ned +++ b/src/applications/udpapp/UDPBasicApp.ned @@ -29,7 +29,7 @@ import inet.applications.IUDPApp; // The sending interval can be a constant or a random value (e.g. exponential(1)). // If the destAddresses parameter contains more than one address, one // of them is randomly chosen for each packet. An address may be given in the -// dotted decimal notation, or with the module name. (The IPvXAddressResolver +// dotted decimal notation, or with the module name. (The AddressResolver // class is used to resolve the address.) To disable the model, set // destAddresses to "". // diff --git a/src/applications/udpapp/UDPBasicBurst.cc b/src/applications/udpapp/UDPBasicBurst.cc index 8328cc11869..ece59f9ef83 100644 --- a/src/applications/udpapp/UDPBasicBurst.cc +++ b/src/applications/udpapp/UDPBasicBurst.cc @@ -22,16 +22,16 @@ #include "UDPBasicBurst.h" #include "UDPControlInfo_m.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #ifdef WITH_IPv4 -#include "IRoutingTable.h" -#include "RoutingTableAccess.h" +#include "IIPv4RoutingTable.h" +#include "IPv4RoutingTableAccess.h" #endif #ifdef WITH_IPv6 -#include "RoutingTable6.h" -#include "RoutingTable6Access.h" +#include "IPv6RoutingTable.h" +#include "IPv6RoutingTableAccess.h" #endif @@ -116,7 +116,7 @@ void UDPBasicBurst::initialize(int stage) } } -IPvXAddress UDPBasicBurst::chooseDestAddr() +Address UDPBasicBurst::chooseDestAddr() { if (destAddresses.size() == 1) return destAddresses[0]; @@ -149,10 +149,10 @@ void UDPBasicBurst::processStart() bool excludeLocalDestAddresses = par("excludeLocalDestAddresses").boolValue(); #ifdef WITH_IPv4 - IRoutingTable *rt = RoutingTableAccess().getIfExists(); + IIPv4RoutingTable *rt = IPv4RoutingTableAccess().getIfExists(); #endif #ifdef WITH_IPv6 - RoutingTable6 *rt6 = RoutingTable6Access().getIfExists(); + IPv6RoutingTable *rt6 = IPv6RoutingTableAccess().getIfExists(); #endif while ((token = tokenizer.nextToken()) != NULL) @@ -161,13 +161,13 @@ void UDPBasicBurst::processStart() destAddresses.push_back(IPv4Address::ALLONES_ADDRESS); else { - IPvXAddress addr = IPvXAddressResolver().resolve(token); + Address addr = AddressResolver().resolve(token); #ifdef WITH_IPv4 - if (excludeLocalDestAddresses && rt && rt->isLocalAddress(addr.get4())) + if (excludeLocalDestAddresses && rt && rt->isLocalAddress(addr.toIPv4())) continue; #endif #ifdef WITH_IPv6 - if (excludeLocalDestAddresses && rt6 && rt6->isLocalAddress(addr.get6())) + if (excludeLocalDestAddresses && rt6 && rt6->isLocalAddress(addr.toIPv6())) continue; #endif destAddresses.push_back(addr); diff --git a/src/applications/udpapp/UDPBasicBurst.h b/src/applications/udpapp/UDPBasicBurst.h index 29e716578cb..bb51b9a7547 100644 --- a/src/applications/udpapp/UDPBasicBurst.h +++ b/src/applications/udpapp/UDPBasicBurst.h @@ -49,8 +49,8 @@ class INET_API UDPBasicBurst : public AppBase int localPort, destPort; ChooseDestAddrMode chooseDestAddrMode; - std::vector destAddresses; - IPvXAddress destAddr; + std::vector
destAddresses; + Address destAddr; int destAddrRNG; typedef std::map SourceSequence; @@ -86,7 +86,7 @@ class INET_API UDPBasicBurst : public AppBase static simsignal_t dropPkSignal; // chooses random destination address - virtual IPvXAddress chooseDestAddr(); + virtual Address chooseDestAddr(); virtual cPacket *createPacket(); virtual void processPacket(cPacket *msg); virtual void generateBurst(); diff --git a/src/applications/udpapp/UDPBasicBurst.ned b/src/applications/udpapp/UDPBasicBurst.ned index 1f9d87ab6f5..a8195b4d4d1 100644 --- a/src/applications/udpapp/UDPBasicBurst.ned +++ b/src/applications/udpapp/UDPBasicBurst.ned @@ -39,7 +39,7 @@ import inet.applications.IUDPApp; // The own addresses will be ignored. // // An address may be given in the dotted decimal notation, or with the module -// name. (The IPvXAddressResolver class is used to resolve the address.) +// name. (The AddressResolver class is used to resolve the address.) // You can use the "Broadcast" string as address for sending broadcast messages. // // INET also defines several NED functions that can be useful: diff --git a/src/applications/udpapp/UDPEchoApp.cc b/src/applications/udpapp/UDPEchoApp.cc index e501a07b514..3cafb2f32c1 100644 --- a/src/applications/udpapp/UDPEchoApp.cc +++ b/src/applications/udpapp/UDPEchoApp.cc @@ -57,7 +57,7 @@ void UDPEchoApp::handleMessageWhenUp(cMessage *msg) // determine its source address/port UDPDataIndication *ctrl = check_and_cast(pk->removeControlInfo()); - IPvXAddress srcAddress = ctrl->getSrcAddr(); + Address srcAddress = ctrl->getSrcAddr(); int srcPort = ctrl->getSrcPort(); delete ctrl; diff --git a/src/applications/udpapp/UDPVideoStreamCli.cc b/src/applications/udpapp/UDPVideoStreamCli.cc index c4bba879b03..94fc63d68ef 100644 --- a/src/applications/udpapp/UDPVideoStreamCli.cc +++ b/src/applications/udpapp/UDPVideoStreamCli.cc @@ -23,7 +23,7 @@ #include "UDPVideoStreamCli.h" #include "UDPControlInfo_m.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" Define_Module(UDPVideoStreamCli); @@ -75,7 +75,7 @@ void UDPVideoStreamCli::requestStream() int svrPort = par("serverPort"); int localPort = par("localPort"); const char *address = par("serverAddress"); - IPvXAddress svrAddr = IPvXAddressResolver().resolve(address); + Address svrAddr = AddressResolver().resolve(address); if (svrAddr.isUnspecified()) { diff --git a/src/applications/udpapp/UDPVideoStreamSvr.h b/src/applications/udpapp/UDPVideoStreamSvr.h index f211757c0bb..58bb312fdcd 100644 --- a/src/applications/udpapp/UDPVideoStreamSvr.h +++ b/src/applications/udpapp/UDPVideoStreamSvr.h @@ -48,7 +48,7 @@ class INET_API UDPVideoStreamSvr : public AppBase struct VideoStreamData { cMessage *timer; ///< self timer msg - IPvXAddress clientAddr; ///< client address + Address clientAddr; ///< client address int clientPort; ///< client UDP port long videoSize; ///< total size of video long bytesLeft; ///< bytes left to transmit diff --git a/src/applications/voip/SimpleVoIPReceiver.h b/src/applications/voip/SimpleVoIPReceiver.h index c8779225978..c1e62818564 100644 --- a/src/applications/voip/SimpleVoIPReceiver.h +++ b/src/applications/voip/SimpleVoIPReceiver.h @@ -22,7 +22,7 @@ #include #include #include "INETDefs.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "UDPSocket.h" #include "ILifecycle.h" #include "LifecycleOperation.h" diff --git a/src/applications/voip/SimpleVoIPSender.cc b/src/applications/voip/SimpleVoIPSender.cc index 96bcb64bba4..638c9b301fc 100644 --- a/src/applications/voip/SimpleVoIPSender.cc +++ b/src/applications/voip/SimpleVoIPSender.cc @@ -66,7 +66,7 @@ void SimpleVoIPSender::initialize(int stage) selfSender = new cMessage("selfSender"); localPort = par("localPort"); destPort = par("destPort"); - destAddress = IPvXAddressResolver().resolve(par("destAddress").stringValue()); + destAddress = AddressResolver().resolve(par("destAddress").stringValue()); socket.setOutputGate(gate("udpOut")); socket.bind(localPort); diff --git a/src/applications/voip/SimpleVoIPSender.h b/src/applications/voip/SimpleVoIPSender.h index 29c9187a07d..8a653933e8d 100644 --- a/src/applications/voip/SimpleVoIPSender.h +++ b/src/applications/voip/SimpleVoIPSender.h @@ -22,7 +22,7 @@ #include #include "INETDefs.h" #include "UDPSocket.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "ILifecycle.h" #include "LifecycleOperation.h" @@ -54,7 +54,7 @@ class SimpleVoIPSender : public cSimpleModule, public ILifecycle simtime_t timestamp; int localPort; int destPort; - IPvXAddress destAddress; + Address destAddress; simtime_t stopTime; void talkspurt(simtime_t dur); diff --git a/src/applications/voipstream/VoIPStreamReceiver.h b/src/applications/voipstream/VoIPStreamReceiver.h index 24d9e4f6420..aa1b3d3b8a9 100644 --- a/src/applications/voipstream/VoIPStreamReceiver.h +++ b/src/applications/voipstream/VoIPStreamReceiver.h @@ -37,7 +37,7 @@ extern "C" { #include #include -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "UDPControlInfo_m.h" #include "UDPSocket.h" #include "VoIPStreamPacket_m.h" @@ -92,9 +92,9 @@ class VoIPStreamReceiver : public cSimpleModule, public ILifecycle AVCodecContext *decCtx; AVCodec *pCodecDec; AudioOutFile outFile; - IPvXAddress srcAddr; + Address srcAddr; int srcPort; - IPvXAddress destAddr; + Address destAddr; int destPort; }; diff --git a/src/applications/voipstream/VoIPStreamSender.cc b/src/applications/voipstream/VoIPStreamSender.cc index 91cd023493c..267ab3d4d96 100644 --- a/src/applications/voipstream/VoIPStreamSender.cc +++ b/src/applications/voipstream/VoIPStreamSender.cc @@ -75,7 +75,7 @@ void VoIPStreamSender::initialize(int stage) pReSampleCtx = NULL; localPort = par("localPort"); destPort = par("destPort"); - destAddress = IPvXAddressResolver().resolve(par("destAddress").stringValue()); + destAddress = AddressResolver().resolve(par("destAddress").stringValue()); socket.setOutputGate(gate("udpOut")); socket.bind(localPort); diff --git a/src/applications/voipstream/VoIPStreamSender.h b/src/applications/voipstream/VoIPStreamSender.h index 1c7c761660a..539e3ebaef0 100644 --- a/src/applications/voipstream/VoIPStreamSender.h +++ b/src/applications/voipstream/VoIPStreamSender.h @@ -37,7 +37,7 @@ extern "C" { }; #include "AudioOutFile.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "UDPSocket.h" #include "VoIPStreamPacket_m.h" #include "ILifecycle.h" @@ -92,7 +92,7 @@ class INET_API VoIPStreamSender : public cSimpleModule, public ILifecycle // general parameters int localPort; int destPort; - IPvXAddress destAddress; + Address destAddress; int voipHeaderSize; int voipSilenceThreshold; // the maximum amplitude of a silence packet diff --git a/src/base/InterfaceOperations.cc b/src/base/InterfaceOperations.cc index 964facc1788..000a19c792a 100644 --- a/src/base/InterfaceOperations.cc +++ b/src/base/InterfaceOperations.cc @@ -19,7 +19,7 @@ // //#include "InterfaceOperations.h" //#include "IInterfaceTable.h" -//#include "IPvXAddressResolver.h" +//#include "AddressResolver.h" //#include "ModuleAccess.h" // //Register_Class(InterfaceDownOperation); @@ -34,7 +34,7 @@ // LifecycleOperation::initialize(module, params); // // // note: these operations cannot be generic, because their ctor requires InterfaceEntry as parameter -// IInterfaceTable *ift = IPvXAddressResolver().findInterfaceTableOf(module); +// IInterfaceTable *ift = AddressResolver().findInterfaceTableOf(module); // if (!ift) // throw cRuntimeError("Interface table of network node '%s' not found, required for operation %s", module->getFullPath().c_str(), getClassName()); // std::string interfaceName = params["interfacename"]; diff --git a/src/base/LifecycleController.cc b/src/base/LifecycleController.cc index 4638c44c7da..4738eb9e016 100644 --- a/src/base/LifecycleController.cc +++ b/src/base/LifecycleController.cc @@ -18,7 +18,7 @@ #include "LifecycleController.h" #include "IInterfaceTable.h" #include "InterfaceEntry.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "LifecycleOperation.h" #include "opp_utils.h" // for OPP_Global::getModuleByPath() diff --git a/src/base/ModuleAccess.h b/src/base/ModuleAccess.h index c5597be18c6..25cd3881fe6 100644 --- a/src/base/ModuleAccess.h +++ b/src/base/ModuleAccess.h @@ -69,7 +69,7 @@ INET_API cModule *findModuleUnderContainingNode(cModule *from); /** * Finds and returns the pointer to a module of type T and name N. - * Uses findModuleWhereverInNode(). See usage e.g. at RoutingTableAccess. + * Uses findModuleWhereverInNode(). See usage e.g. at IPv4RoutingTableAccess. */ template class INET_API ModuleAccess diff --git a/src/base/NotificationBoard.ned b/src/base/NotificationBoard.ned index fc504943189..739ca839e1d 100644 --- a/src/base/NotificationBoard.ned +++ b/src/base/NotificationBoard.ned @@ -33,7 +33,7 @@ package inet.base; // ~NotificationBoard is accessed via direct C++ method calls (not // message exchange). Modules can "subscribe" to categories of changes // (e.g. "routing table changed" or "radio channel became empty"). -// When such a change occurs, the corresponding module (e.g. the ~RoutingTable +// When such a change occurs, the corresponding module (e.g. the ~IPv4RoutingTable // or the physical layer module) will let ~NotificationBoard know, and // it will disseminate this information to all interested modules. // diff --git a/src/inet-doc.ned b/src/inet-doc.ned index 75ae669cb35..e63dcf13902 100644 --- a/src/inet-doc.ned +++ b/src/inet-doc.ned @@ -47,7 +47,7 @@ // a MAC, and possibly other simple modules. See ~EthernetInterface as an example. // // Not all modules implement protocols though. There are modules which hold -// data (for example ~RoutingTable), facilitate communication of modules +// data (for example ~IPv4RoutingTable), facilitate communication of modules // (~NotificationBoard), perform autoconfiguration of a network // (~FlatNetworkConfigurator), move a mobile node around (for example // ~ConstSpeedMobility), and perform housekeeping associated with radio channels @@ -83,7 +83,7 @@ // functions). Network interfaces get dynamically registered (added to the table) // by simple modules implementing the network interface, for example ~EtherMAC. // -// - ~RoutingTable. This module contains the IP (v4) routing table, and heavily relies +// - ~IPv4RoutingTable. This module contains the IP (v4) routing table, and heavily relies // on ~InterfaceTable for its operation. This module is also accessed from other // modules (typically ~IPv4) by calling the public member functions of its C++ class. // There are member functions for querying, adding, deleting routes, and @@ -91,7 +91,7 @@ // The routing table submodule within the host (router) must be called // routingTable for other modules to find it. // -// - ~RoutingTable6. This is like ~RoutingTable, but for IPv6. +// - ~IPv6RoutingTable. This is like ~IPv4RoutingTable, but for IPv6. // // - ~NotificationBoard. This module makes it possible for several modules to // communicate in a publish-subscribe manner. For example, the radio module @@ -142,12 +142,12 @@ // @page ipaddresses.html, Specifying IP (IPv6) addresses in module parameters // // In INET, ~TCP, ~UDP and all application layer modules work with -// both IPv4 and IPv6. Internally they use the IPvXAddress C++ class, which +// both IPv4 and IPv6. Internally they use the Address C++ class, which // can represent both IPv4 and IPv6 addresses. // -// Most modules use the IPvXAddressResolver C++ class to resolve addresses +// Most modules use the AddressResolver C++ class to resolve addresses // specified in module parameters in omnetpp.ini. -// IPvXAddressResolver accepts the following syntax: +// AddressResolver accepts the following syntax: // // - literal IPv4 address: "186.54.66.2" // - literal IPv6 address: "3011:7cd6:750b:5fd6:aba3:c231:e9f9:6a43" @@ -162,7 +162,7 @@ // // Routing files are files with .irt or .mrt extension, // and their names are passed in the routingFileName parameter -// to ~RoutingTable modules. RoutingTables are present in all +// to ~IPv4RoutingTable modules. RoutingTables are present in all // IP nodes (hosts and routers). // // Routing files may contain network interface configuration and static @@ -171,7 +171,7 @@ // // Interfaces themselves are represented in the simulation by modules // (such as the ~PPP module). Modules automatically register themselves -// with appropriate defaults in the ~RoutingTable, and entries in the +// with appropriate defaults in the ~IPv4RoutingTable, and entries in the // routing file refine (overwrite) these settings. // Interfaces are identified by names (e.g. ppp0, ppp1, eth0) which // are normally derived from the module's name: a module called @@ -255,7 +255,7 @@ // // IPv6 support is implemented by several cooperating modules. The ~IPv6 module // implements IPv6 datagram handling (sending, forwarding etc). It relies on -// ~RoutingTable6 to get access to the routes. ~RoutingTable6 also contains the +// ~IPv6RoutingTable to get access to the routes. ~IPv6RoutingTable also contains the // neighbour discovery data structures (destination cache, neighbour cache, // prefix list -- the latter effectively merged into the route table). Interface // configuration (address, state, timeouts etc) is held in the ~InterfaceTable, @@ -265,7 +265,7 @@ // The ~IPv6NeighbourDiscovery module implements all tasks associated with // neighbour discovery and stateless address autoconfiguration. The data // structures themselves (destination cache, neighbour cache, prefix list) -// are kept in ~RoutingTable6, and are accessed via public C++ methods. +// are kept in ~IPv6RoutingTable, and are accessed via public C++ methods. // Neighbour discovery packets are only sent and processed by this module -- // when ~IPv6 receives one, it forwards the packet to ~IPv6NeighbourDiscovery. // diff --git a/src/inet-index.ned b/src/inet-index.ned index a062efe19b7..1970f3156cd 100644 --- a/src/inet-index.ned +++ b/src/inet-index.ned @@ -45,8 +45,8 @@ // - network interfaces: ~EthernetInterface, ~PPPInterface, ~Ieee80211Nic // - IEEE 802.11 models, both ad-hoc and infrastructure // mode are supported -// - IPv4 layer: ~IPv4, ~ARP and ~ICMP; ~RoutingTable -// - IPv6 support: ~IPv6, ~IPv6NeighbourDiscovery, ~ICMPv6, ~RoutingTable6; +// - IPv4 layer: ~IPv4, ~ARP and ~ICMP; ~IPv4RoutingTable +// - IPv6 support: ~IPv6, ~IPv6NeighbourDiscovery, ~ICMPv6, ~IPv6RoutingTable; // see IPv6 model overview // - transport layer: ~TCP, ~UDP, ~SCTP // - ~InterfaceTable and ~NotificationBoard are there in every diff --git a/src/networklayer/arp/ARP.cc b/src/networklayer/arp/ARP.cc index 6d1589930d5..1a30e99de62 100644 --- a/src/networklayer/arp/ARP.cc +++ b/src/networklayer/arp/ARP.cc @@ -23,8 +23,8 @@ #include "IPv4ControlInfo.h" #include "IPv4Datagram.h" #include "IPv4InterfaceData.h" -#include "IRoutingTable.h" -#include "RoutingTableAccess.h" +#include "IIPv4RoutingTable.h" +#include "IPv4RoutingTableAccess.h" #include "ARPPacket_m.h" #include "IInterfaceTable.h" #include "InterfaceTableAccess.h" @@ -83,7 +83,7 @@ void ARP::initialize(int stage) if (stage==4) { ift = InterfaceTableAccess().get(); - rt = RoutingTableAccess().get(); + rt = IPv4RoutingTableAccess().get(); nicOutBaseGateId = gateSize("nicOut")==0 ? -1 : gate("nicOut", 0)->getId(); diff --git a/src/networklayer/arp/ARP.h b/src/networklayer/arp/ARP.h index 530455dded7..6bfc7d72745 100644 --- a/src/networklayer/arp/ARP.h +++ b/src/networklayer/arp/ARP.h @@ -32,7 +32,7 @@ class ARPPacket; class IInterfaceTable; class InterfaceEntry; -class IRoutingTable; +class IIPv4RoutingTable; /** * ARP implementation. @@ -86,8 +86,9 @@ class INET_API ARP : public cSimpleModule, public ILifecycle, public INotifiable int nicOutBaseGateId; // id of the nicOut[0] gate IInterfaceTable *ift; - IRoutingTable *rt; // for Proxy ARP + IIPv4RoutingTable *rt; // for Proxy ARP NotificationBoard *nb; + // Maps an IP multicast address to an Ethernet multicast address. MACAddress mapMulticastAddress(IPv4Address addr); diff --git a/src/networklayer/arp/ARP.ned b/src/networklayer/arp/ARP.ned index 71a2f40028f..97d3a85f734 100644 --- a/src/networklayer/arp/ARP.ned +++ b/src/networklayer/arp/ARP.ned @@ -29,7 +29,7 @@ package inet.networklayer.arp; // ARP resolution is used over broadcast interfaces only, // that is, over interfaces that have the isBroadcast() flag set in // InterfaceEntry (see ~InterfaceTable). Since routing files -// (.irt or .mrt files, given as parameter to ~RoutingTable) +// (.irt or .mrt files, given as parameter to ~IPv4RoutingTable) // may modify the default interface configuration, you must take care that // these files don't contain the word BROADCAST e.g. for PPP // interfaces. diff --git a/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.cc b/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.cc index 3f65d0176f9..3e0f8e7625c 100644 --- a/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.cc +++ b/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.cc @@ -16,9 +16,9 @@ // #include -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "IInterfaceTable.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "FlatNetworkConfigurator.h" #include "InterfaceEntry.h" #include "IPv4InterfaceData.h" @@ -70,11 +70,11 @@ void FlatNetworkConfigurator::extractTopology(cTopology& topo, NodeInfoVector& n for (int i=0; igetModule(); - nodeInfo[i].isIPNode = IPvXAddressResolver().findRoutingTableOf(mod)!=NULL && IPvXAddressResolver().findInterfaceTableOf(mod)!=NULL; + nodeInfo[i].isIPNode = AddressResolver().findRoutingTableOf(mod)!=NULL && AddressResolver().findInterfaceTableOf(mod)!=NULL; if (nodeInfo[i].isIPNode) { - nodeInfo[i].ift = IPvXAddressResolver().interfaceTableOf(mod); - nodeInfo[i].rt = IPvXAddressResolver().routingTableOf(mod); + nodeInfo[i].ift = AddressResolver().interfaceTableOf(mod); + nodeInfo[i].rt = AddressResolver().routingTableOf(mod); nodeInfo[i].ipForwardEnabled = mod->hasPar("IPForward") ? mod->par("IPForward").boolValue() : false; topo.getNode(i)->setWeight(nodeInfo[i].ipForwardEnabled ? 0.0 : INFINITY); } @@ -126,7 +126,7 @@ void FlatNetworkConfigurator::addDefaultRoutes(cTopology& topo, NodeInfoVector& continue; IInterfaceTable *ift = nodeInfo[i].ift; - IRoutingTable *rt = nodeInfo[i].rt; + IIPv4RoutingTable *rt = nodeInfo[i].rt; // count non-loopback interfaces int numIntf = 0; @@ -198,7 +198,7 @@ void FlatNetworkConfigurator::fillRoutingTables(cTopology& _topo, NodeInfoVector EV << " towards " << destModName << "=" << IPv4Address(destAddr) << " interface " << ie->getName() << endl; // add route - IRoutingTable *rt = nodeInfo[j].rt; + IIPv4RoutingTable *rt = nodeInfo[j].rt; IPv4Route *e = new IPv4Route(); e->setDestination(destAddr); e->setNetmask(IPv4Address(255, 255, 255, 255)); // full match needed diff --git a/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.h b/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.h index 8bd3b64140d..cd89b8a105e 100644 --- a/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.h +++ b/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.h @@ -23,7 +23,7 @@ #include "IPv4Address.h" class IInterfaceTable; -class IRoutingTable; +class IIPv4RoutingTable; /** @@ -40,7 +40,7 @@ class INET_API FlatNetworkConfigurator : public cSimpleModule NodeInfo() {isIPNode = false; ift = NULL; rt = NULL; usesDefaultRoute = false;} bool isIPNode; IInterfaceTable *ift; - IRoutingTable *rt; + IIPv4RoutingTable *rt; IPv4Address address; bool usesDefaultRoute; bool ipForwardEnabled; diff --git a/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.ned b/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.ned index c84086e003b..6ee3a821b94 100644 --- a/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.ned +++ b/src/networklayer/autorouting/ipv4/FlatNetworkConfigurator.ned @@ -35,7 +35,7 @@ package inet.networklayer.autorouting.ipv4; // -# then it'll discover the topology of the network (using OMNeT++'s // cTopology class), and calculate shortest paths; // -# finally, it will add routes which correspond to the shortest -// paths to the routing tables (see RoutingTable::addRoutingEntry()). +// paths to the routing tables (see IPv4RoutingTable::addRoutingEntry()). // // How does it know which modules are routers, hosts, et.c that need to // be configured, and what is the network topology? The configurator @@ -44,7 +44,7 @@ package inet.networklayer.autorouting.ipv4; // shortest path algorithm on it, and configures all modules which are // IPv4 nodes. // -// It is assumed that the routing table (~RoutingTable module) is the +// It is assumed that the routing table (~IPv4RoutingTable module) is the // "routingTable" or "networkLayer.routingTable" submodule in all hosts // and routers. // diff --git a/src/networklayer/autorouting/ipv4/HostAutoConfigurator.cc b/src/networklayer/autorouting/ipv4/HostAutoConfigurator.cc index 6a6304e7ae7..cdb0f773994 100644 --- a/src/networklayer/autorouting/ipv4/HostAutoConfigurator.cc +++ b/src/networklayer/autorouting/ipv4/HostAutoConfigurator.cc @@ -21,9 +21,9 @@ #include "HostAutoConfigurator.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "IPv4InterfaceData.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "IInterfaceTable.h" #include "IPv4Address.h" @@ -65,11 +65,11 @@ void HostAutoConfigurator::setupNetworkLayer() if (!host) throw cRuntimeError("No parent module found"); // get our routing table - IRoutingTable* routingTable = IPvXAddressResolver().routingTableOf(host); + IIPv4RoutingTable* routingTable = AddressResolver().routingTableOf(host); if (!routingTable) throw cRuntimeError("No routing table found"); // get our interface table - IInterfaceTable *ift = IPvXAddressResolver().interfaceTableOf(host); + IInterfaceTable *ift = AddressResolver().interfaceTableOf(host); if (!ift) throw cRuntimeError("No interface table found"); // look at all interface table entries diff --git a/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.cc b/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.cc index f98aac9155b..bec3a3262a4 100644 --- a/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.cc +++ b/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.cc @@ -20,8 +20,9 @@ #include #include "stlutils.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "IInterfaceTable.h" +#include "AddressResolver.h" #include "IPv4NetworkConfigurator.h" #include "InterfaceEntry.h" #include "ModuleAccess.h" @@ -175,7 +176,7 @@ void IPv4NetworkConfigurator::configureAllRoutingTables() } } -void IPv4NetworkConfigurator::configureRoutingTable(IRoutingTable *routingTable) +void IPv4NetworkConfigurator::configureRoutingTable(IIPv4RoutingTable *routingTable) { ensureConfigurationComputed(topology); // TODO: avoid linear search @@ -241,8 +242,8 @@ void IPv4NetworkConfigurator::extractTopology(IPv4Topology& topology) Node *node = (Node *)topology.getNode(i); cModule *module = node->getModule(); node->module = module; - node->interfaceTable = IPvXAddressResolver().findInterfaceTableOf(module); - node->routingTable = IPvXAddressResolver().findRoutingTableOf(module); + node->interfaceTable = AddressResolver().findInterfaceTableOf(module); + node->routingTable = AddressResolver().findRoutingTableOf(module); if (node->routingTable && !node->routingTable->isIPForwardingEnabled()) node->setWeight(DBL_MAX); } @@ -553,7 +554,7 @@ IPv4NetworkConfigurator::InterfaceInfo *IPv4NetworkConfigurator::determineGatewa { InterfaceInfo *interfaceInfo = linkInfo->interfaceInfos[interfaceIndex]; IInterfaceTable *interfaceTable = interfaceInfo->node->interfaceTable; - IRoutingTable *routingTable = interfaceInfo->node->routingTable; + IIPv4RoutingTable *routingTable = interfaceInfo->node->routingTable; // count how many (non-loopback) interfaces this node has int numInterfaces = 0; @@ -1292,7 +1293,7 @@ void IPv4NetworkConfigurator::dumpConfig(IPv4Topology& topology) for (int i = 0; i < topology.getNumNodes(); i++) { Node *node = (Node *)topology.getNode(i); - IRoutingTable *routingTable = node->routingTable; + IIPv4RoutingTable *routingTable = node->routingTable; if (routingTable) { for (int j = 0; j < routingTable->getNumRoutes(); j++) @@ -1315,7 +1316,7 @@ void IPv4NetworkConfigurator::dumpConfig(IPv4Topology& topology) for (int i = 0; i < topology.getNumNodes(); i++) { Node *node = (Node *)topology.getNode(i); - IRoutingTable *routingTable = node->routingTable; + IIPv4RoutingTable *routingTable = node->routingTable; if (routingTable) { for (int j = 0; j < routingTable->getNumMulticastRoutes(); j++) @@ -1422,9 +1423,9 @@ void IPv4NetworkConfigurator::readManualRouteConfiguration(IPv4Topology& topolog { cXMLElement *routeElement = routeElements[i]; const char *hostAttr = getMandatoryAttribute(routeElement, "hosts"); - const char *destinationAttr = getMandatoryAttribute(routeElement, "destination"); // destination address (IPvXAddressResolver syntax) + const char *destinationAttr = getMandatoryAttribute(routeElement, "destination"); // destination address (AddressResolver syntax) const char *netmaskAttr = routeElement->getAttribute("netmask"); // default: 255.255.255.255; alternative notation: "/23" - const char *gatewayAttr = routeElement->getAttribute("gateway"); // next hop address (IPvXAddressResolver syntax) + const char *gatewayAttr = routeElement->getAttribute("gateway"); // next hop address (AddressResolver syntax) const char *interfaceAttr = routeElement->getAttribute("interface"); // output interface name const char *metricAttr = routeElement->getAttribute("metric"); @@ -1433,7 +1434,7 @@ void IPv4NetworkConfigurator::readManualRouteConfiguration(IPv4Topology& topolog // parse and check the attributes IPv4Address destination; if (!isEmpty(destinationAttr) && strcmp(destinationAttr, "*")) - destination = resolve(destinationAttr, IPvXAddressResolver::ADDR_IPv4).get4(); + destination = resolve(destinationAttr, AddressResolver::ADDR_IPv4).toIPv4(); IPv4Address netmask; if (!isEmpty(netmaskAttr) && strcmp(netmaskAttr, "*")) { @@ -1490,7 +1491,7 @@ void IPv4NetworkConfigurator::readManualMulticastRouteConfiguration(IPv4Topology { cXMLElement *routeElement = routeElements[i]; const char *hostAttr = routeElement->getAttribute("hosts"); - const char *sourceAttr = routeElement->getAttribute("source"); // source address (IPvXAddressResolver syntax) + const char *sourceAttr = routeElement->getAttribute("source"); // source address (AddressResolver syntax) const char *netmaskAttr = routeElement->getAttribute("netmask"); // default: 255.255.255.255; alternative notation: "/23" const char *groupsAttr = routeElement->getAttribute("groups"); // addresses of the multicast groups, default: 0.0.0.0, matching all groups const char *parentAttr = routeElement->getAttribute("parent"); // name of expected input interface @@ -1502,7 +1503,7 @@ void IPv4NetworkConfigurator::readManualMulticastRouteConfiguration(IPv4Topology // parse and check the attributes IPv4Address source; if (!isEmpty(sourceAttr) && strcmp(sourceAttr, "*")) - source = resolve(sourceAttr, IPvXAddressResolver::ADDR_IPv4).get4(); + source = resolve(sourceAttr, AddressResolver::ADDR_IPv4).toIPv4(); IPv4Address netmask; if (!isEmpty(netmaskAttr) && strcmp(netmaskAttr, "*")) { @@ -1612,7 +1613,7 @@ void IPv4NetworkConfigurator::resolveInterfaceAndGateway(Node *node, const char ASSERT(isNotEmpty(gatewayAttr)); // see "if" above // check syntax of gatewayAttr, and obtain an initial value - outGateway = resolve(gatewayAttr, IPvXAddressResolver::ADDR_IPv4).get4(); + outGateway = resolve(gatewayAttr, AddressResolver::ADDR_IPv4).toIPv4(); IPv4Address gatewayAddressOnCommonLink; @@ -1649,8 +1650,8 @@ void IPv4NetworkConfigurator::resolveInterfaceAndGateway(Node *node, const char // the address of the interface which is towards the configured node (i.e. on the same link) // // gatewayAttr may be an IP address, or a module name, or modulename+interfacename - // in a syntax accepted by IPvXAddressResolver. If the gatewayAttr is a concrete IP address - // or contains a gateway interface name (IPvXAddressResolver accepts it after a "/"), we're done + // in a syntax accepted by AddressResolver. If the gatewayAttr is a concrete IP address + // or contains a gateway interface name (AddressResolver accepts it after a "/"), we're done if (IPv4Address::isWellFormed(gatewayAttr) || strchr(gatewayAttr, '/') != NULL) return; diff --git a/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.h b/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.h index 296ecde9f92..a60d797b262 100644 --- a/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.h +++ b/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.h @@ -26,9 +26,9 @@ #include "INETDefs.h" #include "Topology.h" #include "IInterfaceTable.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "IPv4Address.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "IPv4InterfaceData.h" #include "PatternMatcher.h" @@ -40,7 +40,7 @@ * For more info please see the NED file. */ // TODO: remove topology arguments from functions or perhaps move those functions into topology or leave it as it is? -class INET_API IPv4NetworkConfigurator : public cSimpleModule, public IPvXAddressResolver +class INET_API IPv4NetworkConfigurator : public cSimpleModule, public AddressResolver { protected: class LinkInfo; @@ -53,7 +53,7 @@ class INET_API IPv4NetworkConfigurator : public cSimpleModule, public IPvXAddres public: cModule *module; IInterfaceTable *interfaceTable; - IRoutingTable *routingTable; + IIPv4RoutingTable *routingTable; std::vector interfaceInfos; std::vector staticRoutes; std::vector staticMulticastRoutes; @@ -227,7 +227,7 @@ class INET_API IPv4NetworkConfigurator : public cSimpleModule, public IPvXAddres /** * Configures the provided routing table based on the current network configuration. */ - virtual void configureRoutingTable(IRoutingTable *routingTable); + virtual void configureRoutingTable(IIPv4RoutingTable *routingTable); protected: virtual int numInitStages() const { return 4; } @@ -341,7 +341,7 @@ class INET_API IPv4NetworkConfigurator : public cSimpleModule, public IPvXAddres public: // TODO: find a better way to reuse and override IPvXAddressResolver functionality - bool getInterfaceIPv4Address(IPvXAddress &ret, InterfaceEntry *ie, bool netmask) + bool getInterfaceIPv4Address(Address &ret, InterfaceEntry *ie, bool netmask) { // TODO: replace linear search for (int i = 0; i < (int)topology.linkInfos.size(); i++) { diff --git a/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.ned b/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.ned index 6bee5dd8493..1bc6475f4cf 100644 --- a/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.ned +++ b/src/networklayer/autorouting/ipv4/IPv4NetworkConfigurator.ned @@ -53,7 +53,7 @@ package inet.networklayer.autorouting.ipv4; // router, etc.) are expected to have the @node property, becaue that's how the // configurator recognizes them in the model. All nodes must have their // interface table (~InterfaceTable module) as their "interfaceTable" submodule. -// All routers must have their routing table (~RoutingTable module) as their +// All routers must have their routing table (~IPv4RoutingTable module) as their // "routingTable" or "networkLayer.routingTable" submodule. // // By default all interfaces in all nodes will have a unique IPv4 address @@ -279,7 +279,7 @@ package inet.networklayer.autorouting.ipv4; // // - @destination // Optional parameter attribute that specifies the destination address in -// the route (IPvXAddressResolver syntax). The default value is "*". +// the route (AddressResolver syntax). The default value is "*". // e.g. "192.168.1.1" or "subnet.client[3]" or "subnet.server(ipv4)" or "*" // // - @netmask @@ -289,7 +289,7 @@ package inet.networklayer.autorouting.ipv4; // // - @gateway // Optional parameter attribute that specifies the gateway (next-hop) -// address in the route (IPvXAddressResolver syntax). When unspecified +// address in the route (AddressResolver syntax). When unspecified // the interface parameter must be specified. The default value is "*". // e.g. "192.168.1.254" or "subnet.router" or "*" // diff --git a/src/networklayer/autorouting/ipv4/IPv4NodeConfigurator.cc b/src/networklayer/autorouting/ipv4/IPv4NodeConfigurator.cc index 3d8e47bdf66..d60123d359d 100644 --- a/src/networklayer/autorouting/ipv4/IPv4NodeConfigurator.cc +++ b/src/networklayer/autorouting/ipv4/IPv4NodeConfigurator.cc @@ -21,7 +21,7 @@ #include "IPv4NodeConfigurator.h" #include "ModuleAccess.h" #include "InterfaceTableAccess.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "NodeStatus.h" #include "NodeOperations.h" #include "opp_utils.h" // for OPP_Global::getModuleByPath() @@ -43,7 +43,7 @@ void IPv4NodeConfigurator::initialize(int stage) const char *networkConfiguratorPath = par("networkConfiguratorModule"); nodeStatus = dynamic_cast(findContainingNode(this)->getSubmodule("status")); interfaceTable = InterfaceTableAccess().get(); - routingTable = RoutingTableAccess().get(); + routingTable = IPv4RoutingTableAccess().get(); if (!networkConfiguratorPath[0]) networkConfigurator = NULL; diff --git a/src/networklayer/autorouting/ipv4/IPv4NodeConfigurator.h b/src/networklayer/autorouting/ipv4/IPv4NodeConfigurator.h index b03b0dbb611..b4742d062d9 100644 --- a/src/networklayer/autorouting/ipv4/IPv4NodeConfigurator.h +++ b/src/networklayer/autorouting/ipv4/IPv4NodeConfigurator.h @@ -25,7 +25,7 @@ #include "ILifecycle.h" #include "NodeStatus.h" #include "IInterfaceTable.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "IPv4NetworkConfigurator.h" /** @@ -51,7 +51,7 @@ class IPv4NodeConfigurator : public cSimpleModule, public ILifecycle { protected: NodeStatus *nodeStatus; IInterfaceTable *interfaceTable; - IRoutingTable *routingTable; + IIPv4RoutingTable *routingTable; IPv4NetworkConfigurator *networkConfigurator; public: diff --git a/src/networklayer/autorouting/ipv6/FlatNetworkConfigurator6.cc b/src/networklayer/autorouting/ipv6/FlatNetworkConfigurator6.cc index 69307e5340b..d36b507124b 100644 --- a/src/networklayer/autorouting/ipv6/FlatNetworkConfigurator6.cc +++ b/src/networklayer/autorouting/ipv6/FlatNetworkConfigurator6.cc @@ -21,9 +21,9 @@ #include "FlatNetworkConfigurator6.h" #include "IInterfaceTable.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "IPv6InterfaceData.h" -#include "RoutingTable6.h" +#include "IPv6RoutingTable.h" // FIXME UPDATE DOCU!!!!!!! @@ -66,8 +66,8 @@ void FlatNetworkConfigurator6::setDisplayString(int numIPNodes, int numNonIPNode bool FlatNetworkConfigurator6::isIPNode(cTopology::Node *node) { - return IPvXAddressResolver().findRoutingTable6Of(node->getModule()) != NULL - && IPvXAddressResolver().findInterfaceTableOf(node->getModule()) != NULL; + return AddressResolver().findRoutingTable6Of(node->getModule()) != NULL + && AddressResolver().findInterfaceTableOf(node->getModule()) != NULL; } void FlatNetworkConfigurator6::configureAdvPrefixes(cTopology& topo) @@ -83,8 +83,8 @@ void FlatNetworkConfigurator6::configureAdvPrefixes(cTopology& topo) // find interface table and assign address to all (non-loopback) interfaces cModule *mod = topo.getNode(i)->getModule(); - IInterfaceTable *ift = IPvXAddressResolver().interfaceTableOf(mod); - RoutingTable6 *rt = IPvXAddressResolver().routingTable6Of(mod); + IInterfaceTable *ift = AddressResolver().interfaceTableOf(mod); + IPv6RoutingTable *rt = AddressResolver().routingTable6Of(mod); // skip hosts if (!rt->par("isRouter").boolValue()) @@ -137,8 +137,8 @@ void FlatNetworkConfigurator6::addOwnAdvPrefixRoutes(cTopology& topo) if (!isIPNode(node)) continue; - RoutingTable6 *rt = IPvXAddressResolver().routingTable6Of(node->getModule()); - IInterfaceTable *ift = IPvXAddressResolver().interfaceTableOf(node->getModule()); + IPv6RoutingTable *rt = AddressResolver().routingTable6Of(node->getModule()); + IInterfaceTable *ift = AddressResolver().interfaceTableOf(node->getModule()); // skip hosts if (!rt->par("isRouter").boolValue()) @@ -179,8 +179,8 @@ void FlatNetworkConfigurator6::addStaticRoutes(cTopology& topo) */ numIPNodes++; // FIXME split into num hosts, num routers - RoutingTable6 *destRt = IPvXAddressResolver().routingTable6Of(destNode->getModule()); - IInterfaceTable *destIft = IPvXAddressResolver().interfaceTableOf(destNode->getModule()); + IPv6RoutingTable *destRt = AddressResolver().routingTable6Of(destNode->getModule()); + IInterfaceTable *destIft = AddressResolver().interfaceTableOf(destNode->getModule()); // don't add routes towards hosts if (!destRt->par("isRouter").boolValue()) @@ -217,8 +217,8 @@ void FlatNetworkConfigurator6::addStaticRoutes(cTopology& topo) if (atNode->getNumPaths() == 0) continue; // not connected - RoutingTable6 *rt = IPvXAddressResolver().routingTable6Of(atNode->getModule()); - IInterfaceTable *ift = IPvXAddressResolver().interfaceTableOf(atNode->getModule()); + IPv6RoutingTable *rt = AddressResolver().routingTable6Of(atNode->getModule()); + IInterfaceTable *ift = AddressResolver().interfaceTableOf(atNode->getModule()); // skip hosts' routing tables if (!rt->par("isRouter").boolValue()) @@ -240,7 +240,7 @@ void FlatNetworkConfigurator6::addStaticRoutes(cTopology& topo) // ok, the next hop is now just one step away from prevNode cGate *remoteGate = prevNode->getPath(0)->getRemoteGate(); cModule *nextHop = remoteGate->getOwnerModule(); - IInterfaceTable *nextHopIft = IPvXAddressResolver().interfaceTableOf(nextHop); + IInterfaceTable *nextHopIft = AddressResolver().interfaceTableOf(nextHop); InterfaceEntry *nextHopOnlinkIf = nextHopIft->getInterfaceByNodeInputGateId(remoteGate->getId()); // find link-local address for next hop diff --git a/src/networklayer/bgpv4/BGPFSM.cc b/src/networklayer/bgpv4/BGPFSM.cc index f1a263e562c..650848c22a2 100644 --- a/src/networklayer/bgpv4/BGPFSM.cc +++ b/src/networklayer/bgpv4/BGPFSM.cc @@ -382,7 +382,7 @@ void Established::entry() //if it's an IGP Session, send update message with only the BGP routes learned by EGP const IPv4Route* rtEntry; BGP::RoutingTableEntry* BGPEntry; - IRoutingTable* IPRoutingTable = session.getIPRoutingTable(); + IIPv4RoutingTable* IPRoutingTable = session.getIPRoutingTable(); for (int i=1; igetNumRoutes(); i++) { diff --git a/src/networklayer/bgpv4/BGPRouting.cc b/src/networklayer/bgpv4/BGPRouting.cc index d69628359cc..821758c806c 100644 --- a/src/networklayer/bgpv4/BGPRouting.cc +++ b/src/networklayer/bgpv4/BGPRouting.cc @@ -16,10 +16,9 @@ // #include "BGPRouting.h" - #include "ModuleAccess.h" #include "NodeStatus.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "OSPFRouting.h" #include "BGPSession.h" @@ -47,9 +46,9 @@ void BGPRouting::initialize(int stage) if (!isOperational) throw cRuntimeError("This module doesn't support starting in node DOWN state"); } - else if (stage==4) // we must wait until RoutingTable is completely initialized + else if (stage==4) // we must wait until IPv4RoutingTable is completely initialized { - _rt = RoutingTableAccess().get(); + _rt = IPv4RoutingTableAccess().get(); _inft = InterfaceTableAccess().get(); // read BGP configuration @@ -170,7 +169,7 @@ void BGPRouting::processMessageFromTCP(cMessage *msg) socket = new TCPSocket(msg); socket->readDataTransferModePar(*this); socket->setOutputGate(gate("tcpOut")); - IPv4Address peerAddr = socket->getRemoteAddress().get4(); + IPv4Address peerAddr = socket->getRemoteAddress().toIPv4(); BGP::SessionID i = findIdFromPeerAddr(_BGPSessions, peerAddr); if (i == (BGP::SessionID)-1) { @@ -762,7 +761,7 @@ bool BGPRouting::deleteBGPRoutingEntry(BGP::RoutingTableEntry* entry){ } /*return index of the IPv4 table if the route is found, -1 else*/ -int BGPRouting::isInRoutingTable(IRoutingTable* rtTable, IPv4Address addr) +int BGPRouting::isInRoutingTable(IIPv4RoutingTable* rtTable, IPv4Address addr) { for (int i = 0; i < rtTable->getNumRoutes(); i++) { @@ -833,7 +832,7 @@ bool BGPRouting::isInASList(std::vector ASList, BGP::RoutingTableEntr } /*return true if OSPF exists, false else*/ -bool BGPRouting::ospfExist(IRoutingTable* rtTable) +bool BGPRouting::ospfExist(IIPv4RoutingTable* rtTable) { for (int i=0; igetNumRoutes(); i++) { diff --git a/src/networklayer/bgpv4/BGPRouting.h b/src/networklayer/bgpv4/BGPRouting.h index f8462b21d5e..8efce1f9de7 100644 --- a/src/networklayer/bgpv4/BGPRouting.h +++ b/src/networklayer/bgpv4/BGPRouting.h @@ -22,7 +22,7 @@ #include "TCPSocket.h" #include "TCPSocketMap.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTableAccess.h" #include "OSPFRoutingAccess.h" #include "BGPRoutingTableEntry.h" @@ -65,7 +65,7 @@ class INET_API BGPRouting : public cSimpleModule, public ILifecycle, public TCPS void getCancelAndDelete(cMessage* msg) { return cancelAndDelete(msg);} cMessage* getCancelEvent(cMessage* msg) { return cancelEvent(msg);} cGate* getGate(const char* gateName) { return gate(gateName);} - IRoutingTable* getIPRoutingTable() { return _rt;} + IIPv4RoutingTable* getIPRoutingTable() { return _rt;} std::vector getBGPRoutingTable() { return _BGPRoutingTable;} /** * \brief active listenSocket for a given session (used by BGPFSM) @@ -84,7 +84,7 @@ class INET_API BGPRouting : public cSimpleModule, public ILifecycle, public TCPS */ BGP::SessionID findNextSession(BGP::type type, bool startSession = false); /** - * \brief check if the route is in OSPF external RoutingTable + * \brief check if the route is in OSPF external IPv4RoutingTable * * \return true if it is, false else */ @@ -121,11 +121,11 @@ class INET_API BGPRouting : public cSimpleModule, public ILifecycle, public TCPS void loadSessionConfig(cXMLElementList& sessionList, simtime_t* delayTab); void loadConfigFromXML(cXMLElement *bgpConfig); BGP::ASID findMyAS(cXMLElementList& ASList, int& outRouterPosition); - bool ospfExist(IRoutingTable* rtTable); + bool ospfExist(IIPv4RoutingTable* rtTable); void loadTimerConfig(cXMLElementList& timerConfig, simtime_t* delayTab); unsigned char asLoopDetection(BGP::RoutingTableEntry* entry, BGP::ASID myAS); BGP::SessionID findIdFromPeerAddr(std::map sessions, IPv4Address peerAddr); - int isInRoutingTable(IRoutingTable* rtTable, IPv4Address addr); + int isInRoutingTable(IIPv4RoutingTable* rtTable, IPv4Address addr); int isInInterfaceTable(IInterfaceTable* rtTable, IPv4Address addr); BGP::SessionID findIdFromSocketConnId(std::map sessions, int connId); unsigned int calculateStartDelay(int rtListSize, unsigned char rtPosition, unsigned char rtPeerPosition); @@ -135,7 +135,7 @@ class INET_API BGPRouting : public cSimpleModule, public ILifecycle, public TCPS BGP::SessionID _currSessionId; IInterfaceTable* _inft; - IRoutingTable* _rt; // The IP routing table + IIPv4RoutingTable* _rt; // The IP routing table std::vector _BGPRoutingTable; // The BGP routing table std::vector _prefixListIN; std::vector _prefixListOUT; diff --git a/src/networklayer/bgpv4/BGPRoutingTableEntry.h b/src/networklayer/bgpv4/BGPRoutingTableEntry.h index 759abad89ed..e1ab701edaf 100644 --- a/src/networklayer/bgpv4/BGPRoutingTableEntry.h +++ b/src/networklayer/bgpv4/BGPRoutingTableEntry.h @@ -18,7 +18,7 @@ #ifndef __INET_BGPROUTINGTABLEENTRY_H #define __INET_BGPROUTINGTABLEENTRY_H -#include "RoutingTable.h" +#include "IPv4RoutingTable.h" #include "BGPCommon.h" namespace BGP { diff --git a/src/networklayer/bgpv4/BGPSession.cc b/src/networklayer/bgpv4/BGPSession.cc index 50fb8315d41..539852a9434 100644 --- a/src/networklayer/bgpv4/BGPSession.cc +++ b/src/networklayer/bgpv4/BGPSession.cc @@ -124,7 +124,7 @@ void BGPSession::sendOpenMessage() BGPOpenMessage* openMsg = new BGPOpenMessage("BGPOpen"); openMsg->setMyAS(_info.ASValue); openMsg->setHoldTime(_holdTime); - openMsg->setBGPIdentifier(_info.socket->getLocalAddress().get4()); + openMsg->setBGPIdentifier(_info.socket->getLocalAddress().toIPv4()); _info.socket->send(openMsg); _openMsgSent ++; } diff --git a/src/networklayer/bgpv4/BGPSession.h b/src/networklayer/bgpv4/BGPSession.h index 13cc2db43f5..4b0b7d8a0bb 100644 --- a/src/networklayer/bgpv4/BGPSession.h +++ b/src/networklayer/bgpv4/BGPSession.h @@ -61,7 +61,7 @@ class INET_API BGPSession : public cObject IPv4Address getPeerAddr() { return _info.peerAddr;} TCPSocket* getSocket() { return _info.socket;} TCPSocket* getSocketListen() { return _info.socketListen;} - IRoutingTable* getIPRoutingTable() { return _bgpRouting.getIPRoutingTable();} + IIPv4RoutingTable* getIPRoutingTable() { return _bgpRouting.getIPRoutingTable();} std::vector getBGPRoutingTable() { return _bgpRouting.getBGPRoutingTable();} Macho::Machine& getFSM() { return *_fsm;} bool checkExternalRoute(const IPv4Route* ospfRoute) { return _bgpRouting.checkExternalRoute(ospfRoute);} diff --git a/src/networklayer/common/InterfaceTable.h b/src/networklayer/common/InterfaceTable.h index c16dbe83126..6747b83b6ea 100644 --- a/src/networklayer/common/InterfaceTable.h +++ b/src/networklayer/common/InterfaceTable.h @@ -40,7 +40,7 @@ * * Interfaces are dynamically registered: at the start of the simulation, * every L2 module adds its own InterfaceEntry to the table; after that, - * IPv4's IRoutingTable and IPv6's RoutingTable6 (an possibly, further + * IPv4's IIPv4RoutingTable and IPv6's IPv6RoutingTable (an possibly, further * L3 protocols) add protocol-specific data on each InterfaceEntry * (see IPv4InterfaceData, IPv6InterfaceData, and InterfaceEntry::setIPv4Data(), * InterfaceEntry::setIPv6Data()) diff --git a/src/networklayer/common/InterfaceTable.ned b/src/networklayer/common/InterfaceTable.ned index eb14d385670..3951d3b9ba5 100644 --- a/src/networklayer/common/InterfaceTable.ned +++ b/src/networklayer/common/InterfaceTable.ned @@ -24,7 +24,7 @@ package inet.networklayer.common; // ~PPPInterface. In addition to registered interfaces, a loopback interface // will also be created. This table only contains protocol-independent // properties of interfaces -- IPv4 or IPv6 specific per-interface data -// (addresses etc) are kept in ~RoutingTable and ~RoutingTable6. +// (addresses etc) are kept in ~IPv4RoutingTable and ~IPv6RoutingTable. // Must be named as "interfaceTable". // // This module has no gates; all functionality can be accessed via member diff --git a/src/networklayer/contract/IPvXAddress.cc b/src/networklayer/contract/Address.cc similarity index 84% rename from src/networklayer/contract/IPvXAddress.cc rename to src/networklayer/contract/Address.cc index 79d050f26f8..2ff3572143b 100644 --- a/src/networklayer/contract/IPvXAddress.cc +++ b/src/networklayer/contract/Address.cc @@ -15,12 +15,12 @@ // License along with this program; if not, see . // -#include "IPvXAddress.h" +#include "Address.h" #include -bool IPvXAddress::tryParse(const char *addr) +bool Address::tryParse(const char *addr) { // try as IPv4 if (IPv4Address::isWellFormed(addr)) @@ -41,9 +41,9 @@ bool IPvXAddress::tryParse(const char *addr) return false; } -void IPvXAddress::set(const char *addr) +void Address::set(const char *addr) { if (!tryParse(addr)) - throw cRuntimeError("IPvXAddress: cannot interpret address string `%s'", addr); + throw cRuntimeError("Address: cannot interpret address string `%s'", addr); } diff --git a/src/networklayer/contract/IPvXAddress.h b/src/networklayer/contract/Address.h similarity index 80% rename from src/networklayer/contract/IPvXAddress.h rename to src/networklayer/contract/Address.h index 734c52aac4d..acd8ac5ed40 100644 --- a/src/networklayer/contract/IPvXAddress.h +++ b/src/networklayer/contract/Address.h @@ -32,7 +32,7 @@ * Storage is efficient: an object occupies size of an IPv6 address * (128 bits=16 bytes) plus a bool. */ -class INET_API IPvXAddress +class INET_API Address { protected: uint32 d[4]; @@ -42,34 +42,34 @@ class INET_API IPvXAddress /** * Constructor for IPv4 addresses. */ - IPvXAddress() {isv6 = false; d[0] = 0;} + Address() {isv6 = false; d[0] = 0;} /** * Constructor for IPv4 addresses. */ - IPvXAddress(const IPv4Address& addr) {set(addr);} + Address(const IPv4Address& addr) {set(addr);} /** * Constructor for IPv6 addresses. */ - IPvXAddress(const IPv6Address& addr) {set(addr);} + Address(const IPv6Address& addr) {set(addr);} /** * Accepts string representations supported by IPv4Address (dotted decimal * notation) and IPv6Address (hex string with colons). Throws an error * if the format is not recognized. */ - explicit IPvXAddress(const char *addr) {set(addr);} + explicit Address(const char *addr) {set(addr);} /** * Copy constructor. */ - IPvXAddress(const IPvXAddress& addr) {set(addr);} + Address(const Address& addr) {set(addr);} /** * Destructor */ - ~IPvXAddress() {} + ~Address() {} /** * Is this an IPv6 address? @@ -79,10 +79,10 @@ class INET_API IPvXAddress /** * Get IPv4 address. Throws exception if this is an IPv6 address. */ - IPv4Address get4() const + IPv4Address toIPv4() const { if (isv6) - throw cRuntimeError("IPvXAddress: cannot return IPv6 address %s as IPv4", str().c_str()); + throw cRuntimeError("Address: cannot return IPv6 address %s as IPv4", str().c_str()); return IPv4Address(d[0]); } @@ -90,14 +90,14 @@ class INET_API IPvXAddress /** * Get IPv6 address. Throws exception if this is an IPv4 address. */ - IPv6Address get6() const + IPv6Address toIPv6() const { if (!isv6) { if (d[0] == 0) // allow null address to be returned as IPv6 return IPv6Address(); - throw cRuntimeError("IPvXAddress: cannot return IPv4 address %s as IPv6", str().c_str()); + throw cRuntimeError("Address: cannot return IPv4 address %s as IPv6", str().c_str()); } return IPv6Address(d[0], d[1], d[2], d[3]); @@ -132,7 +132,7 @@ class INET_API IPvXAddress /** * Assignment */ - void set(const IPvXAddress& addr) + void set(const Address& addr) { isv6 = addr.isv6; d[0] = addr.d[0]; @@ -153,17 +153,17 @@ class INET_API IPvXAddress /** * Assignment */ - IPvXAddress& operator=(const IPv4Address& addr) {set(addr); return *this;} + Address& operator=(const IPv4Address& addr) {set(addr); return *this;} /** * Assignment */ - IPvXAddress& operator=(const IPv6Address& addr) {set(addr); return *this;} + Address& operator=(const IPv6Address& addr) {set(addr); return *this;} /** * Assignment */ - IPvXAddress& operator=(const IPvXAddress& addr) {set(addr); return *this;} + Address& operator=(const Address& addr) {set(addr); return *this;} /** * Parses and assigns the given address and returns true if the string is @@ -178,7 +178,7 @@ class INET_API IPvXAddress { if (isv6) { - return get6().str(); + return toIPv6().str(); } else if (d[0] == 0) { @@ -186,7 +186,7 @@ class INET_API IPvXAddress } else { - return get4().str(); + return toIPv4().str(); } } @@ -203,7 +203,7 @@ class INET_API IPvXAddress */ bool isMulticast() const { - return isv6 ? get6().isMulticast() : get4().isMulticast(); + return isv6 ? toIPv6().isMulticast() : toIPv4().isMulticast(); } /** @@ -237,7 +237,7 @@ class INET_API IPvXAddress /** * Returns true if the two addresses are equal */ - bool equals(const IPvXAddress& addr) const + bool equals(const Address& addr) const { return (isv6 == addr.isv6) && (d[0] == addr.d[0]) && (!isv6 || (d[3] == addr.d[3] && d[2] == addr.d[2] && d[1] == addr.d[1])); @@ -266,17 +266,17 @@ class INET_API IPvXAddress /** * Returns equals(addr). */ - bool operator==(const IPvXAddress& addr) const {return equals(addr);} + bool operator==(const Address& addr) const {return equals(addr);} /** * Returns !equals(addr). */ - bool operator!=(const IPvXAddress& addr) const {return !equals(addr);} + bool operator!=(const Address& addr) const {return !equals(addr);} /** * Compares two addresses. */ - bool operator<(const IPvXAddress& addr) const + bool operator<(const Address& addr) const { if (isv6 != addr.isv6) return !isv6; @@ -287,20 +287,20 @@ class INET_API IPvXAddress } }; -inline std::ostream& operator<<(std::ostream& os, const IPvXAddress& ip) +inline std::ostream& operator<<(std::ostream& os, const Address& ip) { return os << ip.str(); } -inline void doPacking(cCommBuffer *buf, const IPvXAddress& addr) +inline void doPacking(cCommBuffer *buf, const Address& addr) { if (buf->packFlag(addr.isIPv6())) - doPacking(buf, addr.get6()); + doPacking(buf, addr.toIPv6()); else - doPacking(buf, addr.get4()); + doPacking(buf, addr.toIPv4()); } -inline void doUnpacking(cCommBuffer *buf, IPvXAddress& addr) +inline void doUnpacking(cCommBuffer *buf, Address& addr) { if (buf->checkFlag()) { diff --git a/src/networklayer/contract/IPvXAddressResolver.cc b/src/networklayer/contract/AddressResolver.cc similarity index 71% rename from src/networklayer/contract/IPvXAddressResolver.cc rename to src/networklayer/contract/AddressResolver.cc index d64e0d92609..c2446d58a92 100644 --- a/src/networklayer/contract/IPvXAddressResolver.cc +++ b/src/networklayer/contract/AddressResolver.cc @@ -19,34 +19,34 @@ // @author Zoltan Bojthe // -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "IInterfaceTable.h" #include "NotificationBoard.h" #ifdef WITH_IPv4 #include "IPv4NetworkConfigurator.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "IPv4InterfaceData.h" #endif #ifdef WITH_IPv6 #include "IPv6InterfaceData.h" -#include "RoutingTable6.h" +#include "IPv6RoutingTable.h" #endif -IPvXAddress IPvXAddressResolver::resolve(const char *s, int addrType) +Address AddressResolver::resolve(const char *s, int addrType) { - IPvXAddress addr; + Address addr; if (!tryResolve(s, addr, addrType)) - throw cRuntimeError("IPvXAddressResolver: address `%s' not configured (yet?)", s); + throw cRuntimeError("AddressResolver: address `%s' not configured (yet?)", s); return addr; } -std::vector IPvXAddressResolver::resolve(std::vector strs, int addrType) +std::vector
AddressResolver::resolve(std::vector strs, int addrType) { - std::vector result; + std::vector
result; int n = strs.size(); result.reserve(n); for (int i=0; i IPvXAddressResolver::resolve(std::vector s return result; } -bool IPvXAddressResolver::tryResolve(const char *s, IPvXAddress& result, int addrType) +bool AddressResolver::tryResolve(const char *s, Address& result, int addrType) { // empty address - result = IPvXAddress(); + result = Address(); if (!s || !*s) return true; @@ -113,12 +113,12 @@ bool IPvXAddressResolver::tryResolve(const char *s, IPvXAddress& result, int add } if (c) - throw cRuntimeError("IPvXAddressResolver: syntax error parsing address spec `%s'", s); + throw cRuntimeError("AddressResolver: syntax error parsing address spec `%s'", s); // find module cModule *mod = simulation.getModuleByPath(modname.c_str()); if (!mod) - throw cRuntimeError("IPvXAddressResolver: module `%s' not found", modname.c_str()); + throw cRuntimeError("AddressResolver: module `%s' not found", modname.c_str()); // check protocol @@ -129,7 +129,7 @@ bool IPvXAddressResolver::tryResolve(const char *s, IPvXAddress& result, int add else if (protocol == "ipv6") addrType = ADDR_IPv6; else - throw cRuntimeError("IPvXAddressResolver: error parsing address spec `%s': address type must be `(ipv4)' or `(ipv6)'", s); + throw cRuntimeError("AddressResolver: error parsing address spec `%s': address type must be `(ipv4)' or `(ipv6)'", s); } if (netmask) addrType |= ADDR_MASK; @@ -140,45 +140,45 @@ bool IPvXAddressResolver::tryResolve(const char *s, IPvXAddress& result, int add { cModule *destnode = simulation.getModuleByPath(destnodename.c_str()); if (!destnode) - throw cRuntimeError("IPvXAddressResolver: destination module `%s' not found", destnodename.c_str()); + throw cRuntimeError("AddressResolver: destination module `%s' not found", destnodename.c_str()); result = addressOf(mod, destnode, addrType); } else if (ifname.empty()) result = addressOf(mod, addrType); else if (ifname == "routerId") - result = IPvXAddress(routerIdOf(mod)); // addrType is meaningless here, routerId is protocol independent + result = Address(routerIdOf(mod)); // addrType is meaningless here, routerId is protocol independent else result = addressOf(mod, ifname.c_str(), addrType); return !result.isUnspecified(); } -IPv4Address IPvXAddressResolver::routerIdOf(cModule *host) +IPv4Address AddressResolver::routerIdOf(cModule *host) { #ifdef WITH_IPv4 - IRoutingTable *rt = routingTableOf(host); + IIPv4RoutingTable *rt = routingTableOf(host); return rt->getRouterId(); #else throw cRuntimeError("INET was compiled without IPv4 support"); #endif } -IPvXAddress IPvXAddressResolver::addressOf(cModule *host, int addrType) +Address AddressResolver::addressOf(cModule *host, int addrType) { IInterfaceTable *ift = interfaceTableOf(host); return getAddressFrom(ift, addrType); } -IPvXAddress IPvXAddressResolver::addressOf(cModule *host, const char *ifname, int addrType) +Address AddressResolver::addressOf(cModule *host, const char *ifname, int addrType) { IInterfaceTable *ift = interfaceTableOf(host); InterfaceEntry *ie = ift->getInterfaceByName(ifname); if (ie) return getAddressFrom(ie, addrType); - throw cRuntimeError("IPvXAddressResolver: no interface called `%s' in interface table of `%s'", ifname, host->getFullPath().c_str()); + throw cRuntimeError("AddressResolver: no interface called `%s' in interface table of `%s'", ifname, host->getFullPath().c_str()); } -IPvXAddress IPvXAddressResolver::addressOf(cModule *host, cModule *destmod, int addrType) +Address AddressResolver::addressOf(cModule *host, cModule *destmod, int addrType) { IInterfaceTable *ift = interfaceTableOf(host); for (int i=0; i < ift->getNumInterfaces(); i++) @@ -192,12 +192,12 @@ IPvXAddress IPvXAddressResolver::addressOf(cModule *host, cModule *destmod, int return getAddressFrom(ie, addrType); } } - throw cRuntimeError("IPvXAddressResolver: no interface connected to `%s' module in interface table of `%s'", destmod->getFullPath().c_str(), host->getFullPath().c_str()); + throw cRuntimeError("AddressResolver: no interface connected to `%s' module in interface table of `%s'", destmod->getFullPath().c_str(), host->getFullPath().c_str()); } -IPvXAddress IPvXAddressResolver::getAddressFrom(IInterfaceTable *ift, int addrType) +Address AddressResolver::getAddressFrom(IInterfaceTable *ift, int addrType) { - IPvXAddress ret; + Address ret; bool netmask = addrType & ADDR_MASK; if (addrType & ADDR_IPv6) @@ -220,15 +220,15 @@ IPvXAddress IPvXAddressResolver::getAddressFrom(IInterfaceTable *ift, int addrTy } else { - throw cRuntimeError("IPvXAddressResolver: unknown addrType %d", addrType); + throw cRuntimeError("AddressResolver: unknown addrType %d", addrType); } return ret; } -IPvXAddress IPvXAddressResolver::getAddressFrom(InterfaceEntry *ie, int addrType) +Address AddressResolver::getAddressFrom(InterfaceEntry *ie, int addrType) { - IPvXAddress ret; + Address ret; bool mask = addrType & ADDR_MASK; if (addrType & ADDR_IPv6) @@ -245,16 +245,16 @@ IPvXAddress IPvXAddressResolver::getAddressFrom(InterfaceEntry *ie, int addrType } else { - throw cRuntimeError("IPvXAddressResolver: unknown addrType %d", addrType); + throw cRuntimeError("AddressResolver: unknown addrType %d", addrType); } return ret; } -bool IPvXAddressResolver::getIPv4AddressFrom(IPvXAddress& retAddr, IInterfaceTable *ift, bool netmask) +bool AddressResolver::getIPv4AddressFrom(Address& retAddr, IInterfaceTable *ift, bool netmask) { if (ift->getNumInterfaces()==0) - throw cRuntimeError("IPvXAddressResolver: interface table `%s' has no interface registered " + throw cRuntimeError("AddressResolver: interface table `%s' has no interface registered " "(yet? try in a later init stage!)", ift->getFullPath().c_str()); #ifdef WITH_IPv4 @@ -271,11 +271,11 @@ bool IPvXAddressResolver::getIPv4AddressFrom(IPvXAddress& retAddr, IInterfaceTab return false; } -bool IPvXAddressResolver::getIPv6AddressFrom(IPvXAddress& retAddr, IInterfaceTable *ift, bool netmask) +bool AddressResolver::getIPv6AddressFrom(Address& retAddr, IInterfaceTable *ift, bool netmask) { // browse interfaces and pick a globally routable address if (ift->getNumInterfaces()==0) - throw cRuntimeError("IPvXAddressResolver: interface table `%s' has no interface registered " + throw cRuntimeError("AddressResolver: interface table `%s' has no interface registered " "(yet? try in a later init stage!)", ift->getFullPath().c_str()); #ifndef WITH_IPv6 @@ -301,7 +301,7 @@ bool IPvXAddressResolver::getIPv6AddressFrom(IPvXAddress& retAddr, IInterfaceTab #endif } -bool IPvXAddressResolver::getInterfaceIPv6Address(IPvXAddress &ret, InterfaceEntry *ie, bool netmask) +bool AddressResolver::getInterfaceIPv6Address(Address &ret, InterfaceEntry *ie, bool netmask) { #ifdef WITH_IPv6 if (netmask) @@ -319,7 +319,7 @@ bool IPvXAddressResolver::getInterfaceIPv6Address(IPvXAddress &ret, InterfaceEnt return false; } -bool IPvXAddressResolver::getInterfaceIPv4Address(IPvXAddress &ret, InterfaceEntry *ie, bool netmask) +bool AddressResolver::getInterfaceIPv4Address(Address &ret, InterfaceEntry *ie, bool netmask) { #ifdef WITH_IPv4 if (ie->ipv4Data()) @@ -343,80 +343,80 @@ bool IPvXAddressResolver::getInterfaceIPv4Address(IPvXAddress &ret, InterfaceEnt return false; } -IInterfaceTable *IPvXAddressResolver::interfaceTableOf(cModule *host) +IInterfaceTable *AddressResolver::interfaceTableOf(cModule *host) { // find IInterfaceTable cModule *mod = host->getSubmodule("interfaceTable"); if (!mod) - throw cRuntimeError("IPvXAddressResolver: IInterfaceTable not found as submodule " + throw cRuntimeError("AddressResolver: IInterfaceTable not found as submodule " " `interfaceTable' in host/router `%s'", host->getFullPath().c_str()); return check_and_cast(mod); } -IRoutingTable *IPvXAddressResolver::routingTableOf(cModule *host) +IIPv4RoutingTable *AddressResolver::routingTableOf(cModule *host) { - IRoutingTable *mod = findRoutingTableOf(host); + IIPv4RoutingTable *mod = findRoutingTableOf(host); if (!mod) - throw cRuntimeError("IPvXAddressResolver: IRoutingTable not found as submodule " + throw cRuntimeError("AddressResolver: IIPv4RoutingTable not found as submodule " " `routingTable' in host/router `%s'", host->getFullPath().c_str()); return mod; } -RoutingTable6 *IPvXAddressResolver::routingTable6Of(cModule *host) +IPv6RoutingTable *AddressResolver::routingTable6Of(cModule *host) { - // find RoutingTable6 - RoutingTable6 *mod = findRoutingTable6Of(host); + // find IPv6RoutingTable + IPv6RoutingTable *mod = findRoutingTable6Of(host); if (!mod) - throw cRuntimeError("IPvXAddressResolver: RoutingTable6 not found as submodule " + throw cRuntimeError("AddressResolver: IPv6RoutingTable not found as submodule " " `routingTable6' in host/router `%s'", host->getFullPath().c_str()); return mod; } -NotificationBoard *IPvXAddressResolver::notificationBoardOf(cModule *host) +NotificationBoard *AddressResolver::notificationBoardOf(cModule *host) { // find NotificationBoard cModule *mod = host->getSubmodule("notificationBoard"); if (!mod) - throw cRuntimeError("IPvXAddressResolver: NotificationBoard not found as submodule " + throw cRuntimeError("AddressResolver: NotificationBoard not found as submodule " " notificationBoard' in host/router `%s'", host->getFullPath().c_str()); return check_and_cast(mod); } -IInterfaceTable *IPvXAddressResolver::findInterfaceTableOf(cModule *host) +IInterfaceTable *AddressResolver::findInterfaceTableOf(cModule *host) { cModule *mod = host->getSubmodule("interfaceTable"); return dynamic_cast(mod); } -IRoutingTable *IPvXAddressResolver::findRoutingTableOf(cModule *host) +IIPv4RoutingTable *AddressResolver::findRoutingTableOf(cModule *host) { #ifdef WITH_IPv4 cModule *mod = host->getSubmodule("routingTable"); - return dynamic_cast(mod); + return dynamic_cast(mod); #else return NULL; #endif } -RoutingTable6 *IPvXAddressResolver::findRoutingTable6Of(cModule *host) +IPv6RoutingTable *AddressResolver::findRoutingTable6Of(cModule *host) { #ifdef WITH_IPv6 cModule *mod = host->getSubmodule("routingTable6"); - return dynamic_cast(mod); + return dynamic_cast(mod); #else return NULL; #endif } -NotificationBoard *IPvXAddressResolver::findNotificationBoardOf(cModule *host) +NotificationBoard *AddressResolver::findNotificationBoardOf(cModule *host) { cModule *mod = host->getSubmodule("notificationBoard"); return dynamic_cast(mod); } -cModule *IPvXAddressResolver::findHostWithAddress(const IPvXAddress & add) +cModule *AddressResolver::findHostWithAddress(const Address & add) { if (add.isUnspecified() || add.isMulticast()) return NULL; @@ -429,7 +429,7 @@ cModule *IPvXAddressResolver::findHostWithAddress(const IPvXAddress & add) for (int i=0; igetModule(); - IInterfaceTable * itable = IPvXAddressResolver().findInterfaceTableOf(mod); + IInterfaceTable * itable = AddressResolver().findInterfaceTableOf(mod); if (itable != NULL) { for (int i = 0; i < itable->getNumInterfaces(); i++) @@ -438,14 +438,14 @@ cModule *IPvXAddressResolver::findHostWithAddress(const IPvXAddress & add) if (add.isIPv6()) { #ifdef WITH_IPv6 - if (entry->ipv6Data()->hasAddress(add.get6())) + if (entry->ipv6Data()->hasAddress(add.toIPv6())) return mod; #endif } else { #ifdef WITH_IPv4 - if (entry->ipv4Data()->getIPAddress() == add.get4()) + if (entry->ipv4Data()->getIPAddress() == add.toIPv4()) return mod; #endif } diff --git a/src/networklayer/contract/IPvXAddressResolver.h b/src/networklayer/contract/AddressResolver.h similarity index 73% rename from src/networklayer/contract/IPvXAddressResolver.h rename to src/networklayer/contract/AddressResolver.h index 3732a16ea9d..4c2c6645479 100644 --- a/src/networklayer/contract/IPvXAddressResolver.h +++ b/src/networklayer/contract/AddressResolver.h @@ -24,13 +24,13 @@ #include "INETDefs.h" -#include "IPvXAddress.h" +#include "Address.h" // Forward declarations: class IInterfaceTable; class InterfaceEntry; -class IRoutingTable; -class RoutingTable6; +class IIPv4RoutingTable; +class IPv6RoutingTable; class NotificationBoard; @@ -49,17 +49,17 @@ class NotificationBoard; * - routerId: "router1%routerId", "R1%routerId" * - interface of a host or router toward defined another node: "client1>router" */ -class INET_API IPvXAddressResolver +class INET_API AddressResolver { protected: // internal - virtual bool getIPv4AddressFrom(IPvXAddress &retAddr, IInterfaceTable *ift, bool netmask); + virtual bool getIPv4AddressFrom(Address &retAddr, IInterfaceTable *ift, bool netmask); // internal - virtual bool getIPv6AddressFrom(IPvXAddress &retAddr, IInterfaceTable *ift, bool netmask); + virtual bool getIPv6AddressFrom(Address &retAddr, IInterfaceTable *ift, bool netmask); // internal - virtual bool getInterfaceIPv4Address(IPvXAddress &ret, InterfaceEntry *ie, bool mask); + virtual bool getInterfaceIPv4Address(Address &ret, InterfaceEntry *ie, bool mask); // internal - virtual bool getInterfaceIPv6Address(IPvXAddress &ret, InterfaceEntry *ie, bool mask); + virtual bool getInterfaceIPv6Address(Address &ret, InterfaceEntry *ie, bool mask); public: enum { @@ -74,8 +74,8 @@ class INET_API IPvXAddressResolver }; public: - IPvXAddressResolver() {} - virtual ~IPvXAddressResolver() {} + AddressResolver() {} + virtual ~AddressResolver() {} /** * Accepts dotted decimal notation ("127.0.0.1"), module name of the host @@ -84,14 +84,14 @@ class INET_API IPvXAddressResolver * looked up using simulation.getModuleByPath(), and then * addressOf() will be called to determine its IP address. */ - virtual IPvXAddress resolve(const char *str, int addrType = ADDR_PREFER_IPv6); + virtual Address resolve(const char *str, int addrType = ADDR_PREFER_IPv6); /** * Utility function: Calls resolve() for each item in the string vector, and * returns the result in an address vector. The string vector may come e.g. * from cStringTokenizer::asVector(). */ - virtual std::vector resolve(std::vector strs, int addrType = ADDR_PREFER_IPv6); + virtual std::vector
resolve(std::vector strs, int addrType = ADDR_PREFER_IPv6); /** * Similar to resolve(), but returns false (instead of throwing an error) @@ -99,22 +99,22 @@ class INET_API IPvXAddressResolver * doesn't have an address assigned yet. (It still throws an error * on any other error condition). */ - virtual bool tryResolve(const char *str, IPvXAddress& result, int addrType = ADDR_PREFER_IPv6); + virtual bool tryResolve(const char *str, Address& result, int addrType = ADDR_PREFER_IPv6); /** @name Utility functions supporting resolve() */ //@{ /** * Returns IPv4 or IPv6 address of the given host or router. * - * This function uses routingTableOf() to find the IRoutingTable module, + * This function uses routingTableOf() to find the IIPv4RoutingTable module, * then invokes getAddressFrom() to extract the IP address. */ - virtual IPvXAddress addressOf(cModule *host, int addrType = ADDR_PREFER_IPv6); + virtual Address addressOf(cModule *host, int addrType = ADDR_PREFER_IPv6); /** * Similar to addressOf(), but only looks at the given interface */ - virtual IPvXAddress addressOf(cModule *host, const char *ifname, int addrType = ADDR_PREFER_IPv6); + virtual Address addressOf(cModule *host, const char *ifname, int addrType = ADDR_PREFER_IPv6); /** * Returns IPv4 or IPv6 address of the given host or router. @@ -122,11 +122,11 @@ class INET_API IPvXAddressResolver * This function find an interface of host connected to destmod * then invokes getAddressFrom() to extract the IP address. */ - virtual IPvXAddress addressOf(cModule *host, cModule *destmod, int addrType = ADDR_PREFER_IPv6); + virtual Address addressOf(cModule *host, cModule *destmod, int addrType = ADDR_PREFER_IPv6); /** * Returns the router Id of the given router. Router Id is obtained from - * the getRouterId() method of the IRoutingTable submodule. + * the getRouterId() method of the IIPv4RoutingTable submodule. */ virtual IPv4Address routerIdOf(cModule *host); @@ -134,12 +134,12 @@ class INET_API IPvXAddressResolver * Returns the IPv4 or IPv6 address of the given host or router, given its IInterfaceTable * module. For IPv4, the first usable interface address is chosen. */ - virtual IPvXAddress getAddressFrom(IInterfaceTable *ift, int addrType = ADDR_PREFER_IPv6); + virtual Address getAddressFrom(IInterfaceTable *ift, int addrType = ADDR_PREFER_IPv6); /** * Returns the IPv4 or IPv6 address of the given interface (of a host or router). */ - virtual IPvXAddress getAddressFrom(InterfaceEntry *ie, int addrType = ADDR_PREFER_IPv6); + virtual Address getAddressFrom(InterfaceEntry *ie, int addrType = ADDR_PREFER_IPv6); /** * The function tries to look up the IInterfaceTable module as submodule @@ -149,18 +149,18 @@ class INET_API IPvXAddressResolver virtual IInterfaceTable *interfaceTableOf(cModule *host); /** - * The function tries to look up the IRoutingTable module as submodule + * The function tries to look up the IIPv4RoutingTable module as submodule * "routingTable" or "networkLayer.routingTable" within * the host/router module. Throws an error if not found. */ - virtual IRoutingTable *routingTableOf(cModule *host); + virtual IIPv4RoutingTable *routingTableOf(cModule *host); /** - * The function tries to look up the RoutingTable6 module as submodule + * The function tries to look up the IPv6RoutingTable module as submodule * "routingTable6" or "networkLayer.routingTable6" within * the host/router module. Throws an error if not found. */ - virtual RoutingTable6 *routingTable6Of(cModule *host); + virtual IPv6RoutingTable *routingTable6Of(cModule *host); /** * The function tries to look up the NotificationBoard module as submodule @@ -177,12 +177,12 @@ class INET_API IPvXAddressResolver /** * Like routingTableOf(), but doesn't throw error if not found. */ - virtual IRoutingTable *findRoutingTableOf(cModule *host); + virtual IIPv4RoutingTable *findRoutingTableOf(cModule *host); /** * Like interfaceTableOf(), but doesn't throw error if not found. */ - virtual RoutingTable6 *findRoutingTable6Of(cModule *host); + virtual IPv6RoutingTable *findRoutingTable6Of(cModule *host); /** * Like notificationBoardOf(), but doesn't throw error if not found. @@ -192,7 +192,7 @@ class INET_API IPvXAddressResolver /** * Find the Host with the specified address. */ - virtual cModule *findHostWithAddress(const IPvXAddress &addr); + virtual cModule *findHostWithAddress(const Address &addr); //@} }; diff --git a/src/networklayer/diffserv/BehaviorAggregateClassifier.cc b/src/networklayer/diffserv/BehaviorAggregateClassifier.cc index 30849049c98..bbf7be7c85c 100644 --- a/src/networklayer/diffserv/BehaviorAggregateClassifier.cc +++ b/src/networklayer/diffserv/BehaviorAggregateClassifier.cc @@ -17,8 +17,8 @@ // #include "INETDefs.h" -#include "IPvXAddress.h" -#include "IPvXAddressResolver.h" +#include "Address.h" +#include "AddressResolver.h" #ifdef WITH_IPv4 #include "IPv4Datagram.h" diff --git a/src/networklayer/diffserv/MultiFieldClassifier.cc b/src/networklayer/diffserv/MultiFieldClassifier.cc index 57b51d1751e..3214bbcf57d 100644 --- a/src/networklayer/diffserv/MultiFieldClassifier.cc +++ b/src/networklayer/diffserv/MultiFieldClassifier.cc @@ -17,8 +17,8 @@ // #include "INETDefs.h" -#include "IPvXAddress.h" -#include "IPvXAddressResolver.h" +#include "Address.h" +#include "AddressResolver.h" #ifdef WITH_IPv4 #include "IPv4Datagram.h" @@ -44,9 +44,9 @@ using namespace DiffservUtil; #ifdef WITH_IPv4 bool MultiFieldClassifier::Filter::matches(IPv4Datagram *datagram) { - if (srcPrefixLength > 0 && (srcAddr.isIPv6() || !datagram->getSrcAddress().prefixMatches(srcAddr.get4(), srcPrefixLength))) + if (srcPrefixLength > 0 && (srcAddr.isIPv6() || !datagram->getSrcAddress().prefixMatches(srcAddr.toIPv4(), srcPrefixLength))) return false; - if (destPrefixLength > 0 && (destAddr.isIPv6() || !datagram->getDestAddress().prefixMatches(destAddr.get4(), destPrefixLength))) + if (destPrefixLength > 0 && (destAddr.isIPv6() || !datagram->getDestAddress().prefixMatches(destAddr.toIPv4(), destPrefixLength))) return false; if (protocol >= 0 && datagram->getTransportProtocol() != protocol) return false; @@ -86,9 +86,9 @@ bool MultiFieldClassifier::Filter::matches(IPv4Datagram *datagram) #ifdef WITH_IPv6 bool MultiFieldClassifier::Filter::matches(IPv6Datagram *datagram) { - if (srcPrefixLength > 0 && (!srcAddr.isIPv6() || !datagram->getSrcAddress().matches(srcAddr.get6(), srcPrefixLength))) + if (srcPrefixLength > 0 && (!srcAddr.isIPv6() || !datagram->getSrcAddress().matches(srcAddr.toIPv6(), srcPrefixLength))) return false; - if (destPrefixLength > 0 && (!destAddr.isIPv6() || !datagram->getDestAddress().matches(destAddr.get6(), destPrefixLength))) + if (destPrefixLength > 0 && (!destAddr.isIPv6() || !datagram->getDestAddress().matches(destAddr.toIPv6(), destPrefixLength))) return false; if (protocol >= 0 && datagram->getTransportProtocol() != protocol) return false; @@ -232,7 +232,7 @@ void MultiFieldClassifier::addFilter(const Filter &filter) void MultiFieldClassifier::configureFilters(cXMLElement *config) { - IPvXAddressResolver addressResolver; + AddressResolver addressResolver; cXMLElementList filterElements = config->getChildrenByTagName("filter"); for (int i = 0; i < (int)filterElements.size(); i++) { diff --git a/src/networklayer/diffserv/MultiFieldClassifier.h b/src/networklayer/diffserv/MultiFieldClassifier.h index f8c5cc25f23..6647a702a06 100644 --- a/src/networklayer/diffserv/MultiFieldClassifier.h +++ b/src/networklayer/diffserv/MultiFieldClassifier.h @@ -32,9 +32,9 @@ class INET_API MultiFieldClassifier : public cSimpleModule { int gateIndex; - IPvXAddress srcAddr; + Address srcAddr; int srcPrefixLength; - IPvXAddress destAddr; + Address destAddr; int destPrefixLength; int protocol; int tos; diff --git a/src/networklayer/icmpv6/ICMPv6.ned b/src/networklayer/icmpv6/ICMPv6.ned index 73d0379d688..f6a8de60e95 100644 --- a/src/networklayer/icmpv6/ICMPv6.ned +++ b/src/networklayer/icmpv6/ICMPv6.ned @@ -26,7 +26,7 @@ package inet.networklayer.icmpv6; // attached. The message will be used as ping payload (encapsulated into an ~ICMPv6Message). // When an ICMPv6 Echo Reply is received, the payload message will be sent to pingOut. // -// @see ~IPv6, ~RoutingTable6, ~IPv6NeighbourDiscovery +// @see ~IPv6, ~IPv6RoutingTable, ~IPv6NeighbourDiscovery //#FIXME gate descriptions needed... // simple ICMPv6 diff --git a/src/networklayer/icmpv6/IPv6NeighbourDiscovery.cc b/src/networklayer/icmpv6/IPv6NeighbourDiscovery.cc index 82919c79522..ddc91307f1b 100644 --- a/src/networklayer/icmpv6/IPv6NeighbourDiscovery.cc +++ b/src/networklayer/icmpv6/IPv6NeighbourDiscovery.cc @@ -25,7 +25,7 @@ #include "InterfaceTableAccess.h" #include "ModuleAccess.h" #include "NodeStatus.h" -#include "RoutingTable6Access.h" +#include "IPv6RoutingTableAccess.h" #ifdef WITH_xMIPv6 #include "xMIPv6Access.h" @@ -77,7 +77,7 @@ void IPv6NeighbourDiscovery::initialize(int stage) else if (stage == 3) { ift = InterfaceTableAccess().get(); - rt6 = RoutingTable6Access().get(); + rt6 = IPv6RoutingTableAccess().get(); icmpv6 = ICMPv6Access().get(); #ifdef WITH_xMIPv6 diff --git a/src/networklayer/icmpv6/IPv6NeighbourDiscovery.h b/src/networklayer/icmpv6/IPv6NeighbourDiscovery.h index 42a0029f5db..d907838a204 100644 --- a/src/networklayer/icmpv6/IPv6NeighbourDiscovery.h +++ b/src/networklayer/icmpv6/IPv6NeighbourDiscovery.h @@ -38,7 +38,7 @@ class IInterfaceTable; class InterfaceEntry; class IPv6ControlInfo; class IPv6Datagram; -class RoutingTable6; +class IPv6RoutingTable; #ifdef WITH_xMIPv6 class xMIPv6; @@ -99,7 +99,7 @@ class INET_API IPv6NeighbourDiscovery : public cSimpleModule, public ILifecycle cQueue pendingQueue; IInterfaceTable *ift; - RoutingTable6 *rt6; + IPv6RoutingTable *rt6; ICMPv6 *icmpv6; #ifdef WITH_xMIPv6 diff --git a/src/networklayer/icmpv6/IPv6NeighbourDiscovery.ned b/src/networklayer/icmpv6/IPv6NeighbourDiscovery.ned index 03d2f680814..e5f8a4fec00 100644 --- a/src/networklayer/icmpv6/IPv6NeighbourDiscovery.ned +++ b/src/networklayer/icmpv6/IPv6NeighbourDiscovery.ned @@ -24,7 +24,7 @@ package inet.networklayer.icmpv6; // An overview of the IPv6 implementation in the INET Framework is // provided here. // -// @see ~IPv6, ~RoutingTable6, ~ICMPv6 +// @see ~IPv6, ~IPv6RoutingTable, ~ICMPv6 // simple IPv6NeighbourDiscovery { diff --git a/src/networklayer/ipv4/ICMP.h b/src/networklayer/ipv4/ICMP.h index 084a1f26a6f..236c1113145 100644 --- a/src/networklayer/ipv4/ICMP.h +++ b/src/networklayer/ipv4/ICMP.h @@ -25,7 +25,7 @@ #include "INETDefs.h" #include "ICMPMessage.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" class IPv4Datagram; class IPv4ControlInfo; @@ -37,7 +37,7 @@ class PingPayload; class INET_API ICMP : public cSimpleModule { protected: - RoutingTableAccess routingTableAccess; + IPv4RoutingTableAccess routingTableAccess; typedef std::map PingMap; PingMap pingMap; diff --git a/src/networklayer/ipv4/IGMPv2.cc b/src/networklayer/ipv4/IGMPv2.cc index a056fed469d..382ccf27047 100755 --- a/src/networklayer/ipv4/IGMPv2.cc +++ b/src/networklayer/ipv4/IGMPv2.cc @@ -17,7 +17,7 @@ // #include "IGMPv2.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTableAccess.h" #include "IPv4ControlInfo.h" #include "IPv4InterfaceData.h" @@ -332,7 +332,7 @@ void IGMPv2::initialize(int stage) if (stage == 0) { ift = InterfaceTableAccess().get(); - rt = RoutingTableAccess().get(); + rt = IPv4RoutingTableAccess().get(); nb = NotificationBoardAccess().get(); nb->subscribe(this, NF_INTERFACE_DELETED); diff --git a/src/networklayer/ipv4/IGMPv2.h b/src/networklayer/ipv4/IGMPv2.h index f611543f6fb..cbf775fde7e 100755 --- a/src/networklayer/ipv4/IGMPv2.h +++ b/src/networklayer/ipv4/IGMPv2.h @@ -28,7 +28,7 @@ #include class IInterfaceTable; -class IRoutingTable; +class IIPv4RoutingTable; class NotificationBoard; class INET_API IGMPv2 : public cSimpleModule, protected INotifiable @@ -129,7 +129,7 @@ class INET_API IGMPv2 : public cSimpleModule, protected INotifiable }; protected: - IRoutingTable *rt; // cached pointer + IIPv4RoutingTable *rt; // cached pointer IInterfaceTable *ift; // cached pointer NotificationBoard *nb; // cached pointer diff --git a/src/networklayer/ipv4/IRoutingTable.h b/src/networklayer/ipv4/IIPv4RoutingTable.h similarity index 95% rename from src/networklayer/ipv4/IRoutingTable.h rename to src/networklayer/ipv4/IIPv4RoutingTable.h index c7e52aee680..15fead2106d 100644 --- a/src/networklayer/ipv4/IRoutingTable.h +++ b/src/networklayer/ipv4/IIPv4RoutingTable.h @@ -26,17 +26,17 @@ #include "IPv4Route.h" // not strictly required, but most clients will need it anyway /** - * A C++ interface to abstract the functionality of IRoutingTable. - * Referring to IRoutingTable via this interface makes it possible to - * transparently replace IRoutingTable with a different implementation, + * A C++ interface to abstract the functionality of IIPv4RoutingTable. + * Referring to IIPv4RoutingTable via this interface makes it possible to + * transparently replace IIPv4RoutingTable with a different implementation, * without any change to the base INET. * - * @see IRoutingTable, IPv4Route + * @see IIPv4RoutingTable, IPv4Route */ -class INET_API IRoutingTable +class INET_API IIPv4RoutingTable { public: - virtual ~IRoutingTable() {}; + virtual ~IIPv4RoutingTable() {}; /** * For debugging diff --git a/src/networklayer/ipv4/IPv4.cc b/src/networklayer/ipv4/IPv4.cc index f794f561e1c..8d9bfa28a78 100644 --- a/src/networklayer/ipv4/IPv4.cc +++ b/src/networklayer/ipv4/IPv4.cc @@ -27,7 +27,7 @@ #include "IPv4ControlInfo.h" #include "IPv4Datagram.h" #include "IPv4InterfaceData.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "Ieee802Ctrl_m.h" #include "NodeOperations.h" #include "NodeStatus.h" @@ -44,7 +44,7 @@ void IPv4::initialize(int stage) QueueBase::initialize(); ift = InterfaceTableAccess().get(); - rt = RoutingTableAccess().get(); + rt = IPv4RoutingTableAccess().get(); nb = NotificationBoardAccess().getIfExists(); // needed only for multicast forwarding queueOutGate = gate("queueOut"); diff --git a/src/networklayer/ipv4/IPv4.h b/src/networklayer/ipv4/IPv4.h index 7270482c16f..c999b37f969 100644 --- a/src/networklayer/ipv4/IPv4.h +++ b/src/networklayer/ipv4/IPv4.h @@ -37,7 +37,7 @@ class ARPPacket; class ICMPMessage; class IInterfaceTable; class IPv4Datagram; -class IRoutingTable; +class IIPv4RoutingTable; class NotificationBoard; // ICMP type 2, code 4: fragmentation needed, but don't-fragment bit set @@ -50,7 +50,7 @@ const int ICMP_FRAGMENTATION_ERROR_CODE = 4; class INET_API IPv4 : public QueueBase, public ILifecycle { protected: - IRoutingTable *rt; + IIPv4RoutingTable *rt; IInterfaceTable *ift; NotificationBoard *nb; ICMPAccess icmpAccess; diff --git a/src/networklayer/ipv4/IPv4.ned b/src/networklayer/ipv4/IPv4.ned index 4b532568bce..4e68adb5a68 100644 --- a/src/networklayer/ipv4/IPv4.ned +++ b/src/networklayer/ipv4/IPv4.ned @@ -51,11 +51,11 @@ package inet.networklayer.ipv4; // // Routing and interfacing with lower layers // -// The routing table is stored in the module ~RoutingTable. When a datagram -// needs to be routed, ~IPv4 queries ~RoutingTable for the output interface +// The routing table is stored in the module ~IPv4RoutingTable. When a datagram +// needs to be routed, ~IPv4 queries ~IPv4RoutingTable for the output interface // (or "port") and next hop address of the packet. This is done by directly -// calling C++ methods (such as findBestMatchingRoute(destAddress)) of ~RoutingTable. -// No message exchange with ~RoutingTable takes place. +// calling C++ methods (such as findBestMatchingRoute(destAddress)) of ~IPv4RoutingTable. +// No message exchange with ~IPv4RoutingTable takes place. // // A routed datagram will be sent to the queueOut gate, with an // ~IPv4RoutingDecision control info object attached which contains @@ -63,7 +63,7 @@ package inet.networklayer.ipv4; // connected to ~ARP. // // Routing protocol implementations (e.g. OSPF and ISIS) can also query -// and manipulate the route table by calling ~RoutingTable's methods in C++. +// and manipulate the route table by calling ~IPv4RoutingTable's methods in C++. // // Performance model, QoS // @@ -77,7 +77,7 @@ package inet.networklayer.ipv4; // method which determines processing time for a packet, or (2) use a // different base class. // -// @see ~RoutingTable, ~IPv4ControlInfo, ~IPv4RoutingDecision, ~ARP +// @see ~IPv4RoutingTable, ~IPv4ControlInfo, ~IPv4RoutingDecision, ~ARP // // @author Andras Varga // diff --git a/src/networklayer/ipv4/IPv4Route.cc b/src/networklayer/ipv4/IPv4Route.cc index 9df8efd490b..76e9744e400 100644 --- a/src/networklayer/ipv4/IPv4Route.cc +++ b/src/networklayer/ipv4/IPv4Route.cc @@ -23,7 +23,7 @@ #include "IPv4InterfaceData.h" #include "InterfaceEntry.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" std::string IPv4Route::info() const diff --git a/src/networklayer/ipv4/IPv4Route.h b/src/networklayer/ipv4/IPv4Route.h index d0ea62e651c..2c5e7194885 100644 --- a/src/networklayer/ipv4/IPv4Route.h +++ b/src/networklayer/ipv4/IPv4Route.h @@ -24,12 +24,12 @@ #include "IPv4Address.h" class InterfaceEntry; -class IRoutingTable; +class IIPv4RoutingTable; /** - * IPv4 unicast route in IRoutingTable. + * IPv4 unicast route in IIPv4RoutingTable. * - * @see IRoutingTable, RoutingTable + * @see IIPv4RoutingTable, IPv4RoutingTable */ class INET_API IPv4Route : public cObject { @@ -68,7 +68,7 @@ class INET_API IPv4Route : public cObject }; private: - IRoutingTable *rt; ///< the routing table in which this route is inserted, or NULL + IIPv4RoutingTable *rt; ///< the routing table in which this route is inserted, or NULL IPv4Address dest; ///< Destination IPv4Address netmask; ///< Route mask IPv4Address gateway; ///< Next hop @@ -102,8 +102,8 @@ class INET_API IPv4Route : public cObject bool equals(const IPv4Route& route) const; /** To be called by the routing table when this route is added or removed from it */ - virtual void setRoutingTable(IRoutingTable *rt) {this->rt = rt;} - IRoutingTable *getRoutingTable() const {return rt;} + virtual void setRoutingTable(IIPv4RoutingTable *rt) {this->rt = rt;} + IIPv4RoutingTable *getRoutingTable() const {return rt;} /** test validity of route entry, e.g. check expiry */ virtual bool isValid() const { return true; } @@ -142,7 +142,7 @@ class INET_API IPv4Route : public cObject }; /** - * IPv4 multicast route in IRoutingTable. + * IPv4 multicast route in IIPv4RoutingTable. * Multicast routing protocols may extend this class to store protocol * specific fields. * @@ -161,7 +161,7 @@ class INET_API IPv4Route : public cObject * routing tree), then the datagram is forwarded only if there are listeners * of the multicast group on that link (TRPB routing). * - * @see IRoutingTable, RoutingTable + * @see IIPv4RoutingTable, IPv4RoutingTable */ class INET_API IPv4MulticastRoute : public cObject { @@ -205,7 +205,7 @@ class INET_API IPv4MulticastRoute : public cObject }; private: - IRoutingTable *rt; ///< the routing table in which this route is inserted, or NULL + IIPv4RoutingTable *rt; ///< the routing table in which this route is inserted, or NULL IPv4Address origin; ///< Source network IPv4Address originNetmask; ///< Source network mask IPv4Address group; ///< Multicast group, if unspecified then matches any @@ -233,8 +233,8 @@ class INET_API IPv4MulticastRoute : public cObject virtual std::string detailedInfo() const; /** To be called by the routing table when this route is added or removed from it */ - virtual void setRoutingTable(IRoutingTable *rt) {this->rt = rt;} - IRoutingTable *getRoutingTable() const {return rt;} + virtual void setRoutingTable(IIPv4RoutingTable *rt) {this->rt = rt;} + IIPv4RoutingTable *getRoutingTable() const {return rt;} /** test validity of route entry, e.g. check expiry */ virtual bool isValid() const { return true; } diff --git a/src/networklayer/ipv4/RoutingTable.cc b/src/networklayer/ipv4/IPv4RoutingTable.cc similarity index 90% rename from src/networklayer/ipv4/RoutingTable.cc rename to src/networklayer/ipv4/IPv4RoutingTable.cc index d6b3e358d1e..c68b71e7b58 100644 --- a/src/networklayer/ipv4/RoutingTable.cc +++ b/src/networklayer/ipv4/IPv4RoutingTable.cc @@ -22,7 +22,7 @@ #include #include -#include "RoutingTable.h" +#include "IPv4RoutingTable.h" #include "IInterfaceTable.h" #include "InterfaceTableAccess.h" @@ -37,7 +37,7 @@ using namespace OPP_Global; -Define_Module(RoutingTable); +Define_Module(IPv4RoutingTable); std::ostream& operator<<(std::ostream& os, const IPv4Route& e) @@ -52,13 +52,13 @@ std::ostream& operator<<(std::ostream& os, const IPv4MulticastRoute& e) return os; }; -RoutingTable::RoutingTable() +IPv4RoutingTable::IPv4RoutingTable() { ift = NULL; nb = NULL; } -RoutingTable::~RoutingTable() +IPv4RoutingTable::~IPv4RoutingTable() { for (unsigned int i=0; i RoutingTable::gatherAddresses() const +std::vector IPv4RoutingTable::gatherAddresses() const { std::vector addressvector; @@ -338,7 +338,7 @@ std::vector RoutingTable::gatherAddresses() const //--- -void RoutingTable::configureInterfaceForIPv4(InterfaceEntry *ie) +void IPv4RoutingTable::configureInterfaceForIPv4(InterfaceEntry *ie) { IPv4InterfaceData *d = new IPv4InterfaceData(); ie->setIPv4Data(d); @@ -355,7 +355,7 @@ void RoutingTable::configureInterfaceForIPv4(InterfaceEntry *ie) } } -InterfaceEntry *RoutingTable::getInterfaceByAddress(const IPv4Address& addr) const +InterfaceEntry *IPv4RoutingTable::getInterfaceByAddress(const IPv4Address& addr) const { Enter_Method("getInterfaceByAddress(%u.%u.%u.%u)", addr.getDByte(0), addr.getDByte(1), addr.getDByte(2), addr.getDByte(3)); // note: str().c_str() too slow here @@ -371,7 +371,7 @@ InterfaceEntry *RoutingTable::getInterfaceByAddress(const IPv4Address& addr) con } -void RoutingTable::configureLoopbackForIPv4() +void IPv4RoutingTable::configureLoopbackForIPv4() { InterfaceEntry *ie = ift->getFirstLoopbackInterface(); if (ie) { @@ -387,7 +387,7 @@ void RoutingTable::configureLoopbackForIPv4() //--- -bool RoutingTable::isLocalAddress(const IPv4Address& dest) const +bool IPv4RoutingTable::isLocalAddress(const IPv4Address& dest) const { Enter_Method("isLocalAddress(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here @@ -406,7 +406,7 @@ bool RoutingTable::isLocalAddress(const IPv4Address& dest) const } // JcM add: check if the dest addr is local network broadcast -bool RoutingTable::isLocalBroadcastAddress(const IPv4Address& dest) const +bool IPv4RoutingTable::isLocalBroadcastAddress(const IPv4Address& dest) const { Enter_Method("isLocalBroadcastAddress(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here @@ -428,7 +428,7 @@ bool RoutingTable::isLocalBroadcastAddress(const IPv4Address& dest) const return it!=localBroadcastAddresses.end(); } -InterfaceEntry *RoutingTable::findInterfaceByLocalBroadcastAddress(const IPv4Address& dest) const +InterfaceEntry *IPv4RoutingTable::findInterfaceByLocalBroadcastAddress(const IPv4Address& dest) const { for (int i=0; igetNumInterfaces(); i++) { @@ -441,7 +441,7 @@ InterfaceEntry *RoutingTable::findInterfaceByLocalBroadcastAddress(const IPv4Add return NULL; } -bool RoutingTable::isLocalMulticastAddress(const IPv4Address& dest) const +bool IPv4RoutingTable::isLocalMulticastAddress(const IPv4Address& dest) const { Enter_Method("isLocalMulticastAddress(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here @@ -454,7 +454,7 @@ bool RoutingTable::isLocalMulticastAddress(const IPv4Address& dest) const return false; } -void RoutingTable::purge() +void IPv4RoutingTable::purge() { bool deleted = false; @@ -497,7 +497,7 @@ void RoutingTable::purge() } } -IPv4Route *RoutingTable::findBestMatchingRoute(const IPv4Address& dest) const +IPv4Route *IPv4RoutingTable::findBestMatchingRoute(const IPv4Address& dest) const { Enter_Method("findBestMatchingRoute(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here @@ -528,7 +528,7 @@ IPv4Route *RoutingTable::findBestMatchingRoute(const IPv4Address& dest) const return bestRoute; } -InterfaceEntry *RoutingTable::getInterfaceForDestAddr(const IPv4Address& dest) const +InterfaceEntry *IPv4RoutingTable::getInterfaceForDestAddr(const IPv4Address& dest) const { Enter_Method("getInterfaceForDestAddr(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here @@ -536,7 +536,7 @@ InterfaceEntry *RoutingTable::getInterfaceForDestAddr(const IPv4Address& dest) c return e ? e->getInterface() : NULL; } -IPv4Address RoutingTable::getGatewayForDestAddr(const IPv4Address& dest) const +IPv4Address IPv4RoutingTable::getGatewayForDestAddr(const IPv4Address& dest) const { Enter_Method("getGatewayForDestAddr(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here @@ -545,7 +545,7 @@ IPv4Address RoutingTable::getGatewayForDestAddr(const IPv4Address& dest) const } -const IPv4MulticastRoute *RoutingTable::findBestMatchingMulticastRoute(const IPv4Address &origin, const IPv4Address &group) const +const IPv4MulticastRoute *IPv4RoutingTable::findBestMatchingMulticastRoute(const IPv4Address &origin, const IPv4Address &group) const { Enter_Method("getMulticastRoutesFor(%u.%u.%u.%u, %u.%u.%u.%u)", origin.getDByte(0), origin.getDByte(1), origin.getDByte(2), origin.getDByte(3), @@ -563,14 +563,14 @@ const IPv4MulticastRoute *RoutingTable::findBestMatchingMulticastRoute(const IPv return NULL; } -IPv4Route *RoutingTable::getRoute(int k) const +IPv4Route *IPv4RoutingTable::getRoute(int k) const { if (k < (int)routes.size()) return routes[k]; return NULL; } -IPv4Route *RoutingTable::getDefaultRoute() const +IPv4Route *IPv4RoutingTable::getDefaultRoute() const { // if exists default route entry, it is the last valid entry for (RouteVector::const_reverse_iterator i=routes.rbegin(); i!=routes.rend() && (*i)->getNetmask().isUnspecified(); ++i) @@ -584,7 +584,7 @@ IPv4Route *RoutingTable::getDefaultRoute() const // The 'routes' vector stores the routes in this order. // The best matching route should precede the other matching routes, // so the method should return true if a is better the b. -bool RoutingTable::routeLessThan(const IPv4Route *a, const IPv4Route *b) +bool IPv4RoutingTable::routeLessThan(const IPv4Route *a, const IPv4Route *b) { // longer prefixes are better, because they are more specific if (a->getNetmask() != b->getNetmask()) @@ -603,12 +603,12 @@ bool RoutingTable::routeLessThan(const IPv4Route *a, const IPv4Route *b) return a->getMetric() < b->getMetric(); } -void RoutingTable::setRouterId(IPv4Address a) +void IPv4RoutingTable::setRouterId(IPv4Address a) { routerId = a; } -void RoutingTable::internalAddRoute(IPv4Route *entry) +void IPv4RoutingTable::internalAddRoute(IPv4Route *entry) { if (!entry->getNetmask().isValidNetmask()) error("addRoute(): wrong netmask %s in route", entry->getNetmask().str().c_str()); @@ -648,7 +648,7 @@ void RoutingTable::internalAddRoute(IPv4Route *entry) entry->setRoutingTable(this); } -void RoutingTable::addRoute(IPv4Route *entry) +void IPv4RoutingTable::addRoute(IPv4Route *entry) { Enter_Method("addRoute(...)"); @@ -660,7 +660,7 @@ void RoutingTable::addRoute(IPv4Route *entry) nb->fireChangeNotification(NF_IPv4_ROUTE_ADDED, entry); } -IPv4Route *RoutingTable::internalRemoveRoute(IPv4Route *entry) +IPv4Route *IPv4RoutingTable::internalRemoveRoute(IPv4Route *entry) { RouteVector::iterator i = std::find(routes.begin(), routes.end(), entry); if (i!=routes.end()) @@ -671,7 +671,7 @@ IPv4Route *RoutingTable::internalRemoveRoute(IPv4Route *entry) return NULL; } -IPv4Route *RoutingTable::removeRoute(IPv4Route *entry) +IPv4Route *IPv4RoutingTable::removeRoute(IPv4Route *entry) { Enter_Method("removeRoute(...)"); @@ -688,7 +688,7 @@ IPv4Route *RoutingTable::removeRoute(IPv4Route *entry) return entry; } -bool RoutingTable::deleteRoute(IPv4Route *entry) +bool IPv4RoutingTable::deleteRoute(IPv4Route *entry) { Enter_Method("deleteRoute(...)"); @@ -705,7 +705,7 @@ bool RoutingTable::deleteRoute(IPv4Route *entry) return entry != NULL; } -bool RoutingTable::multicastRouteLessThan(const IPv4MulticastRoute *a, const IPv4MulticastRoute *b) +bool IPv4RoutingTable::multicastRouteLessThan(const IPv4MulticastRoute *a, const IPv4MulticastRoute *b) { // We want routes with longer // prefixes to be at front, so we compare them as "less". @@ -723,7 +723,7 @@ bool RoutingTable::multicastRouteLessThan(const IPv4MulticastRoute *a, const IPv return a->getMetric() < b->getMetric(); } -void RoutingTable::internalAddMulticastRoute(IPv4MulticastRoute *entry) +void IPv4RoutingTable::internalAddMulticastRoute(IPv4MulticastRoute *entry) { if (!entry->getOriginNetmask().isValidNetmask()) error("addMulticastRoute(): wrong netmask %s in multicast route", entry->getOriginNetmask().str().c_str()); @@ -762,7 +762,7 @@ void RoutingTable::internalAddMulticastRoute(IPv4MulticastRoute *entry) entry->setRoutingTable(this); } -void RoutingTable::addMulticastRoute(IPv4MulticastRoute *entry) +void IPv4RoutingTable::addMulticastRoute(IPv4MulticastRoute *entry) { Enter_Method("addMulticastRoute(...)"); @@ -774,7 +774,7 @@ void RoutingTable::addMulticastRoute(IPv4MulticastRoute *entry) nb->fireChangeNotification(NF_IPv4_MROUTE_ADDED, entry); } -IPv4MulticastRoute *RoutingTable::internalRemoveMulticastRoute(IPv4MulticastRoute *entry) +IPv4MulticastRoute *IPv4RoutingTable::internalRemoveMulticastRoute(IPv4MulticastRoute *entry) { MulticastRouteVector::iterator i = std::find(multicastRoutes.begin(), multicastRoutes.end(), entry); if (i!=multicastRoutes.end()) @@ -785,7 +785,7 @@ IPv4MulticastRoute *RoutingTable::internalRemoveMulticastRoute(IPv4MulticastRout return NULL; } -IPv4MulticastRoute *RoutingTable::removeMulticastRoute(IPv4MulticastRoute *entry) +IPv4MulticastRoute *IPv4RoutingTable::removeMulticastRoute(IPv4MulticastRoute *entry) { Enter_Method("removeMulticastRoute(...)"); @@ -802,7 +802,7 @@ IPv4MulticastRoute *RoutingTable::removeMulticastRoute(IPv4MulticastRoute *entry return entry; } -bool RoutingTable::deleteMulticastRoute(IPv4MulticastRoute *entry) +bool IPv4RoutingTable::deleteMulticastRoute(IPv4MulticastRoute *entry) { Enter_Method("deleteMulticastRoute(...)"); @@ -819,7 +819,7 @@ bool RoutingTable::deleteMulticastRoute(IPv4MulticastRoute *entry) return entry != NULL; } -void RoutingTable::routeChanged(IPv4Route *entry, int fieldCode) +void IPv4RoutingTable::routeChanged(IPv4Route *entry, int fieldCode) { if (fieldCode==IPv4Route::F_DESTINATION || fieldCode==IPv4Route::F_NETMASK || fieldCode==IPv4Route::F_METRIC) // our data structures depend on these fields { @@ -833,7 +833,7 @@ void RoutingTable::routeChanged(IPv4Route *entry, int fieldCode) nb->fireChangeNotification(NF_IPv4_ROUTE_CHANGED, entry); // TODO include fieldCode in the notification } -void RoutingTable::multicastRouteChanged(IPv4MulticastRoute *entry, int fieldCode) +void IPv4RoutingTable::multicastRouteChanged(IPv4MulticastRoute *entry, int fieldCode) { if (fieldCode==IPv4MulticastRoute::F_ORIGIN || fieldCode==IPv4MulticastRoute::F_ORIGINMASK || fieldCode==IPv4MulticastRoute::F_MULTICASTGROUP || fieldCode==IPv4MulticastRoute::F_METRIC) // our data structures depend on these fields @@ -848,7 +848,7 @@ void RoutingTable::multicastRouteChanged(IPv4MulticastRoute *entry, int fieldCod nb->fireChangeNotification(NF_IPv4_MROUTE_CHANGED, entry); // TODO include fieldCode in the notification } -void RoutingTable::updateNetmaskRoutes() +void IPv4RoutingTable::updateNetmaskRoutes() { // first, delete all routes with src=IFACENETMASK for (unsigned int k=0; k(operation)) { @@ -922,7 +922,7 @@ bool RoutingTable::handleOperationStage(LifecycleOperation *operation, int stage return true; } -IPv4Route *RoutingTable::createNewRoute() +IPv4Route *IPv4RoutingTable::createNewRoute() { return new IPv4Route(); } diff --git a/src/networklayer/ipv4/RoutingTable.h b/src/networklayer/ipv4/IPv4RoutingTable.h similarity index 98% rename from src/networklayer/ipv4/RoutingTable.h rename to src/networklayer/ipv4/IPv4RoutingTable.h index 1ace04bdb5a..554e7de54aa 100644 --- a/src/networklayer/ipv4/RoutingTable.h +++ b/src/networklayer/ipv4/IPv4RoutingTable.h @@ -34,7 +34,7 @@ #include "INotifiable.h" #include "IPv4Address.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "ILifecycle.h" class IInterfaceTable; @@ -72,7 +72,7 @@ class RoutingTableParser; * * @see InterfaceEntry, IPv4InterfaceData, IPv4Route */ -class INET_API RoutingTable: public cSimpleModule, public IRoutingTable, protected INotifiable, public ILifecycle +class INET_API IPv4RoutingTable: public cSimpleModule, public IIPv4RoutingTable, protected INotifiable, public ILifecycle { protected: IInterfaceTable *ift; // cached pointer @@ -143,8 +143,8 @@ class INET_API RoutingTable: public cSimpleModule, public IRoutingTable, protect IPv4MulticastRoute *internalRemoveMulticastRoute(IPv4MulticastRoute *entry); public: - RoutingTable(); - virtual ~RoutingTable(); + IPv4RoutingTable(); + virtual ~IPv4RoutingTable(); protected: virtual int numInitStages() const {return 4;} diff --git a/src/networklayer/ipv4/RoutingTable.ned b/src/networklayer/ipv4/IPv4RoutingTable.ned similarity index 99% rename from src/networklayer/ipv4/RoutingTable.ned rename to src/networklayer/ipv4/IPv4RoutingTable.ned index f2cb039c483..2444b3513f7 100644 --- a/src/networklayer/ipv4/RoutingTable.ned +++ b/src/networklayer/ipv4/IPv4RoutingTable.ned @@ -45,7 +45,7 @@ package inet.networklayer.ipv4; // @see ~InterfaceTable // @author: Jochen Reber, Andras Varga // -simple RoutingTable +simple IPv4RoutingTable { parameters: string routerId = default("auto"); // for routers, the router id using IPv4 address dotted diff --git a/src/networklayer/ipv4/RoutingTableAccess.h b/src/networklayer/ipv4/IPv4RoutingTableAccess.h similarity index 80% rename from src/networklayer/ipv4/RoutingTableAccess.h rename to src/networklayer/ipv4/IPv4RoutingTableAccess.h index cda83db72fc..44cd89d2c88 100644 --- a/src/networklayer/ipv4/RoutingTableAccess.h +++ b/src/networklayer/ipv4/IPv4RoutingTableAccess.h @@ -25,16 +25,16 @@ #include "INETDefs.h" #include "ModuleAccess.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" /** - * Gives access to the IRoutingTable. + * Gives access to the IIPv4RoutingTable. */ -class INET_API RoutingTableAccess : public ModuleAccess +class INET_API IPv4RoutingTableAccess : public ModuleAccess { public: - RoutingTableAccess() : ModuleAccess("routingTable") {} + IPv4RoutingTableAccess() : ModuleAccess("routingTable") {} }; #endif diff --git a/src/networklayer/ipv4/NetworkInfo.cc b/src/networklayer/ipv4/NetworkInfo.cc index bc03a2148fc..eead0b9fd78 100644 --- a/src/networklayer/ipv4/NetworkInfo.cc +++ b/src/networklayer/ipv4/NetworkInfo.cc @@ -21,8 +21,8 @@ #include "NetworkInfo.h" #include "InterfaceEntry.h" -#include "IPvXAddressResolver.h" -#include "IRoutingTable.h" +#include "AddressResolver.h" +#include "IIPv4RoutingTable.h" Define_Module(NetworkInfo); @@ -73,7 +73,7 @@ void NetworkInfo::dumpRoutingInfo(cModule *target, const char *filename, bool ap { std::vector lines; - IRoutingTable *rt = check_and_cast(rtmod); + IIPv4RoutingTable *rt = check_and_cast(rtmod); for (int i = 0; i < rt->getNumRoutes(); i++) { IPv4Address dest = rt->getRoute(i)->getDestination(); diff --git a/src/networklayer/ipv4/RoutingTableParser.cc b/src/networklayer/ipv4/RoutingTableParser.cc index 175a3b6c5a7..9d235058922 100644 --- a/src/networklayer/ipv4/RoutingTableParser.cc +++ b/src/networklayer/ipv4/RoutingTableParser.cc @@ -43,7 +43,7 @@ const char *IFCONFIG_START_TOKEN = "ifconfig:", *ROUTE_START_TOKEN = "route:", *ROUTE_END_TOKEN = "routeend."; -RoutingTableParser::RoutingTableParser(IInterfaceTable *i, IRoutingTable *r) +RoutingTableParser::RoutingTableParser(IInterfaceTable *i, IIPv4RoutingTable *r) { ift = i; rt = r; diff --git a/src/networklayer/ipv4/RoutingTableParser.h b/src/networklayer/ipv4/RoutingTableParser.h index 89f1b712e5e..1b73fef0271 100644 --- a/src/networklayer/ipv4/RoutingTableParser.h +++ b/src/networklayer/ipv4/RoutingTableParser.h @@ -32,7 +32,7 @@ #include "INETDefs.h" -#include "RoutingTable.h" +#include "IPv4RoutingTable.h" /** * Parses a routing table file into a routing table. @@ -41,13 +41,13 @@ class INET_API RoutingTableParser { protected: IInterfaceTable *ift; - IRoutingTable *rt; + IIPv4RoutingTable *rt; public: /** * Constructor */ - RoutingTableParser(IInterfaceTable *ift, IRoutingTable *rt); + RoutingTableParser(IInterfaceTable *ift, IIPv4RoutingTable *rt); /** * Destructor diff --git a/src/networklayer/ipv4/RoutingTableRecorder.cc b/src/networklayer/ipv4/RoutingTableRecorder.cc index 198b045b1f3..14e2a2aaea5 100644 --- a/src/networklayer/ipv4/RoutingTableRecorder.cc +++ b/src/networklayer/ipv4/RoutingTableRecorder.cc @@ -18,7 +18,7 @@ #include "NotifierConsts.h" #include "NotificationBoard.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "IPv4Route.h" #include "IInterfaceTable.h" #include "IPv4InterfaceData.h" @@ -138,7 +138,7 @@ void RoutingTableRecorder::recordInterfaceChange(cModule *host, const InterfaceE void RoutingTableRecorder::recordRouteChange(cModule *host, const IPv4Route *route, int category) { - IRoutingTable *rt = route->getRoutingTable(); // may be NULL! (route already removed from its routing table) + IIPv4RoutingTable *rt = route->getRoutingTable(); // may be NULL! (route already removed from its routing table) const char *tag; switch (category) { diff --git a/src/networklayer/ipv4/RoutingTableRecorder.h b/src/networklayer/ipv4/RoutingTableRecorder.h index 911279514e3..16c0c1b68b7 100644 --- a/src/networklayer/ipv4/RoutingTableRecorder.h +++ b/src/networklayer/ipv4/RoutingTableRecorder.h @@ -19,13 +19,13 @@ #define __ROUTINGTABLERECORDER_H #include "INETDefs.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "INotifiable.h" /** * Records routing table changes into a file. * - * @see RoutingTable, IPv4Route + * @see IPv4RoutingTable, IPv4Route */ class INET_API RoutingTableRecorder : public cSimpleModule { diff --git a/src/networklayer/ipv4/RoutingTableRecorder.ned b/src/networklayer/ipv4/RoutingTableRecorder.ned index c6f07bd75c1..c57f19a56b6 100644 --- a/src/networklayer/ipv4/RoutingTableRecorder.ned +++ b/src/networklayer/ipv4/RoutingTableRecorder.ned @@ -18,7 +18,7 @@ package inet.networklayer.ipv4; // -// Records changes in the routing tables (~RoutingTable) and interface tables +// Records changes in the routing tables (~IPv4RoutingTable) and interface tables // (~InterfaceTable) of all hosts and routers. The filename has to be specified // in the routinglog-file configuration option that this module registers. // diff --git a/src/networklayer/ipv6/IPv6.cc b/src/networklayer/ipv6/IPv6.cc index 368d7de1a5a..fb29a42faf4 100644 --- a/src/networklayer/ipv6/IPv6.cc +++ b/src/networklayer/ipv6/IPv6.cc @@ -22,7 +22,7 @@ #include "IPv6.h" #include "InterfaceTableAccess.h" -#include "RoutingTable6Access.h" +#include "IPv6RoutingTableAccess.h" #include "ICMPv6Access.h" #include "IPv6NeighbourDiscoveryAccess.h" @@ -54,10 +54,9 @@ void IPv6::initialize(int stage) QueueBase::initialize(); ift = InterfaceTableAccess().get(); - rt = RoutingTable6Access().get(); + rt = IPv6RoutingTableAccess().get(); nd = IPv6NeighbourDiscoveryAccess().get(); icmp = ICMPv6Access().get(); - tunneling = IPv6TunnelingAccess().get(); mapping.parseProtocolMapping(par("protocolMapping")); diff --git a/src/networklayer/ipv6/IPv6.h b/src/networklayer/ipv6/IPv6.h index d8130f31a0e..d8ba8630ac4 100644 --- a/src/networklayer/ipv6/IPv6.h +++ b/src/networklayer/ipv6/IPv6.h @@ -22,7 +22,7 @@ #include "INETDefs.h" #include "QueueBase.h" -#include "RoutingTable6.h" +#include "IPv6RoutingTable.h" #include "ICMPv6.h" #include "IPv6NeighbourDiscovery.h" @@ -41,7 +41,7 @@ class INET_API IPv6 : public QueueBase, public ILifecycle { protected: IInterfaceTable *ift; - RoutingTable6 *rt; + IPv6RoutingTable *rt; IPv6NeighbourDiscovery *nd; ICMPv6 *icmp; diff --git a/src/networklayer/ipv6/IPv6.ned b/src/networklayer/ipv6/IPv6.ned index 9a4e086248b..a5503119148 100644 --- a/src/networklayer/ipv6/IPv6.ned +++ b/src/networklayer/ipv6/IPv6.ned @@ -53,16 +53,16 @@ package inet.networklayer.ipv6; // // Routing and interfacing with lower layers // -// The routing table is stored in the module ~RoutingTable6. When a datagram -// needs to be routed, IPv6 queries ~RoutingTable6 for the output interface +// The routing table is stored in the module ~IPv6RoutingTable. When a datagram +// needs to be routed, IPv6 queries ~IPv6RoutingTable for the output interface // (or "port") and next hop address of the packet. This is done by directly -// calling C++ methods of ~RoutingTable6. No message exchange with ~RoutingTable6 +// calling C++ methods of ~IPv6RoutingTable. No message exchange with ~IPv6RoutingTable // takes place. // //#FIXME TBD describe operation // // Routing protocol implementations can also query and manipulate the route table -// by calling ~RoutingTable6's methods in C++. +// by calling ~IPv6RoutingTable's methods in C++. // // Performance model, QoS // @@ -70,7 +70,7 @@ package inet.networklayer.ipv6; // datagrams are processed in order. The processing time is determined by the // procDelay module parameter. // -// @see ~RoutingTable6, ~IPv6ControlInfo, ~IPv6NeighbourDiscovery, ~ICMPv6 +// @see ~IPv6RoutingTable, ~IPv6ControlInfo, ~IPv6NeighbourDiscovery, ~ICMPv6 // // @author Andras Varga // diff --git a/src/networklayer/ipv6/IPv6InterfaceData.cc b/src/networklayer/ipv6/IPv6InterfaceData.cc index 89fe2fb7955..3d79c7d3be3 100644 --- a/src/networklayer/ipv6/IPv6InterfaceData.cc +++ b/src/networklayer/ipv6/IPv6InterfaceData.cc @@ -22,7 +22,7 @@ #include "IPv6InterfaceData.h" #ifdef WITH_xMIPv6 -#include "RoutingTable6Access.h" +#include "IPv6RoutingTableAccess.h" #endif /* WITH_xMIPv6 */ //FIXME invoked changed() from state-changing methods, to trigger notification... @@ -86,7 +86,7 @@ IPv6InterfaceData::IPv6InterfaceData() routerMcastData = NULL; nb = NULL; #ifdef WITH_xMIPv6 - rt6 = RoutingTable6Access().get(); + rt6 = IPv6RoutingTableAccess().get(); #endif /* WITH_xMIPv6 */ /*******************Setting host/node/router Protocol Constants************/ routerConstants.maxInitialRtrAdvertInterval = IPv6_MAX_INITIAL_RTR_ADVERT_INTERVAL; @@ -128,7 +128,7 @@ IPv6InterfaceData::IPv6InterfaceData() _getMaxRandomFactor(), getBaseReachableTime()); hostVars.retransTimer = IPv6_RETRANS_TIMER; - //rtrVars.advSendAdvertisements is set in RoutingTable6.cc:line 143 + //rtrVars.advSendAdvertisements is set in IPv6RoutingTable.cc:line 143 rtrVars.maxRtrAdvInterval = IPv6_DEFAULT_MAX_RTR_ADV_INT; rtrVars.minRtrAdvInterval = 0.33*rtrVars.maxRtrAdvInterval; rtrVars.advManagedFlag = false; diff --git a/src/networklayer/ipv6/IPv6InterfaceData.h b/src/networklayer/ipv6/IPv6InterfaceData.h index b50c96b5b16..f903a5d1795 100644 --- a/src/networklayer/ipv6/IPv6InterfaceData.h +++ b/src/networklayer/ipv6/IPv6InterfaceData.h @@ -31,7 +31,7 @@ //Forward declarations: #ifdef WITH_xMIPv6 -class RoutingTable6; +class IPv6RoutingTable; #endif /* WITH_xMIPv6 */ #define IPv6_DEFAULT_DUPADDRDETECTTRANSMITS 1 // send NS once (RFC2462:Section 5.1) @@ -785,7 +785,7 @@ class INET_API IPv6InterfaceData : public InterfaceProtocolData IPv6Address removeAddress(IPv6InterfaceData::AddressType type); // update 06.08.08 - CB protected: - RoutingTable6* rt6; // A pointer variable, specifically used to access the type of node (MN, HA, Router, CN). Used in info(). (Zarrar Yousaf 20.07.07) + IPv6RoutingTable* rt6; // A pointer variable, specifically used to access the type of node (MN, HA, Router, CN). Used in info(). (Zarrar Yousaf 20.07.07) #endif /* WITH_xMIPv6 */ }; diff --git a/src/networklayer/ipv6/RoutingTable6.cc b/src/networklayer/ipv6/IPv6RoutingTable.cc similarity index 90% rename from src/networklayer/ipv6/RoutingTable6.cc rename to src/networklayer/ipv6/IPv6RoutingTable.cc index 85bf1f730d8..0dac048e357 100644 --- a/src/networklayer/ipv6/RoutingTable6.cc +++ b/src/networklayer/ipv6/IPv6RoutingTable.cc @@ -21,7 +21,7 @@ #include "opp_utils.h" -#include "RoutingTable6.h" +#include "IPv6RoutingTable.h" #include "IPv6InterfaceData.h" #include "InterfaceTableAccess.h" @@ -29,7 +29,7 @@ #include "IPv6TunnelingAccess.h" #include "NodeOperations.h" -Define_Module(RoutingTable6); +Define_Module(IPv6RoutingTable); std::string IPv6Route::info() const @@ -74,28 +74,28 @@ std::ostream& operator<<(std::ostream& os, const IPv6Route& e) return os; }; -std::ostream& operator<<(std::ostream& os, const RoutingTable6::DestCacheEntry& e) +std::ostream& operator<<(std::ostream& os, const IPv6RoutingTable::DestCacheEntry& e) { os << "if=" << e.interfaceId << " " << e.nextHopAddr; //FIXME try printing interface name return os; }; -RoutingTable6::RoutingTable6() +IPv6RoutingTable::IPv6RoutingTable() { } -RoutingTable6::~RoutingTable6() +IPv6RoutingTable::~IPv6RoutingTable() { for (unsigned int i=0; ifireChangeNotification(NF_IPv6_ROUTE_CHANGED, entry); // TODO include fieldCode in the notification } -void RoutingTable6::configureInterfaceForIPv6(InterfaceEntry *ie) +void IPv6RoutingTable::configureInterfaceForIPv6(InterfaceEntry *ie) { IPv6InterfaceData *ipv6IfData = new IPv6InterfaceData(); ie->setIPv6Data(ipv6IfData); @@ -303,7 +303,7 @@ void RoutingTable6::configureInterfaceForIPv6(InterfaceEntry *ie) } } -void RoutingTable6::assignRequiredNodeAddresses(InterfaceEntry *ie) +void IPv6RoutingTable::assignRequiredNodeAddresses(InterfaceEntry *ie) { //RFC 3513 Section 2.8:A Node's Required Addresses /*A host is required to recognize the following addresses as @@ -367,7 +367,7 @@ static bool toBool(const char *s, bool defaultValue = false) return !strcmp(s, "on") || !strcmp(s, "true") || !strcmp(s, "yes"); } -void RoutingTable6::configureInterfaceFromXML(InterfaceEntry *ie, cXMLElement *cfg) +void IPv6RoutingTable::configureInterfaceFromXML(InterfaceEntry *ie, cXMLElement *cfg) { /*XML parsing capabilities tweaked by WEI. For now, we can configure a specific node's interface. We can set advertising prefixes and other variables to be used @@ -432,7 +432,7 @@ void RoutingTable6::configureInterfaceFromXML(InterfaceEntry *ie, cXMLElement *c } } -void RoutingTable6::configureTunnelFromXML(cXMLElement* cfg) +void IPv6RoutingTable::configureTunnelFromXML(cXMLElement* cfg) { IPv6Tunneling* tunneling = IPv6TunnelingAccess().get(); @@ -460,7 +460,7 @@ void RoutingTable6::configureTunnelFromXML(cXMLElement* cfg) } } -InterfaceEntry *RoutingTable6::getInterfaceByAddress(const IPv6Address& addr) +InterfaceEntry *IPv6RoutingTable::getInterfaceByAddress(const IPv6Address& addr) { Enter_Method("getInterfaceByAddress(%s)=?", addr.str().c_str()); @@ -476,7 +476,7 @@ InterfaceEntry *RoutingTable6::getInterfaceByAddress(const IPv6Address& addr) return NULL; } -bool RoutingTable6::isLocalAddress(const IPv6Address& dest) const +bool IPv6RoutingTable::isLocalAddress(const IPv6Address& dest) const { Enter_Method("isLocalAddress(%s) y/n", dest.str().c_str()); @@ -511,7 +511,7 @@ bool RoutingTable6::isLocalAddress(const IPv6Address& dest) const return false; } -const IPv6Address& RoutingTable6::lookupDestCache(const IPv6Address& dest, int& outInterfaceId) +const IPv6Address& IPv6RoutingTable::lookupDestCache(const IPv6Address& dest, int& outInterfaceId) { Enter_Method("lookupDestCache(%s)", dest.str().c_str()); @@ -533,7 +533,7 @@ const IPv6Address& RoutingTable6::lookupDestCache(const IPv6Address& dest, int& return entry.nextHopAddr; } -const IPv6Route *RoutingTable6::doLongestPrefixMatch(const IPv6Address& dest) +const IPv6Route *IPv6RoutingTable::doLongestPrefixMatch(const IPv6Address& dest) { Enter_Method("doLongestPrefixMatch(%s)", dest.str().c_str()); @@ -566,7 +566,7 @@ const IPv6Route *RoutingTable6::doLongestPrefixMatch(const IPv6Address& dest) return NULL; } -bool RoutingTable6::isPrefixPresent(const IPv6Address& prefix) const +bool IPv6RoutingTable::isPrefixPresent(const IPv6Address& prefix) const { for (RouteList::const_iterator it=routeList.begin(); it!=routeList.end(); it++) if (prefix.matches((*it)->getDestPrefix(), 128)) @@ -574,7 +574,7 @@ bool RoutingTable6::isPrefixPresent(const IPv6Address& prefix) const return false; } -void RoutingTable6::updateDestCache(const IPv6Address& dest, const IPv6Address& nextHopAddr, int interfaceId, simtime_t expiryTime) +void IPv6RoutingTable::updateDestCache(const IPv6Address& dest, const IPv6Address& nextHopAddr, int interfaceId, simtime_t expiryTime) { DestCacheEntry &entry = destCache[dest]; entry.nextHopAddr = nextHopAddr; @@ -584,13 +584,13 @@ void RoutingTable6::updateDestCache(const IPv6Address& dest, const IPv6Address& updateDisplayString(); } -void RoutingTable6::purgeDestCache() +void IPv6RoutingTable::purgeDestCache() { destCache.clear(); updateDisplayString(); } -void RoutingTable6::purgeDestCacheEntriesToNeighbour(const IPv6Address& nextHopAddr, int interfaceId) +void IPv6RoutingTable::purgeDestCacheEntriesToNeighbour(const IPv6Address& nextHopAddr, int interfaceId) { for (DestCache::iterator it=destCache.begin(); it!=destCache.end(); ) { @@ -608,7 +608,7 @@ void RoutingTable6::purgeDestCacheEntriesToNeighbour(const IPv6Address& nextHopA updateDisplayString(); } -void RoutingTable6::purgeDestCacheForInterfaceID(int interfaceId) +void IPv6RoutingTable::purgeDestCacheForInterfaceID(int interfaceId) { for (DestCache::iterator it=destCache.begin(); it!=destCache.end(); ) { @@ -626,7 +626,7 @@ void RoutingTable6::purgeDestCacheForInterfaceID(int interfaceId) updateDisplayString(); } -void RoutingTable6::addOrUpdateOnLinkPrefix(const IPv6Address& destPrefix, int prefixLength, +void IPv6RoutingTable::addOrUpdateOnLinkPrefix(const IPv6Address& destPrefix, int prefixLength, int interfaceId, simtime_t expiryTime) { // see if prefix exists in table @@ -664,7 +664,7 @@ void RoutingTable6::addOrUpdateOnLinkPrefix(const IPv6Address& destPrefix, int p updateDisplayString(); } -void RoutingTable6::addOrUpdateOwnAdvPrefix(const IPv6Address& destPrefix, int prefixLength, +void IPv6RoutingTable::addOrUpdateOwnAdvPrefix(const IPv6Address& destPrefix, int prefixLength, int interfaceId, simtime_t expiryTime) { // FIXME this is very similar to the one above -- refactor!! @@ -704,7 +704,7 @@ void RoutingTable6::addOrUpdateOwnAdvPrefix(const IPv6Address& destPrefix, int p updateDisplayString(); } -void RoutingTable6::removeOnLinkPrefix(const IPv6Address& destPrefix, int prefixLength) +void IPv6RoutingTable::removeOnLinkPrefix(const IPv6Address& destPrefix, int prefixLength) { // scan the routing table for this prefix and remove it for (RouteList::iterator it=routeList.begin(); it!=routeList.end(); it++) @@ -719,7 +719,7 @@ void RoutingTable6::removeOnLinkPrefix(const IPv6Address& destPrefix, int prefix updateDisplayString(); } -void RoutingTable6::addStaticRoute(const IPv6Address& destPrefix, int prefixLength, +void IPv6RoutingTable::addStaticRoute(const IPv6Address& destPrefix, int prefixLength, unsigned int interfaceId, const IPv6Address& nextHop, int metric) { @@ -736,7 +736,7 @@ void RoutingTable6::addStaticRoute(const IPv6Address& destPrefix, int prefixLeng addRoute(route); } -void RoutingTable6::addDefaultRoute(const IPv6Address& nextHop, unsigned int ifID, +void IPv6RoutingTable::addDefaultRoute(const IPv6Address& nextHop, unsigned int ifID, simtime_t routerLifetime) { // create route object @@ -754,13 +754,13 @@ void RoutingTable6::addDefaultRoute(const IPv6Address& nextHop, unsigned int ifI addRoute(route); } -void RoutingTable6::addRoutingProtocolRoute(IPv6Route *route) +void IPv6RoutingTable::addRoutingProtocolRoute(IPv6Route *route) { ASSERT(route->getSrc()==IPv6Route::ROUTING_PROT); addRoute(route); } -bool RoutingTable6::routeLessThan(const IPv6Route *a, const IPv6Route *b) +bool IPv6RoutingTable::routeLessThan(const IPv6Route *a, const IPv6Route *b) { // helper for sort() in addRoute(). We want routes with longer // prefixes to be at front, so we compare them as "less". @@ -776,7 +776,7 @@ bool RoutingTable6::routeLessThan(const IPv6Route *a, const IPv6Route *b) return a->getMetric() < b->getMetric(); } -void RoutingTable6::addRoute(IPv6Route *route) +void IPv6RoutingTable::addRoute(IPv6Route *route) { route->setRoutingTable(this); routeList.push_back(route); @@ -793,7 +793,7 @@ void RoutingTable6::addRoute(IPv6Route *route) nb->fireChangeNotification(NF_IPv6_ROUTE_ADDED, route); } -void RoutingTable6::removeRoute(IPv6Route *route) +void IPv6RoutingTable::removeRoute(IPv6Route *route) { RouteList::iterator it = std::find(routeList.begin(), routeList.end(), route); ASSERT(it!=routeList.end()); @@ -811,12 +811,12 @@ void RoutingTable6::removeRoute(IPv6Route *route) updateDisplayString(); } -int RoutingTable6::getNumRoutes() const +int IPv6RoutingTable::getNumRoutes() const { return routeList.size(); } -IPv6Route *RoutingTable6::getRoute(int i) +IPv6Route *IPv6RoutingTable::getRoute(int i) { ASSERT(i>=0 && i<(int)routeList.size()); return routeList[i]; @@ -825,7 +825,7 @@ IPv6Route *RoutingTable6::getRoute(int i) #ifdef WITH_xMIPv6 //#####Added by Zarrar Yousaf################################################################## -const IPv6Address& RoutingTable6::getHomeAddress() +const IPv6Address& IPv6RoutingTable::getHomeAddress() { for (int i=0; igetNumInterfaces(); ++i) { @@ -838,7 +838,7 @@ const IPv6Address& RoutingTable6::getHomeAddress() } // Added by CB -bool RoutingTable6::isHomeAddress(const IPv6Address& addr) +bool IPv6RoutingTable::isHomeAddress(const IPv6Address& addr) { // check all interfaces whether they have the // provided address as HoA @@ -853,7 +853,7 @@ bool RoutingTable6::isHomeAddress(const IPv6Address& addr) } // Added by CB -void RoutingTable6::removeDefaultRoutes(int interfaceID) +void IPv6RoutingTable::removeDefaultRoutes(int interfaceID) { EV << "/// Removing default route for interface=" << interfaceID << endl; @@ -870,7 +870,7 @@ void RoutingTable6::removeDefaultRoutes(int interfaceID) } // Added by CB -void RoutingTable6::removeAllRoutes() +void IPv6RoutingTable::removeAllRoutes() { EV << "/// Removing all routes from rt6 " << endl; @@ -883,7 +883,7 @@ void RoutingTable6::removeAllRoutes() } // 4.9.07 - Added by CB -void RoutingTable6::removePrefixes(int interfaceID) +void IPv6RoutingTable::removePrefixes(int interfaceID) { for (RouteList::iterator it=routeList.begin(); it!=routeList.end(); ) { @@ -897,7 +897,7 @@ void RoutingTable6::removePrefixes(int interfaceID) updateDisplayString(); } -bool RoutingTable6::isOnLinkAddress(const IPv6Address& address) +bool IPv6RoutingTable::isOnLinkAddress(const IPv6Address& address) { for (int j = 0; j < ift->getNumInterfaces(); j++) { @@ -913,7 +913,7 @@ bool RoutingTable6::isOnLinkAddress(const IPv6Address& address) #endif /* WITH_xMIPv6 */ -bool RoutingTable6::handleOperationStage(LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) +bool IPv6RoutingTable::handleOperationStage(LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) { Enter_Method_Silent(); if (dynamic_cast(operation)) { diff --git a/src/networklayer/ipv6/RoutingTable6.h b/src/networklayer/ipv6/IPv6RoutingTable.h similarity index 96% rename from src/networklayer/ipv6/RoutingTable6.h rename to src/networklayer/ipv6/IPv6RoutingTable.h index b30bf28778c..e73f9b12efa 100644 --- a/src/networklayer/ipv6/RoutingTable6.h +++ b/src/networklayer/ipv6/IPv6RoutingTable.h @@ -28,7 +28,7 @@ class IInterfaceTable; class InterfaceEntry; -class RoutingTable6; +class IPv6RoutingTable; /** * Represents a route in the route table. Routes with src=FROM_RA represent @@ -77,11 +77,11 @@ class INET_API IPv6Route : public cObject }; protected: - RoutingTable6 *_rt; ///< the routing table in which this route is inserted, or NULL + IPv6RoutingTable *_rt; ///< the routing table in which this route is inserted, or NULL IPv6Address _destPrefix; short _length; RouteSrc _src; - int _interfaceID; //XXX IPv4 IRoutingTable uses interface pointer + int _interfaceID; //XXX IPv4 IIPv4RoutingTable uses interface pointer IPv6Address _nextHop; // unspecified means "direct" simtime_t _expiryTime; // if route is an advertised prefix: prefix lifetime int _metric; @@ -106,8 +106,8 @@ class INET_API IPv6Route : public cObject } /** To be called by the routing table when this route is added or removed from it */ - virtual void setRoutingTable(RoutingTable6 *rt) { _rt = rt; } - RoutingTable6 *getRoutingTable() const {return _rt;} + virtual void setRoutingTable(IPv6RoutingTable *rt) { _rt = rt; } + IPv6RoutingTable *getRoutingTable() const {return _rt;} virtual std::string info() const; virtual std::string detailedInfo() const; @@ -144,7 +144,7 @@ class INET_API IPv6Route : public cObject * be read and modified during simulation, typically by routing protocol * implementations. */ -class INET_API RoutingTable6 : public cSimpleModule, protected INotifiable, public ILifecycle +class INET_API IPv6RoutingTable : public cSimpleModule, protected INotifiable, public ILifecycle { protected: IInterfaceTable *ift; // cached pointer @@ -204,8 +204,8 @@ class INET_API RoutingTable6 : public cSimpleModule, protected INotifiable, publ virtual void updateDisplayString(); public: - RoutingTable6(); - virtual ~RoutingTable6(); + IPv6RoutingTable(); + virtual ~IPv6RoutingTable(); protected: virtual int numInitStages() const {return 5;} diff --git a/src/networklayer/ipv6/RoutingTable6.ned b/src/networklayer/ipv6/IPv6RoutingTable.ned similarity index 98% rename from src/networklayer/ipv6/RoutingTable6.ned rename to src/networklayer/ipv6/IPv6RoutingTable.ned index f971888633c..3e2c4634eb4 100644 --- a/src/networklayer/ipv6/RoutingTable6.ned +++ b/src/networklayer/ipv6/IPv6RoutingTable.ned @@ -26,7 +26,7 @@ package inet.networklayer.ipv6; // // @see ~IPv6, ~IPv6NeighbourDiscovery, ~ICMPv6 // -simple RoutingTable6 +simple IPv6RoutingTable { parameters: xml routingTable = default(xml("")); diff --git a/src/networklayer/ipv6/RoutingTable6Access.h b/src/networklayer/ipv6/IPv6RoutingTableAccess.h similarity index 79% rename from src/networklayer/ipv6/RoutingTable6Access.h rename to src/networklayer/ipv6/IPv6RoutingTableAccess.h index 2bc0ae8c809..d2a97d59401 100644 --- a/src/networklayer/ipv6/RoutingTable6Access.h +++ b/src/networklayer/ipv6/IPv6RoutingTableAccess.h @@ -22,16 +22,16 @@ #include "INETDefs.h" #include "ModuleAccess.h" -#include "RoutingTable6.h" +#include "IPv6RoutingTable.h" /** - * Gives access to RoutingTable6 + * Gives access to IPv6RoutingTable */ -class INET_API RoutingTable6Access : public ModuleAccess +class INET_API IPv6RoutingTableAccess : public ModuleAccess { public: - RoutingTable6Access() : ModuleAccess("routingTable6") {} + IPv6RoutingTableAccess() : ModuleAccess("routingTable6") {} }; #endif diff --git a/src/networklayer/ipv6tunneling/IPv6Tunneling.cc b/src/networklayer/ipv6tunneling/IPv6Tunneling.cc index 0892ccfd408..038651ec6c0 100644 --- a/src/networklayer/ipv6tunneling/IPv6Tunneling.cc +++ b/src/networklayer/ipv6tunneling/IPv6Tunneling.cc @@ -43,7 +43,7 @@ #include "IPv6InterfaceData.h" #include "ModuleAccess.h" #include "NodeStatus.h" -#include "RoutingTable6Access.h" +#include "IPv6RoutingTableAccess.h" #ifdef WITH_xMIPv6 #include "MobilityHeader_m.h" // for HA Option header @@ -66,7 +66,7 @@ void IPv6Tunneling::initialize(int stage) if (stage == 0) { ift = InterfaceTableAccess().get(); - rt = RoutingTable6Access().get(); + rt = IPv6RoutingTableAccess().get(); vIfIndexTop = INT_MAX; // virtual interface number set to maximum int value noOfNonSplitTunnels = 0; // current number of non-split tunnels on this host diff --git a/src/networklayer/ipv6tunneling/IPv6Tunneling.h b/src/networklayer/ipv6tunneling/IPv6Tunneling.h index 532d4145e76..1d9cbda69ec 100644 --- a/src/networklayer/ipv6tunneling/IPv6Tunneling.h +++ b/src/networklayer/ipv6tunneling/IPv6Tunneling.h @@ -35,7 +35,7 @@ // Foreign declarations: class IInterfaceTable; class IPv6Datagram; -class RoutingTable6; +class IPv6RoutingTable; /** @@ -57,7 +57,7 @@ class INET_API IPv6Tunneling : public cSimpleModule, public ILifecycle protected: IInterfaceTable* ift; - RoutingTable6* rt; + IPv6RoutingTable* rt; struct Tunnel { diff --git a/src/networklayer/ldp/LDP.cc b/src/networklayer/ldp/LDP.cc index e312e316eaa..4d4be5fa26c 100644 --- a/src/networklayer/ldp/LDP.cc +++ b/src/networklayer/ldp/LDP.cc @@ -25,7 +25,7 @@ #include "LIBTable.h" #include "InterfaceTableAccess.h" #include "IPv4InterfaceData.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "LIBTableAccess.h" #include "TEDAccess.h" #include "NotifierConsts.h" @@ -109,7 +109,7 @@ void LDP::initialize(int stage) helloInterval = par("helloInterval").doubleValue(); ift = InterfaceTableAccess().get(); - rt = RoutingTableAccess().get(); + rt = IPv4RoutingTableAccess().get(); lt = LIBTableAccess().get(); tedmod = TEDAccess().get(); nb = NotificationBoardAccess().get(); @@ -543,7 +543,7 @@ void LDP::processHelloTimeout(cMessage *msg) void LDP::processLDPHello(LDPHello *msg) { UDPDataIndication *controlInfo = check_and_cast(msg->getControlInfo()); - //IPv4Address peerAddr = controlInfo->getSrcAddr().get4(); + //IPv4Address peerAddr = controlInfo->getSrcAddr().toIPv4(); IPv4Address peerAddr = msg->getSenderAddress(); int interfaceId = controlInfo->getInterfaceId(); delete msg; @@ -627,7 +627,7 @@ void LDP::processMessageFromTCP(cMessage *msg) // FIXME there seems to be some confusion here. Is it sure that // routerIds we use as peerAddrs are the same as IP addresses // the routing is based on? --Andras - IPv4Address peerAddr = socket->getRemoteAddress().get4(); + IPv4Address peerAddr = socket->getRemoteAddress().toIPv4(); int i = findPeer(peerAddr); if (i==-1 || myPeers[i].socket) diff --git a/src/networklayer/ldp/LDP.h b/src/networklayer/ldp/LDP.h index 2a2dbe04fd9..4c5743ae30e 100644 --- a/src/networklayer/ldp/LDP.h +++ b/src/networklayer/ldp/LDP.h @@ -40,7 +40,7 @@ class IInterfaceTable; -class IRoutingTable; +class IIPv4RoutingTable; class LIBTable; class TED; @@ -118,7 +118,7 @@ class INET_API LDP: public cSimpleModule, public TCPSocket::CallbackInterface, p // NodeStatus *nodeStatus; IInterfaceTable *ift; - IRoutingTable *rt; + IIPv4RoutingTable *rt; LIBTable *lt; TED *tedmod; NotificationBoard *nb; diff --git a/src/networklayer/manetrouting/aodv/aodv-uu/aodv_socket.cc b/src/networklayer/manetrouting/aodv/aodv-uu/aodv_socket.cc index ada92656ca5..940268b3327 100644 --- a/src/networklayer/manetrouting/aodv/aodv-uu/aodv_socket.cc +++ b/src/networklayer/manetrouting/aodv/aodv-uu/aodv_socket.cc @@ -614,8 +614,6 @@ void NS_CLASS aodv_socket_send(AODV_msg * aodv_msg, struct in_addr dst, else delay = par ("unicastDelay").doubleValue(); } - // IPv4Address desAddIp4(dst.s_addr); - // IPvXAddress destAdd(desAddIp4); if (useIndex) sendToIp(aodv_msg, 654, destAdd, 654, ttl, delay, dev->ifindex); else @@ -706,5 +704,3 @@ void aodv_socket_cleanup(void) #endif /* NS_PORT */ } - - diff --git a/src/networklayer/manetrouting/aodv/aodv_msg_struct.cc b/src/networklayer/manetrouting/aodv/aodv_msg_struct.cc index 6d762efe39d..a2e69bf5a6d 100644 --- a/src/networklayer/manetrouting/aodv/aodv_msg_struct.cc +++ b/src/networklayer/manetrouting/aodv/aodv_msg_struct.cc @@ -9,7 +9,7 @@ #include "IPv6ControlInfo.h" #include "ICMPMessage_m.h" #include "IPv4Datagram.h" -#include "RoutingTable.h" +#include "IPv4RoutingTable.h" #include "ICMPAccess.h" #include "IPv4ControlInfo.h" #include "IPv4Datagram.h" diff --git a/src/networklayer/manetrouting/aodv/aodv_uu_omnet.cc b/src/networklayer/manetrouting/aodv/aodv_uu_omnet.cc index d751beae3ff..854d687053f 100644 --- a/src/networklayer/manetrouting/aodv/aodv_uu_omnet.cc +++ b/src/networklayer/manetrouting/aodv/aodv_uu_omnet.cc @@ -37,7 +37,7 @@ #include "ProtocolMap.h" #include "IPv4Address.h" -#include "IPvXAddress.h" +#include "Address.h" #include "ControlManetRouting_m.h" #include "Ieee802Ctrl_m.h" #include "aodv_uu_omnet.h" @@ -855,8 +855,8 @@ void NS_CLASS recvAODVUUPacket(cMessage * msg) if (!isInMacLayer()) { IPv4ControlInfo *ctrl = check_and_cast(msg->getControlInfo()); - IPvXAddress srcAddr = ctrl->getSrcAddr(); - IPvXAddress destAddr = ctrl->getDestAddr(); + Address srcAddr = ctrl->getSrcAddr(); + Address destAddr = ctrl->getDestAddr(); src.s_addr = ManetAddress(srcAddr); dst.s_addr = ManetAddress(destAddr); diff --git a/src/networklayer/manetrouting/base/ManetAddress.cc b/src/networklayer/manetrouting/base/ManetAddress.cc index bd32f6286f9..29720bf95c0 100644 --- a/src/networklayer/manetrouting/base/ManetAddress.cc +++ b/src/networklayer/manetrouting/base/ManetAddress.cc @@ -30,12 +30,12 @@ void ManetAddress::set(const IPv6Address& addr) lo = ((uint64_t)w[2] << 32) + w[3]; } -void ManetAddress::set(const IPvXAddress& addr) +void ManetAddress::set(const Address& addr) { if (addr.isIPv6()) - set(addr.get6()); + set(addr.toIPv6()); else - set(addr.get4()); + set(addr.toIPv4()); } void ManetAddress::setPrefix(short unsigned int masklen) @@ -67,15 +67,15 @@ IPv6Address ManetAddress::getIPv6() const throw cRuntimeError("ManetAddress is not an IPv6Address"); } -IPvXAddress ManetAddress::getIPvX() const +Address ManetAddress::getIPvX() const { if (addrType == IPv4_ADDRESS) - return IPvXAddress(_getIPv4()); + return Address(_getIPv4()); if (addrType == IPv6_ADDRESS) - return IPvXAddress(_getIPv6()); + return Address(_getIPv6()); if (addrType == UNDEFINED) - return IPvXAddress(IPv4Address::UNSPECIFIED_ADDRESS); - throw cRuntimeError("ManetAddress is not an IPvXAddress"); + return Address(IPv4Address::UNSPECIFIED_ADDRESS); + throw cRuntimeError("ManetAddress is not an Address"); } MACAddress ManetAddress::getMAC() const @@ -170,20 +170,20 @@ void ManetNetworkAddress::set(const IPv6Address& addr, short unsigned int maskle prefixLength = masklen; } -void ManetNetworkAddress::set(const IPvXAddress& addr) +void ManetNetworkAddress::set(const Address& addr) { if (addr.isIPv6()) - set(addr.get6()); + set(addr.toIPv6()); else - set(addr.get4()); + set(addr.toIPv4()); } -void ManetNetworkAddress::set(const IPvXAddress& addr, short unsigned int masklen) +void ManetNetworkAddress::set(const Address& addr, short unsigned int masklen) { if (addr.isIPv6()) - set(addr.get6(), masklen); + set(addr.toIPv6(), masklen); else - set(addr.get4(), masklen); + set(addr.toIPv4(), masklen); } void ManetNetworkAddress::set(MACAddress addr, short unsigned int masklen) diff --git a/src/networklayer/manetrouting/base/ManetAddress.h b/src/networklayer/manetrouting/base/ManetAddress.h index f7542d8b2f2..8d26a540b36 100644 --- a/src/networklayer/manetrouting/base/ManetAddress.h +++ b/src/networklayer/manetrouting/base/ManetAddress.h @@ -22,7 +22,7 @@ #include "IPv4Address.h" #include "IPv6Address.h" -#include "IPvXAddress.h" +#include "Address.h" #include "MACAddress.h" /** @@ -49,19 +49,19 @@ class ManetAddress ManetAddress(const ManetAddress& o) : hi(o.hi), lo(o.lo), addrType(o.addrType) {} explicit ManetAddress(IPv4Address addr) { set(addr); } explicit ManetAddress(const IPv6Address& addr) { set(addr); } - explicit ManetAddress(const IPvXAddress& addr) { set(addr); } + explicit ManetAddress(const Address& addr) { set(addr); } explicit ManetAddress(MACAddress addr) { set(addr); } /// Setters void set(const IPv4Address& addr) { addrType = IPv4_ADDRESS; hi = addr.getInt(); lo = 0; } void set(const IPv6Address& addr); - void set(const IPvXAddress& addr); + void set(const Address& addr); void set(const MACAddress& addr) { addrType = MAC_ADDRESS; hi = addr.getInt(); lo = 0; } /// Getters IPv4Address getIPv4() const; IPv6Address getIPv6() const; - IPvXAddress getIPvX() const; + Address getIPvX() const; MACAddress getMAC() const; /// Get address type @@ -132,14 +132,14 @@ class ManetNetworkAddress ManetNetworkAddress(const ManetAddress& o, short unsigned int masklen) : address(o), prefixLength(masklen) { setPrefixLen(masklen); } explicit ManetNetworkAddress(IPv4Address addr, short unsigned int masklen=32) { set(addr, masklen); } explicit ManetNetworkAddress(const IPv6Address& addr, short unsigned int masklen=128) { set(addr, masklen); } - explicit ManetNetworkAddress(const IPvXAddress& addr) { set(addr); } - ManetNetworkAddress(const IPvXAddress& addr, short unsigned int masklen) { set(addr, masklen); } + explicit ManetNetworkAddress(const Address& addr) { set(addr); } + ManetNetworkAddress(const Address& addr, short unsigned int masklen) { set(addr, masklen); } explicit ManetNetworkAddress(MACAddress addr, short unsigned int masklen=48) { set(addr, masklen); } void set(IPv4Address addr, short unsigned int masklen = 32); void set(const IPv6Address& addr, short unsigned int masklen = 128); - void set(const IPvXAddress& addr); - void set(const IPvXAddress& addr, short unsigned int masklen); + void set(const Address& addr); + void set(const Address& addr, short unsigned int masklen); void set(MACAddress addr, short unsigned int masklen = 48); void setPrefixLen(short unsigned int masklen); diff --git a/src/networklayer/manetrouting/base/ManetRoutingBase.cc b/src/networklayer/manetrouting/base/ManetRoutingBase.cc index 2316e002ba0..714c7db0fbf 100644 --- a/src/networklayer/manetrouting/base/ManetRoutingBase.cc +++ b/src/networklayer/manetrouting/base/ManetRoutingBase.cc @@ -28,7 +28,7 @@ #include "IPv4InterfaceData.h" #include "IPv6ControlInfo.h" #include "Ieee802Ctrl_m.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTableAccess.h" #include "Coord.h" #include "ControlInfoBreakLink_m.h" @@ -86,7 +86,7 @@ void ManetRoutingBase::registerRoutingModule() /* Set host parameters */ isRegistered = true; int num_80211 = 0; - inet_rt = RoutingTableAccess().getIfExists(); + inet_rt = IPv4RoutingTableAccess().getIfExists(); inet_ift = InterfaceTableAccess().get(); nb = NotificationBoardAccess().get(); diff --git a/src/networklayer/manetrouting/base/ManetRoutingBase.h b/src/networklayer/manetrouting/base/ManetRoutingBase.h index 9c14e60e56c..b21d3b27110 100644 --- a/src/networklayer/manetrouting/base/ManetRoutingBase.h +++ b/src/networklayer/manetrouting/base/ManetRoutingBase.h @@ -28,10 +28,10 @@ #include "compatibility.h" #include "Coord.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "NotificationBoard.h" #include "IInterfaceTable.h" -#include "IPvXAddress.h" +#include "Address.h" #include "ManetAddress.h" #include "NotifierConsts.h" #include "ICMP.h" @@ -73,7 +73,7 @@ class INET_API ManetRoutingBase : public cSimpleModule, public INotifiable, prot static bool createInternalStore; static GlobalRouteMap *globalRouteMap; - IRoutingTable *inet_rt; + IIPv4RoutingTable *inet_rt; IInterfaceTable *inet_ift; NotificationBoard *nb; ICMP *icmpModule; diff --git a/src/networklayer/manetrouting/batman/BatmanMain.cc b/src/networklayer/manetrouting/batman/BatmanMain.cc index ccb4619c577..a976ebbb4c6 100644 --- a/src/networklayer/manetrouting/batman/BatmanMain.cc +++ b/src/networklayer/manetrouting/batman/BatmanMain.cc @@ -4,7 +4,7 @@ #include "IPv4ControlInfo.h" #include "IPv4InterfaceData.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "UDPPacket_m.h" #include "Ieee802Ctrl_m.h" @@ -131,7 +131,7 @@ void Batman::initialize(int stage) throw cRuntimeError("Invalid 'originatorInterval' parameter"); const char *preferedGateWay = par("preferedGateWay"); - pref_gateway = ManetAddress(IPvXAddressResolver().resolve(preferedGateWay, IPvXAddressResolver::ADDR_IPv4)); + pref_gateway = ManetAddress(AddressResolver().resolve(preferedGateWay, AddressResolver::ADDR_IPv4)); routing_class = par("routingClass"); if (routing_class < 0) @@ -216,8 +216,8 @@ void Batman::initialize(int stage) if (addrPair.size() != 2) throw cRuntimeError("invalid 'announcedNetworks' parameter content: '%s'", token); - IPv4Address addr = IPvXAddressResolver().resolve(addrPair[0].c_str()).get4(); - IPv4Address mask = IPvXAddressResolver().resolve(addrPair[1].c_str(), IPvXAddressResolver::ADDR_MASK).get4(); + IPv4Address addr = AddressResolver().resolve(addrPair[0].c_str()).toIPv4(); + IPv4Address mask = AddressResolver().resolve(addrPair[1].c_str(), AddressResolver::ADDR_MASK).toIPv4(); addr.doAnd(mask); // add to HNA: @@ -276,7 +276,7 @@ void Batman::handleMessage(cMessage *msg) if (!this->isInMacLayer()) { IPv4ControlInfo *ctrl = check_and_cast(msg->removeControlInfo()); - IPvXAddress srcAddr = ctrl->getSrcAddr(); + Address srcAddr = ctrl->getSrcAddr(); neigh = ManetAddress(srcAddr); for (unsigned int i=0; ipurge(); @@ -278,7 +278,7 @@ void DSDV_2::handleMessage(cMessage *msg) IPv4Address source = interface80211ptr->ipv4Data()->getIPAddress(); //pointer to interface and routing table - //rt = RoutingTableAccess_DSDV().get(); // RoutingTable *rt = nodeInfo[i].rt; + //rt = RoutingTableAccess_DSDV().get(); // IPv4RoutingTable *rt = nodeInfo[i].rt; //ift = InterfaceTableAccess().get();//InterfaceTable *ift = nodeInfo[i].ift; diff --git a/src/networklayer/manetrouting/dsdv/DSDV_2.h b/src/networklayer/manetrouting/dsdv/DSDV_2.h index 16852739489..a2f90f2b287 100644 --- a/src/networklayer/manetrouting/dsdv/DSDV_2.h +++ b/src/networklayer/manetrouting/dsdv/DSDV_2.h @@ -30,9 +30,9 @@ #include "IPv4Datagram.h" #include "IInterfaceTable.h" #include "InterfaceTableAccess.h" -#include "IRoutingTable.h" -#include "RoutingTable.h" -#include "RoutingTableAccess.h" +#include "IIPv4RoutingTable.h" +#include "IPv4RoutingTable.h" +#include "IPv4RoutingTableAccess.h" using namespace std; @@ -61,7 +61,7 @@ class INET_API DSDV_2 : public cSimpleModule protected: simtime_t hellomsgperiod_DSDV; IInterfaceTable *ift; - IRoutingTable *rt; + IIPv4RoutingTable *rt; public: DSDV_2(); diff --git a/src/networklayer/manetrouting/dsr/dsr-uu-omnetpp.cc b/src/networklayer/manetrouting/dsr/dsr-uu-omnetpp.cc index cf1228f0fdf..31b5ab4eed7 100644 --- a/src/networklayer/manetrouting/dsr/dsr-uu-omnetpp.cc +++ b/src/networklayer/manetrouting/dsr/dsr-uu-omnetpp.cc @@ -324,7 +324,7 @@ void DSRUU::initialize(int stage) if (stage==4) { /* Search the 80211 interface */ - inet_rt = RoutingTableAccess().get(); + inet_rt = IPv4RoutingTableAccess().get(); inet_ift = InterfaceTableAccess().get(); int num_80211 = 0; diff --git a/src/networklayer/manetrouting/dsr/dsr-uu-omnetpp.h b/src/networklayer/manetrouting/dsr/dsr-uu-omnetpp.h index ca3cfb8b95e..ca366e1d230 100644 --- a/src/networklayer/manetrouting/dsr/dsr-uu-omnetpp.h +++ b/src/networklayer/manetrouting/dsr/dsr-uu-omnetpp.h @@ -23,8 +23,8 @@ #ifndef MobilityFramework #include "IPv4Datagram.h" #include "InterfaceTableAccess.h" -#include "RoutingTableAccess.h" -#include "IRoutingTable.h" +#include "IPv4RoutingTableAccess.h" +#include "IIPv4RoutingTable.h" #include "ICMPAccess.h" #include "IPv4InterfaceData.h" #include "IInterfaceTable.h" @@ -249,7 +249,7 @@ class DSRUU:public cSimpleModule, public INotifiable //************++ #ifndef MobilityFramework - IRoutingTable *inet_rt; + IIPv4RoutingTable *inet_rt; IInterfaceTable *inet_ift; #else SimpleArp* arp; diff --git a/src/networklayer/manetrouting/dymo/dymo_um_omnet.cc b/src/networklayer/manetrouting/dymo/dymo_um_omnet.cc index c95a48e838e..8252ab7f374 100644 --- a/src/networklayer/manetrouting/dymo/dymo_um_omnet.cc +++ b/src/networklayer/manetrouting/dymo/dymo_um_omnet.cc @@ -40,7 +40,7 @@ #include "ProtocolMap.h" #include "IPv4Address.h" -#include "IPvXAddress.h" +#include "Address.h" #include "ControlManetRouting_m.h" #ifdef WITH_80211MESH #include "LocatorNotificationInfo_m.h" @@ -647,8 +647,8 @@ void DYMOUM::recvDYMOUMPacket(cMessage * msg) if (!isInMacLayer()) { IPv4ControlInfo *ctrl = check_and_cast(msg->removeControlInfo()); - IPvXAddress srcAddr = ctrl->getSrcAddr(); - IPvXAddress destAddr = ctrl->getDestAddr(); + Address srcAddr = ctrl->getSrcAddr(); + Address destAddr = ctrl->getDestAddr(); src.s_addr = ManetAddress(srcAddr); dst.s_addr = ManetAddress(destAddr); interfaceId = ctrl->getInterfaceId(); diff --git a/src/networklayer/manetrouting/dymo_fau/DYMO.h b/src/networklayer/manetrouting/dymo_fau/DYMO.h index db4b4e230e0..b4d4e7b770d 100644 --- a/src/networklayer/manetrouting/dymo_fau/DYMO.h +++ b/src/networklayer/manetrouting/dymo_fau/DYMO.h @@ -26,8 +26,8 @@ #include "IPv4.h" #include "IInterfaceTable.h" #include "InterfaceTableAccess.h" -#include "IRoutingTable.h" -#include "RoutingTableAccess.h" +#include "IIPv4RoutingTable.h" +#include "IPv4RoutingTableAccess.h" #include "Ieee802Ctrl_m.h" #include "ICMPMessage.h" #include "IPv4Datagram.h" diff --git a/src/networklayer/manetrouting/dymo_fau/DYMO_DataQueue.h b/src/networklayer/manetrouting/dymo_fau/DYMO_DataQueue.h index db36fdabe42..4339740d935 100644 --- a/src/networklayer/manetrouting/dymo_fau/DYMO_DataQueue.h +++ b/src/networklayer/manetrouting/dymo_fau/DYMO_DataQueue.h @@ -31,8 +31,8 @@ #include "IPv4Datagram.h" #include "InterfaceTable.h" #include "InterfaceTableAccess.h" -#include "RoutingTable.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTable.h" +#include "IPv4RoutingTableAccess.h" #include "IPv4.h" class DYMO; diff --git a/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingEntry.h b/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingEntry.h index 2fc0372bb03..9fa3b8501a4 100644 --- a/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingEntry.h +++ b/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingEntry.h @@ -27,7 +27,7 @@ #include #include -#include "RoutingTable.h" +#include "IPv4RoutingTable.h" #include "DYMO_Timer.h" class DYMO; diff --git a/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingTable.cc b/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingTable.cc index 29b7dc52323..17446b43ed9 100644 --- a/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingTable.cc +++ b/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingTable.cc @@ -32,11 +32,11 @@ DYMO_RoutingTable::DYMO_RoutingTable(DYMO* host, const IPv4Address& myAddr) dymoProcess = host; // get our routing table - // routingTable = IPvXAddressResolver().routingTableOf(host); + // routingTable = AddressResolver().routingTableOf(host); // if (!routingTable) throw cRuntimeError("No routing table found"); // get our interface table - // IInterfaceTable *ift = IPvXAddressResolver().interfaceTableOf(host); + // IInterfaceTable *ift = AddressResolver().interfaceTableOf(host); // look at all interface table entries } diff --git a/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingTable.h b/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingTable.h index 20449e36209..cd763e2d318 100644 --- a/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingTable.h +++ b/src/networklayer/manetrouting/dymo_fau/DYMO_RoutingTable.h @@ -26,7 +26,7 @@ #include "NotificationBoard.h" #include "DYMO_RoutingEntry.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" /** * class describes the functionality of the routing table diff --git a/src/networklayer/manetrouting/dymo_fau/DYMO_TokenBucket.h b/src/networklayer/manetrouting/dymo_fau/DYMO_TokenBucket.h index 7cfd13736e3..8be0ee65e44 100644 --- a/src/networklayer/manetrouting/dymo_fau/DYMO_TokenBucket.h +++ b/src/networklayer/manetrouting/dymo_fau/DYMO_TokenBucket.h @@ -24,8 +24,8 @@ #include "IPv4Address.h" #include "IInterfaceTable.h" #include "InterfaceTableAccess.h" -#include "IRoutingTable.h" -#include "RoutingTableAccess.h" +#include "IIPv4RoutingTable.h" +#include "IPv4RoutingTableAccess.h" #include "Ieee802Ctrl_m.h" #include "ICMPMessage.h" #include "IPv4Datagram.h" diff --git a/src/networklayer/manetrouting/olsr/OLSR.cc b/src/networklayer/manetrouting/olsr/OLSR.cc index cac65df7610..b1a75d88767 100644 --- a/src/networklayer/manetrouting/olsr/OLSR.cc +++ b/src/networklayer/manetrouting/olsr/OLSR.cc @@ -38,7 +38,7 @@ #include "IPv4ControlInfo.h" #include "IPv4InterfaceData.h" #include "IPv6ControlInfo.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTableAccess.h" #include "OLSRpkt_m.h" diff --git a/src/networklayer/manetrouting/olsr/OLSROPT.cc b/src/networklayer/manetrouting/olsr/OLSROPT.cc index 79f7b9a70e7..eccbf6406d4 100644 --- a/src/networklayer/manetrouting/olsr/OLSROPT.cc +++ b/src/networklayer/manetrouting/olsr/OLSROPT.cc @@ -37,7 +37,7 @@ #include "IPv4ControlInfo.h" #include "IPv4InterfaceData.h" #include "IPv6ControlInfo.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTableAccess.h" #include "OLSRpkt_m.h" diff --git a/src/networklayer/manetrouting/olsr/OLSR_ETX.cc b/src/networklayer/manetrouting/olsr/OLSR_ETX.cc index 9c13516c07b..4cd47d7a355 100644 --- a/src/networklayer/manetrouting/olsr/OLSR_ETX.cc +++ b/src/networklayer/manetrouting/olsr/OLSR_ETX.cc @@ -43,7 +43,7 @@ #include "IPv6ControlInfo.h" #include "NotifierConsts.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTableAccess.h" #include "OLSRpkt_m.h" diff --git a/src/networklayer/mpls/LIBTable.cc b/src/networklayer/mpls/LIBTable.cc index 75eaf6817ee..6266a5ab7d5 100644 --- a/src/networklayer/mpls/LIBTable.cc +++ b/src/networklayer/mpls/LIBTable.cc @@ -16,7 +16,7 @@ #include #include "LIBTable.h" #include "XMLUtils.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" Define_Module(LIBTable); @@ -28,8 +28,8 @@ void LIBTable::initialize(int stage) // we have to wait until routerId gets assigned in stage 3 if (stage==4) { - RoutingTableAccess routingTableAccess; - IRoutingTable *rt = routingTableAccess.get(); + IPv4RoutingTableAccess routingTableAccess; + IIPv4RoutingTable *rt = routingTableAccess.get(); routerId = rt->getRouterId(); // read configuration diff --git a/src/networklayer/mpls/MPLS.cc b/src/networklayer/mpls/MPLS.cc index f3008d733b8..891cc7c84b3 100644 --- a/src/networklayer/mpls/MPLS.cc +++ b/src/networklayer/mpls/MPLS.cc @@ -21,7 +21,7 @@ #include "Utils.h" #include "InterfaceTableAccess.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "LIBTableAccess.h" #include "IClassifier.h" diff --git a/src/networklayer/ospfv2/OSPFConfigReader.cc b/src/networklayer/ospfv2/OSPFConfigReader.cc index d1c5694c5e2..53a3ec70813 100644 --- a/src/networklayer/ospfv2/OSPFConfigReader.cc +++ b/src/networklayer/ospfv2/OSPFConfigReader.cc @@ -27,13 +27,13 @@ #include "IPv4Address.h" #include "IPv4ControlInfo.h" #include "IPv4InterfaceData.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "MessageHandler.h" #include "OSPFArea.h" #include "OSPFcommon.h" #include "OSPFInterface.h" #include "PatternMatcher.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "XMLUtils.h" diff --git a/src/networklayer/ospfv2/OSPFConfigReader.h b/src/networklayer/ospfv2/OSPFConfigReader.h index e89f51e623b..8844183076c 100644 --- a/src/networklayer/ospfv2/OSPFConfigReader.h +++ b/src/networklayer/ospfv2/OSPFConfigReader.h @@ -24,7 +24,7 @@ #include "INETDefs.h" #include "IInterfaceTable.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "OSPFPacket_m.h" #include "OSPFRouter.h" diff --git a/src/networklayer/ospfv2/OSPFRouting.cc b/src/networklayer/ospfv2/OSPFRouting.cc index ec332d36cc1..579e2c52266 100644 --- a/src/networklayer/ospfv2/OSPFRouting.cc +++ b/src/networklayer/ospfv2/OSPFRouting.cc @@ -25,7 +25,7 @@ #include "MessageHandler.h" #include "OSPFConfigReader.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "NodeOperations.h" #include "NodeStatus.h" @@ -59,7 +59,7 @@ void OSPFRouting::initialize(int stage) void OSPFRouting::createOspfRouter() { - IRoutingTable *rt = RoutingTableAccess().get(); + IIPv4RoutingTable *rt = IPv4RoutingTableAccess().get(); ospfRouter = new OSPF::Router(rt->getRouterId(), this); // read the OSPF AS configuration diff --git a/src/networklayer/ospfv2/OSPFRouting.h b/src/networklayer/ospfv2/OSPFRouting.h index b92a3c635cf..0b8e2655c49 100644 --- a/src/networklayer/ospfv2/OSPFRouting.h +++ b/src/networklayer/ospfv2/OSPFRouting.h @@ -24,7 +24,7 @@ #include "INETDefs.h" #include "IInterfaceTable.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "OSPFPacket_m.h" #include "OSPFRouter.h" #include "ILifecycle.h" diff --git a/src/networklayer/ospfv2/router/OSPFRouter.cc b/src/networklayer/ospfv2/router/OSPFRouter.cc index 3215dd4e2ee..b95a69cea53 100644 --- a/src/networklayer/ospfv2/router/OSPFRouter.cc +++ b/src/networklayer/ospfv2/router/OSPFRouter.cc @@ -18,7 +18,7 @@ #include "OSPFRouter.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" OSPF::Router::Router(OSPF::RouterID id, cSimpleModule* containingModule) : @@ -745,9 +745,9 @@ void OSPF::Router::rebuildRoutingTable() routingTable.clear(); routingTable.assign(newTable.begin(), newTable.end()); - RoutingTableAccess routingTableAccess; + IPv4RoutingTableAccess routingTableAccess; std::vector eraseEntries; - IRoutingTable* simRoutingTable = routingTableAccess.get(); + IIPv4RoutingTable* simRoutingTable = routingTableAccess.get(); unsigned long routingEntryNumber = simRoutingTable->getNumRoutes(); // remove entries from the IPv4 routing table inserted by the OSPF module for (i = 0; i < routingEntryNumber; i++) { @@ -1328,7 +1328,7 @@ void OSPF::Router::updateExternalRoute(IPv4Address networkAddress, const OSPFASE OSPFOptions lsaOptions; //OSPF::LSAKeyType lsaKey; - IRoutingTable* simRoutingTable = RoutingTableAccess().get(); + IIPv4RoutingTable* simRoutingTable = IPv4RoutingTableAccess().get(); unsigned long routingEntryNumber = simRoutingTable->getNumRoutes(); bool inRoutingTable = false; // add the external route to the routing table if it was not added by another module @@ -1350,7 +1350,7 @@ void OSPF::Router::updateExternalRoute(IPv4Address networkAddress, const OSPFASE entry->setInterface(InterfaceTableAccess().get()->getInterfaceById(ifIndex)); entry->setSource(IPv4Route::MANUAL); entry->setMetric(externalRouteContents.getRouteCost()); - simRoutingTable->addRoute(entry); // IRoutingTable deletes entry pointer + simRoutingTable->addRoute(entry); // IIPv4RoutingTable deletes entry pointer } lsaHeader.setLsAge(0); @@ -1380,7 +1380,7 @@ void OSPF::Router::updateExternalRoute(IPv4Address networkAddress, const OSPFASE void OSPF::Router::addExternalRouteInIPTable(IPv4Address networkAddress, const OSPFASExternalLSAContents& externalRouteContents, int ifIndex) { - IRoutingTable* simRoutingTable = RoutingTableAccess().get(); + IIPv4RoutingTable* simRoutingTable = IPv4RoutingTableAccess().get(); IInterfaceTable* simInterfaceTable = InterfaceTableAccess().get(); int routingEntryNumber = simRoutingTable->getNumRoutes(); bool inRoutingTable = false; diff --git a/src/networklayer/ospfv2/router/OSPFRoutingTableEntry.cc b/src/networklayer/ospfv2/router/OSPFRoutingTableEntry.cc index 80176bc949b..a3d86b5a993 100644 --- a/src/networklayer/ospfv2/router/OSPFRoutingTableEntry.cc +++ b/src/networklayer/ospfv2/router/OSPFRoutingTableEntry.cc @@ -53,7 +53,7 @@ OSPF::RoutingTableEntry::RoutingTableEntry(const RoutingTableEntry& entry) : void OSPF::RoutingTableEntry::setPathType(RoutingPathType type) { pathType = type; - // FIXME: this is a hack. But the correct way to do it is to implement a separate IRoutingTable module for OSPF... + // FIXME: this is a hack. But the correct way to do it is to implement a separate IIPv4RoutingTable module for OSPF... if (pathType == OSPF::RoutingTableEntry::TYPE2_EXTERNAL) { setMetric(cost + type2Cost * 1000); } else { @@ -64,7 +64,7 @@ void OSPF::RoutingTableEntry::setPathType(RoutingPathType type) void OSPF::RoutingTableEntry::setCost(Metric pathCost) { cost = pathCost; - // FIXME: this is a hack. But the correct way to do it is to implement a separate IRoutingTable module for OSPF... + // FIXME: this is a hack. But the correct way to do it is to implement a separate IIPv4RoutingTable module for OSPF... if (pathType == OSPF::RoutingTableEntry::TYPE2_EXTERNAL) { setMetric(cost + type2Cost * 1000); } else { @@ -75,7 +75,7 @@ void OSPF::RoutingTableEntry::setCost(Metric pathCost) void OSPF::RoutingTableEntry::setType2Cost(Metric pathCost) { type2Cost = pathCost; - // FIXME: this is a hack. But the correct way to do it is to implement a separate IRoutingTable module for OSPF... + // FIXME: this is a hack. But the correct way to do it is to implement a separate IIPv4RoutingTable module for OSPF... if (pathType == OSPF::RoutingTableEntry::TYPE2_EXTERNAL) { setMetric(cost + type2Cost * 1000); } else { diff --git a/src/networklayer/ospfv2/router/OSPFRoutingTableEntry.h b/src/networklayer/ospfv2/router/OSPFRoutingTableEntry.h index 93b7b529b48..291e20cfd7e 100644 --- a/src/networklayer/ospfv2/router/OSPFRoutingTableEntry.h +++ b/src/networklayer/ospfv2/router/OSPFRoutingTableEntry.h @@ -24,7 +24,7 @@ #include "INETDefs.h" #include "InterfaceTableAccess.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "LSA.h" #include "OSPFcommon.h" #include "OSPFPacket_m.h" diff --git a/src/networklayer/ospfv2/router/OSPFcommon.h b/src/networklayer/ospfv2/router/OSPFcommon.h index 6795fed3b24..0c0074c950c 100644 --- a/src/networklayer/ospfv2/router/OSPFcommon.h +++ b/src/networklayer/ospfv2/router/OSPFcommon.h @@ -24,7 +24,7 @@ #include #include "IPv4Address.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" // global constants @@ -186,12 +186,12 @@ inline bool OSPF::LSAKeyType_Less::operator() (OSPF::LSAKeyType leftKey, OSPF::L inline IPv4Address ipv4AddressFromAddressString(const char* charForm) { - return IPvXAddressResolver().resolve(charForm, IPvXAddressResolver::ADDR_IPv4).get4(); + return AddressResolver().resolve(charForm, AddressResolver::ADDR_IPv4).toIPv4(); } inline IPv4Address ipv4NetmaskFromAddressString(const char* charForm) { - return IPvXAddressResolver().resolve(charForm, IPvXAddressResolver::ADDR_IPv4|IPvXAddressResolver::ADDR_MASK).get4(); + return AddressResolver().resolve(charForm, AddressResolver::ADDR_IPv4|AddressResolver::ADDR_MASK).toIPv4(); } inline char hexCharToByte(char hex) diff --git a/src/networklayer/rsvp_te/RSVP.cc b/src/networklayer/rsvp_te/RSVP.cc index 552eb62eef3..7a767da9b5b 100644 --- a/src/networklayer/rsvp_te/RSVP.cc +++ b/src/networklayer/rsvp_te/RSVP.cc @@ -14,13 +14,13 @@ #include "RSVP.h" #include "IPv4ControlInfo.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "common.h" #include "Utils.h" #include "XMLUtils.h" #include "IPv4InterfaceData.h" #include "TEDAccess.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTableAccess.h" #include "LIBTableAccess.h" #include "NotifierConsts.h" @@ -58,7 +58,7 @@ void RSVP::initialize(int stage) if (stage==4) { tedmod = TEDAccess().get(); - rt = RoutingTableAccess().get(); + rt = IPv4RoutingTableAccess().get(); ift = InterfaceTableAccess().get(); routerId = rt->getRouterId(); lt = LIBTableAccess().get(); @@ -173,12 +173,12 @@ EroVector RSVP::readTrafficRouteFromXML(const cXMLElement *route) if (!strcmp(hop->getTagName(), "node")) { h.L = false; - h.node = IPvXAddressResolver().resolve(hop->getNodeValue()).get4(); + h.node = AddressResolver().resolve(hop->getNodeValue()).toIPv4(); } else if (!strcmp(hop->getTagName(), "lnode")) { h.L = true; - h.node = IPvXAddressResolver().resolve(hop->getNodeValue()).get4(); + h.node = AddressResolver().resolve(hop->getNodeValue()).toIPv4(); } else { diff --git a/src/networklayer/rsvp_te/RSVP.h b/src/networklayer/rsvp_te/RSVP.h index 3e7356aeae0..de60fb9292b 100644 --- a/src/networklayer/rsvp_te/RSVP.h +++ b/src/networklayer/rsvp_te/RSVP.h @@ -30,7 +30,7 @@ #include "ILifecycle.h" class SimpleClassifier; -class IRoutingTable; +class IIPv4RoutingTable; class IInterfaceTable; class TED; class LIBTable; @@ -173,7 +173,7 @@ class INET_API RSVP : public cSimpleModule, public IScriptable, public ILifecycl protected: TED *tedmod; - IRoutingTable *rt; + IIPv4RoutingTable *rt; IInterfaceTable *ift; LIBTable *lt; NotificationBoard *nb; diff --git a/src/networklayer/rsvp_te/SimpleClassifier.cc b/src/networklayer/rsvp_te/SimpleClassifier.cc index b0a4ddf253b..8243b717b26 100644 --- a/src/networklayer/rsvp_te/SimpleClassifier.cc +++ b/src/networklayer/rsvp_te/SimpleClassifier.cc @@ -15,7 +15,7 @@ #include #include "SimpleClassifier.h" #include "XMLUtils.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "LIBTableAccess.h" #include "RSVPAccess.h" #include "LIBTable.h" @@ -30,8 +30,8 @@ void SimpleClassifier::initialize(int stage) maxLabel = 0; - RoutingTableAccess routingTableAccess; - IRoutingTable *rt = routingTableAccess.get(); + IPv4RoutingTableAccess routingTableAccess; + IIPv4RoutingTable *rt = routingTableAccess.get(); routerId = rt->getRouterId(); LIBTableAccess libTableAccess; diff --git a/src/networklayer/ted/LinkStateRouting.cc b/src/networklayer/ted/LinkStateRouting.cc index ad6125ef3a3..eb903495765 100644 --- a/src/networklayer/ted/LinkStateRouting.cc +++ b/src/networklayer/ted/LinkStateRouting.cc @@ -20,7 +20,7 @@ #include "IPv4ControlInfo.h" #include "IPv4InterfaceData.h" #include "NotifierConsts.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTableAccess.h" #include "NotificationBoard.h" #include "TED.h" @@ -45,7 +45,7 @@ void LinkStateRouting::initialize(int stage) { tedmod = TEDAccess().get(); - IRoutingTable *rt = RoutingTableAccess().get(); + IIPv4RoutingTable *rt = IPv4RoutingTableAccess().get(); routerId = rt->getRouterId(); // listen for TED modifications diff --git a/src/networklayer/ted/LinkStateRouting.h b/src/networklayer/ted/LinkStateRouting.h index 89e3487eabf..e09811cc474 100644 --- a/src/networklayer/ted/LinkStateRouting.h +++ b/src/networklayer/ted/LinkStateRouting.h @@ -25,7 +25,7 @@ #define TED_TRAFFIC 1 class TED; -class IRoutingTable; +class IIPv4RoutingTable; class IInterfaceTable; class InterfaceEntry; class NotificationBoard; diff --git a/src/networklayer/ted/TED.cc b/src/networklayer/ted/TED.cc index 81518e107d9..e40cd5f9c3f 100644 --- a/src/networklayer/ted/TED.cc +++ b/src/networklayer/ted/TED.cc @@ -20,7 +20,7 @@ #include "IPv4ControlInfo.h" #include "IPv4InterfaceData.h" #include "NotifierConsts.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTableAccess.h" #include "NotificationBoard.h" #include "ModuleAccess.h" @@ -47,7 +47,7 @@ void TED::initialize(int stage) if (stage!=4) return; - rt = RoutingTableAccess().get(); + rt = IPv4RoutingTableAccess().get(); ift = InterfaceTableAccess().get(); routerId = rt->getRouterId(); nb = NotificationBoardAccess().get(); @@ -106,7 +106,7 @@ void TED::initializeTED() } if (!g) // not connected continue; - IRoutingTable *destRt = RoutingTableAccess().get(destNode); + IIPv4RoutingTable *destRt = IPv4RoutingTableAccess().get(destNode); if (!destRt) // switch, hub, bus, accesspoint, etc continue; IPv4Address destRouterId = destRt->getRouterId(); diff --git a/src/networklayer/ted/TED.h b/src/networklayer/ted/TED.h index 9cd25eadb22..bee0b511541 100644 --- a/src/networklayer/ted/TED.h +++ b/src/networklayer/ted/TED.h @@ -21,7 +21,7 @@ #include "IntServ.h" #include "ILifecycle.h" -class IRoutingTable; +class IIPv4RoutingTable; class IInterfaceTable; class InterfaceEntry; class NotificationBoard; @@ -96,7 +96,7 @@ class TED : public cSimpleModule, public ILifecycle virtual bool handleOperationStage(LifecycleOperation *operation, int stage, IDoneCallback *doneCallback); protected: - IRoutingTable *rt; + IIPv4RoutingTable *rt; IInterfaceTable *ift; IPv4Address routerId; NotificationBoard *nb; diff --git a/src/networklayer/xmipv6/xMIPv6.cc b/src/networklayer/xmipv6/xMIPv6.cc index 800b90982b1..9a2d705ad36 100644 --- a/src/networklayer/xmipv6/xMIPv6.cc +++ b/src/networklayer/xmipv6/xMIPv6.cc @@ -32,7 +32,7 @@ #include "IPv6InterfaceData.h" #include "IPv6NeighbourDiscoveryAccess.h" #include "IPv6TunnelingAccess.h" -#include "RoutingTable6Access.h" +#include "IPv6RoutingTableAccess.h" #define MK_SEND_PERIODIC_BU 1 @@ -120,7 +120,7 @@ void xMIPv6::initialize(int stage) // moved rt6 initialization to here, as we should // set the MIPv6 flag as soon as possible for use // with other modules. - rt6 = RoutingTable6Access().get(); + rt6 = IPv6RoutingTableAccess().get(); ASSERT(rt6 != NULL); rt6->setMIPv6Support(true); // 4.9.07 - CB diff --git a/src/networklayer/xmipv6/xMIPv6.h b/src/networklayer/xmipv6/xMIPv6.h index 1aee88c00a2..ab8016dab93 100644 --- a/src/networklayer/xmipv6/xMIPv6.h +++ b/src/networklayer/xmipv6/xMIPv6.h @@ -41,7 +41,7 @@ class IPv6ControlInfo; class IPv6Datagram; class IPv6NeighbourDiscovery; class IPv6Tunneling; -class RoutingTable6; +class IPv6RoutingTable; class NotificationBoard; // 13.9.07 @@ -75,7 +75,7 @@ class INET_API xMIPv6 : public cSimpleModule protected: IInterfaceTable* ift; - RoutingTable6* rt6; + IPv6RoutingTable* rt6; BindingUpdateList* bul; //31.07.07 BindingCache* bc; //31.07.07 IPv6Tunneling* tunneling; // 21.08.07 - CB diff --git a/src/nodes/inet/NodeBase.ned b/src/nodes/inet/NodeBase.ned index a480471af8b..79a7fe9303f 100644 --- a/src/nodes/inet/NodeBase.ned +++ b/src/nodes/inet/NodeBase.ned @@ -25,7 +25,7 @@ import inet.linklayer.IWirelessNic; import inet.linklayer.loopback.LoopbackInterface; import inet.mobility.IMobility; import inet.networklayer.common.InterfaceTable; -import inet.networklayer.ipv4.RoutingTable; +import inet.networklayer.ipv4.IPv4RoutingTable; import inet.status.NodeStatus; import inet.util.PcapRecorder; @@ -85,7 +85,7 @@ module NodeBase @display("p=329,287;q=queue"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { parameters: @display("p=53,225;is=s"); IPForward = IPForward; diff --git a/src/nodes/internetcloud/InternetCloud.ned b/src/nodes/internetcloud/InternetCloud.ned index 7ad4ea2c245..7171f3f29e0 100644 --- a/src/nodes/internetcloud/InternetCloud.ned +++ b/src/nodes/internetcloud/InternetCloud.ned @@ -30,7 +30,7 @@ import inet.networklayer.internetcloud.InternetCloudTaggerChannel; import inet.networklayer.ipv4.ErrorHandling; import inet.networklayer.ipv4.ICMP; import inet.networklayer.ipv4.IPv4; -import inet.networklayer.ipv4.RoutingTable; +import inet.networklayer.ipv4.IPv4RoutingTable; import inet.util.PcapRecorder; @@ -125,7 +125,7 @@ module InternetCloud parameters: @display("p=60,131"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { parameters: IPForward = true; routerId = "auto"; diff --git a/src/nodes/ipv6/NodeBase6.ned b/src/nodes/ipv6/NodeBase6.ned index 9bc07079428..8c90aad22e9 100644 --- a/src/nodes/ipv6/NodeBase6.ned +++ b/src/nodes/ipv6/NodeBase6.ned @@ -24,7 +24,7 @@ import inet.linklayer.IWirelessNic; import inet.linklayer.loopback.LoopbackInterface; import inet.mobility.IMobility; import inet.networklayer.common.InterfaceTable; -import inet.networklayer.ipv6.RoutingTable6; +import inet.networklayer.ipv6.IPv6RoutingTable; // @@ -68,7 +68,7 @@ module NodeBase6 @display("p=329,287;q=queue"); } - routingTable6: RoutingTable6 { + routingTable6: IPv6RoutingTable { parameters: @display("p=53,225;is=s"); isRouter = IPForward; diff --git a/src/nodes/mpls/LDP_LSR.ned b/src/nodes/mpls/LDP_LSR.ned index 22d396c9aae..5deab1ba068 100644 --- a/src/nodes/mpls/LDP_LSR.ned +++ b/src/nodes/mpls/LDP_LSR.ned @@ -15,7 +15,7 @@ import inet.base.NotificationBoard; import inet.linklayer.IWiredNic; import inet.linklayer.loopback.LoopbackInterface; import inet.networklayer.common.InterfaceTable; -import inet.networklayer.ipv4.RoutingTable; +import inet.networklayer.ipv4.IPv4RoutingTable; import inet.networklayer.ldp.LDP; import inet.networklayer.mpls.LIBTable; import inet.networklayer.mpls.MPLS; @@ -59,7 +59,7 @@ module LDP_LSR parameters: @display("p=73,176;is=s"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { parameters: IPForward = true; routerId = routerId; diff --git a/src/nodes/mpls/RSVP_LSR.ned b/src/nodes/mpls/RSVP_LSR.ned index 08f2c58560f..f8c8d74a12a 100644 --- a/src/nodes/mpls/RSVP_LSR.ned +++ b/src/nodes/mpls/RSVP_LSR.ned @@ -15,7 +15,7 @@ import inet.base.NotificationBoard; import inet.linklayer.IWiredNic; import inet.linklayer.loopback.LoopbackInterface; import inet.networklayer.common.InterfaceTable; -import inet.networklayer.ipv4.RoutingTable; +import inet.networklayer.ipv4.IPv4RoutingTable; import inet.networklayer.mpls.LIBTable; import inet.networklayer.mpls.MPLS; import inet.networklayer.rsvp_te.RSVP; @@ -53,7 +53,7 @@ module RSVP_LSR parameters: @display("p=58,106;is=s"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { parameters: IPForward = true; routerId = routerId; diff --git a/src/nodes/ospfv2/OSPFRouter.ned b/src/nodes/ospfv2/OSPFRouter.ned index b1fc4322699..9a6b3ca1362 100644 --- a/src/nodes/ospfv2/OSPFRouter.ned +++ b/src/nodes/ospfv2/OSPFRouter.ned @@ -21,7 +21,7 @@ package inet.nodes.ospfv2; import inet.base.NotificationBoard; import inet.linklayer.IWiredNic; import inet.networklayer.common.InterfaceTable; -import inet.networklayer.ipv4.RoutingTable; +import inet.networklayer.ipv4.IPv4RoutingTable; import inet.networklayer.ospfv2.OSPFRouting; import inet.nodes.inet.NetworkLayer; import inet.nodes.inet.Router; diff --git a/src/transport/contract/SCTPCommand.msg b/src/transport/contract/SCTPCommand.msg index b304fd2e570..d2b99cbc27d 100644 --- a/src/transport/contract/SCTPCommand.msg +++ b/src/transport/contract/SCTPCommand.msg @@ -19,15 +19,15 @@ cplusplus {{ #include -#include "IPvXAddress.h" +#include "Address.h" #include "SCTPCommand.h" -typedef std::vector AddressVector; +typedef std::vector
AddressVector; }} -class noncobject IPvXAddress; +class noncobject Address; class noncobject AddressVector; @@ -60,8 +60,8 @@ class SCTPCommand extends cPacket int ssn = -1; unsigned short sendUnordered = false; double prValue = 0; - IPvXAddress localAddr = IPvXAddress("0.0.0.0"); - IPvXAddress remoteAddr = IPvXAddress("0.0.0.0"); + Address localAddr = Address("0.0.0.0"); + Address remoteAddr = Address("0.0.0.0"); int gate = -1; } @@ -102,9 +102,9 @@ class SCTPErrorInfo extends SCTPCommand // class SCTPOpenCommand extends SCTPCommand { - //IPvXAddress localAddr; // may be left empty + //Address localAddr; // may be left empty AddressVector localAddresses; - IPvXAddress remoteAddr; // required for active open + Address remoteAddr; // required for active open AddressVector remoteAddresses; int localPort = -1; // required for passive open int remotePort = -1; // required for active open @@ -143,8 +143,8 @@ class SCTPSendCommand extends SCTPCommand // class SCTPConnectInfo extends SCTPCommand { - //IPvXAddress localAddr; - //IPvXAddress remoteAddr; + //Address localAddr; + //Address remoteAddr; AddressVector remoteAddresses; int localPort; int remotePort; @@ -165,18 +165,18 @@ class SCTPStatusInfo extends SCTPCommand { int state; string stateName; - IPvXAddress pathId; + Address pathId; bool active; } class SCTPPathInfo extends SCTPCommand { - IPvXAddress remoteAddress; + Address remoteAddress; } class SCTPResetInfo extends SCTPCommand { - IPvXAddress remoteAddr; + Address remoteAddr; unsigned short requestType = 0; char streams[]; } @@ -199,4 +199,4 @@ class SCTPSendQueueAbated extends SCTPCommand uint64 bytesQueued; uint64 bytesLimit; uint64 queuedForStream[]; -} \ No newline at end of file +} diff --git a/src/transport/contract/SCTPSocket.cc b/src/transport/contract/SCTPSocket.cc index 3fad9351b4d..3351b5f7ae1 100644 --- a/src/transport/contract/SCTPSocket.cc +++ b/src/transport/contract/SCTPSocket.cc @@ -91,12 +91,12 @@ void SCTPSocket::bind(int lPort) if (sockstate!=NOT_BOUND) throw cRuntimeError("SCTPSocket::bind(): socket already bound"); - localAddresses.push_back(IPvXAddress("0.0.0.0")); + localAddresses.push_back(Address("0.0.0.0")); localPrt = lPort; sockstate = CLOSED; } -void SCTPSocket::bind(IPvXAddress lAddr, int lPort) +void SCTPSocket::bind(Address lAddr, int lPort) { sctpEV3<<"bind address "< AddressVector; +typedef std::vector
AddressVector; class INET_API SCTPSocket @@ -59,7 +59,7 @@ class INET_API SCTPSocket virtual void shutdownReceivedArrived(int connId) {} virtual void sendqueueFullArrived(int connId) {} virtual void sendqueueAbatedArrived(int connId, uint64 buffer) {} - virtual void addressAddedArrived(int assocId, IPvXAddress localAddr, IPvXAddress remoteAddr) {} + virtual void addressAddedArrived(int assocId, Address localAddr, Address remoteAddr) {} }; enum State {NOT_BOUND, CLOSED, LISTENING, CONNECTING, CONNECTED, PEER_CLOSED, LOCALLY_CLOSED, SOCKERROR}; @@ -70,11 +70,11 @@ class INET_API SCTPSocket int sockstate; bool oneToOne; - IPvXAddress localAddr; + Address localAddr; AddressVector localAddresses; int localPrt; - IPvXAddress remoteAddr; + Address remoteAddr; AddressVector remoteAddresses; int remotePrt; int fsmStatus; @@ -131,13 +131,13 @@ class INET_API SCTPSocket /** @name Getter functions */ //@{ - // IPvXAddress localAddress() {return localAddr;} + // Address localAddress() {return localAddr;} AddressVector getLocalAddresses() {return localAddresses;} int getLocalPort() {return localPrt;} - // IPvXAddress remoteAddress() {return remoteAddr;} + // Address remoteAddress() {return remoteAddr;} AddressVector getRemoteAddresses() {return remoteAddresses;} int getRemotePort() {return remotePrt;} - IPvXAddress getRemoteAddr() {return remoteAddr;} + Address getRemoteAddr() {return remoteAddr;} //@} /** @name Opening and closing connections, sending data */ @@ -163,11 +163,11 @@ class INET_API SCTPSocket * Bind the socket to a local port number and IP address (useful with * multi-homing). */ - void bind(IPvXAddress localAddr, int localPort); + void bind(Address localAddr, int localPort); void bindx(AddressVector localAddr, int localPort); - void addAddress(IPvXAddress addr); + void addAddress(Address addr); // // TBD add support for these options too! // string sendQueueClass; @@ -187,7 +187,7 @@ class INET_API SCTPSocket /** * Active OPEN to the given remote socket. */ - void connect(IPvXAddress remoteAddress, int32 remotePort, bool streamReset, int32 prMethod, uint32 numRequests); + void connect(Address remoteAddress, int32 remotePort, bool streamReset, int32 prMethod, uint32 numRequests); void connectx(AddressVector remoteAddresses, int32 remotePort, bool streamReset=false, int32 prMethod=0, uint32 numRequests = 0); diff --git a/src/transport/contract/TCPCommand.msg b/src/transport/contract/TCPCommand.msg index 2b367a7ce29..2c7e0953504 100644 --- a/src/transport/contract/TCPCommand.msg +++ b/src/transport/contract/TCPCommand.msg @@ -17,11 +17,11 @@ cplusplus {{ -#include "IPvXAddress.h" +#include "Address.h" }} -class noncobject IPvXAddress; +class noncobject Address; // // TCP command codes, sent by the application to TCP. These constants @@ -147,8 +147,8 @@ enum TCPDataTransferMode // class TCPOpenCommand extends TCPCommand { - IPvXAddress localAddr; // may be left empty - IPvXAddress remoteAddr;// required for active open + Address localAddr; // may be left empty + Address remoteAddr;// required for active open int localPort = -1; // required for passive open int remotePort = -1; // required for active open bool fork = false; // used only for passive open @@ -175,8 +175,8 @@ class TCPSendCommand extends TCPCommand // class TCPConnectInfo extends TCPCommand { - IPvXAddress localAddr; - IPvXAddress remoteAddr; + Address localAddr; + Address remoteAddr; int localPort; int remotePort; } @@ -194,8 +194,8 @@ class TCPStatusInfo extends TCPCommand int state; string stateName; - IPvXAddress localAddr; - IPvXAddress remoteAddr; + Address localAddr; + Address remoteAddr; int localPort; int remotePort; diff --git a/src/transport/contract/TCPSocket.cc b/src/transport/contract/TCPSocket.cc index 5218dc1d3d1..8bf24dd90a4 100644 --- a/src/transport/contract/TCPSocket.cc +++ b/src/transport/contract/TCPSocket.cc @@ -104,7 +104,7 @@ void TCPSocket::bind(int lPort) sockstate = BOUND; } -void TCPSocket::bind(IPvXAddress lAddr, int lPort) +void TCPSocket::bind(Address lAddr, int lPort) { if (sockstate != NOT_BOUND) throw cRuntimeError("TCPSocket::bind(): socket already bound"); @@ -139,7 +139,7 @@ void TCPSocket::listen(bool fork) sockstate = LISTENING; } -void TCPSocket::connect(IPvXAddress remoteAddress, int remotePort) +void TCPSocket::connect(Address remoteAddress, int remotePort) { if (sockstate != NOT_BOUND && sockstate != BOUND) throw cRuntimeError( "TCPSocket::connect(): connect() or listen() already called (need renewSocket()?)"); @@ -216,7 +216,7 @@ void TCPSocket::requestStatus() void TCPSocket::renewSocket() { connId = ev.getUniqueNumber(); - remoteAddr = localAddr = IPvXAddress(); + remoteAddr = localAddr = Address(); remotePrt = localPrt = -1; sockstate = NOT_BOUND; } diff --git a/src/transport/contract/TCPSocket.h b/src/transport/contract/TCPSocket.h index d791de5ad6b..d4d78bd8828 100644 --- a/src/transport/contract/TCPSocket.h +++ b/src/transport/contract/TCPSocket.h @@ -22,7 +22,7 @@ #include "INETDefs.h" #include "TCPCommand_m.h" -#include "IPvXAddress.h" +#include "Address.h" class TCPStatusInfo; @@ -44,7 +44,7 @@ class TCPStatusInfo; * *
  *   TCPSocket socket;
- *   socket.connect(IPvXAddress("10.0.0.2"), 2000);
+ *   socket.connect(Address("10.0.0.2"), 2000);
  *
  *   msg = new cMessage("data1");
  *   msg->setByteLength(16*1024);  // 16K
@@ -150,9 +150,9 @@ class INET_API TCPSocket
     int connId;
     int sockstate;
 
-    IPvXAddress localAddr;
+    Address localAddr;
     int localPrt;
-    IPvXAddress remoteAddr;
+    Address remoteAddr;
     int remotePrt;
 
     CallbackInterface *cb;
@@ -209,9 +209,9 @@ class INET_API TCPSocket
 
     /** @name Getter functions */
     //@{
-    IPvXAddress getLocalAddress() {return localAddr;}
+    Address getLocalAddress() {return localAddr;}
     int getLocalPort() {return localPrt;}
-    IPvXAddress getRemoteAddress() {return remoteAddr;}
+    Address getRemoteAddress() {return remoteAddr;}
     int getRemotePort() {return remotePrt;}
     //@}
 
@@ -233,7 +233,7 @@ class INET_API TCPSocket
      * Bind the socket to a local port number and IP address (useful with
      * multi-homing).
      */
-    void bind(IPvXAddress localAddr, int localPort);
+    void bind(Address localAddr, int localPort);
 
     /**
      * Returns the current dataTransferMode parameter.
@@ -297,7 +297,7 @@ class INET_API TCPSocket
     /**
      * Active OPEN to the given remote socket.
      */
-    void connect(IPvXAddress remoteAddr, int remotePort);
+    void connect(Address remoteAddr, int remotePort);
 
     /**
      * Sends data packet.
diff --git a/src/transport/contract/UDPControlInfo.msg b/src/transport/contract/UDPControlInfo.msg
index 725a476923a..6cc039d0f67 100644
--- a/src/transport/contract/UDPControlInfo.msg
+++ b/src/transport/contract/UDPControlInfo.msg
@@ -18,10 +18,10 @@
 
 
 cplusplus {{
-#include "IPvXAddress.h"
+#include "Address.h"
 }}
 
-class noncobject IPvXAddress;
+class noncobject Address;
 
 
 //
@@ -79,7 +79,7 @@ class UDPControlInfo
 //
 class UDPBindCommand extends UDPControlInfo
 {
-    IPvXAddress localAddr;
+    Address localAddr;
     int localPort = -1;
 }
 
@@ -95,7 +95,7 @@ class UDPBindCommand extends UDPControlInfo
 //
 class UDPConnectCommand extends UDPControlInfo
 {
-    IPvXAddress remoteAddr;
+    Address remoteAddr;
     int remotePort = -1;
 }
 
@@ -112,7 +112,7 @@ class UDPConnectCommand extends UDPControlInfo
 //
 class UDPSendCommand extends UDPControlInfo
 {
-    IPvXAddress destAddr; // destination IPv4 or IPv6 address
+    Address destAddr; // destination IPv4 or IPv6 address
     int destPort = -1;     // destination port
     int interfaceId = -1; // interface on which the packet must be sent (see ~InterfaceTable)
 }
@@ -137,8 +137,8 @@ class UDPCloseCommand extends UDPControlInfo
 //
 class UDPDataIndication extends UDPControlInfo
 {
-    IPvXAddress srcAddr;   // source IPv4 or IPv6 address of the received packet
-    IPvXAddress destAddr;  // destination IPv4 or IPv6 address of the received packet
+    Address srcAddr;   // source IPv4 or IPv6 address of the received packet
+    Address destAddr;  // destination IPv4 or IPv6 address of the received packet
     int srcPort;           // source port of the received packet
     int destPort;          // destination port of the received packet
     int ttl;               // TTL field of the received packet
@@ -155,8 +155,8 @@ class UDPDataIndication extends UDPControlInfo
 //
 class UDPErrorIndication extends UDPControlInfo
 {
-    IPvXAddress srcAddr;   // source IPv4 or IPv6 address of the undeliverable packet
-    IPvXAddress destAddr;  // destination IPv4 or IPv6 address of the undeliverable packet
+    Address srcAddr;   // source IPv4 or IPv6 address of the undeliverable packet
+    Address destAddr;  // destination IPv4 or IPv6 address of the undeliverable packet
     int srcPort;           // source port of the undeliverable packet
     int destPort;          // destination port of the undeliverable packet
 }
@@ -261,7 +261,7 @@ class UDPSetReuseAddressCommand extends UDPSetOptionCommand
 //
 class UDPJoinMulticastGroupsCommand extends UDPSetOptionCommand
 {
-    IPvXAddress multicastAddr[];
+    Address multicastAddr[];
     int interfaceId[];
 }
 
@@ -275,6 +275,6 @@ class UDPJoinMulticastGroupsCommand extends UDPSetOptionCommand
 //
 class UDPLeaveMulticastGroupsCommand extends UDPSetOptionCommand
 {
-    IPvXAddress multicastAddr[];
+    Address multicastAddr[];
 }
 
diff --git a/src/transport/contract/UDPSocket.cc b/src/transport/contract/UDPSocket.cc
index 266a7ac5c3b..cc3ed83118c 100644
--- a/src/transport/contract/UDPSocket.cc
+++ b/src/transport/contract/UDPSocket.cc
@@ -46,10 +46,10 @@ void UDPSocket::sendToUDP(cMessage *msg)
 
 void UDPSocket::bind(int localPort)
 {
-    bind(IPvXAddress(), localPort);
+    bind(Address(), localPort);
 }
 
-void UDPSocket::bind(IPvXAddress localAddr, int localPort)
+void UDPSocket::bind(Address localAddr, int localPort)
 {
     if (localPort<-1 || localPort>65535)  // -1: ephemeral port
         throw cRuntimeError("UDPSocket::bind(): invalid port number %d", localPort);
@@ -63,7 +63,7 @@ void UDPSocket::bind(IPvXAddress localAddr, int localPort)
     sendToUDP(msg);
 }
 
-void UDPSocket::connect(IPvXAddress addr, int port)
+void UDPSocket::connect(Address addr, int port)
 {
     if (addr.isUnspecified())
         throw cRuntimeError("UDPSocket::connect(): unspecified remote address");
@@ -79,7 +79,7 @@ void UDPSocket::connect(IPvXAddress addr, int port)
     sendToUDP(msg);
 }
 
-void UDPSocket::sendTo(cPacket *pk, IPvXAddress destAddr, int destPort)
+void UDPSocket::sendTo(cPacket *pk, Address destAddr, int destPort)
 {
     pk->setKind(UDP_C_DATA);
     UDPSendCommand *ctrl = new UDPSendCommand();
@@ -90,7 +90,7 @@ void UDPSocket::sendTo(cPacket *pk, IPvXAddress destAddr, int destPort)
     sendToUDP(pk);
 }
 
-void UDPSocket::sendTo(cPacket *pk, IPvXAddress destAddr, int destPort, int outInterface)
+void UDPSocket::sendTo(cPacket *pk, Address destAddr, int destPort, int outInterface)
 {
     pk->setKind(UDP_C_DATA);
     UDPSendCommand *ctrl = new UDPSendCommand();
@@ -179,7 +179,7 @@ void UDPSocket::setReuseAddress(bool value)
     sendToUDP(msg);
 }
 
-void UDPSocket::joinMulticastGroup(const IPvXAddress& multicastAddr, int interfaceId)
+void UDPSocket::joinMulticastGroup(const Address& multicastAddr, int interfaceId)
 {
     cMessage *msg = new cMessage("JoinMulticastGroups", UDP_C_SETOPTION);
     UDPJoinMulticastGroupsCommand *ctrl = new UDPJoinMulticastGroupsCommand();
@@ -243,7 +243,7 @@ void UDPSocket::joinLocalMulticastGroups()
 }
 
 
-void UDPSocket::leaveMulticastGroup(const IPvXAddress& multicastAddr)
+void UDPSocket::leaveMulticastGroup(const Address& multicastAddr)
 {
     cMessage *msg = new cMessage("LeaveMulticastGroups", UDP_C_SETOPTION);
     UDPLeaveMulticastGroupsCommand *ctrl = new UDPLeaveMulticastGroupsCommand();
@@ -317,8 +317,8 @@ std::string UDPSocket::getReceivedPacketInfo(cPacket *pk)
 {
     UDPDataIndication *ctrl = check_and_cast(pk->getControlInfo());
 
-    IPvXAddress srcAddr = ctrl->getSrcAddr();
-    IPvXAddress destAddr = ctrl->getDestAddr();
+    Address srcAddr = ctrl->getSrcAddr();
+    Address destAddr = ctrl->getDestAddr();
     int srcPort = ctrl->getSrcPort();
     int destPort = ctrl->getDestPort();
     int interfaceID = ctrl->getInterfaceId();
diff --git a/src/transport/contract/UDPSocket.h b/src/transport/contract/UDPSocket.h
index 97059d87ee8..e407a9b3ed9 100644
--- a/src/transport/contract/UDPSocket.h
+++ b/src/transport/contract/UDPSocket.h
@@ -20,7 +20,7 @@
 #define __INET_UDPSOCKET_H
 
 #include "INETDefs.h"
-#include "IPvXAddress.h"
+#include "Address.h"
 
 class UDPDataIndication;
 
@@ -41,7 +41,7 @@ class UDPDataIndication;
  * 
  *   UDPSocket socket;
  *   socket.setOutputGate(gate("udpOut"));
- *   socket.connect(IPvXAddress("10.0.0.2"), 2000);
+ *   socket.connect(Address("10.0.0.2"), 2000);
  *
  *   cPacket *pk = new cPacket("dgram");
  *   pk->setByteLength(1024);
@@ -106,14 +106,14 @@ class INET_API UDPSocket
      * Bind the socket to a local port number and IP address (useful with
      * multi-homing or multicast addresses). Use port=0 for an ephemeral port.
      */
-    void bind(IPvXAddress localAddr, int localPort);
+    void bind(Address localAddr, int localPort);
 
     /**
      * Connects to a remote UDP socket. This has two effects:
      * (1) this socket will only receive packets from specified address/port,
      * and (2) you can use send() (as opposed to sendTo()) to send packets.
      */
-    void connect(IPvXAddress remoteAddr, int remotePort);
+    void connect(Address remoteAddr, int remotePort);
 
     /**
      * Set the TTL (IPv6: Hop Limit) field on sent packets.
@@ -162,7 +162,7 @@ class INET_API UDPSocket
      * One can also optionally specify the output interface for packets sent to
      * that address.
      */
-    void joinMulticastGroup(const IPvXAddress& multicastAddr, int interfaceId=-1);
+    void joinMulticastGroup(const Address& multicastAddr, int interfaceId=-1);
 
     /**
      * Joins the socket to each multicast group that are registered with
@@ -174,7 +174,7 @@ class INET_API UDPSocket
      * Causes the socket to leave the given multicast group, i.e. UDP packets
      * arriving to the given multicast address will no longer passed up to the socket.
      */
-    void leaveMulticastGroup(const IPvXAddress& multicastAddr);
+    void leaveMulticastGroup(const Address& multicastAddr);
 
     /**
      * Causes the socket to leave each multicast groups that are registered with
@@ -185,13 +185,13 @@ class INET_API UDPSocket
     /**
      * Sends a data packet to the given address and port.
      */
-    void sendTo(cPacket *msg, IPvXAddress destAddr, int destPort);
+    void sendTo(cPacket *msg, Address destAddr, int destPort);
 
     /**
      * Sends a data packet to the given address and port using the provided
      * interface.
      */
-    void sendTo(cPacket *msg, IPvXAddress destAddr, int destPort, int outInterface);
+    void sendTo(cPacket *msg, Address destAddr, int destPort, int outInterface);
 
     /**
      * Sends a data packet to the address and port specified previously
diff --git a/src/transport/rtp/RTP.cc b/src/transport/rtp/RTP.cc
index 1135ecc0bd1..c1c12c8b687 100644
--- a/src/transport/rtp/RTP.cc
+++ b/src/transport/rtp/RTP.cc
@@ -23,7 +23,7 @@
 #include "LifecycleOperation.h"
 #include "ModuleAccess.h"
 #include "NodeStatus.h"
-#include "RoutingTableAccess.h"
+#include "IPv4RoutingTableAccess.h"
 #include "RTPInnerPacket.h"
 #include "RTPInterfacePacket_m.h"
 #include "RTPProfile.h"
@@ -371,7 +371,7 @@ int RTP::resolveMTU()
     // it returns MTU bytelength (ethernet) minus ip
     // and udp headers
     // TODO: How to do get the valid length of IP and ETHERNET header?
-    RoutingTableAccess routingTableAccess;
+    IPv4RoutingTableAccess routingTableAccess;
     const InterfaceEntry* rtie = routingTableAccess.get()->getInterfaceForDestAddr(_destinationAddress);
 
     if (rtie == NULL)
diff --git a/src/transport/rtp/RTP.h b/src/transport/rtp/RTP.h
index 997eccb3f2c..66d613671f8 100644
--- a/src/transport/rtp/RTP.h
+++ b/src/transport/rtp/RTP.h
@@ -21,9 +21,8 @@
 
 
 #include "INETDefs.h"
-
 #include "ILifecycle.h"
-#include "IPvXAddress.h"
+#include "Address.h"
 #include "RTPInnerPacket.h"
 #include "RTPInterfacePacket_m.h"
 #include "UDPSocket.h"
diff --git a/src/transport/sctp/SCTP.cc b/src/transport/sctp/SCTP.cc
index 8011a53113d..d208b281c46 100644
--- a/src/transport/sctp/SCTP.cc
+++ b/src/transport/sctp/SCTP.cc
@@ -51,7 +51,7 @@ void SCTP::printInfoAssocMap()
             assoc = i->second;
             key = i->first;
 
-                sctpEV3<<"assocId: "<assocId<<"  assoc: "<assocId<<"  assoc: "<setProtocol(IP_PROT_SCTP);
-        controlInfo->setSrcAddr(srcAddr.get4());
-        controlInfo->setDestAddr(destAddr.get4());
+        controlInfo->setSrcAddr(srcAddr.toIPv4());
+        controlInfo->setDestAddr(destAddr.toIPv4());
         msg->setControlInfo(controlInfo);
         send(msg, "to_ip");
     }
 }
 
-void SCTP::sendShutdownCompleteFromMain(SCTPMessage* sctpmsg, IPvXAddress srcAddr, IPvXAddress destAddr)
+void SCTP::sendShutdownCompleteFromMain(SCTPMessage* sctpmsg, Address srcAddr, Address destAddr)
 {
     SCTPMessage *msg = new SCTPMessage();
 
@@ -385,8 +385,8 @@ void SCTP::sendShutdownCompleteFromMain(SCTPMessage* sctpmsg, IPvXAddress srcAdd
     msg->addChunk(scChunk);
     IPv4ControlInfo *controlInfo = new IPv4ControlInfo();
     controlInfo->setProtocol(IP_PROT_SCTP);
-    controlInfo->setSrcAddr(srcAddr.get4());
-    controlInfo->setDestAddr(destAddr.get4());
+    controlInfo->setSrcAddr(srcAddr.toIPv4());
+    controlInfo->setDestAddr(destAddr.toIPv4());
     msg->setControlInfo(controlInfo);
     send(msg, "to_ip");
 }
@@ -463,7 +463,7 @@ SCTPAssociation *SCTP::findAssocWithVTag(uint32 peerVTag, uint32 remotePort, uin
     return NULL;
 }
 
-SCTPAssociation *SCTP::findAssocForMessage(IPvXAddress srcAddr, IPvXAddress destAddr, uint32 srcPort, uint32 destPort, bool findListen)
+SCTPAssociation *SCTP::findAssocForMessage(Address srcAddr, Address destAddr, uint32 srcPort, uint32 destPort, bool findListen)
 {
     SockPair key;
 
@@ -538,7 +538,7 @@ uint16 SCTP::getEphemeralPort()
     return nextEphemeralPort++;
 }
 
-void SCTP::updateSockPair(SCTPAssociation *assoc, IPvXAddress localAddr, IPvXAddress remoteAddr, int32 localPort, int32 remotePort)
+void SCTP::updateSockPair(SCTPAssociation *assoc, Address localAddr, Address remoteAddr, int32 localPort, int32 remotePort)
 {
     SockPair key;
     sctpEV3<<"updateSockPair:   localAddr: "< remAddresses)
+void SCTP::addLocalAddressToAllRemoteAddresses(SCTPAssociation *assoc, Address address, std::vector
remAddresses) { SockPair key; @@ -631,7 +631,7 @@ void SCTP::addLocalAddressToAllRemoteAddresses(SCTPAssociation *assoc, IPvXAddre } } -void SCTP::removeLocalAddressFromAllRemoteAddresses(SCTPAssociation *assoc, IPvXAddress address, std::vector remAddresses) +void SCTP::removeLocalAddressFromAllRemoteAddresses(SCTPAssociation *assoc, Address address, std::vector
remAddresses) { SockPair key; @@ -657,7 +657,7 @@ void SCTP::removeLocalAddressFromAllRemoteAddresses(SCTPAssociation *assoc, IPvX } } -void SCTP::removeRemoteAddressFromAllAssociations(SCTPAssociation *assoc, IPvXAddress address, std::vector locAddresses) +void SCTP::removeRemoteAddressFromAllAssociations(SCTPAssociation *assoc, Address address, std::vector
locAddresses) { SockPair key; @@ -683,7 +683,7 @@ void SCTP::removeRemoteAddressFromAllAssociations(SCTPAssociation *assoc, IPvXAd } } -bool SCTP::addRemoteAddress(SCTPAssociation *assoc, IPvXAddress localAddress, IPvXAddress remoteAddress) +bool SCTP::addRemoteAddress(SCTPAssociation *assoc, Address localAddress, Address remoteAddress) { sctpEV3<<"Add remote Address: "< remAddresses); - bool addRemoteAddress(SCTPAssociation *assoc, IPvXAddress localAddress, IPvXAddress remoteAddress); - void removeLocalAddressFromAllRemoteAddresses(SCTPAssociation *assoc, IPvXAddress address, std::vector remAddresses); - void removeRemoteAddressFromAllAssociations(SCTPAssociation *assoc, IPvXAddress address, std::vector locAddresses); + void updateSockPair(SCTPAssociation *assoc, Address localAddr, Address remoteAddr, int32 localPort, int32 remotePort); + void addLocalAddress(SCTPAssociation *assoc, Address address); + void addLocalAddressToAllRemoteAddresses(SCTPAssociation *assoc, Address address, std::vector
remAddresses); + bool addRemoteAddress(SCTPAssociation *assoc, Address localAddress, Address remoteAddress); + void removeLocalAddressFromAllRemoteAddresses(SCTPAssociation *assoc, Address address, std::vector
remAddresses); + void removeRemoteAddressFromAllAssociations(SCTPAssociation *assoc, Address address, std::vector
locAddresses); /** * Update assocs socket pair, and register newAssoc (which'll keep LISTENing). * Also, assoc will get a new assocId (and newAssoc will live on with its old assocId). */ - void addForkedAssociation(SCTPAssociation *assoc, SCTPAssociation *newAssoc, IPvXAddress localAddr, IPvXAddress remoteAddr, int32 localPort, int32 remotePort); + void addForkedAssociation(SCTPAssociation *assoc, SCTPAssociation *newAssoc, Address localAddr, Address remoteAddr, int32 localPort, int32 remotePort); /** * To be called from SCTPAssociation: reserves an ephemeral port for the connection. diff --git a/src/transport/sctp/SCTPAssociation.h b/src/transport/sctp/SCTPAssociation.h index 85aa0407f66..4d571bfd070 100644 --- a/src/transport/sctp/SCTPAssociation.h +++ b/src/transport/sctp/SCTPAssociation.h @@ -21,7 +21,7 @@ #include "INETDefs.h" -#include "IPvXAddress.h" +#include "Address.h" #include "IPv4Address.h" #include "SCTP.h" #include "InterfaceTable.h" @@ -46,7 +46,7 @@ class SCTPSendStream; class SCTPAlgorithm; class SCTP; -typedef std::vector AddressVector; +typedef std::vector
AddressVector; enum SctpState { @@ -268,11 +268,11 @@ inline double max(const double a, const double b) { return (a < b) ? b : a; } class INET_API SCTPPathVariables : public cObject { public: - SCTPPathVariables(const IPvXAddress& addr, SCTPAssociation* assoc); + SCTPPathVariables(const Address& addr, SCTPAssociation* assoc); ~SCTPPathVariables(); SCTPAssociation* association; - IPvXAddress remoteAddress; + Address remoteAddress; // ====== Path Management ============================================= bool activePath; @@ -377,7 +377,7 @@ class INET_API SCTPDataVariables : public cObject inline void setInitialDestination(SCTPPathVariables* path) { initialDestination = path; } - inline const IPvXAddress& getInitialDestination() const { + inline const Address& getInitialDestination() const { if (initialDestination != NULL) { return (initialDestination->remoteAddress); } @@ -390,7 +390,7 @@ class INET_API SCTPDataVariables : public cObject inline void setLastDestination(SCTPPathVariables* path) { lastDestination = path; } - inline const IPvXAddress& getLastDestination() const { + inline const Address& getLastDestination() const { if (lastDestination != NULL) { return (lastDestination->remoteAddress); } @@ -403,7 +403,7 @@ class INET_API SCTPDataVariables : public cObject inline void setNextDestination(SCTPPathVariables* path) { nextDestination = path; } - inline const IPvXAddress& getNextDestination() const { + inline const Address& getNextDestination() const { if (nextDestination != NULL) { return (nextDestination->remoteAddress); } @@ -457,7 +457,7 @@ class INET_API SCTPDataVariables : public cObject bool sendForwardIfAbandoned; public: - static const IPvXAddress zeroAddress; + static const Address zeroAddress; // ====== Private Control Information ================================= private: @@ -477,7 +477,7 @@ class INET_API SCTPStateVariables : public cObject inline void setPrimaryPath(SCTPPathVariables* path) { primaryPath = path; } - inline const IPvXAddress& getPrimaryPathIndex() const { + inline const Address& getPrimaryPathIndex() const { if (primaryPath != NULL) { return (primaryPath->remoteAddress); } @@ -514,7 +514,7 @@ class INET_API SCTPStateVariables : public cObject bool inOut; bool noMoreOutstanding; uint32 numGapReports; - IPvXAddress initialPrimaryPath; + Address initialPrimaryPath; std::list lastDataSourceList; // DATA chunk sources for new SACK SCTPPathVariables* lastDataSourcePath; AddressVector localAddresses; @@ -666,9 +666,9 @@ class INET_API SCTPAssociation : public cObject friend class SCTPPathVariables; // map for storing the path parameters - typedef std::map SCTPPathMap; + typedef std::map SCTPPathMap; // map for storing the queued bytes per path - typedef std::map CounterMap; + typedef std::map CounterMap; typedef struct counter { uint64 roomSumSendStreams; uint64 bookedSumSendStreams; @@ -697,8 +697,8 @@ class INET_API SCTPAssociation : public cObject // connection identification by apps: appgateIndex+assocId int32 appGateIndex; // Application gate index int32 assocId; // Identifies connection within the app - IPvXAddress remoteAddr; // Remote address from last message - IPvXAddress localAddr; // Local address from last message + Address remoteAddr; // Remote address from last message + Address localAddr; // Local address from last message uint16 localPort; // Remote port from last message uint16 remotePort; // Local port from last message uint32 localVTag; // Local verification tag @@ -795,7 +795,7 @@ class INET_API SCTPAssociation : public cObject static const char* indicationName(const int32 code); /** Utility: return IPv4 or IPv6 address level */ - static int getAddressLevel(const IPvXAddress& addr); + static int getAddressLevel(const Address& addr); /* @name Various getters */ //@{ @@ -825,7 +825,7 @@ class INET_API SCTPAssociation : public cObject * of false means that the connection structure must be deleted by the * caller (SCTP). */ - bool processSCTPMessage(SCTPMessage* sctpmsg, const IPvXAddress& srcAddr, const IPvXAddress& destAddr); + bool processSCTPMessage(SCTPMessage* sctpmsg, const Address& srcAddr, const Address& destAddr); /** * Process commands from the application. * Normally returns true. A return value of false means that the @@ -833,11 +833,11 @@ class INET_API SCTPAssociation : public cObject */ bool processAppCommand(cPacket* msg); void removePath(); - void removePath(const IPvXAddress& addr); + void removePath(const Address& addr); void deleteStreams(); void stopTimer(cMessage* timer); void stopTimers(); - inline SCTPPathVariables* getPath(const IPvXAddress& pathId) const { + inline SCTPPathVariables* getPath(const Address& pathId) const { SCTPPathMap::const_iterator iterator = sctpPathMap.find(pathId); if (iterator != sctpPathMap.end()) { return iterator->second; @@ -882,13 +882,13 @@ class INET_API SCTPAssociation : public cObject /** @name Processing SCTP message arrivals. Invoked from processSCTPMessage(). */ //@{ - bool process_RCV_Message(SCTPMessage* sctpseg, const IPvXAddress& src, const IPvXAddress& dest); + bool process_RCV_Message(SCTPMessage* sctpseg, const Address& src, const Address& dest); /** * Process incoming SCTP packets. Invoked from process_RCV_Message */ bool processInitArrived(SCTPInitChunk* initChunk, int32 sport, int32 dport); bool processInitAckArrived(SCTPInitAckChunk* initAckChunk); - bool processCookieEchoArrived(SCTPCookieEchoChunk* cookieEcho, IPvXAddress addr); + bool processCookieEchoArrived(SCTPCookieEchoChunk* cookieEcho, Address addr); bool processCookieAckArrived(); SCTPEventCode processDataArrived(SCTPDataChunk* dataChunk); SCTPEventCode processSackArrived(SCTPSackChunk* sackChunk); @@ -928,15 +928,15 @@ class INET_API SCTPAssociation : public cObject void sendInit(); void sendInitAck(SCTPInitChunk* initchunk); void sendCookieEcho(SCTPInitAckChunk* initackchunk); - void sendCookieAck(const IPvXAddress& dest); + void sendCookieAck(const Address& dest); void sendAbort(); void sendHeartbeat(const SCTPPathVariables* path); void sendHeartbeatAck(const SCTPHeartbeatChunk* heartbeatChunk, - const IPvXAddress& src, - const IPvXAddress& dest); + const Address& src, + const Address& dest); void sendSack(); void sendShutdown(); - void sendShutdownAck(const IPvXAddress& dest); + void sendShutdownAck(const Address& dest); void sendShutdownComplete(); SCTPSackChunk* createSack(); /** Retransmitting chunks */ @@ -947,7 +947,7 @@ class INET_API SCTPAssociation : public cObject void retransmitShutdownAck(); /** Utility: adds control info to message and sends it to IP */ - void sendToIP(SCTPMessage* sctpmsg, const IPvXAddress& dest); + void sendToIP(SCTPMessage* sctpmsg, const Address& dest); inline void sendToIP(SCTPMessage* sctpmsg) { sendToIP(sctpmsg, remoteAddr); } @@ -985,9 +985,9 @@ class INET_API SCTPAssociation : public cObject /** Utility: returns name of SCTP_E_xxx constants */ static const char* eventName(const int32 event); - void addPath(const IPvXAddress& addr); + void addPath(const Address& addr); SCTPPathVariables* getNextPath(const SCTPPathVariables* oldPath) const; - inline const IPvXAddress& getNextAddress(const SCTPPathVariables* oldPath) const { + inline const Address& getNextAddress(const SCTPPathVariables* oldPath) const { const SCTPPathVariables* nextPath = getNextPath(oldPath); if (nextPath != NULL) { return (nextPath->remoteAddress); @@ -1010,7 +1010,7 @@ class INET_API SCTPAssociation : public cObject void sendPacketDrop(const bool flag); void sendHMacError(const uint16 id); - SCTPForwardTsnChunk* createForwardTsnChunk(const IPvXAddress& pid); + SCTPForwardTsnChunk* createForwardTsnChunk(const Address& pid); bool msgMustBeAbandoned(SCTPDataMsg* msg, int32 stream, bool ordered); //PR-SCTP bool chunkMustBeAbandoned(SCTPDataVariables* chunk, diff --git a/src/transport/sctp/SCTPAssociationAddIP.cc b/src/transport/sctp/SCTPAssociationAddIP.cc index b13278aaf5b..409088708eb 100644 --- a/src/transport/sctp/SCTPAssociationAddIP.cc +++ b/src/transport/sctp/SCTPAssociationAddIP.cc @@ -16,16 +16,16 @@ // along with this program; if not, see . // -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" #include "SCTPAssociation.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" #include "common.h" void SCTPAssociation::sendAsconf(const char* type, const bool remote) { SCTPAuthenticationChunk* authChunk; bool nat = false; - IPvXAddress targetAddr = remoteAddr; + Address targetAddr = remoteAddr; uint16 chunkLength = 0; if (state->asconfOutstanding == false) { @@ -40,7 +40,7 @@ void SCTPAssociation::sendAsconf(const char* type, const bool remote) chunkLength = SCTP_ADD_IP_CHUNK_LENGTH; sctpEV3 << "localAddr=" << localAddr << ", remoteAddr=" << remoteAddr << "\n"; if (getAddressLevel(localAddr)==3 && getAddressLevel(remoteAddr)==4 && (bool)sctpMain->par("natFriendly")) { - asconfChunk->setAddressParam(IPvXAddress("0.0.0.0")); + asconfChunk->setAddressParam(Address("0.0.0.0")); asconfChunk->setPeerVTag(peerVTag); nat = true; } @@ -71,16 +71,16 @@ void SCTPAssociation::sendAsconf(const char* type, const bool remote) ipParam->setParameterType(ADD_IP_ADDRESS); ipParam->setRequestCorrelationId(++state->corrIdNum); if (nat) { - ipParam->setAddressParam(IPvXAddress("0.0.0.0")); - sctpMain->addLocalAddressToAllRemoteAddresses(this, IPvXAddressResolver().resolve(sctpMain->par("addAddress"), 1), (std::vector) remoteAddressList); - state->localAddresses.push_back(IPvXAddressResolver().resolve(sctpMain->par("addAddress"), 1)); + ipParam->setAddressParam(Address("0.0.0.0")); + sctpMain->addLocalAddressToAllRemoteAddresses(this, AddressResolver().resolve(sctpMain->par("addAddress"), 1), (std::vector
) remoteAddressList); + state->localAddresses.push_back(AddressResolver().resolve(sctpMain->par("addAddress"), 1)); if (remote) targetAddr = remoteAddr; else targetAddr = getNextAddress(getPath(remoteAddr)); } else { - ipParam->setAddressParam(IPvXAddressResolver().resolve(sctpMain->par("addAddress"), 1)); + ipParam->setAddressParam(AddressResolver().resolve(sctpMain->par("addAddress"), 1)); } if (ipParam->getAddressParam().isIPv6()) { chunkLength += 20; @@ -100,7 +100,7 @@ void SCTPAssociation::sendAsconf(const char* type, const bool remote) chunkLength += SCTP_ADD_IP_PARAMETER_LENGTH; delParam->setParameterType(DELETE_IP_ADDRESS); delParam->setRequestCorrelationId(++state->corrIdNum); - delParam->setAddressParam(IPvXAddressResolver().resolve(sctpMain->par("addAddress"), 1)); + delParam->setAddressParam(AddressResolver().resolve(sctpMain->par("addAddress"), 1)); if (delParam->getAddressParam().isIPv6()) { chunkLength += 20; delParam->setBitLength((SCTP_ADD_IP_PARAMETER_LENGTH+20)*8); @@ -119,9 +119,9 @@ void SCTPAssociation::sendAsconf(const char* type, const bool remote) chunkLength += SCTP_ADD_IP_PARAMETER_LENGTH; priParam->setParameterType(SET_PRIMARY_ADDRESS); priParam->setRequestCorrelationId(++state->corrIdNum); - priParam->setAddressParam(IPvXAddressResolver().resolve(sctpMain->par("addAddress"), 1)); + priParam->setAddressParam(AddressResolver().resolve(sctpMain->par("addAddress"), 1)); if (nat) { - priParam->setAddressParam(IPvXAddress("0.0.0.0")); + priParam->setAddressParam(Address("0.0.0.0")); } if (priParam->getAddressParam().isIPv6()) { chunkLength += 20; diff --git a/src/transport/sctp/SCTPAssociationBase.cc b/src/transport/sctp/SCTPAssociationBase.cc index bbd9457883b..a4a3190401d 100644 --- a/src/transport/sctp/SCTPAssociationBase.cc +++ b/src/transport/sctp/SCTPAssociationBase.cc @@ -27,11 +27,11 @@ #include "SCTPCommand_m.h" #include "SCTPQueue.h" #include "SCTPAlgorithm.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTableAccess.h" -SCTPPathVariables::SCTPPathVariables(const IPvXAddress& addr, SCTPAssociation* assoc) +SCTPPathVariables::SCTPPathVariables(const Address& addr, SCTPAssociation* assoc) { // ====== Path Variable Initialization =================================== association = assoc; @@ -62,11 +62,11 @@ SCTPPathVariables::SCTPPathVariables(const IPvXAddress& addr, SCTPAssociation* a queuedBytes = 0; outstandingBytes = 0; - RoutingTableAccess routingTableAccess; - const InterfaceEntry* rtie = routingTableAccess.get()->getInterfaceForDestAddr(remoteAddress.get4()); + IPv4RoutingTableAccess routingTableAccess; + const InterfaceEntry* rtie = routingTableAccess.get()->getInterfaceForDestAddr(remoteAddress.toIPv4()); if (rtie == NULL) { - throw cRuntimeError("No interface for remote address %s found!", remoteAddress.get4().str().c_str()); + throw cRuntimeError("No interface for remote address %s found!", remoteAddress.toIPv4().str().c_str()); } pmtu = rtie->getMTU(); @@ -210,7 +210,7 @@ SCTPPathVariables::~SCTPPathVariables() } -const IPvXAddress SCTPDataVariables::zeroAddress = IPvXAddress("0.0.0.0"); +const Address SCTPDataVariables::zeroAddress = Address("0.0.0.0"); SCTPDataVariables::SCTPDataVariables() { @@ -419,7 +419,7 @@ SCTPAssociation::SCTPAssociation(SCTP* _module, int32 _appGateIndex, int32 _asso // ====== Path Info ====================================================== SCTPPathInfo* pinfo = new SCTPPathInfo("pathInfo"); - pinfo->setRemoteAddress(IPvXAddress("0.0.0.0")); + pinfo->setRemoteAddress(Address("0.0.0.0")); // ====== Timers ========================================================= char timerName[128]; @@ -635,9 +635,9 @@ bool SCTPAssociation::processTimer(cMessage *msg) sctpEV3 << msg->getName() << " timer expired at "<(msg->getControlInfo()); - IPvXAddress addr = pinfo->getRemoteAddress(); + Address addr = pinfo->getRemoteAddress(); - if (addr != IPvXAddress("0.0.0.0")) + if (addr != Address("0.0.0.0")) path = getPath(addr); // first do actions @@ -729,8 +729,8 @@ bool SCTPAssociation::processTimer(cMessage *msg) } bool SCTPAssociation::processSCTPMessage(SCTPMessage* sctpmsg, - const IPvXAddress& msgSrcAddr, - const IPvXAddress& msgDestAddr) + const Address& msgSrcAddr, + const Address& msgDestAddr) { printAssocBrief(); diff --git a/src/transport/sctp/SCTPAssociationEventProc.cc b/src/transport/sctp/SCTPAssociationEventProc.cc index 645ea9a661c..7ab0e279d49 100644 --- a/src/transport/sctp/SCTPAssociationEventProc.cc +++ b/src/transport/sctp/SCTPAssociationEventProc.cc @@ -30,7 +30,7 @@ void SCTPAssociation::process_ASSOCIATE(SCTPEventCode& event, SCTPCommand *sctpCommand, cPacket *msg) { - IPvXAddress lAddr, rAddr; + Address lAddr, rAddr; SCTPOpenCommand *openCmd = check_and_cast(sctpCommand); @@ -78,7 +78,7 @@ void SCTPAssociation::process_ASSOCIATE(SCTPEventCode& event, SCTPCommand *sctpC void SCTPAssociation::process_OPEN_PASSIVE(SCTPEventCode& event, SCTPCommand *sctpCommand, cPacket *msg) { - IPvXAddress lAddr; + Address lAddr; int16 localPort; SCTPOpenCommand *openCmd = check_and_cast(sctpCommand); @@ -107,7 +107,7 @@ void SCTPAssociation::process_OPEN_PASSIVE(SCTPEventCode& event, SCTPCommand *sc sctpEV3 << "Assoc "<updateSockPair(this, lAddr, IPvXAddress(), localPort, 0); + sctpMain->updateSockPair(this, lAddr, Address(), localPort, 0); break; default: @@ -243,7 +243,7 @@ void SCTPAssociation::process_SEND(SCTPEventCode& event, SCTPCommand* sctpComman // ------ Set initial destination address ----------------------------- if (sendCommand->getPrimary()) { - if (sendCommand->getRemoteAddr() == IPvXAddress("0.0.0.0")) { + if (sendCommand->getRemoteAddr() == Address("0.0.0.0")) { datMsg->setInitialDestination(remoteAddr); } else { diff --git a/src/transport/sctp/SCTPAssociationRcvMessage.cc b/src/transport/sctp/SCTPAssociationRcvMessage.cc index 52eb2f0172a..0be0bd3eeec 100644 --- a/src/transport/sctp/SCTPAssociationRcvMessage.cc +++ b/src/transport/sctp/SCTPAssociationRcvMessage.cc @@ -63,8 +63,8 @@ void SCTPAssociation::decreaseOutstandingBytes(SCTPDataVariables* chunk) bool SCTPAssociation::process_RCV_Message(SCTPMessage* sctpmsg, - const IPvXAddress& src, - const IPvXAddress& dest) + const Address& src, + const Address& dest) { // ====== Header checks ================================================== sctpEV3 << getFullPath() << " SCTPAssociationRcvMessage:process_RCV_Message" @@ -529,7 +529,7 @@ bool SCTPAssociation::processInitArrived(SCTPInitChunk* initchunk, int32 srcPort numberOfRemoteAddresses = initchunk->getAddressesArraySize(); IInterfaceTable *ift = interfaceTableAccess.get(); state->localAddresses.clear(); - if (localAddressList.front() == IPvXAddress("0.0.0.0")) + if (localAddressList.front() == Address("0.0.0.0")) { for (int32 i=0; igetNumInterfaces(); ++i) { @@ -798,7 +798,7 @@ bool SCTPAssociation::processInitAckArrived(SCTPInitAckChunk* initAckChunk) -bool SCTPAssociation::processCookieEchoArrived(SCTPCookieEchoChunk* cookieEcho, IPvXAddress addr) +bool SCTPAssociation::processCookieEchoArrived(SCTPCookieEchoChunk* cookieEcho, Address addr) { bool trans = false; SCTPCookie* cookie = check_and_cast(cookieEcho->getStateCookie()); @@ -1305,7 +1305,7 @@ SCTPEventCode SCTPAssociation::processSackArrived(SCTPSackChunk* sackChunk) sctpEV3 << "Before ccUpdateBytesAcked: "; for (SCTPPathMap::iterator piter = sctpPathMap.begin(); piter != sctpPathMap.end(); piter++) { SCTPPathVariables* myPath = piter->second; - const IPvXAddress& myPathId = myPath->remoteAddress; + const Address& myPathId = myPath->remoteAddress; if (myPath->newlyAckedBytes > 0) { @@ -1337,7 +1337,7 @@ SCTPEventCode SCTPAssociation::processSackArrived(SCTPSackChunk* sackChunk) // ====== Need to stop or restart T3 timer? ============================== for (SCTPPathMap::iterator piter = sctpPathMap.begin(); piter != sctpPathMap.end(); piter++) { SCTPPathVariables* myPath = piter->second; - const IPvXAddress& myPathId = myPath->remoteAddress; + const Address& myPathId = myPath->remoteAddress; if (myPath->outstandingBytes == 0) { // T.D. 07.01.2010: Only stop T3 timer when there is nothing more to send on this path! @@ -1906,7 +1906,7 @@ SCTPEventCode SCTPAssociation::processHeartbeatAckArrived(SCTPHeartbeatAckChunk* path->numberOfHeartbeatAcksRcvd++; path->vectorPathRcvdHbAck->record(path->numberOfHeartbeatAcksRcvd); /* hb-ack goes to pathmanagement, reset error counters, stop timeout timer */ - const IPvXAddress addr = hback->getRemoteAddr(); + const Address addr = hback->getRemoteAddr(); const simtime_t hbTimeField = hback->getTimeField(); stopTimer(path->HeartbeatTimer); /* assume a valid RTT measurement on this path */ @@ -2188,8 +2188,8 @@ SCTPEventCode SCTPAssociation::processAsconfArrived(SCTPAsconfChunk* asconfChunk { SCTPParameter* sctpParam; SCTPPathVariables* path; - IPvXAddress addr; - std::vector locAddr; + Address addr; + std::vector
locAddr; SCTPAuthenticationChunk* authChunk; sctpEV3 << "Asconf arrived " << asconfChunk->getName() << "\n"; SCTPMessage *sctpAsconfAck = new SCTPMessage("ASCONF_ACK"); @@ -2219,7 +2219,7 @@ SCTPEventCode SCTPAssociation::processAsconfArrived(SCTPAsconfChunk* asconfChunk SCTPAddIPParameter* ipParam; ipParam = check_and_cast(sctpParam); addr = ipParam->getAddressParam(); - if (addr==IPvXAddress("0.0.0.0")) + if (addr==Address("0.0.0.0")) { sctpEV3 << "no address specified, add natted address " << remoteAddr << "\n"; addr = remoteAddr; @@ -2276,7 +2276,7 @@ SCTPEventCode SCTPAssociation::processAsconfArrived(SCTPAsconfChunk* asconfChunk } else { - locAddr = (std::vector) state->localAddresses; + locAddr = (std::vector
) state->localAddresses; sctpMain->removeRemoteAddressFromAllAssociations(this, addr, locAddr); removePath(addr); sctpEV3 << "remove path from address " << addr << "\n"; @@ -2289,7 +2289,7 @@ SCTPEventCode SCTPAssociation::processAsconfArrived(SCTPAsconfChunk* asconfChunk SCTPSetPrimaryIPParameter* priParam; priParam = check_and_cast(sctpParam); addr = priParam->getAddressParam(); - if (addr==IPvXAddress("0.0.0.0")) + if (addr==Address("0.0.0.0")) { sctpEV3 << "no address specified, add natted address " << remoteAddr << "\n"; addr = remoteAddr; @@ -2332,7 +2332,7 @@ SCTPEventCode SCTPAssociation::processAsconfArrived(SCTPAsconfChunk* asconfChunk SCTPEventCode SCTPAssociation::processAsconfAckArrived(SCTPAsconfAckChunk* asconfAckChunk) { SCTPParameter* sctpParam; - IPvXAddress addr; + Address addr; SCTPAsconfChunk *sctpasconf; std::vector errorCorrId; std::vector::iterator iter; @@ -2345,7 +2345,7 @@ SCTPEventCode SCTPAssociation::processAsconfAckArrived(SCTPAsconfAckChunk* ascon state->errorCount = 0; state->asconfOutstanding = false; getPath(remoteAddr)->pathErrorCount = 0; - std::vector remAddr = (std::vector) remoteAddressList; + std::vector
remAddr = (std::vector
) remoteAddressList; for (uint32 j=0; jgetAsconfResponseArraySize(); j++) { sctpParam = (SCTPParameter*)(asconfAckChunk->getAsconfResponse(j)); @@ -2379,7 +2379,7 @@ SCTPEventCode SCTPAssociation::processAsconfAckArrived(SCTPAsconfAckChunk* ascon break; } addr = ipParam->getAddressParam(); - if (addr==IPvXAddress("0.0.0.0")) + if (addr==Address("0.0.0.0")) { addr = localAddr; sendIndicationToApp(SCTP_I_ADDRESS_ADDED); diff --git a/src/transport/sctp/SCTPAssociationUtil.cc b/src/transport/sctp/SCTPAssociationUtil.cc index a19f1e830bd..d999fe0e9fc 100644 --- a/src/transport/sctp/SCTPAssociationUtil.cc +++ b/src/transport/sctp/SCTPAssociationUtil.cc @@ -26,8 +26,8 @@ #include "SCTPCommand_m.h" #include "SCTPQueue.h" #include "SCTPAlgorithm.h" -#include "RoutingTable.h" -#include "RoutingTableAccess.h" +#include "IPv4RoutingTable.h" +#include "IPv4RoutingTableAccess.h" #include "InterfaceTable.h" #include "InterfaceTableAccess.h" #include "IPv6Address.h" @@ -276,7 +276,7 @@ SCTPAssociation* SCTPAssociation::cloneAssociation() } void SCTPAssociation::sendToIP(SCTPMessage* sctpmsg, - const IPvXAddress& dest) + const Address& dest) { // Final touches on the segment before sending sctpmsg->setSrcPort(localPort); @@ -306,7 +306,7 @@ void SCTPAssociation::sendToIP(SCTPMessage* sctpmsg, IPv6ControlInfo* controlInfo = new IPv6ControlInfo(); controlInfo->setProtocol(IP_PROT_SCTP); controlInfo->setSrcAddr(IPv6Address()); - controlInfo->setDestAddr(dest.get6()); + controlInfo->setDestAddr(dest.toIPv6()); sctpmsg->setControlInfo(controlInfo); sctpMain->send(sctpmsg, "to_ipv6"); } @@ -314,7 +314,7 @@ void SCTPAssociation::sendToIP(SCTPMessage* sctpmsg, IPv4ControlInfo* controlInfo = new IPv4ControlInfo(); controlInfo->setProtocol(IP_PROT_SCTP); controlInfo->setSrcAddr(IPv4Address("0.0.0.0")); - controlInfo->setDestAddr(dest.get4()); + controlInfo->setDestAddr(dest.toIPv4()); sctpmsg->setControlInfo(controlInfo); sctpMain->send(sctpmsg, "to_ip"); } @@ -472,7 +472,7 @@ void SCTPAssociation::sendInit() initTsn = initChunk->getInitTSN(); IInterfaceTable *ift = interfaceTableAccess.get(); sctpEV3<<"add local address\n"; - if (localAddressList.front() == IPvXAddress("0.0.0.0")) + if (localAddressList.front() == Address("0.0.0.0")) { for (int32 i=0; igetNumInterfaces(); ++i) { @@ -535,14 +535,14 @@ void SCTPAssociation::sendInit() length += 8; sctpMain->addLocalAddress(this, (*i)); state->localAddresses.push_back((*i)); - if (localAddr.get4().getInt()==0) + if (localAddr.toIPv4().getInt()==0) localAddr = (*i); } else if (rlevel==4 && addressLevel==3 && friendly) { sctpMain->addLocalAddress(this, (*i)); state->localAddresses.push_back((*i)); - if (localAddr.get4().getInt()==0) + if (localAddr.toIPv4().getInt()==0) localAddr = (*i); } } @@ -935,8 +935,8 @@ void SCTPAssociation::sendHeartbeat(const SCTPPathVariables* path) } void SCTPAssociation::sendHeartbeatAck(const SCTPHeartbeatChunk* heartbeatChunk, - const IPvXAddress& src, - const IPvXAddress& dest) + const Address& src, + const Address& dest) { SCTPAuthenticationChunk* authChunk; SCTPMessage* sctpHeartbeatAck = new SCTPMessage(); @@ -967,7 +967,7 @@ void SCTPAssociation::sendHeartbeatAck(const SCTPHeartbeatChunk* heartbeatChunk, sendToIP(sctpHeartbeatAck, dest); } -void SCTPAssociation::sendCookieAck(const IPvXAddress& dest) +void SCTPAssociation::sendCookieAck(const Address& dest) { SCTPAuthenticationChunk* authChunk; SCTPMessage *sctpcookieack = new SCTPMessage(); @@ -991,7 +991,7 @@ void SCTPAssociation::sendCookieAck(const IPvXAddress& dest) sendToIP(sctpcookieack, dest); } -void SCTPAssociation::sendShutdownAck(const IPvXAddress& dest) +void SCTPAssociation::sendShutdownAck(const Address& dest) { sendOnAllPaths(getPath(dest)); if (getOutstandingBytes() == 0) { @@ -1229,7 +1229,7 @@ void SCTPAssociation::scheduleSack() } } -SCTPForwardTsnChunk* SCTPAssociation::createForwardTsnChunk(const IPvXAddress& pid) +SCTPForwardTsnChunk* SCTPAssociation::createForwardTsnChunk(const Address& pid) { uint16 chunkLength = SCTP_FORWARD_TSN_CHUNK_LENGTH; SCTPDataVariables* chunk; @@ -1793,7 +1793,7 @@ SCTPDataChunk* SCTPAssociation::transformDataChunk(SCTPDataVariables* chunk) return dataChunk; } -void SCTPAssociation::addPath(const IPvXAddress& addr) +void SCTPAssociation::addPath(const Address& addr) { sctpEV3<<"Add Path remote address: "<second; path->pathErrorCount = 0; - InterfaceEntry *rtie = routingTableAccess.get()->getInterfaceForDestAddr(path->remoteAddress.get4()); + InterfaceEntry *rtie = routingTableAccess.get()->getInterfaceForDestAddr(path->remoteAddress.toIPv4()); path->pmtu = rtie->getMTU(); sctpEV3 << "Path MTU of Interface "<< i << " = " << path->pmtu <<"\n"; if (path->pmtu < state->assocPmtu) @@ -2590,11 +2590,11 @@ void SCTPAssociation::disposeOf(SCTPMessage* sctpmsg) delete sctpmsg; } -int SCTPAssociation::getAddressLevel(const IPvXAddress& addr) +int SCTPAssociation::getAddressLevel(const Address& addr) { if (addr.isIPv6()) { - switch(addr.get6().getScope()) + switch(addr.toIPv6().getScope()) { case IPv6Address::UNSPECIFIED: case IPv6Address::MULTICAST: @@ -2613,12 +2613,12 @@ int SCTPAssociation::getAddressLevel(const IPvXAddress& addr) return 4; default: - throw cRuntimeError("Unknown IPv6 scope: %d", (int)(addr.get6().getScope())); + throw cRuntimeError("Unknown IPv6 scope: %d", (int)(addr.toIPv6().getScope())); } } else { - switch(addr.get4().getAddressCategory()) + switch(addr.toIPv4().getAddressCategory()) { case IPv4Address::UNSPECIFIED: case IPv4Address::THIS_NETWORK: @@ -2644,7 +2644,7 @@ int SCTPAssociation::getAddressLevel(const IPvXAddress& addr) return 4; default: - throw cRuntimeError("Unknown IPv4 address category: %d", (int)(addr.get4().getAddressCategory())); + throw cRuntimeError("Unknown IPv4 address category: %d", (int)(addr.toIPv4().getAddressCategory())); } } } diff --git a/src/transport/sctp/SCTPMessage.msg b/src/transport/sctp/SCTPMessage.msg index b1b68240994..ad6f89bcf7d 100644 --- a/src/transport/sctp/SCTPMessage.msg +++ b/src/transport/sctp/SCTPMessage.msg @@ -17,7 +17,7 @@ // cplusplus {{ -#include "IPvXAddress.h" +#include "Address.h" }} @@ -30,7 +30,7 @@ typedef cPacket *cPacketPtr; struct cPacketPtr; -class noncobject IPvXAddress; +class noncobject Address; message SCTPSimpleMessage extends cPacket { @@ -74,7 +74,7 @@ message SCTPInitChunk extends SCTPChunk // Initial TSN uint32 initTSN; bool forwardTsn; - IPvXAddress addresses[]; + Address addresses[]; uint8 unrecognizedParameters[]; //Will be filled by the Parser, if unrecognized Parameters arrive. uint32 msg_rwnd; uint16 chunkTypes[]; //Chunk list parameter, i.e. for SCTP AUTH @@ -85,21 +85,21 @@ message SCTPInitChunk extends SCTPChunk message SCTPInitAckChunk extends SCTPChunk { - // Initiate Tag - uint32 initTag; - // Advertised Receiver Window - uint32 a_rwnd; - // Number of Outbound Streams - uint16 noOutStreams; - // Number of Inbound Streams - uint16 noInStreams; - // Initial TSN - uint32 initTSN; - bool forwardTsn; - IPvXAddress addresses[]; - char cookie[]; - uint8 unrecognizedParameters[]; - cPacketPtr stateCookie; + // Initiate Tag + uint32 initTag; + // Advertised Receiver Window + uint32 a_rwnd; + // Number of Outbound Streams + uint16 noOutStreams; + // Number of Inbound Streams + uint16 noInStreams; + // Initial TSN + uint32 initTSN; + bool forwardTsn; + Address addresses[]; + char cookie[]; + uint8 unrecognizedParameters[]; + cPacketPtr stateCookie; uint32 msg_rwnd; uint8 random[]; //Random Number uint16 chunkTypes[]; @@ -137,7 +137,7 @@ message SCTPDataMsg extends cPacket simtime_t enqueuingTime; simtime_t expiryTime; uint32 ppid; - IPvXAddress initialDestination; + Address initialDestination; uint32 msgNum; uint16 sid; bool ordered; @@ -208,14 +208,14 @@ message SCTPAbortChunk extends SCTPChunk message SCTPHeartbeatChunk extends SCTPChunk { - IPvXAddress remoteAddr; + Address remoteAddr; simtime_t timeField; char info[]; } message SCTPHeartbeatAckChunk extends SCTPChunk { - IPvXAddress remoteAddr; + Address remoteAddr; simtime_t timeField; char info[]; } @@ -311,7 +311,7 @@ message SCTPAsconfChunk extends SCTPChunk { @customize(true); uint32 serialNumber; - IPvXAddress addressParam; + Address addressParam; uint32 peerVTag; //for NAT abstract cPacketPtr asconfParams[]; } @@ -326,19 +326,19 @@ message SCTPAsconfAckChunk extends SCTPChunk message SCTPAddIPParameter extends SCTPParameter { uint32 requestCorrelationId; //assigned by the sender to identify each request parameter - IPvXAddress addressParam; + Address addressParam; } message SCTPDeleteIPParameter extends SCTPParameter { uint32 requestCorrelationId; //assigned by the sender to identify each request parameter - IPvXAddress addressParam; + Address addressParam; } message SCTPSetPrimaryIPParameter extends SCTPParameter { uint32 requestCorrelationId; //assigned by the sender to identify each request parameter - IPvXAddress addressParam; + Address addressParam; } message SCTPSupportedExtensionsParameter extends SCTPParameter @@ -360,4 +360,4 @@ message SCTPSimpleErrorCauseParameter extends SCTPParameter message SCTPSuccessIndication extends SCTPParameter { uint32 responseCorrelationId; -} \ No newline at end of file +} diff --git a/src/transport/sctp/SCTPQueue.cc b/src/transport/sctp/SCTPQueue.cc index 2ee8f1b8db6..63dc1ea4db0 100644 --- a/src/transport/sctp/SCTPQueue.cc +++ b/src/transport/sctp/SCTPQueue.cc @@ -198,7 +198,7 @@ uint16 SCTPQueue::getFirstSsnInQueue(const uint16 sid) return payloadQueue.begin()->second->ssn; } -void SCTPQueue::findEarliestOutstandingTSNsForPath(const IPvXAddress& remoteAddress, +void SCTPQueue::findEarliestOutstandingTSNsForPath(const Address& remoteAddress, uint32& earliestOutstandingTSN, uint32& rtxEarliestOutstandingTSN) const { @@ -227,7 +227,7 @@ void SCTPQueue::findEarliestOutstandingTSNsForPath(const IPvXAddress& remoteAddr } -uint32 SCTPQueue::getSizeOfFirstChunk(const IPvXAddress& remoteAddress) +uint32 SCTPQueue::getSizeOfFirstChunk(const Address& remoteAddress) { for (PayloadQueue::const_iterator iterator = payloadQueue.begin(); iterator != payloadQueue.end(); ++iterator) { diff --git a/src/transport/sctp/SCTPQueue.h b/src/transport/sctp/SCTPQueue.h index 131e0e0acb2..6a993b602be 100644 --- a/src/transport/sctp/SCTPQueue.h +++ b/src/transport/sctp/SCTPQueue.h @@ -21,7 +21,7 @@ #include "INETDefs.h" -#include "IPvXAddress.h" +#include "Address.h" #include "SCTP.h" @@ -85,11 +85,11 @@ class INET_API SCTPQueue : public cObject SCTPDataVariables* dequeueChunkBySSN(const uint16 ssn); - uint32 getSizeOfFirstChunk(const IPvXAddress& remoteAddress); + uint32 getSizeOfFirstChunk(const Address& remoteAddress); uint16 getFirstSsnInQueue(const uint16 sid); - void findEarliestOutstandingTSNsForPath(const IPvXAddress& remoteAddress, + void findEarliestOutstandingTSNsForPath(const Address& remoteAddress, uint32& earliestOutstandingTSN, uint32& rtxEarliestOutstandingTSN) const; diff --git a/src/transport/tcp/TCP.cc b/src/transport/tcp/TCP.cc index 4d2d4bc678a..941cbff02f3 100644 --- a/src/transport/tcp/TCP.cc +++ b/src/transport/tcp/TCP.cc @@ -55,8 +55,8 @@ bool TCP::logverbose; static std::ostream& operator<<(std::ostream& os, const TCP::SockPair& sp) { - os << "loc=" << IPvXAddress(sp.localAddr) << ":" << sp.localPort << " " - << "rem=" << IPvXAddress(sp.remoteAddr) << ":" << sp.remotePort; + os << "loc=" << Address(sp.localAddr) << ":" << sp.localPort << " " + << "rem=" << Address(sp.remoteAddr) << ":" << sp.remotePort; return os; } @@ -152,7 +152,7 @@ void TCP::handleMessage(cMessage *msg) TCPSegment *tcpseg = check_and_cast(msg); // get src/dest addresses - IPvXAddress srcAddr, destAddr; + Address srcAddr, destAddr; if (dynamic_cast(tcpseg->getControlInfo()) != NULL) { @@ -222,7 +222,7 @@ TCPConnection *TCP::createConnection(int appGateIndex, int connId) return new TCPConnection(this, appGateIndex, connId); } -void TCP::segmentArrivalWhileClosed(TCPSegment *tcpseg, IPvXAddress srcAddr, IPvXAddress destAddr) +void TCP::segmentArrivalWhileClosed(TCPSegment *tcpseg, Address srcAddr, Address destAddr) { TCPConnection *tmp = new TCPConnection(); tmp->segmentArrivalWhileClosed(tcpseg, srcAddr, destAddr); @@ -293,7 +293,7 @@ void TCP::updateDisplayString() getDisplayString().setTagArg("t", 0, buf2); } -TCPConnection *TCP::findConnForSegment(TCPSegment *tcpseg, IPvXAddress srcAddr, IPvXAddress destAddr) +TCPConnection *TCP::findConnForSegment(TCPSegment *tcpseg, Address srcAddr, Address destAddr) { SockPair key; key.localAddr = destAddr; @@ -310,7 +310,7 @@ TCPConnection *TCP::findConnForSegment(TCPSegment *tcpseg, IPvXAddress srcAddr, return i->second; // try with localAddr missing (only localPort specified in passive/active open) - key.localAddr = IPvXAddress(); + key.localAddr = Address(); i = tcpConnMap.find(key); if (i != tcpConnMap.end()) @@ -318,7 +318,7 @@ TCPConnection *TCP::findConnForSegment(TCPSegment *tcpseg, IPvXAddress srcAddr, // try fully qualified local socket + blank remote socket (for incoming SYN) key = save; - key.remoteAddr = IPvXAddress(); + key.remoteAddr = Address(); key.remotePort = -1; i = tcpConnMap.find(key); @@ -326,7 +326,7 @@ TCPConnection *TCP::findConnForSegment(TCPSegment *tcpseg, IPvXAddress srcAddr, return i->second; // try with blank remote socket, and localAddr missing (for incoming SYN) - key.localAddr = IPvXAddress(); + key.localAddr = Address(); i = tcpConnMap.find(key); if (i != tcpConnMap.end()) @@ -368,7 +368,7 @@ ushort TCP::getEphemeralPort() return lastEphemeralPort; } -void TCP::addSockPair(TCPConnection *conn, IPvXAddress localAddr, IPvXAddress remoteAddr, int localPort, int remotePort) +void TCP::addSockPair(TCPConnection *conn, Address localAddr, Address remoteAddr, int localPort, int remotePort) { // update addresses/ports in TCPConnection SockPair key; @@ -398,7 +398,7 @@ void TCP::addSockPair(TCPConnection *conn, IPvXAddress localAddr, IPvXAddress re usedEphemeralPorts.insert(localPort); } -void TCP::updateSockPair(TCPConnection *conn, IPvXAddress localAddr, IPvXAddress remoteAddr, int localPort, int remotePort) +void TCP::updateSockPair(TCPConnection *conn, Address localAddr, Address remoteAddr, int localPort, int remotePort) { // find with existing address/port pair... SockPair key; @@ -423,7 +423,7 @@ void TCP::updateSockPair(TCPConnection *conn, IPvXAddress localAddr, IPvXAddress // localPort doesn't change (see ASSERT above), so there's no need to update usedEphemeralPorts[]. } -void TCP::addForkedConnection(TCPConnection *conn, TCPConnection *newConn, IPvXAddress localAddr, IPvXAddress remoteAddr, int localPort, int remotePort) +void TCP::addForkedConnection(TCPConnection *conn, TCPConnection *newConn, Address localAddr, Address remoteAddr, int localPort, int remotePort) { // update conn's socket pair, and register newConn (which'll keep LISTENing) updateSockPair(conn, localAddr, remoteAddr, localPort, remotePort); diff --git a/src/transport/tcp/TCP.h b/src/transport/tcp/TCP.h index 048de7cb494..787ef1081b1 100644 --- a/src/transport/tcp/TCP.h +++ b/src/transport/tcp/TCP.h @@ -25,7 +25,7 @@ #include "INETDefs.h" #include "ILifecycle.h" -#include "IPvXAddress.h" +#include "Address.h" #include "TCPCommand_m.h" // Forward declarations: @@ -119,8 +119,8 @@ class INET_API TCP : public cSimpleModule, public ILifecycle }; struct SockPair { - IPvXAddress localAddr; - IPvXAddress remoteAddr; + Address localAddr; + Address remoteAddr; int localPort; // -1: unspec int remotePort; // -1: unspec @@ -152,9 +152,9 @@ class INET_API TCP : public cSimpleModule, public ILifecycle virtual TCPConnection *createConnection(int appGateIndex, int connId); // utility methods - virtual TCPConnection *findConnForSegment(TCPSegment *tcpseg, IPvXAddress srcAddr, IPvXAddress destAddr); + virtual TCPConnection *findConnForSegment(TCPSegment *tcpseg, Address srcAddr, Address destAddr); virtual TCPConnection *findConnForApp(int appGateIndex, int connId); - virtual void segmentArrivalWhileClosed(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest); + virtual void segmentArrivalWhileClosed(TCPSegment *tcpseg, Address src, Address dest); virtual void removeConnection(TCPConnection *conn); virtual void updateDisplayString(); @@ -180,19 +180,19 @@ class INET_API TCP : public cSimpleModule, public ILifecycle * To be called from TCPConnection when a new connection gets created, * during processing of OPEN_ACTIVE or OPEN_PASSIVE. */ - virtual void addSockPair(TCPConnection *conn, IPvXAddress localAddr, IPvXAddress remoteAddr, int localPort, int remotePort); + virtual void addSockPair(TCPConnection *conn, Address localAddr, Address remoteAddr, int localPort, int remotePort); /** * To be called from TCPConnection when socket pair (key for TcpConnMap) changes * (e.g. becomes fully qualified). */ - virtual void updateSockPair(TCPConnection *conn, IPvXAddress localAddr, IPvXAddress remoteAddr, int localPort, int remotePort); + virtual void updateSockPair(TCPConnection *conn, Address localAddr, Address remoteAddr, int localPort, int remotePort); /** * Update conn's socket pair, and register newConn (which'll keep LISTENing). * Also, conn will get a new connId (and newConn will live on with its old connId). */ - virtual void addForkedConnection(TCPConnection *conn, TCPConnection *newConn, IPvXAddress localAddr, IPvXAddress remoteAddr, int localPort, int remotePort); + virtual void addForkedConnection(TCPConnection *conn, TCPConnection *newConn, Address localAddr, Address remoteAddr, int localPort, int remotePort); /** * To be called from TCPConnection: reserves an ephemeral port for the connection. diff --git a/src/transport/tcp/TCPConnection.h b/src/transport/tcp/TCPConnection.h index cc03fe417c4..c65b4bb5b1d 100644 --- a/src/transport/tcp/TCPConnection.h +++ b/src/transport/tcp/TCPConnection.h @@ -22,7 +22,7 @@ #include "INETDefs.h" -#include "IPvXAddress.h" +#include "Address.h" #include "TCP.h" #include "TCPSegment.h" @@ -288,7 +288,7 @@ class INET_API TCPStateVariables : public cObject * * The "entry points" of TCPConnnection from TCP are: * - processTimer(cMessage *msg): handle self-messages which belong to the connection - * - processTCPSegment(TCPSegment *tcpSeg, IPvXAddress srcAddr, IPvXAddress destAddr): + * - processTCPSegment(TCPSegment *tcpSeg, Address srcAddr, Address destAddr): * handle segment arrivals * - processAppCommand(cMessage *msg): process commands which arrive from the * application (TCP_C_xxx) @@ -321,8 +321,8 @@ class INET_API TCPConnection int connId; // identifies connection within the app // socket pair - IPvXAddress localAddr; - IPvXAddress remoteAddr; + Address localAddr; + Address remoteAddr; int localPort; int remotePort; @@ -406,9 +406,9 @@ class INET_API TCPConnection * Process incoming TCP segment. Returns a specific event code (e.g. TCP_E_RCV_SYN) * which will drive the state machine. */ - virtual TCPEventCode process_RCV_SEGMENT(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest); - virtual TCPEventCode processSegmentInListen(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest); - virtual TCPEventCode processSegmentInSynSent(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest); + virtual TCPEventCode process_RCV_SEGMENT(TCPSegment *tcpseg, Address src, Address dest); + virtual TCPEventCode processSegmentInListen(TCPSegment *tcpseg, Address src, Address dest); + virtual TCPEventCode processSegmentInSynSent(TCPSegment *tcpseg, Address src, Address dest); virtual TCPEventCode processSegment1stThru8th(TCPSegment *tcpseg); virtual TCPEventCode processRstInSynReceived(TCPSegment *tcpseg); virtual bool processAckInEstabEtc(TCPSegment *tcpseg); @@ -489,9 +489,9 @@ class INET_API TCPConnection /** Utility: sends RST */ virtual void sendRst(uint32 seqNo); /** Utility: sends RST; does not use connection state */ - virtual void sendRst(uint32 seq, IPvXAddress src, IPvXAddress dest, int srcPort, int destPort); + virtual void sendRst(uint32 seq, Address src, Address dest, int srcPort, int destPort); /** Utility: sends RST+ACK; does not use connection state */ - virtual void sendRstAck(uint32 seq, uint32 ack, IPvXAddress src, IPvXAddress dest, int srcPort, int destPort); + virtual void sendRstAck(uint32 seq, uint32 ack, Address src, Address dest, int srcPort, int destPort); /** Utility: sends FIN */ virtual void sendFin(); @@ -526,7 +526,7 @@ class INET_API TCPConnection cMessage *cancelEvent(cMessage *msg) {return tcpMain->cancelEvent(msg);} /** Utility: send IP packet */ - static void sendToIP(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest); + static void sendToIP(TCPSegment *tcpseg, Address src, Address dest); /** Utility: sends packet to application */ virtual void sendToApp(cMessage *msg); @@ -587,7 +587,7 @@ class INET_API TCPConnection * connection object so that it can call this method, then immediately * deletes it. */ - virtual void segmentArrivalWhileClosed(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest); + virtual void segmentArrivalWhileClosed(TCPSegment *tcpseg, Address src, Address dest); /** @name Various getters **/ //@{ @@ -612,7 +612,7 @@ class INET_API TCPConnection * of false means that the connection structure must be deleted by the * caller (TCP). */ - virtual bool processTCPSegment(TCPSegment *tcpSeg, IPvXAddress srcAddr, IPvXAddress destAddr); + virtual bool processTCPSegment(TCPSegment *tcpSeg, Address srcAddr, Address destAddr); /** * Process commands from the application. diff --git a/src/transport/tcp/TCPConnectionBase.cc b/src/transport/tcp/TCPConnectionBase.cc index afa2bd28fa2..ac763f70adf 100644 --- a/src/transport/tcp/TCPConnectionBase.cc +++ b/src/transport/tcp/TCPConnectionBase.cc @@ -327,7 +327,7 @@ bool TCPConnection::processTimer(cMessage *msg) return performStateTransition(event); } -bool TCPConnection::processTCPSegment(TCPSegment *tcpseg, IPvXAddress segSrcAddr, IPvXAddress segDestAddr) +bool TCPConnection::processTCPSegment(TCPSegment *tcpseg, Address segSrcAddr, Address segDestAddr) { printConnBrief(); if (!localAddr.isUnspecified()) diff --git a/src/transport/tcp/TCPConnectionEventProc.cc b/src/transport/tcp/TCPConnectionEventProc.cc index fefac2fb735..26f9f7bda01 100644 --- a/src/transport/tcp/TCPConnectionEventProc.cc +++ b/src/transport/tcp/TCPConnectionEventProc.cc @@ -33,7 +33,7 @@ void TCPConnection::process_OPEN_ACTIVE(TCPEventCode& event, TCPCommand *tcpCommand, cMessage *msg) { TCPOpenCommand *openCmd = check_and_cast(tcpCommand); - IPvXAddress localAddr, remoteAddr; + Address localAddr, remoteAddr; int localPort, remotePort; switch (fsm.getState()) @@ -79,7 +79,7 @@ void TCPConnection::process_OPEN_ACTIVE(TCPEventCode& event, TCPCommand *tcpComm void TCPConnection::process_OPEN_PASSIVE(TCPEventCode& event, TCPCommand *tcpCommand, cMessage *msg) { TCPOpenCommand *openCmd = check_and_cast(tcpCommand); - IPvXAddress localAddr; + Address localAddr; int localPort; switch (fsm.getState()) @@ -98,7 +98,7 @@ void TCPConnection::process_OPEN_PASSIVE(TCPEventCode& event, TCPCommand *tcpCom tcpEV << "Starting to listen on: " << localAddr << ":" << localPort << "\n"; - tcpMain->addSockPair(this, localAddr, IPvXAddress(), localPort, -1); + tcpMain->addSockPair(this, localAddr, Address(), localPort, -1); break; default: diff --git a/src/transport/tcp/TCPConnectionRcvSegment.cc b/src/transport/tcp/TCPConnectionRcvSegment.cc index bae90aa2665..c96cd6e3790 100644 --- a/src/transport/tcp/TCPConnectionRcvSegment.cc +++ b/src/transport/tcp/TCPConnectionRcvSegment.cc @@ -34,7 +34,7 @@ bool TCPConnection::tryFastRoute(TCPSegment *tcpseg) } -void TCPConnection::segmentArrivalWhileClosed(TCPSegment *tcpseg, IPvXAddress srcAddr, IPvXAddress destAddr) +void TCPConnection::segmentArrivalWhileClosed(TCPSegment *tcpseg, Address srcAddr, Address destAddr) { tcpEV << "Seg arrived: "; printSegmentBrief(tcpseg); @@ -87,7 +87,7 @@ void TCPConnection::segmentArrivalWhileClosed(TCPSegment *tcpseg, IPvXAddress sr } } -TCPEventCode TCPConnection::process_RCV_SEGMENT(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest) +TCPEventCode TCPConnection::process_RCV_SEGMENT(TCPSegment *tcpseg, Address src, Address dest) { tcpEV << "Seg arrived: "; printSegmentBrief(tcpseg); @@ -770,7 +770,7 @@ TCPEventCode TCPConnection::processSegment1stThru8th(TCPSegment *tcpseg) //---- -TCPEventCode TCPConnection::processSegmentInListen(TCPSegment *tcpseg, IPvXAddress srcAddr, IPvXAddress destAddr) +TCPEventCode TCPConnection::processSegmentInListen(TCPSegment *tcpseg, Address srcAddr, Address destAddr) { tcpEV2 << "Processing segment in LISTEN\n"; @@ -914,7 +914,7 @@ TCPEventCode TCPConnection::processSegmentInListen(TCPSegment *tcpseg, IPvXAddre return TCP_E_IGNORE; } -TCPEventCode TCPConnection::processSegmentInSynSent(TCPSegment *tcpseg, IPvXAddress srcAddr, IPvXAddress destAddr) +TCPEventCode TCPConnection::processSegmentInSynSent(TCPSegment *tcpseg, Address srcAddr, Address destAddr) { tcpEV2 << "Processing segment in SYN_SENT\n"; diff --git a/src/transport/tcp/TCPConnectionUtil.cc b/src/transport/tcp/TCPConnectionUtil.cc index 7670066e47e..e3dea732771 100644 --- a/src/transport/tcp/TCPConnectionUtil.cc +++ b/src/transport/tcp/TCPConnectionUtil.cc @@ -234,8 +234,8 @@ void TCPConnection::sendToIP(TCPSegment *tcpseg) // send over IPv4 IPv4ControlInfo *controlInfo = new IPv4ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(localAddr.get4()); - controlInfo->setDestAddr(remoteAddr.get4()); + controlInfo->setSrcAddr(localAddr.toIPv4()); + controlInfo->setDestAddr(remoteAddr.toIPv4()); tcpseg->setControlInfo(controlInfo); tcpMain->send(tcpseg, "ipOut"); @@ -245,15 +245,15 @@ void TCPConnection::sendToIP(TCPSegment *tcpseg) // send over IPv6 IPv6ControlInfo *controlInfo = new IPv6ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(localAddr.get6()); - controlInfo->setDestAddr(remoteAddr.get6()); + controlInfo->setSrcAddr(localAddr.toIPv6()); + controlInfo->setDestAddr(remoteAddr.toIPv6()); tcpseg->setControlInfo(controlInfo); tcpMain->send(tcpseg, "ipv6Out"); } } -void TCPConnection::sendToIP(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest) +void TCPConnection::sendToIP(TCPSegment *tcpseg, Address src, Address dest) { tcpEV << "Sending: "; printSegmentBrief(tcpseg); @@ -263,8 +263,8 @@ void TCPConnection::sendToIP(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress de // send over IPv4 IPv4ControlInfo *controlInfo = new IPv4ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(src.get4()); - controlInfo->setDestAddr(dest.get4()); + controlInfo->setSrcAddr(src.toIPv4()); + controlInfo->setDestAddr(dest.toIPv4()); tcpseg->setControlInfo(controlInfo); check_and_cast(simulation.getContextModule())->send(tcpseg, "ipOut"); @@ -274,8 +274,8 @@ void TCPConnection::sendToIP(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress de // send over IPv6 IPv6ControlInfo *controlInfo = new IPv6ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(src.get6()); - controlInfo->setDestAddr(dest.get6()); + controlInfo->setSrcAddr(src.toIPv6()); + controlInfo->setDestAddr(dest.toIPv6()); tcpseg->setControlInfo(controlInfo); check_and_cast(simulation.getContextModule())->send(tcpseg, "ipv6Out"); @@ -513,7 +513,7 @@ void TCPConnection::sendRst(uint32 seqNo) sendRst(seqNo, localAddr, remoteAddr, localPort, remotePort); } -void TCPConnection::sendRst(uint32 seq, IPvXAddress src, IPvXAddress dest, int srcPort, int destPort) +void TCPConnection::sendRst(uint32 seq, Address src, Address dest, int srcPort, int destPort) { TCPSegment *tcpseg = createTCPSegment("RST"); @@ -527,7 +527,7 @@ void TCPConnection::sendRst(uint32 seq, IPvXAddress src, IPvXAddress dest, int s sendToIP(tcpseg, src, dest); } -void TCPConnection::sendRstAck(uint32 seq, uint32 ack, IPvXAddress src, IPvXAddress dest, int srcPort, int destPort) +void TCPConnection::sendRstAck(uint32 seq, uint32 ack, Address src, Address dest, int srcPort, int destPort) { TCPSegment *tcpseg = createTCPSegment("RST+ACK"); diff --git a/src/transport/tcp_common/TCPSpoof.cc b/src/transport/tcp_common/TCPSpoof.cc index db2371b733c..05de7220c6e 100644 --- a/src/transport/tcp_common/TCPSpoof.cc +++ b/src/transport/tcp_common/TCPSpoof.cc @@ -42,8 +42,8 @@ void TCPSpoof::sendSpoofPacket() { TCPSegment *tcpseg = new TCPSegment("spoof"); - IPvXAddress srcAddr = IPvXAddressResolver().resolve(par("srcAddress")); - IPvXAddress destAddr = IPvXAddressResolver().resolve(par("destAddress")); + Address srcAddr = AddressResolver().resolve(par("srcAddress")); + Address destAddr = AddressResolver().resolve(par("destAddress")); int srcPort = par("srcPort"); int destPort = par("destPort"); bool isSYN = par("isSYN"); @@ -61,7 +61,7 @@ void TCPSpoof::sendSpoofPacket() sendToIP(tcpseg, srcAddr, destAddr); } -void TCPSpoof::sendToIP(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest) +void TCPSpoof::sendToIP(TCPSegment *tcpseg, Address src, Address dest) { EV << "Sending: "; //printSegmentBrief(tcpseg); @@ -71,8 +71,8 @@ void TCPSpoof::sendToIP(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest) // send over IPv4 IPv4ControlInfo *controlInfo = new IPv4ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(src.get4()); - controlInfo->setDestAddr(dest.get4()); + controlInfo->setSrcAddr(src.toIPv4()); + controlInfo->setDestAddr(dest.toIPv4()); tcpseg->setControlInfo(controlInfo); emit(sentPkSignal, tcpseg); @@ -83,8 +83,8 @@ void TCPSpoof::sendToIP(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest) // send over IPv6 IPv6ControlInfo *controlInfo = new IPv6ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(src.get6()); - controlInfo->setDestAddr(dest.get6()); + controlInfo->setSrcAddr(src.toIPv6()); + controlInfo->setDestAddr(dest.toIPv6()); tcpseg->setControlInfo(controlInfo); emit(sentPkSignal, tcpseg); diff --git a/src/transport/tcp_common/TCPSpoof.h b/src/transport/tcp_common/TCPSpoof.h index 206de0e6d24..8a690dac264 100644 --- a/src/transport/tcp_common/TCPSpoof.h +++ b/src/transport/tcp_common/TCPSpoof.h @@ -17,7 +17,7 @@ #include "INETDefs.h" #include "TCPSegment.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" /** @@ -26,7 +26,7 @@ class INET_API TCPSpoof : public cSimpleModule { protected: - virtual void sendToIP(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest); + virtual void sendToIP(TCPSegment *tcpseg, Address src, Address dest); virtual unsigned long chooseInitialSeqNum(); virtual void sendSpoofPacket(); diff --git a/src/transport/tcp_lwip/LwipTcpLayer.cc b/src/transport/tcp_lwip/LwipTcpLayer.cc index 3c38049760b..ce45eca0f00 100644 --- a/src/transport/tcp_lwip/LwipTcpLayer.cc +++ b/src/transport/tcp_lwip/LwipTcpLayer.cc @@ -22,7 +22,7 @@ #include "lwip/memp.h" -#include "IPvXAddress.h" +#include "Address.h" #include "LwipTcpStackIf.h" @@ -83,7 +83,7 @@ err_t LwipTcpLayer::ip_output(LwipTcpLayer::tcp_pcb *pcb, struct pbuf *p, assert(p); assert(p->len <= p->tot_len); - IPvXAddress srcAddr, destAddr; + Address srcAddr, destAddr; srcAddr = src->addr; destAddr = dest->addr; @@ -94,7 +94,7 @@ err_t LwipTcpLayer::ip_output(LwipTcpLayer::tcp_pcb *pcb, struct pbuf *p, struct netif * LwipTcpLayer::ip_route(struct ip_addr *addr) { - IPvXAddress ipAddr; + Address ipAddr; if (addr) ipAddr = addr->addr; diff --git a/src/transport/tcp_lwip/LwipTcpStackIf.h b/src/transport/tcp_lwip/LwipTcpStackIf.h index 08e01d7ae77..22dd6010e29 100644 --- a/src/transport/tcp_lwip/LwipTcpStackIf.h +++ b/src/transport/tcp_lwip/LwipTcpStackIf.h @@ -19,7 +19,7 @@ #include "lwip/tcp.h" //forward declarations: -class IPvXAddress; +class Address; struct pbuf; /** @@ -39,7 +39,7 @@ class LwipTcpStackIf * @param len: length of tcpseg */ virtual void ip_output(LwipTcpLayer::tcp_pcb *pcb, - IPvXAddress const& src, IPvXAddress const& dest, void *tcpseg, int len) = 0; + Address const& src, Address const& dest, void *tcpseg, int len) = 0; /** * TCP layer events @@ -57,7 +57,7 @@ class LwipTcpStackIf /** * Get the network interface */ - virtual netif* ip_route(IPvXAddress const & ipAddr) = 0; + virtual netif* ip_route(Address const & ipAddr) = 0; virtual void notifyAboutIncomingSegmentProcessing(LwipTcpLayer::tcp_pcb *pcb, uint32 seqNo, const void *dataptr, int len) = 0; diff --git a/src/transport/tcp_lwip/TCP_lwIP.cc b/src/transport/tcp_lwip/TCP_lwIP.cc index dd883e36bb3..7304e2b00f7 100644 --- a/src/transport/tcp_lwip/TCP_lwIP.cc +++ b/src/transport/tcp_lwip/TCP_lwIP.cc @@ -65,15 +65,15 @@ TCP_lwIP::TCP_lwIP() isAliveM(false), pCurTcpSegM(NULL) { - netIf.gw.addr = IPvXAddress(); + netIf.gw.addr = Address(); netIf.flags = 0; netIf.input = NULL; - netIf.ip_addr.addr = IPvXAddress(); + netIf.ip_addr.addr = Address(); netIf.linkoutput = NULL; netIf.mtu = 1500; netIf.name[0] = 'T'; netIf.name[1] = 'C'; - netIf.netmask.addr = IPvXAddress(); + netIf.netmask.addr = Address(); netIf.next = 0; netIf.num = 0; netIf.output = NULL; @@ -148,7 +148,7 @@ void TCP_lwIP::sendEstablishedMsg(TcpLwipConnection &connP) void TCP_lwIP::handleIpInputMessage(TCPSegment* tcpsegP) { - IPvXAddress srcAddr, destAddr; + Address srcAddr, destAddr; int interfaceId = -1; // get src/dest addresses @@ -202,8 +202,8 @@ void TCP_lwIP::handleIpInputMessage(TCPSegment* tcpsegP) // search unfilled local addr in pcb-s for this connection. TcpAppConnMap::iterator i; - IPvXAddress laddr = ih->dest.addr; - IPvXAddress raddr = ih->src.addr; + Address laddr = ih->dest.addr; + Address raddr = ih->src.addr; u16_t lport = tcpsegP->getDestPort(); u16_t rport = tcpsegP->getSrcPort(); @@ -417,7 +417,7 @@ err_t TCP_lwIP::tcp_event_poll(TcpLwipConnection &conn) return ERR_OK; } -struct netif * TCP_lwIP::ip_route(IPvXAddress const & ipAddr) +struct netif * TCP_lwIP::ip_route(Address const & ipAddr) { return &netIf; } @@ -590,8 +590,8 @@ void TCP_lwIP::printConnBrief(TcpLwipConnection& connP) tcpEV << this << ": connId=" << connP.connIdM << " appGateIndex=" << connP.appGateIndexM; } -void TCP_lwIP::ip_output(LwipTcpLayer::tcp_pcb *pcb, IPvXAddress const& srcP, - IPvXAddress const& destP, void *dataP, int lenP) +void TCP_lwIP::ip_output(LwipTcpLayer::tcp_pcb *pcb, Address const& srcP, + Address const& destP, void *dataP, int lenP) { TcpLwipConnection *conn = (pcb != NULL) ? (TcpLwipConnection *)(pcb->callback_arg) : NULL; @@ -621,8 +621,8 @@ void TCP_lwIP::ip_output(LwipTcpLayer::tcp_pcb *pcb, IPvXAddress const& srcP, // send over IPv4 IPv4ControlInfo *controlInfo = new IPv4ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(srcP.get4()); - controlInfo->setDestAddr(destP.get4()); + controlInfo->setSrcAddr(srcP.toIPv4()); + controlInfo->setDestAddr(destP.toIPv4()); tcpseg->setControlInfo(controlInfo); output = "ipOut"; @@ -632,8 +632,8 @@ void TCP_lwIP::ip_output(LwipTcpLayer::tcp_pcb *pcb, IPvXAddress const& srcP, // send over IPv6 IPv6ControlInfo *controlInfo = new IPv6ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(srcP.get6()); - controlInfo->setDestAddr(destP.get6()); + controlInfo->setSrcAddr(srcP.toIPv6()); + controlInfo->setDestAddr(destP.toIPv6()); tcpseg->setControlInfo(controlInfo); output = "ipv6Out"; diff --git a/src/transport/tcp_lwip/TCP_lwIP.h b/src/transport/tcp_lwip/TCP_lwIP.h index 9726d692970..008acaf3e51 100644 --- a/src/transport/tcp_lwip/TCP_lwIP.h +++ b/src/transport/tcp_lwip/TCP_lwIP.h @@ -26,7 +26,7 @@ #include "INETDefs.h" #include "ILifecycle.h" -#include "IPvXAddress.h" +#include "Address.h" #include "TCPCommand_m.h" #include "lwip/tcp.h" #include "LwipTcpStackIf.h" @@ -62,14 +62,14 @@ class INET_API TCP_lwIP : public cSimpleModule, public LwipTcpStackIf, public IL // sometime pcb is NULL (tipically when send a RESET ) virtual void ip_output(LwipTcpLayer::tcp_pcb *pcb, - IPvXAddress const& src, IPvXAddress const& dest, void *tcpseg, int len); + Address const& src, Address const& dest, void *tcpseg, int len); virtual err_t lwip_tcp_event(void *arg, LwipTcpLayer::tcp_pcb *pcb, LwipTcpLayer::lwip_event event, struct pbuf *p, u16_t size, err_t err); virtual void lwip_free_pcb_event(LwipTcpLayer::tcp_pcb* pcb); - virtual netif* ip_route(IPvXAddress const & ipAddr); + virtual netif* ip_route(Address const & ipAddr); virtual void notifyAboutIncomingSegmentProcessing(LwipTcpLayer::tcp_pcb *pcb, uint32 seqNo, const void *dataptr, int len); diff --git a/src/transport/tcp_lwip/TcpLwipConnection.cc b/src/transport/tcp_lwip/TcpLwipConnection.cc index 3e1a15f9b24..7eeae1496f8 100644 --- a/src/transport/tcp_lwip/TcpLwipConnection.cc +++ b/src/transport/tcp_lwip/TcpLwipConnection.cc @@ -136,7 +136,7 @@ void TcpLwipConnection::sendEstablishedMsg() TCPConnectInfo *tcpConnectInfo = new TCPConnectInfo(); - IPvXAddress localAddr(pcbM->local_ip.addr), remoteAddr(pcbM->remote_ip.addr); + Address localAddr(pcbM->local_ip.addr), remoteAddr(pcbM->remote_ip.addr); tcpConnectInfo->setConnId(connIdM); tcpConnectInfo->setLocalAddr(localAddr); @@ -208,7 +208,7 @@ void TcpLwipConnection::fillStatusInfo(TCPStatusInfo &statusInfo) //TODO statusInfo.setFin_ack_rcvd(pcbM->fin_ack_rcvd); } -void TcpLwipConnection::listen(IPvXAddress& localAddr, unsigned short localPort) +void TcpLwipConnection::listen(Address& localAddr, unsigned short localPort) { onCloseM = false; tcpLwipM.getLwipTcpLayer()->tcp_bind(pcbM, NULL, localPort); @@ -221,8 +221,8 @@ void TcpLwipConnection::listen(IPvXAddress& localAddr, unsigned short localPort) totalSentM = 0; } -void TcpLwipConnection::connect(IPvXAddress& localAddr, unsigned short localPort, - IPvXAddress& remoteAddr, unsigned short remotePort) +void TcpLwipConnection::connect(Address& localAddr, unsigned short localPort, + Address& remoteAddr, unsigned short remotePort) { onCloseM = false; struct ip_addr src_addr; diff --git a/src/transport/tcp_lwip/TcpLwipConnection.h b/src/transport/tcp_lwip/TcpLwipConnection.h index 50378eb28b2..d0050af86ba 100644 --- a/src/transport/tcp_lwip/TcpLwipConnection.h +++ b/src/transport/tcp_lwip/TcpLwipConnection.h @@ -22,7 +22,7 @@ #include "INETDefs.h" -#include "IPvXAddress.h" +#include "Address.h" #include "lwip/tcp.h" #include "TCPSegment.h" #include "TCPCommand_m.h" @@ -79,9 +79,9 @@ class INET_API TcpLwipConnection void sendIndicationToApp(int code); - void listen(IPvXAddress& localAddr, unsigned short localPort); + void listen(Address& localAddr, unsigned short localPort); - void connect(IPvXAddress& localAddr, unsigned short localPort, IPvXAddress& remoteAddr, + void connect(Address& localAddr, unsigned short localPort, Address& remoteAddr, unsigned short remotePort); void close(); diff --git a/src/transport/tcp_lwip/lwip/include/ipv4/lwip/ip_addr.h b/src/transport/tcp_lwip/lwip/include/ipv4/lwip/ip_addr.h index 4fe204dfe64..5f4775c666f 100644 --- a/src/transport/tcp_lwip/lwip/include/ipv4/lwip/ip_addr.h +++ b/src/transport/tcp_lwip/lwip/include/ipv4/lwip/ip_addr.h @@ -36,7 +36,7 @@ #include "lwip/inet.h" -#include "IPvXAddress.h" +#include "Address.h" #ifdef __cplusplus //extern "C" { @@ -47,7 +47,7 @@ #endif PACK_STRUCT_BEGIN struct ip_addr { - PACK_STRUCT_FIELD(IPvXAddress addr); + PACK_STRUCT_FIELD(Address addr); } PACK_STRUCT_STRUCT; PACK_STRUCT_END #ifdef PACK_STRUCT_USE_INCLUDES @@ -121,7 +121,7 @@ extern const struct ip_addr ip_addr_broadcast; (u32_t)((d) & 0xff)) #define ip_addr_set(dest, src) (dest)->addr = \ - ((src) == NULL ? IPvXAddress() : \ + ((src) == NULL ? Address() : \ (src)->addr) /** * Determine if two address are on the same network. diff --git a/src/transport/tcp_nsc/TCP_NSC.cc b/src/transport/tcp_nsc/TCP_NSC.cc index c2f29f14ceb..b9330d94a00 100644 --- a/src/transport/tcp_nsc/TCP_NSC.cc +++ b/src/transport/tcp_nsc/TCP_NSC.cc @@ -57,10 +57,10 @@ Define_Module(TCP_NSC); //static member variables: -const IPvXAddress TCP_NSC::localInnerIpS("1.0.0.253"); -const IPvXAddress TCP_NSC::localInnerMaskS("255.255.255.0"); -const IPvXAddress TCP_NSC::localInnerGwS("1.0.0.254"); -const IPvXAddress TCP_NSC::remoteFirstInnerIpS("2.0.0.1"); +const Address TCP_NSC::localInnerIpS("1.0.0.253"); +const Address TCP_NSC::localInnerMaskS("255.255.255.0"); +const Address TCP_NSC::localInnerGwS("1.0.0.254"); +const Address TCP_NSC::remoteFirstInnerIpS("2.0.0.1"); const char * TCP_NSC::stackNameParamNameS = "stackName"; const char * TCP_NSC::bufferSizeParamNameS = "stackBufferSize"; @@ -170,7 +170,7 @@ TCP_NSC::TCP_NSC() // return mapped remote ip in host byte order // if addrP not exists in map, it's create a new nsc addr -uint32_t TCP_NSC::mapRemote2Nsc(IPvXAddress const& addrP) +uint32_t TCP_NSC::mapRemote2Nsc(Address const& addrP) { Remote2NscMap::iterator i = remote2NscMapM.find(addrP); if (i != remote2NscMapM.end()) @@ -179,7 +179,7 @@ uint32_t TCP_NSC::mapRemote2Nsc(IPvXAddress const& addrP) } // get first free remote NSC IP - uint32_t ret = remoteFirstInnerIpS.get4().getInt(); + uint32_t ret = remoteFirstInnerIpS.toIPv4().getInt(); Nsc2RemoteMap::iterator j; for ( j = nsc2RemoteMapM.begin(); j != nsc2RemoteMapM.end(); j++) { @@ -199,7 +199,7 @@ uint32_t TCP_NSC::mapRemote2Nsc(IPvXAddress const& addrP) // return original remote ip from remote NSC IP // assert if IP not exists in map // nscAddrP in host byte order! -IPvXAddress const & TCP_NSC::mapNsc2Remote(uint32_t nscAddrP) +Address const & TCP_NSC::mapNsc2Remote(uint32_t nscAddrP) { Nsc2RemoteMap::iterator i = nsc2RemoteMapM.find(nscAddrP); @@ -388,7 +388,7 @@ void TCP_NSC::handleIpInputMessage(TCPSegment* tcpsegP) ih->protocol = 6; // TCP ih->check = 0; ih->saddr = htonl(nscSrcAddr); - ih->daddr = htonl(localInnerIpS.get4().getInt()); + ih->daddr = htonl(localInnerIpS.toIPv4().getInt()); tcpEV << this << ": modified to: IP " << ih->version << " len " << ih->ihl << " protocol " << (unsigned int)(ih->protocol) @@ -846,7 +846,7 @@ void TCP_NSC::gettime(unsigned int *secP, unsigned int *usecP) void TCP_NSC::sendToIP(const void *dataP, int lenP) { - IPvXAddress src, dest; + Address src, dest; const nsc_iphdr *iph = (const nsc_iphdr *)dataP; int ipHdrLen = 4 * iph->ihl; @@ -903,8 +903,8 @@ void TCP_NSC::sendToIP(const void *dataP, int lenP) // send over IPv4 IPv4ControlInfo *controlInfo = new IPv4ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(src.get4()); - controlInfo->setDestAddr(dest.get4()); + controlInfo->setSrcAddr(src.toIPv4()); + controlInfo->setDestAddr(dest.toIPv4()); tcpseg->setControlInfo(controlInfo); output = "ipOut"; @@ -914,8 +914,8 @@ void TCP_NSC::sendToIP(const void *dataP, int lenP) // send over IPv6 IPv6ControlInfo *controlInfo = new IPv6ControlInfo(); controlInfo->setProtocol(IP_PROT_TCP); - controlInfo->setSrcAddr(src.get6()); - controlInfo->setDestAddr(dest.get6()); + controlInfo->setSrcAddr(src.toIPv6()); + controlInfo->setDestAddr(dest.toIPv6()); tcpseg->setControlInfo(controlInfo); output = "ipv6Out"; diff --git a/src/transport/tcp_nsc/TCP_NSC.h b/src/transport/tcp_nsc/TCP_NSC.h index f4d7f29e4b7..12438ec63db 100644 --- a/src/transport/tcp_nsc/TCP_NSC.h +++ b/src/transport/tcp_nsc/TCP_NSC.h @@ -33,7 +33,7 @@ #include // NSC. We need this here to derive from classes #include "ILifecycle.h" -#include "IPvXAddress.h" +#include "Address.h" #include "TCPCommand_m.h" #include "TCP_NSC_Connection.h" @@ -117,13 +117,13 @@ class INET_API TCP_NSC : public cSimpleModule, ISendCallback, IInterruptCallback // return mapped remote IP in host byte order // if addrP not exists in map, it's create a new nsc addr, and insert it to map - u_int32_t mapRemote2Nsc(IPvXAddress const& addrP); + u_int32_t mapRemote2Nsc(Address const& addrP); // return original remote ip from mapped ip // assert if not exists in map // nscAddrP has IP in host byte order // x == mapNsc2Remote(mapRemote2Nsc(x)) - IPvXAddress const & mapNsc2Remote(u_int32_t nscAddrP); + Address const & mapNsc2Remote(u_int32_t nscAddrP); // send a connection established msg to application layer void sendEstablishedMsg(TCP_NSC_Connection &connP); @@ -143,8 +143,8 @@ class INET_API TCP_NSC : public cSimpleModule, ISendCallback, IInterruptCallback protected: typedef std::map TcpAppConnMap; // connId-to-TCP_NSC_Connection - typedef std::map Nsc2RemoteMap; - typedef std::map Remote2NscMap; + typedef std::map Nsc2RemoteMap; + typedef std::map Remote2NscMap; typedef std::map SockPair2ConnIdMap; // Maps: @@ -169,10 +169,10 @@ class INET_API TCP_NSC : public cSimpleModule, ISendCallback, IInterruptCallback int curAddrCounterM; // incr, when set curLocalAddr, decr when "felhasznaltam" TCP_NSC_Connection *curConnM; // store current connection in connect/listen command - static const IPvXAddress localInnerIpS; // local NSC IP addr - static const IPvXAddress localInnerGwS; // local NSC gateway IP addr - static const IPvXAddress localInnerMaskS; // local NSC Network Mask - static const IPvXAddress remoteFirstInnerIpS; // first remote NSC IP addr + static const Address localInnerIpS; // local NSC IP addr + static const Address localInnerGwS; // local NSC gateway IP addr + static const Address localInnerMaskS; // local NSC Network Mask + static const Address remoteFirstInnerIpS; // first remote NSC IP addr static const char * stackNameParamNameS; // name of stackname parameter static const char * bufferSizeParamNameS; // name of buffersize parameter diff --git a/src/transport/tcp_nsc/TCP_NSC_Connection.cc b/src/transport/tcp_nsc/TCP_NSC_Connection.cc index bdee33d69e4..d957ae37187 100644 --- a/src/transport/tcp_nsc/TCP_NSC_Connection.cc +++ b/src/transport/tcp_nsc/TCP_NSC_Connection.cc @@ -157,7 +157,7 @@ void TCP_NSC_Connection::listen(INetStack &stackP, SockPair &inetSockPairP, Sock nscSockPairP.localM.ipAddrM.set(IPv4Address(sockAddr.sin_addr.s_addr)); nscSockPairP.localM.portM = ntohs(sockAddr.sin_port); - nscSockPairP.remoteM.ipAddrM = IPvXAddress(); + nscSockPairP.remoteM.ipAddrM = Address(); nscSockPairP.remoteM.portM = -1; } diff --git a/src/transport/tcp_nsc/TCP_NSC_Connection.h b/src/transport/tcp_nsc/TCP_NSC_Connection.h index 62cbdf3012d..7a9cf75eceb 100644 --- a/src/transport/tcp_nsc/TCP_NSC_Connection.h +++ b/src/transport/tcp_nsc/TCP_NSC_Connection.h @@ -27,7 +27,7 @@ #include "INETDefs.h" -#include "IPvXAddress.h" +#include "Address.h" // forward declarations: class TCPConnectInfo; @@ -47,7 +47,7 @@ class INET_API TCP_NSC_Connection { public: SockAddr() : ipAddrM(), portM(-1) {} - IPvXAddress ipAddrM; + Address ipAddrM; unsigned short portM; inline bool operator<(const SockAddr& b) const diff --git a/src/transport/udp/UDP.cc b/src/transport/udp/UDP.cc index be8705f1d3c..5509e55030e 100644 --- a/src/transport/udp/UDP.cc +++ b/src/transport/udp/UDP.cc @@ -221,7 +221,7 @@ void UDP::processCommandFromApp(cMessage *msg) else if (dynamic_cast(ctrl)) { UDPJoinMulticastGroupsCommand *cmd = (UDPJoinMulticastGroupsCommand*)ctrl; - std::vector addresses; + std::vector
addresses; std::vector interfaceIds; for (int i = 0; i < (int)cmd->getMulticastAddrArraySize(); i++) addresses.push_back(cmd->getMulticastAddr(i)); @@ -232,7 +232,7 @@ void UDP::processCommandFromApp(cMessage *msg) else if (dynamic_cast(ctrl)) { UDPLeaveMulticastGroupsCommand *cmd = (UDPLeaveMulticastGroupsCommand*)ctrl; - std::vector addresses; + std::vector
addresses; for (int i = 0; i < (int)cmd->getMulticastAddrArraySize(); i++) addresses.push_back(cmd->getMulticastAddr(i)); leaveMulticastGroups(sd, addresses); @@ -254,7 +254,7 @@ void UDP::processPacketFromApp(cPacket *appData) UDPSendCommand *ctrl = check_and_cast(appData->removeControlInfo()); SockDesc *sd = getOrCreateSocket(ctrl->getSockId(), appData->getArrivalGate()->getIndex()); - const IPvXAddress& destAddr = ctrl->getDestAddr().isUnspecified() ? sd->remoteAddr : ctrl->getDestAddr(); + const Address& destAddr = ctrl->getDestAddr().isUnspecified() ? sd->remoteAddr : ctrl->getDestAddr(); int destPort = ctrl->getDestPort() == -1 ? sd->remotePort : ctrl->getDestPort(); if (destAddr.isUnspecified() || destPort == -1) error("send: missing destination address or port when sending over unconnected port"); @@ -262,7 +262,7 @@ void UDP::processPacketFromApp(cPacket *appData) int interfaceId = ctrl->getInterfaceId(); if (interfaceId == -1 && destAddr.isMulticast()) { - std::map::iterator it = sd->multicastAddrs.find(destAddr); + std::map::iterator it = sd->multicastAddrs.find(destAddr); interfaceId = (it != sd->multicastAddrs.end() && it->second != -1) ? it->second : sd->multicastOutputInterfaceId; } sendDown(appData, sd->localAddr, sd->localPort, destAddr, destPort, interfaceId, sd->multicastLoop, sd->ttl, sd->typeOfService); @@ -287,8 +287,8 @@ void UDP::processUDPPacket(UDPPacket *udpPacket) return; } - IPvXAddress srcAddr; - IPvXAddress destAddr; + Address srcAddr; + Address destAddr; bool isMulticast, isBroadcast; int srcPort = udpPacket->getSourcePort(); int destPort = udpPacket->getDestinationPort(); @@ -375,7 +375,7 @@ void UDP::processICMPError(cPacket *pk) { // extract details from the error message, then try to notify socket that sent bogus packet int type, code; - IPvXAddress localAddr, remoteAddr; + Address localAddr, remoteAddr; ushort localPort, remotePort; #ifdef WITH_IPv4 @@ -481,7 +481,7 @@ void UDP::processUndeliverablePacket(UDPPacket *udpPacket, cObject *ctrl) } } -void UDP::bind(int sockId, int gateIndex, const IPvXAddress& localAddr, int localPort) +void UDP::bind(int sockId, int gateIndex, const Address& localAddr, int localPort) { if (sockId == -1) error("sockId in BIND message not filled in"); @@ -519,7 +519,7 @@ void UDP::bind(int sockId, int gateIndex, const IPvXAddress& localAddr, int loca } } -void UDP::connect(int sockId, int gateIndex, const IPvXAddress& remoteAddr, int remotePort) +void UDP::connect(int sockId, int gateIndex, const Address& remoteAddr, int remotePort) { if (remoteAddr.isUnspecified()) error("connect: unspecified remote address"); @@ -534,7 +534,7 @@ void UDP::connect(int sockId, int gateIndex, const IPvXAddress& remoteAddr, int EV << "Socket connected: " << *sd << "\n"; } -UDP::SockDesc *UDP::createSocket(int sockId, int gateIndex, const IPvXAddress& localAddr, int localPort) +UDP::SockDesc *UDP::createSocket(int sockId, int gateIndex, const Address& localAddr, int localPort) { // create and fill in SockDesc SockDesc *sd = new SockDesc(sockId, gateIndex); @@ -609,7 +609,7 @@ ushort UDP::getEphemeralPort() return lastEphemeralPort; } -UDP::SockDesc *UDP::findFirstSocketByLocalAddress(const IPvXAddress& localAddr, ushort localPort) +UDP::SockDesc *UDP::findFirstSocketByLocalAddress(const Address& localAddr, ushort localPort) { SocketsByPortMap::iterator it = socketsByPortMap.find(localPort); if (it == socketsByPortMap.end()) @@ -625,7 +625,7 @@ UDP::SockDesc *UDP::findFirstSocketByLocalAddress(const IPvXAddress& localAddr, return NULL; } -UDP::SockDesc *UDP::findSocketForUnicastPacket(const IPvXAddress& localAddr, ushort localPort, const IPvXAddress& remoteAddr, ushort remotePort) +UDP::SockDesc *UDP::findSocketForUnicastPacket(const Address& localAddr, ushort localPort, const Address& remoteAddr, ushort remotePort) { SocketsByPortMap::iterator it = socketsByPortMap.find(localPort); if (it == socketsByPortMap.end()) @@ -651,7 +651,7 @@ UDP::SockDesc *UDP::findSocketForUnicastPacket(const IPvXAddress& localAddr, ush return socketBoundToAnyAddress; } -std::vector UDP::findSocketsForMcastBcastPacket(const IPvXAddress& localAddr, ushort localPort, const IPvXAddress& remoteAddr, ushort remotePort, bool isMulticast, bool isBroadcast) +std::vector UDP::findSocketsForMcastBcastPacket(const Address& localAddr, ushort localPort, const Address& remoteAddr, ushort remotePort, bool isMulticast, bool isBroadcast) { ASSERT(isMulticast || isBroadcast); std::vector result; @@ -685,7 +685,7 @@ std::vector UDP::findSocketsForMcastBcastPacket(const IPvXAddres return result; } -void UDP::sendUp(cPacket *payload, SockDesc *sd, const IPvXAddress& srcAddr, ushort srcPort, const IPvXAddress& destAddr, ushort destPort, int interfaceId, int ttl, unsigned char tos) +void UDP::sendUp(cPacket *payload, SockDesc *sd, const Address& srcAddr, ushort srcPort, const Address& destAddr, ushort destPort, int interfaceId, int ttl, unsigned char tos) { EV << "Sending payload up to socket sockId=" << sd->sockId << "\n"; @@ -707,7 +707,7 @@ void UDP::sendUp(cPacket *payload, SockDesc *sd, const IPvXAddress& srcAddr, ush numPassedUp++; } -void UDP::sendUpErrorIndication(SockDesc *sd, const IPvXAddress& localAddr, ushort localPort, const IPvXAddress& remoteAddr, ushort remotePort) +void UDP::sendUpErrorIndication(SockDesc *sd, const Address& localAddr, ushort localPort, const Address& remoteAddr, ushort remotePort) { cMessage *notifyMsg = new cMessage("ERROR", UDP_I_ERROR); UDPErrorIndication *udpCtrl = new UDPErrorIndication(); @@ -721,7 +721,7 @@ void UDP::sendUpErrorIndication(SockDesc *sd, const IPvXAddress& localAddr, usho send(notifyMsg, "appOut", sd->appGateIndex); } -void UDP::sendDown(cPacket *appData, const IPvXAddress& srcAddr, ushort srcPort, const IPvXAddress& destAddr, ushort destPort, +void UDP::sendDown(cPacket *appData, const Address& srcAddr, ushort srcPort, const Address& destAddr, ushort destPort, int interfaceId, bool multicastLoop, int ttl, unsigned char tos) { if (destAddr.isUnspecified()) @@ -743,8 +743,8 @@ void UDP::sendDown(cPacket *appData, const IPvXAddress& srcAddr, ushort srcPort, EV << "Sending app packet " << appData->getName() << " over IPv4.\n"; IPv4ControlInfo *ipControlInfo = new IPv4ControlInfo(); ipControlInfo->setProtocol(IP_PROT_UDP); - ipControlInfo->setSrcAddr(srcAddr.get4()); - ipControlInfo->setDestAddr(destAddr.get4()); + ipControlInfo->setSrcAddr(srcAddr.toIPv4()); + ipControlInfo->setDestAddr(destAddr.toIPv4()); ipControlInfo->setInterfaceId(interfaceId); ipControlInfo->setMulticastLoop(multicastLoop); ipControlInfo->setTimeToLive(ttl); @@ -760,8 +760,8 @@ void UDP::sendDown(cPacket *appData, const IPvXAddress& srcAddr, ushort srcPort, EV << "Sending app packet " << appData->getName() << " over IPv6.\n"; IPv6ControlInfo *ipControlInfo = new IPv6ControlInfo(); ipControlInfo->setProtocol(IP_PROT_UDP); - ipControlInfo->setSrcAddr(srcAddr.get6()); - ipControlInfo->setDestAddr(destAddr.get6()); + ipControlInfo->setSrcAddr(srcAddr.toIPv6()); + ipControlInfo->setDestAddr(destAddr.toIPv6()); ipControlInfo->setInterfaceId(interfaceId); ipControlInfo->setMulticastLoop(multicastLoop); ipControlInfo->setHopLimit(ttl); @@ -797,7 +797,7 @@ UDP::SockDesc *UDP::getOrCreateSocket(int sockId, int gateIndex) if (it != socketsByIdMap.end()) return it->second; - return createSocket(sockId, gateIndex, IPvXAddress(), -1); + return createSocket(sockId, gateIndex, Address(), -1); } void UDP::setTimeToLive(SockDesc *sd, int ttl) @@ -830,13 +830,13 @@ void UDP::setReuseAddress(SockDesc *sd, bool reuseAddr) sd->reuseAddr = reuseAddr; } -void UDP::joinMulticastGroups(SockDesc *sd, const std::vector& multicastAddresses, const std::vector interfaceIds) +void UDP::joinMulticastGroups(SockDesc *sd, const std::vector
& multicastAddresses, const std::vector interfaceIds) { int multicastAddressesLen = multicastAddresses.size(); int interfaceIdsLen = interfaceIds.size(); for (int k = 0; k < multicastAddressesLen; k++) { - const IPvXAddress &multicastAddr = multicastAddresses[k]; + const Address &multicastAddr = multicastAddresses[k]; int interfaceId = k < interfaceIdsLen ? interfaceIds[k] : -1; ASSERT(multicastAddr.isMulticast()); sd->multicastAddrs[multicastAddr] = interfaceId; @@ -859,23 +859,23 @@ void UDP::joinMulticastGroups(SockDesc *sd, const std::vector& mult } } -void UDP::addMulticastAddressToInterface(InterfaceEntry *ie, const IPvXAddress& multicastAddr) +void UDP::addMulticastAddressToInterface(InterfaceEntry *ie, const Address& multicastAddr) { if (!multicastAddr.isIPv6()) { #ifdef WITH_IPv4 - ie->ipv4Data()->joinMulticastGroup(multicastAddr.get4()); + ie->ipv4Data()->joinMulticastGroup(multicastAddr.toIPv4()); #endif } else { #ifdef WITH_IPv6 - ie->ipv6Data()->assignAddress(multicastAddr.get6(), false, SimTime::getMaxTime(), SimTime::getMaxTime()); + ie->ipv6Data()->assignAddress(multicastAddr.toIPv6(), false, SimTime::getMaxTime(), SimTime::getMaxTime()); #endif } } -void UDP::leaveMulticastGroups(SockDesc *sd, const std::vector& multicastAddresses) +void UDP::leaveMulticastGroups(SockDesc *sd, const std::vector
& multicastAddresses) { for (unsigned int i = 0; i < multicastAddresses.size(); i++) sd->multicastAddrs.erase(multicastAddresses[i]); diff --git a/src/transport/udp/UDP.h b/src/transport/udp/UDP.h index 17fbbd1aeea..954ae974714 100644 --- a/src/transport/udp/UDP.h +++ b/src/transport/udp/UDP.h @@ -53,8 +53,8 @@ class INET_API UDP : public cSimpleModule, public ILifecycle bool isBound; bool onlyLocalPortIsSet; bool reuseAddr; - IPvXAddress localAddr; - IPvXAddress remoteAddr; + Address localAddr; + Address remoteAddr; int localPort; int remotePort; bool isBroadcast; @@ -62,7 +62,7 @@ class INET_API UDP : public cSimpleModule, public ILifecycle bool multicastLoop; int ttl; unsigned char typeOfService; - std::map multicastAddrs; // key: multicast address; value: output interface Id or -1 + std::map multicastAddrs; // key: multicast address; value: output interface Id or -1 }; typedef std::list SockDescList; // might contain duplicated local addresses if their reuseAddr flag is set @@ -100,9 +100,9 @@ class INET_API UDP : public cSimpleModule, public ILifecycle // socket handling virtual SockDesc *getSocketById(int sockId); virtual SockDesc *getOrCreateSocket(int sockId, int gateIndex); - virtual SockDesc *createSocket(int sockId, int gateIndex, const IPvXAddress& localAddr, int localPort); - virtual void bind(int sockId, int gateIndex, const IPvXAddress& localAddr, int localPort); - virtual void connect(int sockId, int gateIndex, const IPvXAddress& remoteAddr, int remotePort); + virtual SockDesc *createSocket(int sockId, int gateIndex, const Address& localAddr, int localPort); + virtual void bind(int sockId, int gateIndex, const Address& localAddr, int localPort); + virtual void connect(int sockId, int gateIndex, const Address& remoteAddr, int remotePort); virtual void close(int sockId); virtual void clearAllSockets(); virtual void setTimeToLive(SockDesc *sd, int ttl); @@ -111,20 +111,20 @@ class INET_API UDP : public cSimpleModule, public ILifecycle virtual void setMulticastOutputInterface(SockDesc *sd, int interfaceId); virtual void setMulticastLoop(SockDesc *sd, bool loop); virtual void setReuseAddress(SockDesc *sd, bool reuseAddr); - virtual void joinMulticastGroups(SockDesc *sd, const std::vector& multicastAddresses, const std::vector interfaceIds); - virtual void leaveMulticastGroups(SockDesc *sd, const std::vector& multicastAddresses); - virtual void addMulticastAddressToInterface(InterfaceEntry *ie, const IPvXAddress& multicastAddr); + virtual void joinMulticastGroups(SockDesc *sd, const std::vector
& multicastAddresses, const std::vector interfaceIds); + virtual void leaveMulticastGroups(SockDesc *sd, const std::vector
& multicastAddresses); + virtual void addMulticastAddressToInterface(InterfaceEntry *ie, const Address& multicastAddr); // ephemeral port virtual ushort getEphemeralPort(); - virtual SockDesc *findSocketForUnicastPacket(const IPvXAddress& localAddr, ushort localPort, const IPvXAddress& remoteAddr, ushort remotePort); - virtual std::vector findSocketsForMcastBcastPacket(const IPvXAddress& localAddr, ushort localPort, const IPvXAddress& remoteAddr, ushort remotePort, bool isMulticast, bool isBroadcast); - virtual SockDesc *findFirstSocketByLocalAddress(const IPvXAddress& localAddr, ushort localPort); - virtual void sendUp(cPacket *payload, SockDesc *sd, const IPvXAddress& srcAddr, ushort srcPort, const IPvXAddress& destAddr, ushort destPort, int interfaceId, int ttl, unsigned char tos); - virtual void sendDown(cPacket *appData, const IPvXAddress& srcAddr, ushort srcPort, const IPvXAddress& destAddr, ushort destPort, int interfaceId, bool multicastLoop, int ttl, unsigned char tos); + virtual SockDesc *findSocketForUnicastPacket(const Address& localAddr, ushort localPort, const Address& remoteAddr, ushort remotePort); + virtual std::vector findSocketsForMcastBcastPacket(const Address& localAddr, ushort localPort, const Address& remoteAddr, ushort remotePort, bool isMulticast, bool isBroadcast); + virtual SockDesc *findFirstSocketByLocalAddress(const Address& localAddr, ushort localPort); + virtual void sendUp(cPacket *payload, SockDesc *sd, const Address& srcAddr, ushort srcPort, const Address& destAddr, ushort destPort, int interfaceId, int ttl, unsigned char tos); + virtual void sendDown(cPacket *appData, const Address& srcAddr, ushort srcPort, const Address& destAddr, ushort destPort, int interfaceId, bool multicastLoop, int ttl, unsigned char tos); virtual void processUndeliverablePacket(UDPPacket *udpPacket, cObject *ctrl); - virtual void sendUpErrorIndication(SockDesc *sd, const IPvXAddress& localAddr, ushort localPort, const IPvXAddress& remoteAddr, ushort remotePort); + virtual void sendUpErrorIndication(SockDesc *sd, const Address& localAddr, ushort localPort, const Address& remoteAddr, ushort remotePort); // process an ICMP error packet virtual void processICMPError(cPacket *icmpErrorMsg); // TODO use ICMPMessage diff --git a/src/util/XMLUtils.cc b/src/util/XMLUtils.cc index c0bb997f9ad..b3e134a9054 100644 --- a/src/util/XMLUtils.cc +++ b/src/util/XMLUtils.cc @@ -1,6 +1,6 @@ #include "XMLUtils.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" const cXMLElement* getUniqueChild(const cXMLElement *node, const char *name) { @@ -118,7 +118,7 @@ IPv4Address getParameterIPAddressValue(const cXMLElement *ptr, const char *name, { const cXMLElement *xvalue = getUniqueChildIfExists(ptr, name); if (xvalue) - return IPvXAddressResolver().resolve(xvalue->getNodeValue()).get4(); + return AddressResolver().resolve(xvalue->getNodeValue()).toIPv4(); else return def; } @@ -126,7 +126,7 @@ IPv4Address getParameterIPAddressValue(const cXMLElement *ptr, const char *name, IPv4Address getParameterIPAddressValue(const cXMLElement *ptr, const char *name) { const cXMLElement *xvalue = getUniqueChild(ptr, name); - return IPvXAddressResolver().resolve(xvalue->getNodeValue()).get4(); + return AddressResolver().resolve(xvalue->getNodeValue()).toIPv4(); } double getParameterDoubleValue(const cXMLElement *ptr, const char *name, double def) diff --git a/src/util/headerserializers/sctp/SCTPSerializer.cc b/src/util/headerserializers/sctp/SCTPSerializer.cc index 0cd5d8e19ee..5bac870cf74 100644 --- a/src/util/headerserializers/sctp/SCTPSerializer.cc +++ b/src/util/headerserializers/sctp/SCTPSerializer.cc @@ -149,7 +149,7 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint struct init_ipv4_address_parameter *ipv4addr = (struct init_ipv4_address_parameter*) (((unsigned char *)ic) + size_init_chunk + parPtr); ipv4addr->type = htons(INIT_PARAM_IPV4); ipv4addr->length = htons(8); - ipv4addr->address = htonl(initChunk->getAddresses(i).get4().getInt()); + ipv4addr->address = htonl(initChunk->getAddresses(i).toIPv4().getInt()); parPtr += sizeof(struct init_ipv4_address_parameter); } int chunkcount = initChunk->getSepChunksArraySize(); @@ -259,7 +259,7 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint struct init_ipv4_address_parameter *ipv4addr = (struct init_ipv4_address_parameter*) (((unsigned char *)iac) + size_init_chunk + parPtr); ipv4addr->type = htons(INIT_PARAM_IPV4); ipv4addr->length = htons(8); - ipv4addr->address = htonl(initAckChunk->getAddresses(i).get4().getInt()); + ipv4addr->address = htonl(initAckChunk->getAddresses(i).toIPv4().getInt()); parPtr += 8; } int chunkcount = initAckChunk->getSepChunksArraySize(); @@ -451,12 +451,12 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint // deliver info: struct heartbeat_info *hbi = (struct heartbeat_info*) (((unsigned char*)hbc) + size_heartbeat_chunk); - IPvXAddress addr = heartbeatChunk->getRemoteAddr(); + Address addr = heartbeatChunk->getRemoteAddr(); simtime_t time = heartbeatChunk->getTimeField(); - int32 infolen = sizeof(addr.get4().getInt()) + sizeof(uint32); + int32 infolen = sizeof(addr.toIPv4().getInt()) + sizeof(uint32); hbi->type = htons(1); // mandatory hbi->length = htons(infolen+4); - HBI_ADDR(hbi) = htonl(addr.get4().getInt()); + HBI_ADDR(hbi) = htonl(addr.toIPv4().getInt()); HBI_TIME(hbi) = htonl((uint32)time.dbl()); break; } @@ -488,13 +488,13 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint } else { - IPvXAddress addr = heartbeatAckChunk->getRemoteAddr(); - infolen = sizeof(addr.get4().getInt()) + sizeof(uint32); + Address addr = heartbeatAckChunk->getRemoteAddr(); + infolen = sizeof(addr.toIPv4().getInt()) + sizeof(uint32); hbi->type = htons(1); // mandatory hbi->length = htons(infolen+4); simtime_t time = heartbeatAckChunk->getTimeField(); - HBI_ADDR(hbi) = htonl(addr.get4().getInt()); + HBI_ADDR(hbi) = htonl(addr.toIPv4().getInt()); HBI_TIME(hbi) = htonl((uint32)time.dbl()); } break; @@ -680,7 +680,7 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint struct init_ipv4_address_parameter *ipv4addr = (struct init_ipv4_address_parameter*) (((unsigned char *)asconf) + sizeof(struct asconf_chunk) + parPtr); ipv4addr->type = htons(INIT_PARAM_IPV4); ipv4addr->length = htons(8); - ipv4addr->address = htonl(asconfChunk->getAddressParam().get4().getInt()); + ipv4addr->address = htonl(asconfChunk->getAddressParam().toIPv4().getInt()); parPtr += 8; for (unsigned int i=0; igetAsconfParamsArraySize(); i++) { @@ -697,7 +697,7 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint struct init_ipv4_address_parameter *ipv4addr = (struct init_ipv4_address_parameter*) (((unsigned char *)asconf) + sizeof(struct asconf_chunk) + parPtr); ipv4addr->type = htons(INIT_PARAM_IPV4); ipv4addr->length = htons(8); - ipv4addr->address = htonl(addip->getAddressParam().get4().getInt()); + ipv4addr->address = htonl(addip->getAddressParam().toIPv4().getInt()); parPtr += 8; ip->length = htons(addip->getByteLength()); break; @@ -712,7 +712,7 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint struct init_ipv4_address_parameter *ipv4addr = (struct init_ipv4_address_parameter*) (((unsigned char *)asconf) + sizeof(struct asconf_chunk) + parPtr); ipv4addr->type = htons(INIT_PARAM_IPV4); ipv4addr->length = htons(8); - ipv4addr->address = htonl(deleteip->getAddressParam().get4().getInt()); + ipv4addr->address = htonl(deleteip->getAddressParam().toIPv4().getInt()); parPtr += 8; ip->length = htons(deleteip->getByteLength()); break; @@ -727,7 +727,7 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint struct init_ipv4_address_parameter *ipv4addr = (struct init_ipv4_address_parameter*) (((unsigned char *)asconf) + sizeof(struct asconf_chunk) + parPtr); ipv4addr->type = htons(INIT_PARAM_IPV4); ipv4addr->length = htons(8); - ipv4addr->address = htonl(setip->getAddressParam().get4().getInt()); + ipv4addr->address = htonl(setip->getAddressParam().toIPv4().getInt()); parPtr += 8; ip->length = htons(setip->getByteLength()); break; @@ -775,7 +775,7 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint ip->correlation_id = htonl(addip->getRequestCorrelationId()); struct init_ipv4_address_parameter *ipv4addr = (struct init_ipv4_address_parameter*) (((unsigned char *)errorc) + sizeof(struct error_cause) + 8); ipv4addr->length = htons(8); - ipv4addr->address = htonl(addip->getAddressParam().get4().getInt()); + ipv4addr->address = htonl(addip->getAddressParam().toIPv4().getInt()); parPtr += 8; ip->length = htons(addip->getByteLength()); break; @@ -790,7 +790,7 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint struct init_ipv4_address_parameter *ipv4addr = (struct init_ipv4_address_parameter*) (((unsigned char *)errorc) + sizeof(struct error_cause) + 8); ipv4addr->type = htons(INIT_PARAM_IPV4); ipv4addr->length = htons(8); - ipv4addr->address = htonl(deleteip->getAddressParam().get4().getInt()); + ipv4addr->address = htonl(deleteip->getAddressParam().toIPv4().getInt()); parPtr += 8; ip->length = htons(deleteip->getByteLength()); break; @@ -805,7 +805,7 @@ int32 SCTPSerializer::serialize(const SCTPMessage *msg, unsigned char *buf, uint struct init_ipv4_address_parameter *ipv4addr = (struct init_ipv4_address_parameter*) (((unsigned char *)errorc) + sizeof(struct error_cause) + 8); ipv4addr->type = htons(INIT_PARAM_IPV4); ipv4addr->length = htons(8); - ipv4addr->address = htonl(setip->getAddressParam().get4().getInt()); + ipv4addr->address = htonl(setip->getAddressParam().toIPv4().getInt()); parPtr += 8; ip->length = htons(setip->getByteLength()); break; @@ -1133,7 +1133,7 @@ void SCTPSerializer::parse(const uint8_t *buf, uint32 bufsize, SCTPMessage *dest const struct init_ipv4_address_parameter *v4addr; v4addr = (struct init_ipv4_address_parameter*) (((unsigned char*)init_chunk) + size_init_chunk + parptr); chunk->setAddressesArraySize(++addrcounter); - IPvXAddress localv4Addr(IPv4Address(ntohl(v4addr->address))); + Address localv4Addr(IPv4Address(ntohl(v4addr->address))); chunk->setAddresses(addrcounter-1, localv4Addr); chunklen += 8; break; @@ -1145,7 +1145,7 @@ void SCTPSerializer::parse(const uint8_t *buf, uint32 bufsize, SCTPMessage *dest ipv6addr = (struct init_ipv6_address_parameter*) (((unsigned char*)init_chunk) + size_init_chunk + parptr); IPv6Address ipv6Addr = IPv6Address(ipv6addr->address[0], ipv6addr->address[1], ipv6addr->address[2], ipv6addr->address[3]); - IPvXAddress localv6Addr(ipv6Addr); + Address localv6Addr(ipv6Addr); sctpEV3<<"address"<setAddressesArraySize(++addrcounter); chunk->setAddresses(addrcounter-1, localv6Addr); @@ -1334,7 +1334,7 @@ void SCTPSerializer::parse(const uint8_t *buf, uint32 bufsize, SCTPMessage *dest const struct init_ipv4_address_parameter *v4addr; v4addr = (struct init_ipv4_address_parameter*) (((unsigned char*)iac) + size_init_ack_chunk + parptr); chunk->setAddressesArraySize(++addrcounter); - IPvXAddress localv4Addr(IPv4Address(ntohl(v4addr->address))); + Address localv4Addr(IPv4Address(ntohl(v4addr->address))); chunk->setAddresses(addrcounter-1, localv4Addr); chunklen += 8; break; @@ -1347,7 +1347,7 @@ void SCTPSerializer::parse(const uint8_t *buf, uint32 bufsize, SCTPMessage *dest IPv6Address ipv6Addr = IPv6Address(ipv6addr->address[0], ipv6addr->address[1], ipv6addr->address[2], ipv6addr->address[3]); sctpEV3<<"address"<setAddressesArraySize(++addrcounter); chunk->setAddresses(addrcounter-1, localv6Addr); @@ -1593,7 +1593,7 @@ void SCTPSerializer::parse(const uint8_t *buf, uint32 bufsize, SCTPMessage *dest { parptr += sizeof(struct heartbeat_info); parcounter++; - chunk->setRemoteAddr(IPvXAddress(IPv4Address(ntohl(HBI_ADDR(hbi))))); + chunk->setRemoteAddr(Address(IPv4Address(ntohl(HBI_ADDR(hbi))))); chunk->setTimeField(ntohl((uint32)HBI_TIME(hbi))); } else @@ -1804,7 +1804,7 @@ void SCTPSerializer::parse(const uint8_t *buf, uint32 bufsize, SCTPMessage *dest } else { - IPvXAddress localAddr(IPv4Address(ntohl(ipv4addr->address))); + Address localAddr(IPv4Address(ntohl(ipv4addr->address))); chunk->setAddressParam(localAddr); } while(cLen > size_asconf_chunk+parptr) @@ -1823,7 +1823,7 @@ void SCTPSerializer::parse(const uint8_t *buf, uint32 bufsize, SCTPMessage *dest addip->setRequestCorrelationId(ntohl(ipparam->correlation_id)); const struct init_ipv4_address_parameter *v4addr1; v4addr1 = (struct init_ipv4_address_parameter*) (((unsigned char*)asconf_chunk) + size_asconf_chunk + parptr + size_addip_parameter); - IPvXAddress localAddr(IPv4Address(ntohl(v4addr1->address))); + Address localAddr(IPv4Address(ntohl(v4addr1->address))); addip->setAddressParam(localAddr); chunk->addAsconfParam(addip); break; @@ -1837,7 +1837,7 @@ void SCTPSerializer::parse(const uint8_t *buf, uint32 bufsize, SCTPMessage *dest deleteip->setRequestCorrelationId(ntohl(ipparam->correlation_id)); const struct init_ipv4_address_parameter *v4addr2; v4addr2 = (struct init_ipv4_address_parameter*) (((unsigned char*)asconf_chunk) + size_asconf_chunk + parptr + size_addip_parameter); - IPvXAddress localAddr(IPv4Address(ntohl(v4addr2->address))); + Address localAddr(IPv4Address(ntohl(v4addr2->address))); deleteip->setAddressParam(localAddr); chunk->addAsconfParam(deleteip); break; @@ -1851,7 +1851,7 @@ void SCTPSerializer::parse(const uint8_t *buf, uint32 bufsize, SCTPMessage *dest priip->setRequestCorrelationId(ntohl(ipparam->correlation_id)); const struct init_ipv4_address_parameter *v4addr3; v4addr3 = (struct init_ipv4_address_parameter*) (((unsigned char*)asconf_chunk) + size_asconf_chunk + parptr + size_addip_parameter); - IPvXAddress localAddr(IPv4Address(ntohl(v4addr3->address))); + Address localAddr(IPv4Address(ntohl(v4addr3->address))); priip->setAddressParam(localAddr); chunk->addAsconfParam(priip); break; diff --git a/src/util/headerserializers/tcp/TCPSerializer.cc b/src/util/headerserializers/tcp/TCPSerializer.cc index 13f536f6a6b..ff02fe83c55 100644 --- a/src/util/headerserializers/tcp/TCPSerializer.cc +++ b/src/util/headerserializers/tcp/TCPSerializer.cc @@ -141,7 +141,7 @@ int TCPSerializer::serialize(const TCPSegment *tcpseg, int TCPSerializer::serialize(const TCPSegment *tcpseg, unsigned char *buf, unsigned int bufsize, - const IPvXAddress &srcIp, const IPvXAddress &destIp) + const Address &srcIp, const Address &destIp) { int writtenbytes = serialize(tcpseg, buf, bufsize); struct tcphdr *tcp = (struct tcphdr*) (buf); @@ -235,7 +235,7 @@ void TCPSerializer::parse(const unsigned char *buf, unsigned int bufsize, TCPSeg } uint16_t TCPSerializer::checksum(const void *addr, unsigned int count, - const IPvXAddress &srcIp, const IPvXAddress &destIp) + const Address &srcIp, const Address &destIp) { uint32_t sum = TCPIPchecksum::_checksum(addr, count); diff --git a/src/util/headerserializers/tcp/TCPSerializer.h b/src/util/headerserializers/tcp/TCPSerializer.h index 28f439a1018..48809f812b6 100644 --- a/src/util/headerserializers/tcp/TCPSerializer.h +++ b/src/util/headerserializers/tcp/TCPSerializer.h @@ -20,7 +20,7 @@ #define __TCPSERIALIZER_H -#include "IPvXAddress.h" +#include "Address.h" #include "headers/defs.h" @@ -54,7 +54,7 @@ class TCPSerializer * TODO pseudoheader vs IPv6, pseudoheder.len should calculated by the serialize(), etc */ int serialize(const TCPSegment *source, unsigned char *destbuf, unsigned int bufsize, - const IPvXAddress &srcIp, const IPvXAddress &destIp); + const Address &srcIp, const Address &destIp); /** * Puts a packet sniffed from the wire into a TCPSegment. @@ -67,7 +67,7 @@ class TCPSerializer * Calculate checksum with pseudo header. */ static uint16_t checksum(const void *addr, unsigned int count, - const IPvXAddress &srcIp, const IPvXAddress &destIp); + const Address &srcIp, const Address &destIp); }; #endif diff --git a/tests/misc/dlltest/SomeUDPApp.cc b/tests/misc/dlltest/SomeUDPApp.cc index 9113df54546..fa7a3f87e5e 100644 --- a/tests/misc/dlltest/SomeUDPApp.cc +++ b/tests/misc/dlltest/SomeUDPApp.cc @@ -21,7 +21,7 @@ #include "SomeUDPApp.h" #include "UDPControlInfo_m.h" -#include "IPvXAddressResolver.h" +#include "AddressResolver.h" @@ -31,7 +31,7 @@ int SomeUDPApp::counter; void SomeUDPApp::initialize(int stage) { - // because of IPvXAddressResolver, we need to wait until interfaces are registered, + // because of AddressResolver, we need to wait until interfaces are registered, // address auto-assignment takes place etc. if (stage!=3) return; @@ -50,7 +50,7 @@ void SomeUDPApp::initialize(int stage) cStringTokenizer tokenizer(destAddrs); const char *token; while ((token = tokenizer.nextToken())!=NULL) - destAddresses.push_back(IPvXAddressResolver().resolve(token)); + destAddresses.push_back(AddressResolver().resolve(token)); if (destAddresses.empty()) return; @@ -61,7 +61,7 @@ void SomeUDPApp::initialize(int stage) scheduleAt((double)par("sendInterval"), timer); } -IPvXAddress SomeUDPApp::chooseDestAddr() +Address SomeUDPApp::chooseDestAddr() { int k = intrand(destAddresses.size()); return destAddresses[k]; @@ -75,7 +75,7 @@ void SomeUDPApp::sendPacket() cMessage *payload = new cMessage(msgName); payload->setLength(msgLength); - IPvXAddress destAddr = chooseDestAddr(); + Address destAddr = chooseDestAddr(); sendToUDP(payload, localPort, destAddr, destPort); numSent++; diff --git a/tests/misc/dlltest/SomeUDPApp.h b/tests/misc/dlltest/SomeUDPApp.h index c74847a00ab..137f7aca866 100644 --- a/tests/misc/dlltest/SomeUDPApp.h +++ b/tests/misc/dlltest/SomeUDPApp.h @@ -38,7 +38,7 @@ class SomeUDPApp : public UDPAppBase std::string nodeName; int localPort, destPort; int msgLength; - std::vector destAddresses; + std::vector
destAddresses; static int counter; // counter for generating a global number for each packet @@ -46,7 +46,7 @@ class SomeUDPApp : public UDPAppBase int numReceived; // chooses random destination address - virtual IPvXAddress chooseDestAddr(); + virtual Address chooseDestAddr(); virtual void sendPacket(); virtual void processPacket(cMessage *msg); diff --git a/tests/module/DHCP_2.test b/tests/module/DHCP_2.test index 07704640903..292d17dfc78 100644 --- a/tests/module/DHCP_2.test +++ b/tests/module/DHCP_2.test @@ -11,7 +11,7 @@ import inet.base.NotificationBoard; import inet.linklayer.loopback.LoopbackInterface; import inet.networklayer.autorouting.ipv4.IPv4NodeConfigurator; import inet.networklayer.common.InterfaceTable; -import inet.networklayer.ipv4.RoutingTable; +import inet.networklayer.ipv4.IPv4RoutingTable; module DHCPNode @@ -33,7 +33,7 @@ module DHCPNode interfaceTable: InterfaceTable { @display("p=66,145"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { @display("p=68,216"); } configurator: IPv4NodeConfigurator { diff --git a/tests/module/UDPSocket_1.test b/tests/module/UDPSocket_1.test index ce32945fc8a..8bc519e5f2c 100644 --- a/tests/module/UDPSocket_1.test +++ b/tests/module/UDPSocket_1.test @@ -26,9 +26,9 @@ void TestApp::activity() UDPSocket s; s.setOutputGate(gate("udpOut")); s.setMulticastLoop(false); - s.connect(IPvXAddress("10.0.0.1"), 1000); + s.connect(Address("10.0.0.1"), 1000); s.bind(100); - s.connect(IPvXAddress("10.0.0.2"), 2000); + s.connect(Address("10.0.0.2"), 2000); } } diff --git a/tests/module/lib/TcpTestClient.cc b/tests/module/lib/TcpTestClient.cc index df7e59047ab..ce2b735b04f 100644 --- a/tests/module/lib/TcpTestClient.cc +++ b/tests/module/lib/TcpTestClient.cc @@ -159,10 +159,10 @@ void TcpTestClient::handleSelfMessage(cMessage *msg) const char *connectAddress = par("connectAddress"); int connectPort = par("connectPort"); - socket.bind(*localAddress ? IPvXAddress(localAddress) : IPvXAddress(), localPort); + socket.bind(*localAddress ? Address(localAddress) : Address(), localPort); if (par("active").boolValue()) - socket.connect(IPvXAddress(par("connectAddress")), connectPort); + socket.connect(Address(par("connectAddress")), connectPort); else socket.listenOnce(); scheduleNextSend(); diff --git a/tests/module/lib/TestIGMP.cc b/tests/module/lib/TestIGMP.cc index 03b6fa45149..a22f46b9bdf 100644 --- a/tests/module/lib/TestIGMP.cc +++ b/tests/module/lib/TestIGMP.cc @@ -6,7 +6,7 @@ #include "IPv4InterfaceData.h" #include "IPv4ControlInfo.h" #include "IInterfaceTable.h" -#include "IRoutingTable.h" +#include "IIPv4RoutingTable.h" #include "IGMPv2.h" enum StateKind diff --git a/tests/traci/Car.ned b/tests/traci/Car.ned index bfd094b7f15..657413cf417 100644 --- a/tests/traci/Car.ned +++ b/tests/traci/Car.ned @@ -24,7 +24,7 @@ import inet.base.NotificationBoard; import inet.networklayer.common.InterfaceTable; import inet.applications.traci.TraCITestApp; 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; @@ -54,7 +54,7 @@ module Car parameters: @display("p=60,459"); } - routingTable: RoutingTable { + routingTable: IPv4RoutingTable { parameters: IPForward = true; routerId = "";