Hi, Just set ch->size() to the simulated length of the message. No matter the real size of your structure, for the simulation only ch->size() is taken into account.
Regards, fran On Tuesday 19 September 2006 12:31, Ramzi Tka wrote: > Hi evry body, > I'am writing 802.16 mesh extensions for ns-2. My problem is that I can't > find the right way to send a control message (DSCH-MSH message). In fact, > this type of message have a variable length, since they are composed of a > sequence of data structures whose total number varies in function of the > number of neighbors. When i looked to the 802.11 implementation in order to > have some ideas, I found that the control messages have always a constant > length and structure: > > Packet *p = Packet::alloc(); > hdr_cmn* ch = HDR_CMN(p); > struct cts_frame *cf = (struct cts_frame*)p->access(hdr_mac::offset_); > > assert(pktCTRL_ == 0); > > ch->uid() = 0; > ch->ptype() = PT_MAC; > ch->size() = phymib_.getCTSlen(); > > > ch->iface() = -2; > ch->error() = 0; > //ch->direction() = hdr_cmn::DOWN; > bzero(cf, MAC_HDR_LEN); > > cf->cf_fc.fc_protocol_version = MAC_ProtocolVersion; > cf->cf_fc.fc_type = MAC_Type_Control; > cf->cf_fc.fc_subtype = MAC_Subtype_CTS; > cf->cf_fc.fc_to_ds = 0; > cf->cf_fc.fc_from_ds = 0; > cf->cf_fc.fc_more_frag = 0; > cf->cf_fc.fc_retry = 0; > cf->cf_fc.fc_pwr_mgt = 0; > cf->cf_fc.fc_more_data = 0; > cf->cf_fc.fc_wep = 0; > cf->cf_fc.fc_order = 0; > in 802.111, the developper has just to fill a given structure fields. How > about 80.16 ? > Could someone help me please! > Thanks in advance > Ramzi Tka
