Files
WoW-Hybrid-gateway/tests/source_local_realm_ports_test.c

22 lines
1.3 KiB
C

/* #129: LOCAL (profile 5) realmd lists several realms on the pinned host, each on its own world port
* (ThunderClan 8090, Hardcore 8091, PvP 8092). All must be selectable; other hosts and privileged ports not. */
#define GW_SOURCE_ONLY_PROFILE 5
#define GW_SOURCE_LOCAL_AUTH_IPV4 "127.0.0.1"
#define GW_SOURCE_LOCAL_REALM_IPV4 "192.168.122.1"
#define GW_SOURCE_LOCAL_REALM_PORT 8090
#include "../native/wine_source_resolver.c"
#include <stdio.h>
static int fails;
static void need(int ok,const char*what){if(!ok){printf("FAIL %s\n",what);++fails;}}
int main(void){
const unsigned char host[4]={192,168,122,1},other[4]={192,168,122,2};
need(gw_private_source_realm_endpoint_eligible(5,host,8090),"pinned realm port");
need(gw_private_source_realm_endpoint_eligible(5,host,8091),"second LOCAL realm (Hardcore 8091)");
need(gw_private_source_realm_endpoint_eligible(5,host,8092),"third LOCAL realm (PvP 8092)");
need(!gw_private_source_realm_endpoint_eligible(5,other,8090),"other host rejected");
need(!gw_private_source_realm_endpoint_eligible(5,host,80),"privileged port rejected");
need(!gw_private_source_realm_endpoint_eligible(5,0,8090),"null address rejected");
if(!fails)printf("local realm ports: every realm port on the pinned host selectable\n");
return fails!=0;
}