Compile fixes
[tpg/opendispense2.git] / server / src / common.h
1 /*
2  * OpenDispense2
3  *
4  * This code is published under the terms of the Acess licence.
5  * See the file COPYING for details.
6  *
7  * common.h - Core Header
8  */
9 #ifndef _COMMON_H_
10 #define _COMMON_H_
11
12 // === CONSTANTS ===
13 #define DEFAULT_CONFIG_FILE     "/etc/opendispense/main.cfg"
14
15 // === HELPER MACROS ===
16 #define _EXPSTR(x)      #x
17 #define EXPSTR(x)       _EXPSTR(x)
18
19 // === STRUCTURES ===
20 typedef struct sItem    tItem;
21 struct sItem
22 {
23         char    *Name;  //!< Display Name
24          int    Price;  //!< Price
25         
26         short   Type;   //!< References an action
27         short   ID;     //!< Item ID
28 };
29
30 typedef struct sUser    tUser;
31 struct sUser
32 {
33          int    ID;             //!< User ID (LDAP ID)
34          int    Balance;        //!< Balance in cents
35          int    Bytes;  //!< Traffic Usage
36         char    Name[]; //!< Username
37 };
38
39 typedef struct sHandler tHandler;
40 struct sHandler
41 {
42         char    *Name;
43          int    (*CanDispense)(int User, int ID);
44          int    (*DoDispense)(int User, int ID);
45 };
46
47 // === GLOBALS ===
48 extern tItem    *gaItems;
49 extern int      giNumItems;
50 extern tHandler *gaHandlers;
51 extern int      giDebugLevel;
52
53 // === FUNCTIONS ===
54 // --- Logging ---
55 extern void     Log_Error(const char *Format, ...);
56 extern void     Log_Info(const char *Format, ...);
57
58 // --- Cokebank Functions ---
59 extern int      AlterBalance(int User, int Ammount);
60 extern int      GetBalance(int User);
61 extern char     *GetUserName(int User);
62 extern int      GetUserID(const char *Username);
63
64 #endif

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