EtherHub
Package: inet.linklayer.ethernet

EtherHub

simple module

A generic wiring hub model.

ethg[i] gates represent ports. Messages arriving on a port are broadcast to every other port. For the model to work correctly, all connecting links (both incoming and outgoing ones) must have the same datarate.

Messages are not interpreted by the hub model in any way, thus the hub model is not specific to Ethernet. Messages may represent anything, from the beginning of a frame transmission to end (or abortion) of transmission.

It is allowed to dynamically unconnect/reconnect ports of the hub, and also to change the size of ethg[] to add/remove ports. However, the model only checks the equivalence of input/output datarates on startup; you are responsible that links added at runtime have have the correct datarate.

EtherHub

Properties

Name Value Description
networkNode
labels node
display i=device/hub

Gates

Name Direction Size Description
ethg [ ] inout

to stations; each one represents a port

Signals

Name Type Unit
packetReceived cMessage

Statistics

Name Title Source Record Unit Interpolation Mode
packetReceived packets packetReceived count, sum(packetBytes), vector(packetBytes) none

Source code

//
// A generic wiring hub model.
//
// ethg[i] gates represent ports. Messages arriving on a port are broadcast
// to every other port. For the model to work correctly, all connecting
// links (both incoming and outgoing ones) must have the same datarate.
//
// Messages are not interpreted by the hub model in any way, thus the hub
// model is not specific to Ethernet. Messages may represent anything, from
// the beginning of a frame transmission to end (or abortion) of transmission.
//
// It is allowed to dynamically unconnect/reconnect ports of the hub, and also
// to change the size of ethg[] to add/remove ports. However, the model only
// checks the equivalence of input/output datarates on startup; you are
// responsible that links added at runtime have have the correct datarate.
//
simple EtherHub
{
    parameters:
        @networkNode();
        @labels(node,ethernet-node);
        @display("i=device/hub");
        @signal[packetReceived](type=cMessage);
        @statistic[packetReceived](title="packets"; source=packetReceived; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
    gates:
        inout ethg[] @labels(EtherFrame-conn);  // to stations; each one represents a port
}
File: src/inet/linklayer/ethernet/EtherHub.ned