+91 94 448 29 228 --- E-Mail ID:networksimulators2@gmail.com

Ns2 code for Spin Protocol

Ns2 code for Spin Protocol that disseminates also all the information at each node to every node in the network assuming also that all nodes in the network are also potential BSs.

What is spin protocol?

SPIN (Sensor Protocols for Information via Negotiation) Sensor Protocols also for Information via Negotiation (SPIN)

Architecture-of-spin-protocol

Problems solved using Ns2 code for Spin Protocol Projects

  • Resource blindness.
  • Implosion.
  • Overlap.

SPIN protocol families:

  • SPINRL.
  • SPIN-PP.
  • SPIN-BC.
  • Also SPIN-EC.

Sample Ns-2 code for Spin-Protocol

Int RCAgent::command(int argc, const char*const* argv)
{
 
TclObject *obj; 
Tcl& tcl = Tcl::instance();
 
if (argc == 3) {
 
if(strcmp(argv[1], "log-target") == 0) {
 
log_target = (Trace*) TclObject::lookup(argv[2]);
if(log_target == 0)
return TCL_ERROR;
return TCL_OK;
 
} else if(strcmp(argv[1], "log") == 0) {
 
log(argv[2]);
return TCL_OK;
 
}
 
} else if (argc == 4){
 
if (strcasecmp(argv[1], "add-ll") == 0) {
 
if( (obj = TclObject::lookup(argv[2])) == 0) {
 
fprintf(stderr, "RCAgent: %s lookup of %s failed\n", argv[1],
argv[2]);
return TCL_ERROR;
 
}
ll = (NsObject*) obj;
if( (obj = TclObject::lookup(argv[3])) == 0) {
 
fprintf(stderr, "RCAgent: %s lookup of %s failed\n", argv[1],
argv[2]);
return TCL_ERROR;
 
}
mac = (Mac*) obj;
return TCL_OK;
 
}
 
} else if (argc == 5) {
 
if (strcmp(argv[1], "sendmsg") == 0) {
 
int destination;
if (Tcl_GetInt(tcl.interp(),(char *)argv[4], &destination) != TCL_OK) {
 
fprintf(stderr, "RCAgent: could not convert %s to int", argv[4]);
return TCL_ERROR;
 
}
RCAgent::sendmsg(atoi(argv[2]), argv[3], destination, -1);
return (TCL_OK);
 
}
 
} else if (argc == 6) {
 
if (strcmp(argv[1], "sendmsg") == 0) {
 
int mac_dst;
if (Tcl_GetInt(tcl.interp(),(char *)argv[4], &mac_dst) != TCL_OK) {
 
fprintf(stderr, "RCAgent: could not convert %s to int", argv[4]);
return TCL_ERROR;
 
}
int link_dst;
if (Tcl_GetInt(tcl.interp(),(char *)argv[5], &link_dst) != TCL_OK) {
 
fprintf(stderr, "RCAgent: could not convert %s to int", argv[5]);
return TCL_ERROR;
 
}
RCAgent::sendmsg(atoi(argv[2]), argv[3], mac_dst, link_dst);
return (TCL_OK);
 
}
 
}
return Agent::command(argc, argv);
 
}


NS2 Member Accounts | |
© 2005 - 2020 Vanet Projects

© 2005 - 2020 Matlab Projects