----------------------------------------------------------------------------- Process data received from the Z-Wave PC interface -----------------------------------------------------------------------------
| 1904 | // Process data received from the Z-Wave PC interface |
| 1905 | //----------------------------------------------------------------------------- |
| 1906 | void Driver::ProcessMsg |
| 1907 | ( |
| 1908 | uint8* _data, |
| 1909 | uint8 _length |
| 1910 | ) |
| 1911 | { |
| 1912 | bool handleCallback = true; |
| 1913 | bool wasencrypted = false; |
| 1914 | //uint8 nodeId = GetNodeNumber( m_currentMsg ); |
| 1915 | |
| 1916 | if ((REQUEST == _data[0]) && |
| 1917 | (Security::StaticGetCommandClassId() == _data[5])) { |
| 1918 | /* if this message is a NONCE Report - Then just Trigger the Encrypted Send */ |
| 1919 | if (SecurityCmd_NonceReport == _data[6]) { |
| 1920 | Log::Write(LogLevel_Info, _data[3], "Received SecurityCmd_NonceReport from node %d", _data[3] ); |
| 1921 | |
| 1922 | /* handle possible resends of NONCE_REPORT messages.... See Issue #931 */ |
| 1923 | if (!m_currentMsg) { |
| 1924 | Log::Write(LogLevel_Warning, _data[3], "Received a NonceReport from node, but no pending messages. Dropping.."); |
| 1925 | return; |
| 1926 | } |
| 1927 | |
| 1928 | // No Need to triger a WriteMsg here - It should be handled automatically |
| 1929 | m_currentMsg->setNonce(&_data[7]); |
| 1930 | this->SendEncryptedMessage(); |
| 1931 | return; |
| 1932 | |
| 1933 | /* if this is a NONCE Get - Then call to the CC directly, process it, and then bail out. */ |
| 1934 | } else if (SecurityCmd_NonceGet == _data[6]) { |
| 1935 | Log::Write(LogLevel_Info, _data[3], "Received SecurityCmd_NonceGet from node %d", _data[3] ); |
| 1936 | { |
| 1937 | uint8 *nonce = NULL; |
| 1938 | LockGuard LG(m_nodeMutex); |
| 1939 | Node* node = GetNode( _data[3] ); |
| 1940 | if( node ) { |
| 1941 | nonce = node->GenerateNonceKey(); |
| 1942 | } else { |
| 1943 | Log::Write(LogLevel_Warning, _data[3], "Couldn't Generate Nonce Key for Node %d", _data[3]); |
| 1944 | return; |
| 1945 | } |
| 1946 | |
| 1947 | SendNonceKey(_data[3], nonce); |
| 1948 | |
| 1949 | } |
| 1950 | /* don't continue processing */ |
| 1951 | return; |
| 1952 | |
| 1953 | /* if this message is encrypted, decrypt it first */ |
| 1954 | } else if ((SecurityCmd_MessageEncap == _data[6]) || (SecurityCmd_MessageEncapNonceGet == _data[6])) { |
| 1955 | uint8 _newdata[256]; |
| 1956 | uint8 SecurityCmd = _data[6]; |
| 1957 | uint8 *_nonce; |
| 1958 | |
| 1959 | /* clear out NONCE Report tracking */ |
| 1960 | m_nonceReportSent = 0; |
| 1961 | m_nonceReportSentAttempt = 0; |
| 1962 | |
| 1963 | /* make sure the Node Exists, and it has the Security CC */ |
nothing calls this directly
no test coverage detected