/*
*/
/*
* BSD 3 Clause License
*
* Copyright (c) 2007, The Storage Networking Industry Association.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* - Neither the name of The Storage Networking Industry Association (SNIA)
* nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Copyright (c) 2007, The Storage Networking Industry Association. */
/* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
/* Copyright 2014 Nexenta Systems, Inc. All rights reserved. */
#ifndef _LIBNDMP_H
#define _LIBNDMP_H
#include <libscf.h>
#include <libnvpair.h>
#ifdef __cplusplus
extern "C" {
#endif
/* NDMP supported versions */
/* Device type */
extern int ndmp_errno;
/* NDMP plugin module API */
typedef struct ndmp_context {
char *nc_plname;
void *nc_cmds;
void *nc_params;
typedef struct ndmp_plugin {
/* Plugin entry points */
const char *);
int);
const char *, const char *);
int);
typedef enum ndmp_log_dma_type {
NDMP_LOGD_NORMAL = 0,
typedef enum {
NDMP_BUTYPE_TAR = 0,
/* libndmp error codes */
enum {
};
/* Tape device open mode */
typedef enum ndmp_tp_open_mode {
/* Mover state */
typedef enum ndmp_mv_state {
/* Mover mode */
typedef enum ndmp_mv_mode {
/* Mover pause reson */
typedef enum ndmp_mv_pause_reason {
/* Mover halt reason */
typedef enum ndmp_mv_halt_reason {
/* Address type */
typedef enum ndmp_ad_type {
/* NDMP data operation */
typedef enum ndmp_dt_operation {
/* NDMP data state */
typedef enum ndmp_dt_state {
/* NDMP data halt reason */
typedef enum ndmp_dt_halt_reason {
/* Device information structure */
typedef struct ndmp_devinfo {
/* Scsi device info sturcture */
typedef struct ndmp_scsi {
/* -1 if not open */
/* scsi_id and lun are set only if valid_target_set is set */
} ndmp_scsi_t;
typedef struct ndmp_tape {
/* The data below is set only if "fd" is not -1 */
} ndmp_tape_t;
/* NDMP mover info structure */
typedef struct ndmp_mover {
/* Filled in V3 and V4 only */
} ndmp_mover_t;
typedef struct ndmp_dt_name {
char *nn_name;
char *nn_dest;
typedef struct ndmp_dt_pval {
char *np_name;
char *np_value;
typedef struct ndmp_dt_name_v3 {
char *nn3_opath;
char *nn3_dpath;
typedef struct ndmp_dt_v3 {
int dv3_listen_sock;
} ndmp_dt_v3_t;
/* NDMP data structure */
typedef struct ndmp_data {
/* 0 = No, otherwise Yes */
/* or recover request */
union {
/* Filled in V2 */
/* Filled in V3 */
} nd_nlist;
} ndmp_data_t;
/* NDMP session information */
typedef struct ndmp_session_info {
/* 0="no", else "yes" */
/* Stats data */
typedef struct ndmp_stat {
} ndmp_stat_t;
typedef struct ndmp_door_ctx {
char *ptr;
char *start_ptr;
char *end_ptr;
int status;
extern int ndmp_get_dbglevel(void);
extern int ndmp_get_stats(ndmp_stat_t *);
extern int ndmp_terminate_session(int);
extern int ndmp_set_dbglevel(int);
extern const char *ndmp_strerror(int);
extern int ndmp_door_status(void);
extern int ndmp_get_prop(const char *, char **);
extern int ndmp_set_prop(const char *, const char *);
extern int ndmp_service_refresh(void);
extern char *ndmp_base64_encode(const char *);
extern char *ndmp_base64_decode(const char *);
extern ndmp_door_ctx_t *ndmp_door_decode_start(char *, int);
extern int ndmp_door_decode_finish(ndmp_door_ctx_t *);
extern ndmp_door_ctx_t *ndmp_door_encode_start(char *, int);
extern int ndmp_door_encode_finish(ndmp_door_ctx_t *, unsigned int *);
extern char *ndmp_door_get_string(ndmp_door_ctx_t *);
extern void ndmp_door_put_string(ndmp_door_ctx_t *, char *);
extern void ndmp_door_free_string(char *);
extern void ndmp_door_put_short(ndmp_door_ctx_t *, short);
extern short ndmp_door_get_short(ndmp_door_ctx_t *);
extern void ndmp_door_put_ushort(ndmp_door_ctx_t *, unsigned short);
extern unsigned short ndmp_door_get_ushort(ndmp_door_ctx_t *);
extern void ndmp_door_put_buf(ndmp_door_ctx_t *, unsigned char *, int);
extern int ndmp_door_get_buf(ndmp_door_ctx_t *, unsigned char *, int);
extern int ndmp_include_zfs(ndmp_context_t *, const char *);
extern void ndmp_context_set_specific(ndmp_context_t *, void *);
extern void *ndmp_context_get_specific(ndmp_context_t *);
#ifdef __cplusplus
}
#endif
#endif /* _LIBNDMP_H */