Channel)
A channel is a relatively underlying thing in a communication system. You can regard it as a communication medium (sound can be transmitted through air, and the function of a channel is similar to that of air ). A channel in wireless communication can be a specific channel in a frequency or CDMA.
The channel in the program, I would rather think of it as something like a pipe, after all, its role is to connect the two ends of the communication. Let's take a look at the cable channels in NS2. The corresponding code is in channel. h and channel. CC. The approximate structure is as follows:
Its main external interface is to send sendup to the upper layer and accept Recv;
Let's take a look at the wireless channel. The source code is also in channel. {H, CC. The general structure is as follows:
The main interfaces are the same as above. The channel should provide infrastructure to support Mac carrier listening, competition, and conflict detection. However, in ns2.29, this part of code is commented out. Note: all the attributes of the wireless channel are not listed, but the main attributes and interfaces are shown. The following figure shows the attributes of the wireless channel.
Phy (Physical Layer)
In the introduction of PHY, we first introduce a general connection "Up and down" connector biconnector, which is roughly as follows:
It serves as a connection between upper and lower layers. It is a virtual base class and can be inherited by all components with upper and lower hierarchies. PHY is one of them. Biconnector has the uptarget and downtarget pointers pointing to and pointing to the bottom, through which you can quickly find the components "above" and "below. In addition, it also has the sendup, senddown and Recv interfaces for upstream (send) and downstream (send) communication;
Phy inherits biconnector, which naturally has all the attributes and interfaces of biconnector, but it also has its own important attributes. Please take a look at them first:
Some attributes inherited from biconnector are omitted in the figure. Note that both chnl_link _ and node_link _ in the figure are struct types. The definition of chnl_link _ is as follows:
Struct {
Phy * le_next;/* next element */
Phy ** le_prev;/* address of previous next element */
}
The function of chnl_link _ Is to concatenate the Phys connected to the same channel,
Node_link _ is used to concatenate all the tokens connected to the same node. The other two attributes node points to the node, and the channel points to the channel.
The main function of the physical layer is to control the access to the channel and set the bandwidth and computing transmission time.
The combination of channel and PHY can be seen as what we call the physical layer. In this way, the channel is responsible for simulating the transmission of data packets on the physical layer, and the PHY is responsible for controlling channel transmission.
Address: http://happywh583.blog.sohu.com/67413384.html