1 #ifndef NETSNMP_FACTORY_H
2 #define NETSNMP_FACTORY_H
9 typedef void * (netsnmp_factory_produce_f)(void);
10 typedef int (netsnmp_factory_produce_noalloc_f)(void *);
12 typedef struct netsnmp_factory_s {
14 * a string describing the product the factory creates
19 * a function to create an object in newly allcoated memory
21 netsnmp_factory_produce_f *produce;
24 * a function to create an object in previously allcoated memory
26 netsnmp_factory_produce_noalloc_f *produce_noalloc;
31 * init factory registry
33 void netsnmp_factory_init(void);
36 * register a factory type
38 int netsnmp_factory_register(netsnmp_factory *f);
43 netsnmp_factory* netsnmp_factory_get(const char* product);
46 * ask a factory to produce an object
48 void * netsnmp_factory_produce(const char* product);
51 * ask a factory to produce an object in the provided memory
53 int netsnmp_factory_produce_noalloc(const char *product, void *memory);
56 * factory return codes
72 #endif /* NETSNMP_FACTORY_H */