data_provider_opts.c revision ddd21d5dc3c89712d9286d1f66f4b2af73651cf2
/*
SSSD
Data Provider Helpers
Copyright (C) Simo Sorce <ssorce@redhat.com> 2009
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "data_provider.h"
/* =Retrieve-Options====================================================== */
struct confdb_ctx *cdb,
const char *conf_path,
int num_opts,
{
int i, ret;
for (i = 0; i < num_opts; i++) {
char *tmp;
case DP_OPT_STRING:
"Failed to retrieve value for option (%s)\n",
goto done;
}
break;
case DP_OPT_BLOB:
"Failed to retrieve value for option (%s)\n",
goto done;
}
if (tmp) {
} else {
}
break;
case DP_OPT_NUMBER:
"Failed to retrieve value for option (%s)\n",
goto done;
}
break;
case DP_OPT_BOOL:
"Failed to retrieve value for option (%s)\n",
goto done;
}
break;
}
}
done:
return ret;
}
/* =Basic-Option-Helpers================================================== */
int num_opts,
{
for (i = 0; i < num_opts; i++) {
case DP_OPT_STRING:
}
"Failed to copy value for option (%s)\n",
goto done;
}
break;
case DP_OPT_BLOB:
}
"Failed to retrieve value for option (%s)\n",
goto done;
}
break;
case DP_OPT_NUMBER:
}
"Failed to retrieve value for option (%s)\n",
goto done;
}
break;
case DP_OPT_BOOL:
}
"Failed to retrieve value for option (%s)\n",
goto done;
}
break;
}
}
done:
return ret;
}
{
switch (type) {
case DP_OPT_STRING:
return "String";
case DP_OPT_BLOB:
return "Blob";
case DP_OPT_NUMBER:
return "Number";
case DP_OPT_BOOL:
return "Boolean";
}
return NULL;
}
/* Getters */
{
"[%s] Requested type 'String' for option '%s'"
" but value is of type '%s'!\n",
return NULL;
}
}
{
"[%s] Requested type 'String' for option '%s'"
" but value is of type '%s'!\n",
return NULL;
}
}
{
" but value is of type '%s'!\n",
return null_blob;
}
}
{
"[%s] Requested type 'Number' for option '%s'"
" but value is of type '%s'!\n",
return 0;
}
}
{
"[%s] Requested type 'Boolean' for option '%s'"
" but value is of type '%s'!\n",
return false;
}
}
/* Setters */
const char *s, const char *location)
{
"[%s] Requested type 'String' for option '%s'"
" but type is '%s'!\n",
return EINVAL;
}
}
if (s) {
return ENOMEM;
}
}
return EOK;
}
struct dp_opt_blob b, const char *location)
{
" but type is '%s'!\n",
return EINVAL;
}
}
if (b.data) {
return ENOMEM;
}
}
return EOK;
}
int i, const char *location)
{
"[%s] Requested type 'Number' for option '%s'"
" but type is '%s'!\n",
return EINVAL;
}
return EOK;
}
bool b, const char *location)
{
"[%s] Requested type 'Boolean' for option '%s'"
" but type is '%s'!\n",
return EINVAL;
}
return EOK;
}