ns2 code for trust calculation
#1

hai
i am doing project regarding trustworthy architecture for sensor networks,
for that i need materials for trust calculation for each node in the network
Reply
#2
how to implement trust in AODV routing under NS-2.31
Reply
#3
trust_entry::trust_entry()
{
//Initialize as per your need.
}
trust_entry::~trust_entry()
{
//Deconstruct as per your need.
}

trust_entry* trust_store::trust_lookup(nsaddr_t node_id)
{
trust_entry *rp = trusthead.lh_first;
for (; rp; rp = rp->trust_link.le_next) {
if (rp->node_id == node_id)
break;
}
return rp;
}
void trust_store::trust_delete(nsaddr_t node_id)
{
trust_entry *rp = trust_lookup(node_id);

if (rp)
{
LIST_REMOVE(rp, trust_link);
delete rp;
}

}

trust_entry*
trust_store::trust_insert(nsaddr_t node_id, nsaddr_t prev_node,nsaddr_t next_node,int32_t trust_value)
{
trust_entry *rp;
//assert(tr_lookup(dst_seq_no) == 0);
rp = new trust_entry;
assert(rp);
rp->node_id = node_id;
rp->prev_node = prev_node;
rp->next_node = next_node;
rp->trust_value = trust_value;
LIST_INSERT_HEAD(&trusthead, rp, trust_link);
return rp;
}

trust_entry* trust_store::trust_update(nsaddr_t node_id,nsaddr_t prev_node,nsaddr_t next_node, int32_t trust_value)
{ trust_delete(node_id);
trust_insert(node_id,prev_node,next_node,trust_value);
}
In rtable.h add below code


class trust_entry
{
friend class AODV;
friend class trust_store;
public:
trust_entry();
~trust_entry();
nsaddr_t node_id;
nsaddr_t prev_node;
nsaddr_t next_node;
int32_t trust_value;
protected:
LIST_ENTRY(trust_entry) trust_link;
};

class trust_store
{

public:
trust_store()
{
LIST_INIT(&trusthead);
}
trust_entry* head()
{
return trusthead.lh_first;
}
trust_entry* trust_insert(nsaddr_t node_id,nsaddr_t prev_node,nsaddr_t next_node,int32_t trust_value);
trust_entry* trust_lookup(nsaddr_t node_id);
void trust_delete(nsaddr_t node_id);
trust_entry* trust_update(nsaddr_t node_id,nsaddr_t prev_node,nsaddr_t next_node, int32_t trust_value);
private:
LIST_HEAD(trust_head, trust_entry) trusthead;
};

while using in aodv code i.e. aodv.cc add below code to aodv.h

trust_store tstore;

and if u want to access functions for adding route entry in aodv.cc then add below code in aodv.cc
tstore.trust_insert(node_id,prev_node,next_node,trust_value);
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: ns2 trust calculation, ns2 code for trust aodv, matlab code for sinr calculation in wireless network, example code ns2 for trust, calculation of far and frr matlab code, trust computation source code sensor, trust value calculation,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
Sad wormhole attack is implemented in ns2 at the network layer 13 4,502 05-05-2017, 01:42 PM
Last Post: neeraj.kuntal90
  saddle support design calculation 2 1,432 28-04-2017, 12:58 PM
Last Post: jaseela123d
  ns2 projects for wormhole attack detection with source code free download 8 6,357 15-04-2017, 04:31 PM
Last Post: Guest
  ns2 source code free download broadcast message 1 980 15-04-2017, 02:42 PM
Last Post: jaseela123d
  ant colony optimization ns2 code 1 954 15-04-2017, 01:27 PM
Last Post: jaseela123d
  pneumatic vice design calculation pdf 1 1,176 13-04-2017, 11:47 AM
Last Post: jaseela123d
  sinkhole aodv implementation code in ns2 1 890 10-04-2017, 04:25 PM
Last Post: jaseela123d
  matlab code for adaptive differential pulse code modulation 1 1,131 04-04-2017, 11:49 AM
Last Post: jaseela123d
  ns2 coding for clone node attack 1 756 04-04-2017, 10:04 AM
Last Post: jaseela123d
  load balancing using ns2 1 742 31-03-2017, 01:55 PM
Last Post: jaseela123d

Forum Jump: