TrustCore SDK NanoSSH API reference  version 7.0
Port Forwarding Callbacks

Variables

sbyte4(* sshSettings::funcCancelTcpIpForward )(sbyte4 connectionInstance, ubyte4 dstPort)
 
sbyte4(* sshSettings::funcCheckPort )(ubyte4 dstPort)
 
sbyte4(* sshSettings::funcPortFwdPtrClosed )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen, ubyte4 channel)
 Respond to a client's close connection request. More...
 
sbyte4(* sshSettings::funcPortFwdPtrEof )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen, ubyte4 channel)
 Respond to a client's EOF request. More...
 
sbyte4(* sshSettings::funcPortFwdReceivedData )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen, ubyte4 channel)
 (Optional) Receive SSH port forwarding session data. More...
 
sbyte4(* sshSettings::funcPtrRemotePortFwdSessionOpen )(sbyte4 connectionInstance, ubyte4 channel, ubyte4 myChannel)
 
sbyte4(* sshSettings::funcStartTcpIpForward )(sbyte4 connectionInstance, ubyte *pSrc, ubyte4 dstport, ubyte4 orgPort)
 

Detailed Description

Variable Documentation

◆ funcPortFwdPtrClosed

sbyte4(* sshSettings::funcPortFwdPtrClosed) (sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen, ubyte4 channel)

This function is invoked when a client's connection with the NanoSSH server is closed for a port forwarding session (message type SSH_SESSION_CLOSED). This callback is applicable only to port forwarding.

Since
3.06
Version
3.06 and later

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

  • __ENABLE_MOCANA_SSH_PORT_FORWARDING__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_SERVER__
  • __ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
Parameters
connectionInstanceConnection instance returned from SSH_acceptConnection() or SSH_ASYNC_acceptConnection().
sessionEventAny of the sshSessionTypes enumerated values (see ssh.h).
pMesgNot used for this upcall.
mesgLenNot used for this upcall.
channelAssociated channel number on the client side.

ssh.h

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.

ssh.h

◆ funcPortFwdPtrEof

sbyte4(* sshSettings::funcPortFwdPtrEof) (sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen, ubyte4 channel)

This function is invoked when a client's connection with the NanoSSH server sends an EOF for a port forwarding session (message type SSH_SESSION_CLOSED). This callback is applicable only to port forwarding.

Since
3.06
Version
3.06 and later

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

  • __ENABLE_MOCANA_SSH_PORT_FORWARDING__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_SERVER__
  • __ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
Parameters
connectionInstanceConnection instance returned from SSH_acceptConnection() or SSH_ASYNC_acceptConnection().
sessionEventAny of the sshSessionTypes enumerated values (see ssh.h).
pMesgNot used for this upcall.
mesgLenNot used for this upcall.
channelAssociated channel number on the client side.
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.

ssh.h

◆ funcPortFwdReceivedData

sbyte4(* sshSettings::funcPortFwdReceivedData) (sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen, ubyte4 channel)

This callback function is invoked when the server receives text data from a client in a port forwarding session. Your application can do anything when it receives this call, but no particular action is required. This callback is applicable only to port forwarding.

Since
3.06
Version
3.06 and later

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

  • __ENABLE_MOCANA_SSH_PORT_FORWARDING__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_SERVER__
  • __ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
Parameters
connectionInstanceConnection instance returned from SSH_acceptConnection() or SSH_ASYNC_acceptConnection().
sessionEventAny of the sshSessionTypes enumerated values (see ssh.h).
pMesgPointer to received message.
mesgLenNumber of bytes in received message (pMesg).
channelAssociated channel number on the client side.
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.

ssh.h