rpcdb_xdr.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /*
  2. * Please do not edit this file.
  3. * It was generated using rpcgen.
  4. */
  5. #include "rpcdb.h"
  6. bool_t
  7. xdr_status (XDR *xdrs, status *objp)
  8. {
  9. register int32_t *buf;
  10. if (!xdr_enum (xdrs, (enum_t *) objp))
  11. return FALSE;
  12. return TRUE;
  13. }
  14. bool_t
  15. xdr_sensor_data (XDR *xdrs, sensor_data *objp)
  16. {
  17. register int32_t *buf;
  18. if (!xdr_int (xdrs, &objp->sensor_id))
  19. return FALSE;
  20. if (!xdr_array (xdrs, (char **)&objp->values.values_val, (u_int *) &objp->values.values_len, ~0,
  21. sizeof (float), (xdrproc_t) xdr_float))
  22. return FALSE;
  23. return TRUE;
  24. }
  25. bool_t
  26. xdr_sensor_stat (XDR *xdrs, sensor_stat *objp)
  27. {
  28. register int32_t *buf;
  29. if (!xdr_int (xdrs, &objp->sensor_id))
  30. return FALSE;
  31. if (!xdr_float (xdrs, &objp->min))
  32. return FALSE;
  33. if (!xdr_float (xdrs, &objp->max))
  34. return FALSE;
  35. if (!xdr_float (xdrs, &objp->avg))
  36. return FALSE;
  37. if (!xdr_float (xdrs, &objp->med))
  38. return FALSE;
  39. return TRUE;
  40. }
  41. bool_t
  42. xdr_command_type (XDR *xdrs, command_type *objp)
  43. {
  44. register int32_t *buf;
  45. if (!xdr_enum (xdrs, (enum_t *) objp))
  46. return FALSE;
  47. return TRUE;
  48. }
  49. bool_t
  50. xdr_login_response (XDR *xdrs, login_response *objp)
  51. {
  52. register int32_t *buf;
  53. if (!xdr_status (xdrs, &objp->response))
  54. return FALSE;
  55. if (!xdr_u_quad_t (xdrs, &objp->session_key))
  56. return FALSE;
  57. return TRUE;
  58. }
  59. bool_t
  60. xdr_basic_response (XDR *xdrs, basic_response *objp)
  61. {
  62. register int32_t *buf;
  63. if (!xdr_status (xdrs, &objp->response))
  64. return FALSE;
  65. return TRUE;
  66. }
  67. bool_t
  68. xdr_sensor_response (XDR *xdrs, sensor_response *objp)
  69. {
  70. register int32_t *buf;
  71. if (!xdr_status (xdrs, &objp->response))
  72. return FALSE;
  73. if (!xdr_array (xdrs, (char **)&objp->values.values_val, (u_int *) &objp->values.values_len, ~0,
  74. sizeof (float), (xdrproc_t) xdr_float))
  75. return FALSE;
  76. return TRUE;
  77. }
  78. bool_t
  79. xdr_sensors_response (XDR *xdrs, sensors_response *objp)
  80. {
  81. register int32_t *buf;
  82. if (!xdr_status (xdrs, &objp->response))
  83. return FALSE;
  84. if (!xdr_array (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0,
  85. sizeof (sensor_data), (xdrproc_t) xdr_sensor_data))
  86. return FALSE;
  87. return TRUE;
  88. }
  89. bool_t
  90. xdr_stat_response (XDR *xdrs, stat_response *objp)
  91. {
  92. register int32_t *buf;
  93. if (!xdr_status (xdrs, &objp->response))
  94. return FALSE;
  95. if (!xdr_sensor_stat (xdrs, &objp->stat))
  96. return FALSE;
  97. return TRUE;
  98. }
  99. bool_t
  100. xdr_stats_response (XDR *xdrs, stats_response *objp)
  101. {
  102. register int32_t *buf;
  103. if (!xdr_status (xdrs, &objp->response))
  104. return FALSE;
  105. if (!xdr_array (xdrs, (char **)&objp->stats.stats_val, (u_int *) &objp->stats.stats_len, ~0,
  106. sizeof (sensor_stat), (xdrproc_t) xdr_sensor_stat))
  107. return FALSE;
  108. return TRUE;
  109. }
  110. bool_t
  111. xdr_bad_response (XDR *xdrs, bad_response *objp)
  112. {
  113. register int32_t *buf;
  114. if (!xdr_status (xdrs, &objp->response))
  115. return FALSE;
  116. return TRUE;
  117. }
  118. bool_t
  119. xdr_login_request (XDR *xdrs, login_request *objp)
  120. {
  121. register int32_t *buf;
  122. if (!xdr_string (xdrs, &objp->username, USERNAME_SIZE))
  123. return FALSE;
  124. return TRUE;
  125. }
  126. bool_t
  127. xdr_logout_request (XDR *xdrs, logout_request *objp)
  128. {
  129. register int32_t *buf;
  130. if (!xdr_u_quad_t (xdrs, &objp->session_key))
  131. return FALSE;
  132. if (!xdr_string (xdrs, &objp->username, ~0))
  133. return FALSE;
  134. return TRUE;
  135. }
  136. bool_t
  137. xdr_basic_request (XDR *xdrs, basic_request *objp)
  138. {
  139. register int32_t *buf;
  140. if (!xdr_u_quad_t (xdrs, &objp->session_key))
  141. return FALSE;
  142. return TRUE;
  143. }
  144. bool_t
  145. xdr_add_update_request (XDR *xdrs, add_update_request *objp)
  146. {
  147. register int32_t *buf;
  148. if (!xdr_u_quad_t (xdrs, &objp->session_key))
  149. return FALSE;
  150. if (!xdr_sensor_data (xdrs, &objp->data))
  151. return FALSE;
  152. return TRUE;
  153. }
  154. bool_t
  155. xdr_sensor_request (XDR *xdrs, sensor_request *objp)
  156. {
  157. register int32_t *buf;
  158. if (!xdr_u_quad_t (xdrs, &objp->session_key))
  159. return FALSE;
  160. if (!xdr_int (xdrs, &objp->sensor_id))
  161. return FALSE;
  162. return TRUE;
  163. }
  164. bool_t
  165. xdr_sensors_request (XDR *xdrs, sensors_request *objp)
  166. {
  167. register int32_t *buf;
  168. if (!xdr_u_quad_t (xdrs, &objp->session_key))
  169. return FALSE;
  170. if (!xdr_array (xdrs, (char **)&objp->sensors.sensors_val, (u_int *) &objp->sensors.sensors_len, ~0,
  171. sizeof (sensor_data), (xdrproc_t) xdr_sensor_data))
  172. return FALSE;
  173. return TRUE;
  174. }
  175. bool_t
  176. xdr_request (XDR *xdrs, request *objp)
  177. {
  178. register int32_t *buf;
  179. if (!xdr_command_type (xdrs, &objp->type))
  180. return FALSE;
  181. switch (objp->type) {
  182. case LOGIN_CMD:
  183. if (!xdr_login_request (xdrs, &objp->request_u.login))
  184. return FALSE;
  185. break;
  186. case LOGOUT_CMD:
  187. if (!xdr_logout_request (xdrs, &objp->request_u.logout))
  188. return FALSE;
  189. break;
  190. case LOAD_CMD:
  191. if (!xdr_sensors_request (xdrs, &objp->request_u.load))
  192. return FALSE;
  193. break;
  194. case ADD_CMD:
  195. case UPDATE_CMD:
  196. if (!xdr_add_update_request (xdrs, &objp->request_u.empty))
  197. return FALSE;
  198. break;
  199. case DELETE_CMD:
  200. case READ_CMD:
  201. case GET_STAT_CMD:
  202. if (!xdr_sensor_request (xdrs, &objp->request_u.existing))
  203. return FALSE;
  204. break;
  205. case STORE_CMD:
  206. case READ_ALL_CMD:
  207. case GET_STAT_ALL_CMD:
  208. if (!xdr_basic_request (xdrs, &objp->request_u.everything))
  209. return FALSE;
  210. break;
  211. default:
  212. return FALSE;
  213. }
  214. return TRUE;
  215. }
  216. bool_t
  217. xdr_response (XDR *xdrs, response *objp)
  218. {
  219. register int32_t *buf;
  220. if (!xdr_command_type (xdrs, &objp->type))
  221. return FALSE;
  222. switch (objp->type) {
  223. case LOGIN_CMD:
  224. if (!xdr_login_response (xdrs, &objp->response_u.login))
  225. return FALSE;
  226. break;
  227. case ADD_CMD:
  228. case UPDATE_CMD:
  229. case DELETE_CMD:
  230. case LOAD_CMD:
  231. case LOGOUT_CMD:
  232. if (!xdr_basic_response (xdrs, &objp->response_u.active))
  233. return FALSE;
  234. break;
  235. case GET_STAT_CMD:
  236. if (!xdr_stat_response (xdrs, &objp->response_u.get_stat))
  237. return FALSE;
  238. break;
  239. case GET_STAT_ALL_CMD:
  240. if (!xdr_stats_response (xdrs, &objp->response_u.get_stat_all))
  241. return FALSE;
  242. break;
  243. case READ_CMD:
  244. if (!xdr_sensor_response (xdrs, &objp->response_u.read))
  245. return FALSE;
  246. break;
  247. case STORE_CMD:
  248. case READ_ALL_CMD:
  249. if (!xdr_sensors_response (xdrs, &objp->response_u.read_all))
  250. return FALSE;
  251. break;
  252. case BAD_CMD:
  253. if (!xdr_bad_response (xdrs, &objp->response_u.bad))
  254. return FALSE;
  255. break;
  256. default:
  257. return FALSE;
  258. }
  259. return TRUE;
  260. }