1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #pragma once
3 
4 #include "hashmap.h"
5 #include "time-util.h"
6 #include "udev-util.h"
7 
8 typedef struct UdevRules UdevRules;
9 typedef struct UdevEvent UdevEvent;
10 
11 typedef enum {
12         ESCAPE_UNSET,
13         ESCAPE_NONE,    /* OPTIONS="string_escape=none" */
14         ESCAPE_REPLACE, /* OPTIONS="string_escape=replace" */
15         _ESCAPE_TYPE_MAX,
16         _ESCAPE_TYPE_INVALID = -EINVAL,
17 } UdevRuleEscapeType;
18 
19 int udev_rules_parse_file(UdevRules *rules, const char *filename);
20 UdevRules* udev_rules_new(ResolveNameTiming resolve_name_timing);
21 int udev_rules_load(UdevRules **ret_rules, ResolveNameTiming resolve_name_timing);
22 UdevRules *udev_rules_free(UdevRules *rules);
23 DEFINE_TRIVIAL_CLEANUP_FUNC(UdevRules*, udev_rules_free);
24 
25 bool udev_rules_check_timestamp(UdevRules *rules);
26 int udev_rules_apply_to_event(UdevRules *rules, UdevEvent *event,
27                               usec_t timeout_usec,
28                               int timeout_signal,
29                               Hashmap *properties_list);
30 int udev_rules_apply_static_dev_perms(UdevRules *rules);
31