Skip to main content

ethGetMacAddressAsString

Open topic with navigation CAPL Functions » Ethernet » Function Overview » ethGetMacAddressAsString

Function Syntax

long ethGetMacAddressAsString( qword macAddr, char buffer[], dword bufferLength );

Description

Converts a MAC address from qword to string. The function is helpful with ethernetPacket.source and ethernetPacket.destination.

Parameters

  • macAddr: MAC address as qword, i.e. from ethernetPacket.source.
  • buffer: Buffer where the MAC address string is copied to.
  • bufferLength: Length of buffer

Return Values

  • 0: The function completed successfully.
  • 8: The address buffer was insufficient.

Example

on ethernetPacket *
{
  char macAddrStr[18];
  if (ethGetMacAddressAsString(this.source, macAddrStr, elcount(macAddrStr)) == 0)
  {
    write("Received Ethernet packet from %s", macAddrStr);
  }
}
See Also