blob: eb49cd3b4fadd52e2021ae8eae476f8703f374c0 [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
Damien Miller34132e52000-01-14 15:45:46 +110055arrow from S2.ne to S4.sw
56box invis "rcvd OCLOSE/ " with .e at last arrow.c
57box invis " send IEOF" with .w at last arrow.c
Damien Millerd4a8b7e1999-10-27 13:42:43 +100058.PE
59.SH
60Channel Output State Diagram
61.PS
62S1: ellipse "OUTPUT" "OPEN"
63move right 2*l from last ellipse.e
64S3: ellipse "OUTPUT" "WAIT" "IEOF"
65move down l from last ellipse.s
66S4: ellipse "OUTPUT" "CLOSED"
67move down l from 1st ellipse.s
68S2: ellipse "OUTPUT" "WAIT" "DRAIN"
69arrow "" "write_failed/" "shutdown_write" "send OCLOSE" from S1.e to S3.w
70arrow "obuf_empty ||" "write_failed/" "shutdown_write" "send OCLOSE" from S2.e to S4.w
71arrow from S1.s to S2.n
72box invis "rcvd IEOF/" "-" with .e at last arrow.c
73arrow from S3.s to S4.n
74box invis "rcvd IEOF/" "-" with .w at last arrow.c
75ellipse wid .9*ellipsewid ht .9*ellipseht at S4
76arrow "start" "" from S1.w+(-0.5,0) to S1.w
77.PE
78.SH
79Notes
80.PP
81The input buffer is filled with data from the socket
Damien Miller34132e52000-01-14 15:45:46 +110082(the socket represents the local consumer/producer of the
Damien Millerd4a8b7e1999-10-27 13:42:43 +100083forwarded channel).
Damien Miller1e4772c1999-10-30 11:39:56 +100084The data is then sent over the INPUT-end (transmit-end) of the channel to the
Damien Millerd4a8b7e1999-10-27 13:42:43 +100085remote peer.
Damien Miller1e4772c1999-10-30 11:39:56 +100086Data sent by the peer is received on the OUTPUT-end (receive-end),
Damien Millerd4a8b7e1999-10-27 13:42:43 +100087saved in the output buffer and written to the socket.
88.PP
89If the local protocol instance has forwarded all data on the
90INPUT-end of the channel, it sends an IEOF message to the peer.
Damien Miller34132e52000-01-14 15:45:46 +110091If the peer receives the IEOF and has consumed all
Damien Millerd4a8b7e1999-10-27 13:42:43 +100092data he replies with an OCLOSE.
93When the local instance receives the OCLOSE
94he considers the INPUT-half of the channel closed.
95The peer has his OUTOUT-half closed.
96.PP
97A channel can be deallocated by a protocol instance
98if both the INPUT- and the OUTOUT-half on his
99side of the channel are closed.
Damien Miller34132e52000-01-14 15:45:46 +1100100Note that when an instance is unable to consume the
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000101received data, he is permitted to send an OCLOSE
102before the matching IEOF is received.