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 6a1b713e13 Reorganise the stubs collection.
I made a specific subdirectory 'stubs' to keep all the link-time stub
modules in, like notiming.c. And I put _one_ run-time stub in it,
namely nullplug.c. But the rest of the runtime stubs went into utils.

I think it's better to keep all the stubs together, so I've moved all
the null*.c in utils into stubs (with the exception of nullstrcmp.c,
which means the 'null' in a different sense). Also, fiddled with the
naming to be a bit more consistent, and stated in the new CMakeLists
the naming policy that distinguishes no-*.c from null-*.c.
2022-09-01 20:43:23 +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, 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;