NS-2によるマルチチャネルの実装
AODVで使ってみる
以下の変数を追加する.たぶん,class AODVかと.
NsObject *downtarget1_;
NsObject *downtarget2_;
NsObject *downtarget3_;
NsObject *downtarget4_;
NsObject *downtarget5_;
int AODV::command(int argc, const char*const* argv)に以下の変更
else if (strcasecmp (argv[1], "down-target-1") == 0) {
downtarget1_ = (NsObject *) TclObject::lookup(argv[2]);
return TCL_OK;
}
else if (strcasecmp (argv[1], "down-target-2") == 0) {
downtarget2_ = (NsObject *) TclObject::lookup(argv[2]);
return TCL_OK;
}
else if (strcasecmp (argv[1], "down-target-3") == 0) {
downtarget3_ = (NsObject *) TclObject::lookup(argv[2]);
return TCL_OK;
}
else if (strcasecmp (argv[1], "down-target-4") == 0) {
downtarget4_ = (NsObject *) TclObject::lookup(argv[2]);
return TCL_OK;
}
else if (strcasecmp (argv[1], "down-target-5") == 0) {
downtarget5_ = (NsObject *) TclObject::lookup(argv[2]);
return TCL_OK;
}
IEEE 802.11 DCF MACを使うならば
エラーを避けるために必要らしい.
#include "arp.h"
#include "ll.h"
#include "mac.h"
#include "mac-timers.h"
#include "mac-802_11.h"
#include "cmu-trace.h"
/*
multi-interface support
*/
#define NUM_NICS 5
...
int
Mac802_11::command(int argc, const char*const* argv)
{
if (argc == 3) {
if (strcmp(argv[1], "log-target") == 0) {
logtarget_ = (NsObject*) TclObject::lookup(argv[2]);
if(logtarget_ == 0)
return TCL_ERROR;
return TCL_OK;
} else if(strcmp(argv[1], "nodes") == 0) {
if(cache_) return TCL_ERROR;
/* multiple interface support
cache_node_count_ = atoi(argv[2]);
*/
cache_node_count_ = atoi(argv[2]) * NUM_NICS;
cache_ = new Host[cache_node_count_ + 1];
assert(cache_);
...
void
Mac802_11::recv_timer()
{
...
/* multiple interface support
*/
// if(dst != (u_int32_t)index_) {
if((dst/NUM_NICS) != (u_int32_t)(index_/NUM_NICS)) {
set_nav(mh->dh_duration);
}
...
最終更新:2008年07月14日 13:38