/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _LIBDLPI_IMPL_H
#define _LIBDLPI_IMPL_H
#include <libdlpi.h>
#include <sys/sysmacros.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Maximum DLPI response size, in bytes.
*/
/*
* Maximum SAP length, in bytes.
*/
/*
* Number of elements in 'arr'.
*/
/*
* Allocate buffer size for DLPI message, in bytes and set DLPI primitive.
*/
/*
* Publicly available DLPI notification types. This list may change if
* new DLPI notification types are made public. See dlpi(7P).
*
*/
/*
* Used in a mactype lookup table.
*/
typedef struct dlpi_mactype_s {
/*
* Used to get the maximum DLPI message buffer size, in bytes.
*/
typedef struct dlpi_primsz {
/* max. message size, in bytes, for dp_prim */
/*
* Used to create DLPI message.
*/
typedef struct dlpi_msg {
/* store DLPI primitive message */
/* provide buffer size for dlm_msg */
} dlpi_msg_t;
typedef struct dlpi_notifyent {
/* notification types registered */
/* callback to call */
/*
* Private libdlpi structure associated with each DLPI handle.
*/
typedef struct dlpi_impl_s {
/* full linkname including PPA */
/* only provider name */
/* true if notification is being */
/* processed */
/* list of registered notifications */
} dlpi_impl_t;
/*
* dlpi_info() version support notes:
*
* We have bumped the version field to 1 in support of a larger dlpi_info_t
* structure that can hold linknames upto MAXLINKNAMESPECIFIER size. We need to
* support clients passing both version 0 and version 1. In particular, there
* are three cases we need to support:
*
* (a) Existing client binaries that pass version 0 and have a dlpi_info_t
* structure in the binary that is of version 0. libdlpi at runtime should
* copy in the version 0 dlpi_info_t back to the caller.
* (b) Existing client source compiled against libdlpi but continue to use
* version 0. The client when compiled using libdlpi.h should see the
* version 0 dlpi_info_t structure as that is the version of the structure
* we will copy back to the caller at runtime.
* (c) Finally, new clients modified to use version 1. New clients should
* be able to see version 1 dlpi_info_t from the libdlpi.h file and at
* runtime libdlpi should copy over the version 1 dlpi_info_t structure
* to the caller.
*
* We cannot modify dlpi_info_t in libdlpi.h for all clients because case (b)
* above will fail as clients passing version 0 should continue to receive the
* has to expose version 0 of the dlpi_info_t structure to existing clients
* compiled in future and expose version 1 of the dlpi_info_t structure to new
* clients passing version 1. The way we support this is by requiring new
* clients to pre-define DLPI_INFO_VERSION to value 1 before including libdlpi.h
*
* New clients that define the DLPI_INFO_VERSION to value 1 will see the
* updated version 1 of the dlpi_info_t structure from libdlpi.h header file.
* But if a new client passes value 1 but does not pre-define DLPI_INFO_VERSION
* to 1 then client will run into silent failures as we will copy over version
* 1 of the structure whereas the client has been compiled with version 0 of the
* structure. Similarly if client passes value 0 even when the client has
* pre-defined DLPI_INFO_VERSION to be 1, silent failures will occur.
* Unfortunately we cannot detect either of these cases at runtime in libdlpi
* and return an error to the caller.
*
* Existing clients will require no changes and will continue to work when
* compiled and run using libdlpi. There is also the question of which version
* of the dlpi_info_t structure that libdlpi is compiled with. We could compile
* libdlpi with either version 1 or 0. libdlpi is currently compiled to use
* version 0 of the dlpi_info_t structure.
*/
/*
* Version 1 dlpi_info_t. When callers pass version 1 this structure will be
* used by the dlpi_info() call. libdlpi is compiled with version 0 so the
* dlpi_info_t from libdlpi.h is of version 0 and is used when callers pass
* version 0. If libdlpi is compiled to use version 1 then we would need
* a similar private dlpi_info_t in support of version 0.
*/
typedef struct {
int di_timeout;
/*
* Supported versions for dlpi_info(3DLPI). To specify version 1 callers must
* define DLPI_INFO_VERSION to value 1 and pass caller defined DLPI_INFO_VERSION
* constant to dlpi_info().
*/
#define DLPI_INFO_VERS0 0
/*
* structure or the dlpi_info_t structure based on the given
* version argument to dlpi_info() call.
*/
dlpi_info_t *infopv0; \
if ((version) == DLPI_INFO_VERS0) { \
} else { \
} \
}
}
#ifdef __cplusplus
}
#endif
#endif /* _LIBDLPI_IMPL_H */