gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22208 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r22208 - gnunet/src/mesh
Date: Fri, 22 Jun 2012 16:01:54 +0200

Author: bartpolot
Date: 2012-06-22 16:01:54 +0200 (Fri, 22 Jun 2012)
New Revision: 22208

Modified:
   gnunet/src/mesh/mesh.h
   gnunet/src/mesh/mesh_api.c
Log:
- api part of connect by string

Modified: gnunet/src/mesh/mesh.h
===================================================================
--- gnunet/src/mesh/mesh.h      2012-06-22 12:54:34 UTC (rev 22207)
+++ gnunet/src/mesh/mesh.h      2012-06-22 14:01:54 UTC (rev 22208)
@@ -191,7 +191,7 @@
 
 
 /**
- * Message for connecting to peers offering a certain service.
+ * Message for connecting to peers offering a service, by service number.
  */
 struct GNUNET_MESH_ConnectPeerByType
 {
@@ -211,6 +211,25 @@
    */
   GNUNET_MESH_ApplicationType type GNUNET_PACKED;
 };
+
+
+/**
+ * Message for connecting to peers offering a service, by service string.
+ */
+struct GNUNET_MESH_ConnectPeerByString
+{
+    /**
+     * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_STRING
+     */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * ID of a tunnel controlled by this client.
+   */
+  MESH_TunnelNumber tunnel_id GNUNET_PACKED;
+
+  /* String describing the service */
+};
 GNUNET_NETWORK_STRUCT_END
 
 
/******************************************************************************/

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2012-06-22 12:54:34 UTC (rev 22207)
+++ gnunet/src/mesh/mesh_api.c  2012-06-22 14:01:54 UTC (rev 22208)
@@ -1591,7 +1591,18 @@
 GNUNET_MESH_peer_request_connect_by_string (struct GNUNET_MESH_Tunnel *tunnel,
                                             const char *description)
 {
-  
+  struct GNUNET_MESH_ConnectPeerByString *msg;
+  size_t len;
+  size_t msgsize;
+
+  len = strlen(description);
+  msgsize = sizeof(struct GNUNET_MESH_ConnectPeerByString) + len;
+  GNUNET_assert (UINT16_MAX > msgsize);
+  msg = GNUNET_malloc (msgsize);
+  msg->header.size = htons (msgsize);
+  msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_STRING);
+  msg->tunnel_id = htonl (tunnel->tid);
+  memcpy(&msg[1], description, len);
 }
 
 




reply via email to

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