aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-cadet.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-01-26 20:49:59 +0100
committerChristian Grothoff <christian@grothoff.org>2019-01-26 20:49:59 +0100
commit7fc78674a6d3f2edb41e32cea59200908d0b344b (patch)
treeb99608184fa08dcc6cd3e297369cb2761a03524f /src/cadet/gnunet-cadet.c
parenta5a54c51011a9498e72b2a9341b35333c6beef1a (diff)
downloadgnunet-7fc78674a6d3f2edb41e32cea59200908d0b344b.tar.gz
gnunet-7fc78674a6d3f2edb41e32cea59200908d0b344b.zip
starting with #5385 in earnest
Diffstat (limited to 'src/cadet/gnunet-cadet.c')
-rw-r--r--src/cadet/gnunet-cadet.c91
1 files changed, 35 insertions, 56 deletions
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c
index ccc757d7e..b36113318 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -72,11 +72,6 @@ static char *listen_port;
72static int echo; 72static int echo;
73 73
74/** 74/**
75 * Request a debug dump
76 */
77static int dump;
78
79/**
80 * Time of last echo request. 75 * Time of last echo request.
81 */ 76 */
82static struct GNUNET_TIME_Absolute echo_time; 77static struct GNUNET_TIME_Absolute echo_time;
@@ -102,6 +97,11 @@ static char *target_port = "default";
102static struct GNUNET_CADET_Handle *mh; 97static struct GNUNET_CADET_Handle *mh;
103 98
104/** 99/**
100 * Our configuration.
101 */
102static const struct GNUNET_CONFIGURATION_Handle *my_cfg;
103
104/**
105 * Channel handle. 105 * Channel handle.
106 */ 106 */
107static struct GNUNET_CADET_Channel *ch; 107static struct GNUNET_CADET_Channel *ch;
@@ -396,20 +396,6 @@ send_echo (void *cls)
396 396
397 397
398/** 398/**
399 * Call CADET's monitor API, request debug dump on the service.
400 *
401 * @param cls Closure (unused).
402 */
403static void
404request_dump (void *cls)
405{
406 job = NULL;
407 GNUNET_CADET_request_dump (mh);
408 GNUNET_SCHEDULER_shutdown ();
409}
410
411
412/**
413 * Check data message sanity. Does nothing so far (all messages are OK). 399 * Check data message sanity. Does nothing so far (all messages are OK).
414 * 400 *
415 * @param cls Closure (unused). 401 * @param cls Closure (unused).
@@ -683,7 +669,11 @@ static void
683get_peers (void *cls) 669get_peers (void *cls)
684{ 670{
685 job = NULL; 671 job = NULL;
686 GNUNET_CADET_get_peers (mh, &peers_callback, NULL); 672#if FIXME5385
673 GNUNET_CADET_list_peers (my_cfg,
674 &peers_callback,
675 NULL);
676#endif
687} 677}
688 678
689 679
@@ -709,7 +699,12 @@ show_peer (void *cls)
709 GNUNET_SCHEDULER_shutdown(); 699 GNUNET_SCHEDULER_shutdown();
710 return; 700 return;
711 } 701 }
712 GNUNET_CADET_get_peer (mh, &pid, peer_callback, NULL); 702#if FIXME5385
703 GNUNET_CADET_get_peer (my_cfg,
704 &pid,
705 &peer_callback,
706 NULL);
707#endif
713} 708}
714 709
715 710
@@ -722,7 +717,11 @@ static void
722get_tunnels (void *cls) 717get_tunnels (void *cls)
723{ 718{
724 job = NULL; 719 job = NULL;
725 GNUNET_CADET_get_tunnels (mh, &tunnels_callback, NULL); 720#if FIXME5385
721 GNUNET_CADET_list_tunnels (my_cfg,
722 &tunnels_callback,
723 NULL);
724#endif
726} 725}
727 726
728 727
@@ -748,10 +747,12 @@ show_tunnel (void *cls)
748 GNUNET_SCHEDULER_shutdown (); 747 GNUNET_SCHEDULER_shutdown ();
749 return; 748 return;
750 } 749 }
751 GNUNET_CADET_get_tunnel (mh, 750#if FIXME5385
751 GNUNET_CADET_get_tunnel (my_cfg,
752 &pid, 752 &pid,
753 &tunnel_callback, 753 &tunnel_callback,
754 NULL); 754 NULL);
755#endif
755} 756}
756 757
757 758
@@ -804,7 +805,7 @@ run (void *cls,
804 }; 805 };
805 806
806 /* FIXME add option to monitor apps */ 807 /* FIXME add option to monitor apps */
807 808 my_cfg = cfg;
808 target_id = args[0]; 809 target_id = args[0];
809 if (target_id && args[1]) 810 if (target_id && args[1])
810 target_port = args[1]; 811 target_port = args[1];
@@ -821,14 +822,7 @@ run (void *cls,
821 return; 822 return;
822 } 823 }
823 824
824 if (GNUNET_YES == dump) 825 if (NULL != peer_id)
825 {
826 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
827 "Requesting debug dump\n");
828 job = GNUNET_SCHEDULER_add_now (&request_dump,
829 NULL);
830 }
831 else if (NULL != peer_id)
832 { 826 {
833 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 827 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
834 "Show peer\n"); 828 "Show peer\n");
@@ -971,48 +965,33 @@ main (int argc,
971 "CONNECTION_ID", 965 "CONNECTION_ID",
972 gettext_noop ("Provide information about a particular connection"), 966 gettext_noop ("Provide information about a particular connection"),
973 &conn_id), 967 &conn_id),
974
975 GNUNET_GETOPT_option_flag ('e', 968 GNUNET_GETOPT_option_flag ('e',
976 "echo", 969 "echo",
977 gettext_noop ("Activate echo mode"), 970 gettext_noop ("Activate echo mode"),
978 &echo), 971 &echo),
979
980 GNUNET_GETOPT_option_flag ('d',
981 "dump",
982 gettext_noop ("Dump debug information to STDERR"),
983 &dump),
984
985 GNUNET_GETOPT_option_string ('o', 972 GNUNET_GETOPT_option_string ('o',
986 "open-port", 973 "open-port",
987 "SHARED_SECRET", 974 "SHARED_SECRET",
988 gettext_noop ("Listen for connections using a shared secret among sender and recipient"), 975 gettext_noop ("Listen for connections using a shared secret among sender and recipient"),
989 &listen_port), 976 &listen_port),
990
991
992 GNUNET_GETOPT_option_string ('p', 977 GNUNET_GETOPT_option_string ('p',
993 "peer", 978 "peer",
994 "PEER_ID", 979 "PEER_ID",
995 gettext_noop ("Provide information about a patricular peer"), 980 gettext_noop ("Provide information about a patricular peer"),
996 &peer_id), 981 &peer_id),
997
998
999 GNUNET_GETOPT_option_flag ('P', 982 GNUNET_GETOPT_option_flag ('P',
1000 "peers", 983 "peers",
1001 gettext_noop ("Provide information about all peers"), 984 gettext_noop ("Provide information about all peers"),
1002 &request_peers), 985 &request_peers),
1003
1004 GNUNET_GETOPT_option_string ('t', 986 GNUNET_GETOPT_option_string ('t',
1005 "tunnel", 987 "tunnel",
1006 "TUNNEL_ID", 988 "TUNNEL_ID",
1007 gettext_noop ("Provide information about a particular tunnel"), 989 gettext_noop ("Provide information about a particular tunnel"),
1008 &tunnel_id), 990 &tunnel_id),
1009
1010
1011 GNUNET_GETOPT_option_flag ('T', 991 GNUNET_GETOPT_option_flag ('T',
1012 "tunnels", 992 "tunnels",
1013 gettext_noop ("Provide information about all tunnels"), 993 gettext_noop ("Provide information about all tunnels"),
1014 &request_tunnels), 994 &request_tunnels),
1015
1016 GNUNET_GETOPT_OPTION_END 995 GNUNET_GETOPT_OPTION_END
1017 }; 996 };
1018 997