diff --git a/package.xml b/package.xml index 19a7efb..559df90 100644 --- a/package.xml +++ b/package.xml @@ -11,7 +11,6 @@ src/BSCConfig.st src/BSCListener.st src/BSCSCCPHandler.st - src/GSMAuthenticator.st src/GSMProcessor.st src/GSMCMServiceRequest.st src/GSMLURequest.st @@ -22,6 +21,9 @@ src/call/Extensions.st src/call/GSMMOCall.st src/call/SIPMTCall.st + src/auth/GSMAuthenticatorBase.st + src/auth/GSMNullAuthenticator.st + src/auth/GSMIdentityAuthenticator.st OsmoMSC.HLRTest diff --git a/src/auth/GSMAuthenticatorBase.st b/src/auth/GSMAuthenticatorBase.st new file mode 100644 index 0000000..350fefd --- /dev/null +++ b/src/auth/GSMAuthenticatorBase.st @@ -0,0 +1,86 @@ +" + (C) 2010-2012 by Holger Hans Peter Freyther + All Rights Reserved + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +" + +Object subclass: GSMAuthenticatorBase [ + | connection onAccept onReject | + + >#takeLocks: selector to take the required locks.'> + + + LegalMessages := {OsmoGSM.GSM48CMServiceReq. + OsmoGSM.GSM48RRPagingResponse. + OsmoGSM.GSM48LURequest. + "As part of Local-Call-Routing deal with CC Setup" + OsmoGSM.GSM48CCSetup. + }. + + appropriateInitialMessage: aMsg [ + "Check if the message is one of the allowed initial messages." + ^ LegalMessages includes: aMsg class + ] + + connection: aCon [ + + connection := aCon. + ] + + connection [ + + ^ connection + ] + + onAccept: aBlock [ + + "Called when the connection is accepted" + onAccept := aBlock + ] + + onReject: aBlock [ + + "Called when the connection is rejected" + onReject := aBlock + ] + + start: aMsg [ + + "Start authentication with the initial message." + ^ self subclassResponsibility + ] + + onData: aMsg [ + + "Called with data from the GSM connection" + ^ self subclassResponsibility + ] + + cancel [ + + "The GSM Connection has failed cancel everything." + ^ self subclassResponsibility + ] + + nextPut: aMsg [ + connection nextPutData: (BSSAPDTAP initWith: aMsg + linkIdentifier: 0). + ] +] diff --git a/src/GSMAuthenticator.st b/src/auth/GSMIdentityAuthenticator.st similarity index 53% rename from src/GSMAuthenticator.st rename to src/auth/GSMIdentityAuthenticator.st index 4a3bcc9..217a488 100644 --- a/src/GSMAuthenticator.st +++ b/src/auth/GSMIdentityAuthenticator.st @@ -16,97 +16,10 @@ along with this program. If not, see . " -Object subclass: GSMAuthenticatorBase [ - | connection onAccept onReject | - - >#takeLocks: selector to take the required locks.'> - - - LegalMessages := {OsmoGSM.GSM48CMServiceReq. - OsmoGSM.GSM48RRPagingResponse. - OsmoGSM.GSM48LURequest. - "As part of Local-Call-Routing deal with CC Setup" - OsmoGSM.GSM48CCSetup. - }. - - appropriateInitialMessage: aMsg [ - "Check if the message is one of the allowed initial messages." - ^ LegalMessages includes: aMsg class - ] - - connection: aCon [ - - connection := aCon. - ] - - connection [ - - ^ connection - ] - - onAccept: aBlock [ - - "Called when the connection is accepted" - onAccept := aBlock - ] - - onReject: aBlock [ - - "Called when the connection is rejected" - onReject := aBlock - ] - - start: aMsg [ - - "Start authentication with the initial message." - ^ self subclassResponsibility - ] - - onData: aMsg [ - - "Called with data from the GSM connection" - ^ self subclassResponsibility - ] - - cancel [ - - "The GSM Connection has failed cancel everything." - ^ self subclassResponsibility - ] - - nextPut: aMsg [ - connection nextPutData: (BSSAPDTAP initWith: aMsg - linkIdentifier: 0). - ] -] - -GSMAuthenticatorBase subclass: GSMNullAuthenticator [ - - - - start: aMsg [ - (self appropriateInitialMessage: aMsg) - ifTrue: [onAccept value: self] - ifFalse: [onReject value: self]. - ] - - onData: aMsg [ - ^ self shouldNotImplement - ] - - cancel [ - "Nothing" - ] -] GSMAuthenticatorBase subclass: GSMIdentityAuthenticator [ | state timeout | - + diff --git a/src/auth/GSMNullAuthenticator.st b/src/auth/GSMNullAuthenticator.st new file mode 100644 index 0000000..65b003c --- /dev/null +++ b/src/auth/GSMNullAuthenticator.st @@ -0,0 +1,37 @@ +" + (C) 2010-2012 by Holger Hans Peter Freyther + All Rights Reserved + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +" + +GSMAuthenticatorBase subclass: GSMNullAuthenticator [ + + + + start: aMsg [ + (self appropriateInitialMessage: aMsg) + ifTrue: [onAccept value: self] + ifFalse: [onReject value: self]. + ] + + onData: aMsg [ + ^ self shouldNotImplement + ] + + cancel [ + "Nothing" + ] +] +