| 366 | #endif |
| 367 | |
| 368 | int main( int argc, const char **argv ) |
| 369 | { |
| 370 | SteamNetworkingIdentity identityLocal; identityLocal.Clear(); |
| 371 | SteamNetworkingIdentity identityRemote; identityRemote.Clear(); |
| 372 | const char *pszTrivialSignalingService = "localhost:10000"; |
| 373 | const char *pszSTUNServer = DEFAULT_STUN_SERVER; |
| 374 | const char *pszTURNServer = nullptr; |
| 375 | const char *pszTURNUsername = nullptr; |
| 376 | const char *pszTURNPassword = nullptr; |
| 377 | int g_nICEImplementation = -1; // -1 = not set, use library default |
| 378 | int g_nICEEnable = k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_All; |
| 379 | int nSignalingLossPct = 0; |
| 380 | int nSignalingDupPct = 0; |
| 381 | #ifdef STEAMNETWORKINGSOCKETS_ENABLE_MOCK |
| 382 | TEST_mocknetwork_config_t mockConfig; |
| 383 | int nCurrentMockLoss = 0; // applied to subsequently added adapters |
| 384 | #endif |
| 385 | |
| 386 | // Parse the command line |
| 387 | for ( int idxArg = 1 ; idxArg < argc ; ++idxArg ) |
| 388 | { |
| 389 | const char *pszSwitch = argv[idxArg]; |
| 390 | |
| 391 | auto GetArg = [&]() -> const char * { |
| 392 | if ( idxArg + 1 >= argc ) |
| 393 | TEST_Fatal( "Expected argument after %s", pszSwitch ); |
| 394 | return argv[++idxArg]; |
| 395 | }; |
| 396 | auto ParseIdentity = [&]( SteamNetworkingIdentity &x ) { |
| 397 | const char *pszArg = GetArg(); |
| 398 | if ( !x.ParseString( pszArg ) ) |
| 399 | TEST_Fatal( "'%s' is not a valid identity string", pszArg ); |
| 400 | }; |
| 401 | |
| 402 | if ( !strcmp( pszSwitch, "--identity-local" ) ) |
| 403 | ParseIdentity( identityLocal ); |
| 404 | else if ( !strcmp( pszSwitch, "--identity-remote" ) ) |
| 405 | ParseIdentity( identityRemote ); |
| 406 | else if ( !strcmp( pszSwitch, "--signaling-server" ) ) |
| 407 | pszTrivialSignalingService = GetArg(); |
| 408 | else if ( !strcmp( pszSwitch, "--stun-server" ) ) |
| 409 | pszSTUNServer = GetArg(); |
| 410 | else if ( !strcmp( pszSwitch, "--turn-server" ) ) |
| 411 | pszTURNServer = GetArg(); |
| 412 | else if ( !strcmp( pszSwitch, "--turn-username" ) ) |
| 413 | pszTURNUsername = GetArg(); |
| 414 | else if ( !strcmp( pszSwitch, "--turn-password" ) ) |
| 415 | pszTURNPassword = GetArg(); |
| 416 | else if ( !strcmp( pszSwitch, "--ice-implementation" ) ) |
| 417 | g_nICEImplementation = atoi( GetArg() ); |
| 418 | else if ( !strcmp( pszSwitch, "--ice-enable" ) ) |
| 419 | g_nICEEnable = atoi( GetArg() ); |
| 420 | else if ( !strcmp( pszSwitch, "--repeat" ) ) |
| 421 | g_nRepeat = atoi( GetArg() ); |
| 422 | else if ( !strcmp( pszSwitch, "--ticks" ) ) |
| 423 | g_nTicks = atoi( GetArg() ); |
| 424 | else if ( !strcmp( pszSwitch, "--expect-failure" ) ) |
| 425 | g_bExpectFailure = true; |
nothing calls this directly
no test coverage detected