diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-07-24 11:51:42 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-07-24 11:51:42 +0200 |
commit | 2df9f74284a15bb1dec83af07c39359a7ee94aa9 (patch) | |
tree | 753d7b8460fb0f0ad010aa636ad5b08404149181 | |
parent | 1e249c5e0e475e01a2ecbc1e46f4497fa92c2e7a (diff) |
pharo: Continue with portability changes for pharo
* There is no RecursionLock but Mutex
* MD5 behaves differently on Pharo
* UDP sockets are different..
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | pharo-porting/changes_for_pharo.st | 54 | ||||
-rw-r--r-- | pharo-porting/compat_for_pharo.st | 8 |
3 files changed, 66 insertions, 0 deletions
@@ -24,6 +24,10 @@ CONVERT_RULES = -r'Osmo.LogManager->LogManager' \ -r'Sockets.SocketAddress->GSTSocketAddress' \ -r'((Osmo at: \#SIPParser) combineUri: ``@args1)->(SIPParser combineUri: ``@args1)' \ -r'``@object nl->``@object lf' \ + -r'RecursionLock->Mutex' \ + -r'SystemExceptions.EndOfStream->Exception' \ + -r'Sockets.DatagramSocket new->Socket newUDP' \ + -r'(``@obj beginsWith: ``@arg2 )->(``@obj startsWith: ``@arg2)' \ # Can not be parsed right now.. # -r'(``@object => ``@args1)->(``@object ==> ``@args1)' diff --git a/pharo-porting/changes_for_pharo.st b/pharo-porting/changes_for_pharo.st index 9c44fe0..e36fa58 100644 --- a/pharo-porting/changes_for_pharo.st +++ b/pharo-porting/changes_for_pharo.st @@ -103,3 +103,57 @@ Base64LikeConverter class extend [ ^me mimeStream ] ] + +SIPDigest class extend [ + ha1: aName realm: aRealm password: aPassword [ + ^(MD5 hashMessage: (String streamContents: [:str | + str + nextPutAll: aName; + nextPutAll: ':'; + nextPutAll: aRealm; + nextPutAll: ':'; + nextPutAll: aPassword])) hex. + ] + + ha2: anOperation uri: aSipUrlString [ + ^(MD5 hashMessage: (String streamContents: [:str | + str + nextPutAll: anOperation; + nextPutAll: ':'; + nextPutAll: aSipUrlString])) hex. + ] + + authUser: aName password: aPassword realm: aRealm nonce: aNonce operation: anOperation url: aSipUrlString [ + | ha1 ha2 resp md5 | + ha1 := self ha1: aName realm: aRealm password: aPassword. + ha2 := self ha2: anOperation uri: aSipUrlString. + + ^(MD5 hashMessage: (String streamContents: [:str | + str + nextPutAll: ha1; + nextPutAll: ':'; + nextPutAll: aNonce; + nextPutAll: ':'; + nextPutAll: ha2])) hex + ] + + authUser: aName password: aPassword realm: aRealm nonce: aNonce operation: anOperation url: aSipUrlString qop: aQop clientNonce: aCnonce nonceCount: aNc [ + | ha1 ha2 resp md5 | + ha1 := self ha1: aName realm: aRealm password: aPassword. + ha2 := self ha2: anOperation uri: aSipUrlString. + + ^(MD5 hashMessage: (String streamContents: [:str | + str + nextPutAll: ha1; + nextPutAll: ':'; + nextPutAll: aNonce; + nextPutAll: ':'; + nextPutAll: aNc; + nextPutAll: ':'; + nextPutAll: aCnonce; + nextPutAll: ':'; + nextPutAll: aQop; + nextPutAll: ':'; + nextPutAll: ha2])) hex + ] +] diff --git a/pharo-porting/compat_for_pharo.st b/pharo-porting/compat_for_pharo.st index aa82ba8..0bd2b0f 100644 --- a/pharo-porting/compat_for_pharo.st +++ b/pharo-porting/compat_for_pharo.st @@ -5,4 +5,12 @@ Object subclass: GSTSocketAddress [ GSTSocketAddress class >> localHostName [ ^ NetNameResolver localHostName ] + + GSTSocketAddress class >> loopbackHost [ + ^'127.0.0.1' + ] + + GSTSocketAddress class >> byName: aName [ + ^NetNameResolver addressForName: aName + ] ] |