summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-07-24 16:04:50 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-07-24 16:04:50 +0200
commitaa7002b2e164e403f49b5e7629ec0a246fa7d850 (patch)
treed73238d3897d69c68b95460b7ff7d65b2370679b
parent15d8883c95b9b2a508e5dc16b36bcff785e14e77 (diff)
pharo: Fix the conversion, more crypto, address handling
-rw-r--r--Makefile3
-rw-r--r--pharo-porting/changes_for_pharo.st31
2 files changed, 32 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index f50e8e1..b5c40a7 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ CONVERT_RULES = -r'Osmo.LogManager->LogManager' \
-r'RecursionLock->Mutex' \
-r'SystemExceptions.EndOfStream->Exception' \
-r'Sockets.DatagramSocket new->Socket newUDP' \
- -r'(``@obj beginsWith: ``@arg2 )->(``@obj startsWith: ``@arg2)' \
+ -r'(``@obj startsWith: ``@arg2 )->(``@obj beginsWith: ``@arg2)' \
# Can not be parsed right now..
# -r'(``@object => ``@args1)->(``@object ==> ``@args1)'
@@ -40,7 +40,6 @@ GRAMMAR = \
CALLAGENT = \
callagent/Base64MimeConverter.st \
- callagent/Extensions.st \
callagent/SIPLogArea.st \
callagent/SIPDialog.st \
callagent/misc/SIPBase64.st \
diff --git a/pharo-porting/changes_for_pharo.st b/pharo-porting/changes_for_pharo.st
index e36fa58..9de32d1 100644
--- a/pharo-porting/changes_for_pharo.st
+++ b/pharo-porting/changes_for_pharo.st
@@ -9,6 +9,11 @@ SIPURandom class extend [
<category: 'random'>
^(RAND rand: 4) asInteger
]
+
+ nextFourBytes [
+ <category: 'random'>
+ ^RAND rand: 4
+ ]
]
SIPUserAgentBase class extend [
@@ -17,6 +22,32 @@ SIPUserAgentBase class extend [
"For pharo just use the random we have"
^(RAND rand: 4) asInteger abs
]
+
+ generateBranch [
+ | data |
+ data := '<1p>,<2p>' expandMacrosWithArguments:
+ {DateTime now asUTC asSeconds.
+ (RAND rand: 2) asInteger}.
+ ^ self branchStart, (SIPBase64 encode: data).
+ ]
+]
+
+SIPUserAgentBase extend [
+ generateVia: aBranch [
+ <category: 'ids'>
+ "For Pharo assume that transport address is a string"
+ ^ (WriteStream on: String new)
+ nextPutAll: 'SIP/2.0/';
+ nextPutAll: transport type;
+ nextPutAll: ' ';
+ nextPutAll: transport address;
+ nextPutAll: ':';
+ nextPutAll: transport port asString;
+ nextPutAll: ';branch=';
+ nextPutAll: aBranch;
+ nextPutAll: ';rport';
+ contents.
+ ]
]
SIPQuotedStringParser extend [