yumapro  24.10-2
YumaPro SDK
Loading...
Searching...
No Matches
subsys_util.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3 * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4 *
5 * Unless required by applicable law or agreed to in writing,
6 * software distributed under the License is distributed on an
7 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 * KIND, either express or implied. See the License for the
9 * specific language governing permissions and limitations
10 * under the License.
11 */
12#ifndef _H_subsys_util
13#define _H_subsys_util
14
15/* FILE: subsys_util.h
16*********************************************************************
17* *
18* P U R P O S E *
19* *
20*********************************************************************/
21
28/*********************************************************************
29* *
30* C H A N G E H I S T O R Y *
31* *
32*********************************************************************
33
34date init comment
35----------------------------------------------------------------------
3624-oct-12 abb Begun; split from subsystem.c
37
38*/
39
40#ifndef _H_subsystem
41#include "subsystem.h"
42#endif
43
44#ifndef _H_status
45#include "status.h"
46#endif
47
48#ifndef _H_subsys_magic
49#include "subsys_magic.h"
50#endif
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55
56/********************************************************************
57* *
58* C O N S T A N T S *
59* *
60*********************************************************************/
61
62
77#define SERVER_MAP_FILE_LINELEN 1024
78
80#define SERVER_MAP_WILDCARD "*"
81
83#define SERVER_MAP_ID_MAXLEN 64
84
85
86/********************************************************************
87* *
88* T Y P E S *
89* *
90*********************************************************************/
91
92
94typedef struct subsys_cb_t_ {
95
97 const char *request_uri;
98
100 const char *request_method;
101
103 const char *content_type;
104
106 const char *content_length;
107
109 const char *modified_since;
110
112 const char *unmodified_since;
113
115 const char *match;
116
118 const char *none_match;
119
121 const char *http_accept;
122
124 const char *user;
125
127 const char *ha_server_id;
128
129
136 const char *ha_server_addr;
137
143
146
149
152
155
158
161
164
166 char *port;
167
170
173
175 boolean ncxconnect;
176
178 boolean nonblocking;
179
182
184 boolean no_connect;
185
187 boolean yp_ha_mode;
188
190 boolean extern_mode;
191
194
196 const char *subsys_id;
197
200
202 FILE *errfile;
203
205 fd_set fds;
206
208 char msgbuff[SUBSYS_BUFFLEN];
209
211
212
213/********************************************************************
214* *
215* F U N C T I O N S *
216* *
217*********************************************************************/
218
219
226extern status_t
228
229
238extern status_t
240
241
248extern status_t
250
251
258extern status_t
260
261
267extern void
269
270
276extern void
278
279
292extern void
294 int argc,
295 char **argv);
296
297
309extern status_t
310 start_subsys_ypshell (int *retfd);
311
312
325extern status_t
326 start_subsys_tcp_ncx (int *retfd,
327 const char *user);
328
329
345extern status_t
346 start_subsys_extern_tcp_ncx (int *retfd,
347 const char *user,
348 const char *addr,
349 unsigned int portnum);
350
351
355#ifdef __cplusplus
356} /* end extern 'C' */
357#endif
358
359#endif /* _H_subsys_util */
status_t
global error return code
Definition: status_enum.h:210
proto_id_t
the type of protocol starting the subsystem
Definition: subsystem.h:117
#define SUBSYS_BUFFLEN
max length of an <ncx-connect> message
Definition: subsystem.h:80
status_t(* subsys_stdout_fn_t)(const char *buff, size_t bufflen)
STDOUT FUNCTION TEMPLATE subsys_stdout_fn_t.
Definition: subsystem.h:149
ssize_t(* subsys_stdin_fn_t)(char *buff, size_t bufflen)
STDIN FUNCTION TEMPLATE subsys_stdin_fn_t.
Definition: subsystem.h:162
void clean_subsys_cb(subsys_cb_t *cb)
Clean the fields of a subsystem control block.
Definition: subsys_util.c:1018
void init_subsys_cb(subsys_cb_t *cb)
Initialize the fields of a subsystem control block.
Definition: subsys_util.c:1002
void configure_cli_parms(subsys_cb_t *cb, int argc, char **argv)
Configure CLI parameters.
Definition: subsys_util.c:1056
status_t start_subsys_tcp_ncx(int *retfd, const char *user)
Start the subsystem for a tcp-ncx transport connection.
Definition: subsys_util.c:1200
status_t start_subsys_extern_tcp_ncx(int *retfd, const char *user, const char *addr, unsigned int portnum)
Start the subsystem to connect to an external tcp-ncx socket.
Definition: subsys_util.c:1280
status_t get_ssh_parms(subsys_cb_t *cb)
Get the SSH environment parameters.
Definition: subsys_util.c:724
status_t start_subsys_ypshell(int *retfd)
Start the subsystem for yp-shell.
Definition: subsys_util.c:1138
status_t start_connection(subsys_cb_t *cb)
Start the connection to the server.
Definition: subsys_util.c:882
status_t get_server_root_mapfile(subsys_cb_t *cb)
Get the name of the server root mapfile set.
Definition: subsys_util.c:834
status_t send_cli_ncxconnect(subsys_cb_t *cb)
Send the <ncx-connect> message to the ncxserver for CLI protocol.
Definition: subsys_util.c:934
Global error messages for status code enumerations.
one subsystem control block for session
Definition: subsys_util.h:94
const char * content_length
Content-Length if a RESTCONF session.
Definition: subsys_util.h:106
boolean nonblocking_set_ok
Flag non-blocking failed.
Definition: subsys_util.h:181
const char * http_accept
Accept a RESTCONF session.
Definition: subsys_util.h:121
char * server_root_mapfile
server root ID string
Definition: subsys_util.h:154
const char * ha_server_id
The HA server-id.
Definition: subsys_util.h:127
int ncxsock
socket number
Definition: subsys_util.h:172
boolean yp_ha_mode
flag YP-HA mode
Definition: subsys_util.h:187
subsys_stdout_fn_t stdout_fn
override STDOUT function
Definition: subsys_util.h:148
const char * match
Match if a RESTCONF session.
Definition: subsys_util.h:115
int32 content_len
content length
Definition: subsys_util.h:151
const char * user
User ID for the session.
Definition: subsys_util.h:124
const char * subsys_id
subsystem ID to use
Definition: subsys_util.h:196
const char * modified_since
Modified-Since if a RESTCONF session.
Definition: subsys_util.h:109
boolean extern_mode
flag external mode
Definition: subsys_util.h:190
proto_id_t proto_id
protocol in use
Definition: subsys_util.h:193
boolean nonblocking
Use non-blocking.
Definition: subsys_util.h:178
subsys_stdin_fn_t stdin_fn
override STDIN function
Definition: subsys_util.h:145
const char * request_uri
request URI if a RESTCONF session
Definition: subsys_util.h:97
char * server_addr
server address from SSH_CONNECTION
Definition: subsys_util.h:169
const char * ha_server_addr
YP-HA support; this address will override the AF_LOCAL or the TCP socket file read by subsys_info_rea...
Definition: subsys_util.h:136
char * server_root
server root ID string
Definition: subsys_util.h:157
boolean ncxconnect
Use ncxconnect.
Definition: subsys_util.h:175
char * client_addr
client address
Definition: subsys_util.h:163
FILE * errfile
error file
Definition: subsys_util.h:202
const char * request_method
request method if a RESTCONF session
Definition: subsys_util.h:100
const char * none_match
None-Match if a RESTCONF session.
Definition: subsys_util.h:118
const char * content_type
content-type if a RESTCONF session
Definition: subsys_util.h:103
const char * unmodified_since
Unmodified-Since if a RESTCONF session.
Definition: subsys_util.h:112
char * port
server port
Definition: subsys_util.h:166
boolean server_root_from_env
server root from ENV
Definition: subsys_util.h:160
int traceLevel
debug trace level set (0 - 3)
Definition: subsys_util.h:199
boolean no_connect
flag no connection
Definition: subsys_util.h:184
fd_set fds
file descriptors
Definition: subsys_util.h:205
uint16 ha_server_port
HA server port number The ha_server_port is also used by the extern tcp-ncx mode (extern_mode == TRUE...
Definition: subsys_util.h:142
Define magic string value for <ncx-connect> messages.
Thin client IO handler for YumaPro server.