key_repository.h

Go to the documentation of this file.
00001 #ifndef KEY_REPOSITORY_CLASS
00002 #define KEY_REPOSITORY_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : key_repository                                                    *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2004-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #ifndef OMIT_CRYPTO_SUPPORT
00019 
00020 #include "dll_tentacles.h"
00021 
00022 #include <basis/mutex.h>
00023 #include <crypto/blowfish_crypto.h>
00024 #include <data_struct/symbol_table.h>
00025 #include <octopus/entity_defs.h>
00026 
00028 
00035 class TENTACLES_CLASS_STYLE octenc_key_record
00036 {
00037 public:
00038   octopus_entity _entity;  
00039   blowfish_crypto _key;  
00040 
00041   octenc_key_record() : _key(200) {}  
00042 
00043   octenc_key_record(const octopus_entity &entity, const blowfish_crypto &key) 
00044   : _entity(entity), _key(key) {}
00045 };
00046 
00048 
00049 class TENTACLES_CLASS_STYLE key_repository
00050 {
00051 public:
00052   key_repository() : _locker(), _keys() {}
00053   virtual ~key_repository();
00054 
00055   IMPLEMENT_CLASS_NAME("key_repository");
00056 
00057   octenc_key_record *lock(const octopus_entity &ent);
00059 
00061   void unlock(octenc_key_record *to_unlock);
00063 
00064   outcome add(const octopus_entity &ent, const blowfish_crypto &key);
00066 
00067   outcome whack(const octopus_entity &ent);
00069 
00070 private:
00071   mutex _locker;  
00072   symbol_table<octenc_key_record> _keys;  
00073 };
00074 
00075 #endif // crypto
00076 
00077 #endif // outer guard.
00078 

Generated on Fri Nov 28 04:29:32 2008 for HOOPLE Libraries by  doxygen 1.5.1