diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/EURANE-version ns-2.28-eu111/EURANE-version
--- ns-2.28-eu110/EURANE-version	2005-04-27 16:30:09.000000000 +0200
+++ ns-2.28-eu111/EURANE-version	2005-10-28 13:51:31.000000000 +0200
@@ -1 +1 @@
-EURANE version 1.10 (ns-2.28)
+EURANE version 1.11 (ns-2.28)
diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/tcl/lib/ns-default.tcl ns-2.28-eu111/tcl/lib/ns-default.tcl
--- ns-2.28-eu110/tcl/lib/ns-default.tcl	2005-09-22 17:19:49.000000000 +0200
+++ ns-2.28-eu111/tcl/lib/ns-default.tcl	2005-10-28 14:06:41.000000000 +0200
@@ -96,7 +96,7 @@
 # change DropTail to RED for RED on individual queues
 FQLink set queueManagement_ DropTail
 
-Queue/DropTail set drop_front_ false
+Queue/DropTail set drop_front_ true 
 Queue/DropTail set summarystats_ false
 Queue/DropTail set queue_in_bytes_ false
 Queue/DropTail set mean_pktsize_ 500
@@ -664,6 +664,7 @@
 LL set avoidReordering_ false ;	#not used 
 
 # UMTS starts
+UMTS/RLC/UM set avoidReordering_                      false
 UMTS/RLC/UM set payload_                              40
 UMTS/RLC/UM set bandwidth_                            0
 UMTS/RLC/UM set debug_                                false
@@ -676,6 +677,7 @@
 UMTS/RLC/UM set min_concat_data_                      3
 UMTS/RLC/UM set delay_                                50us
 
+UMTS/RLC/UMHS set avoidReordering_                      false
 UMTS/RLC/UMHS set debug_                              false
 UMTS/RLC/UMHS set macDA_                              -1
 UMTS/RLC/UMHS set win_                                4095
diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/tcl/lib/ns-umts.tcl ns-2.28-eu111/tcl/lib/ns-umts.tcl
--- ns-2.28-eu110/tcl/lib/ns-umts.tcl	2005-09-22 17:19:49.000000000 +0200
+++ ns-2.28-eu111/tcl/lib/ns-umts.tcl	2005-10-28 14:06:41.000000000 +0200
@@ -631,6 +631,7 @@
 Node/UmtsNode instproc add-interface args {
    $self instvar bs_ nifs_ chan_rx_ chan_tx_ phy_rx_ phy_tx_ mac_
    $self instvar drophead_ cs_ tcm_ connector_ nif_ ll_ type_
+   [Simulator instance]  instvar llType_
 
    set t $nifs_
    incr nifs_
@@ -674,9 +675,15 @@
          $tcm down-target $mac_(1)
          $tcm CS $cs
          $tcm BS 1
-         $tcm RLC-AM $ll
 
+	 if {$llType_ == "UMTS/RLC/AM"} {
+         $tcm RLC-AM $ll
          $cs downlink-AM $ll
+         } else {
+	 $tcm RLC-UM $ll
+	 $cs downlink-UM $ll
+         }
+ 	 
          $cs downlink-tcm $tcm
 
 
@@ -934,9 +941,16 @@
          $tcm up-target $mac
          $tcm down-target $mac_(0)
          $tcm CS $cs
-         $tcm RLC-AM $ll
 
+	 if {$llType_ == "UMTS/RLC/AM"} {
+	     $tcm RLC-AM $ll
          $cs uplink-AM $ll
+	    } else {
+	     $tcm RLC-UM $ll
+	     $cs uplink-UM $ll
+	 }
+
+
          $cs uplink-tcm $tcm
 
 
@@ -1279,8 +1293,8 @@
 
     $queue_ drop-target $drophead_
 
-    $drpT_ target [$queue_ drop-target]
-    $queue_ drop-target $drpT_
+    #$drpT_ target [$queue_ drop-target]
+    #$queue_ drop-target $drpT_
 
     $deqT_ target [$queue_ target]
     $queue_ target $deqT_
diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/umts/hsdpalink.cc ns-2.28-eu111/umts/hsdpalink.cc
--- ns-2.28-eu110/umts/hsdpalink.cc	2005-09-22 17:19:49.000000000 +0200
+++ ns-2.28-eu111/umts/hsdpalink.cc	2005-10-28 14:06:41.000000000 +0200
@@ -1,7 +1,5 @@
 /*
  * Copyright (c) 2003 Ericsson Telecommunicatie B.V.
- * Copyright (c) 2005 Twente Institute for Wireless and Mobile
- *		Communications B.V.
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
@@ -13,7 +11,7 @@
  *     notice, this list of conditions and the following disclaimer in the
  *     documentation and/or other materials provided with the
  *     distribution.
- * 3. Neither the name of Ericsson Telecommunicatie B.V. or WMC may be used
+ * 3. Neither the name of Ericsson Telecommunicatie B.V. may be used
  *     to endorse or promote products derived from this software without
  *     specific prior written permission.
  *
@@ -54,7 +52,7 @@
 // These variables are used as 'super-globals', in this way the AM-HS object
 // and the MAC-hs object at the BS can be reached.
 
-extern AM_HS *rlc_address;      // defined in am-hs.cc
+extern RLC_HS *rlc_address;      // defined in am-hs.cc
 HsdpaMac   *mac_address;        // points to the object in the BS
 
 /*
@@ -155,7 +153,7 @@
       reord_mac_hs *temp_mh = new reord_mac_hs(this);
 
       temp_mh->next_expected_TSN_ = 0;
-      temp_mh->T1_TSN_ = 0;
+      temp_mh->T1_TSN_ = -1;
       temp_mh->rcvWindow_UpperEdge_ = -1; // reord_buf_size_ - 1;
       // TODO: This upperEdge value is not according to the standard, but this works.
       // a better solution would be to rewrite some of the reordering code to store
@@ -286,6 +284,7 @@
         // Perform Credit Allocation to RLC
 
 
+	//umhs_address->credit_update(new_rlc_credits_);
         rlc_address->credit_update(new_rlc_credits_);
 
         break;
@@ -464,24 +463,28 @@
 
          int upperEdge = reord_.at(priority_id)->rcvWindow_UpperEdge_;
 
-         for (int i = upperEdge + 1;
-              i < upperEdge - rcwWindow_Size_ + reord_buf_size_ + 1; i++) {
+
+	 // Define the upper and lower limits of the space outside the Reordering window
+	 int lower_index = max(0, (upperEdge - reord_buf_size_ + 1));
+	 int upper_index = max(0, (upperEdge - rcwWindow_Size_));
+
+          // Pass any PDUs in this space up to be disassembled
+         for (int i = lower_index; i< upper_index; i++) {
             if (reord_.at(priority_id)->reord_buffer_.at(i % reord_buf_size_)->
                 size() != 0) {
                ro_passUp(priority_id, tsn);
             }
          }
-         if (! ro_isInsideWindow(priority_id,
-               reord_.at(priority_id)->next_expected_TSN_)) {
+
+	 // If next_expected_TSN is outside the Reordering window, set it to be equal to TSN of last in window
+	 if (reord_.at(priority_id)->next_expected_TSN_ <= (upperEdge - rcwWindow_Size_)) {
+	   
             reord_.at(priority_id)->next_expected_TSN_ =
-                  upperEdge + 1 + (reord_buf_size_ - rcwWindow_Size_);
-         }
-      }
+	     upperEdge + 1 - rcwWindow_Size_;
 
-      if (tsn == reord_.at(priority_id)->next_expected_TSN_) {
-         // Disassemble all consecutive received PDUs
          int sn = reord_.at(priority_id)->next_expected_TSN_;
 
+	   // Pass up all consecutive waiting PDUs in the Reordering window after update of next_expected_TSN 
          while (reord_.at(priority_id)->reord_buffer_.at(sn % reord_buf_size_)->
                 size() != 0) {
             ro_passUp(priority_id, sn);
@@ -491,6 +494,9 @@
          // Update next expected TSN to the first not received PDU
          reord_.at(priority_id)->next_expected_TSN_ = sn;
       }
+         
+      }
+         
       //Clear HARQ process
       if (process->clear_process_timer.status() != TIMER_PENDING) {
          process->clear_process_timer.sched(ack_process_delay_);
@@ -501,10 +507,12 @@
       // Is this the last possible transmission of this PDU?
       if (process->tx_number_ == nr_harq_rtx_) {
          ro_stopTransmission(process);
+
       } else {
          // Is the TSN of the PDU outside the reordering window?
-// TODO check!         if (!ro_isInsideWindow(priority_id, tsn)) {
-         if (tsn <= reord_.at(priority_id)->rcvWindow_UpperEdge_){
+	// If it is, we dont want to retransmit it, so clear the associated process 
+	if (tsn <= (reord_.at(priority_id)->rcvWindow_UpperEdge_ - rcwWindow_Size_)){
+	  
             // This is done here for the transmitter operation. The transmitter
             // should not retransmit packets that are outside the window. It
             // would be nicer when this part was implemented at the transmitter,
@@ -533,12 +542,29 @@
 {
    // Place each individual Mac-d PDU in the reordering. We can't place whole
    // Mac-hs PDUs in this buffer, because these Mac-hs PDUs are re-used.
+   if (reord_.at(priority_id)->reord_buffer_.at(tsn % reord_buf_size_)->size() != 0){
+	   printf("ro_placeInBuffer: OVERWRITING\n");
+   }
    reord_.at(priority_id)->reord_buffer_.at(tsn % reord_buf_size_)->clear();
    for (unsigned int i = 0; i < process->pdu_vector_.size(); i++) {
       reord_.at(priority_id)->reord_buffer_.at(tsn %
                                                reord_buf_size_)->
             push_back(process->pdu_vector_.at(i));
    }
+   if (tsn == reord_.at(priority_id)->next_expected_TSN_) {
+     // Disassemble all consecutive received PDUs
+     int sn = reord_.at(priority_id)->next_expected_TSN_;
+     
+     while (reord_.at(priority_id)->reord_buffer_.at(sn % reord_buf_size_)->
+	    size() != 0) {
+       ro_passUp(priority_id, sn);
+       sn++;
+     }
+     
+     // Update next expected TSN to the first not received PDU
+     reord_.at(priority_id)->next_expected_TSN_ = sn;
+   }
+   
 }
 
 void HsdpaMac::ro_passUp(int priority_id, int tsn)
diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/umts/rlc.h ns-2.28-eu111/umts/rlc.h
--- ns-2.28-eu110/umts/rlc.h	2005-09-22 17:19:49.000000000 +0200
+++ ns-2.28-eu111/umts/rlc.h	2005-10-28 14:06:41.000000000 +0200
@@ -57,7 +57,7 @@
    virtual void recv(Packet *, Handler *) = 0;
 };
 
-class RLC_HS:public RLC {
+class RLC_HS: public RLC {
 public:
    RLC_HS::RLC_HS():RLC() {
    } virtual void credit_update(vector < int >new_rlc_credits) = 0;
diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/umts/tcs.cc ns-2.28-eu111/umts/tcs.cc
--- ns-2.28-eu110/umts/tcs.cc	2005-09-22 17:19:49.000000000 +0200
+++ ns-2.28-eu111/umts/tcs.cc	2005-10-28 14:06:41.000000000 +0200
@@ -90,7 +90,7 @@
    a_->timeout(3);
 }
 
-TCM::TCM():BiConnector(), bs_(0), direction_(0), total_bits_(0), status_(0), cs_(0),
+TCM::TCM():BiConnector(), bs_(0), direction_(0), total_bits_(0), status_(0), cs_(0), am_(NULL), um_(NULL),
 THP_RT(this), RPT(this), BRT(this), PTAT(this)
 {
 
@@ -124,6 +124,12 @@
             return (TCL_ERROR);
          }
          return (TCL_OK);
+      } else if (strcmp(argv[1], "RLC-UM") == 0) {
+	um_ = (UM *) TclObject::lookup(argv[2]);
+	if (um_ == NULL) {
+	   return (TCL_ERROR);
+	}
+        return (TCL_OK);
       }
    }
    return (BiConnector::command(argc, argv));
@@ -172,11 +178,25 @@
    } else if (tno == 1) {
       cs_->timeout(0);
    } else if (tno == 2) {
-      int size = am_->buff_size() / 100;
+     
+       int size = 0;
+     
+      // Added check for UM RLC support also
+      if (am_ != NULL) {
+        size =am_->buff_size() / 100;
 
       if ((am_->buff_size() % 100) > 50) {
          size++;
       }
+	
+      } else if (um_ != NULL) {
+         size =um_->buff_size() / 100;
+
+	 if ((um_->buff_size() % 100) > 50) {
+		 size++;
+	 }
+      }
+	      
       size = size * 100;
       if (bs_) {
          if (size > DL_RLC_BUF_UPSWITCH_THRESH_sRAB_) {
@@ -198,7 +218,7 @@
 }
 
 
-CS::CS():NsObject(), uplink_(0), downlink_(0), DS_T_sRab(this)
+CS::CS():NsObject(), uplink_(0), downlink_(0), uplink_am_(NULL), downlink_am_(NULL), downlink_um_(NULL), uplink_um_(NULL),DS_T_sRab(this)
 {
    bind_time("DOWNSWITCH_TIMER_sRAB_", &DOWNSWITCH_TIMER_sRAB_);
    bind_bool("noSwitching_", &noSwitching_);
@@ -231,6 +251,18 @@
             return (TCL_ERROR);
          }
          return (TCL_OK);
+      } else if (strcmp(argv[1], "downlink-UM") == 0) {
+         downlink_um_ = (UM *) TclObject::lookup(argv[2]);
+         if (downlink_um_ == NULL) {
+            return (TCL_ERROR);
+         }
+         return (TCL_OK);
+      } else if (strcmp(argv[1], "uplink-UM") == 0) {
+         uplink_um_ = (UM *) TclObject::lookup(argv[2]);
+         if (uplink_um_ == NULL) {
+            return (TCL_ERROR);
+         }
+         return (TCL_OK);
       }
    } else if (argc == 6) {
       if (strcmp(argv[1], "rlc_DS_info") == 0) {
@@ -270,8 +302,15 @@
       }
       uplink_->direction() = common;
       downlink_->direction() = common;
+
+      if ( uplink_am_ != NULL && downlink_am_ !=NULL ) {
       uplink_am_->CSwitch(ds_node_bw_, ds_node_tti_);
       downlink_am_->CSwitch(ds_bs_bw_, ds_bs_tti_);
+      } else if (uplink_um_ != NULL && downlink_um_ != NULL) {
+	uplink_um_->CSwitch(ds_node_bw_, ds_node_tti_);
+	downlink_um_->CSwitch(ds_bs_bw_, ds_bs_tti_);
+      }
+      
 /*		cout<<"downswitch at "<<Scheduler::instance().clock()<<endl; */
       DS_T_sRab.resched(DOWNSWITCH_TIMER_sRAB_ + 0.00001);
 
@@ -283,8 +322,13 @@
       }
       uplink_->direction() = dedicated;
       downlink_->direction() = dedicated;
+      if ( uplink_am_ != NULL && downlink_am_ !=NULL ) {
       uplink_am_->CSwitch(us_node_bw_, us_node_tti_);
       downlink_am_->CSwitch(us_bs_bw_, us_bs_tti_);
+      } else if (uplink_um_ != NULL && downlink_um_ != NULL) {
+	uplink_um_->CSwitch(us_node_bw_, us_node_tti_);
+	downlink_um_->CSwitch(us_bs_bw_, us_bs_tti_);
+      }
 /*		cout<<"upswitch at "<<Scheduler::instance().clock()<<endl; */
    }
 }
diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/umts/tcs.h ns-2.28-eu111/umts/tcs.h
--- ns-2.28-eu110/umts/tcs.h	2005-09-22 17:19:49.000000000 +0200
+++ ns-2.28-eu111/umts/tcs.h	2005-10-28 14:06:41.000000000 +0200
@@ -49,6 +49,7 @@
 #include "bi-connector.h"
 #include "timer-handler.h"
 #include "am.h"
+#include "um.h"
 
 #define	dedicated	0
 #define	common		1
@@ -116,6 +117,8 @@
    TCM        *downlink_;
    AM         *uplink_am_;
    AM         *downlink_am_;
+   UM         *downlink_um_;
+   UM         *uplink_um_;
    double      us_node_tti_;
    double      us_node_bw_;
    double      ds_node_tti_;
@@ -151,6 +154,7 @@
    int         status_;
    CS         *cs_;
    AM         *am_;
+   UM         *um_;
 
    double      THP_REPORT_INTERVAL_;
    double      DOWNSWITCH_THRESHOLD_;
diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/umts/um.cc ns-2.28-eu111/umts/um.cc
--- ns-2.28-eu110/umts/um.cc	2005-09-22 17:19:49.000000000 +0200
+++ ns-2.28-eu111/umts/um.cc	2005-10-28 14:06:41.000000000 +0200
@@ -575,4 +575,14 @@
    uptarget_ ? sendUp(p) : Packet::free(p);
 }
 
+int UM::buff_size()
+{
+   return(transmissionBuffer_.size());
+}
+
+void UM::CSwitch(double bandwidth, double TTI)
+{
+	   bandwidth_ = bandwidth;
+	      TTI_ = TTI;
+}
 
diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/umts/um.h ns-2.28-eu111/umts/um.h
--- ns-2.28-eu110/umts/um.h	2005-09-22 17:19:49.000000000 +0200
+++ ns-2.28-eu111/umts/um.h	2005-10-28 14:06:41.000000000 +0200
@@ -79,6 +79,9 @@
    virtual void recv(Packet *, Handler *);
    int         command(int, const char *const *);
    void        timeout(int tno, int flowID = -1);
+   int         buff_size();
+   void        CSwitch(double, double);
+
 protected:
    int         enquePacket(Packet * p);
    int         enqueInBackOfTransmissionBuffer(Packet * p);
diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive ns-2.28-eu110/umts/um-hs.cc ns-2.28-eu111/umts/um-hs.cc
--- ns-2.28-eu110/umts/um-hs.cc	2005-09-22 17:19:49.000000000 +0200
+++ ns-2.28-eu111/umts/um-hs.cc	2005-10-28 14:06:41.000000000 +0200
@@ -640,7 +640,7 @@
    // allocation vector.
    for (int i = 0; i < priorityMax_; i++) {
       for (int j = 0; j < flowMax_; j++) {
-         for (int k = 0; k < new_rlc_credits.at(i * priorityMax_ + j); k++) {
+         for (int k = 0; k < new_rlc_credits.at(i * flowMax_ + j); k++) {
             //Note: Buffers indexed: f1p1,f2p1,f3p1,f1p2,f2p2,f3p2,f1p3...
 
             Packet     *p;
