blob: e6303de2d1af0cba8719dd98981ef0f93da8c425 [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301/*
2 * Copyright 2019-present Infosys Limited  
3 *   
4 * SPDX-License-Identifier: Apache-2.0    
5 */
6
7/******************************************************************************
8 *
9 * This is an auto generated file.
10 * Please do not edit this file.
11 * All edits to be made through template source file
12 * <TOP-DIR/scripts/GtpV2StackCodeGen/tts/msgtemplate.cpp.tt>
13 ******************************************************************************/
14
15#include "modifyBearerResponseMsg.h"
16#include "../ieClasses/manual/gtpV2Ie.h"
17#include "../ieClasses/gtpV2IeFactory.h"
18#include "../ieClasses/ebiIe.h"
19#include "../ieClasses/bearerContextIe.h"
20#include "../ieClasses/bearerContextsModifiedInModifyBearerResponse.h"
21#include "../ieClasses/bearerContextIe.h"
22#include "../ieClasses/bearerContextsMarkedForRemovalInModifyBearerResponse.h"
23#include "../ieClasses/indicationIe.h"
24#include "../ieClasses/causeIe.h"
25#include "../ieClasses/apnRestrictionIe.h"
26#include "../ieClasses/pcoIe.h"
27#include "../ieClasses/changeReportingActionIe.h"
28#include "../ieClasses/csgInformationReportingActionIe.h"
29#include "../ieClasses/henbInformationReportingIe.h"
30#include "../ieClasses/fqdnIe.h"
31#include "../ieClasses/ipAddressIe.h"
32#include "../ieClasses/fqCsidIe.h"
33#include "../ieClasses/fqCsidIe.h"
34#include "../ieClasses/recoveryIe.h"
35#include "../ieClasses/localDistinguishedNameIe.h"
36#include "../ieClasses/localDistinguishedNameIe.h"
37#include "../ieClasses/presenceReportingAreaActionIe.h"
38#include "../ieClasses/loadControlInformationIe.h"
39#include "../ieClasses/pgwsNodeLevelLoadControlInformationInModifyBearerResponse.h"
40#include "../ieClasses/loadControlInformationIe.h"
41#include "../ieClasses/pgwsApnLevelLoadControlInformationInModifyBearerResponse.h"
42#include "../ieClasses/loadControlInformationIe.h"
43#include "../ieClasses/sgwsNodeLevelLoadControlInformationInModifyBearerResponse.h"
44#include "../ieClasses/overloadControlInformationIe.h"
45#include "../ieClasses/pgwsOverloadControlInformationInModifyBearerResponse.h"
46#include "../ieClasses/overloadControlInformationIe.h"
47#include "../ieClasses/sgwsOverloadControlInformationInModifyBearerResponse.h"
48#include "../ieClasses/chargingIdIe.h"
49#include "../ieClasses/msisdnIe.h"
50
51ModifyBearerResponseMsg::ModifyBearerResponseMsg()
52{
53 msgType = ModifyBearerResponseMsgType;
54 Uint16 mandIe;
55 mandIe = CauseIeType;
56 mandIe = (mandIe << 8) | 0; // cause
57 mandatoryIeSet.insert(mandIe);
58}
59
60ModifyBearerResponseMsg::~ModifyBearerResponseMsg()
61{
62
63}
64
65bool ModifyBearerResponseMsg::encodeModifyBearerResponseMsg(MsgBuffer &buffer,
66 ModifyBearerResponseMsgData
67 const &data)
68{
69 bool rc = false;
70 GtpV2IeHeader header;
71 Uint16 startIndex = 0;
72 Uint16 endIndex = 0;
73 Uint16 length = 0;
74
75 if (data.linkedEpsBearerIdIePresent)
76 {
77
78 // Encode the Ie Header
79 header.ieType = EbiIeType;
80 header.instance = 0;
81 header.length = 0; // We will encode the IE first and then update the length
82 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
83 startIndex = buffer.getCurrentIndex();
84 EbiIe ebi=
85 dynamic_cast<
86 EbiIe&>(GtpV2IeFactory::getInstance().getIeObject(EbiIeType));
87 rc = ebi.encodeEbiIe(buffer, data.linkedEpsBearerId);
88 endIndex = buffer.getCurrentIndex();
89 length = endIndex - startIndex;
90
91 // encode the length value now
92 buffer.goToIndex(startIndex - 3);
93 buffer.writeUint16(length, false);
94 buffer.goToIndex(endIndex);
95
96 if (!(rc))
97 {
98 errorStream.add((char *)"Failed to encode IE: linkedEpsBearerId\n");
99 return false;
100 }
101 }
102
103 // First validate if the applicatoin provided more than the expected cardinality
104 if (data.bearerContextsModifiedCount > 11)
105 {
106 errorStream.add((char *)"Number of entries of bearerContextsModified exceeded\n");
107 errorStream.add((char *)"Expected count: 11 Received count: ");
108 errorStream.add((char *)"data.bearerContextsModifiedCount");
109 errorStream.endOfLine();
110 return false;
111 }
112 for (Uint8 i = 0; i < data.bearerContextsModifiedCount; i++)
113 {
114 // Encode the Ie Header
115 header.ieType = BearerContextIeType;
116 header.instance = 0;
117 header.length = 0; // We will encode the IE first and then update the length
118 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
119 startIndex = buffer.getCurrentIndex();
120 BearerContextIe bearerContext=
121 dynamic_cast<
122 BearerContextIe&>(GtpV2IeFactory::getInstance().
123 getIeObject(BearerContextIeType));
124 BearerContextsModifiedInModifyBearerResponse groupedIeInstance = dynamic_cast<BearerContextsModifiedInModifyBearerResponse&>(bearerContext.getGroupedIe(msgType, 0));
125 rc = groupedIeInstance.encodeBearerContextsModifiedInModifyBearerResponse(buffer, data.bearerContextsModified[i]);
126 endIndex = buffer.getCurrentIndex();
127 length = endIndex - startIndex;
128
129 // encode the length value now
130 buffer.goToIndex(startIndex - 3);
131 buffer.writeUint16(length, false);
132 buffer.goToIndex(endIndex);
133 }
134
135 if (!(rc))
136 {
137 errorStream.add((char *)"Failed to encode IE: bearerContextsModified\n");
138 return false;
139 }
140
141 // First validate if the applicatoin provided more than the expected cardinality
142 if (data.bearerContextsMarkedForRemovalCount > 11)
143 {
144 errorStream.add((char *)"Number of entries of bearerContextsMarkedForRemoval exceeded\n");
145 errorStream.add((char *)"Expected count: 11 Received count: ");
146 errorStream.add((char *)"data.bearerContextsMarkedForRemovalCount");
147 errorStream.endOfLine();
148 return false;
149 }
150 for (Uint8 i = 0; i < data.bearerContextsMarkedForRemovalCount; i++)
151 {
152 // Encode the Ie Header
153 header.ieType = BearerContextIeType;
154 header.instance = 1;
155 header.length = 0; // We will encode the IE first and then update the length
156 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
157 startIndex = buffer.getCurrentIndex();
158 BearerContextIe bearerContext=
159 dynamic_cast<
160 BearerContextIe&>(GtpV2IeFactory::getInstance().
161 getIeObject(BearerContextIeType));
162 BearerContextsMarkedForRemovalInModifyBearerResponse groupedIeInstance = dynamic_cast<BearerContextsMarkedForRemovalInModifyBearerResponse&>(bearerContext.getGroupedIe(msgType, 1));
163 rc = groupedIeInstance.encodeBearerContextsMarkedForRemovalInModifyBearerResponse(buffer, data.bearerContextsMarkedForRemoval[i]);
164 endIndex = buffer.getCurrentIndex();
165 length = endIndex - startIndex;
166
167 // encode the length value now
168 buffer.goToIndex(startIndex - 3);
169 buffer.writeUint16(length, false);
170 buffer.goToIndex(endIndex);
171 }
172
173 if (!(rc))
174 {
175 errorStream.add((char *)"Failed to encode IE: bearerContextsMarkedForRemoval\n");
176 return false;
177 }
178
179 if (data.indicationFlagsIePresent)
180 {
181
182 // Encode the Ie Header
183 header.ieType = IndicationIeType;
184 header.instance = 0;
185 header.length = 0; // We will encode the IE first and then update the length
186 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
187 startIndex = buffer.getCurrentIndex();
188 IndicationIe indication=
189 dynamic_cast<
190 IndicationIe&>(GtpV2IeFactory::getInstance().getIeObject(IndicationIeType));
191 rc = indication.encodeIndicationIe(buffer, data.indicationFlags);
192 endIndex = buffer.getCurrentIndex();
193 length = endIndex - startIndex;
194
195 // encode the length value now
196 buffer.goToIndex(startIndex - 3);
197 buffer.writeUint16(length, false);
198 buffer.goToIndex(endIndex);
199
200 if (!(rc))
201 {
202 errorStream.add((char *)"Failed to encode IE: indicationFlags\n");
203 return false;
204 }
205 }
206
207
208 // Encode the Ie Header
209 header.ieType = CauseIeType;
210 header.instance = 0;
211 header.length = 0; // We will encode the IE first and then update the length
212 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
213 startIndex = buffer.getCurrentIndex();
214 CauseIe cause=
215 dynamic_cast<
216 CauseIe&>(GtpV2IeFactory::getInstance().getIeObject(CauseIeType));
217 rc = cause.encodeCauseIe(buffer, data.cause);
218 endIndex = buffer.getCurrentIndex();
219 length = endIndex - startIndex;
220
221 // encode the length value now
222 buffer.goToIndex(startIndex - 3);
223 buffer.writeUint16(length, false);
224 buffer.goToIndex(endIndex);
225
226 if (!(rc))
227 {
228 errorStream.add((char *)"Failed to encode IE: cause\n");
229 return false;
230 }
231
232 if (data.apnRestrictionIePresent)
233 {
234
235 // Encode the Ie Header
236 header.ieType = ApnRestrictionIeType;
237 header.instance = 0;
238 header.length = 0; // We will encode the IE first and then update the length
239 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
240 startIndex = buffer.getCurrentIndex();
241 ApnRestrictionIe apnRestriction=
242 dynamic_cast<
243 ApnRestrictionIe&>(GtpV2IeFactory::getInstance().getIeObject(ApnRestrictionIeType));
244 rc = apnRestriction.encodeApnRestrictionIe(buffer, data.apnRestriction);
245 endIndex = buffer.getCurrentIndex();
246 length = endIndex - startIndex;
247
248 // encode the length value now
249 buffer.goToIndex(startIndex - 3);
250 buffer.writeUint16(length, false);
251 buffer.goToIndex(endIndex);
252
253 if (!(rc))
254 {
255 errorStream.add((char *)"Failed to encode IE: apnRestriction\n");
256 return false;
257 }
258 }
259
260 if (data.protocolConfigurationOptionsIePresent)
261 {
262
263 // Encode the Ie Header
264 header.ieType = PcoIeType;
265 header.instance = 0;
266 header.length = 0; // We will encode the IE first and then update the length
267 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
268 startIndex = buffer.getCurrentIndex();
269 PcoIe pco=
270 dynamic_cast<
271 PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType));
272 rc = pco.encodePcoIe(buffer, data.protocolConfigurationOptions);
273 endIndex = buffer.getCurrentIndex();
274 length = endIndex - startIndex;
275
276 // encode the length value now
277 buffer.goToIndex(startIndex - 3);
278 buffer.writeUint16(length, false);
279 buffer.goToIndex(endIndex);
280
281 if (!(rc))
282 {
283 errorStream.add((char *)"Failed to encode IE: protocolConfigurationOptions\n");
284 return false;
285 }
286 }
287
288 if (data.changeReportingActionIePresent)
289 {
290
291 // Encode the Ie Header
292 header.ieType = ChangeReportingActionIeType;
293 header.instance = 0;
294 header.length = 0; // We will encode the IE first and then update the length
295 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
296 startIndex = buffer.getCurrentIndex();
297 ChangeReportingActionIe changeReportingAction=
298 dynamic_cast<
299 ChangeReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(ChangeReportingActionIeType));
300 rc = changeReportingAction.encodeChangeReportingActionIe(buffer, data.changeReportingAction);
301 endIndex = buffer.getCurrentIndex();
302 length = endIndex - startIndex;
303
304 // encode the length value now
305 buffer.goToIndex(startIndex - 3);
306 buffer.writeUint16(length, false);
307 buffer.goToIndex(endIndex);
308
309 if (!(rc))
310 {
311 errorStream.add((char *)"Failed to encode IE: changeReportingAction\n");
312 return false;
313 }
314 }
315
316 if (data.csgInformationReportingActionIePresent)
317 {
318
319 // Encode the Ie Header
320 header.ieType = CsgInformationReportingActionIeType;
321 header.instance = 0;
322 header.length = 0; // We will encode the IE first and then update the length
323 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
324 startIndex = buffer.getCurrentIndex();
325 CsgInformationReportingActionIe csgInformationReportingAction=
326 dynamic_cast<
327 CsgInformationReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(CsgInformationReportingActionIeType));
328 rc = csgInformationReportingAction.encodeCsgInformationReportingActionIe(buffer, data.csgInformationReportingAction);
329 endIndex = buffer.getCurrentIndex();
330 length = endIndex - startIndex;
331
332 // encode the length value now
333 buffer.goToIndex(startIndex - 3);
334 buffer.writeUint16(length, false);
335 buffer.goToIndex(endIndex);
336
337 if (!(rc))
338 {
339 errorStream.add((char *)"Failed to encode IE: csgInformationReportingAction\n");
340 return false;
341 }
342 }
343
344 if (data.hNbInformationReportingIePresent)
345 {
346
347 // Encode the Ie Header
348 header.ieType = HenbInformationReportingIeType;
349 header.instance = 0;
350 header.length = 0; // We will encode the IE first and then update the length
351 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
352 startIndex = buffer.getCurrentIndex();
353 HenbInformationReportingIe henbInformationReporting=
354 dynamic_cast<
355 HenbInformationReportingIe&>(GtpV2IeFactory::getInstance().getIeObject(HenbInformationReportingIeType));
356 rc = henbInformationReporting.encodeHenbInformationReportingIe(buffer, data.hNbInformationReporting);
357 endIndex = buffer.getCurrentIndex();
358 length = endIndex - startIndex;
359
360 // encode the length value now
361 buffer.goToIndex(startIndex - 3);
362 buffer.writeUint16(length, false);
363 buffer.goToIndex(endIndex);
364
365 if (!(rc))
366 {
367 errorStream.add((char *)"Failed to encode IE: hNbInformationReporting\n");
368 return false;
369 }
370 }
371
372 if (data.chargingGatewayNameIePresent)
373 {
374
375 // Encode the Ie Header
376 header.ieType = FqdnIeType;
377 header.instance = 0;
378 header.length = 0; // We will encode the IE first and then update the length
379 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
380 startIndex = buffer.getCurrentIndex();
381 FqdnIe fqdn=
382 dynamic_cast<
383 FqdnIe&>(GtpV2IeFactory::getInstance().getIeObject(FqdnIeType));
384 rc = fqdn.encodeFqdnIe(buffer, data.chargingGatewayName);
385 endIndex = buffer.getCurrentIndex();
386 length = endIndex - startIndex;
387
388 // encode the length value now
389 buffer.goToIndex(startIndex - 3);
390 buffer.writeUint16(length, false);
391 buffer.goToIndex(endIndex);
392
393 if (!(rc))
394 {
395 errorStream.add((char *)"Failed to encode IE: chargingGatewayName\n");
396 return false;
397 }
398 }
399
400 if (data.chargingGatewayAddressIePresent)
401 {
402
403 // Encode the Ie Header
404 header.ieType = IpAddressIeType;
405 header.instance = 0;
406 header.length = 0; // We will encode the IE first and then update the length
407 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
408 startIndex = buffer.getCurrentIndex();
409 IpAddressIe ipAddress=
410 dynamic_cast<
411 IpAddressIe&>(GtpV2IeFactory::getInstance().getIeObject(IpAddressIeType));
412 rc = ipAddress.encodeIpAddressIe(buffer, data.chargingGatewayAddress);
413 endIndex = buffer.getCurrentIndex();
414 length = endIndex - startIndex;
415
416 // encode the length value now
417 buffer.goToIndex(startIndex - 3);
418 buffer.writeUint16(length, false);
419 buffer.goToIndex(endIndex);
420
421 if (!(rc))
422 {
423 errorStream.add((char *)"Failed to encode IE: chargingGatewayAddress\n");
424 return false;
425 }
426 }
427
428 if (data.pgwFqCsidIePresent)
429 {
430
431 // Encode the Ie Header
432 header.ieType = FqCsidIeType;
433 header.instance = 0;
434 header.length = 0; // We will encode the IE first and then update the length
435 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
436 startIndex = buffer.getCurrentIndex();
437 FqCsidIe fqCsid=
438 dynamic_cast<
439 FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType));
440 rc = fqCsid.encodeFqCsidIe(buffer, data.pgwFqCsid);
441 endIndex = buffer.getCurrentIndex();
442 length = endIndex - startIndex;
443
444 // encode the length value now
445 buffer.goToIndex(startIndex - 3);
446 buffer.writeUint16(length, false);
447 buffer.goToIndex(endIndex);
448
449 if (!(rc))
450 {
451 errorStream.add((char *)"Failed to encode IE: pgwFqCsid\n");
452 return false;
453 }
454 }
455
456 if (data.sgwFqCsidIePresent)
457 {
458
459 // Encode the Ie Header
460 header.ieType = FqCsidIeType;
461 header.instance = 1;
462 header.length = 0; // We will encode the IE first and then update the length
463 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
464 startIndex = buffer.getCurrentIndex();
465 FqCsidIe fqCsid=
466 dynamic_cast<
467 FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType));
468 rc = fqCsid.encodeFqCsidIe(buffer, data.sgwFqCsid);
469 endIndex = buffer.getCurrentIndex();
470 length = endIndex - startIndex;
471
472 // encode the length value now
473 buffer.goToIndex(startIndex - 3);
474 buffer.writeUint16(length, false);
475 buffer.goToIndex(endIndex);
476
477 if (!(rc))
478 {
479 errorStream.add((char *)"Failed to encode IE: sgwFqCsid\n");
480 return false;
481 }
482 }
483
484 if (data.recoveryIePresent)
485 {
486
487 // Encode the Ie Header
488 header.ieType = RecoveryIeType;
489 header.instance = 0;
490 header.length = 0; // We will encode the IE first and then update the length
491 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
492 startIndex = buffer.getCurrentIndex();
493 RecoveryIe recovery=
494 dynamic_cast<
495 RecoveryIe&>(GtpV2IeFactory::getInstance().getIeObject(RecoveryIeType));
496 rc = recovery.encodeRecoveryIe(buffer, data.recovery);
497 endIndex = buffer.getCurrentIndex();
498 length = endIndex - startIndex;
499
500 // encode the length value now
501 buffer.goToIndex(startIndex - 3);
502 buffer.writeUint16(length, false);
503 buffer.goToIndex(endIndex);
504
505 if (!(rc))
506 {
507 errorStream.add((char *)"Failed to encode IE: recovery\n");
508 return false;
509 }
510 }
511
512 if (data.sgwLdnIePresent)
513 {
514
515 // Encode the Ie Header
516 header.ieType = LocalDistinguishedNameIeType;
517 header.instance = 0;
518 header.length = 0; // We will encode the IE first and then update the length
519 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
520 startIndex = buffer.getCurrentIndex();
521 LocalDistinguishedNameIe localDistinguishedName=
522 dynamic_cast<
523 LocalDistinguishedNameIe&>(GtpV2IeFactory::getInstance().getIeObject(LocalDistinguishedNameIeType));
524 rc = localDistinguishedName.encodeLocalDistinguishedNameIe(buffer, data.sgwLdn);
525 endIndex = buffer.getCurrentIndex();
526 length = endIndex - startIndex;
527
528 // encode the length value now
529 buffer.goToIndex(startIndex - 3);
530 buffer.writeUint16(length, false);
531 buffer.goToIndex(endIndex);
532
533 if (!(rc))
534 {
535 errorStream.add((char *)"Failed to encode IE: sgwLdn\n");
536 return false;
537 }
538 }
539
540 if (data.pgwLdnIePresent)
541 {
542
543 // Encode the Ie Header
544 header.ieType = LocalDistinguishedNameIeType;
545 header.instance = 1;
546 header.length = 0; // We will encode the IE first and then update the length
547 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
548 startIndex = buffer.getCurrentIndex();
549 LocalDistinguishedNameIe localDistinguishedName=
550 dynamic_cast<
551 LocalDistinguishedNameIe&>(GtpV2IeFactory::getInstance().getIeObject(LocalDistinguishedNameIeType));
552 rc = localDistinguishedName.encodeLocalDistinguishedNameIe(buffer, data.pgwLdn);
553 endIndex = buffer.getCurrentIndex();
554 length = endIndex - startIndex;
555
556 // encode the length value now
557 buffer.goToIndex(startIndex - 3);
558 buffer.writeUint16(length, false);
559 buffer.goToIndex(endIndex);
560
561 if (!(rc))
562 {
563 errorStream.add((char *)"Failed to encode IE: pgwLdn\n");
564 return false;
565 }
566 }
567
568 if (data.presenceReportingAreaActionIePresent)
569 {
570
571 // Encode the Ie Header
572 header.ieType = PresenceReportingAreaActionIeType;
573 header.instance = 0;
574 header.length = 0; // We will encode the IE first and then update the length
575 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
576 startIndex = buffer.getCurrentIndex();
577 PresenceReportingAreaActionIe presenceReportingAreaAction=
578 dynamic_cast<
579 PresenceReportingAreaActionIe&>(GtpV2IeFactory::getInstance().getIeObject(PresenceReportingAreaActionIeType));
580 rc = presenceReportingAreaAction.encodePresenceReportingAreaActionIe(buffer, data.presenceReportingAreaAction);
581 endIndex = buffer.getCurrentIndex();
582 length = endIndex - startIndex;
583
584 // encode the length value now
585 buffer.goToIndex(startIndex - 3);
586 buffer.writeUint16(length, false);
587 buffer.goToIndex(endIndex);
588
589 if (!(rc))
590 {
591 errorStream.add((char *)"Failed to encode IE: presenceReportingAreaAction\n");
592 return false;
593 }
594 }
595
596 if (data.pgwsNodeLevelLoadControlInformationIePresent)
597 {
598
599 // Encode the Ie Header
600 header.ieType = LoadControlInformationIeType;
601 header.instance = 0;
602 header.length = 0; // We will encode the IE first and then update the length
603 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
604 startIndex = buffer.getCurrentIndex();
605 LoadControlInformationIe loadControlInformation=
606 dynamic_cast<
607 LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType));
608 PgwsNodeLevelLoadControlInformationInModifyBearerResponse groupedIeInstance =
609 dynamic_cast<
610 PgwsNodeLevelLoadControlInformationInModifyBearerResponse&>(loadControlInformation.getGroupedIe(msgType, 0));
611 rc = groupedIeInstance.encodePgwsNodeLevelLoadControlInformationInModifyBearerResponse(buffer, data.pgwsNodeLevelLoadControlInformation);
612 endIndex = buffer.getCurrentIndex();
613 length = endIndex - startIndex;
614
615 // encode the length value now
616 buffer.goToIndex(startIndex - 3);
617 buffer.writeUint16(length, false);
618 buffer.goToIndex(endIndex);
619
620 if (!(rc))
621 {
622 errorStream.add((char *)"Failed to encode IE: pgwsNodeLevelLoadControlInformation\n");
623 return false;
624 }
625 }
626
627 if (data.pgwsApnLevelLoadControlInformationIePresent)
628 {
629
630 // Encode the Ie Header
631 header.ieType = LoadControlInformationIeType;
632 header.instance = 1;
633 header.length = 0; // We will encode the IE first and then update the length
634 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
635 startIndex = buffer.getCurrentIndex();
636 LoadControlInformationIe loadControlInformation=
637 dynamic_cast<
638 LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType));
639 PgwsApnLevelLoadControlInformationInModifyBearerResponse groupedIeInstance =
640 dynamic_cast<
641 PgwsApnLevelLoadControlInformationInModifyBearerResponse&>(loadControlInformation.getGroupedIe(msgType, 1));
642 rc = groupedIeInstance.encodePgwsApnLevelLoadControlInformationInModifyBearerResponse(buffer, data.pgwsApnLevelLoadControlInformation);
643 endIndex = buffer.getCurrentIndex();
644 length = endIndex - startIndex;
645
646 // encode the length value now
647 buffer.goToIndex(startIndex - 3);
648 buffer.writeUint16(length, false);
649 buffer.goToIndex(endIndex);
650
651 if (!(rc))
652 {
653 errorStream.add((char *)"Failed to encode IE: pgwsApnLevelLoadControlInformation\n");
654 return false;
655 }
656 }
657
658 if (data.sgwsNodeLevelLoadControlInformationIePresent)
659 {
660
661 // Encode the Ie Header
662 header.ieType = LoadControlInformationIeType;
663 header.instance = 2;
664 header.length = 0; // We will encode the IE first and then update the length
665 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
666 startIndex = buffer.getCurrentIndex();
667 LoadControlInformationIe loadControlInformation=
668 dynamic_cast<
669 LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType));
670 SgwsNodeLevelLoadControlInformationInModifyBearerResponse groupedIeInstance =
671 dynamic_cast<
672 SgwsNodeLevelLoadControlInformationInModifyBearerResponse&>(loadControlInformation.getGroupedIe(msgType, 2));
673 rc = groupedIeInstance.encodeSgwsNodeLevelLoadControlInformationInModifyBearerResponse(buffer, data.sgwsNodeLevelLoadControlInformation);
674 endIndex = buffer.getCurrentIndex();
675 length = endIndex - startIndex;
676
677 // encode the length value now
678 buffer.goToIndex(startIndex - 3);
679 buffer.writeUint16(length, false);
680 buffer.goToIndex(endIndex);
681
682 if (!(rc))
683 {
684 errorStream.add((char *)"Failed to encode IE: sgwsNodeLevelLoadControlInformation\n");
685 return false;
686 }
687 }
688
689 if (data.pgwsOverloadControlInformationIePresent)
690 {
691
692 // Encode the Ie Header
693 header.ieType = OverloadControlInformationIeType;
694 header.instance = 0;
695 header.length = 0; // We will encode the IE first and then update the length
696 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
697 startIndex = buffer.getCurrentIndex();
698 OverloadControlInformationIe overloadControlInformation=
699 dynamic_cast<
700 OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType));
701 PgwsOverloadControlInformationInModifyBearerResponse groupedIeInstance =
702 dynamic_cast<
703 PgwsOverloadControlInformationInModifyBearerResponse&>(overloadControlInformation.getGroupedIe(msgType, 0));
704 rc = groupedIeInstance.encodePgwsOverloadControlInformationInModifyBearerResponse(buffer, data.pgwsOverloadControlInformation);
705 endIndex = buffer.getCurrentIndex();
706 length = endIndex - startIndex;
707
708 // encode the length value now
709 buffer.goToIndex(startIndex - 3);
710 buffer.writeUint16(length, false);
711 buffer.goToIndex(endIndex);
712
713 if (!(rc))
714 {
715 errorStream.add((char *)"Failed to encode IE: pgwsOverloadControlInformation\n");
716 return false;
717 }
718 }
719
720 if (data.sgwsOverloadControlInformationIePresent)
721 {
722
723 // Encode the Ie Header
724 header.ieType = OverloadControlInformationIeType;
725 header.instance = 1;
726 header.length = 0; // We will encode the IE first and then update the length
727 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
728 startIndex = buffer.getCurrentIndex();
729 OverloadControlInformationIe overloadControlInformation=
730 dynamic_cast<
731 OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType));
732 SgwsOverloadControlInformationInModifyBearerResponse groupedIeInstance =
733 dynamic_cast<
734 SgwsOverloadControlInformationInModifyBearerResponse&>(overloadControlInformation.getGroupedIe(msgType, 1));
735 rc = groupedIeInstance.encodeSgwsOverloadControlInformationInModifyBearerResponse(buffer, data.sgwsOverloadControlInformation);
736 endIndex = buffer.getCurrentIndex();
737 length = endIndex - startIndex;
738
739 // encode the length value now
740 buffer.goToIndex(startIndex - 3);
741 buffer.writeUint16(length, false);
742 buffer.goToIndex(endIndex);
743
744 if (!(rc))
745 {
746 errorStream.add((char *)"Failed to encode IE: sgwsOverloadControlInformation\n");
747 return false;
748 }
749 }
750
751 if (data.pdnConnectionChargingIdIePresent)
752 {
753
754 // Encode the Ie Header
755 header.ieType = ChargingIdIeType;
756 header.instance = 0;
757 header.length = 0; // We will encode the IE first and then update the length
758 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
759 startIndex = buffer.getCurrentIndex();
760 ChargingIdIe chargingId=
761 dynamic_cast<
762 ChargingIdIe&>(GtpV2IeFactory::getInstance().getIeObject(ChargingIdIeType));
763 rc = chargingId.encodeChargingIdIe(buffer, data.pdnConnectionChargingId);
764 endIndex = buffer.getCurrentIndex();
765 length = endIndex - startIndex;
766
767 // encode the length value now
768 buffer.goToIndex(startIndex - 3);
769 buffer.writeUint16(length, false);
770 buffer.goToIndex(endIndex);
771
772 if (!(rc))
773 {
774 errorStream.add((char *)"Failed to encode IE: pdnConnectionChargingId\n");
775 return false;
776 }
777 }
778
779 if (data.msisdnIePresent)
780 {
781
782 // Encode the Ie Header
783 header.ieType = MsisdnIeType;
784 header.instance = 0;
785 header.length = 0; // We will encode the IE first and then update the length
786 GtpV2Ie::encodeGtpV2IeHeader(buffer, header);
787 startIndex = buffer.getCurrentIndex();
788 MsisdnIe msisdn=
789 dynamic_cast<
790 MsisdnIe&>(GtpV2IeFactory::getInstance().getIeObject(MsisdnIeType));
791 rc = msisdn.encodeMsisdnIe(buffer, data.msisdn);
792 endIndex = buffer.getCurrentIndex();
793 length = endIndex - startIndex;
794
795 // encode the length value now
796 buffer.goToIndex(startIndex - 3);
797 buffer.writeUint16(length, false);
798 buffer.goToIndex(endIndex);
799
800 if (!(rc))
801 {
802 errorStream.add((char *)"Failed to encode IE: msisdn\n");
803 return false;
804 }
805 }
806 return rc;
807
808}
809
810bool ModifyBearerResponseMsg::decodeModifyBearerResponseMsg(MsgBuffer &buffer,
811 ModifyBearerResponseMsgData
812 &data, Uint16 length)
813{
814
815 bool rc = false;
816 GtpV2IeHeader ieHeader;
817
818 set<Uint16> mandatoryIeLocalList = mandatoryIeSet;
819 while (buffer.lengthLeft() > IE_HEADER_SIZE)
820 {
821 GtpV2Ie::decodeGtpV2IeHeader(buffer, ieHeader);
822 if (ieHeader.length > buffer.lengthLeft())
823 {
824 // We do not have enough bytes left in the message for this IE
825 errorStream.add((char *)"IE Length exceeds beyond message boundary\n");
826 errorStream.add((char *)" Offending IE Type: ");
827 errorStream.add(ieHeader.ieType);
828 errorStream.add((char *)"\n Ie Length in Header: ");
829 errorStream.add(ieHeader.length);
830 errorStream.add((char *)"\n Bytes left in message: ");
831 errorStream.add(buffer.lengthLeft());
832 errorStream.endOfLine();
833 return false;
834 }
835
836 switch (ieHeader.ieType){
837
838 case EbiIeType:
839 {
840 EbiIe ieObject =
841 dynamic_cast<
842 EbiIe&>(GtpV2IeFactory::getInstance().getIeObject(EbiIeType));
843
844 if(ieHeader.instance == 0)
845 {
846 rc = ieObject.decodeEbiIe(buffer, data.linkedEpsBearerId, ieHeader.length);
847
848 data.linkedEpsBearerIdIePresent = true;
849 if (!(rc))
850 {
851 errorStream.add((char *)"Failed to decode IE: linkedEpsBearerId\n");
852 return false;
853 }
854 }
855
856 else
857 {
858 // Unknown IE instance print error
859 errorStream.add((char *)"Unknown IE Type: ");
860 errorStream.add(ieHeader.ieType);
861 errorStream.endOfLine();
862 buffer.skipBytes(ieHeader.length);
863 }
864 break;
865 }
866
867 case BearerContextIeType:
868 {
869 BearerContextIe ieObject =
870 dynamic_cast<
871 BearerContextIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerContextIeType));
872
873 if(ieHeader.instance == 0)
874 {
875 // First check if we have enough space left to decode and store this instance
876 if (data.bearerContextsModifiedCount == 11)
877 {
878 errorStream.add((char *)"More than 11 instances of bearerContextsModified received\n");
879 return false;
880 }
881 BearerContextsModifiedInModifyBearerResponse groupedIeInstance =
882 dynamic_cast<
883 BearerContextsModifiedInModifyBearerResponse&>(ieObject.getGroupedIe(msgType, 0));
884 rc = groupedIeInstance.decodeBearerContextsModifiedInModifyBearerResponse(buffer,
885 data.bearerContextsModified[data.bearerContextsModifiedCount], ieHeader.length);
886 data.bearerContextsModifiedCount++; // TODO Count validation
887
888 if (!(rc))
889 {
890 errorStream.add((char *)"Failed to decode IE: bearerContextsModified\n");
891 return false;
892 }
893 }
894 else if(ieHeader.instance == 1)
895 {
896 // First check if we have enough space left to decode and store this instance
897 if (data.bearerContextsMarkedForRemovalCount == 11)
898 {
899 errorStream.add((char *)"More than 11 instances of bearerContextsMarkedForRemoval received\n");
900 return false;
901 }
902 BearerContextsMarkedForRemovalInModifyBearerResponse groupedIeInstance =
903 dynamic_cast<
904 BearerContextsMarkedForRemovalInModifyBearerResponse&>(ieObject.getGroupedIe(msgType, 1));
905 rc = groupedIeInstance.decodeBearerContextsMarkedForRemovalInModifyBearerResponse(buffer,
906 data.bearerContextsMarkedForRemoval[data.bearerContextsMarkedForRemovalCount], ieHeader.length);
907 data.bearerContextsMarkedForRemovalCount++; // TODO Count validation
908
909 if (!(rc))
910 {
911 errorStream.add((char *)"Failed to decode IE: bearerContextsMarkedForRemoval\n");
912 return false;
913 }
914 }
915
916 else
917 {
918 // Unknown IE instance print error
919 errorStream.add((char *)"Unknown IE Type: ");
920 errorStream.add(ieHeader.ieType);
921 errorStream.endOfLine();
922 buffer.skipBytes(ieHeader.length);
923 }
924 break;
925 }
926
927 case IndicationIeType:
928 {
929 IndicationIe ieObject =
930 dynamic_cast<
931 IndicationIe&>(GtpV2IeFactory::getInstance().getIeObject(IndicationIeType));
932
933 if(ieHeader.instance == 0)
934 {
935 rc = ieObject.decodeIndicationIe(buffer, data.indicationFlags, ieHeader.length);
936
937 data.indicationFlagsIePresent = true;
938 if (!(rc))
939 {
940 errorStream.add((char *)"Failed to decode IE: indicationFlags\n");
941 return false;
942 }
943 }
944
945 else
946 {
947 // Unknown IE instance print error
948 errorStream.add((char *)"Unknown IE Type: ");
949 errorStream.add(ieHeader.ieType);
950 errorStream.endOfLine();
951 buffer.skipBytes(ieHeader.length);
952 }
953 break;
954 }
955
956 case CauseIeType:
957 {
958 CauseIe ieObject =
959 dynamic_cast<
960 CauseIe&>(GtpV2IeFactory::getInstance().getIeObject(CauseIeType));
961
962 if(ieHeader.instance == 0)
963 {
964 rc = ieObject.decodeCauseIe(buffer, data.cause, ieHeader.length);
965
966 if (!(rc))
967 {
968 errorStream.add((char *)"Failed to decode IE: cause\n");
969 return false;
970 }
971 }
972
973 else
974 {
975 // Unknown IE instance print error
976 errorStream.add((char *)"Unknown IE Type: ");
977 errorStream.add(ieHeader.ieType);
978 errorStream.endOfLine();
979 buffer.skipBytes(ieHeader.length);
980 }
981 break;
982 }
983
984 case ApnRestrictionIeType:
985 {
986 ApnRestrictionIe ieObject =
987 dynamic_cast<
988 ApnRestrictionIe&>(GtpV2IeFactory::getInstance().getIeObject(ApnRestrictionIeType));
989
990 if(ieHeader.instance == 0)
991 {
992 rc = ieObject.decodeApnRestrictionIe(buffer, data.apnRestriction, ieHeader.length);
993
994 data.apnRestrictionIePresent = true;
995 if (!(rc))
996 {
997 errorStream.add((char *)"Failed to decode IE: apnRestriction\n");
998 return false;
999 }
1000 }
1001
1002 else
1003 {
1004 // Unknown IE instance print error
1005 errorStream.add((char *)"Unknown IE Type: ");
1006 errorStream.add(ieHeader.ieType);
1007 errorStream.endOfLine();
1008 buffer.skipBytes(ieHeader.length);
1009 }
1010 break;
1011 }
1012
1013 case PcoIeType:
1014 {
1015 PcoIe ieObject =
1016 dynamic_cast<
1017 PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType));
1018
1019 if(ieHeader.instance == 0)
1020 {
1021 rc = ieObject.decodePcoIe(buffer, data.protocolConfigurationOptions, ieHeader.length);
1022
1023 data.protocolConfigurationOptionsIePresent = true;
1024 if (!(rc))
1025 {
1026 errorStream.add((char *)"Failed to decode IE: protocolConfigurationOptions\n");
1027 return false;
1028 }
1029 }
1030
1031 else
1032 {
1033 // Unknown IE instance print error
1034 errorStream.add((char *)"Unknown IE Type: ");
1035 errorStream.add(ieHeader.ieType);
1036 errorStream.endOfLine();
1037 buffer.skipBytes(ieHeader.length);
1038 }
1039 break;
1040 }
1041
1042 case ChangeReportingActionIeType:
1043 {
1044 ChangeReportingActionIe ieObject =
1045 dynamic_cast<
1046 ChangeReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(ChangeReportingActionIeType));
1047
1048 if(ieHeader.instance == 0)
1049 {
1050 rc = ieObject.decodeChangeReportingActionIe(buffer, data.changeReportingAction, ieHeader.length);
1051
1052 data.changeReportingActionIePresent = true;
1053 if (!(rc))
1054 {
1055 errorStream.add((char *)"Failed to decode IE: changeReportingAction\n");
1056 return false;
1057 }
1058 }
1059
1060 else
1061 {
1062 // Unknown IE instance print error
1063 errorStream.add((char *)"Unknown IE Type: ");
1064 errorStream.add(ieHeader.ieType);
1065 errorStream.endOfLine();
1066 buffer.skipBytes(ieHeader.length);
1067 }
1068 break;
1069 }
1070
1071 case CsgInformationReportingActionIeType:
1072 {
1073 CsgInformationReportingActionIe ieObject =
1074 dynamic_cast<
1075 CsgInformationReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(CsgInformationReportingActionIeType));
1076
1077 if(ieHeader.instance == 0)
1078 {
1079 rc = ieObject.decodeCsgInformationReportingActionIe(buffer, data.csgInformationReportingAction, ieHeader.length);
1080
1081 data.csgInformationReportingActionIePresent = true;
1082 if (!(rc))
1083 {
1084 errorStream.add((char *)"Failed to decode IE: csgInformationReportingAction\n");
1085 return false;
1086 }
1087 }
1088
1089 else
1090 {
1091 // Unknown IE instance print error
1092 errorStream.add((char *)"Unknown IE Type: ");
1093 errorStream.add(ieHeader.ieType);
1094 errorStream.endOfLine();
1095 buffer.skipBytes(ieHeader.length);
1096 }
1097 break;
1098 }
1099
1100 case HenbInformationReportingIeType:
1101 {
1102 HenbInformationReportingIe ieObject =
1103 dynamic_cast<
1104 HenbInformationReportingIe&>(GtpV2IeFactory::getInstance().getIeObject(HenbInformationReportingIeType));
1105
1106 if(ieHeader.instance == 0)
1107 {
1108 rc = ieObject.decodeHenbInformationReportingIe(buffer, data.hNbInformationReporting, ieHeader.length);
1109
1110 data.hNbInformationReportingIePresent = true;
1111 if (!(rc))
1112 {
1113 errorStream.add((char *)"Failed to decode IE: hNbInformationReporting\n");
1114 return false;
1115 }
1116 }
1117
1118 else
1119 {
1120 // Unknown IE instance print error
1121 errorStream.add((char *)"Unknown IE Type: ");
1122 errorStream.add(ieHeader.ieType);
1123 errorStream.endOfLine();
1124 buffer.skipBytes(ieHeader.length);
1125 }
1126 break;
1127 }
1128
1129 case FqdnIeType:
1130 {
1131 FqdnIe ieObject =
1132 dynamic_cast<
1133 FqdnIe&>(GtpV2IeFactory::getInstance().getIeObject(FqdnIeType));
1134
1135 if(ieHeader.instance == 0)
1136 {
1137 rc = ieObject.decodeFqdnIe(buffer, data.chargingGatewayName, ieHeader.length);
1138
1139 data.chargingGatewayNameIePresent = true;
1140 if (!(rc))
1141 {
1142 errorStream.add((char *)"Failed to decode IE: chargingGatewayName\n");
1143 return false;
1144 }
1145 }
1146
1147 else
1148 {
1149 // Unknown IE instance print error
1150 errorStream.add((char *)"Unknown IE Type: ");
1151 errorStream.add(ieHeader.ieType);
1152 errorStream.endOfLine();
1153 buffer.skipBytes(ieHeader.length);
1154 }
1155 break;
1156 }
1157
1158 case IpAddressIeType:
1159 {
1160 IpAddressIe ieObject =
1161 dynamic_cast<
1162 IpAddressIe&>(GtpV2IeFactory::getInstance().getIeObject(IpAddressIeType));
1163
1164 if(ieHeader.instance == 0)
1165 {
1166 rc = ieObject.decodeIpAddressIe(buffer, data.chargingGatewayAddress, ieHeader.length);
1167
1168 data.chargingGatewayAddressIePresent = true;
1169 if (!(rc))
1170 {
1171 errorStream.add((char *)"Failed to decode IE: chargingGatewayAddress\n");
1172 return false;
1173 }
1174 }
1175
1176 else
1177 {
1178 // Unknown IE instance print error
1179 errorStream.add((char *)"Unknown IE Type: ");
1180 errorStream.add(ieHeader.ieType);
1181 errorStream.endOfLine();
1182 buffer.skipBytes(ieHeader.length);
1183 }
1184 break;
1185 }
1186
1187 case FqCsidIeType:
1188 {
1189 FqCsidIe ieObject =
1190 dynamic_cast<
1191 FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType));
1192
1193 if(ieHeader.instance == 0)
1194 {
1195 rc = ieObject.decodeFqCsidIe(buffer, data.pgwFqCsid, ieHeader.length);
1196
1197 data.pgwFqCsidIePresent = true;
1198 if (!(rc))
1199 {
1200 errorStream.add((char *)"Failed to decode IE: pgwFqCsid\n");
1201 return false;
1202 }
1203 }
1204 else if(ieHeader.instance == 1)
1205 {
1206 rc = ieObject.decodeFqCsidIe(buffer, data.sgwFqCsid, ieHeader.length);
1207
1208 data.sgwFqCsidIePresent = true;
1209 if (!(rc))
1210 {
1211 errorStream.add((char *)"Failed to decode IE: sgwFqCsid\n");
1212 return false;
1213 }
1214 }
1215
1216 else
1217 {
1218 // Unknown IE instance print error
1219 errorStream.add((char *)"Unknown IE Type: ");
1220 errorStream.add(ieHeader.ieType);
1221 errorStream.endOfLine();
1222 buffer.skipBytes(ieHeader.length);
1223 }
1224 break;
1225 }
1226
1227 case RecoveryIeType:
1228 {
1229 RecoveryIe ieObject =
1230 dynamic_cast<
1231 RecoveryIe&>(GtpV2IeFactory::getInstance().getIeObject(RecoveryIeType));
1232
1233 if(ieHeader.instance == 0)
1234 {
1235 rc = ieObject.decodeRecoveryIe(buffer, data.recovery, ieHeader.length);
1236
1237 data.recoveryIePresent = true;
1238 if (!(rc))
1239 {
1240 errorStream.add((char *)"Failed to decode IE: recovery\n");
1241 return false;
1242 }
1243 }
1244
1245 else
1246 {
1247 // Unknown IE instance print error
1248 errorStream.add((char *)"Unknown IE Type: ");
1249 errorStream.add(ieHeader.ieType);
1250 errorStream.endOfLine();
1251 buffer.skipBytes(ieHeader.length);
1252 }
1253 break;
1254 }
1255
1256 case LocalDistinguishedNameIeType:
1257 {
1258 LocalDistinguishedNameIe ieObject =
1259 dynamic_cast<
1260 LocalDistinguishedNameIe&>(GtpV2IeFactory::getInstance().getIeObject(LocalDistinguishedNameIeType));
1261
1262 if(ieHeader.instance == 0)
1263 {
1264 rc = ieObject.decodeLocalDistinguishedNameIe(buffer, data.sgwLdn, ieHeader.length);
1265
1266 data.sgwLdnIePresent = true;
1267 if (!(rc))
1268 {
1269 errorStream.add((char *)"Failed to decode IE: sgwLdn\n");
1270 return false;
1271 }
1272 }
1273 else if(ieHeader.instance == 1)
1274 {
1275 rc = ieObject.decodeLocalDistinguishedNameIe(buffer, data.pgwLdn, ieHeader.length);
1276
1277 data.pgwLdnIePresent = true;
1278 if (!(rc))
1279 {
1280 errorStream.add((char *)"Failed to decode IE: pgwLdn\n");
1281 return false;
1282 }
1283 }
1284
1285 else
1286 {
1287 // Unknown IE instance print error
1288 errorStream.add((char *)"Unknown IE Type: ");
1289 errorStream.add(ieHeader.ieType);
1290 errorStream.endOfLine();
1291 buffer.skipBytes(ieHeader.length);
1292 }
1293 break;
1294 }
1295
1296 case PresenceReportingAreaActionIeType:
1297 {
1298 PresenceReportingAreaActionIe ieObject =
1299 dynamic_cast<
1300 PresenceReportingAreaActionIe&>(GtpV2IeFactory::getInstance().getIeObject(PresenceReportingAreaActionIeType));
1301
1302 if(ieHeader.instance == 0)
1303 {
1304 rc = ieObject.decodePresenceReportingAreaActionIe(buffer, data.presenceReportingAreaAction, ieHeader.length);
1305
1306 data.presenceReportingAreaActionIePresent = true;
1307 if (!(rc))
1308 {
1309 errorStream.add((char *)"Failed to decode IE: presenceReportingAreaAction\n");
1310 return false;
1311 }
1312 }
1313
1314 else
1315 {
1316 // Unknown IE instance print error
1317 errorStream.add((char *)"Unknown IE Type: ");
1318 errorStream.add(ieHeader.ieType);
1319 errorStream.endOfLine();
1320 buffer.skipBytes(ieHeader.length);
1321 }
1322 break;
1323 }
1324
1325 case LoadControlInformationIeType:
1326 {
1327 LoadControlInformationIe ieObject =
1328 dynamic_cast<
1329 LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType));
1330
1331 if(ieHeader.instance == 0)
1332 {
1333 PgwsNodeLevelLoadControlInformationInModifyBearerResponse groupedIeInstance =
1334 dynamic_cast<
1335 PgwsNodeLevelLoadControlInformationInModifyBearerResponse&>(ieObject.getGroupedIe(msgType, 0));
1336 rc = groupedIeInstance.decodePgwsNodeLevelLoadControlInformationInModifyBearerResponse(buffer, data.pgwsNodeLevelLoadControlInformation, ieHeader.length);
1337
1338 data.pgwsNodeLevelLoadControlInformationIePresent = true;
1339 if (!(rc))
1340 {
1341 errorStream.add((char *)"Failed to decode IE: pgwsNodeLevelLoadControlInformation\n");
1342 return false;
1343 }
1344 }
1345 else if(ieHeader.instance == 1)
1346 {
1347 PgwsApnLevelLoadControlInformationInModifyBearerResponse groupedIeInstance =
1348 dynamic_cast<
1349 PgwsApnLevelLoadControlInformationInModifyBearerResponse&>(ieObject.getGroupedIe(msgType, 1));
1350 rc = groupedIeInstance.decodePgwsApnLevelLoadControlInformationInModifyBearerResponse(buffer, data.pgwsApnLevelLoadControlInformation, ieHeader.length);
1351
1352 data.pgwsApnLevelLoadControlInformationIePresent = true;
1353 if (!(rc))
1354 {
1355 errorStream.add((char *)"Failed to decode IE: pgwsApnLevelLoadControlInformation\n");
1356 return false;
1357 }
1358 }
1359 else if(ieHeader.instance == 2)
1360 {
1361 SgwsNodeLevelLoadControlInformationInModifyBearerResponse groupedIeInstance =
1362 dynamic_cast<
1363 SgwsNodeLevelLoadControlInformationInModifyBearerResponse&>(ieObject.getGroupedIe(msgType, 2));
1364 rc = groupedIeInstance.decodeSgwsNodeLevelLoadControlInformationInModifyBearerResponse(buffer, data.sgwsNodeLevelLoadControlInformation, ieHeader.length);
1365
1366 data.sgwsNodeLevelLoadControlInformationIePresent = true;
1367 if (!(rc))
1368 {
1369 errorStream.add((char *)"Failed to decode IE: sgwsNodeLevelLoadControlInformation\n");
1370 return false;
1371 }
1372 }
1373
1374 else
1375 {
1376 // Unknown IE instance print error
1377 errorStream.add((char *)"Unknown IE Type: ");
1378 errorStream.add(ieHeader.ieType);
1379 errorStream.endOfLine();
1380 buffer.skipBytes(ieHeader.length);
1381 }
1382 break;
1383 }
1384
1385 case OverloadControlInformationIeType:
1386 {
1387 OverloadControlInformationIe ieObject =
1388 dynamic_cast<
1389 OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType));
1390
1391 if(ieHeader.instance == 0)
1392 {
1393 PgwsOverloadControlInformationInModifyBearerResponse groupedIeInstance =
1394 dynamic_cast<
1395 PgwsOverloadControlInformationInModifyBearerResponse&>(ieObject.getGroupedIe(msgType, 0));
1396 rc = groupedIeInstance.decodePgwsOverloadControlInformationInModifyBearerResponse(buffer, data.pgwsOverloadControlInformation, ieHeader.length);
1397
1398 data.pgwsOverloadControlInformationIePresent = true;
1399 if (!(rc))
1400 {
1401 errorStream.add((char *)"Failed to decode IE: pgwsOverloadControlInformation\n");
1402 return false;
1403 }
1404 }
1405 else if(ieHeader.instance == 1)
1406 {
1407 SgwsOverloadControlInformationInModifyBearerResponse groupedIeInstance =
1408 dynamic_cast<
1409 SgwsOverloadControlInformationInModifyBearerResponse&>(ieObject.getGroupedIe(msgType, 1));
1410 rc = groupedIeInstance.decodeSgwsOverloadControlInformationInModifyBearerResponse(buffer, data.sgwsOverloadControlInformation, ieHeader.length);
1411
1412 data.sgwsOverloadControlInformationIePresent = true;
1413 if (!(rc))
1414 {
1415 errorStream.add((char *)"Failed to decode IE: sgwsOverloadControlInformation\n");
1416 return false;
1417 }
1418 }
1419
1420 else
1421 {
1422 // Unknown IE instance print error
1423 errorStream.add((char *)"Unknown IE Type: ");
1424 errorStream.add(ieHeader.ieType);
1425 errorStream.endOfLine();
1426 buffer.skipBytes(ieHeader.length);
1427 }
1428 break;
1429 }
1430
1431 case ChargingIdIeType:
1432 {
1433 ChargingIdIe ieObject =
1434 dynamic_cast<
1435 ChargingIdIe&>(GtpV2IeFactory::getInstance().getIeObject(ChargingIdIeType));
1436
1437 if(ieHeader.instance == 0)
1438 {
1439 rc = ieObject.decodeChargingIdIe(buffer, data.pdnConnectionChargingId, ieHeader.length);
1440
1441 data.pdnConnectionChargingIdIePresent = true;
1442 if (!(rc))
1443 {
1444 errorStream.add((char *)"Failed to decode IE: pdnConnectionChargingId\n");
1445 return false;
1446 }
1447 }
1448
1449 else
1450 {
1451 // Unknown IE instance print error
1452 errorStream.add((char *)"Unknown IE Type: ");
1453 errorStream.add(ieHeader.ieType);
1454 errorStream.endOfLine();
1455 buffer.skipBytes(ieHeader.length);
1456 }
1457 break;
1458 }
1459
1460 case MsisdnIeType:
1461 {
1462 MsisdnIe ieObject =
1463 dynamic_cast<
1464 MsisdnIe&>(GtpV2IeFactory::getInstance().getIeObject(MsisdnIeType));
1465
1466 if(ieHeader.instance == 0)
1467 {
1468 rc = ieObject.decodeMsisdnIe(buffer, data.msisdn, ieHeader.length);
1469
1470 data.msisdnIePresent = true;
1471 if (!(rc))
1472 {
1473 errorStream.add((char *)"Failed to decode IE: msisdn\n");
1474 return false;
1475 }
1476 }
1477
1478 else
1479 {
1480 // Unknown IE instance print error
1481 errorStream.add((char *)"Unknown IE Type: ");
1482 errorStream.add(ieHeader.ieType);
1483 errorStream.endOfLine();
1484 buffer.skipBytes(ieHeader.length);
1485 }
1486 break;
1487 }
1488
1489 default:
1490 {
1491 // Unknown IE print error
1492 errorStream.add((char *)"Unknown IE Type: ");
1493 errorStream.add(ieHeader.ieType);
1494 errorStream.endOfLine();
1495 buffer.skipBytes(ieHeader.length);
1496 }
1497 }
1498 }
1499 return rc; // TODO validations
1500}
1501
1502void ModifyBearerResponseMsg::
1503displayModifyBearerResponseMsgData_v(ModifyBearerResponseMsgData const &data, Debug &stream)
1504{
1505 stream.incrIndent();
1506 stream.add((char *)"ModifyBearerResponseMsg:");
1507 stream.endOfLine();
1508 stream.incrIndent();
1509
1510
1511 if (data.linkedEpsBearerIdIePresent)
1512 {
1513
1514
1515 stream.add((char *)"IE - linkedEpsBearerId:");
1516 stream.endOfLine();
1517 EbiIe ebi=
1518 dynamic_cast<
1519 EbiIe&>(GtpV2IeFactory::getInstance().getIeObject(EbiIeType));
1520 ebi.displayEbiIe_v(data.linkedEpsBearerId, stream);
1521
1522 }
1523
1524 Uint8 displayCount;
1525
1526 displayCount = data.bearerContextsModifiedCount;
1527 if (displayCount > 11)
1528 {
1529 stream.add((char *)"Invalid data more than 11 instances");
1530 stream.endOfLine();
1531 stream.add((char *)"Displaying only 11");
1532 stream.endOfLine();
1533 displayCount = 11;
1534 }
1535 for (Uint8 i = 0; i < displayCount; i++)
1536 {
1537 stream.add((char *)"IE - bearerContextsModified:");
1538 stream.endOfLine();
1539 BearerContextIe bearerContext=
1540 dynamic_cast<
1541 BearerContextIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerContextIeType));
1542 BearerContextsModifiedInModifyBearerResponse groupedIeInstance =
1543 dynamic_cast<
1544 BearerContextsModifiedInModifyBearerResponse&>(bearerContext.getGroupedIe(msgType, 0));
1545 groupedIeInstance.displayBearerContextsModifiedInModifyBearerResponseData_v(data.bearerContextsModified[i], stream);
1546 }
1547
1548
1549
1550
1551 displayCount = data.bearerContextsMarkedForRemovalCount;
1552 if (displayCount > 11)
1553 {
1554 stream.add((char *)"Invalid data more than 11 instances");
1555 stream.endOfLine();
1556 stream.add((char *)"Displaying only 11");
1557 stream.endOfLine();
1558 displayCount = 11;
1559 }
1560 for (Uint8 i = 0; i < displayCount; i++)
1561 {
1562 stream.add((char *)"IE - bearerContextsMarkedForRemoval:");
1563 stream.endOfLine();
1564 BearerContextIe bearerContext=
1565 dynamic_cast<
1566 BearerContextIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerContextIeType));
1567 BearerContextsMarkedForRemovalInModifyBearerResponse groupedIeInstance =
1568 dynamic_cast<
1569 BearerContextsMarkedForRemovalInModifyBearerResponse&>(bearerContext.getGroupedIe(msgType, 1));
1570 groupedIeInstance.displayBearerContextsMarkedForRemovalInModifyBearerResponseData_v(data.bearerContextsMarkedForRemoval[i], stream);
1571 }
1572
1573
1574
1575
1576 if (data.indicationFlagsIePresent)
1577 {
1578
1579
1580 stream.add((char *)"IE - indicationFlags:");
1581 stream.endOfLine();
1582 IndicationIe indication=
1583 dynamic_cast<
1584 IndicationIe&>(GtpV2IeFactory::getInstance().getIeObject(IndicationIeType));
1585 indication.displayIndicationIe_v(data.indicationFlags, stream);
1586
1587 }
1588 stream.add((char *)"IE - cause:");
1589 stream.endOfLine();
1590 CauseIe cause=
1591 dynamic_cast<
1592 CauseIe&>(GtpV2IeFactory::getInstance().getIeObject(CauseIeType));
1593 cause.displayCauseIe_v(data.cause, stream);
1594
1595 if (data.apnRestrictionIePresent)
1596 {
1597
1598
1599 stream.add((char *)"IE - apnRestriction:");
1600 stream.endOfLine();
1601 ApnRestrictionIe apnRestriction=
1602 dynamic_cast<
1603 ApnRestrictionIe&>(GtpV2IeFactory::getInstance().getIeObject(ApnRestrictionIeType));
1604 apnRestriction.displayApnRestrictionIe_v(data.apnRestriction, stream);
1605
1606 }
1607 if (data.protocolConfigurationOptionsIePresent)
1608 {
1609
1610
1611 stream.add((char *)"IE - protocolConfigurationOptions:");
1612 stream.endOfLine();
1613 PcoIe pco=
1614 dynamic_cast<
1615 PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType));
1616 pco.displayPcoIe_v(data.protocolConfigurationOptions, stream);
1617
1618 }
1619 if (data.changeReportingActionIePresent)
1620 {
1621
1622
1623 stream.add((char *)"IE - changeReportingAction:");
1624 stream.endOfLine();
1625 ChangeReportingActionIe changeReportingAction=
1626 dynamic_cast<
1627 ChangeReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(ChangeReportingActionIeType));
1628 changeReportingAction.displayChangeReportingActionIe_v(data.changeReportingAction, stream);
1629
1630 }
1631 if (data.csgInformationReportingActionIePresent)
1632 {
1633
1634
1635 stream.add((char *)"IE - csgInformationReportingAction:");
1636 stream.endOfLine();
1637 CsgInformationReportingActionIe csgInformationReportingAction=
1638 dynamic_cast<
1639 CsgInformationReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(CsgInformationReportingActionIeType));
1640 csgInformationReportingAction.displayCsgInformationReportingActionIe_v(data.csgInformationReportingAction, stream);
1641
1642 }
1643 if (data.hNbInformationReportingIePresent)
1644 {
1645
1646
1647 stream.add((char *)"IE - hNbInformationReporting:");
1648 stream.endOfLine();
1649 HenbInformationReportingIe henbInformationReporting=
1650 dynamic_cast<
1651 HenbInformationReportingIe&>(GtpV2IeFactory::getInstance().getIeObject(HenbInformationReportingIeType));
1652 henbInformationReporting.displayHenbInformationReportingIe_v(data.hNbInformationReporting, stream);
1653
1654 }
1655 if (data.chargingGatewayNameIePresent)
1656 {
1657
1658
1659 stream.add((char *)"IE - chargingGatewayName:");
1660 stream.endOfLine();
1661 FqdnIe fqdn=
1662 dynamic_cast<
1663 FqdnIe&>(GtpV2IeFactory::getInstance().getIeObject(FqdnIeType));
1664 fqdn.displayFqdnIe_v(data.chargingGatewayName, stream);
1665
1666 }
1667 if (data.chargingGatewayAddressIePresent)
1668 {
1669
1670
1671 stream.add((char *)"IE - chargingGatewayAddress:");
1672 stream.endOfLine();
1673 IpAddressIe ipAddress=
1674 dynamic_cast<
1675 IpAddressIe&>(GtpV2IeFactory::getInstance().getIeObject(IpAddressIeType));
1676 ipAddress.displayIpAddressIe_v(data.chargingGatewayAddress, stream);
1677
1678 }
1679 if (data.pgwFqCsidIePresent)
1680 {
1681
1682
1683 stream.add((char *)"IE - pgwFqCsid:");
1684 stream.endOfLine();
1685 FqCsidIe fqCsid=
1686 dynamic_cast<
1687 FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType));
1688 fqCsid.displayFqCsidIe_v(data.pgwFqCsid, stream);
1689
1690 }
1691 if (data.sgwFqCsidIePresent)
1692 {
1693
1694
1695 stream.add((char *)"IE - sgwFqCsid:");
1696 stream.endOfLine();
1697 FqCsidIe fqCsid=
1698 dynamic_cast<
1699 FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType));
1700 fqCsid.displayFqCsidIe_v(data.sgwFqCsid, stream);
1701
1702 }
1703 if (data.recoveryIePresent)
1704 {
1705
1706
1707 stream.add((char *)"IE - recovery:");
1708 stream.endOfLine();
1709 RecoveryIe recovery=
1710 dynamic_cast<
1711 RecoveryIe&>(GtpV2IeFactory::getInstance().getIeObject(RecoveryIeType));
1712 recovery.displayRecoveryIe_v(data.recovery, stream);
1713
1714 }
1715 if (data.sgwLdnIePresent)
1716 {
1717
1718
1719 stream.add((char *)"IE - sgwLdn:");
1720 stream.endOfLine();
1721 LocalDistinguishedNameIe localDistinguishedName=
1722 dynamic_cast<
1723 LocalDistinguishedNameIe&>(GtpV2IeFactory::getInstance().getIeObject(LocalDistinguishedNameIeType));
1724 localDistinguishedName.displayLocalDistinguishedNameIe_v(data.sgwLdn, stream);
1725
1726 }
1727 if (data.pgwLdnIePresent)
1728 {
1729
1730
1731 stream.add((char *)"IE - pgwLdn:");
1732 stream.endOfLine();
1733 LocalDistinguishedNameIe localDistinguishedName=
1734 dynamic_cast<
1735 LocalDistinguishedNameIe&>(GtpV2IeFactory::getInstance().getIeObject(LocalDistinguishedNameIeType));
1736 localDistinguishedName.displayLocalDistinguishedNameIe_v(data.pgwLdn, stream);
1737
1738 }
1739 if (data.presenceReportingAreaActionIePresent)
1740 {
1741
1742
1743 stream.add((char *)"IE - presenceReportingAreaAction:");
1744 stream.endOfLine();
1745 PresenceReportingAreaActionIe presenceReportingAreaAction=
1746 dynamic_cast<
1747 PresenceReportingAreaActionIe&>(GtpV2IeFactory::getInstance().getIeObject(PresenceReportingAreaActionIeType));
1748 presenceReportingAreaAction.displayPresenceReportingAreaActionIe_v(data.presenceReportingAreaAction, stream);
1749
1750 }
1751 if (data.pgwsNodeLevelLoadControlInformationIePresent)
1752 {
1753
1754
1755 stream.add((char *)"IE - pgwsNodeLevelLoadControlInformation:");
1756 stream.endOfLine();
1757 LoadControlInformationIe loadControlInformation=
1758 dynamic_cast<
1759 LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType));
1760 PgwsNodeLevelLoadControlInformationInModifyBearerResponse groupedIeInstance =
1761 dynamic_cast<
1762 PgwsNodeLevelLoadControlInformationInModifyBearerResponse&>(loadControlInformation.getGroupedIe(msgType, 0));
1763 groupedIeInstance.displayPgwsNodeLevelLoadControlInformationInModifyBearerResponseData_v(data.pgwsNodeLevelLoadControlInformation, stream);
1764
1765 }
1766 if (data.pgwsApnLevelLoadControlInformationIePresent)
1767 {
1768
1769
1770 stream.add((char *)"IE - pgwsApnLevelLoadControlInformation:");
1771 stream.endOfLine();
1772 LoadControlInformationIe loadControlInformation=
1773 dynamic_cast<
1774 LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType));
1775 PgwsApnLevelLoadControlInformationInModifyBearerResponse groupedIeInstance =
1776 dynamic_cast<
1777 PgwsApnLevelLoadControlInformationInModifyBearerResponse&>(loadControlInformation.getGroupedIe(msgType, 1));
1778 groupedIeInstance.displayPgwsApnLevelLoadControlInformationInModifyBearerResponseData_v(data.pgwsApnLevelLoadControlInformation, stream);
1779
1780 }
1781 if (data.sgwsNodeLevelLoadControlInformationIePresent)
1782 {
1783
1784
1785 stream.add((char *)"IE - sgwsNodeLevelLoadControlInformation:");
1786 stream.endOfLine();
1787 LoadControlInformationIe loadControlInformation=
1788 dynamic_cast<
1789 LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType));
1790 SgwsNodeLevelLoadControlInformationInModifyBearerResponse groupedIeInstance =
1791 dynamic_cast<
1792 SgwsNodeLevelLoadControlInformationInModifyBearerResponse&>(loadControlInformation.getGroupedIe(msgType, 2));
1793 groupedIeInstance.displaySgwsNodeLevelLoadControlInformationInModifyBearerResponseData_v(data.sgwsNodeLevelLoadControlInformation, stream);
1794
1795 }
1796 if (data.pgwsOverloadControlInformationIePresent)
1797 {
1798
1799
1800 stream.add((char *)"IE - pgwsOverloadControlInformation:");
1801 stream.endOfLine();
1802 OverloadControlInformationIe overloadControlInformation=
1803 dynamic_cast<
1804 OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType));
1805 PgwsOverloadControlInformationInModifyBearerResponse groupedIeInstance =
1806 dynamic_cast<
1807 PgwsOverloadControlInformationInModifyBearerResponse&>(overloadControlInformation.getGroupedIe(msgType, 0));
1808 groupedIeInstance.displayPgwsOverloadControlInformationInModifyBearerResponseData_v(data.pgwsOverloadControlInformation, stream);
1809
1810 }
1811 if (data.sgwsOverloadControlInformationIePresent)
1812 {
1813
1814
1815 stream.add((char *)"IE - sgwsOverloadControlInformation:");
1816 stream.endOfLine();
1817 OverloadControlInformationIe overloadControlInformation=
1818 dynamic_cast<
1819 OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType));
1820 SgwsOverloadControlInformationInModifyBearerResponse groupedIeInstance =
1821 dynamic_cast<
1822 SgwsOverloadControlInformationInModifyBearerResponse&>(overloadControlInformation.getGroupedIe(msgType, 1));
1823 groupedIeInstance.displaySgwsOverloadControlInformationInModifyBearerResponseData_v(data.sgwsOverloadControlInformation, stream);
1824
1825 }
1826 if (data.pdnConnectionChargingIdIePresent)
1827 {
1828
1829
1830 stream.add((char *)"IE - pdnConnectionChargingId:");
1831 stream.endOfLine();
1832 ChargingIdIe chargingId=
1833 dynamic_cast<
1834 ChargingIdIe&>(GtpV2IeFactory::getInstance().getIeObject(ChargingIdIeType));
1835 chargingId.displayChargingIdIe_v(data.pdnConnectionChargingId, stream);
1836
1837 }
1838 if (data.msisdnIePresent)
1839 {
1840
1841
1842 stream.add((char *)"IE - msisdn:");
1843 stream.endOfLine();
1844 MsisdnIe msisdn=
1845 dynamic_cast<
1846 MsisdnIe&>(GtpV2IeFactory::getInstance().getIeObject(MsisdnIeType));
1847 msisdn.displayMsisdnIe_v(data.msisdn, stream);
1848
1849 }
1850
1851 stream.decrIndent();
1852 stream.decrIndent();
1853}
1854
1855