client_manager: add API for async operations
[oweals/gnunet.git] / src / include / gnunet_conversation_service.h
index cfe4a64ba22a6b79a76f1d07d590019e16e99120..c01f3b61545aced029bd4fc9f356c87b0d537eaf 100644 (file)
@@ -1,6 +1,6 @@
 /*
   This file is part of GNUnet
-  (C) 2013 Christian Grothoff (and other contributing authors)
+  Copyright (C) 2013, 2014 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
@@ -131,12 +131,13 @@ enum GNUNET_CONVERSATION_PhoneEventCode
  * @param cls closure
  * @param code type of the event
  * @param caller handle for the caller
- * @param caller_id name of the caller in GNS
+ * @param caller_id public key of the caller (in GNS)
  */
-typedef void (*GNUNET_CONVERSATION_PhoneEventHandler)(void *cls,
-                                                      enum GNUNET_CONVERSATION_PhoneEventCode code,
-                                                      struct GNUNET_CONVERSATION_Caller *caller,
-                                                      const char *caller_id);
+typedef void
+(*GNUNET_CONVERSATION_PhoneEventHandler)(void *cls,
+                                         enum GNUNET_CONVERSATION_PhoneEventCode code,
+                                         struct GNUNET_CONVERSATION_Caller *caller,
+                                         const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id);
 
 
 /**
@@ -172,8 +173,9 @@ enum GNUNET_CONVERSATION_CallerEventCode
  * @param cls closure
  * @param code type of the event for this caller
  */
-typedef void (*GNUNET_CONVERSATION_CallerEventHandler)(void *cls,
-                                                       enum GNUNET_CONVERSATION_CallerEventCode code);
+typedef void
+(*GNUNET_CONVERSATION_CallerEventHandler)(void *cls,
+                                          enum GNUNET_CONVERSATION_CallerEventCode code);
 
 
 /**
@@ -293,6 +295,7 @@ struct GNUNET_CONVERSATION_Call;
  */
 enum GNUNET_CONVERSATION_CallEventCode
 {
+
   /**
    * We are the caller and are now ringing the other party (GNS lookup
    * succeeded).
@@ -333,7 +336,14 @@ enum GNUNET_CONVERSATION_CallEventCode
    * both sides can independently suspend and resume calls; a call is
    * only "working" of both sides are active.
    */
-  GNUNET_CONVERSATION_EC_CALL_RESUMED
+  GNUNET_CONVERSATION_EC_CALL_RESUMED,
+
+  /**
+   * We had an error handing the call, and are now restarting it
+   * (back to lookup).  This happens, for example, if the peer
+   * is restarted during a call.
+   */
+  GNUNET_CONVERSATION_EC_CALL_ERROR
 
 };
 
@@ -344,8 +354,9 @@ enum GNUNET_CONVERSATION_CallEventCode
  * @param cls closure
  * @param code type of the event on the call
  */
-typedef void (*GNUNET_CONVERSATION_CallEventHandler)(void *cls,
-                                                     enum GNUNET_CONVERSATION_CallEventCode code);
+typedef void
+(*GNUNET_CONVERSATION_CallEventHandler)(void *cls,
+                                        enum GNUNET_CONVERSATION_CallEventCode code);
 
 
 /**
@@ -353,6 +364,7 @@ typedef void (*GNUNET_CONVERSATION_CallEventHandler)(void *cls,
  *
  * @param cfg configuration to use, specifies our phone service
  * @param caller_id identity of the caller
+ * @param zone_id GNS zone to use to resolve @a callee
  * @param callee GNS name of the callee (used to locate the callee's record)
  * @param speaker speaker to use (will be used automatically immediately once the
  *        #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated); we will NOT generate
@@ -361,10 +373,12 @@ typedef void (*GNUNET_CONVERSATION_CallEventHandler)(void *cls,
  *        #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated)
  * @param event_handler how to notify the owner of the phone about events
  * @param event_handler_cls closure for @a event_handler
+ * @return handle for the call
  */
 struct GNUNET_CONVERSATION_Call *
 GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                struct GNUNET_IDENTITY_Ego *caller_id,
+                               struct GNUNET_IDENTITY_Ego *zone_id,
                                const char *callee,
                                struct GNUNET_SPEAKER_Handle *speaker,
                                struct GNUNET_MICROPHONE_Handle *mic,