Annotation of libaitsync/inc/aitsync.h, revision 1.1.1.1.2.2
1.1 misho 1: /*************************************************************************
2: * (C) 2010 AITNET ltd - Sofia/Bulgaria - <misho@aitbg.com>
3: * by Michael Pounov <misho@openbsd-bg.org>
4: *
5: * $Author: misho $
1.1.1.1.2.2! misho 6: * $Id: aitsync.h,v 1.1.1.1.2.1 2010/03/24 16:31:27 misho Exp $
1.1 misho 7: *
8: *************************************************************************/
9: #ifndef __AITSYNC_H
10: #define __AITSYNC_H
11:
12:
13: #include <sys/types.h>
14: #include <openssl/md5.h>
15:
16:
17: #define CHUNK_MAX 2048
18: #define DLTSYNC_MAGIC 0xD34DC0D3
19: #define SIGSYNC_MAGIC 0xDEADBEEF
20:
1.1.1.1.2.2! misho 21: #ifndef STRSIZ
! 22: #define STRSIZ 256
! 23: #endif
! 24:
1.1 misho 25:
26: typedef struct tagSyncChunk {
27: u_int sc_magic;
28: u_long sc_id;
29: off_t sc_off;
30: size_t sc_len;
31: u_int sc_roll;
32: u_char sc_cksum[MD5_DIGEST_LENGTH];
33: } sync_chunk_t;
34:
35:
1.1.1.1.2.2! misho 36: struct tagDirName {
! 37: u_char ch;
! 38: u_short tag;
! 39: u_int hash;
! 40: char name[MAXPATHLEN];
! 41: char extra[STRSIZ];
! 42: };
! 43:
! 44:
1.1 misho 45: // -------------------------------------------------------
46: // sync_GetErrno() Get error code of last operation
47: inline int sync_GetErrno();
48: // sync_GetError() Get error text of last operation
49: inline const char *sync_GetError();
50: // -------------------------------------------------------
51:
52: /*
53: * syncSignature() Calculate and create signature for diff
54: * @csInput = Input patched file name for calculating check sums
55: * @csSig = Output Signature file name
1.1.1.1.2.1 misho 56: * @compress = 2 compress signatures output, 0 not compressed
1.1 misho 57: * return: -1 error, 0 ok
58: */
1.1.1.1.2.1 misho 59: int syncSignature(const char *csInput, const char *csSig, int compress);
1.1 misho 60:
61: /*
62: * syncDelta() Create Delta patch file
63: * @csInput = Input original source file name for make delta patch file
64: * @csSig = Input Signature file name
65: * @csDelta = Output Delta patch file name
1.1.1.1.2.1 misho 66: * @compress = 3 everything compress, 2 compressed signatures, 1 compress delta output, 0 not compressed
1.1 misho 67: * return: -1 error, 0 ok, create delta patch, 1 ok, no differences and not create patch
68: */
69: int syncDelta(const char *csInput, const char *csSig, const char *csDelta, int compress);
70:
71: /*
72: * syncPatch() Apply delta patch file to target
73: * @csInput = Input target file name for patch
74: * @csDelta = Input Delta patch file name
75: * @csPatch = After applied patch create new alternate target file, if != NULL
1.1.1.1.2.1 misho 76: * @compress = 1 compress delta input, 0 not compressed
1.1 misho 77: * return: -1 error, 0 ok, create delta patch, 1 ok, no differences and not create patch
78: */
79: int syncPatch(const char *csInput, const char *csDelta, const char *csPatch, int compress);
80:
81:
1.1.1.1.2.2! misho 82: /*
! 83: * sync_dircmp() Compare directories
! 84: * @csDir1 = Directory 1
! 85: * @csDir2 = Directory 2
! 86: * return: -1 error, 0 is equal or 1 different
! 87: */
! 88: int sync_dircmp(const char *csDir1, const char *csDir2);
! 89: /*
! 90: * sync_dirCSum() Calculate checksum of directory
! 91: * @csDir = Directory
! 92: * @md = Message digest allocated memory, must be free after use!
! 93: * return: -1 error or !=-1 ok
! 94: */
! 95: int sync_dirCSum(const char *csDir, u_char **md);
! 96: /*
! 97: * sync_dircmpList() Compare directories or directory and file list
! 98: * @csDir1 = Directory 1
! 99: * @csDir2 = Directory 2 or File list, if "-" get input from console
! 100: * @lm = Long mode options, 1 long output
! 101: * @list = Output diff list, after use must be free!
! 102: * return: -1 error, 0 is equal or >0 count of returned list items
! 103: */
! 104: int sync_dircmpList(const char *csDir1, const char *csDir2, int lm, struct tagDirName **list);
! 105:
! 106:
1.1 misho 107: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>