blob: 94d4dc19935a4363dc0b3ba093473134809a4d66 [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/* Copyright (C) 2006
19 *
20 * Authors: Werner Dittmann <Werner.Dittmann@t-online.de>
21 */
22
23#include <libzrtpcpp/ZrtpPacketError.h>
24
25ZrtpPacketError::ZrtpPacketError() {
26 DEBUGOUT((fprintf(stdout, "Creating Error packet without data\n")));
27
28 zrtpHeader = &data.hdr; // the standard header
29 errorHeader = &data.error;
30
31 setZrtpId();
32 setLength((sizeof(ErrorPacket_t) / ZRTP_WORD_SIZE) - 1);
33 setMessageType((uint8_t*)ErrorMsg);
34}
35
36ZrtpPacketError::ZrtpPacketError(uint8_t *data) {
37 DEBUGOUT((fprintf(stdout, "Creating Error packet from data\n")));
38
39 allocated = NULL;
40 zrtpHeader = (zrtpPacketHeader_t *)&((ErrorPacket_t *)data)->hdr; // the standard header
41 errorHeader = (Error_t *)&((ErrorPacket_t *)data)->error;
42}
43
44ZrtpPacketError::~ZrtpPacketError() {
45 DEBUGOUT((fprintf(stdout, "Deleting Error packet: alloc: %x\n", allocated)));
46}