summaryrefslogtreecommitdiffstats
path: root/src/sbus/sssd_dbus_meta.c
blob: f058edec8044f0e52d90102abcf358fef1c80a57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
    Authors:
        Stef Walter <stefw@redhat.com>

    Copyright (C) 2014 Red Hat

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "util/util.h"
#include "sbus/sssd_dbus_meta.h"

const struct sbus_method_meta *
sbus_meta_find_method(const struct sbus_interface_meta *interface,
                      const char *method_name)
{
    const struct sbus_method_meta *method;

    for (method = interface->methods; method && method->name; method++) {
        if (strcmp(method_name, method->name) == 0) {
            return method;
        }
    }

    return NULL;
}

const struct sbus_signal_meta *
sbus_meta_find_signal(const struct sbus_interface_meta *interface,
                      const char *signal_name)
{
    const struct sbus_signal_meta *sig;

    for (sig = interface->signals; sig && sig->name; sig++) {
        if (strcmp(signal_name, sig->name) == 0) {
            return sig;
        }
    }

    return NULL;
}

const struct sbus_property_meta *
sbus_meta_find_property(const struct sbus_interface_meta *interface,
                        const char *property_name)
{
    const struct sbus_property_meta *property;

    for (property = interface->properties; property && property->name; property++) {
        if (strcmp(property_name, property->name) == 0) {
            return property;
        }
    }

    return NULL;
}