aboutsummaryrefslogtreecommitdiffstats
path: root/pacredir.h
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2017-04-29 21:50:26 +0200
committerGravatar Christian Hesse <mail@eworm.de>2017-04-29 23:05:35 +0200
commit0429aca36e7161e601df164b5c11e020942ebc8a (patch)
treebb65f899b3459bcc537db823400014ac23f0a586 /pacredir.h
parent94940d5e121ee8b93d4f94b81ba4bae98b8a5e26 (diff)
downloadpacredir-0429aca36e7161e601df164b5c11e020942ebc8a.tar.gz
pacredir-0429aca36e7161e601df164b5c11e020942ebc8a.tar.zst
Do not rely on mDNS...
... but do resolve the addresses within pacredir. The biggest advantage is that we do no longer require nss-mdns, which tends to fool us in different ways. As requests are done by address rather than host name you can no longer use virtual hosts for pacserve and pacdbserve. But did anybody try that?
Diffstat (limited to 'pacredir.h')
-rw-r--r--pacredir.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/pacredir.h b/pacredir.h
index 161845e..2cd8cca 100644
--- a/pacredir.h
+++ b/pacredir.h
@@ -61,6 +61,8 @@ struct services {
struct hosts {
/* host name */
char * host;
+ /* resolved address */
+ char address[AVAHI_ADDRESS_STR_MAX];
/* online status and bad time for services */
struct services pacserve;
struct services pacdbserve;
@@ -97,13 +99,27 @@ int write_log(FILE *stream, const char *format, ...);
/* get_fqdn */
char * get_fqdn(const char * hostname, const char * domainname);
/* get_url */
-char * get_url(const char * hostname, const uint16_t port, const char * uri);
+char * get_url(const char * hostname, const char * address, const uint16_t port, const char * uri);
/* add_host */
-int add_host(const char * host, const uint16_t port, const char * type);
+int add_host(const char * host, const char * address, const uint16_t port, const char * type);
/* remove_host */
int remove_host(const char * host, const char * type);
+/* resolve_callback */
+static void resolve_callback(AvahiServiceResolver *r,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiResolverEvent event,
+ const char *name,
+ const char *type,
+ const char *domain,
+ const char *host,
+ const AvahiAddress *address,
+ uint16_t port,
+ AvahiStringList *txt,
+ AvahiLookupResultFlags flags,
+ void* userdata);
/* browse_callback */
static void browse_callback(AvahiServiceBrowser *b,
AvahiIfIndex interface,
@@ -112,12 +128,12 @@ static void browse_callback(AvahiServiceBrowser *b,
const char *name,
const char *type,
const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
+ AvahiLookupResultFlags flags,
void* userdata);
/* client_callback */
static void client_callback(AvahiClient *c,
AvahiClientState state,
- AVAHI_GCC_UNUSED void * userdata);
+ void * userdata);
/* get_http_code */
static void * get_http_code(void * data);