OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
nninternal.h
1#ifndef _NNINTERNAL_H_
2#define _NNINTERNAL_H_
3
4#include "natneg.h"
5#define MATCHUP1_HOSTNAME "natneg1." GSI_DOMAIN_NAME
6#define MATCHUP2_HOSTNAME "natneg2." GSI_DOMAIN_NAME
7#define MATCHUP3_HOSTNAME "natneg3." GSI_DOMAIN_NAME
8#define MATCHUP_PORT1 27901
9#define MATCHUP_PORT2 27901
10#define MATCHUP_PORT3 27901
11
12#define FINISHED_NOERROR 0
13#define FINISHED_ERROR_DEADBEAT_PARTNER 1
14#define FINISHED_ERROR_INIT_PACKETS_TIMEDOUT 2
15
16#define INIT_RETRY_TIME 500
17#define INIT_RETRY_COUNT 10
18#define NNINBUF_LEN 512
19#define PING_RETRY_TIME 700
20#define PING_RETRY_COUNT 7
21#define FINISHED_IDLE_TIME 5000
22#define PARTNER_WAIT_TIME 60000
23#define REPORT_RETRY_TIME 1000
24#define REPORT_RETRY_COUNT 5
25
26#define NN_PROTVER 3
27//#define NN_PROTVER 2
28
29#define NN_PT_GP 0
30#define NN_PT_NN1 1
31#define NN_PT_NN2 2
32#define NN_PT_NN3 3
33
34#define NN_INIT 0
35#define NN_INITACK 1
36#define NN_ERTTEST 2
37#define NN_ERTACK 3
38#define NN_STATEUPDATE 4
39#define NN_CONNECT 5
40#define NN_CONNECT_ACK 6
41#define NN_CONNECT_PING 7
42#define NN_BACKUP_TEST 8
43#define NN_BACKUP_ACK 9
44#define NN_ADDRESS_CHECK 10
45#define NN_ADDRESS_REPLY 11
46#define NN_NATIFY_REQUEST 12
47#define NN_REPORT 13
48#define NN_REPORT_ACK 14
49
50#if !defined(_PS2) && !defined(_NITRO)
51#pragma pack(1)
52#endif
53
54
55#define INITPACKET_SIZE BASEPACKET_SIZE + 9
56#define INITPACKET_ADDRESS_OFFSET BASEPACKET_SIZE + 3
57typedef struct _InitPacket
58{
59 unsigned char porttype;
60 unsigned char clientindex;
61 unsigned char usegameport;
62 unsigned int localip;
63 unsigned short localport;
64} InitPacket;
65
66#define REPORTPACKET_SIZE BASEPACKET_SIZE + 61
67typedef struct _ReportPacket
68{
69 unsigned char porttype;
70 unsigned char clientindex;
71 unsigned char negResult;
72 NatType natType;
73 NatMappingScheme natMappingScheme;
74 char gamename[50];
75} ReportPacket;
76
77#define CONNECTPACKET_SIZE BASEPACKET_SIZE + 8
78typedef struct _ConnectPacket
79{
80 unsigned int remoteIP;
81 unsigned short remotePort;
82 unsigned char gotyourdata;
83 unsigned char finished;
84} ConnectPacket;
85
86#define BASEPACKET_SIZE 12
87#define BASEPACKET_TYPE_OFFSET 7
88typedef struct _NatNegPacket {
89 // Base members:
90 unsigned char magic[NATNEG_MAGIC_LEN];
91 unsigned char version;
92 unsigned char packettype;
93 int cookie;
94
95 union
96 {
97 InitPacket Init;
98 ConnectPacket Connect;
99 ReportPacket Report;
100 } Packet;
101
102} NatNegPacket;
103
104
105#if !defined(_PS2) && !defined(_NITRO)
106#pragma pack()
107#endif
108
109#endif
Definition nninternal.h:79
Definition nninternal.h:58
Definition nninternal.h:88
Definition nninternal.h:68