diff --git a/Makefile b/Makefile index 657ceb726..57c7510a1 100644 --- 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 index 000000000..ca696f9bd --- /dev/null +++ b/addons/deviceatlas/dummy/Os/daunix.c @@ -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; +} diff --git a/addons/deviceatlas/dummy/dac.h b/addons/deviceatlas/dummy/dac.h index 92a9396c0..55bc6c025 100644 --- a/addons/deviceatlas/dummy/dac.h +++ b/addons/deviceatlas/dummy/dac.h @@ -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 index 000000000..53c5fdf17 --- /dev/null +++ b/addons/deviceatlas/dummy/dadwcom.c @@ -0,0 +1 @@ +#include diff --git a/addons/deviceatlas/dummy/dasch.c b/addons/deviceatlas/dummy/dasch.c new file mode 100644 index 000000000..53c5fdf17 --- /dev/null +++ b/addons/deviceatlas/dummy/dasch.c @@ -0,0 +1 @@ +#include diff --git a/doc/DeviceAtlas-device-detection.txt b/doc/DeviceAtlas-device-detection.txt index 9a1c9b594..b6009180c 100644 --- a/doc/DeviceAtlas-device-detection.txt +++ b/doc/DeviceAtlas-device-detection.txt @@ -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=] + +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=&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 .