RSA BSAFE Micro Edition Suite

Streamlined security for mobile and embedded devices

Search  Print

stack.h

Go to the documentation of this file.
00001 /* $Id: stack.h,v 1.24 2003/09/19 07:12:35 sfruenke Exp $ */
00002 /*
00003  * Copyright (C) 1998-2003 RSA Security Inc. All rights reserved. 
00004  *
00005  * This work contains proprietary information of RSA Security. 
00006  * Distribution is limited to authorized licensees of RSA 
00007  * Security. Any unauthorized reproduction, distribution or 
00008  * modification of this work is strictly prohibited.
00009  */
00016 #ifndef HEADER_COMMON_STACK_H
00017 #define HEADER_COMMON_STACK_H
00018 
00019 
00020 #ifdef  __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 #include "r_com.h"
00025 
00026 #ifndef HEADER_COMMON_STACK_H_TYPEDEF_DEF
00027 #define HEADER_COMMON_STACK_H_TYPEDEF_DEF
00028 
00031 typedef struct stack_st STACK;
00032 #endif
00033 
00034 #ifndef HEADER_COMMON_STACK_H_STRUCT_DEF
00035 #define HEADER_COMMON_STACK_H_STRUCT_DEF
00036 
00040 struct stack_st
00041     {
00042     int num;
00043     char **data;
00044     int sorted;
00045 
00046     int num_alloc;
00047     int (*comp)(char **d1, char **d2);
00048     };
00049 #endif
00050 
00051 #define sk_num(sk)      ((sk)->num)
00052 #define sk_value(sk,n)  ((sk)->data[n])
00053 #define sk_data(sk)     ((sk)->data)
00054 
00055 #define sk_new_null()   sk_new(NULL)
00056 
00057 
00058 STACK * R_CDECL sk_new(int (*cmp)(char **d1, char **d2));
00059 void R_CDECL sk_pop_free(STACK *st, void (*func)(char *data));
00060 int R_CDECL sk_delete_all(STACK *st, char *data, void (*free_func)(char *data));
00061 void R_CDECL sk_clear(STACK *st, void (*free_func)(char *data));
00062 void R_CDECL sk_set_cmp_func(STACK *sk, int (*c)(char **d1, char **d2));
00063 
00064 #if defined(PLATFORM_LINUX_KERNEL)
00065 void R_CDECL sk_rcom_free(STACK *);
00066 #define sk_free             sk_rcom_free
00067 #else
00068 void R_CDECL sk_free(STACK *);
00069 #endif    
00070 int R_CDECL sk_insert(STACK *sk,char *data,int where);
00071 char * R_CDECL sk_delete(STACK *st,int loc);
00072 char * R_CDECL sk_delete_ptr(STACK *st, char *p);
00073 int R_CDECL sk_find(STACK *st,char *data);
00074 int R_CDECL sk_lfind(STACK *st, char *data);
00075 int R_CDECL sk_move(STACK *st, int loc, int dest);
00076 int R_CDECL sk_push(STACK *st,char *data);
00077 int R_CDECL sk_unshift(STACK *st,char *data);
00078 char * R_CDECL sk_shift(STACK *st);
00079 char * R_CDECL sk_pop(STACK *st);
00080 void R_CDECL sk_zero(STACK *st);
00081 STACK * R_CDECL sk_dup(STACK *st);
00082 int R_CDECL sk_cat(STACK *d_st, STACK *s_st);
00083 char * R_CDECL sk_set(STACK *st, int i, char *value);
00084 
00085 
00086 #ifdef  __cplusplus
00087 }
00088 #endif
00089 
00090 #endif /* HEADER_COMMON_STACK_H */
00091 

Copyright (c) 1999-2005 RSA Security Inc. All rights reserved. 072-001001-2100-001-000 - 2.1