summaryrefslogtreecommitdiffabout
path: root/src/eyetil.h
Unidiff
Diffstat (limited to 'src/eyetil.h') (more/less context) (ignore whitespace changes)
-rw-r--r--src/eyetil.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/eyetil.h b/src/eyetil.h
index 7517ba6..8784cb4 100644
--- a/src/eyetil.h
+++ b/src/eyetil.h
@@ -53,48 +53,59 @@ struct md5_digester {
53 } 53 }
54 }; 54 };
55 55
56 template<typename T> 56 template<typename T>
57 update_iterator<T> updater() { 57 update_iterator<T> updater() {
58 return update_iterator<T>(this); 58 return update_iterator<T>(this);
59 } 59 }
60 60
61}; 61};
62template<> inline void md5_digester::update<binary_t>(const binary_t& x) { 62template<> inline void md5_digester::update<binary_t>(const binary_t& x) {
63 update((const unsigned char*)&(x.front()),x.size()); 63 update((const unsigned char*)&(x.front()),x.size());
64} 64}
65 65
66#pragma pack(1) 66#pragma pack(1)
67struct block512_t { 67struct block512_t {
68 enum { words = 512 / sizeof(uint16_t) }; 68 enum { words = 512 / sizeof(uint16_t) };
69 uint16_t data[words]; 69 uint16_t data[words];
70 70
71 inline uint8_t *dptr(size_t o) { return ((uint8_t*)this)+o; } 71 inline uint8_t *dptr(size_t o) { return ((uint8_t*)this)+o; }
72 72
73 static uint16_t tcpcksum(block512_t& data); 73 static uint16_t tcpcksum(block512_t& data);
74}; 74};
75#pragma pack() 75#pragma pack()
76 76
77struct integrity_digester {
78 md5_digester md5;
79 size_t data_size;
80 block512_t data;
81
82 integrity_digester() : data_size(0) { }
83 void update(const void *d,size_t s);
84 binary_t final(const std::string& ukey);
85};
86
87
77class tmpdir_t { 88class tmpdir_t {
78 public: 89 public:
79 std::string dir; 90 std::string dir;
80 91
81 tmpdir_t(const std::string& dt); 92 tmpdir_t(const std::string& dt);
82 ~tmpdir_t(); 93 ~tmpdir_t();
83 94
84 std::string get_file(const std::string& f); 95 std::string get_file(const std::string& f);
85}; 96};
86 97
87class tarchive_t { 98class tarchive_t {
88 public: 99 public:
89 struct archive *a; 100 struct archive *a;
90 struct archive_entry *e; 101 struct archive_entry *e;
91 102
92 tarchive_t(void *p,size_t s); 103 tarchive_t(void *p,size_t s);
93 ~tarchive_t(); 104 ~tarchive_t();
94 105
95 bool read_next_header(); 106 bool read_next_header();
96 107
97 std::string entry_pathname(); 108 std::string entry_pathname();
98 109
99 bool read_data_into_fd(int fd); 110 bool read_data_into_fd(int fd);
100}; 111};