dtcm: make it build
[oweals/cde.git] / cde / lib / csa / cm.x
1 /* $XConsortium: cm.x /main/1 1996/04/21 19:21:56 drk $ */
2 /*
3  * (c) Copyright 1996 Digital Equipment Corporation.
4  * (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
5  * (c) Copyright 1993,1994,1996 International Business Machines Corp.
6  * (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
7  * (c) Copyright 1993,1994,1996 Novell, Inc. 
8  * (c) Copyright 1996 FUJITSU LIMITED.
9  * (c) Copyright 1996 Hitachi.
10  */
11
12 /*
13  * Calendar manager service RPC protocol.
14  */
15
16 #if defined(RPC_HDR) || defined(RPC_XDR)
17
18 %
19 %#include "csa.h" 
20 %#include "connection.h"
21 #ifdef RPC_XDR
22 %#include "cmxdr.h"
23 #endif
24 %
25
26 %
27 %/*
28 % * cms_name - a user name or calendar name which is
29 % *             variable length character string
30 % */
31 typedef string  cms_name<>;
32
33 %
34 %/*
35 % * buffer - a variable length character string
36 % */
37 typedef string  buffer<>;
38
39 %
40 %/*
41 % * cms_access_entry - data structure for the access list attribute
42 % */
43 struct cms_access_entry {
44         cms_name        user;
45         u_int           rights;
46         cms_access_entry *next;
47 };
48
49 %
50 %/*
51 % * cms_attribute_value - data structure for attribute value
52 % */
53 %struct cms_attribute_value {
54 %       int     type;
55 %       union {
56 %               CSA_boolean     boolean_value;
57 %               CSA_enum        enumerated_value;
58 %               CSA_flags       flags_value;
59 %               int             sint32_value;
60 %               uint            uint32_value;
61 %               char            *string_value;
62 %               char            *calendar_user_value;
63 %               char            *date_time_value;
64 %               char            *date_time_range_value;
65 %               char            *time_duration_value;
66 %               cms_access_entry *access_list_value;
67 %               CSA_date_time_entry *date_time_list_value;
68 %               CSA_reminder    *reminder_value;
69 %               CSA_opaque_data *opaque_data_value;
70 %       } item;
71 %};
72 %typedef struct cms_attribute_value cms_attribute_value;
73 %
74
75 %
76 %/*
77 % * cms_key consists of the time and the unique
78 % * identifier of the entry.
79 % */
80 struct cms_key {
81         time_t  time;
82         long    id;
83 };
84
85 %
86 %/*
87 % * num contains the hashed number for the associated name assigned
88 % * by the server.  Client should not change its value.
89 % * If it's zero, name is not hashed yet.
90 % */
91 struct cms_attr_name {
92         short           num;
93         cms_name        name;
94 };
95
96 %
97 %/*
98 % *
99 % */
100 struct cms_attribute {
101         cms_attr_name           name;
102         cms_attribute_value     *value;
103 };
104
105 %
106 %
107 %/*
108 % * An entry is identified by an identifier unique within the calendar
109 % * and has a variable number of attributes associated with it.
110 % */
111 struct cms_entry {
112         cms_key         key;
113         u_int           num_attrs;
114         cms_attribute   *attrs;
115         struct cms_entry *next;
116 };
117
118 %
119 %
120 %/*
121 % * cms_enumerate_calendar_attr_res
122 % *
123 % * If stat is CSA_SUCCESS, names contains an array of names.
124 % */
125 struct cms_enumerate_calendar_attr_res { 
126         CSA_return_code stat;
127         CSA_uint32      num_names;
128         cms_attr_name   *names;
129 };
130
131 %
132 %
133 %/*
134 % * cms_list_calendars_res
135 % *
136 % * If stat is CSA_SUCCESS, names contains an array of names.
137 % */
138 struct cms_list_calendars_res { 
139         CSA_return_code stat;
140         CSA_uint32      num_names;
141         cms_name        *names;
142 };
143
144 %
145 %
146 %/*
147 % * cms_open_args - used by CMS_OPEN_CALENDAR
148 % */
149 struct cms_open_args {
150         cms_name        cal;
151         int             pid;
152 };
153
154 %
155 %
156 %/*
157 % * cms_open_res - returned by CMS_OPEN_CALENDAR
158 % *
159 % * If stat is DtCm_OK,
160 % *     svr_vers contains the version number of the server,
161 % *     file_vers contains the version number of the callog file,
162 % *     user_access is the calling user's access right to the calendar
163 % *     num_attrs indicates the size of the array pointed to by attrs,
164 % *     and attrs contains an array of calendar attributes.
165 % */
166 struct cms_open_res {
167         CSA_return_code stat;
168         int             svr_vers;
169         int             file_vers;
170         u_int           user_access;
171         CSA_uint32      num_attrs;
172         cms_attribute   *attrs;
173 };
174
175 %
176 %
177 %/*
178 % * cms_create_args - used by CMS_CREATE_CALENDAR
179 % */
180 struct cms_create_args {
181         cms_name        cal;
182         buffer          char_set;
183         int             pid;
184         CSA_uint32      num_attrs;
185         cms_attribute   *attrs;
186 };
187
188 %
189 %
190 %/*
191 % * cms_remove_args - used by CMS_REMOVE_CALENDAR
192 % */
193 struct cms_remove_args {
194         cms_name        cal;
195         int             pid;
196 };
197
198 %
199 %
200 %/*
201 % * cms_register_args - used by CMS_REGISTER and CMS_UNREGISTER
202 % */
203 struct cms_register_args {
204         cms_name        cal;
205         u_int           update_type;
206         u_long          prognum;
207         u_long          versnum;
208         u_long          procnum;
209         int             pid;
210 };
211
212 %
213 %
214 %/*
215 % * cms_get_cal_attr_res - used by CMS_GET_CALENDAR_ATTR
216 % *
217 % * If stat is CSA_SUCCESS, attrs contains an array of attributes.
218 % */
219 struct cms_get_cal_attr_res { 
220         CSA_return_code stat;
221         CSA_uint32      num_attrs;
222         cms_attribute   *attrs;
223 };
224
225 %
226 %
227 %/*
228 % * cms_get_cal_attr_args - used by CMS_GET_CALENDAR_ATTR
229 % */
230 struct cms_get_cal_attr_args {
231         cms_name        cal;
232         CSA_uint32      num_names;
233         cms_attr_name   *names;
234 };
235
236 %
237 %
238 %/*
239 % * cms_set_cal_attr_args - used by CMS_SET_CALENDAR_ATTR
240 % */
241 struct cms_set_cal_attr_args {
242         cms_name        cal;
243         int             pid;
244         CSA_uint32      num_attrs;
245         cms_attribute   *attrs;
246 };
247
248 %
249 %
250 %/*
251 % * cms_archive_res - used by CMS_ARCHIVE
252 % *
253 % * If stat is CSA_SUCCESS, data contains the data to be archived
254 % */
255 struct cms_archive_res {
256         CSA_return_code stat;
257         buffer          data;
258 };
259
260 %
261 %
262 %/*
263 % * cms_archive_args - used by CMS_ARCHIVE
264 % */
265 struct cms_archive_args {
266         cms_name        cal;
267         bool            delete;
268         buffer          char_set;
269         CSA_uint32      num_attrs;
270         cms_attribute   *attrs;
271         int             *ops;
272 };
273
274 %
275 %
276 %/*
277 % * cms_restore_args - used by CMS_RESTORE
278 % */
279 struct cms_restore_args {
280         cms_name        cal;
281         buffer          data;
282         buffer          char_set;
283         CSA_uint32      num_attrs;
284         cms_attribute   *attrs;
285         int             *ops;
286 };
287
288 %
289 %
290 %/*
291 % * cms_reminder
292 % */
293 struct cms_reminder_ref {
294         buffer  reminder_name;
295         buffer  entryid;
296         cms_key key;
297         long    runtime;
298         struct cms_reminder_ref *next;
299 };
300
301 %
302 %
303 %/*
304 % * cms_reminder_res - used by CMS_LOOKUP_REMINDER
305 % *
306 % * If stat is CSA_SUCCESS, rems contains an array of reminders.
307 % */
308 struct cms_reminder_res {
309         CSA_return_code         stat;
310         cms_reminder_ref        *rems;
311 };
312
313 %
314 %
315 %/*
316 % * cms_reminder_args - used by CMS_LOOKUP_REMINDER
317 % */
318 struct cms_reminder_args {
319         cms_name        cal;
320         long            tick;
321         CSA_uint32      num_names;
322         cms_attr_name   *names;
323 };
324
325 %
326 %
327 %/*
328 % * cms_entries_res
329 % *
330 % * If stat is CSA_SUCCESS, entries contains an array of entries.
331 % */
332 struct cms_entries_res { 
333         CSA_return_code stat;
334         cms_entry       *entries;
335 };
336
337 %
338 %
339 %/*
340 % * cms_lookup_entries_args - used by CMS_LOOKUP_ENTRIES
341 % */
342 struct cms_lookup_entries_args {
343         cms_name        cal;
344         buffer          char_set;
345         CSA_uint32      num_attrs;
346         cms_attribute   *attrs;
347         int             *ops;
348 };
349
350 %
351 %
352 %/*
353 % * cms_enumerate_args - used by CMS_ENUERATE_SEQUENCE
354 % */
355 struct cms_enumerate_args {
356         cms_name        cal;
357         long            id;
358         long            start;
359         long            end;
360 };
361
362 %
363 %/*
364 % * If stat is CSA_SUCCESS, attrs contains an array of
365 % * attributes.
366 % */
367 struct cms_get_entry_attr_res_item {
368         CSA_return_code stat;
369         cms_key         key;
370         CSA_uint32      num_attrs;
371         cms_attribute   *attrs;
372         struct cms_get_entry_attr_res_item *next;
373 };
374
375 %
376 %
377 %/*
378 % * cms_get_entry_attr_res - used by CMS_GET_ENTRY_ATTR
379 % *
380 % * If stat is CSA_SUCCESS, entries contains an array of
381 % * cms_get_entry_attr_res_item structures.
382 % */
383 struct cms_get_entry_attr_res { 
384         CSA_return_code stat;
385         cms_get_entry_attr_res_item     *entries;
386 };
387
388 %
389 %
390 %/*
391 % * cms_get_entry_attr_args - used by CMS_GET_ENTRY_ATTR
392 % */
393 struct cms_get_entry_attr_args {
394         cms_name        cal;
395         u_int           num_keys;
396         cms_key         *keys;
397         CSA_uint32      num_names;
398         cms_attr_name   *names;
399 };
400
401 %
402 %
403 %/*
404 % * cms_entry_res
405 % *
406 % * If stat is CSA_SUCCESS, entry points to an entry.
407 % */
408 struct cms_entry_res {
409         CSA_return_code stat;
410         cms_entry       *entry;
411 };
412
413 %
414 %
415 %/*
416 % * cms_insert_args - used by CMS_INSERT_ENTRY
417 % */
418 struct cms_insert_args {
419         cms_name        cal;
420         int             pid;
421         CSA_uint32      num_attrs;
422         cms_attribute   *attrs;
423 };
424
425 %
426 %
427 %/*
428 % * cms_update_args - used by CMS_UPDATE_ENTRY
429 % */
430 struct cms_update_args {
431         cms_name        cal;
432         int             pid;
433         cms_key         entry;
434         int             scope;
435         CSA_uint32      num_attrs;
436         cms_attribute   *attrs;
437 };
438
439 %
440 %
441 %/*
442 % * cms_delete_args - used by CMS_DELETE_ENTRY
443 % */
444 struct cms_delete_args {
445         cms_name        cal;
446         int             pid;
447         cms_key         entry;
448         int             scope;
449 };
450
451 #endif /* RPC_HDR */
452
453 program TABLEPROG {
454
455         /* RPC Language description of the calendar protocol */
456
457         version TABLEVERS {
458                 void
459                 CMS_PING(void) = 0;
460
461                 /*
462                  * List all calendars supported by the server.
463                  */
464                 cms_list_calendars_res
465                 CMS_LIST_CALENDARS(void) = 1;
466
467                 /*
468                  * Check existence of the calendar.
469                  * Names and tags of all calendar attribute
470                  * will be returned.
471                  */
472                 cms_open_res
473                 CMS_OPEN_CALENDAR(cms_open_args) = 2;
474
475                 /*
476                  * Create a calendar and initialize it with
477                  * the given attributes.
478                  */
479                 CSA_return_code
480                 CMS_CREATE_CALENDAR(cms_create_args) = 3;
481
482                 /*
483                  * Remove the calendar.
484                  */
485                 CSA_return_code
486                 CMS_REMOVE_CALENDAR(cms_remove_args) = 4;
487
488                 /*
489                  * Register client for callbacks.
490                  */
491                 CSA_return_code
492                 CMS_REGISTER(cms_register_args) = 5;
493
494                 /*
495                  * Unregister the client.
496                  */
497                 CSA_return_code
498                 CMS_UNREGISTER(cms_register_args) = 6;
499
500                 /*
501                  * Enumerate all calendar attributes.
502                  */
503                 cms_enumerate_calendar_attr_res
504                 CMS_ENUMERATE_CALENDAR_ATTR(cms_name) = 7;
505
506                 /*
507                  * Get calendar attribute values.
508                  */
509                 cms_get_cal_attr_res
510                 CMS_GET_CALENDAR_ATTR(cms_get_cal_attr_args) = 8;
511
512                 /*
513                  * Set calendar attribute values.
514                  */
515                 CSA_return_code
516                 CMS_SET_CALENDAR_ATTR(cms_set_cal_attr_args) = 9;
517
518                 /*
519                  * Get data to be archived.
520                  */
521                 cms_archive_res
522                 CMS_ARCHIVE(cms_archive_args) = 10;
523
524                 /*
525                  * Restore data to the calendar.
526                  */
527                 CSA_return_code
528                 CMS_RESTORE(cms_restore_args) = 11;
529
530                 /*
531                  * Lookup reminders relative to the given tick.
532                  */
533                 cms_reminder_res
534                 CMS_LOOKUP_REMINDER(cms_reminder_args) = 12;
535
536                 /*
537                  * Lookup entries that match the given criteria.
538                  * Attribute values of predefined attributes are returned.
539                  * For other attributes, only the names are
540                  * returned but not the values.
541                  */
542                 cms_entries_res
543                 CMS_LOOKUP_ENTRIES(cms_lookup_entries_args) = 13;
544
545                 /*
546                  * Lookup instances of a repeating entry
547                  * The attribute list specify the entry
548                  * id and a time range.
549                  * If the entry repeats indefinitely,
550                  * the time range is mandatory.
551                  */
552                 cms_entries_res
553                 CMS_ENUMERATE_SEQUENCE(cms_enumerate_args) = 14;
554
555                 /*
556                  * Get entry attribute values.
557                  */
558                 cms_get_entry_attr_res
559                 CMS_GET_ENTRY_ATTR(cms_get_entry_attr_args) = 15;
560
561                 /*
562                  * Insert an entry.
563                  */
564                 cms_entry_res
565                 CMS_INSERT_ENTRY(cms_insert_args) = 16;
566
567                 /*
568                  * Update an entry.
569                  */
570                 cms_entry_res
571                 CMS_UPDATE_ENTRY(cms_update_args) = 17;
572
573                 /*
574                  * Delete an entry.
575                  */
576                 CSA_return_code
577                 CMS_DELETE_ENTRY(cms_delete_args) = 18;
578
579         } = 5;
580 } = 100068; 
581