~ubuntu-branches/debian/wheezy/linuxdcpp/wheezy

« back to all changes in this revision

Viewing changes to client/CryptoManager.h

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2006-10-24 16:46:05 UTC
  • mfrom: (1.1.5 upstream) (4.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20061024164605-ydvywkpog32r1wiw
Tags: 0.0.1.cvs20061024-1
* New upstream release
* Patched SContruct to remove unneeded ld flags, according to
checklib

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* 
2
 
 * Copyright (C) 2001-2005 Jacek Sieka, arnetheduck on gmail point com
 
1
/*
 
2
 * Copyright (C) 2001-2006 Jacek Sieka, arnetheduck on gmail point com
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by
16
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 */
18
18
 
19
 
#if !defined(AFX_CRYPTO_H__28F66860_0AD5_44AD_989C_BA4326C42F46__INCLUDED_)
20
 
#define AFX_CRYPTO_H__28F66860_0AD5_44AD_989C_BA4326C42F46__INCLUDED_
 
19
#if !defined(CRYPTO_MANAGER_H)
 
20
#define CRYPTO_MANAGER_H
21
21
 
22
22
#if _MSC_VER > 1000
23
23
#pragma once
46
46
        Node* left;
47
47
        Node* right;
48
48
        
49
 
        Node(int aChr, int aWeight) : chr(aChr), weight(aWeight), left(NULL), right(NULL) { };
50
 
        Node(Node* aLeft, Node* aRight) :  chr(-1), weight(aLeft->weight + aRight->weight), left(aLeft), right(aRight) { };
 
49
        Node(int aChr, int aWeight) : chr(aChr), weight(aWeight), left(NULL), right(NULL) { }
 
50
        Node(Node* aLeft, Node* aRight) :  chr(-1), weight(aLeft->weight + aRight->weight), left(aLeft), right(aRight) { }
51
51
        ~Node() {
52
52
                delete left;
53
53
                delete right;
73
73
{
74
74
public:
75
75
        string makeKey(const string& aLock);
76
 
        const string& getLock() { return lock; };
77
 
        const string& getPk() { return pk; };
78
 
        bool isExtended(const string& aLock) { return strncmp(aLock.c_str(), "EXTENDEDPROTOCOL", 16) == 0; };
 
76
        const string& getLock() { return lock; }
 
77
        const string& getPk() { return pk; }
 
78
        bool isExtended(const string& aLock) { return strncmp(aLock.c_str(), "EXTENDEDPROTOCOL", 16) == 0; }
79
79
 
80
80
        void decodeHuffman(const u_int8_t* /*is*/, string& /*os*/, const size_t /*len*/) throw(CryptoException);
81
 
        void encodeHuffman(const string& is, string& os);
82
81
        void decodeBZ2(const u_int8_t* is, size_t sz, string& os) throw(CryptoException);
83
82
private:
84
83
 
85
84
        friend class Singleton<CryptoManager>;
86
85
        
87
 
        CryptoManager() : lock("EXTENDEDPROTOCOLABCABCABCABCABCABC"), pk("DCPLUSPLUS" VERSIONSTRING "ABCABC") { };
88
 
        virtual ~CryptoManager() { };
 
86
        CryptoManager() : lock("EXTENDEDPROTOCOLABCABCABCABCABCABC"), pk("DCPLUSPLUS" VERSIONSTRING "ABCABC") { }
 
87
        virtual ~CryptoManager() { }
89
88
 
90
89
        class Leaf : public FastAlloc<Leaf> {
91
90
        public:
92
91
                int chr;
93
92
                int len;
94
 
                Leaf(int aChr, int aLen) : chr(aChr), len(aLen) { };
95
 
                Leaf() : chr(-1), len(-1) { };
 
93
                Leaf(int aChr, int aLen) : chr(aChr), len(aLen) { }
 
94
                Leaf() : chr(-1), len(-1) { }
96
95
        };
97
96
        
98
97
        class DecNode : public FastAlloc<DecNode> {
100
99
                int chr;
101
100
                DecNode* left;
102
101
                DecNode* right;
103
 
                DecNode(int aChr) : chr(aChr), left(NULL), right(NULL) { };
104
 
                DecNode(DecNode* aLeft, DecNode* aRight) : chr(-1), left(aLeft), right(aRight) { };
105
 
                DecNode() : chr(-1), left(NULL), right(NULL) { };
 
102
                DecNode(int aChr) : chr(aChr), left(NULL), right(NULL) { }
 
103
                DecNode(DecNode* aLeft, DecNode* aRight) : chr(-1), left(aLeft), right(aRight) { }
 
104
                DecNode() : chr(-1), left(NULL), right(NULL) { }
106
105
                ~DecNode() {
107
106
                        delete left;
108
107
                        delete right;
123
122
        }
124
123
};
125
124
 
126
 
#endif // !defined(AFX_CRYPTO_H__28F66860_0AD5_44AD_989C_BA4326C42F46__INCLUDED_)
127
 
 
128
 
/**
129
 
 * @file
130
 
 * $Id: CryptoManager.h,v 1.4 2005/06/25 19:24:01 paskharen Exp $
131
 
 */
 
125
#endif // !defined(CRYPTO_MANAGER_H)