In file /home/eternity/Source/Eso/Banker/H/banker.h:

class Banker : public Debugable, public Rollbackable, SixOffspring

Banker

Inheritance:

Banker < Debugable

Banker < Rollbackable

Banker < SixOffspring


Public Methods

Err Banker::CreatePayments ()
Creates Payments table
Err Banker::DecideAcceptPPlan (MsgField * )
Decide Wheather To Accept Payment Plan
GMessage* Banker::DecideWhichBank ()
Chooses a bank
Void Banker::DelPayPlan (TID tId)
Deletes Payment Plan with given TID
Void Banker::DeleteRecsFileID (ID fileId)
Deletes all records with given file ID
Err Banker::DeleteRecsInTable (Table *t, Char *whichId, ID id)
Deletes all records in the table
Err Banker::DeleteRecsInTable (Table *t, Char *whichId, ID id)
Deletes all records in the table
Void Banker::DeleteRecsPayID (ID payId)
Deletes all records with file ID which correspond to given payment ID
Char* Banker::FillTableForBank (Record **r, Table *bankTmpTab)
Fills given table with information about payments
Record* Banker::FindAndDelInTable (Table *t, Char *whichId, ID id)
Finds and deletes record in the table
GMessage* Banker::GenerateAnswer (CurrPay *p)
Generates message for bank
GMessage* Banker::GenerateMsgForBank (GMessage *bankAC, Char *sum, Table *bankTab)
Generate message for bank
Err Banker::GeneratePayId (ID *payId)
Generates Pay ID
GMessage* Banker::GenerateRequest (CurrPay *p)
Generates message for bank
Err Banker::MakePPlanForBanks (MsgField *pPlanFld)
Makes Payment Plans For Banks
MsgField* Banker::MakePayPlan (Size size, RelTime timeToStore, TID tId)
Generates payment plan for a client

Public

methods

Protected

attributes
Table* pPlans
bankers' persistent tables:
Table* clientPPlan
generated payment plans
Table* payments
pay plan that will be sent to client
Table* currPays
all payments that should be done
Table* notPaidPays
all payments that are carried out right now

payments that haven't been paid
methods

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

Public

attributes

int debugOptions
What messages should be logged
LogFile* logFile
Log file for debug messages

Inherited from Rollbackable:


Inherited from SixOffspring:

Public Methods

SixOffspring::SixOffspring(Six * aSix)

Documentation

Banker. A class which manages everything about payments in Eso: Makes Payment Plans for Clients Has control over all payment transactions between Bank and Eso (sends request for payment and reacts to a challenge from Bank)
attributes

Table* pPlans
bankers' persistent tables:

Table* clientPPlan
generated payment plans

Table* payments
pay plan that will be sent to client

Table* currPays
all payments that should be done

Table* notPaidPays
all payments that are carried out right now

payments that haven't been paid

methods

methods

Err Banker::CreatePayments()
Creates Payments table. Creates (or connects to exist.) Payments table.
Returns:
error code
Parameters:
void -
Author:
Ivana
See Also:
Banker()

Err Banker::DecideAcceptPPlan(MsgField * )
Decide Wheather To Accept Payment Plan. Decides wheather client accepts sent payment plan or not. (Now agrees with everything, later it should accept client's decision.) If sent payment plan is NULL, Eso store client's file for free.
Returns:
OK/KO
Parameters:
pPlanFld - msgField of payment plan
Author:
Ivana
See Also:
Majordomo::StoreFile()

GMessage* Banker::DecideWhichBank()
Chooses a bank. Decide which bank we use when generating PayPlan. Now randomly selects a bank AC (later it should be more sophisticated).
Returns:
bank access certificate
Author:
Ivana
See Also:
MakePayPlan()

Void Banker::DelPayPlan(TID tId)
Deletes Payment Plan with given TID. Deletes Payment Plan with given TID. The reason of it may be: first, client didn't send data (timeout from Scheduller), second, client sent "wrong" data (too big, ...), third, eso couldn't store sent file.
Returns:
void
Parameters:
tId - transaction ID corresponding to the payment plan
Author:
Ivana
See Also:
Majordomo::DRCDataToStore()

Void Banker::DeleteRecsFileID(ID fileId)
Deletes all records with given file ID. If administrator wants to delete a file (the reason can be, that there are no payments for it), this method is used. It deletes all records (in all tables) with given file ID.
Returns:
void
Parameters:
fileId - ID of deleted file records
Author:
Ivana
See Also:
DeleteRecsPayID

Err Banker::DeleteRecsInTable(Table *t, Char *whichId, ID id)
Deletes all records in the table. Deletes all records in the table with given ID. If whichId is not specified (NULL), clears given table.
Returns:
error code
Parameters:
t - table in which we will delete
whichId - specifies ID, that is used for deleting
id - a value of the ID
Author:
Ivana
See Also:

Err Banker::DeleteRecsInTable(Table *t, Char *whichId, ID id)
Deletes all records in the table. Deletes all records in the table with given ID. If whichId is not specified (NULL), clears given table.
Returns:
error code
Parameters:
t - table in which we will delete
whichId - specifies ID, that is used for deleting
id - a value of the ID
Author:
Ivana
See Also:
ChallengeOK, ChallengeKO, AnswerOK, AnswerKO, TimeOutCurrPay()

Void Banker::DeleteRecsPayID(ID payId)
Deletes all records with file ID which correspond to given payment ID. If administrator wants to delete a file, which correspond to given payment ID (the reason can be, that there are no payments for it), this method is used. It deletes all records (in all tables) with file ID which correspond to given payment ID.
Returns:
void
Parameters:
payId - ID of payment that correspond to deleted file records
Author:
Ivana
See Also:
DeleteRecsFileID()

Char* Banker::FillTableForBank(Record **r, Table *bankTmpTab)
Fills given table with information about payments. From each record from table PayPlan with given bankACID and transaction ID strips TID and writes it to the table for bank.
Returns:
total sum of money to be paid to the bank
Parameters:
r - initialize record, in which we find useful information
bankTable - table for bank
Author:
Ivana
See Also:
PrepareMsgsForBanks()

Record* Banker::FindAndDelInTable(Table *t, Char *whichId, ID id)
Finds and deletes record in the table. Finds and deletes record in the table with given ID.
Returns:
found record or NULL
Parameters:
t - table in which we will search
whichId - specifies ID, that is used for searching
id - a value of the ID
Author:
Ivana
See Also:
PrepareMsgsForBanks()

GMessage* Banker::GenerateAnswer(CurrPay *p)
Generates message for bank. Generates answer for bank, including payId, MAC, SAuthentification.
Returns:
message for bank
Parameters:
p - current payment structure
Author:
Ivana
See Also:
ChallengeOK(), TimeOutCurrPay()

GMessage* Banker::GenerateMsgForBank(GMessage *bankAC, Char *sum, Table *bankTab)
Generate message for bank. Generate message for bank including bank access certificate, total sum of money to be paid and payment plan.
Returns:
message for bank or NULL
Author:
Ivana
See Also:
PrepareMsgsForBanks()

Err Banker::GeneratePayId(ID *payId)
Generates Pay ID. Generates unique payment ID.
Returns:
error code
Parameters:
payId - return parametr
Author:
Ivana
See Also:
MakePayPlan()

GMessage* Banker::GenerateRequest(CurrPay *p)
Generates message for bank. Generates request for bank including payId.
Returns:
message for bank
Parameters:
p - current payment structure
Author:
Ivana
See Also:
TimeForPayment(), TimeOutCurrPay()

Err Banker::MakePPlanForBanks(MsgField *pPlanFld)
Makes Payment Plans For Banks. Receiving Eso's payment plan, finishes it (by generating oAuths and computing MAC for each record) and stores it with current transaction ID.
Returns:
error code
Parameters:
pPlanFld - msgField of payment plan
Author:
Ivana
See Also:
Majordomo::StoreFile()

MsgField* Banker::MakePayPlan(Size size, RelTime timeToStore, TID tId)
Generates payment plan for a client. First it check system time. If it is OK, count price for storrage and for each pay period chooses bank and generate payment record. After generating all pay records returns whole payment plan as new msgField.
Returns:
payment plan as a new msgField
Parameters:
size - size of file, which will be stored
timeToStore - period for which is file stored
tId - current transactoin ID
Author:
Ivana
See Also:
Majordomo::DRCRequestForStorage()


This class has no child classes.
Author:
Ivana

alphabetic index hierarchy of classes


generated by doc++