Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mc/Diameter.package/AVPBaseType.class/instance/avpType.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
avpType
^ avpType
6 changes: 4 additions & 2 deletions mc/Diameter.package/AVPBuilderTrait.trait/properties.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"name" : "AVPBuilderTrait",
"commentStamp" : "",
"category" : "Diameter-AVP-Base"
"classinstvars" : [ ],
"category" : "Diameter-AVP-Base",
"instvars" : [ ],
"name" : "AVPBuilderTrait"
}
Empty file.
5 changes: 5 additions & 0 deletions mc/Diameter.package/AVPCollection.class/class/on.with..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instance creation
on: aPath with: someAVPs
^ self new
initializeOn: aPath with: someAVPs;
yourself
6 changes: 6 additions & 0 deletions mc/Diameter.package/AVPCollection.class/instance/^slash.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
/ aName
^ elements
detect: [ :avp | avp avpData avpType avpName = path ]
ifFound: [ :element | element avpData / aName ]
ifNone: [ nil ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initializeOn: aPath with: someAVPs
path := aPath.
elements := someAVPs
4 changes: 4 additions & 0 deletions mc/Diameter.package/AVPCollection.class/instance/printOn..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
printOn: aStream
super printOn: aStream.
elements printElementsOn: aStream.
4 changes: 4 additions & 0 deletions mc/Diameter.package/AVPCollection.class/instance/size.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
size

^ elements size
4 changes: 4 additions & 0 deletions mc/Diameter.package/AVPCollection.class/instance/value.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
value

^ elements
14 changes: 14 additions & 0 deletions mc/Diameter.package/AVPCollection.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"commentStamp" : "",
"super" : "Object",
"category" : "Diameter-Parser",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"elements",
"path"
],
"name" : "AVPCollection",
"type" : "normal"
}
15 changes: 8 additions & 7 deletions mc/Diameter.package/AVPGrouped.class/class/decodeData.type..st
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
as yet unclassified
decodeData: aByteArray type: aType
decodeData: aByteArray type: aType
| stream parsedAvps |
stream := aByteArray readStream.

parsedAvps := OrderedCollection new.
[ stream atEnd ] whileFalse: [
parsedAvps add: (AVPHeader parseFrom: stream)].
aType avps do: [:type |
type parse: parsedAvps].
^self new
[ stream atEnd ]
whileFalse: [
parsedAvps add: (AVPHeader parseFrom: stream) ].
aType avps do: [ :type | type parse: parsedAvps ].
^ self new
avpType: aType;
contents: parsedAvps;
yourself.
yourself
3 changes: 3 additions & 0 deletions mc/Diameter.package/AVPGrouped.class/instance/^slash.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
/ aName
^ self avpsPath / aName
4 changes: 4 additions & 0 deletions mc/Diameter.package/AVPGrouped.class/instance/avpsPath.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
avpsPath

^ AVPPath on: self avpHeaders
2 changes: 2 additions & 0 deletions mc/Diameter.package/AVPHeader.class/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Attribute-Value-Structure (AVP)

I represent the "4.1. AVP Header" DIAMETER RFC 6733

0 1 2 3
Expand Down
3 changes: 3 additions & 0 deletions mc/Diameter.package/AVPHeader.class/instance/^slash.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
/ aName
^ avpData / aName
12 changes: 5 additions & 7 deletions mc/Diameter.package/AVPHeader.class/instance/parseData..st
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ parseData: aReadStream
| len fixedLength rest |
fixedLength := 8.
len := aReadStream uint24.

avpFlagVendor ifTrue: [
fixedLength := fixedLength + 4.
avpVendorId := aReadStream uint32].

avpFlagVendor
ifTrue: [ fixedLength := fixedLength + 4.
avpVendorId := aReadStream uint32 ].
avpData := aReadStream next: len - fixedLength.

"Deal with padding to have it 32bit aligned.."
rest := len \\ 4.
rest = 0 ifFalse: [
aReadStream next: 4 - rest].
rest = 0
ifFalse: [ aReadStream next: 4 - rest ]
5 changes: 1 addition & 4 deletions mc/Diameter.package/AVPHeader.class/instance/printOn..st
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
printing
printOn: aStream
aStream
nextPutAll: self class name;
nextPutAll: ' ';
nextPutAll: avpCode displayString
aStream nextPutAll: 'AVP(' , avpCode displayString , ')'
4 changes: 4 additions & 0 deletions mc/Diameter.package/AVPHeader.class/instance/value.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
value

^ avpData value
2 changes: 1 addition & 1 deletion mc/Diameter.package/AVPHeader.class/properties.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"commentStamp" : "HolgerHansPeterFreyther 5/19/2018 12:40",
"commentStamp" : "sebastiansastre 12/5/2019 14:59",
"super" : "Object",
"category" : "Diameter-AVP-Base",
"classinstvars" : [ ],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
accessing
authApplicationIdAVPHeader: anInteger

^AVPHeader new
avpCode: 258;
avpFlagMandatory: true;
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions mc/Diameter.package/AVPPath.class/class/on..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
on: someAVPs
^ self on: '.' with: someAVPs
5 changes: 5 additions & 0 deletions mc/Diameter.package/AVPPath.class/class/on.with..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instance creation
on: aName with: someAVPs
^ self new
initializeOn: aName with: someAVPs;
yourself
5 changes: 5 additions & 0 deletions mc/Diameter.package/AVPPath.class/instance/^slash.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
initialization
/ aName
^ AVPCollection
on: aName
with: (roots select: [ :avp | avp avpData avpType avpName = aName ])
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initializeOn: aName with: someAVPs
path := aName.
roots := someAVPs
7 changes: 7 additions & 0 deletions mc/Diameter.package/AVPPath.class/instance/printOn..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
as yet unclassified
printOn: aStream
super printOn: aStream.
aStream
nextPutAll: '(';
nextPutAll: path displayString, ' ', roots asArray displayString;
nextPutAll: ')'
14 changes: 14 additions & 0 deletions mc/Diameter.package/AVPPath.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"commentStamp" : "",
"super" : "Object",
"category" : "Diameter-Parser",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"roots",
"path"
],
"name" : "AVPPath",
"type" : "normal"
}
1 change: 1 addition & 0 deletions mc/Diameter.package/AVPPathTest.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Coverage fot the AVP querying feature
11 changes: 11 additions & 0 deletions mc/Diameter.package/AVPPathTest.class/class/s6aParser.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
accessing
s6aParser
^ OTPDiaParser new
moduleSet:
(Dictionary new
at: 'ietf-avps' put: 'src/diameter/contrib/specs/ietf-avps.dia';
at: '3gpp-avps' put: 'src/diameter/contrib/specs/3gpp-avps.dia';
at: '3gpp2-avps' put: 'src/diameter/contrib/specs/3gpp2-avps.dia';
at: 'etsi-avps' put: 'src/diameter/contrib/specs/etsi-avps.dia';
yourself);
parseModule: 'src/diameter/contrib/specs/S6a.dia' asFileReference contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
updateLocationAnswerSample
^ ByteArray
readHexFrom:
'010001704000013e0100002300476cc6ee07e32f00000107400000456d6d65322e6570632e6d6e633030362e6d63633236302e336770706e6574776f726b2e6f72673b303b313436323434303832363b3237363735313135320000000000010c4000000c000007d1000001154000000c000000010000010840000030686c726873732e6570632e6d6e633834302e6d63633331302e336770706e6574776f726b2e6f726700000128400000296570632e6d6e633834302e6d63633331302e336770706e6574776f726b2e6f726700000000000585c00000a0000028af00000586c0000094000028af0000058bc0000010000028af00000001000005a7c000001c000028afb6ac653f84a0a0cdbdd8059584cb0f30000005a8c0000014000028af2f71dd06cdd8f4c9000005a9c000001c000028af561871ca8668b9b9a61fd592699b1187000005aac000002c000028af7535b3127f09d9b701d437e3fdbccb67ee7e82dcadf00eb2d01999c4681ce10f'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
updateLocationRequestSample
^ ByteArray
readHexFrom:
'01000214c000013e0100002300476cc6ee07e32f00000107400000456d6d65322e6570632e6d6e633030362e6d63633236302e336770706e6574776f726b2e6f72673b303b313436323434303832363b32373637353131353200000000000104400000200000010a4000000c000028af000001024000000c01000023000001084000002e6d6d65322e6570632e6d6e633030362e6d63633236302e336770706e6574776f726b2e6f7267000000000128400000296570632e6d6e633030362e6d63633236302e336770706e6574776f726b2e6f72670000000000012540000030686c726873732e6570632e6d6e633834302e6d63633331302e336770706e6574776f726b2e6f72670000011b400000296570632e6d6e633834302e6d63633331302e336770706e6574776f726b2e6f726700000000000001400000173331303834303830303030323034320000000580c000002c000028af00000582c0000010000028af0000000100000584c0000010000028af000000010000057fc000000f000028af62f06000000001154000000c000000010000011a400000306b61746473722e6570632e6d6e633030362e6d63633236302e336770706e6574776f726b2e6f72670000011a4000001c647261616d733130312e6962617369732e6772780000011a4000001b6472616e6c30312e636f6d666f6e652e636f6d000000011a400000156665702d702d736374705f7568000000'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
tests
testULAnswerQuerying
| message |
message := DiameterMessage
decode: self class updateLocationAnswerSample.
self class s6aParser decode: message.
message decodeAll.
self
assert: (message avpsPath / 'Auth-Session-State') value first value = 1.
self
assert:
(message avpsPath / 'Authentication-Info' / 'E-UTRAN-Vector' / 'AUTN')
value first value
= #[86 24 113 202 134 104 185 185 166 31 213 146 105 155 17 135]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
tests
testULRNestedDecode
| message |
message := DiameterMessage
decode: self class updateLocationRequestSample.
self class s6aParser decode: message.
message decodeAll.
self assert: (message avpsPath / 'Route-Record') size = 4.
self
assert:
(message avpsPath / 'Route-Record') value first value
= 'katdsr.epc.mnc006.mcc260.3gppnetwork.org'.
self
assert: (message avpsPath / 'User-Name') value first value = '310840800002042'.
self
assert:
(message avpsPath / 'Visited-PLMN-Id') value first value
= #[98 240 96]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
tests
testULRequestQuerying
| message |
message := DiameterMessage
decode: self class updateLocationRequestSample.
self class s6aParser decode: message.
message decodeAll.
self assert: (message avpsPath / 'Route-Record') size = 4.
self
assert:
(message avpsPath / 'Route-Record') value first value
= 'katdsr.epc.mnc006.mcc260.3gppnetwork.org'.
self
assert: (message avpsPath / 'User-Name') value first value = '310840800002042'.
self
assert:
(message avpsPath / 'Visited-PLMN-Id') value first value
= #[98 240 96].

self assert: (message avpsPath / 'Requested-EUTRAN-Authentication-Info' / 'Number-Of-Requested-Vectors') value first value = 1
11 changes: 11 additions & 0 deletions mc/Diameter.package/AVPPathTest.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "sebastiansastre 12/11/2019 10:16",
"super" : "TestCase",
"category" : "Diameter-Tests",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "AVPPathTest",
"type" : "normal"
}
1 change: 1 addition & 0 deletions mc/Diameter.package/AVPType.class/instance/newHeader.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
as yet unclassified
newHeader

^AVPHeader new
avpCode: avpCode;
avpFlagProtected: false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
as yet unclassified
applicationId: anInteger
applicationId: anInteger
" Application-ID

Application-ID is four octets and is used to identify for which
application the message is applicable. The application can be an
authentication application, an accounting application, or a
vendor-specific application.

The value of the Application-ID field in the header MUST be the
same as any relevant Application-Id AVPs contained in the message."

applicationId := anInteger
3 changes: 3 additions & 0 deletions mc/Diameter.package/DiameterMessage.class/instance/avps..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
avps: someAVPs
avps := someAVPs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
avpsPath

^ AVPPath on: avps
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
as yet unclassified
commandCode: anInteger
commandCode: anInteger
" Command Code

The Command Code field is three octets and is used in order to
communicate the command associated with the message. The 24-bit
address space is managed by IANA (see Section 3.1). Command Code
values 16,777,214 and 16,777,215 (hexadecimal values FFFFFE-
FFFFFF) are reserved for experimental use (see Section 11.2)."

commandCode := anInteger
21 changes: 19 additions & 2 deletions mc/Diameter.package/DiameterMessage.class/instance/endToEndId..st
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
as yet unclassified
endToEndId: anInteger
endToEndId := anInteger.
endToEndId: anInteger
"End-to-End Identifier

The End-to-End Identifier is an unsigned 32-bit integer field (in
network byte order) that is used to detect duplicate messages.
Upon reboot, implementations MAY set the high order 12 bits to
contain the low order 12 bits of current time, and the low order
20 bits to a random value. Senders of request messages MUST
insert a unique identifier on each message. The identifier MUST
remain locally unique for a period of at least 4 minutes, even
across reboots. The originator of an answer message MUST ensure
that the End-to-End Identifier field contains the same value that
was found in the corresponding request. The End-to-End Identifier
MUST NOT be modified by Diameter agents of any kind. The
combination of the Origin-Host AVP (Section 6.3) and this field is
used to detect duplicates. Duplicate requests SHOULD cause the
same answer to be transmitted (modulo the Hop-by-Hop Identifier"

endToEndId := anInteger
Loading