aboutsummaryrefslogtreecommitdiff
path: root/src/social
diff options
context:
space:
mode:
authorpsyc://loupsycedyglgamf.onion/~lynX <BM-NB7xa9gEpmJgYp9PVnEdACiZcGmmEJcY>2017-02-02 09:21:58 +0000
committerpsyc://loupsycedyglgamf.onion/~lynX <BM-NB7xa9gEpmJgYp9PVnEdACiZcGmmEJcY>2017-02-02 09:21:59 +0000
commit437bebe1b239a93b74eaa92b9afd8f1c22624549 (patch)
tree375bc3d30894b948625a1923598e1ff92e8a7fd2 /src/social
parent2a79d2a8df64c33828f5cccec68e6cbb2062648a (diff)
downloadgnunet-437bebe1b239a93b74eaa92b9afd8f1c22624549.tar.gz
gnunet-437bebe1b239a93b74eaa92b9afd8f1c22624549.zip
gnunet-social CLI: porcelain status and psyc messages
Diffstat (limited to 'src/social')
-rw-r--r--src/social/gnunet-social.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c
index 6d72ca552..1da51243e 100644
--- a/src/social/gnunet-social.c
+++ b/src/social/gnunet-social.c
@@ -154,6 +154,8 @@ struct GNUNET_SOCIAL_Host *hst;
154struct GNUNET_SOCIAL_Guest *gst; 154struct GNUNET_SOCIAL_Guest *gst;
155struct GNUNET_SOCIAL_Place *plc; 155struct GNUNET_SOCIAL_Place *plc;
156 156
157const char *method_received;
158
157 159
158/* DISCONNECT */ 160/* DISCONNECT */
159 161
@@ -308,7 +310,7 @@ static void
308guest_left (void *cls) 310guest_left (void *cls)
309{ 311{
310 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 312 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
311 "The guest has left the place.\n"); 313 "Guest has left the place.\n");
312} 314}
313 315
314 316
@@ -555,10 +557,15 @@ slicer_recv_method (void *cls,
555 uint64_t message_id, 557 uint64_t message_id,
556 const char *method_name) 558 const char *method_name)
557{ 559{
560 method_received = method_name;
558 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 561 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
559 "Received method for message ID %" PRIu64 ":\n" 562 "Received method for message ID %" PRIu64 ":\n"
560 "%s (flags: %x)\n", 563 "%s (flags: %x)\n",
561 message_id, method_name, ntohl (meth->flags)); 564 message_id, method_name, ntohl (meth->flags));
565 /* routing header is missing, so we just print double newline */
566 printf(".\n\n");
567 /* we output . instead of | to indicate that this is not proper PSYC syntax */
568 /* FIXME: use libpsyc here */
562} 569}
563 570
564 571
@@ -576,10 +583,15 @@ slicer_recv_modifier (void *cls,
576 uint16_t value_size, 583 uint16_t value_size,
577 uint16_t full_value_size) 584 uint16_t full_value_size)
578{ 585{
586#if 0
579 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 587 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
580 "Received modifier for message ID %" PRIu64 ":\n" 588 "Received modifier for message ID %" PRIu64 ":\n"
581 "%c%s: %.*s (size: %u)\n", 589 "%c%s: %.*s (size: %u)\n",
582 message_id, oper, name, value_size, (const char *) value, value_size); 590 message_id, oper, name, value_size, (const char *) value, value_size);
591#endif
592 /* obviously not binary safe */
593 printf("%c%s\t%.*s\n",
594 oper, name, value_size, (const char *) value);
583} 595}
584 596
585 597
@@ -594,10 +606,15 @@ slicer_recv_data (void *cls,
594 const void *data, 606 const void *data,
595 uint16_t data_size) 607 uint16_t data_size)
596{ 608{
609#if 0
597 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 610 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
598 "Received data for message ID %" PRIu64 ":\n" 611 "Received data for message ID %" PRIu64 ":\n"
599 "%.*s\n", 612 "%.*s\n",
600 message_id, data_size, (const char *) data); 613 message_id, data_size, (const char *) data);
614#endif
615 /* obviously not binary safe */
616 printf("%s\n%.*s\n",
617 method_received, data_size, (const char *) data);
601} 618}
602 619
603 620
@@ -611,6 +628,7 @@ slicer_recv_eom (void *cls,
611 uint64_t message_id, 628 uint64_t message_id,
612 uint8_t is_cancelled) 629 uint8_t is_cancelled)
613{ 630{
631 printf(".\n");
614 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 632 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
615 "Received end of message ID %" PRIu64 633 "Received end of message ID %" PRIu64
616 ", cancelled: %u\n", 634 ", cancelled: %u\n",
@@ -685,7 +703,7 @@ guest_recv_local_enter (void *cls, int result,
685{ 703{
686 char *pub_str = GNUNET_CRYPTO_eddsa_public_key_to_string (pub_key); 704 char *pub_str = GNUNET_CRYPTO_eddsa_public_key_to_string (pub_key);
687 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 705 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
688 "Guest entered to local place: %s, max_message_id: %" PRIu64 "\n", 706 "Guest entered local place: %s, max_message_id: %" PRIu64 "\n",
689 pub_str, max_message_id); 707 pub_str, max_message_id);
690 GNUNET_free (pub_str); 708 GNUNET_free (pub_str);
691 GNUNET_assert (0 <= result); 709 GNUNET_assert (0 <= result);
@@ -1012,8 +1030,7 @@ app_recv_host (void *cls,
1012 enum GNUNET_SOCIAL_AppPlaceState place_state) 1030 enum GNUNET_SOCIAL_AppPlaceState place_state)
1013{ 1031{
1014 char *host_pub_str = GNUNET_CRYPTO_eddsa_public_key_to_string (host_pub_key); 1032 char *host_pub_str = GNUNET_CRYPTO_eddsa_public_key_to_string (host_pub_key);
1015 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1033 printf ("Host\t%s\n", host_pub_str);
1016 "Host: %s\n", host_pub_str);
1017 GNUNET_free (host_pub_str); 1034 GNUNET_free (host_pub_str);
1018 1035
1019 if ((op_host_reconnect || op_host_leave || op_host_announce || op_host_assign 1036 if ((op_host_reconnect || op_host_leave || op_host_announce || op_host_assign
@@ -1039,8 +1056,7 @@ app_recv_guest (void *cls,
1039 enum GNUNET_SOCIAL_AppPlaceState place_state) 1056 enum GNUNET_SOCIAL_AppPlaceState place_state)
1040{ 1057{
1041 char *guest_pub_str = GNUNET_CRYPTO_eddsa_public_key_to_string (guest_pub_key); 1058 char *guest_pub_str = GNUNET_CRYPTO_eddsa_public_key_to_string (guest_pub_key);
1042 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1059 printf ("Guest\t%s\n", guest_pub_str);
1043 "Guest: %s\n", guest_pub_str);
1044 GNUNET_free (guest_pub_str); 1060 GNUNET_free (guest_pub_str);
1045 1061
1046 if ((op_guest_reconnect || op_guest_leave || op_guest_talk 1062 if ((op_guest_reconnect || op_guest_leave || op_guest_talk
@@ -1065,7 +1081,7 @@ app_recv_ego (void *cls,
1065 const char *name) 1081 const char *name)
1066{ 1082{
1067 char *s = GNUNET_CRYPTO_ecdsa_public_key_to_string (pub_key); 1083 char *s = GNUNET_CRYPTO_ecdsa_public_key_to_string (pub_key);
1068 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Ego: %s\t%s\n", s, name); 1084 printf ("Ego\t%s\t%s\n", s, name);
1069 GNUNET_free (s); 1085 GNUNET_free (s);
1070 1086
1071 if (0 == memcmp (&ego_pub_key, pub_key, sizeof (*pub_key)) 1087 if (0 == memcmp (&ego_pub_key, pub_key, sizeof (*pub_key))
@@ -1124,6 +1140,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1124 || op_look_at || op_look_for)) 1140 || op_look_at || op_look_for))
1125 { 1141 {
1126 op_status = 1; 1142 op_status = 1;
1143 fputs("Caution: This tool does not produce correct binary safe PSYC syntax.\n\n", stderr);
1127 } 1144 }
1128 1145
1129 GNUNET_SCHEDULER_add_shutdown (scheduler_shutdown, NULL); 1146 GNUNET_SCHEDULER_add_shutdown (scheduler_shutdown, NULL);