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