75 lines
1.8 KiB
C
75 lines
1.8 KiB
C
/* =============================================================================
|
|
* # Server Transactions.
|
|
* Transactions in the contexts of a entity, is an action. This action could be
|
|
* anything that my include moving, shooting, douging, etc.
|
|
*
|
|
* Transactions take an entity id, action id, argsize and user
|
|
*
|
|
*
|
|
* =============================================================================
|
|
* */
|
|
#ifndef TRANSACTIONS_H
|
|
#define TRANSACTIONS_H
|
|
|
|
#define ENTITY_ACTION_MOVE 1
|
|
|
|
#define SERVER_PACKET 1
|
|
#define USER_PACKET 2
|
|
#define RELAY_PACKET 3
|
|
#define ADMIN_PACKET 4
|
|
|
|
typedef struct {
|
|
int packetTpye, size;
|
|
void* packet;
|
|
}packet;
|
|
|
|
typedef struct {
|
|
int id;
|
|
int action;
|
|
int userId;
|
|
int entityId;
|
|
int argsize;
|
|
void* userArg;
|
|
}user_transaction;
|
|
|
|
#define SERVER_T_CONNECT 0b0001
|
|
#define SERVER_T_DISCONNECT 0b0010
|
|
#define SERVER_T_RECONNECT 0b0011
|
|
#define SERVER_T_RELAY 0b0100
|
|
#define SERVER_T_KICK 0b0101
|
|
#define SERVER_T_REQUEST 0b0110
|
|
|
|
#define SERVER_T_USER_FLAG 0b00010000
|
|
#define SERVER_T_ADMIN_FLAG 0b00100000
|
|
#define SERVER_T_SERVER_FLAG 0b01000000
|
|
#define SERVER_T_RELAY_FLAG 0b10000000
|
|
|
|
#define SERVER_T_GET_PLAYER_DATA 1
|
|
#define SERVER_T_SET_PLAYER_ID 2
|
|
|
|
|
|
typedef struct {
|
|
int id;
|
|
int action;
|
|
int userId;
|
|
unsigned int ipaddress;
|
|
int argsize;
|
|
void* serverArg;
|
|
|
|
}server_transaction;
|
|
|
|
int GetTransaction(user_transaction* tract);
|
|
int ProssesTransaction(user_transaction* tract);
|
|
|
|
int SendServerTransaction(server_transaction* tract, int serverFD);
|
|
int SendUserTransaction(user_transaction* tract, int serverFD);
|
|
|
|
int RecvServerTransaction(server_transaction* tract, int serverFD);
|
|
int RecvUserTransaction(user_transaction* tract, int serverFD);
|
|
|
|
void FreeUserTransaction(user_transaction* ut);
|
|
void FreeServerTransaction(server_transaction* st);
|
|
|
|
#define TRANSACTIONS_H
|
|
#endif
|