Skip to main content

DoIP_SetMulticastScopeId

Valid for: CANoe DE Note
The following DoIP CAPL function is only available with the modeling library DoIP.dll and eventually an appropriate implementation of the CAPL Callback Interface. Information about the DoIP DLL and the CAPL Callback Interface you find here:

Function Syntax

void DoIP_SetMulticastScopeId(dword scopeId);

Description

Sets an IPv6 address scope ID for multicast requests, sent by a tester. The scope ID is equal to an adapter index of the tester node. See ipGetAdapter functions for more information. The function allows to select an appropriate adapter for IPv6 multicast address, to be able, for example, to send multicast requests with a given VLAN tag. Note
DoIP_SetMulticastScopeId must be called before DoIP_SetLocalIPaddress in order to use the scope ID with the specified local IP address.

Parameters

  • scopeId: Scope ID for selection of a network adapter for IPv6 multicast requests.

Return Values

Example

// returns TCP/IP adapter index for the given IP address
dword GetTCPIPAdapterScopeId(char ipAddr[])
{
  dword adapterCount;
  dword adapterIndex;

  dword addressCount;
  dword addressIndex;

  IP_Address ipAddresses[16];
  char ipAddressString[256];

  adapterCount = ipGetAdapterCount();
  for(adapterIndex = 1; adapterIndex <= adapterCount; adapterIndex++)
  {
    ipGetAdapterAddress(adapterIndex, ipAddresses, addressCount);
    for(addressIndex = 0; addressIndex < addressCount; addressIndex++)
    {
      ipAddresses[addressIndex].PrintAddressToString(ipAddressString);
      if(strncmp(ipAddr, ipAddressString, strlen(ipAddr)) == 0)
        return adapterIndex;
    }
  }

  return 0;
}

// identify the adapter scope ID for the tester IP address
// set it for sending multicast requests in corresponding network
dword scopeId;
scopeId = GetTCPIPAdapterScopeId(testerIPaddr);
DoIP_SetMulticastScopeId(scopeId);