Blame library/adutil.h

Packit Service 6d40f9
/*
Packit Service 6d40f9
 * adcli
Packit Service 6d40f9
 *
Packit Service 6d40f9
 * Copyright (C) 2012 Red Hat Inc.
Packit Service 6d40f9
 *
Packit Service 6d40f9
 * This program is free software; you can redistribute it and/or modify
Packit Service 6d40f9
 * it under the terms of the GNU Lesser General Public License as
Packit Service 6d40f9
 * published by the Free Software Foundation; either version 2.1 of
Packit Service 6d40f9
 * the License, or (at your option) any later version.
Packit Service 6d40f9
 *
Packit Service 6d40f9
 * This program is distributed in the hope that it will be useful, but
Packit Service 6d40f9
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 6d40f9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 6d40f9
 * Lesser General Public License for more details.
Packit Service 6d40f9
 *
Packit Service 6d40f9
 * You should have received a copy of the GNU Lesser General Public
Packit Service 6d40f9
 * License along with this program; if not, write to the Free Software
Packit Service 6d40f9
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
Packit Service 6d40f9
 * MA 02110-1301 USA
Packit Service 6d40f9
 *
Packit Service 6d40f9
 * Author: Stef Walter <stefw@gnome.org>
Packit Service 6d40f9
 */
Packit Service 6d40f9
Packit Service 6d40f9
#ifndef ADUTIL_H_
Packit Service 6d40f9
#define ADUTIL_H_
Packit Service 6d40f9
Packit Service 6d40f9
#include <stdlib.h>
Packit Service 6d40f9
#include <stdbool.h>
Packit Service 6d40f9
Packit Service 6d40f9
typedef enum {
Packit Service 6d40f9
	/* Successful completion */
Packit Service 6d40f9
	ADCLI_SUCCESS = 0,
Packit Service 6d40f9
Packit Service 6d40f9
	/*
Packit Service 6d40f9
	 * Invalid input or unexpected system behavior.
Packit Service 6d40f9
	 *
Packit Service 6d40f9
	 * This is almost always caused by a bug, or completely broken
Packit Service 6d40f9
	 * system configuration or state. This is returned when memory
Packit Service 6d40f9
	 * allocation fails, but the process will almost certainly have
Packit Service 6d40f9
	 * been killed first.
Packit Service 6d40f9
	 *
Packit Service 6d40f9
	 * This is returned for invalid inputs (such an unexpected
Packit Service 6d40f9
	 * NULL) to adcli.
Packit Service 6d40f9
	 */
Packit Service 6d40f9
	ADCLI_ERR_UNEXPECTED = -2,
Packit Service 6d40f9
Packit Service 6d40f9
	/*
Packit Service 6d40f9
	 * A general failure, that doesn't fit into the other categories.
Packit Service 6d40f9
	 * Not much the caller can do.
Packit Service 6d40f9
	 */
Packit Service 6d40f9
	ADCLI_ERR_FAIL = -3,
Packit Service 6d40f9
Packit Service 6d40f9
	/*
Packit Service 6d40f9
	 * A problem with the active directory or connecting to it.
Packit Service 6d40f9
	 */
Packit Service 6d40f9
	ADCLI_ERR_DIRECTORY = -4,
Packit Service 6d40f9
Packit Service 6d40f9
	/*
Packit Service 6d40f9
	 * A logic problem with the configuration of the local system, or
Packit Service 6d40f9
	 * the settings passed into adcli.
Packit Service 6d40f9
	 */
Packit Service 6d40f9
	ADCLI_ERR_CONFIG = -5,
Packit Service 6d40f9
Packit Service 6d40f9
	/*
Packit Service 6d40f9
	 * Invalid credentials.
Packit Service 6d40f9
	 *
Packit Service 6d40f9
	 * The credentials are invalid, or don't have the necessary
Packit Service 6d40f9
	 * access rights.
Packit Service 6d40f9
	 */
Packit Service 6d40f9
	ADCLI_ERR_CREDENTIALS = -6,
Packit Service 6d40f9
} adcli_result;
Packit Service 6d40f9
Packit Service 6d40f9
typedef enum {
Packit Service 6d40f9
	ADCLI_MESSAGE_INFO,
Packit Service 6d40f9
	ADCLI_MESSAGE_WARNING,
Packit Service 6d40f9
	ADCLI_MESSAGE_ERROR
Packit Service 6d40f9
} adcli_message_type;
Packit Service 6d40f9
Packit Service 6d40f9
const char *      adcli_result_to_string        (adcli_result res);
Packit Service 6d40f9
Packit Service 6d40f9
int               adcli_mem_clear               (void *data,
Packit Service 6d40f9
                                                 size_t length);
Packit Service 6d40f9
Packit Service 6d40f9
Packit Service 6d40f9
typedef void      (* adcli_message_func)        (adcli_message_type type,
Packit Service 6d40f9
                                                 const char *message);
Packit Service 6d40f9
Packit Service 6d40f9
void              adcli_set_message_func        (adcli_message_func message_func);
Packit Service 6d40f9
Packit Service 6d40f9
void              adcli_clear_last_error        (void);
Packit Service 6d40f9
Packit Service 6d40f9
const char *      adcli_get_last_error          (void);
Packit Service 6d40f9
Packit Service 6d40f9
#endif /* ADUTIL_H_ */