52 lines
996 B
Smalltalk
52 lines
996 B
Smalltalk
PackageLoader fileInPackage: 'OsmoNetwork'.
|
|
|
|
Object subclass: SCCPConnection [
|
|
| src dst |
|
|
|
|
srcRef [
|
|
^ src
|
|
]
|
|
srcRef: aRef [
|
|
src := aRef
|
|
]
|
|
|
|
dstRef: aRef [
|
|
dst := aRef
|
|
]
|
|
]
|
|
|
|
Object subclass: SCCPHadler [
|
|
| connections last_ref |
|
|
<comment: 'I handle SCCP messages'>
|
|
|
|
registerOn: aDispatcher [
|
|
aDispatcher addHandler: Osmo.IPAConstants protocolSCCP
|
|
on: self with: #handleMsg:.
|
|
]
|
|
|
|
handleMsg: aMsg [
|
|
'Got a new SCCP message' printNl.
|
|
]
|
|
|
|
createConnection: aData [
|
|
| con res|
|
|
|
|
con := SCCPConnection new.
|
|
con srcRef: self assignSrcRef.
|
|
res := Osmo.SCCPConnectionRequest
|
|
initWith: (con srcRef) dest: (Osmo.SCCPAddress createWith: 254) data: aData.
|
|
self connections add: res.
|
|
|
|
^ res
|
|
]
|
|
|
|
assignSrcRef [
|
|
^ 666
|
|
]
|
|
|
|
connections [
|
|
^ connections ifNil: [ connections := OrderedCollection new. ]
|
|
]
|
|
]
|
|
|