blob: 679a80396bfd77ff1b16cac0d5a8f016fe42a49d [file] [log] [blame]
Alexandre Lision51140e12013-12-02 10:54:09 -05001/*
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05002 Copyright (C) 2006-2013 Werner Dittmann
Alexandre Lision51140e12013-12-02 10:54:09 -05003
4 This program is free software: you can redistribute it and/or modify
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05005 it under the terms of the GNU Lesser General Public License as published by
Alexandre Lision51140e12013-12-02 10:54:09 -05006 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef _ZRTPPACKETERROR_H_
19#define _ZRTPPACKETERROR_H_
20
21/**
22 * @file ZrtpPacketError.h
23 * @brief The ZRTP Error message
24 *
25 * @ingroup GNU_ZRTP
26 * @{
27 */
28
29#include <libzrtpcpp/ZrtpPacketBase.h>
30
31/**
32 * Implement the Error packet.
33 *
34 * The ZRTP simple message Error. The implementation sends this
35 * after detecting an error.
36 *
37 * @author Werner Dittmann <Werner.Dittmann@t-online.de>
38 */
39
40class __EXPORT ZrtpPacketError : public ZrtpPacketBase {
41
42 protected:
43 Error_t* errorHeader; ///< Points to Error message
44
45 public:
46 /// Creates a Error packet with default data
47 ZrtpPacketError();
48
49 /// Creates a Error packet from received data
50 ZrtpPacketError(uint8_t* data);
51
52 virtual ~ZrtpPacketError();
53
54 /// Get the error code from Error message
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -050055 uint32_t getErrorCode() { return zrtpNtohl(errorHeader->errorCode); };
Alexandre Lision51140e12013-12-02 10:54:09 -050056
57 /// Set error code in Error message
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -050058 void setErrorCode(uint32_t code) {errorHeader->errorCode = zrtpHtonl(code); };
Alexandre Lision51140e12013-12-02 10:54:09 -050059
60 private:
61 ErrorPacket_t data;
62};
63
64/**
65 * @}
66 */
67#endif // ZRTPPACKETERROR
68