Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

mntd_dbus_error.c

00001 /***************************************************************************
00002  * CVSID: $Id: mntd_dbus_error.c,v 1.4 2004/03/27 01:43:25 stefanb Exp $
00003  *
00004  * mntd_dbus_error.c : D-BUS errors for MNT daemon
00005  *
00006  * Copyright (C) 2004 Stefan Bambach, <stefan@bambach.biz>
00007  *
00008  * Licensed under the GNU General Public License 2.0
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  **************************************************************************/
00025  
00026 #ifdef HAVE_CONFIG_H
00027 #  include <config.h>
00028 #endif
00029 
00030 #include <stdio.h>
00031 #include <stdlib.h>
00032 #include <string.h>
00033 #include <dbus/dbus.h>
00034 #include <dbus/dbus-glib.h>
00035 
00036 #include <libmnt/libmnt.h>   /* for common defines etc. */
00037 
00038 #include "mntd_dbus_error.h"
00039 #include "errmanager.h"
00040 
00041 
00056 void mntd_dbus_error_raise_no_such_device(DBusConnection* connection,
00057                                  DBusMessage* in_reply_to,
00058                                  const char* udi)
00059 {
00060     char buf[512];
00061     DBusMessage *reply;
00062     
00063     snprintf(buf, 511, "No device with id %s", udi);
00064     MSG_WARNING(buf);
00065     reply = dbus_message_new_error(in_reply_to, 
00066                                             "biz.bambach.Mnt.NoSuchDevice", 
00067                                             buf);
00068     if(reply == NULL) {
00069         MSG_EMERG("Out of memory");
00070     }
00071     if(!dbus_connection_send(connection, reply, NULL)) {
00072         MSG_EMERG("Out of memory");
00073     }
00074     dbus_message_unref(reply);
00075 }
00076 
00077 

Generated on Thu May 27 23:27:28 2004 for Mntd by doxygen 1.3.5