Skip to main content
Open topic with navigation CAPL Functions » TCP/IP API » IpGetAdapterVlanId

IpGetAdapterVlanId

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

long IpGetAdapterVlanId( dword ifIndex, word &retVlanId);

Description

The function returns the VLAN ID of the adapter with the given index. If the adapter is not a VLAN interface it returns the error code WSA_INVALID_PARAMETER (87).

Parameters

  • ifIndex: The 1-based network interface index.
  • retVlanId: The VLAN ID of the adapter.

Return Values

  • 0: The function completed successfully.
  • 1: The function is not supported on the selected TCP/IP stack.
  • WSA_INVALID_PARAMETER (87): The specified network interface index was invalid or is not a VLAN adapter.
  • SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error code.

Example

on start
{
  dword adapterCount;
  dword ifIndex;
  word vlanId;
  long result;
  adapterCount = ipGetAdapterCount();

  for(ifIndex = 1; ifIndex <= adapterCount; ifIndex++)
  {
    result = ipGetAdapterVlanId(ifIndex, vlanId);
    if(result == 0)
    {
      write("Adapter %d has VLAN id %d", ifIndex, vlanId);
    }
  }
}