construction of two different packet for a protocol / a simulation in NS2

拟墨画扇 提交于 2020-01-25 12:23:48

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!