1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/stubs/null-plug.c
Simon Tatham c1d9da67a2 Pass the calling Socket to plug_log.
This enables plug_log to run query methods on the socket in order to
find out useful information to log. I don't expect it's sensible to do
anything else with it.
2024-06-29 12:00:12 +01:00

41 lines
1.0 KiB
C

/*
* nullplug.c: provide a null implementation of the Plug vtable which
* ignores all calls. Occasionally useful in cases where we want to
* make a network connection just to see if it works, but not do
* anything with it afterwards except close it again.
*/
#include "putty.h"
void nullplug_log(Plug *plug, Socket *s, PlugLogType type, SockAddr *addr,
int port, const char *err_msg, int err_code)
{
}
void nullplug_closing(Plug *plug, PlugCloseType type, const char *error_msg)
{
}
void nullplug_receive(Plug *plug, int urgent, const char *data, size_t len)
{
}
void nullplug_sent(Plug *plug, size_t bufsize)
{
}
static const PlugVtable nullplug_plugvt = {
.log = nullplug_log,
.closing = nullplug_closing,
.receive = nullplug_receive,
.sent = nullplug_sent,
};
static Plug nullplug_plug = { &nullplug_plugvt };
/*
* There's a singleton instance of nullplug, because it's not
* interesting enough to worry about making more than one of them.
*/
Plug *const nullplug = &nullplug_plug;