Added CLIXON_CLIENT_SSH to client API to communicate remotely via SSH netconf sub-system

configure: stringified SSH_BIN
C-API: Added `sock_flags` parameter to `clixon_proc_socket()`
This commit is contained in:
Olof Hagsand 2022-12-08 13:26:39 +01:00
parent 100f15b699
commit 6baa904039
10 changed files with 171 additions and 95 deletions

View file

@ -42,11 +42,25 @@
typedef void *clixon_handle;
typedef void *clixon_client_handle;
/* Connection type as parameter to connect */
/* Connection type as parameter to connect
*/
typedef enum {
CLIXON_CLIENT_IPC, /* Internal IPC API, only experimental use */
CLIXON_CLIENT_NETCONF, /* External Netconf */
CLIXON_CLIENT_SSH /* NYI External Netconf over SSH */
/* Internal IPC API, connect directly on local UNIX domain socket to backend
* or using IP according to CLICON_SOCK_FAMILY setting
* see https://clixon-docs.readthedocs.io/en/latest/netconf.html#ipc
* Must be local on device
*/
CLIXON_CLIENT_IPC,
/* Regular NETCONF via local netconf binary
* Fork clixon_netconf locally which in turn communicates with backend
* Must be local on device
*/
CLIXON_CLIENT_NETCONF,
/* Regular NETCONF using ssh sub-system via local SSH (openssh) client binary
* Fork ssh locally which in turn communicates remotely to device
* Must have openssh installed locally and device must have ssh sub-subsystem
*/
CLIXON_CLIENT_SSH
} clixon_client_type;
/*
@ -59,7 +73,9 @@ extern "C" {
clixon_handle clixon_client_init(const char *config_file);
int clixon_client_terminate(clixon_handle h);
clixon_client_handle clixon_client_connect(clixon_handle h, clixon_client_type socktype);
int clixon_client_lock(int sock, const int lock, const char *db);
int clixon_client_hello(int sock, int version);
clixon_client_handle clixon_client_connect(clixon_handle h, clixon_client_type socktype, const char *dest);
int clixon_client_disconnect(clixon_client_handle ch);
int clixon_client_get_bool(clixon_client_handle ch, int *rval, const char *xnamespace, const char *xpath);
int clixon_client_get_str(clixon_client_handle ch, char *rval, int n, const char *xnamespace, const char *xpath);

View file

@ -124,7 +124,7 @@ enum error_option{ /* edit-config */
/* NETCONF framing
*/
enum framing_type{
NETCONF_SSH_EOM, /* RFC 4742, RFC 6242 hello msg (end-of-msg: ]]>]]>)*/
NETCONF_SSH_EOM=0, /* RFC 4742, RFC 6242 hello msg (end-of-msg: ]]>]]>)*/
NETCONF_SSH_CHUNKED, /* RFC 6242 Chunked framing */
};
typedef enum framing_type netconf_framing_type;

View file

@ -58,7 +58,7 @@ typedef int (proc_cb_t)(clicon_handle h, process_entry_t *pe, proc_operation *op
/*
* Prototypes
*/
int clixon_proc_socket(char **argv, pid_t *pid, int *sock);
int clixon_proc_socket(char **argv, int sock_flags, pid_t *pid, int *sock);
int clixon_proc_socket_close(pid_t pid, int sock);
int clixon_proc_background(char **argv, const char *netns, pid_t *pid);
int clixon_process_pid(clicon_handle h, const char *name, pid_t *pid);