Debian Codegraph @

src/common/tag.h

raw symbols SCIP
1 /*
2 * Copyright (C) 1998 Mark Baysinger ([email protected])
3 * Copyright (C) 1998,1999,2000 Ross Combs ([email protected])
4 * Copyright (C) 2004 CreepLord ([email protected])
5 * Copyright (C) 2007 Pelish ([email protected])
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21 #ifndef INCLUDED_TAG_TYPES
22 #define INCLUDED_TAG_TYPES
23
24 #include <cstdint>
25 #include <string>
26
27 namespace pvpgn
28 {
29 using t_tag = std::uint32_t;
30 using t_archtag = t_tag;
31 using t_clienttag = t_tag;
32 using t_gamelang = t_tag;
33 }
34
35 typedef enum {
36 tag_wol_locale_unknown = 0,
37 tag_wol_locale_other = 1,
38 tag_wol_locale_usa = 2,
39 tag_wol_locale_canada = 3,
40 tag_wol_locale_uk = 4,
41 tag_wol_locale_germany = 5,
42 tag_wol_locale_france = 6,
43 tag_wol_locale_spain = 7,
44 tag_wol_locale_netherlands = 8,
45 tag_wol_locale_belgium = 9,
46 tag_wol_locale_austria = 10,
47 tag_wol_locale_switzerland = 11,
48 tag_wol_locale_italy = 12,
49 tag_wol_locale_denmark = 13,
50 tag_wol_locale_sweden = 14,
51 tag_wol_locale_norway = 15,
52 tag_wol_locale_finland = 16,
53 tag_wol_locale_israel = 17,
54 tag_wol_locale_south_africa = 18,
55 tag_wol_locale_japan = 19,
56 tag_wol_locale_south_korea = 20,
57 tag_wol_locale_china = 21,
58 tag_wol_locale_singapore = 22,
59 tag_wol_locale_taiwan = 23,
60 tag_wol_locale_malaysia = 24,
61 tag_wol_locale_australia = 25,
62 tag_wol_locale_new_zealand = 26,
63 tag_wol_locale_brazil = 27,
64 tag_wol_locale_thailand = 28,
65 tag_wol_locale_argentina = 29,
66 tag_wol_locale_philippines = 30,
67 tag_wol_locale_greece = 31,
68 tag_wol_locale_ireland = 32,
69 tag_wol_locale_poland = 33,
70 tag_wol_locale_portugal = 34,
71 tag_wol_locale_mexico = 35,
72 tag_wol_locale_russia = 36,
73 tag_wol_locale_turkey = 37
74 } t_tag_wol_locale;
75
76 #endif
77
78 /*****/
79 #ifndef JUST_NEED_TYPES
80 #ifndef INCLUDED_TAG_PROTOS
81 #define INCLUDED_TAG_PROTOS
82
83 /* Software tags */
84 #define CLIENTTAG_BNCHATBOT "CHAT" /* CHAT bot */
85 #define CLIENTTAG_BNCHATBOT_UINT 0x43484154
86 #define CLIENTTAG_STARCRAFT "STAR" /* Starcraft (original) */
87 #define CLIENTTAG_STARCRAFT_UINT 0x53544152
88 #define CLIENTTAG_BROODWARS "SEXP" /* Starcraft EXpansion Pack */
89 #define CLIENTTAG_BROODWARS_UINT 0x53455850
90 #define CLIENTTAG_SHAREWARE "SSHR" /* Starcraft Shareware */
91 #define CLIENTTAG_SHAREWARE_UINT 0x53534852
92 #define CLIENTTAG_DIABLORTL "DRTL" /* Diablo ReTaiL */
93 #define CLIENTTAG_DIABLORTL_UINT 0x4452544C
94 #define CLIENTTAG_DIABLOSHR "DSHR" /* Diablo SHaReware */
95 #define CLIENTTAG_DIABLOSHR_UINT 0x44534852
96 #define CLIENTTAG_WARCIIBNE "W2BN" /* WarCraft II Battle.net Edition */
97 #define CLIENTTAG_WARCIIBNE_UINT 0x5732424E
98 #define CLIENTTAG_DIABLO2DV "D2DV" /* Diablo II Diablo's Victory */
99 #define CLIENTTAG_DIABLO2DV_UINT 0x44324456
100 #define CLIENTTAG_STARJAPAN "JSTR" /* Starcraft (Japan) */
101 #define CLIENTTAG_STARJAPAN_UINT 0x4A535452
102 #define CLIENTTAG_DIABLO2ST "D2ST" /* Diablo II Stress Test */
103 #define CLIENTTAG_DIABLO2ST_UINT 0x44325354
104 #define CLIENTTAG_DIABLO2XP "D2XP" /* Diablo II Extension Pack */
105 #define CLIENTTAG_DIABLO2XP_UINT 0x44325850
106 /* FIXME: according to FSGS:
107 SJPN==Starcraft (Japanese)
108 SSJP==Starcraft (Japanese,Spawn)
109 */
110 #define CLIENTTAG_WARCRAFT3 "WAR3" /* WarCraft III */
111 #define CLIENTTAG_WARCRAFT3_UINT 0x57415233
112 #define CLIENTTAG_WAR3XP "W3XP" /* WarCraft III Expansion */
113 #define CLIENTTAG_WAR3XP_UINT 0x57335850
114
115 #define CLIENTTAG_IIRC "IIRC"/* IRC */
116 #define CLIENTTAG_IIRC_UINT 0x49495243
117
118 /* Westwood Online tags: */
119 #define CLIENTTAG_WCHAT "WCHT" /* Westwood Chat */
120 #define CLIENTTAG_WCHAT_UINT 0x57434854
121 #define CLIENTTAG_TIBERNSUN "TSUN" /* Tiberian Sun */
122 #define CLIENTTAG_TIBERNSUN_UINT 0x5453554E
123 #define CLIENTTAG_TIBSUNXP "TSXP" /* Tiberian Sun Extension Pack */
124 #define CLIENTTAG_TIBSUNXP_UINT 0x54535850
125 #define CLIENTTAG_REDALERT "RALT" /* Red Alert 1 */
126 #define CLIENTTAG_REDALERT_UINT 0x52414C54
127 #define CLIENTTAG_REDALERT2 "RAL2" /* Red Alert 2 */
128 #define CLIENTTAG_REDALERT2_UINT 0x52414C32
129 #define CLIENTTAG_DUNE2000 "DN2K" /* Dune 2000 */
130 #define CLIENTTAG_DUNE2000_UINT 0x444E324B
131 #define CLIENTTAG_NOX "NOXX" /* NOX */
132 #define CLIENTTAG_NOX_UINT 0x4E4F5858
133 #define CLIENTTAG_NOXQUEST "NOXQ" /* NOX Quest*/
134 #define CLIENTTAG_NOXQUEST_UINT 0x4E4F5851
135 #define CLIENTTAG_RENEGADE "RNGD" /* Renegade */
136 #define CLIENTTAG_RENEGADE_UINT 0x524E4744
137 #define CLIENTTAG_RENGDFDS "RFDS" /* Renegade Free Dedicated Server */
138 #define CLIENTTAG_RENGDFDS_UINT 0x52464453
139 #define CLIENTTAG_YURISREV "YURI" /* Yuri's Revenge */
140 #define CLIENTTAG_YURISREV_UINT 0x59555249
141 #define CLIENTTAG_EMPERORBD "EBFD" /* Emperor: Battle for Dune */
142 #define CLIENTTAG_EMPERORBD_UINT 0x45424644
143 #define CLIENTTAG_LOFLORE3 "LOR3" /* Lands of Lore 3 */
144 #define CLIENTTAG_LOFLORE3_UINT 0x4C4F5233
145 #define CLIENTTAG_WWOL "WWOL" /* Other Westwood Online games */
146 #define CLIENTTAG_WWOL_UINT 0x57574F4C
147
148 /* BNETD-specific software tags - we try to use lowercase to avoid collisions */
149 #define CLIENTTAG_FREECRAFT "free" /* FreeCraft http://www.freecraft.com/ */
150
151 #define CLIENTTAG_UNKNOWN "UNKN"
152 #define CLIENTTAG_UNKNOWN_UINT 0x554E4B4E
153
154 /* Architecture tags */
155 #define ARCHTAG_WINX86 "IX86" /* MS Windows on Intel x86 */
156 #define ARCHTAG_MACPPC "PMAC" /* MacOS on PowerPC */
157 #define ARCHTAG_OSXPPC "XMAC" /* MacOS X on PowerPC */
158
159 #define ARCHTAG_WINX86_UINT 0x49583836 /* IX86 */
160 #define ARCHTAG_MACPPC_UINT 0x504D4143 /* PMAC */
161 #define ARCHTAG_OSXPPC_UINT 0x584D4143 /* XMAC */
162
163 /* game languages */
164 #define GAMELANG_ENGLISH_UINT 0x656E5553 /* enUS */
165 #define GAMELANG_GERMAN_UINT 0x64654445 /* deDE */
166 #define GAMELANG_CZECH_UINT 0x6373435A /* csCZ */
167 #define GAMELANG_SPANISH_UINT 0x65734553 /* esES */
168 #define GAMELANG_FRENCH_UINT 0x66724652 /* frFR */
169 #define GAMELANG_ITALIAN_UINT 0x69744954 /* itIT */
170 #define GAMELANG_JAPANESE_UINT 0x6A614A41 /* jaJA */
171 #define GAMELANG_KOREAN_UINT 0x6B6F4B52 /* koKR */
172 #define GAMELANG_POLISH_UINT 0x706C504C /* plPL */
173 #define GAMELANG_RUSSIAN_UINT 0x72755255 /* ruRU */
174 #define GAMELANG_CHINESE_S_UINT 0x7A68434E /* zhCN */
175 #define GAMELANG_CHINESE_T_UINT 0x7A685457 /* zhTW */
176
177 #define TAG_UNKNOWN_UINT 0x554E4B4E /* UNKN */
178 #define TAG_UNKNOWN "UNKN"
179
180 /* Server tag */
181 #define BNETTAG "bnet" /* Battle.net */
182
183 /* Filetype tags (note these are "backwards") */
184 #define EXTENSIONTAG_PCX "xcp."
185 #define EXTENSIONTAG_SMK "kms."
186 #define EXTENSIONTAG_MNG "gnm."
187
188 namespace pvpgn
189 {
190
191 extern t_clienttag clienttag_str_to_uint(char const * clienttag);
192 extern char const * clienttag_uint_to_str(t_clienttag clienttag);
193 extern char const * clienttag_get_title(t_clienttag clienttag);
194
195 extern t_tag tag_str_to_uint(char const * tag_str);
196 extern t_tag tag_case_str_to_uint(char const * tag_str);
197 extern const char * tag_uint_to_str(char * tag_str, t_tag tag_uint);
198 extern std::string tag_uint_to_str2(t_tag tag_uint);
199 extern const char * tag_uint_to_revstr(char * tag_str, t_tag tag_uint);
200 extern int tag_check_arch(t_tag tag_uint);
201 extern int tag_check_client(t_tag tag_uint);
202 extern int tag_check_wolv1(t_tag tag_uint);
203 extern int tag_check_wolv2(t_tag tag_uint);
204 extern int tag_check_in_list(t_clienttag clienttag, const char * list);
205 extern t_clienttag tag_sku_to_uint(int sku);
206 extern t_clienttag tag_channeltype_to_uint(int channeltype);
207 extern t_tag tag_wol_locale_to_uint(int locale);
208 extern t_clienttag tag_validate_client(char const * client);
209 }
210
211 #endif
212 #endif