Skeleton server code (compiles, just doesn't do anything)
[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 // === STRUCTURES ===
16 typedef struct sItem    tItem;
17 struct sItem
18 {
19         char    *Name;  //!< Display Name
20          int    Price;  //!< Price
21         
22         short   Type;   //!< References an action
23         short   ID;     //!< Item ID
24 };
25
26 typedef struct sUser    tUser;
27 struct sUser
28 {
29          int    ID;             //!< User ID (LDAP ID)
30          int    Balance;        //!< Balance in cents
31          int    Bytes;  //!< Traffic Usage
32         char    Name[]; //!< Username
33 };
34
35 typedef struct sHandler tHandler;
36 struct sHandler
37 {
38         char    *Name;
39          int    (*CanDispense)(int User, int ID);
40          int    (*DoDispense)(int User, int ID);
41 };
42
43 // === GLOBALS ===
44 extern tItem    *gaItems;
45 extern int      giNumItems;
46 extern tHandler *gaHandlers;
47
48 // === FUNCTIONS ===
49 // --- Logging ---
50 extern void     Log_Error(const char *Format, ...);
51 extern void     Log_Info(const char *Format, ...);
52
53 // --- Cokebank Functions ---
54 extern int      AlterBalance(int User, int Ammount);
55 extern int      GetBalance(int User);
56 extern char     *GetUserName(int User);
57
58 #endif

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