xref: /dflybsd-src/bin/cpdup/hcproto.h (revision 5ca0a96d6c3bf50926197b4bb92af7969ed3528a)
14d858d58SMatthew Dillon /*
24d858d58SMatthew Dillon  * HCPROTO.H
34d858d58SMatthew Dillon  */
44d858d58SMatthew Dillon 
54d858d58SMatthew Dillon #ifndef _HCPROTO_H_
64d858d58SMatthew Dillon #define _HCPROTO_H_
74d858d58SMatthew Dillon 
82b7dbe20SMatthew Dillon #define HCPROTO_VERSION		6
9e7624993SMatthew Dillon #define HCPROTO_VERSION_COMPAT	2
102b7dbe20SMatthew Dillon #define HCPROTO_VERSION_LUCC	6	/* lutimes, lchflags, lchmod */
11e7624993SMatthew Dillon 
124d858d58SMatthew Dillon #define HC_HELLO	0x0001
134d858d58SMatthew Dillon 
144d858d58SMatthew Dillon #define HC_STAT		0x0010
154d858d58SMatthew Dillon #define HC_LSTAT	0x0011
164d858d58SMatthew Dillon #define HC_OPENDIR	0x0012
174d858d58SMatthew Dillon #define HC_READDIR	0x0013
184d858d58SMatthew Dillon #define HC_CLOSEDIR	0x0014
194d858d58SMatthew Dillon #define HC_OPEN		0x0015
204d858d58SMatthew Dillon #define HC_CLOSE	0x0016
214d858d58SMatthew Dillon #define HC_READ		0x0017
224d858d58SMatthew Dillon #define HC_WRITE	0x0018
234d858d58SMatthew Dillon #define HC_REMOVE	0x0019
244d858d58SMatthew Dillon #define HC_MKDIR	0x001A
254d858d58SMatthew Dillon #define HC_RMDIR	0x001B
264d858d58SMatthew Dillon #define HC_CHOWN	0x001C
274d858d58SMatthew Dillon #define HC_LCHOWN	0x001D
284d858d58SMatthew Dillon #define HC_CHMOD	0x001E
294d858d58SMatthew Dillon #define HC_LINK		0x001F
304d858d58SMatthew Dillon #define HC_CHFLAGS	0x0020
314d858d58SMatthew Dillon #define HC_READLINK	0x0021
324d858d58SMatthew Dillon #define HC_UMASK	0x0022
334d858d58SMatthew Dillon #define HC_SYMLINK	0x0023
344d858d58SMatthew Dillon #define HC_RENAME	0x0024
354d858d58SMatthew Dillon #define HC_UTIMES	0x0025
36975200d7SMatthew Dillon #define HC_MKNOD	0x0026
37293141b7SMatthew Dillon #define HC_GETEUID	0x0027
38293141b7SMatthew Dillon #define HC_GETGROUPS	0x0028
39c0538630SMatthew Dillon #define HC_SCANDIR	0x0029
40c0538630SMatthew Dillon #define HC_READFILE	0x002A
412b7dbe20SMatthew Dillon #define HC_LUTIMES	0x002B
422b7dbe20SMatthew Dillon #define HC_LCHFLAGS	0x002C
432b7dbe20SMatthew Dillon #define HC_LCHMOD	0x002D
444d858d58SMatthew Dillon 
454d858d58SMatthew Dillon #define LC_HELLOSTR	(0x0001|LCF_STRING)
464d858d58SMatthew Dillon #define LC_PATH1	(0x0010|LCF_STRING)
474d858d58SMatthew Dillon #define LC_PATH2	(0x0011|LCF_STRING)
484d858d58SMatthew Dillon #define LC_OFLAGS	(0x0012|LCF_INT32)
494d858d58SMatthew Dillon #define LC_MODE		(0x0013|LCF_INT32)
504d858d58SMatthew Dillon #define LC_BYTES	(0x0014|LCF_INT32)
514d858d58SMatthew Dillon #define LC_OWNER	(0x0015|LCF_INT32)
524d858d58SMatthew Dillon #define LC_GROUP	(0x0016|LCF_INT32)
534d858d58SMatthew Dillon #define LC_DEV		(0x0017|LCF_INT32)
544d858d58SMatthew Dillon #define LC_INO		(0x0018|LCF_INT64)
554d858d58SMatthew Dillon #define LC_NLINK	(0x0019|LCF_INT32)
564d858d58SMatthew Dillon #define LC_UID		(0x001A|LCF_INT32)
574d858d58SMatthew Dillon #define LC_GID		(0x001B|LCF_INT32)
584d858d58SMatthew Dillon #define LC_RDEV		(0x001C|LCF_INT32)
594d858d58SMatthew Dillon #define LC_ATIME	(0x001D|LCF_INT64)
604d858d58SMatthew Dillon #define LC_MTIME	(0x001E|LCF_INT64)
614d858d58SMatthew Dillon #define LC_CTIME	(0x001F|LCF_INT64)
624d858d58SMatthew Dillon #define LC_FILESIZE	(0x0020|LCF_INT64)
634d858d58SMatthew Dillon #define LC_FILEBLKS	(0x0021|LCF_INT64)
644d858d58SMatthew Dillon #define LC_FILEFLAGS	(0x0022|LCF_INT64)
65*5ca0a96dSSascha Wildner #define LC_UNUSED23	(0x0023|LCF_INT64)
664d858d58SMatthew Dillon #define LC_DESCRIPTOR	(0x0024|LCF_INT32)
674d858d58SMatthew Dillon #define LC_DATA		(0x0025|LCF_BINARY)
684d858d58SMatthew Dillon #define LC_TYPE		(0x0026|LCF_INT32)
694d858d58SMatthew Dillon #define LC_BLKSIZE	(0x0027|LCF_INT32)
70a2dc574cSMatthew Dillon #define LC_VERSION	(0x0028|LCF_INT32)
71293141b7SMatthew Dillon #define LC_COUNT	(0x0029|LCF_INT32)
720212bfceSMatthew Dillon #define LC_ATIMENSEC	(0x002A|LCF_INT32)
730212bfceSMatthew Dillon #define LC_MTIMENSEC	(0x002B|LCF_INT32)
740212bfceSMatthew Dillon #define LC_CTIMENSEC	(0x002C|LCF_INT32)
754d858d58SMatthew Dillon 
764d858d58SMatthew Dillon #define XO_NATIVEMASK	3		/* passed through directly */
774d858d58SMatthew Dillon #define XO_CREAT	0x00010000
784d858d58SMatthew Dillon #define XO_EXCL		0x00020000
794d858d58SMatthew Dillon #define XO_TRUNC	0x00040000
804d858d58SMatthew Dillon 
814d858d58SMatthew Dillon #define HC_DESC_DIR	1
824d858d58SMatthew Dillon #define HC_DESC_FD	2
834d858d58SMatthew Dillon 
84c0538630SMatthew Dillon #ifndef MAXNAMLEN
85c0538630SMatthew Dillon #define MAXNAMLEN	255
86c0538630SMatthew Dillon #endif
87c0538630SMatthew Dillon 
88c0538630SMatthew Dillon struct HCDirEntry {
89c0538630SMatthew Dillon 	char d_name[MAXNAMLEN + 1];
90c0538630SMatthew Dillon };
91c0538630SMatthew Dillon 
92c0538630SMatthew Dillon int hc_connect(struct HostConf *hc, int readonly);
934d858d58SMatthew Dillon void hc_slave(int fdin, int fdout);
944d858d58SMatthew Dillon 
954d858d58SMatthew Dillon int hc_hello(struct HostConf *hc);
964d858d58SMatthew Dillon int hc_stat(struct HostConf *hc, const char *path, struct stat *st);
974d858d58SMatthew Dillon int hc_lstat(struct HostConf *hc, const char *path, struct stat *st);
984d858d58SMatthew Dillon DIR *hc_opendir(struct HostConf *hc, const char *path);
99c0538630SMatthew Dillon struct HCDirEntry *hc_readdir(struct HostConf *hc, DIR *dir, struct stat **statpp);
1004d858d58SMatthew Dillon int hc_closedir(struct HostConf *hc, DIR *dir);
1014d858d58SMatthew Dillon int hc_open(struct HostConf *hc, const char *path, int flags, mode_t mode);
1024d858d58SMatthew Dillon int hc_close(struct HostConf *hc, int fd);
1034d858d58SMatthew Dillon ssize_t hc_read(struct HostConf *hc, int fd, void *buf, size_t bytes);
1044d858d58SMatthew Dillon ssize_t hc_write(struct HostConf *hc, int fd, const void *buf, size_t bytes);
1054d858d58SMatthew Dillon int hc_remove(struct HostConf *hc, const char *path);
1064d858d58SMatthew Dillon int hc_mkdir(struct HostConf *hc, const char *path, mode_t mode);
1074d858d58SMatthew Dillon int hc_rmdir(struct HostConf *hc, const char *path);
1084d858d58SMatthew Dillon int hc_chown(struct HostConf *hc, const char *path, uid_t owner, gid_t group);
1094d858d58SMatthew Dillon int hc_lchown(struct HostConf *hc, const char *path, uid_t owner, gid_t group);
1104d858d58SMatthew Dillon int hc_chmod(struct HostConf *hc, const char *path, mode_t mode);
1112b7dbe20SMatthew Dillon int hc_lchmod(struct HostConf *hc, const char *path, mode_t mode);
112975200d7SMatthew Dillon int hc_mknod(struct HostConf *hc, const char *path, mode_t mode, dev_t rdev);
1134d858d58SMatthew Dillon int hc_link(struct HostConf *hc, const char *name1, const char *name2);
1144d858d58SMatthew Dillon int hc_chflags(struct HostConf *hc, const char *path, u_long flags);
1152b7dbe20SMatthew Dillon int hc_lchflags(struct HostConf *hc, const char *path, u_long flags);
1164d858d58SMatthew Dillon int hc_readlink(struct HostConf *hc, const char *path, char *buf, int bufsiz);
1174d858d58SMatthew Dillon mode_t hc_umask(struct HostConf *hc, mode_t numask);
1184d858d58SMatthew Dillon int hc_symlink(struct HostConf *hc, const char *name1, const char *name2);
1194d858d58SMatthew Dillon int hc_rename(struct HostConf *hc, const char *name1, const char *name2);
1204d858d58SMatthew Dillon int hc_utimes(struct HostConf *hc, const char *path, const struct timeval *times);
1212b7dbe20SMatthew Dillon int hc_lutimes(struct HostConf *hc, const char *path, const struct timeval *times);
122293141b7SMatthew Dillon uid_t hc_geteuid(struct HostConf *hc);
123293141b7SMatthew Dillon int hc_getgroups(struct HostConf *hc, gid_t **gidlist);
1244d858d58SMatthew Dillon 
1254d858d58SMatthew Dillon #endif
1264d858d58SMatthew Dillon 
127