Motr  M0
ham.c File Reference
#include "lib/trace.h"
#include "module/instance.h"
#include "motr/init.h"
#include "net/net.h"
#include "net/buffer_pool.h"
#include "reqh/reqh.h"
#include "rpc/rpc_machine.h"
#include "rpc/rpc.h"
#include "ha/ha.h"
#include "ha/link.h"
#include "lib/memory.h"
#include "lib/string.h"
#include <libgen.h>
#include <getopt.h>
#include <unistd.h>
Include dependency graph for ham.c:

Go to the source code of this file.

Data Structures

struct  ham_params
 
struct  ham_rpc_ctx
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_HA
 
#define HAM_SERVER_EP_DEFAULT   "0@lo:12345:43:100"
 
#define HAM_CLIENT_EP_DEFAULT   "0@lo:12345:43:101"
 
#define HAM_SERVER_WAIT_DEFAULT   0
 

Enumerations

enum  ham_mode { HM_CONNECT, HM_LISTEN, HM_SELF_CHECK }
 
enum  { HAM_ID = 72 }
 

Functions

static void * xcode_read_as (const struct m0_xcode_type *type, const char *str, int *rc)
 
static bool ha_msg_is_one_way (const struct m0_ha_msg *msg)
 
static void ham_say (const char *format,...)
 
static void ham_xcode_print (const struct m0_xcode_obj *x)
 
static int ham_fread_str (char *dest, size_t size, FILE *src)
 
static void ham_rpc_ctx_init (struct ham_rpc_ctx *ctx, const char *local_endpoint, const struct m0_fid *local_process)
 
static void ham_rpc_ctx_fini (struct ham_rpc_ctx *ctx)
 
static void ham_send (struct m0_ha *ha, struct m0_ha_link *hl, const struct m0_ha_msg *msg)
 
static void ham_entrypoint_request (struct m0_ha *ha, const struct m0_ha_entrypoint_req *req, const struct m0_uint128 *req_id)
 
static void ham_entrypoint_replied (struct m0_ha *ha, struct m0_ha_entrypoint_rep *rep)
 
static void ham_msg_received (struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg, uint64_t tag)
 
static void ham_msg_is_delivered (struct m0_ha *ha, struct m0_ha_link *hl, uint64_t tag)
 
static void ham_msg_is_not_delivered (struct m0_ha *ha, struct m0_ha_link *hl, uint64_t tag)
 
static void ham_link_connected (struct m0_ha *ha, const struct m0_uint128 *req_id, struct m0_ha_link *hl)
 
static void ham_link_reused (struct m0_ha *ha, const struct m0_uint128 *req_id, struct m0_ha_link *hl)
 
static void ham_link_absent (struct m0_ha *ha, const struct m0_uint128 *req_id)
 
static void ham_link_is_disconnecting (struct m0_ha *ha, struct m0_ha_link *hl)
 
static void ham_link_disconnected (struct m0_ha *ha, struct m0_ha_link *hl)
 
static void ham_sighandler (int signum)
 
static int ham_sighandler_init (void)
 
static int ham_params_check (struct ham_params *params)
 
static void ham_help (FILE *stream, char *progname)
 
static int ham_args_parse (struct ham_params *params, int argc, char *const *argv)
 
static void ham_maybe_set (const char **dest, const char *value)
 
int main (int argc, char **argv)
 

Variables

static struct ham_params g_params
 
static struct m0_semaphore g_sem
 
static struct m0_ha_msgg_msg
 
static struct m0_uint128 g_self_req_id
 
static const struct m0_ha_msg ham_self_check_msg_default
 
static const struct m0_ha_ops ham_ha_ops