00001 /* 00002 * Copyright (c) 2003 Ericsson Telecommunicatie B.V. 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the 00013 * distribution. 00014 * 3. Neither the name of Ericsson Telecommunicatie B.V. may be used 00015 * to endorse or promote products derived from this software without 00016 * specific prior written permission. 00017 * 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY ERICSSON TELECOMMUNICATIE B.V. AND 00020 * CONTRIBUTORS "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, 00021 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00022 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00023 * IN NO EVENT SHALL ERICSSON TELECOMMUNICATIE B.V., THE AUTHOR OR HIS 00024 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00026 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00027 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00028 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00030 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 * 00032 * 00033 * Contact for feedback on EURANE: eurane@ti-wmc.nl 00034 * EURANE = Enhanced UMTS Radio Access Network Extensions 00035 * website: http://www.ti-wmc.nl/eurane/ 00036 */ 00037 00038 /* 00039 * $Id: umts-timers.cc,v 1.18 2004/01/20 13:29:24 simon Exp $ 00040 */ 00041 00042 #include "umts-timers.h" 00043 00044 UmtsTimer::UmtsTimer(RLC * rlc, int timeoutNumber, int flowID):TimerHandler() 00045 { 00046 00047 if (rlc != NULL) { 00048 rlc_ = rlc; 00049 timeoutNumber_ = timeoutNumber; 00050 } else { 00051 } 00052 } 00053 00054 void UmtsTimer::expire(Event *) 00055 { 00056 rlc_->timeout(timeoutNumber_); 00057 } 00058 00059 double UmtsTimer::timeOfExpiry() 00060 { 00061 return event_.time_; 00062 } 00063 00064 00065 char *UmtsTimer::getName() 00066 { 00067 switch (timeoutNumber_) { 00068 case RLC_TIMER_POLL: 00069 return "RLC_TIMER_POLL"; 00070 break; 00071 case RLC_TIMER_RTX: 00072 return "RLC_TIMER_RTX"; 00073 break; 00074 case RLC_TIMER_DELSND: 00075 return "RLC_TIMER_DELSND"; 00076 break; 00077 case RLC_TIMER_STPROB: 00078 return "RLC_TIMER_STPROB"; 00079 break; 00080 case RLC_TIMER_TTI: 00081 return "RLC_TIMER_TTI"; 00082 break; 00083 case RLC_TIMER_TEMP_PDU: 00084 return "RLC_TIMER_TEMP_PDU"; 00085 break; 00086 case RLC_TIMER_CREDIT: 00087 return "RLC_TIMER_CREDIT"; 00088 break; 00089 case RLC_TIMER_STATUS: 00090 return "RLC_TIMER_STATUS"; 00091 break; 00092 case RLC_TIMER_MRWACK: 00093 return "RLC_TIMER_MRWACK"; 00094 break; 00095 default: 00096 return "UNKNOWN"; 00097 break; 00098 } 00099 } 00100 00101 // HsdpaMacTimer::HsdpaMacTimer(VirtualUmtsMac * mac, int timeoutNumber, 00102 // int flowID):TimerHandler() 00103 // { 00104 // mac_ = mac; 00105 // timeoutNumber_ = timeoutNumber; 00106 // flowID_ = flowID; 00107 // } 00108 00109 // void HsdpaMacTimer::expire(Event *) 00110 // { 00111 // mac_->timeout(timeoutNumber_); 00112 // } 00113 00114 // double HsdpaMacTimer::timeOfExpiry() 00115 // { 00116 // return event_.time_; 00117 // } 00118 00119 // char *HsdpaMacTimer::getName() 00120 // { 00121 // switch (timeoutNumber_) { 00122 // case MACHS_TIMER_FRAME: 00123 // return "MACHS_TIMER_FRAME"; 00124 // break; 00125 // case MACHS_TIMER_CREDALLOC: 00126 // return "MACHS_TIMER_CREDALLOC"; 00127 // break; 00128 // case MACHS_TIMER_SCHEDULE: 00129 // return "MACHS_TIMER_SCHEDULE"; 00130 // break; 00131 // case MACHS_TIMER_REORDER_STALL: 00132 // return "MACHS_TIMER_REOR"; 00133 // break; 00134 // case MACHS_TIMER_PROCESS_CLEAR: 00135 // return "MACHS_TIMER_PROCESS_CLEAR"; 00136 // break; 00137 // default: 00138 // return "UNKNOWN HSDPAMAC TIMER"; 00139 // break; 00140 // } 00141 // } 00142 00143 // 00144 void UmtsTimer::cancel() 00145 { 00146 if (status_ != TIMER_PENDING) { 00147 return; 00148 } else { 00149 ((TimerHandler *) this)->cancel(); 00150 } 00151 } 00152 00153 void UmtsTimer::sched(double delay) 00154 { 00155 if (delay >= 0) { 00156 ((TimerHandler *) this)->sched(delay); 00157 } else { 00158 abort(); 00159 } 00160 } 00161 00162 void UmtsTimer::resched(double delay) 00163 { 00164 if (delay >= 0) { 00165 ((TimerHandler *) this)->resched(delay); 00166 } else { 00167 abort(); 00168 } 00169 } 00170 00171 00172 // void HsdpaMacTimer::cancel() 00173 // { 00174 00175 // if (status_ != TIMER_PENDING) { 00176 // return; 00177 // } else { 00178 // ((TimerHandler *) this)->cancel(); 00179 // } 00180 // } 00181 00182 // void HsdpaMacTimer::sched(double delay) 00183 // { 00184 // if (delay >= 0) { 00185 // ((TimerHandler *) this)->sched(delay); 00186 // } else { 00187 // abort(); 00188 // } 00189 // } 00190 00191 // void HsdpaMacTimer::resched(double delay) 00192 // { 00193 // if (delay >= 0) { 00194 // ((TimerHandler *) this)->resched(delay); 00195 // } else { 00196 // abort(); 00197 // } 00198 // }