In file /home/eternity/Source/Common/CertificateRepository/H/certificateRepository.h:

class CertificateRepository : public Debugable

Repository for various certificates

Inheritance:

CertificateRepository < Debugable


Public Methods

CertificateRepository::CertificateRepository (ConfigFile * cmConfigFile, LogFile *cmLogFile)
Certificate repository constructor
CertificateRepository::CertificateRepository (ConfigFile * cmConfigFile, LogFile *cmLogFile, set > allowedTypes)
Certificate repository constructor
Err CertificateRepository::ClearDirectory (string dir)
Clears certificates from directory
void CertificateRepository::DeleteCertificates ()
Delete certificates from memmory
GMessage* CertificateRepository::GetCertificate (string type)
Returns random certificate
GMessage* CertificateRepository::GetCertificates (Size count, string type)
Returns a bunch of certificates
bool CertificateRepository::IsAllowedType (string type)
Is the type allowed to be stored in repository
Err CertificateRepository::LoadCertificates ()
Load certificates from disk
void CertificateRepository::PutCertificates (GMessage *data)
Inserts certificate into certificate repository
Err CertificateRepository::SaveCertificates ()
Save certificates to disk
CertificateRepository::~CertificateRepository ()
Certificate repository destructor

Public

methods
CertificateRepository (ConfigFile * cmConfigFile, LogFile *cmLogFile)
constructor
CertificateRepository (ConfigFile * cmConfigFile, LogFile *cmLogFile, set > allowedTypes)
constructor
GMessage* GetCertificates (Size count, string type)
Return certificates of specified type
GMessage* GetCertificate (string type)
Return certificate of specified type
void PutCertificates (GMessage *certifcates)
Insert certificates into repository
bool IsAllowedType (string type)
Is allowed to store in repository
Err LoadCertificates ()
Load certificates from disk
Err SaveCertificates ()
Save certificates to disk
void DeleteCertificates ()
Free certificates from memory
Err ClearDirectory (string dir)
Delete certificates in certificates directory

Protected

attributes
Certificates certificates
Stored certificates
set > allowedTypes
list of allowed types
bool allowAllTypes
Do we allow everything
ConfigFile* configFile
Configuration file

Inherited from Debugable:

Public Methods

string* Debugable::CreateString(char *firstStr, int firstInt, int secondInt)
Debugable::Debugable(LogFile * debugLogFile)
int Debugable::SetDebugOptions(int newLogOptions)
void Debugable::SetLogFile(LogFile *aLogFile)
void Debugable::WriteString(LogLevel debugLevel, char * format, ...)
Debugable::~Debugable()

Documentation

Repository for various certificates. Stores certificates in memory and is able to seve them to disk and again load them. It is also able to return certificates of desired type.
attributes

Certificates certificates
Stored certificates

set > allowedTypes
list of allowed types

bool allowAllTypes
Do we allow everything

ConfigFile* configFile
Configuration file

methods

CertificateRepository(ConfigFile * cmConfigFile, LogFile *cmLogFile)
constructor

CertificateRepository(ConfigFile * cmConfigFile, LogFile *cmLogFile, set > allowedTypes)
constructor

GMessage* GetCertificates(Size count, string type)
Return certificates of specified type

GMessage* GetCertificate(string type)
Return certificate of specified type

void PutCertificates(GMessage *certifcates)
Insert certificates into repository

bool IsAllowedType(string type)
Is allowed to store in repository

Err LoadCertificates()
Load certificates from disk

Err SaveCertificates()
Save certificates to disk

void DeleteCertificates()
Free certificates from memory

Err ClearDirectory(string dir)
Delete certificates in certificates directory

CertificateRepository::CertificateRepository(ConfigFile * cmConfigFile, LogFile *cmLogFile)
Certificate repository constructor. Certificate repository stores different types of certificates and is able to return certificates of specified type. Certificates are stored internally in a STL container called map that is implemented like lookup tree so the lookups of certificates efficient.
Parameters:
cmConfigFile - Configuration file.
cmLogFile - Log file for debug messages.
Author:
Venca
See Also:
AddressManager, GetCertificate()

CertificateRepository::CertificateRepository(ConfigFile * cmConfigFile, LogFile *cmLogFile, set > allowedTypes)
Certificate repository constructor. Certificate repository stores different types of certificates and is able to return certificates of specified type. Certificates are stored internally in a STL container called map that is implemented like lookup tree so the lookups of certificates efficient.
This version of constructor takes an additional parameter that specifies what certificates can be stored in this instance of certificate repository.
Parameters:
cmConfigFile - Configuration file.
cmLogFile - Log file for debug messages.
allowedTypes - list (STL list) of types that can be stored in repository.
Author:
Venca
See Also:
AddressManager, GetCertificate()

Err CertificateRepository::ClearDirectory(string dir)
Clears certificates from directory. deletes all the certificates stored in this directory (cert0 ... certn) Useful before writting new certificates.
Returns:
OK if successful KO otherwise
Parameters:
dir - Directory to clear
Author:
Venca
See Also:
SaveCertificates()

void CertificateRepository::DeleteCertificates()
Delete certificates from memmory. Goes through all the certificates stored in repository and deletes them.
Returns:
void
Author:
Venca
See Also:
LoadCertificates(), ~CertificateRepository()

GMessage* CertificateRepository::GetCertificate(string type)
Returns random certificate. Return random certificate of type "type".
Returns:
Pointer to a new GMessage containing sertificate of type 'type'
Parameters:
type - Type of certificate to return
Author:
Venca
See Also:
PutCertificate(), AddressManager

GMessage* CertificateRepository::GetCertificates(Size count, string type)
Returns a bunch of certificates. Get count of random certificates with type "type". Internally implemented as count of calls to GetCertificate()
Parameters:
count - Number of certificates to return.
type - Type of certificates we want.
Author:
Venca
See Also:
GetCertificate(), PutCertificates()

bool CertificateRepository::IsAllowedType(string type)
Is the type allowed to be stored in repository. Checks if the type is between those allowed types that were specified in constructor - default is allow all.
Returns:
true if allowed false otherwise.
Parameters:
type - Certificate type to check.
Author:
Venca
See Also:
PutCertificate(), PutCertificates()

Err CertificateRepository::LoadCertificates()
Load certificates from disk. From directory specified in config file reads number of certificates and then inserts all the certififcates into its search tree.
Returns:
OK if siccessful KO otherwise.
Author:
Venca
See Also:
SaveCertificates()

void CertificateRepository::PutCertificates(GMessage *data)
Inserts certificate into certificate repository. Checks the type against its list of allowed types and if it is there then the certificate is stored.
Parameters:
data - Type of certificate to return
Author:
Venca
See Also:
GetCertificate(), AddressManager

Err CertificateRepository::SaveCertificates()
Save certificates to disk. Clears the directory specified in configuration file and then writes all the certificates in repository to separate files. It also writes a certificate Count in a special file.
Returns:
OK if successful KO otherwise.
Author:
Venca
See Also:
LoadCertificates()

CertificateRepository::~CertificateRepository()
Certificate repository destructor. Frees all stored certificates from memmory.
Author:
Venca
See Also:
PutCertificate(), CertificateRepository()


This class has no child classes.
Author:
Venca
See Also:
AddressManager MessageCreator

alphabetic index hierarchy of classes


generated by doc++