NSR_DATA(5)

NAME
nsr_data - Data formats for NetWorker Save and Recover

DESCRIPTION
All data in the NetWorker system is encoded using the eXternal Data Representation (XDR) standard. When files are passed between client (see save(8) and recover(8)) and server (see nsrd(8)) and media (see nsrmmd(8)), they are represented as a savestream, which is encoded as a linked list of savefiles. There are currently 2 different savefile formats. A magic number at the start of each file indicates the particular type of the following savefile thus allowing for self identifying savestreams containing more than one savefile type. Logically each savefile consists of some header information followed by file data. The original savefile1 format uses a doubly wrapped set of client attributes describing the file attributes and the file data is encoded as a bucketlist. The newer savefile2 format uses an alternate singularly wrapped client attributes with the file data encoded as a bucket-less succession of self describing sections each containing a type, a length, and bytes of data. The file data section of a file is terminated by an ending section with a type of 0 (NSR_ASDF_END).

The XDR language description of the OS independent portion of the savestream data structures is shown below.

const NSR_IDLEN = 1024;	/* length of file id */
const NSR_MAXNAMELEN = 1024;	/* max length of file system name */
const NSR_MAXCATTRSIZE = 8192;	/* max size of client specific attributes */
const NSR_MAXBUCKETDATA = 8192;	/* max size of file bucket's data (w/o slop) */
const NSR_MAXBUCKETSIZE = 9000;	/* max total size of file bucket (w/ slop) */
const NSR_MAXCLNTSIZE = 16384;	/* max size of a clntrec */
typedef opaque fileid<NSR_IDLEN>;	/* file identifier */
typedef string nsrname<NSR_MAXNAMELEN>;	/* file name type */
typedef opaque clientattr<NSR_MAXCATTRSIZE>;	/* client attributes */
typedef opaque wraposaverec<NSR_MAXCLNTSIZE>;	/* wrapped osaverec */
typedef nulong_t checksum;	/* 4 bytes for checksum */
typedef u_long sfid_t;	/* savefile id (offset) */
struct id {
	string id_str<>;	/* id string */
	id *id_next;	/* next such structure */
};
struct asmrec {
	id *ar_info;	/* name and args to ASM */
	nsrname *ar_path;	/* not currently used */
	asmrec *ar_next;	/* next such structure */
};
const NSR_MAGIC1 = 0x09265900;	/* older format using buckets & ssaverec's */
struct osaverec {
	nsrname sr_filename;	/* name of this file */
	fileid sr_fid;	/* client specific file id */
	asmrec *sr_ar;	/* ASM list for this file */
	u_long sr_catype;	/* client specific attribute type */
	clientattr sr_cattr;	/* client specific file attributes */
};
struct ssaverec {
	sfid_t sr_id;	/* savefile id in the savestream */
	u_long sr_size;	/* size of encoded savefile */
	nulong_t sr_savetime;	/* savetime of this saveset */
	wraposaverec sr_wcr;	/* a wrapped osaverec */
};
/*
 * File data for older style savestream is logically
 * expressed as a linked list of file buckets.
 */
struct bucketlist {
	bucket bl_bucket;
	bucketlist *bl_next;
};
/*
 * XDR description of the original savefile1 format.
 */
struct savefile1 {
	u_long sf_magic;	/* magic number (must be NSR_MAGIC1) */
	u_long sf_chksumtype;	/* file checksum type */
	ssaverec sf_saverec;	/* wrapped file attributes */
	bucketlist *sf_data;	/* file data in buckets */
	checksum sf_checksum;	/* checksum value */
};
/*
 * New savestream defines and structures.
 */
const NSR_MAGIC2 = 0x03175800;	/* newer bucketless format */
const NSRAPP_BACKUP = 1;	/* backup application name space */
const NSRAPP_HSM = 2;	/* HSM application name space */
const NSRAPP_ARCHIVE = 3;	/* Archive application name space */
struct saverec {
	sfid_t sr_id;	/* savefile id in the savestream */
	u_long sr_size;	/* size of encoded savefile */
	nulong_t sr_savetime;	/* savetime of this saveset */
	nulong_t sr_appid;	/* application id */
	nsrname sr_filename;	/* name of encoded file */
	fileid sr_fid;	/* client specific file id */
	asmrec *sr_ar;	/* ASM list for this file */
	u_long sr_catype;	/* client specific attribute type */
	clientattr sr_cattr;	/* client specific file attributes */
};
/*
 * Defines for self describing data sections.
 * The NSR_ASDF_END type defines the end of the file data.
 * The NSR_ASDF_FILE_DATA_TYPE type has the file data preceded by an
 * nulong_t that is the relative offset from the last block into the file.
 */
const NSR_ASDF_END = 0x0;	/* end of ASDF data */
const NSR_ASDF_FILE_DATA_TYPE = 0x100;	/* normal file data */
/*
 * Describes a section of NetWorker "file data" when
 * using ASM Structured Data Format (ASDF) sections.
 */
struct asdf_hdr {
	nulong_t typevers;	/* type of file data */
	nulong_t length;	/* section length */
};
/*
 * Pseudo XDR description of the newer savefile2 format.
 * The new savefile2 format uses the unwrapped saverec structure
 * and a "bucketless" file data format that is based on ASDF.
 * The data portion ends with a 0 sized section of type NSR_ASDF_END.
 */
struct savefile2 {
	u_long sf_magic;	/* magic number (must be SF_MAGIC2) */
	u_long sf_chksumtype;	/* file checksum type */
	saverec sf_saverec;	/* new saverec structure */
	<asdf_hdr & data>	/* ASDF section sans buckets */
	    ...
	<asdf_hdr & data>	/* ASDF section sans buckets */
	<asdf_hdr.typevers = 0>	/* final ASDF section type = NSR_ASDF_END */
	<asdf_hdr.length = 0>	/* final ASDF section len = 0 */
	checksum sf_checksum;	/* checksum value */
};

SEE ALSO
mm_data(5), nsr(8), nsrmmd(8), nsrd(8), recover(8), save(8), xdr(3n).
RFC 1014 XDR Protocol Spec.