目录
ns3对网络组建的抽象
节点、应用程序、信道、网络设备
节点:Node
ns3将基本的计算设备抽象为Node(具体表现为C++的Node类)
- Node对应于host, end system…
- 可以把Node视为一台裸机(需要我们安装软硬件功能部件,如:应用程序、协议栈、计算机外设等)
应用程序:Application
应用程序Application:网络的数据的发起方和接收方,其为运行在Node内部的用户软件。
- ns-3中有很多Application类的子类,如:
- UdpEchoClient
- UdpEchoServer
信道:Channel
信道Channel:数据传输的通道(可以视为通信的子网或者网络)。如:有线、无线、卫星、LTE……
- 在现实世界中,网卡通过双绞线连接到以太网中;
- 对应网络模拟世界中,(安装对应的网络设备的)网络节点Node通过网络设备连接到信道Channel中。
the basic communication subnetwork abstraction is called the channel and is represented in C++ by the class Channel.
Channel类:提供相应的方法来管理通信子网对象,将节点连接到通信子网中。
- A Channel specialization may model something as simple as a wire
- The specialized Channel can also model things as complicated as a large Ethernet switch . 以太网交换机
- or three-dimensional space full of obstructions in the case of wireless networks. 无线网络中充满障碍的三维空间
常见的Channel:
- CsmaChannel:可以建模实现csma(carrier sense multiple access)的通信子网
- PointToPointChannel
- WiFiChannel
网络设备:Net Device
ns-3中NetDevice抽象包括两个部分:
- software driver:设备驱动程序
- simulated hardware:仿真硬件
NetDevice 被安装到Node中,使当前Node能够和其他Node构建网络(借助Channel)
Just as in a real computer, a Node may be connected to more than one Channel via multiple NetDevices.
拓扑辅助类:Topology Helpers
为什么需要Helpers类?
核心: 简化网络拓扑配置,将那些机械的重复性的配置操作用Helper实现
Helpers示例
- PointToPointHelper
- InternetStackHelper
- Ipv4AddressHelper
- UdpEchoServerHelper
- UdpEchoClientHelper
相关类总结
Node
作用:
计算设备的抽象
NodeContainer
作用:
保存Node节点的容器,用于保存和跟踪节点,即快速访问某节点,进而对节点进行操作。
NodeList
作用:
创建的节点,都会加入到NodeList中进行管理。
Channel
作用:
实现了通讯子网的框架,具体通讯方式的实现是由子类完成的,如:
子类:
- ns3::BridgeChannel
- ns3::CsmaChannel
- ns3::PointToPointChannel
- ns3::SimpleChannel
- ns3::SpectrumChannel
- ns3::UanChannel
- ns3::WimaxChannel
- ns3::YansWifiChannel
继承关系图如下图所示:
NetDevice
作用:
几乎每一种连接的网络Channel有相应的NetDevice。如:PointToPointChannel对应的连接PointToPointNetDevice设备
子类:
- ns3::BridgeNetDevice
- ns3::CsmaNetDevice
- ns3::LoopbackNetDevice
- ns3::LrWpanNetDevice
- ns3::LteNetDevice
- ns3::PointToPointNetDevice
- ns3::SimpleChannel
- ns3::UanChannel
- ns3::WifiChannel
继承关系图如下图所示:
NetDeviceContainer
作用:
存储NetDevice,用于快速访问
Application
作用:
安装在网络节点上的应用程序。
子类:
- ns3::MyApp
- ns3::DhcpClient
- ns3::DhcpServer
- ns3::PacketSocketClient
- ns3::PacketSocketServer
- ns3::UdpClient
- ns3::UdpServer
继承关系图如下图所示:
ApplicationContainer
作用:
存储Node中的Application,用于快速访问。