X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/4ed34d251770cb8dd7f13217976d1dec9452b5e6..8eebd22198133e95ce25af1dd15dead0a5389371:/network.h diff --git a/network.h b/network.h index 28744a6f..8f1b2bed 100644 --- a/network.h +++ b/network.h @@ -27,6 +27,9 @@ struct socket_function_table { int (*write) (Socket s, char *data, int len); int (*write_oob) (Socket s, char *data, int len); void (*flush) (Socket s); + void (*set_private_ptr) (Socket s, void *ptr); + void *(*get_private_ptr) (Socket s); + void (*set_frozen) (Socket s, int is_frozen); /* ignored by tcp, but vital for ssl */ char *(*socket_error) (Socket s); }; @@ -60,15 +63,23 @@ struct plug_function_table { */ }; +/* proxy indirection layer */ +Socket new_connection(SockAddr addr, char *hostname, + int port, int privport, + int oobinline, int nodelay, Plug plug); +Socket new_listener(int port, Plug plug, int local_host_only); + +/* socket functions */ void sk_init(void); /* called once at program startup */ +void sk_cleanup(void); /* called just before program exit */ SockAddr sk_namelookup(char *host, char **canonicalname); void sk_getaddr(SockAddr addr, char *buf, int buflen); void sk_addr_free(SockAddr addr); Socket sk_new(SockAddr addr, int port, int privport, int oobinline, - Plug p); + int nodelay, Plug p); Socket sk_newlistener(int port, Plug plug, int local_host_only); @@ -94,8 +105,8 @@ Socket sk_register(void *sock, Plug plug); * This is perhaps unnecessary now that we have the notion of a plug, * but there is some existing code that uses it, so it stays. */ -void sk_set_private_ptr(Socket s, void *ptr); -void *sk_get_private_ptr(Socket s); +#define sk_set_private_ptr(s, ptr) (((*s)->set_private_ptr) (s, ptr)) +#define sk_get_private_ptr(s) (((*s)->get_private_ptr) (s)) /* * Special error values are returned from sk_namelookup and sk_new @@ -122,7 +133,7 @@ char *sk_addr_error(SockAddr addr); * associated local socket in order to avoid unbounded buffer * growth. */ -void sk_set_frozen(Socket sock, int is_frozen); +#define sk_set_frozen(s, is_frozen) (((*s)->set_frozen) (s, is_frozen)) /* * Call this after an operation that might have tried to send on a