mms_api.h revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef __MMS_API_H
#define __MMS_API_H
#define MMS_API_VERSION 1000
#define MMS_API_RSP_UNACC 0
#define MMS_API_RSP_ACC 1
#define MMS_API_RSP_FINAL 2
#define MMS_API_RSP_FINAL_INTR 3
#define MMS_API_RSP_FINAL_ERR 4
#define MMS_API_RSP_FINAL_CANC 5
#define MMS_API_RSP_EVENT 7
#define MMS_API_NO 0
#define MMS_API_YES 1
#define MMS_API_OK 0
#define MMS_API_ERROR 1
#define MMS_API_UNCONFIG 0
#define MMS_API_CONFIG 1
#define MMS_API_FAILURE 2
#define MMS_API_ASYNC 1
#define MMS_API_SYNC 2
typedef struct mms_event {
int mms_ev_code;
void *mms_ev_data;
} mms_event_t;
typedef struct mms_ev_volume {
char *mms_ev_volume_name;
char *mms_ev_media_type;
typedef struct mms_ev_library {
char *mms_ev_inst_name;
char *mms_ev_lib_name;
typedef struct mms_ev_dm {
char *mms_ev_inst_name;
char *mms_ev_drive_name;
char *mms_ev_host;
} mms_ev_dm_t;
typedef struct mms_ev_message {
char *mms_ev_who;
char *mms_ev_id;
char *mms_ev_client;
char *mms_ev_inst;
char *mms_ev_level;
char *mms_ev_text;
char *mms_ev_msg;
typedef struct mms_rsp_ele {
int mms_rsp_type; /* Type of response or */
/* event type */
char *mms_rsp_tid; /* Task id of response or */
/* event tag */
char *mms_rsp_str; /* Response or event string */
typedef struct mms_send_ele {
char *mms_send_tid; /* Task id of cmd to be sent */
/* over a async connection */
char *mms_send_cmd; /* Command to be sent */
typedef struct mms_cmd_ele {
int mms_cmd_type; /* Type of command async,sync */
char *mms_cmd_tid; /* Task id of outstanding cmd */
char *mms_cmd_cmd; /* Outstanding command */
/* If async cmd, callback */
/* function to use for */
/* response */
void *mms_cmd_callbk_param; /* User param to be sent to */
/* callback function */
typedef struct mms_callbk {
void *mms_param; /* Callback parameter */
} mms_callbk_t;
typedef struct mms_rsp_callbk {
/* Callback */
void *mms_param; /* Callback parameter */
typedef struct mms_session {
/* response list */
int mms_thrd_cnt; /* Number of outstanding */
/* threads in session */
int mms_api_state; /* Current state of the */
/* connection, config, */
/* unconfig, or error */
int mms_api_mode; /* Type of connection, SYNC */
/* or combination with ASYNC */
int mms_api_errcode; /* If a internal processing */
/* error occurs this get */
/* set to show what caused */
/* the error to happen */
int mms_api_rstarted; /* For async mode, tells when */
/* reader thread has started */
char *mms_acc_tid; /* Task id of cmd waiting on */
/* accept response */
char *cprefix; /* Set by the client to tag */
/* who is using the API */
void (*clog) (char *, char *); /* Function to use to log */
/* API errors into the */
/* clients log file */
/* structure pointer */
/* mms_thrd_cnt */
/* waiting to shutdown the */
/* session when all */
/* outstanding threads */
/* to MM have stopped */
/* mms_cmd_list */
/* from sending their cmds */
/* until current cmd gets */
/* and the thread waiting on */
/* accessing shared memory */
/* at the same time */
/* response */
/* cmds response list */
/* waiting on a final rsp */
/* to MMS */
/* socket */
/* send */
/* thread in async mode */
/* thread */
/* processing error is */
/* encountered using a ASYNC */
/* connection to notify the */
/* client of the failure */
void *mms_async_error_param; /* Error callback parameter */
/* Event callback */
void *mms_ev_callbk_param; /* Event callback parameter */
/* list */
/* waiting on events */
int mms_init(void **, int *);
int mms_hello(void *, char *, char *, char *, char *, char *, char *, char *,
void *);
int mms_hello_net(void *, mms_network_cfg_t *, char *, void *);
int mms_goodbye(void *, int);
int mms_agoodbye(void *, int);
void *mms_api_reader(void *);
void *mms_api_writer(void *);
int mms_handle_err_rsp(void *, int *, int *, char **);
int mms_send_cmd(void *, char *, void **);
int mms_send_acmd(void *, char *, void (*)(), void *);
int mms_read_response(void *, char *, void **);
int mms_read_event(void *, void **);
void mms_free_event(void *);
void mms_free_rsp(void *);
void mms_free_cmd(mms_cmd_ele_t *);
void mms_free_send(mms_send_ele_t *);
char *mms_get_attribute(void *, char *, void **);
mms_rsp_ele_t *mms_gen_err_rsp(char *, int, char *);
void mms_serr(mms_trace_sev_t, char *, int, const char *, ...);
extern char mms_empty_string[];
/* This may need to be part of a session to show which events a */
/* session of the api has registered for */
extern char *mms_notify[];
extern char *mms_event[];
extern char *mms_scope[];
extern char *mms_api[];
/* MACROS */
}
}
#define mms_state_failed(_sess) \
#endif /* __MMS_API_H */