blob: 57576017b3646387fe3d0611d041f6c29c4041fd [file] [log] [blame]
Damien Millera8e06ce2003-11-21 23:48:55 +11001.\" $OpenBSD: nchan.ms,v 1.8 2003/11/21 11:57:03 djm Exp $
Ben Lindstrom36579d32001-01-29 07:39:26 +00002.\"
Damien Millera8e06ce2003-11-21 23:48:55 +11003.\"
Damien Miller5428f641999-11-25 11:54:57 +11004.\" Copyright (c) 1999 Markus Friedl. All rights reserved.
Damien Millera8e06ce2003-11-21 23:48:55 +11005.\"
Damien Miller5428f641999-11-25 11:54:57 +11006.\" 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.
Damien Millera8e06ce2003-11-21 23:48:55 +110014.\"
Damien Miller5428f641999-11-25 11:54:57 +110015.\" 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.\"
Damien Millerd4a8b7e1999-10-27 13:42:43 +100026.TL
27OpenSSH Channel Close Protocol 1.5 Implementation
28.SH
29Channel Input State Diagram
30.PS
31reset
32l=1
33s=1.2
34ellipsewid=s*ellipsewid
35boxwid=s*boxwid
36ellipseht=s*ellipseht
37S1: ellipse "INPUT" "OPEN"
38move right 2*l from last ellipse.e
39S4: ellipse "INPUT" "CLOSED"
40move down l from last ellipse.s
41S3: ellipse "INPUT" "WAIT" "OCLOSED"
42move down l from 1st ellipse.s
43S2: ellipse "INPUT" "WAIT" "DRAIN"
44arrow "" "rcvd OCLOSE/" "shutdown_read" "send IEOF" from S1.e to S4.w
45arrow "ibuf_empty/" "send IEOF" from S2.e to S3.w
46arrow from S1.s to S2.n
47box invis "read_failed/" "shutdown_read" with .e at last arrow.c
48arrow from S3.n to S4.s
49box invis "rcvd OCLOSE/" "-" with .w at last arrow.c
50ellipse wid .9*ellipsewid ht .9*ellipseht at S4
51arrow "start" "" from S1.w+(-0.5,0) to S1.w
Damien Miller34132e52000-01-14 15:45:46 +110052arrow from S2.ne to S4.sw
53box invis "rcvd OCLOSE/ " with .e at last arrow.c
54box invis " send IEOF" with .w at last arrow.c
Damien Millerd4a8b7e1999-10-27 13:42:43 +100055.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
Damien Miller34132e52000-01-14 15:45:46 +110079(the socket represents the local consumer/producer of the
Damien Millerd4a8b7e1999-10-27 13:42:43 +100080forwarded 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.
Damien Miller34132e52000-01-14 15:45:46 +110088If the peer receives the IEOF and has consumed all
Damien Millerd4a8b7e1999-10-27 13:42:43 +100089data 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.
Damien Miller34132e52000-01-14 15:45:46 +110097Note that when an instance is unable to consume the
Damien Millerd4a8b7e1999-10-27 13:42:43 +100098received data, he is permitted to send an OCLOSE
99before the matching IEOF is received.