Skip to main content

on ethernetPacket

Open topic with navigation CAPL Functions » Ethernet » Function Overview » on ethernetPacket

Function Syntax

  • on ethernetPacket *; // form 1
  • on ethernetPacket msgChannel<X>.*; // form 2
  • on ethernetPacket ethernetPort::<Network>::<PortName>.*; // form 3

Description

The event procedure is called on the receipt of a valid Ethernet packet. To access the control information you would use selectors. The keyword this is available within an on ethernetPacket procedure, to access the data of the packet that has just been received. CAPL programs are by default not transparent to bus events. This means that a CAPL node in the evaluation branch of the measurement configuration will block the data flow to its right side. You must explicitly program the passing of messages in CAPL nodes in the evaluation branch. To make the CAPL node transparent to messages you would write:
on ethernetPacket *
{
    output(this);
};

Parameters

  • msgChannel<X>: Ethernet channel number, range 1..32.
  • ethernetPort::<NetworkName>::<PortName>: Ethernet port qualification.

Selectors

See ethernetPacket

Example

Example 1
on ethernetPacket *
{
    write("Received Ethernet packet on Eth%d", this.msgChannel );
    output( this ); // only required in CAPL node in measurement setup!
}
Example 2
on ethernetPacket msgChannel1.*
{
    write("Received Ethernet packet with length %d", this.Length );
    output( this ); // only required in CAPL node in measurement setup!
}
Example 3
on ethernetPacket ethernetPort::Ethernet1::HU.*
{
    write("Received Ethernet packet with length %d", this.Length );
    output( this ); // only required in CAPL node in measurement setup!
}
See Also