66 char buf[INET6_ADDRSTRLEN];
77 "Changing A record from `%s' to `%s'\n",
78 inet_ntop (AF_INET, record->
data.
raw.
data, buf,
sizeof(buf)),
91 "Changing AAAA record from `%s' to `%s'\n",
92 inet_ntop (AF_INET6, record->
data.
raw.
data, buf,
sizeof(buf)),
138 size_t request_length,
150 fprintf (stderr,
"Received malformed DNS packet, leaving it untouched\n");
163 "Modified DNS response did not fit, keeping old response\n");
172 "Injecting modified DNS response\n");
202 run (
void *cls,
char *
const *
args,
const char *cfgfile,
209 (1 != inet_pton (AF_INET,
n4, &i4)))
212 "`%s' is nto a valid IPv4 address!\n",
217 (1 != inet_pton (AF_INET6,
n6, &i6)))
220 "`%s' is nto a valid IPv6 address!\n",
235 main (
int argc,
char *
const *argv)
260 (
"Change DNS replies to point elsewhere."),
static struct GNUNET_DNS_Handle * handle
Handle to DNS service.
struct GNUNET_DNSPARSER_Record * answers
Array of all answers in the packet, must contain "num_answers" entries.
uint16_t type
See GNUNET_DNSPARSER_TYPE_*.
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
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.
#define GNUNET_DNSPARSER_TYPE_CNAME
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.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_verbose(unsigned int *level)
Define the '-V' verbosity option.
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int GNUNET_DNSPARSER_pack(const struct GNUNET_DNSPARSER_Packet *p, uint16_t max, char **buf, size_t *buf_length)
Given a DNS packet p, generate the corresponding UDP payload.
This client wants to be called on the results of a DNS resolution (either resolved by PRE-RESOLUTION ...
static char * n6
New target for AAAA records.
void GNUNET_DNSPARSER_free_packet(struct GNUNET_DNSPARSER_Packet *p)
Free memory taken by a packet.
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.
Definition of a command line option.
#define GNUNET_DNSPARSER_TYPE_MX
unsigned int num_answers
Number of answers in the packet, should be 0 for queries.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
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.
int main(int argc, char *const *argv)
#define GNUNET_DNSPARSER_TYPE_PTR
static char * n4
New target for A records.
void GNUNET_DNS_disconnect(struct GNUNET_DNS_Handle *dh)
Disconnect from the DNS service.
#define GNUNET_DNSPARSER_TYPE_SOA
static void do_disconnect(void *cls)
Shutdown.
static struct GNUNET_OS_Process * p
Helper process we started.
struct GNUNET_DNSPARSER_Packet * GNUNET_DNSPARSER_parse(const char *udp_payload, size_t udp_payload_length)
Parse a UDP payload of a DNS packet in to a nice struct for further processing and manipulation...
static int ret
Global return value (0 success).
union GNUNET_DNSPARSER_Record::@24 data
Payload of the record (which one of these is valid depends on the 'type').
#define GNUNET_free_nz(ptr)
Wrapper around free.
size_t data_len
Number of bytes in data.
void * data
Binary record data.
#define GNUNET_DNSPARSER_TYPE_TXT
struct GNUNET_DNS_Handle * GNUNET_DNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_DNS_Flags flags, GNUNET_DNS_RequestHandler rh, void *rh_cls)
Connect to the service-dns.
GNUNET_DNS_RequestHandler rh
Function to call to get replies.
void GNUNET_DNS_request_answer(struct GNUNET_DNS_RequestHandle *rh, uint16_t reply_length, const char *reply)
If a GNUNET_DNS_RequestHandler calls this function, the request is supposed to be answered with the d...
static void modify_request(void *cls, struct GNUNET_DNS_RequestHandle *rh, size_t request_length, const char *request)
Signature of a function that is called whenever the DNS service encounters a DNS request and needs to...
static void modify_record(const struct GNUNET_DNSPARSER_Record *record)
Modify the given DNS record.
Handle to identify an individual DNS request.
#define GNUNET_DNSPARSER_TYPE_AAAA
void GNUNET_DNS_request_forward(struct GNUNET_DNS_RequestHandle *rh)
If a GNUNET_DNS_RequestHandler calls this function, the request is given to other clients or the glob...
#define GNUNET_DNSPARSER_TYPE_NS
Easy-to-process, parsed version of a DNS packet.
static void record(void *cls, size_t data_size, const void *data)
Process recorded audio data.
static unsigned int verbosity
Selected level of verbosity.
struct GNUNET_DNSPARSER_RawRecord raw
Raw data for all other types.
#define GNUNET_DNSPARSER_TYPE_A
#define GNUNET_free(ptr)
Wrapper around free.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
#define gettext_noop(String)