Wireshark-dev: [Wireshark-dev] NDMP V4 and SnapShot Management Extensions dissector support

From: "Jesse Lala" <jessel@xxxxxxxxxxx>
Date: Fri, 23 Apr 2010 10:58:43 -0700
Hello,
 
Looking to see if we could add  the NDMP headers for the NDMP v4 Snapshot manager extension.
 
NDMP V4 SnapShot Management Extensions
 

Appendix A: XDR Definitions

Although there are certainly many very different XDR files that could define an NDMP specification, one is included below for purposes of reference.

struct ndmp_u_quad

{

     u_long      high;

     u_long      low;

};

 

struct ndmp_pval

{

     string      name<>;

     string      value<>;

};

 

enum ndmp_snap_message

{

     NDMP_SNAP_CREATE              = 0x20500100,

     NDMP_SNAP_DELETE              = 0x20500101,

    NDMP_SNAP_RECOVER             = 0x20500102,

    NDMP_SNAP_RENAME              = 0x20500103,

    NDMP_SNAP_GET_SERVER_INFO     = 0x20500104,

    NDMP_SNAP_GET_SNAPSHOT_NAMES  = 0x20500105,

    NDMP_SNAP_GET_SNAPSHOT_STATE  = 0x20500106,

    NDMP_SNAP_GET_CDR_OP_STATE    = 0x20500107,

    NDMP_SNAP_GET_SNAPSHOT_PATH   = 0x20500108,

    NDMP_SNAP_SET_RESERVE         = 0x20500109,

    NDMP_SNAP_GET_RESERVE_INFO    = 0x2050010a,

    NDMP_SNAP_SET_SCHEDULE        = 0x2050010b,

    NDMP_SNAP_GET_SCHEDULE_INFO   = 0x2050010c,

    NDMP_SNAP_DIR_LIST            = 0x2050010d,

 

    NDMP_SNAP_NOTIFY_CREATE_END   = 0x20500180,

    NDMP_SNAP_NOTIFY_DELETE_END   = 0x20500181,

    NDMP_SNAP_NOTIFY_RECOVER_END  = 0x20500182

};

 

enum ndmp_snap_error

{

     NDMP_NO_ERR                   = 0,

     NDMP_PERMISSION_ERR           = 5,

     NDMP_IO_ERR                   = 7,

     NDMP_ILLEGAL_ARGS_ERR         = 9,

     NDMP_ILLEGAL_STATE_ERR        = 19,

     NDMP_NO_MEM_ERR               = 22,

     NDMP_SNAP_EXISTS_ERR          = 0x20500100,

     NDMP_SNAP_NOT_FOUND_ERR       = 0x20500101,

     NDMP_SNAP_READ_ONLY_FS_ERR    = 0x20500102,

     NDMP_SNAP_INVALID_PATH_ERR    = 0x20500103,

     NDMP_SNAP_NO_SPACE_ERR        = 0x20500104,

     NDMP_SNAP_BUSY_ERR            = 0x20500105,

     NDMP_SNAP_INTERNAL_ERR        = 0x20500106,

     NDMP_SNAP_NO_DISK_SPACE       = 0x20500107

};

 

/* NDMP_SNAP_CREATE */

struct ndmp_snap_create_request

{

     string            pathname<>;

     string            snapname<>;

};

 

struct ndmp_snap_create_reply

{

     ndmp_snap_error   error;

};

 

/* NDMP_SNAP_DELETE */

struct ndmp_snap_delete_request

{    

     string           snapname<>;

};

 

struct ndmp_snap_delete_reply

{

     ndmp_snap_error   error;

};

 

/* NDMP SNAP RECOVER FLAGS BITMASK BITS */

const NDMP_SNAP_RECOVER_DIR_ONLY_FLAG          = 0x00000001;

const NDMP_SNAP_RECOVER_DIR_DATA_FLAG          = 0x00000002;

const NDMP_SNAP_RECOVER_EXCEPTION_LOGGING_FLAG = 0x00000004;

 

/* NDMP_SNAP_RECOVER */

struct ndmp_name

{

     string            original_path<>;

     string            destination_dir<>;

     string            name<>;

     string            other_name<>;

     ndmp_u_quad       node;

     ndmp_u_quad       fh_info;

};

 

struct ndmp_snap_recover_request

{

     string            snapname<>;

     ndmp_name         nlist<>;

     u_long            flags;

};

 

struct ndmp_snap_recover_reply

{

     ndmp_snap_error   error;

};

 

/* NDMP_SNAP_RENAME */

struct ndmp_snap_rename_request

{     

     string            snapname<>;

     string            new_snapname<>;

};

 

struct ndmp_snap_rename_reply

{

     ndmp_snap_error   error;

};

 

/* NDMP_SNAP_GET_SERVER_INFO */

/* snap_get_server_info_reply create, recover, reserve support */

const NDMP_SNAP_VOLUME_ALLOWED          = 0x00000001;

const NDMP_SNAP_SUBVOLUME_ALLOWED       = 0x00000002;

const NDMP_SNAP_DRIVE_ALLOWED           = 0x00000004;

const NDMP_SNAP_DIRECTORY_ALLOWED       = 0x00000008;

const NDMP_SNAP_FILE_ALLOWED            = 0x00000010;

const NDMP_SNAP_OTHER_ALLOWED           = 0x00000020;

 

/* snap_get_server_info_reply scheduled snapshot support */

const NDMP_SNAP_SCHED_WEEKLY_ALLOWED    = 0x00000001;

const NDMP_SNAP_SCHED_DAILY_ALLOWED     = 0x00000002;

const NDMP_SNAP_SCHED_HOURLY_ALLOWED    = 0x00000004;

const NDMP_SNAP_SCHED_SET_TOD_ALLOWED   = 0x00000008;

const NDMP_SNAP_SCHED_SET_DOW_ALLOWED   = 0x00000010;

const NDMP_SNAP_SCHED_SET_HL_ALLOWED    = 0x00000020;

const NDMP_SNAP_SCHED_SET_PATH_ALLOWED  = 0x00000040;

 

/* snap_get_server_info_reply recover relocation support */

const NDMP_SNAP_RELOC_VOLUME_ALLOWED    = 0x00000001;

const NDMP_SNAP_RELOC_SUBVOLUME_ALLOWED = 0x00000002;

const NDMP_SNAP_RELOC_DRIVE_ALLOWED     = 0x00000004;

const NDMP_SNAP_RELOC_DIRECTORY_ALLOWED = 0x00000008;

const NDMP_SNAP_RELOC_FILE_ALLOWED      = 0x00000010;

 

struct ndmp_snap_get_server_info_reply

{

     ndmp_snap_error error;

     u_long            create_support;

     u_long            recover_support;

     u_long            reserve_support;

     u_long            schedule_support;

     u_long            relocation_support;     

};

 

/* NDMP_SNAP_GET_SNAPSHOT_NAMES */

struct ndmp_snap_get_snapshot_names_request

{

     string      pathname<>;

};

 

struct sname

{

     string      name<>;

};

 

struct ndmp_snap_get_snapshot_names_reply

{

     ndmp_snap_error   error;

     sname             snapnames<>;

};

 

/* NDMP_SNAP_GET_SNAPSHOT_STATE */

struct ndmp_snap_get_snapshot_state_request

{

     string            snapname<>;

};

 

/* snap_get_snapshot_state_reply unsupported bits */

const NDMP_SNAP_SNAPSHOT_STATE_PATHNAME_UNS   = 0x00000001;

const NDMP_SNAP_SNAPSHOT_STATE_USED_UNS       = 0x00000002;

const NDMP_SNAP_SNAPSHOT_STATE_TOTAL_UNS      = 0x00000004;

const NDMP_SNAP_SNAPSHOT_STATE_DATE_UNS       = 0x00000008;

const NDMP_SNAP_SNAPSHOT_STATE_BUSY_UNS       = 0x00000010;

const NDMP_SNAP_SNAPSHOT_STATE_DEPENDENCY_UNS = 0x00000020;

 

struct ndmp_snap_get_snapshot_state_reply

{

     ndmp_snap_error   error;

     u_long            unsupported;

     string            pathname<>;

     u_short           used_percent;

     u_short           total_percent;

     u_long            date;

     opaque            snapid[64];

     u_short           busy;

     u_short           dependency;

};

 

/* NDMP_SNAP_GET_CDR_OP_STATE */

struct ndmp_snap_get_cdr_op_state_request

{

     ndmp_snap_message operation_type; 

};

 

/* snap_get_cdr_op_state_reply unsupported bits */

const NDMP_SNAP_GET_CDR_OP_STATE_TOTAL_FILES_UNS     =0x00000001;

const NDMP_SNAP_GET_CDR_OP_STATE_PROCESSED_FILES_UNS =0x00000002;

const NDMP_SNAP_GET_CDR_OP_STATE_EXCEPTION_FILES_UNS =0x00000004;

const NDMP_SNAP_GET_CDR_OP_STATE_DATE_UNS            =0x00000008;

 

struct ndmp_snap_get_cdr_op_state_reply

{

     ndmp_snap_error   error;

     u_long            unsupported;

     ndmp_u_quad       total_files;

     ndmp_u_quad       processed_files;

     ndmp_u_quad       exception_files;

     u_long            date;

};

 

/* NDMP_SNAP_GET_SNAPSHOT_PATH */

/* snap_get_snapshot path_types */

enum ndmp_snap_path_types

{

     NDMP_SNAP_PATH_TYPE_UNCONSTRAINED         = 1,

     NDMP_SNAP_PATH_TYPE_PARTIALLY_CONSTRAINED = 2,

     NDMP_SNAP_PATH_TYPE_FULLY_CONSTRAINED     = 3

};

 

struct ndmp_snap_get_snapshot_path_request

{

     string      pathname<>;

};

 

struct ndmp_snap_get_snapshot_path_reply

{

     ndmp_snap_error         error;

     u_short                 max_snapshots;

     ndmp_snap_path_types    path_type;

     string                  snappath<>;

};

 

/* NDMP_SNAP_SET_RESERVE */

struct ndmp_snap_set_reserve_request

{

     string            pathame<>;

     u_short           percent;

};

 

struct ndmp_snap_set_reserve_reply

{

     ndmp_snap_error   error;

};

 

/* NDMP_SNAP_GET_RESERVE_INFO */

struct ndmp_snap_get_reserve_info_request

{

     string            pathname<>;

};

 

struct ndmp_snap_get_reserve_info_reply

{

     ndmp_snap_error   error;

     ndmp_u_quad kb;

     u_short           percent;

};

 

/* NDMP_SNAP_SET_SCHEDULE */

enum ndmp_snap_days

{

     NDMP_SNAP_SCHED_CREATE_NA           = 0,

     NDMP_SNAP_SCHED_CREATE_SUNDAY       = 1,

     NDMP_SNAP_SCHED_CREATE_MONDAY       = 2,

     NDMP_SNAP_SCHED_CREATE_TUESDAY      = 3,

     NDMP_SNAP_SCHED_CREATE_WEDNESDAY    = 4,

     NDMP_SNAP_SCHED_CREATE_THURSDAY     = 5,

     NDMP_SNAP_SCHED_CREATE_FRIDAY       = 6,

     NDMP_SNAP_SCHED_CREATE_SATURDAY     = 7

};

 

struct ndmp_snap_set_schedule_request

{

     string            pathname<>;

     u_short           week;

     u_short           day;

     u_short           hour;

     u_short           hourlist<>;

     ndmp_snap_days    day_of_week;

     u_short           time_of_day;

     string            snappath<>;

};

 

struct ndmp_snap_set_schedule_reply

{

     ndmp_snap_error   error;

};

 

/* NDMP_SNAP_GET_SCHEDULE_INFO */

struct ndmp_snap_get_schedule_info_request

{

     string            pathname<>;

};

 

struct ndmp_snap_get_schedule_info_reply

{

     ndmp_snap_error   error;

     u_short           week;

     u_short           day;

     u_short           hour;

     u_short           hourlist<>;

     ndmp_snap_days    day_of_week;

     u_short           time_of_day;

     string            snappath<>;

};

 

/* NDMP SNAP DIR_LIST REQUEST FLAGS BITMASK BITS */

const NDMP_SNAP_DIR_LIST_ABORT_FLAG   = 0x00000001;

 

/* NDMP SNAP DIR_LIST REPLY STATUS BITMASK BITS */

const NDMP_SNAP_DIR_LIST_MORE_STATUS  = 0x00000001;

 

/* NDMP_SNAP_DIR_LIST */

/* NDMP SNAP DIR LIST NODE BITMASK BITS */

const NDMP_SNAP_DIR_LIST_NODE_PRIMAL           = 0x00000001;

const NDMP_SNAP_DIR_LIST_NODE_VOLUME           = 0x00000002;

const NDMP_SNAP_DIR_LIST_NODE_SUBVOLUME        = 0x00000004;

const NDMP_SNAP_DIR_LIST_NODE_DRIVE            = 0x00000008;

const NDMP_SNAP_DIR_LIST_NODE_SNAPSHOT         = 0x00000010;

const NDMP_SNAP_DIR_LIST_NODE_SNAPSHOT_ALLOWED = 0x00010000;

 

enum ndmp_fs_type

{

     NDMP_FS_UNIX      = 0,

     NDMP_FS_NT        = 1,

     NDMP_FS_OTHER     = 2

};

 

typedef string ndmp_path<>;

 

struct ndmp_nt_path

{

     ndmp_path   nt_path;

     ndmp_path   dos_path;

};

 

union ndmp_file_name switch (ndmp_fs_type fs_type)

{

     case NDMP_FS_UNIX:

           ndmp_path         unix_name;

     case NDMP_FS_NT:

           ndmp_nt_path      nt_name;

     default:

           ndmp_path         other_name;

};

 

enum ndmp_file_type

{

     NDMP_FILE_DIR           = 0,

     NDMP_FILE_FIFO          = 1,

     NDMP_FILE_CSPEC         = 2,

     NDMP_FILE_BSPEC         = 3,

     NDMP_FILE_REG           = 4,

     NDMP_FILE_SLINK         = 5,

     NDMP_FILE_SOCK          = 6,

     NDMP_FILE_REGISTRY      = 7,

     NDMP_FILE_OTHER         = 8

};

 

const NDMP_FILE_STAT_ATIME_UNS = 0x00000001;

const NDMP_FILE_STAT_CTIME_UNS = 0x00000002;

const NDMP_FILE_STAT_GROUP_UNS = 0x00000004;

 

struct ndmp_file_stat

{

     u_long            unsupported;

     ndmp_fs_type      fs_type;

     ndmp_file_type    ftype;

     u_long            mtime;

     u_long            atime;

     u_long            ctime;

     u_long            owner;

     u_long            group;

     u_long            fattr;

     ndmp_u_quad       size;

     u_long            links;

};

 

struct ndmp_file

{

     ndmp_file_name    name<>;

     ndmp_file_stat    stat<>;

     ndmp_u_quad       node;

     ndmp_u_quad       fh_info;

};

 

struct ndmp_snap_dir_list_request

{

     string            pathname<>;

     u_long            flags;

     u_long            max_entries;

};

 

struct ndmp_snap_dir_list_reply

{

     ndmp_snap_error   error;

     ndmp_file         dir_list<>;

     u_long            status;

};

 

enum ndmp_snap_end_reason

{

     NDMP_SNAP_END_REASON_NA             = 0,

     NDMP_SNAP_END_REASON_SUCCESS        = 1,

     NDMP_SNAP_END_REASON_EXCEPTIONS     = 2,

     NDMP_SNAP_END_REASON_FAILURE        = 3,

     NDMP_SNAP_END_REASON_INTERNAL_ERROR = 4

};

 

/* NDMP_SNAP_NOTIFY_CREATE_END */

struct ndmp_snap_notify_create_end_post

{

     ndmp_snap_end_reason    reason;

     ndmp_snap_error         error;

     opaque                  snapid[64];

};

 

/* NDMP_SNAP_NOTIFY_DELETE_END */

struct ndmp_snap_notify_delete_end_post

{

     ndmp_snap_end_reason    reason;

     ndmp_snap_error         error;

};

 

/* NDMP_SNAP_NOTIFY_RECOVER_END */

struct ndmp_snap_notify_recover_end_post

{

     ndmp_snap_end_reason    reason;

     ndmp_snap_error         error;

 

 

Attachment: snapshot_managementv4.trc
Description: snapshot_managementv4.trc