struct GNUNET_CONVERSATION_Handle
{
- /**
- * Our configuration.
- */
+ /**
+ * Our configuration.
+ */
const struct GNUNET_CONFIGURATION_Handle *cfg;
- /**
- * Handle to the server connection, to send messages later
- */
+ /**
+ * Handle to the server connection, to send messages later
+ */
struct GNUNET_CLIENT_Connection *client;
- /**
- * GNS handle
- */
+ /**
+ * GNS handle
+ */
struct GNUNET_GNS_Handle *gns;
- /**
- * Namestore handle
- */
+ /**
+ * Namestore handle
+ */
struct GNUNET_NAMESTORE_Handle *namestore;
- /**
- * TXT record for gns
- */
+ /**
+ * TXT record for gns
+ */
int txt_record_set;
- /**
- * Callback for incoming calls
- */
+ /**
+ * Callback for incoming calls
+ */
GNUNET_CONVERSATION_CallHandler *call_handler;
- /**
- * Callback for rejected calls
- */
+ /**
+ * Callback for rejected calls
+ */
GNUNET_CONVERSATION_RejectHandler *reject_handler;
-
- /**
- * Callback for notifications
- */
+
+ /**
+ * Callback for notifications
+ */
GNUNET_CONVERSATION_NotificationHandler *notification_handler;
- /**
- * Callback for missed calls
- */
+ /**
+ * Callback for missed calls
+ */
GNUNET_CONVERSATION_MissedCallHandler *missed_call_handler;
- /**
- * The pointer to the call
- */
+ /**
+ * The pointer to the call
+ */
struct GNUNET_CONVERSATION_CallInformation *call;
};
{
h->txt_record_set = GNUNET_YES;
}
-
- return;
}
+
/**
-* Check if the gns txt record for conversation exits
-*/
+ * Check if the gns txt record for conversation exits
+ */
static void
check_gns (struct GNUNET_CONVERSATION_Handle *h)
{
- GNUNET_GNS_lookup (h->gns, "conversation.gads",
+ GNUNET_GNS_lookup (h->gns, "conversation.gns",
NULL /* FIXME_ZONE */,
GNUNET_DNSPARSER_TYPE_TXT,
GNUNET_NO,
NULL,
&check_gns_cb, h);
-
- return;
}
+
/******************************************************************************/
/*********************** RECEIVE HANDLERS ****************************/
/******************************************************************************/
* @param msg message received, NULL on timeout or fatal error
*/
static void
-receive_message_cb (void *cls, const struct GNUNET_MessageHeader *msg)
+receive_message_cb (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_CONVERSATION_Handle *h = cls;
struct ServerClientSessionInitiateMessage *imsg;
&transmit_session_accept_message, h);
}
+
/**
* Auxiliary function to reject a call.
*
&transmit_session_reject_message, h);
}
+
/**
* Auxiliary function to terminate a call.
*
h);
}
+
/**
-*
-*/
+ *
+ */
static void
gns_call_cb (void *cls, uint32_t rd_count,
const struct GNUNET_NAMESTORE_RecordData *rd)
/******************************************************************************/
struct GNUNET_CONVERSATION_Handle *
-GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls,
- GNUNET_CONVERSATION_CallHandler * call_handler,
- GNUNET_CONVERSATION_RejectHandler * reject_handler,
- GNUNET_CONVERSATION_NotificationHandler * notification_handler,
- GNUNET_CONVERSATION_MissedCallHandler * missed_call_handler)
+GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ void *cls,
+ GNUNET_CONVERSATION_CallHandler call_handler,
+ GNUNET_CONVERSATION_RejectHandler reject_handler,
+ GNUNET_CONVERSATION_NotificationHandler notification_handler,
+ GNUNET_CONVERSATION_MissedCallHandler missed_call_handler)
{
struct GNUNET_CONVERSATION_Handle *h;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "GNUNET_CONVERSATION_connect()\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "GNUNET_CONVERSATION_connect()\n");
h = GNUNET_malloc (sizeof (struct GNUNET_CONVERSATION_Handle));
h->cfg = cfg;
return h;
}
+
void
GNUNET_CONVERSATION_disconnect (struct GNUNET_CONVERSATION_Handle *handle)
{
initiate_call (h, peer);
}
+
void
GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *h)
{
terminate_call (h);
}
+
void
GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *h)
{
accept_call (h);
}
+
void
GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *h)
{
#define MAX_MESSAGE_LENGTH (32 * 1024)
/**
-* CONVERSATION handle
-*/
-struct GNUNET_CONVERSATION_Handle *conversation = NULL;
+ * CONVERSATION handle
+ */
+static struct GNUNET_CONVERSATION_Handle *conversation;
/**
-* Task which handles the commands
-*/
+ * Task which handles the commands
+ */
static GNUNET_SCHEDULER_TaskIdentifier handle_cmd_task;
/**
-* Function declareation for executing a action
-*/
-typedef int (*ActionFunction) (const char *argumetns, const void *xtra);
+ * Function declareation for executing a action
+ */
+typedef int (*ActionFunction) (const char *argumetns,
+ const void *xtra);
/**
* Structure which defines a command
const char *helptext;
};
-/******************************************************************************/
-/*********************** DECLARATIONS *************************/
-/******************************************************************************/
-
-static int do_help (const char *args, const void *xtra);
-/******************************************************************************/
-/*********************** Functions *************************/
-/******************************************************************************/
+static int
+do_help (const char *args,
+ const void *xtra);
/**
struct GNUNET_CONVERSATION_Handle *handle,
struct GNUNET_CONVERSATION_MissedCallNotification *missed_calls)
{
- FPRINTF (stdout, _("You have missed calls.\n"));
+ FPRINTF (stdout,
+ _("You have missed calls.\n"));
}
do_unknown (const char *msg,
const void *xtra)
{
- FPRINTF (stderr, _("Unknown command `%s'\n"), msg);
+ FPRINTF (stderr,
+ _("Unknown command `%s'\n"),
+ msg);
return GNUNET_OK;
}
do_call (const char *arg,
const void *xtra)
{
- char *callee = GNUNET_strdup (arg);
-
FPRINTF (stdout,
_("Initiating call to: %s\n"),
- callee);
+ arg);
GNUNET_CONVERSATION_call (conversation,
- callee,
+ arg,
GNUNET_YES);
return GNUNET_OK;
}
do_call_peer (const char *arg,
const void *xtra)
{
- char *callee = GNUNET_strdup (arg);
-
FPRINTF (stdout,
_("Initiating call to: %s\n"),
- callee);
- GNUNET_CONVERSATION_call (conversation, callee, GNUNET_NO);
-
+ arg);
+ GNUNET_CONVERSATION_call (conversation,
+ arg,
+ GNUNET_NO);
return GNUNET_OK;
}
* List of supported commands.
*/
static struct VoipCommand commands[] = {
- {"/call ", &do_call, gettext_noop ("Use `/call gads_record'")},
+ {"/call ", &do_call, gettext_noop ("Use `/call gns_name'")},
{"/callpeer ", &do_call_peer,
gettext_noop ("Use `/call private_key' to call a person")},
{"/accept", &do_accept,