File: PLUGINS

package info (click to toggle)
echoping 6.0.2-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 9,296 kB
  • ctags: 515
  • sloc: sh: 8,951; ansic: 3,352; makefile: 170
file content (63 lines) | stat: -rw-r--r-- 2,354 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
addrinfo.

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
the plugin.]

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
  (see echoping.h).

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:

#define IN_PLUGIN
#include <echoping/echoping.h>

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 $