|
|
@ -1,4 +1,4 @@
|
|
|
|
/* $Id: broadcast.c,v 1.6 2005/04/10 03:28:02 stpohle Exp $
|
|
|
|
/* $Id: broadcast.c,v 1.7 2007/12/12 19:27:35 stpohle Exp $
|
|
|
|
* find broadcasted games and also hold in this list
|
|
|
|
* find broadcasted games and also hold in this list
|
|
|
|
* all games which the ogc reports us */
|
|
|
|
* all games which the ogc reports us */
|
|
|
|
|
|
|
|
|
|
|
@ -16,6 +16,8 @@ struct broadcast_entry broadcast_list [BC_MAXENTRYS];
|
|
|
|
int broadcast_find (char *host, char *port) {
|
|
|
|
int broadcast_find (char *host, char *port) {
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf ("breadcast_find host:%s port:%s\n", host, port);
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; (((strncmp (host, broadcast_list[i].host, LEN_SERVERNAME) != 0)
|
|
|
|
for (i = 0; (((strncmp (host, broadcast_list[i].host, LEN_SERVERNAME) != 0)
|
|
|
|
|| (strncmp (port, broadcast_list[i].port, LEN_PORT) != 0))
|
|
|
|
|| (strncmp (port, broadcast_list[i].port, LEN_PORT) != 0))
|
|
|
|
&& (i < BC_MAXENTRYS)); i++);
|
|
|
|
&& (i < BC_MAXENTRYS)); i++);
|
|
|
@ -105,6 +107,7 @@ void broadcast_init () {
|
|
|
|
|
|
|
|
|
|
|
|
if (bman.broadcast)
|
|
|
|
if (bman.broadcast)
|
|
|
|
broadcast_send (NULL, NULL);
|
|
|
|
broadcast_send (NULL, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
bc_lastrequest = timestamp;
|
|
|
|
bc_lastrequest = timestamp;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -113,7 +116,6 @@ void broadcast_init () {
|
|
|
|
void broadcast_send (char *host, char *port) {
|
|
|
|
void broadcast_send (char *host, char *port) {
|
|
|
|
_net_addr addr;
|
|
|
|
_net_addr addr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (host != NULL && port != NULL) {
|
|
|
|
if (host != NULL && port != NULL) {
|
|
|
|
strncpy (addr.host, host, LEN_SERVERNAME);
|
|
|
|
strncpy (addr.host, host, LEN_SERVERNAME);
|
|
|
|
strncpy (addr.port, port, LEN_PORT);
|
|
|
|
strncpy (addr.port, port, LEN_PORT);
|
|
|
@ -123,7 +125,7 @@ void broadcast_send (char *host, char *port) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
sprintf (addr.port, "%d", DEFAULT_UDPPORT);
|
|
|
|
sprintf (addr.port, "%d", DEFAULT_UDPPORT);
|
|
|
|
strncpy (addr.host, "255.255.255.255", LEN_SERVERNAME);
|
|
|
|
strncpy (addr.host, "0.0.0.0", LEN_SERVERNAME);
|
|
|
|
d_printf ("broadcast_send (%s:%s)\n", addr.host, addr.port);
|
|
|
|
d_printf ("broadcast_send (%s:%s)\n", addr.host, addr.port);
|
|
|
|
dns_filladdr (addr.host, LEN_SERVERNAME, addr.port, LEN_PORT, bman.net_ai_family, &addr.sAddr);
|
|
|
|
dns_filladdr (addr.host, LEN_SERVERNAME, addr.port, LEN_PORT, bman.net_ai_family, &addr.sAddr);
|
|
|
|
send_gameinfo (&addr, bman.sock, 1);
|
|
|
|
send_gameinfo (&addr, bman.sock, 1);
|
|
|
|