gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r38190 - gnunet/src/nat


From: gnunet
Subject: [GNUnet-SVN] r38190 - gnunet/src/nat
Date: Sun, 23 Oct 2016 21:16:26 +0200

Author: grothoff
Date: 2016-10-23 21:16:26 +0200 (Sun, 23 Oct 2016)
New Revision: 38190

Modified:
   gnunet/src/nat/nat.h
Log:
specing out the NAT service IPC messages'


Modified: gnunet/src/nat/nat.h
===================================================================
--- gnunet/src/nat/nat.h        2016-10-23 17:49:49 UTC (rev 38189)
+++ gnunet/src/nat/nat.h        2016-10-23 19:16:26 UTC (rev 38190)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2011 GNUnet e.V.
+     Copyright (C) 2011, 2016 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -66,8 +66,38 @@
 
 
 /**
- *
+ * Flags specifying the events this client would be
+ * interested in being told about.
  */
+enum GNUNET_NAT_RegisterFlags
+{
+  /**
+   * This client does not want any notifications.
+   */
+  GNUNET_NAT_RF_NONE = 0,
+
+  /**
+   * This client wants to be informed about our IPv4 address
+   * changing.
+   */
+  GNUNET_NAT_RF_IPV4 = 1,
+
+  /**
+   * This client wants to be informed about changes to our
+   * external addresses.
+   */
+  GNUNET_NAT_RF_ADDRESSES = 2,
+
+  /**
+   * This client supports address reversal.
+   */
+  GNUNET_NAT_RF_REVERSAL = 4
+};
+
+
+/**
+ * Message sent by a client to register with its addresses.
+ */
 struct GNUNET_NAT_RegisterMessage
 {
   /**
@@ -74,11 +104,38 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_REGISTER
    */
   struct GNUNET_MessageHeader header;
+
+  /**
+   * An `enum GNUNET_NAT_RegisterFlags`.
+   */
+  uint8_t flags GNUNET_PACKED;
+
+  /**
+   * Client's IPPROTO, e.g. IPPROTO_UDP or IPPROTO_TCP.
+   */
+  uint8_t proto GNUNET_PACKED;
+
+  /**
+   * Port we would like as we are configured to use this one for
+   * advertising (in addition to the one we are binding to).
+   */
+  uint16_t adv_port GNUNET_PACKED;
+
+  /**
+   * Number of addresses that this service is bound to that follow.
+   * Given as an array of "struct sockaddr" entries, the size of
+   * each entry being determined by the "sa_family" at the beginning.
+   */
+  uint16_t num_addrs GNUNET_PACKED;
+
+  /* Followed by @e num_addrs addresses of type 'struct
+     sockaddr' */
+  
 };
 
 
 /**
- *
+ * Client telling the service to (possibly) handle a STUN message.
  */
 struct GNUNET_NAT_HandleStunMessage
 {
@@ -86,11 +143,25 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_HANDLE_STUN
    */
   struct GNUNET_MessageHeader header;
+
+  /**
+   * Size of the sender address included, in NBO.
+   */
+  uint16_t sender_addr_size;
+
+  /**
+   * Number of bytes of payload included, in NBO.
+   */
+  uint16_t payload_size;
+
+  /* followed by a `struct sockaddr` of @e sender_addr_size bytes */
+
+  /* followed by payload with @e payload_size bytes */
 };
 
 
 /**
- *
+ * Client asking the service to initiate connection reversal.
  */
 struct GNUNET_NAT_RequestConnectionReversalMessage
 {
@@ -98,11 +169,26 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL
    */
   struct GNUNET_MessageHeader header;
+
+  /**
+   * Size of the local address included, in NBO.
+   */
+  uint16_t local_addr_size;
+
+  /**
+   * Size of the remote address included, in NBO.
+   */
+  uint16_t remote_addr_size;
+
+  /* followed by a `struct sockaddr` of @e local_addr_size bytes */
+
+  /* followed by a `struct sockaddr` of @e remote_addr_size bytes */
+
 };
 
 
 /**
- *
+ * Service telling a client that connection reversal was requested.
  */
 struct GNUNET_NAT_ConnectionReversalRequestedMessage
 {
@@ -110,11 +196,27 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_CONNECTION_REVERSAL_REQUESTED
    */
   struct GNUNET_MessageHeader header;
+
+  /**
+   * Size of the local address where we received the request, in NBO.
+   */
+  uint16_t local_addr_size;
+
+  /**
+   * Size of the remote address making the request, in NBO.
+   */
+  uint16_t remote_addr_size;
+
+  /* followed by a `struct sockaddr` of @e local_addr_size bytes */
+
+  /* followed by a `struct sockaddr` of @e remote_addr_size bytes */
+  
 };
 
 
 /**
- *
+ * Service notifying the client about changes in the set of 
+ * addresses it has.
  */
 struct GNUNET_NAT_AddressChangeNotificationMessage
 {
@@ -122,11 +224,20 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE
    */
   struct GNUNET_MessageHeader header;
+
+  /**
+   * #GNUNET_YES to add, #GNUNET_NO to remove the address from the list.
+   */ 
+  int32_t add_remove GNUNET_PACKED;
+
+  /* followed by a `struct sockaddr` */
+  
 };
 
 
 /**
- *
+ * Service notifying the client about a change of our
+ * known external IPv4 address.
  */
 struct GNUNET_NAT_Ipv4ChangeNotificationMessage
 {
@@ -134,11 +245,22 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_IPV4_CHANGE
    */
   struct GNUNET_MessageHeader header;
+
+  /**
+   * #GNUNET_YES to add, #GNUNET_NO to remove the address from the list.
+   */ 
+  int32_t add_remove GNUNET_PACKED;
+
+  /**
+   * IPv4 address affected.
+   */
+  struct in_addr addr GNUNET_PACKED;
+  
 };
 
 
 /**
- *
+ * Client requesting test of network connectivity.
  */
 struct GNUNET_NAT_RequestTestMessage
 {
@@ -146,11 +268,37 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_TEST
    */
   struct GNUNET_MessageHeader header;
+
+  /**
+   * Port to bind to, in NBO
+   */
+  uint16_t bind_port GNUNET_PACKED;
+
+  /**
+   * Port external verifier should try to connect to, in NBO.
+   */
+  uint16_t extern_port GNUNET_PACKED;
+
+  /**
+   * IPv4 to bind to, in NBO.
+   */
+  struct in_addr bind_ip GNUNET_PACKED;
+
+  /**
+   * IPv4 external verifier should try to connect to, in NBO.
+   */
+  struct in_addr extern_ip GNUNET_PACKED;
+  
+  /**
+   * IP protocol to use, i.e. IPPROTO_UDP or IPPROTO_TCP.
+   */
+  uint8_t proto;
+
 };
 
 
 /**
- *
+ * Service responding with network connectivity test result.
  */
 struct GNUNET_NAT_TestResultMessage
 {
@@ -158,11 +306,16 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_TEST_RESULT
    */
   struct GNUNET_MessageHeader header;
+
+  /**
+   * An `enum GNUNET_NAT_StatusCode` in NBO.
+   */
+  int32_t status_code GNUNET_PACKED;
 };
 
 
 /**
- *
+ * Client requesting automatic configuration.
  */
 struct GNUNET_NAT_AutoconfigRequestMessage
 {
@@ -170,11 +323,14 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG
    */
   struct GNUNET_MessageHeader header;
+
+  /* Followed by configuration (diff, serialized, compressed) */
+  
 };
 
 
 /**
- *
+ * Service responding with proposed configuration.
  */
 struct GNUNET_NAT_AutoconfigResultMessage
 {
@@ -182,6 +338,18 @@
    * Header with type #GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT
    */
   struct GNUNET_MessageHeader header;
+  
+  /**
+   * An `enum GNUNET_NAT_StatusCode` in NBO.
+   */
+  int32_t status_code GNUNET_PACKED;
+
+  /**
+   * An `enum GNUNET_NAT_Type` in NBO.
+   */
+  int32_t type GNUNET_PACKED;
+
+  /* Followed by configuration (diff, serialized, compressed) */
 };
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]