Our deamon makes use of various structures to transport data within our application. This section summarizes those structures, tells you where they are defined and what they are good for.
The first one is structServerConfig that contains all the server settings. The names in this structure don't follow the code convention but are named like the configuration directives are. This to make it all more clear and later on expandable.
These structures are defined in
configurartion.h, so include that one if you want to make use of it. Most structures are globally defined so you prolly don't have to instantiate another one.
This is the layout of this structure:
struct structServerConfig
{
char ServerName[80];
char ServerListenIP[16];
unsigned int ServerPort;
char Motd[80];
char User[20];
char Group[20];
int MaxInstances;
double ClientTimeOut;
char* LogFile;
int verbose;
};
Next to the server settings there is a structure that handles the mysql settings. The names in this structure don't follow the code convention either but are named like the configuration directives are. This to make it all more clear and later on expandable. he following structure is therefore created:
struct structMysqlConfig
{
char MySQLServer[70];
char MySQLUsername[20];
char MySQLPassword[20];
char MySQLDatabase[30];
};
This structure is defined in ctsdconf.h.
To handle user information per connection there is a structure available as well:
#define MAX_USER_NAME 17
#define MAX_PASSWORD 33
struct structUser
{
long user_id;
char user_name[MAX_USER_NAME];
char user_password[MAX_PASSWORD];
};
This is a structure for activities:
struct structActivity
{
long activity_id;
long activity_parent_id;
char activity_name[256];
char* activity_description
};
There is an array defined in the program that has all the error messages. This array is a big array of structures. The following layout for the error messages is used:
struct structErrorDefs
{
int code;
char *message;
};
We also make use of various internal structures defined by "mysql.h". We wont specify them in more detail. Instead we point the reader to the the MySQL website.
This structure should include data about the state of the connection with a particular client. Up till now this structure only has one member, but that might grow in the future.
struct structConnection
{
long con_message_id;
};