gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22210 - in gnunet/src: include mesh


From: gnunet
Subject: [GNUnet-SVN] r22210 - in gnunet/src: include mesh
Date: Fri, 22 Jun 2012 16:13:52 +0200

Author: bartpolot
Date: 2012-06-22 16:13:52 +0200 (Fri, 22 Jun 2012)
New Revision: 22210

Modified:
   gnunet/src/include/gnunet_protocols.h
   gnunet/src/mesh/mesh_api.c
Log:
- add api for regex announce

Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h       2012-06-22 14:04:33 UTC (rev 
22209)
+++ gnunet/src/include/gnunet_protocols.h       2012-06-22 14:13:52 UTC (rev 
22210)
@@ -828,17 +828,22 @@
 /**
  * Ask the mesh service to add a peer described by a service string
  */
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_STRING 278
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_ANNOUNCE_REGEX   278
 
 /**
+ * Ask the mesh service to add a peer described by a service string
+ */
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_STRING 279
+
+/**
  * Ask the mesh service to add a peer to the blacklist of an existing tunnel
  */
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_BLACKLIST   279
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_BLACKLIST   280
 
 /**
  * Ask the mesh service to remove a peer from the blacklist of a tunnel
  */
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_UNBLACKLIST 280
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_UNBLACKLIST 281
 
 /**
  * 640kb should be enough for everybody

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2012-06-22 14:04:33 UTC (rev 22209)
+++ gnunet/src/mesh/mesh_api.c  2012-06-22 14:13:52 UTC (rev 22210)
@@ -1393,8 +1393,19 @@
                             const char *regex)
 {
   struct GNUNET_MessageHeader *msg;
-  
-  msg = GNUNET_malloc
+  size_t len;
+  size_t msgsize;
+
+  len = strlen (regex);
+  msgsize = sizeof(struct GNUNET_MessageHeader) + len;
+  GNUNET_assert (UINT16_MAX > msgsize);
+
+  msg = GNUNET_malloc (msgsize);
+  msg->size = htons (msgsize);
+  msg->type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ANNOUNCE_REGEX);
+  memcpy (&msg[1], regex, len);
+
+  send_packet(h, msg, NULL);
 }
 
 /**




reply via email to

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