#ifndef _BACKUPPCD_H
#define _BACKUPPCD_H 1
/*
 * Copyright (C) 2005  Roy Keene
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Author Information
 *      Roy Keene
 *      Planning Systems Inc
 *      Slidell, LA
 *      backuppcd-bugs@psislidell.com
 */

/*
 * These define the values that we send and recieve over the wire denoting
 * what type of file is beiNg referenced.
 *
 * Must fit inside a uint8_t
 */
typedef enum {
	BPC_FILE_DIR = 0,
	BPC_FILE_REG = 1,
	BPC_FILE_SYMLINK = 2,
	BPC_FILE_SOCKET = 3,
	BPC_FILE_FIFO = 4,
	BPC_FILE_BDEV = 5,
	BPC_FILE_CDEV = 6,
	BPC_FILE_HRDLINK = 7,
	BPC_FILE_UNKNOWN = 255
} backuppc_filetype_t;

/*
 * These define the values for each command sent and recieved over the wire.
 * Reply messages have their high-bit set.
 *
 * Must fit inside a uint8_t
 */
typedef enum {
	BPC_CMD_NONE = 0,
	BPC_CMD_AUTH = 1,
	BPC_CMD_SSL = 2,
	BPC_CMD_KEY = 3,
	BPC_CMD_LIST = 4,
	BPC_CMD_GET = 5,
	BPC_CMD_PUT = 6,
	BPC_CMD_RDGET = 7,
	BPC_CMD_AUTH_REPLY = (BPC_CMD_AUTH | 0x80),
	BPC_CMD_SSL_REPLY = (BPC_CMD_SSL | 0x80),
	BPC_CMD_KEY_REPLY = (BPC_CMD_KEY | 0x80),
	BPC_CMD_LIST_REPLY = (BPC_CMD_LIST | 0x80),
	BPC_CMD_GET_REPLY = (BPC_CMD_GET | 0x80),
	BPC_CMD_PUT_REPLY = (BPC_CMD_PUT | 0x80),
	BPC_CMD_RDGET_REPLY = (BPC_CMD_RDGET | 0x80),
} backuppc_cmd_t;

/*
 * These define the values we send and recieve over the wire to describe each
 * attribute for a referenced file.
 *
 * Must fit inside a uint16_t
 */
typedef enum {
	BPC_ATTRID_NOP = 0,
	BPC_ATTRID_MTIME = 1,
	BPC_ATTRID_CTIME = 2,
	BPC_ATTRID_USER = 3,
	BPC_ATTRID_GROUP = 4,
	BPC_ATTRID_UID = 5,
	BPC_ATTRID_GID = 6,
	BPC_ATTRID_MD5 = 7,
	BPC_ATTRID_ACL = 8,
	BPC_ATTRID_PACL = 9,
	BPC_ATTRID_NTACL = 10,
	BPC_ATTRID_SYMLINKDEST = 11,
	BPC_ATTRID_HRDLINKDEST = 12,
	BPC_ATTRID_MD4 = 13,
	BPC_ATTRID_SHA1 = 14,
	BPC_ATTRID_BPCHASH = 15,
} backuppc_attrid_t;

/*
 * These define the values we send and recieve over the wire to describe the
 * hashing algorithm used for RDIFF
 *
 * Must fit inside a uint8_t
 */
typedef enum {
	BPC_HASH_NONE = 0,
	BPC_HASH_MD5 = 1,
	BPC_HASH_MD4 = 2,
	BPC_HASH_SHA1 = 3,
	BPC_HASH_BPC = 4,
} backuppc_hashid_t;

/*
 * These are used for short status messages.
 *
 * Must fit inside a uint8_t
 */
typedef enum {
	BPC_STATUS_OKAY = 0,
	BPC_STATUS_FAILED = 1,
	BPC_STATUS_UNKNOWN = 255
} backuppc_status_t;

/*
 * These values are used to in the ACL entry for a LIST or GET reply.
 * They are the values for an ACL entry.  Extended ACLs will be either
 * PACL (POSIX ACL) or NTACL (Microsoft NT ACL).
 *
 * Must fit inside a uint16_t
 */
#define BPC_ACL_XOTH 00001
#define BPC_ACL_WOTH 00002
#define BPC_ACL_ROTH 00004
#define BPC_ACL_XGRP 00010
#define BPC_ACL_WGRP 00020
#define BPC_ACL_RGRP 00040
#define BPC_ACL_XUSR 00100
#define BPC_ACL_WUSR 00200
#define BPC_ACL_RUSR 00400
#define BPC_ACL_STCK 01000
#define BPC_ACL_SGID 02000
#define BPC_ACL_SUID 04000

/*
 * These values are used for the OPTIONS field in a LIST or GET request.
 * They may be combined.
 *
 * Must fit inside a uint8_t when ORd together.
 */
#define BPC_OPT_RECURSIVE 0x01
#define BPC_OPT_MD5       0x02
#define BPC_OPT_MD4       0x04
#define BPC_OPT_SHA1      0x08
#define BPC_OPT_BPCHASH   0x10

/*
 * Maximum pathname length to support.
 */
#define BPC_MAXPATH_LEN	4096

#endif
