smalltalk
/
osmo-st-sip
Archived
1
0
Fork 0

pharo: Continue with portability changes for pharo

* There is no RecursionLock but Mutex
* MD5 behaves differently on Pharo
* UDP sockets are different..
This commit is contained in:
Holger Hans Peter Freyther 2015-07-24 11:51:42 +02:00
parent 1e249c5e0e
commit 2df9f74284
3 changed files with 66 additions and 0 deletions

View File

@ -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)'

View File

@ -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
]
]

View File

@ -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
]
]