102 const char *state_str;
116 state_str =
_ (
"fresh connection");
120 state_str =
_ (
"key sent");
124 state_str =
_ (
"key received");
128 state_str =
_ (
"connection established");
132 state_str =
_ (
"rekeying");
136 state_str =
_ (
"disconnected");
145 _ (
"Connection to CORE service lost (reconnecting)"));
149 state_str =
_ (
"unknown state");
154 _ (
"%24s: %-30s %4s (timeout in %6s)\n"),
184 fprintf (stderr,
_ (
"Invalid command line argument `%s'\n"),
args[0]);
189 fprintf (stderr,
"%s",
_ (
"No argument given.\n"));
203 _ (
"Core service is lacking HOSTKEY configuration setting. Exiting.\n"));
214 "Failed to read peer's private key!\n");
224 _ (
"Current local peer identity: %s\n"),
231 _ (
"Monitoring connections. Press CTRL-C to quit.\n\n"));
236 fprintf (stderr,
"%s",
_ (
"Failed to connect to CORE service!\n"));
253main (
int argc,
char *
const *argv)
261 "provide information about all current connections (continuously)"),
267 "Show our current peer identity"
274 "Show current connections"
284 "Print information about connected peers."),
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
#define gettext_noop(String)
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
static int monitor_connections
Option -m.
static struct GNUNET_CRYPTO_EddsaPrivateKey my_private_key
Peer private key.
static struct GNUNET_PeerIdentity my_full_id
Peer identity.
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 int show_conns
Option -s.
static void shutdown_task(void *cls)
Task run in monitor mode when the user presses CTRL-C to abort.
static int ret
Return code.
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.
static int show_pid
Option -i.
int main(int argc, char *const *argv)
The main function to obtain peer information from CORE.
static char * res
Currently read line or NULL on EOF.
enum State state
current state of profiling
Core service; the main API for encrypted P2P communications.
Functions related to time.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
GNUNET_CORE_KxState
State machine for our P2P encryption handshake.
void GNUNET_CORE_monitor_stop(struct GNUNET_CORE_MonitorHandle *mh)
Stop monitoring CORE activity.
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_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,...
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_key_from_file(const char *filename, int do_create, struct GNUNET_CRYPTO_EddsaPrivateKey *pkey)
Create a new private key by reading it from a file.
void GNUNET_CRYPTO_eddsa_key_get_public(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Extract the public key for the given private 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.
#define GNUNET_log(kind,...)
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_free(ptr)
Wrapper around free.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, 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,...
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?
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_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.
Handle to a CORE monitoring operation.
Private ECC key encoded for transmission.
Definition of a command line option.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Time for absolute times used by GNUnet, in microseconds.