blob: 51ad8c8ffe311f7fa996139c6ec7c4c08c286719 [file] [log] [blame]
Alexandre Lision51140e12013-12-02 10:54:09 -05001/*
2 Copyright (C) 2006-2009 Werner Dittmann
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 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 _ZRTPPACKETPINGACK_H_
19#define _ZRTPPACKETPINGACK_H_
20
21#include <libzrtpcpp/ZrtpPacketBase.h>
22/**
23 * @file ZrtpPacketPingAck.h
24 * @brief The ZRTP PingAck message
25 *
26 * @ingroup GNU_ZRTP
27 * @{
28 */
29
30/**
31 * Implement the PingAck packet.
32 *
33 * The ZRTP simple message PingAck.
34 *
35 * @author Werner Dittmann <Werner.Dittmann@t-online.de>
36 */
37class __EXPORT ZrtpPacketPingAck : public ZrtpPacketBase {
38
39 protected:
40 PingAck_t* pingAckHeader; ///< Points to PingAck message
41
42 public:
43 /// Creates a PingAck message with default data
44 ZrtpPacketPingAck();
45
46 /// Creates a PingAck message from received data
47 ZrtpPacketPingAck(uint8_t* data);
48
49 virtual ~ZrtpPacketPingAck();
50
51 /// Get SSRC from PingAck message
52 uint32_t getSSRC() { return ntohl(pingAckHeader->ssrc); };
53
54 /// Set ZRTP protocol version field, fixed ASCII character array
55 void setVersion(uint8_t *text) { memcpy(pingAckHeader->version, text, ZRTP_WORD_SIZE ); }
56
57 /// Set SSRC in PingAck message
58 void setSSRC(uint32_t data) {pingAckHeader->ssrc = htonl(data); };
59
60 /// Set remote endpoint hash, fixed byte array
61 void setRemoteEpHash(uint8_t *hash) { memcpy(pingAckHeader->remoteEpHash, hash, sizeof(pingAckHeader->remoteEpHash)); }
62
63 /// Set local endpoint hash, fixed byte array
64 void setLocalEpHash(uint8_t *hash) { memcpy(pingAckHeader->localEpHash, hash, sizeof(pingAckHeader->localEpHash)); }
65
66 private:
67 PingAckPacket_t data;
68};
69
70/**
71 * @}
72 */
73#endif // ZRTPPACKETCLEARACK
74