19#include "../common/gsCommon.h"
32#define NATNEG_MAGIC_LEN 6
33#define NN_MAGIC_0 0xFD
34#define NN_MAGIC_1 0xFC
35#define NN_MAGIC_2 0x1E
36#define NN_MAGIC_3 0x66
37#define NN_MAGIC_4 0x6A
38#define NN_MAGIC_5 0xB2
41extern unsigned char NNMagicData[];
48typedef enum {ns_initsent, ns_initack, ns_connectping, ns_finished, ns_canceled, ns_reportsent, ns_reportack } NegotiateState;
57typedef enum {nr_success, nr_deadbeatpartner, nr_inittimeout, nr_pingtimeout, nr_unknownerror, nr_noresult } NegotiateResult;
66typedef enum {ne_noerror, ne_allocerror, ne_socketerror, ne_dnserror} NegotiateError;
70typedef void (*NegotiateProgressFunc)(NegotiateState
state,
void *userdata);
73typedef void (*NegotiateCompletedFunc)(NegotiateResult result, SOCKET gamesocket,
struct sockaddr_in *remoteaddr,
void *userdata);
76typedef void (*NatDetectionResultsFunc)(gsi_bool success, NAT nat);
89NegotiateError NNBeginNegotiation(
int cookie,
int clientindex, NegotiateProgressFunc progresscallback, NegotiateCompletedFunc completedcallback,
void *userdata);
98NegotiateError NNBeginNegotiationWithSocket(SOCKET gamesocket,
int cookie,
int clientindex, NegotiateProgressFunc progresscallback, NegotiateCompletedFunc completedcallback,
void *userdata);
115void NNProcessData(
char *data,
int len,
struct sockaddr_in *fromaddr);
123void NNCancel(
int cookie);
133void NNFreeNegotiateList();
141NegotiateError NNStartNatDetection(NatDetectionResultsFunc resultscallback);
145extern char *Matchup2Hostname;
146extern char *Matchup1Hostname;