test-bus-match.c revision 19befb2d5fc087f96e40ddc432b2cc9385666209
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include "log.h"
#include "util.h"
#include "macro.h"
#include "bus-match.h"
#include "bus-message.h"
#include "bus-util.h"
#include "bus-slot.h"
static bool mask[32];
return 0;
}
static bool mask_contains(unsigned a[], unsigned n) {
unsigned i, j;
for (i = 0; i < ELEMENTSOF(mask); i++) {
bool found = false;
for (j = 0; j < n; j++)
if (a[j] == i) {
found = true;
break;
}
return false;
}
return true;
}
static int match_add(sd_bus_slot *slots, struct bus_match_node *root, const char *match, int value) {
unsigned n_components = 0;
sd_bus_slot *s;
int r;
zero(*s);
if (r < 0)
return r;
return r;
}
struct bus_match_node root;
enum bus_match_node_type i;
assert_se(match_add(slots, &root, "arg2='wal\\'do',sender='foo',type='signal',interface='bar.x',", 1) >= 0);
assert_se(match_add(slots, &root, "arg2='wal\\'do2',sender='foo',type='signal',interface='bar.x',", 2) >= 0);
assert_se(match_add(slots, &root, "arg3='test',sender='foo',type='signal',interface='bar.x',", 3) >= 0);
assert_se(match_add(slots, &root, "arg3='test',sender='foo',type='method_call',interface='bar.x',", 4) >= 0);
bus_match_dump(&root, 0);
bus_match_dump(&root, 0);
for (i = 0; i < _BUS_MATCH_NODE_TYPE_MAX; i++) {
char buf[32];
const char *x;
if (i >= BUS_MATCH_MESSAGE_TYPE)
}
return 0;
}