Bachelorthesis/Modbus-DLL/include/VCSignalProtocolDLL/VCSignalProtocolDLL.cpp

70 lines
2 KiB
C++
Raw Normal View History

/*-------------------------------------------------------------------
VCSignalProtocolDLL.cpp
-------------------------------------------------------------------
(c) 2009 Vector Informatik GmbH. All rights reserved.
------------------------------------------------------------------- */
#include "StdAfx.h"
#include "VCSignalProtocolDLL.h"
#include "VCSignalProtocolAddOn.h"
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/*--------------------------------------------------------------------*/
//! Reply new ProtocolManager instance
/*!
This function is called on loading of this DLL by the IPB Packet API.
It must register the protocol of this DLL.
*/
STDAPI DllRegisterAddOn( NIPB::IAddOnRegistrar* registrar )
{
if (registrar == NULL)
{
return E_INVALIDARG;
}
//
// register the signal protocol at the IPB Packet Lib. For the protocol
// UDP with source port 40001 is used.
//
if (registrar->RegisterProtocol( "vc-sig", new VCSignalProtocolAddOn(), "udp", 40001, 0xFFFFFFFF ) != NIPB::kOK)
{
VCSignalProtocolAddOn::Instance().Release();
return NIPB::kError;
}
return S_OK;
}
/*--------------------------------------------------------------------*/
//! Return interface version
/*!
This DLL must support a proper version of the IBP Packet API.
*/
STDAPI DllGetApiVersion( unsigned long /*out*/*major, unsigned long /*out*/*minor, unsigned long /*out*/*structVersion )
{
if (major)
{
*major = IPB_PACKET_LIB_INTERFACE_VERSION_MAJOR;
}
if (minor)
{
*minor = IPB_PACKET_LIB_INTERFACE_VERSION_MINOR;
}
if (structVersion)
{
*structVersion = IPB_PACKET_LIB_STRUCT_VERSION;
}
return S_OK;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////