3 * UCC (University [of WA] Computer Club) Electronic Accounting System
5 * cokebank.h - Coke-Bank common definitions
7 * This file is licenced under the 3-clause BSD Licence. See the file COPYING
13 #define COKEBANK_SALES_ACCT ">sales" //!< Sales made into
14 #define COKEBANK_DEBT_ACCT ">liability" //!< Credit taken out of
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
24 // --- Cokebank Functions ---
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
32 extern int Bank_Transfer(int SourceUser, int DestUser, int Ammount, const char *Reason);
34 * \brief Get flags on an account
35 * \param User UID to get flags from
36 * \see eCokebank_Flags
38 extern int Bank_GetFlags(int User);
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
45 extern int Bank_SetFlags(int User, int Mask, int Value);
47 * \brief Get an account's balance
48 * \param User UID to query
50 extern int Bank_GetBalance(int User);
52 * \brief Get the name associated with an account
55 extern char *Bank_GetUserName(int User);
57 * \brief Get a UID from a passed name
59 extern int Bank_GetUserID(const char *Username);
61 * \brief Create a new account
63 extern int Bank_CreateUser(const char *Username);
65 * \brief Get the maximum UID
66 * \note Used for iterating accounts
68 extern int Bank_GetMaxID(void);
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
75 extern int Bank_GetUserAuth(const char *Salt, const char *Username, const char *Password);