monitor_sbus.c revision 8263230a0c543a737ab17a071a0ea964dcab4259
3e4bc252a7bd65ed789cbe305c257dfb7abf7cdcjerenkrantz Data Provider Helpers
3e4bc252a7bd65ed789cbe305c257dfb7abf7cdcjerenkrantz Copyright (C) Stephen Gallagher <sgallagh@redhat.com> 2009
3ca6ee111e6044cb463e6dc45b9adcfa3050ff00rbowen This program is free software; you can redistribute it and/or modify
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim it under the terms of the GNU General Public License as published by
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim the Free Software Foundation; either version 3 of the License, or
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen (at your option) any later version.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen This program is distributed in the hope that it will be useful,
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen but WITHOUT ANY WARRANTY; without even the implied warranty of
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3e4bc252a7bd65ed789cbe305c257dfb7abf7cdcjerenkrantz GNU General Public License for more details.
3f08db06526d6901aa08c110b5bc7dde6bc39905nd You should have received a copy of the GNU General Public License
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim along with this program. If not, see <http://www.gnu.org/licenses/>.
3f08db06526d6901aa08c110b5bc7dde6bc39905nd/* Needed for res_init() */
3e4bc252a7bd65ed789cbe305c257dfb7abf7cdcjerenkrantzint monitor_get_sbus_address(TALLOC_CTX *mem_ctx, char **address)
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim default_address = talloc_asprintf(mem_ctx, "unix:path=%s/%s",
65af5ed5b6403a8bed4edaa782c9905780015017rbowenstatic void id_callback(DBusPendingCall *pending, void *ptr)
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf /* reply should never be null. This function shouldn't be called
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf * until reply is valid or timeout has occurred. If reply is NULL
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf * here, something is seriously wrong and we should bail out.
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf DEBUG(0, ("Severe error. A reply callback was called but no"
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf " reply was received and no timeout occurred\n"));
4fb14420685b9831d11271e9e24b40e7ccec808esf /* FIXME: Destroy this connection ? */
5997560e9031b7b0fd0c392512f6cf5ee737b89bjim switch (type) {
9534272616b71aaea50aeec4162e749a96aebd7fsf if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error);
4fb14420685b9831d11271e9e24b40e7ccec808esf /* FIXME: Destroy this connection ? */
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf DEBUG(4, ("Got id ack and version (%d) from Monitor\n", mon_ver));
4fb14420685b9831d11271e9e24b40e7ccec808esf /* Falling through to default intentionally*/
4fb14420685b9831d11271e9e24b40e7ccec808esf * Timeout or other error occurred or something
4fb14420685b9831d11271e9e24b40e7ccec808esf * unexpected happened.
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf * It doesn't matter which, because either way we
4fb14420685b9831d11271e9e24b40e7ccec808esf * know that this connection isn't trustworthy.
4fb14420685b9831d11271e9e24b40e7ccec808esf * We'll destroy it now.
4fb14420685b9831d11271e9e24b40e7ccec808esf /* FIXME: Destroy this connection ? */
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf /* create the message */
4eb7c39c20580bee95586910acc3241784d42ce5sf ret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
4eb7c39c20580bee95586910acc3241784d42ce5sf * Critical Failure
4eb7c39c20580bee95586910acc3241784d42ce5sf * We can't communicate on this connection
4eb7c39c20580bee95586910acc3241784d42ce5sf * We'll drop it using the default destructor.
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf /* Set up the reply handler */
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf dbus_pending_call_set_notify(pending_reply, id_callback, NULL, NULL);
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf ret = dbus_message_append_args(reply, DBUS_TYPE_INVALID);
b71b65bbe45d025c2714893350a4ccea9f6d7fbcsf /* send reply back */
f5f89f79907d5295ca937e1814227875f11949b9jorton /* Send an empty reply to acknowledge receipt */