浏览代码

PuTTY snapshot 96ec2c25 (Get rid of lots of implicit pointer types - 2018-10-04)

Source commit: 1ddd4092bf9c08204a7499c91cdabb6779765333
Martin Prikryl 6 年之前
父节点
当前提交
9e61ce0071

+ 13 - 13
source/putty/WINDOWS/winhsock.c

@@ -41,7 +41,7 @@ typedef struct HandleSocket {
 
     char *error;
 
-    Plug plug;
+    Plug *plug;
 
     const Socket_vtable *sockvt;
 } HandleSocket;
@@ -105,16 +105,16 @@ static void handle_sentdata(struct handle *h, int new_backlog)
     plug_sent(hs->plug, new_backlog);
 }
 
-static Plug sk_handle_plug(Socket s, Plug p)
+static Plug *sk_handle_plug(Socket *s, Plug *p)
 {
     HandleSocket *hs = FROMFIELD(s, HandleSocket, sockvt);
-    Plug ret = hs->plug;
+    Plug *ret = hs->plug;
     if (p)
 	hs->plug = p;
     return ret;
 }
 
-static void sk_handle_close(Socket s)
+static void sk_handle_close(Socket *s)
 {
     HandleSocket *hs = FROMFIELD(s, HandleSocket, sockvt);
 
@@ -134,14 +134,14 @@ static void sk_handle_close(Socket s)
     sfree(hs);
 }
 
-static int sk_handle_write(Socket s, const void *data, int len)
+static int sk_handle_write(Socket *s, const void *data, int len)
 {
     HandleSocket *hs = FROMFIELD(s, HandleSocket, sockvt);
 
     return handle_write(hs->send_h, data, len);
 }
 
-static int sk_handle_write_oob(Socket s, const void *data, int len)
+static int sk_handle_write_oob(Socket *s, const void *data, int len)
 {
     /*
      * oob data is treated as inband; nasty, but nothing really
@@ -150,14 +150,14 @@ static int sk_handle_write_oob(Socket s, const void *data, int len)
     return sk_handle_write(s, data, len);
 }
 
-static void sk_handle_write_eof(Socket s)
+static void sk_handle_write_eof(Socket *s)
 {
     HandleSocket *hs = FROMFIELD(s, HandleSocket, sockvt);
 
     handle_write_eof(hs->send_h);
 }
 
-static void sk_handle_flush(Socket s)
+static void sk_handle_flush(Socket *s)
 {
     /* HandleSocket *hs = FROMFIELD(s, HandleSocket, sockvt); */
     /* do nothing */
@@ -210,7 +210,7 @@ static void handle_socket_unfreeze(void *hsv)
     }
 }
 
-static void sk_handle_set_frozen(Socket s, int is_frozen)
+static void sk_handle_set_frozen(Socket *s, int is_frozen)
 {
     HandleSocket *hs = FROMFIELD(s, HandleSocket, sockvt);
 
@@ -265,13 +265,13 @@ static void sk_handle_set_frozen(Socket s, int is_frozen)
     }
 }
 
-static const char *sk_handle_socket_error(Socket s)
+static const char *sk_handle_socket_error(Socket *s)
 {
     HandleSocket *hs = FROMFIELD(s, HandleSocket, sockvt);
     return hs->error;
 }
 
-static char *sk_handle_peer_info(Socket s)
+static char *sk_handle_peer_info(Socket *s)
 {
     HandleSocket *hs = FROMFIELD(s, HandleSocket, sockvt);
     ULONG pid;
@@ -318,8 +318,8 @@ static const Socket_vtable HandleSocket_sockvt = {
     sk_handle_peer_info,
 };
 
-Socket make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H,
-                          Plug plug, int overlapped)
+Socket *make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H,
+                           Plug *plug, int overlapped)
 {
     HandleSocket *hs;
     int flags = (overlapped ? HANDLE_FLAG_OVERLAPPED : 0);

+ 2 - 2
source/putty/be_misc.c

@@ -9,7 +9,7 @@
 #include "putty.h"
 #include "network.h"
 
-void backend_socket_log(Frontend *frontend, int type, SockAddr addr, int port,
+void backend_socket_log(Frontend *frontend, int type, SockAddr *addr, int port,
                         const char *error_msg, int error_code, Conf *conf,
                         int session_started)
 {
@@ -59,7 +59,7 @@ void backend_socket_log(Frontend *frontend, int type, SockAddr addr, int port,
     }
 }
 
-void log_proxy_stderr(Plug plug, bufchain *buf, const void *vdata, int len)
+void log_proxy_stderr(Plug *plug, bufchain *buf, const void *vdata, int len)
 {
     const char *data = (const char *)vdata;
     int pos = 0;

+ 4 - 10
source/putty/defs.h

@@ -40,7 +40,7 @@ typedef struct BinarySource BinarySource;
 
 typedef struct IdempotentCallback IdempotentCallback;
 
-typedef struct SockAddr_tag *SockAddr;
+typedef struct SockAddr SockAddr;
 
 typedef struct Socket_vtable Socket_vtable;
 typedef struct Plug_vtable Plug_vtable;
@@ -53,7 +53,7 @@ typedef struct LogContext_tag LogContext;
 
 typedef struct Frontend Frontend;
 
-typedef struct ssh_tag *Ssh;
+typedef struct Ssh Ssh;
 
 typedef struct Channel Channel;
 typedef struct SshChannel SshChannel;
@@ -74,14 +74,8 @@ typedef struct settings_e settings_e;
 
 typedef struct SessionSpecial SessionSpecial;
 
-/* Note indirection: for historical reasons (it used to be closer to
- * the OS socket type), the type that most code uses for a socket is
- * 'Socket', not 'Socket *'. So an implementation of Socket or Plug
- * has a 'const Socket *' field for the vtable pointer, and the
- * 'Socket' type returned to client code is a pointer to _that_ in
- * turn. */
-typedef const Socket_vtable **Socket;
-typedef const Plug_vtable **Plug;
+typedef const Socket_vtable *Socket;
+typedef const Plug_vtable *Plug;
 
 /*
  * A small structure wrapping up a (pointer, length) pair so that it

+ 7 - 7
source/putty/errsock.c

@@ -12,21 +12,21 @@
 
 typedef struct {
     char *error;
-    Plug plug;
+    Plug *plug;
 
     const Socket_vtable *sockvt;
 } ErrorSocket;
 
-static Plug sk_error_plug(Socket s, Plug p)
+static Plug *sk_error_plug(Socket *s, Plug *p)
 {
     ErrorSocket *es = FROMFIELD(s, ErrorSocket, sockvt);
-    Plug ret = es->plug;
+    Plug *ret = es->plug;
     if (p)
 	es->plug = p;
     return ret;
 }
 
-static void sk_error_close(Socket s)
+static void sk_error_close(Socket *s)
 {
     ErrorSocket *es = FROMFIELD(s, ErrorSocket, sockvt);
 
@@ -34,13 +34,13 @@ static void sk_error_close(Socket s)
     sfree(es);
 }
 
-static const char *sk_error_socket_error(Socket s)
+static const char *sk_error_socket_error(Socket *s)
 {
     ErrorSocket *es = FROMFIELD(s, ErrorSocket, sockvt);
     return es->error;
 }
 
-static char *sk_error_peer_info(Socket s)
+static char *sk_error_peer_info(Socket *s)
 {
     return NULL;
 }
@@ -57,7 +57,7 @@ static const Socket_vtable ErrorSocket_sockvt = {
     sk_error_peer_info,
 };
 
-Socket new_error_socket(const char *errmsg, Plug plug)
+Socket *new_error_socket(const char *errmsg, Plug *plug)
 {
     ErrorSocket *es = snew(ErrorSocket);
     es->sockvt = &ErrorSocket_sockvt;

+ 49 - 49
source/putty/network.h

@@ -16,26 +16,26 @@
 #include "defs.h"
 
 struct Socket_vtable {
-    Plug(*plug) (Socket s, Plug p);
+    Plug *(*plug) (Socket *s, Plug *p);
     /* use a different plug (return the old one) */
     /* if p is NULL, it doesn't change the plug */
     /* but it does return the one it's using */
-    void (*close) (Socket s);
-    int (*write) (Socket s, const void *data, int len);
-    int (*write_oob) (Socket s, const void *data, int len);
-    void (*write_eof) (Socket s);
-    void (*flush) (Socket s);
-    void (*set_frozen) (Socket s, int is_frozen);
+    void (*close) (Socket *s);
+    int (*write) (Socket *s, const void *data, int len);
+    int (*write_oob) (Socket *s, const void *data, int len);
+    void (*write_eof) (Socket *s);
+    void (*flush) (Socket *s);
+    void (*set_frozen) (Socket *s, int is_frozen);
     /* ignored by tcp, but vital for ssl */
-    const char *(*socket_error) (Socket s);
-    char *(*peer_info) (Socket s);
+    const char *(*socket_error) (Socket *s);
+    char *(*peer_info) (Socket *s);
 };
 
 typedef union { void *p; int i; } accept_ctx_t;
-typedef Socket (*accept_fn_t)(accept_ctx_t ctx, Plug plug);
+typedef Socket *(*accept_fn_t)(accept_ctx_t ctx, Plug *plug);
 
 struct Plug_vtable {
-    void (*log)(Plug p, int type, SockAddr addr, int port,
+    void (*log)(Plug *p, int type, SockAddr *addr, int port,
 		const char *error_msg, int error_code);
     /*
      * Passes the client progress reports on the process of setting
@@ -55,11 +55,11 @@ struct Plug_vtable {
      *    indicate this.
      */
     void (*closing)
-     (Plug p, const char *error_msg, int error_code, int calling_back);
+     (Plug *p, const char *error_msg, int error_code, int calling_back);
     /* error_msg is NULL iff it is not an error (ie it closed normally) */
     /* calling_back != 0 iff there is a Plug function */
     /* currently running (would cure the fixme in try_send()) */
-    void (*receive) (Plug p, int urgent, char *data, int len);
+    void (*receive) (Plug *p, int urgent, char *data, int len);
     /*
      *  - urgent==0. `data' points to `len' bytes of perfectly
      *    ordinary data.
@@ -70,13 +70,13 @@ struct Plug_vtable {
      *  - urgent==2. `data' points to `len' bytes of data,
      *    the first of which was the one at the Urgent mark.
      */
-    void (*sent) (Plug p, int bufsize);
+    void (*sent) (Plug *p, int bufsize);
     /*
      * The `sent' function is called when the pending send backlog
      * on a socket is cleared or partially cleared. The new backlog
      * size is passed in the `bufsize' parameter.
      */
-    int (*accepting)(Plug p, accept_fn_t constructor, accept_ctx_t ctx);
+    int (*accepting)(Plug *p, accept_fn_t constructor, accept_ctx_t ctx);
     /*
      * `accepting' is called only on listener-type sockets, and is
      * passed a constructor function+context that will create a fresh
@@ -88,55 +88,55 @@ struct Plug_vtable {
 /* proxy indirection layer */
 /* NB, control of 'addr' is passed via new_connection, which takes
  * responsibility for freeing it */
-Socket new_connection(SockAddr addr, const char *hostname,
-		      int port, int privport,
-		      int oobinline, int nodelay, int keepalive,
-		      Plug plug, Conf *conf);
-Socket new_listener(const char *srcaddr, int port, Plug plug,
-                    int local_host_only, Conf *conf, int addressfamily);
-SockAddr name_lookup(const char *host, int port, char **canonicalname,
-                     Conf *conf, int addressfamily,
-                     Frontend *frontend_for_logging,
-                     const char *lookup_reason_for_logging);
-int proxy_for_destination (SockAddr addr, const char *hostname, int port,
+Socket *new_connection(SockAddr *addr, const char *hostname,
+                       int port, int privport,
+                       int oobinline, int nodelay, int keepalive,
+                       Plug *plug, Conf *conf);
+Socket *new_listener(const char *srcaddr, int port, Plug *plug,
+                     int local_host_only, Conf *conf, int addressfamily);
+SockAddr *name_lookup(const char *host, int port, char **canonicalname,
+                      Conf *conf, int addressfamily,
+                      Frontend *frontend_for_logging,
+                      const char *lookup_reason_for_logging);
+int proxy_for_destination (SockAddr *addr, const char *hostname, int port,
                            Conf *conf);
 
 /* platform-dependent callback from new_connection() */
 /* (same caveat about addr as new_connection()) */
-Socket platform_new_connection(SockAddr addr, const char *hostname,
-			       int port, int privport,
-			       int oobinline, int nodelay, int keepalive,
-			       Plug plug, Conf *conf);
+Socket *platform_new_connection(SockAddr *addr, const char *hostname,
+                                int port, int privport,
+                                int oobinline, int nodelay, int keepalive,
+                                Plug *plug, Conf *conf);
 
 /* socket functions */
 
 void sk_init(void);		       /* called once at program startup */
 void sk_cleanup(void);		       /* called just before program exit */
 
-SockAddr sk_namelookup(const char *host, char **canonicalname, int address_family);
-SockAddr sk_nonamelookup(const char *host);
-void sk_getaddr(SockAddr addr, char *buf, int buflen);
-int sk_addr_needs_port(SockAddr addr);
+SockAddr *sk_namelookup(const char *host, char **canonicalname, int address_family);
+SockAddr *sk_nonamelookup(const char *host);
+void sk_getaddr(SockAddr *addr, char *buf, int buflen);
+int sk_addr_needs_port(SockAddr *addr);
 int sk_hostname_is_local(const char *name);
-int sk_address_is_local(SockAddr addr);
-int sk_address_is_special_local(SockAddr addr);
-int sk_addrtype(SockAddr addr);
-void sk_addrcopy(SockAddr addr, char *buf);
-void sk_addr_free(SockAddr addr);
+int sk_address_is_local(SockAddr *addr);
+int sk_address_is_special_local(SockAddr *addr);
+int sk_addrtype(SockAddr *addr);
+void sk_addrcopy(SockAddr *addr, char *buf);
+void sk_addr_free(SockAddr *addr);
 /* sk_addr_dup generates another SockAddr which contains the same data
  * as the original one and can be freed independently. May not actually
  * physically _duplicate_ it: incrementing a reference count so that
  * one more free is required before it disappears is an acceptable
  * implementation. */
-SockAddr sk_addr_dup(SockAddr addr);
+SockAddr *sk_addr_dup(SockAddr *addr);
 
 /* NB, control of 'addr' is passed via sk_new, which takes responsibility
  * for freeing it, as for new_connection() */
-Socket sk_new(SockAddr addr, int port, int privport, int oobinline,
-	      int nodelay, int keepalive, Plug p);
+Socket *sk_new(SockAddr *addr, int port, int privport, int oobinline,
+               int nodelay, int keepalive, Plug *p);
 
-Socket sk_newlistener(const char *srcaddr, int port, Plug plug,
-                      int local_host_only, int address_family);
+Socket *sk_newlistener(const char *srcaddr, int port, Plug *plug,
+                       int local_host_only, int address_family);
 
 #define sk_plug(s,p) (((*s)->plug) (s, p))
 #define sk_close(s) (((*s)->close) (s))
@@ -158,7 +158,7 @@ Socket sk_newlistener(const char *srcaddr, int port, Plug plug,
  * if there's a problem. These functions extract an error message,
  * or return NULL if there's no problem.
  */
-const char *sk_addr_error(SockAddr addr);
+const char *sk_addr_error(SockAddr *addr);
 #define sk_socket_error(s) (((*s)->socket_error) (s))
 
 /*
@@ -206,12 +206,12 @@ char *get_hostname(void);
  * Trivial socket implementation which just stores an error. Found in
  * errsock.c.
  */
-Socket new_error_socket(const char *errmsg, Plug plug);
+Socket *new_error_socket(const char *errmsg, Plug *plug);
 
 /*
  * Trivial plug that does absolutely nothing. Found in nullplug.c.
  */
-extern Plug nullplug;
+extern Plug *nullplug;
 
 /* ----------------------------------------------------------------------
  * Functions defined outside the network code, which have to be
@@ -222,9 +222,9 @@ extern Plug nullplug;
 /*
  * Exports from be_misc.c.
  */
-void backend_socket_log(Frontend *frontend, int type, SockAddr addr, int port,
+void backend_socket_log(Frontend *frontend, int type, SockAddr *addr, int port,
                         const char *error_msg, int error_code, Conf *conf,
                         int session_started);
-void log_proxy_stderr(Plug plug, bufchain *buf, const void *vdata, int len);
+void log_proxy_stderr(Plug *plug, bufchain *buf, const void *vdata, int len);
 
 #endif

+ 1 - 1
source/putty/noshare.c

@@ -13,7 +13,7 @@
 #include "network.h"
 
 int platform_ssh_share(const char *name, Conf *conf,
-                       Plug downplug, Plug upplug, Socket *sock,
+                       Plug *downplug, Plug *upplug, Socket **sock,
                        char **logtext, char **ds_err, char **us_err,
                        int can_upstream, int can_downstream)
 {

+ 5 - 5
source/putty/nullplug.c

@@ -7,21 +7,21 @@
 
 #include "putty.h"
 
-static void nullplug_socket_log(Plug plug, int type, SockAddr addr, int port,
+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,
+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_receive(Plug *plug, int urgent, char *data, int len)
 {
 }
 
-static void nullplug_sent(Plug plug, int bufsize)
+static void nullplug_sent(Plug *plug, int bufsize)
 {
 }
 
@@ -39,4 +39,4 @@ static const Plug_vtable *nullplug_plugvt_ptr = &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 nullplug = &nullplug_plugvt_ptr;
+Plug *nullplug = &nullplug_plugvt_ptr;

+ 2 - 2
source/putty/pageant.h

@@ -84,8 +84,8 @@ void keylist_update(void);
  * to.
  */
 struct pageant_listen_state;
-struct pageant_listen_state *pageant_listener_new(Plug *plug);
-void pageant_listener_got_socket(struct pageant_listen_state *pl, Socket sock);
+struct pageant_listen_state *pageant_listener_new(Plug **plug);
+void pageant_listener_got_socket(struct pageant_listen_state *pl, Socket *);
 void pageant_listener_set_logfn(struct pageant_listen_state *pl,
                                 void *logctx, pageant_logfn_t logfn);
 void pageant_listener_free(struct pageant_listen_state *pl);

+ 12 - 12
source/putty/portfwd.c

@@ -38,7 +38,7 @@ typedef struct PortForwarding {
     SshChannel *c;         /* channel structure held by SSH connection layer */
     ConnectionLayer *cl;   /* the connection layer itself */
     /* Note that ssh need not be filled in if c is non-NULL */
-    Socket s;
+    Socket *s;
     int input_wanted;
     int ready;
     SocksState socks_state;
@@ -62,7 +62,7 @@ typedef struct PortForwarding {
 
 struct PortListener {
     ConnectionLayer *cl;
-    Socket s;
+    Socket *s;
     int is_dynamic;
     /*
      * `hostname' and `port' are the real hostname and port, for
@@ -107,13 +107,13 @@ static void free_portlistener_state(struct PortListener *pl)
     sfree(pl);
 }
 
-static void pfd_log(Plug plug, int type, SockAddr addr, int port,
+static void pfd_log(Plug *plug, int type, SockAddr *addr, int port,
 		    const char *error_msg, int error_code)
 {
     /* we have to dump these since we have no interface to logging.c */
 }
 
-static void pfl_log(Plug plug, int type, SockAddr addr, int port,
+static void pfl_log(Plug *plug, int type, SockAddr *addr, int port,
 		    const char *error_msg, int error_code)
 {
     /* we have to dump these since we have no interface to logging.c */
@@ -121,7 +121,7 @@ static void pfl_log(Plug plug, int type, SockAddr addr, int port,
 
 static void pfd_close(struct PortForwarding *pf);
 
-static void pfd_closing(Plug plug, const char *error_msg, int error_code,
+static void pfd_closing(Plug *plug, const char *error_msg, int error_code,
 			int calling_back)
 {
     struct PortForwarding *pf = FROMFIELD(plug, struct PortForwarding, plugvt);
@@ -153,7 +153,7 @@ static void pfd_closing(Plug plug, const char *error_msg, int error_code,
 
 static void pfl_terminate(struct PortListener *pl);
 
-static void pfl_closing(Plug plug, const char *error_msg, int error_code,
+static void pfl_closing(Plug *plug, const char *error_msg, int error_code,
 			int calling_back)
 {
     struct PortListener *pl = (struct PortListener *) plug;
@@ -162,7 +162,7 @@ static void pfl_closing(Plug plug, const char *error_msg, int error_code,
 
 static SshChannel *wrap_lportfwd_open(
     ConnectionLayer *cl, const char *hostname, int port,
-    Socket s, Channel *chan)
+    Socket *s, Channel *chan)
 {
     char *peerinfo, *description;
     SshChannel *toret;
@@ -203,7 +203,7 @@ static char *ipv6_to_string(ptrlen ipv6)
                      (unsigned)GET_16BIT_MSB_FIRST(addr + 14));
 }
 
-static void pfd_receive(Plug plug, int urgent, char *data, int len)
+static void pfd_receive(Plug *plug, int urgent, char *data, int len)
 {
     struct PortForwarding *pf = FROMFIELD(plug, struct PortForwarding, plugvt);
 
@@ -427,7 +427,7 @@ static void pfd_receive(Plug plug, int urgent, char *data, int len)
         sshfwd_write(pf->c, data, len);
 }
 
-static void pfd_sent(Plug plug, int bufsize)
+static void pfd_sent(Plug *plug, int bufsize)
 {
     struct PortForwarding *pf = FROMFIELD(plug, struct PortForwarding, plugvt);
 
@@ -466,11 +466,11 @@ static const struct ChannelVtable PortForwarding_channelvt = {
  called when someone connects to the local port
  */
 
-static int pfl_accepting(Plug p, accept_fn_t constructor, accept_ctx_t ctx)
+static int pfl_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx)
 {
     struct PortForwarding *pf;
     struct PortListener *pl;
-    Socket s;
+    Socket *s;
     const char *err;
 
     pl = FROMFIELD(p, struct PortListener, plugvt);
@@ -1020,7 +1020,7 @@ char *portfwdmgr_connect(PortFwdManager *mgr, Channel **chan_ret,
                          char *hostname, int port, SshChannel *c,
                          int addressfamily)
 {
-    SockAddr addr;
+    SockAddr *addr;
     const char *err;
     char *dummy_realhost = NULL;
     struct PortForwarding *pf;

+ 25 - 25
source/putty/proxy.c

@@ -78,16 +78,16 @@ void proxy_activate (ProxySocket *p)
 
 /* basic proxy socket functions */
 
-static Plug sk_proxy_plug (Socket s, Plug p)
+static Plug *sk_proxy_plug (Socket *s, Plug *p)
 {
     ProxySocket *ps = FROMFIELD(s, ProxySocket, sockvt);
-    Plug ret = ps->plug;
+    Plug *ret = ps->plug;
     if (p)
 	ps->plug = p;
     return ret;
 }
 
-static void sk_proxy_close (Socket s)
+static void sk_proxy_close (Socket *s)
 {
     ProxySocket *ps = FROMFIELD(s, ProxySocket, sockvt);
 
@@ -96,7 +96,7 @@ static void sk_proxy_close (Socket s)
     sfree(ps);
 }
 
-static int sk_proxy_write (Socket s, const void *data, int len)
+static int sk_proxy_write (Socket *s, const void *data, int len)
 {
     ProxySocket *ps = FROMFIELD(s, ProxySocket, sockvt);
 
@@ -107,7 +107,7 @@ static int sk_proxy_write (Socket s, const void *data, int len)
     return sk_write(ps->sub_socket, data, len);
 }
 
-static int sk_proxy_write_oob (Socket s, const void *data, int len)
+static int sk_proxy_write_oob (Socket *s, const void *data, int len)
 {
     ProxySocket *ps = FROMFIELD(s, ProxySocket, sockvt);
 
@@ -120,7 +120,7 @@ static int sk_proxy_write_oob (Socket s, const void *data, int len)
     return sk_write_oob(ps->sub_socket, data, len);
 }
 
-static void sk_proxy_write_eof (Socket s)
+static void sk_proxy_write_eof (Socket *s)
 {
     ProxySocket *ps = FROMFIELD(s, ProxySocket, sockvt);
 
@@ -131,7 +131,7 @@ static void sk_proxy_write_eof (Socket s)
     sk_write_eof(ps->sub_socket);
 }
 
-static void sk_proxy_flush (Socket s)
+static void sk_proxy_flush (Socket *s)
 {
     ProxySocket *ps = FROMFIELD(s, ProxySocket, sockvt);
 
@@ -142,7 +142,7 @@ static void sk_proxy_flush (Socket s)
     sk_flush(ps->sub_socket);
 }
 
-static void sk_proxy_set_frozen (Socket s, int is_frozen)
+static void sk_proxy_set_frozen (Socket *s, int is_frozen)
 {
     ProxySocket *ps = FROMFIELD(s, ProxySocket, sockvt);
 
@@ -181,7 +181,7 @@ static void sk_proxy_set_frozen (Socket s, int is_frozen)
     sk_set_frozen(ps->sub_socket, is_frozen);
 }
 
-static const char * sk_proxy_socket_error (Socket s)
+static const char * sk_proxy_socket_error (Socket *s)
 {
     ProxySocket *ps = FROMFIELD(s, ProxySocket, sockvt);
     if (ps->error != NULL || ps->sub_socket == NULL) {
@@ -192,7 +192,7 @@ static const char * sk_proxy_socket_error (Socket s)
 
 /* basic proxy plug functions */
 
-static void plug_proxy_log(Plug plug, int type, SockAddr addr, int port,
+static void plug_proxy_log(Plug *plug, int type, SockAddr *addr, int port,
 			   const char *error_msg, int error_code)
 {
     ProxySocket *ps = FROMFIELD(plug, ProxySocket, plugvt);
@@ -200,7 +200,7 @@ static void plug_proxy_log(Plug plug, int type, SockAddr addr, int port,
     plug_log(ps->plug, type, addr, port, error_msg, error_code);
 }
 
-static void plug_proxy_closing (Plug p, const char *error_msg,
+static void plug_proxy_closing (Plug *p, const char *error_msg,
 				int error_code, int calling_back)
 {
     ProxySocket *ps = FROMFIELD(p, ProxySocket, plugvt);
@@ -215,7 +215,7 @@ static void plug_proxy_closing (Plug p, const char *error_msg,
     }
 }
 
-static void plug_proxy_receive (Plug p, int urgent, char *data, int len)
+static void plug_proxy_receive (Plug *p, int urgent, char *data, int len)
 {
     ProxySocket *ps = FROMFIELD(p, ProxySocket, plugvt);
 
@@ -234,7 +234,7 @@ static void plug_proxy_receive (Plug p, int urgent, char *data, int len)
     }
 }
 
-static void plug_proxy_sent (Plug p, int bufsize)
+static void plug_proxy_sent (Plug *p, int bufsize)
 {
     ProxySocket *ps = FROMFIELD(p, ProxySocket, plugvt);
 
@@ -246,7 +246,7 @@ static void plug_proxy_sent (Plug p, int bufsize)
     plug_sent(ps->plug, bufsize);
 }
 
-static int plug_proxy_accepting(Plug p,
+static int plug_proxy_accepting(Plug *p,
                                 accept_fn_t constructor, accept_ctx_t ctx)
 {
     ProxySocket *ps = FROMFIELD(p, ProxySocket, plugvt);
@@ -263,7 +263,7 @@ static int plug_proxy_accepting(Plug p,
  * This function can accept a NULL pointer as `addr', in which case
  * it will only check the host name.
  */
-int proxy_for_destination (SockAddr addr, const char *hostname,
+int proxy_for_destination (SockAddr *addr, const char *hostname,
                            int port, Conf *conf)
 {
     int s = 0, e = 0;
@@ -367,7 +367,7 @@ static char *dns_log_msg(const char *host, int addressfamily,
                       ""), reason);
 }
 
-SockAddr name_lookup(const char *host, int port, char **canonicalname,
+SockAddr *name_lookup(const char *host, int port, char **canonicalname,
                      Conf *conf, int addressfamily, Frontend *frontend,
                      const char *reason)
 {
@@ -416,19 +416,19 @@ static const struct Plug_vtable ProxySocket_plugvt = {
     plug_proxy_accepting
 };
 
-Socket new_connection(SockAddr addr, const char *hostname,
-		      int port, int privport,
-		      int oobinline, int nodelay, int keepalive,
-		      Plug plug, Conf *conf)
+Socket *new_connection(SockAddr *addr, const char *hostname,
+                       int port, int privport,
+                       int oobinline, int nodelay, int keepalive,
+                       Plug *plug, Conf *conf)
 {
     if (conf_get_int(conf, CONF_proxy_type) != PROXY_NONE &&
 	proxy_for_destination(addr, hostname, port, conf))
     {
 	ProxySocket *ret;
-	SockAddr proxy_addr;
+	SockAddr *proxy_addr;
 	char *proxy_canonical_name;
         const char *proxy_type;
-	Socket sret;
+	Socket *sret;
 	int type;
 
 	if ((sret = platform_new_connection(addr, hostname, port, privport,
@@ -536,8 +536,8 @@ Socket new_connection(SockAddr addr, const char *hostname,
     return sk_new(addr, port, privport, oobinline, nodelay, keepalive, plug);
 }
 
-Socket new_listener(const char *srcaddr, int port, Plug plug,
-                    int local_host_only, Conf *conf, int addressfamily)
+Socket *new_listener(const char *srcaddr, int port, Plug *plug,
+                     int local_host_only, Conf *conf, int addressfamily)
 {
     /* TODO: SOCKS (and potentially others) support inbound
      * TODO: connections via the proxy. support them.
@@ -1278,7 +1278,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
  * standardised or at all well-defined.)
  */
 
-char *format_telnet_command(SockAddr addr, int port, Conf *conf)
+char *format_telnet_command(SockAddr *addr, int port, Conf *conf)
 {
     char *fmt = conf_get_str(conf, CONF_proxy_telnet_command);
     char *ret = NULL;

+ 4 - 4
source/putty/proxy.h

@@ -18,9 +18,9 @@ typedef struct ProxySocket ProxySocket;
 struct ProxySocket {
     const char *error;
 
-    Socket sub_socket;
-    Plug plug;
-    SockAddr remote_addr;
+    Socket *sub_socket;
+    Plug *plug;
+    SockAddr *remote_addr;
     int remote_port;
 
     bufchain pending_output_data;
@@ -102,7 +102,7 @@ extern int proxy_socks5_negotiate (ProxySocket *, int);
  * This may be reused by local-command proxies on individual
  * platforms.
  */
-char *format_telnet_command(SockAddr addr, int port, Conf *conf);
+char *format_telnet_command(SockAddr *addr, int port, Conf *conf);
 
 /*
  * These are implemented in cproxy.c or nocproxy.c, depending on

+ 4 - 4
source/putty/putty.h

@@ -1254,10 +1254,10 @@ void random_unref(void);
 /*
  * Exports from pinger.c.
  */
-typedef struct pinger_tag *Pinger;
-Pinger pinger_new(Conf *conf, Backend *backend);
-void pinger_reconfig(Pinger, Conf *oldconf, Conf *newconf);
-void pinger_free(Pinger);
+typedef struct Pinger Pinger;
+Pinger *pinger_new(Conf *conf, Backend *backend);
+void pinger_reconfig(Pinger *, Conf *oldconf, Conf *newconf);
+void pinger_free(Pinger *);
 
 /*
  * Exports from misc.c.

+ 53 - 53
source/putty/ssh.c

@@ -29,8 +29,8 @@
 #define GSS_CTXT_MAYFAIL (1<<3)	/* Context may expire during handshake */
 #endif
 
-struct ssh_tag {
-    Socket s;
+struct Ssh {
+    Socket *s;
     Frontend *frontend;
     Conf *conf;
 
@@ -101,7 +101,7 @@ struct ssh_tag {
      */
     int session_started;
 
-    Pinger pinger;
+    Pinger *pinger;
 
     int need_random_unref;
 };
@@ -109,16 +109,16 @@ struct ssh_tag {
 #define ssh_logevent(params) ( \
         logevent_and_free((ssh)->frontend, dupprintf params))
 
-static void ssh_shutdown(Ssh ssh);
-static void ssh_throttle_all(Ssh ssh, int enable, int bufsize);
+static void ssh_shutdown(Ssh *ssh);
+static void ssh_throttle_all(Ssh *ssh, int enable, int bufsize);
 static void ssh_bpp_output_raw_data_callback(void *vctx);
 
-Frontend *ssh_get_frontend(Ssh ssh)
+Frontend *ssh_get_frontend(Ssh *ssh)
 {
     return ssh->frontend;
 }
 
-static void ssh_connect_bpp(Ssh ssh)
+static void ssh_connect_bpp(Ssh *ssh)
 {
     ssh->bpp->ssh = ssh;
     ssh->bpp->in_raw = &ssh->in_raw;
@@ -129,7 +129,7 @@ static void ssh_connect_bpp(Ssh ssh)
     ssh->bpp->remote_bugs = ssh->remote_bugs;
 }
 
-static void ssh_connect_ppl(Ssh ssh, PacketProtocolLayer *ppl)
+static void ssh_connect_ppl(Ssh *ssh, PacketProtocolLayer *ppl)
 {
     ppl->bpp = ssh->bpp;
     ppl->user_input = &ssh->user_input;
@@ -141,7 +141,7 @@ static void ssh_connect_ppl(Ssh ssh, PacketProtocolLayer *ppl)
 static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
                                 int major_version)
 {
-    Ssh ssh = FROMFIELD(rcv, struct ssh_tag, version_receiver);
+    Ssh *ssh = FROMFIELD(rcv, Ssh, version_receiver);
     BinaryPacketProtocol *old_bpp;
     PacketProtocolLayer *connection_layer;
 
@@ -289,7 +289,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
 
 static void ssh_bpp_output_raw_data_callback(void *vctx)
 {
-    Ssh ssh = (Ssh)vctx;
+    Ssh *ssh = (Ssh *)vctx;
 
     if (!ssh->s)
         return;
@@ -319,7 +319,7 @@ static void ssh_bpp_output_raw_data_callback(void *vctx)
     }
 }
 
-static void ssh_shutdown_internal(Ssh ssh)
+static void ssh_shutdown_internal(Ssh *ssh)
 {
     expire_timer_context(ssh);
 
@@ -345,7 +345,7 @@ static void ssh_shutdown_internal(Ssh ssh)
     ssh->cl = NULL;
 }
 
-static void ssh_shutdown(Ssh ssh)
+static void ssh_shutdown(Ssh *ssh)
 {
     ssh_shutdown_internal(ssh);
 
@@ -364,7 +364,7 @@ static void ssh_shutdown(Ssh ssh)
     bufchain_clear(&ssh->user_input);
 }
 
-static void ssh_initiate_connection_close(Ssh ssh)
+static void ssh_initiate_connection_close(Ssh *ssh)
 {
     /* Wind up everything above the BPP. */
     ssh_shutdown_internal(ssh);
@@ -388,7 +388,7 @@ static void ssh_initiate_connection_close(Ssh ssh)
     msg = dupvprintf(fmt, ap);                  \
     va_end(ap);
 
-void ssh_remote_error(Ssh ssh, const char *fmt, ...)
+void ssh_remote_error(Ssh *ssh, const char *fmt, ...)
 {
     if (ssh->base_layer || !ssh->session_started) {
         GET_FORMATTED_MSG;
@@ -406,7 +406,7 @@ void ssh_remote_error(Ssh ssh, const char *fmt, ...)
     }
 }
 
-void ssh_remote_eof(Ssh ssh, const char *fmt, ...)
+void ssh_remote_eof(Ssh *ssh, const char *fmt, ...)
 {
     if (ssh->base_layer || !ssh->session_started) {
         GET_FORMATTED_MSG;
@@ -429,7 +429,7 @@ void ssh_remote_eof(Ssh ssh, const char *fmt, ...)
     }
 }
 
-void ssh_proto_error(Ssh ssh, const char *fmt, ...)
+void ssh_proto_error(Ssh *ssh, const char *fmt, ...)
 {
     if (ssh->base_layer || !ssh->session_started) {
         GET_FORMATTED_MSG;
@@ -446,7 +446,7 @@ void ssh_proto_error(Ssh ssh, const char *fmt, ...)
     }
 }
 
-void ssh_sw_abort(Ssh ssh, const char *fmt, ...)
+void ssh_sw_abort(Ssh *ssh, const char *fmt, ...)
 {
     if (ssh->base_layer || !ssh->session_started) {
         GET_FORMATTED_MSG;
@@ -463,7 +463,7 @@ void ssh_sw_abort(Ssh ssh, const char *fmt, ...)
     }
 }
 
-void ssh_user_close(Ssh ssh, const char *fmt, ...)
+void ssh_user_close(Ssh *ssh, const char *fmt, ...)
 {
     if (ssh->base_layer || !ssh->session_started) {
         GET_FORMATTED_MSG;
@@ -486,10 +486,10 @@ void ssh_user_close(Ssh ssh, const char *fmt, ...)
     }
 }
 
-static void ssh_socket_log(Plug plug, int type, SockAddr addr, int port,
+static void ssh_socket_log(Plug *plug, int type, SockAddr *addr, int port,
                            const char *error_msg, int error_code)
 {
-    Ssh ssh = FROMFIELD(plug, struct ssh_tag, plugvt);
+    Ssh *ssh = FROMFIELD(plug, Ssh, plugvt);
 
     /*
      * While we're attempting connection sharing, don't loudly log
@@ -506,10 +506,10 @@ static void ssh_socket_log(Plug plug, int type, SockAddr addr, int port,
                            ssh->session_started);
 }
 
-static void ssh_closing(Plug plug, const char *error_msg, int error_code,
+static void ssh_closing(Plug *plug, const char *error_msg, int error_code,
 			int calling_back)
 {
-    Ssh ssh = FROMFIELD(plug, struct ssh_tag, plugvt);
+    Ssh *ssh = FROMFIELD(plug, Ssh, plugvt);
     if (error_msg) {
         ssh_remote_error(ssh, "Network error: %s", error_msg);
     } else if (ssh->bpp) {
@@ -518,9 +518,9 @@ static void ssh_closing(Plug plug, const char *error_msg, int error_code,
     }
 }
 
-static void ssh_receive(Plug plug, int urgent, char *data, int len)
+static void ssh_receive(Plug *plug, int urgent, char *data, int len)
 {
-    Ssh ssh = FROMFIELD(plug, struct ssh_tag, plugvt);
+    Ssh *ssh = FROMFIELD(plug, Ssh, plugvt);
 
     /* Log raw data, if we're in that mode. */
     if (ssh->logctx)
@@ -532,9 +532,9 @@ static void ssh_receive(Plug plug, int urgent, char *data, int len)
         queue_idempotent_callback(&ssh->bpp->ic_in_raw);
 }
 
-static void ssh_sent(Plug plug, int bufsize)
+static void ssh_sent(Plug *plug, int bufsize)
 {
-    Ssh ssh = FROMFIELD(plug, struct ssh_tag, plugvt);
+    Ssh *ssh = FROMFIELD(plug, Ssh, plugvt);
     /*
      * If the send backlog on the SSH socket itself clears, we should
      * unthrottle the whole world if it was throttled. Also trigger an
@@ -613,10 +613,10 @@ static const Plug_vtable Ssh_plugvt = {
  * Also places the canonical host name into `realhost'. It must be
  * freed by the caller.
  */
-static const char *connect_to_host(Ssh ssh, const char *host, int port,
+static const char *connect_to_host(Ssh *ssh, const char *host, int port,
 				   char **realhost, int nodelay, int keepalive)
 {
-    SockAddr addr;
+    SockAddr *addr;
     const char *err;
     char *loghost;
     int addressfamily, sshprot;
@@ -725,7 +725,7 @@ static const char *connect_to_host(Ssh ssh, const char *host, int port,
 /*
  * Throttle or unthrottle the SSH connection.
  */
-void ssh_throttle_conn(Ssh ssh, int adjust)
+void ssh_throttle_conn(Ssh *ssh, int adjust)
 {
     int old_count = ssh->conn_throttle_count;
     int frozen;
@@ -758,7 +758,7 @@ void ssh_throttle_conn(Ssh ssh, int adjust)
  * Throttle or unthrottle _all_ local data streams (for when sends
  * on the SSH connection itself back up).
  */
-static void ssh_throttle_all(Ssh ssh, int enable, int bufsize)
+static void ssh_throttle_all(Ssh *ssh, int enable, int bufsize)
 {
     if (enable == ssh->throttled_all)
 	return;
@@ -768,7 +768,7 @@ static void ssh_throttle_all(Ssh ssh, int enable, int bufsize)
     ssh_throttle_all_channels(ssh->cl, enable);
 }
 
-static void ssh_cache_conf_values(Ssh ssh)
+static void ssh_cache_conf_values(Ssh *ssh)
 {
     ssh->pls.omit_passwords = conf_get_int(ssh->conf, CONF_logomitpass);
     ssh->pls.omit_data = conf_get_int(ssh->conf, CONF_logomitdata);
@@ -785,10 +785,10 @@ static const char *ssh_init(Frontend *frontend, Backend **backend_handle,
 			    int nodelay, int keepalive)
 {
     const char *p;
-    Ssh ssh;
+    Ssh *ssh;
 
-    ssh = snew(struct ssh_tag);
-    memset(ssh, 0, sizeof(struct ssh_tag));
+    ssh = snew(Ssh);
+    memset(ssh, 0, sizeof(Ssh));
 
     ssh->conf = conf_copy(conf);
     ssh_cache_conf_values(ssh);
@@ -825,7 +825,7 @@ static const char *ssh_init(Frontend *frontend, Backend **backend_handle,
 
 static void ssh_free(Backend *be)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     int need_random_unref;
 
     ssh_shutdown(ssh);
@@ -860,7 +860,7 @@ static void ssh_free(Backend *be)
  */
 static void ssh_reconfig(Backend *be, Conf *conf)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
 
     if (ssh->pinger)
         pinger_reconfig(ssh->pinger, ssh->conf, conf);
@@ -877,7 +877,7 @@ static void ssh_reconfig(Backend *be, Conf *conf)
  */
 static int ssh_send(Backend *be, const char *buf, int len)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
 
     if (ssh == NULL || ssh->s == NULL)
 	return 0;
@@ -894,7 +894,7 @@ static int ssh_send(Backend *be, const char *buf, int len)
  */
 static int ssh_sendbuffer(Backend *be)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     int backlog;
 
     if (!ssh || !ssh->s || !ssh->cl)
@@ -919,7 +919,7 @@ static int ssh_sendbuffer(Backend *be)
  */
 static void ssh_size(Backend *be, int width, int height)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
 
     ssh->term_width = width;
     ssh->term_height = height;
@@ -956,7 +956,7 @@ static void ssh_add_special(void *vctx, const char *text,
  */
 static const SessionSpecial *ssh_get_specials(Backend *be)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
 
     /*
      * Ask all our active protocol layers what specials they've got,
@@ -986,7 +986,7 @@ static const SessionSpecial *ssh_get_specials(Backend *be)
  */
 static void ssh_special(Backend *be, SessionSpecialCode code, int arg)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
 
     if (ssh->base_layer)
         ssh_ppl_special_cmd(ssh->base_layer, code, arg);
@@ -998,24 +998,24 @@ static void ssh_special(Backend *be, SessionSpecialCode code, int arg)
  */
 static void ssh_unthrottle(Backend *be, int bufsize)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
 
     ssh_stdout_unthrottle(ssh->cl, bufsize);
 }
 
 static int ssh_connected(Backend *be)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     return ssh->s != NULL;
 }
 
 static int ssh_sendok(Backend *be)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     return ssh->base_layer && ssh_ppl_want_user_input(ssh->base_layer);
 }
 
-void ssh_ldisc_update(Ssh ssh)
+void ssh_ldisc_update(Ssh *ssh)
 {
     /* Called when the connection layer wants to propagate an update
      * to the line discipline options */
@@ -1025,30 +1025,30 @@ void ssh_ldisc_update(Ssh ssh)
 
 static int ssh_ldisc(Backend *be, int option)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     return ssh->cl ? ssh_ldisc_option(ssh->cl, option) : FALSE;
 }
 
 static void ssh_provide_ldisc(Backend *be, Ldisc *ldisc)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     ssh->ldisc = ldisc;
 }
 
 static void ssh_provide_logctx(Backend *be, LogContext *logctx)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     ssh->logctx = logctx;
 }
 
-void ssh_got_exitcode(Ssh ssh, int exitcode)
+void ssh_got_exitcode(Ssh *ssh, int exitcode)
 {
     ssh->exitcode = exitcode;
 }
 
 static int ssh_return_exitcode(Backend *be)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     if (ssh->s && (!ssh->session_started || ssh->base_layer))
         return -1;
     else
@@ -1062,7 +1062,7 @@ static int ssh_return_exitcode(Backend *be)
  */
 static int ssh_cfg_info(Backend *be)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     if (ssh->version == 0)
 	return 0; /* don't know yet */
     else if (ssh->bare_connection)
@@ -1078,11 +1078,11 @@ static int ssh_cfg_info(Backend *be)
  */
 extern int ssh_fallback_cmd(Backend *be)
 {
-    Ssh ssh = FROMFIELD(be, struct ssh_tag, backend);
+    Ssh *ssh = FROMFIELD(be, Ssh, backend);
     return ssh->fallback_cmd;
 }
 
-void ssh_got_fallback_cmd(Ssh ssh)
+void ssh_got_fallback_cmd(Ssh *ssh)
 {
     ssh->fallback_cmd = TRUE;
 }

+ 16 - 16
source/putty/ssh.h

@@ -160,9 +160,9 @@ int ssh2_censor_packet(
 PktOut *ssh_new_packet(void);
 void ssh_free_pktout(PktOut *pkt);
 
-extern Socket ssh_connection_sharing_init(
+extern Socket *ssh_connection_sharing_init(
     const char *host, int port, Conf *conf, Frontend *frontend,
-    Plug sshplug, ssh_sharing_state **state);
+    Plug *sshplug, ssh_sharing_state **state);
 void ssh_connshare_provide_connlayer(ssh_sharing_state *sharestate,
                                      ConnectionLayer *cl);
 int ssh_share_test_for_upstream(const char *host, int port, Conf *conf);
@@ -173,7 +173,7 @@ void share_activate(ssh_sharing_state *sharestate,
 void sharestate_free(ssh_sharing_state *state);
 int share_ndownstreams(ssh_sharing_state *state);
 
-void ssh_connshare_log(Ssh ssh, int event, const char *logtext,
+void ssh_connshare_log(Ssh *ssh, int event, const char *logtext,
                        const char *ds_err, const char *us_err);
 void share_setup_x11_channel(ssh_sharing_connstate *cs, share_channel *chan,
                              unsigned upstream_id, unsigned server_id,
@@ -306,20 +306,20 @@ char *portfwdmgr_connect(PortFwdManager *mgr, Channel **chan_ret,
                          char *hostname, int port, SshChannel *c,
                          int addressfamily);
 
-Frontend *ssh_get_frontend(Ssh ssh);
+Frontend *ssh_get_frontend(Ssh *ssh);
 
 /* Communications back to ssh.c from connection layers */
-void ssh_throttle_conn(Ssh ssh, int adjust);
-void ssh_got_exitcode(Ssh ssh, int status);
-void ssh_ldisc_update(Ssh ssh);
-void ssh_got_fallback_cmd(Ssh ssh);
+void ssh_throttle_conn(Ssh *ssh, int adjust);
+void ssh_got_exitcode(Ssh *ssh, int status);
+void ssh_ldisc_update(Ssh *ssh);
+void ssh_got_fallback_cmd(Ssh *ssh);
 
 /* Functions to abort the connection, for various reasons. */
-void ssh_remote_error(Ssh ssh, const char *fmt, ...);
-void ssh_remote_eof(Ssh ssh, const char *fmt, ...);
-void ssh_proto_error(Ssh ssh, const char *fmt, ...);
-void ssh_sw_abort(Ssh ssh, const char *fmt, ...);
-void ssh_user_close(Ssh ssh, const char *fmt, ...);
+void ssh_remote_error(Ssh *ssh, const char *fmt, ...);
+void ssh_remote_eof(Ssh *ssh, const char *fmt, ...);
+void ssh_proto_error(Ssh *ssh, const char *fmt, ...);
+void ssh_sw_abort(Ssh *ssh, const char *fmt, ...);
+void ssh_user_close(Ssh *ssh, const char *fmt, ...);
 
 #define SSH_CIPHER_IDEA		1
 #define SSH_CIPHER_DES		2
@@ -875,7 +875,7 @@ struct X11Display {
 
     /* PuTTY networking SockAddr to connect to the display, and associated
      * gubbins */
-    SockAddr addr;
+    SockAddr *addr;
     int port;
     char *realhost;
 
@@ -935,7 +935,7 @@ extern void platform_get_x11_auth(struct X11Display *display, Conf *);
     /* examine a mostly-filled-in X11Display and fill in localauth* */
 extern const int platform_uses_x11_unix_by_default;
     /* choose default X transport in the absence of a specified one */
-SockAddr platform_get_x11_unix_address(const char *path, int displaynum);
+SockAddr *platform_get_x11_unix_address(const char *path, int displaynum);
     /* make up a SockAddr naming the address for displaynum */
 char *platform_get_x_display(void);
     /* allocated local X display string, if any */
@@ -1158,7 +1158,7 @@ void invent_firstbits(unsigned *one, unsigned *two);
  */
 enum { SHARE_NONE, SHARE_DOWNSTREAM, SHARE_UPSTREAM };
 int platform_ssh_share(const char *name, Conf *conf,
-                       Plug downplug, Plug upplug, Socket *sock,
+                       Plug *downplug, Plug *upplug, Socket **sock,
                        char **logtext, char **ds_err, char **us_err,
                        int can_upstream, int can_downstream);
 void platform_ssh_share_cleanup(const char *name);

+ 2 - 2
source/putty/ssh1connection.c

@@ -19,7 +19,7 @@ struct outstanding_succfail;
 struct ssh1_connection_state {
     int crState;
 
-    Ssh ssh;
+    Ssh *ssh;
 
     Conf *conf;
     int local_protoflags;
@@ -248,7 +248,7 @@ static void ssh1_channel_free(struct ssh1_channel *c)
 }
 
 PacketProtocolLayer *ssh1_connection_new(
-    Ssh ssh, Conf *conf, ConnectionLayer **cl_out)
+    Ssh *ssh, Conf *conf, ConnectionLayer **cl_out)
 {
     struct ssh1_connection_state *s = snew(struct ssh1_connection_state);
     memset(s, 0, sizeof(*s));

+ 2 - 2
source/putty/ssh2connection.c

@@ -22,7 +22,7 @@ struct outstanding_global_request;
 struct ssh2_connection_state {
     int crState;
 
-    Ssh ssh;
+    Ssh *ssh;
 
     ssh_sharing_state *connshare;
     char *peer_verstring;
@@ -370,7 +370,7 @@ static void ssh2_channel_free(struct ssh2_channel *c)
 }
 
 PacketProtocolLayer *ssh2_connection_new(
-    Ssh ssh, ssh_sharing_state *connshare, int is_simple,
+    Ssh *ssh, ssh_sharing_state *connshare, int is_simple,
     Conf *conf, const char *peer_verstring, ConnectionLayer **cl_out)
 {
     struct ssh2_connection_state *s = snew(struct ssh2_connection_state);

+ 1 - 1
source/putty/sshbpp.h

@@ -22,7 +22,7 @@ struct BinaryPacketProtocol {
     PktOutQueue out_pq;
     PacketLogSettings *pls;
     LogContext *logctx;
-    Ssh ssh;
+    Ssh *ssh;
 
     /* ic_in_raw is filled in by the BPP (probably by calling
      * ssh_bpp_common_setup). The BPP's owner triggers it when data is

+ 3 - 3
source/putty/sshppl.h

@@ -54,7 +54,7 @@ struct PacketProtocolLayer {
 
     /* Logging and error-reporting facilities. */
     void *frontend;               /* for logevent, dialog boxes etc */
-    Ssh ssh;   /* for session termination + assorted connection-layer ops */
+    Ssh *ssh;   /* for session termination + assorted connection-layer ops */
 
     /* Known bugs in the remote implementation. */
     unsigned remote_bugs;
@@ -89,7 +89,7 @@ PacketProtocolLayer *ssh1_login_new(
     Conf *conf, const char *host, int port,
     PacketProtocolLayer *successor_layer);
 PacketProtocolLayer *ssh1_connection_new(
-    Ssh ssh, Conf *conf, ConnectionLayer **cl_out);
+    Ssh *ssh, Conf *conf, ConnectionLayer **cl_out);
 
 struct DataTransferStats;
 struct ssh_connection_shared_gss_state;
@@ -108,7 +108,7 @@ PacketProtocolLayer *ssh2_userauth_new(
     int try_gssapi_auth, int try_gssapi_kex_auth,
     int gssapi_fwd, struct ssh_connection_shared_gss_state *shgss);
 PacketProtocolLayer *ssh2_connection_new(
-    Ssh ssh, ssh_sharing_state *connshare, int is_simple,
+    Ssh *ssh, ssh_sharing_state *connshare, int is_simple,
     Conf *conf, const char *peer_verstring, ConnectionLayer **cl_out);
 
 /* Can't put this in the userauth constructor without having a

+ 12 - 12
source/putty/sshshare.c

@@ -141,7 +141,7 @@
 
 struct ssh_sharing_state {
     char *sockname;                  /* the socket name, kept for cleanup */
-    Socket listensock;               /* the master listening Socket */
+    Socket *listensock;              /* the master listening Socket */
     tree234 *connections;            /* holds ssh_sharing_connstates */
     unsigned nextid;                 /* preferred id for next connstate */
     ConnectionLayer *cl;             /* instance of the ssh connection layer */
@@ -155,7 +155,7 @@ struct share_globreq;
 struct ssh_sharing_connstate {
     unsigned id;    /* used to identify this downstream in log messages */
 
-    Socket sock;                     /* the Socket for this connection */
+    Socket *sock;                     /* the Socket for this connection */
     struct ssh_sharing_state *parent;
 
     int crLine;                        /* coroutine state for share_receive */
@@ -947,7 +947,7 @@ static void share_disconnect(struct ssh_sharing_connstate *cs,
     share_begin_cleanup(cs);
 }
 
-static void share_closing(Plug plug, const char *error_msg, int error_code,
+static void share_closing(Plug *plug, const char *error_msg, int error_code,
 			  int calling_back)
 {
     struct ssh_sharing_connstate *cs = FROMFIELD(
@@ -1764,7 +1764,7 @@ static void share_got_pkt_from_downstream(struct ssh_sharing_connstate *cs,
         (c) = (unsigned char)*data++;                           \
     } while (0)
 
-static void share_receive(Plug plug, int urgent, char *data, int len)
+static void share_receive(Plug *plug, int urgent, char *data, int len)
 {
     ssh_sharing_connstate *cs = FROMFIELD(
         plug, ssh_sharing_connstate, plugvt);
@@ -1840,7 +1840,7 @@ static void share_receive(Plug plug, int urgent, char *data, int len)
     crFinishV;
 }
 
-static void share_sent(Plug plug, int bufsize)
+static void share_sent(Plug *plug, int bufsize)
 {
     /* ssh_sharing_connstate *cs = FROMFIELD(
         plug, ssh_sharing_connstate, plugvt); */
@@ -1855,7 +1855,7 @@ static void share_sent(Plug plug, int bufsize)
      */
 }
 
-static void share_listen_closing(Plug plug, const char *error_msg,
+static void share_listen_closing(Plug *plug, const char *error_msg,
 				 int error_code, int calling_back)
 {
     ssh_sharing_state *sharestate = FROMFIELD(plug, ssh_sharing_state, plugvt);
@@ -1918,7 +1918,7 @@ static const Plug_vtable ssh_sharing_conn_plugvt = {
     NULL /* no accepting function, because we've already done it */
 };
 
-static int share_listen_accepting(Plug plug,
+static int share_listen_accepting(Plug *plug,
                                   accept_fn_t constructor, accept_ctx_t ctx)
 {
     struct ssh_sharing_state *sharestate = FROMFIELD(
@@ -2030,13 +2030,13 @@ int ssh_share_test_for_upstream(const char *host, int port, Conf *conf)
 {
     char *sockname, *logtext, *ds_err, *us_err;
     int result;
-    Socket sock;
+    Socket *sock;
 
     sockname = ssh_share_sockname(host, port, conf);
 
     sock = NULL;
     logtext = ds_err = us_err = NULL;
-    result = platform_ssh_share(sockname, conf, nullplug, (Plug)NULL, &sock,
+    result = platform_ssh_share(sockname, conf, nullplug, (Plug *)NULL, &sock,
                                 &logtext, &ds_err, &us_err, FALSE, TRUE);
 
     sfree(logtext);
@@ -2078,14 +2078,14 @@ void ssh_connshare_provide_connlayer(ssh_sharing_state *sharestate,
  * to the upstream; otherwise (whether or not we have established an
  * upstream) we return NULL.
  */
-Socket ssh_connection_sharing_init(
+Socket *ssh_connection_sharing_init(
     const char *host, int port, Conf *conf, Frontend *frontend,
-    Plug sshplug, ssh_sharing_state **state)
+    Plug *sshplug, ssh_sharing_state **state)
 {
     int result, can_upstream, can_downstream;
     char *logtext, *ds_err, *us_err;
     char *sockname;
-    Socket sock, toret = NULL;
+    Socket *sock, *toret = NULL;
     struct ssh_sharing_state *sharestate;
 
     if (!conf_get_int(conf, CONF_ssh_connection_sharing))

+ 54 - 54
source/putty/windows/winnet.c

@@ -52,7 +52,7 @@ typedef struct NetSocket NetSocket;
 struct NetSocket {
     const char *error;
     SOCKET s;
-    Plug plug;
+    Plug *plug;
     bufchain output_data;
     int connected;
     int writable;
@@ -64,7 +64,7 @@ struct NetSocket {
     int sending_oob;
     int oobinline, nodelay, keepalive, privport;
     enum { EOF_NO, EOF_PENDING, EOF_SENT } outgoingeof;
-    SockAddr addr;
+    SockAddr *addr;
     SockAddrStep step;
     int port;
     int pending_error;		       /* in case send() returns error */
@@ -79,7 +79,7 @@ struct NetSocket {
     const Socket_vtable *sockvt;
 };
 
-struct SockAddr_tag {
+struct SockAddr {
     int refcount;
     char *error;
     int resolved;
@@ -525,10 +525,10 @@ const char *winsock_error_string(int error)
     return es->text;
 }
 
-SockAddr sk_namelookup(const char *host, char **canonicalname,
-		       int address_family)
+SockAddr *sk_namelookup(const char *host, char **canonicalname,
+                        int address_family)
 {
-    SockAddr ret = snew(struct SockAddr_tag);
+    SockAddr *ret = snew(SockAddr);
     unsigned long a;
     char realhost[8192];
     int hint_family;
@@ -541,7 +541,7 @@ SockAddr sk_namelookup(const char *host, char **canonicalname,
 		   AF_UNSPEC);
 
     /* Clear the structure and default to IPv4. */
-    memset(ret, 0, sizeof(struct SockAddr_tag));
+    memset(ret, 0, sizeof(SockAddr));
 #ifndef NO_IPV6
     ret->ais = NULL;
 #endif
@@ -650,9 +650,9 @@ SockAddr sk_namelookup(const char *host, char **canonicalname,
     return ret;
 }
 
-SockAddr sk_nonamelookup(const char *host)
+SockAddr *sk_nonamelookup(const char *host)
 {
-    SockAddr ret = snew(struct SockAddr_tag);
+    SockAddr *ret = snew(SockAddr);
     ret->error = NULL;
     ret->resolved = FALSE;
 #ifndef NO_IPV6
@@ -667,9 +667,9 @@ SockAddr sk_nonamelookup(const char *host)
     return ret;
 }
 
-SockAddr sk_namedpipe_addr(const char *pipename)
+SockAddr *sk_namedpipe_addr(const char *pipename)
 {
-    SockAddr ret = snew(struct SockAddr_tag);
+    SockAddr *ret = snew(SockAddr);
     ret->error = NULL;
     ret->resolved = FALSE;
 #ifndef NO_IPV6
@@ -684,7 +684,7 @@ SockAddr sk_namedpipe_addr(const char *pipename)
     return ret;
 }
 
-int sk_nextaddr(SockAddr addr, SockAddrStep *step)
+int sk_nextaddr(SockAddr *addr, SockAddrStep *step)
 {
 #ifndef NO_IPV6
     if (step->ai) {
@@ -703,7 +703,7 @@ int sk_nextaddr(SockAddr addr, SockAddrStep *step)
     }
 }
 
-void sk_getaddr(SockAddr addr, char *buf, int buflen)
+void sk_getaddr(SockAddr *addr, char *buf, int buflen)
 {
     SockAddrStep step;
     START_STEP(addr, step);
@@ -746,10 +746,10 @@ void sk_getaddr(SockAddr addr, char *buf, int buflen)
  * rather than dynamically allocated - that should clue in anyone
  * writing a call to it that something is weird about it.)
  */
-static struct SockAddr_tag sk_extractaddr_tmp(
-    SockAddr addr, const SockAddrStep *step)
+static SockAddr sk_extractaddr_tmp(
+    SockAddr *addr, const SockAddrStep *step)
 {
-    struct SockAddr_tag toret;
+    SockAddr toret;
     toret = *addr;                    /* structure copy */
     toret.refcount = 1;
 
@@ -766,7 +766,7 @@ static struct SockAddr_tag sk_extractaddr_tmp(
     return toret;
 }
 
-int sk_addr_needs_port(SockAddr addr)
+int sk_addr_needs_port(SockAddr *addr)
 {
     return addr->namedpipe ? FALSE : TRUE;
 }
@@ -811,7 +811,7 @@ static int ipv4_is_local_addr(struct in_addr addr)
     return 0;		       /* this address is not local */
 }
 
-int sk_address_is_local(SockAddr addr)
+int sk_address_is_local(SockAddr *addr)
 {
     SockAddrStep step;
     int family;
@@ -842,12 +842,12 @@ int sk_address_is_local(SockAddr addr)
     }
 }
 
-int sk_address_is_special_local(SockAddr addr)
+int sk_address_is_special_local(SockAddr *addr)
 {
     return 0;                /* no Unix-domain socket analogue here */
 }
 
-int sk_addrtype(SockAddr addr)
+int sk_addrtype(SockAddr *addr)
 {
     SockAddrStep step;
     int family;
@@ -861,7 +861,7 @@ int sk_addrtype(SockAddr addr)
 	    ADDRTYPE_NAME);
 }
 
-void sk_addrcopy(SockAddr addr, char *buf)
+void sk_addrcopy(SockAddr *addr, char *buf)
 {
     SockAddrStep step;
     int family;
@@ -889,7 +889,7 @@ void sk_addrcopy(SockAddr addr, char *buf)
     }
 }
 
-void sk_addr_free(SockAddr addr)
+void sk_addr_free(SockAddr *addr)
 {
     if (--addr->refcount > 0)
 	return;
@@ -902,22 +902,22 @@ void sk_addr_free(SockAddr addr)
     sfree(addr);
 }
 
-SockAddr sk_addr_dup(SockAddr addr)
+SockAddr *sk_addr_dup(SockAddr *addr)
 {
     addr->refcount++;
     return addr;
 }
 
-static Plug sk_net_plug(Socket sock, Plug p)
+static Plug *sk_net_plug(Socket *sock, Plug *p)
 {
     NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
-    Plug ret = s->plug;
+    Plug *ret = s->plug;
     if (p)
 	s->plug = p;
     return ret;
 }
 
-static void sk_net_flush(Socket s)
+static void sk_net_flush(Socket *s)
 {
     /*
      * We send data to the socket as soon as we can anyway,
@@ -925,13 +925,13 @@ static void sk_net_flush(Socket s)
      */
 }
 
-static void sk_net_close(Socket s);
-static int sk_net_write(Socket s, const void *data, int len);
-static int sk_net_write_oob(Socket s, const void *data, int len);
-static void sk_net_write_eof(Socket s);
-static void sk_net_set_frozen(Socket s, int is_frozen);
-static const char *sk_net_socket_error(Socket s);
-static char *sk_net_peer_info(Socket s);
+static void sk_net_close(Socket *s);
+static int sk_net_write(Socket *s, const void *data, int len);
+static int sk_net_write_oob(Socket *s, const void *data, int len);
+static void sk_net_write_eof(Socket *s);
+static void sk_net_set_frozen(Socket *s, int is_frozen);
+static const char *sk_net_socket_error(Socket *s);
+static char *sk_net_peer_info(Socket *s);
 
 extern char *do_select(SOCKET skt, int startup);
 
@@ -947,7 +947,7 @@ static const Socket_vtable NetSocket_sockvt = {
     sk_net_peer_info,
 };
 
-static Socket sk_net_accept(accept_ctx_t ctx, Plug plug)
+static Socket *sk_net_accept(accept_ctx_t ctx, Plug *plug)
 {
     DWORD err;
     char *errstr;
@@ -1012,7 +1012,7 @@ static DWORD try_connect(NetSocket *sock)
     }
 
     {
-        struct SockAddr_tag thisaddr = sk_extractaddr_tmp(
+        SockAddr thisaddr = sk_extractaddr_tmp(
             sock->addr, &sock->step);
         plug_log(sock->plug, 0, &thisaddr, sock->port, NULL, 0);
     }
@@ -1185,15 +1185,15 @@ static DWORD try_connect(NetSocket *sock)
     add234(sktree, sock);
 
     if (err) {
-        struct SockAddr_tag thisaddr = sk_extractaddr_tmp(
+        SockAddr thisaddr = sk_extractaddr_tmp(
             sock->addr, &sock->step);
 	plug_log(sock->plug, 1, &thisaddr, sock->port, sock->error, err);
     }
     return err;
 }
 
-Socket sk_new(SockAddr addr, int port, int privport, int oobinline,
-	      int nodelay, int keepalive, Plug plug)
+Socket *sk_new(SockAddr *addr, int port, int privport, int oobinline,
+               int nodelay, int keepalive, Plug *plug)
 {
     NetSocket *ret;
     DWORD err;
@@ -1232,8 +1232,8 @@ Socket sk_new(SockAddr addr, int port, int privport, int oobinline,
     return &ret->sockvt;
 }
 
-Socket sk_newlistener(const char *srcaddr, int port, Plug plug,
-                      int local_host_only, int orig_address_family)
+Socket *sk_newlistener(const char *srcaddr, int port, Plug *plug,
+                       int local_host_only, int orig_address_family)
 {
     SOCKET s;
 #ifndef NO_IPV6
@@ -1408,8 +1408,8 @@ Socket sk_newlistener(const char *srcaddr, int port, Plug plug,
      * IPv6 listening socket and link it to this one.
      */
     if (address_family == AF_INET && orig_address_family == ADDRTYPE_UNSPEC) {
-	Socket other = sk_newlistener(srcaddr, port, plug,
-                                      local_host_only, ADDRTYPE_IPV6);
+	Socket *other = sk_newlistener(srcaddr, port, plug,
+                                       local_host_only, ADDRTYPE_IPV6);
 
 	if (other) {
             NetSocket *ns = FROMFIELD(other, NetSocket, sockvt);
@@ -1426,7 +1426,7 @@ Socket sk_newlistener(const char *srcaddr, int port, Plug plug,
     return &ret->sockvt;
 }
 
-static void sk_net_close(Socket sock)
+static void sk_net_close(Socket *sock)
 {
     extern char *do_select(SOCKET skt, int startup);
     NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
@@ -1538,7 +1538,7 @@ void try_send(NetSocket *s)
     }
 }
 
-static int sk_net_write(Socket sock, const void *buf, int len)
+static int sk_net_write(Socket *sock, const void *buf, int len)
 {
     NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
 
@@ -1558,7 +1558,7 @@ static int sk_net_write(Socket sock, const void *buf, int len)
     return bufchain_size(&s->output_data);
 }
 
-static int sk_net_write_oob(Socket sock, const void *buf, int len)
+static int sk_net_write_oob(Socket *sock, const void *buf, int len)
 {
     NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
 
@@ -1581,7 +1581,7 @@ static int sk_net_write_oob(Socket sock, const void *buf, int len)
     return s->sending_oob;
 }
 
-static void sk_net_write_eof(Socket sock)
+static void sk_net_write_eof(Socket *sock)
 {
     NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
 
@@ -1622,7 +1622,7 @@ void select_result(WPARAM wParam, LPARAM lParam)
 	 * plug.
 	 */
 	if (s->addr) {
-            struct SockAddr_tag thisaddr = sk_extractaddr_tmp(
+            SockAddr thisaddr = sk_extractaddr_tmp(
                 s->addr, &s->step);
 	    plug_log(s->plug, 1, &thisaddr, s->port,
 		     winsock_error_string(err), err);
@@ -1780,17 +1780,17 @@ void select_result(WPARAM wParam, LPARAM lParam)
  * if there's a problem. These functions extract an error message,
  * or return NULL if there's no problem.
  */
-const char *sk_addr_error(SockAddr addr)
+const char *sk_addr_error(SockAddr *addr)
 {
     return addr->error;
 }
-static const char *sk_net_socket_error(Socket sock)
+static const char *sk_net_socket_error(Socket *sock)
 {
     NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
     return s->error;
 }
 
-static char *sk_net_peer_info(Socket sock)
+static char *sk_net_peer_info(Socket *sock)
 {
     NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
 #ifdef NO_IPV6
@@ -1822,7 +1822,7 @@ static char *sk_net_peer_info(Socket sock)
     }
 }
 
-static void sk_net_set_frozen(Socket sock, int is_frozen)
+static void sk_net_set_frozen(Socket *sock, int is_frozen)
 {
     NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
     if (s->frozen == is_frozen)
@@ -1902,11 +1902,11 @@ char *get_hostname(void)
     return hostname;
 }
 
-SockAddr platform_get_x11_unix_address(const char *display, int displaynum,
+SockAddr *platform_get_x11_unix_address(const char *display, int displaynum,
 				       char **canonicalname)
 {
-    SockAddr ret = snew(struct SockAddr_tag);
-    memset(ret, 0, sizeof(struct SockAddr_tag));
+    SockAddr *ret = snew(SockAddr);
+    memset(ret, 0, sizeof(SockAddr));
     ret->error = "unix sockets not supported on this platform";
     ret->refcount = 1;
     return ret;

+ 9 - 9
source/putty/windows/winproxy.c

@@ -13,13 +13,13 @@
 #include "network.h"
 #include "proxy.h"
 
-Socket make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H,
-                          Plug plug, int overlapped);
+Socket *make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H,
+                           Plug *plug, int overlapped);
 
-Socket platform_new_connection(SockAddr addr, const char *hostname,
-			       int port, int privport,
-			       int oobinline, int nodelay, int keepalive,
-			       Plug plug, Conf *conf)
+Socket *platform_new_connection(SockAddr *addr, const char *hostname,
+                                int port, int privport,
+                                int oobinline, int nodelay, int keepalive,
+                                Plug *plug, Conf *conf)
 {
     char *cmd;
     HANDLE us_to_cmd, cmd_from_us;
@@ -51,14 +51,14 @@ Socket platform_new_connection(SockAddr addr, const char *hostname,
     sa.lpSecurityDescriptor = NULL;    /* default */
     sa.bInheritHandle = TRUE;
     if (!CreatePipe(&us_from_cmd, &cmd_to_us, &sa, 0)) {
-	Socket ret =
+	Socket *ret =
             new_error_socket("Unable to create pipes for proxy command", plug);
         sfree(cmd);
 	return ret;
     }
 
     if (!CreatePipe(&cmd_from_us, &us_to_cmd, &sa, 0)) {
-	Socket ret =
+	Socket *ret =
             new_error_socket("Unable to create pipes for proxy command", plug);
         sfree(cmd);
 	CloseHandle(us_from_cmd);
@@ -67,7 +67,7 @@ Socket platform_new_connection(SockAddr addr, const char *hostname,
     }
 
     if (!CreatePipe(&us_from_cmd_err, &cmd_err_to_us, &sa, 0)) {
-        Socket ret = new_error_socket
+        Socket *ret = new_error_socket
             ("Unable to create pipes for proxy command", plug);
         sfree(cmd);
         CloseHandle(us_from_cmd);

+ 7 - 7
source/putty/x11fwd.c

@@ -40,7 +40,7 @@ typedef struct X11Connection {
     char *peer_addr;
     int peer_port;
     SshChannel *c;               /* channel structure held by SSH backend */
-    Socket s;
+    Socket *s;
 
     const Plug_vtable *plugvt;
     Channel chan;
@@ -288,12 +288,12 @@ struct X11Display *x11_setup_display(const char *display, Conf *conf)
      * display (as the standard X connection libraries do).
      */
     if (!disp->unixdomain && sk_address_is_local(disp->addr)) {
-	SockAddr ux = platform_get_x11_unix_address(NULL, disp->displaynum);
+	SockAddr *ux = platform_get_x11_unix_address(NULL, disp->displaynum);
 	const char *err = sk_addr_error(ux);
 	if (!err) {
 	    /* Create trial connection to see if there is a useful Unix-domain
 	     * socket */
-	    Socket s = sk_new(sk_addr_dup(ux), 0, 0, 0, 0, 0, nullplug);
+	    Socket *s = sk_new(sk_addr_dup(ux), 0, 0, 0, 0, 0, nullplug);
 	    err = sk_socket_error(s);
 	    sk_close(s);
 	}
@@ -622,7 +622,7 @@ void x11_get_auth_from_authfile(struct X11Display *disp,
     sfree(ourhostname);
 }
 
-static void x11_log(Plug p, int type, SockAddr addr, int port,
+static void x11_log(Plug *p, int type, SockAddr *addr, int port,
 		    const char *error_msg, int error_code)
 {
     /* We have no interface to the logging module here, so we drop these. */
@@ -631,7 +631,7 @@ static void x11_log(Plug p, int type, SockAddr addr, int port,
 static void x11_send_init_error(struct X11Connection *conn,
                                 const char *err_message);
 
-static void x11_closing(Plug plug, const char *error_msg, int error_code,
+static void x11_closing(Plug *plug, const char *error_msg, int error_code,
 			int calling_back)
 {
     struct X11Connection *xconn = FROMFIELD(
@@ -664,7 +664,7 @@ static void x11_closing(Plug plug, const char *error_msg, int error_code,
     }
 }
 
-static void x11_receive(Plug plug, int urgent, char *data, int len)
+static void x11_receive(Plug *plug, int urgent, char *data, int len)
 {
     struct X11Connection *xconn = FROMFIELD(
         plug, struct X11Connection, plugvt);
@@ -673,7 +673,7 @@ static void x11_receive(Plug plug, int urgent, char *data, int len)
     sshfwd_write(xconn->c, data, len);
 }
 
-static void x11_sent(Plug plug, int bufsize)
+static void x11_sent(Plug *plug, int bufsize)
 {
     struct X11Connection *xconn = FROMFIELD(
         plug, struct X11Connection, plugvt);