blob: 1679d39f30f3a33e8e6d76324d20734740df7e68 [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.
Damien Miller5428f641999-11-25 11:54:57 +110012.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23.\"
Damien Millerd4a8b7e1999-10-27 13:42:43 +100024.TL
25OpenSSH Channel Close Protocol 1.5 Implementation
26.SH
27Channel Input State Diagram
28.PS
29reset
30l=1
31s=1.2
32ellipsewid=s*ellipsewid
33boxwid=s*boxwid
34ellipseht=s*ellipseht
35S1: ellipse "INPUT" "OPEN"
36move right 2*l from last ellipse.e
37S4: ellipse "INPUT" "CLOSED"
38move down l from last ellipse.s
39S3: ellipse "INPUT" "WAIT" "OCLOSED"
40move down l from 1st ellipse.s
41S2: ellipse "INPUT" "WAIT" "DRAIN"
42arrow "" "rcvd OCLOSE/" "shutdown_read" "send IEOF" from S1.e to S4.w
43arrow "ibuf_empty/" "send IEOF" from S2.e to S3.w
44arrow from S1.s to S2.n
45box invis "read_failed/" "shutdown_read" with .e at last arrow.c
46arrow from S3.n to S4.s
47box invis "rcvd OCLOSE/" "-" with .w at last arrow.c
48ellipse wid .9*ellipsewid ht .9*ellipseht at S4
49arrow "start" "" from S1.w+(-0.5,0) to S1.w
Damien Miller34132e52000-01-14 15:45:46 +110050arrow from S2.ne to S4.sw
51box invis "rcvd OCLOSE/ " with .e at last arrow.c
52box invis " send IEOF" with .w at last arrow.c
Damien Millerd4a8b7e1999-10-27 13:42:43 +100053.PE
54.SH
55Channel Output State Diagram
56.PS
57S1: ellipse "OUTPUT" "OPEN"
58move right 2*l from last ellipse.e
59S3: ellipse "OUTPUT" "WAIT" "IEOF"
60move down l from last ellipse.s
61S4: ellipse "OUTPUT" "CLOSED"
62move down l from 1st ellipse.s
63S2: ellipse "OUTPUT" "WAIT" "DRAIN"
64arrow "" "write_failed/" "shutdown_write" "send OCLOSE" from S1.e to S3.w
65arrow "obuf_empty ||" "write_failed/" "shutdown_write" "send OCLOSE" from S2.e to S4.w
66arrow from S1.s to S2.n
67box invis "rcvd IEOF/" "-" with .e at last arrow.c
68arrow from S3.s to S4.n
69box invis "rcvd IEOF/" "-" with .w at last arrow.c
70ellipse wid .9*ellipsewid ht .9*ellipseht at S4
71arrow "start" "" from S1.w+(-0.5,0) to S1.w
72.PE
73.SH
74Notes
75.PP
76The input buffer is filled with data from the socket
Damien Miller34132e52000-01-14 15:45:46 +110077(the socket represents the local consumer/producer of the
Damien Millerd4a8b7e1999-10-27 13:42:43 +100078forwarded channel).
Damien Miller1e4772c1999-10-30 11:39:56 +100079The data is then sent over the INPUT-end (transmit-end) of the channel to the
Damien Millerd4a8b7e1999-10-27 13:42:43 +100080remote peer.
Damien Miller1e4772c1999-10-30 11:39:56 +100081Data sent by the peer is received on the OUTPUT-end (receive-end),
Damien Millerd4a8b7e1999-10-27 13:42:43 +100082saved in the output buffer and written to the socket.
83.PP
84If the local protocol instance has forwarded all data on the
85INPUT-end of the channel, it sends an IEOF message to the peer.
Damien Miller34132e52000-01-14 15:45:46 +110086If the peer receives the IEOF and has consumed all
Damien Millerd4a8b7e1999-10-27 13:42:43 +100087data he replies with an OCLOSE.
88When the local instance receives the OCLOSE
89he considers the INPUT-half of the channel closed.
90The peer has his OUTOUT-half closed.
91.PP
92A channel can be deallocated by a protocol instance
93if both the INPUT- and the OUTOUT-half on his
94side of the channel are closed.
Damien Miller34132e52000-01-14 15:45:46 +110095Note that when an instance is unable to consume the
Damien Millerd4a8b7e1999-10-27 13:42:43 +100096received data, he is permitted to send an OCLOSE
97before the matching IEOF is received.