cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

policy_server.h
Go to the documentation of this file.
1 /*
2  Copyright 2019 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 /** @file
26  * @brief Access to Policy Server IP Address, hostname and port number.
27  *
28  * Provides a simple get/set interface for the policy server variables.
29  * Does hostname resolution behind the scenes.
30  */
31 
32 #ifndef CFENGINE_POLICYSERVER_H
33 #define CFENGINE_POLICYSERVER_H
34 
35 #include <platform.h>
36 
37 // GET/SET FUNCTIONS:
38 void PolicyServerSet(const char *new_policy_server);
39 const char *PolicyServerGet();
40 const char *PolicyServerGetIP();
41 const char *PolicyServerGetHost();
42 const char *PolicyServerGetPort();
43 
44 // POLICY SERVER FILE FUNCTIONS:
45 char* PolicyServerReadFile(const char *workdir);
46 bool PolicyServerParseFile(const char *workdir, char **host, char **port);
47 bool PolicyServerLookUpFile(const char *workdir, char **ipaddr, char **port);
48 bool PolicyServerWriteFile(const char *workdir, const char *new_policy_server);
49 bool PolicyServerRemoveFile(const char *workdir);
50 
51 #endif
bool PolicyServerRemoveFile(const char *workdir)
Remove the policy_server.dat file.
bool PolicyServerWriteFile(const char *workdir, const char *new_policy_server)
Write new_policy_server to the policy_server.dat file.
const char * PolicyServerGetHost()
Gets the host part of what was bootstrapped to (without port).
char * PolicyServerReadFile(const char *workdir)
Reads the policy_server.dat file.
void PolicyServerSet(const char *new_policy_server)
Sets both internal C variables as well as policy sys variables.
Definition: policy_server.c:77
bool PolicyServerParseFile(const char *workdir, char **host, char **port)
Reads and parses the policy_server.dat file.
const char * PolicyServerGetPort()
Gets the port part of the policy server.
const char * PolicyServerGet()
Used to access the internal POLICY_SERVER variable.
const char * PolicyServerGetIP()
Gets the IP address of policy server, does lookup if necessary.
bool PolicyServerLookUpFile(const char *workdir, char **ipaddr, char **port)
Reads and parses the policy_server.dat file.