typedef unsigned int MAGICNUM;
typedef unsigned short MSGLEN;
typedef unsigned short MSGID;
typedef char NAME[11];
typedef char PASSWORD[14];
typedef unsigned char PLAYERID;
typedef int VMONEY;
typedef unsigned short ERRMSGID;
typedef struct {
struct {
MAGICNUM magic_num;
MSGLEN len;
MSGID id;
} header;
union {
union {
struct {
NAME player_name;
PASSWORD player_password;
} request;
struct {
NAME player_name;
PLAYERID player_id;
VMONEY vmoney;
} accept;
struct {
NAME player_name;
ERRMSGID error_msg;
} reject;
} login;
/* Other message removed */
};
} TIN9NETMSG;
Since all packets are transmitted in the same platform of machines, no byte ordering has been considered so far. However, we have made the provision that byte ordering can be added by just modifying the routine netcom.c without affecting any other modules of the program.