echoping/SRC/PLUGINS

35 lines
1.1 KiB
Plaintext
Raw Normal View History

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
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)?
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.
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?
$Id$