etherealのプラグインのREADME.plugins
- packet-xxx.c を作る
- packet-xxx.c に #include "moduleinfo.h"
の中の G_MODULE_EXPORT が定義としている
#define G_MODULE_IMPORT extern
#ifdef G_PLATFORM_WIN32
# define G_MODULE_EXPORT __declspec(dllexport)
#else /* !G_PLATFORM_WIN32 */
# define G_MODULE_EXPORT
#endif /* !G_PLATFORM_WIN32 */
- packet-xxx.c にversion定義
#ifndef ENABLE_STATIC
G_MODULE_EXPORT const gchar version[] = VERSION;
#endif
- packet-xxx.c に EXPORT関数をさらに追加
#ifndef ENABLE_STATIC
G_MODULE_EXPORT void
plugin_register(void)
#endif
これは初期化時に呼ぶ
/* register the new protocol, protocol fields, and subtrees */
if (proto_xxx == -1) { /* execute protocol initialization only once */
proto_register_xxx();
}
こんな感じで一度だけ呼ばれるようにする
- packet-xxx.c に EXPORT関数をさらに追加
#ifndef ENABLE_STATIC
G_MODULE_EXPORT void
plugin_reg_handoff(void)
#endif
デストラクタ
proto_reg_handoff_xxx();
を呼んで始末しよう
- ディレクトリ構造はこんな感じ
moduleinfo.h
packet-xxx.c
- plugins/xxx/moduleinfo.h はこんな感じ
/* Included *after* config.h, in order to re-define these macros */
#ifdef PACKAGE
#undef PACKAGE
#endif/* Name of package */
#define PACKAGE "xxx"
#ifdef VERSION
#undef VERSION
#endif/* Version number of package */
#define VERSION "0.0.8"