00001 // 00002 // Copyright (C) 2005 Andras Varga 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this program; if not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 #include "IPv6ControlInfo.h" 00019 #include "IPv6Datagram.h" 00020 00021 IPv6ControlInfo::~IPv6ControlInfo() 00022 { 00023 if (dgram) 00024 { 00025 drop(dgram); 00026 delete dgram; 00027 } 00028 } 00029 00030 void IPv6ControlInfo::setOrigDatagram(IPv6Datagram *d) 00031 { 00032 if (dgram) 00033 opp_error("IPv6ControlInfo::setOrigDatagram(): a datagram is already attached"); 00034 dgram = d; 00035 take(dgram); 00036 } 00037 00038 IPv6Datagram *IPv6ControlInfo::removeOrigDatagram() 00039 { 00040 if (!dgram) 00041 opp_error("IPv6ControlInfo::removeOrigDatagram(): no datagram attached " 00042 "(already removed, or maybe this IPv6ControlInfo does not come " 00043 "from the IPv6 module?)"); 00044 IPv6Datagram *ret = dgram; 00045 drop(dgram); 00046 dgram = NULL; 00047 return ret; 00048 } 00049 00050