uhub/doc/architecture.txt

92 lines
3.1 KiB
Plaintext
Raw Permalink Normal View History

2009-02-19 16:14:09 +00:00
= Architecture of uHub =
2012-03-19 13:00:37 +00:00
uHub is single-threaded and handles network and timer events using the
2009-02-19 16:14:09 +00:00
libevent library.
For each state there is a read event (and sometimes a write event) and timeout
event in case an expected read (or write) event does not occur.
== Protocol overview ==
2012-03-19 13:00:37 +00:00
uHub "speaks" the ADC protocol, which works in short as follows:
2009-02-19 16:14:09 +00:00
(C = client, S = server aka uHub).
C: HSUP ADBASE
Client connects to hub and supplies a list of supported features to the hub.
S: ISUP ADBASE { }
Server responds with a list of supported features.
S: ISID xxxx
Server assigns a session-ID to the client (4 bytes, BASE32 encoded).
C: BINF xxxx (...)
Client sends information about itself, such as nick name, etc.
The hub will relay this information to all users, including the client.
S: BINF xxx1 NInick1 (...)
S: BINF xxx2 NInick2
S: (...)
S: BINF xxxx (client's own nick)
Client gets list of other clients, which ends with the client's own user info.
At this point the client is successfully logged into the hub.
== The hub architecture ==
Accepting new users
--------------------- -----------------
| Accept connection | <---------- | libevent loop |
--------------------- -----------------
|
V
--------------------- ------------
| Setup login timer | --+----> | Timeout? | <----+
--------------------- | ------------ |
| | | |
V | V |
--------------------- | --------------- |
| Receive 'HSUP' | --+----> | DISCONNECT! | |
--------------------- --------------- |
| ^ |
V | |
--------------------- | |
| Send 'ISUP', and | | |
| assign Session ID | | |
--------------------- | |
| | |
V | |
--------------------- | |
| Receive 'BINF' |-----------------+------------
+--| Validate message | ^
| --------------------- |
| | |
| V |
| --------------------- ---------------------
2019-01-14 19:16:48 +00:00
| | Send password | ------> | Receive and check |
2009-02-19 16:14:09 +00:00
| | request, if needed| | password. |
| --------------------- ---------------------
| |
| |
| ------------------------ |
+->| Send welcome message |<--------------+
------------------------
|
V
------------------------
| Send user list to |
| newly accepted user. |
------------------------
|
V
------------------------
| User is logged in. |
| Announce to all. |
------------------------