2004-04-05 20:56:19 +00:00
|
|
|
If you want to write your own plugins, they will have to provide three
|
|
|
|
functions:
|
|
|
|
|
|
|
|
char * init (const int argc, const char **argv)
|
|
|
|
Accepts remaining arguments (you have to use popt to parse them, or
|
|
|
|
do it by hand, getopt does not allow you to resume the parsing) and
|
2004-05-25 13:44:54 +00:00
|
|
|
returns a string identifying the port name. If it makes no sense, you
|
2004-04-05 20:56:19 +00:00
|
|
|
can safely return NULL.
|
|
|
|
|
|
|
|
void start (struct addrinfo *res)
|
|
|
|
Typically just stores the res structure for later use.
|
|
|
|
|
2004-05-25 13:44:54 +00:00
|
|
|
TODO: two start() routines, one which takes a struct addrinfo and one
|
|
|
|
which does not (PostgreSQL or MySQL does not use struct addrinfo but a
|
|
|
|
string)?
|
|
|
|
|
2004-04-06 20:30:06 +00:00
|
|
|
int execute ()
|
|
|
|
Connects and do whatever the protocol requires. It is called once
|
|
|
|
per iteration. It returns >=0 if it succeeds and -1 if it failed.
|
|
|
|
|
|
|
|
void terminate ()
|
|
|
|
Cleans everything. It is called after all iterations.
|
2004-04-05 20:56:19 +00:00
|
|
|
|
|
|
|
Start your plugin source code with:
|
|
|
|
|
|
|
|
#define IN_PLUGIN
|
|
|
|
#include "../echoping.h"
|
|
|
|
|
|
|
|
You can look at random.c, the simplest plugin, and whois.c, the
|
|
|
|
simplest which still does something useful.
|
|
|
|
|
2004-04-06 08:16:15 +00:00
|
|
|
TODO: documentation of the plugin. A man page echoping_PLUGINNAME?
|
|
|
|
|
2004-04-05 20:56:19 +00:00
|
|
|
$Id$
|