TrustCore SDK NanoSSH API reference  version 7.0
Port Forwarding Functions

Functions

MOC_EXTERN sbyte4 SSHC_doProtocolProcessPortForwardSession (sbyte4 connectionInstance, intBoolean useTimeout, ubyte4 timeout)
 
MOC_EXTERN sbyte4 SSHC_lpfRegisterConnection (sbyte4 connectionInstance, ubyte4 *pChannel)
 Register the port number on which to listen for port forwarding messages from the SSH server. More...
 
MOC_EXTERN sbyte4 SSHC_lpfSendMessage (sbyte4 connectionInstance, ubyte4 channel, sbyte *pBuffer, sbyte4 bufferSize, sbyte4 *pBytesSent)
 Send local port forwarding connection data from SSH client to SSH server. More...
 
MOC_EXTERN sbyte4 SSHC_lpfStartConnection (sbyte4 connectionInstance, ubyte4 channel, ubyte *pConnectHost, ubyte4 connectPort, ubyte *pSrcHost, ubyte4 srcPort)
 Start a port forwarding session. More...
 
MOC_EXTERN sbyte4 SSHC_lpfStopConnection (sbyte4 connectionInstance, ubyte4 channel)
 Stop port forwarding through the specified SSH connection. More...
 

Detailed Description

Function Documentation

◆ SSHC_doProtocolProcessPortForwardSession()

MOC_EXTERN sbyte4 SSHC_doProtocolProcessPortForwardSession ( sbyte4  connectionInstance,
intBoolean  useTimeout,
ubyte4  timeout 
)

Forward port forwarding messages from an SSH server to local ports. This function forwards port forwarding messages from an SSH server to local ports.

Since
3.06
Version
3.06 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_CLIENT__
  • __ENABLE_MOCANA_SSH_PORT_FORWARDING__

sshc.h

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
useTimeoutTRUE to use the dead man timer specified by the timeout parameter; FALSE otherwise.
timeoutNumber of milliseconds to wait for the forwarding result.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients.

sshc.h

◆ SSHC_lpfRegisterConnection()

MOC_EXTERN sbyte4 SSHC_lpfRegisterConnection ( sbyte4  connectionInstance,
ubyte4 *  pChannel 
)

This function registers the port number on which to listen for port forwarding messages from the SSH server.

Since
3.06
Version
3.06 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_CLIENT__
  • __ENABLE_MOCANA_SSH_PORT_FORWARDING__

sshc.h

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
pChannelPointer to port forwarding channel number through which to send the message.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients.

sshc.h

◆ SSHC_lpfSendMessage()

MOC_EXTERN sbyte4 SSHC_lpfSendMessage ( sbyte4  connectionInstance,
ubyte4  channel,
sbyte *  pBuffer,
sbyte4  bufferSize,
sbyte4 *  pBytesSent 
)

This function sends local port forwarding connection data from SSH client to SSH server.

Since
3.06
Version
3.06 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_CLIENT__
  • __ENABLE_MOCANA_SSH_PORT_FORWARDING__

sshc.h

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
channelPort forwarding channel number through which to send the message.
pBufferPointer to message to forward.
bufferSizeNumber of bytes in message to forward (pBuffer).
pBytesSentOn return, pointer to number of bytes forwarded.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients.

sshc.h

◆ SSHC_lpfStartConnection()

MOC_EXTERN sbyte4 SSHC_lpfStartConnection ( sbyte4  connectionInstance,
ubyte4  channel,
ubyte *  pConnectHost,
ubyte4  connectPort,
ubyte *  pSrcHost,
ubyte4  srcPort 
)

This function starts a port forwarding session by sending the required SSH message from SSH client to the SSH server.

Since
3.06
Version
3.06 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_CLIENT__
  • __ENABLE_MOCANA_SSH_PORT_FORWARDING__

sshc.h

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
channelPort forwarding channel number through which to send the message.
pConnectHostPointer to string representation of SSH server host computer IP address.
connectPortPort number through which to connect to the SSH server host.
pSrcHostPointer to string representation of originating computer IP address.
srcPortPort number of originating computer's forwarding connection.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients.

sshc.h

◆ SSHC_lpfStopConnection()

MOC_EXTERN sbyte4 SSHC_lpfStopConnection ( sbyte4  connectionInstance,
ubyte4  channel 
)

This function stops port forwarding (terminates the connection) by sending an SSH CLOSE message to the SSH server.

Since
3.06
Version
3.06 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_CLIENT__
  • __ENABLE_MOCANA_SSH_PORT_FORWARDING__

sshc.h

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
channelPort forwarding channel number through which to send the message.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients.

sshc.h