um.h

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: um.h,v 1.1 2005/04/27 14:30:10 simon Exp $
00040  */
00041 
00042 // This file both defines the RLC header and UM.
00043 
00044 #ifndef ns_um_h
00045 #define ns_um_h
00046 
00047 #include <vector>
00048 #include <ll.h>
00049 #include <queue.h>
00050 #include <agent.h>
00051 
00052 #include "rlc.h"
00053 #include "umts-queue.h"
00054 #include "umts-timers.h"
00055 #include "umts-headers.h"
00056 #include"umts-packet.h"
00057 #include "timer-handler.h"
00058 
00059 
00060 #define EOPNO_NOT_EOP -1
00061 #define EOPNO_TO_SEQNO -2
00062 
00063 #define PAYLOAD_FLD1 0
00064 #define PAYLOAD_FLD2 1
00065 #define PAYLOAD_FLD3 2
00066 
00067 
00068 class temporaryPacket {
00069 public:
00070    temporaryPacket(RLC * rlc):tempPDUTimer(rlc, RLC_TIMER_TEMP_PDU) {
00071    } Packet   *p;
00072    int         concat_data;
00073    UmtsTimer   tempPDUTimer;
00074 };
00075 
00076 
00077 class UM:   public RLC {
00078 public:
00079    UM();
00080    virtual void recv(Packet *, Handler *);
00081    int         command(int, const char *const *);
00082    void        timeout(int tno, int flowID = -1);
00083    int         buff_size();
00084    void        CSwitch(double, double);
00085 
00086 protected:
00087    int         enquePacket(Packet * p);
00088    int         enqueInBackOfTransmissionBuffer(Packet * p);
00089    void        sendDown(Packet * p);
00090    void        StoreTemporaryPacket(Packet * p, int concat_data);
00091    void        handleTemporaryPacket(Packet * p);
00092    void        completePDU(Packet * p);
00093    void        makeSDU(Packet * p);
00094 
00095    int         lengthIndicatorSize_;
00096    // The size of the Length indicator + the
00097    // extention bit. The size is in bytes. The
00098    // size is 1 or 2 bytes depending on the size
00099    // of the PDUs.
00100 
00101    // parameters of the object, set through TCL
00102 
00103    int         win_;
00104    // defines the RLC Window Size, which is the amount of packets that can be
00105    // sent after the last acknowledged packet.
00106 
00107    int         bufferLevelMax_;
00108    // The maximum number of PDUs for each flow-id and
00109    // priority pair in the Transmission Buffer.
00110 
00111    double      tempPDUTimeOutTime_;
00112    // When a PDU is constructed that has some
00113    // space left, the PDU is stored in the vector
00114    // temporaryPackets_. A timeout will be set
00115    // to ensure that when no further SDU arrives
00116    // with the same flow-id and priority, the
00117    // not-full PDU will be sent and will not
00118    // wait indefinitely.
00119 
00120    temporaryPacket temporaryPacket_;
00121    // In this vector Temporary PDUs are stored. These are PDUs that a not
00122    // completely full, and they can be possibly concatenated with a part of
00123    // a new SDU. However, this concatenation should be done quick enough,
00124    // otherwise timeouts and unnesessary delays may occur. So, a timer will
00125    // be set, when the concatenation can be done before the timer times out,
00126    // the PDU will be concatenated with a part of a new SDU. When the timer
00127    // times out, the Temporary Packet is padded and sent without concatenation.
00128 
00129    double      overhead_;       // Time that is needed to contruct SDUs
00130 
00131    int         payloadSize_;    // user data per DATA PDU
00132    double      TTI_;
00133    int         TTI_PDUs_;
00134 
00135    int         length_indicator_;
00136    int         min_concat_data_;
00137 
00138    int         address_;        // address of this RLC Entity
00139 
00140    umtsQueue   transmissionBuffer_;
00141    // For our Transmission Buffer we use a vector of rlcQueue, for each
00142    // flow-id and priority-pair one queue exists.
00143 
00144    int         nextExpectedSDU_;
00145    int         nextExpectedSeqno_;
00146    int         nextExpectedSegment_;
00147    int         errorInSDU_;
00148 
00149    int         seqno_;
00150 
00151    int         send_status_;
00152    int         SDU_size_;       // stores the original size of the SDU when a part already
00153    // was concatenated
00154 
00155    int         maxseq_;         // highest seqno transmitted so far
00156    int         highest_ack_;    // highest ack recieved by sender
00157    int         maxseen_;        // max PDU (seqno)number seen by receiver
00158 //   int seen_[MWS];   // array of PDUs seen by reciever
00159    int         next_;           // next PDU expected by reciever
00160 
00161    int         d_address_;      // destination address of this RLC Entity
00162    int         macDA_;          // mac destination address for packets created by this RLC
00163    // Entity
00164 
00165    umtsQueue   sduB_;
00166 
00167    UmtsTimer   tti_timer_;
00168 
00169 };
00170 
00171 
00172 #endif

Generated on Wed Nov 26 15:47:29 2008 for NS-MIRACLE library by  doxygen 1.5.2