Duke Wiki  logo
Child pages
  • Dispatcher & Message Router Configuration
Skip to end of metadata
Go to start of metadata

Dispatcher and Message Router configuration is done in a file named cobalt-router.conf located in the config directory    It is read in at viewer startup time and is used to configure the external connectivity, the authentication services and error logging. It's a file of Smalltalk code that returns a configuration object to the dispatcher, so it follows the Smalltalk syntax rules.

There are 4 types of stanzas/blocks that appear in the router config:  comments, dispatcher configuration, authentication

that matter, the first is a block that will return a dispatcher configuration ( dispatcherConfigBlock: ) and the second is to set up the authentication and authorization services ( authServicesBlock: ) . In the shipped standard configuration file, the dispatcherBlock: is setup to configure a Universal Plug and Play firewall hole (if a UPnP accessible firewall router is available) using the TUpnpDispatcherConfig. Also in the standard config file, the authServicesBlock: configures in 2 authentication domains: Local, the developers back door; and Test User Database, a simple self contained user/password/privileges database.

The other options for the dispatcherCofigBlock: are a LAN only config (TLanOnlyDispatcherConfig) and a fully manual config (TManualDiapatcherConfig).  These all can be sent the routerClass: method to set up the kind of router that get spawned on connection. I expect we won't be changing the router type much but it's been useful for testing. There is also a localAddressString: method they all understand. There are example configuration files illustrating these options in the example-config directory in the Open Cobalt installation.

The Squeak TCP/IP interface has some problems and doesn't really understand having multiple active TCP/IP interfaces....they seem to have made an assumption that there is only one interface active as would be common in a workstation.  Servers, or a workstation running VMware or Parallels will often have more than one active interface. If you ask for the local interface address, it will give back it's best guess....which is often wrong if you have multiple interfaces.  The localAddressString: method is there to specify the interface we want to advertise, in the cases where the automatic approach is giving us wrong answers.  In the shipped configuration file I have the localAddressString: send commented out, but if Cobalt Master isn't starting up properly try uncommenting it and setting the address string to the IP address you want to use, usually the default interface.  In testing has worked, it just won't let anyone else get a reasonable address to connect to you.

For the TLanOnlyDispatcherConfig there are no other options.  For theTManualDispatcherConfig there are a bunch of options so you can specify the address on the other side of the firewall and the port numbers.

There is also a commentBlock: stanza that does nothing and is useful for commenting out old configurations and putting in inline string comments.

Example configuration file.:

^(CobaltRouterConfig new)
    commentBlock: 'This is a comment, Open Cobalt will ignore it.';
    dispatcherConfigBlock: [
        "This is the default config, it tries to automatically determine
            a working config. Still somewhat error prone"
        (TUpnpDispatcherConfig new)
            routerClass: CobaltMessageRouter ;
            "localAddressString: '';"
    ] ;
    authServicesBlock: [ :services |
        | userSrv ldapSrv |
        services addService: ( CoLocalSecretTestAuthService named: 'Local' ).
        userSrv := CoUserDbAuthService named: 'Test User Database'.
            addUsername: 'root' password: 'testroot'  displayName: 'SuperUser' group: #wheel;
            addUsername: 'bbuilder' password: 'testroot'  displayName: 'Bob the Builder' group: #builder;
            addUsername: 'jruser' password: 'teatime'  displayName: 'J. Random User' group: #user ;
            addUsername: 'foo' password: 'bar'  displayName: 'Test User' group: #wheel ;
            addUsername: 'cobalttest@jabber.org' password: 'teatime'  displayName: 'Cobalt Test Jabber User' group: #wheel ;
            addUsername: 'jdougan' password: 'teatime'  displayName: 'John Dougan' group: #wheel ;
            addUsername: 'guest' password: 'guest'  displayName: 'Guest User' group: #ghost.
        services addService: userSrv.

        services authorizationService: userSrv.
    ] ;
    logBlock: [ :log |
        | filelog |
        log adapter: nil.
        filelog := LogFile named: (Directory imageDir / 'log' / 'router.log') asFile addTimeStamp asVmPathName.
        filelog maxLevel: 13.
        log adapters add: filelog.
        "log adapters add: (Transcript)."

There are 3 stanzas in this example: commentBlock:, dispatcherConfigBlock:, authServicesBlock:, and logBlock.

  • No labels