hlswmaster/plugins/quake3.c

66 lines
2.4 KiB
C
Raw Normal View History

2006-02-02 16:25:55 +01:00
/***************************************************************************
* Copyright (C) 03/2005 by Olaf Rempel *
* razzor@kopf-tisch.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <string.h>
2006-02-02 16:24:06 +01:00
#include "plugin.h"
2006-02-02 16:25:55 +01:00
struct scan_ports port_arr[] = {
{ 20099, 20110, 13 }, /* Soldier of Fortune 2 */
{ 27960, 27963, 6 }, /* Q3, Elite Force, RtCW, ET, CoD */
{ 28069, 28080, 12 }, /* Jedi Knight 2 */
{ 29069, 29080, 27 }, /* Jedi Knight 3 */
{ 29252, 29263, 26 }, /* Elite Force 2 */
{ 0,0,0 }
};
2006-02-02 16:24:06 +01:00
2006-02-02 16:25:55 +01:00
static char scanmsg[] = "\xff\xff\xff\xffgetstatus";
static char replymsg[] = "\xff\xff\xff\xffstatusResponse";
2006-02-02 16:24:06 +01:00
2006-02-02 16:25:55 +01:00
int scan(void) {
pkt_send_portarr(NULL, port_arr, scanmsg, strlen(scanmsg));
2006-02-02 16:24:06 +01:00
return 1;
}
int parse(struct net_pkt *pkt) {
2006-02-02 16:25:55 +01:00
int gameid;
2006-02-02 16:24:06 +01:00
2006-02-02 16:25:55 +01:00
if (pkt_memcmp(pkt, 0, replymsg, strlen(replymsg)))
return 0;
if (!(gameid = pkt_check_portarr(pkt, port_arr)))
return 0;
2006-02-02 16:24:06 +01:00
2006-02-02 16:25:55 +01:00
server_add_pkt(gameid, pkt);
2006-02-02 16:24:06 +01:00
return 1;
}
static struct hlswmaster_plugin quake3_plugin = {
.name = "quake3",
.scan = &scan,
.parse = &parse,
};
void _init(void) {
register_plugin(&quake3_plugin);
}
void _fini(void) {
unregister_plugin(&quake3_plugin);
}