monitor_sbus.c revision 8263230a0c543a737ab17a071a0ea964dcab4259
/*
SSSD
Data Provider Helpers
Copyright (C) Stephen Gallagher <sgallagh@redhat.com> 2009
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/>.
*/
/* Needed for res_init() */
#include <resolv.h>
#include "sbus/sssd_dbus.h"
#include "monitor/monitor_interfaces.h"
{
char *default_address;
if (default_address == NULL) {
return ENOMEM;
}
return EOK;
}
{
int type;
if (!reply) {
/* reply should never be null. This function shouldn't be called
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
DEBUG(0, ("Severe error. A reply callback was called but no"
" reply was received and no timeout occurred\n"));
/* FIXME: Destroy this connection ? */
goto done;
}
switch (type) {
if (!ret) {
/* FIXME: Destroy this connection ? */
goto done;
}
break;
case DBUS_MESSAGE_TYPE_ERROR:
DEBUG(0,("The Monitor returned an error [%s]\n",
/* Falling through to default intentionally*/
default:
/*
* Timeout or other error occurred or something
* unexpected happened.
* It doesn't matter which, because either way we
* know that this connection isn't trustworthy.
* We'll destroy it now.
*/
/* FIXME: Destroy this connection ? */
break;
}
done:
}
{
/* create the message */
DEBUG(0, ("Out of memory?!\n"));
return ENOMEM;
}
if (!ret) {
return EIO;
}
30000 /* TODO: set timeout */);
if (!ret || !pending_reply) {
/*
* Critical Failure
* We can't communicate on this connection
* We'll drop it using the default destructor.
*/
DEBUG(0, ("D-BUS send failed.\n"));
return EIO;
}
/* Set up the reply handler */
return EOK;
}
struct sbus_connection *conn)
{
if (!ret) {
return EIO;
}
/* send reply back */
return EOK;
}
struct sbus_connection *conn)
{
int ret;
if(ret != 0) {
return EIO;
}
/* Send an empty reply to acknowledge receipt */
}