Cleanup - Multiple changes, see description
[tpg/opendispense2.git] / src / cokebank.h
1 /*
2  * OpenDispense 2 
3  * UCC (University [of WA] Computer Club) Electronic Accounting System
4  *
5  * cokebank.h - Coke-Bank common definitions
6  *
7  * This file is licenced under the 3-clause BSD Licence. See the file COPYING
8  * for full details.
9  */
10 #ifndef _COKEBANK_H_
11 #define _COKEBANK_H_
12
13 #define COKEBANK_SALES_ACCT     ">sales"        //!< Sales made into
14 #define COKEBANK_DEBT_ACCT      ">liability"    //!< Credit taken out of
15
16 enum eCokebank_Flags {  
17         USER_FLAG_COKE          = 0x01,
18         USER_FLAG_WHEEL         = 0x02,
19         USER_FLAG_DOORGROUP     = 0x04,
20         USER_FLAG_INTERNAL      = 0x40,
21         USER_FLAG_DISABLED      = 0x80
22 };
23
24 // --- Cokebank Functions ---
25 /**
26  * \brief Transfer money from one account to another
27  * \param SourceUser    UID (from \a GetUserID) to take the money from
28  * \param DestUser      UID (from \a GetUserID) give money to
29  * \param Ammount       Amount of money (in cents) to transfer
30  * \param Reason        Reason for the transfer
31  */
32 extern int      Bank_Transfer(int SourceUser, int DestUser, int Ammount, const char *Reason);
33 /**
34  * \brief Get flags on an account
35  * \param User  UID to get flags from
36  * \see eCokebank_Flags
37  */
38 extern int      Bank_GetFlags(int User);
39 /**
40  * \brief Set an account's flags
41  * \param User  UID to set flags on
42  * \param Mask  Mask of flags changed
43  * \param Value Final value of changed flags
44  */
45 extern int      Bank_SetFlags(int User, int Mask, int Value);
46 /**
47  * \brief Get an account's balance
48  * \param User  UID to query
49  */
50 extern int      Bank_GetBalance(int User);
51 /**
52  * \brief Get the name associated with an account
53  * \return Heap string
54  */
55 extern char     *Bank_GetUserName(int User);
56 /**
57  * \brief Get a UID from a passed name
58  */
59 extern int      Bank_GetUserID(const char *Username);
60 /**
61  * \brief Create a new account
62  */
63 extern int      Bank_CreateUser(const char *Username);
64 /**
65  * \brief Get the maximum UID
66  * \note Used for iterating accounts
67  */
68 extern int      Bank_GetMaxID(void);
69 /**
70  * \brief Validates a user's authentication
71  * \param Salt  Salt given to the client for hashing the password
72  * \param Username      Username used
73  * \param Password      Password sent by the client
74  */
75 extern int      Bank_GetUserAuth(const char *Salt, const char *Username, const char *Password);
76
77 #endif

UCC git Repository :: git.ucc.asn.au