00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef LIBSTORAGEMGMT_REST_H
00020 #define LIBSTORAGEMGMT_REST_H
00021
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00026 #define LSM_REST_PORT 8888
00027 #define LSM_REST_TMO 60000
00028 #define LSM_SOCK_BUFF_LEN 4096
00029 #define LSM_DEFAULT_ID 100
00030 #define LSM_JSON_MIME "application/json"
00031 #define LSM_HEADER_LEN 10
00032 #define LSM_API_VER_LEN 4
00033 #define LSM_UDS_PATH_DEFAULT "/var/run/lsm/ipc"
00034
00035 enum lsm_json_type {
00036 lsm_json_type_null,
00037 lsm_json_type_int,
00038 lsm_json_type_float,
00039 lsm_json_type_string,
00040 lsm_json_type_bool,
00041 lsm_json_type_array_str,
00042 };
00043
00044 static const char *lsm_query_strs[] = {
00045 "systems", "volumes", "pools", "disks", "fs", "access_groups",
00046 "initiators",
00047 };
00048
00049 typedef struct Parameter {
00050 const char *key_name;
00051 const void *value;
00052 enum lsm_json_type value_type;
00053 ssize_t array_len;
00054 struct Parameter *next;
00055 } Parameter_t;
00056
00057 typedef struct ParaList {
00058 Parameter_t *head;
00059 } ParaList_t;
00060
00061 void para_list_init(ParaList_t *);
00062
00063 int para_list_add(ParaList_t *, const char *, const void *,
00064 const enum lsm_json_type, const ssize_t);
00065
00066 void para_list_free(ParaList_t *);
00067
00068 json_object *para_to_json(const enum lsm_json_type, const void *,
00069 const ssize_t);
00070
00071 json_object *para_list_to_json(ParaList_t *);
00072
00073 #ifdef __cplusplus
00074 }
00075 #endif
00076
00077 #endif