ideas
authorChristian Grothoff <christian@grothoff.org>
Tue, 29 Mar 2011 11:50:08 +0000 (11:50 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 29 Mar 2011 11:50:08 +0000 (11:50 +0000)
src/include/Makefile.am
src/include/gnunet_applications.h [new file with mode: 0644]
src/include/gnunet_mesh_service.h

index ea12f333980222669ac322627ee458c33a9e7122..fcc106d10c299b84396bab9a44ad8f3b32e570a9 100644 (file)
@@ -17,6 +17,7 @@ gnunetinclude_HEADERS = \
   $(WINPROC) \
   block_dns.h \
   block_fs.h \
+  gnunet_applications.h \
   gnunet_arm_service.h \
   gnunet_bandwidth_lib.h \
   gnunet_bio_lib.h \
diff --git a/src/include/gnunet_applications.h b/src/include/gnunet_applications.h
new file mode 100644 (file)
index 0000000..6304a24
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+     This file is part of GNUnet.
+     (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
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file include/gnunet_applications.h
+ * @brief constants for network applications operating on top of the MESH service
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_APPLICATIONS_H
+#define GNUNET_APPLICATIONS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0                           /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * Test.
+ */
+#define GNUNET_APPLICATION_TYPE_TEST 1
+
+/**
+ * Internet DNS resolution (external DNS gateway).
+ */
+#define GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER 2
+
+/**
+ * Internet HTTP gateway (port 80).
+ */
+#define GNUNET_APPLICATION_TYPE_INTERNET_HTTP_GATEWAY 3
+
+/**
+ * Internet HTTPS gateway (port 443).
+ */
+#define GNUNET_APPLICATION_TYPE_INTERNET_HTTPS_GATEWAY 4
+
+/**
+ * Internet TCP gateway (any port).
+ */
+#define GNUNET_APPLICATION_TYPE_INTERNET_TCP_GATEWAY 5
+
+/**
+ * Internet UDP gateway (any port).
+ */
+#define GNUNET_APPLICATION_TYPE_INTERNET_UDP_GATEWAY 6
+
+/**
+ * GNUnet VPN Search Engine (searches HTTP sites hosted within GNUnet) [example]
+ */
+#define GNUNET_APPLICATION_TYPE_GNUNET_SEARCH 7
+
+
+#if 0                           /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+/* ifndef GNUNET_APPLICATIONS_H */
+#endif
+/* end of gnunet_applications.h */
index aefdd209a28cd44394bc747d28274f5a3e414b00..0c90f2105ebd523ed3a5330aa1a34b4b360369dc 100644 (file)
@@ -115,6 +115,12 @@ typedef void (GNUNET_MESH_TunnelEndHandler)(void *cls,
                                            void **tunnel_ctx);
 
 
+/**
+ * Type for an application.  Values defined in gnunet_applications.h
+ */
+typedef uint32_t GNUNET_MESH_ApplicationType;
+
+
 /**
  * Connect to the mesh service.
  *
@@ -132,8 +138,8 @@ struct GNUNET_MESH_Handle *
 GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
                      void *cls,
                     GNUNET_MESH_TunnelEndHandler cleaner,
-                     const struct GNUNET_MESH_MessageHandler *handlers);
-
+                     const struct GNUNET_MESH_MessageHandler *handlers
+                    const GNUNET_MESH_ServiceType *stypes);
 
 /**
  * Get the peer on the other side of this tunnel if it is just one. Return NULL otherwise
@@ -268,7 +274,7 @@ GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel,
  *
  * @param h mesh handle
  * @param timeout how long to try to establish a connection
- * @param message_type message type that must be supported by the peer (MESH should
+ * @param app_type application type that must be supported by the peer (MESH should
  *                discover peer in proximity handling this type)
  * @param connect_handler function to call on successful connect (or timeout);
  *                will be called for EACH of the peers in the list and
@@ -282,7 +288,7 @@ GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel,
 struct GNUNET_MESH_Tunnel *
 GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Handle *h,
                                          struct GNUNET_TIME_Relative timeout,
-                                         uint16_t message_type,
+                                         GNUNET_MESH_ApplicationType app_type,
                                          GNUNET_MESH_TunnelConnectHandler connect_handler,
                                          GNUNET_MESH_TunnelDisconnectHandler disconnect_handler,
                                          void *handler_cls);