pacemaker
2.1.9-49aab99839
Scalable High-Availability cluster resource manager
|
IPC interface to Pacemaker daemons. More...
Go to the source code of this file.
Macros | |
#define | create_reply(request, xml_response_data) create_reply_adv(request, xml_response_data, __func__) |
#define | create_request(task, xml_data, host_to, sys_to, sys_from, uuid_from) |
Typedefs | |
typedef struct pcmk_ipc_api_s | pcmk_ipc_api_t |
Client connection to Pacemaker IPC. More... | |
typedef void(* | pcmk_ipc_callback_t) (pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type, crm_exit_t status, void *event_data, void *user_data) |
Callback function type for Pacemaker daemon IPC APIs. More... | |
typedef struct crm_ipc_s | crm_ipc_t |
Enumerations | |
enum | pcmk_ipc_server { pcmk_ipc_attrd, pcmk_ipc_based, pcmk_ipc_controld, pcmk_ipc_execd, pcmk_ipc_fenced, pcmk_ipc_pacemakerd, pcmk_ipc_schedulerd } |
Available IPC interfaces. More... | |
enum | pcmk_ipc_event { pcmk_ipc_event_connect, pcmk_ipc_event_disconnect, pcmk_ipc_event_reply, pcmk_ipc_event_notify } |
Possible event types that an IPC event callback can be called for. More... | |
enum | pcmk_ipc_dispatch { pcmk_ipc_dispatch_main, pcmk_ipc_dispatch_poll, pcmk_ipc_dispatch_sync } |
How IPC replies should be dispatched. More... | |
enum | crm_ipc_flags { crm_ipc_flags_none = 0x00000000, crm_ipc_compressed = 0x00000001, crm_ipc_proxied = 0x00000100, crm_ipc_client_response = 0x00000200, crm_ipc_server_event = 0x00010000, crm_ipc_server_free = 0x00020000, crm_ipc_proxied_relay_response = 0x00040000, crm_ipc_server_info = 0x00100000, crm_ipc_server_error = 0x00200000 } |
Functions | |
xmlNode * | create_reply_adv (const xmlNode *request, xmlNode *xml_response_data, const char *origin) |
Create a Pacemaker reply (for IPC or cluster layer) More... | |
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) |
Create a Pacemaker request (for IPC or cluster layer) More... | |
int | pcmk_new_ipc_api (pcmk_ipc_api_t **api, enum pcmk_ipc_server server) |
Create a new object for using Pacemaker daemon IPC. More... | |
void | pcmk_free_ipc_api (pcmk_ipc_api_t *api) |
Free the contents of an IPC API object. More... | |
int | pcmk_connect_ipc (pcmk_ipc_api_t *api, enum pcmk_ipc_dispatch dispatch_type) |
Connect to a Pacemaker daemon via IPC. More... | |
void | pcmk_disconnect_ipc (pcmk_ipc_api_t *api) |
Disconnect an IPC API instance. More... | |
int | pcmk_poll_ipc (const pcmk_ipc_api_t *api, int timeout_ms) |
Check whether an IPC connection has data available (without main loop) More... | |
void | pcmk_dispatch_ipc (pcmk_ipc_api_t *api) |
Dispatch available messages on an IPC connection (without main loop) More... | |
void | pcmk_register_ipc_callback (pcmk_ipc_api_t *api, pcmk_ipc_callback_t cb, void *user_data) |
Register a callback for IPC API events. More... | |
const char * | pcmk_ipc_name (const pcmk_ipc_api_t *api, bool for_log) |
Get the IPC name used with an IPC API connection. More... | |
bool | pcmk_ipc_is_connected (pcmk_ipc_api_t *api) |
Check whether an IPC API connection is active. More... | |
int | pcmk_ipc_purge_node (pcmk_ipc_api_t *api, const char *node_name, uint32_t nodeid) |
Ask a Pacemaker daemon to purge a node from its peer cache. More... | |
crm_ipc_t * | crm_ipc_new (const char *name, size_t max_size) |
Create a new (legacy) object for using Pacemaker daemon IPC. More... | |
bool | crm_ipc_connect (crm_ipc_t *client) |
Establish an IPC connection to a Pacemaker component. More... | |
void | crm_ipc_close (crm_ipc_t *client) |
void | crm_ipc_destroy (crm_ipc_t *client) |
void | pcmk_free_ipc_event (struct iovec *event) |
Free an I/O vector created by pcmk__ipc_prepare_iov() More... | |
int | crm_ipc_send (crm_ipc_t *client, const xmlNode *message, enum crm_ipc_flags flags, int32_t ms_timeout, xmlNode **reply) |
Send an IPC XML message. More... | |
int | crm_ipc_get_fd (crm_ipc_t *client) |
bool | crm_ipc_connected (crm_ipc_t *client) |
int | crm_ipc_ready (crm_ipc_t *client) |
Check whether an IPC connection is ready to be read. More... | |
long | crm_ipc_read (crm_ipc_t *client) |
const char * | crm_ipc_buffer (crm_ipc_t *client) |
uint32_t | crm_ipc_buffer_flags (crm_ipc_t *client) |
const char * | crm_ipc_name (crm_ipc_t *client) |
unsigned int | crm_ipc_default_buffer_size (void) |
Return pacemaker's default IPC buffer size. More... | |
int | crm_ipc_is_authentic_process (int sock, uid_t refuid, gid_t refgid, pid_t *gotpid, uid_t *gotuid, gid_t *gotgid) |
Check the authenticity of the IPC socket peer process (legacy) More... | |
xmlNode * | create_hello_message (const char *uuid, const char *client_name, const char *major_version, const char *minor_version) |
Create XML for a controller IPC "hello" message. More... | |
IPC interface to Pacemaker daemons.
Definition in file ipc.h.
#define create_reply | ( | request, | |
xml_response_data | |||
) | create_reply_adv(request, xml_response_data, __func__) |
#define create_request | ( | task, | |
xml_data, | |||
host_to, | |||
sys_to, | |||
sys_from, | |||
uuid_from | |||
) |
typedef struct pcmk_ipc_api_s pcmk_ipc_api_t |
typedef void(* pcmk_ipc_callback_t) (pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type, crm_exit_t status, void *event_data, void *user_data) |
Callback function type for Pacemaker daemon IPC APIs.
[in,out] | api | IPC API connection |
[in] | event_type | The type of event that occurred |
[in] | status | Event status |
[in,out] | event_data | Event-specific data |
[in,out] | user_data | Caller data provided when callback was registered |
enum crm_ipc_flags |
Enumerator | |
---|---|
crm_ipc_flags_none | |
crm_ipc_compressed | |
crm_ipc_proxied | |
crm_ipc_client_response | |
crm_ipc_server_event | |
crm_ipc_server_free | |
crm_ipc_proxied_relay_response | |
crm_ipc_server_info |
|
crm_ipc_server_error |
|
enum pcmk_ipc_dispatch |
enum pcmk_ipc_event |
Possible event types that an IPC event callback can be called for.
enum pcmk_ipc_server |
xmlNode* create_hello_message | ( | const char * | uuid, |
const char * | client_name, | ||
const char * | major_version, | ||
const char * | minor_version | ||
) |
Create XML for a controller IPC "hello" message.
Definition at line 627 of file ipc_controld.c.
xmlNode* create_reply_adv | ( | const xmlNode * | original_request, |
xmlNode * | xml_response_data, | ||
const char * | origin | ||
) |
Create a Pacemaker reply (for IPC or cluster layer)
[in] | original_request | XML of request this is a reply to |
[in] | xml_response_data | XML to copy as data section of reply |
[in] | origin | Name of function that called this one |
Definition at line 104 of file messages.c.
xmlNode* create_request_adv | ( | const char * | task, |
xmlNode * | msg_data, | ||
const char * | host_to, | ||
const char * | sys_to, | ||
const char * | sys_from, | ||
const char * | uuid_from, | ||
const char * | origin | ||
) |
Create a Pacemaker request (for IPC or cluster layer)
[in] | task | What to set as the request's task |
[in] | msg_data | What to add as the request's data contents |
[in] | host_to | What to set as the request's destination host |
[in] | sys_to | What to set as the request's destination system |
[in] | sys_from | If not NULL, set as request's origin system |
[in] | uuid_from | If not NULL, use in request's origin system |
[in] | origin | Name of function that called this one |
Definition at line 40 of file messages.c.
const char* crm_ipc_buffer | ( | crm_ipc_t * | client | ) |
Definition at line 1206 of file ipc_client.c.
uint32_t crm_ipc_buffer_flags | ( | crm_ipc_t * | client | ) |
Definition at line 1213 of file ipc_client.c.
void crm_ipc_close | ( | crm_ipc_t * | client | ) |
Definition at line 993 of file ipc_client.c.
bool crm_ipc_connect | ( | crm_ipc_t * | client | ) |
Establish an IPC connection to a Pacemaker component.
[in,out] | client | Connection instance obtained from crm_ipc_new() |
Definition at line 968 of file ipc_client.c.
bool crm_ipc_connected | ( | crm_ipc_t * | client | ) |
Definition at line 1068 of file ipc_client.c.
unsigned int crm_ipc_default_buffer_size | ( | void | ) |
Return pacemaker's default IPC buffer size.
Definition at line 88 of file ipc_common.c.
void crm_ipc_destroy | ( | crm_ipc_t * | client | ) |
Definition at line 1006 of file ipc_client.c.
int crm_ipc_get_fd | ( | crm_ipc_t * | client | ) |
Definition at line 1054 of file ipc_client.c.
int crm_ipc_is_authentic_process | ( | int | sock, |
uid_t | refuid, | ||
gid_t | refgid, | ||
pid_t * | gotpid, | ||
uid_t * | gotuid, | ||
gid_t * | gotgid | ||
) |
Check the authenticity of the IPC socket peer process (legacy)
If everything goes well, peer's authenticity is verified by the means of comparing against provided referential UID and GID (either satisfies), and the result of this check can be deduced from the return value. As an exception, detected UID of 0 ("root") satisfies arbitrary provided referential daemon's credentials.
[in] | sock | IPC related, connected Unix socket to check peer of |
[in] | refuid | referential UID to check against |
[in] | refgid | referential GID to check against |
[out] | gotpid | to optionally store obtained PID of the peer (not available on FreeBSD, special value of 1 used instead, and the caller is required to special case this value respectively) |
[out] | gotuid | to optionally store obtained UID of the peer |
[out] | gotgid | to optionally store obtained GID of the peer |
refuid
, or at least its group matches refgid
), either or both (in case of UID=0) mismatches on the expected credentials of such peer process shall be investigated at the caller when value of 1 gets returned there, since higher-than-expected privileges in respect to the expected/intended credentials possibly violate the least privilege principle and may pose an additional risk (i.e. such accidental inconsistency shall be eventually fixed). Definition at line 1572 of file ipc_client.c.
const char* crm_ipc_name | ( | crm_ipc_t * | client | ) |
Definition at line 1227 of file ipc_client.c.
crm_ipc_t* crm_ipc_new | ( | const char * | name, |
size_t | max_size | ||
) |
Create a new (legacy) object for using Pacemaker daemon IPC.
[in] | name | IPC system name to connect to |
[in] | max_size | Use a maximum IPC buffer size of at least this size |
Definition at line 850 of file ipc_client.c.
long crm_ipc_read | ( | crm_ipc_t * | client | ) |
Definition at line 1158 of file ipc_client.c.
int crm_ipc_ready | ( | crm_ipc_t * | client | ) |
Check whether an IPC connection is ready to be read.
[in,out] | client | Connection to check |
Definition at line 1100 of file ipc_client.c.
int crm_ipc_send | ( | crm_ipc_t * | client, |
const xmlNode * | message, | ||
enum crm_ipc_flags | flags, | ||
int32_t | ms_timeout, | ||
xmlNode ** | reply | ||
) |
Send an IPC XML message.
[in,out] | client | Connection to IPC server |
[in] | message | XML message to send |
[in] | flags | Bitmask of crm_ipc_flags |
[in] | ms_timeout | Give up if not sent within this much time (5 seconds if 0, or no timeout if negative) |
[out] | reply | Reply from server (or NULL if none) |
Definition at line 1300 of file ipc_client.c.
int pcmk_connect_ipc | ( | pcmk_ipc_api_t * | api, |
enum pcmk_ipc_dispatch | dispatch_type | ||
) |
Connect to a Pacemaker daemon via IPC.
[in,out] | api | IPC API instance |
[in] | dispatch_type | How IPC replies should be dispatched |
Definition at line 571 of file ipc_client.c.
void pcmk_disconnect_ipc | ( | pcmk_ipc_api_t * | api | ) |
Disconnect an IPC API instance.
[in,out] | api | IPC API connection |
Definition at line 594 of file ipc_client.c.
void pcmk_dispatch_ipc | ( | pcmk_ipc_api_t * | api | ) |
Dispatch available messages on an IPC connection (without main loop)
[in,out] | api | IPC API connection |
Definition at line 439 of file ipc_client.c.
void pcmk_free_ipc_api | ( | pcmk_ipc_api_t * | api | ) |
Free the contents of an IPC API object.
[in,out] | api | IPC API object to free |
Definition at line 206 of file ipc_client.c.
void pcmk_free_ipc_event | ( | struct iovec * | event | ) |
Free an I/O vector created by pcmk__ipc_prepare_iov()
[in,out] | event | I/O vector to free |
Definition at line 259 of file ipc_server.c.
bool pcmk_ipc_is_connected | ( | pcmk_ipc_api_t * | api | ) |
Check whether an IPC API connection is active.
[in,out] | api | IPC API connection |
Definition at line 287 of file ipc_client.c.
const char* pcmk_ipc_name | ( | const pcmk_ipc_api_t * | api, |
bool | for_log | ||
) |
Get the IPC name used with an IPC API connection.
[in] | api | IPC API connection |
[in] | for_log | If true, return human-friendly name instead of IPC name |
Definition at line 247 of file ipc_client.c.
int pcmk_ipc_purge_node | ( | pcmk_ipc_api_t * | api, |
const char * | node_name, | ||
uint32_t | nodeid | ||
) |
Ask a Pacemaker daemon to purge a node from its peer cache.
[in,out] | api | IPC API connection |
[in] | node_name | If not NULL, name of node to purge |
[in] | nodeid | If not 0, node ID of node to purge |
Definition at line 797 of file ipc_client.c.
int pcmk_new_ipc_api | ( | pcmk_ipc_api_t ** | api, |
enum pcmk_ipc_server | server | ||
) |
Create a new object for using Pacemaker daemon IPC.
[out] | api | Where to store new IPC object |
[in] | server | Which Pacemaker daemon the object is for |
Definition at line 51 of file ipc_client.c.
int pcmk_poll_ipc | ( | const pcmk_ipc_api_t * | api, |
int | timeout_ms | ||
) |
Check whether an IPC connection has data available (without main loop)
[in] | api | IPC API connection |
[in] | timeout_ms | If less than 0, poll indefinitely; if 0, poll once and return immediately; otherwise, poll for up to this many milliseconds |
Definition at line 399 of file ipc_client.c.
void pcmk_register_ipc_callback | ( | pcmk_ipc_api_t * | api, |
pcmk_ipc_callback_t | cb, | ||
void * | user_data | ||
) |
Register a callback for IPC API events.
[in,out] | api | IPC API connection |
[in] | callback | Callback to register |
[in] | userdata | Caller data to pass to callback |
Definition at line 645 of file ipc_client.c.