From ae815fe0090a159d5d7ba551fb6a4da2a11393fa Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Mon, 24 Apr 2006 18:47:56 +0000 Subject: [PATCH] Create prototype for IPC_CREATE macro on linux, and change return type to pointer. --- c_micasacache/sscs_ipc.c | 5 +- include/sscs_ipc.h | 385 ++++++++++++++++++++------------------- 2 files changed, 198 insertions(+), 192 deletions(-) diff --git a/c_micasacache/sscs_ipc.c b/c_micasacache/sscs_ipc.c index 42480b03..c8947679 100644 --- a/c_micasacache/sscs_ipc.c +++ b/c_micasacache/sscs_ipc.c @@ -34,7 +34,8 @@ int firstReadAfterWrite = 0; */ #ifdef SSCS_LINUX_PLAT_F -int ipc_unx_create() +void* ipc_unx_create() + { int retVal = 0; struct sockaddr_un servAddr; @@ -63,7 +64,7 @@ int ipc_unx_create() else retVal = sockFd; }while(0); - return retVal; + return (void*)retVal; } #else diff --git a/include/sscs_ipc.h b/include/sscs_ipc.h index 9c364b49..9bdc6b33 100644 --- a/include/sscs_ipc.h +++ b/include/sscs_ipc.h @@ -20,158 +20,163 @@ * ***********************************************************************/ -#ifndef _SSCS_IPC_H -#define _SSCS_IPC_H -#include - -typedef uint8_t Byte; -#define MAX_SOCKET_PATH_LEN 256 -#ifdef DEBUG -#define DMSG(x) printf x -#else -#define DMSG(x) -#endif -// Used for global buffers. -#define MIN_REQUEST_BUF_LEN 1024 -#define MIN_REPLY_BUF_LEN 4096 - -#ifdef SSCS_LINUX_PLAT_F -#include "sscs_unx_ipc_client.h" -#include "sscs_unx_cache_defines.h" -#include -#include -#include - -#define IPC_CREATE(...) ipc_unx_create(__VA_ARGS__); -#define IPC_READ(...) ipc_unx_read(__VA_ARGS__); -#define IPC_WRITE(...) ipc_unx_write(__VA_ARGS__); -#define IPC_CLOSE(...) ipc_unx_close(__VA_ARGS__); - -#else - -//#ifdef SSCS_WIN32_PLAT_F - -#include -#include "sscs_unx_ipc_client.h" -#include "sscs_unx_cache_defines.h" -#include -#include - -void * ipc_win_create(void); -int ipc_win_write(HANDLE hPipe, LPCVOID lpBuffer, DWORD bytesToWrite); -int ipc_win_read(HANDLE hPipe, LPVOID lpBuffer, DWORD numOfBytesToRead); -int ipc_win_close(HANDLE hPipe); - -#define IPC_CREATE() ipc_win_create(); -#define IPC_READ(s1,s2,s3) ipc_win_read(s1,s2,s3); -#define IPC_WRITE(s1,s2,s3) ipc_win_write(s1,s2,s3); -#define IPC_CLOSE(s1) ipc_win_close(s1); - -//#endif - -// function prototypes -int ipc_OpenSecretStore -( - void *secretStoreID, - SSCS_SECRETSTORE_HANDLE_T *ssHandle -); - -int ipc_CloseSecretStore -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - uint32_t ssFlags -); - -int ipc_RemoveSecretStore -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle -); - -int ipc_EnumerateKeychainIDs -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_KEYCHAIN_ID_LIST_T *kcIDList -); - -int ipc_AddKeychain -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - unsigned int ssFlags, - SSCS_KEYCHAIN_ID_T *keychainID -); - -int ipc_RemoveKeychain -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_KEYCHAIN_ID_T *keychainID -); - -int ipc_EnumerateSecretIDs -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_KEYCHAIN_ID_T *keychainID, - SSCS_SECRET_ID_LIST_T *secretIDList -); - -int ipc_ReadSecret -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_KEYCHAIN_ID_T *keychainID, - SSCS_SECRET_ID_T *secretID, - SSCS_SECRET_T *secretData, - SSCS_PASSWORD_T *epPassword, - unsigned int *bytesRequired -); - -int ipc_WriteSecret -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - unsigned int ssFlags, - SSCS_KEYCHAIN_ID_T *keychainID, - SSCS_SECRET_ID_T *secretID, - SSCS_SECRET_T *secretData, - SSCS_PASSWORD_T *epPassword, - SSCS_EXT_T *ext -); - -int ipc_RemoveSecret -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_KEYCHAIN_ID_T *keychainID, - SSCS_SECRET_ID_T *secretID, - SSCS_PASSWORD_T *epPassword -); - -int ipc_GetSecretStoreInfo -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_SECRETSTORE_INFO_T *ssInfo -); - -int ipc_GetKeychainInfo -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_KEYCHAIN_ID_T *keychainID, - SSCS_KEYCHAIN_INFO_T *kcInfo -); - -int ipc_LockCache -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle -); - -int ipc_UnlockCache -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_PASSCODE_T *passcode -); - -int ipc_SetMasterPasscode -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_PASSCODE_T *passcode -); - +#ifndef _SSCS_IPC_H +#define _SSCS_IPC_H +#include + +typedef uint8_t Byte; +#define MAX_SOCKET_PATH_LEN 256 +#ifdef DEBUG +#define DMSG(x) printf x +#else +#define DMSG(x) +#endif +// Used for global buffers. +#define MIN_REQUEST_BUF_LEN 1024 +#define MIN_REPLY_BUF_LEN 4096 + +#ifdef SSCS_LINUX_PLAT_F +#include "sscs_unx_ipc_client.h" +#include "sscs_unx_cache_defines.h" +#include +#include +#include + +void* ipc_unx_create(void); +int ipc_unx_write(int fd, Byte *pData, int bytes); +int ipc_unx_read(int fd, Byte *pData, int bytes); +int ipc_unx_close(int fd); + +#define IPC_CREATE(...) ipc_unx_create(__VA_ARGS__); +#define IPC_READ(...) ipc_unx_read(__VA_ARGS__); +#define IPC_WRITE(...) ipc_unx_write(__VA_ARGS__); +#define IPC_CLOSE(...) ipc_unx_close(__VA_ARGS__); + +#else + +//#ifdef SSCS_WIN32_PLAT_F + +#include +#include "sscs_unx_ipc_client.h" +#include "sscs_unx_cache_defines.h" +#include +#include + +void * ipc_win_create(void); +int ipc_win_write(HANDLE hPipe, LPCVOID lpBuffer, DWORD bytesToWrite); +int ipc_win_read(HANDLE hPipe, LPVOID lpBuffer, DWORD numOfBytesToRead); +int ipc_win_close(HANDLE hPipe); + +#define IPC_CREATE() ipc_win_create(); +#define IPC_READ(s1,s2,s3) ipc_win_read(s1,s2,s3); +#define IPC_WRITE(s1,s2,s3) ipc_win_write(s1,s2,s3); +#define IPC_CLOSE(s1) ipc_win_close(s1); + +//#endif + +// function prototypes +int ipc_OpenSecretStore +( + void *secretStoreID, + SSCS_SECRETSTORE_HANDLE_T *ssHandle +); + +int ipc_CloseSecretStore +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + uint32_t ssFlags +); + +int ipc_RemoveSecretStore +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle +); + +int ipc_EnumerateKeychainIDs +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_KEYCHAIN_ID_LIST_T *kcIDList +); + +int ipc_AddKeychain +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + unsigned int ssFlags, + SSCS_KEYCHAIN_ID_T *keychainID +); + +int ipc_RemoveKeychain +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_KEYCHAIN_ID_T *keychainID +); + +int ipc_EnumerateSecretIDs +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_KEYCHAIN_ID_T *keychainID, + SSCS_SECRET_ID_LIST_T *secretIDList +); + +int ipc_ReadSecret +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_KEYCHAIN_ID_T *keychainID, + SSCS_SECRET_ID_T *secretID, + SSCS_SECRET_T *secretData, + SSCS_PASSWORD_T *epPassword, + unsigned int *bytesRequired +); + +int ipc_WriteSecret +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + unsigned int ssFlags, + SSCS_KEYCHAIN_ID_T *keychainID, + SSCS_SECRET_ID_T *secretID, + SSCS_SECRET_T *secretData, + SSCS_PASSWORD_T *epPassword, + SSCS_EXT_T *ext +); + +int ipc_RemoveSecret +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_KEYCHAIN_ID_T *keychainID, + SSCS_SECRET_ID_T *secretID, + SSCS_PASSWORD_T *epPassword +); + +int ipc_GetSecretStoreInfo +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_SECRETSTORE_INFO_T *ssInfo +); + +int ipc_GetKeychainInfo +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_KEYCHAIN_ID_T *keychainID, + SSCS_KEYCHAIN_INFO_T *kcInfo +); + +int ipc_LockCache +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle +); + +int ipc_UnlockCache +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_PASSCODE_T *passcode +); + +int ipc_SetMasterPasscode +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_PASSCODE_T *passcode +); + int ipc_ReadKey ( SSCS_SECRETSTORE_HANDLE_T *ssHandle, @@ -183,36 +188,9 @@ int ipc_ReadKey uint32_t *valLen, SSCS_PASSWORD_T *epPassword, uint32_t *bytesRequired -); - +); + int ipc_WriteKey -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - uint32_t ssFlags, - SSCS_KEYCHAIN_ID_T *keychainID, - SSCS_SECRET_ID_T *secretID, - SS_UTF8_T *key, - uint32_t keyLen, - uint8_t *val, - uint32_t valLen, - SSCS_PASSWORD_T *epPassword, - SSCS_EXT_T *ext -); - -int ipc_ReadBinaryKey -( - SSCS_SECRETSTORE_HANDLE_T *ssHandle, - SSCS_KEYCHAIN_ID_T *keychainID, - SSCS_SECRET_ID_T *secretID, - SS_UTF8_T *key, - uint32_t keyLen, - uint8_t *val, - uint32_t *valLen, - SSCS_PASSWORD_T *epPassword, - uint32_t *bytesRequired -); - -int ipc_WriteBinaryKey ( SSCS_SECRETSTORE_HANDLE_T *ssHandle, uint32_t ssFlags, @@ -224,15 +202,42 @@ int ipc_WriteBinaryKey uint32_t valLen, SSCS_PASSWORD_T *epPassword, SSCS_EXT_T *ext -); - +); + +int ipc_ReadBinaryKey +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + SSCS_KEYCHAIN_ID_T *keychainID, + SSCS_SECRET_ID_T *secretID, + SS_UTF8_T *key, + uint32_t keyLen, + uint8_t *val, + uint32_t *valLen, + SSCS_PASSWORD_T *epPassword, + uint32_t *bytesRequired +); + +int ipc_WriteBinaryKey +( + SSCS_SECRETSTORE_HANDLE_T *ssHandle, + uint32_t ssFlags, + SSCS_KEYCHAIN_ID_T *keychainID, + SSCS_SECRET_ID_T *secretID, + SS_UTF8_T *key, + uint32_t keyLen, + uint8_t *val, + uint32_t valLen, + SSCS_PASSWORD_T *epPassword, + SSCS_EXT_T *ext +); + int32_t ipc_SetMasterPassword ( SSCS_SECRETSTORE_HANDLE_T *ssHandle, SSCS_PASSWORD_T *passwd, SSCS_HINT_T *hint -); - +); + int ipc_IsSecretPersistent ( SSCS_SECRETSTORE_HANDLE_T *ssHandle, @@ -240,8 +245,8 @@ int ipc_IsSecretPersistent SSCS_KEYCHAIN_ID_T *keychainID, SSCS_SECRET_ID_T *secretID, SSCS_EXT_T *ext -); - -#endif -#endif - +); + +#endif +#endif +