root/crmd/crmd_messages.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright (C) 2004 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 XML_CRM_MESSAGES__H
  19 #  define XML_CRM_MESSAGES__H
  20 
  21 #  include <crm/crm.h>
  22 #  include <crm/common/ipcs.h>
  23 #  include <crm/common/xml.h>
  24 #  include <crm/cluster/internal.h>
  25 #  include <crmd_fsa.h>
  26 
  27 typedef struct ha_msg_input_s {
  28     xmlNode *msg;
  29     xmlNode *xml;
  30 
  31 } ha_msg_input_t;
  32 
  33 extern ha_msg_input_t *new_ha_msg_input(xmlNode * orig);
  34 extern void delete_ha_msg_input(ha_msg_input_t * orig);
  35 
  36 extern void *fsa_typed_data_adv(fsa_data_t * fsa_data, enum fsa_data_type a_type,
  37                                 const char *caller);
  38 
  39 #  define fsa_typed_data(x) fsa_typed_data_adv(msg_data, x, __FUNCTION__)
  40 
  41 extern void register_fsa_error_adv(enum crmd_fsa_cause cause, enum crmd_fsa_input input,
  42                                    fsa_data_t * cur_data, void *new_data, const char *raised_from);
  43 
  44 #  define register_fsa_error(cause, input, new_data) register_fsa_error_adv(cause, input, msg_data, new_data, __FUNCTION__)
  45 
  46 extern int register_fsa_input_adv(enum crmd_fsa_cause cause, enum crmd_fsa_input input,
  47                                   void *data, long long with_actions,
  48                                   gboolean prepend, const char *raised_from);
  49 
  50 extern void fsa_dump_queue(int log_level);
  51 extern void route_message(enum crmd_fsa_cause cause, xmlNode * input);
  52 
  53 #  define crmd_fsa_stall(suppress) do {                                 \
  54     if(suppress == FALSE && msg_data != NULL) {                         \
  55         register_fsa_input_adv(                                         \
  56             ((fsa_data_t*)msg_data)->fsa_cause, I_WAIT_FOR_EVENT,       \
  57             ((fsa_data_t*)msg_data)->data, action, TRUE, __FUNCTION__); \
  58     } else {                                                            \
  59         register_fsa_input_adv(                                         \
  60             C_FSA_INTERNAL, I_WAIT_FOR_EVENT,                           \
  61             NULL, action, TRUE, __FUNCTION__);                          \
  62     }                                                                   \
  63     } while(0)
  64 
  65 #  define register_fsa_input(cause, input, data) register_fsa_input_adv(cause, input, data, A_NOTHING, FALSE, __FUNCTION__)
  66 
  67 #  define register_fsa_action(action) {                                 \
  68                 fsa_actions |= action;                                  \
  69                 if(fsa_source) {                                        \
  70                         mainloop_set_trigger(fsa_source);                       \
  71                 }                                                       \
  72                 crm_debug("%s added action %s to the FSA",              \
  73                           __FUNCTION__, fsa_action2string(action));     \
  74         }
  75 
  76 #  define register_fsa_input_before(cause, input, data) register_fsa_input_adv(cause, input, data, A_NOTHING, TRUE, __FUNCTION__)
  77 
  78 #  define register_fsa_input_later(cause, input, data) register_fsa_input_adv(cause, input, data, A_NOTHING, FALSE, __FUNCTION__)
  79 
  80 void delete_fsa_input(fsa_data_t * fsa_data);
  81 
  82 GListPtr put_message(fsa_data_t * new_message);
  83 fsa_data_t *get_message(void);
  84 gboolean is_message(void);
  85 gboolean have_wait_message(void);
  86 
  87 extern gboolean relay_message(xmlNode * relay_message, gboolean originated_locally);
  88 
  89 extern void process_message(xmlNode * msg, gboolean originated_locally, const char *src_node_name);
  90 
  91 extern gboolean crm_dc_process_message(xmlNode * whole_message,
  92                                        xmlNode * action,
  93                                        const char *host_from,
  94                                        const char *sys_from,
  95                                        const char *sys_to, const char *op, gboolean dc_mode);
  96 
  97 extern gboolean send_msg_via_ipc(xmlNode * msg, const char *sys);
  98 
  99 extern gboolean add_pending_outgoing_reply(const char *originating_node_name,
 100                                            const char *crm_msg_reference,
 101                                            const char *sys_to, const char *sys_from);
 102 
 103 gboolean crmd_is_proxy_session(const char *session);
 104 void crmd_proxy_send(const char *session, xmlNode *msg);
 105 
 106 extern gboolean crmd_authorize_message(xmlNode * client_msg, crm_client_t * curr_client, const char *proxy_session);
 107 
 108 extern gboolean send_request(xmlNode * msg, char **msg_reference);
 109 
 110 extern enum crmd_fsa_input handle_message(xmlNode * stored_msg, enum crmd_fsa_cause cause);
 111 
 112 extern ha_msg_input_t *copy_ha_msg_input(ha_msg_input_t * orig);
 113 
 114 void send_remote_state_message(const char *node_name, gboolean node_up);
 115 
 116 #endif

/* [previous][next][first][last][top][bottom][index][help] */