1 | .\" $OpenBSD: nchan.ms,v 1.7 2001/01/29 01:58:17 niklas Exp $ |
---|
2 | .\" |
---|
3 | .\" |
---|
4 | .\" Copyright (c) 1999 Markus Friedl. All rights reserved. |
---|
5 | .\" |
---|
6 | .\" Redistribution and use in source and binary forms, with or without |
---|
7 | .\" modification, are permitted provided that the following conditions |
---|
8 | .\" are met: |
---|
9 | .\" 1. Redistributions of source code must retain the above copyright |
---|
10 | .\" notice, this list of conditions and the following disclaimer. |
---|
11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
---|
12 | .\" notice, this list of conditions and the following disclaimer in the |
---|
13 | .\" documentation and/or other materials provided with the distribution. |
---|
14 | .\" |
---|
15 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
---|
16 | .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
---|
17 | .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
---|
18 | .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
---|
19 | .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
---|
20 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
21 | .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
22 | .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
23 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
---|
24 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
25 | .\" |
---|
26 | .TL |
---|
27 | OpenSSH Channel Close Protocol 1.5 Implementation |
---|
28 | .SH |
---|
29 | Channel Input State Diagram |
---|
30 | .PS |
---|
31 | reset |
---|
32 | l=1 |
---|
33 | s=1.2 |
---|
34 | ellipsewid=s*ellipsewid |
---|
35 | boxwid=s*boxwid |
---|
36 | ellipseht=s*ellipseht |
---|
37 | S1: ellipse "INPUT" "OPEN" |
---|
38 | move right 2*l from last ellipse.e |
---|
39 | S4: ellipse "INPUT" "CLOSED" |
---|
40 | move down l from last ellipse.s |
---|
41 | S3: ellipse "INPUT" "WAIT" "OCLOSED" |
---|
42 | move down l from 1st ellipse.s |
---|
43 | S2: ellipse "INPUT" "WAIT" "DRAIN" |
---|
44 | arrow "" "rcvd OCLOSE/" "shutdown_read" "send IEOF" from S1.e to S4.w |
---|
45 | arrow "ibuf_empty/" "send IEOF" from S2.e to S3.w |
---|
46 | arrow from S1.s to S2.n |
---|
47 | box invis "read_failed/" "shutdown_read" with .e at last arrow.c |
---|
48 | arrow from S3.n to S4.s |
---|
49 | box invis "rcvd OCLOSE/" "-" with .w at last arrow.c |
---|
50 | ellipse wid .9*ellipsewid ht .9*ellipseht at S4 |
---|
51 | arrow "start" "" from S1.w+(-0.5,0) to S1.w |
---|
52 | arrow from S2.ne to S4.sw |
---|
53 | box invis "rcvd OCLOSE/ " with .e at last arrow.c |
---|
54 | box invis " send IEOF" with .w at last arrow.c |
---|
55 | .PE |
---|
56 | .SH |
---|
57 | Channel Output State Diagram |
---|
58 | .PS |
---|
59 | S1: ellipse "OUTPUT" "OPEN" |
---|
60 | move right 2*l from last ellipse.e |
---|
61 | S3: ellipse "OUTPUT" "WAIT" "IEOF" |
---|
62 | move down l from last ellipse.s |
---|
63 | S4: ellipse "OUTPUT" "CLOSED" |
---|
64 | move down l from 1st ellipse.s |
---|
65 | S2: ellipse "OUTPUT" "WAIT" "DRAIN" |
---|
66 | arrow "" "write_failed/" "shutdown_write" "send OCLOSE" from S1.e to S3.w |
---|
67 | arrow "obuf_empty ||" "write_failed/" "shutdown_write" "send OCLOSE" from S2.e to S4.w |
---|
68 | arrow from S1.s to S2.n |
---|
69 | box invis "rcvd IEOF/" "-" with .e at last arrow.c |
---|
70 | arrow from S3.s to S4.n |
---|
71 | box invis "rcvd IEOF/" "-" with .w at last arrow.c |
---|
72 | ellipse wid .9*ellipsewid ht .9*ellipseht at S4 |
---|
73 | arrow "start" "" from S1.w+(-0.5,0) to S1.w |
---|
74 | .PE |
---|
75 | .SH |
---|
76 | Notes |
---|
77 | .PP |
---|
78 | The input buffer is filled with data from the socket |
---|
79 | (the socket represents the local consumer/producer of the |
---|
80 | forwarded channel). |
---|
81 | The data is then sent over the INPUT-end (transmit-end) of the channel to the |
---|
82 | remote peer. |
---|
83 | Data sent by the peer is received on the OUTPUT-end (receive-end), |
---|
84 | saved in the output buffer and written to the socket. |
---|
85 | .PP |
---|
86 | If the local protocol instance has forwarded all data on the |
---|
87 | INPUT-end of the channel, it sends an IEOF message to the peer. |
---|
88 | If the peer receives the IEOF and has consumed all |
---|
89 | data he replies with an OCLOSE. |
---|
90 | When the local instance receives the OCLOSE |
---|
91 | he considers the INPUT-half of the channel closed. |
---|
92 | The peer has his OUTOUT-half closed. |
---|
93 | .PP |
---|
94 | A channel can be deallocated by a protocol instance |
---|
95 | if both the INPUT- and the OUTOUT-half on his |
---|
96 | side of the channel are closed. |
---|
97 | Note that when an instance is unable to consume the |
---|
98 | received data, he is permitted to send an OCLOSE |
---|
99 | before the matching IEOF is received. |
---|