Damien Miller | 5428f64 | 1999-11-25 11:54:57 +1100 | [diff] [blame] | 1 | .\" |
| 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 Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 29 | .TL |
| 30 | OpenSSH Channel Close Protocol 1.5 Implementation |
| 31 | .SH |
| 32 | Channel Input State Diagram |
| 33 | .PS |
| 34 | reset |
| 35 | l=1 |
| 36 | s=1.2 |
| 37 | ellipsewid=s*ellipsewid |
| 38 | boxwid=s*boxwid |
| 39 | ellipseht=s*ellipseht |
| 40 | S1: ellipse "INPUT" "OPEN" |
| 41 | move right 2*l from last ellipse.e |
| 42 | S4: ellipse "INPUT" "CLOSED" |
| 43 | move down l from last ellipse.s |
| 44 | S3: ellipse "INPUT" "WAIT" "OCLOSED" |
| 45 | move down l from 1st ellipse.s |
| 46 | S2: ellipse "INPUT" "WAIT" "DRAIN" |
| 47 | arrow "" "rcvd OCLOSE/" "shutdown_read" "send IEOF" from S1.e to S4.w |
| 48 | arrow "ibuf_empty/" "send IEOF" from S2.e to S3.w |
| 49 | arrow from S1.s to S2.n |
| 50 | box invis "read_failed/" "shutdown_read" with .e at last arrow.c |
| 51 | arrow from S3.n to S4.s |
| 52 | box invis "rcvd OCLOSE/" "-" with .w at last arrow.c |
| 53 | ellipse wid .9*ellipsewid ht .9*ellipseht at S4 |
| 54 | arrow "start" "" from S1.w+(-0.5,0) to S1.w |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame^] | 55 | arrow from S2.ne to S4.sw |
| 56 | box invis "rcvd OCLOSE/ " with .e at last arrow.c |
| 57 | box invis " send IEOF" with .w at last arrow.c |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 58 | .PE |
| 59 | .SH |
| 60 | Channel Output State Diagram |
| 61 | .PS |
| 62 | S1: ellipse "OUTPUT" "OPEN" |
| 63 | move right 2*l from last ellipse.e |
| 64 | S3: ellipse "OUTPUT" "WAIT" "IEOF" |
| 65 | move down l from last ellipse.s |
| 66 | S4: ellipse "OUTPUT" "CLOSED" |
| 67 | move down l from 1st ellipse.s |
| 68 | S2: ellipse "OUTPUT" "WAIT" "DRAIN" |
| 69 | arrow "" "write_failed/" "shutdown_write" "send OCLOSE" from S1.e to S3.w |
| 70 | arrow "obuf_empty ||" "write_failed/" "shutdown_write" "send OCLOSE" from S2.e to S4.w |
| 71 | arrow from S1.s to S2.n |
| 72 | box invis "rcvd IEOF/" "-" with .e at last arrow.c |
| 73 | arrow from S3.s to S4.n |
| 74 | box invis "rcvd IEOF/" "-" with .w at last arrow.c |
| 75 | ellipse wid .9*ellipsewid ht .9*ellipseht at S4 |
| 76 | arrow "start" "" from S1.w+(-0.5,0) to S1.w |
| 77 | .PE |
| 78 | .SH |
| 79 | Notes |
| 80 | .PP |
| 81 | The input buffer is filled with data from the socket |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame^] | 82 | (the socket represents the local consumer/producer of the |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 83 | forwarded channel). |
Damien Miller | 1e4772c | 1999-10-30 11:39:56 +1000 | [diff] [blame] | 84 | The data is then sent over the INPUT-end (transmit-end) of the channel to the |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 85 | remote peer. |
Damien Miller | 1e4772c | 1999-10-30 11:39:56 +1000 | [diff] [blame] | 86 | Data sent by the peer is received on the OUTPUT-end (receive-end), |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 87 | saved in the output buffer and written to the socket. |
| 88 | .PP |
| 89 | If the local protocol instance has forwarded all data on the |
| 90 | INPUT-end of the channel, it sends an IEOF message to the peer. |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame^] | 91 | If the peer receives the IEOF and has consumed all |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 92 | data he replies with an OCLOSE. |
| 93 | When the local instance receives the OCLOSE |
| 94 | he considers the INPUT-half of the channel closed. |
| 95 | The peer has his OUTOUT-half closed. |
| 96 | .PP |
| 97 | A channel can be deallocated by a protocol instance |
| 98 | if both the INPUT- and the OUTOUT-half on his |
| 99 | side of the channel are closed. |
Damien Miller | 34132e5 | 2000-01-14 15:45:46 +1100 | [diff] [blame^] | 100 | Note that when an instance is unable to consume the |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 101 | received data, he is permitted to send an OCLOSE |
| 102 | before the matching IEOF is received. |