Alexandre Lision | 51140e1 | 2013-12-02 10:54:09 -0500 | [diff] [blame] | 1 | /* |
Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 2 | Copyright (C) 2006-2013 Werner Dittmann |
Alexandre Lision | 51140e1 | 2013-12-02 10:54:09 -0500 | [diff] [blame] | 3 | |
| 4 | This program is free software: you can redistribute it and/or modify |
Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 5 | it under the terms of the GNU Lesser General Public License as published by |
Alexandre Lision | 51140e1 | 2013-12-02 10:54:09 -0500 | [diff] [blame] | 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 | */ |
| 37 | class __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 |
Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 52 | uint32_t getSSRC() { return zrtpNtohl(pingAckHeader->ssrc); }; |
Alexandre Lision | 51140e1 | 2013-12-02 10:54:09 -0500 | [diff] [blame] | 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 |
Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 58 | void setSSRC(uint32_t data) {pingAckHeader->ssrc = zrtpHtonl(data); }; |
Alexandre Lision | 51140e1 | 2013-12-02 10:54:09 -0500 | [diff] [blame] | 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 | |