moved demo scripts and docs into the demo directory
[urisagit/Stem.git] / Design / portal_notes
CommitLineData
4536f655 1
2 Stem::Portal Design Notes
3
4The Stem::Portal class supports the transmission of Stem Messages
5between Stem Hubs. Portals are based on sockets and are configured very
6similarly to a Socket with host and port attributes. Also a Portal can
7be designated a TCP/IP server or a client. Once two Hubs are connected
8via their Portals, they communicate peer to peer in full duplex mode.
9
10Portals are sent a Message to transmit by the Stem::Msg delivery
11subsystem. The Message is converted to a byte stream format and written
12to the Portal socket. When a Portal reads a byte stream Message from its
13socket, it converts it back to an internal Message and sends it to the
14Stem::Msg class for delivery.
15
16When a Stem Portal connects to another, they both exchange a special
17'register' type Stem Message. This message when received by a Portal is
18trapped and never sent for delivery to the Stem::Msg subsystem. The
19'register' message contains the Hub name of the remote Portal. This name
20is then stored in a registry private to the Portal class. It is used by
21the Stem::Msg delivery subsystem to look up which Portal to use to send
22out a remote message. You can see the current state of the Portal
23registry by sending a 'status' command message to the Portal class. This
24is easily done from the terminal (if the Hub has Stem::TtyMsg
25configured) with the command:
26
27 :port status
28
29If you put a Hub name before the :, you will get the Portal registry
30status of that Hub.
31
32A special alias is set up for a client Portal that is the first one
33configured in a Hub. It is given the alias DEFAULT and this Portal
34becomes the default destination for any Messages that aren't delivered
35locally. So if a Stem Message has no Hub in its 'to' address and the
36Cell name is not registered locally, it is sent to the DEFAULT Portal
37and hence to the Hub it is connected to. This is very similar to the
38default route in IP routers like the routed daemon. A new feature (to be
39implemented soon) will be to allow the setting of the DEFAULT Portal at
40configuration or run time.
41
42Security of Hub to Hub communications are handled by the Portal
43Cells. There are two designs in progress, one which pipes over ssh to
44the other Hub, and an internal encryption module which will perform the
45same functions but be more efficient.