/*-------------------------------------------------------------------
	IPBPacketAPI.h
	-------------------------------------------------------------------

	(c) 2009 Vector Informatik GmbH. All rights reserved.

	------------------------------------------------------------------- */ 

#pragma once
#ifndef IPBPACKETAPI_H
#define IPBPACKETAPI_H

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

/*!
	!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	!!!                                                                !!!
	!!! Important: If this header is modified, the version definitions !!!
	!!!            must be properly increased.                         !!!
	!!!                                                                !!!
	!!! New methods must be added at the end within a interface class  !!!
	!!! (not before existing methods).                                 !!!
	!!!                                                                !!!
	!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

	The IPBPacketLib, add-on DLLs and CANoe/CANalyzer must use exactly
	the same version for IPB_PACKET_LIB_INTERFACE_VERSION_MAJOR and
	IPB_PACKET_LIB_STRUCT_VERSION. If these values differ, CANoe/CANalyzer
	does not load the IPBPacketLib or the add-on DLL.

	If only IPB_PACKET_LIB_INTERFACE_VERSION_MINOR differs, the changes
	are backward compatible.
*/

//
// Version
//

#define IPB_PACKET_LIB_INTERFACE_VERSION_MAJOR 1
#define IPB_PACKET_LIB_INTERFACE_VERSION_MINOR 0
#define IPB_PACKET_LIB_STRUCT_VERSION 1

//
// Utility Macros
//

#define VDECL virtual NIPB::VResult __stdcall
#define VDEF  NIPB::VResult __stdcall

#define BY2BI(x)  ((x)<<3)            // Bytes to Bits
#define BI2BY(x)  ((x)>>3)            // Bites to Bytes
#define BIOF(x)   ((x)&0x07)          // Bits of value

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

namespace NIPB
{
	// forward declarations
	class IApi;
	class IAddOnManager;
	class IProtocolManager;
	class ISocketManager;
	class IProtocolAddOn;
	class IAddOnRegistrar;
	class INetworkModel;
	class ITokenDefinition;
	class IDefinitionIterator;
	class ITokenDefinitionCreator;
	class IProtocol;
	class IPacket;
	class IPacket;
	class IEncoder;
	class IFormatter;
	class IPacketInspector;
	class IValueTableDefinition;
	struct VProtocolToken;

	//! Error codes
	typedef enum {
		kOK                               = 0,
		kError                            = 460100, //!< General error
		kInternalError                    = 460101,
		kNotImplemented                   = 460102, //!< Function is not implemented
		kInvalidArg                       = 460103, //!< Invalid parameter was given to a function
		kEndReached                       = 460104, //!< Iterator reached last element
		kNoBusProtocol                    = 460105, //!< Only bus protocol allowed
		kProtocolNotAvailable             = 460106, //!< Protocol with Id not found
		kProtocolAlreadyAvailable         = 460107, //!< Protocol with Id not found
		kTokenNotFound                    = 460108, //!< Token with Id not found
		kEncodingNotSupported             = 460109, //!< Encoding is not supported
		kEncodingError                    = 460110, //!< Encoding error
		kPacketParseError                 = 460111, //!< Packet could not be parsed
		kOutOfBounds                      = 460112, //!< Token references data outside packet data length
		kFileNotFound                     = 460113, //!< File not found
		kInvalidAddOnDll                  = 460114, //!< AddOn DLL is invalid, required functions not found
		kInvalidAddOnVersion              = 460115, //!< AddOn version not accepted
		kPropertyNotFound                 = 460116, //!< The property is not available
		kOperationNotAllowedWhenNotActive = 460117, //!< IApi is not active
		kOperationNotAllowedWhenActive    = 460118, //!< Operation can not be performed, if active
		kDataNotAvailable                 = 460119, //!< Cannot access part of packet data because frame is to short
		kPacketIsLocked                   = 460120, //!< Packet is locket and cannot be modified
		kNotAllowed                       = 460121, //!< Operation is not allowed 
		kHostNotReachable                 = 460122  //!< Host is not reachable, maybe netmask is wrong
	} VResult;

	//! Predefined token IDs of build-in protocols
	typedef enum {
		kNil      = 0x0000,
		kHeader   = 0x0001,  // Header of a protocol (has no designator)
		kData     = 0x0002,  // Payload of a protocol (has no designator)
		kReserved = 0x0003,  // Placeholder for reserved fields (has no designator)

		//
		// Token IDs
		//

		// Ethernet
		kETH                          = 0x0100,
		kEthHeader                    = 0x0101,
		kEthData                      = 0x0102,
		kEthType                      = 0x0103,
		kEthSource                    = 0x0104,
		kEthDestination               = 0x0105,
		kEthVlan                      = 0x0106,
		kEthVlanTci                   = 0x0107,
		kEthVlanPriority              = 0x0108,
		kEthVlanTr                    = 0x0109,
		kEthVlanId                    = 0x010A,
		// ARP
		kARP                          = 0x0110,
		kARPHeader                    = 0x0111,   
		kARPHardwareType              = 0x0113,
		kARPProtocolType              = 0x0114,   
		kARPHardwareSize              = 0x0115,  
		kARPProtocolSize              = 0x0116,  
		kARPOperation                 = 0x0117, 
		kARPHwSourceAddr              = 0x0118,
		kARPProtSourceAddr            = 0x0119,
		kARPHwDestinationAddr         = 0x011A,
		kARPProtDestinationAddr       = 0x011B,
		kARPError                     = 0x011C,
		// RARP
		kRARP                         = 0x0200,
		kRARPHeader                   = 0x0201,   
		kRARPHardwareType             = 0x0203,
		kRARPProtocolType             = 0x0204,   
		kRARPHardwareSize             = 0x0205,  
		kRARPProtocolSize             = 0x0206,  
		kRARPOperation                = 0x0207, 
		kRARPHwSourceAddr             = 0x0208,
		kRARPProtSourceAddr           = 0x0209,
		kRARPHwDestinationAddr        = 0x020A,
		kRARPProtDestinationAddr      = 0x020B,
		kRARPError                    = 0x020C,
		// IPv4
		kIPv4                         = 0x0120,
		kIPv4Header                   = 0x0121,
		kIPv4Data                     = 0x0122,
		kIPv4Version                  = 0x0123,
		kIPv4IHL                      = 0x0124,
		kIPv4DSCP                     = 0x0125,
		kIPv4ECN                      = 0x0126,
		kIPv4TotalLength              = 0x0127,
		kIPv4Identification           = 0x0128,
		kIPv4Flags                    = 0x0129,
		kIPv4Offset                   = 0x012A,
		kIPv4TTL                      = 0x012B,
		kIPv4Protocol                 = 0x012C,
		kIPv4Checksum                 = 0x012D,
		kIPv4Source                   = 0x012E,
		kIPv4Destination              = 0x012F,
		// IPv6                    
		kIPv6                         = 0x0130,
		kIPv6Header                   = 0x0131,
		kIPv6Data                     = 0x0132,
		kIPv6Version                  = 0x0133,
		kIPv6Class                    = 0x0134,
		kIPv6Flow                     = 0x0135,
		kIPv6Length                   = 0x0136,
		kIPv6Next                     = 0x0137,
		kIPv6HopLimit                 = 0x0138,
		kIPv6Source                   = 0x0139,
		kIPv6Destination              = 0x013A,
		// NDP                
		kNDP                          = 0x0140,
		kNDPHeader                    = 0x0141,
		kNDPData                      = 0x0142,
		kNDPCurHopLimt                = 0x0143,
		kNDPManagedAddrConfigFlag     = 0x0144,
		kNDPOtherConfigFlag           = 0x0145,
		kNDPMobileIPv6HomeAgentFlag   = 0x0146,
		kNDPDefaultRouterPreferences  = 0x0147,
		kNDPNeighborDiscoveryProxyFlag= 0x0148,
		kNDPRouterLifetime            = 0x0149,
		kNDPReachableTime             = 0x014A,
		kNDPRetransTimer              = 0x014B,
		kNDPTarget                    = 0x014C,
		kNDPRouterFlag                = 0x014D,
		kNDPSolicitedFlag             = 0x014E,
		kNDPOverrideFlag              = 0x014F,
		kNDPDestination               = 0x0151,
		kNDPOption                    = 0x0152,
		// UDP
		kUDP                          = 0x0160,
		kUDPHeader                    = 0x0161,
		kUDPData                      = 0x0162,
		kUDPSource                    = 0x0163,
		kUDPDestination               = 0x0164,
		kUDPLength                    = 0x0165,
		kUDPChecksum                  = 0x0166,
		// TCP                
		kTCP                          = 0x0170,
		kTCPHeader                    = 0x0171,
		kTCPData                      = 0x0172,
		kTCPSource                    = 0x0173,
		kTCPDestination               = 0x0174,
		kTCPSequence                  = 0x0175,
		kTCPAckNumber                 = 0x0176,
		kTCPOffset                    = 0x0177,
		kTCPFlags                     = 0x0178,
		kTCPWindow                    = 0x0179,
		kTCPChecksum                  = 0x017A,
		kTCPPointer                   = 0x017B,
		// ICMPv4            
		kICMPv4                       = 0x0180,
		kICMPv4Header                 = 0x0181,
		kICMPv4Data                   = 0x0182,
		kICMPv4Type                   = 0x0183,
		kICMPv4Code                   = 0x0184,
		kICMPv4Checksum               = 0x0185,
		kICMPv4Identifier             = 0x0186,
		kICMPv4SequenceNumber         = 0x0187,
		kICMPv4GatewayAddr            = 0x0188,
		kICMPv4RouterAdvertNumOfAddr  = 0x0189,
		kICMPv4RouterAddrEntrySize    = 0x018A,
		kICMPv4RouterLifetime         = 0x018B,
		kICMPv4TimestampOriginate     = 0x018C,
		kICMPv4TimestampReceive       = 0x018D,
		kICMPv4TimestampTransmit      = 0x018E,
		kICMPv4ParameterProblemPtr    = 0x018F,
		kICMPv4AddressMask            = 0x0190,
		kICMPv4OutboundHopCnt         = 0x0191,
		kICMPv4ReturnHopCnt           = 0x0192,
		kICMPv4OutputLinkSpeed        = 0x0193,
		kICMPv4OutputLinkMTU          = 0x0194,
		kICMPv4DataConvErrPointer     = 0x0195,
		kICMPv4TimeToLive             = 0x0196,
		kICMPv4MsgUtilizedByExpSubType=0x0197,
		kICMPv4TimeToLiveNames        = 0x0198,
		kICMPv4RouterAddr             = 0x0199,
		// ICMPv6
		kICMPv6                       = 0x01A0,
		kICMPv6Header                 = 0x01A1,
		kICMPv6Data                   = 0x01A2,
		kICMPv6Type                   = 0x01A3,
		kICMPv6Code                   = 0x01A4,
		kICMPv6Checksum               = 0x01A5,
		kICMPv6MTU                    = 0x01A6,
		kICMPv6Pointer                = 0x01A7,
		kICMPv6Identifier             = 0x01A8,
		kICMPv6SequenceNumber         = 0x01A9,
		// NTP                     
		kNTP                          = 0x01B0,
		kNTPHeader                    = 0x01B1,
		kNTPProtocol                  = 0x01B3,
		kNTPLeapInd                   = 0x01B4,
		kNTPVersion                   = 0x01B5,
		kNTPMode                      = 0x01B6,
		kNTPStratum                   = 0x01B7,
		kNTPPollIntervall             = 0x01B8,
		kNTPPrecision                 = 0x01B9,
		kNTPRootDelay                 = 0x01BA,
		kNTPRootDispersion            = 0x01BB,
		kNTPRefId                     = 0x01BC,
		kNTPRefTimestamp              = 0x01BD,
		kNTPOrgTimestamp              = 0x01BE,
		kNTPRxTimestamp               = 0x01BF,
		kNTPTxTimestamp               = 0x01C0,
		kNTPKeyId                     = 0x01C1,
		kNTPAuthenticationCode        = 0x01C2,
		kNTPResponse                  = 0x01C3,
		kNTPError                     = 0x01C4,
		kNTPMore                      = 0x01C5,
		kNTPOperation                 = 0x01C6,
		kNTPSequence                  = 0x01C7,
		kNTPStatus                    = 0x01C8,
		kNTPAssociationId             = 0x01C9,
		kNTPOffset                    = 0x01CA,
		kNTPCount                     = 0x01CB,
		kNTPDataArea                  = 0x01CC,
		kNTPPadding                   = 0x01CD,
		kNTPStatusLeapIndicator       = 0x01CE,
		kNTPStatusClockSource         = 0x01CF,
		kNTPStatusSystemEventCount    = 0x01D0,
		kNTPStatusSystemEventCode     = 0x01D1,
		kNTPStatusPeer                = 0x01D2,
		kNTPStatusPeerSelection       = 0x01D3,
		kNTPStatusPeerEventCount      = 0x01D4,
		kNTPStatusPeerEventCode       = 0x01D5,
		kNTPStatusClock               = 0x01D6,
		kNTPStatusClockEventCode      = 0x01D7,
		kNTPStatusErrorCode           = 0x01D8,
		// DHCPv4                   
		kDHCPv4                       = 0x01E0,
		kDHCPv4Header                 = 0x01E1,
		kDHCPv4Data                   = 0x01E2,
		kDHCPv4Operation              = 0x01E3,
		kDHCPv4HardwareType           = 0x01E4,
		kDHCPv4HardwareSize           = 0x01E5,
		kDHCPv4Hops                   = 0x01E6,
		kDHCPv4XID                    = 0x01E7,
		kDHCPv4Time                   = 0x01E8,
		kDHCPv4Flags                  = 0x01E0,
		kDHCPv4ClientAddr             = 0x01EA,
		kDHCPv4YourAddr               = 0x01EB,
		kDHCPv4ServerAddr             = 0x01EC,
		kDHCPv4AgentAddr              = 0x01ED,
		kDHCPv4ClientHwAddr           = 0x01EE,
		kDHCPv4ClientHwAddrPadding    = 0x01EF,
		kDHCPv4ServerName             = 0x01F0,
		kDHCPv4File                   = 0x01F1,
		kDHCPv4MagicCookie            = 0x01F2,
		kDHCPv4Option                 = 0x01F3,
		// DoIP                      
		kDoIP                         = 0x01F4,
		kDoIPHeader                   = 0x01F5,
		kDoIPData                     = 0x01F6,
		kDoIPVersion                  = 0x01F7,
		kDoIPInverseVersion           = 0x01F8,
		kDoIPPayloadType              = 0x01F9,
		kDoIPPayloadLength            = 0x01FA,

		//
		// Init protocol types
		//

		kPacketTypeVLAN              = 0x01001,

		//
		// Socket Properties
		//

		kEthLocalAddress             = 0x0201,
		kIPv4LocalAddress            = 0x0210,
		kIPv4RemoteAddress           = 0x0211,
		kIPv4Netmask                 = 0x0212,
		kUDPRemotePort               = 0x0220,
		kUDPLocalPort                = 0x0221,
		kTCPRemotePort               = 0x0230,
		kTCPLocalPort                = 0x0231,

	} VPredefinedTokenIds;

	//! Kind of encoding
	typedef enum {
		kEncodingDisplayText = 0x01, //!< Value buffer must be string buffer (zero terminated) which is interpreted by the encoder
		kEncodingPhysical    = 0x02, //!< Value buffer must be double
		kEncodingInteger     = 0x03, //!< Value buffer must be integer with 8, 16, 32 or 64 bit size
		kEncodingUnsigned    = 0x04, //!< Value buffer must be unsigned integer with 8, 16, 32 or 64 bit size
		kEncodingData        = 0x05  //!< Value buffer must be raw data
	} VEncoding;

	typedef enum {
		kEncoderData                = 1,
		kEncoderUnsignedLE          = 2,
		kEncoderUnsignedBE          = 3,
		kEncoderMacId               = 4,
		kEncoderIPv4                = 5,
		kEncoderIPv6                = 6,
		kEncoderIP                  = 7,
		kEncoderTypeICMPv4          = 8,
		kEncoderCodeICMPv4          = 9,
		kEncoderProtocolIPv4        = 10,
		kEncoderOperationARP        = 11,
		kEncoderHardwareTypeARP     = 12,
		kEncoderTypeETH             = 13,
		kEncoderPortUDP             = 14,
		kEncoderPortTCP             = 15,
		kEncoderFlagsTCP            = 16,
		kEncoderTypeDHCP            = 17,
		kEncoderModeNTP             = 18,
		kEncoderStratumNTP          = 19,
		kEncoderTimeNTP             = 20,
		kEncoderPollIntervalNTP     = 21,
		kEncoderLeapIndicatorNTP    = 22,
		kEncoderRootTimesNTP        = 23,
		kEncoderReferenceIdNTP      = 24,
		kEncoderPrecisionNTP        = 25,
		kEncoderOperationCodeNTP    = 26,
		kEncoderClockSourceNTP      = 27,
		kEncoderSystemEventCodeNTP  = 28,
		kEncoderPeerStatusNTP       = 29,
		kEncoderPeerSelectionNTP    = 30,
		kEncoderPeerEventCodeNTP    = 31,
		kEncoderClockStatusNTP      = 32,
		kEncoderErrorCodeNTP        = 33,
		kEncoderTypeICMPv6          = 34,
		kEncoderCodeICMPv6          = 35,
		kEncodeFlagsDCHP            = 36,
		kEncoderStringANSII         = 37,
		kEncoderTimeMilliseconds    = 38,
		kEncoderTimeSeconds         = 39,
		kEncoderErrorDRARP          = 40,
		kEncoderPayloadTypeDoIP     = 41
 } VEncoder;

	// Fields for inspection
	typedef enum {
		kFieldLabel               = 1,
		kFieldValue               = 2,
		kFieldValueInterpretation = 3,
		kFieldInfo                = 4
	} VInspectorField;

	//! Inpspection type
	typedef enum {
		kInspectionInfoColumn = 1,
		kInspectionDetailTree = 2
	} VInspectionType;

	//! Direction of a packet
	typedef enum {
		kDirRx = 0,
		kDirTx = 1
	} VDirection;
	
	//! Types of token definitions
	/*!
			Two types of token definitions are supported. It can be retrieved via the ITokenDefinition.
	*/
	typedef enum {
		kTypeNone           = 0, // Invalid value for token type
		kTypeProtocol       = 1, // The token defintion represents a IP based protocol, i.e. UDP or IPv4
		kTypeProtocolField  = 2, // The token defintion represents a field of a protocol, i.e. IP source address
		kTypeSocketProperty = 3, // The token defintion represents a property of a socket
		kTypePacketType     = 4  // The token defintion represents a packet type. i.e. vlan of Ethernet
	} VTokenType;

	//! Format of a defined token
	/*!
			The token format can be retrieved from ITokenDefinition for each defined token.
			It can be used for sophisticated presentation of the token value in the UI.
	*/
	typedef enum {
		kFormatData        = 0,   //!< Generic data format
		kFormatInteger     = 1,   //!< Integer format with 1, 2, 4 or 8 Bytes
		kFormatBitfield    = 2,   //!< Bit field
		kFormatTextASCII   = 3,   //!< String in ASCII format
		kFormatMacId       = 4,   //!< Ethernet MAC address
		kFormatAddressIPv4 = 5,   //!< IPv4 IP address
		kFormatAddressIPv6 = 6,   //!< IPv6 IP address
		kFormatPayload     = 7,   //!< the payload field
		kFormatHeader      = 8,   //!< the header of a protocol
	} VTokenFormat;

	//! Format flags for kFormatInteger
	/*!
			With the format flags the protocol can give hints for presentation
			of the token value.
	*/
	typedef enum {
		kFormatFlagPrefferedHex = 0x01,  //!< Preffered value presentation is hexadecimal
		kFormatFlagPrefferedDec = 0x02,  //!< Preffered value presentation is decimal
		kFormatFlagChecksum     = 0x04   //!< the value is a checksum
	} VTokeFormatFlagsInteger;

	typedef enum {
		kBusAll      = 0,
		kBusEthernet = 11
	} VBusType;

	typedef long VChannel;

	// Token identifier
	typedef unsigned long VTokenId;

	// Time in [ns]
	typedef unsigned long long VTimeNS;

	//! The function DllGetApiVersion is implemented in the IPBPacketLib und
	//! must be implemented by protocol DLLs.
	typedef HRESULT(__stdcall *VGetApiVersionFct)( unsigned long /*out*/ *major,        // Version major, must return IPB_PACKET_LIB_INTERFACE_VERSION_MAJOR
					                                       unsigned long /*out*/ *minor,        // Version minor, must return IPB_PACKET_LIB_INTERFACE_VERSION_MINOR
					                                       unsigned long /*out*/ *structVersion // Struct version, must return IPB_PACKET_LIB_STRUCT_VERSION
					                                     );

	//! Create the Api of the IPBPacketLib
	/*!
			Returns the API object of the IPB packet library
			The function DllGetApi is implemented in the IPBPacketLib with this signature
	*/
	typedef HRESULT(__stdcall *VCreatedApiFct)( NIPB::IApi /*out*/ **api );

	//! Release the Api of the IPBPacketLib
	/*!
		The function DllGetApi is implemented in the IPBPacketLib with this signature
	*/
	typedef HRESULT(__stdcall *VReleaseApiFct)( NIPB::IApi /*out*/ *api ); // 

	//! Use this addOn manager to register addOns
	/*!
			The function DllRegisterAddOn must be implemented in the protocol DLL
	*/
	typedef HRESULT(__stdcall *VRegisterAddOnFct)( NIPB::IAddOnRegistrar /*in*/ *registrar ); // 

	/*-----------------------------------------------------------------------------------------------*/
	//! The entry point to the IPB Packet Lib
	/*! 
			This is the base for accessing the functionality of the IPBPacketLib. A pointer
			to this interface canb be retrieved via the exported C function VCreateApiFct. When it 
			is not longer needed it must be release with the exported C function VReleaseApiFct.

			IApi -+
					  |
					  +-- IAddOnManager      Manages the add-on DLLs
					  +-- IProtocolManager   Manages the supported protocols
					  +-- INetworkModel      Contains the defintions of the protocols and its fields
					  +-- ISocketManager     Manages the sockets

			The IPBPacketLib knows three states:

			 +-----------------+  Initallize  +-----------------+   Active    +-----------------+
			 |                 |------------->|                 |------------>|                 |
			 | Not Initialized |              |   Initialized   |             |     Active      |
			 |                 |<-------------|                 |------------>|                 |
			 +-----------------+ Deintialize  +-----------------+   Deactive  +-----------------+

		 Depending on the state functionality is available or not:

		 State 'Not Initialized': Add-on DLLs can beloaded. Network Model, Protocol Manager and
					                    Socket Manager are not available

		 State 'Initialized':     Protocol Manager and Network Manager are available. Protocols
					                    can be interpreted and packets can be assembled.
					                    Transmitting and receiving is not possible. In CANoe/CANalyzer
					                    this state is used when measurement is not running.

		 State 'Active':          Socket Manager is available and everthing of state 'Initialized'.
					                    Packets can be received and transmitted.
					                    In CANoe/CANalyzer this state is used when measurement is running.
	*/
	class IApi
	{
	public:
		VDECL Initialize() = 0;
		VDECL Activate() = 0;
		VDECL Deactivate() = 0;
		VDECL Deinitialize() = 0;

		VDECL GetAddOnManager   ( IAddOnManager /*out*/ **manager ) = 0;
		VDECL GetProtocolManager( VBusType /*in*/ busType, VChannel /*in*/ channel, IProtocolManager /*out*/ **manager ) = 0;
		VDECL GetNetworkModel   ( VBusType /*in*/ busType, VChannel /*in*/ channel, INetworkModel /*out*/ **model ) = 0;
		VDECL GetSocketManager  ( VBusType /*in*/ busType, VChannel /*in*/ channel, ISocketManager /*out*/ **manager ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Manager for add-on DLLs
	/*! 
			With add-on DLLs the IPB Packet Lib can be extended with user defined protocols. These protocols
			can use the build-in protocols like IPv4 and UDP and access only the payload of these protocols.

			The add-on DLL must export the C function VRegisterAddOnFct. This function is called by the
			IPBPacketLib on loading. The function gets a pointer to IAddOnRegistrar, which can be used
			by the add-on DLL to register additonal protocols. For this the add-on DLL must implement
			the interfaces IProtocolAddOn and IProtocol.
	*/
	class IAddOnManager
	{
	public:
		//! Loads an add-on DLL
		/*!
			LoadAddOn is only available, if the IPB Packet API ist not initialized yet (IApi::Initialize).
			During IApi::Deinitialize all loaded add-ons are unloaded. 
		*/
		VDECL LoadAddOn( const char /*in*/ *filename ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Interface to register useer define protocols of a add-on DLL
	/*! 
			This interface must be used by an add-on DLL to register a user define protocol. The
			interface is passed to the exported C function VRegisterAddOnFct during IAddOnManager::LoadAddOn.
			See IAddOnManager for details.
	*/
	class IAddOnRegistrar
	{
	public:
		//! Registers a user protocol
		/*!
			This function must be called to register a user protocol at the IPB packet Lib.

			The lower protocol, which preceeds the user protocol must be specified. The lowerProtocolTag
			allow the selection of the user protocol. The meaning of the lowerProtocolTag depends on 
			the lowerProtocol. Following protocols are supported as lowerProtocol:

				Designator   lowerProtocolTag1  lowerProtocolTag2  Comment
				"eth"        Ethernet Type      -
				"ipv4"       Protocol           -
				"udp"        source port        destination port   The value 0xFFFFFFFF is used as wildcard
				"tcp"        source port        destination port   The value 0xFFFFFFFF is used as wildcard
		*/
		VDECL RegisterProtocol( const char /*in*/ *protocolDesignator, IProtocolAddOn /*in*/ *addOn, const char /*in*/ *lowerProtocolDesignator, ULONG /*in*/ lowerProtocolTag1, ULONG /*in*/ lowerProtocolTag2 ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Handling of user protocol in a add-on DLL
	/*! 
			This interface must be implemented by a add-on DLL. It creates a protoocl object, which must
			implement the IProtocol interface, during IApi::Initialized.
			On IApi::Deinialize the release function IProtocolAddOn::ReleaseProtocol is called to delete
			the protocol object. See IAddOnManager for details.
	*/
	class IProtocolAddOn
	{
	public:
		VDECL CreateProtocol( const char /*in*/ *protocolDesignator, IProtocol /*out*/ **protocol ) = 0;
		VDECL ReleaseProtocol( IProtocol /*in*/ *protocol) = 0;
	};

	//////////////////////////////////////////////////////////////////////
	// Network Model API
	//////////////////////////////////////////////////////////////////////

	/*-----------------------------------------------------------------------------------------------*/
	//! The network model manages all available protocol and token definitions
	/*! 
			The network model contains all avalable definitions of token and protocols. It can resolve
			token and protocol designators to tokenIDs.
	*/
	class INetworkModel
	{
	public:
		VDECL GetTokenId            ( const char /*in*/ *protocolDesignator, const char /*in*/ *tokenDesignator, VTokenId /*out*/ *tokenId ) = 0;
		VDECL GetDefinition         ( VTokenId /*in*/ identifier, ITokenDefinition /*out*/ **definition ) = 0;
		VDECL GetDefinitionIterator ( VTokenId /*in*/ identifier, VTokenType /*in*/ tokenType, IDefinitionIterator /*out*/ **iterator ) = 0; 
		VDECL ReleaseDefinitionIterator( IDefinitionIterator /*in*/ *iterator ) = 0; 
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! The network model creator is used by user protocol DLLs to register protocol and token definitions
	/*! 
			The interface INetworkModelCreator is only available in IProtocol::Initialize method. A user
			protocol DLL must define its protocols and tokens with this interface.
	*/
	class INetworkModelCreator
	{
	public:
		VDECL DefineProtocol( const char /*in*/ *protocolDesignator, VTokenId /*out*/ *tokenId , ITokenDefinitionCreator /*out*/ **definition ) =  0;
		VDECL DefineProtocolField( ITokenDefinitionCreator /*in*/ *protocol, const char /*in*/ *designator, VTokenId /*out*/ *tokenId, ITokenDefinitionCreator /*out*/ **definition ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Setup a token defintition with a user protocol DLL
	/*! 
			This interface is available in INetworkModelCreator::DefineProtocol and DefineProtocolField to
			setup the definition of a token or protocol.
	*/
	class ITokenDefinitionCreator
	{
	public:
		VDECL GetDefinition( ITokenDefinition /*out*/ **definition ) = 0;
		VDECL SetDisplayName( char /*in*/ *name ) = 0;
		VDECL SetFormat( VTokenFormat /*in*/ format ) = 0;
		VDECL SetFormatFlags( unsigned long /*in*/ formatFlags ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Definition of a token.
	/*! 
			A token can be a protocol or a field of a protocol. The ITokenDefinition
			contains all information about a token, like TokenId, Designator, Type, ...

			The ITokenDefinition must be defined on initialization of the IPBPacketLib
			and are valid until deintialization.
			The information of the ITokenDefintion can be retrieved via INetworkModel and
			can be used for sophisticated representation of the token and it valus with the UI.
	*/
	class ITokenDefinition
	{
	public:
		//! Unique identifier of the token
		/*!
				The token identifier is used all over the whole IPBPacketLib to address
				protocols and fields of protocols. The identifier is only valid during
				runtime and must not be used for persistence.
				
				The are predefined token IDs for convenience reasons, see VPredefinedTokenIds.
				Token IDs of add-on DLLs are created dynamically on defintion with INetworkModelCreator.
		*/
		VDECL GetIdentifier( VTokenId /*out*/ *identifier ) = 0;

		//! Designator of the token
		/*!
				The designator of a token must be unique within its protoocol (but is is not
				globally unique). It must also fullfil the requirements of a CAPL variable
				(no spaces, no special characters, don't start with a number).
		*/
		VDECL GetDesignator( unsigned long /*in*/ bufferSize, char /*out**/ *buffer ) = 0;

		//! Type of the token
		/*!
				See VTokenType.
		*/
		VDECL GetType( VTokenType /*out*/ *type ) = 0;

		//! Format of the token value
		/*!
				The token format can be used for sophisticated presentation of a token
				value, see VTokenFormat.
		*/
		VDECL GetFormat( VTokenFormat /*out*/ *format ) = 0;

		//! Format depended flags
		/*!
				With the format flag the representation of token value can be influenced.
				See VTokeFromatFlags.
		*/
		VDECL GetFormatFlags( unsigned long /*out*/ *flags ) = 0;

		//! Name of a protocol or field of a protocol display on the UI
		/*!
				The display name can contain spaces.
		*/
		VDECL GetDisplayName( unsigned long /*in*/ bufferSize, char /*out**/ *buffer ) = 0;

		//! Short description of the token
		/*!
		*/
		VDECL GetDescription( unsigned long /*in*/ bufferSize, char /*out**/ *buffer ) = 0;

		//! Returns a value table for a token definition
		/*!
				Note: Value tables are only supported for build-in protocols!

				\param packet       Optional parameter to filter the value table for valid
					                  values. Use NULL to return all possible values.
				\param valueTable   The function push the values of the value table to this object.
					                  The caller must implement this interface to receive to values.
		*/
		VDECL GetValueTableDefinition( IPacket /*in*/ *packet, IValueTableDefinition /*in*/ *valueTable ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Iterator for the INetworkModel
	/*! 
			This interface is used to iterate through the definitions of the INetworkModel. Use
			INetworkModel::GetDefinitionIterator to retrieve an iterator, INetworkModel::ReleaseDefinitionIterator
			must be called to delete the iterator.
	*/
	class IDefinitionIterator
	{
	public:
		VDECL Next() = 0;
		VDECL GetCurrent( ITokenDefinition /*out*/ **definition ) = 0;
	};

	//////////////////////////////////////////////////////////////////////
	// Packet API
	//////////////////////////////////////////////////////////////////////

	/*-----------------------------------------------------------------------------------------------*/
	//! Structure for a token within a packet.
	/*! 
		This structure references the data of a token within a packet. The structure is only valid
		within the scope, where its is initialized by the IPBPacketAPI functions. Do not store this
		structure as in a member variable! The structure will be invalid outside the current scope!

		The structure must be created as local (stack) variable. The functions of the IPBPacketAPI
		need a pointer to this structure and will fill the members (with IProtocolManager::GetToken).
		Other functions of the IPBPacketAPI need a filled VToken structure to access the data of a
		token within in packet, like IEncoder::Decode.

		Important: If this structure is changed, IPB_PACKET_LIB_STRUCT_VERSION
		must be increased and the IPBPacketLib will not be compatible with other
		versions of IPB_PACKET_LIB_STRUCT_VERSION.
	*/
	struct VToken
	{
		VTokenId      tokenId;
		IProtocol    *protocol;
		IPacket      *packet;
		unsigned long bitOffset;  //!< Offset from start of packet in [bit]
		unsigned long bitLength;  //!< Length of token in [bit]
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Structure for a protocol token within a packet.
	/*!
		The VProtocolToken is a specialiezed token which references the data of a protocol within a
		packet. It references the header and the payload of a protocol seperatly.

		The functions of the IPBPacketLib which use a VToken as parameter also accept the VProtocolToken.
		These functions will access the payload of the protocol (via bitOffset and bitLength).

		Important: If this structure is changed, IPB_PACKET_LIB_STRUCT_VERSION
		must be increased and the IPBPacketLib will not be compatible with other
		versions of IPB_PACKET_LIB_STRUCT_VERSION.
	*/
	struct VProtocolToken : public VToken
	{
		unsigned long headerBitOffset; //!< Offset from start of packet in [bit]
		unsigned long headerBitLength; //!< Length of token in [bit]
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Structure for the protocols of a packet.
	/*! 
		The IPacket interface must handle and provide this structure. It contains array with all
		protocols of the packet as VProtocolToken. The structure is filled by IProtocolManager::ParsePacket
		or IProtocolManager::InitProtocol. In most cases it is not necessary to access this structure
		directly. Only the member 'contentId' and 'flags' must be set manually by IProtocol.

		Important: If this structure is changed, IPB_PACKET_LIB_STRUCT_VERSION
		must be increased and the IPBPacketLib will not be compatible with other
		versions of IPB_PACKET_LIB_STRUCT_VERSION.
	*/
	struct VProtocols
	{
		BYTE           protocolCapacity; //!< Max. number of protocols in 'protocol'
		BYTE           protocolCount;    //!< Number of protocols in 'protocol'
		BYTE           flags;            //!< Bit 0    - Protocol Error
					                           //!< Bit 1..7 - Reserved
		BYTE           reserved;         //!< Reserved
		ULONG          contentId;        //!< Id of the application layer content (0xFFFFFFFF=no content)
		VProtocolToken protocol[1];      //!< Protocol tokens
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Encoding and decoding hints for IEncoder
	/*! 
		This structure can be provided optionally to IEncoder to give a hint how a token should be
		encoded or decoded. It is mainly needed for kEncodingDisplayText.

		Important: Do not change or remove field of this structure. It is
		allowed to add new fields, if necesarry. 'structSize' must be properly
		initialized and call must use 'structSize' to verify that a required
		field is included.
	*/
	struct VEncoderInfo
	{
		unsigned long structSize; //!< Size of this structure in [byte]
		unsigned long numberBase; //!< Global number base setting, 10=decimal, 16=hexadecimal
		bool          isSymbolic; //!< true, if global setting 'Designatoric' is enabled
		bool          isCompact;  //!< true, if compact (short) output is required, i.e. for trace columns
	};

	typedef VEncoderInfo VDecoderInfo;

	/*-----------------------------------------------------------------------------------------------*/
	//! Info structure of IPacketInspector.
	/*! 
		The structure can optionally provided to IPacketInspector::InspectPacket.

		Important: Do not change or remove field of this structure. It is
		allowed to add new fields, if necesarry. 'structSize' must be properly
		initialized and call must use 'structSize' to verify that a required
		field is included.
	*/
	struct VInspectorInfo
	{
		unsigned long structSize;     //!< Size of this structure in [byte]
		bool          defaultElapsed; //!< True, if items is by default elapsed
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Structure for value table definition for a token definition.
	/*! 
		The structure is used for IValueTableDefinition.

		Important: Do not change or remove field of this structure. It is
		allowed to add new fields, if necesarry. 'structSize' must be properly
		initialized and call must use 'structSize' to verify that a required
		field is included.
	*/
	struct VValueDefinition
	{
		unsigned long structureSize;    //!< Size of this structure in [byte]
		const char   *label;            //!< Label of the value for display
		VTokenFormat  valueFormat;      //!< Format of valueData, see VTokenFormat
		unsigned long valueFormatFlags; //!< Format flags, see VTokeFormatFlagsInteger
		unsigned long valueLength;      //!< Number of byte of value
		void         *valueData;        //!< Points to data of the value
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! The IProtocolManager is the central entity to manage packets.
	/*! 
			The IProtocolManager can be retrieved via IApi::GetProtocolManager. It is the central entity
			to access and create packets and its tokens. It uses the IProtocol to handle specific IP based
			protocols. With the IAddOnManager additional protocols can be implemented in external DLLs by
			the user.
	*/
	class IProtocolManager
	{
	public:
		VDECL GetEncoder        ( VEncoder /*in*/encoderType, IEncoder /*out*/ **encoder ) = 0;

		VDECL CreatePacket      ( VTokenId /*in*/busProtocolId, VTokenId /*in*/busProtocolTypeId, unsigned long /*in*/ capacity, IPacket /*out*/ **packet ) = 0;
		VDECL ReleasePacket     ( IPacket /*in*/ *packet ) = 0;

		VDECL InitPacket        ( IPacket /*in*/*packet, VTokenId /*in*/ busProtocolId, VTokenId /*in*/busProtocolTypeId ) = 0;
		VDECL RemoveProtocol    ( IPacket /*in*/*packet, VTokenId /*in*/ protocolId ) = 0;
		VDECL InitProtocol      ( IPacket /*in*/*packet, VTokenId /*in*/ protocolId, VTokenId /*in*/ protocolTypeId, VProtocolToken /*out*/ *token ) = 0;
		VDECL CompleteProtocol  ( IPacket /*in*/*packet, VTokenId /*in*/ protocolId ) = 0;
		VDECL ParsePacket       ( IPacket /*in*/*packet, VTokenId /*in*/ busProtocolId, IFormatter /*in*/ *errorWriter ) = 0;

		VDECL GetAppProtocol    ( IPacket /*in*/*packet, VProtocolToken /*out*/ *protocol ) = 0;
		VDECL GetProtocol       ( IPacket /*in*/*packet, VTokenId /*in*/ protocolId, VProtocolToken /*out*/ *protocol ) = 0;
		VDECL GetProtocolByIndex( IPacket /*in*/*packet, unsigned long /*in*/ index, VProtocolToken /*out*/ *protocol ) = 0;
		VDECL GetProtocolCount  ( IPacket /*in*/*packet, unsigned long/*out*/ *protocolCount ) = 0;

		VDECL GetToken          ( IPacket /*in*/*packet, VTokenId /*in*/ protocolId, VTokenId /*in*/ tokenId, VToken /*out*/ *token ) = 0;
		VDECL ResizeToken       ( const VToken /*in*/ *token, unsigned long /*in*/bitLength, VToken /*out*/ *resizedToken ) = 0;
		
		VDECL InspectPacket     ( IPacket /*in*/*packet, VInspectionType /*in*/ type, IPacketInspector /*in*/ *inspector ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! The IProtocol handle a single IP based protocol.
	/*!
		This interface must be implemented by specific protocols. The IPBPacketLib contains basic
		protocols, which implement this protocol.
		
		Lifetime: An object, which implements this protocol, must exist during
		the whole runtime (initializato to deinitialzation) of the IPBPacketAPI.
	*/
	class IProtocol
	{
	public:
		//! Initialize the protocol
		/*!
			\param protocolManager The protocol manager for this protocol. The pointer can be stored and is valid
					                   during the whole lifetime of the IProtocol object.
			\param networkModel    The network model for this protocol. The pointer can be stored and is valid
					                   during the whole lifetime of the IProtocol object.
			\param modelCreator    Define network model entities with this object. Pointer is only valid during this call.
		*/
		VDECL Initialize( IProtocolManager /*in*/ *protocolManager, INetworkModel /*in*/ *networkModel, INetworkModelCreator /*in*/ *modelCreator ) = 0;

		/*!
			\param protocolManager The protocol manager for this protocol. The pointer is invalid after Deinitialize.
			\param networkModel    The network model for this protocol. The pointer is invalid after Deinitialize.
		*/
		VDECL Deinitialize( IProtocolManager /*in*/ *protocolManager, INetworkModel /*in*/ *networkModel ) = 0;

		//! Returns the textual designator of the protocol
		/*!
				The designator is used to access the protocol in CAPL (via Nodelayer) or the GUI of CANoe/CANalyzer.

				\param bufferSize   Length of 'buffer'. Must not > 0
				\param buffer       The designator is copied to this buffer. Must not be 0
		*/
		VDECL GetDesignator( unsigned long /*in*/ bufferSize, char /*out**/ *buffer ) = 0;

		//! Unique token identifier of the protocol
		/*!
				The VTokenId of the protocol is registerd on startup during defintion of the protocol token.

				\param identifier  A pointer to a VTokenId, which retrieves the identifier. Must not be 0
		*/
		VDECL GetIdentifier( VTokenId /*out*/ *identifier ) = 0;

		//! Returns specific encoder for a token ID
		/*!
				The IEncoder is used to access a token within a IPacket.

				\param tokenId  Token identifier for which the encoder is requested.
				\param encoder  Returns a pointer to the encoder. Must not be 0.
		*/
		VDECL GetEncoder( VTokenId /*in*/ tokenId, IEncoder /*out*/ **encoder ) = 0;

		//! Initialize a specific protocol during creation of a new packet
		/*!
				Use this method to setup a protocol within a packet.

				\param packet           The packet where the protocol should be setup. Must not be 0.
				\param protocolTypeId   Type ID for a specific type of the protocol, i.e ARP request or ARP response
				\param topProtocolToken Points to the top most protocol within the packet.
				\param protocolToken    This strucuture must be filled in InitProtocol.
		*/
		VDECL InitProtocol( IPacket /*in*/ *packet, VTokenId /*in*/ protocolTypeId, const VProtocolToken /*in*/ *topProtocolToken, VProtocolToken /*out*/ *protocolToken ) = 0;

		//! Complete the protocol at the end of creation/modification of a packet.
		/*!
			In this function the checksum or length field of a protocol can be calculated.

			\param packet   The packet to complete
			\param protocol Points to the protocol token for this protocol
		*/
		VDECL CompleteProtocol( IPacket /*in*/ *packet, const VProtocolToken /*in*/ *protocol ) = 0;

		//! Parse a received packet.
		/*!
				The method is called, when a packet is parsed. During parsing the VProtocols structure is initialzed
				with the protocol information, whiche are returnd with 'protocolToken'.

				\param packet            The packet to parse.
				\param topProtocolToken  Points to the top most, already parsed protocol within the packet.
				\param errorWriter       Use this interface to returne parsing errors, i.e wrong checksum
				\param nextProcotolId    Return the VTokenId of the next protocol.
				\param protocolToken     Fill this strucutre to setup the VProtocols structure.
		*/
		VDECL ParsePacket( IPacket /*in*/ *packet, const VProtocolToken /*in*/ *topProtocolToken, IFormatter /*in*/ *errorWriter, VTokenId /*out*/ *nextProcotolId, VProtocolToken /*out*/ *protocolToken ) = 0;

		//! Return a token of a protocol.
		/*!
			The function must fill the 'token' with the information of the request 'tokenId'.

			\param protocolToken  Points the the VProtocolToken for the protocol.
			\param tokenId        The identifier of the requested token.
			\param token          Points to a VToken, which must be filled by this function.
		*/
		VDECL GetToken( const VProtocolToken /*in*/ *protocolToken, VTokenId /*in*/ tokenId, VToken /*out*/ *token ) = 0;

		//! Build a tree with information of the protocol.
		/*!
				The function is used in CANoe/CANalyzer in the detail view of the trace window to build
				a tree with protocols and fields.

				\param protocolToken  Protocol token of this protocol
				\param type           Inspection type
				\param inspector      IPacketInspectore to create the output.
		*/
		VDECL InspectProtocol( const VProtocolToken /*in*/ *protocolToken, VInspectionType /*in*/ type, IPacketInspector /*in*/ *inspector ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Interface for packets.
	/*!
			The IPacket handles the data of a packet and its VProtocols structure.
	*/
	class IPacket
	{
	public:
		VDECL GetDataSize( unsigned long /*out*/ *dataSize) = 0;
		VDECL GetDataCapacity( unsigned long /*out*/ *dataCapacity) = 0;
		VDECL GetDataPtr( void /*out*/ **data ) = 0;
		VDECL GetProtocols( VProtocols /*out*/ **protocols ) = 0;

		VDECL IsLocked( bool /*out*/ *locked ) = 0;
		VDECL Clear() = 0;
		VDECL Resize( unsigned long /*in*/ newSize ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Intefacef for encoding or decoding values and data of a token whith a packet.
	/*! 
			Encoders are static and singleton objects.
	*/
	class IEncoder
	{
	public:
		VDECL Encode( const VToken /*in*/*token, const VEncoderInfo /*in*/ *info, VEncoding /*in*/encoding, unsigned long /*in*/valueLength, const void /*in*/ *value ) = 0;
		VDECL Decode( const VToken /*in*/*token, const VDecoderInfo /*in*/ *info, VEncoding /*in*/encoding, unsigned long /*in*/bufferLength, void /*in*/ *buffer, unsigned long /*out*/ *decodedLength ) = 0;
		VDECL GetLastError( VResult /*out*/ *error, unsigned long /*in*/bufferSize, char /*out*/ *buffer ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Inteface for creating textual output, i.e Trace window
	/*! 
			IFormatter is provided by the IPacketInspector.
	*/
	class IFormatter
	{
	public:
		VDECL GetNumberBase( unsigned long /*out*/ *numberBase ) = 0;
		VDECL IsSymbolic( unsigned long /*out*/ *symbolic ) = 0;
		VDECL IsCompact( unsigned long /*out*/ *compact ) = 0;

		VDECL Format( const char /*in*/ *format, ... ) = 0;
		VDECL FormatToken( const VToken /*in*/ *token ) = 0;
		VDECL FormatString( const char /*in*/ *string ) = 0;
		VDECL FormatInteger( long /*in*/ value, unsigned long /*in*/ valueLength, unsigned long /*in*/numberBase ) = 0;
		VDECL FormatUnsigned( unsigned long /*in*/ value, unsigned long /*in*/ valueLength, unsigned long /*in*/numberBase ) = 0;
		VDECL FormatDouble( double /*in*/ value, unsigned long /*in*/ fieldLength, unsigned long /*in*/decimalLength ) = 0;
		VDECL FormatData( unsigned long /*in*/ dataLength, const void /*in*/ *data, unsigned long /*in*/numberBase ) = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! The packet inspector is used to create textual output, i.e Trace window
	/*! 
			The packet inspector can build a tree of protocol and protocol fields.
	*/
	class IPacketInspector
	{
	public:
		VDECL BeginToken( VTokenId /*in*/ tokenId, unsigned long /*in*/ index, VInspectorInfo /*in*/ *info ) = 0;
		VDECL SelectField( unsigned long /*in*/ fieldId, IFormatter /*out*/ **formatter ) = 0;
		VDECL EndToken() = 0;
	};

	/*-----------------------------------------------------------------------------------------------*/
	//! Interface to retreive values of a value table
	/*! 
			This interface must be implemented by the client. It is used by the IPBPacketLib
			In ITokenDefinition::GetValueTableDefinition to push the values of a value table to the caller.
	*/
	class IValueTableDefinition
	{
	public:
		//! Add a single definition of a value table entry
		/*!
				\param  definition  Points to a VValueDefinition structure, which contains the
					                  value definition. It is valid until next call of AddValueDefinition
					                  or until ITokenDefinition::GetValueTableDefinition returns
				\return             kOK to receive more values
		*/
		VDECL AddValueDefinition( VValueDefinition /*in*/ *definition ) = 0;
	};

} // namespace NIPB

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

#endif // IPBPACKETAPI_H
