# ``twisted`.`conch`.`ssh`.`channel`.`SSHChannel``

class documentation

`class SSHChannel(log.Logger): (source)`

Known subclasses: `twisted.conch.client.agent.SSHAgentForwardingChannel`, `twisted.conch.scripts.cftp.SSHSession`, `twisted.conch.scripts.conch.SSHSession`, `twisted.conch.scripts.tkconch.SSHSession`, `twisted.conch.ssh.forwarding.SSHConnectForwardingChannel`, `twisted.conch.ssh.forwarding.SSHListenForwardingChannel`, `twisted.conch.ssh.session.SSHSession`, `twisted.conch.endpoints._CommandChannel`

Implements interfaces: `twisted.internet.interfaces.ITransport`

View In Hierarchy

A class that represents a multiplexed channel over an SSH connection. The channel has a local window which is the maximum amount of data it will receive, and a remote which is the maximum amount of data the remote side will accept. There is also a maximum packet size for any individual data packet going each way.

Method | `__bytes__` | Return a byte string representation of the channel
Method | `__init__` | Undocumented
Method | `__str__` | Undocumented
Method | `addWindowBytes` | Called when bytes are added to the remote window. By default it clears the data buffers.
Method | `channelOpen` | Called when the channel is opened. specificData is any data that the other side sent us when opening the channel.
Method | `closed` | Called when the channel is closed. This means that both our side and the remote side have closed the channel.
Method | `closeReceived` | Called when the other side has closed the channel.
Method | `dataReceived` | Called when we receive data.
Method | `eofReceived` | Called when the other side will send no more data.
Method | `extReceived` | Called when we receive extended data (usually standard error).
Method | `getHost` | See: `ITransport.getHost`
Method | `getPeer` | See: `ITransport.getPeer`
Method | `logPrefix` | Override this method to insert custom logging behavior. Its return value will be inserted in front of every line. It may be called more times than the number of output lines.
Method | `loseConnection` | Close the channel if there is no buferred data. Otherwise, note the request and return.
Method | `openFailed` | Called when the open failed for some reason. reason.desc is a string descrption, reason.code the SSH error code.
Method | `requestReceived` | No summary
Method | `startWriting` | Called when the remote buffer has more room, as a hint to continue writing.
Method | `stopWriting` | Called when the remote buffer is full, as a hint to stop writing. This can be ignored, but it can be helpful.
Method | `write` | Write some data to the channel. If there is not enough remote window available, buffer until it is. Otherwise, split the data into packets of length remoteMaxPacket and send them.
Method | `writeExtended` | Send extended data to this channel. If there is not enough remote window available, buffer until there is. Otherwise, split the data into packets of length remoteMaxPacket and send them.
Method | `writeSequence` | Part of the Transport interface. Write a list of strings to the channel.
Instance Variable | `areWriting` | Undocumented
Instance Variable | `avatar` | an avatar for the logged-in user (if a server channel)
Instance Variable | `buf` | Undocumented
Instance Variable | `closing` | Undocumented
Instance Variable | `conn` | the connection this channel is multiplexed through.
Instance Variable | `data` | any data to send to the other side when the channel is requested.
Instance Variable | `extBuf` | Undocumented
Instance Variable | `id` | Undocumented
Instance Variable | `localClosed` | True if we aren't accepting more data.
Instance Variable | `localMaxPacket` | the maximum size of packet we will accept in bytes.
Instance Variable | `localWindowLeft` | how many bytes are left in the local window.
Instance Variable | `localWindowSize` | the maximum size of the local window in bytes.
Instance Variable | `name` | the name of the channel.
Instance Variable | `remoteClosed` | True if the other side isn't accepting more data.
Instance Variable | `remoteMaxPacket` | the maximum size of a packet the remote side will accept in bytes.
Instance Variable | `remoteWindowLeft` | how many bytes are left in the remote window.
Instance Variable | `specificData` | Undocumented
Class Variable | `_log` | Undocumented

def __bytes__(self): (source)
Return a byte string representation of the channel

Returns
`bytes` | Undocumented

def __init__(self, localWindow=0, localMaxPacket=0, remoteWindow=0, remoteMaxPacket=0, conn=None, data=None, avatar=None): (source)
overridden in `twisted.conch.ssh.forwarding.SSHConnectForwardingChannel`, `twisted.conch.ssh.session.SSHSession`, `twisted.conch.endpoints._CommandChannel`

Undocumented

def __str__(self): (source)

Undocumented

Returns
`str` | Undocumented

def addWindowBytes(self, data): (source)
Called when bytes are added to the remote window. By default it clears the data buffers.

Parameters
data:`bytes` | Undocumented

def channelOpen(self, specificData): (source)
overridden in `twisted.conch.client.agent.SSHAgentForwardingChannel`, `twisted.conch.scripts.cftp.SSHSession`, `twisted.conch.scripts.conch.SSHSession`, `twisted.conch.scripts.tkconch.SSHSession`, `twisted.conch.ssh.forwarding.SSHConnectForwardingChannel`, `twisted.conch.ssh.forwarding.SSHListenForwardingChannel`, `twisted.conch.endpoints._CommandChannel`
Called when the channel is opened. specificData is any data that the other side sent us when opening the channel.

Parameters
specificData:`bytes` | Undocumented

def closed(self): (source)
overridden in `twisted.conch.client.agent.SSHAgentForwardingChannel`, `twisted.conch.scripts.cftp.SSHSession`, `twisted.conch.scripts.conch.SSHSession`, `twisted.conch.scripts.tkconch.SSHSession`, `twisted.conch.ssh.forwarding.SSHConnectForwardingChannel`, `twisted.conch.ssh.forwarding.SSHListenForwardingChannel`, `twisted.conch.ssh.session.SSHSession`, `twisted.conch.endpoints._CommandChannel`
Called when the channel is closed. This means that both our side and the remote side have closed the channel.
def closeReceived(self): (source)
overridden in `twisted.conch.scripts.cftp.SSHSession`, `twisted.conch.scripts.conch.SSHSession`
Called when the other side has closed the channel.
def dataReceived(self, data): (source)
overridden in `twisted.conch.client.agent.SSHAgentForwardingChannel`, `twisted.conch.scripts.conch.SSHSession`, `twisted.conch.scripts.tkconch.SSHSession`, `twisted.conch.ssh.forwarding.SSHConnectForwardingChannel`, `twisted.conch.ssh.forwarding.SSHListenForwardingChannel`, `twisted.conch.ssh.session.SSHSession`, `twisted.conch.endpoints._CommandChannel`
Called when we receive data.

Parameters
data:`bytes` | Undocumented

def eofReceived(self): (source)
overridden in `twisted.conch.scripts.cftp.SSHSession`, `twisted.conch.scripts.conch.SSHSession`, `twisted.conch.scripts.tkconch.SSHSession`, `twisted.conch.ssh.forwarding.SSHListenForwardingChannel`, `twisted.conch.ssh.session.SSHSession`
Called when the other side will send no more data.
def extReceived(self, dataType, data): (source)
overridden in `twisted.conch.scripts.cftp.SSHSession`, `twisted.conch.scripts.conch.SSHSession`, `twisted.conch.scripts.tkconch.SSHSession`, `twisted.conch.ssh.session.SSHSession`
Called when we receive extended data (usually standard error).

Parameters
dataType:`int` | Undocumented
data:`str` | Undocumented

def getHost(self): (source)
from `twisted.internet.interfaces.ITransport`
See: `ITransport.getHost`

Returns
`SSHTransportAddress`. | An address describing this side of the connection.

def getPeer(self): (source)
from `twisted.internet.interfaces.ITransport`
See: `ITransport.getPeer`

Returns
`SSHTransportAddress`. | The remote address of this connection.

def logPrefix(self): (source)
overrides `twisted.python.log.Logger.logPrefix`
Override this method to insert custom logging behavior. Its return value will be inserted in front of every line. It may be called more times than the number of output lines.
def loseConnection(self): (source)
from `twisted.internet.interfaces.ITransport`
overridden in `twisted.conch.ssh.session.SSHSession`
Close the channel if there is no buferred data. Otherwise, note the request and return.
def openFailed(self, reason): (source)
overridden in `twisted.conch.ssh.forwarding.SSHListenForwardingChannel`, `twisted.conch.endpoints._CommandChannel`
Called when the open failed for some reason. reason.desc is a string descrption, reason.code the SSH error code.

Parameters
reason:`error.ConchError` | Undocumented

def requestReceived(self, requestType, data): (source)
Called when a request is sent to this channel. By default it delegates to self.request_<requestType>. If this function returns true, the request succeeded, otherwise it failed.

Parameters
requestType:`bytes` | Undocumented
data:`bytes` | Undocumented
Returns
`bool` | Undocumented

def startWriting(self): (source)
overridden in `twisted.conch.scripts.cftp.SSHSession`, `twisted.conch.scripts.conch.SSHSession`
Called when the remote buffer has more room, as a hint to continue writing.
def stopWriting(self): (source)
overridden in `twisted.conch.scripts.cftp.SSHSession`, `twisted.conch.scripts.conch.SSHSession`
Called when the remote buffer is full, as a hint to stop writing. This can be ignored, but it can be helpful.
def write(self, data): (source)
from `twisted.internet.interfaces.ITransport`
Write some data to the channel. If there is not enough remote window available, buffer until it is. Otherwise, split the data into packets of length remoteMaxPacket and send them.

Parameters
data:`bytes` | Undocumented

def writeExtended(self, dataType, data): (source)
Send extended data to this channel. If there is not enough remote window available, buffer until there is. Otherwise, split the data into packets of length remoteMaxPacket and send them.

Parameters
dataType:`int` | Undocumented
data:`bytes` | Undocumented

def writeSequence(self, data): (source)
from `twisted.internet.interfaces.ITransport`
Part of the Transport interface. Write a list of strings to the channel.

Parameters
data:`list` of `str` | Undocumented

areWriting: `int` = (source)

Undocumented

avatar = (source)
an avatar for the logged-in user (if a server channel)
buf = (source)
overridden in `twisted.conch.client.agent.SSHAgentForwardingChannel`, `twisted.conch.ssh.session.SSHSession`

Undocumented

closing: `int` = (source)

Undocumented

conn: `SSHConnection` = (source)
the connection this channel is multiplexed through.
data: `bytes` = (source)
any data to send to the other side when the channel is requested.
extBuf = (source)

Undocumented

id = (source)

Undocumented

localClosed: `bool` = (source)
True if we aren't accepting more data.
localMaxPacket: `int` = (source)
the maximum size of packet we will accept in bytes.
localWindowLeft: `int` = (source)
how many bytes are left in the local window.
localWindowSize: `int` = (source)
the maximum size of the local window in bytes.
name: `bytes` = (source)
overridden in `twisted.conch.scripts.cftp.SSHSession`, `twisted.conch.scripts.conch.SSHSession`, `twisted.conch.scripts.tkconch.SSHSession`, `twisted.conch.ssh.forwarding.SSHListenClientForwardingChannel`, `twisted.conch.ssh.forwarding.SSHListenServerForwardingChannel`, `twisted.conch.ssh.session.SSHSession`, `twisted.conch.endpoints._CommandChannel`
the name of the channel.
remoteClosed: `bool` = (source)
True if the other side isn't accepting more data.
remoteMaxPacket: `int` = (source)
the maximum size of a packet the remote side will accept in bytes.
remoteWindowLeft: `int` = (source)
how many bytes are left in the remote window.
specificData: `bytes` = (source)

Undocumented

_log = (source)
overridden in `twisted.conch.endpoints._CommandChannel`

Undocumented