Initial sketch of channel stream messages.

This commit is contained in:
Tony Garnock-Jones 2012-06-14 11:59:14 -04:00
parent 03560599a1
commit f69527bb14
2 changed files with 59 additions and 1 deletions

View File

@ -9,7 +9,15 @@
(require "os2-support.rkt")
(provide (struct-out ssh-channel))
(provide (struct-out ssh-channel)
(struct-out channel-stream-credit)
(struct-out channel-stream-data)
(struct-out channel-stream-extended-data)
(struct-out channel-stream-eof)
(struct-out channel-stream-notify)
(struct-out channel-stream-request)
(struct-out channel-stream-ok)
(struct-out channel-stream-fail))
;; A CloseState is one of
;; - 'neither, indicating that neither side has signalled closure
@ -41,3 +49,52 @@
close-state ;; CloseState covering CLOSE signals
)
#:transparent)
;; ChannelMessage = (channel-message ChannelStreamName ChannelMessageBody)
;; Relates a message to a particular stream within a channel within a
;; connection.
(struct channel-message (stream-name body) #:prefab)
;; ChannelStreamName = (channel-stream-name Boolean Boolean Any)
;; Names a stream within a channel within a connection. Unique within
;; a particular connection. If (inbound?) is true, this is the stream
;; of packets from the remote peer to the local peer; if false, the
;; reverse. If (locally-originated?) is true, then the local peer is
;; the one that opened this channel, and the local peer is reponsible
;; for choosing the (identifier) and ensuring that it is unique with
;; respect to other locally-originated streams within this connection;
;; if false, the remote peer opened the channel, and the (identifier)
;; is chosen managed by the connection-control code.
(struct channel-stream-name (inbound? locally-originated? identifier) #:prefab)
;; A ChannelMessageBody is one of
;; -- (channel-stream-credit NonNegativeInteger) **
;; Informs the publisher that it may transmit another (count)
;; bytes.
;; -- (channel-stream-data Bytes)
;; Data intended for the subscriber.
;; -- (channel-stream-extended-data Uint32 Bytes)
;; Extended data intended for the subscriber. The type code is one
;; of those defined in ssh-numbers.rkt; for example,
;; SSH_EXTENDED_DATA_STDERR.
;; -- (channel-stream-eof)
;; Signals the end of the data stream. Notice that channel closure
;; is signalled with presence changes.
;; -- (channel-stream-notify Bytes Bytes)
;; One-way notification of SSH_MSG_CHANNEL_REQUEST.
;; -- (channel-stream-request Bytes Bytes)
;; RPC SSH_MSG_CHANNEL_REQUEST request.
;; -- (channel-stream-ok) **
;; RPC SSH_MSG_CHANNEL_REQUEST reply.
;; -- (channel-stream-fail) **
;; RPC SSH_MSG_CHANNEL_REQUEST error.
;;
;; Messages marked ** travel "upstream", from subscriber to publisher.
(struct channel-stream-credit (count) #:prefab)
(struct channel-stream-data (bytes) #:prefab)
(struct channel-stream-extended-data (type bytes) #:prefab)
(struct channel-stream-eof () #:prefab)
(struct channel-stream-notify (type bytes) #:prefab)
(struct channel-stream-request (type bytes) #:prefab)
(struct channel-stream-ok () #:prefab)
(struct channel-stream-fail () #:prefab)

View File

@ -14,6 +14,7 @@
(require "ssh-message-types.rkt")
(require "ssh-exceptions.rkt")
(require "ssh-transport.rkt")
(require "ssh-channel.rkt")
(require "os2-support.rkt")