[BACK]Return to cms_lib.h CVS log [TXT][DIR] Up to [Development] / failsafe / FailSafe / cluster_services / include

File: [Development] / failsafe / FailSafe / cluster_services / include / cms_lib.h (download)

Revision 1.2, Wed Mar 28 01:52:33 2001 UTC (16 years, 7 months ago) by scotth
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +3 -3 lines

Fix *_LOG macro definitions to be correct ANSI C preprocessor usage:
remove incorrect ## usage and replace with correct: space-char.
bugzilla #61.

/*
 * Copyright (c) 2000,2001 Silicon Graphics, Inc.  All Rights Reserved.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 * 
 * This program is distributed in the hope that it would be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * 
 * Further, this software is distributed without any warranty that it is
 * free of the rightful claim of any third person regarding infringement
 * or the like.  Any license provided herein, whether implied or
 * otherwise, applies only to this software file.  Patent licenses, if
 * any, provided herein do not apply to combinations of this program with
 * other software, or any other product whatsoever.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
 * USA.
 * 
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 * Mountain View, CA 94043, or:
 * 
 * http://www.sgi.com 
 * 
 * For further information regarding this notice, see: 
 * 
 * http://oss.sgi.com/projects/GenInfo/NoticeExplan
 */
/* 
 * cms_lib.h
 *
 * What's in this file?
 */
#ident "$Id: cms_lib.h,v 1.2 2001/03/28 01:52:33 scotth Exp $"

#include <sys/param.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

#include <string.h>

#include <errno.h>
#include <unistd.h>
#include <netdb.h>
#include <signal.h>
#include <netinet/in.h>

#include <ci_log.h>
#include <ci_misc.h>
#include <ci_config.h>
#include <ci_cdbkeys.h>
#include <ci_clikeys.h>
#include <ci_pathnames.h>
#include "cms.h"

#define	CMSD_HAIPC_SIZE	(32 * 1024)

#define	CMS_IPC_PREFIX	"cms"

typedef enum cms_info_state_e {
    CIS_NEW		= 1,	/* The information has been newly obtained
				 * from cmsd. */
    CIS_PARTIAL		= 2,	/* The membership has been partially delivered
				 * to the client. */
    CIS_DELIVERED	= 3	/* The membership has been completely
				 * delivered to the client. */
} cms_info_state_t;

typedef	struct	__cms_servinfo_s {
	uint_t			clientid;
	uint_t			auth_base;
	uint_t			auth_spec;
	boolean_t		registred;
	boolean_t		debug;
  	cms_info_t		*prev_info;	/* Previous membership info.*/
	cms_info_t		*info;		/* Current membership info. */
  	cms_info_state_t	info_state;
	uint_t			sqn;		/* Local membership sequence
						 * number */
	uint_t			global_sqn;	/* Global membership sequence
						 * number. The number keeps on
						 * increasing as long as every
						 * two consecutive membership
						 * has at least one node in
						 * common. */
    	uint_t			prev_node_cnt;	/* Node count in previnfo */
  	uint_t			node_cnt;	/* Node count in info */
    	uint_t			change;
	struct timeval		tv;		/* Time since cur membership
						 * has been valid */
    	boolean_t		partial_memb;
} __cms_servinfo_t;

extern __cms_servinfo_t	*__cms_si;

extern	uint_t		__cms_node_cnt;
extern	pthread_mutex_t	__cms_mutex;

extern	char	__cms_dir[];
extern	char	__cms_options_file[];
extern	char	__cms_incarnation_file[];
extern	char	__cms_auth_spec_file[];
extern	char	__cms_auth_base_file[];
extern	char	__cms_ipc_file[];

ci_err_t	__cms_ipc_pulse(ci_clock_t);
ci_err_t	__cms_ipc_register(char *, sigset_t *, ci_clock_t);
ci_err_t	__cms_ipc_unregister(void);
ci_err_t	__cms_ipc_send(cmsd_service_msg_t *, int, char *);
ci_err_t	__cms_ipc_recv(cmsd_service_msg_t *, char *);
ci_err_t	__cms_ipc(cmsd_service_msg_t **, sigset_t *, int len, 
			  char *, boolean_t);
ci_err_t	__cms_check_reply(cmsd_service_msg_t *, cmsd_service_type_t, char *);
ci_err_t	__cms_log(uint32_t, ci_err_t, const char *, ...);
ci_err_t	__cms_service_init(void);
void		__cms_service_destroy(void);

#define CMS_LOG(args) (CI_LOG_START, __cms_log args, CI_LOG_END)