Skip to main content

AfdxInitProtocol

Valid for: CANoe DE • CANoe:lite DE • CANoe4SW DE • CANoe4SW:lite DE

Function Syntax

long AfdxInitProtocol( long packet, char protocolDesignator[] ); // form 1
long AfdxInitProtocol( long packet, char protocolDesignator[], char packetTypeDesignator[] ); // form 2

Description

This function initializes the protocol for a packet. If necessary further needed lower protocols are initialized, e.g. IPv4. Already initialized higher protocols are deleted.

Parameters

  • packet: Handle of the message that has been created with AfdxInitPacket.
  • protocolDesignator: Name of the protocol.
  • packetTypeDesignator: Type of the packet.

Return Values

Example

testfunction Packet_InitProtocolICMP( long expectError, char expectErrorText[] )
{
  //
  // Create AFDX gPacket
  //
  gPacket_Result = AfdxInitProtocol( gPacket[gPacketSelect], "afdx", "icmp" );

  if (expectError == 0)
  {
    if (gPacket_Result != 0)
    {
      snprintf( gPacket_Text, elcount(gPacket_Text), "AfdxInitProtocol failed, result %d", gPacket_Result );
      TestStepFail( gPacket_Text );
      Packet_ReportLastError();
      return;
    }
    else
    {
      TestStepPass();
    }
  }
  else
  {
    if (Packet_CheckExpectError( "AfdxInitProtocol", expectError, expectErrorText ))
    {
      TestStepPass();
    }
  }
}