What is  SPIN Protocol?Concepts involved in SPIN Protocol projects?

SPIN referred as Sensor Protocols for Information via Negotiation.It is used for distributing information efficient in a constrained Wireless Sensor Network.Nodes in SPIN Protocol is usually referred as meta-data for high level data descriptors.This is helpful in eliminating redundant data in a network.



Types of messages used in spin protocol:

  • ADY.
  • DATA.
  • REQ.


Concepts involved in spin routing protocol:

  • To realize traffic reduction for information dissemination.
  • Gossiping and ideal protocol for energy and bandwidth consumption.
  • For ensure the elimination of redundant data and transfer of useful information takes place.
  • For flat routing.

Architecture of spin routing:



Sample NS2 Code for spin routing protocol:

This code has enough information of what are the process are involved in sending and receiving messages in spin routing protocol.

void RCAgent::sendmsg(int data_size, const char* meta_data, int mac_dst, int link_dst)
Packet *p = allocpkt();
hdr_cmn *hdr = HDR_CMN(p);
hdr->size() = data_size;
  hdr_rca *rca_hdr = HDR_RCA(p);
rca_hdr->msg_type() = packetMsg_;
rca_hdr->rca_mac_dst() = mac_dst;
rca_hdr->rca_link_dst() = link_dst;
rca_hdr->rca_src() = mac->addr();
//printf("Sending: Type=%d data_size=%d\n\tMeta = %s\n\tSource=%x\n\tTarget = %x\n",rca_hdr->msg_type(), hdr->size(), rca_hdr->meta(),rca_hdr->rca_src(),rca_hdr->rca_mac_dst());
//printf("\tTime = %f\n",Scheduler::instance().clock());
//printf("\tLink_dst = %x\n",rca_hdr->rca_link_dst());
Scheduler::instance().schedule(ll, p, 0);
void RCAgent::recv(Packet* p, Handler*)
  hdr_cmn *hdr = HDR_CMN(p);
  hdr_rca *rca_hdr = HDR_RCA(p);
//printf("Receiving: Link_dst = %x, Type=%d data_size=%d\n\tMeta = %s, source = %d\n",rca_hdr->rca_link_dst(),rca_hdr->msg_type(), hdr->size(), rca_hdr->meta(),rca_hdr->rca_src());
packetMsg_ = rca_hdr->msg_type();
if (app_)
app_->recv(rca_hdr->rca_link_dst(), hdr->size(), rca_hdr->meta(),
 * didn't expect packet (or we're a null agent?)

Journal Support for NS2 Projects: (SPIN NS2)