fmd_xprt.h revision d9638e547d8811f2c689977f8dd2a353938b61fd
d9638e547d8811f2c689977f8dd2a353938b61fdmws * CDDL HEADER START
d9638e547d8811f2c689977f8dd2a353938b61fdmws * The contents of this file are subject to the terms of the
d9638e547d8811f2c689977f8dd2a353938b61fdmws * Common Development and Distribution License, Version 1.0 only
d9638e547d8811f2c689977f8dd2a353938b61fdmws * (the "License"). You may not use this file except in compliance
d9638e547d8811f2c689977f8dd2a353938b61fdmws * with the License.
d9638e547d8811f2c689977f8dd2a353938b61fdmws * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d9638e547d8811f2c689977f8dd2a353938b61fdmws * See the License for the specific language governing permissions
d9638e547d8811f2c689977f8dd2a353938b61fdmws * and limitations under the License.
d9638e547d8811f2c689977f8dd2a353938b61fdmws * When distributing Covered Code, include this CDDL HEADER in each
d9638e547d8811f2c689977f8dd2a353938b61fdmws * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d9638e547d8811f2c689977f8dd2a353938b61fdmws * If applicable, add the following below this CDDL HEADER, with the
d9638e547d8811f2c689977f8dd2a353938b61fdmws * fields enclosed by brackets "[]" replaced with your own identifying
d9638e547d8811f2c689977f8dd2a353938b61fdmws * information: Portions Copyright [yyyy] [name of copyright owner]
d9638e547d8811f2c689977f8dd2a353938b61fdmws * CDDL HEADER END
d9638e547d8811f2c689977f8dd2a353938b61fdmws * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
d9638e547d8811f2c689977f8dd2a353938b61fdmws * Use is subject to license terms.
d9638e547d8811f2c689977f8dd2a353938b61fdmws#pragma ident "%Z%%M% %I% %E% SMI"
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern "C" {
d9638e547d8811f2c689977f8dd2a353938b61fdmwstypedef void fmd_xprt_rule_f(struct fmd_xprt_impl *, nvlist_t *);
d9638e547d8811f2c689977f8dd2a353938b61fdmwstypedef struct fmd_xprt_rule {
d9638e547d8811f2c689977f8dd2a353938b61fdmwstypedef struct fmd_xprt_stat {
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_eventqstat_t xs_evqstat; /* statistics for xprt event queue */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_stat_t xs_module; /* module name associated with xprt */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_stat_t xs_authority; /* authority associated with xprt */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_stat_t xs_state; /* state name associated with xprt */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_stat_t xs_received; /* number of events received by xprt */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_stat_t xs_discarded; /* number of events discarded by xprt */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_stat_t xs_retried; /* number of events retried by xprt */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_stat_t xs_replayed; /* number of events replayed by xprt */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_stat_t xs_timeouts; /* number of events recv'd with ttl=0 */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_stat_t xs_subscriptions; /* number of active subscriptions */
d9638e547d8811f2c689977f8dd2a353938b61fdmwstypedef struct fmd_xprt_class {
d9638e547d8811f2c689977f8dd2a353938b61fdmws struct fmd_xprt_class *xc_next; /* next class on xi_subhash chain */
d9638e547d8811f2c689977f8dd2a353938b61fdmwstypedef struct fmd_xprt_class_hash {
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_eventq_t *xch_queue; /* associated event queue (or NULL) */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_xprt_class_t **xch_hash; /* subscription hash bucket array */
d9638e547d8811f2c689977f8dd2a353938b61fdmwstypedef struct fmd_xprt_impl {
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_list_t xi_list; /* linked list next/prev pointers */
d9638e547d8811f2c689977f8dd2a353938b61fdmws struct fmd_eventq *xi_queue; /* event queue for outbound events */
d9638e547d8811f2c689977f8dd2a353938b61fdmws struct fmd_thread *xi_thread; /* thread associated with transport */
d9638e547d8811f2c689977f8dd2a353938b61fdmws const fmd_xprt_rule_t *xi_state; /* rules for the current state */
d9638e547d8811f2c689977f8dd2a353938b61fdmws struct fmd_log *xi_log; /* log for received events (optional) */
d9638e547d8811f2c689977f8dd2a353938b61fdmws pthread_mutex_t xi_stats_lock; /* lock protecting xi_stats data */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_xprt_stat_t *xi_stats; /* built-in per-transport statistics */
d9638e547d8811f2c689977f8dd2a353938b61fdmws pthread_mutex_t xi_lock; /* lock for modifying members below */
d9638e547d8811f2c689977f8dd2a353938b61fdmws pthread_cond_t xi_cv; /* condition variable for xi_flags */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_xprt_class_hash_t xi_lsub; /* subscriptions in local dispq */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_xprt_class_hash_t xi_rsub; /* subscriptions in remote peer */
d9638e547d8811f2c689977f8dd2a353938b61fdmws fmd_xprt_class_hash_t xi_usub; /* pending remote unsubscriptions */
d9638e547d8811f2c689977f8dd2a353938b61fdmws * Flags for fmd_xprt_create() and xi_flags. NOTE: Any public API flags must
d9638e547d8811f2c689977f8dd2a353938b61fdmws * exactly match the corresponding definitions in <fmd_api.h>.
d9638e547d8811f2c689977f8dd2a353938b61fdmws#define FMD_XPRT_ACCEPT 0x4 /* xprt is accepting connection */
d9638e547d8811f2c689977f8dd2a353938b61fdmws#define FMD_XPRT_SUSPENDED 0x8 /* xprt is suspended by user */
d9638e547d8811f2c689977f8dd2a353938b61fdmws#define FMD_XPRT_SUBSCRIBER 0x10 /* xprt is actively subscribing */
d9638e547d8811f2c689977f8dd2a353938b61fdmws#define FMD_XPRT_ISUSPENDED 0x20 /* xprt is waiting for _fmd_init */
d9638e547d8811f2c689977f8dd2a353938b61fdmws#define FMD_XPRT_DSUSPENDED 0x40 /* xprt is suspended by fmd mechanism */
d9638e547d8811f2c689977f8dd2a353938b61fdmws (FMD_XPRT_SUSPENDED | FMD_XPRT_ISUSPENDED | FMD_XPRT_DSUSPENDED)
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern fmd_xprt_t *fmd_xprt_create(fmd_module_t *, uint_t, nvlist_t *, void *);
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern void fmd_xprt_recv(fmd_xprt_t *, nvlist_t *, hrtime_t);
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern void fmd_xprt_uuclose(fmd_xprt_t *, const char *);
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern void fmd_xprt_subscribe(fmd_xprt_t *, const char *);
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern void fmd_xprt_unsubscribe(fmd_xprt_t *, const char *);
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern void fmd_xprt_subscribe_all(const char *);
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern void fmd_xprt_unsubscribe_all(const char *);
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern void fmd_xprt_suspend_all(void);
d9638e547d8811f2c689977f8dd2a353938b61fdmwsextern void fmd_xprt_resume_all(void);
d9638e547d8811f2c689977f8dd2a353938b61fdmws#endif /* _FMD_XPRT_H */