summaryrefslogtreecommitdiffabout
path: root/include/opkele/util.h
Unidiff
Diffstat (limited to 'include/opkele/util.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/util.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/include/opkele/util.h b/include/opkele/util.h
index fbbef93..5372498 100644
--- a/include/opkele/util.h
+++ b/include/opkele/util.h
@@ -3,58 +3,57 @@
3 3
4#include <time.h> 4#include <time.h>
5#include <string> 5#include <string>
6#include <openssl/bn.h> 6#include <openssl/bn.h>
7#include <openssl/dh.h> 7#include <openssl/dh.h>
8 8
9namespace opkele { 9namespace opkele {
10 using std::string; 10 using std::string;
11 11
12 namespace util { 12 namespace util {
13 13
14 class bignum_t { 14 class bignum_t {
15 public: 15 public:
16 BIGNUM *_bn; 16 BIGNUM *_bn;
17 17
18 bignum_t() : _bn(0) { } 18 bignum_t() : _bn(0) { }
19 bignum_t(BIGNUM *bn) : _bn(bn) { } 19 bignum_t(BIGNUM *bn) : _bn(bn) { }
20 ~bignum_t() throw() { if(_bn) BN_free(_bn); } 20 ~bignum_t() throw() { if(_bn) BN_free(_bn); }
21 21
22 bignum_t& operator=(BIGNUM *bn) { if(_bn) BN_free(_bn); _bn = bn; return *this; } 22 bignum_t& operator=(BIGNUM *bn) { if(_bn) BN_free(_bn); _bn = bn; return *this; }
23 23
24 operator const BIGNUM*(void) const { return _bn; } 24 operator const BIGNUM*(void) const { return _bn; }
25 operator BIGNUM*(void) { return _bn; } 25 operator BIGNUM*(void) { return _bn; }
26 }; 26 };
27 class dh_t { 27 class dh_t {
28 public: 28 public:
29 DH *_dh; 29 DH *_dh;
30 30
31 dh_t() : _dh(0) { } 31 dh_t() : _dh(0) { }
32 dh_t(DH *dh) : _dh(dh) { } 32 dh_t(DH *dh) : _dh(dh) { }
33 ~dh_t() throw() { if(_dh) DH_free(_dh); } 33 ~dh_t() throw() { if(_dh) DH_free(_dh); }
34 34
35 dh_t& operator=(DH *dh) { if(_dh) DH_free(_dh); _dh = dh; return *this; } 35 dh_t& operator=(DH *dh) { if(_dh) DH_free(_dh); _dh = dh; return *this; }
36 36
37 operator const DH*(void) const { return _dh; } 37 operator const DH*(void) const { return _dh; }
38 operator DH*(void) { return _dh; } 38 operator DH*(void) { return _dh; }
39 39
40 DH* operator->() { return _dh; } 40 DH* operator->() { return _dh; }
41 const DH* operator->() const { return _dh; } 41 const DH* operator->() const { return _dh; }
42 }; 42 };
43 43
44 BIGNUM *base64_to_bignum(const string& b64); 44 BIGNUM *base64_to_bignum(const string& b64);
45 BIGNUM *dec_to_bignum(const string& dec); 45 BIGNUM *dec_to_bignum(const string& dec);
46 string bignum_to_base64(const BIGNUM *bn); 46 string bignum_to_base64(const BIGNUM *bn);
47 47
48 string time_to_w3c(time_t t); 48 string time_to_w3c(time_t t);
49 time_t w3c_to_time(const string& w); 49 time_t w3c_to_time(const string& w);
50 50
51 string canonicalize_url(const string& url);
52 string url_encode(const string& str); 51 string url_encode(const string& str);
53 52
54 string long_to_string(long l); 53 string long_to_string(long l);
55 long string_to_long(const string& s); 54 long string_to_long(const string& s);
56 } 55 }
57 56
58} 57}
59 58
60#endif /* __OPKELE_UTIL_H */ 59#endif /* __OPKELE_UTIL_H */