
#ifndef DTISECURITY_H
#define DTISECURITY_H
/*************************************************************************
 **
 **  Copyright 2014 Actian Corporation All Rights Reserved
 **
 *************************************************************************/
/*************************************************************************
 *   DTISECURITY.H
 *
 *
 *   This header prototypes the database security functions
 *   of the PSQL Distributed Tuning Interface.
 *
 *     The following functions are found in this file:
 *
 *       PvSecureDatabase()
 *       PvSecureDatabase2()
 *       PvUnSecureDatabase()
 *       PvIsDatabaseSecured()
 *
 *************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

#ifndef DTI_IMPEXP
#define DTI_IMPEXP
#endif

#ifndef DTI_API
#define DTI_API BTI_SINT DTI_IMPEXP BTIAPICALLTYPE
#endif

/*
 * DTI_API PvSecureDatabase (BTI_LONG hConnection, const BTI_CHAR *dbName,
 *                           const BTI_CHAR *userName, const BTI_CHAR *userPwd)
 * Description: Secures the specified database with the given Master password
 *              The user name is not used currently.
 *
 * Returns: P_OK - on sucess,
 *          P_E_FAIL  if the call fails with a general error
 * Parameters:
 *              IN: hConnection - the connection of interest
 *                  dbName      - database name
 *                  userName    - user name (currently ignored)
 *                  userPwd     - password (Master password assumed)
 */
DTI_API PvSecureDatabase (BTI_LONG hConnection, const BTI_CHAR *dbName,
                          const BTI_CHAR *userName, const BTI_CHAR *userPwd);

/*
 * DTI_API PvSecureDatabase2 (BTI_LONG hConnection, const BTI_CHAR *dbName,
 *                            const BTI_CHAR *userPwd, BTI_LONG authentication)
 * Description: Secures the specified database with the given Master password
 *              and authentication.
 *
 * Returns: P_OK - on sucess,
 *          P_E_FAIL  if the call fails with a general error
 * Parameters:
 *              IN: hConnection - the connection of interest
 *                  dbName      - database name
 *                  userPwd     - password (Master password assumed)
 *                  authentication - authentication type
 */
DTI_API PvSecureDatabase2 (BTI_LONG hConnection, const BTI_CHAR *dbName,
                           const BTI_CHAR *userPwd, BTI_LONG authentication);

/*
 * DTI_API PvUnSecureDatabase (BTI_LONG hConnection, const BTI_CHAR *dbName,
 *                             const BTI_CHAR *userName, const BTI_CHAR *userPwd)
 * Description: Unsecures the specified database with the given Master password
 *              The user name is not used currently.
 *
 * Returns: P_OK - on sucess,
 *          P_E_FAIL  if the call fails with a general error
 * Parameters:
 *              IN: hConnection - the connection of interest
 *                  dbName      - database name
 *                  userName    - user name (currently ignored)
 *                  userPwd     - password (Master password assumed)
 */
DTI_API PvUnSecureDatabase (BTI_LONG hConnection, const BTI_CHAR *dbName,
                            const BTI_CHAR *userName, const BTI_CHAR *userPwd);

/*
 * DTI_API PvIsDatabaseSecured (BTI_LONG hConnection, const BTI_CHAR *dbName,
 *                              BTI_ULONG_PTR secured)
 * Description: Checks if given database is secured or not.
 *
 * Returns: P_OK - on sucess,
 *          P_E_FAIL  if the call fails with a general error
 * Parameters:
 *              IN: hConnection - the connection of interest
 *                  dbName      - database name
 *              OUT: secured    - > 0 if secured, 0 if not
 */
DTI_API PvIsDatabaseSecured (BTI_LONG hConnection, const BTI_CHAR *dbName,
                             BTI_ULONG_PTR secured);

#ifdef __cplusplus
}
#endif

#endif // DTISECURITY_H

