50 lines
827 B
C
50 lines
827 B
C
|
#include "plugin.h"
|
||
|
|
||
|
#define GAMEID_Q3 0x0006
|
||
|
|
||
|
int scan(void) {
|
||
|
struct net_pkt *scan;
|
||
|
unsigned int port;
|
||
|
char msg[] = "\xff\xff\xff\xffgetstatus";
|
||
|
|
||
|
for (port = 27960; port <= 27963; port++) {
|
||
|
if (!(scan = pkt_factory(NULL, port, msg, 13)))
|
||
|
return 0;
|
||
|
|
||
|
pkt_queue(scan);
|
||
|
}
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
int parse(struct net_pkt *pkt) {
|
||
|
if (!pkt_strcmp(pkt, 0, "\xff\xff\xff\xffstatusResponse")) {
|
||
|
server_add(GAMEID_Q3, pkt->addr.sin_addr, pkt->addr.sin_port, 0);
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int init(struct list_head *config) {
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
int fini(void) {
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
static struct hlswmaster_plugin quake3_plugin = {
|
||
|
.name = "quake3",
|
||
|
.init = &init,
|
||
|
.fini = &fini,
|
||
|
.scan = &scan,
|
||
|
.parse = &parse,
|
||
|
};
|
||
|
|
||
|
void _init(void) {
|
||
|
register_plugin(&quake3_plugin);
|
||
|
}
|
||
|
|
||
|
void _fini(void) {
|
||
|
unregister_plugin(&quake3_plugin);
|
||
|
}
|