cfg.h
Go to the documentation of this file.
/*
* Copyright (c) 2005 MontaVista Software, Inc.
* Copyright (c) 2006-2013 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@redhat.com)
*
* This software licensed under BSD license, the text of which follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the MontaVista Software, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef COROSYNC_CFG_H_DEFINED
#define COROSYNC_CFG_H_DEFINED
#include <netinet/in.h>
#include <corosync/corotypes.h>
typedef uint64_t corosync_cfg_handle_t;
typedef enum {
COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST = 0,
COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS = 1,
COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE = 2,
} corosync_cfg_shutdown_flags_t;
typedef enum {
COROSYNC_CFG_SHUTDOWN_FLAG_NO = 0,
COROSYNC_CFG_SHUTDOWN_FLAG_YES = 1,
} corosync_cfg_shutdown_reply_flags_t;
typedef void (*corosync_cfg_shutdown_callback_t) (
corosync_cfg_handle_t cfg_handle,
corosync_cfg_shutdown_flags_t flags);
typedef struct {
corosync_cfg_shutdown_callback_t corosync_cfg_shutdown_callback;
} corosync_cfg_callbacks_t;
typedef struct
{
int address_length;
char address[sizeof(struct sockaddr_in6)];
} corosync_cfg_node_address_t;
/*
* Interfaces
*/
#ifdef __cplusplus
extern "C" {
#endif
cs_error_t
corosync_cfg_initialize (
corosync_cfg_handle_t *cfg_handle,
const corosync_cfg_callbacks_t *cfg_callbacks);
cs_error_t
corosync_cfg_fd_get (
corosync_cfg_handle_t cfg_handle,
int32_t *selection_fd);
cs_error_t
corosync_cfg_dispatch (
corosync_cfg_handle_t cfg_handle,
cs_dispatch_flags_t dispatch_flags);
cs_error_t
corosync_cfg_finalize (
corosync_cfg_handle_t cfg_handle);
cs_error_t
corosync_cfg_ring_status_get (
corosync_cfg_handle_t cfg_handle,
char ***interface_names,
char ***status,
unsigned int *interface_count);
typedef enum {
CFG_NODE_STATUS_V1 = 1,
} corosync_cfg_node_status_version_t;
#define CFG_MAX_HOST_LEN 256
#define CFG_MAX_LINKS 8
struct corosync_knet_link_status_v1 {
uint8_t enabled; /* link is configured and admin enabled for traffic */
uint8_t connected; /* link is connected for data (local view) */
uint8_t dynconnected; /* link has been activated by remote dynip */
unsigned int mtu; /* current detected MTU on this link */
char src_ipaddr[CFG_MAX_HOST_LEN];
char dst_ipaddr[CFG_MAX_HOST_LEN];
};
struct corosync_cfg_node_status_v1 {
corosync_cfg_node_status_version_t version;
unsigned int nodeid;
uint8_t reachable;
uint8_t remote;
uint8_t external;
uint8_t onwire_min;
uint8_t onwire_max;
uint8_t onwire_ver;
struct corosync_knet_link_status_v1 link_status[CFG_MAX_LINKS];
};
cs_error_t
corosync_cfg_node_status_get (
corosync_cfg_handle_t cfg_handle,
unsigned int nodeid,
corosync_cfg_node_status_version_t version,
void *node_status);
cs_error_t
corosync_cfg_kill_node (
corosync_cfg_handle_t cfg_handle,
unsigned int nodeid,
const char *reason);
cs_error_t
corosync_cfg_trackstart (
corosync_cfg_handle_t cfg_handle,
uint8_t track_flags);
cs_error_t
corosync_cfg_trackstop (
corosync_cfg_handle_t cfg_handle);
cs_error_t
corosync_cfg_try_shutdown (
corosync_cfg_handle_t cfg_handle,
corosync_cfg_shutdown_flags_t flags);
cs_error_t
corosync_cfg_replyto_shutdown (
corosync_cfg_handle_t cfg_handle,
corosync_cfg_shutdown_reply_flags_t flags);
cs_error_t
corosync_cfg_get_node_addrs (
corosync_cfg_handle_t cfg_handle,
unsigned int nodeid,
size_t max_addrs,
int *num_addrs,
corosync_cfg_node_address_t *addrs);
cs_error_t
corosync_cfg_local_get (
corosync_cfg_handle_t handle,
unsigned int *local_nodeid);
cs_error_t corosync_cfg_reload_config (
corosync_cfg_handle_t handle);
cs_error_t corosync_cfg_reopen_log_files (
corosync_cfg_handle_t handle);
#ifdef __cplusplus
}
#endif
#endif /* COROSYNC_CFG_H_DEFINED */
corosync_cfg_trackstart
cs_error_t corosync_cfg_trackstart(corosync_cfg_handle_t cfg_handle, uint8_t track_flags)
corosync_cfg_trackstart Track CFG for shutdown requests
Definition: lib/cfg.c:452
corosync_cfg_fd_get
cs_error_t corosync_cfg_fd_get(corosync_cfg_handle_t cfg_handle, int32_t *selection_fd)
corosync_cfg_fd_get
Definition: lib/cfg.c:126
corosync_cfg_finalize
cs_error_t corosync_cfg_finalize(corosync_cfg_handle_t cfg_handle)
corosync_cfg_finalize
Definition: lib/cfg.c:254
corosync_cfg_node_status_version_t
corosync_cfg_node_status_version_t
Definition: cfg.h:165
CFG_NODE_STATUS_V1
@ CFG_NODE_STATUS_V1
Definition: cfg.h:166
corosync_cfg_ring_status_get
cs_error_t corosync_cfg_ring_status_get(corosync_cfg_handle_t cfg_handle, char ***interface_names, char ***status, unsigned int *interface_count)
corosync_cfg_ring_status_get
Definition: lib/cfg.c:283
corosync_cfg_kill_node
cs_error_t corosync_cfg_kill_node(corosync_cfg_handle_t cfg_handle, unsigned int nodeid, const char *reason)
corosync_cfg_kill_node
Definition: lib/cfg.c:520
corosync_cfg_replyto_shutdown
cs_error_t corosync_cfg_replyto_shutdown(corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_reply_flags_t flags)
corosync_cfg_replyto_shutdown
Definition: lib/cfg.c:598
corosync_cfg_dispatch
cs_error_t corosync_cfg_dispatch(corosync_cfg_handle_t cfg_handle, cs_dispatch_flags_t dispatch_flags)
corosync_cfg_dispatch
Definition: lib/cfg.c:145
corosync_cfg_shutdown_callback_t
void(* corosync_cfg_shutdown_callback_t)(corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags)
corosync_cfg_shutdown_callback_t callback
Definition: cfg.h:74
corosync_cfg_trackstop
cs_error_t corosync_cfg_trackstop(corosync_cfg_handle_t cfg_handle)
corosync_cfg_trackstop Stop tracking CFG for shutdown requests
Definition: lib/cfg.c:487
corosync_cfg_initialize
cs_error_t corosync_cfg_initialize(corosync_cfg_handle_t *cfg_handle, const corosync_cfg_callbacks_t *cfg_callbacks)
corosync_cfg_initialize
Definition: lib/cfg.c:85
corosync_cfg_shutdown_reply_flags_t
corosync_cfg_shutdown_reply_flags_t
enum corosync_cfg_shutdown_reply_flags_t
Definition: cfg.h:66
COROSYNC_CFG_SHUTDOWN_FLAG_NO
@ COROSYNC_CFG_SHUTDOWN_FLAG_NO
Definition: cfg.h:67
COROSYNC_CFG_SHUTDOWN_FLAG_YES
@ COROSYNC_CFG_SHUTDOWN_FLAG_YES
Definition: cfg.h:68
corosync_cfg_handle_t
uint64_t corosync_cfg_handle_t
Definition: cfg.h:41
corosync_cfg_shutdown_flags_t
corosync_cfg_shutdown_flags_t
Shutdown types.
Definition: cfg.h:46
COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS
@ COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS
REGARDLESS will tell other daemons but ignore their opinions.
Definition: cfg.h:55
COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE
@ COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE
IMMEDIATE will shut down straight away (but still tell other nodes).
Definition: cfg.h:60
COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST
@ COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST
REQUEST is the normal shutdown.
Definition: cfg.h:51
corosync_cfg_reload_config
cs_error_t corosync_cfg_reload_config(corosync_cfg_handle_t handle)
corosync_cfg_reload_config
Definition: lib/cfg.c:759
corosync_cfg_get_node_addrs
cs_error_t corosync_cfg_get_node_addrs(corosync_cfg_handle_t cfg_handle, unsigned int nodeid, size_t max_addrs, int *num_addrs, corosync_cfg_node_address_t *addrs)
corosync_cfg_get_node_addrs
Definition: lib/cfg.c:630
corosync_cfg_reopen_log_files
cs_error_t corosync_cfg_reopen_log_files(corosync_cfg_handle_t handle)
Reopen logging files.
Definition: lib/cfg.c:798
corosync_cfg_local_get
cs_error_t corosync_cfg_local_get(corosync_cfg_handle_t handle, unsigned int *local_nodeid)
corosync_cfg_local_get
Definition: lib/cfg.c:717
CFG_MAX_LINKS
#define CFG_MAX_LINKS
Definition: cfg.h:170
corosync_cfg_try_shutdown
cs_error_t corosync_cfg_try_shutdown(corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags)
corosync_cfg_try_shutdown
Definition: lib/cfg.c:563
CFG_MAX_HOST_LEN
#define CFG_MAX_HOST_LEN
Definition: cfg.h:169
corosync_cfg_node_status_get
cs_error_t corosync_cfg_node_status_get(corosync_cfg_handle_t cfg_handle, unsigned int nodeid, corosync_cfg_node_status_version_t version, void *node_status)
corosync_cfg_node_status_get
Definition: lib/cfg.c:371
nodeid
unsigned int nodeid
Definition: coroapi.h:0
corotypes.h
cs_dispatch_flags_t
cs_dispatch_flags_t
The cs_dispatch_flags_t enum.
Definition: corotypes.h:84
cs_error_t
cs_error_t
The cs_error_t enum.
Definition: corotypes.h:98
flags
uint32_t flags
Definition: exec/votequorum.c:4
corosync_cfg_callbacks_t
struct corosync_cfg_shutdown_callback_t
Definition: cfg.h:81
corosync_cfg_callbacks_t::corosync_cfg_shutdown_callback
corosync_cfg_shutdown_callback_t corosync_cfg_shutdown_callback
Definition: cfg.h:82
corosync_cfg_node_address_t
A node address.
Definition: cfg.h:96
corosync_cfg_node_address_t::address_length
int address_length
Definition: cfg.h:97
corosync_cfg_node_status_v1
Definition: cfg.h:181
corosync_cfg_node_status_v1::onwire_ver
uint8_t onwire_ver
Definition: cfg.h:189
corosync_cfg_node_status_v1::remote
uint8_t remote
Definition: cfg.h:185
corosync_cfg_node_status_v1::link_status
struct corosync_knet_link_status_v1 link_status[CFG_MAX_LINKS]
Definition: cfg.h:190
corosync_cfg_node_status_v1::onwire_max
uint8_t onwire_max
Definition: cfg.h:188
corosync_cfg_node_status_v1::nodeid
unsigned int nodeid
Definition: cfg.h:183
corosync_cfg_node_status_v1::reachable
uint8_t reachable
Definition: cfg.h:184
corosync_cfg_node_status_v1::version
corosync_cfg_node_status_version_t version
Definition: cfg.h:182
corosync_cfg_node_status_v1::external
uint8_t external
Definition: cfg.h:186
corosync_cfg_node_status_v1::onwire_min
uint8_t onwire_min
Definition: cfg.h:187
corosync_knet_link_status_v1
Definition: cfg.h:172
corosync_knet_link_status_v1::enabled
uint8_t enabled
Definition: cfg.h:173
corosync_knet_link_status_v1::mtu
unsigned int mtu
Definition: cfg.h:176
corosync_knet_link_status_v1::connected
uint8_t connected
Definition: cfg.h:174
corosync_knet_link_status_v1::dynconnected
uint8_t dynconnected
Definition: cfg.h:175
corosync_knet_link_status_v1::dst_ipaddr
char dst_ipaddr[CFG_MAX_HOST_LEN]
Definition: cfg.h:178
corosync_knet_link_status_v1::src_ipaddr
char src_ipaddr[CFG_MAX_HOST_LEN]
Definition: cfg.h:177
version
char version
Definition: totem.h:1