![]() |
TrustCore SDK NanoSSH API reference
version 7.0
|
Functions | |
MOC_EXTERN void | SSHC_close (sbyte4 connectionInstance) |
Close an SSH session and releases all its resources. More... | |
MOC_EXTERN sbyte4 | SSHC_connect (TCP_SOCKET tempSocket, sbyte4 *pConnectionInstance, sbyte *pCommonName, struct certStore *pCertStore) |
Create a secure SSH connection with a remote server. More... | |
MOC_EXTERN sbyte4 | SSHC_getCookie (sbyte4 connectionInstance, void **pRetCookie) |
Get a connection's cookie containing custom (application-specific) information. More... | |
MOC_EXTERN sbyte4 | SSHC_init (sbyte4 numClientConnections) |
Initialize NanoSSH client internal structures. More... | |
MOC_EXTERN sbyte4 | SSHC_initiateReKey (sbyte4 connectionInstance, ubyte4 msAllowToComply) |
Initiate an SSH re-key operation. More... | |
MOC_EXTERN sbyte4 | SSHC_negotiateCloseChannel (sbyte4 connectionInstance, sbyte4 channelNumber) |
Negotiate closing of a channel. More... | |
MOC_EXTERN sbyte4 | SSHC_negotiateConnection (sbyte4 connectionInstance) |
Authenticate a server (which establishes a secure connection). More... | |
MOC_EXTERN sbyte4 | SSHC_negotiateSession (sbyte4 connectionInstance) |
Negotiate a connection (the client is authenticated by the server). More... | |
MOC_EXTERN sbyte4 | SSHC_negotiateSFTPHello (sbyte4 connectionInstance) |
Start a NanoSSH client SFTP session. More... | |
MOC_EXTERN sbyte4 | SSHC_negotiateSubsystemSFTPChannelRequest (sbyte4 connectionInstance) |
Send an SSH exec sftp command on the specified connection. More... | |
MOC_EXTERN sbyte4 | SSHC_numBytesTransmitted (sbyte4 connectionInstance, ubyte8 *pRetNumBytes) |
Get the number of bytes sent and received through a given connectionInstance. More... | |
MOC_EXTERN sbyte4 | SSHC_setCookie (sbyte4 connectionInstance, void *cookie) |
Save a cookie containing custom information. More... | |
MOC_EXTERN sbyte4 | SSHC_shutdown (void) |
Release memory initialized by SSHC_init(). More... | |
MOC_EXTERN sshClientSettings * | SSHC_sshClientSettings (void) |
Get a pointer to the session's NanoSSH Client settings. More... | |
MOC_EXTERN sbyte4 | SSHC_useThisCipher (sbyte4 connectionInstance, ubyte *pCipher) |
Set an SSH connection's cipher. More... | |
MOC_EXTERN sbyte4 | SSHC_useThisHmac (sbyte4 connectionInstance, ubyte *pHmac) |
Set an SSH connection's HMAC. More... | |
MOC_EXTERN void SSHC_close | ( | sbyte4 | connectionInstance | ) |
This function closes an SSH session and releases all resources that are managed by the NanoSSH client.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
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 SSHC_connect | ( | TCP_SOCKET | tempSocket, |
sbyte4 * | pConnectionInstance, | ||
sbyte * | pCommonName, | ||
struct certStore * | pCertStore | ||
) |
This function creates a connection context for a secure SSH connection with a remote server.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
tempSocket | Socket returned by OS-specific TCP connection call. |
pConnectionInstance | On return, pointer to new connection context. |
pCommonName | Expected common name of target server's certificate. |
pCertStore | Pointer to SoT Platform certificate store that contains the SSH connection's certificate (as a trust point or identify). |
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 SSHC_getCookie | ( | sbyte4 | connectionInstance, |
void ** | pRetCookie | ||
) |
This function retrieves custom (application-specific) information stored in the connection instance's context. Your application should not call this function until after it calls SSHC_setCookie().
(pRetCookie changed type)
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
pRetCookie | On return, pointer to cookie containing custom information. |
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 SSHC_init | ( | sbyte4 | numClientConnections | ) |
This function initializes NanoSSH client internal structures.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
numClientConnections | Maximum number of NanoSSH client connections to allow. |
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 SSHC_initiateReKey | ( | sbyte4 | connectionInstance, |
ubyte4 | msAllowToComply | ||
) |
This function initiates an SSH re-key operation. NanoSSH automatically processes re-key requests from an SSH client.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
msAllowToComply | Number of milliseconds to wait for an SSH client to respond before closing the session. Zero (0) indicates that the request is not being strictly enforced. |
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 SSHC_negotiateCloseChannel | ( | sbyte4 | connectionInstance, |
sbyte4 | channelNumber | ||
) |
This function negotiates the closing of the channel associated with channelNumber.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
channelNumber | Channel number of the channel we want to close. |
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 SSHC_negotiateConnection | ( | sbyte4 | connectionInstance | ) |
This function authenticates a server, establishing a secure connection.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
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 SSHC_negotiateSession | ( | sbyte4 | connectionInstance | ) |
This function negotiates a connection (the client is authenticated by the server), after which the SSH server can provide services requested by NanoSSH client.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
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 SSHC_negotiateSFTPHello | ( | sbyte4 | connectionInstance | ) |
This function starts a NanoSsH client SFTP session by negotiating an SFTP protocol version.
To enable this function, the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
__ENABLE_MOCANA_SSH_FTP_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
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 SSHC_negotiateSubsystemSFTPChannelRequest | ( | sbyte4 | connectionInstance | ) |
This function sends an SSH exec sftp
command on the specified connection.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
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 SSHC_numBytesTransmitted | ( | sbyte4 | connectionInstance, |
ubyte8 * | pRetNumBytes | ||
) |
This function returns (through the pRetNumBytes
parameter) the number of bytes sent and received through a given connectionInstance. Typical usage for this function is to determine when it's appropriate to initiate a re-key exchange operation.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
pRetNumBytes | On return, the number of bytes received and transmitted. |
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 SSHC_setCookie | ( | sbyte4 | connectionInstance, |
void * | cookie | ||
) |
This function saves a cookie containing custom (application-specific) information about the context connection. Your application should not call this function until after it calls SSHC_connect().
(pRetCookie changed type)
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
cookie | Custom information (the cookie). |
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 SSHC_shutdown | ( | void | ) |
This function releases memory that was initialized by SSHC_init().
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
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 sshClientSettings* SSHC_sshClientSettings | ( | void | ) |
This function returns a pointer to the session's NanoSSH client settings.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
MOC_EXTERN sbyte4 SSHC_useThisCipher | ( | sbyte4 | connectionInstance, |
ubyte * | pCipher | ||
) |
This function explicitly sets the cipher used by the specified SSH connection (instead of enabling automatic cipher selection). Because this function requires a valid connection instance, the function cannot be called until after a call to SSHC_connect().
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
pCipher | Pointer to string containing the desired cipher name (see sshc.hipher_suites). |
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 SSHC_useThisHmac | ( | sbyte4 | connectionInstance, |
ubyte * | pHmac | ||
) |
This function explicitly sets the HMAC used by the specified SSH connection (instead of enabling automatic HMAC selection). Because this function requires a valid connection instance, the function cannot be called until after a call to SSHC_connect().
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSH_CLIENT__
connectionInstance | Connection instance returned from SSHC_connect(). |
pHmac | Pointer to string containing the desired HMAC name (an entry in the mHmacSuites array, declared in sshc_trans.c). |
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.