77 const char *state_str;
91 state_str =
_ (
"fresh connection");
95 state_str =
_ (
"key sent");
99 state_str =
_ (
"key received");
103 state_str =
_ (
"connection established");
107 state_str =
_ (
"rekeying");
111 state_str =
_ (
"disconnected");
120 _ (
"Connection to CORE service lost (reconnecting)"));
124 state_str =
_ (
"unknown state");
129 _ (
"%24s: %-30s %4s (timeout in %6s)\n"),
157 fprintf (stderr,
_ (
"Invalid command line argument `%s'\n"), args[0]);
163 fprintf (stderr,
"%s",
_ (
"Failed to connect to CORE service!\n"));
178 main (
int argc,
char *
const *argv)
186 "provide information about all current connections (continuously)"),
196 "Print information about connected peers."),
int main(int argc, char *const *argv)
The main function to obtain peer information from CORE.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run by the scheduler.
Handle to a CORE monitoring operation.
GNUNET_CORE_KxState
State machine for our P2P encryption handshake.
Definition of a command line option.
static struct GNUNET_CORE_MonitorHandle * mh
Handle to the CORE monitor.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
We've received the other peers session key.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
static void monitor_cb(void *cls, const struct GNUNET_PeerIdentity *peer, enum GNUNET_CORE_KxState state, struct GNUNET_TIME_Absolute timeout)
Function called to notify core users that another peer changed its state with us. ...
enum State state
current state of profiling
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
static void shutdown_task(void *cls)
Task run in monitor mode when the user presses CTRL-C to abort.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
struct GNUNET_CORE_MonitorHandle * GNUNET_CORE_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CORE_MonitorCallback peer_cb, void *peer_cb_cls)
Monitor connectivity and KX status of all peers known to CORE.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
#define GNUNET_free_nz(ptr)
Wrapper around free.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
This is not a state in a peer's state machine, but a special value used with the GNUNET_CORE_MonitorC...
The other peer has confirmed our session key + PING with a PONG message encrypted with their session ...
The identity of the host (wraps the signing key of the peer).
void GNUNET_CORE_monitor_stop(struct GNUNET_CORE_MonitorHandle *mh)
Stop monitoring CORE activity.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Last state of a KX (when it is being terminated).
Time for absolute times used by GNUnet, in microseconds.
We've sent our session key.
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
This is not a state in a peer's state machine, but a special value used with the GNUNET_CORE_MonitorC...
static int monitor_connections
Option -m.
#define gettext_noop(String)
We're rekeying (or had a timeout), so we have sent the other peer our new ephemeral key...