Annotation of src/usr.bin/ssh/nchan.ms, Revision 1.2
1.1 markus 1: .TL
2: OpenSSH Channel Close Protocol 1.5 Implementation
3: .SH
4: Channel Input State Diagram
5: .PS
6: reset
7: l=1
8: s=1.2
9: ellipsewid=s*ellipsewid
10: boxwid=s*boxwid
11: ellipseht=s*ellipseht
12: S1: ellipse "INPUT" "OPEN"
13: move right 2*l from last ellipse.e
14: S4: ellipse "INPUT" "CLOSED"
15: move down l from last ellipse.s
16: S3: ellipse "INPUT" "WAIT" "OCLOSED"
17: move down l from 1st ellipse.s
18: S2: ellipse "INPUT" "WAIT" "DRAIN"
19: arrow "" "rcvd OCLOSE/" "shutdown_read" "send IEOF" from S1.e to S4.w
20: arrow "ibuf_empty/" "send IEOF" from S2.e to S3.w
21: arrow from S1.s to S2.n
22: box invis "read_failed/" "shutdown_read" with .e at last arrow.c
23: arrow from S3.n to S4.s
24: box invis "rcvd OCLOSE/" "-" with .w at last arrow.c
25: ellipse wid .9*ellipsewid ht .9*ellipseht at S4
26: arrow "start" "" from S1.w+(-0.5,0) to S1.w
27: .PE
28: .SH
29: Channel Output State Diagram
30: .PS
31: S1: ellipse "OUTPUT" "OPEN"
32: move right 2*l from last ellipse.e
33: S3: ellipse "OUTPUT" "WAIT" "IEOF"
34: move down l from last ellipse.s
35: S4: ellipse "OUTPUT" "CLOSED"
36: move down l from 1st ellipse.s
37: S2: ellipse "OUTPUT" "WAIT" "DRAIN"
38: arrow "" "write_failed/" "shutdown_write" "send OCLOSE" from S1.e to S3.w
39: arrow "obuf_empty ||" "write_failed/" "shutdown_write" "send OCLOSE" from S2.e to S4.w
40: arrow from S1.s to S2.n
41: box invis "rcvd IEOF/" "-" with .e at last arrow.c
42: arrow from S3.s to S4.n
43: box invis "rcvd IEOF/" "-" with .w at last arrow.c
44: ellipse wid .9*ellipsewid ht .9*ellipseht at S4
45: arrow "start" "" from S1.w+(-0.5,0) to S1.w
46: .PE
1.2 ! markus 47: .SH
! 48: Notes
! 49: .PP
! 50: The input buffer is filled with data from the socket
! 51: (the socket represents the local comsumer/producer of the
! 52: forwarded channel).
! 53: The data is then sent over the INPUT-end of the channel to the
! 54: remote peer.
! 55: Data sent by the peer is received on the OUTPUT-end,
! 56: saved in the output buffer and written to the socket.
! 57: .PP
! 58: If the local protocol instance has forwarded all data on the
! 59: INPUT-end of the channel, it sends an IEOF message to the peer.
! 60: If the peer receives the IEOF and has comsumed all
! 61: data he replies with an OCLOSE.
! 62: When the local instance receives the OCLOSE
! 63: he considers the INPUT-half of the channel closed.
! 64: The peer has his OUTOUT-half closed.
! 65: .PP
! 66: A channel can be deallocated by a protocol instance
! 67: if both the INPUT- and the OUTOUT-half on his
! 68: side of the channel are closed.
! 69: Note that when an instance is unable to comsume the
! 70: received data, he is permitted to send an OCLOSE
! 71: before the matching IEOF is received.