1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-09-22 04:15:55 -04:00

Update: added initial structure for logging core

This commit is contained in:
Philipp Schafft 2019-09-11 22:58:15 +00:00
parent 3571819931
commit f6817709c0
4 changed files with 89 additions and 0 deletions

View File

@ -26,6 +26,7 @@ pkginclude_HEADERS = \
include/igloo/filter.h \
include/igloo/objecthandler.h \
include/igloo/logmsg.h \
include/igloo/logcore.h \
include/igloo/buffer.h \
include/igloo/list.h \
include/igloo/error.h \
@ -41,6 +42,7 @@ libigloo_la_SOURCES = \
src/filter.c \
src/objecthandler.c \
src/logmsg.c \
src/logcore.c \
src/buffer.c \
src/list.c \
src/error.c \

54
include/igloo/logcore.h Normal file
View File

@ -0,0 +1,54 @@
/* Copyright (C) 2019 Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _LIBIGLOO__LOGCORE_H_
#define _LIBIGLOO__LOGCORE_H_
/**
* @file
* Put a good description of this file here
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "ro.h"
#include "interface.h"
/* About thread safety:
* This set of functions is thread safe.
*/
typedef struct {
char *id;
char *filename;
ssize_t recent_limit;
igloo_filter_t *filter;
igloo_objecthandler_t *formater;
} igloo_logcore_output_t;
int igloo_logcore_configure(igloo_logcore_t *core, ssize_t recent_limit, ssize_t askack_limit, ssize_t output_recent_limit, const igloo_logcore_output_t *outputs, size_t outputs_len);
igloo_list_t * igloo_logcore_get_recent(igloo_logcore_t *core, const igloo_ro_type_t *type, igloo_filter_t *filter, ssize_t limit, const char *id);
igloo_list_t * igloo_logcore_get_askack(igloo_logcore_t *core, const igloo_ro_type_t *type, igloo_filter_t *filter, ssize_t limit);
int igloo_logcore_acknowledge(igloo_logcore_t *core, igloo_ro_t object);
#ifdef __cplusplus
}
#endif
#endif /* ! _LIBIGLOO__LOGCORE_H_ */

View File

@ -43,6 +43,7 @@ typedef struct igloo_io_tag igloo_io_t;
typedef struct igloo_filter_tag igloo_filter_t;
typedef struct igloo_objecthandler_tag igloo_objecthandler_t;
typedef struct igloo_logmsg_tag igloo_logmsg_t;
typedef struct igloo_logcore_tag igloo_logcore_t;
typedef struct igloo_buffer_tag igloo_buffer_t;
typedef struct igloo_list_tag igloo_list_t;
@ -72,6 +73,7 @@ typedef union __attribute__ ((__transparent_union__)) {
igloo_RO_TYPE(igloo_filter_t)
igloo_RO_TYPE(igloo_objecthandler_t)
igloo_RO_TYPE(igloo_logmsg_t)
igloo_RO_TYPE(igloo_logcore_t)
igloo_RO_TYPE(igloo_buffer_t)
igloo_RO_TYPE(igloo_list_t)
igloo_RO_TYPE(igloo_reportxml_t)

31
src/logcore.c Normal file
View File

@ -0,0 +1,31 @@
/* Icecast
*
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2019, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <igloo/ro.h>
#include <igloo/logcore.h>
#include "private.h"
struct igloo_logcore_tag {
igloo_ro_base_t __base;
};
static void __free(igloo_ro_t self);
igloo_RO_PUBLIC_TYPE(igloo_logcore_t,
igloo_RO_TYPEDECL_FREE(__free),
igloo_RO_TYPEDECL_NEW_NOOP()
);
static void __free(igloo_ro_t self)
{
igloo_logcore_t *core = igloo_RO_TO_TYPE(self, igloo_logcore_t);
}