Package: inet.linklayer.ethernet.basic
EthernetCsmaMac
simple moduleImplements the Ethernet CSMA/CD MAC protocol. It supports building both Ethernet CSMA/CD and Ethernet PLCA network interfaces.
Implements the exponential backoff algorithm, sends jam signal when a collision is detected, and maintains IFG between signals on the channel. It expects complete Ethernet MAC protocol frames containing an Ethernet MAC header and an Ethernet FCS.
The lower layer must be connected to a module implementing the ~IEthernetCsmaPhy C++ interface. There are two such modules: ~EthernetCsmaPhy and ~EthernetPlca. The former can be used to build an Ethernet CSMA/CD network interface, the latter can be used to build an Ethernet PLCA network interface.
<b>See also:</b> ~EthernetCsmaPhy, ~EthernetPlca, ~EthernetPlcaInterface
Inheritance diagram
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.
Used in compound modules
| Name | Type | Description |
|---|---|---|
| EthernetPlcaInterface | compound module |
Implements a network interface that is suitable for use in Ethernet 10BASE-T1S multidrop links. Such a multidrop link uses the Ethernet Phyisical Layer Collision Avoidance (PLCA) protocol. The protocol is defined in the IEEE 802.3cg-2019 standard. This network interface can be used in any network node module (e.g. ~StandardHost) that allows replacing its network interfaces. All network interfaces on the same multidrop link must use this module. |
Extends
| Name | Type | Description |
|---|---|---|
| MacProtocolBase | simple module |
Module base for different MAC protocols. |
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| displayStringTextFormat | string | "" |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
| interfaceTableModule | string | ||
| promiscuous | bool | false |
if true, all packets are received, otherwise only the ones with matching destination MAC address |
| mtu | int | 1500B | |
| fcsMode | string |
Properties
| Name | Value | Description |
|---|---|---|
| class | EthernetCsmaMac | |
| display | i=block/rxtx |
Gates
| Name | Direction | Size | Description |
|---|---|---|---|
| upperLayerIn | input | ||
| upperLayerOut | output | ||
| lowerLayerIn | input | ||
| lowerLayerOut | output |
Signals
| Name | Type | Unit | Description |
|---|---|---|---|
| carrierSenseChanged | int |
emitted when the incoming carrier sense signal changes, the value is 1 or 0 |
|
| stateChanged | int |
emitted when the state of the state machine changes, the value is one of IDLE, WAIT_IFG, TRANSMITTING, JAMMING, BACKOFF, RECEIVING |
|
| collisionChanged | int |
emitted when the incoming collision signal changes, the value is 1 or 0 |
Statistics
| Name | Title | Source | Record | Unit | Interpolation Mode | Description |
|---|---|---|---|---|---|---|
| collision | collision | collisionChanged | count, vector | sample-hold |
the time evolution of the incoming collision signal |
|
| carrierSense | carrier sense | carrierSenseChanged | count, vector | sample-hold |
the time evolution of the incoming carrier sense signal |
|
| state | state | stateChanged | count, vector | sample-hold |
the time evolution of the state of the state machine |
Source code
// // Implements the Ethernet CSMA/CD MAC protocol. It supports building // both Ethernet CSMA/CD and Ethernet PLCA network interfaces. // // Implements the exponential backoff algorithm, sends jam signal // when a collision is detected, and maintains IFG between signals on the channel. // It expects complete Ethernet MAC protocol frames containing an Ethernet MAC // header and an Ethernet FCS. // // The lower layer must be connected to a module implementing the ~IEthernetCsmaPhy // C++ interface. There are two such modules: ~EthernetCsmaPhy and ~EthernetPlca. // The former can be used to build an Ethernet CSMA/CD network interface, the // latter can be used to build an Ethernet PLCA network interface. // // @see ~EthernetCsmaPhy, ~EthernetPlca, ~EthernetPlcaInterface // simple EthernetCsmaMac extends MacProtocolBase { parameters: bool promiscuous = default(false); // if true, all packets are received, otherwise only the // ones with matching destination MAC address int mtu @unit(B) = default(1500B); string fcsMode @enum("declared","computed"); @class(EthernetCsmaMac); // emitted when the incoming carrier sense signal changes, the value is 1 or 0 @signal[carrierSenseChanged](type=int); // emitted when the incoming collision signal changes, the value is 1 or 0 @signal[collisionChanged](type=int); // emitted when the state of the state machine changes, the value is one of IDLE, WAIT_IFG, TRANSMITTING, JAMMING, BACKOFF, RECEIVING @signal[stateChanged](type=int); // the time evolution of the incoming carrier sense signal @statistic[carrierSense](title="carrier sense"; type=int; source=carrierSenseChanged; record=count,vector; interpolationmode=sample-hold); // the time evolution of the incoming collision signal @statistic[collision](title="collision"; type=int; source=collisionChanged; record=count,vector; interpolationmode=sample-hold); // the time evolution of the state of the state machine @statistic[state](title="state"; type=enum; enum=IDLE,WAIT_IFG,TRANSMITTING,JAMMING,BACKOFF,RECEIVING; source=stateChanged; record=count,vector; interpolationmode=sample-hold); }File: src/inet/linklayer/ethernet/basic/EthernetCsmaMac.ned