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 * Ported spring 2007 from EURANE to NSMIRACLE 00038 * by Nicola Baldo and Marco Miozzo 00039 * SIGNET Group, Department of Information Engineering, 00040 * University of Padova 00041 * 00042 * 00043 */ 00044 00045 /* 00046 * 00047 */ 00048 00049 #ifndef ns_umts_headers_h 00050 #define ns_umts_headers_h 00051 00052 // Type of Payload in MAC frame 00053 #define ETHERTYPE_RLC 0x0900 00054 00055 /* Data RLC PDU (with eventual piggybacked STATUS) */ 00056 #define RLC_DATA 0x8000 00057 00058 /* Stand-alone STATUS PDU */ 00059 #define RLC_STATUS 0x0000 00060 00061 /* Positive ACK (like Tahoe) */ 00062 #define RLC_ACK 0x0001 00063 00064 /* Bitmap SUFI */ 00065 #define RLC_BITMAP 0x0002 00066 00067 /* Move Receiver Window request SUFI 00068 * sent by sender to notify SDU discard */ 00069 #define RLC_MRW 0X0004 00070 00071 /* Move Receiver Window request acknowledged SUFI 00072 * sent by receiver to notify RLC_MRW reception */ 00073 #define RLC_MRWACK 0X0008 00074 00075 00076 // Maximum number of octets used for the BITMAP SUFI 00077 #define MAX_BITMAP_OCTETS 16 00078 00079 00080 struct hdr_rlc { 00081 packet_t lptype_; // SDU type 00082 int lerror_; // error flag of SDU 00083 double lts_; // ts value of SDU 00084 int lsize_; // payload SDU size 00085 00086 int lltype_; // RLC frame type 00087 int seqno_; // PDU sequence number 00088 int a_seqno_; // PDU sequence number 00089 int eopno_; // end of SDU seqno 00090 int segment_; // the segment number of the PDU, starts with 0 for the first 00091 // PDU of a SDU. 00092 bool poll_; // poll flag 00093 00094 int payload_[3]; 00095 int lengthInd_; 00096 int padding_; 00097 00103 int FSN_; 00104 int length_; 00105 00106 00107 u_int8_t bitmapsufi_[MAX_BITMAP_OCTETS]; // BITMAP SUFI using bit fields 00108 00109 /* MRW SUperFIeld */ 00110 int Nlength; 00111 int SN_MRW; // In practice, the new desired value for AM::next_ 00112 00113 /* MRW ACK SUperFIeld */ 00114 int SN_MRW_ACK; // The current value at the receiver for AM::next_, i.e., VR(R) 00115 // This is sent to the transmitter so it can 00116 // update FSN_, i.e., VT(A) 00117 00118 int src_rlc_id_; // Unique identifier of source RLC instance 00119 int dst_rlc_id_; // Unique identifier of dest RLC instance 00120 00121 nsaddr_t src_; 00122 nsaddr_t dst_; 00123 00124 static int offset_; 00125 inline int &offset() { 00126 return offset_; 00127 } static hdr_rlc *access(const Packet * p) { 00128 return (hdr_rlc *) p->access(offset_); 00129 } 00130 00131 packet_t & lptype() { 00132 return (lptype_); 00133 } 00134 int &lerror() { 00135 return lerror_; 00136 } 00137 double <s() { 00138 return (lts_); 00139 } 00140 int &lsize() { 00141 return lsize_; 00142 } 00143 00144 int& lltype() { 00145 return lltype_; 00146 } 00147 int &seqno() { 00148 return seqno_; 00149 } 00150 int &a_seqno() { 00151 return a_seqno_; 00152 } 00153 int &eopno() { 00154 return eopno_; 00155 } 00156 int &segment() { 00157 return segment_; 00158 } 00159 bool &poll() { 00160 return poll_; 00161 } 00162 00163 int &FSN() { 00164 return FSN_; 00165 } 00166 int &length() { 00167 return length_; 00168 } 00169 00177 int bitmap(int i) { 00178 assert(i>=0); 00179 assert(i<128); 00180 return ((bitmapsufi_[i / 8] & ((0x01)<<(i%8))) >> (i%8)); 00181 } 00182 00188 void setbitmap(int i) { 00189 assert(i>=0); 00190 assert(i<128); 00191 bitmapsufi_[i / 8] |= ((0x01)<<(i%8)); 00192 } 00193 00194 int &lengthInd() { 00195 return lengthInd_; 00196 } 00197 int &padding() { 00198 return padding_; 00199 } 00200 int &payload(int i) { 00201 return payload_[i]; 00202 } 00203 00204 nsaddr_t & src() { 00205 return (src_); 00206 } 00207 nsaddr_t & dst() { 00208 return (dst_); 00209 } 00210 }; 00211 00212 00213 00214 00215 00216 00217 struct hdr_umtsphy { 00218 int bs_code_id; // scrambling code id of the BS 00219 int me_code_id; // scrambling code id of the ME 00220 int coding_type; // channel coding type (convolutional, etc.) 00221 double coding_rate; // rate of the channel coding type 00222 int spreading_factor; // spreading factor 00223 int bits_per_symbol; // yeah 00224 int direction; // uplink or downlink 00225 bool data; // true when packet contains data, otherwise is a control packet 00226 bool powerUp; // true when the power control algorithm has to command to reduce the power of a step 00227 00228 00229 static int offset_; 00230 inline int &offset() { return offset_; } 00231 static hdr_umtsphy *access(const Packet * p) { 00232 return (hdr_umtsphy *) p->access(offset_); 00233 } 00234 00235 }; 00236 00237 #define HDR_RLC(p) (hdr_rlc::access(p)) 00238 #define HDR_UMTSPHY(p) (hdr_umtsphy::access(p)) 00239 00240 00241 00242 00243 00244 00245 00246 #endif