00001 #ifndef NETSNMP_FACTORY_H
00002 #define NETSNMP_FACTORY_H
00003
00004
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008
00009 typedef void * (netsnmp_factory_produce_f)(void);
00010 typedef int (netsnmp_factory_produce_noalloc_f)(void *);
00011
00012 typedef struct netsnmp_factory_s {
00013
00014
00015
00016 const char *product;
00017
00018
00019
00020
00021 netsnmp_factory_produce_f *produce;
00022
00023
00024
00025
00026 netsnmp_factory_produce_noalloc_f *produce_noalloc;
00027
00028 } netsnmp_factory;
00029
00030
00031
00032
00033 void netsnmp_factory_init(void);
00034
00035
00036
00037
00038 int netsnmp_factory_register(netsnmp_factory *f);
00039
00040
00041
00042
00043 netsnmp_factory* netsnmp_factory_get(const char* product);
00044
00045
00046
00047
00048 void * netsnmp_factory_produce(const char* product);
00049
00050
00051
00052
00053 int netsnmp_factory_produce_noalloc(const char *product, void *memory);
00054
00055
00056
00057
00058 enum {
00059 FACTORY_NOERROR = 0,
00060 FACTORY_EXISTS,
00061 FACTORY_NOTFOUND,
00062 FACTORY_NOMEMORY,
00063 FACTORY_GENERR,
00064 FACTORY_MAXIMUM_ERROR
00065 };
00066
00067 #ifdef __cplusplus
00068 }
00069 #endif
00070
00071
00072 #endif