File: filemap.h

package info (click to toggle)
rsyncrypto 1.12-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 1,312 kB
  • ctags: 576
  • sloc: sh: 3,958; cpp: 3,253; makefile: 70
file content (49 lines) | stat: -rw-r--r-- 1,554 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef FILELIST_H
#define FILELIST_H

#ifndef FILE_H
#include "file.h"
#endif

class filemap;

typedef std::map<std::string, filemap> filemaptype;
typedef std::map<std::string, std::string> revfilemap;

class filemap {
    std::string plainname;
    std::string ciphername;

    char dirsep;

public:
    filemap() : dirsep('\0')
    {
    }
    static void fill_map( const char *list_filename, bool encrypt );
    static void write_map( const char *list_filename );

    // Helper functions for name conversions
    static std::string namecat_encrypt( const char *left, const char *right, mode_t mode );
    static std::string namecat_decrypt( const char *left, const char *right, mode_t mode );
    //static std::string create_combined_path( const char *left, const char *right );

    static void enc_file_delete( const char *source_dir, const char *dst_dir, const char *key_dir,
	    filemaptype::iterator &item, RSA *rsa_key );
private:
    static void nest_name( std::string &name );
};

extern filemaptype filelist;
extern revfilemap reversemap; // Cypher->plain mapping for encryption usage

// Helper functions for "dir" scan
typedef void (*encopfunc)( const char *source_dir, const char *dst_dir, const char *key_dir,
	filemaptype::iterator &item, RSA *rsa_key );
void virt_recurse_dir_enc( const char *encdir, const char *plaindir, const char *keydir,
	RSA *rsa_key, encopfunc op, const char *dir_sig_part );

// The file name by which the file list is stored inside the encrypted directory
static const char FILEMAPNAME[]="filemap";

#endif