MSC: Handle incoming SCCP Connections from a BSC.
This commit is contained in:
parent
504eade7cf
commit
812a7ab6c8
|
@ -18,8 +18,25 @@
|
|||
|
||||
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 [
|
||||
| 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
|
||||
protocol to exchange messages. I will be executed from within
|
||||
a thread and can do a blocking read from in here.'>
|
||||
|
@ -31,6 +48,15 @@ Object subclass: BSCIPAConnection [
|
|||
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.
|
||||
writeQueue := SharedQueue new.
|
||||
|
@ -40,16 +66,47 @@ Object subclass: BSCIPAConnection [
|
|||
|
||||
dispatcher := Osmo.IPADispatcher new.
|
||||
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 [
|
||||
"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.
|
||||
]
|
||||
|
||||
terminateAll [
|
||||
"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 |
|
||||
self logError: 'Unexpected exception for lac: %1' % {aConfig lac}
|
||||
area: #bsc.
|
||||
thisContext backtraceOn: Transcript.
|
||||
]] ensure: [
|
||||
self logNotice: 'BSC being disconnected for lac: %1' % {aConfig lac}
|
||||
area: #bsc.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<namespace>OsmoMSC</namespace>
|
||||
<prereq>OsmoLogging</prereq>
|
||||
<prereq>OsmoNetwork</prereq>
|
||||
<prereq>OsmoGSM</prereq>
|
||||
|
||||
<filein>Logging.st</filein>
|
||||
<filein>VLR.st</filein>
|
||||
|
|
Reference in New Issue