File: null-plug.c

package info (click to toggle)
putty 0.83-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,216 kB
  • sloc: ansic: 148,476; python: 8,466; perl: 1,830; makefile: 128; sh: 117
file content (40 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download
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
/*
 * 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;