rpcdb.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /*
  2. * Please do not edit this file.
  3. * It was generated using rpcgen.
  4. */
  5. #ifndef _RPCDB_H_RPCGEN
  6. #define _RPCDB_H_RPCGEN
  7. #include <rpc/rpc.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #define RESPONSE_SIZE 50
  12. #define USERNAME_SIZE 15
  13. enum status {
  14. VALID = 0,
  15. INVALID_USER = 1,
  16. EXISTING_USER = 2,
  17. INVALID_SESSION_KEY = 3,
  18. SESSION_KEY_NOT_FOUND = 4,
  19. INVALID_REQUEST = 5,
  20. INVALID_DATA = 6,
  21. EXISTING_RECORD = 7,
  22. NO_DATA_FOUND = 8,
  23. NO_DB_FOUND = 9,
  24. };
  25. typedef enum status status;
  26. struct sensor_data {
  27. int sensor_id;
  28. struct {
  29. u_int values_len;
  30. float *values_val;
  31. } values;
  32. };
  33. typedef struct sensor_data sensor_data;
  34. struct sensor_stat {
  35. int sensor_id;
  36. float min;
  37. float max;
  38. float avg;
  39. float med;
  40. };
  41. typedef struct sensor_stat sensor_stat;
  42. enum command_type {
  43. LOGIN_CMD = 0,
  44. LOGOUT_CMD = 1,
  45. LOAD_CMD = 2,
  46. STORE_CMD = 3,
  47. ADD_CMD = 4,
  48. DELETE_CMD = 5,
  49. UPDATE_CMD = 6,
  50. READ_CMD = 7,
  51. READ_ALL_CMD = 8,
  52. GET_STAT_CMD = 9,
  53. GET_STAT_ALL_CMD = 10,
  54. BAD_CMD = 11,
  55. };
  56. typedef enum command_type command_type;
  57. struct login_response {
  58. status response;
  59. u_quad_t session_key;
  60. };
  61. typedef struct login_response login_response;
  62. struct basic_response {
  63. status response;
  64. };
  65. typedef struct basic_response basic_response;
  66. struct sensor_response {
  67. status response;
  68. struct {
  69. u_int values_len;
  70. float *values_val;
  71. } values;
  72. };
  73. typedef struct sensor_response sensor_response;
  74. struct sensors_response {
  75. status response;
  76. struct {
  77. u_int data_len;
  78. sensor_data *data_val;
  79. } data;
  80. };
  81. typedef struct sensors_response sensors_response;
  82. struct stat_response {
  83. status response;
  84. sensor_stat stat;
  85. };
  86. typedef struct stat_response stat_response;
  87. struct stats_response {
  88. status response;
  89. struct {
  90. u_int stats_len;
  91. sensor_stat *stats_val;
  92. } stats;
  93. };
  94. typedef struct stats_response stats_response;
  95. struct bad_response {
  96. status response;
  97. };
  98. typedef struct bad_response bad_response;
  99. struct login_request {
  100. char *username;
  101. };
  102. typedef struct login_request login_request;
  103. struct logout_request {
  104. u_quad_t session_key;
  105. char *username;
  106. };
  107. typedef struct logout_request logout_request;
  108. struct basic_request {
  109. u_quad_t session_key;
  110. };
  111. typedef struct basic_request basic_request;
  112. struct add_update_request {
  113. u_quad_t session_key;
  114. sensor_data data;
  115. };
  116. typedef struct add_update_request add_update_request;
  117. struct sensor_request {
  118. u_quad_t session_key;
  119. int sensor_id;
  120. };
  121. typedef struct sensor_request sensor_request;
  122. struct sensors_request {
  123. u_quad_t session_key;
  124. struct {
  125. u_int sensors_len;
  126. sensor_data *sensors_val;
  127. } sensors;
  128. };
  129. typedef struct sensors_request sensors_request;
  130. struct request {
  131. command_type type;
  132. union {
  133. login_request login;
  134. logout_request logout;
  135. sensors_request load;
  136. add_update_request empty;
  137. sensor_request existing;
  138. basic_request everything;
  139. } request_u;
  140. };
  141. typedef struct request request;
  142. struct response {
  143. command_type type;
  144. union {
  145. login_response login;
  146. basic_response active;
  147. stat_response get_stat;
  148. stats_response get_stat_all;
  149. sensor_response read;
  150. sensors_response read_all;
  151. bad_response bad;
  152. } response_u;
  153. };
  154. typedef struct response response;
  155. #define RPC_PROG 1
  156. #define RPC_VERS 1
  157. #if defined(__STDC__) || defined(__cplusplus)
  158. #define rpc_call 1
  159. extern response * rpc_call_1(request *, CLIENT *);
  160. extern response * rpc_call_1_svc(request *, struct svc_req *);
  161. extern int rpc_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
  162. #else /* K&R C */
  163. #define rpc_call 1
  164. extern response * rpc_call_1();
  165. extern response * rpc_call_1_svc();
  166. extern int rpc_prog_1_freeresult ();
  167. #endif /* K&R C */
  168. /* the xdr functions */
  169. #if defined(__STDC__) || defined(__cplusplus)
  170. extern bool_t xdr_status (XDR *, status*);
  171. extern bool_t xdr_sensor_data (XDR *, sensor_data*);
  172. extern bool_t xdr_sensor_stat (XDR *, sensor_stat*);
  173. extern bool_t xdr_command_type (XDR *, command_type*);
  174. extern bool_t xdr_login_response (XDR *, login_response*);
  175. extern bool_t xdr_basic_response (XDR *, basic_response*);
  176. extern bool_t xdr_sensor_response (XDR *, sensor_response*);
  177. extern bool_t xdr_sensors_response (XDR *, sensors_response*);
  178. extern bool_t xdr_stat_response (XDR *, stat_response*);
  179. extern bool_t xdr_stats_response (XDR *, stats_response*);
  180. extern bool_t xdr_bad_response (XDR *, bad_response*);
  181. extern bool_t xdr_login_request (XDR *, login_request*);
  182. extern bool_t xdr_logout_request (XDR *, logout_request*);
  183. extern bool_t xdr_basic_request (XDR *, basic_request*);
  184. extern bool_t xdr_add_update_request (XDR *, add_update_request*);
  185. extern bool_t xdr_sensor_request (XDR *, sensor_request*);
  186. extern bool_t xdr_sensors_request (XDR *, sensors_request*);
  187. extern bool_t xdr_request (XDR *, request*);
  188. extern bool_t xdr_response (XDR *, response*);
  189. #else /* K&R C */
  190. extern bool_t xdr_status ();
  191. extern bool_t xdr_sensor_data ();
  192. extern bool_t xdr_sensor_stat ();
  193. extern bool_t xdr_command_type ();
  194. extern bool_t xdr_login_response ();
  195. extern bool_t xdr_basic_response ();
  196. extern bool_t xdr_sensor_response ();
  197. extern bool_t xdr_sensors_response ();
  198. extern bool_t xdr_stat_response ();
  199. extern bool_t xdr_stats_response ();
  200. extern bool_t xdr_bad_response ();
  201. extern bool_t xdr_login_request ();
  202. extern bool_t xdr_logout_request ();
  203. extern bool_t xdr_basic_request ();
  204. extern bool_t xdr_add_update_request ();
  205. extern bool_t xdr_sensor_request ();
  206. extern bool_t xdr_sensors_request ();
  207. extern bool_t xdr_request ();
  208. extern bool_t xdr_response ();
  209. #endif /* K&R C */
  210. #ifdef __cplusplus
  211. }
  212. #endif
  213. #endif /* !_RPCDB_H_RPCGEN */