-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.h
More file actions
95 lines (71 loc) · 3.29 KB
/
command.h
File metadata and controls
95 lines (71 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright Nezametdinov E. Ildus 2024.
// Distributed under the GNU General Public License, Version 3.
// (See accompanying file LICENSE_GPL_3_0.txt or copy at
// https://www.gnu.org/licenses/gpl-3.0.txt)
//
#ifndef H_912497DA005D417288BB624C83B68F94
#define H_912497DA005D417288BB624C83B68F94
#include <sys/types.h>
#include <stdbool.h>
#include <stddef.h>
////////////////////////////////////////////////////////////////////////////////
// Command list declaration.
////////////////////////////////////////////////////////////////////////////////
struct rose_command_list;
////////////////////////////////////////////////////////////////////////////////
// Command access rights definition.
////////////////////////////////////////////////////////////////////////////////
enum rose_command_access_rights {
rose_command_access_ipc = 0x01,
rose_command_access_wayland_privileged_protocols = 0x02
};
// A mask of command access rights. Is a bitwise OR of zero or more values from
// the rose_command_access_rights enumeration.
typedef unsigned rose_command_access_rights_mask;
////////////////////////////////////////////////////////////////////////////////
// Command argument list definition.
////////////////////////////////////////////////////////////////////////////////
struct rose_command_argument_list {
// A pointer to an array of zero-terminated arguments.
char* data;
// Size of the array.
size_t size;
};
////////////////////////////////////////////////////////////////////////////////
// Command list initialization/destruction interface.
////////////////////////////////////////////////////////////////////////////////
struct rose_command_list*
rose_command_list_initialize();
void
rose_command_list_destroy(struct rose_command_list* command_list);
////////////////////////////////////////////////////////////////////////////////
// Command list manipulation interface.
////////////////////////////////////////////////////////////////////////////////
bool
rose_command_list_execute_command(
struct rose_command_list* command_list,
struct rose_command_argument_list argument_list,
rose_command_access_rights_mask rights);
void
rose_command_list_notify_command_termination(
struct rose_command_list* command_list, pid_t command_pid);
////////////////////////////////////////////////////////////////////////////////
// Command list query interface.
////////////////////////////////////////////////////////////////////////////////
rose_command_access_rights_mask
rose_command_list_query_access_rights(
struct rose_command_list* command_list, pid_t command_pid);
////////////////////////////////////////////////////////////////////////////////
// Command argument list initialization interface.
////////////////////////////////////////////////////////////////////////////////
struct rose_command_argument_list
rose_command_argument_list_initialize(char const* file_path);
////////////////////////////////////////////////////////////////////////////////
// Command execution interface.
////////////////////////////////////////////////////////////////////////////////
pid_t
rose_execute_command_in_child_process(
struct rose_command_argument_list argument_list);
void
rose_execute_command(struct rose_command_argument_list argument_list);
#endif // H_912497DA005D417288BB624C83B68F94