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."),
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
#define gettext_noop(String)
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
static int monitor_connections
Option -m.
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.
static void shutdown_task(void *cls)
Task run in monitor mode when the user presses CTRL-C to abort.
static struct GNUNET_CORE_MonitorHandle * mh
Handle to the CORE monitor.
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.
int main(int argc, char *const *argv)
The main function to obtain peer information from CORE.
enum State state
current state of profiling
Core service; the main API for encrypted P2P communications.
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.
GNUNET_CORE_KxState
State machine for our P2P encryption handshake.
void GNUNET_CORE_monitor_stop(struct GNUNET_CORE_MonitorHandle *mh)
Stop monitoring CORE activity.
@ GNUNET_CORE_KX_PEER_DISCONNECT
Last state of a KX (when it is being terminated).
@ GNUNET_CORE_KX_STATE_UP
The other peer has confirmed our session key + PING with a PONG message encrypted with their session ...
@ GNUNET_CORE_KX_STATE_DOWN
No handshake yet.
@ GNUNET_CORE_KX_CORE_DISCONNECT
This is not a state in a peer's state machine, but a special value used with the GNUNET_CORE_MonitorC...
@ GNUNET_CORE_KX_STATE_KEY_SENT
We've sent our session key.
@ GNUNET_CORE_KX_STATE_KEY_RECEIVED
We've received the other peers session key.
@ GNUNET_CORE_KX_ITERATION_FINISHED
This is not a state in a peer's state machine, but a special value used with the GNUNET_CORE_MonitorC...
@ GNUNET_CORE_KX_STATE_REKEY_SENT
We're rekeying (or had a timeout), so we have sent the other peer our new ephemeral key,...
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.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_free_nz(ptr)
Wrapper around free.
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,...
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
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,...
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
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?
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Handle to a CORE monitoring operation.
Definition of a command line option.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.