pacemaker  1.1.18-7fdfbbe
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ipc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This software is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 #ifndef CRM_COMMON_IPC__H
19 # define CRM_COMMON_IPC__H
20 
27 # include <crm/common/xml.h>
28 
29 /* clplumbing based IPC */
30 
31 # define create_reply(request, xml_response_data) create_reply_adv(request, xml_response_data, __FUNCTION__);
32 xmlNode *create_reply_adv(xmlNode * request, xmlNode * xml_response_data, const char *origin);
33 
34 # define create_request(task, xml_data, host_to, sys_to, sys_from, uuid_from) create_request_adv(task, xml_data, host_to, sys_to, sys_from, uuid_from, __FUNCTION__)
35 
36 xmlNode *create_request_adv(const char *task, xmlNode * xml_data, const char *host_to,
37  const char *sys_to, const char *sys_from, const char *uuid_from,
38  const char *origin);
39 
40 /* *INDENT-OFF* */
42 {
43  crm_ipc_flags_none = 0x00000000,
44 
45  crm_ipc_compressed = 0x00000001, /* Message has been compressed */
46 
47  crm_ipc_proxied = 0x00000100, /* _ALL_ replies to proxied connections need to be sent as events */
48  crm_ipc_client_response = 0x00000200, /* A Response is expected in reply */
49 
50  /* These options are just options for crm_ipcs_sendv() */
51  crm_ipc_server_event = 0x00010000, /* Send an Event instead of a Response */
52  crm_ipc_server_free = 0x00020000, /* Free the iovec after sending */
53  crm_ipc_proxied_relay_response = 0x00040000, /* all replies to proxied connections are sent as events, this flag preserves whether the event should be treated as an actual event, or a response.*/
54 
55  crm_ipc_server_info = 0x00100000, /* Log failures as LOG_INFO */
56  crm_ipc_server_error = 0x00200000, /* Log failures as LOG_ERR */
57 };
58 /* *INDENT-ON* */
59 
60 # include <qb/qbipcc.h>
61 typedef struct crm_ipc_s crm_ipc_t;
62 
63 crm_ipc_t *crm_ipc_new(const char *name, size_t max_size);
64 bool crm_ipc_connect(crm_ipc_t * client);
65 void crm_ipc_close(crm_ipc_t * client);
66 void crm_ipc_destroy(crm_ipc_t * client);
67 
68 int crm_ipc_send(crm_ipc_t * client, xmlNode * message, enum crm_ipc_flags flags,
69  int32_t ms_timeout, xmlNode ** reply);
70 
71 int crm_ipc_get_fd(crm_ipc_t * client);
72 bool crm_ipc_connected(crm_ipc_t * client);
73 int crm_ipc_ready(crm_ipc_t * client);
74 long crm_ipc_read(crm_ipc_t * client);
75 const char *crm_ipc_buffer(crm_ipc_t * client);
77 const char *crm_ipc_name(crm_ipc_t * client);
78 unsigned int crm_ipc_default_buffer_size(void);
79 
80 /* Utils */
81 xmlNode *create_hello_message(const char *uuid, const char *client_name,
82  const char *major_version, const char *minor_version);
83 
84 #endif
bool crm_ipc_connect(crm_ipc_t *client)
Establish an IPC connection to a Pacemaker component.
Definition: ipc.c:873
int crm_ipc_get_fd(crm_ipc_t *client)
Definition: ipc.c:942
xmlNode * create_reply_adv(xmlNode *request, xmlNode *xml_response_data, const char *origin)
Definition: ipc.c:150
long crm_ipc_read(crm_ipc_t *client)
Definition: ipc.c:1050
xmlNode * create_hello_message(const char *uuid, const char *client_name, const char *major_version, const char *minor_version)
Definition: ipc.c:1335
uint32_t crm_ipc_buffer_flags(crm_ipc_t *client)
Definition: ipc.c:1103
const char * crm_ipc_buffer(crm_ipc_t *client)
Definition: ipc.c:1096
struct crm_ipc_s crm_ipc_t
Definition: ipc.h:61
Wrappers for and extensions to libxml2.
unsigned int crm_ipc_default_buffer_size(void)
Definition: ipc.c:67
void crm_ipc_destroy(crm_ipc_t *client)
Definition: ipc.c:919
bool crm_ipc_connected(crm_ipc_t *client)
Definition: ipc.c:956
int crm_ipc_ready(crm_ipc_t *client)
Check whether an IPC connection is ready to be read.
Definition: ipc.c:988
const char * crm_ipc_name(crm_ipc_t *client)
Definition: ipc.c:1117
int crm_ipc_send(crm_ipc_t *client, xmlNode *message, enum crm_ipc_flags flags, int32_t ms_timeout, xmlNode **reply)
Definition: ipc.c:1199
xmlNode * create_request_adv(const char *task, xmlNode *xml_data, const char *host_to, const char *sys_to, const char *sys_from, const char *uuid_from, const char *origin)
Definition: ipc.c:105
crm_ipc_t * crm_ipc_new(const char *name, size_t max_size)
Definition: ipc.c:845
#define uint32_t
Definition: stdint.in.h:158
crm_ipc_flags
Definition: ipc.h:41
void crm_ipc_close(crm_ipc_t *client)
Definition: ipc.c:904
uint64_t flags
Definition: remote.c:156
#define int32_t
Definition: stdint.in.h:157