mirror of
https://framagit.org/bortzmeyer/echoping
synced 2024-11-15 00:12:48 +00:00
35 lines
1.1 KiB
Plaintext
35 lines
1.1 KiB
Plaintext
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
|
|
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.
|
|
|
|
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.
|
|
|
|
TODO: documentation of the plugin. A man page echoping_PLUGINNAME?
|
|
|
|
$Id$
|