Exemple #1
0
/**
 * @brief	Initialize the bzip library and bind dynamically to the exported functions that are required.
 * @result	true on success or false on failure.
 */
bool_t lib_load_bzip(void) {

	int len;
	char *ver;
	symbol_t bzip[] = {
		M_BIND(BZ2_bzBuffToBuffCompress), M_BIND(BZ2_bzBuffToBuffDecompress), M_BIND(BZ2_bzlibVersion)
	};

	if (lib_symbols(sizeof(bzip) / sizeof(symbol_t), bzip) != 1) {
		return false;
	}

	// Expecting a version string similar to 1.0.5, 10-Dec-2007.
	if (!(ver = (char *)BZ2_bzlibVersion_d()) || !(len = ns_length_int(ver))) {
		log_pedantic("Invalid BZIP version string.");
		return false;
	}

	for (size_t i = 0; i < len; i++) {
		if (*(ver + i) != '.' && !(*(ver + i) >= '0' && *(ver + i) <= '9')) {
			len = i;
		}
	}

	if (!snprintf(bzip_version, 16, "%.*s", len, ver)) {
		log_pedantic("Invalid BZIP version string.");
		return false;
	}

	return true;
}
Exemple #2
0
/**
 * @brief	Initialize the jpeg library and bind dynamically to the exported functions that are required.
 * @return	true on success or false on failure.
 */
bool_t lib_load_jpeg(void) {

	symbol_t jpeg[] = {
		M_BIND(jpeg_version)
	};

	if (lib_symbols(sizeof(jpeg) / sizeof(symbol_t), jpeg) != 1) {
		return false;
	}

	return true;
}
Exemple #3
0
/**
 * @brief	Initialize the png library and bind dynamically to the exported functions that are required.
 * @return	true on success or false on failure.
 */
bool_t lib_load_png(void) {

	symbol_t png[] = {
		M_BIND(png_access_version_number)
	};

	if (lib_symbols(sizeof(png) / sizeof(symbol_t), png) != 1) {
		return false;
	}

	return true;
}
Exemple #4
0
/**
 * @brief	Initialize the gd library and bind dynamically to the exported functions that are required.
 * @return	true on success or false on failure.
 */
bool_t lib_load_gd(void) {

	symbol_t gd[] = {
		M_BIND(gdFree), M_BIND(gdImageColorResolve), M_BIND(gdImageCreate),	M_BIND(gdImageDestroy), M_BIND(gdImageGifPtr),
		M_BIND(gdImageJpegPtr),	M_BIND(gdImageSetPixel), M_BIND(gdImageStringFT), M_BIND(gdVersionString)
	};

	if (lib_symbols(sizeof(gd) / sizeof(symbol_t), gd) != 1) {
		return false;
	}

	return true;
}
Exemple #5
0
/**
 * @brief	Initialize the dspam library and bind dynamically to the exported functions that are required.
 * @return	true on success or false on failure.
 */
bool_t lib_load_dspam(void) {

	symbol_t dspam[] = {
		M_BIND(dspam_attach), M_BIND(dspam_create), M_BIND(dspam_destroy), M_BIND(dspam_detach), M_BIND(dspam_init_driver),
		M_BIND(dspam_process), M_BIND(dspam_shutdown_driver), M_BIND(dspam_version)
	};

	if (lib_symbols(sizeof(dspam) / sizeof(symbol_t), dspam) != 1) {
		return false;
	}

	return true;
}
Exemple #6
0
/**
 * @brief	Initialize the Tokyo Cabinet library and bind dynamically to the exported functions that are required.
 * @result	true on success or false on failure.
 */
bool_t lib_load_tokyo(void) {

	symbol_t tokyo[] = {
			M_BIND(tcndbdel), M_BIND(tcndbnew2), M_BIND(tcndbfwmkeys), M_BIND(tcndbget), M_BIND(tclistdel),	M_BIND(tclistnum),
			M_BIND(tclistval), M_BIND(tcndbputkeep), M_BIND(tcndbout), M_BIND(tcndbrnum), M_BIND(tctreekeys), M_BIND(tctreevals),
			M_BIND(tcndbgetboth), M_BIND(tchdbnew), M_BIND(tchdbdel), M_BIND(tchdbecode), M_BIND(tchdbsync), M_BIND(tchdbclose),
			M_BIND(tchdberrmsg), M_BIND(tchdbtune), M_BIND(tchdbputasync), M_BIND(tchdbopen), M_BIND(tchdbsetmutex), M_BIND(tchdbout),
			M_BIND(tchdbpath), M_BIND(tchdbget), M_BIND(tcfree), M_BIND(tchdbrnum),	M_BIND(tchdbfsiz), M_BIND(tchdbsetdfunit),
			M_BIND(tchdbdefrag), M_BIND(tchdboptimize),	M_BIND(tcndbget3), M_BIND(tcndbiternext2), M_BIND(tcndbiterinit), M_BIND(tcndbdup),
			M_BIND(tcversion)
	};

	if (!lib_symbols(sizeof(tokyo) / sizeof(symbol_t), tokyo)) {
		return false;
	}

	return true;
}