示例#1
0
static void
service_connect_comp_publish (void *cls,
			      struct GNUNET_TESTBED_Operation *op,
			      void *ca_result,
			      const char *emsg)
{	
  struct GNUNET_TIME_Relative timeout;
  const char *topic = "some6/IntLevel1/topic";
  const char *message = "test message";
	
  timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
                                           request_timeout);
  GNUNET_MQTT_publish (mqtt_handle_publish, strlen(topic) + 1, topic,
                       strlen(message) + 1, message, timeout, NULL,
                       NULL);
}
static void
service_connect_comp (void *cls, struct GNUNET_TESTBED_Operation *op,
		      void *ca_result,
		      const char *emsg)
{	
  struct GNUNET_TIME_Relative timeout;
  struct GNUNET_MQTT_SubscribeHandle *sh;
  const char *topic = "some/topic";
  const char *message = "test message";
  
  timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
                                           request_timeout);
  sh = GNUNET_MQTT_subscribe (mqtt_handle, strlen(topic) + 1, topic, timeout,
                         NULL, NULL,
                         subscribe_result_callback, NULL);
  GNUNET_MQTT_unsubscribe(sh);
  GNUNET_MQTT_publish (mqtt_handle, strlen(topic) + 1, topic,
                       strlen(message) + 1, message, timeout, NULL,
                       NULL);
  result = GNUNET_OK;				   
  GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), &shutdown_task, NULL);
}