TrustCore SDK NanoSSH API reference  version 7.0
General Purpose Callbacks

Variables

void(* sshClientSettings::funcPtrAuthOpen )(sbyte4 connectionInstance)
 Inform the calling application that authentication has been successful. More...
 
sbyte4(* sshClientSettings::funcPtrDisplayBanner )(sbyte4 connectionInstance, ubyte *pBanner, ubyte4 length, ubyte *pMsgLanguageTag)
 Display a warning message from the server. More...
 
sbyte4(* sshClientSettings::funcPtrRetrieveUserAuthRequestInfo )(sbyte4 connectionInstance, ubyte *pAuthNameList, ubyte4 authNameListLen, ubyte **ppUserName, ubyte4 *pUserNameLength, ubyte4 *pMethod)
 Select which authentication methods can be used with the server. More...
 
sbyte4(* sshClientSettings::funcPtrRetrieveUserAuthRequestInfoEx )(sbyte4 connectionInstance, ubyte messageCode, ubyte4 methodType, ubyte *pAuthNameList, ubyte4 authNameListLen, ubyte **ppUserName, ubyte4 *pUserNameLength, ubyte4 *pMethod, intBoolean *pSendSignature)
 Select which authentication methods can be used with the server, and decide whether to query if server supports authentication method first. More...
 
sbyte4(* sshClientSettings::funcPtrRetrieveUserPassword )(sbyte4 connectionInstance, ubyte *pUserName, ubyte4 userNameLength, ubyte **ppUserPassword, ubyte4 *pUserPasswordLength)
 Return user's password and its length. More...
 
sbyte4(* sshClientSettings::funcPtrSessionOpenFail )(sbyte4 connectionInstance, ubyte *pInfo, ubyte4 infoLength, ubyte *pLanguage, ubyte4 languageLength)
 Respond to a failed session open request. More...
 
MSTATUS(* sshClientSettings::funcPtrSessionReKey )(sbyte4 connectionInstance, intBoolean initiatedByRemote)
 Inform the calling application that Session Rekey has been initiated. More...
 
void(* sshClientSettings::funcPtrStartTimer )(sbyte4 connectionInstance, ubyte4 msTimerExpire, sbyte4 boolUserAuthenticated)
 Start a timer to use for timeout notifications. More...
 

Detailed Description

Variable Documentation

◆ funcPtrAuthOpen

void(* sshClientSettings::funcPtrAuthOpen) (sbyte4 connectionInstance)

This callback function is invoked after successful authentication; it should inform the calling application that authentication has been successful.

Callback registration happens at session creation and initialization by assigning your custom callback function (which can have any name) to this callback pointer.

Since
1.41
Version
1.41 and later

There are no flag dependencies to enable this callback.

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
Returns
None.

sshc.h

◆ funcPtrDisplayBanner

sbyte4(* sshClientSettings::funcPtrDisplayBanner) (sbyte4 connectionInstance, ubyte *pBanner, ubyte4 length, ubyte *pMsgLanguageTag)

This callback function is invoked during authentication to display a warning message from the server.

Callback registration happens at session creation and initialization by assigning your custom callback function (which can have any name) to this callback pointer.

Since
5.4
Version
5.4 and later
Parameters
connectionInstancePointer to the SSH client instance.
pBannerPointer to the banner string to display.
lengthNumber of bytes in the banner string (pBanner).
pMsgLanguageTagPointer to the banner string language tag to be displayed on the screen.

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

  • __ENABLE_MOCANA_SSH_AUTH_BANNER__
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
You should define and customize this hookup function for your application if SSH is configured to use digital certificates for authentication.

sshc.h

◆ funcPtrRetrieveUserAuthRequestInfo

sbyte4(* sshClientSettings::funcPtrRetrieveUserAuthRequestInfo) (sbyte4 connectionInstance, ubyte *pAuthNameList, ubyte4 authNameListLen, ubyte **ppUserName, ubyte4 *pUserNameLength, ubyte4 *pMethod)

This callback function is invoked when the SSH server requests that NanoSSH client authenticate itself; it should select which authentication methods can be used with the server.

Callback registration happens at session creation and initialization by assigning your custom callback function (which can have any name) to this callback pointer.

Since
1.41
Version
1.41 and later

There are no flag dependencies to enable this callback.

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
pAuthNameListPointer to a comma-separated name-list of authentication 'method name' values.
authNameListLenNumber of characters (bytes) in the name-list (pAuthNameList).
ppUserNameOn return, pointer to address of user name buffer.
pUserNameLengthOn return, pointer to number of characters (bytes) in the user name (ppUserName).
pMethodOn return, pointer to bit mask of selected authentication method:

  • MOCANA_SSH_AUTH_PUBLIC_KEY
  • MOCANA_SSH_AUTH_PASSWORD
  • MOCANA_SSH_AUTH_KEYBOARD_INTERACTIVE
  • MOCANA_SSH_AUTH_NONE
  • MOCANA_SSH_AUTH_CERT
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.

sshc.h

◆ funcPtrRetrieveUserAuthRequestInfoEx

sbyte4(* sshClientSettings::funcPtrRetrieveUserAuthRequestInfoEx) (sbyte4 connectionInstance, ubyte messageCode, ubyte4 methodType, ubyte *pAuthNameList, ubyte4 authNameListLen, ubyte **ppUserName, ubyte4 *pUserNameLength, ubyte4 *pMethod, intBoolean *pSendSignature)

This callback function is invoked when the SSH server requests that NanoSSH client authenticate itself; it should select which authentication methods that can be used with the server.

Callback registration happens at session creation and initialization by assigning your custom callback function (which can have any name) to this callback pointer.

Since
1.41
Version
1.41 and later

There are no flag dependencies to enable this callback.

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
messageCodeThe message code recieved by client. The message codes supported are the following:

  • SSH_MSG_SERVICE_ACCEPT
  • SSH_MSG_USERAUTH_FAILURE
  • SSH_MSG_USERAUTH_PK_OK
methodTypeThe authentication method value associated with the messageCode recieved. If the value of messageCode is SSH_MSG_SERVICE_ACCEPT, this value hasn't been defined yet.
pAuthNameListPointer to a comma-separated name-list of authentication 'method name' values.
authNameListLenNumber of characters (bytes) in the name-list (pAuthNameList).
ppUserNameOn return, pointer to address of user name buffer.
pUserNameLengthOn return, pointer to number of characters (bytes) in the user name (ppUserName).
pMethodOn return, pointer to bit mask of selected authentication method:

  • MOCANA_SSH_AUTH_PUBLIC_KEY
  • MOCANA_SSH_AUTH_PASSWORD
  • MOCANA_SSH_AUTH_KEYBOARD_INTERACTIVE
  • MOCANA_SSH_AUTH_NONE
  • MOCANA_SSH_AUTH_CERT
pSendSignatureOn return, pointer to intBoolean used to determine whether signature is sent in authentication message. If TRUE, signature is sent.
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.

sshc.h

◆ funcPtrRetrieveUserPassword

sbyte4(* sshClientSettings::funcPtrRetrieveUserPassword) (sbyte4 connectionInstance, ubyte *pUserName, ubyte4 userNameLength, ubyte **ppUserPassword, ubyte4 *pUserPasswordLength)

This callback function is invoked when the SSH server requests authentication; it should return the user's password and its length.

Callback registration happens at session creation and initialization by assigning your custom callback function (which can have any name) to this callback pointer.

Since
1.41
Version
1.41 and later

There are no flag dependencies to enable this callback.

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
pUserNamePointer to user name buffer.
userNameLengthNumber of characters (bytes) in the user name (userName).
ppUserPasswordOn return, pointer to address of user password buffer.
pUserPasswordLengthOn return, pointer to number of characters in user password (ppUserPassword).
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.

sshc.h

◆ funcPtrSessionOpenFail

sbyte4(* sshClientSettings::funcPtrSessionOpenFail) (sbyte4 connectionInstance, ubyte *pInfo, ubyte4 infoLength, ubyte *pLanguage, ubyte4 languageLength)

This callback function is invoked when the SSH Client attempts to open a service, but fails because the service is not available on the server. This callback function should try a different service or return an error code.

Callback registration happens at session creation and initialization by assigning your custom callback function (which can have any name) to this callback pointer.

Since
1.41
Version
1.41 and later

There are no flag dependencies to enable this callback.

Parameters
connectionInstanceConnection instance returned from SSHC_connect().
pInfoPointer to text explaining why the session was closed.
infoLengthNumber of bytes in text explanation (pInfo).
pLanguagePointer to language tag as defined in RFC 1766, Tags for the Identification of Languages; includes the ISO 639 2-letter language code.
languageLengthNumber of bytes in language tag (pLanguage).
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.

sshc.h

◆ funcPtrSessionReKey

MSTATUS(* sshClientSettings::funcPtrSessionReKey) (sbyte4 connectionInstance, intBoolean initiatedByRemote)

This callback function is invoked on rekey negotiation start (initiated locally or by remote) - allowing the application to take update session context.

Since
3.06
Version
3.06 and later

There are no flag dependencies to enable this callback.

Parameters
connectionInstanceConnection instance returned from SSHC_connect.
initiatedByRemoteTrue if the rekey was initiated by remote.
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.

◆ funcPtrStartTimer

void(* sshClientSettings::funcPtrStartTimer) (sbyte4 connectionInstance, ubyte4 msTimerExpire, sbyte4 boolUserAuthenticated)

This callback starts a timer to use for timeout notifications.

Callback registration happens at session creation and initialization by assigning your custom callback function (which can have any name) to this callback pointer.

Since
2.02
Version
2.02 and later

There are no flag dependencies to enable this callback.

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_acceptconnection().
msTimerExpireNumber of milliseconds until timer expires.
boolUserAuthenticated(Reserved for future use.)
Returns
None.

sshc.h