The non-java project is being replaced by a client and a server project
in order to allow for the client component to be consumed by distributions targeting the desktop. This check-in is for the server project.
This commit is contained in:
40
CASA-auth-token/server/include/Makefile.am
Normal file
40
CASA-auth-token/server/include/Makefile.am
Normal file
@@ -0,0 +1,40 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2006 Novell, Inc.
|
||||
#
|
||||
# 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, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Author: Juan Carlos Luciani <jluciani@novell.com>
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
CFILES =
|
||||
|
||||
EXTRA_DIST = *.h
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall
|
||||
package package-clean package-install package-uninstall:
|
||||
$(MAKE) -C $(TARGET_OS) $@
|
||||
|
||||
clean-local:
|
||||
if [ -d lib ]; then rm -rf lib; fi
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
278
CASA-auth-token/server/include/casa_c_ipc.h
Normal file
278
CASA-auth-token/server/include/casa_c_ipc.h
Normal file
@@ -0,0 +1,278 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* 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 _IPCCLIENT_
|
||||
#define _IPCCLIENT_
|
||||
|
||||
//===[ Header files specific to this module ]==============================
|
||||
|
||||
//===[ Manifest constants ]==============================
|
||||
|
||||
#ifndef IN
|
||||
#define IN
|
||||
#endif
|
||||
#ifndef OUT
|
||||
#define OUT
|
||||
#endif
|
||||
#ifndef INOUT
|
||||
#define INOUT
|
||||
#endif
|
||||
|
||||
//===[ Structure Definitions ]==============================
|
||||
|
||||
//===[ Function Prototypes ]==============================
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int
|
||||
IpcClientOpenUnixRemoteEndPoint(
|
||||
IN char *pSocketFileName,
|
||||
IN int maxRpcRetries,
|
||||
INOUT uint32_t *pEndPointHandle);
|
||||
//
|
||||
// Arguments In: port - Server's listening port number.
|
||||
//
|
||||
// address - The server's IP Address. Use
|
||||
// 0x7F000001 if the server is local.
|
||||
//
|
||||
// maxRpcRetries - Maximum number of Rpc retries that
|
||||
// should be utilized when submitting
|
||||
// a request to the endpoint. A value
|
||||
// of zero requests that the default
|
||||
// setting be utilized.
|
||||
//
|
||||
// Arguments Out: pEndPointHandle - Pointer to variable that will receive
|
||||
// the endpoint handle.
|
||||
//
|
||||
// Returns: 0 == Success
|
||||
// -1 == Failure
|
||||
//
|
||||
// Abstract: Method to open a UNIX (PF_UNIX) remote endpoint.
|
||||
//
|
||||
// Note: The service should have been initialized before calling
|
||||
// this procedure.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
typedef
|
||||
int
|
||||
(*PFN_IpcClientOpenUnixRemoteEndPoint)(
|
||||
IN char *pSocketFileName,
|
||||
IN int maxRpcRetries,
|
||||
INOUT uint32_t *pEndPointHandle);
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int
|
||||
IpcClientOpenInetRemoteEndPoint(
|
||||
IN unsigned short int port,
|
||||
IN uint32_t address,
|
||||
IN int maxRpcRetries,
|
||||
INOUT uint32_t *pEndPointHandle);
|
||||
//
|
||||
// Arguments In: port - Server's listening port number.
|
||||
//
|
||||
// address - The server's IP Address. Use
|
||||
// 0x7F000001 if the server is local.
|
||||
//
|
||||
// maxRpcRetries - Maximum number of Rpc retries that
|
||||
// should be utilized when submitting
|
||||
// a request to the endpoint. A value
|
||||
// of zero requests that the default
|
||||
// setting be utilized.
|
||||
//
|
||||
// Arguments Out: pEndPointHandle - Pointer to variable that will receive
|
||||
// the endpoint handle.
|
||||
//
|
||||
// Returns: 0 == Success
|
||||
// -1 == Failure
|
||||
//
|
||||
// Abstract: Method to open a TCP (AF_INET) remote endpoint.
|
||||
//
|
||||
// Note: The service should have been initialized before calling
|
||||
// this procedure.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
typedef
|
||||
int
|
||||
(*PFN_IpcClientOpenInetRemoteEndPoint)(
|
||||
IN unsigned short int port,
|
||||
IN uint32_t address,
|
||||
IN int maxRpcRetries,
|
||||
INOUT uint32_t *pEndPointHandle);
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int
|
||||
IpcClientCloseRemoteEndPoint(
|
||||
IN uint32_t endPointHandle);
|
||||
//
|
||||
// Arguments In: endpointHandle - Handle of the endpoint being closed.
|
||||
//
|
||||
//
|
||||
// Arguments Out: None.
|
||||
// the endpoint handle.
|
||||
//
|
||||
// Returns: 0 == Success
|
||||
// -1 == Failure
|
||||
//
|
||||
// Abstract: Method to close a remote endpoint.
|
||||
//
|
||||
// Note: The service should have been initialized before calling
|
||||
// this procedure.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
typedef
|
||||
int
|
||||
(*PFN_IpcClientCloseRemoteEndPoint)(
|
||||
IN uint32_t endPointHandle);
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int
|
||||
IpcClientSubmitReq(
|
||||
IN uint32_t endPointHandle,
|
||||
IN char *pClientData,
|
||||
IN int clientDataLen,
|
||||
INOUT char **ppServerData,
|
||||
INOUT int *pServerDataLen);
|
||||
//
|
||||
// Arguments In: endPointHandle - Handle of the remote endpoint that will
|
||||
// be the target of the request.
|
||||
//
|
||||
// pClientData - Pointer to client data that must be sent to
|
||||
// the server. Buffer is NEVER released by the
|
||||
// procedure.
|
||||
//
|
||||
// clientDataLen - Length of the client data.
|
||||
//
|
||||
// Arguments Out: ppServerData - Pointer to variable that will receive a
|
||||
// pointer to the buffer containing the data
|
||||
// received from the server.
|
||||
//
|
||||
// The returned buffer always contains a NULL after the
|
||||
// data indicated. You may be able to leverage this to
|
||||
// treat the data as a NULL terminated string in cases
|
||||
// where the request consists of ASCII characters.
|
||||
//
|
||||
// pServerDataLen - Pointer to variable that will receive the
|
||||
// length of the data received from the server.
|
||||
//
|
||||
// Returns: 0 == Request completed gracefully
|
||||
// -1 == Request did not complete gracefully
|
||||
//
|
||||
// Abstract: Method to submit a request.
|
||||
//
|
||||
// Notes: The routine blocks until the request completes.
|
||||
//
|
||||
// The buffer returned with the server data must be released
|
||||
// by the calling application by calling free().
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
typedef
|
||||
int
|
||||
(*PFN_IpcClientSubmitReq)(
|
||||
IN uint32_t endPointHandle,
|
||||
IN char *pClientData,
|
||||
IN int clientDataLen,
|
||||
INOUT char **ppServerData,
|
||||
INOUT int *pServerDataLen);
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int
|
||||
IpcClientInit(
|
||||
IN char *pName,
|
||||
IN bool multithreaded,
|
||||
IN int debugLevel,
|
||||
IN bool useSyslog);
|
||||
//
|
||||
// Arguments In: pName - Pointer to string containing the name that the
|
||||
// calling application wants associated with the
|
||||
// debug logs emitted by the library.
|
||||
//
|
||||
// multithreaded - Set to TRUE if the process is
|
||||
// multithreaded.
|
||||
//
|
||||
// debugLevel - The level that the library should use for
|
||||
// determining what information should be logged
|
||||
// for debugging purposes. 0 being the lowest
|
||||
// level.
|
||||
//
|
||||
// useSyslog - Set to TRUE to log debug statements using Syslog,
|
||||
// else debugs are log to stderr.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: 0 == Success
|
||||
// -1 == Failure
|
||||
//
|
||||
// Abstract: Method to initialize the IPC infrastructure for process.
|
||||
//
|
||||
// Note: It is necessary to call the appropriate function to
|
||||
// set the server address before a request can be submitted.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
typedef
|
||||
int
|
||||
(*PFN_IpcClientInit)(
|
||||
IN char *pName,
|
||||
IN bool multithreaded,
|
||||
IN int debugLevel,
|
||||
IN bool useSyslog);
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
void
|
||||
IpcClientShutdown(void);
|
||||
//
|
||||
// Arguments In: None.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: Nothing.
|
||||
//
|
||||
// Abstract: Method to shutdown the IPC infrastructure for process.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
typedef
|
||||
void
|
||||
(*PFN_IpcClientShutdown)(void);
|
||||
|
||||
|
||||
#endif // _IPCCLIENT_
|
||||
|
||||
//=========================================================================
|
||||
//=========================================================================
|
||||
305
CASA-auth-token/server/include/casa_s_authtoken.h
Normal file
305
CASA-auth-token/server/include/casa_s_authtoken.h
Normal file
@@ -0,0 +1,305 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* 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 _CASA_S_AUTHTOKEN_H_
|
||||
#define _CASA_S_AUTHTOKEN_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 ]==================================================
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
***************************************************************************
|
||||
** **
|
||||
** Principal Interface Definition **
|
||||
** **
|
||||
***************************************************************************
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
typedef
|
||||
int
|
||||
(SSCS_CALL *PFNPrincipalIf_AddReference)(
|
||||
IN const void *pIfInstance);
|
||||
//
|
||||
// Arguments:
|
||||
// pIfInstance -
|
||||
// Pointer to interface object.
|
||||
//
|
||||
// Returns:
|
||||
// Interface reference count.
|
||||
//
|
||||
// Description:
|
||||
// Increases interface reference count.
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
typedef
|
||||
void
|
||||
(SSCS_CALL *PFNPrincipalIf_ReleaseReference)(
|
||||
IN const void *pIfInstance);
|
||||
//
|
||||
// Arguments:
|
||||
// pIfInstance -
|
||||
// Pointer to interface object.
|
||||
//
|
||||
// Returns:
|
||||
// Nothing.
|
||||
//
|
||||
// Description:
|
||||
// Decreases interface reference count. The interface is deallocated if
|
||||
// the reference count becomes zero.
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
typedef
|
||||
CasaStatus
|
||||
(SSCS_CALL *PFNPrincipalIf_GetIdentityId)(
|
||||
IN const void *pIfInstance,
|
||||
INOUT char *pIdentIdBuf,
|
||||
INOUT int *pIdentIdLen);
|
||||
//
|
||||
// Arguments:
|
||||
// pIfInstance -
|
||||
// Pointer to interface object.
|
||||
//
|
||||
// pIdentIdBuf -
|
||||
// Pointer to buffer that will receive the identity id. The returned
|
||||
// id will be in the form of a NULL terminated string.
|
||||
//
|
||||
// pIdentIdBufLen -
|
||||
// Pointer to variable with the length of the buffer pointed by
|
||||
// pIdentIdBuf. On exit it contains the length of the returned id
|
||||
// (including the NULL terminator).
|
||||
//
|
||||
//
|
||||
// Returns:
|
||||
// Casa Status
|
||||
//
|
||||
// Description:
|
||||
// Get the identity id associated with the identity token.
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
typedef
|
||||
CasaStatus
|
||||
(SSCS_CALL *PFNPrincipalIf_GetSourceName)(
|
||||
IN const void *pIfInstance,
|
||||
INOUT char *pSourceNameBuf,
|
||||
INOUT int *pSourceNameLen);
|
||||
//
|
||||
// Arguments:
|
||||
// pIfInstance -
|
||||
// Pointer to interface object.
|
||||
//
|
||||
// pSourceNameBuf -
|
||||
// Pointer to buffer that will receive the name associated with the
|
||||
// identity information source. The returned name will be in the form
|
||||
// of a NULL terminated string.
|
||||
//
|
||||
// pSourceNameBufLen -
|
||||
// Pointer to variable with the length of the buffer pointed by
|
||||
// pSourceNameBuf. On exit it contains the length of the returned
|
||||
// name (including the NULL terminator).
|
||||
//
|
||||
//
|
||||
// Returns:
|
||||
// Casa Status
|
||||
//
|
||||
// Description:
|
||||
// Get the name of the identity source associated with the identity token.
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
typedef
|
||||
CasaStatus
|
||||
(SSCS_CALL *PFNPrincipalIf_GetSourceUrl)(
|
||||
IN const void *pIfInstance,
|
||||
INOUT char *pSourceUrlBuf,
|
||||
INOUT int *pSourceUrlLen);
|
||||
//
|
||||
// Arguments:
|
||||
// pIfInstance -
|
||||
// Pointer to interface object.
|
||||
//
|
||||
// pSourceUrlBuf -
|
||||
// Pointer to buffer that will receive the URL associated with the
|
||||
// identity information source. The returned URL will be in the form
|
||||
// of a NULL terminated string.
|
||||
//
|
||||
// pSourceUrlBufLen -
|
||||
// Pointer to variable with the length of the buffer pointed by
|
||||
// pSourceUrlBuf. On exit it contains the length of the returned
|
||||
// URL (including the NULL terminator).
|
||||
//
|
||||
//
|
||||
// Returns:
|
||||
// Casa Status
|
||||
//
|
||||
// Description:
|
||||
// Get the URL to the identity source associated with the identity token.
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
typedef
|
||||
CasaStatus
|
||||
(SSCS_CALL *PFNPrincipalIf_AttributeEnumerate)(
|
||||
IN const void *pIfInstance,
|
||||
INOUT int *pEnumHandle,
|
||||
INOUT char *pAttribNameBuf,
|
||||
INOUT int *pAttribNameLen,
|
||||
INOUT char *pAttribValueBuf,
|
||||
INOUT int *pAttribValueLen);
|
||||
//
|
||||
// Arguments:
|
||||
// pIfInstance -
|
||||
// Pointer to interface object.
|
||||
//
|
||||
// pEnumHandle -
|
||||
// Pointer to enumeration handle. Must be set to 0 to start an
|
||||
// enumeration. Note the enumeration handle advances if the
|
||||
// function returns success.
|
||||
//
|
||||
// pAttribNameBuf -
|
||||
// Pointer to buffer that will receive the identity attribute name. The
|
||||
// returned name will be in the form of a NULL terminated string.
|
||||
//
|
||||
// pAttribNameLen -
|
||||
// Pointer to variable with the length of the buffer pointed by
|
||||
// pAttribNameBuf. On exit it contains the length of the returned
|
||||
// name (including the NULL terminator).
|
||||
//
|
||||
// pAttribValueBuf -
|
||||
// Pointer to buffer that will receive the identity attribute value. The
|
||||
// returned value will be in the form of a NULL terminated string.
|
||||
//
|
||||
// pAttribValueLen -
|
||||
// Pointer to variable with the length of the buffer pointed by
|
||||
// pAttribValueBuf. On exit it contains the length of the returned
|
||||
// value (including the NULL terminator).
|
||||
//
|
||||
//
|
||||
// Returns:
|
||||
// Casa Status
|
||||
//
|
||||
// Description:
|
||||
// Enumerates through the attributes associated with the identity token.
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//
|
||||
// Principal Interface Object
|
||||
//
|
||||
typedef struct _PrincipalIf
|
||||
{
|
||||
PFNPrincipalIf_AddReference addReference;
|
||||
PFNPrincipalIf_ReleaseReference releaseReference;
|
||||
PFNPrincipalIf_GetIdentityId getIdentityId;
|
||||
PFNPrincipalIf_GetSourceName getSourceName;
|
||||
PFNPrincipalIf_GetSourceUrl getSourceUrl;
|
||||
PFNPrincipalIf_AttributeEnumerate attributeEnumerate;
|
||||
|
||||
} PrincipalIf, *PPrincipalIf;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
***************************************************************************
|
||||
** **
|
||||
** Validate Authentication Token API **
|
||||
** **
|
||||
***************************************************************************
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern CasaStatus SSCS_CALL
|
||||
ValidateAuthToken(
|
||||
IN const char *pServiceName,
|
||||
IN const char *pTokenBuf,
|
||||
IN const int tokenBufLen,
|
||||
INOUT PrincipalIf **ppPrincipalIf);
|
||||
//
|
||||
// Arguments:
|
||||
// pServiceName -
|
||||
// Pointer to NULL terminated string that contains the
|
||||
// name of the service targeted by the token.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// ppPrincipalIf -
|
||||
// Pointer to variable that will receive a pointer to a principal
|
||||
// interface with information about the authenticated entity.
|
||||
// IMPORTANT NOTE: The caller is responsible for releasing the
|
||||
// interface after it is done with it to avoid a resource leak.
|
||||
//
|
||||
// Returns:
|
||||
// Casa status.
|
||||
//
|
||||
// Description:
|
||||
// Validates authentication token.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif // #if defined(__cplusplus) || defined(c_plusplus)
|
||||
|
||||
#endif // #ifndef _CASA_S_AUTHTOKEN_H_
|
||||
|
||||
259
CASA-auth-token/server/include/casa_s_ipc.h
Normal file
259
CASA-auth-token/server/include/casa_s_ipc.h
Normal file
@@ -0,0 +1,259 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* 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 _IPCSERVER_
|
||||
#define _IPCSERVER_
|
||||
|
||||
//===[ Header files specific to this module ]==============================
|
||||
|
||||
//===[ Manifest constants ]==============================
|
||||
|
||||
#ifndef IN
|
||||
#define IN
|
||||
#endif
|
||||
#ifndef OUT
|
||||
#define OUT
|
||||
#endif
|
||||
#ifndef INOUT
|
||||
#define INOUT
|
||||
#endif
|
||||
|
||||
//===[ Structure Definitions ]==============================
|
||||
|
||||
//===[ Function Prototypes ]==============================
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int32_t
|
||||
IpcServerGetRequest(void);
|
||||
//
|
||||
// Arguments In: None.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: The id of the pending request.
|
||||
// 0 == Not able to wait for request.
|
||||
//
|
||||
// Abstract: A server thread invokes this method to be informed when
|
||||
// a request is received that needs to be acted upon.
|
||||
//
|
||||
// Notes: The routine blocks until a request becomes available or
|
||||
// until the IpcServer is shutdown.
|
||||
//
|
||||
// An application can execute this method from multiple
|
||||
// threads to allow requests to be process concurrently.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int32_t
|
||||
IpcServerGetRequestData(
|
||||
IN int32_t requestId,
|
||||
INOUT char **ppReqData);
|
||||
//
|
||||
// Arguments In: requestId - The id of the request being processed.
|
||||
//
|
||||
// Arguments Out: ppReqData - Pointer to variable that will receive a
|
||||
// pointer to the buffer containing the request
|
||||
// data the client.
|
||||
//
|
||||
// Returns: The length of the request data returned.
|
||||
//
|
||||
// Abstract: Method to obtain the data associated with a particular
|
||||
// request.
|
||||
//
|
||||
// Notes: The returned buffer SHOULD NOT be released by the calling
|
||||
// application.
|
||||
//
|
||||
// The returned buffer always contains a NULL after the
|
||||
// data indicated. You may be able to leverage this to
|
||||
// treat the data as a NULL terminated string in cases
|
||||
// where the request consists of ASCII characters.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
void
|
||||
IpcServerCompleteRequest(
|
||||
IN int32_t requestId,
|
||||
IN char *pReplyData);
|
||||
//
|
||||
// Arguments In: requestId - The id of the request being completed.
|
||||
//
|
||||
// pReplyData - Pointer to reply data that must be sent to
|
||||
// the client for this request.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: Nothing.
|
||||
//
|
||||
// Abstract: Method to complete a request being processed.
|
||||
//
|
||||
// Notes: The returned buffer will not NOT be released by the method.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
void
|
||||
IpcServerAbortRequest(
|
||||
IN int32_t requestId);
|
||||
//
|
||||
// Arguments In: requestId - The id of the request being aborted.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: Nothing.
|
||||
//
|
||||
// Abstract: Method to abort a request being processed.
|
||||
//
|
||||
// Notes:
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int
|
||||
IpcServerStart(void);
|
||||
//
|
||||
// Arguments In: None.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: 0 == Success
|
||||
// -1 == Failure
|
||||
//
|
||||
// Abstract: Method to enable the reception of server requests.
|
||||
//
|
||||
// Note: The service needs to be initialized and the listen address
|
||||
// needs to be set before calling this procedure.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int
|
||||
IpcServerSetUnAddress(
|
||||
IN char *pSocketFileName);
|
||||
//
|
||||
// Arguments In: pSocketFileName - Pointer to string containing the name
|
||||
// of the socket file to listen on.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: 0 == Success
|
||||
// -1 == Failure
|
||||
//
|
||||
// Abstract: Method to set the socket file name to utilize for
|
||||
// communicating with the server via DOMAIN sockets.
|
||||
//
|
||||
// Note: The service needs to be initialized before calling this procedure.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int
|
||||
IpcServerSetInAddress(
|
||||
IN unsigned short int listenPort);
|
||||
//
|
||||
// Arguments In: serverPort - Server's listening port number.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: 0 == Success
|
||||
// -1 == Failure
|
||||
//
|
||||
// Abstract: Method to set the address to utilize for communicating
|
||||
// with the server via TCP sockets.
|
||||
//
|
||||
// Note: The service needs to be initialized before calling this procedure.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
int
|
||||
IpcServerInit(
|
||||
IN char *pName,
|
||||
IN int debugLevel,
|
||||
IN bool useSyslog);
|
||||
//
|
||||
// Arguments In: pName - Pointer to string containing the name that the
|
||||
// calling application wants associated with the
|
||||
// debug logs emitted by the library.
|
||||
//
|
||||
// debugLevel - The level that the library should use for
|
||||
// determining what information should be logged
|
||||
// for debugging purposes. 0 being the lowest
|
||||
// level.
|
||||
//
|
||||
// useSyslog - Set to TRUE to log debug statements using Syslog,
|
||||
// else debugs are log to stderr.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: 0 == Success
|
||||
// -1 == Failure
|
||||
//
|
||||
// Abstract: Method to initialize the IPC infrastructure for process.
|
||||
//
|
||||
// Note: It is necessary to call the start procedure to start
|
||||
// servicing requests.
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
//++=======================================================================
|
||||
extern
|
||||
void
|
||||
IpcServerShutdown(void);
|
||||
//
|
||||
// Arguments In: None.
|
||||
//
|
||||
// Arguments Out: None.
|
||||
//
|
||||
// Returns: Nothing.
|
||||
//
|
||||
// Abstract: Method to shutdown the IPC service.
|
||||
//
|
||||
// Note:
|
||||
//
|
||||
//=======================================================================--
|
||||
|
||||
|
||||
#endif // _IPCSERVER_
|
||||
|
||||
//=========================================================================
|
||||
//=========================================================================
|
||||
187
CASA-auth-token/server/include/list_entry.h
Normal file
187
CASA-auth-token/server/include/list_entry.h
Normal file
@@ -0,0 +1,187 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2005-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.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef _LIST_ENTRY_H_
|
||||
#define _LIST_ENTRY_H_
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//===[ Include files ]=====================================================
|
||||
|
||||
//#include <micasa_types.h>
|
||||
|
||||
//===[ Type definitions ]==================================================
|
||||
|
||||
#ifndef CSAPI
|
||||
#if defined(WIN32)
|
||||
#define CSAPI __stdcall
|
||||
#else
|
||||
#define CSAPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef IN
|
||||
#define IN
|
||||
#endif
|
||||
|
||||
#ifndef OUT
|
||||
#define OUT
|
||||
#endif
|
||||
|
||||
#ifndef INOUT
|
||||
#define INOUT
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
//
|
||||
// LIST_ENTRY Type
|
||||
// Doubly linked list structure
|
||||
//
|
||||
typedef struct _LIST_ENTRY
|
||||
{
|
||||
struct _LIST_ENTRY * volatile Flink;
|
||||
struct _LIST_ENTRY * volatile Blink;
|
||||
} LIST_ENTRY, *PLIST_ENTRY;
|
||||
#endif
|
||||
|
||||
//===[ Inlines functions ]===============================================
|
||||
|
||||
//
|
||||
// Inline functions for operating on LIST_ENTRY double-linked lists
|
||||
//
|
||||
|
||||
__inline static void InitializeListHead(
|
||||
IN PLIST_ENTRY pListEntry )
|
||||
{
|
||||
pListEntry->Flink = pListEntry->Blink = pListEntry;
|
||||
}
|
||||
|
||||
__inline static void InsertEntryAfter(
|
||||
IN PLIST_ENTRY pListEntry,
|
||||
IN PLIST_ENTRY pAfterEntry )
|
||||
{
|
||||
pListEntry->Flink = pAfterEntry->Flink;
|
||||
pListEntry->Blink = pAfterEntry;
|
||||
pListEntry->Flink->Blink = pAfterEntry->Flink = pListEntry;
|
||||
}
|
||||
|
||||
__inline static void InsertEntryBefore(
|
||||
IN PLIST_ENTRY pListEntry,
|
||||
IN PLIST_ENTRY pBeforeEntry )
|
||||
{
|
||||
pListEntry->Flink = pBeforeEntry;
|
||||
pListEntry->Blink = pBeforeEntry->Blink;
|
||||
pListEntry->Blink->Flink = pBeforeEntry->Blink = pListEntry;
|
||||
}
|
||||
|
||||
__inline static void InsertHeadList(
|
||||
IN PLIST_ENTRY pListHead,
|
||||
IN PLIST_ENTRY pListEntry )
|
||||
{
|
||||
pListEntry->Blink = pListHead;
|
||||
pListEntry->Flink = pListHead->Flink;
|
||||
pListEntry->Flink->Blink = pListHead->Flink = pListEntry;
|
||||
}
|
||||
|
||||
__inline static void InsertTailList(
|
||||
IN PLIST_ENTRY pListHead,
|
||||
IN PLIST_ENTRY pListEntry )
|
||||
{
|
||||
pListEntry->Flink = pListHead;
|
||||
pListEntry->Blink = pListHead->Blink;
|
||||
pListEntry->Blink->Flink = pListHead->Blink = pListEntry;
|
||||
}
|
||||
|
||||
__inline static bool IsListEmpty(
|
||||
IN PLIST_ENTRY pListHead )
|
||||
{
|
||||
bool rc = false;
|
||||
if(pListHead->Flink == pListHead)
|
||||
rc = true;
|
||||
return(rc);
|
||||
}
|
||||
|
||||
__inline static void RemoveEntryList(
|
||||
IN PLIST_ENTRY pListEntry )
|
||||
{
|
||||
pListEntry->Flink->Blink = pListEntry->Blink;
|
||||
pListEntry->Blink->Flink = pListEntry->Flink;
|
||||
pListEntry->Flink = pListEntry->Blink = (PLIST_ENTRY) 0xbaadf00d;
|
||||
}
|
||||
|
||||
__inline static PLIST_ENTRY RemoveHeadList(
|
||||
IN PLIST_ENTRY pListHead )
|
||||
{
|
||||
PLIST_ENTRY Entry = (PLIST_ENTRY)0;
|
||||
if(pListHead->Flink != pListHead)
|
||||
{
|
||||
Entry = pListHead->Flink;
|
||||
RemoveEntryList(Entry);
|
||||
}
|
||||
return(Entry);
|
||||
}
|
||||
|
||||
__inline static PLIST_ENTRY RemoveTailList(
|
||||
IN PLIST_ENTRY pListHead )
|
||||
{
|
||||
PLIST_ENTRY Entry= (PLIST_ENTRY)0;
|
||||
if(pListHead->Blink != pListHead)
|
||||
{
|
||||
Entry = pListHead->Blink;
|
||||
RemoveEntryList(Entry);
|
||||
}
|
||||
return(Entry);
|
||||
}
|
||||
|
||||
__inline static PLIST_ENTRY GetFirstListEntry(
|
||||
IN PLIST_ENTRY pList)
|
||||
{
|
||||
PLIST_ENTRY Entry = (PLIST_ENTRY)0;
|
||||
if(pList != pList->Flink)
|
||||
Entry = pList->Flink;
|
||||
return(Entry);
|
||||
}
|
||||
|
||||
__inline static PLIST_ENTRY GetNextListEntry(
|
||||
IN PLIST_ENTRY pList,
|
||||
IN PLIST_ENTRY pEntry)
|
||||
{
|
||||
PLIST_ENTRY Entry = (PLIST_ENTRY)0;
|
||||
if(pList != pEntry->Flink)
|
||||
Entry = pEntry->Flink;
|
||||
return(Entry);
|
||||
}
|
||||
|
||||
|
||||
//=========================================================================
|
||||
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif // #if defined(__cplusplus) || defined(c_plusplus)
|
||||
|
||||
#endif // #ifndef _LIST_ENTRY_H_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user