/* vim: set noet ts=8 sts=8 sw=8 : */

/** 
 * Functions and structures used for Rock Ridge support.
 * 
 * See IEEE P1282, Rock Ridge Interchange Protocol, Draft Standard version
 * 1.12 for further details.
 */

#ifndef ISO_ROCKRIDGE_H
#define ISO_ROCKRIDGE_H

struct ecma119_write_target;
struct ecma119_tree_node;

/**
 * Add a SUSP "ER" System Use Entry to identify the Rock Ridge specification.
 * 
 * The "ER" System Use Entry is used to uniquely identify a specification
 * compliant with SUSP. This method adds to the given tree node "." entry
 * the "ER" corresponding to the RR protocol.
 * 
 * See IEEE P1281, section 5.5 and IEEE P1282, section 4.3 for more details.
 */
void rrip_add_ER(struct ecma119_write_target *, struct ecma119_tree_node *);

/**
 * Add a PX System Use Entry to the given tree node and, if that node is
 * a directory, to its "." and ".." entries. The PX System Use Entry is 
 * used to add POSIX file attributes, such as access permissions or user and
 * group id, to a ECMA 119 directory record.
 *  
 * See IEEE P1282, section 4.1.1 for more details.
 */
void rrip_add_PX(struct ecma119_write_target *, struct ecma119_tree_node *);

/**
 * Add a PN System Use Entry to the given tree node. 
 * The PN System Use Entry is used to store the device number, and it's
 * mandatory if the tree node corresponds to a character or block device.
 * 
 * See IEEE P1282, section 4.1.2 for more details.
 */
void rrip_add_PN(struct ecma119_write_target *, struct ecma119_tree_node *);

/**
 * Add a SL System Use Entry to the given tree node. This is used to store 
 * the content of a symbolic link, and is mandatory if the tree node
 * indicates a symbolic link.
 * 
 * See IEEE P1282, section 4.1.3 for more details.
 */
void rrip_add_SL(struct ecma119_write_target *, struct ecma119_tree_node *);

/**
 * Add a NM System Use Entry to the given tree node. The purpose of this
 * System Use Entry is to store the content of an Alternate Name to support 
 * POSIX-style or other names. 
 * 
 * See IEEE P1282, section 4.1.4 for more details.
 */
void rrip_add_NM(struct ecma119_write_target *, struct ecma119_tree_node *);

/*
 * The next 3 System Use Entries are used to handle Deep Directory 
 * Hierarchies, i.e., hierarchies where the number of directory levels
 * exceed the eight limit of ECMA-119.
 */

/**
 * Add to the given tree node a CL System Use Entry, that is used to record 
 * the new location of a directory which has been relocated.
 * 
 * See IEEE P1282, section 4.1.5.1 for more details.
 */
void rrip_add_CL(struct ecma119_write_target *, struct ecma119_tree_node *);

/**
 * Add a PL System Use Entry, used to record the location of the original 
 * parent directory of a directory which has been relocated.
 * 
 * This is special because it doesn't modify the susp fields of the directory
 * that gets passed to it; it modifies the susp fields of the ".." entry in
 * that directory.
 * 
 * See IEEE P1282, section 4.1.5.2 for more details.
 */
void rrip_add_PL(struct ecma119_write_target *, struct ecma119_tree_node *);

/**
 * Add a RE System Use Entry to the given tree node. The purpose of the 
 * this System Use Entry is to indicate to an RRIP-compliant receiving
 * system that the Directory Record in which an "RE" System Use Entry is 
 * recorded has been relocated from another position in the original 
 * Directory Hierarchy.
 * 
 * See IEEE P1282, section 4.1.5.3 for more details.
 */
void rrip_add_RE(struct ecma119_write_target *, struct ecma119_tree_node *);

/**
 * Add to the given tree node a TF System Use Entry, used to record some
 * time stamps related to the file.
 * 
 * See IEEE P1282, section 4.1.6 for more details.
 */
void rrip_add_TF(struct ecma119_write_target *, struct ecma119_tree_node *);


void rrip_finalize(struct ecma119_write_target *, struct ecma119_tree_node *);

#endif /* ISO_ROCKRIDGE_H */
