pacemaker  2.0.4-2deceaa3ae
Scalable High-Availability cluster resource manager
crmcommon_private.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018-2019 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 CRMCOMMON_PRIVATE__H
11 # define CRMCOMMON_PRIVATE__H
12 
13 /* This header is for the sole use of libcrmcommon, so that functions can be
14  * declared with G_GNUC_INTERNAL for efficiency.
15  */
16 
18  xpf_none = 0x0000,
19  xpf_dirty = 0x0001,
20  xpf_deleted = 0x0002,
21  xpf_created = 0x0004,
22  xpf_modified = 0x0008,
23 
24  xpf_tracking = 0x0010,
25  xpf_processed = 0x0020,
26  xpf_skip = 0x0040,
27  xpf_moved = 0x0080,
28 
29  xpf_acl_enabled = 0x0100,
30  xpf_acl_read = 0x0200,
31  xpf_acl_write = 0x0400,
32  xpf_acl_deny = 0x0800,
33 
34  xpf_acl_create = 0x1000,
35  xpf_acl_denied = 0x2000,
36  xpf_lazy = 0x4000,
37 };
38 
39 typedef struct xml_private_s {
40  long check;
41  uint32_t flags;
42  char *user;
46 
47 G_GNUC_INTERNAL
48 void pcmk__set_xml_flag(xmlNode *xml, enum xml_private_flags flag);
49 
50 G_GNUC_INTERNAL
51 bool pcmk__tracking_xml_changes(xmlNode *xml, bool lazy);
52 
53 G_GNUC_INTERNAL
54 int pcmk__element_xpath(const char *prefix, xmlNode *xml, char *buffer,
55  int offset, size_t buffer_size);
56 
57 G_GNUC_INTERNAL
58 void pcmk__free_acls(GList *acls);
59 
60 G_GNUC_INTERNAL
61 void pcmk__unpack_acl(xmlNode *source, xmlNode *target, const char *user);
62 
63 G_GNUC_INTERNAL
64 bool pcmk__check_acl(xmlNode *xml, const char *name,
65  enum xml_private_flags mode);
66 
67 G_GNUC_INTERNAL
68 void pcmk__apply_acl(xmlNode *xml);
69 
70 G_GNUC_INTERNAL
71 void pcmk__apply_creation_acl(xmlNode *xml, bool check_top);
72 
73 G_GNUC_INTERNAL
74 void pcmk__mark_xml_attr_dirty(xmlAttr *a);
75 
76 static inline xmlAttr *
77 pcmk__first_xml_attr(const xmlNode *xml)
78 {
79  return xml? xml->properties : NULL;
80 }
81 
82 static inline const char *
83 pcmk__xml_attr_value(const xmlAttr *attr)
84 {
85  return ((attr == NULL) || (attr->children == NULL))? NULL
86  : (const char *) attr->children->content;
87 }
88 
89 #endif // CRMCOMMON_PRIVATE__H
GListPtr
GList * GListPtr
Definition: crm.h:214
xml_private_t
struct xml_private_s xml_private_t
xpf_deleted
@ xpf_deleted
Definition: crmcommon_private.h:20
xpf_created
@ xpf_created
Definition: crmcommon_private.h:21
xpf_acl_deny
@ xpf_acl_deny
Definition: crmcommon_private.h:32
xpf_dirty
@ xpf_dirty
Definition: crmcommon_private.h:19
xpf_acl_write
@ xpf_acl_write
Definition: crmcommon_private.h:31
xml_private_s::check
long check
Definition: crmcommon_private.h:40
xml_private_s::acls
GListPtr acls
Definition: crmcommon_private.h:43
xpf_moved
@ xpf_moved
Definition: crmcommon_private.h:27
pcmk__set_xml_flag
G_GNUC_INTERNAL void pcmk__set_xml_flag(xmlNode *xml, enum xml_private_flags flag)
Definition: xml.c:140
xml_private_flags
xml_private_flags
Definition: crmcommon_private.h:17
pcmk__free_acls
G_GNUC_INTERNAL void pcmk__free_acls(GList *acls)
Definition: acl.c:45
pcmk__unpack_acl
G_GNUC_INTERNAL void pcmk__unpack_acl(xmlNode *source, xmlNode *target, const char *user)
Definition: acl.c:313
xpf_processed
@ xpf_processed
Definition: crmcommon_private.h:25
xml_private_s::flags
uint32_t flags
Definition: crmcommon_private.h:41
xml_private_s::user
char * user
Definition: crmcommon_private.h:42
xml_private_s
Definition: crmcommon_private.h:39
xpf_acl_enabled
@ xpf_acl_enabled
Definition: crmcommon_private.h:29
xpf_modified
@ xpf_modified
Definition: crmcommon_private.h:22
xpf_tracking
@ xpf_tracking
Definition: crmcommon_private.h:24
pcmk__tracking_xml_changes
G_GNUC_INTERNAL bool pcmk__tracking_xml_changes(xmlNode *xml, bool lazy)
Definition: xml.c:74
xpf_none
@ xpf_none
Definition: crmcommon_private.h:18
xml_private_s::deleted_objs
GListPtr deleted_objs
Definition: crmcommon_private.h:44
pcmk__element_xpath
G_GNUC_INTERNAL int pcmk__element_xpath(const char *prefix, xmlNode *xml, char *buffer, int offset, size_t buffer_size)
Definition: xml.c:2030
xpf_lazy
@ xpf_lazy
Definition: crmcommon_private.h:36
target
const char * target
Definition: pcmk_fence.c:28
xpf_skip
@ xpf_skip
Definition: crmcommon_private.h:26
xpf_acl_create
@ xpf_acl_create
Definition: crmcommon_private.h:34
xpf_acl_read
@ xpf_acl_read
Definition: crmcommon_private.h:30
pcmk__mark_xml_attr_dirty
G_GNUC_INTERNAL void pcmk__mark_xml_attr_dirty(xmlAttr *a)
Definition: xml.c:193
xpf_acl_denied
@ xpf_acl_denied
Definition: crmcommon_private.h:35
pcmk__apply_creation_acl
G_GNUC_INTERNAL void pcmk__apply_creation_acl(xmlNode *xml, bool check_top)
Definition: acl.c:565
name
char * name
Definition: pcmk_fence.c:30
pcmk__check_acl
G_GNUC_INTERNAL bool pcmk__check_acl(xmlNode *xml, const char *name, enum xml_private_flags mode)
Definition: acl.c:635
pcmk__apply_acl
G_GNUC_INTERNAL void pcmk__apply_acl(xmlNode *xml)
Definition: acl.c:242