73 return _ (
"Operation Successful");
76 return _ (
"IPC failure");
79 return _ (
"Failure in network subsystem, check permissions.");
82 return _ (
"Encountered timeout while performing operation");
85 return _ (
"detected that we are offline");
88 return _ (
"`upnpc` command not found");
91 return _ (
"Failed to run `upnpc` command");
94 return _ (
"`upnpc' command took too long, process killed");
97 return _ (
"`upnpc' command failed to establish port mapping");
100 return _ (
"`external-ip' command not found");
103 return _ (
"Failed to run `external-ip` command");
106 return _ (
"`external-ip' command output invalid");
109 return _ (
"no valid address was returned by `external-ip'");
113 "Could not determine interface with internal/local network address");
116 return _ (
"No functioning gnunet-helper-nat-server installation found");
119 return _ (
"NAT test could not be initialized");
122 return _ (
"NAT test timeout reached");
125 return _ (
"could not register NAT");
128 return _ (
"No working gnunet-helper-nat-client installation found");
131 return "unknown status code";
167 left = ntohs (
res->header.size) -
sizeof(*res);
171 (
const char *) &
res[1],
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MQ_Envelope * env
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static char * res
Currently read line or NULL on EOF.
static uint32_t type
Type string converted to DNS type value.
static struct GNUNET_NAT_AUTO_AutoHandle * ah
Handle to ongoing autoconfiguration.
static int status
The program status; 0 for success.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(const struct GNUNET_OS_ProjectData *pd)
Create a new configuration object.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_deserialize(struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, const char *source_filename)
De-serializes configuration.
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
GNUNET_NAT_StatusCode
Error Types for the NAT subsystem (which can then later be converted/resolved to a string)
GNUNET_NAT_Type
What the situation of the NAT connectivity.
const char * GNUNET_NAT_AUTO_status2string(enum GNUNET_NAT_StatusCode err)
Converts enum GNUNET_NAT_StatusCode to string.
void(* GNUNET_NAT_AUTO_AutoResultCallback)(void *cls, const struct GNUNET_CONFIGURATION_Handle *diff, enum GNUNET_NAT_StatusCode result, enum GNUNET_NAT_Type type)
Function called with the result from the autoconfiguration.
struct GNUNET_NAT_AUTO_AutoHandle * GNUNET_NAT_AUTO_autoconfig_start(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_NAT_AUTO_AutoResultCallback cb, void *cb_cls)
Start auto-configuration routine.
void GNUNET_NAT_AUTO_autoconfig_cancel(struct GNUNET_NAT_AUTO_AutoHandle *ah)
Abort autoconfiguration.
@ GNUNET_NAT_ERROR_UPNPC_NOT_FOUND
upnpc command not found
@ GNUNET_NAT_ERROR_NOT_ONLINE
detected that we are offline
@ GNUNET_NAT_ERROR_UPNPC_TIMEOUT
‘upnpc’ command took too long, process killed
@ GNUNET_NAT_ERROR_SUCCESS
Just the default.
@ GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID
‘external-ip’ command output invalid
@ GNUNET_NAT_ERROR_UPNPC_FAILED
Failed to run upnpc command.
@ GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED
Failed to run external-ip command.
@ GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR
Failure in network subsystem, check permissions.
@ GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND
@ GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED
‘upnpc’ command failed to establish port mapping
@ GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND
‘external-ip’ command not found
@ GNUNET_NAT_ERROR_NAT_REGISTER_FAILED
NAT test failed to initiate.
@ GNUNET_NAT_ERROR_IPC_FAILURE
IPC Failure.
@ GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO
Could not determine interface with internal/local network address.
@ GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND
No working gnunet-helper-nat-server found.
@ GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID
"no valid address was returned by `external-ip'"
@ GNUNET_NAT_ERROR_NAT_TEST_START_FAILED
NAT test could not be initialized.
@ GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT
NAT test timeout.
@ GNUNET_NAT_ERROR_TIMEOUT
test timed out
@ GNUNET_NAT_TYPE_UNKNOWN
We know nothing about the NAT.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
#define GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT
Message from NAT service with the autoconfiguration result.
#define GNUNET_MESSAGE_TYPE_NAT_AUTO_REQUEST_CFG
Message to ask NAT service to request autoconfiguration.
static void ah_error_handler(void *cls, enum GNUNET_MQ_Error error)
Handle queue errors by reporting autoconfiguration failure.
static int check_auto_result(void *cls, const struct GNUNET_NAT_AUTO_AutoconfigResultMessage *res)
Check result from autoconfiguration attempt.
static void handle_auto_result(void *cls, const struct GNUNET_NAT_AUTO_AutoconfigResultMessage *res)
Handle result from autoconfiguration attempt.
static unsigned int size
Size of the "table".
Handle to a message queue.
Message handler for a specific message type.
Handle to auto-configuration in progress.
void * arc_cls
Closure for arc.
struct GNUNET_MQ_Handle * mq
Message queue for communicating with the NAT service.
GNUNET_NAT_AUTO_AutoResultCallback arc
Function called with the result from the autoconfiguration.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.
Client requesting automatic configuration.
Service responding with proposed configuration.