source: trunk/include/sh_extern.h@ 273

Last change on this file since 273 was 211, checked in by katerina, 16 years ago

Allow shell expansion for cofiguration file values (ticket #137).

File size: 2.6 KB
Line 
1#ifndef SH_EXTERN_H
2#define SH_EXTERN_H
3
4typedef struct
5{
6 char * command;
7 int argc;
8 char * argv[32];
9 int envc;
10 char * envv[32];
11 char checksum[KEY_LEN + 1];
12#if 0
13 uid_t trusted_users[32];
14#endif
15 uid_t run_user_uid;
16 gid_t run_user_gid;
17 int privileged;
18
19 int pipeFD;
20 SL_TICKET pipeTI;
21 pid_t pid;
22 FILE * pipe;
23 char rw;
24 int exit_status;
25 int fork_twice;
26
27 int com_fd;
28 SL_TICKET com_ti;
29
30} sh_tas_t;
31
32
33/*
34 * -- generic safe popen; returns 0 on success, -1 otherwise
35 */
36int sh_ext_popen (sh_tas_t * task);
37
38/*
39 * -- Execute command, return first line of output
40 */
41char * sh_ext_popen_str (char * command);
42
43/*
44 * -- close the pipe, clear and return task->exit_status
45 */
46int sh_ext_pclose (sh_tas_t * task);
47
48/*
49 * -- add CL argument, return # of arguments
50 */
51int sh_ext_tas_add_argv(sh_tas_t * tas, const char * val);
52/*
53 * -- remove last CL argument
54 */
55int sh_ext_tas_rm_argv(sh_tas_t * tas);
56/*
57 * -- add environment variable, return # of variables
58 */
59int sh_ext_tas_add_envv(sh_tas_t * tas, const char * key, const char * val);
60/*
61 * -- set command
62 */
63void sh_ext_tas_command(sh_tas_t * tas, const char * command);
64/*
65 * -- initialize task structure
66 */
67void sh_ext_tas_init (sh_tas_t * tas);
68/*
69 * -- free task structure
70 */
71void sh_ext_tas_free(sh_tas_t * tas);
72
73
74#if defined(WITH_EXTERNAL)
75
76/*
77 * -- start a new external command, and add it to the list
78 */
79int sh_ext_setcommand(const char * cmd);
80
81/*
82 * -- explicitely close a command
83 */
84int sh_ext_close_command (const char * str);
85
86/*
87 * -- clean up the command list
88 */
89int sh_ext_cleanup(void);
90
91/*
92 * -- set deadtime
93 */
94int sh_ext_deadtime (const char * str);
95
96/*
97 * -- add keywords to the OR filter
98 */
99int sh_ext_add_or (const char * str);
100
101/*
102 * -- add keywords to the AND filter
103 */
104int sh_ext_add_and (const char * str);
105
106/*
107 * -- add keywords to the NOT filter
108 */
109int sh_ext_add_not (const char * str);
110
111/*
112 * -- add keywords to the CL argument list
113 */
114int sh_ext_add_argv (const char * str);
115
116/*
117 * -- add a path to the environment
118 */
119int sh_ext_add_default (const char * str);
120
121/*
122 * -- add an environment variable
123 */
124int sh_ext_add_environ (const char * str);
125
126/*
127 * -- define type
128 */
129int sh_ext_type (const char * str);
130
131/*
132 * -- define checksum
133 */
134int sh_ext_checksum (const char * str);
135
136/*
137 * -- choose privileges
138 */
139int sh_ext_priv (const char * c);
140
141/*
142 * -- execute external script/program
143 */
144int sh_ext_execute (char t1, char t2, char t3, /*@null@*/char * message,
145 size_t msg_siz);
146
147#endif
148
149#endif
Note: See TracBrowser for help on using the repository browser.