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.6 2004/08/07 15:10:47 stefanb Exp $
00003  *
00004  * mntd_dbus_error.c : D-BUS errors for MNT daemon
00005  *
00006  * Copyright (C) 2004 Stefan Bambach, <sbambach@gmx.net>
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 #include "dbug_mem.h"
00041 
00042 
00057 void mntd_dbus_error_raise_no_such_device(DBusConnection* connection,
00058                                  DBusMessage* in_reply_to,
00059                                  const char* udi)
00060 {
00061     char buf[512];
00062     DBusMessage *reply;
00063     
00064     snprintf(buf, 511, "No device with id %s", udi);
00065     MSG_WARNING(buf);
00066     reply = dbus_message_new_error(in_reply_to, 
00067                                             "biz.bambach.Mnt.NoSuchDevice", 
00068                                             buf);
00069     if(reply == NULL) {
00070         MSG_EMERG("Out of memory");
00071     }
00072     if(!dbus_connection_send(connection, reply, NULL)) {
00073         MSG_EMERG("Out of memory");
00074     }
00075     dbus_message_unref(reply);
00076 }
00077 
00078 

Generated on Wed Mar 30 13:43:26 2005 for Mntd by  doxygen 1.3.9.1