This file is indexed.

/usr/include/openzwave/Msg.h is in libopenzwave1.5-dev 1.5+ds-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
//-----------------------------------------------------------------------------
//
//	Msg.h
//
//	Represents a Z-Wave message
//
//	Copyright (c) 2010 Mal Lansell <openzwave@lansell.org>
//
//	SOFTWARE NOTICE AND LICENSE
//
//	This file is part of OpenZWave.
//
//	OpenZWave is free software: you can redistribute it and/or modify
//	it under the terms of the GNU Lesser General Public License as published
//	by the Free Software Foundation, either version 3 of the License,
//	or (at your option) any later version.
//
//	OpenZWave is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU Lesser General Public License for more details.
//
//	You should have received a copy of the GNU Lesser General Public License
//	along with OpenZWave.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------

#ifndef _Msg_H
#define _Msg_H

#include <cstdio>
#include <string>
#include <string.h>
#include "Defs.h"
//#include "Driver.h"

namespace OpenZWave
{
	class CommandClass;
	class Driver;

	/** \brief Message object to be passed to and from devices on the Z-Wave network.
	 */
	class OPENZWAVE_EXPORT Msg
	{
	public:
		enum MessageFlags
		{
			m_MultiChannel			= 0x01,		// Indicate MultiChannel encapsulation
			m_MultiInstance			= 0x02,		// Indicate MultiInstance encapsulation
		};

		Msg( string const& _logtext, uint8 _targetNodeId, uint8 const _msgType, uint8 const _function, bool const _bCallbackRequired, bool const _bReplyRequired = true, uint8 const _expectedReply = 0, uint8 const _expectedCommandClassId = 0 );
		~Msg(){}

		void SetInstance( CommandClass* _cc, uint8 const _instance );	// Used to enable wrapping with MultiInstance/MultiChannel during finalize.

		void Append( uint8 const _data );
		void Finalize();
		void UpdateCallbackId();

		/**
		 * \brief Identifies the Node ID of the "target" node (if any) for this function.
		 * \return Node ID of the target.
		 */
		uint8 GetTargetNodeId()const{ return m_targetNodeId; }

		/**
		 * \brief Identifies the Callback ID (if any) for this message.  Callback ID is a value (OpenZWave uses sequential IDs) that
		 * helps the application associate message responses with the original message request.
		 * \return Callback ID for this message.
		 */
		uint8 GetCallbackId()const{ return m_callbackId; }

		/**
		 * \brief Identifies the expected reply type (if any) for this message. The expected reply is a function code...one
		 * of the FUNC_ID... values defined in Defs.h.  Many Z-Wave functions generate responses with the same function code
		 * (for example, a FUNC_ID_ZW_GET_VERSION message generates a FUNC_ID_ZW_GET_VERSION response.  But other functions
		 * generate a different response. FUNC_ID_ZW_SEND_DATA triggers several responses, but ultimately, a "Get" sent with
		 * this function should result in a FUNC_ID_APPLICATION_COMMAND_HANDLER response.
		 * \return Expected reply (function code) for this message.
		 */
		uint8 GetExpectedReply()const{ return m_expectedReply; }

		/**
		 * \brief Identifies the expected Command Class ID (if any) for this message.
		 * \return Expected command class ID for this message.
		 */
		uint8 GetExpectedCommandClassId()const{ return m_expectedCommandClassId; }

		/**
		 * \brief For messages that request a Report for a specified command class, identifies the expected Instance
		 * for the variable being obtained in the report.
		 * \return Expected Instance value for this message.
		 */
		uint8 GetExpectedInstance()const{ return m_instance; }

		/**
		 * \brief For messages that request a Report for a specified command class, identifies the expected Index
		 * for the variable being obtained in the report.
		 * \return Expected Index value for this message.
		 */
//		uint8 GetExpectedIndex()const{ return m_expectedIndex; }
		/**
		 * \brief get the LogText Associated with this message
		 * \return the LogText used during the constructor
		 */
		string GetLogText()const{ return m_logText; }

		uint32 GetLength()const{ return m_encrypted == true ? m_length + 20 + 6 : m_length; }
		uint8* GetBuffer();
		string GetAsString();

		uint8 GetSendAttempts()const{ return m_sendAttempts; }
		void SetSendAttempts( uint8 _count ){ m_sendAttempts = _count; }

		uint8 GetMaxSendAttempts()const{ return m_maxSendAttempts; }
		void SetMaxSendAttempts( uint8 _count ){ if( _count < MAX_MAX_TRIES ) m_maxSendAttempts = _count; }

		bool IsWakeUpNoMoreInformationCommand()
		{
			return( m_bFinal && (m_length==11) && (m_buffer[3]==0x13) && (m_buffer[6]==0x84) && (m_buffer[7]==0x08) );
		}
		bool IsNoOperation()
		{
			return( m_bFinal && (m_length==11) && (m_buffer[3]==0x13) && (m_buffer[6]==0x00) && (m_buffer[7]==0x00) );
		}

		bool operator == ( Msg const& _other )const
		{
			if( m_bFinal && _other.m_bFinal )
			{
				// Do not include the callback Id or checksum in the comparison.
				uint8 length = m_length - (m_bCallbackRequired ? 2: 1 );
				return( !memcmp( m_buffer, _other.m_buffer, length ) );
			}

			return false;
		}
		uint8 GetSendingCommandClass() {
			if (m_buffer[3] == 0x13) {
				return m_buffer[6];
			}
			return 0;

		}

		bool isEncrypted() {
			return m_encrypted;
		}
		void setEncrypted() {
			m_encrypted = true;
		}
		bool isNonceRecieved() {
			return m_noncerecvd;
		}
		void setNonce(uint8 nonce[8]) {
			memcpy(m_nonce, nonce, 8);
			m_noncerecvd = true;
			UpdateCallbackId();
		}
		void clearNonce() {
			memset((m_nonce), '\0', 8);
			m_noncerecvd = false;
		}
		void SetHomeId(uint32 homeId) { m_homeId = homeId; };

		/** Returns a pointer to the driver (interface with a Z-Wave controller)
		 *  associated with this node.
		*/
		Driver* GetDriver()const;
	private:


		void MultiEncap();					// Encapsulate the data inside a MultiInstance/Multicommand message

		string			m_logText;
		bool			m_bFinal;
		bool			m_bCallbackRequired;

		uint8			m_callbackId;
		uint8			m_expectedReply;
		uint8			m_expectedCommandClassId;
		uint8			m_length;
		uint8			m_buffer[256];
		uint8			e_buffer[256];

		uint8			m_targetNodeId;
		uint8			m_sendAttempts;
		uint8			m_maxSendAttempts;

		uint8			m_instance;
		uint8			m_endPoint;			// Endpoint to use if the message must be wrapped in a multiInstance or multiChannel command class
		uint8			m_flags;

		bool			m_encrypted;
		bool			m_noncerecvd;
		uint8			m_nonce[8];
		uint32			m_homeId;
		static uint8		s_nextCallbackId;		// counter to get a unique callback id
	};

} // namespace OpenZWave

#endif //_Msg_H