If you want to write your own plugins, you will first have to decide
wether your plugin uses a "cooked" hostname or a "raw" one.
In the first case, the cooked hostname, your plugin will receive from
echoping a struct addrinfo. All the DNS stuff, including IDN, is
performed by echoping. You can immediately start using the struct
But some libraries (typically, the one used by the DBMSs) do not work
on struct addrinfo but on strings such as "dbname=test
hostname=foo.bar". Plugins using these libraries will have to use the
raw interface. The host name given as argument is ignored.
[Do note there is *no* interface where the TCP connection and shutdown
are done by echoping. (See bug #1694510) They are always performed by
You indicate to echoping wether you use the raw interface or the
cooked one by returning a port name or NULL from the init() function.
You will have to provide three functions:
char * init (const int argc, const char **argv, const echoping_options options))
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 (cooked interface) or NULL
(raw interface). The options struct will give you the global options
For the cooked interface:
void start (struct addrinfo *res)
Typically just stores the res structure for later use.
For the raw interface:
void start_raw ()
Typically connects to the server.
int execute ()
Connects and do whatever the protocol requires. It is called once
per iteration. It returns >=0 if it succeeds, -1 if it failed
temporarily (so echoping will continue its loop) and -2 if it failed
permanently (so echoping will stop the iteration).
void terminate ()
Cleans everything. It is called after all iterations.
Start your plugin source code with:
You can look at random.c, the simplest plugin, and whois.c, the
simplest which still does something useful.
The documentation of the plugin should be in a manual page named
echoping_PLUGINNAME. See the above plugins for examples.
You can write a shell script named test.sh in the plugin directory to
test the plugin. test-echoping-plugins will execute it.
$Id: PLUGINS 396 2007-04-04 19:40:54Z bortz $