问题
I am implementing a new protocol in NS2. I stucked at a point. kindly help me. Is it possible to make two different type of packets(containing different headers) in the same simulation In my protocol there are two types of struct header { } . At few instances i want to use one and at other instances want to use another.One of the structure has very less fields compared to other so this would reduce the size of packet i'm sending. Is it possible ? and if yes then how to implement that?
回答1:
You have to create two kind of types, like in the code below, you should type it twice:
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 9 ;# number of mobilenodes
set val(rp) DSDV ;# routing protocol
and you need val2
来源:https://stackoverflow.com/questions/29644365/construction-of-two-different-packet-for-a-protocol-a-simulation-in-ns2