Harald Welte | a814f26 | 2017-07-24 13:21:35 +0200 | [diff] [blame^] | 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // // |
| 3 | // Copyright Test Competence Center (TCC) ETH 2008 // |
| 4 | // // |
| 5 | // The copyright to the computer program(s) herein is the property of TCC. // |
| 6 | // The program(s) may be used and/or copied only with the written permission // |
| 7 | // of TCC or in accordance with the terms and conditions stipulated in the // |
| 8 | // agreement/contract under which the program(s) has been supplied. // |
| 9 | // // |
| 10 | /////////////////////////////////////////////////////////////////////////////// |
| 11 | // |
| 12 | // File: LLC_Types.ttcn |
| 13 | // Description: This module contains the Logical Link Control protocol (LLC) |
| 14 | // 44.064 v7.1.0 with attributes for RAW encoding/decoding. |
| 15 | // Rev: R1A0 |
| 16 | // Prodnr: CNL 113 577 |
| 17 | // Updated: 2008-01-22 |
| 18 | // Contact: http://ttcn.ericsson.se |
| 19 | // Reference: 3GPP TS 44.064 7.1.0 |
| 20 | |
| 21 | module LLC_Types |
| 22 | { |
| 23 | |
| 24 | import from General_Types all; |
| 25 | |
| 26 | external function enc_PDU_LLC(in PDU_LLC pdu) return octetstring; |
| 27 | external function dec_PDU_LLC(in octetstring stream) return PDU_LLC; |
| 28 | |
| 29 | type record Version |
| 30 | { |
| 31 | integer version_value (0..15), |
| 32 | BIT4 spare |
| 33 | |
| 34 | } with { |
| 35 | variant (version_value) "FIELDLENGTH(4)"; |
| 36 | } |
| 37 | |
| 38 | type octetstring IOV_UI length(4) |
| 39 | |
| 40 | |
| 41 | type octetstring IOV_I length(4) |
| 42 | |
| 43 | |
| 44 | type record T200 |
| 45 | { |
| 46 | BIT4 spare, |
| 47 | integer t200Value |
| 48 | } with { |
| 49 | variant (t200Value) "FIELDLENGTH(12)"; |
| 50 | variant (t200Value) "BYTEORDER(last)"; |
| 51 | variant "FIELDORDER(msb)"; |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | type record N200 |
| 56 | { |
| 57 | integer retransmissions (0..15), |
| 58 | BIT4 spare |
| 59 | } with { |
| 60 | variant (retransmissions) "FIELDLENGTH(4)"; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | type record N201_U |
| 65 | { |
| 66 | BIT5 spare, |
| 67 | integer n201UValue |
| 68 | } with { |
| 69 | variant (n201UValue) "FIELDLENGTH(11)"; |
| 70 | variant (n201UValue) "BYTEORDER(last)"; |
| 71 | variant "FIELDORDER(msb)"; |
| 72 | }; |
| 73 | |
| 74 | |
| 75 | type record N201_I |
| 76 | { |
| 77 | BIT5 spare, |
| 78 | integer n201IValue |
| 79 | } |
| 80 | with { |
| 81 | variant (n201IValue) "FIELDLENGTH(11)"; |
| 82 | variant (n201IValue) "BYTEORDER(last)"; |
| 83 | variant "FIELDORDER(msb)"; |
| 84 | }; |
| 85 | |
| 86 | type record MD |
| 87 | { |
| 88 | BIT1 spare, |
| 89 | integer mDValue |
| 90 | } with { |
| 91 | variant (mDValue) "FIELDLENGTH(15)"; |
| 92 | variant (mDValue) "BYTEORDER(last)"; |
| 93 | variant "FIELDORDER(msb)"; |
| 94 | }; |
| 95 | |
| 96 | |
| 97 | type record MU |
| 98 | { |
| 99 | BIT1 spare, |
| 100 | integer mUValue |
| 101 | } with { |
| 102 | variant (mUValue) "FIELDLENGTH(15)"; |
| 103 | variant (mUValue) "BYTEORDER(last)"; |
| 104 | variant "FIELDORDER(msb)"; |
| 105 | }; |
| 106 | |
| 107 | type integer KD with {variant "FIELDLENGTH(8)";}; |
| 108 | |
| 109 | type integer KU with {variant "FIELDLENGTH(8)";}; |
| 110 | |
| 111 | type octetstring L3param; |
| 112 | |
| 113 | type octetstring Reset_LLC length(0); |
| 114 | |
| 115 | type union XID_Data |
| 116 | { |
| 117 | Version version, |
| 118 | IOV_UI iOV_UI, |
| 119 | IOV_I iOV_I, |
| 120 | T200 t200, |
| 121 | N200 n200, |
| 122 | N201_U n201_U, |
| 123 | N201_I n201_I, |
| 124 | MD mD, |
| 125 | MU mU, |
| 126 | KD kD, |
| 127 | KU kU, |
| 128 | L3param l3param, |
| 129 | Reset_LLC reset |
| 130 | } |
| 131 | |
| 132 | |
| 133 | type union XID_length |
| 134 | { |
| 135 | integer short_len, |
| 136 | integer long_len |
| 137 | }with { |
| 138 | variant (short_len) "FIELDLENGTH(2)"; |
| 139 | variant (long_len) "FIELDLENGTH(8)"; |
| 140 | variant (long_len) "BYTEORDER(last)"; |
| 141 | variant (short_len) "FIELDORDER(msb)"; |
| 142 | variant (long_len) "FIELDORDER(msb)"; |
| 143 | |
| 144 | } |
| 145 | |
| 146 | |
| 147 | type record XID |
| 148 | { |
| 149 | BIT1 xl, |
| 150 | BIT5 typefield, |
| 151 | XID_length xID_length, |
| 152 | //Header_XID header_XID, |
| 153 | XID_Data xID_Data |
| 154 | } with { |
| 155 | variant (xID_Data) "CROSSTAG( version, typefield = '00000'B; |
| 156 | iOV_UI, typefield = '00001'B; |
| 157 | iOV_I, typefield = '00010'B; |
| 158 | t200, typefield = '00011'B; |
| 159 | n200, typefield = '00100'B; |
| 160 | n201_U, typefield = '00101'B; |
| 161 | n201_I, typefield = '00110'B; |
| 162 | mD, typefield = '00111'B; |
| 163 | mU, typefield = '01000'B; |
| 164 | kD, typefield = '01001'B; |
| 165 | kU, typefield = '01010'B; |
| 166 | l3param, typefield = '01011'B; |
| 167 | reset, typefield = '01100'B; |
| 168 | |
| 169 | )"; |
| 170 | variant "FIELDORDER(msb)"; |
| 171 | variant (xID_length) "CROSSTAG( short_len, xl = '0'B; |
| 172 | long_len, xl = '1'B;)"; |
| 173 | variant (xID_length) "LENGTHTO (xID_Data)" |
| 174 | |
| 175 | variant (xID_length) "PADDING(yes)" |
| 176 | }; |
| 177 | |
| 178 | |
| 179 | type record RejectedFrameControlField_UI |
| 180 | { |
| 181 | Control_field_UI control_field, |
| 182 | OCT4 spare |
| 183 | } |
| 184 | |
| 185 | |
| 186 | type record RejectedFrameControlField_U |
| 187 | { |
| 188 | Control_field_U control_field, |
| 189 | OCT5 spare |
| 190 | } |
| 191 | |
| 192 | |
| 193 | type union RejectedFrameControlField |
| 194 | { |
| 195 | RejectedFrameControlField_UI rejectedFrameControlField_UI, |
| 196 | RejectedFrameControlField_U rejectedFrameControlField_U |
| 197 | } with { |
| 198 | variant "TAG(rejectedFrameControlField_UI, control_field.format = '110'B; |
| 199 | rejectedFrameControlField_U, control_field.format = '111'B; |
| 200 | )"; |
| 201 | }; |
| 202 | |
| 203 | |
| 204 | type record of XID UA_Information; |
| 205 | |
| 206 | type record of XID SABM_Information; |
| 207 | |
| 208 | type record of XID XID_Information; |
| 209 | |
| 210 | |
| 211 | type octetstring DM_Information length(0); |
| 212 | |
| 213 | |
| 214 | type record FRMR_Information |
| 215 | { |
| 216 | RejectedFrameControlField rejectedFrameControlField, |
| 217 | BIT4 spare1, |
| 218 | BIT9 vS, |
| 219 | BIT1 spare2, |
| 220 | BIT9 vR, |
| 221 | BIT1 cR, |
| 222 | BIT4 spare3, |
| 223 | BIT1 w4, |
| 224 | BIT1 w3, |
| 225 | BIT1 w2, |
| 226 | BIT1 w1 |
| 227 | } with { |
| 228 | variant (vS) "BYTEORDER(last)"; |
| 229 | variant (vR) "BYTEORDER(last)"; |
| 230 | variant "FIELDORDER(msb)"; |
| 231 | }; |
| 232 | |
| 233 | |
| 234 | type record Address_field |
| 235 | { |
| 236 | BIT4 sAPI, |
| 237 | BIT2 spare, // '00'B |
| 238 | BIT1 cR, |
| 239 | BIT1 pD //'0' for LLC |
| 240 | } |
| 241 | |
| 242 | type record Control_field_U |
| 243 | { |
| 244 | BIT4 mBits, |
| 245 | BIT1 pF, |
| 246 | BIT3 format // '111'B |
| 247 | } |
| 248 | |
| 249 | |
| 250 | |
| 251 | type record Control_field_UI |
| 252 | |
| 253 | { |
| 254 | BIT3 format, // '110'B |
| 255 | BIT2 spare, |
| 256 | integer nU, //BIT9 |
| 257 | BIT1 e, |
| 258 | BIT1 pM |
| 259 | } with { |
| 260 | |
| 261 | variant (nU) "FIELDLENGTH(9)"; |
| 262 | variant (nU) "BYTEORDER(last)"; |
| 263 | variant "FIELDORDER(msb)"; |
| 264 | } |
| 265 | |
| 266 | |
| 267 | type union Information_field_U |
| 268 | { |
| 269 | UA_Information uA, |
| 270 | SABM_Information sABM, |
| 271 | FRMR_Information fRMR, |
| 272 | DM_Information dM, |
| 273 | XID_Information xID |
| 274 | }; |
| 275 | |
| 276 | |
| 277 | type record PDU_LLC_UI |
| 278 | { |
| 279 | Address_field address_field, |
| 280 | Control_field_UI control_field, |
| 281 | octetstring information_field_UI, |
| 282 | OCT3 fCS optional |
| 283 | // fCS ENCODING: |
| 284 | //'000000'O in send template -> generate CRC, |
| 285 | // omit in send template -> generate CRC, |
| 286 | // otherwise send out fCS in send template |
| 287 | // |
| 288 | // DECODING: |
| 289 | // decoder generates '000000'O if CRC OK |
| 290 | } |
| 291 | |
| 292 | |
| 293 | |
| 294 | type record PDU_LLC_U |
| 295 | { |
| 296 | Address_field address_field, |
| 297 | Control_field_U control_field, |
| 298 | Information_field_U information_field_U, |
| 299 | OCT3 fCS optional |
| 300 | // ENCODING: |
| 301 | //'000000'O in send template -> generate CRC, |
| 302 | // omit in send template -> generate CRC, |
| 303 | // otherwise send out fCS in send template |
| 304 | // |
| 305 | // DECODING: |
| 306 | // decoder generates '000000'O if CRC OK |
| 307 | } with { |
| 308 | variant (information_field_U) "CROSSTAG( uA, control_field.mBits = '0110'B; |
| 309 | sABM, control_field.mBits = '0111'B; |
| 310 | fRMR, control_field.mBits = '1000'B; |
| 311 | dM, control_field.mBits = '0001'B; |
| 312 | xID, control_field.mBits = '1011'B; |
| 313 | )"; |
| 314 | }; |
| 315 | |
| 316 | |
| 317 | type union PDU_LLC |
| 318 | { |
| 319 | PDU_LLC_UI pDU_LLC_UI, |
| 320 | PDU_LLC_U pDU_LLC_U |
| 321 | } with { variant "TAG ( |
| 322 | pDU_LLC_UI, control_field.format ='110'B; |
| 323 | pDU_LLC_U, control_field.format ='111'B; |
| 324 | )" |
| 325 | }; |
| 326 | |
| 327 | |
| 328 | |
| 329 | }with{ encode "RAW"}// end of module |