ldma.h revision 49bfb42b00abac0958a1308f4233e366fd083366
/*
* 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
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LDMA_H
#define _LDMA_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libds.h>
#include <sys/sysmacros.h>
/*
* The following definitions are part of the LDoms Agent specification.
*/
/* reply message types */
/* error codes for error messages */
/*
* LDoms Device Agent
*/
#define LDMA_NAME_DEVICE "agent-device"
/*
* LDoms System Agent
*/
#define LDMA_NAME_SYSTEM "agent-system"
/*
* Size of the header of an agent message. This is the minimal size that
* a message can have.
*/
#define LDMA_MESSAGE_HEADER_SIZE (sizeof (ldma_message_header_t))
/*
* Macro to compute the size of a message with a msg_data of size dlen.
* The size of the msg_data field must be a multiple of 8-bytes so dlen
* is roundup to an 8-bytes multiple.
*/
/*
* Macro to compute the size of the msg_data field from the size of the message.
*/
/*
* Handy macros for using the message and header structures.
*/
/* agent message header structure */
typedef struct ldma_message_header {
/* agent message structure */
typedef struct ldma_message {
/*
* Additional structures and definition for the implementation.
*/
typedef enum ldma_request_status_t {
LDMA_REQ_COMPLETED, /* request was completed */
LDMA_REQ_FAILED, /* request has failed */
LDMA_REQ_INVALID, /* request is invalid */
LDMA_REQ_NOTSUP, /* request is not supported */
LDMA_REQ_DENIED /* request was denied */
typedef struct ldma_msg_handler {
typedef struct ldma_agent_info {
char *name; /* agent name */
int nvers; /* number of versions */
int nhandlers; /* number of handlers */
/*
* Helper functions for the daemon and agents.
*/
/* function to allocate a result message */
/* functions to log messages */
/*
* LDMA_MODULE as the name under which messages are logged. For a given agent,
* LDMA_MODULE should be set to the name of the agent.
*/
#ifdef __cplusplus
}
#endif
#endif /* _LDMA_H */