diff options
author | Martin Willi <martin@strongswan.org> | 2009-09-09 16:16:34 +0200 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2009-09-10 16:20:17 +0200 |
commit | f678f5c77efc2cbae3b449ce6b91ad587a1e50d3 (patch) | |
tree | 55171bfa87b16d9c57f6be59cc340e1fc4347fa1 /src/libstrongswan/credentials/builder.h | |
parent | 3ce9438b6010e6fd5f61531ae25473ea60a83cd9 (diff) | |
download | strongswan-f678f5c77efc2cbae3b449ce6b91ad587a1e50d3.tar.bz2 strongswan-f678f5c77efc2cbae3b449ce6b91ad587a1e50d3.tar.xz |
Replaced builder_t objects by simple builder_function_t functions
Diffstat (limited to 'src/libstrongswan/credentials/builder.h')
-rw-r--r-- | src/libstrongswan/credentials/builder.h | 55 |
1 files changed, 10 insertions, 45 deletions
diff --git a/src/libstrongswan/credentials/builder.h b/src/libstrongswan/credentials/builder.h index 6dbae98dc..b84fcfc6d 100644 --- a/src/libstrongswan/credentials/builder.h +++ b/src/libstrongswan/credentials/builder.h @@ -21,16 +21,21 @@ #ifndef BUILDER_H_ #define BUILDER_H_ -typedef struct builder_t builder_t; +#include <stdarg.h> + typedef enum builder_part_t builder_part_t; /** - * Constructor function which creates a new builder instance. + * Constructor function to build credentials. + * + * Any added parts are cloned/refcounted by the builder implementation, a + * caller may need to free the passed ressources themself. * - * @param subtype constructor specific subtype, e.g. certificate_type_t - * @return builder to construct a instance of type + * @param subtype constructor specific subtype, e.g. a certificate_type_t + * @param args list of builder part types, followed by parts, BUILD_END + * @return builder specific credential, NULL on error */ -typedef builder_t* (*builder_constructor_t)(int subtype); +typedef void* (*builder_function_t)(int subtype, va_list args); #include <library.h> @@ -119,44 +124,4 @@ enum builder_part_t { */ extern enum_name_t *builder_part_names; -/** - * Credential construction API. - * - * The builder allows the construction of credentials in a generic and - * flexible way. - */ -struct builder_t { - - /** - * Add a part to the construct. - * - * Any added parts are cloned/refcounted by the builder implementation, a - * caller may need to free the passed ressources themself. - * - * @param part kind of part - * @param ... part specific variable argument - */ - void (*add)(builder_t *this, builder_part_t part, ...); - - /** - * Build the construct with all supplied parts. - * - * Once build() is called, the builder gets destroyed. - * - * @return specific interface, as requested with constructor. - */ - void* (*build)(builder_t *this); -}; - -/** - * Helper macro to cancel a build in a builder - */ -#define builder_cancel(builder) { (builder)->add = (void*)nop; \ - (builder)->build = (void*)builder_free; } - -/** - * Helper function for a cancelled build. - */ -void* builder_free(builder_t *this); - #endif /** BUILDER_H_ @}*/ |