CASA/include/sscs_lldefs.h
2006-02-01 17:48:29 +00:00

113 lines
3.2 KiB
C

/***********************************************************************
*
* 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 _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 */