dbus-client-track.c revision 718db96199eb307751264e4163555662c9a389fa
/*-*- 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 "dbus-client-track.h"
static unsigned tracked_client_hash(const void *a) {
const BusTrackedClient *x = a;
}
static int tracked_client_compare(const void *a, const void *b) {
const BusTrackedClient *x = a, *y = b;
int r;
if (r != 0)
return r;
return -1;
return 1;
return 0;
}
BusTrackedClient *c = userdata;
int r;
if (r < 0) {
log_debug("Failed to parse NameOwnerChanged message.");
return 0;
}
return 0;
}
static char *build_match(const char *name) {
return strjoin("type='signal',"
"sender='org.freedesktop.DBus',"
"path='/org/freedesktop/DBus',"
"interface='org.freedesktop.DBus',"
"member='NameOwnerChanged',"
}
BusTrackedClient *c, *found;
size_t l;
int r;
assert(s);
if (r < 0)
return r;
c->set = *s;
if (found)
return 0;
if (!c)
return -ENOMEM;
r = set_put(*s, c);
if (r < 0) {
free(c);
return r;
}
if (!match) {
set_remove(*s, c);
free(c);
return -ENOMEM;
}
if (r < 0) {
set_remove(*s, c);
free(c);
return r;
}
}
sd_bus_ref(c->bus);
return 1;
}
assert(s);
assert(c);
if (match)
}
sd_bus_unref(c->bus);
set_remove(s, c);
free(c);
}
BusTrackedClient *c, *found;
size_t l;
assert(s);
if (!found)
return 0;
bus_client_free_one(s, found);
return 1;
}
void bus_client_track_free(Set *s) {
BusTrackedClient *c;
while ((c = set_first(s)))
bus_client_free_one(s, c);
set_free(s);
}
BusTrackedClient *c;
Iterator i;
int r = 0;
SET_FOREACH(c, s, i)
bus_client_free_one(s, c);
r++;
}
return r;
}
BusTrackedClient *c;
Iterator i;
assert(m);
assert(f);
SET_FOREACH(c, s, i) {
else
}
}
const char *e, *q, *name;
void *p;
int r;
if (!e)
return 0;
q = strpbrk(e, WHITESPACE);
if (!q) {
if (m->api_bus) {
name = e;
goto finish;
}
return 1;
}
log_debug("Failed to parse subscription pointer.");
return -EINVAL;
}
if (!bus)
return 1;
if (r < 0) {
return r;
}
return 1;
}