MEDIUM: da: update doc and build for new scheduler mode service.

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.
This commit is contained in:
David Carlier 2022-01-27 18:13:54 +00:00 committed by Willy Tarreau
parent e9cff619c1
commit b81483cf2d
6 changed files with 44 additions and 3 deletions

View File

@ -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]

View File

@ -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;
}

View 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.

View File

@ -0,0 +1 @@
#include <stdio.h>

View File

@ -0,0 +1 @@
#include <stdio.h>

View 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 .