2006-04-03 22:20:37 +02:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Novell, Inc. 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; 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 Lesser 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, Novell, Inc.
|
|
|
|
*
|
|
|
|
* To contact Novell about this file by physical or electronic mail,
|
|
|
|
* you may find current contact information at www.novell.com.
|
|
|
|
*
|
|
|
|
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#ifndef _INTERNAL_H_
|
|
|
|
#define _INTERNAL_H_
|
|
|
|
|
|
|
|
//===[ Include files ]=====================================================
|
|
|
|
|
|
|
|
#include "platform.h"
|
|
|
|
#include <expat.h>
|
|
|
|
#include <micasa_types.h>
|
|
|
|
#include <casa_status.h>
|
2006-04-28 20:58:25 +02:00
|
|
|
#include <casa_c_authtoken.h>
|
2006-04-03 22:20:37 +02:00
|
|
|
#include "list_entry.h"
|
2006-04-28 20:58:25 +02:00
|
|
|
#include "config_if.h"
|
2006-04-03 22:20:37 +02:00
|
|
|
#include "mech_if.h"
|
|
|
|
#include "proto.h"
|
|
|
|
|
|
|
|
//===[ Type definitions ]==================================================
|
|
|
|
|
|
|
|
//
|
|
|
|
// Authentication Context structure
|
|
|
|
//
|
|
|
|
typedef struct _AuthContext
|
|
|
|
{
|
|
|
|
LIST_ENTRY listEntry;
|
|
|
|
char *pContext;
|
2006-04-28 20:58:25 +02:00
|
|
|
int contextLen;
|
2006-04-03 22:20:37 +02:00
|
|
|
char *pMechanism;
|
2006-04-28 20:58:25 +02:00
|
|
|
int mechanismLen;
|
2006-04-03 22:20:37 +02:00
|
|
|
char *pMechInfo;
|
2006-04-28 20:58:25 +02:00
|
|
|
int mechInfoLen;
|
2006-04-03 22:20:37 +02:00
|
|
|
|
|
|
|
} AuthContext, *PAuthContext;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Authentication Policy structure
|
|
|
|
//
|
|
|
|
typedef struct _AuthPolicy
|
|
|
|
{
|
|
|
|
LIST_ENTRY authContextListHead;
|
|
|
|
|
|
|
|
} AuthPolicy, *PAuthPolicy;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Get Authentication Policy Response structure
|
|
|
|
//
|
|
|
|
typedef struct _GetAuthPolicyResp
|
|
|
|
{
|
|
|
|
char *pPolicy;
|
|
|
|
int policyLen;
|
|
|
|
|
|
|
|
} GetAuthPolicyResp, *PGetAuthPolicyResp;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Get Authentication Token Response structure
|
|
|
|
//
|
|
|
|
typedef struct _GetAuthTokenResp
|
|
|
|
{
|
|
|
|
char *pToken;
|
2006-04-28 20:58:25 +02:00
|
|
|
int tokenLen;
|
2006-04-03 22:20:37 +02:00
|
|
|
int tokenLifetime;
|
|
|
|
|
|
|
|
} GetAuthTokenResp, *PGetAuthTokenResp;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Authenticate Response structure
|
|
|
|
//
|
|
|
|
typedef struct _AuthenticateResp
|
|
|
|
{
|
|
|
|
char *pToken;
|
2006-04-28 20:58:25 +02:00
|
|
|
int tokenLen;
|
2006-04-03 22:20:37 +02:00
|
|
|
int tokenLifetime;
|
|
|
|
|
|
|
|
} AuthenticateResp, *PAuthenticateResp;
|
|
|
|
|
|
|
|
|
|
|
|
//===[ Inlines functions ]===============================================
|
|
|
|
|
|
|
|
//===[ Function prototypes ]===============================================
|
|
|
|
|
|
|
|
//===[ Global variables ]==================================================
|
|
|
|
|
|
|
|
//===[ Global externals ]==================================================
|
|
|
|
|
|
|
|
extern int DebugLevel;
|
|
|
|
|
|
|
|
extern char mechConfigFolder[];
|
|
|
|
|
|
|
|
extern char pathCharString[];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===[ External prototypes ]===============================================
|
|
|
|
|
|
|
|
//
|
|
|
|
// Functions exported by engine.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
int
|
|
|
|
InitializeLibrary(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Functions exported by authmech.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
GetAuthMechToken(
|
|
|
|
IN AuthContext *pAuthContext,
|
|
|
|
INOUT char **ppAuthMechToken);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Functions exported by getpolicymsg.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
char*
|
|
|
|
BuildGetAuthPolicyMsg(
|
|
|
|
IN char *pServiceName,
|
|
|
|
IN char *pHostName);
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
CreateGetAuthPolicyResp(
|
|
|
|
IN char *pRespMsg,
|
|
|
|
IN int respLen,
|
|
|
|
INOUT GetAuthPolicyResp **ppGetAuthPolicyResp);
|
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
|
|
|
RelGetAuthPolicyResp(
|
|
|
|
IN GetAuthPolicyResp *pGetAuthPolicyResp);
|
|
|
|
|
2006-04-28 20:58:25 +02:00
|
|
|
//
|
|
|
|
// Functions exported by authpolicy.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
CreateAuthPolicy(
|
|
|
|
IN char *pEncodedData,
|
|
|
|
IN int encodedDataLen,
|
|
|
|
INOUT AuthPolicy **ppAuthPolicy);
|
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
|
|
|
RelAuthPolicy(
|
|
|
|
IN AuthPolicy *pAuthPolicy);
|
|
|
|
|
2006-04-03 22:20:37 +02:00
|
|
|
//
|
|
|
|
// Functions exported by authmsg.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
char*
|
|
|
|
BuildAuthenticateMsg(
|
|
|
|
IN AuthContext *pAuthContext,
|
|
|
|
IN char *pAuthMechToken);
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
CreateAuthenticateResp(
|
|
|
|
IN char *pRespMsg,
|
|
|
|
IN int respLen,
|
|
|
|
INOUT AuthenticateResp **ppAuthenticateResp);
|
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
|
|
|
RelAuthenticateResp(
|
|
|
|
IN AuthenticateResp *pAuthenticateResp);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Functions exported by gettokenmsg.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
char*
|
|
|
|
BuildGetAuthTokenMsg(
|
|
|
|
IN char *pServiceName,
|
|
|
|
IN char *pHostName,
|
|
|
|
IN char *pSessionToken);
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
CreateGetAuthTokenResp(
|
|
|
|
IN char *pRespMsg,
|
|
|
|
IN int respLen,
|
|
|
|
INOUT GetAuthTokenResp **ppGetAuthTokenResp);
|
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
|
|
|
RelGetAuthTokenResp(
|
|
|
|
IN GetAuthTokenResp *pGetAuthTokenResp);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Functions exported by cache.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
AuthCacheEntry*
|
2006-06-02 18:58:27 +02:00
|
|
|
CreateSessionTokenCacheEntry(
|
|
|
|
IN const char *pCacheKey);
|
|
|
|
|
|
|
|
extern
|
|
|
|
AuthCacheEntry*
|
|
|
|
CreateAuthTokenCacheEntry(
|
2006-05-19 22:10:29 +02:00
|
|
|
IN const char *pCacheKey,
|
2006-06-02 18:58:27 +02:00
|
|
|
IN const char *pGroupOrHostName);
|
2006-04-03 22:20:37 +02:00
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
2006-05-19 22:10:29 +02:00
|
|
|
ReleaseAuthCacheEntry(
|
|
|
|
IN AuthCacheEntry *pEntry);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
IncAuthCacheEntryRefCount(
|
2006-04-03 22:20:37 +02:00
|
|
|
IN AuthCacheEntry *pEntry);
|
|
|
|
|
|
|
|
extern
|
|
|
|
AuthCacheEntry*
|
2006-06-02 18:58:27 +02:00
|
|
|
FindSessionTokenEntryInCache(
|
|
|
|
IN const char *pCacheKey);
|
|
|
|
|
|
|
|
extern
|
|
|
|
AuthCacheEntry*
|
|
|
|
FindAuthTokenEntryInCache(
|
2006-05-19 22:10:29 +02:00
|
|
|
IN const char *pCacheKey,
|
2006-06-02 18:58:27 +02:00
|
|
|
IN const char *pGroupOrHostName);
|
2006-04-03 22:20:37 +02:00
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
|
|
|
AddEntryToAuthCache(
|
|
|
|
IN AuthCacheEntry *pEntry,
|
|
|
|
IN int entryLifetime);
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
InitializeAuthCache(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Functions exported by config.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
GetConfigInterface(
|
|
|
|
IN const char *pConfigFolder,
|
|
|
|
IN const char *pConfigName,
|
|
|
|
INOUT ConfigIf **ppConfigIf);
|
|
|
|
|
|
|
|
//
|
2006-04-28 21:06:24 +02:00
|
|
|
// Functions exported by platform.c
|
2006-04-03 22:20:37 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
CreateUserMutex(void);
|
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
2006-04-28 20:58:25 +02:00
|
|
|
AcquireUserMutex(void);
|
2006-04-03 22:20:37 +02:00
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
2006-04-28 20:58:25 +02:00
|
|
|
ReleaseUserMutex(void);
|
2006-04-03 22:20:37 +02:00
|
|
|
|
|
|
|
extern
|
|
|
|
LIB_HANDLE
|
|
|
|
OpenLibrary(
|
|
|
|
IN char *pFileName);
|
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
|
|
|
CloseLibrary(
|
|
|
|
IN LIB_HANDLE libHandle);
|
|
|
|
|
|
|
|
extern
|
|
|
|
void*
|
|
|
|
GetFunctionPtr(
|
|
|
|
IN LIB_HANDLE libHandle,
|
|
|
|
IN char *pFunctionName);
|
|
|
|
|
|
|
|
extern
|
|
|
|
char*
|
|
|
|
NormalizeHostName(
|
2006-05-19 22:10:29 +02:00
|
|
|
IN const char *pHostName);
|
2006-04-03 22:20:37 +02:00
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
InitializeHostNameNormalization(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Functions exported by rpc.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
RpcSession*
|
|
|
|
OpenRpcSession(
|
|
|
|
IN char *pHostName);
|
|
|
|
|
|
|
|
extern
|
|
|
|
void
|
|
|
|
CloseRpcSession(
|
|
|
|
IN RpcSession *pSession);
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
Rpc(
|
|
|
|
IN RpcSession *pSession,
|
|
|
|
IN char *pMethod,
|
|
|
|
IN bool secure,
|
|
|
|
IN char *pRequestData,
|
|
|
|
INOUT char **ppResponseData,
|
|
|
|
INOUT int *pResponseDataLen);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Defined in utils.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
EncodeData(
|
|
|
|
IN const void *pData,
|
|
|
|
IN const int32_t dataLen,
|
|
|
|
INOUT char **ppEncodedData,
|
|
|
|
INOUT int32_t *pEncodedDataLen);
|
|
|
|
|
|
|
|
extern
|
|
|
|
CasaStatus
|
|
|
|
DecodeData(
|
|
|
|
IN const char *pEncodedData,
|
|
|
|
IN const int32_t encodedDataLen, // Does not include NULL terminator
|
|
|
|
INOUT void **ppData,
|
|
|
|
INOUT int32_t *pDataLen);
|
|
|
|
|
|
|
|
extern
|
|
|
|
int
|
|
|
|
dtoul(
|
2006-05-19 22:10:29 +02:00
|
|
|
IN const char *cp,
|
|
|
|
IN const int len);
|
2006-04-03 22:20:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
|
|
|
#endif // _INTERNAL_H_
|
|
|
|
|