yumapro  23.10T-6
YumaPro SDK
Loading...
Searching...
No Matches
Core Functions

Subsystem core functions are used to launch the subsystem and perform IO operations. More...

Collaboration diagram for Core Functions:

Macros

#define SUBSYS_BUFFLEN   32000
 max length of an <ncx-connect> message
 
#define SUBSYS_TRACE1(cb, fmt, ...)
 SUBSYS_TRACE Level 1 log debug trace macro.
 
#define SUBSYS_TRACE2(cb, fmt, ...)
 SUBSYS_TRACE Level 2 log debug trace macro.
 
#define SUBSYS_TRACE3(cb, fmt, ...)
 SUBSYS_TRACE Level 3 log debug trace macro.
 
#define XML_START_MSG
 copied from ncx/xml_util.h to avoid inluding that file and all the files it includes
 

Typedefs

typedef status_t(* subsys_stdout_fn_t) (const char *buff, size_t bufflen)
 STDOUT FUNCTION TEMPLATE subsys_stdout_fn_t. More...
 
typedef ssize_t(* subsys_stdin_fn_t) (char *buff, size_t bufflen)
 STDIN FUNCTION TEMPLATE subsys_stdin_fn_t. More...
 

Enumerations

enum  proto_id_t {
  PROTO_ID_NONE ,
  PROTO_ID_NETCONF ,
  PROTO_ID_YANGAPI ,
  PROTO_ID_CLI ,
  PROTO_ID_WEBUI ,
  PROTO_ID_YCONTROL ,
  PROTO_ID_RESTCONF
}
 the type of protocol starting the subsystem More...
 

Functions

int run_subsystem (proto_id_t protocol_id, int trace_level, int argc, char **argv)
 Run the subsystem : entry point. More...
 
int run_subsystem_ex (proto_id_t protocol_id, int trace_level, int argc, char **argv, char **envp, subsys_stdin_fn_t stdin_fn, subsys_stdout_fn_t stdout_fn, int32 stdin_len)
 Run the subsystem : entry point (extended) More...
 
int run_subsystem_full (proto_id_t protocol_id, int trace_level, int argc, char **argv, char **envp, subsys_stdin_fn_t stdin_fn, subsys_stdout_fn_t stdout_fn, int32 stdin_len)
 Run the subsystem : entry point (full) More...
 
status_t init_subsystem_ycontrol (int trace_level, const char *subsys_id)
 @ More...
 
status_t init_subsystem_ycontrol_ha (int trace_level, const char *subsys_id, const char *server_id, const char *server_addr, uint16 server_port)
 @ More...
 
status_t connect_subsystem_ycontrol (int *retfd)
 Connect the subsystem for YControl. More...
 
status_t connect_subsystem_srid (const char *server_root, int *retfd)
 Connect the subsystem for YControl using a server root. More...
 
status_t check_subsystem_io (void)
 Check if any input ready to transfer. More...
 
void cleanup_subsystem_ycontrol (status_t res)
 Cleanup the subsystem variables. More...
 

Detailed Description

Subsystem core functions are used to launch the subsystem and perform IO operations.

It contains the entry points for the library.

Typedef Documentation

◆ subsys_stdin_fn_t

typedef ssize_t(* subsys_stdin_fn_t) (char *buff, size_t bufflen)

STDIN FUNCTION TEMPLATE subsys_stdin_fn_t.

Parameters
buffbuffer to read from STDIN
bufflenmax number of bytes to read
Returns
-1 if some error; 0 if EOF reached; >0 to indicate number of bytes read

◆ subsys_stdout_fn_t

typedef status_t(* subsys_stdout_fn_t) (const char *buff, size_t bufflen)

STDOUT FUNCTION TEMPLATE subsys_stdout_fn_t.

Parameters
buffbuffer to write to STDOUT
bufflennumber of bytes to write
Returns
status

Enumeration Type Documentation

◆ proto_id_t

enum proto_id_t

the type of protocol starting the subsystem

Enumerator
PROTO_ID_NONE 

not set

PROTO_ID_NETCONF 

NETCONF.

PROTO_ID_YANGAPI 

YANG-API.

PROTO_ID_WEBUI 

WebUI.

PROTO_ID_YCONTROL 

YControl subsystem.

PROTO_ID_RESTCONF 

RESTCONF.

Function Documentation

◆ check_subsystem_io()

status_t check_subsystem_io ( void  )

Check if any input ready to transfer.

Returns
status

◆ cleanup_subsystem_ycontrol()

void cleanup_subsystem_ycontrol ( status_t  res)

Cleanup the subsystem variables.

Parameters
resfinal status for trace message
Here is the caller graph for this function:

◆ connect_subsystem_srid()

status_t connect_subsystem_srid ( const char *  server_root,
int *  retfd 
)

Connect the subsystem for YControl using a server root.

Parameters
server_root
  • server root ID to use in multi-instance mode
  • NULL if single-instance mode
[out]retfdaddress of return file descriptor number
  • *retfd file descriptor number used for this connection
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ connect_subsystem_ycontrol()

status_t connect_subsystem_ycontrol ( int *  retfd)

Connect the subsystem for YControl.

Parameters
[out]retfdaddress of return file descriptor number
  • *retfd file descriptor number used for this connection
Returns
status
Here is the call graph for this function:

◆ init_subsystem_ycontrol()

status_t init_subsystem_ycontrol ( int  trace_level,
const char *  subsys_id 
)

@

Init the subsystem for use within a YControl subsystem

Internal API for YControl use only.

STDIN is input from the client (sent to YP server) STDOUT is output to the client (rcvd from YP server)

THIS FUNCTION WILL SET NON-BLOCKING IO FOR THE SOCKET DO NOT USE FOR yangcli-pro or yp-shell; FOR ycontrol only

Parameters
trace_leveldefault trace level to use if no -t CLI entered
subsys_idsubsystem identifier
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_subsystem_ycontrol_ha()

status_t init_subsystem_ycontrol_ha ( int  trace_level,
const char *  subsys_id,
const char *  server_id,
const char *  server_addr,
uint16  server_port 
)

@

Init the subsystem for use within a YControl subsystem

Internal API for YControl use only.

STDIN is input from the client (sent to YP server) STDOUT is output to the client (rcvd from YP server)

THIS FUNCTION WILL SET NON-BLOCKING IO FOR THE SOCKET DO NOT USE FOR yangcli-pro or yp-shell; FOR ycontrol only

Parameters
trace_leveldefault trace level to use if no -t CLI entered
subsys_idsubsystem identifier
server_idthe server ID to connect to
server_addrthe server address to connect to
server_portthe server port to connect to
Returns
status
Here is the caller graph for this function:

◆ run_subsystem()

int run_subsystem ( proto_id_t  protocol_id,
int  trace_level,
int  argc,
char **  argv 
)

Run the subsystem : entry point.

STDIN is input from the SSH client (sent to YP server)
STDOUT is output to the SSH client (rcvd from YP server)

Parameters
protocol_iddefault protocol to use if no -p CLI entered
trace_leveldefault trace level to use if no -t CLI entered
argcargument count passed to program
argvargument list passed to program
Returns
0 if NO_ERR
1 if error connecting or logging into ncxserver
Here is the call graph for this function:

◆ run_subsystem_ex()

int run_subsystem_ex ( proto_id_t  protocol_id,
int  trace_level,
int  argc,
char **  argv,
char **  envp,
subsys_stdin_fn_t  stdin_fn,
subsys_stdout_fn_t  stdout_fn,
int32  stdin_len 
)

Run the subsystem : entry point (extended)

STDIN is input from the SSH client (sent to YP server)
STDOUT is output to the SSH client (rcvd from YP server)

Parameters
protocol_iddefault protocol to use if no -p CLI entered
trace_leveldefault trace level to use if no -t CLI entered
argcargument count passed to program
argvargument list passed to program
envpenvironment list passed to program
stdin_fnfunction to call for reading a buffer from STDIN
NULL to use internal default function
stdout_fnfunction to call for writing a buffer to STDOUT
NULL to use internal default function
stdin_lencontent length if limited or known in advance
-1 if content_length not known or used
Returns
0 if NO_ERR
1 if error connecting or logging into ncxserver
Here is the call graph for this function:

◆ run_subsystem_full()

int run_subsystem_full ( proto_id_t  protocol_id,
int  trace_level,
int  argc,
char **  argv,
char **  envp,
subsys_stdin_fn_t  stdin_fn,
subsys_stdout_fn_t  stdout_fn,
int32  stdin_len 
)

Run the subsystem : entry point (full)

Appears to be a duplicate of run_subsystem_ex. STDIN is input from the SSH client (sent to YP server)
STDOUT is output to the SSH client (rcvd from YP server)

Parameters
protocol_iddefault protocol to use if no -p CLI entered
trace_leveldefault trace level to use if no -t CLI entered
argcargument count passed to program
argvargument list passed to program
envpenvironment list passed to program
stdin_fnfunction to call for reading a buffer from STDIN
NULL to use internal default function
stdout_fnfunction to call for writing a buffer to STDOUT
NULL to use internal default function
stdin_lencontent length if limited or known in advance
-1 if content_length not known or used
Returns
0 if NO_ERR
1 if error connecting or logging into ncxserver
Here is the caller graph for this function: