Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 1 | /* RCSID("$Id: nchan.h,v 1.1 1999/10/27 03:42:44 damien Exp $"); */ |
| 2 | |
| 3 | #ifndef NCHAN_H |
| 4 | #define NCHAN_H |
| 5 | |
| 6 | /* |
| 7 | * SSH Protocol 1.5 aka New Channel Protocol |
| 8 | * Thanks to Martina, Axel and everyone who left Erlangen, leaving me bored. |
| 9 | * Written by Markus Friedl in October 1999 |
| 10 | * |
| 11 | * Protocol versions 1.3 and 1.5 differ in the handshake protocol used for the |
| 12 | * tear down of channels: |
| 13 | * |
| 14 | * 1.3: strict request-ack-protocol: |
| 15 | * CLOSE -> |
| 16 | * <- CLOSE_CONFIRM |
| 17 | * |
| 18 | * 1.5: uses variations of: |
| 19 | * IEOF -> |
| 20 | * <- OCLOSE |
| 21 | * <- IEOF |
| 22 | * OCLOSE -> |
| 23 | * i.e. both sides have to close the channel |
| 24 | * |
| 25 | * See the debugging output from 'ssh -v' and 'sshd -d' of |
| 26 | * ssh-1.2.27 as an example. |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | /* ssh-proto-1.5 overloads prot-1.3-message-types */ |
| 31 | #define SSH_MSG_CHANNEL_INPUT_EOF SSH_MSG_CHANNEL_CLOSE |
| 32 | #define SSH_MSG_CHANNEL_OUTPUT_CLOSE SSH_MSG_CHANNEL_CLOSE_CONFIRMATION |
| 33 | |
| 34 | /* possible input states */ |
| 35 | #define CHAN_INPUT_OPEN 0x01 |
| 36 | #define CHAN_INPUT_WAIT_DRAIN 0x02 |
| 37 | #define CHAN_INPUT_WAIT_OCLOSE 0x04 |
| 38 | #define CHAN_INPUT_CLOSED 0x08 |
| 39 | |
| 40 | /* possible output states */ |
| 41 | #define CHAN_OUTPUT_OPEN 0x10 |
| 42 | #define CHAN_OUTPUT_WAIT_DRAIN 0x20 |
| 43 | #define CHAN_OUTPUT_WAIT_IEOF 0x40 |
| 44 | #define CHAN_OUTPUT_CLOSED 0x80 |
| 45 | |
| 46 | /* EVENTS for the input state */ |
| 47 | void chan_rcvd_oclose(Channel *c); |
| 48 | void chan_read_failed(Channel *c); |
| 49 | void chan_ibuf_empty(Channel *c); |
| 50 | |
| 51 | /* EVENTS for the output state */ |
| 52 | void chan_rcvd_ieof(Channel *c); |
| 53 | void chan_write_failed(Channel *c); |
| 54 | void chan_obuf_empty(Channel *c); |
| 55 | |
| 56 | void chan_init_iostates(Channel *c); |
| 57 | #endif |