TrustCore SDK NanoSSH API reference  version 7.0

Functions

MOC_EXTERN sbyte4 SSH_getTerminalSettingDescr (sbyte4 connectionInstance, terminalState **ppTerminalSettings)
 Get a pointer to a connection instance's negotiated terminal settings. More...
 
MOC_EXTERN sbyte4 SSH_ioctl (sbyte4 connectionInstance, ubyte4 ioctlSelector, ubyte4 ioctlValue)
 Change a NanoSSH server setting value. More...
 
MOC_EXTERN sshSettingsSSH_sshSettings (void)
 Get a pointer to NanoSSH server settings. More...
 

Detailed Description

Function Documentation

◆ SSH_getTerminalSettingDescr()

MOC_EXTERN sbyte4 SSH_getTerminalSettingDescr ( sbyte4  connectionInstance,
terminalState **  ppTerminalSettings 
)

This function retrieves a pointer to the specified connection instance's negotiated terminal settings.

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().
ppTerminalSettingsOn return, pointer to the client's terminal settings.

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.
Note
This function should not be called until after the shell session has been established.
Remarks
This function is applicable to synchronous and asynchronous servers.

ssh.h

◆ SSH_ioctl()

MOC_EXTERN sbyte4 SSH_ioctl ( sbyte4  connectionInstance,
ubyte4  ioctlSelector,
ubyte4  ioctlValue 
)

This function dynamically updates a selected NanoSSH server setting.

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().
ioctlSelectorSetting to change, specified as an "SSH ioctls" definition from ssh.h; current option is limited to SET_SSH_MAX_SESSION_TIME_LIMIT.
ioctlValueValue to assign to the setting.

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.
if (OK > (ci = SSH_acceptConnection(socketClient)))
{
DEBUG_PRINTNL(DEBUG_SSH_EXAMPLE, "SSH_EXAMPLE_startServer: Too many open connections.");
TCP_CLOSE_SOCKET(socketClient);
continue;
}
DEBUG_PRINTNL(DEBUG_SSH_EXAMPLE, "SSH_EXAMPLE_startServer: Set max session time limit to 40 minutes.");
SSH_ioctl(ci, SET_SSH_MAX_SESSION_TIME_LIMIT, 40 * 60 * 1000);
if (OK > (status = RTOS_createThread(SSH_EXAMPLE_simpleDemo, (void*)ci, SSH_SESSION, &tid)))
{
DEBUG_PRINTNL(DEBUG_SSH_EXAMPLE, "SSH_EXAMPLE_startServer: Too many open connections.");
TCP_CLOSE_SOCKET(socketClient);
goto exit;
}

ssh.h

◆ SSH_sshSettings()

MOC_EXTERN sshSettings* SSH_sshSettings ( void  )

This function returns a pointer to NanoSSH server settings that can be dynamically adjusted during initialization or runtime.

The default values for the following basic settings are suitable for most systems:

SSH_sshSettings()->sshListenPort = 22; SSH_sshSettings()->sshMaxAuthAttempts = 20; SSH_sshSettings()->sshTimeOutOpen = 2000; SSH_sshSettings()->sshTimeOutKeyExchange = 10000; SSH_sshSettings()->sshTimeOutNewKeys = 15000; SSH_sshSettings()->sshTimeOutServiceRequest = 4000; SSH_sshSettings()->sshTimeOutAuthentication = 1000 * 60 * 10; SSH_sshSettings()->sshTimeOutDefaultOpenState = 0; // no timeout SSH_sshSettings()->sshMaxConnections = 4;

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_SSH_SERVER__

ssh.h

Returns
Pointer to NanoSSH Server settings.
Remarks
This function is applicable to synchronous servers.

ssh.h