nchan2.ms 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. .\" $OpenBSD: nchan2.ms,v 1.4 2008/05/15 23:52:24 djm Exp $
  2. .\"
  3. .\" Copyright (c) 2000 Markus Friedl. All rights reserved.
  4. .\"
  5. .\" 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.
  13. .\"
  14. .\" 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. .\"
  25. .TL
  26. OpenSSH Channel Close Protocol 2.0 Implementation
  27. .SH
  28. Channel Input State Diagram
  29. .PS
  30. reset
  31. l=1
  32. s=1.2
  33. ellipsewid=s*ellipsewid
  34. boxwid=s*boxwid
  35. ellipseht=s*ellipseht
  36. S1: ellipse "INPUT" "OPEN"
  37. move right 2*l from last ellipse.e
  38. S3: ellipse invis
  39. move down l from last ellipse.s
  40. S4: ellipse "INPUT" "CLOSED"
  41. move down l from 1st ellipse.s
  42. S2: ellipse "INPUT" "WAIT" "DRAIN"
  43. arrow from S1.e to S4.n
  44. box invis "rcvd CLOSE/" "shutdown_read" with .sw at last arrow.c
  45. arrow "ibuf_empty ||" "rcvd CLOSE/" "send EOF" "" from S2.e to S4.w
  46. arrow from S1.s to S2.n
  47. box invis "read_failed ||" "rcvd EOW/" "shutdown_read" with .e at last arrow.c
  48. ellipse wid .9*ellipsewid ht .9*ellipseht at S4
  49. arrow "start" "" from S1.w+(-0.5,0) to S1.w
  50. .PE
  51. .SH
  52. Channel Output State Diagram
  53. .PS
  54. S1: ellipse "OUTPUT" "OPEN"
  55. move right 2*l from last ellipse.e
  56. S3: ellipse invis
  57. move down l from last ellipse.s
  58. S4: ellipse "OUTPUT" "CLOSED"
  59. move down l from 1st ellipse.s
  60. S2: ellipse "OUTPUT" "WAIT" "DRAIN"
  61. arrow from S1.e to S4.n
  62. box invis "write_failed/" "shutdown_write" "send EOW" with .sw at last arrow.c
  63. arrow "obuf_empty ||" "write_failed/" "shutdown_write" "" from S2.e to S4.w
  64. arrow from S1.s to S2.n
  65. box invis "rcvd EOF ||" "rcvd CLOSE/" "-" with .e at last arrow.c
  66. ellipse wid .9*ellipsewid ht .9*ellipseht at S4
  67. arrow "start" "" from S1.w+(-0.5,0) to S1.w
  68. .PE
  69. .SH
  70. Notes
  71. .PP
  72. The input buffer is filled with data from the socket
  73. (the socket represents the local consumer/producer of the
  74. forwarded channel).
  75. The data is then sent over the INPUT-end (transmit-end) of the channel to the
  76. remote peer.
  77. Data sent by the peer is received on the OUTPUT-end (receive-end),
  78. saved in the output buffer and written to the socket.
  79. .PP
  80. If the local protocol instance has forwarded all data on the
  81. INPUT-end of the channel, it sends an EOF message to the peer.
  82. .PP
  83. A CLOSE message is sent to the peer if
  84. both the INPUT- and the OUTOUT-half of the local
  85. end of the channel are closed.
  86. .PP
  87. The channel can be deallocated by a protocol instance
  88. if a CLOSE message he been both sent and received.