131 char buf[INET6_ADDRSTRLEN];
138 fprintf (stdout,
"%s\n", inet_ntop (af,
address, buf,
sizeof(buf)));
188 _ (
"Option `%s' makes no sense with option `%s'.\n"),
202 fprintf (stderr,
_ (
"Option `%s' or `%s' is required.\n"),
"-i",
"-s");
208 _ (
"Option `%s' is required when using option `%s'.\n"),
216 _ (
"Option `%s' or `%s' is required when using option `%s'.\n"),
225 _ (
"Option `%s' makes no sense with option `%s'.\n"),
231 protocol = IPPROTO_TCP;
233 protocol = IPPROTO_UDP;
239 fprintf (stderr,
_ (
"`%s' is not a valid peer identifier.\n"),
peer_id);
254 if (1 != inet_pton (AF_INET6,
target_ip, &v6))
256 if (1 != inet_pton (AF_INET,
target_ip, &v4))
258 fprintf (stderr,
_ (
"`%s' is not a valid IP address.\n"),
target_ip);
289main (
int argc,
char *
const *argv)
295 "request that result should be an IPv4 address"),
301 "request that result should be an IPv6 address"),
308 gettext_noop (
"how long should the mapping be valid for new tunnels?"),
315 "destination IP for the tunnel"),
322 gettext_noop (
"peer offering the service we would like to access"),
329 "name of the service we would like to access"),
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 char * address
GNS address for this phone.
static uint64_t etime
Expiration string converted to numeric value.
static void do_disconnect(void *cls)
Shutdown.
static unsigned int verbosity
Selected level of verbosity.
static char * target_ip
Option -i: target IP.
static void allocation_cb(void *cls, int af, const void *address)
Callback invoked from the VPN service once a redirection is available.
static char * peer_id
Option -p: destination peer identity for service.
static int ret
Global return value.
static char * service_name
Option -s: service name (hash to get service descriptor)
static struct GNUNET_TIME_Relative duration
Option '-d': duration of the mapping.
static int ipv4
Option -4: IPv4 requested.
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)
static int udp
Option -u: UDP requested.
static int ipv6
Option -6: IPv6 requested.
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
static int tcp
Option -t: TCP requested.
API to access the VPN service.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time).
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_verbose(unsigned int *level)
Define the '-V' verbosity option.
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_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
#define GNUNET_log(kind,...)
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_public_key_from_string(const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Convert a string representing a public key to a public key.
@ 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_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
void GNUNET_TUN_service_name_to_hash(const char *service_name, struct GNUNET_HashCode *hc)
Hash the service name of a hosted service to the hash code that is used to identify the service on th...
struct GNUNET_VPN_Handle * GNUNET_VPN_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the VPN service.
struct GNUNET_VPN_RedirectionRequest * GNUNET_VPN_redirect_to_peer(struct GNUNET_VPN_Handle *vh, int result_af, uint8_t protocol, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HashCode *serv, struct GNUNET_TIME_Absolute expiration_time, GNUNET_VPN_AllocationCallback cb, void *cb_cls)
Tell the VPN that a forwarding to a particular peer offering a particular service is requested.
struct GNUNET_VPN_RedirectionRequest * GNUNET_VPN_redirect_to_ip(struct GNUNET_VPN_Handle *vh, int result_af, int addr_af, const void *addr, struct GNUNET_TIME_Absolute expiration_time, GNUNET_VPN_AllocationCallback cb, void *cb_cls)
Tell the VPN that forwarding to the Internet via some exit node is requested.
void GNUNET_VPN_cancel_request(struct GNUNET_VPN_RedirectionRequest *rr)
Cancel redirection request with the service.
void GNUNET_VPN_disconnect(struct GNUNET_VPN_Handle *vh)
Disconnect from the VPN service.
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.
Time for relative time used by GNUnet, in microseconds.
Opaque redirection request handle.