]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: da: update doc and build for new scheduler mode service.
authorDavid Carlier <dcarlier@deviceatlas.com>
Thu, 27 Jan 2022 18:13:54 +0000 (18:13 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 28 Jan 2022 06:28:53 +0000 (07:28 +0100)
Mentions of the new database update runtime mode and update of
the legit module and the dummy part too.
Note the DeviceAtlas C API version 2.4.0 minimum required
alongside with libCURL, libzip and libgz.

Makefile
addons/deviceatlas/dummy/Os/daunix.c [new file with mode: 0644]
addons/deviceatlas/dummy/dac.h
addons/deviceatlas/dummy/dadwcom.c [new file with mode: 0644]
addons/deviceatlas/dummy/dasch.c [new file with mode: 0644]
doc/DeviceAtlas-device-detection.txt

index 657ceb7262edbd18a31c7860ab11cade5cbedccf..57c7510a129c5cd5ff1c495ce193c561a35f0df4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -653,6 +653,9 @@ endif
 ifneq ($(USE_PCRE2),)
 OPTIONS_CFLAGS  += -DDA_REGEX_HDR=\"dac_pcre2.c\" -DDA_REGEX_TAG=2
 endif
+OPTIONS_OBJS   += $(DEVICEATLAS_LIB)/Os/daunix.o
+OPTIONS_OBJS   += $(DEVICEATLAS_LIB)/dadwcom.o
+OPTIONS_OBJS   += $(DEVICEATLAS_LIB)/dasch.o
 OPTIONS_OBJS   += $(DEVICEATLAS_LIB)/json.o
 OPTIONS_OBJS   += $(DEVICEATLAS_LIB)/dac.o
 endif
@@ -1033,7 +1036,7 @@ clean:
        $(Q)rm -f haproxy-$(VERSION) haproxy-$(VERSION)$(SUBVERS)$(EXTRAVERSION) nohup.out gmon.out
        $(Q)rm -f addons/promex/*.[oas]
        $(Q)rm -f addons/51degrees/*.[oas] addons/51degrees/dummy/*.[oas] addons/51degrees/dummy/*/*.[oas]
-       $(Q)rm -f addons/deviceatlas/*.[oas] addons/deviceatlas/dummy/*.[oas]
+       $(Q)rm -f addons/deviceatlas/*.[oas] addons/deviceatlas/dummy/*.[oas] addons/deviceatlas/dummy/*.o
        $(Q)rm -f addons/ot/src/*.[oas]
        $(Q)rm -f addons/wurfl/*.[oas] addons/wurfl/dummy/*.[oas]
        $(Q)rm -f admin/*/*.[oas] admin/*/*/*.[oas]
diff --git a/addons/deviceatlas/dummy/Os/daunix.c b/addons/deviceatlas/dummy/Os/daunix.c
new file mode 100644 (file)
index 0000000..ca696f9
--- /dev/null
@@ -0,0 +1,9 @@
+#include "dac.h"
+
+static char const __attribute__((unused)) rcsid[] = "$Id: dac.c, v dummy 1970/01/01 00:00:01 dcarlier Exp $";
+
+da_status_t
+da_atlas_read_mapped(const char *path, void *m, void **p, size_t *l)
+{
+    return DA_SYS;
+}
index 92a9396c0ede25746ef33f20ce9a6f6663ae78f9..55bc6c025ba3b237e8ad8417f030553c4e83c5b2 100644 (file)
@@ -223,6 +223,17 @@ da_status_t da_atlas_compile(void *ctx, da_read_fn readfn, da_setpos_fn setposfn
  */
 da_status_t da_atlas_open(da_atlas_t *atlas, da_property_decl_t *extra_props, const void *ptr, size_t pos);
 
+/**
+ * @brief read from a mapped data which then replace da_atlas_compile call
+ *
+ * @param dumppath, anonymous if NULL
+ * @param map for anonymous, it is the responsability of the caller to unmap it, ignored otherwise
+ * @param maplen for anonymous, it is the size of the mapped data, ignored otherwise
+ * @param ptr Pointer dynamically allocated if the mapping happened normally
+ * @param len size of the atlas image
+ * @return status of mapping
+ */
+da_status_t da_atlas_read_mapped(const char *path, void *m, void **p, size_t *l);
 /**
  * @brief Release any resources associated with the atlas structure atlas, which was previously generated from
  * da_read_atlas or da_compile_atlas.
diff --git a/addons/deviceatlas/dummy/dadwcom.c b/addons/deviceatlas/dummy/dadwcom.c
new file mode 100644 (file)
index 0000000..53c5fdf
--- /dev/null
@@ -0,0 +1 @@
+#include <stdio.h>
diff --git a/addons/deviceatlas/dummy/dasch.c b/addons/deviceatlas/dummy/dasch.c
new file mode 100644 (file)
index 0000000..53c5fdf
--- /dev/null
@@ -0,0 +1 @@
+#include <stdio.h>
index 9a1c9b5940ed37cb25c9e772e5f506a515babc65..b6009180cd1a9c57c1d24dc8efe6053b93e0e91a 100644 (file)
@@ -9,7 +9,9 @@ The build supports the USE_PCRE and USE_PCRE2 options. Once extracted :
 
 Optionally DEVICEATLAS_INC and DEVICEATLAS_LIB may be set to override the path
 to the include files and libraries respectively if they're not in the source
-directory.
+directory. However, if the API had been installed beforehand, DEVICEATLAS_SRC
+can be omitted. Note that the DeviceAtlas C API version supported is the 2.4.0
+at minimum.
 
 For HAProxy developers who need to verify that their changes didn't accidentally
 break the DeviceAtlas code, it is possible to build a dummy library provided in
@@ -62,5 +64,19 @@ Single HTTP header
 
     acl device_type_tablet req.fhdr(User-Agent),da-csv-conv(primaryHardwareType) "Tablet"
 
+Optionally a JSON download scheduler is provided to allow a data file being
+fetched automatically in a daily basis without restarting HAProxy :
 
-Please find more information about DeviceAtlas and the detection methods at https://deviceatlas.com/resources .
+    $ cd addons/deviceatlas && make [DEVICEATLAS_SRC=<path to the API root folder>]
+
+Similarly, if the DeviceAtlas API is installed, DEVICEATLAS_SRC can be omitted.
+
+    $ ./dadwsch -u JSON data file URL e.g. "https://deviceatlas.com/getJSON?licencekey=<your licence key>&format=zip&data=my&index=web" \
+      [-p download directory path /tmp by default] \
+      [-d scheduled hour of download, hour when the service is launched by default]
+
+Noted it needs to be started before HAProxy.
+
+
+Please find more information about DeviceAtlas and the detection methods at
+https://deviceatlas.com/resources .