icmap.h File Reference
`#include <stdlib.h>`
`#include <corosync/corotypes.h>`
`#include <qb/qbmap.h>`
Include dependency graph for icmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | icmap_notify_value
| Structure passed as new_value and old_value in change callback. More...

## Macros

#define | ICMAP_KEYNAME_MAXLEN 255
| Maximum length of key in icmap.
#define | ICMAP_KEYNAME_MINLEN 3
| Minimum lenght of key in icmap.
#define | ICMAP_TRACK_ADD 4
#define | ICMAP_TRACK_DELETE 1
#define | ICMAP_TRACK_MODIFY 2
#define | ICMAP_TRACK_PREFIX 8
| Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ... applies).

## Typedefs

typedef void(* | icmap_notify_fn_t) (int32_t event, const char *key_name, struct icmap_notify_value new_value, struct icmap_notify_value old_value, void *user_data)
| Prototype for notify callback function.
typedef struct icmap_map * | icmap_map_t
| icmap type.
typedef qb_map_iter_t * | icmap_iter_t
| Itterator type.
typedef struct icmap_track * | icmap_track_t
| Track type.

## Enumerations

enum | icmap_value_types_t { ICMAP_VALUETYPE_INT8 = 1 , ICMAP_VALUETYPE_UINT8 = 2 , ICMAP_VALUETYPE_INT16 = 3 , ICMAP_VALUETYPE_UINT16 = 4 , ICMAP_VALUETYPE_INT32 = 5 , ICMAP_VALUETYPE_UINT32 = 6 , ICMAP_VALUETYPE_INT64 = 7 , ICMAP_VALUETYPE_UINT64 = 8 , ICMAP_VALUETYPE_FLOAT = 9 , ICMAP_VALUETYPE_DOUBLE = 10 , ICMAP_VALUETYPE_STRING = 11 , ICMAP_VALUETYPE_BINARY = 12 }
| Possible types of value. More...

## Functions

cs_error_t | icmap_init (void)
| Initialize global icmap.
cs_error_t | icmap_init_r (icmap_map_t *result)
| Initialize additional (local, reentrant) icmap_map.
void | icmap_fini (void)
| Finalize global icmap.
void | icmap_fini_r (const icmap_map_t map)
| Finalize local, reentrant icmap.
icmap_map_t | icmap_get_global_map (void)
| Return global icmap.
int | icmap_key_value_eq (const icmap_map_t map1, const char *key_name1, const icmap_map_t map2, const char *key_name2)
| Compare value of key with name key_name1 in map1 with key with name key_name2 in map2.
cs_error_t | icmap_set (const char *key_name, const void *value, size_t value_len, icmap_value_types_t type)
| Store value with value_len length and type as key_name name in global icmap.
cs_error_t | icmap_set_r (const icmap_map_t map, const char *key_name, const void *value, size_t value_len, icmap_value_types_t type)
| Reentrant version of icmap_set.
cs_error_t | icmap_set_int8 (const char *key_name, int8_t value)
cs_error_t | icmap_set_uint8 (const char *key_name, uint8_t value)
cs_error_t | icmap_set_int16 (const char *key_name, int16_t value)
cs_error_t | icmap_set_uint16 (const char *key_name, uint16_t value)
cs_error_t | icmap_set_int32 (const char *key_name, int32_t value)
cs_error_t | icmap_set_uint32 (const char *key_name, uint32_t value)
cs_error_t | icmap_set_int64 (const char *key_name, int64_t value)
cs_error_t | icmap_set_uint64 (const char *key_name, uint64_t value)
cs_error_t | icmap_set_float (const char *key_name, float value)
cs_error_t | icmap_set_double (const char *key_name, double value)
cs_error_t | icmap_set_string (const char *key_name, const char *value)
cs_error_t | icmap_set_int8_r (const icmap_map_t map, const char *key_name, int8_t value)
cs_error_t | icmap_set_uint8_r (const icmap_map_t map, const char *key_name, uint8_t value)
cs_error_t | icmap_set_int16_r (const icmap_map_t map, const char *key_name, int16_t value)
cs_error_t | icmap_set_uint16_r (const icmap_map_t map, const char *key_name, uint16_t value)
cs_error_t | icmap_set_int32_r (const icmap_map_t map, const char *key_name, int32_t value)
cs_error_t | icmap_set_uint32_r (const icmap_map_t map, const char *key_name, uint32_t value)
cs_error_t | icmap_set_int64_r (const icmap_map_t map, const char *key_name, int64_t value)
cs_error_t | icmap_set_uint64_r (const icmap_map_t map, const char *key_name, uint64_t value)
cs_error_t | icmap_set_float_r (const icmap_map_t map, const char *key_name, float value)
cs_error_t | icmap_set_double_r (const icmap_map_t map, const char *key_name, double value)
cs_error_t | icmap_set_string_r (const icmap_map_t map, const char *key_name, const char *value)
cs_error_t | icmap_delete (const char *key_name)
| Delete key from map.
cs_error_t | icmap_delete_r (const icmap_map_t map, const char *key_name)
| icmap_delete_r
cs_error_t | icmap_get (const char *key_name, void *value, size_t *value_len, icmap_value_types_t *type)
| Retrieve value of key key_name and store it in user preallocated value pointer.
cs_error_t | icmap_get_r (const icmap_map_t map, const char *key_name, void *value, size_t *value_len, icmap_value_types_t *type)
| Same as icmap_get but it's reentrant and operates on given icmap_map.
cs_error_t | icmap_get_int8 (const char *key_name, int8_t *i8)
cs_error_t | icmap_get_uint8 (const char *key_name, uint8_t *u8)
cs_error_t | icmap_get_int16 (const char *key_name, int16_t *i16)
cs_error_t | icmap_get_uint16 (const char *key_name, uint16_t *u16)
cs_error_t | icmap_get_int32 (const char *key_name, int32_t *i32)
cs_error_t | icmap_get_uint32 (const char *key_name, uint32_t *u32)
cs_error_t | icmap_get_int64 (const char *key_name, int64_t *i64)
cs_error_t | icmap_get_uint64 (const char *key_name, uint64_t *u64)
cs_error_t | icmap_get_float (const char *key_name, float *flt)
cs_error_t | icmap_get_double (const char *key_name, double *dbl)
cs_error_t | icmap_get_int8_r (const icmap_map_t map, const char *key_name, int8_t *i8)
cs_error_t | icmap_get_uint8_r (const icmap_map_t map, const char *key_name, uint8_t *u8)
cs_error_t | icmap_get_int16_r (const icmap_map_t map, const char *key_name, int16_t *i16)
cs_error_t | icmap_get_uint16_r (const icmap_map_t map, const char *key_name, uint16_t *u16)
cs_error_t | icmap_get_int32_r (const icmap_map_t map, const char *key_name, int32_t *i32)
cs_error_t | icmap_get_uint32_r (const icmap_map_t map, const char *key_name, uint32_t *u32)
cs_error_t | icmap_get_int64_r (const icmap_map_t map, const char *key_name, int64_t *i64)
cs_error_t | icmap_get_uint64_r (const icmap_map_t map, const char *key_name, uint64_t *u64)
cs_error_t | icmap_get_float_r (const icmap_map_t map, const char *key_name, float *flt)
cs_error_t | icmap_get_double_r (const icmap_map_t map, const char *key_name, double *dbl)
cs_error_t | icmap_get_string_r (const icmap_map_t map, const char *key_name, char **str)
cs_error_t | icmap_get_string (const char *key_name, char **str)
| Shortcut for icmap_get for string type.
cs_error_t | icmap_adjust_int (const char *key_name, int32_t step)
| icmap_adjust_int
cs_error_t | icmap_adjust_int_r (const icmap_map_t map, const char *key_name, int32_t step)
| icmap_adjust_int_r
cs_error_t | icmap_fast_adjust_int (const char *key_name, int32_t step)
| icmap_fast_adjust_int
cs_error_t | icmap_fast_adjust_int_r (const icmap_map_t map, const char *key_name, int32_t step)
| icmap_fast_adjust_int_r
cs_error_t | icmap_inc (const char *key_name)
| Increase stored value by one.
cs_error_t | icmap_inc_r (const icmap_map_t map, const char *key_name)
| icmap_inc_r
cs_error_t | icmap_dec (const char *key_name)
| Decrease stored value by one.
cs_error_t | icmap_dec_r (const icmap_map_t map, const char *key_name)
| icmap_dec_r
cs_error_t | icmap_fast_inc (const char *key_name)
| Increase stored value by one.
cs_error_t | icmap_fast_inc_r (const icmap_map_t map, const char *key_name)
| icmap_fast_inc_r
cs_error_t | icmap_fast_dec (const char *key_name)
| Decrease stored value by one.
cs_error_t | icmap_fast_dec_r (const icmap_map_t map, const char *key_name)
| icmap_fast_dec_r
icmap_iter_t | icmap_iter_init (const char *prefix)
| Initialize iterator with given prefix.
icmap_iter_t | icmap_iter_init_r (const icmap_map_t map, const char *prefix)
| icmap_iter_init_r
const char * | icmap_iter_next (icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
| Return next item in iterator iter.
void | icmap_iter_finalize (icmap_iter_t iter)
| Finalize iterator.
cs_error_t | icmap_track_add (const char *key_name, int32_t track_type, icmap_notify_fn_t notify_fn, void *user_data, icmap_track_t *icmap_track)
| Add tracking function for given key_name.
void * | icmap_track_get_user_data (icmap_track_t icmap_track)
| Return user data associated with given track.
cs_error_t | icmap_track_delete (icmap_track_t icmap_track)
| Remove previously added track.
cs_error_t | icmap_set_ro_access (const char *key_name, int prefix, int ro_access)
| Set read-only access for given key (key_name) or prefix, If prefix is set.
int | icmap_is_key_ro (const char *key_name)
| Check in given key is read only.
void | icmap_convert_name_to_valid_name (char *key_name)
| Converts given key_name to valid key name (replacing all prohibited characters by _).
cs_error_t | icmap_copy_map (icmap_map_t dst_map, const icmap_map_t src_map)
| Copy content of src_map icmap to dst_map icmap.
size_t | icmap_get_valuetype_len (icmap_value_types_t type)
int32_t | icmap_tt_to_qbtt (int32_t track_type)
int32_t | icmap_qbtt_to_tt (int32_t track_type)

## Macro Definition Documentation

## ICMAP_KEYNAME_MAXLEN

#define ICMAP_KEYNAME_MAXLEN 255

Maximum length of key in icmap.

Definition at line 48 of file icmap.h.

Referenced by corosync_service_link_and_init(), stats_add_schedmiss_event(), stats_ipcs_add_connection(), stats_ipcs_del_connection(), stats_knet_add_handle(), stats_knet_add_member(), stats_knet_del_member(), stats_map_init(), totem_config_read(), and totem_volatile_config_validate().

## ICMAP_KEYNAME_MINLEN

#define ICMAP_KEYNAME_MINLEN 3

Minimum lenght of key in icmap.

Definition at line 53 of file icmap.h.

## ICMAP_TRACK_ADD

#define ICMAP_TRACK_ADD 4

Definition at line 76 of file icmap.h.

Referenced by icmap_qbtt_to_tt(), icmap_track_add(), icmap_tt_to_qbtt(), stats_map_track_add(), and stats_map_track_delete().

## ICMAP_TRACK_DELETE

#define ICMAP_TRACK_DELETE 1

Definition at line 77 of file icmap.h.

Referenced by icmap_qbtt_to_tt(), icmap_track_add(), icmap_tt_to_qbtt(), stats_map_track_add(), and stats_map_track_delete().

## ICMAP_TRACK_MODIFY

#define ICMAP_TRACK_MODIFY 2

Definition at line 78 of file icmap.h.

Referenced by icmap_qbtt_to_tt(), icmap_track_add(), icmap_tt_to_qbtt(), and stats_trigger_trackers().

## ICMAP_TRACK_PREFIX

#define ICMAP_TRACK_PREFIX 8

Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ... applies).

This value is also never returned inside of callback and is used only in adding track

Definition at line 85 of file icmap.h.

Referenced by icmap_qbtt_to_tt(), icmap_track_add(), icmap_tt_to_qbtt(), stats_map_track_add(), and stats_trigger_trackers().

## Typedef Documentation

## icmap_iter_t

typedef qb_map_iter_t* icmap_iter_t

Itterator type.

Definition at line 123 of file icmap.h.

## icmap_map_t

typedef struct icmap_map* icmap_map_t

icmap type.

icmap.c contains global variable (icmap_global_map) of this type. This is used in every non-reentant call. Also only in this table are implemented operations like set_ro and tracking of values. Other tables (created by icmap_init_r) are simple map tables with get/set/iter operations.

Definition at line 118 of file icmap.h.

## icmap_notify_fn_t

typedef void(* icmap_notify_fn_t) (int32_t event, const char *key_name, struct icmap_notify_value new_value, struct icmap_notify_value old_value, void *user_data)

Prototype for notify callback function.

Even is one of ICMAP_TRACK_* event, key_name is changed key, new and old_value contains values or are zeroed (in other words, type is non existing 0 type) if there were no old (creating of key) or new (deleting of key) value. user_data are passed when adding tracking.

Definition at line 103 of file icmap.h.

## icmap_track_t

typedef struct icmap_track* icmap_track_t

Track type.

Definition at line 128 of file icmap.h.

## Enumeration Type Documentation

## icmap_value_types_t

enum icmap_value_types_t

Possible types of value.

Binary is raw data without trailing zero with given length

Enumerator
ICMAP_VALUETYPE_INT8 |
ICMAP_VALUETYPE_UINT8 |
ICMAP_VALUETYPE_INT16 |
ICMAP_VALUETYPE_UINT16 |
ICMAP_VALUETYPE_INT32 |
ICMAP_VALUETYPE_UINT32 |
ICMAP_VALUETYPE_INT64 |
ICMAP_VALUETYPE_UINT64 |
ICMAP_VALUETYPE_FLOAT |
ICMAP_VALUETYPE_DOUBLE |
ICMAP_VALUETYPE_STRING |
ICMAP_VALUETYPE_BINARY |

Definition at line 58 of file icmap.h.

## Function Documentation

## icmap_adjust_int()

cs_error_t icmap_adjust_int | ( | const char * | key_name,
|  | int32_t | step )

extern

icmap_adjust_int

Defined only for [u]int* values. It adds step to current value.

Parameters

  key_name |
  step |

Returns

Definition at line 983 of file icmap.c.

References icmap_adjust_int_r(), and icmap_item::key_name.

## icmap_adjust_int_r()

cs_error_t icmap_adjust_int_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int32_t | step )

extern

icmap_adjust_int_r

Parameters

  map |
  key_name |
  step |

Returns

Definition at line 926 of file icmap.c.

References CS_ERR_INVALID_PARAM, CS_ERR_NOT_EXIST, CS_OK, icmap_set(), ICMAP_VALUETYPE_BINARY, ICMAP_VALUETYPE_DOUBLE, ICMAP_VALUETYPE_FLOAT, ICMAP_VALUETYPE_INT16, ICMAP_VALUETYPE_INT32, ICMAP_VALUETYPE_INT64, ICMAP_VALUETYPE_INT8, ICMAP_VALUETYPE_STRING, ICMAP_VALUETYPE_UINT16, ICMAP_VALUETYPE_UINT32, ICMAP_VALUETYPE_UINT64, ICMAP_VALUETYPE_UINT8, icmap_item::key_name, icmap_map::qb_map, icmap_item::type, and icmap_item::value.

Referenced by icmap_adjust_int(), icmap_dec_r(), and icmap_inc_r().

## icmap_convert_name_to_valid_name()

void icmap_convert_name_to_valid_name | ( | char * | key_name | ) |

extern

Converts given key_name to valid key name (replacing all prohibited characters by _).

Parameters

  key_name |

Definition at line 282 of file icmap.c.

References icmap_track::key_name.

## icmap_copy_map()

cs_error_t icmap_copy_map | ( | icmap_map_t | dst_map,
|  | const icmap_map_t | src_map )

extern

Copy content of src_map icmap to dst_map icmap.

Parameters

  dst_map |
  src_map |

Returns

Definition at line 1302 of file icmap.c.

References CS_ERR_NO_MEMORY, CS_OK, icmap_iter_finalize(), icmap_iter_init_r(), icmap_iter_next(), icmap_set_r(), icmap_ro_access_item::key_name, and value.

## icmap_dec()

cs_error_t icmap_dec | ( | const char * | key_name | ) |

extern

Decrease stored value by one.

Parameters

  key_name |

Returns

Definition at line 1063 of file icmap.c.

References icmap_dec_r(), and icmap_item::key_name.

## icmap_dec_r()

cs_error_t icmap_dec_r | ( | const icmap_map_t | map,
|  | const char * | key_name )

extern

icmap_dec_r

Parameters

  map |
  key_name |

Returns

Definition at line 1058 of file icmap.c.

References icmap_adjust_int_r(), and icmap_item::key_name.

Referenced by icmap_dec().

## icmap_delete()

cs_error_t icmap_delete | ( | const char * | key_name | ) |

extern

Delete key from map.

Parameters

  key_name |

Returns

Definition at line 657 of file icmap.c.

References icmap_delete_r(), and icmap_item::key_name.

## icmap_delete_r()

cs_error_t icmap_delete_r | ( | const icmap_map_t | map,
|  | const char * | key_name )

extern

icmap_delete_r

Parameters

  map |
  key_name |

Returns

Definition at line 637 of file icmap.c.

References CS_ERR_INVALID_PARAM, CS_ERR_NOT_EXIST, CS_OK, icmap_item::key_name, and icmap_map::qb_map.

Referenced by icmap_delete().

## icmap_fast_adjust_int()

cs_error_t icmap_fast_adjust_int | ( | const char * | key_name,
|  | int32_t | step )

extern

icmap_fast_adjust_int

Defined only for [u]int* values. It adds step to current value. Difference between this function and icmap_adjust_int is given in fact, that in tracking callback, old value is undefined, but whole process is done without malloc/memcpy.

Parameters

  key_name |
  step |

Returns

Definition at line 1040 of file icmap.c.

References icmap_fast_adjust_int_r(), and icmap_item::key_name.

## icmap_fast_adjust_int_r()

cs_error_t icmap_fast_adjust_int_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int32_t | step )

extern

icmap_fast_adjust_int_r

Parameters

  map |
  key_name |
  step |

Returns

Definition at line 991 of file icmap.c.

References CS_ERR_INVALID_PARAM, CS_ERR_NOT_EXIST, CS_OK, ICMAP_VALUETYPE_BINARY, ICMAP_VALUETYPE_DOUBLE, ICMAP_VALUETYPE_FLOAT, ICMAP_VALUETYPE_INT16, ICMAP_VALUETYPE_INT32, ICMAP_VALUETYPE_INT64, ICMAP_VALUETYPE_INT8, ICMAP_VALUETYPE_STRING, ICMAP_VALUETYPE_UINT16, ICMAP_VALUETYPE_UINT32, ICMAP_VALUETYPE_UINT64, ICMAP_VALUETYPE_UINT8, icmap_item::key_name, icmap_map::qb_map, icmap_item::type, and icmap_item::value.

Referenced by icmap_fast_adjust_int(), icmap_fast_dec_r(), and icmap_fast_inc_r().

## icmap_fast_dec()

cs_error_t icmap_fast_dec | ( | const char * | key_name | ) |

extern

Decrease stored value by one.

Difference between this function and icmap_dec is same as between icmap_adjust_int and icmap_fast_adjust_int.

Parameters

  key_name |

Returns

Definition at line 1083 of file icmap.c.

References icmap_fast_dec_r(), and icmap_item::key_name.

## icmap_fast_dec_r()

cs_error_t icmap_fast_dec_r | ( | const icmap_map_t | map,
|  | const char * | key_name )

extern

icmap_fast_dec_r

Parameters

  map |
  key_name |

Returns

Definition at line 1078 of file icmap.c.

References icmap_fast_adjust_int_r(), and icmap_item::key_name.

Referenced by icmap_fast_dec().

## icmap_fast_inc()

cs_error_t icmap_fast_inc | ( | const char * | key_name | ) |

extern

Increase stored value by one.

Difference between this function and icmap_inc is same as between icmap_adjust_int and icmap_fast_adjust_int.

Parameters

  key_name |

Returns

Definition at line 1073 of file icmap.c.

References icmap_fast_inc_r(), and icmap_item::key_name.

Referenced by main_mcast().

## icmap_fast_inc_r()

cs_error_t icmap_fast_inc_r | ( | const icmap_map_t | map,
|  | const char * | key_name )

extern

icmap_fast_inc_r

Parameters

  map |
  key_name |

Returns

Definition at line 1068 of file icmap.c.

References icmap_fast_adjust_int_r(), and icmap_item::key_name.

Referenced by icmap_fast_inc().

## icmap_fini()

void icmap_fini | ( | void |  | ) |

extern

Finalize global icmap.

Definition at line 251 of file icmap.c.

References icmap_fini_r().

## icmap_fini_r()

void icmap_fini_r | ( | const icmap_map_t | map | ) |

extern

Finalize local, reentrant icmap.

Parameters

  map |

Definition at line 242 of file icmap.c.

References icmap_map::qb_map.

Referenced by icmap_fini().

## icmap_get()

cs_error_t icmap_get | ( | const char * | key_name,
|  | void * | value,
|  | size_t * | value_len,
|  | icmap_value_types_t * | type )

extern

Retrieve value of key key_name and store it in user preallocated value pointer.

Value can be NULL, and then only value_len and/or type is returned (both of them can also be NULL). If value is not NULL, actual length of value in map is checked against value_len. If *value_len is shorter then length of value in map, error CS_ERR_INVALID_PARAM is returned. After successful copy of value, value_len is set to actual length of value in map.

Parameters

  key_name |
  value |
  value_len |
  type |

Returns

Definition at line 729 of file icmap.c.

References icmap_get_r(), icmap_item::key_name, type, value, and icmap_item::value_len.

## icmap_get_double()

cs_error_t icmap_get_double | ( | const char * | key_name,
|  | double * | dbl )

extern

Definition at line 920 of file icmap.c.

References icmap_get_double_r(), and icmap_item::key_name.

## icmap_get_double_r()

cs_error_t icmap_get_double_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | double * | dbl )

extern

Definition at line 854 of file icmap.c.

References ICMAP_VALUETYPE_DOUBLE, and icmap_item::key_name.

Referenced by icmap_get_double().

## icmap_get_float()

cs_error_t icmap_get_float | ( | const char * | key_name,
|  | float * | flt )

extern

Definition at line 914 of file icmap.c.

References icmap_get_float_r(), and icmap_item::key_name.

## icmap_get_float_r()

cs_error_t icmap_get_float_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | float * | flt )

extern

Definition at line 848 of file icmap.c.

References ICMAP_VALUETYPE_FLOAT, and icmap_item::key_name.

Referenced by icmap_get_float().

## icmap_get_global_map()

icmap_map_t icmap_get_global_map | ( | void |  | ) |

extern

Return global icmap.

Returns

Definition at line 268 of file icmap.c.

Referenced by main(), main_iface_change_fn(), totem_config_read(), and totem_config_validate().

## icmap_get_int16()

cs_error_t icmap_get_int16 | ( | const char * | key_name,
|  | int16_t * | i16 )

extern

Definition at line 878 of file icmap.c.

References icmap_get_int16_r(), and icmap_item::key_name.

## icmap_get_int16_r()

cs_error_t icmap_get_int16_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int16_t * | i16 )

extern

Definition at line 812 of file icmap.c.

References ICMAP_VALUETYPE_INT16, and icmap_item::key_name.

Referenced by icmap_get_int16().

## icmap_get_int32()

cs_error_t icmap_get_int32 | ( | const char * | key_name,
|  | int32_t * | i32 )

extern

Definition at line 890 of file icmap.c.

References icmap_get_int32_r(), and icmap_item::key_name.

## icmap_get_int32_r()

cs_error_t icmap_get_int32_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int32_t * | i32 )

extern

Definition at line 824 of file icmap.c.

References ICMAP_VALUETYPE_INT32, and icmap_item::key_name.

Referenced by icmap_get_int32().

## icmap_get_int64()

cs_error_t icmap_get_int64 | ( | const char * | key_name,
|  | int64_t * | i64 )

extern

Definition at line 902 of file icmap.c.

References icmap_get_int64_r(), and icmap_item::key_name.

## icmap_get_int64_r()

cs_error_t icmap_get_int64_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int64_t * | i64 )

extern

Definition at line 836 of file icmap.c.

References ICMAP_VALUETYPE_INT64, and icmap_item::key_name.

Referenced by icmap_get_int64().

## icmap_get_int8()

cs_error_t icmap_get_int8 | ( | const char * | key_name,
|  | int8_t * | i8 )

extern

Definition at line 866 of file icmap.c.

References icmap_get_int8_r(), and icmap_item::key_name.

## icmap_get_int8_r()

cs_error_t icmap_get_int8_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int8_t * | i8 )

extern

Definition at line 800 of file icmap.c.

References ICMAP_VALUETYPE_INT8, and icmap_item::key_name.

Referenced by icmap_get_int8().

## icmap_get_r()

cs_error_t icmap_get_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | void * | value,
|  | size_t * | value_len,
|  | icmap_value_types_t * | type )

extern

Same as icmap_get but it's reentrant and operates on given icmap_map.

Parameters

  map |
  key_name |
  value |
  value_len |
  type |

Returns

Definition at line 696 of file icmap.c.

References CS_ERR_INVALID_PARAM, CS_OK, icmap_item::key_name, type, value, and icmap_item::value_len.

Referenced by icmap_get(), icmap_get_string_r(), and totem_config_keyread().

## icmap_get_string()

cs_error_t icmap_get_string | ( | const char * | key_name,
|  | char ** | str )

extern

Shortcut for icmap_get for string type.

Returned string is newly allocated and caller is responsible for freeing memory

Parameters

  key_name |
  str |

Returns

Definition at line 860 of file icmap.c.

References icmap_get_string_r(), and icmap_item::key_name.

Referenced by get_state_dir(), main(), totem_config_read(), and totemknet_initialize().

## icmap_get_string_r()

cs_error_t icmap_get_string_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | char ** | str )

extern

Definition at line 739 of file icmap.c.

References CS_ERR_INVALID_PARAM, CS_ERR_NO_MEMORY, CS_OK, icmap_get_r(), ICMAP_VALUETYPE_STRING, icmap_item::key_name, and type.

Referenced by icmap_get_string(), totem_config_keyread(), and totem_volatile_config_validate().

## icmap_get_uint16()

cs_error_t icmap_get_uint16 | ( | const char * | key_name,
|  | uint16_t * | u16 )

extern

Definition at line 884 of file icmap.c.

References icmap_get_uint16_r(), and icmap_item::key_name.

Referenced by totem_config_read().

## icmap_get_uint16_r()

cs_error_t icmap_get_uint16_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | uint16_t * | u16 )

extern

Definition at line 818 of file icmap.c.

References ICMAP_VALUETYPE_UINT16, and icmap_item::key_name.

Referenced by icmap_get_uint16().

## icmap_get_uint32()

cs_error_t icmap_get_uint32 | ( | const char * | key_name,
|  | uint32_t * | u32 )

extern

Definition at line 896 of file icmap.c.

References icmap_get_uint32_r(), and icmap_item::key_name.

Referenced by totem_config_read(), and totem_config_validate().

## icmap_get_uint32_r()

cs_error_t icmap_get_uint32_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | uint32_t * | u32 )

extern

Definition at line 830 of file icmap.c.

References ICMAP_VALUETYPE_UINT32, and icmap_item::key_name.

Referenced by icmap_get_uint32(), totem_volatile_config_read(), and totem_volatile_config_validate().

## icmap_get_uint64()

cs_error_t icmap_get_uint64 | ( | const char * | key_name,
|  | uint64_t * | u64 )

extern

Definition at line 908 of file icmap.c.

References icmap_get_uint64_r(), and icmap_item::key_name.

## icmap_get_uint64_r()

cs_error_t icmap_get_uint64_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | uint64_t * | u64 )

extern

Definition at line 842 of file icmap.c.

References ICMAP_VALUETYPE_UINT64, and icmap_item::key_name.

Referenced by icmap_get_uint64().

## icmap_get_uint8()

cs_error_t icmap_get_uint8 | ( | const char * | key_name,
|  | uint8_t * | u8 )

extern

Definition at line 872 of file icmap.c.

References icmap_get_uint8_r(), and icmap_item::key_name.

Referenced by totem_config_read().

## icmap_get_uint8_r()

cs_error_t icmap_get_uint8_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | uint8_t * | u8 )

extern

Definition at line 806 of file icmap.c.

References ICMAP_VALUETYPE_UINT8, and icmap_item::key_name.

Referenced by icmap_get_uint8().

## icmap_get_valuetype_len()

size_t icmap_get_valuetype_len | ( | icmap_value_types_t | type | ) |

Definition at line 310 of file icmap.c.

References ICMAP_VALUETYPE_BINARY, ICMAP_VALUETYPE_DOUBLE, ICMAP_VALUETYPE_FLOAT, ICMAP_VALUETYPE_INT16, ICMAP_VALUETYPE_INT32, ICMAP_VALUETYPE_INT64, ICMAP_VALUETYPE_INT8, ICMAP_VALUETYPE_STRING, ICMAP_VALUETYPE_UINT16, ICMAP_VALUETYPE_UINT32, ICMAP_VALUETYPE_UINT64, ICMAP_VALUETYPE_UINT8, and type.

Referenced by icmap_set_r().

## icmap_inc()

cs_error_t icmap_inc | ( | const char * | key_name | ) |

extern

Increase stored value by one.

Parameters

  key_name |

Returns

Definition at line 1053 of file icmap.c.

References icmap_inc_r(), and icmap_item::key_name.

## icmap_inc_r()

cs_error_t icmap_inc_r | ( | const icmap_map_t | map,
|  | const char * | key_name )

extern

icmap_inc_r

Parameters

  map |
  key_name |

Returns

Definition at line 1048 of file icmap.c.

References icmap_adjust_int_r(), and icmap_item::key_name.

Referenced by icmap_inc().

## icmap_init()

cs_error_t icmap_init | ( | void |  | ) |

extern

Initialize global icmap.

Returns

Definition at line 212 of file icmap.c.

References icmap_init_r().

Referenced by main().

## icmap_init_r()

cs_error_t icmap_init_r | ( | icmap_map_t * | result | ) |

extern

Initialize additional (local, reentrant) icmap_map.

Content of variable result is undefined if return code is not CS_OK.

Parameters

  result |

Returns

Definition at line 188 of file icmap.c.

References CS_ERR_INIT, CS_ERR_NO_MEMORY, and qb_to_cs_error().

Referenced by icmap_init().

## icmap_is_key_ro()

int icmap_is_key_ro | ( | const char * | key_name | ) |

extern

Check in given key is read only.

Returns !0 if so, otherwise (key is rw) 0.

Parameters

  key_name |

Returns

Definition at line 1276 of file icmap.c.

References CS_FALSE, CS_TRUE, icmap_ro_access_item::key_name, icmap_ro_access_item::list, and icmap_ro_access_item::prefix.

## icmap_iter_finalize()

void icmap_iter_finalize | ( | icmap_iter_t | iter | ) |

extern

Finalize iterator.

Parameters

  iter |

Definition at line 1120 of file icmap.c.

Referenced by icmap_copy_map().

## icmap_iter_init()

icmap_iter_t icmap_iter_init | ( | const char * | prefix | ) |

extern

Initialize iterator with given prefix.

Parameters

  prefix |

Returns

Definition at line 1093 of file icmap.c.

References icmap_iter_init_r().

## icmap_iter_init_r()

icmap_iter_t icmap_iter_init_r | ( | const icmap_map_t | map,
|  | const char * | prefix )

extern

icmap_iter_init_r

Parameters

  map |
  prefix |

Returns

Definition at line 1088 of file icmap.c.

References icmap_map::qb_map.

Referenced by icmap_copy_map(), and icmap_iter_init().

## icmap_iter_next()

const char * icmap_iter_next | ( | icmap_iter_t | iter,
|  | size_t * | value_len,
|  | icmap_value_types_t * | type )

extern

Return next item in iterator iter.

value_len and type are optional (= can be NULL), but if set, length of returned value and/or type is returned. Function returns following key_name or NULL if iteration is over.

Parameters

  iter |
  value_len |
  type |

Returns

Definition at line 1099 of file icmap.c.

References icmap_item::type, type, and icmap_item::value_len.

Referenced by icmap_copy_map().

## icmap_key_value_eq()

int icmap_key_value_eq | ( | const icmap_map_t | map1,
|  | const char * | key_name1,
|  | const icmap_map_t | map2,
|  | const char * | key_name2 )

extern

Compare value of key with name key_name1 in map1 with key with name key_name2 in map2.

Two values must have same type, length and value to be considered equal. Function returns 0 when any of map1, key_name1, map2, key_name2 are NULL, or key_name is not found in map, or keys are not equal. != 0 is returned when values are equal.

Parameters

  map1 |
  key_name1 |
  map2 |
  key_name2 |

Returns

Definition at line 389 of file icmap.c.

References icmap_map::qb_map, icmap_item::type, icmap_item::value, and icmap_item::value_len.

## icmap_qbtt_to_tt()

int32_t icmap_qbtt_to_tt | ( | int32_t | track_type | ) |

Definition at line 150 of file icmap.c.

References ICMAP_TRACK_ADD, ICMAP_TRACK_DELETE, ICMAP_TRACK_MODIFY, and ICMAP_TRACK_PREFIX.

## icmap_set()

cs_error_t icmap_set | ( | const char * | key_name,
|  | const void * | value,
|  | size_t | value_len,
|  | icmap_value_types_t | type )

extern

Store value with value_len length and type as key_name name in global icmap.

Parameters

  key_name |
  value |
  value_len |
  type |

Returns

Definition at line 491 of file icmap.c.

References icmap_set_r(), icmap_item::key_name, type, value, and icmap_item::value_len.

Referenced by icmap_adjust_int_r().

## icmap_set_double()

cs_error_t icmap_set_double | ( | const char * | key_name,
|  | double | value )

extern

Definition at line 625 of file icmap.c.

References icmap_set_double_r(), icmap_item::key_name, and value.

## icmap_set_double_r()

cs_error_t icmap_set_double_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | double | value )

extern

Definition at line 555 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_DOUBLE, icmap_item::key_name, and value.

Referenced by icmap_set_double().

## icmap_set_float()

cs_error_t icmap_set_float | ( | const char * | key_name,
|  | float | value )

extern

Definition at line 619 of file icmap.c.

References icmap_set_float_r(), icmap_item::key_name, and value.

## icmap_set_float_r()

cs_error_t icmap_set_float_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | float | value )

extern

Definition at line 549 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_FLOAT, icmap_item::key_name, and value.

Referenced by icmap_set_float().

## icmap_set_int16()

cs_error_t icmap_set_int16 | ( | const char * | key_name,
|  | int16_t | value )

extern

Definition at line 583 of file icmap.c.

References icmap_set_int16_r(), icmap_item::key_name, and value.

## icmap_set_int16_r()

cs_error_t icmap_set_int16_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int16_t | value )

extern

Definition at line 513 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_INT16, icmap_item::key_name, and value.

Referenced by icmap_set_int16().

## icmap_set_int32()

cs_error_t icmap_set_int32 | ( | const char * | key_name,
|  | int32_t | value )

extern

Definition at line 595 of file icmap.c.

References icmap_set_int32_r(), icmap_item::key_name, and value.

## icmap_set_int32_r()

cs_error_t icmap_set_int32_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int32_t | value )

extern

Definition at line 525 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_INT32, icmap_item::key_name, and value.

Referenced by icmap_set_int32().

## icmap_set_int64()

cs_error_t icmap_set_int64 | ( | const char * | key_name,
|  | int64_t | value )

extern

Definition at line 607 of file icmap.c.

References icmap_set_int64_r(), icmap_item::key_name, and value.

## icmap_set_int64_r()

cs_error_t icmap_set_int64_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int64_t | value )

extern

Definition at line 537 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_INT64, icmap_item::key_name, and value.

Referenced by icmap_set_int64().

## icmap_set_int8()

cs_error_t icmap_set_int8 | ( | const char * | key_name,
|  | int8_t | value )

extern

Definition at line 571 of file icmap.c.

References icmap_set_int8_r(), icmap_item::key_name, and value.

## icmap_set_int8_r()

cs_error_t icmap_set_int8_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | int8_t | value )

extern

Definition at line 501 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_INT8, icmap_item::key_name, and value.

Referenced by icmap_set_int8().

## icmap_set_r()

cs_error_t icmap_set_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | const void * | value,
|  | size_t | value_len,
|  | icmap_value_types_t | type )

extern

Reentrant version of icmap_set.

Parameters

  map |
  key_name |
  value |
  value_len |
  type |

Returns

Definition at line 411 of file icmap.c.

References CS_ERR_INVALID_PARAM, CS_ERR_NAME_TOO_LONG, CS_ERR_NO_MEMORY, CS_OK, icmap_get_valuetype_len(), ICMAP_VALUETYPE_BINARY, ICMAP_VALUETYPE_STRING, icmap_item::key_name, icmap_map::qb_map, icmap_item::type, type, icmap_item::value, value, and icmap_item::value_len.

Referenced by icmap_copy_map(), icmap_set(), icmap_set_double_r(), icmap_set_float_r(), icmap_set_int16_r(), icmap_set_int32_r(), icmap_set_int64_r(), icmap_set_int8_r(), icmap_set_string_r(), icmap_set_uint16_r(), icmap_set_uint32_r(), icmap_set_uint64_r(), and icmap_set_uint8_r().

## icmap_set_ro_access()

cs_error_t icmap_set_ro_access | ( | const char * | key_name,
|  | int | prefix,
|  | int | ro_access )

extern

Set read-only access for given key (key_name) or prefix, If prefix is set.

ro_access can be !0, which means, that old information about ro of this key is deleted. Read-only access is used only in CMAP service! (in other word it prevents users from deleting/changing key, but doesn't guarantee anything for internal icmap users.)

Parameters

  key_name |
  prefix |
  ro_access |

Returns

Definition at line 1229 of file icmap.c.

References CS_ERR_EXIST, CS_ERR_NO_MEMORY, CS_ERR_NOT_EXIST, CS_OK, icmap_ro_access_item::key_name, icmap_ro_access_item::list, and icmap_ro_access_item::prefix.

Referenced by totem_config_read().

## icmap_set_string()

cs_error_t icmap_set_string | ( | const char * | key_name,
|  | const char * | value )

extern

Definition at line 631 of file icmap.c.

References icmap_set_string_r(), icmap_item::key_name, and value.

Referenced by corosync_service_link_and_init(), totem_config_read(), totemknet_member_add(), and totemknet_reconfigure().

## icmap_set_string_r()

cs_error_t icmap_set_string_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | const char * | value )

extern

Definition at line 561 of file icmap.c.

References CS_ERR_INVALID_PARAM, icmap_set_r(), ICMAP_VALUETYPE_STRING, icmap_item::key_name, and value.

Referenced by icmap_set_string().

## icmap_set_uint16()

cs_error_t icmap_set_uint16 | ( | const char * | key_name,
|  | uint16_t | value )

extern

Definition at line 589 of file icmap.c.

References icmap_set_uint16_r(), icmap_item::key_name, and value.

Referenced by corosync_service_link_and_init(), and totem_config_read().

## icmap_set_uint16_r()

cs_error_t icmap_set_uint16_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | uint16_t | value )

extern

Definition at line 519 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_UINT16, icmap_item::key_name, and value.

Referenced by icmap_set_uint16().

## icmap_set_uint32()

cs_error_t icmap_set_uint32 | ( | const char * | key_name,
|  | uint32_t | value )

extern

Definition at line 601 of file icmap.c.

References icmap_set_uint32_r(), icmap_item::key_name, and value.

Referenced by corosync_service_link_and_init().

## icmap_set_uint32_r()

cs_error_t icmap_set_uint32_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | uint32_t | value )

extern

Definition at line 531 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_UINT32, icmap_item::key_name, and value.

Referenced by icmap_set_uint32(), and totem_volatile_config_read().

## icmap_set_uint64()

cs_error_t icmap_set_uint64 | ( | const char * | key_name,
|  | uint64_t | value )

extern

Definition at line 613 of file icmap.c.

References icmap_set_uint64_r(), icmap_item::key_name, and value.

Referenced by corosync_service_link_and_init().

## icmap_set_uint64_r()

cs_error_t icmap_set_uint64_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | uint64_t | value )

extern

Definition at line 543 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_UINT64, icmap_item::key_name, and value.

Referenced by icmap_set_uint64().

## icmap_set_uint8()

cs_error_t icmap_set_uint8 | ( | const char * | key_name,
|  | uint8_t | value )

extern

Definition at line 577 of file icmap.c.

References icmap_set_uint8_r(), icmap_item::key_name, and value.

## icmap_set_uint8_r()

cs_error_t icmap_set_uint8_r | ( | const icmap_map_t | map,
|  | const char * | key_name,
|  | uint8_t | value )

extern

Definition at line 507 of file icmap.c.

References icmap_set_r(), ICMAP_VALUETYPE_UINT8, icmap_item::key_name, and value.

Referenced by icmap_set_uint8().

## icmap_track_add()

cs_error_t icmap_track_add | ( | const char * | key_name,
|  | int32_t | track_type,
|  | icmap_notify_fn_t | notify_fn,
|  | void * | user_data,
|  | icmap_track_t * | icmap_track )

extern

Add tracking function for given key_name.

Tracked changes (add|modify|delete) depend on track_type, which is bitwise or of ICMAP_TRACK_* values. notify_fn is called on change, where user_data pointer is passed (unchanged). Value which can be used to delete tracking is passed as icmap_track.

Parameters

  key_name |
  track_type |
  notify_fn |
  user_data |
  icmap_track |

Returns

Definition at line 1163 of file icmap.c.

References CS_ERR_INVALID_PARAM, CS_ERR_NO_MEMORY, CS_OK, ICMAP_TRACK_ADD, ICMAP_TRACK_DELETE, ICMAP_TRACK_MODIFY, ICMAP_TRACK_PREFIX, icmap_tt_to_qbtt(), qb_to_cs_error(), and user_data.

## icmap_track_delete()

cs_error_t icmap_track_delete | ( | icmap_track_t | icmap_track | ) |

extern

Remove previously added track.

Parameters

  icmap_track |

Returns

Definition at line 1208 of file icmap.c.

References CS_OK, icmap_tt_to_qbtt(), icmap_track::key_name, icmap_track::list, qb_to_cs_error(), and icmap_track::track_type.

## icmap_track_get_user_data()

void * icmap_track_get_user_data | ( | icmap_track_t | icmap_track | ) |

extern

Return user data associated with given track.

Parameters

  icmap_track |

Returns

Definition at line 1224 of file icmap.c.

References icmap_track::user_data.

## icmap_tt_to_qbtt()

int32_t icmap_tt_to_qbtt | ( | int32_t | track_type | ) |

Definition at line 127 of file icmap.c.

References ICMAP_TRACK_ADD, ICMAP_TRACK_DELETE, ICMAP_TRACK_MODIFY, and ICMAP_TRACK_PREFIX.

Referenced by icmap_track_add(), icmap_track_delete(), stats_map_track_add(), and stats_map_track_delete().