certifiacte validation code added
[profile/ivi/message-port.git] / common / dbus-error.h
1 #ifndef __MSGPORT_ERROR_H
2 #define __MSGPORT_ERROR_H
3
4 #include <glib.h>
5
6 #define MSGPORT_ERROR_QUARK (msgport_error_quark())
7
8 G_BEGIN_DECLS
9
10 typedef enum _MsgPortError
11 {
12     MSGPORT_ERROR_IO_ERROR = 100,
13     MSGPORT_ERROR_OUT_OF_MEMORY,
14     MSGPORT_ERROR_INVALID_PARAMS,
15     MSGPORT_ERROR_NOT_FOUND,
16     MSGPORT_ERROR_ALREADY_EXISTING,
17     MSGPORT_ERROR_CERTIFICATE_MISMATCH,
18     MSGPORT_ERROR_UNKNOWN
19
20 } MsgPortError;
21
22 GQuark
23 msgport_error_quark ();
24
25 #define msgport_error_new(id, msg, args...) \
26     g_error_new (MSGPORT_ERROR_QUARK, id, msg, ##args) 
27
28 #define msgport_error_port_existing_new(app_id, port_name) \
29     msgport_error_new (MSGPORT_ERROR_ALREADY_EXISTING, \
30                        "port already existing with name '%s' on application '%s'", port_name, app_id)
31
32 #define msgport_error_no_memory_new() \
33     msgport_error_new (MSGPORT_ERROR_OUT_OF_MEMORY, "no memomry")
34
35 #define msgport_error_port_not_found(app_id, port_name) \
36     msgport_error_new (MSGPORT_ERROR_NOT_FOUND, "port not found with name '%s' on application '%s'", port_name, app_id)
37
38 #define msgport_error_port_id_not_found_new(service_id) \
39     msgport_error_new (MSGPORT_ERROR_NOT_FOUND, "no port found with id '%d'", service_id);
40
41 #define msgport_error_certificate_mismatch_new() \
42     msgport_error_new (MSGPORT_ERROR_CERTIFICATE_MISMATCH, "cerficates not matched");
43
44 #define msgport_error_unknown_new() \
45     msgport_error_new (MSGPORT_ERROR_UNKNOWN, "unknown");
46
47 G_END_DECLS
48
49 #endif /* __MSGPORT_ERROR_H */