1 /* 2 * Copyright (C) 2000 Ross Combs (rocombs@cs.nmsu.edu) 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_REALM_TYPES 19 #define INCLUDED_REALM_TYPES 20 21 #ifdef JUST_NEED_TYPES 22 #include "common/addr.h" 23 #include "connection.h" 24 # include "common/rcm.h" 25 #else 26 #define JUST_NEED_TYPES 27 #include "common/addr.h" 28 #include "connection.h" 29 # include "common/rcm.h" 30 #undef JUST_NEED_TYPES 31 #endif 32 33 struct connection; 34 35 typedef struct realm 36 #ifdef REALM_INTERNAL_ACCESS 37 { 38 char const * name; 39 char const * description; 40 unsigned int sessionnum; 41 unsigned int active; 42 unsigned int ip; 43 unsigned short port; 44 unsigned int player_number; 45 unsigned int game_number; 46 int tcp_sock; 47 struct connection * conn; 48 t_rcm rcm; 49 } 50 #endif 51 t_realm; 52 53 #endif 54 55 56 /*****/ 57 #ifndef JUST_NEED_TYPES 58 #ifndef INCLUDED_REALM_PROTOS 59 #define INCLUDED_REALM_PROTOS 60 61 #define JUST_NEED_TYPES 62 #include "common/list.h" 63 #include "common/addr.h" 64 #include "connection.h" 65 #include "common/rcm.h" 66 #undef JUST_NEED_TYPES 67 68 extern char const * realm_get_name(t_realm const * realm) ; 69 extern char const * realm_get_description(t_realm const * realm) ; 70 extern unsigned short realm_get_port(t_realm const * realm) ; 71 extern unsigned int realm_get_ip(t_realm const * realm) ; 72 extern int realm_set_name(t_realm * realm, char const * name); 73 extern unsigned int realm_get_active(t_realm const * realm); 74 extern unsigned int realm_get_player_number(t_realm const * realm); 75 extern int realm_add_player_number(t_realm * realm, int number); 76 extern unsigned int realm_get_game_number(t_realm const * realm); 77 extern int realm_add_game_number(t_realm * realm, int number); 78 extern int realm_set_active(t_realm * realm, unsigned int active); 79 extern int realm_active(t_realm * realm, struct connection * c); 80 extern int realm_deactive(t_realm * realm); 81 82 extern int realmlist_create(char const * filename); 83 extern int realmlist_destroy(void); 84 extern int realmlist_reload(char const * filename); 85 extern t_realm * realmlist_find_realm(char const * realmname); 86 extern t_realm * realmlist_find_realm_by_ip(unsigned long ip); /* ??? */ 87 extern t_list * realmlist(void); 88 89 extern struct connection * realm_get_conn(t_realm * realm); 90 91 extern t_realm * realm_get(t_realm * realm, t_rcm_regref * regref); 92 extern void realm_put(t_realm * realm, t_rcm_regref * regref); 93 94 #endif 95 #endif 96