pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1/*
2 * Copyright 2004-2024 the Pacemaker project contributors
3 *
4 * The version control history for this file may have further details.
5 *
6 * This source code is licensed under the GNU Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8 */
9
10#ifndef PCMK__CRM_COMMON_UTIL__H
11#define PCMK__CRM_COMMON_UTIL__H
12
13#include <sys/types.h> // gid_t, mode_t, size_t, time_t, uid_t
14#include <stdlib.h>
15#include <stdbool.h>
16#include <stdint.h> // uint32_t
17#include <limits.h>
18#include <signal.h>
19#include <glib.h>
20
21#include <crm/common/acl.h>
22#include <crm/common/actions.h>
23#include <crm/common/agents.h>
24#include <crm/common/results.h>
25#include <crm/common/scores.h>
26#include <crm/common/strings.h>
27#include <crm/common/nvpair.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
39/* public node attribute functions (from attrs.c) */
40char *pcmk_promotion_score_name(const char *rsc_id);
41
42/* public Pacemaker Remote functions (from remote.c) */
44
45int compare_version(const char *version1, const char *version2);
46
56static inline bool
57pcmk_any_flags_set(uint64_t flag_group, uint64_t flags_to_check)
58{
59 return (flag_group & flags_to_check) != 0;
60}
61
71static inline bool
72pcmk_all_flags_set(uint64_t flag_group, uint64_t flags_to_check)
73{
74 return (flag_group & flags_to_check) == flags_to_check;
75}
76
80#define pcmk_is_set(g, f) pcmk_all_flags_set((g), (f))
81
82void pcmk_common_cleanup(void);
83char *crm_md5sum(const char *buffer);
84char *crm_generate_uuid(void);
85int crm_user_lookup(const char *name, uid_t * uid, gid_t * gid);
86int pcmk_daemon_user(uid_t *uid, gid_t *gid);
87
88#ifdef __cplusplus
89}
90#endif
91
92#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
94#endif
95
96#endif
Low-level API for XML Access Control Lists (ACLs)
APIs related to actions.
API related to resource agents.
const char * name
Definition cib.c:26
char * crm_md5sum(const char *buffer)
Definition digest.c:251
void pcmk_common_cleanup(void)
Free all memory used by libcrmcommon.
Definition utils.c:55
int pcmk_daemon_user(uid_t *uid, gid_t *gid)
Get user and group IDs of pacemaker daemon user.
Definition utils.c:143
char * crm_generate_uuid(void)
Definition utils.c:339
int crm_default_remote_port(void)
Get the default remote connection TCP port on this host.
Definition remote.c:1000
int crm_user_lookup(const char *name, uid_t *uid, gid_t *gid)
Definition utils.c:103
char * pcmk_promotion_score_name(const char *rsc_id)
Return the name of the node attribute used as a promotion score.
Definition attrs.c:88
int compare_version(const char *version1, const char *version2)
Definition utils.c:206
Functionality for manipulating name/value pairs.
Function and executable result codes.
Pacemaker APIs related to scores.
API for strings.
Deprecated Pacemaker utilities.