/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Ensure that the configuration file and all of the containing directories
 * are only writable by root. Otherwise, an attacker can change the 
 * configuration and potentially cause damage.
 * returns 0 if permissions are ok
 */
int check_configuration_permissions(const char* file_name);

// read the given configuration file
void read_config(const char* config_file);

//method exposed to get the configurations
char *get_value(const char* key);

//function to return array of values pointing to the key. Values are
//comma separated strings.
char ** get_values(const char* key);

/**
 * Extracts array of values from the delim separated list of values.
 * A sequence of two or more contiguous delimiter bytes in the parsed string
 * is considered to be a single delimiter, and that delimiter bytes at the
 * start or end of the string are ignored.
 * For example, extract_values_delim("aaa;;bbb,", ";,") would
 * return the strings "aaa" and "bbb", and then a NULL pointer.
 */
char ** extract_values_delim(char *value, const char *delim);

// free the memory returned by get_values
void free_values(char** values);

//method to free allocated configuration
void free_configurations();

