Opentalk at Large - StS 2005
- 1. Opentalk at Large Martin Kobetic Cincom Smalltalk Development Smalltalk Solutions 2005
- 3. Join the GRID Demo ! Wireless AP SSID: Blitzz DHCP Browse: http://192.168.1.3/pub Dowload: grid.im grid.cha VM otminstaller.exe
- 4. IP Multicasting: Intro IP range: 224.0.0.0-239.255.255.255 API: datagram sockets (UDP) join/drop multicast group loopback: on/off multicast routing, IGMP, ttl
- 5. IP Multicasting: Sender ( SocketAccessor family: SocketAccessor AF_INET type: SocketAccessor SOCK_DGRAM ) bindTo: IPSocketAddress thisHostAnyPort
- 6. IP Multicasting: Sending group := IPSocketAddress hostAddress: #[224 5 6 7] port: 4242. (sender writeWaitWithTimeoutMs: 100) ifFalse: [ sender sendTo: group buffer: ‘Hello’ asByteArray ]
- 7. IP Multicasting: Receiver ( SocketAccessor family: SocketAccessor AF_INET type: SocketAccessor SOCK_DGRAM ) soReuseAddr: true; bindTo: (IPSocketAddress hostAddress: #[0 0 0 0] port: 4242); join: (IPMulticastRequest toAddress: #[224 5 6 7])
- 8. IP Multicasting: Receiving sa := IPSocketAddress new. buf := ByteArray new: 5. (receiver readWaitWithTimeoutMs: 100) ifFalse: [ size := receiver receiveFrom: sa buffer: buf (buffer copyFrom: 1 to: size) asString ]
- 9. Opentalk-Groups: Intro Object Group brokers running on the same port brokers join the same mcast address receivers exported under the same OID group proxy #(mcast-address, port, OID) Remote Group Request STSTOnewayRequest
- 10. Opentalk-Groups: Broker (BrokerConfiguration standard adaptor: (AdaptorConfiguration objectGroups transport: (TransportConfiguration mcast mcastAddresses: #([224 5 6 7]); marshaler: MarshalerConfiguration stst ))) newAtPort: 4242
- 11. Opentalk-Groups: Receiver receivers exported under the same OID broker1 objectAdaptor export: Transcript oid: #group. broker2 objectAdaptor export: Transcript oid: #group. …
- 13. Opentalk-Groups: Sender multiple mcast addresses group := broker groupAt: (IPSocketAddress hostAddress: #[224 5 6 7] port: 4242) id: #group. group show: ‘Hello World!’
- 14. OpenChat: Unicast server: parties, sessions add/remove parties session management (invite/accept/decline…) client: server, parties, session messages (send/receive – via session) session: server, parties message broadcasting party management (joining/leaving session)
- 15. OpenChat: Multicast group #all joining:, alreadyIn:, leaving: startSession: id for: originator with: party on: topic session groups accepting: id / declining: id displayMessage: aString from: id leavingSession: id
- 16. Opentalk-Groups one-way messages Group Refs => multicasted messages ObjRefs => unicasted messages groups tied to the object table constraints (only one export per object) weakness (exported objects may get GCed) packet size / fragmentation (UDP)
- 17. Grid: Intro complex task & distributed resources [email_address] resource discovery resource configuration task distribution result collection
- 18. Grid: Demo code breaking: RC4_40_MD5 brute force but randomly selected ranges ranges searched sequentially looking for a known pattern ‘GET /’
- 19. Grid: Demo Setup http://192.168.1. 3/pub grid.im, grid.cha, VM start the image (chmod u+x VM) launcher menu: Tools / Open Grid Drone set #id inst var inst var menu: Connect If asked for IP => 192.168.1.2:7777
- 20. Grid: Framework Controller task specific maintains the grid configures drones distributes tasks collects results Drones generic looks for controller joins/leaves grid gets configured executes tasks
- 21. Grid: Task [ :range :size :ct | (range to: range + size - 1) detect: [ :i || dt | arc setKey: i asByteArray. dt := arc decrypt: ct. dt “starts with ‘GET /’ ?” ] ifNone: [nil] ]
- 22. Grid: Configuration task: <String> prerequisites: #(('ARC4' '')) imports: 'private Security.*' defaults: #(nil 2**task ct) bindings: #(#arc -> ‘ARC4 new’)
- 23. Grid: Execution task parameters: chosen range callback selector: #reply:from:in: (default) callback recipient: controller (default)
- 24. Grid: Execution [ | drone | drone := self next. key ifNil: [ | range | range := “random unchecked range” drone goWith: range. count < tasks ifNotNil: [ false ] ] whileTrue. ^((ARC4 key: key) decrypt: ct) asString.
- 25. Grid: Result Collection reply: anObject from: aDrone in: ms count := count + 1 anObject ifNotNil: [ key := anObject. winner := aDrone ]. self return: aDrone
- 26. Grid: Challenges code in Strings task binding initializers concurrency control thread working threads
- 27. Thank You! [email_address] com irc.parcplace.net /join #smalltalk (mk) public Store repository bundles OpentalkBase OpenChat Grid
Editor's Notes
- sender can be receiver
- OT constraints => wrapped Chat instance in a Proxy OT weakness => have to hold onto the proxies strongly, otherwise they get GCed
- range <Integer> starting point of a key range size <Integer> size of the key range (constant) ct <ByteArray> encrypted text arc <ARC4> instance of ARC4 (preconfigured for reuse) dt <ByteArray> decrypted text
- task: code from previous slide as a String (will be compiled on the Drone) prerequistes: parcel names and versions that need to be loaded in order to run the task imports: namespaces to import into the private namespace of the drone defauts: default values for task parameters bindings: private, task specific, variables of the drone (from its private namespace) can be used either for constant values or to carry state between the task runs
- parameters: actual parameters for given task run callback: used by drone to report results of a task run each task run is executed in its own worker process
- get a drone out of the pool (wait if there is none) was the key found yet ? if not, find the next unchecked key range, get the drone search it
- was the key found ? if yes, set the ‘key’ to allow the control thread to break out of the loop return the drone to the pool, so that its available for another task