author | Michael Krelin <hacker@klever.net> | 2013-02-13 22:43:26 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2013-02-13 22:43:26 (UTC) |
commit | 2a5950df692f8a2c9d51a2a3e0c4d41fe0d3e7c9 (patch) (unidiff) | |
tree | 9c8a49a1bd96177abdc9cd13435b66a3aea783e2 /src/eyetil.h | |
parent | d6545bd95153a5e41cdae441643f4e4a0af94a49 (diff) | |
download | iii-2a5950df692f8a2c9d51a2a3e0c4d41fe0d3e7c9.zip iii-2a5950df692f8a2c9d51a2a3e0c4d41fe0d3e7c9.tar.gz iii-2a5950df692f8a2c9d51a2a3e0c4d41fe0d3e7c9.tar.bz2 |
stream mime attachments directly to disk
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | src/eyetil.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/eyetil.h b/src/eyetil.h index 64948d0..8af18a4 100644 --- a/src/eyetil.h +++ b/src/eyetil.h | |||
@@ -73,65 +73,65 @@ struct block512_t { | |||
73 | inline uint8_t *dptr(size_t o) { return ((uint8_t*)this)+o; } | 73 | inline uint8_t *dptr(size_t o) { return ((uint8_t*)this)+o; } |
74 | 74 | ||
75 | static uint16_t tcpcksum(block512_t& data); | 75 | static uint16_t tcpcksum(block512_t& data); |
76 | }; | 76 | }; |
77 | #pragma pack() | 77 | #pragma pack() |
78 | 78 | ||
79 | struct integrity_digester { | 79 | struct integrity_digester { |
80 | md5_digester md5; | 80 | md5_digester md5; |
81 | size_t data_size; | 81 | size_t data_size; |
82 | block512_t data; | 82 | block512_t data; |
83 | 83 | ||
84 | integrity_digester() : data_size(0) { } | 84 | integrity_digester() : data_size(0) { } |
85 | void update(const void *d,size_t s); | 85 | void update(const void *d,size_t s); |
86 | binary_t final(const std::string& ukey); | 86 | binary_t final(const std::string& ukey); |
87 | }; | 87 | }; |
88 | 88 | ||
89 | 89 | ||
90 | class tmpdir_t { | 90 | class tmpdir_t { |
91 | public: | 91 | public: |
92 | std::string dir; | 92 | std::string dir; |
93 | 93 | ||
94 | tmpdir_t(const std::string& dt); | 94 | tmpdir_t(const std::string& dt); |
95 | ~tmpdir_t(); | 95 | ~tmpdir_t(); |
96 | 96 | ||
97 | std::string get_file(const std::string& f); | 97 | std::string get_file(const std::string& f); |
98 | }; | 98 | }; |
99 | 99 | ||
100 | class tarchive_t { | 100 | class tarchive_t { |
101 | public: | 101 | public: |
102 | struct archive *a; | 102 | struct archive *a; |
103 | struct archive_entry *e; | 103 | struct archive_entry *e; |
104 | 104 | ||
105 | tarchive_t(void *p,size_t s); | 105 | tarchive_t(const char *); |
106 | ~tarchive_t(); | 106 | ~tarchive_t(); |
107 | 107 | ||
108 | bool read_next_header(); | 108 | bool read_next_header(); |
109 | 109 | ||
110 | std::string entry_pathname(); | 110 | std::string entry_pathname(); |
111 | 111 | ||
112 | bool read_data_into_fd(int fd); | 112 | bool read_data_into_fd(int fd); |
113 | }; | 113 | }; |
114 | 114 | ||
115 | struct mimewrite_base { | 115 | struct mimewrite_base { |
116 | virtual ~mimewrite_base() { } | 116 | virtual ~mimewrite_base() { } |
117 | 117 | ||
118 | virtual int write(const char *buf,size_t len) = 0; | 118 | virtual int write(const char *buf,size_t len) = 0; |
119 | virtual void close() = 0; | 119 | virtual void close() = 0; |
120 | }; | 120 | }; |
121 | struct mimewrite_string : public mimewrite_base { | 121 | struct mimewrite_string : public mimewrite_base { |
122 | std::string str; | 122 | std::string str; |
123 | int write(const char *buf,size_t len) { str.append(buf,len); return SOAP_OK; }; | 123 | int write(const char *buf,size_t len) { str.append(buf,len); return SOAP_OK; }; |
124 | void close() { } | 124 | void close() { } |
125 | }; | 125 | }; |
126 | struct mimewrite_tarfile : public mimewrite_base { | 126 | struct mimewrite_tarfile : public mimewrite_base { |
127 | std::string fn; | 127 | std::string fn; |
128 | std::fstream f; | 128 | std::fstream f; |
129 | integrity_digester idigest; | 129 | integrity_digester idigest; |
130 | mimewrite_tarfile(tmpdir_t& d); | 130 | mimewrite_tarfile(tmpdir_t& d); |
131 | ~mimewrite_tarfile(); | 131 | ~mimewrite_tarfile(); |
132 | int write(const char *buf,size_t len); | 132 | int write(const char *buf,size_t len); |
133 | void close() { } | 133 | void close() { } |
134 | }; | 134 | }; |
135 | binary_t integrity_digest(const void *ptr,size_t size, | 135 | binary_t integrity_digest(const void *ptr,size_t size, |
136 | const std::string& ukey); | 136 | const std::string& ukey); |
137 | 137 | ||