![]() |
TrustCore SDK NanoSSH API reference
version 7.0
|
Functions | |
MOC_EXTERN sbyte4 | SSH_ASYNC_acceptConnection (TCP_SOCKET tempSocket, ubyte *pClientHelloString, ubyte4 clientHelloStringLength, ubyte *pServerHelloString, ubyte4 serverHelloStringLength) |
Register a secure SSH asynchronous connection and exchange public/private encryption keys. More... | |
MOC_EXTERN sbyte4 | SSH_ASYNC_closeConnection (sbyte4 connectionInstance) |
Close a NanoSSH server session and releases all its resources. More... | |
MOC_EXTERN sbyte4 | SSH_ASYNC_init (sbyte4 sshMaxConnections) |
Initialize NanoSSH server internal structures. More... | |
MOC_EXTERN sbyte4 | SSH_ASYNC_setListeningPort (ubyte4 listeningPort) |
Set NanoSSH server listening port. More... | |
MOC_EXTERN sbyte4 | SSH_ASYNC_startProtocolV2 (sbyte4 connectionInstance) |
Initiate sending a hello message. More... | |
MOC_EXTERN sbyte4 SSH_ASYNC_acceptConnection | ( | TCP_SOCKET | tempSocket, |
ubyte * | pClientHelloString, | ||
ubyte4 | clientHelloStringLength, | ||
ubyte * | pServerHelloString, | ||
ubyte4 | serverHelloStringLength | ||
) |
This function registers a secure SSH asynchronous connection, exchanges public/private encryption keys, and returns the connection's instance.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
tempSocket | Socket or TCB identifier returned by a call to accept() . |
pClientHelloString | (Optional) Pointer to hello string received from client. |
clientHelloStringLength | (Optional) Number of bytes in hello string received from client (pClientHelloString ). |
pServerHelloString | (Optional) Pointer to hello string sent to client. |
serverHelloStringLength | (Optional) Number of bytes in hello string sent to client (pServerHelloString ). |
DISPLAY_ERROR
macro.MOC_EXTERN sbyte4 SSH_ASYNC_closeConnection | ( | sbyte4 | connectionInstance | ) |
This function closes a NanoSSH server session and releases all the resources that are managed by the NanoSSH server.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
connectionInstance | Connection instance returned from SSH_ASYNC_acceptConnection(). |
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.MOC_EXTERN sbyte4 SSH_ASYNC_init | ( | sbyte4 | sshMaxConnections | ) |
This function initializes NanoSSH server internal structures. It should be called before starting your SSH daemon.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
sshMaxConnections | Maximum number of SSH asynchronous server connections to allow. (Each connection requires only a few bytes of memory.) |
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.MOC_EXTERN sbyte4 SSH_ASYNC_setListeningPort | ( | ubyte4 | listeningPort | ) |
This function resets the NanoSSH server's listening port from its default (port 22) to any desired port. To reset the port, you must call this function immediately after calling SSH_ASYNC_init().
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
listeningPort | Listening port number. |
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.MOC_EXTERN sbyte4 SSH_ASYNC_startProtocolV2 | ( | sbyte4 | connectionInstance | ) |
This function initiates sending a hello
message, contrary to the typical sequence of sending a hello
in response to receiving a client hello. Use this function only in the rare instance that you are using two SSH stacks on the same port.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
connectionInstance | Connection instance returned from SSH_ASYNC_acceptConnection. |
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.