12654012fSReza Sabdar /* 28c4f9701SJanice Chang * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 32654012fSReza Sabdar */ 42654012fSReza Sabdar 52654012fSReza Sabdar /* 62654012fSReza Sabdar * BSD 3 Clause License 72654012fSReza Sabdar * 82654012fSReza Sabdar * Copyright (c) 2007, The Storage Networking Industry Association. 92654012fSReza Sabdar * 102654012fSReza Sabdar * Redistribution and use in source and binary forms, with or without 112654012fSReza Sabdar * modification, are permitted provided that the following conditions 122654012fSReza Sabdar * are met: 132654012fSReza Sabdar * - Redistributions of source code must retain the above copyright 142654012fSReza Sabdar * notice, this list of conditions and the following disclaimer. 152654012fSReza Sabdar * 162654012fSReza Sabdar * - Redistributions in binary form must reproduce the above copyright 172654012fSReza Sabdar * notice, this list of conditions and the following disclaimer in 182654012fSReza Sabdar * the documentation and/or other materials provided with the 192654012fSReza Sabdar * distribution. 202654012fSReza Sabdar * 212654012fSReza Sabdar * - Neither the name of The Storage Networking Industry Association (SNIA) 222654012fSReza Sabdar * nor the names of its contributors may be used to endorse or promote 232654012fSReza Sabdar * products derived from this software without specific prior written 242654012fSReza Sabdar * permission. 252654012fSReza Sabdar * 262654012fSReza Sabdar * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 272654012fSReza Sabdar * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 282654012fSReza Sabdar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 292654012fSReza Sabdar * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 302654012fSReza Sabdar * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 312654012fSReza Sabdar * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 322654012fSReza Sabdar * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 332654012fSReza Sabdar * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 342654012fSReza Sabdar * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 352654012fSReza Sabdar * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 362654012fSReza Sabdar * POSSIBILITY OF SUCH DAMAGE. 372654012fSReza Sabdar */ 388c4f9701SJanice Chang /* Copyright (c) 2007, The Storage Networking Industry Association. */ 398c4f9701SJanice Chang /* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */ 40*8b87c155SJan Kryl /* Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ 412654012fSReza Sabdar #ifndef _LIBNDMP_H 422654012fSReza Sabdar #define _LIBNDMP_H 432654012fSReza Sabdar 442654012fSReza Sabdar #include <rpc/types.h> 452654012fSReza Sabdar #include <libscf.h> 462654012fSReza Sabdar #include <libnvpair.h> 472654012fSReza Sabdar 482654012fSReza Sabdar #ifdef __cplusplus 492654012fSReza Sabdar extern "C" { 502654012fSReza Sabdar #endif 512654012fSReza Sabdar 522654012fSReza Sabdar /* NDMP supported versions */ 532654012fSReza Sabdar #define NDMP_V2 2 542654012fSReza Sabdar #define NDMP_V3 3 552654012fSReza Sabdar #define NDMP_V4 4 562654012fSReza Sabdar 572654012fSReza Sabdar /* Device type */ 582654012fSReza Sabdar #define NDMP_SINQ_SEQ_ACCESS_DEVICE 0x01 592654012fSReza Sabdar #define NDMP_SINQ_TAPE_ROBOT 0x08 602654012fSReza Sabdar 612654012fSReza Sabdar extern int ndmp_errno; 622654012fSReza Sabdar 632654012fSReza Sabdar /* NDMP plugin module API */ 642654012fSReza Sabdar #define NDMP_PLUGIN_VERSION 1 652654012fSReza Sabdar 662654012fSReza Sabdar typedef struct ndmp_context { 672654012fSReza Sabdar char *nc_plname; 682654012fSReza Sabdar uint_t nc_plversion; 698c4f9701SJanice Chang void *nc_pldata; /* data private to the plugin */ 702654012fSReza Sabdar void *nc_cmds; 7142ed7838SReza Sabdar void *nc_params; 728c4f9701SJanice Chang void *nc_ddata; /* data private to the daemon */ 732654012fSReza Sabdar } ndmp_context_t; 742654012fSReza Sabdar 752654012fSReza Sabdar typedef struct ndmp_plugin { 762654012fSReza Sabdar const char *np_plid; /* plugin identifier */ 772654012fSReza Sabdar uint_t np_plversion; /* plugin version */ 782654012fSReza Sabdar void *np_pldata; /* for private use by the plugin */ 792654012fSReza Sabdar 802654012fSReza Sabdar /* Plugin entry points */ 812654012fSReza Sabdar int (*np_pre_backup)(struct ndmp_plugin *, ndmp_context_t *, 822654012fSReza Sabdar const char *); 832654012fSReza Sabdar int (*np_post_backup)(struct ndmp_plugin *, ndmp_context_t *, 842654012fSReza Sabdar int); 852654012fSReza Sabdar int (*np_pre_restore)(struct ndmp_plugin *, ndmp_context_t *, 862654012fSReza Sabdar const char *, const char *); 872654012fSReza Sabdar int (*np_post_restore)(struct ndmp_plugin *, ndmp_context_t *, 882654012fSReza Sabdar int); 892654012fSReza Sabdar } ndmp_plugin_t; 902654012fSReza Sabdar 9142ed7838SReza Sabdar typedef enum ndmp_log_dma_type { 9242ed7838SReza Sabdar NDMP_LOGD_NORMAL = 0, 9342ed7838SReza Sabdar NDMP_LOGD_DEBUG = 1, 9442ed7838SReza Sabdar NDMP_LOGD_ERROR = 2, 9542ed7838SReza Sabdar NDMP_LOGD_WARNING = 3 9642ed7838SReza Sabdar } ndmp_log_dma_type_t; 9742ed7838SReza Sabdar 988c4f9701SJanice Chang typedef enum { 998c4f9701SJanice Chang NDMP_BUTYPE_TAR = 0, 1008c4f9701SJanice Chang NDMP_BUTYPE_DUMP, 1018c4f9701SJanice Chang NDMP_BUTYPE_ZFS 1028c4f9701SJanice Chang } ndmpd_backup_type_t; 1038c4f9701SJanice Chang 1048c4f9701SJanice Chang extern ndmpd_backup_type_t ndmp_get_backup_type(ndmp_context_t *); 1058c4f9701SJanice Chang 1062654012fSReza Sabdar /* libndmp error codes */ 1072654012fSReza Sabdar #define ENDMP_BASE 2000 1082654012fSReza Sabdar enum { 1092654012fSReza Sabdar ENDMP_DOOR_SRV_TIMEOUT = ENDMP_BASE, 1102654012fSReza Sabdar ENDMP_INVALID_ARG, 1112654012fSReza Sabdar ENDMP_DOOR_SRV_OPERATION, 1122654012fSReza Sabdar ENDMP_DOOR_OPEN, 1132654012fSReza Sabdar ENDMP_MEM_ALLOC, 1142654012fSReza Sabdar ENDMP_DOOR_ENCODE_START, 1152654012fSReza Sabdar ENDMP_DOOR_ENCODE_FINISH, 1162654012fSReza Sabdar ENDMP_DOOR_DECODE_FINISH, 1172654012fSReza Sabdar ENDMP_SMF_PERM, 1182654012fSReza Sabdar ENDMP_SMF_INTERNAL, 1192654012fSReza Sabdar ENDMP_SMF_PROP, 1202654012fSReza Sabdar ENDMP_SMF_PROP_GRP 1212654012fSReza Sabdar }; 1222654012fSReza Sabdar 1232654012fSReza Sabdar /* Tape device open mode */ 1242654012fSReza Sabdar typedef enum ndmp_tp_open_mode { 1252654012fSReza Sabdar NDMP_TP_READ_MODE, 1262654012fSReza Sabdar NDMP_TP_WRITE_MODE, 1272654012fSReza Sabdar NDMP_TP_RAW_MODE, 1282654012fSReza Sabdar NDMP_TP_RAW1_MODE = 0x7fffffff, 1292654012fSReza Sabdar NDMP_TP_RAW2_MODE = NDMP_TP_RAW_MODE 1302654012fSReza Sabdar } ndmp_tp_open_mode_t; 1312654012fSReza Sabdar 1322654012fSReza Sabdar /* Mover state */ 1332654012fSReza Sabdar typedef enum ndmp_mv_state { 1342654012fSReza Sabdar NDMP_MV_STATE_IDLE, 1352654012fSReza Sabdar NDMP_MV_STATE_LISTEN, 1362654012fSReza Sabdar NDMP_MV_STATE_ACTIVE, 1372654012fSReza Sabdar NDMP_MV_STATE_PAUSED, 1382654012fSReza Sabdar NDMP_MV_STATE_HALTED 1392654012fSReza Sabdar } ndmp_mv_state_t; 1402654012fSReza Sabdar 1412654012fSReza Sabdar /* Mover mode */ 1422654012fSReza Sabdar typedef enum ndmp_mv_mode { 1432654012fSReza Sabdar NDMP_MV_MODE_READ, 1442654012fSReza Sabdar NDMP_MV_MODE_WRITE, 1452654012fSReza Sabdar NDMP_MV_MODE_NOACTION 1462654012fSReza Sabdar } ndmp_mv_mode_t; 1472654012fSReza Sabdar 1482654012fSReza Sabdar /* Mover pause reson */ 1492654012fSReza Sabdar typedef enum ndmp_mv_pause_reason { 1502654012fSReza Sabdar NDMP_MV_PAUSE_NA, 1512654012fSReza Sabdar NDMP_MV_PAUSE_EOM, 1522654012fSReza Sabdar NDMP_MV_PAUSE_EOF, 1532654012fSReza Sabdar NDMP_MV_PAUSE_SEEK, 1542654012fSReza Sabdar NDMP_MV_PAUSE_MEDIA_ERROR, 1552654012fSReza Sabdar NDMP_MV_PAUSE_EOW 1562654012fSReza Sabdar } ndmp_mv_pause_reason_t; 1572654012fSReza Sabdar 1582654012fSReza Sabdar /* Mover halt reason */ 1592654012fSReza Sabdar typedef enum ndmp_mv_halt_reason { 1602654012fSReza Sabdar NDMP_MV_HALT_NA, 1612654012fSReza Sabdar NDMP_MV_HALT_CONNECT_CLOSED, 1622654012fSReza Sabdar NDMP_MV_HALT_ABORTED, 1632654012fSReza Sabdar NDMP_MV_HALT_INTERNAL_ERROR, 1642654012fSReza Sabdar NDMP_MV_HALT_CONNECT_ERROR, 1652654012fSReza Sabdar NDMP_MV_HALT_MEDIA_ERROR 1662654012fSReza Sabdar } ndmp_mv_halt_reason_t; 1672654012fSReza Sabdar 1682654012fSReza Sabdar /* Address type */ 1692654012fSReza Sabdar typedef enum ndmp_ad_type { 1702654012fSReza Sabdar NDMP_AD_LOCAL, 1712654012fSReza Sabdar NDMP_AD_TCP, 1722654012fSReza Sabdar NDMP_AD_FC, 1732654012fSReza Sabdar NDMP_AD_IPC 1742654012fSReza Sabdar } ndmp_ad_type_t; 1752654012fSReza Sabdar 1762654012fSReza Sabdar /* NDMP data operation */ 1772654012fSReza Sabdar typedef enum ndmp_dt_operation { 1782654012fSReza Sabdar NDMP_DT_OP_NOACTION, 1792654012fSReza Sabdar NDMP_DT_OP_BACKUP, 1802654012fSReza Sabdar NDMP_DT_OP_RECOVER, 1812654012fSReza Sabdar NDMP_DT_OP_RECOVER_FILEHIST 1822654012fSReza Sabdar } ndmp_dt_operation_t; 1832654012fSReza Sabdar 1842654012fSReza Sabdar /* NDMP data state */ 1852654012fSReza Sabdar typedef enum ndmp_dt_state { 1862654012fSReza Sabdar NDMP_DT_STATE_IDLE, 1872654012fSReza Sabdar NDMP_DT_STATE_ACTIVE, 1882654012fSReza Sabdar NDMP_DT_STATE_HALTED, 1892654012fSReza Sabdar NDMP_DT_STATE_LISTEN, 1902654012fSReza Sabdar NDMP_DT_STATE_CONNECTED 1912654012fSReza Sabdar } ndmp_dt_state_t; 1922654012fSReza Sabdar 1932654012fSReza Sabdar /* NDMP data halt reason */ 1942654012fSReza Sabdar typedef enum ndmp_dt_halt_reason { 1952654012fSReza Sabdar NDMP_DT_HALT_NA, 1962654012fSReza Sabdar NDMP_DT_HALT_SUCCESSFUL, 1972654012fSReza Sabdar NDMP_DT_HALT_ABORTED, 1982654012fSReza Sabdar NDMP_DT_HALT_INTERNAL_ERROR, 1992654012fSReza Sabdar NDMP_DT_HALT_CONNECT_ERROR 2002654012fSReza Sabdar } ndmp_dt_halt_reason_t; 2012654012fSReza Sabdar 2022654012fSReza Sabdar /* Device information structure */ 2032654012fSReza Sabdar typedef struct ndmp_devinfo { 2042654012fSReza Sabdar uint_t nd_dev_type; /* SCSI device type */ 2052654012fSReza Sabdar char *nd_name; /* Device name */ 2062654012fSReza Sabdar uint_t nd_lun; /* Lun number */ 2072654012fSReza Sabdar uint_t nd_sid; /* Scsi id */ 2082654012fSReza Sabdar char *nd_vendor; /* Vendor name */ 2092654012fSReza Sabdar char *nd_product; /* Product name */ 2102654012fSReza Sabdar char *nd_revision; /* Revision */ 2117bc22e45SReza Sabdar char *nd_serial; /* Serial */ 2127bc22e45SReza Sabdar char *nd_wwn; /* World wide name */ 2132654012fSReza Sabdar } ndmp_devinfo_t; 2142654012fSReza Sabdar 2152654012fSReza Sabdar /* Scsi device info sturcture */ 2162654012fSReza Sabdar typedef struct ndmp_scsi { 2172654012fSReza Sabdar int ns_scsi_open; /* Scsi device open */ 2182654012fSReza Sabdar /* -1 if not open */ 2192654012fSReza Sabdar char *ns_adapter_name; /* Scsi adapter name */ 2202654012fSReza Sabdar int ns_valid_target_set; /* Scsi valid target */ 2212654012fSReza Sabdar /* scsi_id and lun are set only if valid_target_set is set */ 2222654012fSReza Sabdar int ns_scsi_id; /* Scsi id */ 2232654012fSReza Sabdar int ns_lun; /* Scsi lun */ 2242654012fSReza Sabdar } ndmp_scsi_t; 2252654012fSReza Sabdar 2262654012fSReza Sabdar typedef struct ndmp_tape { 2272654012fSReza Sabdar int nt_fd; /* Tape device file descriptor */ 2282654012fSReza Sabdar /* The data below is set only if "fd" is not -1 */ 2292654012fSReza Sabdar ulong_t nt_rec_count; /* Number of records written */ 2302654012fSReza Sabdar ndmp_tp_open_mode_t nt_mode; /* Tape device open mode */ 2312654012fSReza Sabdar char *nt_dev_name; /* Device name */ 2322654012fSReza Sabdar char *nt_adapter_name; /* Adapter name */ 2332654012fSReza Sabdar int nt_sid; /* Scsi id */ 2342654012fSReza Sabdar int nt_lun; /* Lun number */ 2352654012fSReza Sabdar } ndmp_tape_t; 2362654012fSReza Sabdar 2372654012fSReza Sabdar /* NDMP mover info structure */ 2382654012fSReza Sabdar typedef struct ndmp_mover { 2392654012fSReza Sabdar ndmp_mv_state_t nm_state; /* Current state */ 2402654012fSReza Sabdar ndmp_mv_mode_t nm_mode; /* Current mode */ 2412654012fSReza Sabdar ndmp_mv_pause_reason_t nm_pause_reason; /* Current reason */ 2422654012fSReza Sabdar ndmp_mv_halt_reason_t nm_halt_reason; /* Current reason */ 2432654012fSReza Sabdar ulong_t nm_rec_size; /* Tape I/O record size */ 2442654012fSReza Sabdar ulong_t nm_rec_num; /* Current record num */ 2452654012fSReza Sabdar u_longlong_t nm_mov_pos; /* Current data stream pos */ 2462654012fSReza Sabdar u_longlong_t nm_window_offset; /* Valid data window begin */ 2472654012fSReza Sabdar u_longlong_t nm_window_length; /* Valid data window length */ 2482654012fSReza Sabdar int nm_sock; /* Data conn socket */ 2492654012fSReza Sabdar 2502654012fSReza Sabdar /* Filled in V3 and V4 only */ 2512654012fSReza Sabdar int nm_listen_sock; /* Data conn listen socket */ 2522654012fSReza Sabdar ndmp_ad_type_t nm_addr_type; /* Current address type */ 2532654012fSReza Sabdar char *nm_tcp_addr; /* Only if addr_type is tcp */ 2542654012fSReza Sabdar } ndmp_mover_t; 2552654012fSReza Sabdar 2562654012fSReza Sabdar typedef struct ndmp_dt_name { 2572654012fSReza Sabdar char *nn_name; 2582654012fSReza Sabdar char *nn_dest; 2592654012fSReza Sabdar } ndmp_dt_name_t; 2602654012fSReza Sabdar 2612654012fSReza Sabdar /* NDMP name/value pair structure */ 2622654012fSReza Sabdar typedef struct ndmp_dt_pval { 2632654012fSReza Sabdar char *np_name; 2642654012fSReza Sabdar char *np_value; 2652654012fSReza Sabdar } ndmp_dt_pval_t; 2662654012fSReza Sabdar 2672654012fSReza Sabdar typedef struct ndmp_dt_name_v3 { 2682654012fSReza Sabdar char *nn3_opath; 2692654012fSReza Sabdar char *nn3_dpath; 2702654012fSReza Sabdar u_longlong_t nn3_node; 2712654012fSReza Sabdar u_longlong_t nn3_fh_info; 2722654012fSReza Sabdar } ndmp_dt_name_v3_t; 2732654012fSReza Sabdar 2742654012fSReza Sabdar typedef struct ndmp_dt_v3 { 2752654012fSReza Sabdar int dv3_listen_sock; 2762654012fSReza Sabdar u_longlong_t dv3_bytes_processed; 2772654012fSReza Sabdar ndmp_dt_name_v3_t *dv3_nlist; /* V3 recover file list */ 2782654012fSReza Sabdar } ndmp_dt_v3_t; 2792654012fSReza Sabdar 2802654012fSReza Sabdar /* NDMP data structure */ 2812654012fSReza Sabdar typedef struct ndmp_data { 2822654012fSReza Sabdar ndmp_dt_operation_t nd_oper; /* Current operation */ 2832654012fSReza Sabdar ndmp_dt_state_t nd_state; /* Current state */ 2842654012fSReza Sabdar ndmp_dt_halt_reason_t nd_halt_reason; /* Current reason */ 2852654012fSReza Sabdar int nd_sock; /* Listen and data socket */ 2862654012fSReza Sabdar ndmp_ad_type_t nd_addr_type; /* Current address type */ 2872654012fSReza Sabdar char *nd_tcp_addr; /* Only if addr_type is tcp */ 2882654012fSReza Sabdar int nd_abort; /* Abort operation flag */ 2892654012fSReza Sabdar /* 0 = No, otherwise Yes */ 2902654012fSReza Sabdar u_longlong_t nd_read_offset; /* Data read seek offset */ 2912654012fSReza Sabdar u_longlong_t nd_read_length; /* Data read length */ 2922654012fSReza Sabdar u_longlong_t nd_total_size; /* Backup data size */ 2932654012fSReza Sabdar ulong_t nd_env_len; /* Environment length */ 2942654012fSReza Sabdar ndmp_dt_pval_t *nd_env; /* Environment from backup */ 2952654012fSReza Sabdar /* or recover request */ 2962654012fSReza Sabdar ulong_t nld_nlist_len; /* Recover file list length */ 2972654012fSReza Sabdar union { 2982654012fSReza Sabdar /* Filled in V2 */ 2992654012fSReza Sabdar ndmp_dt_name_t *nld_nlist; /* Recover file list */ 3002654012fSReza Sabdar /* Filled in V3 */ 3012654012fSReza Sabdar ndmp_dt_v3_t nld_dt_v3; /* V3 data */ 3022654012fSReza Sabdar } nd_nlist; 3032654012fSReza Sabdar } ndmp_data_t; 3042654012fSReza Sabdar 3052654012fSReza Sabdar /* NDMP session information */ 3062654012fSReza Sabdar typedef struct ndmp_session_info { 3072654012fSReza Sabdar int nsi_sid; /* Session id */ 3082654012fSReza Sabdar int nsi_pver; /* NDMP protocol version */ 3092654012fSReza Sabdar int nsi_auth; /* Authorized ? 0="no", else "yes" */ 3102654012fSReza Sabdar int nsi_eof; /* Connection EOF flag */ 3112654012fSReza Sabdar /* 0="no", else "yes" */ 3122654012fSReza Sabdar char *nsi_cl_addr; /* Client address */ 3132654012fSReza Sabdar ndmp_scsi_t nsi_scsi; /* Scsi device information */ 3142654012fSReza Sabdar ndmp_tape_t nsi_tape; /* Tape device information */ 3152654012fSReza Sabdar ndmp_mover_t nsi_mover; /* Mover information */ 3162654012fSReza Sabdar ndmp_data_t nsi_data; /* Data information */ 3172654012fSReza Sabdar } ndmp_session_info_t; 3182654012fSReza Sabdar 3192654012fSReza Sabdar /* Stats data */ 3202654012fSReza Sabdar typedef struct ndmp_stat { 3212654012fSReza Sabdar int ns_trun; /* Number of worker threads running */ 3222654012fSReza Sabdar int ns_twait; /* Number of blocked worker threads */ 3232654012fSReza Sabdar int ns_nbk; /* Number of backups operations running */ 3242654012fSReza Sabdar int ns_nrs; /* Number of restores operations running */ 3252654012fSReza Sabdar int ns_rfile; /* Number of files being read */ 3262654012fSReza Sabdar int ns_wfile; /* Number of files being written */ 3272654012fSReza Sabdar uint64_t ns_rdisk; /* Number of disk blocks being read */ 3282654012fSReza Sabdar uint64_t ns_wdisk; /* Number of disk blocks being written */ 3292654012fSReza Sabdar uint64_t ns_rtape; /* Number of tape blocks being read */ 3302654012fSReza Sabdar uint64_t ns_wtape; /* Number of tape blocks being written */ 3312654012fSReza Sabdar } ndmp_stat_t; 3322654012fSReza Sabdar 3332654012fSReza Sabdar /* Common encode/decode functions used by door clients/servers. */ 3342654012fSReza Sabdar typedef struct ndmp_door_ctx { 3352654012fSReza Sabdar char *ptr; 3362654012fSReza Sabdar char *start_ptr; 3372654012fSReza Sabdar char *end_ptr; 3382654012fSReza Sabdar int status; 3392654012fSReza Sabdar } ndmp_door_ctx_t; 3402654012fSReza Sabdar 3412654012fSReza Sabdar extern int ndmp_get_devinfo(ndmp_devinfo_t **, size_t *); 3422654012fSReza Sabdar extern void ndmp_get_devinfo_free(ndmp_devinfo_t *, size_t); 3432654012fSReza Sabdar extern int ndmp_get_dbglevel(void); 3442654012fSReza Sabdar extern int ndmp_get_session_info(ndmp_session_info_t **, size_t *); 3452654012fSReza Sabdar extern void ndmp_get_session_info_free(ndmp_session_info_t *, size_t); 3462654012fSReza Sabdar extern int ndmp_get_stats(ndmp_stat_t *); 3472654012fSReza Sabdar extern int ndmp_terminate_session(int); 3482654012fSReza Sabdar extern int ndmp_set_dbglevel(int); 3492654012fSReza Sabdar extern const char *ndmp_strerror(int); 3502654012fSReza Sabdar extern int ndmp_door_status(void); 351*8b87c155SJan Kryl extern int ndmp_get_prop(const char *, char **); 352*8b87c155SJan Kryl extern int ndmp_set_prop(const char *, const char *); 3532654012fSReza Sabdar extern int ndmp_service_refresh(void); 354*8b87c155SJan Kryl extern char *ndmp_base64_encode(const char *); 355*8b87c155SJan Kryl extern char *ndmp_base64_decode(const char *); 3562654012fSReza Sabdar extern ndmp_door_ctx_t *ndmp_door_decode_start(char *, int); 3572654012fSReza Sabdar extern int ndmp_door_decode_finish(ndmp_door_ctx_t *); 3582654012fSReza Sabdar extern ndmp_door_ctx_t *ndmp_door_encode_start(char *, int); 3592654012fSReza Sabdar extern int ndmp_door_encode_finish(ndmp_door_ctx_t *, unsigned int *); 3602654012fSReza Sabdar extern int32_t ndmp_door_get_int32(ndmp_door_ctx_t *); 3612654012fSReza Sabdar extern uint32_t ndmp_door_get_uint32(ndmp_door_ctx_t *); 3622654012fSReza Sabdar extern char *ndmp_door_get_string(ndmp_door_ctx_t *); 3632654012fSReza Sabdar extern void ndmp_door_put_int32(ndmp_door_ctx_t *, int32_t); 3642654012fSReza Sabdar extern void ndmp_door_put_uint32(ndmp_door_ctx_t *, uint32_t); 3652654012fSReza Sabdar extern void ndmp_door_put_string(ndmp_door_ctx_t *, char *); 3662654012fSReza Sabdar extern void ndmp_door_free_string(char *); 3672654012fSReza Sabdar extern int64_t ndmp_door_get_int64(ndmp_door_ctx_t *); 3682654012fSReza Sabdar extern uint64_t ndmp_door_get_uint64(ndmp_door_ctx_t *); 3692654012fSReza Sabdar extern void ndmp_door_put_uint64(ndmp_door_ctx_t *, uint64_t); 3702654012fSReza Sabdar extern void ndmp_door_put_short(ndmp_door_ctx_t *, short); 3712654012fSReza Sabdar extern short ndmp_door_get_short(ndmp_door_ctx_t *); 3722654012fSReza Sabdar extern void ndmp_door_put_ushort(ndmp_door_ctx_t *, unsigned short); 3732654012fSReza Sabdar extern unsigned short ndmp_door_get_ushort(ndmp_door_ctx_t *); 3742654012fSReza Sabdar extern void ndmp_door_put_buf(ndmp_door_ctx_t *, unsigned char *, int); 3752654012fSReza Sabdar extern int ndmp_door_get_buf(ndmp_door_ctx_t *, unsigned char *, int); 3762654012fSReza Sabdar 3772654012fSReza Sabdar extern int ndmp_include_zfs(ndmp_context_t *, const char *); 3782654012fSReza Sabdar extern int ndmp_iter_zfs(ndmp_context_t *, int (*)(nvlist_t *, void *), void *); 3792654012fSReza Sabdar extern uint_t ndmp_context_get_version(ndmp_context_t *); 3802654012fSReza Sabdar extern void ndmp_context_set_specific(ndmp_context_t *, void *); 3812654012fSReza Sabdar extern void *ndmp_context_get_specific(ndmp_context_t *); 38242ed7838SReza Sabdar void ndmp_log_dma(ndmp_context_t *, ndmp_log_dma_type_t, const char *, ...); 3832654012fSReza Sabdar 3842654012fSReza Sabdar #ifdef __cplusplus 3852654012fSReza Sabdar } 3862654012fSReza Sabdar #endif 3872654012fSReza Sabdar 3882654012fSReza Sabdar #endif /* _LIBNDMP_H */ 389