pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
lrmd_client.c File Reference
#include <crm_internal.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <glib.h>
#include <dirent.h>
#include <crm/crm.h>
#include <crm/lrmd.h>
#include <crm/lrmd_internal.h>
#include <crm/services.h>
#include <crm/services_internal.h>
#include <crm/common/mainloop.h>
#include <crm/common/ipc_internal.h>
#include <crm/common/remote_internal.h>
#include <crm/common/tls_internal.h>
#include <crm/common/xml.h>
#include <crm/stonith-ng.h>
#include <crm/fencing/internal.h>
#include <gnutls/gnutls.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <netdb.h>
Include dependency graph for lrmd_client.c:

Go to the source code of this file.

Macros

#define MAX_TLS_RECV_WAIT   10000
 
#define TLS_HANDSHAKE_TIMEOUT   5
 
#define KEY_READ_LEN   256
 

Typedefs

typedef struct lrmd_private_s lrmd_private_t
 

Functions

 CRM_TRACE_INIT_DATA (lrmd)
 
int lrmd_internal_proxy_send (lrmd_t *lrmd, xmlNode *msg)
 
void lrmd_internal_set_proxy_callback (lrmd_t *lrmd, void *userdata, void(*callback)(lrmd_t *lrmd, void *userdata, xmlNode *msg))
 
void lrmd_list_freeall (lrmd_list_t *head)
 
lrmd_key_value_tlrmd_key_value_add (lrmd_key_value_t *head, const char *key, const char *value)
 
void lrmd_key_value_freeall (lrmd_key_value_t *head)
 
lrmd_event_data_tlrmd_new_event (const char *rsc_id, const char *task, guint interval_ms)
 Create a new lrmd_event_data_t object.
 
lrmd_event_data_tlrmd_copy_event (lrmd_event_data_t *event)
 
void lrmd_free_event (lrmd_event_data_t *event)
 Free an executor event.
 
int lrmd_poll (lrmd_t *lrmd, int timeout)
 Check whether a message is available on an executor connection.
 
bool lrmd_dispatch (lrmd_t *lrmd)
 Use after lrmd_poll returns 1 to read and dispatch a message.
 
int lrmd__remote_send_xml (pcmk__remote_t *session, xmlNode *msg, uint32_t id, const char *msg_type)
 
int lrmd__validate_remote_settings (lrmd_t *lrmd, GHashTable *hash)
 
int lrmd__init_remote_key (gnutls_datum_t *key)
 
lrmd_rsc_info_tlrmd_new_rsc_info (const char *rsc_id, const char *standard, const char *provider, const char *type)
 
lrmd_rsc_info_tlrmd_copy_rsc_info (lrmd_rsc_info_t *rsc_info)
 
void lrmd_free_rsc_info (lrmd_rsc_info_t *rsc_info)
 
void lrmd_free_op_info (lrmd_op_info_t *op_info)
 
int lrmd__new (lrmd_t **api, const char *nodename, const char *server, int port)
 
lrmd_tlrmd_api_new (void)
 Create a new connection to the local executor.
 
lrmd_tlrmd_remote_api_new (const char *nodename, const char *server, int port)
 Create a new TLS connection to a remote executor.
 
void lrmd_api_delete (lrmd_t *lrmd)
 Destroy executor connection object.
 
int lrmd__metadata_async (const lrmd_rsc_info_t *rsc, void(*callback)(int pid, const pcmk__action_result_t *result, void *user_data), void *user_data)
 
void lrmd__set_result (lrmd_event_data_t *event, enum ocf_exitcode rc, int op_status, const char *exit_reason)
 
void lrmd__reset_result (lrmd_event_data_t *event)
 
time_t lrmd__uptime (lrmd_t *lrmd)
 
const char * lrmd__node_start_state (lrmd_t *lrmd)
 

Macro Definition Documentation

◆ KEY_READ_LEN

#define KEY_READ_LEN   256

Definition at line 1176 of file lrmd_client.c.

◆ MAX_TLS_RECV_WAIT

#define MAX_TLS_RECV_WAIT   10000

Definition at line 48 of file lrmd_client.c.

◆ TLS_HANDSHAKE_TIMEOUT

#define TLS_HANDSHAKE_TIMEOUT   5

Definition at line 61 of file lrmd_client.c.

Typedef Documentation

◆ lrmd_private_t

typedef struct lrmd_private_s lrmd_private_t

Function Documentation

◆ CRM_TRACE_INIT_DATA()

CRM_TRACE_INIT_DATA ( lrmd )

◆ lrmd__init_remote_key()

int lrmd__init_remote_key ( gnutls_datum_t * key)

Definition at line 1324 of file lrmd_client.c.

◆ lrmd__metadata_async()

int lrmd__metadata_async ( const lrmd_rsc_info_t * rsc,
void(* callback )(int pid, const pcmk__action_result_t *result, void *user_data),
void * user_data )

Definition at line 2538 of file lrmd_client.c.

◆ lrmd__new()

int lrmd__new ( lrmd_t ** api,
const char * nodename,
const char * server,
int port )

Definition at line 2371 of file lrmd_client.c.

◆ lrmd__node_start_state()

const char * lrmd__node_start_state ( lrmd_t * lrmd)

Definition at line 2675 of file lrmd_client.c.

◆ lrmd__remote_send_xml()

int lrmd__remote_send_xml ( pcmk__remote_t * session,
xmlNode * msg,
uint32_t id,
const char * msg_type )

Definition at line 668 of file lrmd_client.c.

◆ lrmd__reset_result()

void lrmd__reset_result ( lrmd_event_data_t * event)

Definition at line 2639 of file lrmd_client.c.

◆ lrmd__set_result()

void lrmd__set_result ( lrmd_event_data_t * event,
enum ocf_exitcode rc,
int op_status,
const char * exit_reason )

Definition at line 2618 of file lrmd_client.c.

◆ lrmd__uptime()

time_t lrmd__uptime ( lrmd_t * lrmd)

Definition at line 2663 of file lrmd_client.c.

◆ lrmd__validate_remote_settings()

int lrmd__validate_remote_settings ( lrmd_t * lrmd,
GHashTable * hash )

Definition at line 983 of file lrmd_client.c.

◆ lrmd_api_delete()

void lrmd_api_delete ( lrmd_t * lrmd)

Destroy executor connection object.

Parameters
[in,out]lrmdExecutor connection object to destroy

Definition at line 2469 of file lrmd_client.c.

◆ lrmd_api_new()

lrmd_t * lrmd_api_new ( void )

Create a new connection to the local executor.

Definition at line 2451 of file lrmd_client.c.

◆ lrmd_copy_event()

lrmd_event_data_t * lrmd_copy_event ( lrmd_event_data_t * event)

Definition at line 207 of file lrmd_client.c.

◆ lrmd_copy_rsc_info()

lrmd_rsc_info_t * lrmd_copy_rsc_info ( lrmd_rsc_info_t * rsc_info)

Definition at line 1885 of file lrmd_client.c.

◆ lrmd_dispatch()

bool lrmd_dispatch ( lrmd_t * lrmd)

Use after lrmd_poll returns 1 to read and dispatch a message.

Parameters
[in,out]lrmdExecutor connection object
Returns
TRUE if connection is still up, FALSE if disconnected

Definition at line 527 of file lrmd_client.c.

◆ lrmd_free_event()

void lrmd_free_event ( lrmd_event_data_t * event)

Free an executor event.

Parameters
[in,out]Executorevent object to free

Definition at line 246 of file lrmd_client.c.

◆ lrmd_free_op_info()

void lrmd_free_op_info ( lrmd_op_info_t * op_info)

Definition at line 1942 of file lrmd_client.c.

◆ lrmd_free_rsc_info()

void lrmd_free_rsc_info ( lrmd_rsc_info_t * rsc_info)

Definition at line 1892 of file lrmd_client.c.

◆ lrmd_internal_proxy_send()

int lrmd_internal_proxy_send ( lrmd_t * lrmd,
xmlNode * msg )

Definition at line 2049 of file lrmd_client.c.

◆ lrmd_internal_set_proxy_callback()

void lrmd_internal_set_proxy_callback ( lrmd_t * lrmd,
void * userdata,
void(* callback )(lrmd_t *lrmd, void *userdata, xmlNode *msg) )

Definition at line 2029 of file lrmd_client.c.

◆ lrmd_key_value_add()

lrmd_key_value_t * lrmd_key_value_add ( lrmd_key_value_t * head,
const char * key,
const char * value )

Definition at line 146 of file lrmd_client.c.

◆ lrmd_key_value_freeall()

void lrmd_key_value_freeall ( lrmd_key_value_t * head)

Definition at line 169 of file lrmd_client.c.

◆ lrmd_list_freeall()

void lrmd_list_freeall ( lrmd_list_t * head)

Definition at line 131 of file lrmd_client.c.

◆ lrmd_new_event()

lrmd_event_data_t * lrmd_new_event ( const char * rsc_id,
const char * task,
guint interval_ms )

Create a new lrmd_event_data_t object.

Parameters
[in]rsc_idID of resource involved in event
[in]taskAction name
[in]interval_msAction interval
Returns
Newly allocated and initialized lrmd_event_data_t
Note
This functions asserts on memory errors, so the return value is guaranteed to be non-NULL. The caller is responsible for freeing the result with lrmd_free_event().

Definition at line 195 of file lrmd_client.c.

◆ lrmd_new_rsc_info()

lrmd_rsc_info_t * lrmd_new_rsc_info ( const char * rsc_id,
const char * standard,
const char * provider,
const char * type )

Definition at line 1872 of file lrmd_client.c.

◆ lrmd_poll()

int lrmd_poll ( lrmd_t * lrmd,
int timeout )

Check whether a message is available on an executor connection.

Parameters
[in,out]lrmdExecutor connection object to check
[in]timeoutCurrently ignored
Return values
1Message is ready
0Timeout occurred
negativeerrno Error occurred
Note
This is intended for callers that do not use a main loop.

Definition at line 495 of file lrmd_client.c.

◆ lrmd_remote_api_new()

lrmd_t * lrmd_remote_api_new ( const char * nodename,
const char * server,
int port )

Create a new TLS connection to a remote executor.

Parameters
[in]nodenameName of remote node identified with this connection
[in]serverHostname to connect to
[in]portPort number to connect to (or 0 to use default)
Returns
Newly created executor connection object
Note
If only one of nodename and server is non-NULL, it will be used for both purposes. If both are NULL, a local IPC connection will be created instead.

Definition at line 2460 of file lrmd_client.c.