11 #include <sys/types.h>
112 typedef size_t (*
da_read_fn)(
void *ctx,
size_t maxlen,
char *ptr);
120 typedef void *(*da_alloc_fn)(
void *ctx, size_t);
122 typedef void *(*da_realloc_fn)(
void *ctx,
void *, size_t);
da_status_t da_reporterror(da_status_t severity, const char *fmt,...)
Report an error, as per a report from the API to the user-callback.
da_propid_t * proplist
Definition: dac.h:492
enum da_severity da_severity_t
Primary types of the interface.
Definition: dac.h:87
da_status_t da_searchv(const da_atlas_t *atlas, da_deviceinfo_t *info, da_evidence_t *ev, size_t count)
Find device properties given a set of evidence.
da_status_t da_getpropname(const da_deviceinfo_t *info, da_propid_t propid, const char **propname)
returns the name of a given device property from the search functions
da_propid_t id_propid
Definition: dac.h:442
da_status_t da_atlas_getpropname(const da_atlas_t *atlas, da_propid_t propid, const char **propname)
Given a property ID, return the name of that property.
da_evidence_id_t da_atlas_header_evidence_id(const da_atlas_t *atlas, const char *header_name)
Given a specific HTTP header, return the associated ID for that header.
struct da_propset da_propset_t
Definition: dac.h:119
da_status_t da_getpropfloat(const da_deviceinfo_t *info, da_propid_t propid, double *value)
returns a property value as a float from a given float typed property id
da_status_t da_getproptype(const da_deviceinfo_t *info, da_propid_t propid, da_type_t *type)
Some properties may not be not known to the atlas before the search commences.
void da_init()
Functional interface.
int da_evidence_id_t
An operation on an atlas involves converting a set of evidence strings into a set of property/value p...
Definition: dac.h:99
Used to pass evidence to da_searchv()
Definition: dac.h:509
da_status_t da_getpropstring(const da_deviceinfo_t *info, da_propid_t propid, const char **value)
Given a search result, find the value of a specific property.
size_t propcount
Definition: dac.h:493
da_status
Any method that returns a da_status may potentially fail for one of these reasons.
Definition: dac.h:46
void *(* da_realloc_fn)(void *ctx, void *, size_t)
Definition: dac.h:122
struct da_jsonparser da_jsonparser_t
Definition: dac.h:116
size_t header_evidence_count
Definition: dac.h:429
da_status_t da_atlas_open(da_atlas_t *atlas, da_property_decl_t *extra_props, const void *ptr, size_t pos)
opens a previously compiled atlas for operations.
size_t replacement_regex_count
Definition: dac.h:435
Used to pass properties the API intends to query to the da_atlas_open function This can be used to im...
Definition: dac.h:519
Represents a search result Can be used to retrieve values of known properties discovered from the evi...
Definition: dac.h:485
da_status_t da_atlas_getpropid(const da_atlas_t *atlas, const char *propname, da_propid_t *propid)
Given a property name (Eg, "displayWidth"), return the property ID associated with it for the specifi...
da_deviceinfo_t ** cpr_props
Definition: dac.h:444
struct header_evidence_entry * header_priorities
Definition: dac.h:428
da_status_t da_atlas_getproptype(const da_atlas_t *atlas, da_propid_t propid, da_type_t *type)
Given a property ID, return the type of that property.
void da_seterrorfunc(da_errorfunc_t callback)
User-supplied callback to be invoked with information about an error.
struct da_bitset * cprprop
Definition: dac.h:490
char buf[DA_BUFSIZE]
Definition: dac.h:462
da_severity
Definition: dac.h:63
enum da_status da_status_t
Definition: dac.h:88
enum da_type da_type_t
Definition: dac.h:90
struct da_buf initial_heap
Definition: dac.h:503
const struct atlas_image * image
Definition: dac.h:427
void(* da_free_fn)(void *ctx, void *)
Definition: dac.h:121
void(* da_errorfunc_t)(da_severity_t severity, da_status_t status, const char *msg, va_list args)
Definition: dac.h:123
void * context
Definition: dac.h:473
size_t uar_regex_count
Definition: dac.h:432
da_status_t da_search(const da_atlas_t *atlas, da_deviceinfo_t *info,...)
As da_search, but unrolls the evidence array into variable arguments for simpler calling convention w...
char * cur
Definition: dac.h:460
da_realloc_fn realloc
Definition: dac.h:472
struct da_node da_node_t
Definition: dac.h:117
da_type
All values returned by the API have one of these types.
Definition: dac.h:31
char * value
Definition: dac.h:511
da_evidence_id_t next_evidence
Definition: dac.h:439
void da_close(da_deviceinfo_t *info)
After finishing with a search result, release resources associated with it.
da_alloc_fn alloc
Definition: dac.h:470
da_evidence_id_t user_agent_evidence
Definition: dac.h:437
size_t cpr_count
Definition: dac.h:445
size_t(* da_read_fn)(void *ctx, size_t maxlen, char *ptr)
Definition: dac.h:112
da_evidence_id_t da_atlas_clientprop_evidence_id(const da_atlas_t *atlas)
Return the associated ID of the client side properties evidence.
struct pcre_regex_info * replacement_regexes
Definition: dac.h:434
Represents a usable device atlas interface.
Definition: dac.h:426
int da_propid_t
The search result encompasses a key/value set.
Definition: dac.h:111
da_status_t da_atlas_compile(void *ctx, da_read_fn readfn, da_setpos_fn setposfn, void **ptr, size_t *len)
readfn should present JSON content from ctx.
da_status_t da_getpropboolean(const da_deviceinfo_t *info, da_propid_t propid, bool *value)
returns a property value as a boolean from a given boolean typed property id
da_free_fn free
Definition: dac.h:471
struct da_bitset * present
Definition: dac.h:488
da_type_t type
Definition: dac.h:521
void da_atlas_close(da_atlas_t *atlas)
Release any resources associated with the atlas structure atlas, which was previously generated from ...
da_propset_t * properties
Definition: dac.h:441
struct pcre_regex_info * uar_regexes
Definition: dac.h:431
const char * da_typename(da_type_t type)
returns a textual description of the type "type".
da_status_t(* da_setpos_fn)(void *ctx, off_t off)
Definition: dac.h:89
da_propset_t * local_types
Definition: dac.h:494
da_status_t da_getfirstprop(const da_deviceinfo_t *info, da_propid_t **propid)
da_getfirstprop/da_getnextprop provide iteration over all properties in a search result.
void da_fini()
Release all resources used by the API.
struct da_allocator allocator
Definition: dac.h:486
union da_value * properties
Definition: dac.h:491
da_evidence_id_t key
Definition: dac.h:510
struct da_buf * next
Definition: dac.h:459
Represents a chunk of memory.
Definition: dac.h:458
struct da_bitset * localprop
Definition: dac.h:489
A callback interface for allocating memory from some source Not for public consumption.
Definition: dac.h:469
da_evidence_id_t clientprops_evidence
Definition: dac.h:438
char * limit
Definition: dac.h:461
struct da_buf * heap
The per-deviceinfo heap is stored here.
Definition: dac.h:502
da_status_t da_getpropinteger(const da_deviceinfo_t *info, da_propid_t propid, long *value)
returns a property value as a long from a given long typed property id
const da_atlas_t * atlas
Definition: dac.h:487
da_status_t da_getnextprop(const da_deviceinfo_t *info, da_propid_t **propid)
device info properties iterator
const char * da_atlas_get_property_name(const da_atlas_t *atlas, da_propid_t propid)
returns the name of a global property
void *(* da_alloc_fn)(void *ctx, size_t)
Definition: dac.h:120
const char * name
Definition: dac.h:520
size_t da_getpropcount(const da_deviceinfo_t *info)
returns the number of properties in a result.