/*------------------------------------------------------------------- ModbusProtocolDLL.cpp ------------------------------------------------------------------- (c) 2009 Vector Informatik GmbH. All rights reserved. ------------------------------------------------------------------- */ #include "StdAfx.h" #include "ModbusProtocolDLL.h" #include "ModbusProtocolAddOn.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 40002 is used. // if (registrar->RegisterProtocol( "modbus", new ModbusProtocolAddOn(), "udp", 40002, 0xFFFFFFFF ) != NIPB::kOK) { ModbusProtocolAddOn::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; } //////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////