1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/nullplug.c
Simon Tatham 884a7df94b Make Socket and Plug into structs.
I think that means that _every_ one of my traitoids is now a struct
containing a vtable pointer as one of its fields (albeit sometimes the
only field), and never just a bare pointer.
2018-10-06 07:28:51 +01:00

43 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"
static void nullplug_socket_log(Plug *plug, int type, SockAddr *addr, int port,
const char *error_msg, int error_code)
{
}
static void nullplug_closing(Plug *plug, const char *error_msg, int error_code,
int calling_back)
{
}
static void nullplug_receive(Plug *plug, int urgent, char *data, int len)
{
}
static void nullplug_sent(Plug *plug, int bufsize)
{
}
static const PlugVtable nullplug_plugvt = {
nullplug_socket_log,
nullplug_closing,
nullplug_receive,
nullplug_sent,
NULL
};
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;