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_TYPEMASK = 0x03,
18 USER_TYPE_NORMAL = 0x00,
19 USER_TYPE_COKE = 0x01,
20 USER_TYPE_WHEEL = 0x02,
23 USER_FLAG_DOORGROUP = 0x40,
24 USER_FLAG_DISABLED = 0x80
27 // --- Cokebank Functions ---
29 * \brief Transfer money from one account to another
30 * \param SourceUser UID (from \a GetUserID) to take the money from
31 * \param DestUser UID (from \a GetUserID) give money to
32 * \param Ammount Amount of money (in cents) to transfer
33 * \param Reason Reason for the transfer
35 extern int Transfer(int SourceUser, int DestUser, int Ammount, const char *Reason);
37 * \brief Get flags on an account
38 * \param User UID to get flags from
39 * \see eCokebank_Flags
41 extern int GetFlags(int User);
43 * \brief Set an account's flags
44 * \param User UID to set flags on
45 * \param Mask Mask of flags changed
46 * \param Value Final value of changed flags
48 extern int SetFlags(int User, int Mask, int Value);
50 * \brief Get an account's balance
51 * \param User UID to query
53 extern int GetBalance(int User);
55 * \brief Get the name associated with an account
58 extern char *GetUserName(int User);
60 * \brief Get a UID from a passed name
62 extern int GetUserID(const char *Username);
64 * \brief Create a new account
66 extern int CreateUser(const char *Username);
68 * \brief Get the maximum UID
69 * \note Used for iterating accounts
71 extern int GetMaxID(void);
73 * \brief Validates a user's authentication
74 * \param Salt Salt given to the client for hashing the password
75 * \param Username Username used
76 * \param Password Password sent by the client
78 extern int GetUserAuth(const char *Salt, const char *Username, const char *Password);