31 lines
574 B
C
Executable File
31 lines
574 B
C
Executable File
|
|
typedef enum tag_role{
|
|
SLAVE = 0,
|
|
MASTER = 1,
|
|
MASTER_CAND = 2,
|
|
} role_t;
|
|
|
|
typedef struct tag_status {
|
|
int sockid;
|
|
int floor;
|
|
int end_dest;
|
|
elev_state_t state;
|
|
role_t role;
|
|
int alive;
|
|
struct tag_status *next;
|
|
} status_t;
|
|
|
|
int get_master_cand_sock();
|
|
role_t get_role();
|
|
void set_role(role_t r);
|
|
void set_alive(int sock, int b);
|
|
void set_master_flag();
|
|
void set_master_sock(int sock);
|
|
int get_master_sock();
|
|
int get_master_cand_sock();
|
|
void master_init();
|
|
void add_slave(int sock);
|
|
void set_elev_state(int sock, char str[]);
|
|
int find_opt_elev(int call, int floor);
|
|
|