OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
NATify.h
1#if !defined(AFX_NATIFY_H__B8FF4369_8789_4674_8569_3D52CE8CA890__INCLUDED_)
2#define AFX_NATIFY_H__B8FF4369_8789_4674_8569_3D52CE8CA890__INCLUDED_
3
4#if _MSC_VER > 1000
5#pragma once
6#endif // _MSC_VER > 1000
7
8
9#define NATIFY_COOKIE 777
10#define NATIFY_TIMEOUT 10000
11#define NATIFY_STATUS_STEPS (NATIFY_TIMEOUT / 1000) + 7
12
13typedef enum { packet_map1a, packet_map2, packet_map3, packet_map1b, NUM_PACKETS } NatifyPacket;
14typedef enum { no_nat, firewall_only, full_cone, restricted_cone, port_restricted_cone, symmetric, unknown, NUM_NAT_TYPES } NatType;
15typedef enum { promiscuous, not_promiscuous, port_promiscuous, ip_promiscuous, promiscuity_not_applicable, NUM_PROMISCUITY_TYPES } NatPromiscuity;
16typedef enum { unrecognized, private_as_public, consistent_port, incremental, mixed, NUM_MAPPING_SCHEMES } NatMappingScheme;
17
18typedef struct _AddressMapping {
19 unsigned int privateIp;
20 unsigned short privatePort;
21 unsigned int publicIp;
22 unsigned short publicPort;
23} AddressMapping;
24
25typedef struct _NAT {
26 char brand[32];
27 char model[32];
28 char firmware[64];
29 gsi_bool ipRestricted;
30 gsi_bool portRestricted;
31 NatPromiscuity promiscuity;
32 NatType natType;
33 NatMappingScheme mappingScheme;
34 AddressMapping mappings[4];
35 gsi_bool qr2Compatible;
36} NAT;
37
38int DiscoverReachability(SOCKET sock, unsigned int ip, unsigned short port, int portType);
39int DiscoverMapping(SOCKET sock, unsigned int ip, unsigned short port, int portType, int id);
40int NatifyThink(SOCKET sock, NAT * nat);
41gsi_bool DetermineNatType(NAT * nat);
42void OutputMapping(const AddressMapping * theMap);
43
44
45#endif // !defined(AFX_NATIFY_H__B8FF4369_8789_4674_8569_3D52CE8CA890__INCLUDED_)
Definition NATify.h:18
Definition NATify.h:25