android-dns: Remove legacy Android DNS plugin
This was written for the original native Android port. It was never used by the later Android app.
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ include $(CLEAR_VARS)
|
|||||||
# this is the list of plugins that are built into libstrongswan and charon
|
# this is the list of plugins that are built into libstrongswan and charon
|
||||||
# also these plugins are loaded by default (if not changed in strongswan.conf)
|
# also these plugins are loaded by default (if not changed in strongswan.conf)
|
||||||
strongswan_CHARON_PLUGINS := android-log openssl fips-prf random nonce pubkey \
|
strongswan_CHARON_PLUGINS := android-log openssl fips-prf random nonce pubkey \
|
||||||
pkcs1 pkcs8 pem xcbc hmac kdf kernel-netlink socket-default android-dns \
|
pkcs1 pkcs8 pem xcbc hmac kdf kernel-netlink socket-default \
|
||||||
stroke eap-identity eap-mschapv2 eap-md5 eap-gtc
|
stroke eap-identity eap-mschapv2 eap-md5 eap-gtc
|
||||||
|
|
||||||
# list of all plugins - used to enable them with the function below
|
# list of all plugins - used to enable them with the function below
|
||||||
|
|||||||
@@ -234,7 +234,6 @@ ARG_ENABL_SET([stroke], [enable the stroke configuration backend.])
|
|||||||
ARG_ENABL_SET([sql], [enable SQL database configuration backend.])
|
ARG_ENABL_SET([sql], [enable SQL database configuration backend.])
|
||||||
ARG_DISBL_SET([vici], [disable strongSwan IKE generic IPC interface plugin.])
|
ARG_DISBL_SET([vici], [disable strongSwan IKE generic IPC interface plugin.])
|
||||||
# attribute provider/consumer plugins
|
# attribute provider/consumer plugins
|
||||||
ARG_ENABL_SET([android-dns], [enable Android specific DNS handler.])
|
|
||||||
ARG_DISBL_SET([attr], [disable strongswan.conf based configuration attribute plugin.])
|
ARG_DISBL_SET([attr], [disable strongswan.conf based configuration attribute plugin.])
|
||||||
ARG_ENABL_SET([attr-sql], [enable SQL based configuration attribute plugin.])
|
ARG_ENABL_SET([attr-sql], [enable SQL based configuration attribute plugin.])
|
||||||
ARG_ENABL_SET([dhcp], [enable DHCP based attribute provider plugin.])
|
ARG_ENABL_SET([dhcp], [enable DHCP based attribute provider plugin.])
|
||||||
@@ -1190,15 +1189,6 @@ if test x$botan = xtrue; then
|
|||||||
LIBS=$saved_LIBS
|
LIBS=$saved_LIBS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x$android_dns = xtrue; then
|
|
||||||
AC_CHECK_LIB([cutils],[property_get],[LIBS="$LIBS"],[AC_MSG_ERROR([Android library libcutils not found])],[])
|
|
||||||
AC_CHECK_HEADER([cutils/properties.h],,[AC_MSG_ERROR([Android header cutils/properties.h not found!])])
|
|
||||||
# we have to force the use of libdl here because the autodetection
|
|
||||||
# above does not work correctly when cross-compiling for android.
|
|
||||||
DLLIB="-ldl"
|
|
||||||
AC_SUBST(DLLIB)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x$eap_sim_pcsc = xtrue; then
|
if test x$eap_sim_pcsc = xtrue; then
|
||||||
PKG_CHECK_MODULES(pcsclite, [libpcsclite])
|
PKG_CHECK_MODULES(pcsclite, [libpcsclite])
|
||||||
AC_SUBST(pcsclite_CFLAGS)
|
AC_SUBST(pcsclite_CFLAGS)
|
||||||
@@ -1617,7 +1607,6 @@ ADD_PLUGIN([tnccs-dynamic], [t charon])
|
|||||||
ADD_PLUGIN([dhcp], [c charon])
|
ADD_PLUGIN([dhcp], [c charon])
|
||||||
ADD_PLUGIN([osx-attr], [c charon cmd])
|
ADD_PLUGIN([osx-attr], [c charon cmd])
|
||||||
ADD_PLUGIN([p-cscf], [c charon cmd])
|
ADD_PLUGIN([p-cscf], [c charon cmd])
|
||||||
ADD_PLUGIN([android-dns], [c charon])
|
|
||||||
ADD_PLUGIN([android-log], [c charon])
|
ADD_PLUGIN([android-log], [c charon])
|
||||||
ADD_PLUGIN([ha], [c charon])
|
ADD_PLUGIN([ha], [c charon])
|
||||||
ADD_PLUGIN([whitelist], [c charon])
|
ADD_PLUGIN([whitelist], [c charon])
|
||||||
@@ -1723,7 +1712,6 @@ AM_CONDITIONAL(USE_STROKE, test x$stroke = xtrue)
|
|||||||
AM_CONDITIONAL(USE_VICI, test x$vici = xtrue)
|
AM_CONDITIONAL(USE_VICI, test x$vici = xtrue)
|
||||||
AM_CONDITIONAL(USE_OSX_ATTR, test x$osx_attr = xtrue)
|
AM_CONDITIONAL(USE_OSX_ATTR, test x$osx_attr = xtrue)
|
||||||
AM_CONDITIONAL(USE_P_CSCF, test x$p_cscf = xtrue)
|
AM_CONDITIONAL(USE_P_CSCF, test x$p_cscf = xtrue)
|
||||||
AM_CONDITIONAL(USE_ANDROID_DNS, test x$android_dns = xtrue)
|
|
||||||
AM_CONDITIONAL(USE_ANDROID_LOG, test x$android_log = xtrue)
|
AM_CONDITIONAL(USE_ANDROID_LOG, test x$android_log = xtrue)
|
||||||
AM_CONDITIONAL(USE_SQL, test x$sql = xtrue)
|
AM_CONDITIONAL(USE_SQL, test x$sql = xtrue)
|
||||||
AM_CONDITIONAL(USE_DNSCERT, test x$dnscert = xtrue)
|
AM_CONDITIONAL(USE_DNSCERT, test x$dnscert = xtrue)
|
||||||
@@ -2099,7 +2087,6 @@ AC_CONFIG_FILES([
|
|||||||
src/libcharon/plugins/radattr/Makefile
|
src/libcharon/plugins/radattr/Makefile
|
||||||
src/libcharon/plugins/osx_attr/Makefile
|
src/libcharon/plugins/osx_attr/Makefile
|
||||||
src/libcharon/plugins/p_cscf/Makefile
|
src/libcharon/plugins/p_cscf/Makefile
|
||||||
src/libcharon/plugins/android_dns/Makefile
|
|
||||||
src/libcharon/plugins/android_log/Makefile
|
src/libcharon/plugins/android_log/Makefile
|
||||||
src/libcharon/plugins/stroke/Makefile
|
src/libcharon/plugins/stroke/Makefile
|
||||||
src/libcharon/plugins/vici/Makefile
|
src/libcharon/plugins/vici/Makefile
|
||||||
|
|||||||
+1
-1
@@ -261,7 +261,7 @@ all|alpine|codeql|coverage|sonarcloud|no-dbg|no-testable-ke)
|
|||||||
if [ "$TEST" = "no-dbg" ]; then
|
if [ "$TEST" = "no-dbg" ]; then
|
||||||
CFLAGS="$CFLAGS -DDEBUG_LEVEL=-1"
|
CFLAGS="$CFLAGS -DDEBUG_LEVEL=-1"
|
||||||
fi
|
fi
|
||||||
CONFIG="--enable-all --disable-android-dns --disable-android-log
|
CONFIG="--enable-all --disable-android-log
|
||||||
--disable-kernel-pfroute
|
--disable-kernel-pfroute
|
||||||
--disable-lock-profiler --disable-padlock --disable-fuzzing
|
--disable-lock-profiler --disable-padlock --disable-fuzzing
|
||||||
--disable-osx-attr --disable-tkm
|
--disable-osx-attr --disable-tkm
|
||||||
|
|||||||
@@ -148,11 +148,6 @@ LOCAL_SRC_FILES := $(filter %.c,$(libcharon_la_SOURCES))
|
|||||||
|
|
||||||
# adding the plugin source files
|
# adding the plugin source files
|
||||||
|
|
||||||
LOCAL_SRC_FILES += $(call add_plugin, android-dns)
|
|
||||||
ifneq ($(call plugin_enabled, android-dns),)
|
|
||||||
LOCAL_SHARED_LIBRARIES += libcutils
|
|
||||||
endif
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES += $(call add_plugin, android-log)
|
LOCAL_SRC_FILES += $(call add_plugin, android-log)
|
||||||
ifneq ($(call plugin_enabled, android-log),)
|
ifneq ($(call plugin_enabled, android-log),)
|
||||||
LOCAL_LDLIBS += -llog
|
LOCAL_LDLIBS += -llog
|
||||||
|
|||||||
@@ -523,13 +523,6 @@ if MONOLITHIC
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_ANDROID_DNS
|
|
||||||
SUBDIRS += plugins/android_dns
|
|
||||||
if MONOLITHIC
|
|
||||||
libcharon_la_LIBADD += plugins/android_dns/libstrongswan-android-dns.la
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if USE_ANDROID_LOG
|
if USE_ANDROID_LOG
|
||||||
SUBDIRS += plugins/android_log
|
SUBDIRS += plugins/android_log
|
||||||
if MONOLITHIC
|
if MONOLITHIC
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
AM_CPPFLAGS = \
|
|
||||||
-I$(top_srcdir)/src/libstrongswan \
|
|
||||||
-I$(top_srcdir)/src/libcharon
|
|
||||||
|
|
||||||
AM_CFLAGS = \
|
|
||||||
$(PLUGIN_CFLAGS)
|
|
||||||
|
|
||||||
if MONOLITHIC
|
|
||||||
noinst_LTLIBRARIES = libstrongswan-android-dns.la
|
|
||||||
else
|
|
||||||
plugin_LTLIBRARIES = libstrongswan-android-dns.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
libstrongswan_android_dns_la_SOURCES = \
|
|
||||||
android_dns_plugin.c android_dns_plugin.h \
|
|
||||||
android_dns_handler.c android_dns_handler.h
|
|
||||||
|
|
||||||
libstrongswan_android_dns_la_LDFLAGS = -module -avoid-version
|
|
||||||
libstrongswan_android_dns_la_LIBADD = -lcutils
|
|
||||||
@@ -1,239 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2010-2013 Tobias Brunner
|
|
||||||
* Copyright (C) 2010 Martin Willi
|
|
||||||
*
|
|
||||||
* Copyright (C) secunet Security Networks AG
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "android_dns_handler.h"
|
|
||||||
|
|
||||||
#include <networking/host.h>
|
|
||||||
#include <collections/linked_list.h>
|
|
||||||
|
|
||||||
#include <cutils/properties.h>
|
|
||||||
|
|
||||||
typedef struct private_android_dns_handler_t private_android_dns_handler_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Private data of an android_dns_handler_t object.
|
|
||||||
*/
|
|
||||||
struct private_android_dns_handler_t {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Public interface
|
|
||||||
*/
|
|
||||||
android_dns_handler_t public;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of registered DNS servers
|
|
||||||
*/
|
|
||||||
linked_list_t *dns;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prefix to be used when installing DNS servers
|
|
||||||
*/
|
|
||||||
#define DNS_PREFIX_DEFAULT "net"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Struct to store a pair of old and installed DNS servers
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
/** installed dns server */
|
|
||||||
host_t *dns;
|
|
||||||
/** old dns server */
|
|
||||||
host_t *old;
|
|
||||||
} dns_pair_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy a pair of old and installed DNS servers
|
|
||||||
*/
|
|
||||||
static void destroy_dns_pair(dns_pair_t *this)
|
|
||||||
{
|
|
||||||
DESTROY_IF(this->dns);
|
|
||||||
DESTROY_IF(this->old);
|
|
||||||
free(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter pairs of DNS servers
|
|
||||||
*/
|
|
||||||
static bool filter_dns_pair(void *data, dns_pair_t **in, host_t **out)
|
|
||||||
{
|
|
||||||
*out = (*in)->dns;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read DNS server property with a given index
|
|
||||||
*/
|
|
||||||
static host_t *get_dns_server(private_android_dns_handler_t *this, int index)
|
|
||||||
{
|
|
||||||
host_t *dns = NULL;
|
|
||||||
char key[10], value[PROPERTY_VALUE_MAX],
|
|
||||||
*prefix = DNS_PREFIX_DEFAULT;
|
|
||||||
|
|
||||||
if (snprintf(key, sizeof(key), "%s.dns%d", prefix, index) >= sizeof(key))
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property_get(key, value, NULL) > 0)
|
|
||||||
{
|
|
||||||
dns = host_create_from_string(value, 0);
|
|
||||||
}
|
|
||||||
return dns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set DNS server property with a given index
|
|
||||||
*/
|
|
||||||
static bool set_dns_server(private_android_dns_handler_t *this, int index,
|
|
||||||
host_t *dns)
|
|
||||||
{
|
|
||||||
char key[10], value[PROPERTY_VALUE_MAX],
|
|
||||||
*prefix = DNS_PREFIX_DEFAULT;
|
|
||||||
|
|
||||||
if (snprintf(key, sizeof(key), "%s.dns%d", prefix, index) >= sizeof(key))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dns)
|
|
||||||
{
|
|
||||||
if (snprintf(value, sizeof(value), "%H", dns) >= sizeof(value))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value[0] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property_set(key, value) != 0)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
METHOD(attribute_handler_t, handle, bool,
|
|
||||||
private_android_dns_handler_t *this, ike_sa_t *ike_sa,
|
|
||||||
configuration_attribute_type_t type, chunk_t data)
|
|
||||||
{
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case INTERNAL_IP4_DNS:
|
|
||||||
{
|
|
||||||
host_t *dns;
|
|
||||||
dns_pair_t *pair;
|
|
||||||
int index;
|
|
||||||
|
|
||||||
dns = host_create_from_chunk(AF_INET, data, 0);
|
|
||||||
if (dns)
|
|
||||||
{
|
|
||||||
pair = malloc_thing(dns_pair_t);
|
|
||||||
pair->dns = dns;
|
|
||||||
index = this->dns->get_count(this->dns) + 1;
|
|
||||||
pair->old = get_dns_server(this, index);
|
|
||||||
set_dns_server(this, index, dns);
|
|
||||||
this->dns->insert_last(this->dns, pair);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
METHOD(attribute_handler_t, release, void,
|
|
||||||
private_android_dns_handler_t *this, ike_sa_t *ike_sa,
|
|
||||||
configuration_attribute_type_t type, chunk_t data)
|
|
||||||
{
|
|
||||||
if (type == INTERNAL_IP4_DNS)
|
|
||||||
{
|
|
||||||
enumerator_t *enumerator;
|
|
||||||
dns_pair_t *pair;
|
|
||||||
int index;
|
|
||||||
|
|
||||||
enumerator = this->dns->create_enumerator(this->dns);
|
|
||||||
for (index = 1; enumerator->enumerate(enumerator, &pair); index++)
|
|
||||||
{
|
|
||||||
if (chunk_equals(pair->dns->get_address(pair->dns), data))
|
|
||||||
{
|
|
||||||
this->dns->remove_at(this->dns, enumerator);
|
|
||||||
set_dns_server(this, index, pair->old);
|
|
||||||
destroy_dns_pair(pair);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
enumerator->destroy(enumerator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
METHOD(enumerator_t, enumerate_dns, bool,
|
|
||||||
enumerator_t *this, va_list args)
|
|
||||||
{
|
|
||||||
configuration_attribute_type_t *type;
|
|
||||||
chunk_t *data;
|
|
||||||
|
|
||||||
VA_ARGS_VGET(args, type, data);
|
|
||||||
*type = INTERNAL_IP4_DNS;
|
|
||||||
*data = chunk_empty;
|
|
||||||
this->venumerate = (void*)return_false;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
METHOD(attribute_handler_t, create_attribute_enumerator, enumerator_t *,
|
|
||||||
private_android_dns_handler_t *this, ike_sa_t *ike_sa,
|
|
||||||
linked_list_t *vips)
|
|
||||||
{
|
|
||||||
enumerator_t *enumerator;
|
|
||||||
|
|
||||||
INIT(enumerator,
|
|
||||||
.enumerate = enumerator_enumerate_default,
|
|
||||||
.venumerate = _enumerate_dns,
|
|
||||||
.destroy = (void*)free,
|
|
||||||
);
|
|
||||||
return enumerator;
|
|
||||||
}
|
|
||||||
|
|
||||||
METHOD(android_dns_handler_t, destroy, void,
|
|
||||||
private_android_dns_handler_t *this)
|
|
||||||
{
|
|
||||||
this->dns->destroy_function(this->dns, (void*)destroy_dns_pair);
|
|
||||||
free(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See header
|
|
||||||
*/
|
|
||||||
android_dns_handler_t *android_dns_handler_create()
|
|
||||||
{
|
|
||||||
private_android_dns_handler_t *this;
|
|
||||||
|
|
||||||
INIT(this,
|
|
||||||
.public = {
|
|
||||||
.handler = {
|
|
||||||
.handle = _handle,
|
|
||||||
.release = _release,
|
|
||||||
.create_attribute_enumerator = _create_attribute_enumerator,
|
|
||||||
},
|
|
||||||
.destroy = _destroy,
|
|
||||||
},
|
|
||||||
.dns = linked_list_create(),
|
|
||||||
);
|
|
||||||
|
|
||||||
return &this->public;
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2010-2011 Tobias Brunner
|
|
||||||
* Copyright (C) 2010 Martin Willi
|
|
||||||
*
|
|
||||||
* Copyright (C) secunet Security Networks AG
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup android_dns_handler android_dns_handler
|
|
||||||
* @{ @ingroup android_dns
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ANDROID_DNS_HANDLER_H_
|
|
||||||
#define ANDROID_DNS_HANDLER_H_
|
|
||||||
|
|
||||||
#include <attributes/attribute_handler.h>
|
|
||||||
|
|
||||||
typedef struct android_dns_handler_t android_dns_handler_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Android specific DNS attribute handler.
|
|
||||||
*/
|
|
||||||
struct android_dns_handler_t {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements attribute_handler_t.
|
|
||||||
*/
|
|
||||||
attribute_handler_t handler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy a android_dns_handler_t.
|
|
||||||
*/
|
|
||||||
void (*destroy)(android_dns_handler_t *this);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an android_dns_handler_t instance.
|
|
||||||
*/
|
|
||||||
android_dns_handler_t *android_dns_handler_create();
|
|
||||||
|
|
||||||
#endif /** ANDROID_DNS_HANDLER_H_ @}*/
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2010-2013 Tobias Brunner
|
|
||||||
*
|
|
||||||
* Copyright (C) secunet Security Networks AG
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "android_dns_plugin.h"
|
|
||||||
#include "android_dns_handler.h"
|
|
||||||
|
|
||||||
#include <daemon.h>
|
|
||||||
|
|
||||||
typedef struct private_android_dns_plugin_t private_android_dns_plugin_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Private data of an android_dns_plugin_t object.
|
|
||||||
*/
|
|
||||||
struct private_android_dns_plugin_t {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Public interface
|
|
||||||
*/
|
|
||||||
android_dns_plugin_t public;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Android specific DNS handler
|
|
||||||
*/
|
|
||||||
android_dns_handler_t *handler;
|
|
||||||
};
|
|
||||||
|
|
||||||
METHOD(plugin_t, get_name, char*,
|
|
||||||
private_android_dns_plugin_t *this)
|
|
||||||
{
|
|
||||||
return "android-dns";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register handler
|
|
||||||
*/
|
|
||||||
static bool plugin_cb(private_android_dns_plugin_t *this,
|
|
||||||
plugin_feature_t *feature, bool reg, void *cb_data)
|
|
||||||
{
|
|
||||||
if (reg)
|
|
||||||
{
|
|
||||||
charon->attributes->add_handler(charon->attributes,
|
|
||||||
&this->handler->handler);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
charon->attributes->remove_handler(charon->attributes,
|
|
||||||
&this->handler->handler);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
METHOD(plugin_t, get_features, int,
|
|
||||||
private_android_dns_plugin_t *this, plugin_feature_t *features[])
|
|
||||||
{
|
|
||||||
static plugin_feature_t f[] = {
|
|
||||||
PLUGIN_CALLBACK((plugin_feature_callback_t)plugin_cb, NULL),
|
|
||||||
PLUGIN_PROVIDE(CUSTOM, "android-dns"),
|
|
||||||
};
|
|
||||||
*features = f;
|
|
||||||
return countof(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
METHOD(plugin_t, destroy, void,
|
|
||||||
private_android_dns_plugin_t *this)
|
|
||||||
{
|
|
||||||
this->handler->destroy(this->handler);
|
|
||||||
free(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See header
|
|
||||||
*/
|
|
||||||
PLUGIN_DEFINE(android_dns)
|
|
||||||
{
|
|
||||||
private_android_dns_plugin_t *this;
|
|
||||||
|
|
||||||
INIT(this,
|
|
||||||
.public = {
|
|
||||||
.plugin = {
|
|
||||||
.get_name = _get_name,
|
|
||||||
.get_features = _get_features,
|
|
||||||
.destroy = _destroy,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
.handler = android_dns_handler_create(),
|
|
||||||
);
|
|
||||||
|
|
||||||
return &this->public.plugin;
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013 Tobias Brunner
|
|
||||||
*
|
|
||||||
* Copyright (C) secunet Security Networks AG
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup android_dns android_dns
|
|
||||||
* @ingroup cplugins
|
|
||||||
*
|
|
||||||
* @defgroup android_dns_plugin android_dns_plugin
|
|
||||||
* @{ @ingroup android_dns
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ANDROID_DNS_PLUGIN_H_
|
|
||||||
#define ANDROID_DNS_PLUGIN_H_
|
|
||||||
|
|
||||||
#include <plugins/plugin.h>
|
|
||||||
|
|
||||||
typedef struct android_dns_plugin_t android_dns_plugin_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plugin providing an Android-specific handler for DNS servers.
|
|
||||||
*/
|
|
||||||
struct android_dns_plugin_t {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements plugin interface.
|
|
||||||
*/
|
|
||||||
plugin_t plugin;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /** ANDROID_DNS_PLUGIN_H_ @}*/
|
|
||||||
Reference in New Issue
Block a user