hlswmaster/plugins/gamespy2.c
Olaf Rempel 90d33bffbf Version 0.60
- added receive-queue
- changed plugin_helper api from void* to uint offsets
- gamespy1 multi-packet response support
- q3engine plugin rewrite
- added halflife plugin
2006-02-02 16:47:20 +01:00

57 lines
2.2 KiB
C

/***************************************************************************
* 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>
#include "plugin_helper.h"
static struct scan_ports port_arr[] = {
{ 2302, 2302, 30 }, /* halo(30) */
{ 3455, 3455, 37 }, /* painkiller(34) */
{ 0,0,0 }
};
static char scanmsg[] = { 0xFE, 0xFD, 0x00, 0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00 };
static char replymsg[] = { 0x00, 0xDE, 0xAD, 0xBE, 0xEF };
static int scan(void)
{
pkt_send_portarr(NULL, port_arr, scanmsg, sizeof(scanmsg));
return 1;
}
static int parse(struct net_pkt *pkt)
{
int gameid;
if (!(gameid = pkt_check_portarr(pkt, port_arr)))
return PARSE_REJECT;
if (pkt_memcmp(pkt, 0, replymsg, sizeof(replymsg)))
return PARSE_REJECT;
server_add_pkt(gameid, pkt);
return PARSE_ACCEPT;
}
struct hlswmaster_plugin plugin = {
.name = "gamespy2",
.scan = &scan,
.parse = &parse,
};