Skip to content

Commit e2ca397

Browse files
committed
doc: updates
1 parent 8b7b1da commit e2ca397

8 files changed

+377
-577
lines changed

docs/API.org

-571
This file was deleted.

docs/Terminology.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Terminology
2+
| Term | Definition |
3+
|------------|------------------------------------------------------------------|
4+
| server | listen and accept quic connections from clients |
5+
| client | initiates quic connection |
6+
| listener | Erlang Process owns listening port |
7+
| connection | Quic Connection |
8+
| stream | Exchanging app data over a connection |
9+
| owner | 'owner' is a process that receives quic events. |
10+
| | 'connection owner' receive events of a connection |
11+
| | 'stream owner' receive application data and events from a stream |
12+
| | 'listener owner' receive events from listener |
13+
| | When owner is dead, related resources would be released |
14+
| l_ctx | listener nif context |
15+
| c_ctx | connection nif context |
16+
| s_ctx | stream nif context |
17+
18+

docs/messages_to_owner.md

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Messages to Owner Processes
2+
3+
Since most of API calls are asynchronous, the API caller or the stream/connection owner can receive
4+
async messages as following
5+
6+
## Messages to Stream Owner
7+
8+
### active received data
9+
10+
Data received in binary format
11+
12+
```erlang
13+
{quic, binary(), stream_handler(), AbsoluteOffset::integer(), TotalBufferLength::integer(), Flag :: integer()}
14+
```
15+
16+
### peer_send_shutdown
17+
18+
```erlang
19+
{quic, peer_send_shutdown, stream_handler(), ErrorCode}
20+
```
21+
22+
### peer_send_aborted
23+
24+
```erlang
25+
{quic, peer_send_aborted, stream_handler(), ErrorCode}
26+
```
27+
28+
### stream closed, shutdown_completed,
29+
30+
Both directions of the stream have been shut down.
31+
32+
```erlang
33+
{quic, closed, stream_handler(), ConnectionShutdown:: 0 | 1}
34+
```
35+
36+
### send_complete
37+
38+
Send call is handled by stack, caller is ok to release the sndbuffer
39+
40+
This message is for sync send only.
41+
42+
```erlang
43+
{quic, send_complete, stream_handler(), IsSendCanceled :: 0 | 1}
44+
```
45+
46+
47+
### continue recv
48+
49+
This is for passive recv only, this is used to notify
50+
caller that new data is ready in recv buffer. The data in the recv buffer
51+
will be pulled by NIF function instead of by sending the erlang messages
52+
53+
see usage in: quicer:recv/2
54+
55+
``` erlang
56+
{quic, continue, stream_handler()}
57+
```
58+
59+
### passive mode
60+
61+
Running out of *active_n*, stream now is in passive mode.
62+
63+
Need to call setopt active_n to make it back to passive mode again
64+
65+
Or use quicer:recv/2 to receive in passive mode
66+
67+
``` erlang
68+
{quic, passive, stream_handler()}
69+
```
70+
71+
## Messages to Connection Owner
72+
73+
### Connection connected
74+
75+
``` erlang
76+
{quic, connected, connection_handler()}
77+
```
78+
79+
This message notifies the connection owner that quic connection is established(TLS handshake is done).
80+
81+
also see [[Accept New Connection (Server)]]
82+
83+
84+
### New Stream Started
85+
86+
``` erlang
87+
{quic, new_stream, stream_handler()} %% @TODO, it should carry connection_handler() as well
88+
```
89+
90+
This message is sent to notify the process which is accpeting new stream.
91+
92+
The process become the owner of the stream.
93+
94+
also see [[Accept Stream (Server)]]
95+
96+
### Transport Shutdown
97+
98+
Connection has been shutdown by the transport locally, such as idle timeout.
99+
100+
``` erlang
101+
{quic, transport_shutdown, connection_handler(), Status :: atom_status()}
102+
```
103+
104+
### Shutdown initiated by PEER
105+
106+
Peer side initiated connection shutdown.
107+
108+
``` erlang
109+
{quic, shutdown, connection_handler()}
110+
```
111+
112+
### Shutdown Complete
113+
114+
The connection has completed the shutdown process and is ready to be
115+
safely cleaned up.
116+
117+
``` erlang
118+
{quic, closed, connection_handler()}
119+
```
120+
121+
## Messages to Listener Owner
122+
123+
### New connection
124+
125+
``` erlang
126+
{quic, new_conn, connection_handler()}
127+
```
128+
129+
This message is sent to the process who is accepting new connections.
130+
131+
The process becomes the connection owner.
132+
133+
To complete the TLS handshake, quicer:handshake/1,2 should be called.
134+
135+
136+

docs/todo.org

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
* Features List
66

77
Feature todo list, priority descending
8+
** Close configurations in resource destroy callback
9+
10+
** Check shutdown connection wait for peer to close or not
11+
12+
** Hibernate connection owner process since connection process is mostly idling
13+
14+
** get Peer cert
815
** Stream recv FIN flag
916

1017
** Stream send flags

erlang_ls.config

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apps_dirs:
2+
- "apps/*"
3+
deps_dirs:
4+
- "_build/default/lib/*"
5+
- "_build/test/lib/*"
6+
include_dirs:
7+
- "include"
8+
- "apps"
9+
- "apps/*/include"
10+
- "_build/*/lib/"
11+
- "_build/*/lib/*/include"

rebar.config

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
{ex_doc, [
2626
{extras, ["README.md"
2727
, "LICENSE"
28+
, "docs/messages_to_owner.md"
29+
, "docs/Terminology.md"
2830
]},
2931
{main, "README.md"},
3032
{source_url, "https://github.com/namespace/your_app"}

0 commit comments

Comments
 (0)