In file /home/eternity/Source/Six/SixMajordomo/H/sixMajordomo.h:

class SixMajordomo : public Runable, public SixOffspring

Object processing various requests and commands

Inheritance:

SixMajordomo < Runable < Debugable

SixMajordomo < SixOffspring


Public Methods

Err SixMajordomo::AskForOnion ()
Asks for onion, if necessary
Err SixMajordomo::BeginTransaction (ID *newTID)
Starts the transaction
Err SixMajordomo::CommandDataReceived (MsgField *paramFld)
Handles the Data_received command
Err SixMajordomo::CommandOnionGenerated (MsgField *dataFld)
Serves "onion_generated" command from Mix
Err SixMajordomo::CommandTest (MsgField *dataFld)
Serves command Test from Mix
GMessage* SixMajordomo::CreateGenerateOnionMsg (Size hopCount = CFG_HOPS_IN_AC)
Creates "generate_onion" message for Mix
GMessage* SixMajordomo::CreateGetACsMsg (Char *type, Int count)
Creates "get_certificates" message for Mix
GMessage* SixMajordomo::CreateNextACTimeOutMsg (Char *type)
Cretates timeout message
GMessage* SixMajordomo::CreatePublishCertificateMsg (GMessage *ac)
Creates "publish_certificates" message for Mix
GMessage* SixMajordomo::CreateSendDataMsg (Char *commandSer, GMessage *dataSer, GMessage *ac, Size hops)
Creates "send_data" message for Mix
GMessage* SixMajordomo::CreateTestMsg (MsgField *dataFld)
Creates "test" message for Mix
Err SixMajordomo::DRCTest (const MsgField *dataFld)
Handles Test message from service
Err SixMajordomo::DecryptDataMsg (const GMessage *dataMsg, MsgField **decryptedBodyFld, ACID *acid)
Decrypts the field Body
Err SixMajordomo::EndTransaction (ID tid)
Finishes transaction
Err SixMajordomo::FeedSenderWithMsgForMix (GMessage *mixMsg)
Puts one message to the majordomoToSender queue
Err SixMajordomo::FeedSenderWithOutMsgQueue ()
Puts the messages from outMsgQueue to the majordomoToSender queue
Err SixMajordomo::FillReplyToInfo (GMessage *gMsg)
Sets replyToInfo of GMessage
Err SixMajordomo::FillTest (GMessage *gMsg, MsgField *msgFld)
Sets GMessage as Test
Err SixMajordomo::GenerateRequestForMissingACs (Char *acType)
Generates request for ACs of given type
GMessage* SixMajordomo::GetACByACID (Char *type, ACID acID)
Get AC of given type and ACID
Queue* SixMajordomo::GetACs (Char *type, const int count, Queue *notIn)
Returns ACs of given type
ID SixMajordomo::GetTID ()
Returns current TID
Err SixMajordomo::HandleDataReceivedBody (const MsgField *bodyFld, const ACID acid)
Handles the command receiver from Service
Err SixMajordomo::HandleGeneratedAC (GMessage *)
Handles generated AC
Void SixMajordomo::HandleMixMessage (GMessage *inMsg)
Handles the message from Mix
Err SixMajordomo::InsertAC (Char *type, GMessage *ac)
Saves ACs of given type
Err SixMajordomo::NextACTimeOut (Char *type, ESTime *t)
Returns next timeout of ACManager of given type
void* SixMajordomo::Run (void *)
Main running loop of SixMajordomo
SixMajordomo::SixMajordomo (Six * parent, LogFile * majordomoLogFile)
Constructor of SixMajordomo
Err SixMajordomo::SwitchDataReceivedCommand (const Char *command, const MsgField *dataFld, const ACID acid)
Incoming message handling
Err SixMajordomo::SwitchDataReceivedVersion (const Char *version, const GMessage *body, const ACID acid)
Switches a method according to the version
Err SixMajordomo::SwitchMixCommand (MsgField *commandFld, MsgField *dataFld)
Chooses handling method
Err SixMajordomo::TestACCount (Char *type, Int *missing)
Test count of ACs of given type
SixMajordomo::~SixMajordomo ()
Destructor of SixMajordomo

Public

methods
SixMajordomo (Six * parent, LogFile * majordomoLogFile)
Constructor.
virtual ~SixMajordomo ()
Destructor.
virtual void* Run (void *)
Method that runs the whole Eso - processes messages from receiverToMajordomo.
GMessage* CreateSendDataMsg (Char *commandSer, GMessage *dataSer, GMessage *ac, Size hops = CFG_SEND_DATA_HOPS)
Creates "send_data" message.
Err BeginTransaction (ID *newTID)
Starts new transaction and returns its ID.
Err EndTransaction (ID tid)
Ends transaction with ID tid.
ID GetTID ()
Returns ID of the most recently started transaction.

Functions for getting information from ACManagers
virtual ACManager* GetPtrToACManager (Char *type)
Gets pointer to ACManager.
virtual Err InsertAC (Char *type, GMessage *ac)
Inserts AC into ACManager of given type.
virtual Queue* GetACs (Char *type, const int count = 1, Queue *notIn = NULL)
Gets given count of ACs of given type not included in notIn queue.
virtual GMessage* GetACByACID (Char *type, ACID acID)
Gets AC of given type by ACID.
virtual Err NextACTimeOut (Char *type, ESTime *t)
Returns next timeout of ACManager of given type.
virtual GMessage* CreateNextACTimeOutMsg (Char *type)
Creates messages that will be returned in next TimeOut.
virtual Err TestACCount (Char *type, Int *missing)
Tests AC count in ACMgr of given type.
virtual Err GenerateRequestForMissingACs (Char *acType)
Generates request for missing ACs.
virtual Err AskForOnion ()
Asks Mix for onion.

Protected

attributes
TID tID
transaction ID.
Queue* outMsgQueue
Queue with messages prepared to send to Mix.
TransactionManager* transactionManager
Object for managing transactions.
methods

Help functions for putting the messages to the majordomoToSender queue
Err FeedSenderWithOutMsgQueue ()
Puts the messages from outMsgQueue to majordomoToSender queue.
Err FeedSenderWithMsgForMix (GMessage *mixMsg)
Puts one message to majordomoToSender queue.

Functions for commands got from IIQ (Mix cmds)
virtual Void HandleMixMessage (GMessage *inMsg)
gets the Command and Data fields from inMsg and calls SwitchMixCommand.
virtual Err SwitchMixCommand (MsgField *commandFld, MsgField *dataFld)
calls appropriate method for Mix command.
virtual Err CommandTest (MsgField *dataFld)
Serves Test command from MIX.
virtual Err CommandDataReceived (MsgField *dataFld)
Serves DataReceived command from MIX.
virtual Err CommandOnionGenerated (MsgField *dataFld)
Serves OnionGenerated command from MIX.

Functions needed for serving OnionGenerated command from Mix
virtual Err GenerateThisSixAC (MsgField *onion, GMessage **generatedAC)
Generates AC of this six having the Onion (Mix certificate).
virtual Err HandleGeneratedAC (GMessage *generatedAC)
Handles the generated AC according to the type of Six.

Functions needed for serving DataReceived command from Mix
virtual MsgField* DecryptByACPriv (const ACID acid, const MsgField *dData)
Decrypting data by privateKey associated with ACID.
Err DecryptDataMsg (const GMessage *dataMsg, MsgField **decryptedBodyFld, ACID *acid)
Decrypting data that came from Service.
Err HandleDataReceivedBody (const MsgField *bodyFld, const ACID acid)
Handles the body of the message (the decrypted request from Service).
virtual Err SwitchDataReceivedVersion (const Char *version, const GMessage *body, const ACID acid)
Chooses the way to continue according to the protocol version of the message.

Functions that handle various commands from Service
virtual Err SwitchDataReceivedCommand (const Char *command, const MsgField *dataFld, const ACID acid)
Initializing switch.
Err DRCTest (const MsgField *dataFld)
Serving Test command.

Filling the fields into the messages to Service
Err FillTest (GMessage *gMsg, MsgField *msgFld)
Filling fields of TestMessage.
Err FillReplyToInfo (GMessage *gMsg)
Filling Reply-to-AC and Reply-To-TID fields of a GMessage.

Functions that create messages for Mix
GMessage* CreateTestMsg (MsgField *dataFld)
Creates testing message.
GMessage* CreateGetACsMsg (Char *type, Int count)
Creates "get_certificates" message.
GMessage* CreateGenerateOnionMsg (Size hopCount = CFG_HOPS_IN_AC)
Creates "generate_onion" message.

Inherited from Runable:

Public Methods

void Runable::MaskAllSignals()
Runable::Runable(LogFile * logFile)

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()

Inherited from SixOffspring:

Public Methods

SixOffspring::SixOffspring(Six * aSix)

Documentation

Object processing various requests and commands. Processes various requests comming from network and from Mix. Also distributes messages to apropriate objects.
attributes

TID tID
transaction ID.

Queue* outMsgQueue
Queue with messages prepared to send to Mix.

TransactionManager* transactionManager
Object for managing transactions.

methods

Help functions for putting the messages to the majordomoToSender queue

Err FeedSenderWithOutMsgQueue()
Puts the messages from outMsgQueue to majordomoToSender queue.

Err FeedSenderWithMsgForMix(GMessage *mixMsg)
Puts one message to majordomoToSender queue.

Functions for commands got from IIQ (Mix cmds)

virtual Void HandleMixMessage(GMessage *inMsg)
gets the Command and Data fields from inMsg and calls SwitchMixCommand.

virtual Err SwitchMixCommand(MsgField *commandFld, MsgField *dataFld)
calls appropriate method for Mix command.

virtual Err CommandTest(MsgField *dataFld)
Serves Test command from MIX.

virtual Err CommandDataReceived(MsgField *dataFld)
Serves DataReceived command from MIX.

virtual Err CommandOnionGenerated(MsgField *dataFld)
Serves OnionGenerated command from MIX.

Functions needed for serving OnionGenerated command from Mix

virtual Err GenerateThisSixAC(MsgField *onion, GMessage **generatedAC)
Generates AC of this six having the Onion (Mix certificate).

virtual Err HandleGeneratedAC(GMessage *generatedAC)
Handles the generated AC according to the type of Six.

Functions needed for serving DataReceived command from Mix

virtual MsgField* DecryptByACPriv(const ACID acid, const MsgField *dData)
Decrypting data by privateKey associated with ACID.

Err DecryptDataMsg(const GMessage *dataMsg, MsgField **decryptedBodyFld, ACID *acid)
Decrypting data that came from Service.

Err HandleDataReceivedBody(const MsgField *bodyFld, const ACID acid)
Handles the body of the message (the decrypted request from Service).

virtual Err SwitchDataReceivedVersion(const Char *version, const GMessage *body, const ACID acid)
Chooses the way to continue according to the protocol version of the message.

Functions that handle various commands from Service

virtual Err SwitchDataReceivedCommand(const Char *command, const MsgField *dataFld, const ACID acid)
Initializing switch.

Err DRCTest(const MsgField *dataFld)
Serving Test command.

Filling the fields into the messages to Service

Err FillTest(GMessage *gMsg, MsgField *msgFld)
Filling fields of TestMessage.

Err FillReplyToInfo(GMessage *gMsg)
Filling Reply-to-AC and Reply-To-TID fields of a GMessage.

Functions that create messages for Mix

GMessage* CreateTestMsg(MsgField *dataFld)
Creates testing message.

GMessage* CreateGetACsMsg(Char *type, Int count)
Creates "get_certificates" message.

GMessage* CreateGenerateOnionMsg(Size hopCount = CFG_HOPS_IN_AC)
Creates "generate_onion" message.

methods

SixMajordomo(Six * parent, LogFile * majordomoLogFile)
Constructor.

virtual ~SixMajordomo()
Destructor.

virtual void* Run(void *)
Method that runs the whole Eso - processes messages from receiverToMajordomo.

GMessage* CreateSendDataMsg(Char *commandSer, GMessage *dataSer, GMessage *ac, Size hops = CFG_SEND_DATA_HOPS)
Creates "send_data" message.

Err BeginTransaction(ID *newTID)
Starts new transaction and returns its ID.

Err EndTransaction(ID tid)
Ends transaction with ID tid.

ID GetTID()
Returns ID of the most recently started transaction.

Functions for getting information from ACManagers

virtual ACManager* GetPtrToACManager(Char *type)
Gets pointer to ACManager.

virtual Err InsertAC(Char *type, GMessage *ac)
Inserts AC into ACManager of given type.

virtual Queue* GetACs(Char *type, const int count = 1, Queue *notIn = NULL)
Gets given count of ACs of given type not included in notIn queue.

virtual GMessage* GetACByACID(Char *type, ACID acID)
Gets AC of given type by ACID.

virtual Err NextACTimeOut(Char *type, ESTime *t)
Returns next timeout of ACManager of given type.

virtual GMessage* CreateNextACTimeOutMsg(Char *type)
Creates messages that will be returned in next TimeOut.

virtual Err TestACCount(Char *type, Int *missing)
Tests AC count in ACMgr of given type.

virtual Err GenerateRequestForMissingACs(Char *acType)
Generates request for missing ACs.

virtual Err AskForOnion()
Asks Mix for onion.

Err SixMajordomo::AskForOnion()
Asks for onion, if necessary. Test count of ACs of THIS_SIX. If there are some missing, generates request for onion and puts it into outMsgQueue.
Returns:
error code
Parameters:
type - type of the AC
ac - ac to save
Author:
Marek
See Also:
ACManager

Err SixMajordomo::BeginTransaction(ID *newTID)
Starts the transaction. Calls the transactionManager method and thus begins new transaction.
Returns:
newTID returned by the method
Parameters:
parametr -
Author:
error code
See Also:
TransactionManager

Err SixMajordomo::CommandDataReceived(MsgField *paramFld)
Handles the Data_received command. Handling the Data_received command including decryption of the field Body contained in field Data.
Handles this message:
Data:
ACID:
Body: (encrypted by ACPubKey identified by ACID)
Version: (eso-others protocol version)
Command:
Data:
Returns:
error code
Parameters:
paramFld - parameters field from the inMsg
Author:
Pavel
See Also:

Err SixMajordomo::CommandOnionGenerated(MsgField *dataFld)
Serves "onion_generated" command from Mix. Gets the onion and creates the AC of this Six.
Returns:
error code
Parameters:
dataFld - contents of dataMsg
Author:
Marek
See Also:
GMessage, MsgField

Err SixMajordomo::CommandTest(MsgField *dataFld)
Serves command Test from Mix. Handles command Test got from Mix.
Returns:
error code
Parameters:
dataField - contents of data
Author:
Marek
See Also:
GMessage, MsgField

GMessage* SixMajordomo::CreateGenerateOnionMsg(Size hopCount = CFG_HOPS_IN_AC)
Creates "generate_onion" message for Mix. Creates and fills the fields of "generate_onion" message for Mix.
End situation (what is returned):
[mixMsg]Command: generate_onion
Parameters: 
[msg]     Certificate_Type: 
Count: hops
Request_ID:
Returns:
created GMessage
Parameters:
hopCount - count of hops in AC wanted
Author:
Marek
See Also:

GMessage* SixMajordomo::CreateGetACsMsg(Char *type, Int count)
Creates "get_certificates" message for Mix. Creates and fills the fields of "get_certificates" message for Mix.
[mixMsg]Command: get_certificates
Parameters: 
[msg]     Certificate_Type: 
Count: hops
Request_ID:
Returns:
created GMessage
Parameters:
type - type of ACs wanted
count - count of ACs wanted
Author:
Marek
See Also:

GMessage* SixMajordomo::CreateNextACTimeOutMsg(Char *type)
Cretates timeout message. Calls method of ACManager of given type to save ACs of given type. Creates timeout message understood by TO_CHECK_AC_COUNT command serve.
Returns:
acTimeOutMsg
Parameters:
type - type of the AC
Author:
Marek
See Also:
ACManager

GMessage* SixMajordomo::CreatePublishCertificateMsg(GMessage *ac)
Creates "publish_certificates" message for Mix. Creates and fills the fields of "publish_certificates" message for Mix.
End situation (what is returned):
[mixMsg]Command: publish_certificates
Parameters: 
[msg]     Certificate-1: 
Returns:
created GMessage
Parameters:
ac - ac to publish
Author:
Marek
See Also:

GMessage* SixMajordomo::CreateSendDataMsg(Char *commandSer, GMessage *dataSer, GMessage *ac, Size hops)
Creates "send_data" message for Mix. Creates and fills the fields of "send_data" message for Mix.
end situation (what is returned):
[outMsg]Command: send_data
Parameters: 
[msg3]    AC: ac
Add-Hops: hops
Data:
[msg2]      ACID:
Body: {CIPHERED WITH PUB_KEY OF ac}
[msg1]         Command: commandSer
Data: dataSer         
Version: eso_others protocol version
Returns:
created GMessage
Parameters:
commandSer - command to send to Service
dataSer - data to send to Service
ac - ac of recipient
hops - number of hops to add
Author:
Marek
See Also:
Cipherer, GMessage, MsgField

GMessage* SixMajordomo::CreateTestMsg(MsgField *dataFld)
Creates "test" message for Mix. Creates and fills the fields of Test message for Mix.
End situation (what is returned):
[mixMsg]Command: test
Parameters: dataFld
Returns:
created GMessage
Parameters:
dataFld - dataField to insert to message
Author:
Marek
See Also:

Err SixMajordomo::DRCTest(const MsgField *dataFld)
Handles Test message from service. Replies to the Test message got from service.
Returns:
error code
Parameters:
dataFld - data got from service
Author:
Pavel

Err SixMajordomo::DecryptDataMsg(const GMessage *dataMsg, MsgField **decryptedBodyFld, ACID *acid)
Decrypts the field Body. Decrypts the field Body (stored in given GMessage) according to field ACID. Returns the decrypted field Body.
Returns:
error code
Parameters:
dataMsg - given GMessage
decryptedBodyField - returned decrypted field
acid - acid to decrypt with
Author:
Pavel
See Also:
GMessage

Err SixMajordomo::EndTransaction(ID tid)
Finishes transaction. Calls the transaction manager to finish the transaction.
Returns:
error code
Parameters:
tid - tid of transaction to finish
Author:
Pavel
See Also:
TransactionManager

Err SixMajordomo::FeedSenderWithMsgForMix(GMessage *mixMsg)
Puts one message to the majordomoToSender queue. Appends parameter into the majordomoToSenderQueue.
Returns:
error code
Parameters:
mixMsg - message to append
Author:
Marek
See Also:
GMessage, Sender, MessageQueue

Err SixMajordomo::FeedSenderWithOutMsgQueue()
Puts the messages from outMsgQueue to the majordomoToSender queue. If outMsgQueue is not null and not empty, takes all messages from it and puts into majordomoToSender queue.
Returns:
error code
Author:
Marek
See Also:
Queue

Err SixMajordomo::FillReplyToInfo(GMessage *gMsg)
Sets replyToInfo of GMessage. Sets two fields of the gMsg (replyToTID, replyToAC).
Returns:
error code
Parameters:
gMsg - message to fill
Author:
Marek
See Also:
GMessage

Err SixMajordomo::FillTest(GMessage *gMsg, MsgField *msgFld)
Sets GMessage as Test. Sets the Parameters-field of GMessage to given msgField.
Returns:
error code
Parameters:
gMsg - message to fill
msgFld - field tu put in gMsg
Author:
Marek
See Also:

Err SixMajordomo::GenerateRequestForMissingACs(Char *acType)
Generates request for ACs of given type. Test count of ACs of given type. If there are some missing, generates request for missing them and puts it into outMsgQueue.
Returns:
error code
Parameters:
type - type of the AC
Author:
Marek
See Also:
ACManager

GMessage* SixMajordomo::GetACByACID(Char *type, ACID acID)
Get AC of given type and ACID. Calls method of ACManager of given type to get AC of given ACID.
Returns:
found ac
Parameters:
type - type of the AC
acid - acid to find
Author:
Marek
See Also:
ACManager

Queue* SixMajordomo::GetACs(Char *type, const int count, Queue *notIn)
Returns ACs of given type. Calls method of ACManager of given type to return count ACs of given type not included in notIn queue.
Returns:
queue of returned ACs
Parameters:
type - type of the AC
count - count of ACs wanted
notIn - queue of ACs not wanted to include
Author:
Marek
See Also:
ACManager

ID SixMajordomo::GetTID()
Returns current TID. Returns the value of the attribute tID.
Returns:
ID currentTID.
Author:
Pavel

Err SixMajordomo::HandleDataReceivedBody(const MsgField *bodyFld, const ACID acid)
Handles the command receiver from Service. Handles the command received from the receiver (not from a Mix) according to Eso-Others protocol.
Returns:
err
Parameters:
bodyFld - body of the message
acid - acid to which the message was sent
Author:
pavel
See Also:

Err SixMajordomo::HandleGeneratedAC(GMessage *)
Handles generated AC. In Six does nothing. Descendants may save or publish the AC by overriding this method.
Returns:
co
Parameters:
generatedAC -
Author:
jmeno
See Also:
co_se_toho_tyka

Void SixMajordomo::HandleMixMessage(GMessage *inMsg)
Handles the message from Mix. Extracts the command and data fields from the inMsg and calls switch methods.
Returns:
void
Parameters:
inMsg - message that came from receiverToMajordomo queue
Author:
Pavel, Marek
See Also:
GMessage, Debugable

Err SixMajordomo::InsertAC(Char *type, GMessage *ac)
Saves ACs of given type. Calls method of ACManager of given type to save ACs.
Returns:
error code
Parameters:
type - type of the AC
ac - ac to save
Author:
Marek
See Also:
ACManager

Err SixMajordomo::NextACTimeOut(Char *type, ESTime *t)
Returns next timeout of ACManager of given type. Calls method of ACManager of given type to return next timeout.
Returns:
error code
Parameters:
type - type of the AC
t - returned time
Author:
Marek
See Also:
ACManager

void* SixMajordomo::Run(void *)
Main running loop of SixMajordomo. In a loop gets a message from receiverToMajordomo queue, creates outMsgQueue, processes the message and puts all the messages (if there are any) from outMsgQueue into the majordomoToSender queue.
Returns:
void
Author:
Pavel
See Also:
MessageQueue

SixMajordomo::SixMajordomo(Six * parent, LogFile * majordomoLogFile)
Constructor of SixMajordomo. Creates transaction manager and calls its ancestors' constructors.
Parameters:
parent - pointer to Six
majordomoLogFile - logFile to write to
Author:
Pavel
See Also:
TransactionManager, Runable, SixOffspring

Err SixMajordomo::SwitchDataReceivedCommand(const Char *command, const MsgField *dataFld, const ACID acid)
Incoming message handling. Chooses a method to handle the command from the incomming message.
Returns:
error code
Parameters:
command - command received from service
dataFld - data received from service
acid - ID of AC to which the data was sent
Author:
Pavel

Err SixMajordomo::SwitchDataReceivedVersion(const Char *version, const GMessage *body, const ACID acid)
Switches a method according to the version. Chooses a method to handle the incomming message according to its version.
Returns:
error code
Parameters:
version - version of received GMessage
body - body of the received GMessage
acid - ID of certificate to which the message came
Author:
Pavel
See Also:

Err SixMajordomo::SwitchMixCommand(MsgField *commandFld, MsgField *dataFld)
Chooses handling method. According to field Command (in message poped from receiverToMajordomo) chooses and calls handling method.
Returns:
error code
Parameters:
commandFld - command extracted from the message
dataFld - data extracted from the message
Author:
Pavel

Err SixMajordomo::TestACCount(Char *type, Int *missing)
Test count of ACs of given type. Calls method of ACManager of given type to test count of ACs.
Returns:
error code
Parameters:
type - type of the AC
missing - returned count of missing ACs
Author:
Marek
See Also:
ACManager

SixMajordomo::~SixMajordomo()
Destructor of SixMajordomo. Deletes transaction manager.
Author:
Pavel
See Also:
TransactionManager


Direct child classes:
Majordomo
Majordomo
Majordomo
Author:
Pavel
See Also:
Runable, SixOffSpring, Mix

alphabetic index hierarchy of classes


generated by doc++