2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _LIBDS_H
2N/A#define _LIBDS_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/types.h>
2N/A
2N/A/*
2N/A * LDOMs User Domain Services library Interfaces
2N/A */
2N/A
2N/Atypedef uint64_t ds_hdl_t; /* service handle */
2N/Atypedef uint64_t ds_domain_hdl_t; /* domain handle */
2N/Atypedef void *ds_cb_arg_t; /* client callback arg */
2N/A
2N/A#define DS_INVALID_HDL (0) /* a ds handle cannot be zero */
2N/A
2N/A/*
2N/A * LDOMs User Domain Services versioning
2N/A */
2N/Atypedef struct ds_ver {
2N/A uint16_t major;
2N/A uint16_t minor;
2N/A} ds_ver_t;
2N/A
2N/A/*
2N/A * LDOMs User Domain Services capability
2N/A */
2N/Atypedef struct ds_capability {
2N/A char *svc_id; /* service identifier */
2N/A ds_ver_t *vers; /* list of supported versions */
2N/A uint_t nvers; /* number of supported versions */
2N/A} ds_capability_t;
2N/A
2N/A/*
2N/A * LDOMs User Domain Services event callbacks
2N/A */
2N/Atypedef struct ds_ops {
2N/A void (*ds_reg_cb)(ds_hdl_t hdl, ds_cb_arg_t arg, ds_ver_t *ver,
2N/A ds_domain_hdl_t dhdl);
2N/A void (*ds_unreg_cb)(ds_hdl_t hdl, ds_cb_arg_t arg);
2N/A void (*ds_data_cb)(ds_hdl_t hdl, ds_cb_arg_t arg, void *buf,
2N/A size_t buflen);
2N/A ds_cb_arg_t cb_arg;
2N/A} ds_ops_t;
2N/A
2N/Aextern int ds_init(void);
2N/Aextern int ds_svc_reg(ds_capability_t *cap, ds_ops_t *ops);
2N/Aextern int ds_clnt_reg(ds_capability_t *cap, ds_ops_t *ops);
2N/Aextern int ds_hdl_lookup(char *service, boolean_t is_client, ds_hdl_t *hdlsp,
2N/A uint_t maxhdls, uint_t *nhdlsp);
2N/Aextern int ds_domain_lookup(ds_hdl_t hdl, ds_domain_hdl_t *dhdlp);
2N/Aextern int ds_unreg_hdl(ds_hdl_t hdl);
2N/Aextern int ds_send_msg(ds_hdl_t hdl, void *buf, size_t buflen);
2N/Aextern int ds_recv_msg(ds_hdl_t hdl, void *buf, size_t buflen,
2N/A size_t *msglen);
2N/Aextern int ds_isready(ds_hdl_t hdl, boolean_t *is_ready);
2N/Aextern int ds_dom_name_to_hdl(char *domain_name, ds_domain_hdl_t *dhdlp);
2N/Aextern int ds_dom_hdl_to_name(ds_domain_hdl_t dhdl, char *domain_name,
2N/A uint_t maxnamlen);
2N/Aextern void ds_unreg_svc(char *service, boolean_t is_client);
2N/Aextern void ds_fini(void);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LIBDS_H */