|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2008 Irene Ruengeler 00003 // Copyright (C) 2010 Thomas Dreibholz 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #include "SCTPSendStream.h" 00020 00021 00022 SCTPSendStream::SCTPSendStream(const uint16 id) 00023 { 00024 streamId = id; 00025 nextStreamSeqNum = 0; 00026 00027 char queueName[64]; 00028 snprintf(queueName, sizeof(queueName), "OrderedSendQueue ID %d", id); 00029 streamQ = new cQueue(queueName); 00030 snprintf(queueName, sizeof(queueName), "UnorderedSendQueue ID %d", id); 00031 uStreamQ = new cQueue(queueName); 00032 } 00033 00034 SCTPSendStream::~SCTPSendStream() 00035 { 00036 deleteQueue(); 00037 } 00038 00039 void SCTPSendStream::deleteQueue() 00040 { 00041 SCTPDataMsg* datMsg; 00042 SCTPSimpleMessage* smsg; 00043 int32 count = streamQ->length(); 00044 while (!streamQ->empty()) { 00045 datMsg = check_and_cast<SCTPDataMsg*>(streamQ->pop()); 00046 smsg = check_and_cast<SCTPSimpleMessage*>(datMsg->decapsulate()); 00047 delete smsg; 00048 delete datMsg; 00049 count--; 00050 } 00051 while (!uStreamQ->empty()) { 00052 datMsg = check_and_cast<SCTPDataMsg*>(uStreamQ->pop()); 00053 smsg = check_and_cast<SCTPSimpleMessage*>(datMsg->decapsulate()); 00054 delete smsg; 00055 delete datMsg; 00056 } 00057 delete streamQ; 00058 delete uStreamQ; 00059 }