summaryrefslogtreecommitdiff
path: root/library/gnome-keyring-proto.h
blob: 67d5880d4b029f5d644cd8e503747c52456ae121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* gnome-keyring-proto.h - helper code for the keyring daemon protocol

   Copyright (C) 2003 Red Hat, Inc

   The Gnome Keyring Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   The Gnome Keyring Library 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.

   Author: Alexander Larsson <alexl@redhat.com>
*/
#ifndef GNOME_KEYRING_PROTO_H
#define GNOME_KEYRING_PROTO_H

#include <stdarg.h>
#include "gnome-keyring.h"

typedef enum {
	GNOME_KEYRING_OP_LOCK_ALL,
	GNOME_KEYRING_OP_SET_DEFAULT_KEYRING,
	GNOME_KEYRING_OP_GET_DEFAULT_KEYRING,
	GNOME_KEYRING_OP_LIST_KEYRINGS,
	GNOME_KEYRING_OP_CREATE_KEYRING,
	GNOME_KEYRING_OP_LOCK_KEYRING,
	GNOME_KEYRING_OP_UNLOCK_KEYRING,
	GNOME_KEYRING_OP_DELETE_KEYRING,
	GNOME_KEYRING_OP_GET_KEYRING_INFO,
	GNOME_KEYRING_OP_SET_KEYRING_INFO,
	GNOME_KEYRING_OP_LIST_ITEMS,
	GNOME_KEYRING_OP_FIND,
	GNOME_KEYRING_OP_CREATE_ITEM,
	GNOME_KEYRING_OP_DELETE_ITEM,
	GNOME_KEYRING_OP_GET_ITEM_INFO,
	GNOME_KEYRING_OP_SET_ITEM_INFO,
	GNOME_KEYRING_OP_GET_ITEM_ATTRIBUTES,
	GNOME_KEYRING_OP_SET_ITEM_ATTRIBUTES,
	GNOME_KEYRING_OP_GET_ITEM_ACL,
	GNOME_KEYRING_OP_SET_ITEM_ACL,
	GNOME_KEYRING_OP_CHANGE_KEYRING_PASSWORD,
	GNOME_KEYRING_OP_SET_DAEMON_DISPLAY,
	GNOME_KEYRING_OP_GET_ITEM_INFO_FULL,

	/* Add new ops here */
	
	GNOME_KEYRING_NUM_OPS
} GnomeKeyringOpCode;

/* request:
   uint32 package size
   uint32 operation
   ... op data

   reply:
   uint32 reply size
   uint32 result
*/

/* Core buffer ops */
void     gnome_keyring_proto_add_uint32         (GString                    *buffer,
						 guint32                     val);
gboolean gnome_keyring_proto_set_uint32         (GString                    *buffer,
						 gsize                       offset,
						 guint32                     val);
gboolean gnome_keyring_proto_get_uint32         (GString                    *buffer,
						 gsize                       offset,
						 gsize                      *next_offset,
						 guint32                    *val);
gboolean gnome_keyring_proto_get_bytes          (GString                    *buffer,
						 gsize                       offset,
						 gsize                      *next_offset,
						 guchar                     *out,
						 gsize                       n_bytes);
void     gnome_keyring_proto_add_time           (GString                    *buffer,
						 time_t                      val);
gboolean gnome_keyring_proto_get_time           (GString                    *buffer,
						 gsize                       offset,
						 gsize                      *next_offset,
						 time_t                     *time);
gboolean gnome_keyring_proto_add_utf8_string    (GString                    *buffer,
						 const char                 *str);
gboolean gnome_keyring_proto_get_utf8_string    (GString                    *buffer,
						 gsize                       offset,
						 gsize                      *next_offset,
						 char                      **str_ret);
gboolean gnome_keyring_proto_add_attribute_list (GString                    *buffer,
						 GnomeKeyringAttributeList  *attributes);
gboolean gnome_keyring_proto_add_acl            (GString                    *buffer,
						 GList                      *acl);


/* marshallers */
gboolean gnome_keyring_proto_encode_op_only          (GString                   *buffer,
						      GnomeKeyringOpCode         op);
gboolean gnome_keyring_proto_encode_op_string        (GString                   *buffer,
						      GnomeKeyringOpCode         op,
						      const char                *str);
gboolean gnome_keyring_proto_encode_op_string_int    (GString                   *buffer,
						      GnomeKeyringOpCode         op,
						      const char                *str,
						      guint32                    integer);
gboolean gnome_keyring_proto_encode_op_string_int_int (GString                   *buffer,
						      GnomeKeyringOpCode         op,
						      const char                *str,
						      guint32                    integer1,
						      guint32                    integer2);
gboolean gnome_keyring_proto_encode_op_string_string (GString                   *buffer,
						      GnomeKeyringOpCode         op,
						      const char                *str1,
						      const char                *str2);
gboolean gnome_keyring_proto_encode_op_string_string_string (GString                   *buffer,
						      GnomeKeyringOpCode         op,
						      const char                *str1,
						      const char                *str2,
						      const char                *str3);
gboolean gnome_keyring_proto_encode_find             (GString                   *buffer,
						      GnomeKeyringItemType       type,
						      GnomeKeyringAttributeList *attributes);
gboolean gnome_keyring_proto_encode_create_item      (GString                   *buffer,
						      const char                *keyring,
						      const char                *display_name,
						      GnomeKeyringAttributeList *attributes,
						      const char                *secret,
						      GnomeKeyringItemType       type,
						      gboolean                   update_if_exists);
gboolean gnome_keyring_proto_encode_set_attributes   (GString                   *buffer,
						      const char                *keyring,
						      guint32                    id,
						      GnomeKeyringAttributeList *attributes);
gboolean gnome_keyring_proto_encode_set_acl          (GString                   *buffer,
						      const char                *keyring,
						      guint32                    id,
						      GList 			*acl);
gboolean gnome_keyring_proto_encode_set_item_info    (GString                   *buffer,
						      const char                *keyring,
						      guint32                    id,
						      GnomeKeyringItemInfo      *info);
gboolean gnome_keyring_proto_encode_set_keyring_info (GString                   *buffer,
						      const char                *keyring,
						      GnomeKeyringInfo          *info);


/* demarshallers */
gboolean gnome_keyring_proto_decode_packet_operation         (GString                    *buffer,
							      GnomeKeyringOpCode         *op);
gboolean gnome_keyring_proto_decode_packet_size              (GString                    *buffer,
							      guint32                    *size);
gboolean gnome_keyring_proto_decode_attribute_list           (GString                    *buffer,
							      gsize                       offset,
							      gsize                      *next_offset,
							      GnomeKeyringAttributeList **attributes_out);
gboolean gnome_keyring_proto_decode_acl                      (GString                    *buffer,
							      gsize                       offset,
							      gsize                      *next_offset,
							      GList                     **attributes_out);
gboolean gnome_keyring_proto_decode_result_reply             (GString                    *buffer,
							      GnomeKeyringResult         *result);
gboolean gnome_keyring_proto_decode_result_string_reply      (GString                    *buffer,
							      GnomeKeyringResult         *result,
							      char                      **str);
gboolean gnome_keyring_proto_decode_result_string_list_reply (GString                    *buffer,
							      GnomeKeyringResult         *result,
							      GList                     **list);
gboolean gnome_keyring_proto_decode_op_string                (GString                    *buffer,
							      GnomeKeyringOpCode         *op_out,
							      char                      **str_out);
gboolean gnome_keyring_proto_decode_op_string_string         (GString                    *buffer,
							      GnomeKeyringOpCode         *op_out,
							      char                      **str1_out,
							      char                      **str2_out);
gboolean gnome_keyring_proto_decode_op_string_string_string         (GString                    *buffer,
							      GnomeKeyringOpCode         *op_out,
							      char                      **str1_out,
							      char                      **str2_out,
							      char                      **str3_out);
gboolean gnome_keyring_proto_decode_op_string_int            (GString                    *buffer,
							      GnomeKeyringOpCode         *op_out,
							      char                      **str1,
							      guint32                    *val);
gboolean gnome_keyring_proto_decode_get_item_info	     (GString                    *buffer,
							      GnomeKeyringOpCode         *op_out,
							      char                      **keyring,
							      guint32                    *item_id,
							      guint32                    *flags);
gboolean gnome_keyring_proto_decode_find                     (GString                    *buffer,
							      GnomeKeyringItemType       *type,
							      GnomeKeyringAttributeList **attributes);
gboolean gnome_keyring_proto_decode_find_reply               (GString                    *buffer,
							      GnomeKeyringResult         *result,
							      GList                     **list_out);
gboolean gnome_keyring_proto_decode_get_attributes_reply     (GString                    *buffer,
							      GnomeKeyringResult         *result,
							      GnomeKeyringAttributeList **attributes);
gboolean gnome_keyring_proto_decode_get_acl_reply            (GString                    *buffer,
							      GnomeKeyringResult         *result,
							      GList                     **acl);
gboolean gnome_keyring_proto_decode_get_item_info_reply      (GString                    *buffer,
							      GnomeKeyringResult         *result,
							      GnomeKeyringItemInfo      **info);
gboolean gnome_keyring_proto_decode_get_keyring_info_reply   (GString                    *buffer,
							      GnomeKeyringResult         *result,
							      GnomeKeyringInfo          **info);
gboolean gnome_keyring_proto_decode_result_int_list_reply    (GString                    *buffer,
							      GnomeKeyringResult         *result,
							      GList                     **list);
gboolean gnome_keyring_proto_decode_result_integer_reply     (GString                    *buffer,
							      GnomeKeyringResult         *result,
							      guint32                    *integer);
gboolean gnome_keyring_proto_decode_create_item              (GString                    *packet,
							      char                      **keyring,
							      char                      **display_name,
							      GnomeKeyringAttributeList **attributes,
							      char                      **secret,
							      GnomeKeyringItemType       *type_out,
							      gboolean                   *update_if_exists);
gboolean gnome_keyring_proto_decode_set_item_info            (GString                    *buffer,
							      char                      **keyring,
							      guint32                    *item_id,
							      GnomeKeyringItemType       *type,
							      char                      **display_name,
							      char                      **secret);
gboolean gnome_keyring_proto_decode_set_keyring_info         (GString                    *buffer,
							      char                      **keyring,
							      gboolean                   *lock_on_idle,
							      guint32                    *lock_timeout);
gboolean gnome_keyring_proto_decode_set_attributes           (GString                    *buffer,
							      char                      **keyring,
							      guint32                    *item_id,
							      GnomeKeyringAttributeList **attributes);
gboolean gnome_keyring_proto_decode_set_acl                  (GString                    *buffer,
							      char                      **keyring,
							      guint32                    *item_id,
							      GList                     **acl);


   
#endif /* GNOME_KEYRING_PROTO_H */