Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MNLCRTPRangeList.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef MNLCRTPRANGELIST_H 00025 #define MNLCRTPRANGELIST_H 00026 00027 /* 00028 LCRTPRangeList enthaelt die funktionalitaet der Range Liste 00029 Es werden Bytecount bereiche gespeichert und ggf gemerged. 00030 LCRTPLossList und ... benutzen diese Klasse 00031 */ 00032 00033 #include <stdlib.h> 00034 #include <unistd.h> 00035 #include <sys/time.h> 00036 #include "mnstream.h" 00037 #include "var_type.h" 00038 #include "MNMsg.h" 00039 #include "MNList.h" 00040 00041 struct LossRange_t; 00042 00043 class LossRange_tList 00044 : private MNList<LossRange_t*> 00045 { 00046 public: 00047 void* first() { 00048 return MNList<LossRange_t*>::first(); 00049 } 00050 00051 void next( void*& pix ) { 00052 pix = MNList<LossRange_t*>::succ(pix); 00053 } 00054 00055 void prev( void*& pix ) { 00056 pix = MNList<LossRange_t*>::pred(pix); 00057 } 00058 00059 LossRange_t* operator()( void* pix ) { 00060 return MNList<LossRange_t*>::inf(pix); 00061 } 00062 00063 void append( LossRange_t* p ) { 00064 MNList<LossRange_t*>::push_back ( p ); 00065 } 00066 00067 void clear() { 00068 MNList<LossRange_t*>::clear(); 00069 } 00070 00071 void del( void* pix ) { 00072 MNList<LossRange_t*>::del_item(pix); 00073 } 00074 00075 void ins_after( void* pix, LossRange_t *n ) { 00076 MNList<LossRange_t*>::ins_after(pix,n); 00077 } 00078 00079 void ins_before( void* pix, LossRange_t *n ) { 00080 MNList<LossRange_t*>::ins_before(pix,n); 00081 } 00082 }; 00083 00084 /************************************************************** 00085 * Klasse: MNLCRTPRangeList 00086 * Beschreibung: enthaelt die funktionalitaet der Rangeliste 00087 * September 99 00088 **************************************************************/ 00089 struct LossRange_t 00090 { 00091 u_int64 range_begin; /* begin of a bytecount range */ 00092 u_int64 range_end; /* end of a bytecount range */ 00093 u_int32 counter; /* counter, needed for the scheduler in the send_loss_list */ 00094 }; 00095 00096 class MNLCRTPRangeList 00097 { 00098 private: 00099 /* vars */ 00100 LossRange_tList data; 00101 typedef void* Pix; 00102 00103 /* flags */ 00104 bool merge; /* if true, adjacent ranges are merged together, works only if range_in_order is true */ 00105 bool range_in_order; /* if true, - the ranges are kept in increasing order (begin < end) 00106 - range borders are kept, so overlapping ranges can exists in the list, if they are not merged 00107 if false,- data is only appended */ 00108 00109 /* functions */ 00110 void clr(); 00111 bool overlapps(Pix elem, u_int64 begin_r, u_int64 end_r); 00112 Pix get_place(u_int64 begin_r, u_int64 end_r); 00113 00114 public: 00115 MNLCRTPRangeList(); 00116 ~MNLCRTPRangeList(); 00117 00118 /* create */ 00119 void insert_data(u_int64 begin_r, u_int64 end_r); 00120 void insert_data_or_increment_counter(u_int64 begin_r, u_int64 end_r); 00121 00122 /* destroy */ 00123 void delete_all(); 00124 void delete_range(u_int64 begin_r, u_int64 end_r); 00125 00126 /* control */ 00127 void disable_merge(); 00128 void enable_merge(); 00129 void disable_in_order(); 00130 void enable_in_order(); 00131 bool range_exists(u_int64 begin_r); /* true, if a range exists, where begin_R fits in */ 00132 LossRange_t* get_first_data(); 00133 LossRange_t* get_next_data(u_int64 begin_r); /* return only an entry, if the range begins exactly on begin_r */ 00134 LossRange_t* get_next_in_range_data(u_int64 begin_r); /* return an entry, if a range exists, where begin_r is in it */ 00135 int get_counter(u_int64 begin_r); 00136 LossRange_t* get_worst_counter_data(); 00137 }; 00138 00139 #endif 00140

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8