76 lines
3.9 KiB
C++
76 lines
3.9 KiB
C++
/*-------------------------------------------------------------------
|
|
VCSignalProtocol.h
|
|
-------------------------------------------------------------------
|
|
|
|
(c) Vector Informatik GmbH. All rights reserved.
|
|
|
|
------------------------------------------------------------------- */
|
|
|
|
#pragma once
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
/*--------------------------------------------------------------------*/
|
|
//! Signal protocol class
|
|
/*!
|
|
This class implements the NIPB::IProtocol interface. It handles a
|
|
proprietary signal protocol for the Vector Conecept Car Ethernet
|
|
Network.
|
|
|
|
The protocol is located within a UDP protocol and uses the UDP
|
|
ports 40001. The first 32bit of the UDP payload are the content ID.
|
|
The 32-bit content ID represents the header of this Signal protocol.
|
|
The payload of this protocol is interpreted by the DBC.
|
|
*/
|
|
class VCSignalProtocol :
|
|
public NIPB::IProtocol
|
|
{
|
|
static const ULONG kHeaderLength = 4;
|
|
static const ULONG kHeaderBitLength = 32;
|
|
|
|
//
|
|
// Construction
|
|
//
|
|
public:
|
|
VCSignalProtocol();
|
|
|
|
//
|
|
// IProtocol
|
|
//
|
|
public:
|
|
VDECL Initialize ( NIPB::IProtocolManager /*in*/ *protocolManager, NIPB::INetworkModel /*in*/ *networkModel, NIPB::INetworkModelCreator /*in*/ *modelCreator );
|
|
VDECL Deinitialize ( NIPB::IProtocolManager /*in*/ *protocolManager, NIPB::INetworkModel /*in*/ *networkModel );
|
|
VDECL GetDesignator ( unsigned long /*in*/ bufferSize, char /*out**/ *buffer );
|
|
VDECL GetIdentifier ( NIPB::VTokenId /*out*/ *identifier );
|
|
VDECL GetEncoder ( NIPB::VTokenId /*in*/ tokenId, NIPB::IEncoder /*out*/ **encoder );
|
|
VDECL InitProtocol ( NIPB::IPacket /*in*/ *packet, NIPB::VTokenId /*in*/ protocolTypeId, const NIPB::VProtocolToken /*in*/ *topProtocolToken, NIPB::VProtocolToken /*out*/ *protocolToken);
|
|
VDECL CompleteProtocol( NIPB::IPacket /*in*/ *packet, const NIPB::VProtocolToken /*in*/ *udp );
|
|
VDECL ParsePacket ( NIPB::IPacket /*in*/ *packet, const NIPB::VProtocolToken /*in*/ *topProtocolToken, NIPB::IFormatter /*in*/ *errorWriter, NIPB::VTokenId /*out*/ *nextProcotolId, NIPB::VProtocolToken /*out*/ *protocolToken );
|
|
VDECL GetToken ( const NIPB::VProtocolToken /*in*/ *protocolToken, NIPB::VTokenId /*in*/ tokenId, NIPB::VToken /*out*/ *token );
|
|
VDECL InspectProtocol ( const NIPB::VProtocolToken /*in*/ *protocolToken, NIPB::VInspectionType /*in*/ type, NIPB::IPacketInspector /*in*/ *inspector );
|
|
|
|
//
|
|
// Methods
|
|
//
|
|
public:
|
|
ULONG GetContentId( const BYTE *packetData, ULONG packetLength, const NIPB::VProtocolToken &protocol );
|
|
|
|
static NIPB::VResult MakeHeaderToken( const NIPB::VProtocolToken /*in*/ *protocolToken, NIPB::VTokenId /*in*/ tokenId, ULONG /*in*/ offset, ULONG /*in*/ length, NIPB::VToken /*out*/ *token );
|
|
static NIPB::VResult MakePayloadToken( const NIPB::VProtocolToken /*in*/ *protocolToken, NIPB::VTokenId /*in*/ tokenId, ULONG /*in*/ offset, ULONG /*in*/ length, NIPB::VToken /*out*/ *token );
|
|
static void FormatUnsigned( NIPB::IPacketInspector *inspector, LPCTSTR label, NIPB::VTokenId tokenId, ULONG value, ULONG valueLength );
|
|
|
|
static NIPB::VResult SetTokenUnsigned( NIPB::VProtocolToken &protocolToken, NIPB::VTokenId tokenId, ULONG valueLength, ULONG value );
|
|
static NIPB::VResult SetTokenData( NIPB::VProtocolToken &protocolToken, NIPB::VTokenId tokenId, ULONG dataLength, const BYTE *data );
|
|
|
|
//
|
|
// Attributes
|
|
//
|
|
private:
|
|
NIPB::VTokenId mProtocolId; //!< Token ID of this protocol
|
|
NIPB::VTokenId mContentId; //!< Token ID of the 'contentID' field
|
|
NIPB::IProtocolManager *mProtocolManager;
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////
|