Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.11.1.2
openapi_ssh.h
Go to the documentation of this file.
1 
9 /*********************************************************************
10 *
11 * Copyright 2016-2022 Broadcom.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 **********************************************************************
26 *
27 * @filename openapi_ssh.h
28 *
29 * @purpose SSH Configuration and Status
30 *
31 * @component OpEN
32 *
33 * @create 30/01/2013
34 *
35 * @end
36 *
37 **********************************************************************/
38 #ifndef OPENAPI_SSH_H_INCLUDED
39 #define OPENAPI_SSH_H_INCLUDED
40 
41 #include "openapi_common.h"
42 #include "openapi_logging.h"
43 #include "openapi_transfer.h"
44 
46 typedef enum
47 {
52 
54 typedef enum
55 {
56  OPEN_SSH_PROTO_VERSION_1 = 0, /* SSH Protocol Version 1 option not supported */
60 
61 typedef enum
62 {
63  OPEN_SCP_OPER_NONE = 0,
64  OPEN_SCP_PUSH = 1,
65  OPEN_SCP_PULL = 2
66 } OPEN_SCP_OPER_t;
67 
68 #define OPEN_SSHD_KEY_DATA_SIZE_MAX 8192 /* L7_SSHD_KEY_DATA_SIZE_MAX */
69 /*****************************************************************/
89  OPEN_SSH_KEY_TYPE_t sshKeyType);
90 
91 /*****************************************************************/
109  OPEN_SSH_KEY_TYPE_t sshKeyType);
110 
111 /*****************************************************************/
131  OPEN_CONTROL_t sshAdminMode);
132 
133 /*****************************************************************/
149  OPEN_CONTROL_t *sshAdminMode);
150 
151 /*****************************************************************/
171  OPEN_SSH_PROTO_VERSION_t protoVersion);
172 
173 /*****************************************************************/
186  OPEN_SSH_PROTO_VERSION_t *protoVersion);
187 
188 /*****************************************************************/
206  uint32_t sshSessionTimeout);
207 
208 /*****************************************************************/
222  uint32_t *sshSessionTimeout);
223 
224 /*****************************************************************/
242  uint32_t sshMaxSessions);
243 
244 /*****************************************************************/
259 
260 /*****************************************************************/
273  uint32_t *sshMaxSessions);
274 
275 /*****************************************************************/
289  uint32_t *sshActiveSessions);
290 
291 /*****************************************************************/
305  uint32_t sshClientID);
306 
307 /*****************************************************************/
325  OPEN_SSH_KEY_TYPE_t sshKeyType);
326 
327 /*****************************************************************/
346  open_buffdesc *userName, open_buffdesc *password,
347  open_buffdesc *ipAddr, uint32_t sshClientID);
348 
349 /*****************************************************************/
367  open_buffdesc *userName, open_buffdesc *ipAddr,
368  uint32_t sshClientID);
369 
370 /*****************************************************************/
386  OPEN_CONTROL_t *sshdPubKeyAuthMode);
387 
388 /*****************************************************************/
406  OPEN_SSH_KEY_TYPE_t sshKeyType,
407  open_buffdesc *userName,
408  open_buffdesc *pubKey);
409 
410 /*****************************************************************/
426  OPEN_LOG_SEVERITY_t severity, open_buffdesc *fileName,
427  uint32_t lineNum, open_buffdesc *msgBuf);
428 
429 
430 /*****************************************************************/
444  open_buffdesc *userName,
445  open_buffdesc *password);
446 
447 /*****************************************************************/
464  uint32_t clientSockID,
465  open_buffdesc *password);
466 
467 /*****************************************************************/
484  OPEN_CONTROL_t scpServerAdminMode);
485 
486 /*****************************************************************/
503  OPEN_CONTROL_t *scpServerAdminMode);
504 
505 /*****************************************************************/
541  int32_t scpClientPID,
542  open_buffdesc *fileParams);
543 
544 /*****************************************************************/
563 
564 /*********************************************************************
565 * @purpose To get passphrase for SSH key decryption.
566 *
567 * @param[in] client_handle Client handle from registration API.
568 * @param[in] sshKeyType SSH host key type
569 * @param[out] bufPassphrase Buffer for passphrase
570 *
571 * @returns OPEN_E_NONE if successfully updated status.
572 * @returns OPEN_E_PARAM if invalid input parameters is passed.
573 * @returns OPEN_E_ERROR if failed to get passphrase.
574 *
575 * @note This OpEN API returns the passphrase used to decrypt the SSH host key
576 * in plain-text. Usage of this API is not recommended as this can
577 * be a security concern.
578 *
579 * @open-status-hidden
580 *
581 * @supportedinversion OpEN API Version: 1.21
582 *
583 * @end
584 *********************************************************************/
585 open_error_t openapiSSHKeyEncryptPassphraseGet(openapiClientHandle_t *client_handle,
586  OPEN_SSH_KEY_TYPE_t sshKeyType,
587  open_buffdesc *bufPassphrase);
588 /*****************************************************************/
625  int32_t scpClientPID,
626  open_buffdesc *fileParams);
627 
628 /*****************************************************************/
644  OPEN_TRANSFER_STATUS_t transferStatus,
645  OPEN_SCP_OPER_t transferType);
646 
647 /*****************************************************************/
661 
662 /*****************************************************************/
677 
678 /*************************************************************************/
696  uint32_t portNum);
697 
698 /*************************************************************************/
714  uint32_t *pPort);
715 
716 /*************************************************************************/
733  OPEN_BOOL_t *pSshV1Flag,
734  OPEN_BOOL_t *pSshV2Flag);
735 
736 /*************************************************************************/
756  OPEN_SSH_KEY_TYPE_t type, uint32_t length);
757 
758 /*************************************************************************/
775  OPEN_SSH_KEY_TYPE_t type,
776  uint32_t *pLength);
777 
778 /*************************************************************************/
795  OPEN_SSH_KEY_TYPE_t type,
796  uint32_t *pLength);
797 
798 /*************************************************************************/
815  OPEN_SSH_KEY_TYPE_t type,
816  open_buffdesc *pkeyData);
817 
818 #endif
819 
open_error_t openapiSshdKeyLenGet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t type, uint32_t *pLength)
Gets the length of the existing SSH key.
open_error_t openapiSSHPubKeyAuthModeGet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t *sshdPubKeyAuthMode)
Get the admin mode of SSH public key.
open_error_t openapiSSHTransferRemotePasswordFromUserGet(openapiClientHandle_t *client_handle, open_buffdesc *userName, open_buffdesc *password)
Get the remote password for the matching remote username used for transfer.
SSH Protocol Version 2.
Definition: openapi_ssh.h:57
open_error_t openapiSshdKeyLenSet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t type, uint32_t length)
Set the length for SSH Key to be generated.
open_error_t openapiSSHActiveSessionsGet(openapiClientHandle_t *client_handle, uint32_t *sshActiveSessions)
Get the active number of SSH sessions.
open_error_t openapiSSHLogMessage(openapiClientHandle_t *client_handle, OPEN_LOG_SEVERITY_t severity, open_buffdesc *fileName, uint32_t lineNum, open_buffdesc *msgBuf)
Log an SSH message in the log server.
open_error_t
OPEN uses these enumerators to indicate the error codes.
open_error_t openapiSshdPortNumSet(openapiClientHandle_t *client_handle, uint32_t portNum)
Sets the port number to be used for SSH Server.
open_error_t openapiScpServerAdminModeGet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t *scpServerAdminMode)
Get the SCP server admin mode.
open_error_t openapiSSHAdminModeSet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t sshAdminMode)
Set the admin mode of SSH.
open_error_t openapiScpTransferRemoteComplete(openapiClientHandle_t *client_handle, OPEN_TRANSFER_STATUS_t transferStatus, OPEN_SCP_OPER_t transferType)
To update application about the completion of scp remote file transfer.
open_error_t openapiSshdPortNumGet(openapiClientHandle_t *client_handle, uint32_t *pPort)
Gets ssh server port number.
open_error_t openapiSSHMaxSessionsGet(openapiClientHandle_t *client_handle, uint32_t *sshMaxSessions)
Get the maximum number of SSH sessions allowed.
open_error_t openapiSSHUserAuthenticate(openapiClientHandle_t *client_handle, open_buffdesc *userName, open_buffdesc *password, open_buffdesc *ipAddr, uint32_t sshClientID)
Authenticate SSH User.
open_error_t openapiSSHKeyGenerate(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType)
Generate SSH key pairs.
open_error_t openapiSSHSessionTimeoutGet(openapiClientHandle_t *client_handle, uint32_t *sshSessionTimeout)
Get the SSH session idle timeout value.
open_error_t openapiSSHTaskCleanup(openapiClientHandle_t *client_handle)
Stop/cleanup ssh task.
open_error_t openapiScpRemoteTransferStart(openapiClientHandle_t *client_handle, int32_t scpClientPID, open_buffdesc *fileParams)
To get the download file complete path and initiate transfer process.
SSH Key Type DSA.
Definition: openapi_ssh.h:49
OPEN_LOG_SEVERITY_t
OpEN uses this enumeration to define Logging Severity Levels.
SSH Key Type RSA.
Definition: openapi_ssh.h:48
open_error_t openapiSshdKeyDataGet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t type, open_buffdesc *pkeyData)
Gets key data for a specific key type.
open_error_t openapiSshdProtoLevelFlagsGet(openapiClientHandle_t *client_handle, OPEN_BOOL_t *pSshV1Flag, OPEN_BOOL_t *pSshV2Flag)
Gets ssh version flags.
open_error_t openapiSSHKeyStatusGet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType)
Check the status of SSH key.
open_error_t openapiSSHProtocolVersionGet(openapiClientHandle_t *client_handle, OPEN_SSH_PROTO_VERSION_t *protoVersion)
Get the SSH protocol version.
open_error_t openapiScpRemoteTransferComplete(openapiClientHandle_t *client_handle)
To update application about the completion of scp remote file transfer.
open_error_t openapiSSHSessionTimeoutSet(openapiClientHandle_t *client_handle, uint32_t sshSessionTimeout)
Set the SSH session idle timeout.
open_error_t openapiScpServerAdminModeSet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t scpServerAdminMode)
Set the SCP server admin mode to initiate file transfer.
open_error_t openapiSSHAdminModeGet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t *sshAdminMode)
Get the admin mode of SSH.
SSH Key Type ECDSA.
Definition: openapi_ssh.h:50
open_error_t openapiSSHPublicUserAuthenticate(openapiClientHandle_t *client_handle, open_buffdesc *userName, open_buffdesc *ipAddr, uint32_t sshClientID)
Authenticate SSH User.
open_error_t openapiSSHMaxSessionsSet(openapiClientHandle_t *client_handle, uint32_t sshMaxSessions)
Set the maximum number of allowed SSH sessions.
open_error_t openapiSSHPubKeyGet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType, open_buffdesc *userName, open_buffdesc *pubKey)
Get the SSH public key for specified user.
OPEN_CONTROL_t
OPEN uses these enumerators to indicate enable or disable for a given config or status parameter...
OPEN_BOOL_t
OPEN uses these enumerators to indicate true or false for a given config or status parameter...
open_error_t openapiScpTransferStatusSet(openapiClientHandle_t *client_handle)
To update application about the status of scp remote file transfer.
open_error_t openapiSSHSocketInfoClear(openapiClientHandle_t *client_handle, uint32_t sshClientID)
Clear socket info entry.
open_error_t openapiSSHMaxSessionsDefaultSet(openapiClientHandle_t *client_handle)
Set the maximum number of allowed SSH sessions to the default.
open_error_t openapiSSHProtocolVersionSet(openapiClientHandle_t *client_handle, OPEN_SSH_PROTO_VERSION_t protoVersion)
Set the SSH protocol version.
open_error_t openapiSSHKeyDelete(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType)
Delete the generated SSH key pairs.
open_error_t openapiSshdCfgKeyLenGet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t type, uint32_t *pLength)
Gets the configured key length of SSH key.
OPEN_SSH_KEY_TYPE_t
OpEN uses this enumeration to define SSH key types.
Definition: openapi_ssh.h:46
open_error_t openapiSSHRemotePasswordGet(openapiClientHandle_t *client_handle, uint32_t clientSockID, open_buffdesc *password)
Get the remote password for the matching client Socket ID for outbound SSH .
OPEN_SSH_PROTO_VERSION_t
OpEN uses this enumeration to define SSH protocol versions.
Definition: openapi_ssh.h:54
open_error_t openapiScpRemoteTransferUploadStart(openapiClientHandle_t *client_handle, int32_t scpClientPID, open_buffdesc *fileParams)
To get the upload file complete path and initiate transfer process.
OPEN_TRANSFER_STATUS_t
OPEN File Transfer Status.
SSH Protocol Version Both (1 and 2) option not supported.
Definition: openapi_ssh.h:58