/*
This file is part of GNUnet.
- (C) 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
+ (C) 2011 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
*/
/**
- * @file nat/nat.h
- * @brief Library handling UPnP and NAT-PMP port forwarding and
- * external IP address retrieval
- * @author Milan Bouchet-Valat
+ * @file src/nat/nat.h
+ * @brief Messages for interaction with gnunet-nat-server
+ * @author Christian Grothoff
+ *
*/
-
#ifndef NAT_H
#define NAT_H
+#include "gnunet_util_lib.h"
+
+#define DEBUG_NAT GNUNET_EXTRA_LOGGING
-#define DEBUG GNUNET_YES
+GNUNET_NETWORK_STRUCT_BEGIN
/**
- * Used to communicate with the UPnP and NAT-PMP plugins
+ * Request to test NAT traversal.
*/
-enum GNUNET_NAT_PortState
+struct GNUNET_NAT_TestMessage
{
- GNUNET_NAT_PORT_ERROR,
-
- /**
- * the port isn't forwarded
- */
- GNUNET_NAT_PORT_UNMAPPED,
-
- /**
- * we're cancelling the port forwarding
- */
- GNUNET_NAT_PORT_UNMAPPING,
+ /**
+ * Header with type "GNUNET_MESSAGE_TYPE_NAT_TEST"
+ */
+ struct GNUNET_MessageHeader header;
- /**
- * we're in the process of trying to set up port forwarding
- */
- GNUNET_NAT_PORT_MAPPING,
+ /**
+ * IPv4 target IP address
+ */
+ uint32_t dst_ipv4;
- /**
- * we've successfully forwarded the port
- */
- GNUNET_NAT_PORT_MAPPED
-};
+ /**
+ * Port to use, 0 to send dummy ICMP response.
+ */
+ uint16_t dport;
+ /**
+ * Data to send OR advertised-port (in NBO) to use for dummy ICMP.
+ */
+ uint16_t data;
-/**
- * Compare the sin(6)_addr fields of AF_INET or AF_INET(6) sockaddr.
- *
- * @param a first sockaddr
- * @param b second sockaddr
- * @return 0 if addresses are equal, non-null value otherwise
- */
-int GNUNET_NAT_cmp_addr (const struct sockaddr *a, const struct sockaddr *b);
+ /**
+ * GNUNET_YES for TCP, GNUNET_NO for UDP.
+ */
+ int32_t is_tcp;
+};
+GNUNET_NETWORK_STRUCT_END
#endif