anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2019-present Infosys Limited |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | */ |
| 6 | /****************************************************************************** |
| 7 | * |
| 8 | * This is an auto generated file. |
| 9 | * Please do not edit this file. |
| 10 | * All edits to be made through template source file |
| 11 | * <TOP-DIR/scripts/GtpV2StackCodeGen/tts/ietemplate.cpp.tt> |
| 12 | ******************************************************************************/ |
| 13 | |
| 14 | #include "indicationIe.h" |
| 15 | #include "dataTypeCodecUtils.h" |
| 16 | |
| 17 | IndicationIe::IndicationIe() |
| 18 | { |
| 19 | ieType = 77; |
| 20 | // TODO |
| 21 | |
| 22 | } |
| 23 | |
| 24 | IndicationIe::~IndicationIe() { |
| 25 | // TODO Auto-generated destructor stub |
| 26 | } |
| 27 | |
| 28 | bool IndicationIe::encodeIndicationIe(MsgBuffer &buffer, IndicationIeData const &data) |
| 29 | { |
| 30 | if(!(buffer.writeBits(data.iDAF, 1))) |
| 31 | { |
| 32 | errorStream.add((char *)"Encoding of iDAF failed\n"); |
| 33 | return false; |
| 34 | } |
| 35 | if(!(buffer.writeBits(data.iDTF, 1))) |
| 36 | { |
| 37 | errorStream.add((char *)"Encoding of iDTF failed\n"); |
| 38 | return false; |
| 39 | } |
| 40 | if(!(buffer.writeBits(data.iHI, 1))) |
| 41 | { |
| 42 | errorStream.add((char *)"Encoding of iHI failed\n"); |
| 43 | return false; |
| 44 | } |
| 45 | if(!(buffer.writeBits(data.iDFI, 1))) |
| 46 | { |
| 47 | errorStream.add((char *)"Encoding of iDFI failed\n"); |
| 48 | return false; |
| 49 | } |
| 50 | if(!(buffer.writeBits(data.iOI, 1))) |
| 51 | { |
| 52 | errorStream.add((char *)"Encoding of iOI failed\n"); |
| 53 | return false; |
| 54 | } |
| 55 | if(!(buffer.writeBits(data.iISRSI, 1))) |
| 56 | { |
| 57 | errorStream.add((char *)"Encoding of iISRSI failed\n"); |
| 58 | return false; |
| 59 | } |
| 60 | if(!(buffer.writeBits(data.iISRAI, 1))) |
| 61 | { |
| 62 | errorStream.add((char *)"Encoding of iISRAI failed\n"); |
| 63 | return false; |
| 64 | } |
| 65 | if(!(buffer.writeBits(data.iSGWCI, 1))) |
| 66 | { |
| 67 | errorStream.add((char *)"Encoding of iSGWCI failed\n"); |
| 68 | return false; |
| 69 | } |
| 70 | if(!(buffer.writeBits(data.iSQCI, 1))) |
| 71 | { |
| 72 | errorStream.add((char *)"Encoding of iSQCI failed\n"); |
| 73 | return false; |
| 74 | } |
| 75 | if(!(buffer.writeBits(data.iUIMSI, 1))) |
| 76 | { |
| 77 | errorStream.add((char *)"Encoding of iUIMSI failed\n"); |
| 78 | return false; |
| 79 | } |
| 80 | if(!(buffer.writeBits(data.iCFSI, 1))) |
| 81 | { |
| 82 | errorStream.add((char *)"Encoding of iCFSI failed\n"); |
| 83 | return false; |
| 84 | } |
| 85 | if(!(buffer.writeBits(data.iCRSI, 1))) |
| 86 | { |
| 87 | errorStream.add((char *)"Encoding of iCRSI failed\n"); |
| 88 | return false; |
| 89 | } |
| 90 | if(!(buffer.writeBits(data.iP, 1))) |
| 91 | { |
| 92 | errorStream.add((char *)"Encoding of iP failed\n"); |
| 93 | return false; |
| 94 | } |
| 95 | if(!(buffer.writeBits(data.iPT, 1))) |
| 96 | { |
| 97 | errorStream.add((char *)"Encoding of iPT failed\n"); |
| 98 | return false; |
| 99 | } |
| 100 | if(!(buffer.writeBits(data.iSI, 1))) |
| 101 | { |
| 102 | errorStream.add((char *)"Encoding of iSI failed\n"); |
| 103 | return false; |
| 104 | } |
| 105 | if(!(buffer.writeBits(data.iMSV, 1))) |
| 106 | { |
| 107 | errorStream.add((char *)"Encoding of iMSV failed\n"); |
| 108 | return false; |
| 109 | } |
| 110 | buffer.skipBits(3); |
| 111 | |
| 112 | if(!(buffer.writeBits(data.iS6AF, 1))) |
| 113 | { |
| 114 | errorStream.add((char *)"Encoding of iS6AF failed\n"); |
| 115 | return false; |
| 116 | } |
| 117 | if(!(buffer.writeBits(data.iS4AF, 1))) |
| 118 | { |
| 119 | errorStream.add((char *)"Encoding of iS4AF failed\n"); |
| 120 | return false; |
| 121 | } |
| 122 | if(!(buffer.writeBits(data.iMBMDT, 1))) |
| 123 | { |
| 124 | errorStream.add((char *)"Encoding of iMBMDT failed\n"); |
| 125 | return false; |
| 126 | } |
| 127 | if(!(buffer.writeBits(data.iISRAU, 1))) |
| 128 | { |
| 129 | errorStream.add((char *)"Encoding of iISRAU failed\n"); |
| 130 | return false; |
| 131 | } |
| 132 | if(!(buffer.writeBits(data.iCCRSI, 1))) |
| 133 | { |
| 134 | errorStream.add((char *)"Encoding of iCCRSI failed\n"); |
| 135 | return false; |
| 136 | } |
| 137 | |
| 138 | return true; |
| 139 | } |
| 140 | |
| 141 | bool IndicationIe::decodeIndicationIe(MsgBuffer &buffer, IndicationIeData &data, Uint16 length) |
| 142 | { |
| 143 | // TODO optimize the length checks |
| 144 | |
| 145 | Uint16 ieBoundary = buffer.getCurrentIndex() + length; |
| 146 | data.iDAF = buffer.readBits(1); |
| 147 | // confirm that we are not reading beyond the IE boundary |
| 148 | if (buffer.getCurrentIndex() > ieBoundary) |
| 149 | { |
| 150 | errorStream.add((char *)"Attempt to read beyond IE boundary: iDAF\n"); |
| 151 | return false; |
| 152 | } |
| 153 | data.iDTF = buffer.readBits(1); |
| 154 | // confirm that we are not reading beyond the IE boundary |
| 155 | if (buffer.getCurrentIndex() > ieBoundary) |
| 156 | { |
| 157 | errorStream.add((char *)"Attempt to read beyond IE boundary: iDTF\n"); |
| 158 | return false; |
| 159 | } |
| 160 | data.iHI = buffer.readBits(1); |
| 161 | // confirm that we are not reading beyond the IE boundary |
| 162 | if (buffer.getCurrentIndex() > ieBoundary) |
| 163 | { |
| 164 | errorStream.add((char *)"Attempt to read beyond IE boundary: iHI\n"); |
| 165 | return false; |
| 166 | } |
| 167 | data.iDFI = buffer.readBits(1); |
| 168 | // confirm that we are not reading beyond the IE boundary |
| 169 | if (buffer.getCurrentIndex() > ieBoundary) |
| 170 | { |
| 171 | errorStream.add((char *)"Attempt to read beyond IE boundary: iDFI\n"); |
| 172 | return false; |
| 173 | } |
| 174 | data.iOI = buffer.readBits(1); |
| 175 | // confirm that we are not reading beyond the IE boundary |
| 176 | if (buffer.getCurrentIndex() > ieBoundary) |
| 177 | { |
| 178 | errorStream.add((char *)"Attempt to read beyond IE boundary: iOI\n"); |
| 179 | return false; |
| 180 | } |
| 181 | data.iISRSI = buffer.readBits(1); |
| 182 | // confirm that we are not reading beyond the IE boundary |
| 183 | if (buffer.getCurrentIndex() > ieBoundary) |
| 184 | { |
| 185 | errorStream.add((char *)"Attempt to read beyond IE boundary: iISRSI\n"); |
| 186 | return false; |
| 187 | } |
| 188 | data.iISRAI = buffer.readBits(1); |
| 189 | // confirm that we are not reading beyond the IE boundary |
| 190 | if (buffer.getCurrentIndex() > ieBoundary) |
| 191 | { |
| 192 | errorStream.add((char *)"Attempt to read beyond IE boundary: iISRAI\n"); |
| 193 | return false; |
| 194 | } |
| 195 | data.iSGWCI = buffer.readBits(1); |
| 196 | // confirm that we are not reading beyond the IE boundary |
| 197 | if (buffer.getCurrentIndex() > ieBoundary) |
| 198 | { |
| 199 | errorStream.add((char *)"Attempt to read beyond IE boundary: iSGWCI\n"); |
| 200 | return false; |
| 201 | } |
| 202 | data.iSQCI = buffer.readBits(1); |
| 203 | // confirm that we are not reading beyond the IE boundary |
| 204 | if (buffer.getCurrentIndex() > ieBoundary) |
| 205 | { |
| 206 | errorStream.add((char *)"Attempt to read beyond IE boundary: iSQCI\n"); |
| 207 | return false; |
| 208 | } |
| 209 | data.iUIMSI = buffer.readBits(1); |
| 210 | // confirm that we are not reading beyond the IE boundary |
| 211 | if (buffer.getCurrentIndex() > ieBoundary) |
| 212 | { |
| 213 | errorStream.add((char *)"Attempt to read beyond IE boundary: iUIMSI\n"); |
| 214 | return false; |
| 215 | } |
| 216 | data.iCFSI = buffer.readBits(1); |
| 217 | // confirm that we are not reading beyond the IE boundary |
| 218 | if (buffer.getCurrentIndex() > ieBoundary) |
| 219 | { |
| 220 | errorStream.add((char *)"Attempt to read beyond IE boundary: iCFSI\n"); |
| 221 | return false; |
| 222 | } |
| 223 | data.iCRSI = buffer.readBits(1); |
| 224 | // confirm that we are not reading beyond the IE boundary |
| 225 | if (buffer.getCurrentIndex() > ieBoundary) |
| 226 | { |
| 227 | errorStream.add((char *)"Attempt to read beyond IE boundary: iCRSI\n"); |
| 228 | return false; |
| 229 | } |
| 230 | data.iP = buffer.readBits(1); |
| 231 | // confirm that we are not reading beyond the IE boundary |
| 232 | if (buffer.getCurrentIndex() > ieBoundary) |
| 233 | { |
| 234 | errorStream.add((char *)"Attempt to read beyond IE boundary: iP\n"); |
| 235 | return false; |
| 236 | } |
| 237 | data.iPT = buffer.readBits(1); |
| 238 | // confirm that we are not reading beyond the IE boundary |
| 239 | if (buffer.getCurrentIndex() > ieBoundary) |
| 240 | { |
| 241 | errorStream.add((char *)"Attempt to read beyond IE boundary: iPT\n"); |
| 242 | return false; |
| 243 | } |
| 244 | data.iSI = buffer.readBits(1); |
| 245 | // confirm that we are not reading beyond the IE boundary |
| 246 | if (buffer.getCurrentIndex() > ieBoundary) |
| 247 | { |
| 248 | errorStream.add((char *)"Attempt to read beyond IE boundary: iSI\n"); |
| 249 | return false; |
| 250 | } |
| 251 | data.iMSV = buffer.readBits(1); |
| 252 | // confirm that we are not reading beyond the IE boundary |
| 253 | if (buffer.getCurrentIndex() > ieBoundary) |
| 254 | { |
| 255 | errorStream.add((char *)"Attempt to read beyond IE boundary: iMSV\n"); |
| 256 | return false; |
| 257 | } |
| 258 | buffer.skipBits(3); |
| 259 | if (buffer.getCurrentIndex() > ieBoundary) |
| 260 | { |
| 261 | errorStream.add((char *)"Attempt to read beyond IE boundary: \n"); |
| 262 | return false; |
| 263 | } |
| 264 | |
| 265 | data.iS6AF = buffer.readBits(1); |
| 266 | // confirm that we are not reading beyond the IE boundary |
| 267 | if (buffer.getCurrentIndex() > ieBoundary) |
| 268 | { |
| 269 | errorStream.add((char *)"Attempt to read beyond IE boundary: iS6AF\n"); |
| 270 | return false; |
| 271 | } |
| 272 | data.iS4AF = buffer.readBits(1); |
| 273 | // confirm that we are not reading beyond the IE boundary |
| 274 | if (buffer.getCurrentIndex() > ieBoundary) |
| 275 | { |
| 276 | errorStream.add((char *)"Attempt to read beyond IE boundary: iS4AF\n"); |
| 277 | return false; |
| 278 | } |
| 279 | data.iMBMDT = buffer.readBits(1); |
| 280 | // confirm that we are not reading beyond the IE boundary |
| 281 | if (buffer.getCurrentIndex() > ieBoundary) |
| 282 | { |
| 283 | errorStream.add((char *)"Attempt to read beyond IE boundary: iMBMDT\n"); |
| 284 | return false; |
| 285 | } |
| 286 | data.iISRAU = buffer.readBits(1); |
| 287 | // confirm that we are not reading beyond the IE boundary |
| 288 | if (buffer.getCurrentIndex() > ieBoundary) |
| 289 | { |
| 290 | errorStream.add((char *)"Attempt to read beyond IE boundary: iISRAU\n"); |
| 291 | return false; |
| 292 | } |
| 293 | data.iCCRSI = buffer.readBits(1); |
| 294 | // confirm that we are not reading beyond the IE boundary |
| 295 | if (buffer.getCurrentIndex() > ieBoundary) |
| 296 | { |
| 297 | errorStream.add((char *)"Attempt to read beyond IE boundary: iCCRSI\n"); |
| 298 | return false; |
| 299 | } |
| 300 | |
| 301 | // The IE is decoded now. The buffer index should be pointing to the |
| 302 | // IE Boundary. If not, we have some more data left for the IE which we don't know |
| 303 | // how to decode |
| 304 | if (ieBoundary == buffer.getCurrentIndex()) |
| 305 | { |
| 306 | return true; |
| 307 | } |
| 308 | else |
| 309 | { |
| 310 | errorStream.add((char *)"Unable to decode IE IndicationIe\n"); |
| 311 | return false; |
| 312 | } |
| 313 | } |
| 314 | void IndicationIe::displayIndicationIe_v(IndicationIeData const &data, Debug &stream) |
| 315 | { |
| 316 | stream.incrIndent(); |
| 317 | stream.add((char *)"IndicationIeData:"); |
| 318 | stream.incrIndent(); |
| 319 | stream.endOfLine(); |
| 320 | |
| 321 | stream.add( (char *)"iDAF: "); |
| 322 | stream.add((Uint8)data.iDAF); |
| 323 | stream.endOfLine(); |
| 324 | |
| 325 | stream.add( (char *)"iDTF: "); |
| 326 | stream.add((Uint8)data.iDTF); |
| 327 | stream.endOfLine(); |
| 328 | |
| 329 | stream.add( (char *)"iHI: "); |
| 330 | stream.add((Uint8)data.iHI); |
| 331 | stream.endOfLine(); |
| 332 | |
| 333 | stream.add( (char *)"iDFI: "); |
| 334 | stream.add((Uint8)data.iDFI); |
| 335 | stream.endOfLine(); |
| 336 | |
| 337 | stream.add( (char *)"iOI: "); |
| 338 | stream.add((Uint8)data.iOI); |
| 339 | stream.endOfLine(); |
| 340 | |
| 341 | stream.add( (char *)"iISRSI: "); |
| 342 | stream.add((Uint8)data.iISRSI); |
| 343 | stream.endOfLine(); |
| 344 | |
| 345 | stream.add( (char *)"iISRAI: "); |
| 346 | stream.add((Uint8)data.iISRAI); |
| 347 | stream.endOfLine(); |
| 348 | |
| 349 | stream.add( (char *)"iSGWCI: "); |
| 350 | stream.add((Uint8)data.iSGWCI); |
| 351 | stream.endOfLine(); |
| 352 | |
| 353 | stream.add( (char *)"iSQCI: "); |
| 354 | stream.add((Uint8)data.iSQCI); |
| 355 | stream.endOfLine(); |
| 356 | |
| 357 | stream.add( (char *)"iUIMSI: "); |
| 358 | stream.add((Uint8)data.iUIMSI); |
| 359 | stream.endOfLine(); |
| 360 | |
| 361 | stream.add( (char *)"iCFSI: "); |
| 362 | stream.add((Uint8)data.iCFSI); |
| 363 | stream.endOfLine(); |
| 364 | |
| 365 | stream.add( (char *)"iCRSI: "); |
| 366 | stream.add((Uint8)data.iCRSI); |
| 367 | stream.endOfLine(); |
| 368 | |
| 369 | stream.add( (char *)"iP: "); |
| 370 | stream.add((Uint8)data.iP); |
| 371 | stream.endOfLine(); |
| 372 | |
| 373 | stream.add( (char *)"iPT: "); |
| 374 | stream.add((Uint8)data.iPT); |
| 375 | stream.endOfLine(); |
| 376 | |
| 377 | stream.add( (char *)"iSI: "); |
| 378 | stream.add((Uint8)data.iSI); |
| 379 | stream.endOfLine(); |
| 380 | |
| 381 | stream.add( (char *)"iMSV: "); |
| 382 | stream.add((Uint8)data.iMSV); |
| 383 | stream.endOfLine(); |
| 384 | |
| 385 | stream.add( (char *)"iS6AF: "); |
| 386 | stream.add((Uint8)data.iS6AF); |
| 387 | stream.endOfLine(); |
| 388 | |
| 389 | stream.add( (char *)"iS4AF: "); |
| 390 | stream.add((Uint8)data.iS4AF); |
| 391 | stream.endOfLine(); |
| 392 | |
| 393 | stream.add( (char *)"iMBMDT: "); |
| 394 | stream.add((Uint8)data.iMBMDT); |
| 395 | stream.endOfLine(); |
| 396 | |
| 397 | stream.add( (char *)"iISRAU: "); |
| 398 | stream.add((Uint8)data.iISRAU); |
| 399 | stream.endOfLine(); |
| 400 | |
| 401 | stream.add( (char *)"iCCRSI: "); |
| 402 | stream.add((Uint8)data.iCCRSI); |
| 403 | stream.endOfLine(); |
| 404 | stream.decrIndent(); |
| 405 | stream.decrIndent(); |
| 406 | } |