/**
- * Message for connecting to peers offering a certain service.
+ * Message for connecting to peers offering a service, by service number.
*/
struct GNUNET_MESH_ConnectPeerByType
{
*/
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
/******************************************************************************/
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);
}