TrustCore SDK NanoSSH API reference  version 7.0
ssh.h File Reference

NanoSSH server developer API header. More...

Go to the source code of this file.

Data Structures

struct  keyIntInfoReq
 
struct  keyIntInfoResp
 
struct  keyIntPrompt
 
struct  keyIntResp
 
struct  sshSettings
 Configuration settings and callback function pointers for NanoSSH servers. More...
 
struct  terminalState
 

Typedefs

typedef struct certChain * certChainPtr
 

Enumerations

enum  asyncWaitEvents { kNotWaiting = 0, kWaitingForAuth, kWaitingForHwOffload }
 
enum  sshSessionTypes {
  SSH_SESSION_NOTHING, SSH_SESSION_OPEN, SSH_SESSION_OPEN_PF, SSH_SESSION_PTY_REQUEST,
  SSH_SESSION_OPEN_SHELL, SSH_SESSION_OPEN_SFTP, SSH_SESSION_OPEN_EXEC, SSH_SESSION_WINDOW_CHANGE,
  SSH_SESSION_DATA, SSH_SESSION_STDERR, SSH_SESSION_EOF, SSH_SESSION_CLOSED,
  SSH_SESSION_CHANNEL_CLOSED, SSH_PF_CLOSED, SSH_PF_EOF, SSH_SESSION_BREAK_OP,
  SSH_SESSION_PING_REPLY, SSH_PF_DATA
}
 

Functions

MOC_EXTERN sbyte4 SSH_acceptConnection (TCP_SOCKET socket)
 Register an SSH client-server connection and get its connection instance. More...
 
MOC_EXTERN sbyte4 SSH_ackPortFwdReceivedMessageBytes (sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte4 numBytesAck, ubyte4 channel)
 Send an acknowledgement that data was received by the server. More...
 
MOC_EXTERN sbyte4 SSH_assignCertificateStore (sbyte4 connectionInstance, certStorePtr pCertStore)
 Associate host keys with a connection. More...
 
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_ackReceivedMessageBytes (sbyte4 connectionInstance, enum sshSessionTypes sessionEvent, ubyte4 numBytesAck)
 Send an acknowledgement that data was received by the server. 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_recvContinueMessage (sbyte4 connectionInstance, sbyte4 result)
 Resume (continue) an authentication process that was waiting for a result. More...
 
MOC_EXTERN sbyte4 SSH_ASYNC_recvMessage (sbyte4 connectionInstance, ubyte *pBytesReceived, ubyte4 numBytesReceived)
 Get data from a client. More...
 
MOC_EXTERN sbyte4 SSH_ASYNC_sendMessage (sbyte4 connectionInstance, sbyte *pBuffer, sbyte4 bufferSize, sbyte4 *pBytesSent)
 Send data to a client. More...
 
MOC_EXTERN sbyte4 SSH_ASYNC_sendMessagePending (sbyte4 connectionInstance, ubyte4 *pRetNumBytesPending)
 Determine whether there is data in a connection instance's SSH send buffer. 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_closeConnection (sbyte4 connectionInstance)
 Close an NanoSSH server session and releases its resources. More...
 
MOC_EXTERN sbyte4 SSH_compareAuthKeys (const ubyte *pPubKey, ubyte4 pubKeyLength, const ubyte *pFileKey, ubyte4 fileKeyLength, sbyte4 *pRetIsMatch)
 Authenticate a client by public key authentication. More...
 
MOC_EXTERN sbyte4 SSH_convertOldKeyBlobToNew (ubyte *pOldDsaPublicKeyBlob, ubyte4 oldDsaPublicKeyBlobLength, ubyte *pOldDsaPrivateKeyBlob, ubyte4 oldDsaPrivateKeyBlobLength, ubyte **ppRetNewKeyBlob, ubyte4 *pRetNewKeyBlobLength)
 Convert a key blob from NanoSSH version 1.41 and earlier formats to version 2.02 format. More...
 
MOC_EXTERN void SSH_disconnectAllClients (void)
 Disconnect all NanoSSH server clients. More...
 
MOC_EXTERN sbyte4 SSH_getCookie (sbyte4 connectionInstance, sbyte4 *pCookie)
 Get a connection context's custom information. More...
 
MOC_EXTERN sbyte4 SSH_getInstanceFromSocket (TCP_SOCKET socket)
 Get a socket's connection instance. More...
 
MOC_EXTERN sbyte4 SSH_getNextConnectionInstance (sbyte4 connectionInstance)
 Get the next connection instance from the active NanoSSH connection instance table. More...
 
MOC_EXTERN sbyte4 SSH_getSessionCryptoInfo (sbyte4 connectionInstance, sbyte **ppInCipherName, sbyte **ppInMacName, sbyte **ppOutCipherName, sbyte **ppOutMacName)
 Get a NanoSSH session's cipher names. More...
 
MOC_EXTERN sbyte4 SSH_getSocketId (sbyte4 connectionInstance, TCP_SOCKET *pRetSocket)
 Get a connection's socket identifier. More...
 
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_init (sbyte4 sshMaxConnections)
 Initialize NanoSSH server internal structures. More...
 
MOC_EXTERN sbyte4 SSH_initiateReKey (sbyte4 connectionInstance, ubyte4 msAllowToComply)
 Initiate an SSH re-key operation. More...
 
MOC_EXTERN sbyte4 SSH_ioctl (sbyte4 connectionInstance, ubyte4 ioctlSelector, ubyte4 ioctlValue)
 Change a NanoSSH server setting value. More...
 
MOC_EXTERN sbyte4 SSH_negotiateConnection (sbyte4 connectionInstance)
 Exchange keys and establishe a secure SSHv2 client-server connection. More...
 
MOC_EXTERN sbyte4 SSH_numBytesTransmitted (sbyte4 connectionInstance, ubyte8 *pRetNumBytes)
 Get the number of bytes sent and received through a given connectionInstance. More...
 
MOC_EXTERN sbyte4 SSH_recv (sbyte4 connectionInstance, sbyte4 *pMessageType, ubyte *pRetBuffer, ubyte4 bufferSize, sbyte4 *pNumBytesReceived, ubyte4 timeout)
 Get data from a server and decrypt the data. More...
 
MOC_EXTERN sbyte4 SSH_recvMessage (sbyte4 connectionInstance, sbyte4 *pMessageType, sbyte *pRetMessage, sbyte4 *pNumBytesReceived, ubyte4 timeout)
 Get an entire message from a server and decrypt the data. More...
 
MOC_EXTERN sbyte4 SSH_recvPending (sbyte4 connectionInstance, sbyte4 *pRetBooleanIsPending)
 Determine whether there is data in a connection instance's SSH receive buffer. More...
 
MOC_EXTERN sbyte4 SSH_releaseTables (void)
 Release NanoSSH server's internal memory tables. More...
 
MOC_EXTERN sbyte4 SSH_sendErrMessage (sbyte4 connectionInstance, sbyte *pBuffer, sbyte4 bufferSize, sbyte4 *pBytesSent)
 Send stderr error message output data over SSH. More...
 
MOC_EXTERN sbyte4 SSH_sendMessage (sbyte4 connectionInstance, sbyte *pBuffer, sbyte4 bufferSize, sbyte4 *pBytesSent)
 Send data to a client. More...
 
MOC_EXTERN sbyte4 SSH_sendPing (sbyte4 connectionInstance)
 Determine which connections are alive by pinging each open connection. More...
 
MOC_EXTERN sbyte4 SSH_sendPortForwardClose (sbyte4 connectionInstance, sbyte4 channel)
 Send an SSH CLOSE message to an SSH client whose local port forwarding socket is inactive. More...
 
MOC_EXTERN sbyte4 SSH_sendPortForwardMessage (sbyte4 connectionInstance, sbyte4 channel, sbyte *pBuffer, sbyte4 bufferSize, sbyte4 *pBytesSent)
 Send a message to a client over a secure SSH connection. More...
 
MOC_EXTERN sbyte4 SSH_sendPortFwdOpen (sbyte4 connectionInstance, ubyte *pConnectHost, ubyte4 connectPort, ubyte *pSrc, ubyte4 srcPort, ubyte4 *myChannel)
 
MOC_EXTERN sbyte4 SSH_setCookie (sbyte4 connectionInstance, sbyte4 cookie)
 Store custom information (a cookie) about the context connection. More...
 
MOC_EXTERN sbyte4 SSH_setErrorCode (sbyte4 connectionInstance, sbyte4 errorCode)
 
MOC_EXTERN sbyte4 SSH_setUserPortForwardingPermissions (sbyte4 connectionInstance, ubyte4 memberGroups)
 Set a connection's port forwarding access permission. More...
 
MOC_EXTERN sbyte4 SSH_shutdown (void)
 Disconnect all clients and shut down the NanoSSH server stack. More...
 
MOC_EXTERN sshSettingsSSH_sshSettings (void)
 Get a pointer to NanoSSH server settings. More...
 
MOC_EXTERN sbyte4 SSH_startServer (void)
 Start the NanoSSH server. More...
 
MOC_EXTERN void SSH_stopServer (void)
 Stop NanoSSH server from accepting any new client connections. More...
 
MOC_EXTERN sbyte4 SSH_useThisCipherList (sbyte4 connectionInstance, ubyte *pCipherList)
 Set a server's cipher list. More...
 
MOC_EXTERN sbyte4 SSH_useThisHmacList (sbyte4 connectionInstance, ubyte *pHmacList)
 Set a server's HMAC list. More...
 
MOC_EXTERN sbyte4 SSH_verifyPublicKeyFile (sbyte *pKeyFileData, ubyte4 fileSize)
 Verify that an RSA or DSS/DSA or ECC or EDDSA public key file format is valid. More...
 

Detailed Description

This header file contains definitions, enumerations, structures, and function declarations used by NanoSSH server.

Since
1.41
Version
4.0 and later

To build products using this header file, at least one of the following flags must be defined (in a file included before ssh.h is included):

  • __ENABLE_MOCANA_SSH_SERVER__
  • __ENABLE_MOCANA_SSH_ASYNC_SERVER_API__

Whether the following flags are defined determine which enumerations, structures, and function declarations are enabled:

  • __ENABLE_MOCANA_SSH_SERVER__
  • __ENABLE_MOCANA_SSH_ASYNC_SERVER_API__
  • __USE_MOCANA_SSH_SERVER__
  • __ENABLE_MOCANA_SSH_PORT_FORWARDING__

ssh.h