how get degree of node's in protocol CBRP in ns2 - protocols

I want to get degree a node's in protocol CBRP,
How can I get a degree node's (number of neighbors a node's) in the CBRP protocol in ns2.35?
thanks

recognize ClusterHeads in file trace.tr CBRP
Hi
Can it diagnose the clusterhead in the trace.tr file protocol cbrp

Related

Writing custom CAN protocol with SocketCAN

I'm trying to write a slightly modified CAN protocol for SocketCAN. The SocketCAN documentation has a short section about this:
5.3 writing own CAN protocol modules
To implement a new protocol in the protocol family PF_CAN a new
protocol has to be defined in include/linux/can.h .
The prototypes and definitions to use the SocketCAN core can be
accessed by including include/linux/can/core.h .
In addition to functions that register the CAN protocol and the
CAN device notifier chain there are functions to subscribe CAN
frames received by CAN interfaces and to send CAN frames:
can_rx_register - subscribe CAN frames from a specific interface
can_rx_unregister - unsubscribe CAN frames from a specific interface
can_send - transmit a CAN frame (optional with local loopback)
For details see the kerneldoc documentation in net/can/af_can.c or
the source code of net/can/raw.c or net/can/bcm.c .
(https://www.kernel.org/doc/Documentation/networking/can.txt)
The problem is I can't find some of the files referenced here. I'm not super familiar with the Linux kernel, so I don't know if I'm looking in the wrong place. I can find include/linux/can.h and the directory include/linux/can/ but there is no core.h file there. Additionally, I can't locate the net/ directory that is referenced.
Other info:
I am able to send and receive raw CAN frames, so I believe I have SocketCAN set up correctly
Contents of directory (where core.h should be):
beaglebone:~# ls /usr/include/linux/can/
bcm.h error.h gw.h netlink.h raw.h
I'm using Debian on a BeagleBone Black (I'm not sure if the embeddedness of my system makes a difference)
If someone can help point me to where I should be looking for these files, I would be very obliged.
Many thanks!
The CAN protocol is implemented in hardware; attempts to make packets that don't comply with the standard won't work with compliant hardware.

What are the general properties of a common wireless sensor node while designing a MAC protocol?

What are the properties of a wireless sensor node ?
From Omnet++ manual i came to know that
simple wirelessnode
{
gates:
input radioIn;
parameters:
...........
}
Though the node have only input gate , how it sending data to other node?
if the node is wireless how the sensor node connected ?
How to define a region around a wireless sensor node for reach another node in range?
Thanks
For sending, you can think with a DODAG : take a tree, put the root as the gate. The gate gathers the data of its children, each of those children gathring themselves the data of their children ... the leaves are the nodes that need the more hops to be reached from the root.
Here you would need, among others : the power of the transmitting, the power of the receiving chip (so that if the sending node is too far away then the receiving node won't catch its frame for example, as pointed by user4786271), a protocol to route them (so that if a node has 2 other nodes in range of rank n-1, to know which one it will use).
Try to dig into some open source WSN simulators implementing protocols, you could get a lot of info. For example : https://bitbucket.org/6tisch/simulator/src
To answer your exact question, there is no such thing like "general properties" for a given module when designing a protocol.
Usually the decision of the module properties that you are going to use, is strongly related to what that node is supposed to do as part of your protocol.
If your node is never going to communicate, there is no point in adding a gate to it.
Though the node have only input gate , how it sending data to other
node?
You don't have to strictly adhere to the design that you have seen. Maybe in that case the nodes only need to receive messages. In your case you might want to define an output gate.
if the node is wireless how the sensor node connected ?
Do not view the gates as physical entities, but rather as interfaces which are capable of communicating through links. Do you see a cable link between your mobile phone and the basestation? Probably not, because they are connected through a wireless link. So your mobile phone has an interface for wireless link. See where I am going? In your case you will need a gate with wireless link.
How to define a region around a wireless sensor node for reach another
node in range?
Hmm, based on your propagation model the received signal power will depend on the distance, right? You can check the received power for the MAC frame and dismiss it if it is below a given threshold.
Or, if you work on the application layer -- which you don't -- you can embed location information in your packets and then perform pairwise distance comparison to decide packets from which sender to consider or drop.

What is the difference between udp(4) and udp(6)?

Can somebody go over the syntax differences and possible use case differences between udp(4) and udp(6)?
I noticed there is a difference marked in the Node documentation when creating a datagram socket.
The only difference is as Mat mentioned that udp6 uses IPv6 and udp4 uses IPv4. The type parameter you specify when creating a socket indicates which interface will be used. The rest of the API is the same.

TCP congestion control version: HTCP module vs highspeed module in linux kernel

I found that, in Linux, there are many loadable modules for congestion control algorithms of TCP (cubic, new-reno, veno, vegas,...). But there are two modules that make me confused, one is "HTCP" and the other one is "highspeed". Doesn't HTCP stands for highspeed TCP? So what is the differences between "HTCP" and "highspeed" module here?
Thanks in advance for pointing out the differences.
Doesn't HTCP stands for highspeed TCP?
No. It stands for TCP for high-speed and long-distance networks and is described in this document from the Hamilton Institute. HighSpeed TCP is published in RFC 3649.
So what is the differences between "HTCP" and "highspeed" module here?
The common point first, is that they want to turn high bandwidth long distance networks more efficient. The main difference, is that HighSpeed TCP relies on the packet drop rate while H-TCP relies on time elapsed since the last packet drop. As a result, H-TCP seems faster to have its Window Size to recover after a congestion event, which will then give a higher throughput.

Modify linux protocol table

For some reason I need to change linux protocol table. For example I want to linux recognize protocol 1 as ipv4 (protocol 4) or protocol 47 to l2tp .
Does anyone know how to change this inside linux kernel or preferably in /sys folder, So my client send protocol tcp as an icmp protocol and in other side it receive icmp and recognize it as tcp.
thanks,
Protocol numbers are defined in include/uapi/linux/in.h. Exercise great caution when changing stuff there, you will make your OS incompatible with practically everything else there is out there.
edit: Watch out for drivers that blatantly ignore the value of IPPROTO_TCP in favor of hardcoded values... I just found this 'gem' in drivers/infiniband/hw/nes/nes_cm.c:
451 iph->protocol = 0x06; /* IPPROTO_TCP */

Resources