1 /*
   2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  */
   5 
   6 /*
   7  * BSD 3 Clause License
   8  *
   9  * Redistribution and use in source and binary forms, with or without
  10  * modification, are permitted provided that the following conditions are met:
  11  *      - Redistributions of source code must retain the above copyright
  12  *      notice, this list of conditions and the following disclaimer.
  13  *
  14  *      - Redistributions in binary form must reproduce the above copyright
  15  *      notice, this list of conditions and the following disclaimer in the
  16  *      documentation and/or other materials provided with the distribution.
  17  *
  18  *      - Neither the name of Sun Microsystems, Inc. nor the
  19  *      names of its contributors may be used to endorse or promote products
  20  *      derived from this software without specific prior written permission.
  21  *
  22  * THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. ''AS IS'' AND ANY
  23  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25  * DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY
  26  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32  */
  33 
  34 /*
  35  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  36  */
  37 
  38 #ifndef _NDMP_COMM_LIB_H
  39 #define _NDMP_COMM_LIB_H
  40 
  41 /*
  42  * Library functions exposed. These functions are used by
  43  * mainly data and mover interfaces.
  44  */
  45 
  46 #ifdef __cplusplus
  47 extern "C" {
  48 #endif
  49 
  50 #include <ndmp.h>
  51 #include <process_hdlr_table.h>
  52 
  53 #define NDMP_TIME_OUT 5
  54 #define STD_BACKUP_TYPE_DUMP 1
  55 #define STD_BACKUP_TYPE_TAR 2
  56 
  57 void print_ndmp_u_quad(FILE *outstream, ndmp_u_quad quad_t);
  58 void print_ndmp_pval(FILE *outstream, ndmp_pval *pval);
  59 void print_ndmp_tcp_addr(FILE *outstream, ndmp_tcp_addr *tcp_addr);
  60 void print_ndmp_addr(FILE *outstream, ndmp_addr *addr);
  61 ndmp_auth_type strToNdmpAuthType(char *str);
  62 void print_ndmp_addr_type(FILE *outstream, ndmp_addr_type addr);
  63 char *ndmpDataOperationToStr(ndmp_data_operation, char *);
  64 char *ndmpDataStateToStr(ndmp_data_state, char *);
  65 char *ndmpDataHaltReasonToStr(ndmp_data_halt_reason, char *);
  66 ndmp_mover_state strToNdmpMoverState(char *);
  67 ndmp_mover_pause_reason strToNdmpMoverPauseReason(char *);
  68 ndmp_mover_halt_reason strToNdmpMoverHaltReason(char *);
  69 char *ndmpMoverModeToStr(ndmp_mover_mode);
  70 char *ndmpMoverStateToStr(ndmp_mover_state, char *);
  71 char *ndmpMoverPauseReasonToStr(ndmp_mover_pause_reason, char *);
  72 char *ndmpMoverHaltReasonToStr(ndmp_mover_halt_reason, char *);
  73 ndmp_mover_mode strToNdmpMoverMode(char *);
  74 ndmp_addr_type
  75 convert_addr_type(char *);
  76 ndmp_mover_mode
  77 convert_mover_mode(char *);
  78 int
  79 convert_butype(char *);
  80 int
  81 print_intl_result(int, FILE *);
  82 int
  83 print_cleanup_result(int, FILE *);
  84 int
  85 print_intl_result(int, FILE *);
  86 char *
  87 ndmp_err_to_string(ndmp_error);
  88 int
  89 print_test_result(int, FILE *);
  90 ndmp_tape_mtio_op
  91 convert_tape_mtio_op(char *);
  92 #ifdef __cplusplus
  93 }
  94 #endif
  95 
  96 #endif /* _NDMP_COMM_LIB_H */