Browse Source

writeup: much progress! many diagrams!

master
eta 2 years ago
parent
commit
d207a6a03e
  1. 3
      schema.sql
  2. 1
      writeup/IRC Message Parsing Flowchart.drawio
  3. BIN
      writeup/IRC Message Parsing Flowchart.png
  4. 3
      writeup/IRC Message Parsing Flowchart.svg
  5. 3950
      writeup/NEA writeup.lyx
  6. 84
      writeup/erd.plantuml
  7. 15
      writeup/erd.svg
  8. 32
      writeup/irc-auth-ours.plantuml
  9. 29
      writeup/irc-auth.plantuml
  10. 23
      writeup/irc-parse.plantuml

3
schema.sql

@ -78,7 +78,8 @@ CREATE TABLE messages (
body VARCHAR NOT NULL DEFAULT '',
origin_ts TIMESTAMP NOT NULL,
local_ts TIMESTAMP NOT NULL,
is_notice BOOLEAN NOT NULL DEFAULT false
is_notice BOOLEAN NOT NULL DEFAULT false,
CHECK((user_to IS NULL) != (groupchat_to IS NULL))
);
CREATE TABLE system_messages (

1
writeup/IRC Message Parsing Flowchart.drawio

@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2020-03-25T11:47:06.646Z" agent="Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0" etag="Qg-H8qw5PNRbwVIDfC8J" version="12.9.1" type="device"><diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">7V1bd6M4Ev4t++Bzph+Swx38mKQnM73bvd2b9ExvzxsG2WYaIw/ISTy/fiUBtpEEli8gvPglMbIQQlX16atSSR6ZD4u3X1J/Of8EQxCPDC18G5nvR4ah65qB/5GSdV7iWF5eMEujsKi0LXiO/gZFoVaUrqIQZJWKCMIYRctqYQCTBASoUuanKXytVpvCuPrUpT8DXMFz4Md86bcoRPO81DPcbfmvIJrNyyfrzjj/ZuGXlYs3yeZ+CF93isyfR+ZDCiHKPy3eHkBMBq8cl28f1t/ijz+cX/75n+wv/7f7f3399+83eWOPh9yyeYUUJOjopt1fv99Nlo/ru6f1p/TBe/0KfvujbDpD63K8QIiHr7iEKZrDGUz8+Odt6X0KV0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

BIN
writeup/IRC Message Parsing Flowchart.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

3
writeup/IRC Message Parsing Flowchart.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 57 KiB

3950
writeup/NEA writeup.lyx

File diff suppressed because it is too large

84
writeup/erd.plantuml

@ -0,0 +1,84 @@
@startuml
hide circle
skinparam linetype polyline
entity servers {
* **id**
* domain
}
entity users {
* **id**
* username
# server //servers//
}
servers --{ users
entity local_users {
# user_id //users//
* password
* email
}
users --{ local_users
entity local_user_devices {
* **id**
* name
# user_id //users//
* highest_seq
}
users --{ local_user_devices
entity groupchats {
* **uuid**
subject
}
entity groupchat_directory_entries {
* **name**
# uuid //groupchats//
}
groupchats --{ groupchat_directory_entries
entity groupchat_roles {
* **role_id**
# groupchat_uuid //groupchats//
* role_name
}
groupchats --{ groupchat_roles
entity groupchat_role_capabilities {
# role_id //groupchat_roles//
* capability
}
groupchat_roles --{ groupchat_role_capabilities
entity groupchat_memberships {
# **groupchat_uuid** //groupchats//
# **user_id** //users//
# role_id //groupchat_roles//
}
groupchats --{ groupchat_memberships
users --{ groupchat_memberships
groupchat_roles -- groupchat_memberships
entity messages {
* **msgid**
* seq
# user_from //users//
# user_to //users//
# groupchat_to //groupchats//
* tags
* body
* origin_ts
* local_ts
* is_notice
}
users --{ messages
groupchats --{ messages
entity system_messages {
* **msgid**
* seq
* type
# user_ref //users//
# target_user_ref //users//
# groupchat_ref //groupchats//
body
* local_ts
}
users --{ system_messages
groupchats --{ system_messages
@enduml

15
writeup/erd.svg

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="135px" preserveAspectRatio="none" style="width:119px;height:135px;" version="1.1" viewBox="0 0 119 135" width="119px" zoomAndPan="magnify"><defs><filter height="300%" id="f1bh39diomyks7" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="30" x2="30" y1="41.0679" y2="92.7739"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="87" x2="87" y1="41.0679" y2="92.7739"/><rect fill="#FEFECE" filter="url(#f1bh39diomyks7)" height="33.0679" style="stroke: #A80036; stroke-width: 1.5;" width="40" x="8" y="3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="26" x="15" y="24.9659">Bob</text><rect fill="#FEFECE" filter="url(#f1bh39diomyks7)" height="33.0679" style="stroke: #A80036; stroke-width: 1.5;" width="40" x="8" y="91.7739"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="26" x="15" y="113.7399">Bob</text><rect fill="#FEFECE" filter="url(#f1bh39diomyks7)" height="33.0679" style="stroke: #A80036; stroke-width: 1.5;" width="46" x="62" y="3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="32" x="69" y="24.9659">Alice</text><rect fill="#FEFECE" filter="url(#f1bh39diomyks7)" height="33.0679" style="stroke: #A80036; stroke-width: 1.5;" width="46" x="62" y="91.7739"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="32" x="69" y="113.7399">Alice</text><polygon fill="#A80036" points="75,70.7739,85,74.7739,75,78.7739,79,74.7739" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="30" x2="81" y1="74.7739" y2="74.7739"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="29" x="37" y="68.9649">hello</text><!--MD5=[4fd5ee914b554bd14ff0398c8e7f8387]
@startuml
Bob->Alice : hello
@enduml
PlantUML version 1.2020.02(Sun Mar 01 10:22:07 GMT 2020)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 1.8.0_242-b08
Operating System: Linux
Default Encoding: UTF-8
Language: en
Country: GB
--></g></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

32
writeup/irc-auth-ours.plantuml

@ -0,0 +1,32 @@
@startuml
start
repeat
:Receive a message from the user;
if (Is the command //USER//, //NICK//,\n//PASS//, or //CAP//?) then (yes)
:Process it appropriately,\nstoring the supplied information;
else (no)
:Return an error;
endif
if (Has the user attempted SASL?) then (yes)
://Check the authentication information//\nprovided by the user;
endif
repeat while (Is the user //able to register//?) is (no)
->yes;
if (Has the user supplied a password\nvia //PASS//?) then (yes)
://Check the authentication information//\nwith the nickname and password provided;
if (Did authentication fail?) then (yes)
:Disconnect the user;
stop
endif
endif
if (Is there a stored user ID?) then (yes)
:Registration successful!;
:Send registration welcome messages;
:Rejoin the user to all groupchats;
:Replay offline messages;
stop
else (no)
:Disconnect the user;
stop
endif
@enduml

29
writeup/irc-auth.plantuml

@ -0,0 +1,29 @@
@startuml
start
repeat
:Receive a message from the user;
if (Is message command //USER//?) then (yes)
:Set the user's username and realname;
elseif (...//NICK//?) then (yes)
if (Is the nickname free?) then (yes)
:Set the user's nickname;
else (no)
:Return an error;
endif
elseif (...//PASS//?) then (yes)
:Make a note of the password supplied;
else (something else)
:Return an error;
endif
repeat while (Is a username and nickname set?) is (no)
->yes;
if (Is password authentication on?) then (yes)
if (Is the password wrong or nonexistent?) then (yes)
:Disconnect the user;
stop
endif
endif
:Send registration welcome messages;
:Move into next phase;
stop
@enduml

23
writeup/irc-parse.plantuml

@ -0,0 +1,23 @@
@startuml
start
:Initialize empty variables //tags//, //source// and //args//.\nSet //msg// to the message text;
repeat
if (Is //source// or //args// non-null?) then (yes)
if (Is there a colon character in //msg// with a space before it?) then (yes)
:Split //msg// in two at the colon bit;
://Slurp arguments//, providing the first half (before the colon) as //arguments// and the second half as //trailing//;
else (no)
://Slurp arguments//, providing the rest of //msg// as //arguments// and nothing as //trailing//;
endif
else (no)
:Split //msg// at the first space character\nproducing //first-word// and //rest//;
if (Is there nothing after the space character, or no space character?) then (yes)
stop
else (no)
if (Does //first-word// start with @?) then (yes)
://tags// = //parse tags//(//first-word//).
:
endif
endif
stop
@enduml
Loading…
Cancel
Save