[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37277 - gnunet/src/conversation
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37277 - gnunet/src/conversation |
Date: |
Sat, 18 Jun 2016 22:07:17 +0200 |
Author: grothoff
Date: 2016-06-18 22:07:17 +0200 (Sat, 18 Jun 2016)
New Revision: 37277
Modified:
gnunet/src/conversation/conversation_api_call.c
Log:
convert conversation_api_call.c
Modified: gnunet/src/conversation/conversation_api_call.c
===================================================================
--- gnunet/src/conversation/conversation_api_call.c 2016-06-18 20:04:18 UTC
(rev 37276)
+++ gnunet/src/conversation/conversation_api_call.c 2016-06-18 20:07:17 UTC
(rev 37277)
@@ -188,7 +188,7 @@
/**
- * We received a `struct ClientPhoneSuspendMessage`
+ * We received a #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND.
*
* @param cls the `struct GNUNET_CONVERSATION_Call`
* @param msg the message
@@ -195,7 +195,7 @@
*/
static void
handle_call_suspend (void *cls,
- const struct GNUNET_MessageHeader *msg)
+ const struct ClientPhoneSuspendMessage *msg)
{
struct GNUNET_CONVERSATION_Call *call = cls;
@@ -233,7 +233,7 @@
/**
- * We received a `struct ClientPhoneResumeMessage`
+ * We received a #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME.
*
* @param cls the `struct GNUNET_CONVERSATION_Call`
* @param msg the message
@@ -240,7 +240,7 @@
*/
static void
handle_call_resume (void *cls,
- const struct GNUNET_MessageHeader *msg)
+ const struct ClientPhoneResumeMessage *msg)
{
struct GNUNET_CONVERSATION_Call *call = cls;
@@ -282,7 +282,7 @@
/**
- * We received a `struct ClientPhonePickedupMessage`
+ * We received a #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP.
*
* @param cls the `struct GNUNET_CONVERSATION_Call`
* @param msg the message
@@ -289,7 +289,7 @@
*/
static void
handle_call_picked_up (void *cls,
- const struct GNUNET_MessageHeader *msg)
+ const struct ClientPhonePickedupMessage *msg)
{
struct GNUNET_CONVERSATION_Call *call = cls;
@@ -323,7 +323,7 @@
/**
- * We received a `struct ClientPhoneHangupMessage`
+ * We received a #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_HANG_UP.
*
* @param cls the `struct GNUNET_CONVERSATION_Call`
* @param msg the message
@@ -330,7 +330,7 @@
*/
static void
handle_call_hangup (void *cls,
- const struct GNUNET_MessageHeader *msg)
+ const struct ClientPhoneHangupMessage *msg)
{
struct GNUNET_CONVERSATION_Call *call = cls;
GNUNET_CONVERSATION_CallEventHandler eh;
@@ -360,6 +360,22 @@
/**
+ * We received a `struct ClientAudioMessage`, check it is well-formed.
+ *
+ * @param cls the `struct GNUNET_CONVERSATION_Call`
+ * @param msg the message
+ * @return #GNUNET_OK (always well-formed)
+ */
+static int
+check_call_audio (void *cls,
+ const struct ClientAudioMessage *am)
+{
+ /* any payload is OK */
+ return GNUNET_OK;
+}
+
+
+/**
* We received a `struct ClientAudioMessage`
*
* @param cls the `struct GNUNET_CONVERSATION_Call`
@@ -366,13 +382,11 @@
* @param msg the message
*/
static void
-handle_call_audio_message (void *cls,
- const struct GNUNET_MessageHeader *msg)
+handle_call_audio (void *cls,
+ const struct ClientAudioMessage *am)
{
struct GNUNET_CONVERSATION_Call *call = cls;
- const struct ClientAudioMessage *am;
- am = (const struct ClientAudioMessage *) msg;
switch (call->state)
{
case CS_LOOKUP:
@@ -394,7 +408,7 @@
break;
case CS_ACTIVE:
call->speaker->play (call->speaker->cls,
- ntohs (msg->size) - sizeof (struct
ClientAudioMessage),
+ ntohs (am->header.size) - sizeof (struct
ClientAudioMessage),
&am[1]);
break;
case CS_SHUTDOWN:
@@ -533,29 +547,33 @@
GNUNET_CONVERSATION_CallEventHandler
event_handler,
void *event_handler_cls)
{
- static struct GNUNET_MQ_MessageHandler handlers[] =
- {
- { &handle_call_suspend,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND,
- sizeof (struct ClientPhoneSuspendMessage) },
- { &handle_call_resume,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME,
- sizeof (struct ClientPhoneResumeMessage) },
- { &handle_call_picked_up,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP,
- sizeof (struct ClientPhonePickedupMessage) },
- { &handle_call_hangup,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
- sizeof (struct ClientPhoneHangupMessage) },
- { &handle_call_audio_message,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
- 0 },
- { NULL, 0, 0 }
+ struct GNUNET_CONVERSATION_Call *call
+ = GNUNET_new (struct GNUNET_CONVERSATION_Call);
+ GNUNET_MQ_hd_fixed_size (call_suspend,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND,
+ struct ClientPhoneSuspendMessage);
+ GNUNET_MQ_hd_fixed_size (call_resume,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME,
+ struct ClientPhoneResumeMessage);
+ GNUNET_MQ_hd_fixed_size (call_picked_up,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP,
+ struct ClientPhonePickedupMessage);
+ GNUNET_MQ_hd_fixed_size (call_hangup,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
+ struct ClientPhoneHangupMessage);
+ GNUNET_MQ_hd_var_size (call_audio,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
+ struct ClientAudioMessage);
+ struct GNUNET_MQ_MessageHandler handlers[] = {
+ make_call_suspend_handler (call),
+ make_call_resume_handler (call),
+ make_call_picked_up_handler (call),
+ make_call_hangup_handler (call),
+ make_call_audio_handler (call),
+ GNUNET_MQ_handler_end ()
};
struct GNUNET_CRYPTO_EcdsaPublicKey my_zone;
- struct GNUNET_CONVERSATION_Call *call;
- call = GNUNET_new (struct GNUNET_CONVERSATION_Call);
call->client = GNUNET_CLIENT_connect ("conversation", cfg);
if (NULL == call->client)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37277 - gnunet/src/conversation,
gnunet <=