/*
 * Copyright (c) Likewise Software.  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 program.  If
 * not, see <http://www.gnu.org/licenses/>.
 *
 * LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING
 * TERMS AS WELL.  IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT
 * WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE
 * TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU
 * LESSER GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE.  IF YOU
 * HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING
 * TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT
 * license@likewisesoftware.com
 */

/*
 * Module Name:
 *
 *        eventlog.c
 *
 * Abstract:
 *
 *        Low-level eventlog API
 *
 * Authors: Brian Koropoff (bkoropoff@likewise.com)
 *
 */

#include "includes.h"

static LW_RTL_EVENTLOG_POST_CALLBACK gEventPostFunction = NULL;
static LW_RTL_EVENTLOG_REGISTER_TYPE_CALLBACK gEventRegisterFunction = NULL;

LW_NTSTATUS
LwRtlEventlogSetCallbacks(
    LW_IN LW_RTL_EVENTLOG_POST_CALLBACK Post,
    LW_IN LW_RTL_EVENTLOG_REGISTER_TYPE_CALLBACK Register
    )
{
    gEventPostFunction = Post;
    gEventRegisterFunction = Register;

    return STATUS_SUCCESS;
}

LW_NTSTATUS
LwRtlEventlogPostEvents(
    LW_IN LW_ULONG RecordCount,
    LW_IN PLW_RTL_EVENTLOG_RECORD pRecords,
    LW_IN LW_OPTIONAL LW_RTL_EVENTLOG_COMPLETE_CALLBACK Complete,
    LW_IN LW_OPTIONAL LW_PVOID pContext
    )
{
    if (gEventPostFunction)
    {
        return gEventPostFunction(RecordCount, pRecords, Complete, pContext);
    }
    else
    {
        return STATUS_SUCCESS;
    }
}

LW_NTSTATUS
LwRtlEventlogRegisterEventType(
    LW_IN LW_PCGUID pGuid,
    LW_IN LW_RTL_EVENTLOG_TYPE_INFO_FORMAT Format,
    LW_IN PLW_RTL_EVENTLOG_TYPE_INFO pTypeInfo
    )
{
    if (gEventRegisterFunction)
    {
        return gEventRegisterFunction(pGuid, Format, pTypeInfo);
    }
    else
    {
        return STATUS_SUCCESS;
    }
}
