NodeContainer nodes ;
nodes.create(uint n);
或者nodes.add(Node xx / NodeContainer xx);
# 還有一些獲取其中點的操作 like:
NodeContainer.Get(uint n);
PointToPointHelper ppp; # 對應的還有CsmaHelper
#a 鏈路設置一些屬性
ppp.SetDeviceAttribute( string Attr, Value );
ppp.SetChannelAttribute( string Attr, Value );
# Helper類的install操作都是連接兩個層 , 然後會生成接口,這裏就是netDevice
NetDeviceContainer device = ppp.install(nodes);
- 然後網絡層和傳輸層都是InternetStackHelper創建的
InternetStackHelper stack;
#a 創建了Ipv4L4Protocol的兩個子類(UdpL4Protocol和TCpL4Protocol)和Ipv4L3Protoco(Ipv4L3Protocol和Ipv6L3Protocol)
stack.install( NodeContainer or Node );
- 傳輸層和網絡層的連接比較複雜,隱含在install()裏面了 ,但是此時網絡層和鏈路層並沒有連接起來,還需要IpInterface與device進行綁定
#a Ipv4AddressHelper生成ip
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
#a 分配ip給devices會返回IpInterface
Ipv4InterfaceContainer p2pInterfaces = address.Assign (p2pDevices);
question