OpenSSH tools and utilities TAPI (tapi_ssh)

Overview

TAPI to handle OpenSSH tools and utilities. More…

// typedefs

typedef struct tapi_ssh tapi_ssh_t;
typedef enum tapi_ssh_permit_root_login tapi_ssh_permit_root_login_t;
typedef enum tapi_ssh_strict_host_key_checking tapi_ssh_strict_host_key_checking_t;
typedef struct tapi_ssh_client_opt tapi_ssh_client_opt;
typedef struct tapi_ssh_server_opt tapi_ssh_server_opt;

// enums

enum tapi_ssh_permit_root_login;
enum tapi_ssh_strict_host_key_checking;

// structs

struct tapi_ssh;
struct tapi_ssh_client_opt;
struct tapi_ssh_server_opt;

// global variables

const tapi_ssh_client_opt tapi_ssh_client_opt_default_opt;
const tapi_ssh_server_opt tapi_ssh_server_opt_default_opt;

// global functions

te_errno tapi_ssh_create_client(tapi_job_factory_t* factory, const tapi_ssh_client_opt* opt, tapi_ssh_t** client_app);
te_errno tapi_ssh_create_server(tapi_job_factory_t* factory, const tapi_ssh_server_opt* opt, tapi_ssh_t** server_app);
te_errno tapi_ssh_start_app(tapi_ssh_t* app);
te_errno tapi_ssh_wait_app(tapi_ssh_t* app, int timeout_ms);
te_errno tapi_ssh_kill_app(tapi_ssh_t* app, int signo);
te_errno tapi_ssh_destroy_app(tapi_ssh_t* app);
te_errno tapi_ssh_client_wrapper_add(tapi_ssh_t* app, const char* tool, const char** argv, tapi_job_wrapper_priority_t priority, tapi_job_wrapper_t** wrap);

// macros

#define TAPI_SSH_APP_WAIT_TIME_MS
#define TAPI_SSH_NB_CHANNELS

Detailed Documentation

TAPI to handle OpenSSH tools and utilities.

Copyright (C) 2022-2022 OKTET Labs Ltd. All rights reserved.

Typedefs

typedef enum tapi_ssh_permit_root_login tapi_ssh_permit_root_login_t

Representation of possible values for PermitRootLogin sshd option

typedef enum tapi_ssh_strict_host_key_checking tapi_ssh_strict_host_key_checking_t

Representation of possible values for StrictHostKeyChecking ssh option

typedef struct tapi_ssh_client_opt tapi_ssh_client_opt

OpenSSH client specific options

typedef struct tapi_ssh_server_opt tapi_ssh_server_opt

OpenSSH server specific options

Global Variables

const tapi_ssh_client_opt tapi_ssh_client_opt_default_opt

Default ssh options initializer

const tapi_ssh_server_opt tapi_ssh_server_opt_default_opt

Default sshd options initializer

Global Functions

te_errno tapi_ssh_create_client(tapi_job_factory_t* factory, const tapi_ssh_client_opt* opt, tapi_ssh_t** client_app)

Create ssh client app.

Parameters:

factory

Client job factory.

opt

Command line options.

client_app

Client app handle.

Returns:

Status code.

te_errno tapi_ssh_create_server(tapi_job_factory_t* factory, const tapi_ssh_server_opt* opt, tapi_ssh_t** server_app)

Create sshd server app.

Parameters:

factory

Server job factory.

opt

Command line options.

server_app

Server app (sshd) handle.

Returns:

Status code.

te_errno tapi_ssh_start_app(tapi_ssh_t* app)

Start entity app.

app entity may be ssh or sshd.

Parameters:

app

Entity app handle.

Returns:

Status code.

te_errno tapi_ssh_wait_app(tapi_ssh_t* app, int timeout_ms)

Wait for completion of entity app.

app entity may be ssh or sshd.

Parameters:

app

Entity app handle.

timeout_ms

Wait timeout in milliseconds (negative means tapi_job_get_timeout()).

Returns:

Status code.

te_errno tapi_ssh_kill_app(tapi_ssh_t* app, int signo)

Send a signal to entity app.

app entity may be ssh or sshd.

Parameters:

app

Entity app handle.

signo

Signal to send to client.

Returns:

Status code.

te_errno tapi_ssh_destroy_app(tapi_ssh_t* app)

Destroy entity app.

app entity may be ssh or sshd.

Parameters:

app

Entity app handle.

Returns:

Status code.

te_errno tapi_ssh_client_wrapper_add(tapi_ssh_t* app, const char* tool, const char** argv, tapi_job_wrapper_priority_t priority, tapi_job_wrapper_t** wrap)

Add a wrapper tool/script to OpenSSH.

Parameters:

app

SSH client app handle.

tool

Path to the wrapper tool.

argv

Wrapper arguments (last item should be NULL).

priority

Wrapper priority.

wrap

Wrapper instance handle.

Returns:

Status code.

Macros

#define TAPI_SSH_APP_WAIT_TIME_MS

Timeout to wait for completion of entity app

#define TAPI_SSH_NB_CHANNELS

Number of tapi_job output channels