98 lines
2.5 KiB
C
98 lines
2.5 KiB
C
|
/**************************************************************************
|
||
|
* %name: sscs_lldefs.h %
|
||
|
* %version: 5 %
|
||
|
* %date_modified: Thu May 12 13:17:33 2005 %
|
||
|
***************************************************************************
|
||
|
*
|
||
|
***************************************************************************/
|
||
|
#ifndef _SSCSLLDEFS__H
|
||
|
#define _SSCSLLDEFS__H
|
||
|
|
||
|
|
||
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||
|
extern "C"
|
||
|
{
|
||
|
#endif
|
||
|
|
||
|
#include "sscs_utf8.h"
|
||
|
#include "micasa_types.h"
|
||
|
|
||
|
/* ############################## ERROR CODES ############################ */
|
||
|
|
||
|
#define NSSCS_LL_SUCCESS 0x00000000 /* 0 */
|
||
|
#define NSSCS_E_LL_SYS_FAILURE 0xFFFFFCDD /* -803 */
|
||
|
|
||
|
#ifndef TRUE
|
||
|
#define TRUE 1
|
||
|
#endif
|
||
|
|
||
|
#ifndef FALSE
|
||
|
#define FALSE 0
|
||
|
#endif
|
||
|
|
||
|
/* ######################## STRUCTURE DEFINITIONS ######################### */
|
||
|
|
||
|
typedef struct _ll_link
|
||
|
{
|
||
|
struct _ll_link *next; /* next in the list */
|
||
|
void *item;
|
||
|
} LL_LINK_T;
|
||
|
|
||
|
/* this is the link list information structure */
|
||
|
typedef struct _link_lst
|
||
|
{
|
||
|
uint32_t elemCount; /* number of links in the list */
|
||
|
LL_LINK_T *head; /* real head of the link list (for caching & GC)*/
|
||
|
LL_LINK_T *clp; /* current link pointer */
|
||
|
} LL_LINKLIST_T;
|
||
|
|
||
|
|
||
|
typedef struct _shared_secret_key_val
|
||
|
{
|
||
|
uint32_t kLen;
|
||
|
SS_UTF8_T *key;
|
||
|
uint32_t vLen;
|
||
|
uint8_t *value;
|
||
|
} LL_SHSEC_KEY_VAL_T;
|
||
|
|
||
|
|
||
|
int ll_InsertSharedSecretLink
|
||
|
(
|
||
|
LL_LINKLIST_T * list,
|
||
|
uint32_t kLen, //in bytes
|
||
|
SS_UTF8_T * key,
|
||
|
uint32_t vLen, // in bytes
|
||
|
uint8_t * value
|
||
|
);
|
||
|
|
||
|
int ll_RemoveSharedSecretLink
|
||
|
(
|
||
|
LL_LINKLIST_T * list,
|
||
|
uint32_t kLen,
|
||
|
SS_UTF8_T * key
|
||
|
);
|
||
|
|
||
|
#define ll_GetSHSecItem(list) ((LL_SHSEC_KEY_VAL_T *)(list)->clp->item)
|
||
|
#define ll_GetSHSecKey(list) (((LL_SHSEC_KEY_VAL_T *)(list)->clp->item)->key)
|
||
|
#define ll_GetSHSecKeyLen(list) (((LL_SHSEC_KEY_VAL_T *)(list)->clp->item)->kLen)
|
||
|
#define ll_GetSHSecVal(list) (((LL_SHSEC_KEY_VAL_T *)(list)->clp->item)->value)
|
||
|
#define ll_GetSHSecValLen(list) (((LL_SHSEC_KEY_VAL_T *)(list)->clp->item)->vLen)
|
||
|
|
||
|
#define ll_Head(list) {(list)->clp = (list)->head;}
|
||
|
#define ll_IsListPopulated(list) ((list)->elemCount)
|
||
|
#define ll_GetElemCount(list) ((list)->elemCount)
|
||
|
#define ll_GetItemPtr(list); (((list)->elemCount) ? ((list)->clp->item) : NULL)
|
||
|
|
||
|
|
||
|
void ll_DestroyList(LL_LINKLIST_T *list);
|
||
|
int ll_Next(LL_LINKLIST_T *list);
|
||
|
void* ll_GetEntry(LL_LINKLIST_T *list);
|
||
|
|
||
|
|
||
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#endif /* _SSCSLLDEFS__H */
|
||
|
|