missing copyright section added, and few typo fixes
[platform/core/appfw/message-port-dbus.git] / common / dbus-error.h
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4  * Copyright (C) 2013 Intel Corporation.
5  *
6  * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23
24 #ifndef __MSGPORT_ERROR_H
25 #define __MSGPORT_ERROR_H
26
27 #include <glib.h>
28
29 #define MSGPORT_ERROR_QUARK (msgport_error_quark())
30
31 G_BEGIN_DECLS
32
33 typedef enum _MsgPortError
34 {
35     MSGPORT_ERROR_IO_ERROR = 100,
36     MSGPORT_ERROR_OUT_OF_MEMORY,
37     MSGPORT_ERROR_INVALID_PARAMS,
38     MSGPORT_ERROR_NOT_FOUND,
39     MSGPORT_ERROR_ALREADY_EXISTING,
40     MSGPORT_ERROR_CERTIFICATE_MISMATCH,
41     MSGPORT_ERROR_UNKNOWN
42
43 } MsgPortError;
44
45 GQuark
46 msgport_error_quark ();
47
48 #define msgport_error_new(id, msg, args...) \
49     g_error_new (MSGPORT_ERROR_QUARK, id, msg, ##args) 
50
51 #define msgport_error_port_existing_new(app_id, port_name) \
52     msgport_error_new (MSGPORT_ERROR_ALREADY_EXISTING, \
53                        "port already existing with name '%s' on application '%s'", port_name, app_id)
54
55 #define msgport_error_no_memory_new() \
56     msgport_error_new (MSGPORT_ERROR_OUT_OF_MEMORY, "no memomry")
57
58 #define msgport_error_port_not_found(app_id, port_name) \
59     msgport_error_new (MSGPORT_ERROR_NOT_FOUND, "port not found with name '%s' on application '%s'", port_name, app_id)
60
61 #define msgport_error_port_id_not_found_new(service_id) \
62     msgport_error_new (MSGPORT_ERROR_NOT_FOUND, "no port found with id '%d'", service_id);
63
64 #define msgport_error_certificate_mismatch_new() \
65     msgport_error_new (MSGPORT_ERROR_CERTIFICATE_MISMATCH, "cerficates not matched");
66
67 #define msgport_error_unknown_new() \
68     msgport_error_new (MSGPORT_ERROR_UNKNOWN, "unknown");
69
70 G_END_DECLS
71
72 #endif /* __MSGPORT_ERROR_H */