aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2016-08-16 17:01:32 +0100
committerPatrik Flykt <patrik.flykt@linux.intel.com>2016-08-19 10:10:29 +0300
commitb043b6c4e9dcf907e42c1301f137792a4079bef1 (patch)
treec94fd385759d74ee643ab23e743edbe12b5616bf /src
parentdf057700e5a02309476703392490bedc0ad8fd9f (diff)
downloadpacrunner-b043b6c4e9dcf907e42c1301f137792a4079bef1.tar.gz
plugins: New shared C file for common JavaScript routines
Diffstat (limited to 'src')
-rw-r--r--src/js.h3
-rw-r--r--src/js_funcs.c (renamed from src/javascript.h)29
2 files changed, 30 insertions, 2 deletions
diff --git a/src/js.h b/src/js.h
index e5d7abc..f14e796 100644
--- a/src/js.h
+++ b/src/js.h
@@ -34,3 +34,6 @@ struct pacrunner_js_driver {
int pacrunner_js_driver_register(struct pacrunner_js_driver *driver);
void pacrunner_js_driver_unregister(struct pacrunner_js_driver *driver);
+
+/* Common functions for JS plugins */
+extern const char __pacrunner_js_routines[];
diff --git a/src/javascript.h b/src/js_funcs.c
index d48bd0c..6e9cf1e 100644
--- a/src/javascript.h
+++ b/src/js_funcs.c
@@ -1,4 +1,29 @@
-#define JAVASCRIPT_ROUTINES \
+/*
+ *
+ * PACrunner - Proxy configuration daemon
+ *
+ * Copyright © 2010-2016 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+const char __pacrunner_js_routines[] =
"function dnsDomainIs(host, domain) {\n" \
" return (host.length >= domain.length &&\n" \
" host.substring(host.length - domain.length) == domain);\n" \
@@ -196,4 +221,4 @@
" }\n" \
" return ((date1 <= date) && (date <= date2));\n" \
"}\n" \
-""
+"";