b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter/*
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter Authors:
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter Stef Walter <stefw@redhat.com>
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter Copyright (C) 2014 Red Hat
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter This program is free software; you can redistribute it and/or modify
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter it under the terms of the GNU General Public License as published by
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter the Free Software Foundation; either version 3 of the License, or
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter (at your option) any later version.
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter This program is distributed in the hope that it will be useful,
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter but WITHOUT ANY WARRANTY; without even the implied warranty of
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter GNU General Public License for more details.
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter You should have received a copy of the GNU General Public License
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter along with this program. If not, see <http://www.gnu.org/licenses/>.
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter*/
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter#include "util/util.h"
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter#include "sbus/sssd_dbus_meta.h"
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walterconst struct sbus_method_meta *
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Waltersbus_meta_find_method(const struct sbus_interface_meta *interface,
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter const char *method_name)
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter{
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter const struct sbus_method_meta *method;
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter for (method = interface->methods; method && method->name; method++) {
3d5908ed0faf400a5c7d9c3e4312597ee1b7786aJakub Hrozek if (strcmp(method_name, method->name) == 0) {
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter return method;
3d5908ed0faf400a5c7d9c3e4312597ee1b7786aJakub Hrozek }
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter }
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter return NULL;
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter}
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walterconst struct sbus_signal_meta *
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Waltersbus_meta_find_signal(const struct sbus_interface_meta *interface,
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter const char *signal_name)
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter{
e998f7e52cea5344f12a444761cb2d9cc6b00007Lukas Slebodnik const struct sbus_signal_meta *sig;
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
e998f7e52cea5344f12a444761cb2d9cc6b00007Lukas Slebodnik for (sig = interface->signals; sig && sig->name; sig++) {
e998f7e52cea5344f12a444761cb2d9cc6b00007Lukas Slebodnik if (strcmp(signal_name, sig->name) == 0) {
e998f7e52cea5344f12a444761cb2d9cc6b00007Lukas Slebodnik return sig;
3d5908ed0faf400a5c7d9c3e4312597ee1b7786aJakub Hrozek }
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter }
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter return NULL;
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter}
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walterconst struct sbus_property_meta *
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Waltersbus_meta_find_property(const struct sbus_interface_meta *interface,
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter const char *property_name)
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter{
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter const struct sbus_property_meta *property;
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter for (property = interface->properties; property && property->name; property++) {
3d5908ed0faf400a5c7d9c3e4312597ee1b7786aJakub Hrozek if (strcmp(property_name, property->name) == 0) {
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter return property;
3d5908ed0faf400a5c7d9c3e4312597ee1b7786aJakub Hrozek }
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter }
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter return NULL;
b699c4d7f85a5404be1d1ee9450331aea869b886Stef Walter}