TrustCore SDK NanoSSH API reference  version 7.0
Protocol-Specific Callbacks

Variables

sbyte4(* sshSettings::funcPtrBreakOp )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Respond to a client's break message. More...
 
sbyte4(* sshSettings::funcPtrCloseChannel )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Respond to a client's close channel request. More...
 
sbyte4(* sshSettings::funcPtrClosed )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Respond to a client's close connection request. More...
 
sbyte4(* sshSettings::funcPtrEof )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Respond to a connection close request. More...
 
sbyte4(* sshSettings::funcPtrExec )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Notify the NanoSSH server when a client issues a command. More...
 
sbyte4(* sshSettings::funcPtrOpenSftp )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Respond to the opening of a client SFTP session. More...
 
sbyte4(* sshSettings::funcPtrOpenShell )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Respond to the establishment of a secure session. More...
 
sbyte4(* sshSettings::funcPtrPtyRequest )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Respond to receipt of a client's terminal emulation settings. More...
 
sbyte4(* sshSettings::funcPtrReceivedData )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 (Optional) Custom receive data handler. More...
 
sbyte4(* sshSettings::funcPtrReplyPing )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 (Optional) Respond to a Ping message. More...
 
sbyte4(* sshSettings::funcPtrSessionOpen )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Respond to a client session request. More...
 
sbyte4(* sshSettings::funcPtrStdErr )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Process text data sent to stderr. More...
 
sbyte4(* sshSettings::funcPtrWindowChange )(sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte *pMesg, ubyte4 mesgLen)
 Respond to a change in a client's terminal window size. More...
 

Detailed Description

Variable Documentation

◆ funcPtrBreakOp

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

This function is invoked when a client sends a break message (message type SSH_SESSION_BREAK_OP). Not all applications will send this message.

Since
1.41
Version
1.41 and later

To enable this function, 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.
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

◆ funcPtrCloseChannel

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

This function is invoked when a client requests for the channel with the NanoSSH server be closed (message type SSH_SESSION_CHANNEL_CLOSED).

Since
1.41
Version
1.41 and later

To enable this function, 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.
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

◆ funcPtrClosed

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

This function is invoked when a client's connection with the NanoSSH server is closed (message type SSH_SESSION_CLOSED).

Since
1.41
Version
1.41 and later

To enable this function, 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.
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

◆ funcPtrEof

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

This function is invoked when a client requests that its connection to the NanoSSH server be closed (message type SSH_SESSION_EOF). Upon receiving this event, your application should perform cleanup and shutdown operations.

Since
1.41
Version
1.41 and later

To enable this function, 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.
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

◆ funcPtrExec

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

This function notifies the NanoSSH server that an SSH client is requesting an open channel for command execution. The function is invoked when a client sends a break message (message type SSH_SESSION_OPEN_EXEC), as described in RFC 4254, Secure Shell (SSH) Connection Protocol, section 6.5.

Since
1.41
Version
1.41 and later

To enable this function, 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.
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

◆ funcPtrOpenSftp

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

This callback function is invoked when a client opens an SFTP session to the NanoSSH server (message type SSH_SESSION_OPEN_SFTP).

Since
1.41
Version
1.41 and later

To enable this function, 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.
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

◆ funcPtrOpenShell

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

This callback function is invoked when a secure session is established after authentication (message type SSH_SESSION_OPEN_SHELL).

Since
1.41
Version
1.41 and later

To enable this function, 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.
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

◆ funcPtrPtyRequest

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

This callback function is invoked when a client sends terminal emulation settings to the NanoSSH Server (message type SSH_SESSION_PTY_REQUEST).

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_SSH_SERVER__
  • __ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
Parameters
connectionInstancConnection 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.
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

◆ funcPtrReceivedData

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

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

Since
1.41
Version
1.41 and later

To enable this function, 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).
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

◆ funcPtrReplyPing

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

(Optional) This callback function is invoked when a Ping message is received. Your application can do anything when it receives this call, but no particular action is required.

Since
2.02
Version
2.02 and later

To enable this function, 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.
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

◆ funcPtrSessionOpen

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

This callback function is invoked when a client requests a session with the NanoSSH server, after the client is successfully authenticated (message type SSH_SESSION_OPEN). Your application can do anything when it receives this call, but no particular action is required.

Since
1.41
Version
1.41 and later

To enable this function, 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.
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

◆ funcPtrStdErr

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

This callback function is invoked when a client sends text data to stderr. Unless you've built a special application on top of SSH to use this text data, you can ignore this event (message type SSH_SESSION_STDERR).

Since
1.41
Version
1.41 and later

To enable this function, 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 message buffer.
mesgLenNumber of bytes in the message buffer (pMesg).
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

◆ funcPtrWindowChange

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

This callback function is invoked when a client's terminal window changes size. Your application can do anything when it receives this call, but no particular action is required.

Since
1.41
Version
1.41 and later

To enable this function, 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.
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