1CMAP_GET(3) Corosync Cluster Engine Programmer's Manual CMAP_GET(3)
2
3
4
6 cmap_get - Retrieve value from CMAP
7
8
10 #include <corosync/cmap.h>
11
12
13 cs_error_t cmap_get (cmap_handle_t handle, const char *key_name, void
14 *value, size_t *value_len, cmap_value_types_t *type);
15
16 Also shortcuts for different types are defined
17
18 cs_error_t cmap_get_int8 (cmap_handle_t handle, const char *key_name,
19 int8_t *i8);
20
21 cs_error_t cmap_get_uint8 (cmap_handle_t handle, const char *key_name,
22 uint8_t *u8);
23
24 cs_error_t cmap_get_int16 (cmap_handle_t handle, const char *key_name,
25 int16_t *i16);
26
27 cs_error_t cmap_get_uint16 (cmap_handle_t handle, const char *key_name,
28 uint16_t *u16);
29
30 cs_error_t cmap_get_int32 (cmap_handle_t handle, const char *key_name,
31 int32_t *i32);
32
33 cs_error_t cmap_get_uint32 (cmap_handle_t handle, const char *key_name,
34 uint32_t *u32);
35
36 cs_error_t cmap_get_int64 (cmap_handle_t handle, const char *key_name,
37 int64_t *i64);
38
39 cs_error_t cmap_get_uint64 (cmap_handle_t handle, const char *key_name,
40 uint64_t *u64);
41
42 cs_error_t cmap_get_float (cmap_handle_t handle, const char *key_name,
43 float *flt);
44
45 cs_error_t cmap_get_double (cmap_handle_t handle, const char *key_name,
46 double *dbl);
47
48 cs_error_t cmap_get_string (cmap_handle_t handle, const char *key_name,
49 char **str);
50
51
53 The cmap_get function is used to retrieve key from cmap previously set
54 by cmap_set(3) function. The handle argument is connection to CMAP
55 database obtained by calling cmap_initialize(3) function. key_name is
56 name of key to get value from. value is pointer to preallocated data
57 used as storage for data, but can be also NULL, and then only value_len
58 and/or type is returned (both of them can also be NULL, allowing func‐
59 tion to be used only for test of existence of key). If value is not
60 NULL, actual length of value in map is checked against *value_len. If
61 *value_len is shorter then length of value in map, error
62 CS_ERR_INVALID_PARAM is returned. After successful copy of value,
63 *value_len is set to actual length of value in map. Parameter type is
64 pointer to memory, where type of value is stored after successful
65 return. Pointer can also be NULL and then nothing is stored. Type can
66 be one of:
67
68 CMAP_VALUETYPE_INT8 - 8-bit signed integer
69
70 CMAP_VALUETYPE_UINT8 - 8-bit unsigned integer
71
72 CMAP_VALUETYPE_INT16 - 16-bit signed integer
73
74 CMAP_VALUETYPE_UINT16 - 16-bit unsigned integer
75
76 CMAP_VALUETYPE_INT32 - 32-bit signed integer
77
78 CMAP_VALUETYPE_UINT32 - 32-bit unsigned integer
79
80 CMAP_VALUETYPE_INT64 - 64-bit signed integer
81
82 CMAP_VALUETYPE_UINT64 - 64-bit unsigned integer
83
84 CMAP_VALUETYPE_FLOAT - Float value
85
86 CMAP_VALUETYPE_DOUBLE - Double value
87
88 CMAP_VALUETYPE_STRING - C-style string
89
90 CMAP_VALUETYPE_BINARY - Binary data, byte with zero value has no spe‐
91 cial meaning
92
93 Shortcut functions tests cmap type with it's own type. If type didn't
94 match, CS_ERR_INVALID_PARAM error is returned. No conversions are done,
95 so for example cmap_get_int16 is not able to return value with
96 CMAP_VALUETYPE_INT8 type.
97
98 String shortcut function returns newly allocated memory and caller is
99 responsible for freeing that.
100
101
103 This call returns the CS_OK value if successful. If value or key_name
104 are unspecified, CS_ERR_INVALID_PARAM is returned. Same error is also
105 returned if value is specified, and *value_len is too short for store
106 of data. If key doesn't exists (it was not set by calling cmap_set(3)
107 function first) CS_ERR_NOT_EXIST error is returned. For helper func‐
108 tions, CS_ERR_INVALID_PARAM is returned if type stored in cmap doesn't
109 match with type of helper function.
110
111
113 cmap_set(3), cmap_initialize(3), cmap_overview(3)
114
115 CS_ERR_TRY_AGAIN Resource temporarily unavailable
116
117 CS_ERR_INVALID_PARAM Invalid argument
118
119 CS_ERR_ACCESS Permission denied
120
121 CS_ERR_LIBRARY The connection failed
122
123 CS_ERR_INTERRUPT System call interrupted by a signal
124
125 CS_ERR_NOT_SUPPORTED The requested protocol/functionality not supported
126
127 CS_ERR_MESSAGE_ERROR Incorrect auth message received
128
129 CS_ERR_NO_MEMORY Not enough memory to complete the requested task
130
131
132
133corosync Man Page 03/02/2012 CMAP_GET(3)