forked from RestComm/jain-slee.diameter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request RestComm#13 from gfigiel/Issue#12-SessionIDonceonly
Guarantee only 1 occurrence of Session-Id will be present at message when adding it. Fixes RestComm#12
- Loading branch information
Showing
1 changed file
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ | |
* | ||
* @author <a href="mailto:[email protected]"> Bartosz Baranowski </a> | ||
* @author <a href="mailto:[email protected]"> Alexandre Mendonca </a> | ||
* @author <a href="mailto:[email protected]"> Grzegorz Figiel (ProIDS sp. z o.o.)</a> | ||
*/ | ||
public class AvpUtilities { | ||
|
||
|
@@ -224,6 +225,8 @@ public static void setAvpAsString(Object parent, int avpCode, long vendorId, boo | |
|
||
switch(avpCode) { | ||
case Avp.SESSION_ID: | ||
//(...) All messages pertaining to a specific session MUST include only one Session-Id AVP (...) | ||
set.removeAvp(avpCode); | ||
// (...) the Session-Id SHOULD appear immediately following the Diameter Header | ||
set.insertAvp(0, avpCode, value, vendorId, isMandatory, isProtected, isOctetString); | ||
break; | ||
|
@@ -476,6 +479,8 @@ public static void setAvpAsUTF8String(Object parent, int avpCode, long vendorId, | |
|
||
switch(avpCode) { | ||
case Avp.SESSION_ID: | ||
//(...) All messages pertaining to a specific session MUST include only one Session-Id AVP (...) | ||
set.removeAvp(avpCode); | ||
// (...) the Session-Id SHOULD appear immediately following the Diameter Header | ||
set.insertAvp(0, avpCode, value, vendorId, isMandatory, isProtected, false); | ||
break; | ||
|
@@ -1601,6 +1606,8 @@ public static void setAvpAsRaw(Object parent, int avpCode, long vendorId, AvpSet | |
|
||
switch(avpCode) { | ||
case Avp.SESSION_ID: | ||
//(...) All messages pertaining to a specific session MUST include only one Session-Id AVP (...) | ||
set.removeAvp(avpCode); | ||
// (...) the Session-Id SHOULD appear immediately following the Diameter Header | ||
set.insertAvp(0, avpCode, value, vendorId, isMandatory, isProtected); | ||
break; | ||
|
@@ -2216,9 +2223,11 @@ private static void addAvpInternal(DiameterAvp avp, AvpSet set) { | |
} | ||
else { | ||
switch (avpCode) { | ||
case Avp.SESSION_ID: | ||
// (...) the Session-Id SHOULD appear immediately following the Diameter Header | ||
set.insertAvp(0, avpCode, avp.byteArrayValue(), avp.getVendorId(), avp.getMandatoryRule() != DiameterAvp.FLAG_RULE_MUSTNOT, avp.getProtectedRule() == DiameterAvp.FLAG_RULE_MUST); | ||
case Avp.SESSION_ID: | ||
//(...) All messages pertaining to a specific session MUST include only one Session-Id AVP (...) | ||
set.removeAvp(avpCode); | ||
// (...) the Session-Id SHOULD appear immediately following the Diameter Header | ||
set.insertAvp(0, avpCode, avp.byteArrayValue(), avp.getVendorId(), avp.getMandatoryRule() != DiameterAvp.FLAG_RULE_MUSTNOT, avp.getProtectedRule() == DiameterAvp.FLAG_RULE_MUST); | ||
break; | ||
case Avp.ORIGIN_HOST: | ||
case Avp.ORIGIN_REALM: | ||
|