2 * nullplug.c: provide a null implementation of the Plug vtable which
3 * ignores all calls. Occasionally useful in cases where we want to
4 * make a network connection just to see if it works, but not do
5 * anything with it afterwards except close it again.
10 void nullplug_log(Plug
*plug
, PlugLogType type
, SockAddr
*addr
,
11 int port
, const char *err_msg
, int err_code
)
15 void nullplug_closing(Plug
*plug
, PlugCloseType type
, const char *error_msg
)
19 void nullplug_receive(Plug
*plug
, int urgent
, const char *data
, size_t len
)
23 void nullplug_sent(Plug
*plug
, size_t bufsize
)
27 static const PlugVtable nullplug_plugvt
= {
29 .closing
= nullplug_closing
,
30 .receive
= nullplug_receive
,
31 .sent
= nullplug_sent
,
34 static Plug nullplug_plug
= { &nullplug_plugvt
};
37 * There's a singleton instance of nullplug, because it's not
38 * interesting enough to worry about making more than one of them.
40 Plug
*const nullplug
= &nullplug_plug
;