MSC: Handle incoming SCCP Connections from a BSC.
This commit is contained in:
parent
504eade7cf
commit
812a7ab6c8
|
@ -18,8 +18,25 @@
|
||||||
|
|
||||||
PackageLoader fileInPackage: 'OsmoNetwork'.
|
PackageLoader fileInPackage: 'OsmoNetwork'.
|
||||||
|
|
||||||
|
OsmoGSM.SCCPHandler subclass: BSCSCCPHandler [
|
||||||
|
| bsc |
|
||||||
|
<comment: 'I handle SCCP for the MSC/BSC connection'>
|
||||||
|
|
||||||
|
BSCSCCPHandler class >> initWith: aBSC [
|
||||||
|
^ self new
|
||||||
|
instVarNamed: #bsc put: aBSC; yourself
|
||||||
|
]
|
||||||
|
|
||||||
|
newConnection: aConnection [
|
||||||
|
self logNotice: 'New incoming SCCP connection %1 on the BSC %2'
|
||||||
|
% {aConnection srcRef. bsc lac} area: #bsc.
|
||||||
|
|
||||||
|
aConnection release.
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
Object subclass: BSCIPAConnection [
|
Object subclass: BSCIPAConnection [
|
||||||
| socket config demuxer writeQueue muxer dispatcher |
|
| socket config demuxer writeQueue muxer dispatcher sccp tx |
|
||||||
<comment: 'I represent one Connection to a BSC and use the IPA
|
<comment: 'I represent one Connection to a BSC and use the IPA
|
||||||
protocol to exchange messages. I will be executed from within
|
protocol to exchange messages. I will be executed from within
|
||||||
a thread and can do a blocking read from in here.'>
|
a thread and can do a blocking read from in here.'>
|
||||||
|
@ -31,6 +48,15 @@ Object subclass: BSCIPAConnection [
|
||||||
yourself
|
yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
|
BSCIPAConnection class >> terminate: aProc [
|
||||||
|
"Make sure it is dead!"
|
||||||
|
aProc ifNil: [^true].
|
||||||
|
|
||||||
|
[aProc isTerminated] whileFalse: [aProc terminate].
|
||||||
|
]
|
||||||
|
|
||||||
|
lac [ ^ config lac ]
|
||||||
|
|
||||||
socket: aSocket [
|
socket: aSocket [
|
||||||
socket := aSocket.
|
socket := aSocket.
|
||||||
writeQueue := SharedQueue new.
|
writeQueue := SharedQueue new.
|
||||||
|
@ -40,16 +66,47 @@ Object subclass: BSCIPAConnection [
|
||||||
|
|
||||||
dispatcher := Osmo.IPADispatcher new.
|
dispatcher := Osmo.IPADispatcher new.
|
||||||
dispatcher initialize.
|
dispatcher initialize.
|
||||||
|
|
||||||
|
sccp := BSCSCCPHandler initWith: self.
|
||||||
|
sccp registerOn: dispatcher.
|
||||||
|
sccp connection: self.
|
||||||
|
|
||||||
|
"Drain the send queue in a new process"
|
||||||
|
tx := [
|
||||||
|
[[
|
||||||
|
| msg |
|
||||||
|
msg := writeQueue next.
|
||||||
|
socket nextPutAllFlush: msg.
|
||||||
|
] repeat.
|
||||||
|
] ensure: [
|
||||||
|
self logNotice: 'BSC TX queue lac: %1 finished' % {self lac} area: #bsc]
|
||||||
|
] fork.
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
send: aMsg with: aType [
|
||||||
|
muxer nextPut: aMsg with: aType.
|
||||||
]
|
]
|
||||||
|
|
||||||
process [
|
process [
|
||||||
"Drive the BSC process. This will send/queue messages"
|
"Drive the BSC process. This will send/queue messages"
|
||||||
socket logNotice: 'closing down' area: #bsc.
|
|
||||||
|
socket logNotice: 'Processing for lac %1' % {self lac} area: #bsc.
|
||||||
|
|
||||||
|
[
|
||||||
|
| msg |
|
||||||
|
msg := demuxer next.
|
||||||
|
dispatcher dispatch: msg first with: msg second.
|
||||||
|
] repeat.
|
||||||
|
|
||||||
|
|
||||||
socket close.
|
socket close.
|
||||||
]
|
]
|
||||||
|
|
||||||
terminateAll [
|
terminateAll [
|
||||||
"Bring down everything that happens for this BSC. This is a reset"
|
"Bring down everything that happens for this BSC. This is a reset"
|
||||||
self logNotice: 'BSC lac: %1 terminating.' % {config lac} area: #bsc.
|
self logNotice: 'BSC lac: %1 terminating.' % {self lac} area: #bsc.
|
||||||
|
|
||||||
|
self class terminate: tx.
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
1
MSC.st
1
MSC.st
|
@ -67,6 +67,7 @@ Object subclass: MSCBSCConnectionHandler [
|
||||||
] on: Exception do: [:ex |
|
] on: Exception do: [:ex |
|
||||||
self logError: 'Unexpected exception for lac: %1' % {aConfig lac}
|
self logError: 'Unexpected exception for lac: %1' % {aConfig lac}
|
||||||
area: #bsc.
|
area: #bsc.
|
||||||
|
thisContext backtraceOn: Transcript.
|
||||||
]] ensure: [
|
]] ensure: [
|
||||||
self logNotice: 'BSC being disconnected for lac: %1' % {aConfig lac}
|
self logNotice: 'BSC being disconnected for lac: %1' % {aConfig lac}
|
||||||
area: #bsc.
|
area: #bsc.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<namespace>OsmoMSC</namespace>
|
<namespace>OsmoMSC</namespace>
|
||||||
<prereq>OsmoLogging</prereq>
|
<prereq>OsmoLogging</prereq>
|
||||||
<prereq>OsmoNetwork</prereq>
|
<prereq>OsmoNetwork</prereq>
|
||||||
|
<prereq>OsmoGSM</prereq>
|
||||||
|
|
||||||
<filein>Logging.st</filein>
|
<filein>Logging.st</filein>
|
||||||
<filein>VLR.st</filein>
|
<filein>VLR.st</filein>
|
||||||
|
|
Reference in New Issue