author | Tero Marttila <terom@fixme.fi> |
Sat, 26 Sep 2009 16:39:20 +0300 | |
changeset 50 | da394bb715af |
parent 32 | 2168a9ffaef7 |
permissions | -rw-r--r-- |
24
f18b5787c46c
reorganize socket, adding af_inet/af_inet6 modules, and moving sctp in
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
""" |
f18b5787c46c
reorganize socket, adding af_inet/af_inet6 modules, and moving sctp in
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
Transport-layer functionality. |
f18b5787c46c
reorganize socket, adding af_inet/af_inet6 modules, and moving sctp in
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
28
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
4 |
This implements the core TCP/UDP/SCTP functionality, plus relevant transport/application layer stuff like TLS, SOCKS, SSH-channels, etc. |
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
5 |
|
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
6 |
XXX: non-blocking interface? |
26 | 7 |
|
8 |
Firstly, this defines a set of abstract interfaces that model the actual implementation as built on top of the |
|
9 |
socket packages's network-layer implementation: |
|
10 |
||
11 |
||
12 |
Interfaces: |
|
13 |
||
14 |
Transport - very abstract interface that embodies the notion of sending something somewhere |
|
15 |
||
16 |
ConnectedTransport - connection-oriented transport |
|
17 |
||
18 |
Stream - connection-oriented full-duplex byte stream (reliable, sequenced) |
|
28
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
19 |
|
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
20 |
BufferedStream - buffered version of the above |
26 | 21 |
|
22 |
PacketStream - connection-oriented full-duplex packet-oriented communication |
|
23 |
||
24 |
||
25 |
UnconnectedTransport - non-connection-oriented transport dealing with packets |
|
26 |
||
27 |
Peer - connectionless packet-oriented communication |
|
28 |
||
29 |
||
30 |
Endpoint - some transport-level endpoint (local/remote address/socket) |
|
31 |
||
32 |
||
32 | 33 |
Client - connection-oriented endpoint that can establish a Transport to some remote Service |
34 |
||
35 |
Service - listening endpoint that recieves connections from remote Clients and represents those as Transports |
|
26 | 36 |
|
37 |
||
38 |
Next, there are some mid-level helpers, mostly for dealing with |
|
39 |
||
40 |
||
41 |
Then there is are implementations of these interfaces for specific protocols, layering on top of the socket module, |
|
42 |
or other application-level protocols. |
|
43 |
||
44 |
TCP: |
|
45 |
TCP implementation using a SOCK_STREAM socket. |
|
46 |
||
47 |
Stream - connected TCP socket with TCP's byte stream semantics |
|
48 |
||
49 |
Service - TCP socket accept()'ing Streams from remote Clients |
|
50 |
||
51 |
Client - TCP socket connect()'ing to a remote Service |
|
52 |
||
53 |
||
54 |
UDP: |
|
55 |
UDP implementation using a SOCK_DGRAM socket. |
|
56 |
||
57 |
Peer - bind()'d UDP socket without any connection |
|
58 |
||
59 |
Client - connect()'d UDP socket, representing a PacketStream |
|
60 |
||
61 |
||
62 |
UNIX: |
|
63 |
UNIX socket implementation support both SOCK_STREAM and SOCK_DGRAM. |
|
64 |
||
65 |
XXX: verify that this is correct... |
|
66 |
||
67 |
Stream - connected AF_UNIX SOCK_STREAM |
|
68 |
||
69 |
Service - accept()'ing AF_UNIX socket of either SOCK_STREAM mode |
|
70 |
||
71 |
Client - connect()'ing AF_UNIX socket of SOCK_STREAM mode |
|
72 |
||
73 |
Peer - bind()'d AF_UNIX socket of SOCK_DGRAM mode |
|
74 |
||
75 |
SCTP: |
|
76 |
SCTP implementation offering both SOCK_SEQPACKET and SOCK_STREAM -based socket interfaces. |
|
77 |
||
78 |
Stream - a PacketStream carried by an Association |
|
79 |
||
80 |
Association - a Transport that represents a SCTP association between a local and remote Endpoint |
|
81 |
||
82 |
Peer - one-to-many style interface, with a single Peer holding multiple Associations |
|
83 |
||
84 |
Service - a one-to-one style listen()'ing interface which accepts Associations from remote Endpoints |
|
85 |
||
86 |
Client - a one-to-one style connect()'ing interface which establishes Associations with remote Endpoints |
|
87 |
||
88 |
SSL: |
|
89 |
SSL implementation using either OpenSSL or gnutls. |
|
90 |
||
91 |
Stream - tcp.Stream carrying an encrypted byte stream |
|
92 |
||
93 |
Service - tcp.Service accepting connections from SSL endpoints |
|
94 |
||
95 |
Client - tcp.Client connecting to an SSL service |
|
96 |
||
97 |
SOCKS: |
|
98 |
SOCKSv5 client implementing TCP client serviecs. |
|
99 |
||
100 |
Stream - tcp.Stream carried over a SOCKSv5 connections |
|
101 |
||
102 |
Client - tcp.Client connecting via a SOCKSv5 server |
|
28
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
103 |
|
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
104 |
|
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
105 |
|
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
106 |
|
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
107 |
TODO: |
020c89baaa33
[transport] initial TCP implementation
Tero Marttila <terom@fixme.fi>
parents:
26
diff
changeset
|
108 |
* implement the above |
24
f18b5787c46c
reorganize socket, adding af_inet/af_inet6 modules, and moving sctp in
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
109 |
""" |