Create prototype for IPC_CREATE macro on linux,

and change return type to pointer.
This commit is contained in:
Jim Norman 2006-04-24 18:47:56 +00:00
parent c6d199d3a5
commit ae815fe009
2 changed files with 198 additions and 192 deletions

View File

@ -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

View File

@ -20,158 +20,163 @@
*
***********************************************************************/
#ifndef _SSCS_IPC_H
#define _SSCS_IPC_H
#include <micasa_types.h>
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 <sscs_lldefs.h>
#include <errno.h>
#include <unistd.h>
#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 <windows.h>
#include "sscs_unx_ipc_client.h"
#include "sscs_unx_cache_defines.h"
#include <sscs_lldefs.h>
#include <errno.h>
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 <micasa_types.h>
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 <sscs_lldefs.h>
#include <errno.h>
#include <unistd.h>
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 <windows.h>
#include "sscs_unx_ipc_client.h"
#include "sscs_unx_cache_defines.h"
#include <sscs_lldefs.h>
#include <errno.h>
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