From a05805425355615c105bfb322fa94358d3ae2cc3 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 13 Sep 2020 08:39:17 +0100 Subject: [PATCH] Introduce noproxy.c. For use in spinoff programs: this is an alternative to proxy.c, which provides the same API (to avoid link failures in modules like x11fwd.c) but implements it in the trivial way, supporting no proxying at all and just wrapping the underlying sk_new() and friends. --- noproxy.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 noproxy.c diff --git a/noproxy.c b/noproxy.c new file mode 100644 index 00000000..1d372932 --- /dev/null +++ b/noproxy.c @@ -0,0 +1,32 @@ +/* + * noproxy.c: an alternative to proxy.c, for use by auxiliary programs + * that need to make network connections but don't want to include all + * the full-on support for endless network proxies (and its + * configuration requirements). Implements the primary APIs of + * proxy.c, but maps them straight to the underlying network layer. + */ + +#include "putty.h" +#include "network.h" +#include "proxy.h" + +SockAddr *name_lookup(const char *host, int port, char **canonicalname, + Conf *conf, int addressfamily, LogContext *logctx, + const char *reason) +{ + return sk_namelookup(host, canonicalname, addressfamily); +} + +Socket *new_connection(SockAddr *addr, const char *hostname, + int port, bool privport, + bool oobinline, bool nodelay, bool keepalive, + Plug *plug, Conf *conf) +{ + return sk_new(addr, port, privport, oobinline, nodelay, keepalive, plug); +} + +Socket *new_listener(const char *srcaddr, int port, Plug *plug, + bool local_host_only, Conf *conf, int addressfamily) +{ + return sk_newlistener(srcaddr, port, plug, local_host_only, addressfamily); +}