1 /*
2   Copyright 2021 Northern.tech AS
3 
4   This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
5 
6   This program is free software; you can redistribute it and/or modify it
7   under the terms of the GNU General Public License as published by the
8   Free Software Foundation; version 3.
9 
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14 
15   You should have received a copy of the GNU General Public License
16   along with this program; if not, write to the Free Software
17   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
18 
19   To the extent this program is licensed as part of the Enterprise
20   versions of CFEngine, the applicable Commercial Open Source License
21   (COSL) may apply to this file if you as a licensee so wish it. See
22   included file COSL.txt.
23 */
24 
25 #ifndef CFENGINE_PROTOTYPES3_H
26 #define CFENGINE_PROTOTYPES3_H
27 
28 #include <cf3.defs.h>
29 #include <compiler.h>
30 #include <enterprise_extension.h>
31 #include <set.h>
32 
33 bool BootstrapAllowed(void);
34 
35 /* Versions */
36 
37 const char *Version(void);
38 const char *NameVersion(void);
39 
40 /* cfparse.y */
41 
42 void yyerror(const char *s);
43 
44 /* agent.c */
45 
46 PromiseResult ScheduleAgentOperations(EvalContext *ctx, const Bundle *bp);
47 
48 /* Only for agent.c */
49 
50 void ConnectionsInit(void);
51 void ConnectionsCleanup(void);
52 
53 /* client_protocol.c */
54 
55 void SetSkipIdentify(bool enabled);
56 
57 /* enterprise_stubs.c */
58 
59 ENTERPRISE_VOID_FUNC_1ARG_DECLARE(void, Nova_Initialize, EvalContext *, ctx);
60 ENTERPRISE_FUNC_1ARG_DECLARE(int, CfSessionKeySize, char, c);
61 ENTERPRISE_FUNC_0ARG_DECLARE(char, CfEnterpriseOptions);
62 ENTERPRISE_FUNC_1ARG_DECLARE(const EVP_CIPHER *, CfengineCipher, char, type);
63 ENTERPRISE_VOID_FUNC_1ARG_DECLARE(void, EnterpriseContext, EvalContext *, ctx);
64 ENTERPRISE_FUNC_0ARG_DECLARE(const char *, GetConsolePrefix);
65 ENTERPRISE_FUNC_6ARG_DECLARE(char *, GetRemoteScalar, EvalContext *, ctx, char *, proto, char *, handle, const char *, server, int, encrypted, char *, rcv);
66 ENTERPRISE_VOID_FUNC_2ARG_DECLARE(void, LogTotalCompliance, const char *, version, int, background_tasks);
67 #if defined(__MINGW32__)
68 ENTERPRISE_FUNC_4ARG_DECLARE(bool, GetRegistryValue, const char *, key, char *, name, char *, buf, int, bufSz);
69 #endif
70 ENTERPRISE_FUNC_6ARG_DECLARE(void *, CfLDAPValue, char *, uri, char *, dn, char *, filter, char *, name, char *, scope, char *, sec);
71 ENTERPRISE_FUNC_6ARG_DECLARE(void *, CfLDAPList, char *, uri, char *, dn, char *, filter, char *, name, char *, scope, char *, sec);
72 ENTERPRISE_FUNC_8ARG_DECLARE(void *, CfLDAPArray, EvalContext *, ctx, const Bundle *, caller, char *, array, char *, uri, char *, dn, char *, filter, char *, scope, char *, sec);
73 ENTERPRISE_FUNC_8ARG_DECLARE(void *, CfRegLDAP, EvalContext *, ctx, char *, uri, char *, dn, char *, filter, char *, name, char *, scope, char *, regex, char *, sec);
74 ENTERPRISE_VOID_FUNC_3ARG_DECLARE(void, CacheUnreliableValue, char *, caller, char *, handle, char *, buffer);
75 ENTERPRISE_FUNC_3ARG_DECLARE(int, RetrieveUnreliableValue, char *, caller, char *, handle, char *, buffer);
76 ENTERPRISE_FUNC_3ARG_DECLARE(bool, TranslatePath, const char *, from, char *, to, size_t, to_size);
77 ENTERPRISE_FUNC_4ARG_DECLARE(bool, ListHostsWithClass, EvalContext *, ctx, Rlist **, return_list, char *, class_name, char *, return_format);
78 
79 ENTERPRISE_VOID_FUNC_2ARG_DECLARE(void, CheckAndSetHAState, const char *, workdir, EvalContext *, ctx);
80 ENTERPRISE_VOID_FUNC_0ARG_DECLARE(void, ReloadHAConfig);
81 
82 ENTERPRISE_VOID_FUNC_2ARG_DECLARE(void, Nova_ClassHistoryAddContextName, const StringSet *, list, const char *, context_name);
83 ENTERPRISE_VOID_FUNC_2ARG_DECLARE(void, Nova_ClassHistoryEnable, StringSet **, list, bool, enable);
84 
85 /* manual.c */
86 
87 void TexinfoManual(EvalContext *ctx, const char *source_dir, const char *output_file);
88 
89 /* modes.c */
90 
91 bool ParseModeString(const char *modestring, mode_t *plusmask, mode_t *minusmask);
92 
93 /* patches.c */
94 
95 bool IsPrivileged(void);
96 char *cf_strtimestamp_local(const time_t time, char *buf);
97 char *cf_strtimestamp_utc(const time_t time, char *buf);
98 int cf_closesocket(int sd);
99 
100 #if !defined(__MINGW32__)
101 #define OpenNetwork() /* noop */
102 #define CloseNetwork() /* noop */
103 #else
104 void OpenNetwork(void);
105 void CloseNetwork(void);
106 #endif
107 
108 bool LinkOrCopy(const char *from, const char *to, int sym);
109 
110 /* storage_tools.c */
111 
112 off_t GetDiskUsage(char *file, CfSize type);
113 
114 /* verify_reports.c */
115 
116 PromiseResult VerifyReportPromise(EvalContext *ctx, const Promise *pp);
117 
118 /* cf-key */
119 
120 ENTERPRISE_FUNC_1ARG_DECLARE(bool, LicenseInstall, char *, path_source);
121 
122 /* cf-serverd */
123 
124 ENTERPRISE_FUNC_0ARG_DECLARE(size_t, EnterpriseGetMaxCfHubProcesses);
125 
126 #endif
127