cmxdr.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: cmxdr.c /main/1 1996/04/21 19:22:14 drk $ */
  24. /*
  25. * (c) Copyright 1993, 1994 Hewlett-Packard Company
  26. * (c) Copyright 1993, 1994 International Business Machines Corp.
  27. * (c) Copyright 1993, 1994 Novell, Inc.
  28. * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  29. */
  30. /*
  31. * xdr routines for xapia csa data structures
  32. */
  33. #ifdef HAVE_CONFIG_H
  34. #include <cde_config.h>
  35. #endif
  36. #include <EUSCompat.h>
  37. #include "cm.h"
  38. #include "csa.h"
  39. #include "cmxdr.h"
  40. bool_t xdr_cms_attribute_value(XDR *xdrs, cms_attribute_value *objp);
  41. bool_t xdr_time_t(XDR *xdrs, time_t *objp);
  42. /* Functions generated by rtable4.x */
  43. /*
  44. * time_t is a typedef which is system dependent
  45. */
  46. #ifndef _xdr_time_t
  47. # if SIZEOF_INT == SIZEOF_TIME_T
  48. # define _xdr_time_t xdr_int
  49. # elif SIZEOF_LONG == SIZEOF_TIME_T
  50. # define _xdr_time_t xdr_long
  51. # elif SIZEOF_LONG_LONG == SIZEOF_TIME_T
  52. # define _xdr_time_t xdr_hyper
  53. # else
  54. # error "Unknown time_t size"
  55. # endif
  56. #endif
  57. bool_t
  58. xdr_time_t(XDR *xdrs, time_t *objp)
  59. {
  60. if (!_xdr_time_t(xdrs, objp))
  61. return (FALSE);
  62. return (TRUE);
  63. }
  64. /*
  65. * cms_name - a user name or calendar name which is
  66. * variable length character string
  67. */
  68. bool_t
  69. xdr_cms_name(XDR *xdrs, cms_name *objp)
  70. {
  71. if (!xdr_string(xdrs, objp, ~0))
  72. return (FALSE);
  73. return (TRUE);
  74. }
  75. /*
  76. * cms_access_entry - data structure for the access list attribute
  77. */
  78. bool_t
  79. xdr_cms_access_entry(XDR *xdrs, cms_access_entry *objp)
  80. {
  81. if (!xdr_string(xdrs, &objp->user, ~0))
  82. return (FALSE);
  83. if (!xdr_u_int(xdrs, &objp->rights))
  84. return (FALSE);
  85. if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof (cms_access_entry),
  86. (xdrproc_t) xdr_cms_access_entry))
  87. return (FALSE);
  88. return (TRUE);
  89. }
  90. /*
  91. * cms_key consists of the time and the unique
  92. * identifier of the entry.
  93. */
  94. bool_t
  95. xdr_cms_key(XDR *xdrs, cms_key *objp)
  96. {
  97. if (!xdr_time_t(xdrs, &objp->time))
  98. return (FALSE);
  99. if (!xdr_long(xdrs, &objp->id))
  100. return (FALSE);
  101. return (TRUE);
  102. }
  103. bool_t
  104. xdr_CSA_opaque_data(XDR *xdrs, CSA_opaque_data *objp)
  105. {
  106. if (!xdr_bytes(xdrs, (char **)&objp->data, (u_int *) &objp->size, ~0))
  107. return (FALSE);
  108. return (TRUE);
  109. }
  110. bool_t
  111. xdr_CSA_reminder(XDR *xdrs, CSA_reminder *objp)
  112. {
  113. if (!xdr_string(xdrs, &objp->lead_time, ~0))
  114. return (FALSE);
  115. if (!xdr_string(xdrs, &objp->snooze_time, ~0))
  116. return (FALSE);
  117. if (!xdr_u_long(xdrs, &objp->repeat_count))
  118. return (FALSE);
  119. if (!xdr_CSA_opaque_data(xdrs, &objp->reminder_data))
  120. return (FALSE);
  121. return (TRUE);
  122. }
  123. bool_t
  124. xdr_CSA_date_time_entry(XDR *xdrs, CSA_date_time_entry *objp)
  125. {
  126. if (!xdr_string(xdrs, &objp->date_time, ~0))
  127. return (FALSE);
  128. if (!xdr_pointer(xdrs, (char **)&objp->next,
  129. sizeof (CSA_date_time_entry), (xdrproc_t) xdr_CSA_date_time_entry))
  130. return (FALSE);
  131. return (TRUE);
  132. }
  133. bool_t
  134. xdr_cms_attribute_value(XDR *xdrs, cms_attribute_value *objp)
  135. {
  136. if (!xdr_int(xdrs, &objp->type))
  137. return (FALSE);
  138. switch (objp->type) {
  139. case CSA_VALUE_SINT32:
  140. case CSA_VALUE_ENUMERATED:
  141. if (!xdr_long(xdrs, &objp->item.sint32_value))
  142. return (FALSE);
  143. break;
  144. case CSA_VALUE_BOOLEAN:
  145. case CSA_VALUE_FLAGS:
  146. case CSA_VALUE_UINT32:
  147. if (!xdr_u_long(xdrs, &objp->item.uint32_value))
  148. return (FALSE);
  149. break;
  150. case CSA_VALUE_STRING:
  151. case CSA_VALUE_CALENDAR_USER:
  152. case CSA_VALUE_DATE_TIME:
  153. case CSA_VALUE_DATE_TIME_RANGE:
  154. case CSA_VALUE_TIME_DURATION:
  155. if (!xdr_string(xdrs, &objp->item.string_value, ~0))
  156. return (FALSE);
  157. break;
  158. case CSA_VALUE_ACCESS_LIST:
  159. if (!xdr_pointer(xdrs, (char **)&objp->item.access_list_value,
  160. sizeof (cms_access_entry),
  161. (xdrproc_t) xdr_cms_access_entry))
  162. return (FALSE);
  163. break;
  164. case CSA_VALUE_DATE_TIME_LIST:
  165. if (!xdr_pointer(xdrs,
  166. (char **)&objp->item.date_time_list_value,
  167. sizeof (CSA_date_time_entry),
  168. (xdrproc_t) xdr_CSA_date_time_entry))
  169. return (FALSE);
  170. break;
  171. case CSA_VALUE_REMINDER:
  172. if (!xdr_pointer(xdrs,
  173. (char **)&objp->item.reminder_value,
  174. sizeof (CSA_reminder), (xdrproc_t) xdr_CSA_reminder))
  175. return (FALSE);
  176. break;
  177. case CSA_VALUE_OPAQUE_DATA:
  178. if (!xdr_pointer(xdrs, (char **)&objp->item.opaque_data_value,
  179. sizeof (CSA_opaque_data), (xdrproc_t) xdr_CSA_opaque_data))
  180. return (FALSE);
  181. break;
  182. }
  183. return (TRUE);
  184. }
  185. /*
  186. * num contains the hashed number for the associated name assigned
  187. * by the server. Client should not change its value.
  188. * If it's zero, name is not hashed yet.
  189. */
  190. bool_t
  191. xdr_cms_attr_name(XDR *xdrs, cms_attr_name *objp)
  192. {
  193. if (!xdr_short(xdrs, &objp->num))
  194. return (FALSE);
  195. if (!xdr_string(xdrs, &objp->name, ~0))
  196. return (FALSE);
  197. return (TRUE);
  198. }
  199. /*
  200. *
  201. */
  202. bool_t
  203. xdr_cms_attribute(XDR *xdrs, cms_attribute *objp)
  204. {
  205. if (!xdr_cms_attr_name(xdrs, &objp->name))
  206. return (FALSE);
  207. if (!xdr_pointer(xdrs, (char **)&objp->value,
  208. sizeof (CSA_attribute_value), (xdrproc_t) xdr_cms_attribute_value))
  209. return (FALSE);
  210. return (TRUE);
  211. }
  212. /*
  213. * An entry is identified by an identifier unique within the calendar
  214. * and has a variable number of attributes associated with it.
  215. */
  216. bool_t
  217. xdr_cms_entry(XDR *xdrs, cms_entry *objp)
  218. {
  219. if (!xdr_cms_key(xdrs, &objp->key))
  220. return (FALSE);
  221. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  222. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  223. return (FALSE);
  224. if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof (cms_entry),
  225. (xdrproc_t) xdr_cms_entry))
  226. return (FALSE);
  227. return (TRUE);
  228. }
  229. /*
  230. * cms_enumerate_calendar_attr_res
  231. *
  232. * If stat is CSA_SUCCESS, names contains an array of names.
  233. */
  234. bool_t
  235. xdr_cms_enumerate_calendar_attr_res(XDR *xdrs, cms_enumerate_calendar_attr_res *objp)
  236. {
  237. if (!xdr_u_long(xdrs, &objp->stat))
  238. return (FALSE);
  239. if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
  240. ~0, sizeof (cms_attr_name), (xdrproc_t) xdr_cms_attr_name))
  241. return (FALSE);
  242. return (TRUE);
  243. }
  244. /*
  245. * cms_list_calendars_res
  246. *
  247. * If stat is CSA_SUCCESS, names contains an array of names.
  248. */
  249. bool_t
  250. xdr_cms_list_calendars_res(XDR *xdrs, cms_list_calendars_res *objp)
  251. {
  252. if (!xdr_u_long(xdrs, &objp->stat))
  253. return (FALSE);
  254. if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
  255. ~0, sizeof (cms_name), (xdrproc_t) xdr_cms_name))
  256. return (FALSE);
  257. return (TRUE);
  258. }
  259. /*
  260. * cms_open_args - used by CMS_OPEN_CALENDAR
  261. */
  262. bool_t
  263. xdr_cms_open_args(XDR *xdrs, cms_open_args *objp)
  264. {
  265. if (!xdr_string(xdrs, &objp->cal, ~0))
  266. return (FALSE);
  267. if (!xdr_int(xdrs, &objp->pid))
  268. return (FALSE);
  269. return (TRUE);
  270. }
  271. /*
  272. * cms_open_res - returned by CMS_OPEN_CALENDAR
  273. *
  274. * If stat is DtCm_OK,
  275. * svr_vers contains the version number of the server,
  276. * file_vers contains the version number of the callog file,
  277. * user_access is the calling user's access right to the calendar
  278. * num_attrs indicates the size of the array pointed to by attrs,
  279. * and attrs contains an array of calendar attributes.
  280. */
  281. bool_t
  282. xdr_cms_open_res(XDR *xdrs, cms_open_res *objp)
  283. {
  284. if (!xdr_u_long(xdrs, &objp->stat))
  285. return (FALSE);
  286. if (!xdr_int(xdrs, &objp->svr_vers))
  287. return (FALSE);
  288. if (!xdr_int(xdrs, &objp->file_vers))
  289. return (FALSE);
  290. if (!xdr_u_int(xdrs, &objp->user_access))
  291. return (FALSE);
  292. if (!xdr_array(xdrs, (char **)&objp->attrs, &objp->num_attrs,
  293. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  294. return (FALSE);
  295. return (TRUE);
  296. }
  297. /*
  298. * cms_create_args - used by CMS_CREATE_CALENDAR
  299. */
  300. bool_t
  301. xdr_cms_create_args(XDR *xdrs, cms_create_args *objp)
  302. {
  303. if (!xdr_string(xdrs, &objp->cal, ~0))
  304. return (FALSE);
  305. if (!xdr_string(xdrs, &objp->char_set, ~0))
  306. return (FALSE);
  307. if (!xdr_int(xdrs, &objp->pid))
  308. return (FALSE);
  309. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  310. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  311. return (FALSE);
  312. return (TRUE);
  313. }
  314. /*
  315. * cms_remove_args - used by CMS_REMOVE_CALENDAR
  316. */
  317. bool_t
  318. xdr_cms_remove_args(XDR *xdrs, cms_remove_args *objp)
  319. {
  320. if (!xdr_string(xdrs, &objp->cal, ~0))
  321. return (FALSE);
  322. if (!xdr_int(xdrs, &objp->pid))
  323. return (FALSE);
  324. return (TRUE);
  325. }
  326. /*
  327. * cms_register_args - used by CMS_REGISTER and CMS_UNREGISTER
  328. */
  329. bool_t
  330. xdr_cms_register_args(XDR *xdrs, cms_register_args *objp)
  331. {
  332. if (!xdr_string(xdrs, &objp->cal, ~0))
  333. return (FALSE);
  334. if (!xdr_u_int(xdrs, &objp->update_type))
  335. return (FALSE);
  336. if (!xdr_u_long(xdrs, &objp->prognum))
  337. return (FALSE);
  338. if (!xdr_u_long(xdrs, &objp->versnum))
  339. return (FALSE);
  340. if (!xdr_u_long(xdrs, &objp->procnum))
  341. return (FALSE);
  342. if (!xdr_int(xdrs, &objp->pid))
  343. return (FALSE);
  344. return (TRUE);
  345. }
  346. /*
  347. * cms_get_cal_attr_res - used by CMS_GET_CALENDAR_ATTR
  348. *
  349. * If stat is CSA_SUCCESS, attrs contains an array of attributes.
  350. */
  351. bool_t
  352. xdr_cms_get_cal_attr_res(XDR *xdrs, cms_get_cal_attr_res *objp)
  353. {
  354. if (!xdr_u_long(xdrs, &objp->stat))
  355. return (FALSE);
  356. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  357. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  358. return (FALSE);
  359. return (TRUE);
  360. }
  361. /*
  362. * cms_get_cal_attr_args - used by CMS_GET_CALENDAR_ATTR
  363. */
  364. bool_t
  365. xdr_cms_get_cal_attr_args(XDR *xdrs, cms_get_cal_attr_args *objp)
  366. {
  367. if (!xdr_string(xdrs, &objp->cal, ~0))
  368. return (FALSE);
  369. if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
  370. ~0, sizeof (cms_attr_name), (xdrproc_t) xdr_cms_attr_name))
  371. return (FALSE);
  372. return (TRUE);
  373. }
  374. /*
  375. * cms_set_cal_attr_args - used by CMS_SET_CALENDAR_ATTR
  376. */
  377. bool_t
  378. xdr_cms_set_cal_attr_args(XDR *xdrs, cms_set_cal_attr_args *objp)
  379. {
  380. if (!xdr_string(xdrs, &objp->cal, ~0))
  381. return (FALSE);
  382. if (!xdr_int(xdrs, &objp->pid))
  383. return (FALSE);
  384. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  385. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  386. return (FALSE);
  387. return (TRUE);
  388. }
  389. /*
  390. * cms_archive_res - used by CMS_ARCHIVE
  391. *
  392. * If stat is CSA_SUCCESS, data contains the data to be archived
  393. */
  394. bool_t
  395. xdr_cms_archive_res(XDR *xdrs, cms_archive_res *objp)
  396. {
  397. if (!xdr_u_long(xdrs, &objp->stat))
  398. return (FALSE);
  399. if (!xdr_string(xdrs, &objp->data, ~0))
  400. return (FALSE);
  401. return (TRUE);
  402. }
  403. /*
  404. * cms_archive_args - used by CMS_ARCHIVE
  405. */
  406. bool_t
  407. xdr_cms_archive_args(XDR *xdrs, cms_archive_args *objp)
  408. {
  409. if (!xdr_string(xdrs, &objp->cal, ~0))
  410. return (FALSE);
  411. if (!xdr_bool(xdrs, &objp->delete))
  412. return (FALSE);
  413. if (!xdr_string(xdrs, &objp->char_set, ~0))
  414. return (FALSE);
  415. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  416. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  417. return (FALSE);
  418. if (!xdr_array(xdrs, (char **)&objp->ops, (u_int *) &objp->num_attrs,
  419. ~0, sizeof (CSA_enum), (xdrproc_t) xdr_long))
  420. return (FALSE);
  421. return (TRUE);
  422. }
  423. /*
  424. * cms_restore_args - used by CMS_RESTORE
  425. */
  426. bool_t
  427. xdr_cms_restore_args(XDR *xdrs, cms_restore_args *objp)
  428. {
  429. if (!xdr_string(xdrs, &objp->cal, ~0))
  430. return (FALSE);
  431. if (!xdr_string(xdrs, &objp->data, ~0))
  432. return (FALSE);
  433. if (!xdr_string(xdrs, &objp->char_set, ~0))
  434. return (FALSE);
  435. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  436. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  437. return (FALSE);
  438. if (!xdr_array(xdrs, (char **)&objp->ops, (u_int *) &objp->num_attrs,
  439. ~0, sizeof (CSA_enum), (xdrproc_t) xdr_long))
  440. return (FALSE);
  441. return (TRUE);
  442. }
  443. /*
  444. * cms_reminder
  445. */
  446. bool_t
  447. xdr_cms_reminder_ref(XDR *xdrs, cms_reminder_ref *objp)
  448. {
  449. if (!xdr_string(xdrs, &objp->reminder_name, ~0))
  450. return (FALSE);
  451. if (!xdr_string(xdrs, &objp->entryid, ~0))
  452. return (FALSE);
  453. if (!xdr_cms_key(xdrs, &objp->key))
  454. return (FALSE);
  455. if (!xdr_time_t(xdrs, &objp->runtime))
  456. return (FALSE);
  457. if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof (cms_reminder_ref),
  458. (xdrproc_t) xdr_cms_reminder_ref))
  459. return (FALSE);
  460. return (TRUE);
  461. }
  462. /*
  463. * cms_reminder_res - used by CMS_LOOKUP_REMINDER
  464. *
  465. * If stat is CSA_SUCCESS, rems contains an array of reminders.
  466. */
  467. bool_t
  468. xdr_cms_reminder_res(XDR *xdrs, cms_reminder_res *objp)
  469. {
  470. if (!xdr_u_long(xdrs, &objp->stat))
  471. return (FALSE);
  472. if (!xdr_pointer(xdrs, (char **)&objp->rems, sizeof (cms_reminder_ref),
  473. (xdrproc_t) xdr_cms_reminder_ref))
  474. return (FALSE);
  475. return (TRUE);
  476. }
  477. /*
  478. * cms_reminder_args - used by CMS_LOOKUP_REMINDER
  479. */
  480. bool_t
  481. xdr_cms_reminder_args(XDR *xdrs, cms_reminder_args *objp)
  482. {
  483. if (!xdr_string(xdrs, &objp->cal, ~0))
  484. return (FALSE);
  485. if (!xdr_time_t(xdrs, &objp->tick))
  486. return (FALSE);
  487. if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
  488. ~0, sizeof (cms_attr_name), (xdrproc_t) xdr_cms_attr_name))
  489. return (FALSE);
  490. return (TRUE);
  491. }
  492. /*
  493. * cms_entries_res
  494. *
  495. * If stat is CSA_SUCCESS, entries contains an array of entries.
  496. */
  497. bool_t
  498. xdr_cms_entries_res(XDR *xdrs, cms_entries_res *objp)
  499. {
  500. if (!xdr_u_long(xdrs, &objp->stat))
  501. return (FALSE);
  502. if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof (cms_entry),
  503. (xdrproc_t) xdr_cms_entry))
  504. return (FALSE);
  505. return (TRUE);
  506. }
  507. /*
  508. * cms_lookup_entries_args - used by CMS_LOOKUP_ENTRIES
  509. */
  510. bool_t
  511. xdr_cms_lookup_entries_args(XDR *xdrs, cms_lookup_entries_args *objp)
  512. {
  513. if (!xdr_string(xdrs, &objp->cal, ~0))
  514. return (FALSE);
  515. if (!xdr_string(xdrs, &objp->char_set, ~0))
  516. return (FALSE);
  517. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  518. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  519. return (FALSE);
  520. if (!xdr_array(xdrs, (char **)&objp->ops, (u_int *) &objp->num_attrs,
  521. ~0, sizeof (CSA_enum), (xdrproc_t) xdr_long))
  522. return (FALSE);
  523. return (TRUE);
  524. }
  525. /*
  526. * cms_enumerate_args - used by CMS_ENUERATE_SEQUENCE
  527. */
  528. bool_t
  529. xdr_cms_enumerate_args(XDR *xdrs, cms_enumerate_args *objp)
  530. {
  531. if (!xdr_string(xdrs, &objp->cal, ~0))
  532. return (FALSE);
  533. if (!xdr_long(xdrs, &objp->id))
  534. return (FALSE);
  535. if (!xdr_long(xdrs, &objp->start))
  536. return (FALSE);
  537. if (!xdr_long(xdrs, &objp->end))
  538. return (FALSE);
  539. return (TRUE);
  540. }
  541. /*
  542. * If stat is CSA_SUCCESS, attrs contains an array of
  543. * attributes.
  544. */
  545. bool_t
  546. xdr_cms_get_entry_attr_res_item(
  547. XDR *xdrs,
  548. cms_get_entry_attr_res_item *objp)
  549. {
  550. if (!xdr_u_long(xdrs, &objp->stat))
  551. return (FALSE);
  552. if (!xdr_cms_key(xdrs, &objp->key))
  553. return (FALSE);
  554. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  555. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  556. return (FALSE);
  557. if (!xdr_pointer(xdrs, (char **)&objp->next,
  558. sizeof (cms_get_entry_attr_res_item),
  559. (xdrproc_t) xdr_cms_get_entry_attr_res_item))
  560. return (FALSE);
  561. return (TRUE);
  562. }
  563. /*
  564. * cms_get_entry_attr_res - used by CMS_GET_ENTRY_ATTR
  565. *
  566. * If stat is CSA_SUCCESS, entries contains an array of
  567. * cms_get_entry_attr_res_item structures.
  568. */
  569. bool_t
  570. xdr_cms_get_entry_attr_res(XDR *xdrs, cms_get_entry_attr_res *objp)
  571. {
  572. if (!xdr_u_long(xdrs, &objp->stat))
  573. return (FALSE);
  574. if (!xdr_pointer(xdrs, (char **)&objp->entries,
  575. sizeof (cms_get_entry_attr_res_item),
  576. (xdrproc_t) xdr_cms_get_entry_attr_res_item))
  577. return (FALSE);
  578. return (TRUE);
  579. }
  580. /*
  581. * cms_get_entry_attr_args - used by CMS_GET_ENTRY_ATTR
  582. */
  583. bool_t
  584. xdr_cms_get_entry_attr_args(XDR *xdrs, cms_get_entry_attr_args *objp)
  585. {
  586. if (!xdr_string(xdrs, &objp->cal, ~0))
  587. return (FALSE);
  588. if (!xdr_array(xdrs, (char **)&objp->keys, (u_int *) &objp->num_keys,
  589. ~0, sizeof (cms_key), (xdrproc_t) xdr_cms_key))
  590. return (FALSE);
  591. if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
  592. ~0, sizeof (cms_attr_name), (xdrproc_t) xdr_cms_attr_name))
  593. return (FALSE);
  594. return (TRUE);
  595. }
  596. /*
  597. * cms_entry_res
  598. *
  599. * If stat is CSA_SUCCESS, entry points to an entry.
  600. */
  601. bool_t
  602. xdr_cms_entry_res(XDR *xdrs, cms_entry_res *objp)
  603. {
  604. if (!xdr_u_long(xdrs, &objp->stat))
  605. return (FALSE);
  606. if (!xdr_pointer(xdrs, (char **)&objp->entry, sizeof (cms_entry),
  607. (xdrproc_t) xdr_cms_entry))
  608. return (FALSE);
  609. return (TRUE);
  610. }
  611. /*
  612. * cms_insert_args - used by CMS_INSERT_ENTRY
  613. */
  614. bool_t
  615. xdr_cms_insert_args(XDR *xdrs, cms_insert_args *objp)
  616. {
  617. if (!xdr_string(xdrs, &objp->cal, ~0))
  618. return (FALSE);
  619. if (!xdr_int(xdrs, &objp->pid))
  620. return (FALSE);
  621. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  622. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  623. return (FALSE);
  624. return (TRUE);
  625. }
  626. /*
  627. * cms_update_args - used by CMS_UPDATE_ENTRY
  628. */
  629. bool_t
  630. xdr_cms_update_args(XDR *xdrs, cms_update_args *objp)
  631. {
  632. if (!xdr_string(xdrs, &objp->cal, ~0))
  633. return (FALSE);
  634. if (!xdr_int(xdrs, &objp->pid))
  635. return (FALSE);
  636. if (!xdr_cms_key(xdrs, &objp->entry))
  637. return (FALSE);
  638. if (!xdr_int(xdrs, &objp->scope))
  639. return (FALSE);
  640. if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
  641. ~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
  642. return (FALSE);
  643. return (TRUE);
  644. }
  645. /*
  646. * cms_delete_args - used by CMS_DELETE_ENTRY
  647. */
  648. bool_t
  649. xdr_cms_delete_args(XDR *xdrs, cms_delete_args *objp)
  650. {
  651. if (!xdr_string(xdrs, &objp->cal, ~0))
  652. return (FALSE);
  653. if (!xdr_int(xdrs, &objp->pid))
  654. return (FALSE);
  655. if (!xdr_cms_key(xdrs, &objp->entry))
  656. return (FALSE);
  657. if (!xdr_int(xdrs, &objp->scope))
  658. return (FALSE);
  659. return (TRUE);
  660. }