blob: 700150450adc06255361614dd7b06e7948dee037 [file] [log] [blame]
Damien Miller5159bdd2008-05-19 16:08:20 +10001.\" $OpenBSD: nchan2.ms,v 1.4 2008/05/15 23:52:24 djm Exp $
Damien Millera8e06ce2003-11-21 23:48:55 +11002.\"
Ben Lindstrom8bceffb2001-10-04 21:16:57 +00003.\" Copyright (c) 2000 Markus Friedl. All rights reserved.
Damien Millera8e06ce2003-11-21 23:48:55 +11004.\"
Ben Lindstrom8bceffb2001-10-04 21:16:57 +00005.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\" notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\" notice, this list of conditions and the following disclaimer in the
12.\" documentation and/or other materials provided with the distribution.
Damien Millera8e06ce2003-11-21 23:48:55 +110013.\"
Ben Lindstrom8bceffb2001-10-04 21:16:57 +000014.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\"
Damien Miller33b13562000-04-04 14:38:59 +100025.TL
26OpenSSH Channel Close Protocol 2.0 Implementation
27.SH
28Channel Input State Diagram
29.PS
30reset
31l=1
32s=1.2
33ellipsewid=s*ellipsewid
34boxwid=s*boxwid
35ellipseht=s*ellipseht
36S1: ellipse "INPUT" "OPEN"
37move right 2*l from last ellipse.e
38S3: ellipse invis
39move down l from last ellipse.s
40S4: ellipse "INPUT" "CLOSED"
41move down l from 1st ellipse.s
42S2: ellipse "INPUT" "WAIT" "DRAIN"
43arrow from S1.e to S4.n
44box invis "rcvd CLOSE/" "shutdown_read" with .sw at last arrow.c
45arrow "ibuf_empty ||" "rcvd CLOSE/" "send EOF" "" from S2.e to S4.w
46arrow from S1.s to S2.n
Damien Miller5159bdd2008-05-19 16:08:20 +100047box invis "read_failed ||" "rcvd EOW/" "shutdown_read" with .e at last arrow.c
Damien Miller33b13562000-04-04 14:38:59 +100048ellipse wid .9*ellipsewid ht .9*ellipseht at S4
49arrow "start" "" from S1.w+(-0.5,0) to S1.w
50.PE
51.SH
52Channel Output State Diagram
53.PS
54S1: ellipse "OUTPUT" "OPEN"
55move right 2*l from last ellipse.e
56S3: ellipse invis
57move down l from last ellipse.s
58S4: ellipse "OUTPUT" "CLOSED"
59move down l from 1st ellipse.s
60S2: ellipse "OUTPUT" "WAIT" "DRAIN"
61arrow from S1.e to S4.n
Damien Miller5159bdd2008-05-19 16:08:20 +100062box invis "write_failed/" "shutdown_write" "send EOW" with .sw at last arrow.c
Damien Miller33b13562000-04-04 14:38:59 +100063arrow "obuf_empty ||" "write_failed/" "shutdown_write" "" from S2.e to S4.w
64arrow from S1.s to S2.n
65box invis "rcvd EOF ||" "rcvd CLOSE/" "-" with .e at last arrow.c
66ellipse wid .9*ellipsewid ht .9*ellipseht at S4
67arrow "start" "" from S1.w+(-0.5,0) to S1.w
68.PE
69.SH
70Notes
71.PP
72The input buffer is filled with data from the socket
73(the socket represents the local consumer/producer of the
74forwarded channel).
75The data is then sent over the INPUT-end (transmit-end) of the channel to the
76remote peer.
77Data sent by the peer is received on the OUTPUT-end (receive-end),
78saved in the output buffer and written to the socket.
79.PP
80If the local protocol instance has forwarded all data on the
81INPUT-end of the channel, it sends an EOF message to the peer.
82.PP
83A CLOSE message is sent to the peer if
84both the INPUT- and the OUTOUT-half of the local
85end of the channel are closed.
86.PP
87The channel can be deallocated by a protocol instance
88if a CLOSE message he been both sent and received.