info.h revision c0dd49bdd68c0d758a67d56f07826f3b45cfc664
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * CDDL HEADER START
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * The contents of this file are subject to the terms of the
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Common Development and Distribution License (the "License").
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * You may not use this file except in compliance with the License.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * or http://www.opensolaris.org/os/licensing.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * See the License for the specific language governing permissions
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * and limitations under the License.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * When distributing Covered Code, include this CDDL HEADER in each
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * If applicable, add the following below this CDDL HEADER, with the
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * fields enclosed by brackets "[]" replaced with your own identifying
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * information: Portions Copyright [yyyy] [name of copyright owner]
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * CDDL HEADER END
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#ifndef _RDSV3_INFO_H
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#define _RDSV3_INFO_H
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otastruct rdsv3_info_iterator {
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota char *addr;
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota unsigned long offset;
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota};
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otastruct rdsv3_info_lengths {
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota unsigned int nr;
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota unsigned int each;
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota};
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otastruct rdsv3_sock;
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * These functions must fill in the fields of @lens to reflect the size
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * of the available info source. If the snapshot fits in @len then it
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * should be copied using @iter. The caller will deduce if it was copied
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * or not by comparing the lengths.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otatypedef void (*rdsv3_info_func)(struct rsock *sock, unsigned int len,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota struct rdsv3_info_iterator *iter,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota struct rdsv3_info_lengths *lens);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#define rdsv3_info_copy(iter, data, bytes) \
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota bcopy(data, iter->addr + iter->offset, bytes); \
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota iter->offset += bytes
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otavoid rdsv3_info_register_func(int optname, rdsv3_info_func func);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otavoid rdsv3_info_deregister_func(int optname, rdsv3_info_func func);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaint rdsv3_info_getsockopt(struct rsock *sock, int optname, char *optval,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota socklen_t *optlen);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota#endif /* _RDSV3_INFO_H */