/***********************************************************************
 *  File: casa_auth_token.h
 *  Author: Juan Carlos Luciani (jluciani@novell.com)
 * 
 *  Abstract: Defines the interface between the authentication token
 *  module and its providers.
 * 
 *  Copyright (C) 2005 Novell, Inc.
 *
 *  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; version 2.1
 *  of the License.
 *
 *  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 Lesser General Public
 *  License along with this library; if not, write to the Free
 *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 * 
 *  To contact Novell about this file by physical or electronic mail, 
 *  you may find current contact information at www.novell.com. 
 ***********************************************************************/

#ifndef _CASA_AUTH_TOKEN_H_
#define _CASA_AUTH_TOKEN_H_

#if defined(__cplusplus) || defined(c_plusplus)
extern "C" 
{
#endif

//===[ Include files ]=====================================================

#include <micasa_types.h>
#include <casa_status.h>

//===[ Type definitions ]==================================================

#ifndef SSCS_CALL
#if defined(WIN32)
#define SSCS_CALL __stdcall
#else
#define SSCS_CALL
#endif
#endif

//===[ Function prototypes ]===============================================

//===[ Global variables ]==================================================


//++=======================================================================
extern CasaStatus SSCS_CALL
GetAuthTokenCredentials(
   IN       const char  *pServiceName,
   INOUT    const char  *pUserNameBuf,
   INOUT    int         *pUserNameBufLen,
   INOUT    const char  *pTokenBuf,
   INOUT    int         *pTokenBufLen);
//
// Arguments:  
//    pServiceName -
//       Pointer to NULL terminated string that contains the
//       name of the service to which the client is trying to
//       authenticate.
//               
//    pUserNameBuf -
//       Pointer to buffer that will receive a string with the
//       username that should used when authenticating to the
//       service. The length of this buffer is specified by the
//       pUserNameBufLen parameter. Note that the string
//       returned will be NULL terminated.
//
//    pUserNameBufLen -
//       Pointer to integer that contains the length of the
//       buffer pointed at by pUserNameBuf. Upon return of the
//       function, the integer will contain the actual length
//       of the username string (including the NULL terminator)
//       if the function successfully completes or the buffer
//       length required if the function fails because the buffer
//       pointed at by either pUserNameBuf or pTokenBuf is not
//       large enough.
//               
//    pTokenBuf -
//       Pointer to buffer that will receive the authentication
//       token. The length of this buffer is specified by the
//       pTokenBufLen parameter. Note that the the authentication
//       token will be in the form of a NULL terminated string.
//
//    pTokenBufLen -
//       Pointer to integer that contains the length of the
//       buffer pointed at by pTokenBuf. Upon return of the
//       function, the integer will contain the actual length
//       of the authentication token if the function successfully
//       completes or the buffer length required if the function
//       fails because the buffer pointed at by either pUserNameBuf
//       or pTokenBuf is not large enough. Please note that the
//       authentication token
//   
// Returns:
//    Casa Status
//                           
// Description:
//    Get authentication token credentials to authenticate user to specified
//    service.
//=======================================================================--


//++=======================================================================
extern CasaStatus SSCS_CALL
ValidateAuthTokenCredentials(
   IN       const char  *pServiceName,
   IN       const char  *pUserName,
   IN       const int   userNameLen,
   IN       const char  *pTokenBuf,
   IN       const int   tokenBufLen);
//
// Arguments:  
//    pServiceName -
//       Pointer to NULL terminated string that contains the
//       name of the service to which the client is trying to
//       authenticate.
//               
//    pUserName -
//       Pointer to string with the username that is being
//       authenticated to the service. The length of the name
//       is specified by the pUserNameLen parameter. Note that
//       the string does not need to be NULL terminated.
//
//    userNameLen -
//       Length of the user name contained within the buffer
//       pointed at by pUserNameBuf (Does not include the NULL
//       terminator). If this parameter is set to -1 then the
//       function assumes that the username string is NULL
//       terminated.
//               
//    pTokenBuf -
//       Pointer to buffer that will receive the authentication
//       token. The length of this buffer is specified by the
//       pTokenBufLen parameter. Note that the the authentication
//       token will be in the form of a NULL terminated string.
//
//    tokenBufLen -
//       Length of the data contained within the buffer pointed
//       at by pTokenBuf.
//   
// Returns:
//    Casa status.
//                           
// Description:
//    Validates authentication token credentials.
//
//=======================================================================--


#if defined(__cplusplus) || defined(c_plusplus)
}
#endif // #if defined(__cplusplus) || defined(c_plusplus)

#endif // #ifndef _CASA_AUTH_TOKEN_H_