语言版本: Microsoft Visual C++ 2013可再发行(x85)– 12.0.30501

平台版本: 4.0

操作系统: Microsoft Windows 8.1 6.3.9600 Build 9600

任何其他相关软件:

  • Visual Studio 2013社区,带有更新4
  • Halo配置控制面板
  • Halo Hub

  • 我要做什么

    我正在尝试与使用OSDP协议(protocol)的外围设备进行通信。

    实际发生的事情

    我从Visual Studio的输出面板中获得了以下内容。
  • 收到的326个字节的有效数据包
  • 从OSDP Hub收到身份验证响应
  • session key > E856417D8B0364313A4B8F0D89524273F0F70AB1DFF8E950FE96905FECAC9F2F
  • 3毫秒后收到的数据包
  • 收到的有效字节为4字节的数据包
  • 从OSDP Hub收到身份验证拒绝
  • 0毫秒后收到的数据包
  • 在0个设备上执行搜索

  • 粗糙复制
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Work\velox\admins-velox-project\proprietary\rtos\apps\chibios\utilities\osdp_client\Debug_msvc\osdp_client_mswud_vc11.exe'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded
    
    'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded
    
    'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\comdlg32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winspool.drv'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.18006_none_a9ec6aab013aafee\comctl32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wsock32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. Cannot find or open the PDB file.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nsi.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\ProgramData\Internet Helper Anti-phishing\internetHelper_antiphishing.dll'. Module was built without symbols.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\IconCodecService.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WindowsCodecs.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.9600.18696_none_dae05f525bc50fb1\GdiPlus.dll'. Cannot find or open the PDB file.
    Password = 1234
    Private key = 03ac674216f3e15c761ee1a5e255f067
    Added 0 items
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mswsock.dll'. Cannot find or open the PDB file.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dnsapi.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\FWPUCLNT.DLL'. Cannot find or open the PDB file.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rasadhlp.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. Symbols loaded.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rsaenh.dll'. Cannot find or open the PDB file.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. Symbols loaded.
    ..\..\src\common\strvararg.cpp(658): assert "n <= parser.nargs" failed in `anonymous-namespace'::DoGetArgumentType(): more arguments than format string specifiers? [in thread cb4]
    First-chance exception at 0x76165608 (KernelBase.dll) in osdp_client_mswud_vc11.exe: 0x00001976.
    'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dbghelp.dll'. Symbols loaded.
    DBGHELP: Symbol Search Path: .
    DBGHELP: .\wkernelbase.pdb - file not found
    DBGHELP: .\dll\wkernelbase.pdb - file not found
    DBGHELP: .\symbols\dll\wkernelbase.pdb - file not found
    DBGHELP: wkernelbase.pdb - file not found
    DBGHELP: KERNELBASE - export symbols
    DBGHELP: .\osdp_client_mswud_vc11.pdb - file not found
    DBGHELP: .\exe\osdp_client_mswud_vc11.pdb - file not found
    DBGHELP: .\symbols\exe\osdp_client_mswud_vc11.pdb - file not found
    Received valid packet of 326 bytes
    Received authentication response from OSDP Hub
    Session Key > 63B2D0C583090EFD994B5AFE12A417A07F406CEE1F64DCB1613703B45428E32E
    Received packet after 3 ms
    Received valid packet of 4 bytes
    Received authentication denial from OSDP Hub
    Received packet after 2 ms
    DBGHELP: osdp_client_mswud_vc11 - private symbols & lines
            C:\Work\velox\admins-velox-project\proprietary\rtos\apps\chibios\utilities\osdp_client\Debug_msvc\osdp_client_mswud_vc11.pdb
    DBGHELP: .\msvcr120d.i386.pdb - file not found
    DBGHELP: .\dll\msvcr120d.i386.pdb - file not found
    DBGHELP: .\symbols\dll\msvcr120d.i386.pdb - file not found
    DBGHELP: msvcr120d.i386.pdb - file not found
    DBGHELP: MSVCR120D - export symbols
    DBGHELP: .\wntdll.pdb - file not found
    DBGHELP: .\dll\wntdll.pdb - file not found
    DBGHELP: .\symbols\dll\wntdll.pdb - file not found
    DBGHELP: wntdll.pdb - file not found
    DBGHELP: ntdll - export symbols
    DBGHELP: .\wkernel32.pdb - file not found
    DBGHELP: .\DLL\wkernel32.pdb - file not found
    DBGHELP: .\symbols\DLL\wkernel32.pdb - file not found
    DBGHELP: wkernel32.pdb - file not found
    DBGHELP: KERNEL32 - export symbols
    

    这是实际的代码;
    case OSDP_HUB:
    {
        bool ipv4;
        uint8_t ip_addr[16];
    
        osdp_hub_messages* hub = (osdp_hub_messages*)m_packets.get_data( OSDP_HUB );
    
        // goes from here to decode method ondown
        hub->decode( (uint8_t*)buffer, m_packets.get_header()->m_data.length );
    
        if ( hub->get_msg_type() == OSDP_HUB_TCP_IND )
        {
            hub->get_ip_addr( &ipv4, ip_addr );
    
            if ( hub->get_enable() )
            {
                            // Device has connected...
                wxLogDebug( wxT("Device connected on IP address %d.%d.%d.%d : %u"),
                    ip_addr[0], ip_addr[1], ip_addr[2], ip_addr[3], hub->get_tcp_port() );
    
                m_tcp_device_connected = true;
    
                            // Assign an address
                            /// @todo Create an address generation function
                std::vector<uint8_t> ip_addr_vec;
                ip_addr_vec.resize( ipv4? 4 : 16 );
                memcpy( &ip_addr_vec[0], ip_addr, ipv4? 4 : 16 );
                m_tcp_map[0] = ip_addr_vec;
    
                MyCustomEvent customEvent( MyCustomCommandEvent, ID_EVENT_TCP_ADD );
                customEvent.SetText( _T( "SocketThread::Entry() ID_EVENT_TCP_ADD" ) );
                wxPostEvent( m_parent, customEvent );
            }
            else
            {
                            // Device has disconnected...
                wxLogDebug( wxT("Device disconnected on IP address %d.%d.%d.%d"),
                    ip_addr[0], ip_addr[1], ip_addr[2], ip_addr[3] );
    
                            // Change the UI to display the nearest device on the list
                MyCustomEvent customEvent( MyCustomCommandEvent, ID_EVENT_TCP_REMOVE );
                customEvent.SetText( _T( "SocketThread::Entry() ID_EVENT_TCP_REMOVE" ) );
                wxPostEvent( m_parent, customEvent );
            }
        }
        else if ( hub->get_msg_type() == OSDP_HUB_AUTH_1 )
        {
            wxLogDebug( wxT("Received authentication response from OSDP Hub") );
    
            m_auth1_received = true;
    
            std::string salt = hub->get_salt();
            std::string key = hub->get_publickey();
            m_srp_auth->gen_client_session_key( salt, key );
            wxLogDebug( wxT("Session Key > %s"), m_srp_auth->get_session_key() );
            m_srp_auth->gen_client_cryptogram();
        }
        else if ( hub->get_msg_type() == OSDP_HUB_AUTH_3 ) // skips here
        {
            wxLogDebug( wxT("Received authentication accept from OSDP Hub") );
    
            m_auth3_received = true;
        }
        else if ( hub->get_msg_type() == OSDP_HUB_AUTH_4 ) // enters in here
        {
            wxLogDebug( wxT("Received authentication denial from OSDP Hub") );
    
            m_auth4_received = true;
        }
        else if ( hub->get_msg_type() == OSDP_HUB_PONG )
        {
            wxLogDebug( wxT("Received PONG from OSDP Hub") );
    
            m_pong_received = true;
    
            int32_t length;
            hub->encode( (uint8_t*)msg, &length );
            m_clientSocket->Write( (char*)msg, length );
        }
    } break;
    
    
    //comes in here
    int32_t osdp_hub_messages::decode( uint8_t* buffer, int32_t len )
    {
        return osdp_hub_messages_decode( &m_osdp_hub_messages, buffer, len );
    
    } // decode()
    
    
    // then comes in here
    int32_t osdp_hub_messages_decode( osdp_hub_messages_t* data, uint8_t* buffer, int32_t len )
    {
        //goes from OSDP_HUB_AUTH_2 t0 OSDP_HUB_AUTH_4
        //never hits OSDP_HUB_START or OSDP_HUB_TCP_IND
        data->hub_msg = (osdp_hub_e)buffer[0];
    
    
        switch ( data->hub_msg )
        {
            case OSDP_HUB_START: return decode_start( data, buffer+1, len ); break;
            case OSDP_HUB_TCP_IND: return decode_tcp_ind( data, buffer+1, len ); break;
            case OSDP_HUB_AUTH_0: return decode_auth_0( data, buffer+1, len ); break;
            case OSDP_HUB_AUTH_1: return decode_auth_1( data, buffer+1, len ); break;
            case OSDP_HUB_AUTH_2: return decode_auth_2( data, buffer+1, len ); break;
            case OSDP_HUB_AUTH_3: return decode_auth_2( data, buffer+1, len ); break;
            case OSDP_HUB_AUTH_4: return decode_auth_4( data, buffer+1, len ); break;
            case OSDP_HUB_PING: return decode_ping( data, buffer+1, len ); break;
            case OSDP_HUB_PONG: return decode_pong( data, buffer+1, len ); break;
            case OSDP_HUB_GET_AUTH_1: return decode_get_auth_1( data, buffer+1, len ); break;
            case OSDP_HUB_GET_AUTH_3: return decode_get_auth_3( data, buffer+1, len ); break;
    
            default:
            {
                return 0;
            } break;
        }
    
    } // osdp_hub_messages_decode()
    
    //additional code
    
    
    /// @file osdp_halo_alarm_base.h
    /// @brief A C implementation of the proprietary Halo alarm packet.
    ///
    /// @author neil
    
    #pragma once
    
    #include "osdp_header.h"
    
    
    #ifdef _cplusplus
    extern "C" {
    #endif
    
    /// The ID used to define a HALO HUB packet
    #define OSDP_HUB    0x00
    
    typedef enum
    {
        OSDP_HUB_START = 0,
        OSDP_HUB_TCP_IND,
        OSDP_HUB_AUTH_0,
        OSDP_HUB_AUTH_1,
        OSDP_HUB_AUTH_2,
        OSDP_HUB_AUTH_3,
        OSDP_HUB_AUTH_4,
        OSDP_HUB_PING,
        OSDP_HUB_PONG,
        OSDP_HUB_GET_AUTH_1,
        OSDP_HUB_GET_AUTH_3,
    } osdp_hub_e;
    
    struct _osdp_hub_messages_t
    {
        osdp_hub_e     hub_msg;
        bool           enable;
        uint8_t        max_tcp;
        uint8_t        ip_addr[16];
        bool           ipv4;
        uint32_t       port;
        bool           success;
        uint8_t        username[17];
        uint8_t        publickey[321];
        uint8_t        salt[65];
        uint8_t        cryptogram[65];
        osdp_header_t* header;
    };
    typedef struct _osdp_hub_messages_t osdp_hub_messages_t;
    
    
    /// @brief Translate the data structure to a packet for transmission
    /// @param buffer An input data buffer used to store the packet
    /// @param len The length of the output packet
    void osdp_hub_messages_encode( osdp_hub_messages_t* data, uint8_t* buffer, int32_t* len );
    
    /// @brief Translate a received packet into a data structure
    /// @param data A struct containing the decoded output parameters
    /// @param buffer An input data buffer used to store the packet
    /// @param len The length of the input packet
    /// @return The number of decoded bytes
    int32_t osdp_hub_messages_decode( osdp_hub_messages_t* data, uint8_t* buffer, int32_t len );
    
    
    #ifdef _cplusplus
    }
    #endif
    
    //
    // end of file
    //
    

    需要更多的信息,我一定会添加它。谢谢你的帮助!

    最佳答案

    您发布的代码看起来不像SIA OSDP。 (根据Sensurity的网站,即他们所指的OSDP。)也许这是该机制的其他部分?当前有关IP网络上OSDP的SIA OSDP工作组 Activity 是围绕TCP上的OSDP(使用现有的“安全 channel ”机制)或基于TLS的OSDP。

    10-04 12:19