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

class Banker : public Debugable, SixOffspring

Banker

Inheritance:

Banker < Debugable

Banker < SixOffspring


Public Methods

Void Banker::AnswerFromBank (GMessage *inMsg)
Reacts to an answer from bank
Void Banker::AnswerKO ( CurrPay *p, Char *reason)
Reaction to a 'KO answer' from bank
Err Banker::AnswerOK ( CurrPay *p, GMessage *inMsg)
Reaction to a 'OK answer' from bank
Banker::Banker (LogFile *logFile, Client *client)
Banker constructor
Banker::Banker (LogFile *logFile, Eso *eso)
Banker Constructor
GMessage* Banker::ChallengeFromBank (GMessage *inMsg, TID tId, ACID *bankACID)
Reacts to a challenge from bank
Void Banker::ChallengeKO (CurrPay *p, Char *reason)
Reaction to a 'KO challenge' from bank
GMessage* Banker::ChallengeOK (CurrPay *p, GMessage *inMsg)
Reaction to a 'OK challenge' from bank
Void Banker::ChallengeWrongTime (CurrPay * , GMessage * )
Reaction to a 'BadTime challenge' from bank
Char* Banker::CountPrice (Size , RelTime )
Counts price for stored data
Err Banker::CreateBankPPlan ()
Create BankPPlan Table
Err Banker::CreateClientPPlan ()
Creates Client Payment Plan table
Err Banker::CreateCurrPays ()
Creates Current Payments table
Err Banker::CreateNotPaidPays ()
Creates Not Paid Payments table
Err Banker::CreatePPlans ()
Creates Payment Plan table
Err Banker::CreatePayPlan ()
Create PayPlan Table
Err Banker::PartialUpdateCurrPays (CurrPay *p)
Updates table Current Payments
Queue* Banker::PrepareMsgsForBanks (TID oldTID)
Prepares queue of mesages for banks
Err Banker::Rollback (TID tId)
Rollback transaction
Err Banker::SchedulePays (TID tId, ID fileId)
Schedule Payments with given TID
Err Banker::SetCurrPayTimeOut (ID payId, Int state)
Sets current payment time out
Err Banker::SetPaymentTimeOut (ID payId, ESTime time)
Sets payment time out
Err Banker::StorePayPlan (Table *esoPPlan, TID tId)
Stores payments from given table
GMessage* Banker::TimeForPayment (GMessage *inMsg, TID tId, ACID *bankACID)
Time For Some Payment is up
GMessage* Banker::TimeOutCurrPay (CurrPay *p)
TimeOut of some current payment
GMessage* Banker::TimeOutPayment (GMessage *inMsg, TID tId, ACID *bankACID, Int *request)
Reacts to a timeout of some payment
Banker::~Banker ()
Banker destructor
Banker::~Banker ()
Banker Destructor

Public

methods
Err DecideAcceptPPlan (MsgField *pPlanFld)
decides wheather client accepts sent payment plan
Err MakePPlanForBanks (MsgField *pPlanFld)
finishes payment plan (generates oAuths and count MACs) for bank
Queue* PrepareMsgsForBanks (TID oldTID)
prepares msgs for banks

Protected

attributes
Table* payPlan
Bankers' persistent tables
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()

Inherited from SixOffspring:

Public Methods

SixOffspring::SixOffspring(Six * aSix)

Documentation

Banker. A class which manages everything about payments in Client: 1) For each payment (in payment plan sent by Eso) generates OAuth and counts MAC. 2) New payment plan sends to given banks (along with money).
attributes

Table* payPlan
Bankers' persistent tables

methods

methods

Err DecideAcceptPPlan(MsgField *pPlanFld)
decides wheather client accepts sent payment plan

Err MakePPlanForBanks(MsgField *pPlanFld)
finishes payment plan (generates oAuths and count MACs) for bank

Queue* PrepareMsgsForBanks(TID oldTID)
prepares msgs for banks

Void Banker::AnswerFromBank(GMessage *inMsg)
Reacts to an answer from bank. If everything is OK, writes to log file and deletes records in temporary table. Otherwise writes to Not Paid Pays table and warn administrator of the eso.
Returns:
void
Parameters:
inMsg - message (answer) from bank
Author:
Ivana
See Also:
Majordomo::DRCAnswerFromBank()

Void Banker::AnswerKO( CurrPay *p, Char *reason)
Reaction to a 'KO answer' from bank. Reacts to an answer from bank. Something is wrong - write to notPaidPays and logFile, deletes the record in current pays.
Returns:
void
Parameters:
p - current payment structure
reason - reason of fail
Author:
Ivana
See Also:
AnswerFromBank()

Err Banker::AnswerOK( CurrPay *p, GMessage *inMsg)
Reaction to a 'OK answer' from bank. Reacts to an answer from bank. Success is OK - bank knows the payment, MAC and SAuth are correct.
Returns:
error code
Parameters:
p - current payment structure
inMsg - message from bank
Author:
Ivana
See Also:
AnswerFromBank()

Banker::Banker(LogFile *logFile, Client *client)
Banker constructor. Banker constructor creates (and clears) bankers' persistent tables.
Parameters:
logFile - pointer to log file
client - pointer to main class client
Author:
Ivana
See Also:
Client

Banker::Banker(LogFile *logFile, Eso *eso)
Banker Constructor. Banker Constructor creates bankers' persistent tables.
Parameters:
logFile - pointer to log file
eso - pointer to main class eso
Author:
Ivana
See Also:
Eso

GMessage* Banker::ChallengeFromBank(GMessage *inMsg, TID tId, ACID *bankACID)
Reacts to a challenge from bank. As an answer to eso's 'request for payment' bank sends challenge. If something goes wrong (bank does not know the payment, eso requests for payment too early,...) bank does not send the key for computing MAC. If everything is OK (bank knows the payment and time is OK), an OAuthentification is in challenge. On this OAuth and stored client's file banker computes MAC. Then eso send this MAC along with SAuthentification as a 'response to challenge' to bank.
Returns:
message (response to challenge) for bank
Parameters:
inMsg - message (challenge) from bank
tId - current transaction ID
bankACID - ID of bank's access certificate (return parametr)
Author:
Ivana
See Also:
Majordomo::DRCChallengeFromBank()

Void Banker::ChallengeKO(CurrPay *p, Char *reason)
Reaction to a 'KO challenge' from bank. Reacts to a challenge from bank. Something is wrong - write to notPaidPays and logFile.
Returns:
void
Parameters:
p - current payment structure
reason - reason of fail
Author:
Ivana
See Also:
ChallengeFromBank()

GMessage* Banker::ChallengeOK(CurrPay *p, GMessage *inMsg)
Reaction to a 'OK challenge' from bank. Reacts to a challenge from bank; success is OK - bank knows the payment it counts MAC and writes it (with OAuth) to CurrPays.
Returns:
message for bank
Parameters:
p - current payment structure
inMsg - message from bank
Author:
Ivana
See Also:
ChallengeFromBank()

Void Banker::ChallengeWrongTime(CurrPay * , GMessage * )
Reaction to a 'BadTime challenge' from bank. Reacts to a challenge from bank. Bank has different time - warn synchronizer (not implemented now).
Returns:
void
Parameters:
p - current payment structure
inMsg - message from bank
Author:
Ivana
See Also:
ChallengeFromBank()

Char* Banker::CountPrice(Size , RelTime )
Counts price for stored data. From size and timeToStore counts price for stored data. Returns it as a string.
Returns:
amount of money
Parameters:
size - size of stored file
timeToStore - period of storrage of sent file
Author:
Ivana
See Also:
MakePayPlan()

Err Banker::CreateBankPPlan()
Create BankPPlan Table. Creates table BankPPlan - a persistent Banker's table.
Returns:
error code
Author:
Ivana
See Also:
Banker()

Err Banker::CreateClientPPlan()
Creates Client Payment Plan table. Creates (or connects to exist.) Client Payment Plan table. This table is common to eso and client so it calls CreateEsoToClientTable() function to create it.
Returns:
error code
Parameters:
void -
Author:
Ivana
See Also:
Banker(), CreateEsoToClientTable()

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

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

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

Err Banker::CreatePayPlan()
Create PayPlan Table. Creates table PayPlan - a persistent Banker's table.
Returns:
error code
Author:
Ivana
See Also:
Banker()

Err Banker::PartialUpdateCurrPays(CurrPay *p)
Updates table Current Payments. Updates a record in the table CurrentPayments with new TID and NumOfTries.
Returns:
error code
Parameters:
p - current pay record
Author:
Ivana
See Also:
TimeOutCurrPay()

Queue* Banker::PrepareMsgsForBanks(TID oldTID)
Prepares queue of mesages for banks. Finds all records with given TID. For each bank found in these records generate message including payment plan.
Returns:
queue of messages for banks
Parameters:
oldTID - transaction ID with which the payments are connected
Author:
Ivana
See Also:
Majordomo

Err Banker::Rollback(TID tId)
Rollback transaction. We don't have to cancel bank transactions, because they have TimeOuts. After some time they will be resent. We only must rollback generated payment plan (if any). TID is used as FileID!.
Returns:
error code
Parameters:
tId - ID transaction to be rollbacked
Author:
Ivana
See Also:

Err Banker::SchedulePays(TID tId, ID fileId)
Schedule Payments with given TID. Client sent file and eso stored it. So the banker has to schedule payments. For each payment record from table generatedPayPlans with given TID: first, writes it to table payments; second, set time out for it.
Returns:
error code
Parameters:
tId - transaction ID corresponding to the payment plan
fileId - ID od file, which has been stored
Author:
Ivana
See Also:
Majordomo::DRCDataToStore()

Err Banker::SetCurrPayTimeOut(ID payId, Int state)
Sets current payment time out. Sets time out of current payment to specified time.
Returns:
error code
Parameters:
payId - current payment ID
state - state of payemnt (REQUEST/ANSWER)
Author:
Ivana
See Also:
GenerateRequest(), GenerateAnswer()

Err Banker::SetPaymentTimeOut(ID payId, ESTime time)
Sets payment time out. Sets time out on the date the payment should be carried out.
Returns:
error code
Parameters:
payId - payment ID
time - timeOut time
Author:
Ivana
See Also:
SchedulePays()

Err Banker::StorePayPlan(Table *esoPPlan, TID tId)
Stores payments from given table. For each record from table esoPPlan generates OAuth and compute MAC. Then writes the record to table payPlan.
Returns:
error code
Parameters:
esoPPlan - table of payment plan sent by Eso
tId - current transaction ID
Author:
Ivana
See Also:
MakePPlanForBanks()

GMessage* Banker::TimeForPayment(GMessage *inMsg, TID tId, ACID *bankACID)
Time For Some Payment is up. When time of some payment is up, finds payment record with given payId, generates request for bank including payment ID, sets timeout of current payment and fills in table currentPayments.
Returns:
message (request) for bank
Parameters:
inMsg - message from scheduler
tId - current transaction ID
bankACID - ID of bank's access certificate (return parametr)
Author:
Ivana
See Also:
Majordomo::DRCTimeForPayment()

GMessage* Banker::TimeOutCurrPay(CurrPay *p)
TimeOut of some current payment. TimeOut of some current payment has gone.
Returns:
message for bank or NULL
Parameters:
p - current payment structure
Author:
Ivana
See Also:
TimeOutPayment()

GMessage* Banker::TimeOutPayment(GMessage *inMsg, TID tId, ACID *bankACID, Int *request)
Reacts to a timeout of some payment. When time of some current payment is up, finds payment record with given payId. If number of tries to get money from bank is still under limit, generates request or answer (depend on 'state' field) for bank and again sets timeout.
Returns:
message for bank
Parameters:
inMsg - message from scheduler
tId - current transaction ID
bankACID - ID of bank's access certificate (return parametr)
request - wheather state is request or answer; parametr can have values YES or NO (retrun parametr)
Author:
Ivana
See Also:
Majordomo::DRCTimeOutPayment()

Banker::~Banker()
Banker destructor. Banker destructor deletes (and clears) bankers' persistent tables.
Author:
Ivana
See Also:
Client

Banker::~Banker()
Banker Destructor. Banker Destructor deletes bankers' persistent tables.
Author:
Ivana
See Also:
Eso


This class has no child classes.
Author:
Ivana
See Also:
Client

alphabetic index hierarchy of classes


generated by doc++