int checksum_count;
};
-/**
- * Implementation of integrity_checker_t.build_file
- */
-static u_int32_t build_file(private_integrity_checker_t *this, char *file,
- size_t *len)
+METHOD(integrity_checker_t, build_file, u_int32_t,
+ private_integrity_checker_t *this, char *file, size_t *len)
{
u_int32_t checksum;
chunk_t contents;
return 0;
}
-/**
- * Implementation of integrity_checker_t.build_segment
- */
-static u_int32_t build_segment(private_integrity_checker_t *this, void *sym,
- size_t *len)
+METHOD(integrity_checker_t, build_segment, u_int32_t,
+ private_integrity_checker_t *this, void *sym, size_t *len)
{
chunk_t segment;
Dl_info dli;
return NULL;
}
-/**
- * Implementation of integrity_checker_t.check_file
- */
-static bool check_file(private_integrity_checker_t *this,
- char *name, char *file)
+METHOD(integrity_checker_t, check_file, bool,
+ private_integrity_checker_t *this, char *name, char *file)
{
integrity_checksum_t *cs;
u_int32_t sum;
return TRUE;
}
-/**
- * Implementation of integrity_checker_t.check_segment
- */
-static bool check_segment(private_integrity_checker_t *this,
- char *name, void *sym)
+METHOD(integrity_checker_t, check_segment, bool,
+ private_integrity_checker_t *this, char *name, void *sym)
{
integrity_checksum_t *cs;
u_int32_t sum;
return TRUE;
}
-/**
- * Implementation of integrity_checker_t.check
- */
-static bool check(private_integrity_checker_t *this, char *name, void *sym)
+METHOD(integrity_checker_t, check, bool,
+ private_integrity_checker_t *this, char *name, void *sym)
{
Dl_info dli;
return TRUE;
}
-/**
- * Implementation of integrity_checker_t.destroy.
- */
-static void destroy(private_integrity_checker_t *this)
+METHOD(integrity_checker_t, destroy, void,
+ private_integrity_checker_t *this)
{
if (this->handle)
{
*/
integrity_checker_t *integrity_checker_create(char *checksum_library)
{
- private_integrity_checker_t *this = malloc_thing(private_integrity_checker_t);
-
- this->public.check_file = (bool(*)(integrity_checker_t*, char *name, char *file))check_file;
- this->public.build_file = (u_int32_t(*)(integrity_checker_t*, char *file, size_t *len))build_file;
- this->public.check_segment = (bool(*)(integrity_checker_t*, char *name, void *sym))check_segment;
- this->public.build_segment = (u_int32_t(*)(integrity_checker_t*, void *sym, size_t *len))build_segment;
- this->public.check = (bool(*)(integrity_checker_t*, char *name, void *sym))check;
- this->public.destroy = (void(*)(integrity_checker_t*))destroy;
+ private_integrity_checker_t *this;
+
+ INIT(this,
+ .public = {
+ .check_file = _check_file,
+ .build_file = _build_file,
+ .check_segment = _check_segment,
+ .build_segment = _build_segment,
+ .check = _check,
+ .destroy = _destroy,
+ },
+ );
- this->checksum_count = 0;
- this->handle = NULL;
if (checksum_library)
{
this->handle = dlopen(checksum_library, RTLD_LAZY);