Line data Source code
1 : /*
2 : Authors:
3 : Stef Walter <stefw@redhat.com>
4 :
5 : Copyright (C) 2014 Red Hat
6 :
7 : This program is free software; you can redistribute it and/or modify
8 : it under the terms of the GNU General Public License as published by
9 : the Free Software Foundation; either version 3 of the License, or
10 : (at your option) any later version.
11 :
12 : This program is distributed in the hope that it will be useful,
13 : but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : GNU General Public License for more details.
16 :
17 : You should have received a copy of the GNU General Public License
18 : along with this program. If not, see <http://www.gnu.org/licenses/>.
19 : */
20 :
21 : #include "util/util.h"
22 : #include "sbus/sssd_dbus_meta.h"
23 :
24 : const struct sbus_method_meta *
25 1 : sbus_meta_find_method(const struct sbus_interface_meta *interface,
26 : const char *method_name)
27 : {
28 : const struct sbus_method_meta *method;
29 :
30 1 : for (method = interface->methods; method && method->name; method++) {
31 1 : if (strcmp(method_name, method->name) == 0) {
32 1 : return method;
33 : }
34 : }
35 :
36 0 : return NULL;
37 : }
38 :
39 : const struct sbus_signal_meta *
40 1 : sbus_meta_find_signal(const struct sbus_interface_meta *interface,
41 : const char *signal_name)
42 : {
43 : const struct sbus_signal_meta *sig;
44 :
45 1 : for (sig = interface->signals; sig && sig->name; sig++) {
46 1 : if (strcmp(signal_name, sig->name) == 0) {
47 1 : return sig;
48 : }
49 : }
50 :
51 0 : return NULL;
52 : }
53 :
54 : const struct sbus_property_meta *
55 1 : sbus_meta_find_property(const struct sbus_interface_meta *interface,
56 : const char *property_name)
57 : {
58 : const struct sbus_property_meta *property;
59 :
60 1 : for (property = interface->properties; property && property->name; property++) {
61 1 : if (strcmp(property_name, property->name) == 0) {
62 1 : return property;
63 : }
64 : }
65 :
66 0 : return NULL;
67 : }
|