| 1 |
sysadm |
1.1 |
/*
|
| 2 |
|
|
* Copyright (C) 2000,2001 Onlyer (onlyer@263.net)
|
| 3 |
|
|
*
|
| 4 |
|
|
* This program is free software; you can redistribute it and/or
|
| 5 |
|
|
* modify it under the terms of the GNU General Public License
|
| 6 |
|
|
* as published by the Free Software Foundation; either version 2
|
| 7 |
|
|
* of the License, or (at your option) any later version.
|
| 8 |
|
|
*
|
| 9 |
|
|
* This program is distributed in the hope that it will be useful,
|
| 10 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
|
|
* GNU General Public License for more details.
|
| 13 |
|
|
*
|
| 14 |
|
|
* You should have received a copy of the GNU General Public License
|
| 15 |
|
|
* along with this program; if not, write to the Free Software
|
| 16 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 17 |
|
|
*/
|
| 18 |
|
|
#ifndef INCLUDED_D2GS_H
|
| 19 |
|
|
#define INCLUDED_D2GS_H
|
| 20 |
|
|
|
| 21 |
|
|
#include "common/list.h"
|
| 22 |
|
|
#include "connection.h"
|
| 23 |
|
|
|
| 24 |
|
|
typedef enum
|
| 25 |
|
|
{
|
| 26 |
|
|
d2gs_state_none,
|
| 27 |
|
|
d2gs_state_connected,
|
| 28 |
|
|
d2gs_state_authed
|
| 29 |
|
|
} t_d2gs_state;
|
| 30 |
|
|
|
| 31 |
|
|
typedef struct d2gs
|
| 32 |
|
|
{
|
| 33 |
|
|
unsigned int ip;
|
| 34 |
|
|
unsigned int id;
|
| 35 |
|
|
unsigned int flag;
|
| 36 |
|
|
unsigned int active;
|
| 37 |
|
|
unsigned int token;
|
| 38 |
|
|
t_d2gs_state state;
|
| 39 |
|
|
unsigned int maxgame;
|
| 40 |
|
|
unsigned int gamenum;
|
| 41 |
|
|
t_connection * connection;
|
| 42 |
|
|
} t_d2gs;
|
| 43 |
|
|
|
| 44 |
|
|
#define D2GS_FLAG_VALID 0x01
|
| 45 |
|
|
|
| 46 |
|
|
extern t_list * d2gslist(void);
|
| 47 |
|
|
extern int d2gslist_create(void);
|
| 48 |
|
|
extern int d2gslist_destroy(void);
|
| 49 |
|
|
extern int d2gslist_reload(char const * gslist);
|
| 50 |
|
|
extern t_d2gs * d2gs_create(char const * ip);
|
| 51 |
|
|
extern int d2gs_destroy(t_d2gs * gs,t_elem ** curr);
|
| 52 |
|
|
extern t_d2gs * d2gslist_get_server_by_id(unsigned int id);
|
| 53 |
|
|
extern t_d2gs * d2gslist_choose_server(t_connection * c);
|
| 54 |
|
|
extern t_d2gs * d2gslist_find_gs(unsigned int id);
|
| 55 |
|
|
extern t_d2gs * d2gslist_find_gs_by_ip(unsigned int ip);
|
| 56 |
|
|
extern unsigned int d2gs_get_id(t_d2gs const * gs);
|
| 57 |
|
|
extern unsigned int d2gs_get_ip(t_d2gs const * gs);
|
| 58 |
|
|
extern t_d2gs_state d2gs_get_state(t_d2gs const * gs);
|
| 59 |
|
|
extern int d2gs_set_state(t_d2gs * gs, t_d2gs_state state);
|
| 60 |
|
|
extern unsigned int d2gs_get_maxgame(t_d2gs const * gs);
|
| 61 |
|
|
extern int d2gs_set_maxgame(t_d2gs * gs,unsigned int maxgame);
|
| 62 |
|
|
extern unsigned int d2gs_get_gamenum(t_d2gs const * gs);
|
| 63 |
|
|
extern int d2gs_add_gamenum(t_d2gs * gs,int number);
|
| 64 |
|
|
extern unsigned int d2gs_get_token(t_d2gs const * gs);
|
| 65 |
|
|
extern unsigned int d2gs_make_token(t_d2gs * gs);
|
| 66 |
|
|
extern t_connection * d2gs_get_connection(t_d2gs const * gs);
|
| 67 |
|
|
extern int d2gs_active(t_d2gs * gs, t_connection * c);
|
| 68 |
|
|
extern int d2gs_deactive(t_d2gs * gs, t_connection * c);
|
| 69 |
|
|
extern unsigned int d2gs_calc_checksum(t_connection * c);
|
| 70 |
|
|
extern int d2gs_keepalive(void);
|
| 71 |
|
|
extern int d2gs_restart_all_gs(void);
|
| 72 |
|
|
extern int serve_scope_list_load(const char *filename);
|
| 73 |
|
|
extern void serve_scope_list_unload(void);
|
| 74 |
|
|
extern int serve_scope_list_validate(unsigned int ip, t_connection *c);
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
#define D2GS_MAJOR_VERSION_MASK 0xffffff00
|
| 78 |
|
|
|
| 79 |
|
|
#endif
|