mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
sd-bus: make name validation functions public
Those are fairly trivial to reimplement, but any non-trivial user of sd-bus is likely to need them. So let's expose them to save everyone the trouble. I'm keeping the internal functions and making the public ones thin wrappers, because for the internal uses we don't need the additional asserts, and also we can't expose _pure_ annotation easily, and dropping it would likely make the compiled code a bit less efficient.
This commit is contained in:
parent
4c163bf1f4
commit
d2916409ed
@ -700,6 +700,11 @@ global:
|
||||
|
||||
LIBSYSTEMD_246 {
|
||||
global:
|
||||
sd_bus_interface_name_is_valid;
|
||||
sd_bus_service_name_is_valid;
|
||||
sd_bus_member_name_is_valid;
|
||||
sd_bus_object_path_is_valid;
|
||||
|
||||
sd_bus_call_methodv;
|
||||
sd_bus_call_method_asyncv;
|
||||
sd_bus_emit_signalv;
|
||||
@ -707,6 +712,7 @@ global:
|
||||
sd_bus_reply_method_errorfv;
|
||||
sd_bus_reply_method_returnv;
|
||||
sd_bus_set_propertyv;
|
||||
|
||||
sd_path_lookup;
|
||||
sd_path_lookup_strv;
|
||||
} LIBSYSTEMD_245;
|
||||
|
@ -354,6 +354,7 @@ bool interface_name_is_valid(const char *p) _pure_;
|
||||
bool service_name_is_valid(const char *p) _pure_;
|
||||
bool member_name_is_valid(const char *p) _pure_;
|
||||
bool object_path_is_valid(const char *p) _pure_;
|
||||
|
||||
char *object_path_startswith(const char *a, const char *b) _pure_;
|
||||
|
||||
bool namespace_complex_pattern(const char *pattern, const char *value) _pure_;
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "bus-internal.h"
|
||||
#include "bus-type.h"
|
||||
|
||||
bool bus_type_is_valid(char c) {
|
||||
@ -135,3 +136,27 @@ int bus_type_get_size(char c) {
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
_public_ int sd_bus_interface_name_is_valid(const char *p) {
|
||||
assert_return(p, -EINVAL);
|
||||
|
||||
return interface_name_is_valid(p);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_service_name_is_valid(const char *p) {
|
||||
assert_return(p, -EINVAL);
|
||||
|
||||
return service_name_is_valid(p);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_member_name_is_valid(const char *p) {
|
||||
assert_return(p, -EINVAL);
|
||||
|
||||
return member_name_is_valid(p);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_object_path_is_valid(const char *p) {
|
||||
assert_return(p, -EINVAL);
|
||||
|
||||
return object_path_is_valid(p);
|
||||
}
|
||||
|
@ -124,6 +124,13 @@ typedef _sd_destroy_t sd_bus_destroy_t;
|
||||
#include "sd-bus-protocol.h"
|
||||
#include "sd-bus-vtable.h"
|
||||
|
||||
/* Naming */
|
||||
|
||||
int sd_bus_interface_name_is_valid(const char *p);
|
||||
int sd_bus_service_name_is_valid(const char *p);
|
||||
int sd_bus_member_name_is_valid(const char *p);
|
||||
int sd_bus_object_path_is_valid(const char *p);
|
||||
|
||||
/* Connections */
|
||||
|
||||
int sd_bus_default(sd_bus **ret);
|
||||
|
Loading…
Reference in New Issue
Block a user