From c14bd833b7b1b3b1283d116a87b6f293377f129b Mon Sep 17 00:00:00 2001 From: Radek Novacek Date: Mon, 8 Apr 2013 11:09:53 +0200 Subject: Support for using libopenlmicommon by external providers * add FindOpenLMI.cmake module * add pkgconfig for OpenLMI * add openlmi.c/h with exported functions * add symlink with major version to openlmicommon library Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=948948 --- src/openlmi.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/openlmi.h (limited to 'src/openlmi.h') diff --git a/src/openlmi.h b/src/openlmi.h new file mode 100644 index 0000000..9b27d07 --- /dev/null +++ b/src/openlmi.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Radek Novacek + */ + +#ifndef OPENLMI_H +#define OPENLMI_H + +#include + +/** + * This function returns FQDN (fully qualified domain name) of the machine + * + * @note Use this in the SystemName property of all provider created instances. + * + * @return The scoping System's Name. + */ +const char *lmi_get_system_name(); + +/** + * This function returns system creation class name + * + * @note Use this in the SystemCreationClassName property of all provider + * created instances. + * + * @return The scoping System's Creation class name. + */ +const char *lmi_get_system_creation_class_name(); + +/** + * To use standard CIMOM logging facility, broker must be assigned. Without + * calling this function, logging will go to stderr. + * + * \p log_id Identification of log messages + * \p cb CMPIBroker + */ +void lmi_init_logging(const char *log_id, const CMPIBroker *cb); + +/** + * Get currently set logging level + * + * @return logging level + */ +int lmi_log_level(void); + +/** + * Set logging level + * + * @param level new logging level + */ +void lmi_set_log_level(int level); + +enum { + _LMI_DEBUG_NONE=0, _LMI_DEBUG_ERROR, _LMI_DEBUG_WARN, + _LMI_DEBUG_INFO, _LMI_DEBUG_DEBUG +}; + +void _lmi_debug(int level, const char *file, int line, const char *format, ...); + +#define lmi_debug(...) _lmi_debug(_LMI_DEBUG_DEBUG, __FILE__, __LINE__, __VA_ARGS__) +#define lmi_info(...) _lmi_debug(_LMI_DEBUG_INFO, __FILE__, __LINE__, __VA_ARGS__) +#define lmi_warn(...) _lmi_debug(_LMI_DEBUG_WARN, __FILE__, __LINE__, __VA_ARGS__) +#define lmi_error(...) _lmi_debug(_LMI_DEBUG_ERROR, __FILE__, __LINE__, __VA_ARGS__) + +#endif -- cgit