ca8880818858070c0b55234d20f6081ca4b693b9
[silc.git] / lib / silcsim / silcsim.h
1 /*
2
3   silcsim.h
4
5   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
6
7   Copyright (C) 2000 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 2 of the License, or
12   (at your option) any later version.
13   
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19 */
20
21 #ifndef SILCSIM_H
22 #define SILCSIM_H
23
24 typedef struct SilcSimStruct *SilcSim;
25
26 /* All SIM types. New types maybe freely added. */
27 typedef enum {
28   SILC_SIM_NONE = 0,
29   SILC_SIM_CIPHER,
30   SILC_SIM_HASH,
31 } SilcSimType;
32
33 /* Flags used to retrieve the symbols from the library file. Default
34    is that the symbols are resolved as they are loaded. However, if
35    system doesn't support this we have no other choice but to do it lazy
36    thus experience some overhead when using the symbol first time. */
37 #if defined(RTLD_NOW)
38 #define SILC_SIM_FLAGS RTLD_NOW
39 #elif defined(RTLD_LAZY)
40 #define SILC_SIM_FLAGS RTLD_LAZY
41 #else
42 #define SILC_SIM_FLAGS 0
43 #endif
44
45 /* Prototypes */
46 SilcSim silc_sim_alloc(SilcSimType type, const char *libname, 
47                        SilcUInt32 flags);
48 void silc_sim_free(SilcSim sim);
49 int silc_sim_load(SilcSim sim);
50 int silc_sim_close(SilcSim sim);
51 const char *silc_sim_error(SilcSim sim);
52 void *silc_sim_getsym(SilcSim sim, const char *symbol);
53
54 #endif