The preference interface is implemented by objects that store preferences on the behalf of other modules. Preferences are settings that are persistent between sessions. Typically there is a single object implementing the preference interface.
SIM_INTERFACE(preference) {
attr_value_t
(*get_preference_for_module_key)(conf_object_t *NOTNULL prefs,
const char *NOTNULL module,
const char *NOTNULL key);
void (*set_preference_for_module_key)(conf_object_t *NOTNULL prefs,
attr_value_t value,
const char *NOTNULL module,
const char *NOTNULL key);
};
#define PREFERENCE_INTERFACE "preference"
get_preference_for_module_key is called to retrieve a preference for a specified module and key. If no value has been set an invalid attribute is returned.
set_preference_for_module_key is called to store a preference for a specified module and key. Any attribute type is allowed for the value, including nested types. However, the value may no contain any invalid attributes.