Hello ns-suers, i can't send unicast or broadcast packets, I try several solutions, but no one works!
1- the code for unicast (sendUnicast(destination)) Packet* pkt = allocpkt(); hdr_cmn* hdrcmn = hdr_cmn::access(pkt); hdr_ip* iphdr = hdr_ip::access(pkt); hdr_monitor* hdrret = hdr_monitor::access(pktret); hdrret->ret = 1; hdrcmn->next_hop_ = destination; hdrcmn->prev_hop_ = this->addr(); hdrcmn->direction() = hdr_cmn::DOWN; hdrcmn->ptype() = PT_MONITOR; hdrcmn->addr_type() = NS_AF_INET; //NS_AF_INET; // NS_AF_ILINK; // setting the ip header iphdr->saddr() = this->addr(); iphdr->sport() = 100; // 1-254 iphdr->daddr() = destination; iphdr->dport() = 100; // 1-254 iphdr->ttl() = 32; fprintf(stderr, "%d send request to %d \n",this->addr(),destination); // send Scheduler::instance().schedule(ll, pkt, 0.0); 2- for broadcast i use the following code Packet* pkt = allocpkt(); hdr_gc* hdr = hdr_gc::access(pkt); hdr->ret = 0; hdr_cmn* hdrcmn = hdr_cmn::access(pkt); hdr_ip* iphdr = hdr_ip::access(pkt); hdrcmn->next_hop_ = IP_BROADCAST; hdrcmn->prev_hop_ = this->addr(); hdrcmn->direction() = hdr_cmn::DOWN; hdrcmn->ptype() = PT_GC; hdrcmn->addr_type() = NS_AF_INET; //NS_AF_NONE NS_AF_ILINK; // setting the ip header iphdr->saddr() = this->addr(); iphdr->sport() = 101; // 1-254 iphdr->daddr() = IP_BROADCAST; iphdr->dport() = 101; // 1-254 iphdr->ttl() = 1; fprintf(stderr, "%d send bcats\n",this->addr()); // send Scheduler::instance().schedule(ll, pkt, 0.0); // _target ! --------------------- i use the TclObject::lookup to get the ll. Thanks Regards