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 #include <stdlib.h>
  39 #include <unistd.h>
  40 #include <string.h>
  41 #include <errno.h>
  42 #include <sys/types.h>
  43 #include <sys/socket.h>
  44 #include <netdb.h>
  45 #include <sys/time.h>
  46 #include <netinet/in.h>
  47 #include <arpa/inet.h>
  48 #include <sys/uio.h>
  49 #include <stdarg.h>
  50 
  51 #include <ndmp_connect.h>
  52 
  53 /*
  54  * strToNdmpSubMessageCode(): Converts ndmp message string
  55  * to ndmp message code.
  56  *
  57  * Arguments :
  58  *      char * -  ndmp message string.
  59  * Returns :
  60  *      ndmp_message - ndmp_message code.
  61  */
  62 ndmp_message
  63 strToNdmpSubMessageCode(char *strNdmp)
  64 {
  65         if (!(strcmp(strNdmp, "NDMP_MOVER_HALT_CONNECT_CLOSED")))
  66                 return ((ndmp_message) NDMP_MOVER_HALT_CONNECT_CLOSED);
  67         if (!(strcmp(strNdmp, "NDMP_MOVER_HALT_ABORTED")))
  68                 return ((ndmp_message) NDMP_MOVER_HALT_ABORTED);
  69         if (!(strcmp(strNdmp, "NDMP_MOVER_HALT_INTERNAL_ERROR")))
  70                 return ((ndmp_message) NDMP_MOVER_HALT_INTERNAL_ERROR);
  71         if (!(strcmp(strNdmp, "NDMP_MOVER_HALT_CONNECT_ERROR")))
  72                 return ((ndmp_message) NDMP_MOVER_HALT_CONNECT_ERROR);
  73         if (!(strcmp(strNdmp, "NDMP_MOVER_HALT_MEDIA_ERROR")))
  74                 return ((ndmp_message) NDMP_MOVER_HALT_MEDIA_ERROR);
  75 
  76         if (!(strcmp(strNdmp, "NDMP_DATA_HALT_SUCCESSFUL")))
  77                 return ((ndmp_message) NDMP_DATA_HALT_SUCCESSFUL);
  78         if (!(strcmp(strNdmp, "NDMP_DATA_HALT_ABORTED")))
  79                 return ((ndmp_message) NDMP_DATA_HALT_ABORTED);
  80         if (!(strcmp(strNdmp, "NDMP_DATA_HALT_INTERNAL_ERROR")))
  81                 return ((ndmp_message) NDMP_DATA_HALT_INTERNAL_ERROR);
  82         if (!(strcmp(strNdmp, "NDMP_DATA_HALT_CONNECT_ERROR")))
  83                 return ((ndmp_message) NDMP_DATA_HALT_CONNECT_ERROR);
  84 
  85         if (!(strcmp(strNdmp, "NDMP_CONNECTED")))
  86                 return ((ndmp_message) NDMP_CONNECTED);
  87         if (!(strcmp(strNdmp, "NDMP_SHUTDOWN")))
  88                 return ((ndmp_message) NDMP_SHUTDOWN);
  89         if (!(strcmp(strNdmp, "NDMP_REFUSED")))
  90                 return ((ndmp_message) NDMP_REFUSED);
  91 
  92         if (!(strcmp(strNdmp, "NDMP_MOVER_PAUSE_NA")))
  93                 return ((ndmp_message) NDMP_MOVER_PAUSE_NA);
  94         if (!(strcmp(strNdmp, "NDMP_MOVER_PAUSE_EOM")))
  95                 return ((ndmp_message) NDMP_MOVER_PAUSE_EOM);
  96         if (!(strcmp(strNdmp, "NDMP_MOVER_PAUSE_EOF")))
  97                 return ((ndmp_message) NDMP_MOVER_PAUSE_EOF);
  98         if (!(strcmp(strNdmp, "NDMP_MOVER_PAUSE_SEEK")))
  99                 return ((ndmp_message) NDMP_MOVER_PAUSE_SEEK);
 100         if (!(strcmp(strNdmp, "NDMP_MOVER_PAUSE_EOW")))
 101                 return ((ndmp_message) NDMP_MOVER_PAUSE_EOW);
 102 
 103         if (!(strcmp(strNdmp, "NDMP_LOG_NORMAL")))
 104                 return ((ndmp_message) NDMP_LOG_NORMAL);
 105         if (!(strcmp(strNdmp, "NDMP_LOG_DEBUG")))
 106                 return ((ndmp_message) NDMP_LOG_DEBUG);
 107         if (!(strcmp(strNdmp, "NDMP_LOG_ERROR")))
 108                 return ((ndmp_message) NDMP_LOG_ERROR);
 109         if (!(strcmp(strNdmp, "NDMP_LOG_WARNING")))
 110                 return ((ndmp_message) NDMP_LOG_WARNING);
 111 
 112         if (!(strcmp(strNdmp, "NDMP_RECOVERY_SUCCESSFUL")))
 113                 return ((ndmp_message) NDMP_RECOVERY_SUCCESSFUL);
 114         if (!(strcmp(strNdmp, "NDMP_RECOVERY_FAILED_PERMISSION")))
 115                 return ((ndmp_message) NDMP_RECOVERY_FAILED_PERMISSION);
 116         if (!(strcmp(strNdmp, "NDMP_RECOVERY_FAILED_NOT_FOUND")))
 117                 return ((ndmp_message) NDMP_RECOVERY_FAILED_NOT_FOUND);
 118         if (!(strcmp(strNdmp, "NDMP_RECOVERY_FAILED_NO_DIRECTORY")))
 119                 return ((ndmp_message) NDMP_RECOVERY_FAILED_NO_DIRECTORY);
 120         if (!(strcmp(strNdmp, "NDMP_RECOVERY_FAILED_OUT_OF_MEMORY")))
 121                 return ((ndmp_message) NDMP_RECOVERY_FAILED_OUT_OF_MEMORY);
 122         if (!(strcmp(strNdmp, "NDMP_RECOVERY_FAILED_IO_ERROR")))
 123                 return ((ndmp_message) NDMP_RECOVERY_FAILED_IO_ERROR);
 124         if (!(strcmp(strNdmp, "NDMP_RECOVERY_FAILED_UNDEFINED_ERROR")))
 125                 return ((ndmp_message) NDMP_RECOVERY_FAILED_UNDEFINED_ERROR);
 126         if (!(strcmp(strNdmp, "NDMP_RECOVERY_FAILED_FILE_PATH_EXISTS")))
 127                 return ((ndmp_message) NDMP_RECOVERY_FAILED_FILE_PATH_EXISTS);
 128 
 129         else
 130                 return (1000);
 131 }
 132 
 133 /*
 134  * strToNdmpMessageCode(): Converts ndmp message string to
 135  * ndmp message code.
 136  *
 137  * Arguments :
 138  *      char * - ndmp message string to be converted.
 139  *
 140  * Returns :
 141  *      ndmp_message - ndmp_message code.
 142  */
 143 ndmp_message
 144 strToNdmpMessageCode(char *strNdmp)
 145 {
 146         if (!(strcmp(strNdmp, "NDMP_CONNECT_OPEN")))
 147                 return (NDMP_CONNECT_OPEN);
 148         if (!(strcmp(strNdmp, "NDMP_CONNECT_CLIENT_AUTH")))
 149                 return (NDMP_CONNECT_CLIENT_AUTH);
 150         if (!(strcmp(strNdmp, "NDMP_CONNECT_CLOSE")))
 151                 return (NDMP_CONNECT_CLOSE);
 152         if (!(strcmp(strNdmp, "NDMP_CONNECT_SERVER_AUTH")))
 153                 return (NDMP_CONNECT_SERVER_AUTH);
 154 
 155         if (!(strcmp(strNdmp, "NDMP_CONFIG_GET_HOST_INFO")))
 156                 return (NDMP_CONFIG_GET_HOST_INFO);
 157         if (!(strcmp(strNdmp, "NDMP_CONFIG_GET_CONNECTION_TYPE")))
 158                 return (NDMP_CONFIG_GET_CONNECTION_TYPE);
 159         if (!(strcmp(strNdmp, "NDMP_CONFIG_GET_AUTH_ATTR")))
 160                 return (NDMP_CONFIG_GET_AUTH_ATTR);
 161         if (!(strcmp(strNdmp, "NDMP_CONFIG_GET_BUTYPE_INFO")))
 162                 return (NDMP_CONFIG_GET_BUTYPE_INFO);
 163         if (!(strcmp(strNdmp, "NDMP_CONFIG_GET_FS_INFO")))
 164                 return (NDMP_CONFIG_GET_FS_INFO);
 165         if (!(strcmp(strNdmp, "NDMP_CONFIG_GET_TAPE_INFO")))
 166                 return (NDMP_CONFIG_GET_TAPE_INFO);
 167         if (!(strcmp(strNdmp, "NDMP_CONFIG_GET_SCSI_INFO")))
 168                 return (NDMP_CONFIG_GET_SCSI_INFO);
 169         if (!(strcmp(strNdmp, "NDMP_CONFIG_GET_SERVER_INFO")))
 170                 return (NDMP_CONFIG_GET_SERVER_INFO);
 171         if (!(strcmp(strNdmp, "NDMP_CONFIG_GET_EXT_LIST")))
 172                 return (NDMP_CONFIG_GET_EXT_LIST);
 173         if (!(strcmp(strNdmp, "NDMP_CONFIG_SET_EXT_LIST")))
 174                 return (NDMP_CONFIG_SET_EXT_LIST);
 175 
 176         if (!(strcmp(strNdmp, "NDMP_SCSI_OPEN")))
 177                 return (NDMP_SCSI_OPEN);
 178         if (!(strcmp(strNdmp, "NDMP_SCSI_CLOSE")))
 179                 return (NDMP_SCSI_CLOSE);
 180         if (!(strcmp(strNdmp, "NDMP_SCSI_GET_STATE")))
 181                 return (NDMP_SCSI_GET_STATE);
 182         if (!(strcmp(strNdmp, "NDMP_SCSI_RESET_DEVICE")))
 183                 return (NDMP_SCSI_RESET_DEVICE);
 184         if (!(strcmp(strNdmp, "NDMP_SCSI_EXECUTE_CDB")))
 185                 return (NDMP_SCSI_EXECUTE_CDB);
 186 
 187         if (!(strcmp(strNdmp, "NDMP_TAPE_OPEN")))
 188                 return (NDMP_TAPE_OPEN);
 189         if (!(strcmp(strNdmp, "NDMP_TAPE_CLOSE")))
 190                 return (NDMP_TAPE_CLOSE);
 191         if (!(strcmp(strNdmp, "NDMP_TAPE_GET_STATE")))
 192                 return (NDMP_TAPE_GET_STATE);
 193         if (!(strcmp(strNdmp, "NDMP_TAPE_MTIO")))
 194                 return (NDMP_TAPE_MTIO);
 195         if (!(strcmp(strNdmp, "NDMP_TAPE_WRITE")))
 196                 return (NDMP_TAPE_WRITE);
 197         if (!(strcmp(strNdmp, "NDMP_TAPE_READ")))
 198                 return (NDMP_TAPE_READ);
 199         if (!(strcmp(strNdmp, "NDMP_TAPE_EXECUTE_CDB")))
 200                 return (NDMP_TAPE_EXECUTE_CDB);
 201 
 202         if (!(strcmp(strNdmp, "NDMP_DATA_GET_STATE")))
 203                 return (NDMP_DATA_GET_STATE);
 204         if (!(strcmp(strNdmp, "NDMP_DATA_START_BACKUP")))
 205                 return (NDMP_DATA_START_BACKUP);
 206         if (!(strcmp(strNdmp, "NDMP_DATA_START_RECOVER")))
 207                 return (NDMP_DATA_START_RECOVER);
 208         if (!(strcmp(strNdmp, "NDMP_DATA_ABORT")))
 209                 return (NDMP_DATA_ABORT);
 210         if (!(strcmp(strNdmp, "NDMP_DATA_GET_ENV")))
 211                 return (NDMP_DATA_GET_ENV);
 212         if (!(strcmp(strNdmp, "NDMP_DATA_STOP")))
 213                 return (NDMP_DATA_STOP);
 214         if (!(strcmp(strNdmp, "NDMP_DATA_LISTEN")))
 215                 return (NDMP_DATA_LISTEN);
 216         if (!(strcmp(strNdmp, "NDMP_DATA_CONNECT")))
 217                 return (NDMP_DATA_CONNECT);
 218         if (!(strcmp(strNdmp, "NDMP_DATA_START_RECOVER_FILEHIST")))
 219                 return (NDMP_DATA_START_RECOVER_FILEHIST);
 220 
 221         if (!(strcmp(strNdmp, "NDMP_NOTIFY_DATA_HALTED")))
 222                 return (NDMP_NOTIFY_DATA_HALTED);
 223         if (!(strcmp(strNdmp, "NDMP_NOTIFY_CONNECTION_STATUS")))
 224                 return (NDMP_NOTIFY_CONNECTION_STATUS);
 225         if (!(strcmp(strNdmp, "NDMP_NOTIFY_MOVER_HALTED")))
 226                 return (NDMP_NOTIFY_MOVER_HALTED);
 227         if (!(strcmp(strNdmp, "NDMP_NOTIFY_MOVER_PAUSED")))
 228                 return (NDMP_NOTIFY_MOVER_PAUSED);
 229         if (!(strcmp(strNdmp, "NDMP_NOTIFY_DATA_READ")))
 230                 return (NDMP_NOTIFY_DATA_READ);
 231 
 232         if (!(strcmp(strNdmp, "NDMP_LOG_FILE")))
 233                 return (NDMP_LOG_FILE);
 234         if (!(strcmp(strNdmp, "NDMP_LOG_MESSAGE")))
 235                 return (NDMP_LOG_MESSAGE);
 236 
 237         if (!(strcmp(strNdmp, "NDMP_FH_ADD_FILE")))
 238                 return (NDMP_FH_ADD_FILE);
 239         if (!(strcmp(strNdmp, "NDMP_FH_ADD_DIR")))
 240                 return (NDMP_FH_ADD_DIR);
 241         if (!(strcmp(strNdmp, "NDMP_FH_ADD_NODE")))
 242                 return (NDMP_FH_ADD_NODE);
 243 
 244         if (!(strcmp(strNdmp, "NDMP_MOVER_GET_STATE")))
 245                 return (NDMP_MOVER_GET_STATE);
 246         if (!(strcmp(strNdmp, "NDMP_MOVER_LISTEN")))
 247                 return (NDMP_MOVER_LISTEN);
 248         if (!(strcmp(strNdmp, "NDMP_MOVER_CONTINUE")))
 249                 return (NDMP_MOVER_CONTINUE);
 250         if (!(strcmp(strNdmp, "NDMP_MOVER_ABORT")))
 251                 return (NDMP_MOVER_ABORT);
 252         if (!(strcmp(strNdmp, "NDMP_MOVER_STOP")))
 253                 return (NDMP_MOVER_STOP);
 254         if (!(strcmp(strNdmp, "NDMP_MOVER_SET_WINDOW")))
 255                 return (NDMP_MOVER_SET_WINDOW);
 256         if (!(strcmp(strNdmp, "NDMP_MOVER_READ")))
 257                 return (NDMP_MOVER_READ);
 258         if (!(strcmp(strNdmp, "NDMP_MOVER_CLOSE")))
 259                 return (NDMP_MOVER_CLOSE);
 260         if (!(strcmp(strNdmp, "NDMP_MOVER_SET_RECORD_SIZE")))
 261                 return (NDMP_MOVER_SET_RECORD_SIZE);
 262         if (!(strcmp(strNdmp, "NDMP_MOVER_CONNECT")))
 263                 return (NDMP_MOVER_CONNECT);
 264 
 265         if (!(strcmp(strNdmp, "NDMP_EXT_STANDARD_BASE")))
 266                 return (NDMP_EXT_STANDARD_BASE);
 267 
 268         if (!(strcmp(strNdmp, "NDMP_EXT_PROPRIETARY_BASE")))
 269                 return (NDMP_EXT_PROPRIETARY_BASE);
 270 
 271         return (0);
 272 }
 273 
 274 /*
 275  * strToNdmpErrorCode() : Converts ndmp error code in string format
 276  * to ndmp error code in number format.
 277  *
 278  * Arguments :
 279  *      char * - ndmp error code in string format.
 280  * Returns :
 281  *      ndmp_error - ndmp_error code.
 282  */
 283 ndmp_error
 284 strToNdmpErrorCode(char *strNdmpErrorCode)
 285 {
 286         if (! (strcmp(strNdmpErrorCode, "NDMP_NO_ERR")))
 287                 return (NDMP_NO_ERR);
 288         if (! (strcmp(strNdmpErrorCode, "NDMP_NOT_SUPPORTED_ERR")))
 289                 return (NDMP_NOT_SUPPORTED_ERR);
 290         if (! (strcmp(strNdmpErrorCode, "NDMP_DEVICE_BUSY_ERR")))
 291                 return (NDMP_DEVICE_BUSY_ERR);
 292         if (! (strcmp(strNdmpErrorCode, "NDMP_DEVICE_OPENED_ERR")))
 293                 return (NDMP_DEVICE_OPENED_ERR);
 294         if (! (strcmp(strNdmpErrorCode, "NDMP_NOT_AUTHORIZED_ERR")))
 295                 return (NDMP_NOT_AUTHORIZED_ERR);
 296         if (! (strcmp(strNdmpErrorCode, "NDMP_PERMISSION_ERR")))
 297                 return (NDMP_PERMISSION_ERR);
 298         if (! (strcmp(strNdmpErrorCode, "NDMP_DEV_NOT_OPEN_ERR")))
 299                 return (NDMP_DEV_NOT_OPEN_ERR);
 300         if (! (strcmp(strNdmpErrorCode, "NDMP_IO_ERR")))
 301                 return (NDMP_IO_ERR);
 302         if (! (strcmp(strNdmpErrorCode, "NDMP_TIMEOUT_ERR")))
 303                 return (NDMP_TIMEOUT_ERR);
 304         if (! (strcmp(strNdmpErrorCode, "NDMP_ILLEGAL_ARGS_ERR")))
 305                 return (NDMP_ILLEGAL_ARGS_ERR);
 306         if (! (strcmp(strNdmpErrorCode, "NDMP_NO_TAPE_LOADED_ERR")))
 307                 return (NDMP_NO_TAPE_LOADED_ERR);
 308         if (! (strcmp(strNdmpErrorCode, "NDMP_WRITE_PROTECT_ERR")))
 309                 return (NDMP_WRITE_PROTECT_ERR);
 310         if (! (strcmp(strNdmpErrorCode, "NDMP_EOF_ERR")))
 311                 return (NDMP_EOF_ERR);
 312         if (! (strcmp(strNdmpErrorCode, "NDMP_EOM_ERR")))
 313                 return (NDMP_EOM_ERR);
 314         if (! (strcmp(strNdmpErrorCode, "NDMP_FILE_NOT_FOUND_ERR")))
 315                 return (NDMP_FILE_NOT_FOUND_ERR);
 316         if (! (strcmp(strNdmpErrorCode, "NDMP_BAD_FILE_ERR")))
 317                 return (NDMP_BAD_FILE_ERR);
 318         if (! (strcmp(strNdmpErrorCode, "NDMP_NO_DEVICE_ERR")))
 319                 return (NDMP_NO_DEVICE_ERR);
 320         if (! (strcmp(strNdmpErrorCode, "NDMP_NO_BUS_ERR")))
 321                 return (NDMP_NO_BUS_ERR);
 322         if (! (strcmp(strNdmpErrorCode, "NDMP_XDR_DECODE_ERR")))
 323                 return (NDMP_XDR_DECODE_ERR);
 324         if (! (strcmp(strNdmpErrorCode, "NDMP_ILLEGAL_STATE_ERR")))
 325                 return (NDMP_ILLEGAL_STATE_ERR);
 326         if (! (strcmp(strNdmpErrorCode, "NDMP_UNDEFINED_ERR")))
 327                 return (NDMP_UNDEFINED_ERR);
 328         if (! (strcmp(strNdmpErrorCode, "NDMP_XDR_ENCODE_ERR")))
 329                 return (NDMP_XDR_ENCODE_ERR);
 330         if (! (strcmp(strNdmpErrorCode, "NDMP_NO_MEM_ERR")))
 331                 return (NDMP_NO_MEM_ERR);
 332         if (! (strcmp(strNdmpErrorCode, "NDMP_CONNECT_ERR")))
 333                 return (NDMP_CONNECT_ERR);
 334         if (! (strcmp(strNdmpErrorCode, "NDMP_SEQUENCE_NUM_ERR")))
 335                 return (NDMP_SEQUENCE_NUM_ERR);
 336         if (! (strcmp(strNdmpErrorCode, "NDMP_READ_IN_PROGRESS_ERR")))
 337                 return (NDMP_READ_IN_PROGRESS_ERR);
 338         if (! (strcmp(strNdmpErrorCode, "NDMP_PRECONDITION_ERR")))
 339                 return (NDMP_PRECONDITION_ERR);
 340         if (! (strcmp(strNdmpErrorCode, "NDMP_CLASS_NOT_SUPPORTED_ERR")))
 341                 return (NDMP_CLASS_NOT_SUPPORTED_ERR);
 342         if (! (strcmp(strNdmpErrorCode, "NDMP_VERSION_NOT_SUPPORTED_ERR")))
 343                 return (NDMP_VERSION_NOT_SUPPORTED_ERR);
 344         if (! (strcmp(strNdmpErrorCode, "NDMP_EXT_DUPL_CLASSES_ERR")))
 345                 return (NDMP_EXT_DUPL_CLASSES_ERR);
 346         if (! (strcmp(strNdmpErrorCode, "NDMP_EXT_DANDN_ILLEGAL_ERR")))
 347                 return (NDMP_EXT_DANDN_ILLEGAL_ERR);
 348         return (0);
 349 }
 350 
 351 static char     strNdmpErrorCode[40];
 352 
 353 /*
 354  * ndmpErrorCodeToStr() : Converts ndmp error code from
 355  * hex format to ndmp error code in string format.
 356  *
 357  * Arguments :
 358  *      ndmp_error - ndmp_error code.
 359  * Returns :
 360  *      char * - ndmp error code in string format.
 361  */
 362 char *
 363 ndmpErrorCodeToStr(ndmp_error ndmpErrorCode)
 364 {
 365         switch (ndmpErrorCode) {
 366                 case NDMP_NO_ERR:
 367                         (void) strcpy(strNdmpErrorCode, "NDMP_NO_ERR");
 368                         break;
 369                 case NDMP_NOT_SUPPORTED_ERR:
 370                         (void) strcpy(strNdmpErrorCode,
 371                             "NDMP_NOT_SUPPORTED_ERR");
 372                         break;
 373                 case NDMP_DEVICE_BUSY_ERR:
 374                         (void) strcpy(strNdmpErrorCode,
 375                             "NDMP_DEVICE_BUSY_ERR");
 376                         break;
 377                 case NDMP_DEVICE_OPENED_ERR:
 378                         (void) strcpy(strNdmpErrorCode,
 379                             "NDMP_DEVICE_OPENED_ERR");
 380                         break;
 381                 case NDMP_NOT_AUTHORIZED_ERR:
 382                         (void) strcpy(strNdmpErrorCode,
 383                             "NDMP_NOT_AUTHORIZED_ERR");
 384                         break;
 385                 case NDMP_PERMISSION_ERR:
 386                         (void) strcpy(strNdmpErrorCode,
 387                             "NDMP_PERMISSION_ERR");
 388                         break;
 389                 case NDMP_DEV_NOT_OPEN_ERR:
 390                         (void) strcpy(strNdmpErrorCode,
 391                             "NDMP_DEV_NOT_OPEN_ERR");
 392                         break;
 393                 case NDMP_IO_ERR:
 394                         (void) strcpy(strNdmpErrorCode,
 395                             "NDMP_IO_ERR");
 396                         break;
 397                 case NDMP_TIMEOUT_ERR:
 398                         (void) strcpy(strNdmpErrorCode,
 399                             "NDMP_TIMEOUT_ERR");
 400                         break;
 401                 case NDMP_ILLEGAL_ARGS_ERR:
 402                         (void) strcpy(strNdmpErrorCode,
 403                             "NDMP_ILLEGAL_ARGS_ERR");
 404                         break;
 405                 case NDMP_NO_TAPE_LOADED_ERR:
 406                         (void) strcpy(strNdmpErrorCode,
 407                             "NDMP_NO_TAPE_LOADED_ERR");
 408                         break;
 409                 case NDMP_WRITE_PROTECT_ERR:
 410                         (void) strcpy(strNdmpErrorCode,
 411                             "NDMP_WRITE_PROTECT_ERR");
 412                         break;
 413                 case NDMP_EOF_ERR:
 414                         (void) strcpy(strNdmpErrorCode,
 415                             "NDMP_EOF_ERR");
 416                         break;
 417                 case NDMP_EOM_ERR:
 418                         (void) strcpy(strNdmpErrorCode,
 419                             "NDMP_EOM_ERR");
 420                         break;
 421                 case NDMP_FILE_NOT_FOUND_ERR:
 422                         (void) strcpy(strNdmpErrorCode,
 423                             "NDMP_FILE_NOT_FOUND_ERR");
 424                         break;
 425                 case NDMP_BAD_FILE_ERR:
 426                         (void) strcpy(strNdmpErrorCode,
 427                             "NDMP_BAD_FILE_ERR");
 428                         break;
 429                 case NDMP_NO_DEVICE_ERR:
 430                         (void) strcpy(strNdmpErrorCode,
 431                             "NDMP_NO_DEVICE_ERR");
 432                         break;
 433                 case NDMP_NO_BUS_ERR:
 434                         (void) strcpy(strNdmpErrorCode,
 435                             "NDMP_NO_BUS_ERR");
 436                         break;
 437                 case NDMP_XDR_DECODE_ERR:
 438                         (void) strcpy(strNdmpErrorCode,
 439                             "NDMP_XDR_DECODE_ERR");
 440                         break;
 441                 case NDMP_ILLEGAL_STATE_ERR:
 442                         (void) strcpy(strNdmpErrorCode,
 443                             "NDMP_ILLEGAL_STATE_ERR");
 444                         break;
 445                 case NDMP_UNDEFINED_ERR:
 446                         (void) strcpy(strNdmpErrorCode,
 447                             "NDMP_UNDEFINED_ERR");
 448                         break;
 449                 case NDMP_XDR_ENCODE_ERR:
 450                         (void) strcpy(strNdmpErrorCode,
 451                             "NDMP_XDR_ENCODE_ERR");
 452                         break;
 453                 case NDMP_NO_MEM_ERR:
 454                         (void) strcpy(strNdmpErrorCode,
 455                             "NDMP_NO_MEM_ERR");
 456                         break;
 457                 case NDMP_CONNECT_ERR:
 458                         (void) strcpy(strNdmpErrorCode,
 459                             "NDMP_CONNECT_ERR");
 460                         break;
 461                 case NDMP_SEQUENCE_NUM_ERR:
 462                         (void) strcpy(strNdmpErrorCode,
 463                             "NDMP_SEQUENCE_NUM_ERR");
 464                         break;
 465                 case NDMP_READ_IN_PROGRESS_ERR:
 466                         (void) strcpy(strNdmpErrorCode,
 467                             "NDMP_READ_IN_PROGRESS_ERR");
 468                         break;
 469                 case NDMP_PRECONDITION_ERR:
 470                         (void) strcpy(strNdmpErrorCode,
 471                             "NDMP_PRECONDITION_ERR");
 472                         break;
 473                 case NDMP_CLASS_NOT_SUPPORTED_ERR:
 474                         (void) strcpy(strNdmpErrorCode,
 475                         "NDMP_CLASS_NOT_SUPPORTED_ERR");
 476                         break;
 477                 case NDMP_VERSION_NOT_SUPPORTED_ERR:
 478                         (void) strcpy(strNdmpErrorCode,
 479                         "NDMP_VERSION_NOT_SUPPORTED_ERR");
 480                         break;
 481                 case NDMP_EXT_DUPL_CLASSES_ERR:
 482                         (void) strcpy(strNdmpErrorCode,
 483                             "NDMP_EXT_DUPL_CLASSES_ERR");
 484                         break;
 485                 case NDMP_EXT_DANDN_ILLEGAL_ERR:
 486                         (void) strcpy(strNdmpErrorCode,
 487                             "NDMP_EXT_DANDN_ILLEGAL_ERR");
 488                         break;
 489                 default:
 490                         (void) strcpy(strNdmpErrorCode,
 491                             "UNKNOWN_NDMP_ERROR_CODE");
 492         }
 493 
 494         return (strNdmpErrorCode);
 495 }
 496 /*
 497  * End of file  :       ndmp_conv.c
 498  */