/*
 * Copyright Likewise Software
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program 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 General Public License
 * for more details.  You should have received a copy of the GNU 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
 * 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
 */

/*
 * Copyright (C) Likewise Software. All rights reserved.
 *
 * Module Name:
 *
 *        srvevent.h
 *
 * Abstract:
 *
 *        Srv
 *
 *        Event functions
 *
 * Authors: Brian Koropoff (bkoropoff@likewise.com)
 *
 */

#ifndef __SRV_EVENT_H__
#define __SRV_EVENT_H__

#include <lw/types.h>
#include <lw/attrs.h>

typedef struct sockaddr const* PCSOCKADDR;

/**
 * @brief Session setup failure event
 *
 * Called when a session setup fails.  Notable status codes:
 * - #LW_STATUS_LOGON_FAILURE: Generic logon failure
 * - #LW_STATUS_TIME_DIFFERENCE_AT_DC: Clock skew error
 *
 * @param[in] pClientAddr the address of the client
 * @param[in] Status the failure status
 */
VOID
SrvEventSessionSetupFailure(
    IN PCSOCKADDR pClientAddr,
    IN NTSTATUS Status
    );

/**
 * @brief Tree connect failure event
 *
 * Called when a tree connect fails.  Notable status codes:
 * - #LW_STATUS_BAD_NETWORK_NAME: The share did not exist
 * - #LW_STATUS_BAD_NETWORK_PATH: The share path did not exist
 * - #LW_STATUS_ACCESS_DENIED: The user was denied share access
 *
 * @param[in] pClientAddr the address of the client
 * @param[in] pDomain the NetBIOS domain name of the user
 * @param[in] pUser the SAM account name of the user
 * @param[in] IsGuest true if the user was mapped to guest
 * @param[in] pShare the share
 * @param[in] Status the failure status
 */
VOID
SrvEventTreeConnectFailure(
    IN PCSOCKADDR pClientAddr,
    IN PWSTR pDomain,
    IN PWSTR pUser,
    IN BOOLEAN IsGuest,
    IN PWSTR pShare,
    IN NTSTATUS Status
    );

/**
 * @brief Create denied by share permissions event
 *
 * Called when a create is denied by the permissions on the share.
 *
 * @param[in] pClientAddr the address of the client
 * @param[in] pDomain the NetBIOS domain name of the user
 * @param[in] pUser the SAM account name of the user
 * @param[in] pShare the share
 * @param[in] Version the protocol version
 * @param[in] Op the protocol operation that caused the create
 * @param[in] DesiredAccess the desired access mask
 */
VOID
SrvEventCreateDeniedBySharePermissions(
    IN PCSOCKADDR pClientAddr,
    IN PWSTR pDomain,
    IN PWSTR pUser,
    IN PWSTR pShare,
    IN SMB_PROTOCOL_VERSION Version,
    IN USHORT Op,
    IN ACCESS_MASK DesiredAccess
    );

#endif
