mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-08 08:58:00 +00:00
Get rid of lots of implicit pointer types.
All the main backend structures - Ssh, Telnet, Pty, Serial etc - now describe structure types themselves rather than pointers to them. The same goes for the codebase-wide trait types Socket and Plug, and the supporting types SockAddr and Pinger. All those things that were typedefed as pointers are older types; the newer ones have the explicit * at the point of use, because that's what I now seem to be preferring. But whichever one of those is better, inconsistently using a mixture of the two styles is worse, so let's make everything consistent. A few types are still implicitly pointers, such as Bignum and some of the GSSAPI types; generally this is either because they have to be void *, or because they're typedefed differently on different platforms and aren't always pointers at all. Can't be helped. But I've got rid of the main ones, at least.
This commit is contained in:
parent
bf61af1919
commit
96ec2c2500
@ -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;
|
||||
|
@ -24,7 +24,7 @@ sel *asel;
|
||||
sel_rfd *netr, *ptyr, *sigr;
|
||||
int ptyfd;
|
||||
sel_wfd *netw, *ptyw;
|
||||
Telnet telnet;
|
||||
Telnet *telnet;
|
||||
|
||||
#define BUF 65536
|
||||
|
||||
|
@ -172,7 +172,7 @@ static const struct Opt *const opts[] = {
|
||||
&o_echo, &o_we_sga, &o_they_sga, &o_naws, &o_ttype, &o_oenv, &o_nenv, NULL
|
||||
};
|
||||
|
||||
struct telnet_tag {
|
||||
struct Telnet {
|
||||
int opt_states[NUM_OPTS];
|
||||
|
||||
int sb_opt, sb_len;
|
||||
@ -203,7 +203,7 @@ struct telnet_tag {
|
||||
|
||||
#define SB_DELTA 1024
|
||||
|
||||
static void send_opt(Telnet telnet, int cmd, int option)
|
||||
static void send_opt(Telnet *telnet, int cmd, int option)
|
||||
{
|
||||
unsigned char b[3];
|
||||
|
||||
@ -213,7 +213,7 @@ static void send_opt(Telnet telnet, int cmd, int option)
|
||||
sel_write(telnet->net, b, 3);
|
||||
}
|
||||
|
||||
static void deactivate_option(Telnet telnet, const struct Opt *o)
|
||||
static void deactivate_option(Telnet *telnet, const struct Opt *o)
|
||||
{
|
||||
if (telnet->opt_states[o->index] == REQUESTED ||
|
||||
telnet->opt_states[o->index] == ACTIVE)
|
||||
@ -224,11 +224,11 @@ static void deactivate_option(Telnet telnet, const struct Opt *o)
|
||||
/*
|
||||
* Generate side effects of enabling or disabling an option.
|
||||
*/
|
||||
static void option_side_effects(Telnet telnet, const struct Opt *o, int enabled)
|
||||
static void option_side_effects(Telnet *telnet, const struct Opt *o, int enabled)
|
||||
{
|
||||
}
|
||||
|
||||
static void activate_option(Telnet telnet, const struct Opt *o)
|
||||
static void activate_option(Telnet *telnet, const struct Opt *o)
|
||||
{
|
||||
if (o->option == TELOPT_NEW_ENVIRON ||
|
||||
o->option == TELOPT_OLD_ENVIRON ||
|
||||
@ -245,7 +245,7 @@ static void activate_option(Telnet telnet, const struct Opt *o)
|
||||
option_side_effects(telnet, o, 1);
|
||||
}
|
||||
|
||||
static void done_option(Telnet telnet, int option)
|
||||
static void done_option(Telnet *telnet, int option)
|
||||
{
|
||||
if (option == TELOPT_OLD_ENVIRON)
|
||||
telnet->old_environ_done = 1;
|
||||
@ -260,7 +260,7 @@ static void done_option(Telnet telnet, int option)
|
||||
}
|
||||
}
|
||||
|
||||
static void refused_option(Telnet telnet, const struct Opt *o)
|
||||
static void refused_option(Telnet *telnet, const struct Opt *o)
|
||||
{
|
||||
done_option(telnet, o->option);
|
||||
if (o->send == WILL && o->option == TELOPT_NEW_ENVIRON &&
|
||||
@ -272,7 +272,7 @@ static void refused_option(Telnet telnet, const struct Opt *o)
|
||||
option_side_effects(telnet, o, 0);
|
||||
}
|
||||
|
||||
static void proc_rec_opt(Telnet telnet, int cmd, int option)
|
||||
static void proc_rec_opt(Telnet *telnet, int cmd, int option)
|
||||
{
|
||||
const struct Opt *const *o;
|
||||
|
||||
@ -323,7 +323,7 @@ static void proc_rec_opt(Telnet telnet, int cmd, int option)
|
||||
send_opt(telnet, (cmd == WILL ? DONT : WONT), option);
|
||||
}
|
||||
|
||||
static void process_subneg(Telnet telnet)
|
||||
static void process_subneg(Telnet *telnet)
|
||||
{
|
||||
int var, value, n;
|
||||
|
||||
@ -400,7 +400,7 @@ static void process_subneg(Telnet telnet)
|
||||
}
|
||||
}
|
||||
|
||||
void telnet_from_net(Telnet telnet, char *buf, int len)
|
||||
void telnet_from_net(Telnet *telnet, char *buf, int len)
|
||||
{
|
||||
while (len--) {
|
||||
int c = (unsigned char) *buf++;
|
||||
@ -497,11 +497,11 @@ void telnet_from_net(Telnet telnet, char *buf, int len)
|
||||
}
|
||||
}
|
||||
|
||||
Telnet telnet_new(sel_wfd *net, sel_wfd *pty)
|
||||
Telnet *telnet_new(sel_wfd *net, sel_wfd *pty)
|
||||
{
|
||||
Telnet telnet;
|
||||
Telnet *telnet;
|
||||
|
||||
telnet = snew(struct telnet_tag);
|
||||
telnet = snew(Telnet);
|
||||
telnet->sb_buf = NULL;
|
||||
telnet->sb_size = 0;
|
||||
telnet->state = TOP_LEVEL;
|
||||
@ -532,13 +532,13 @@ Telnet telnet_new(sel_wfd *net, sel_wfd *pty)
|
||||
return telnet;
|
||||
}
|
||||
|
||||
void telnet_free(Telnet telnet)
|
||||
void telnet_free(Telnet *telnet)
|
||||
{
|
||||
sfree(telnet->sb_buf);
|
||||
sfree(telnet);
|
||||
}
|
||||
|
||||
void telnet_from_pty(Telnet telnet, char *buf, int len)
|
||||
void telnet_from_pty(Telnet *telnet, char *buf, int len)
|
||||
{
|
||||
unsigned char *p, *end;
|
||||
static const unsigned char iac[2] = { IAC, IAC };
|
||||
@ -563,7 +563,7 @@ void telnet_from_pty(Telnet telnet, char *buf, int len)
|
||||
}
|
||||
}
|
||||
|
||||
int telnet_shell_ok(Telnet telnet, struct shell_data *shdata)
|
||||
int telnet_shell_ok(Telnet *telnet, struct shell_data *shdata)
|
||||
{
|
||||
if (telnet->shell_ok)
|
||||
*shdata = telnet->shdata; /* structure copy */
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "sel.h"
|
||||
|
||||
typedef struct telnet_tag *Telnet;
|
||||
typedef struct Telnet Telnet;
|
||||
|
||||
struct shell_data {
|
||||
char **envvars; /* array of "VAR=value" terms */
|
||||
@ -18,24 +18,24 @@ struct shell_data {
|
||||
/*
|
||||
* Create and destroy a Telnet structure.
|
||||
*/
|
||||
Telnet telnet_new(sel_wfd *net, sel_wfd *pty);
|
||||
void telnet_free(Telnet telnet);
|
||||
Telnet *telnet_new(sel_wfd *net, sel_wfd *pty);
|
||||
void telnet_free(Telnet *telnet);
|
||||
|
||||
/*
|
||||
* Process data read from the pty.
|
||||
*/
|
||||
void telnet_from_pty(Telnet telnet, char *buf, int len);
|
||||
void telnet_from_pty(Telnet *telnet, char *buf, int len);
|
||||
|
||||
/*
|
||||
* Process Telnet protocol data received from the network.
|
||||
*/
|
||||
void telnet_from_net(Telnet telnet, char *buf, int len);
|
||||
void telnet_from_net(Telnet *telnet, char *buf, int len);
|
||||
|
||||
/*
|
||||
* Return true if pre-shell-startup negotiations are complete and
|
||||
* it's safe to start the shell subprocess now. On a true return,
|
||||
* also fills in the shell_data structure.
|
||||
*/
|
||||
int telnet_shell_ok(Telnet telnet, struct shell_data *shdata);
|
||||
int telnet_shell_ok(Telnet *telnet, struct shell_data *shdata);
|
||||
|
||||
#endif /* FIXME_TELNET_H */
|
||||
|
14
defs.h
14
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
|
||||
|
14
errsock.c
14
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;
|
||||
|
98
network.h
98
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
|
||||
|
@ -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)
|
||||
{
|
||||
|
10
nullplug.c
10
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;
|
||||
|
18
pageant.c
18
pageant.c
@ -699,7 +699,7 @@ int pageant_delete_ssh2_key(struct ssh2_userkey *skey)
|
||||
} while (0)
|
||||
|
||||
struct pageant_conn_state {
|
||||
Socket connsock;
|
||||
Socket *connsock;
|
||||
void *logctx;
|
||||
pageant_logfn_t logfn;
|
||||
unsigned char lenbuf[4], pktbuf[AGENT_MAX_MSGLEN];
|
||||
@ -710,7 +710,7 @@ struct pageant_conn_state {
|
||||
const Plug_vtable *plugvt;
|
||||
};
|
||||
|
||||
static void pageant_conn_closing(Plug plug, const char *error_msg,
|
||||
static void pageant_conn_closing(Plug *plug, const char *error_msg,
|
||||
int error_code, int calling_back)
|
||||
{
|
||||
struct pageant_conn_state *pc = FROMFIELD(
|
||||
@ -723,7 +723,7 @@ static void pageant_conn_closing(Plug plug, const char *error_msg,
|
||||
sfree(pc);
|
||||
}
|
||||
|
||||
static void pageant_conn_sent(Plug plug, int bufsize)
|
||||
static void pageant_conn_sent(Plug *plug, int bufsize)
|
||||
{
|
||||
/* struct pageant_conn_state *pc = FROMFIELD(
|
||||
plug, struct pageant_conn_state, plugvt); */
|
||||
@ -745,7 +745,7 @@ static void pageant_conn_log(void *logctx, const char *fmt, va_list ap)
|
||||
sfree(formatted);
|
||||
}
|
||||
|
||||
static void pageant_conn_receive(Plug plug, int urgent, char *data, int len)
|
||||
static void pageant_conn_receive(Plug *plug, int urgent, char *data, int len)
|
||||
{
|
||||
struct pageant_conn_state *pc = FROMFIELD(
|
||||
plug, struct pageant_conn_state, plugvt);
|
||||
@ -797,14 +797,14 @@ static void pageant_conn_receive(Plug plug, int urgent, char *data, int len)
|
||||
}
|
||||
|
||||
struct pageant_listen_state {
|
||||
Socket listensock;
|
||||
Socket *listensock;
|
||||
void *logctx;
|
||||
pageant_logfn_t logfn;
|
||||
|
||||
const Plug_vtable *plugvt;
|
||||
};
|
||||
|
||||
static void pageant_listen_closing(Plug plug, const char *error_msg,
|
||||
static void pageant_listen_closing(Plug *plug, const char *error_msg,
|
||||
int error_code, int calling_back)
|
||||
{
|
||||
struct pageant_listen_state *pl = FROMFIELD(
|
||||
@ -823,7 +823,7 @@ static const Plug_vtable pageant_connection_plugvt = {
|
||||
NULL /* no accepting function, because we've already done it */
|
||||
};
|
||||
|
||||
static int pageant_listen_accepting(Plug plug,
|
||||
static int pageant_listen_accepting(Plug *plug,
|
||||
accept_fn_t constructor, accept_ctx_t ctx)
|
||||
{
|
||||
struct pageant_listen_state *pl = FROMFIELD(
|
||||
@ -866,7 +866,7 @@ static const Plug_vtable pageant_listener_plugvt = {
|
||||
pageant_listen_accepting
|
||||
};
|
||||
|
||||
struct pageant_listen_state *pageant_listener_new(Plug *plug)
|
||||
struct pageant_listen_state *pageant_listener_new(Plug **plug)
|
||||
{
|
||||
struct pageant_listen_state *pl = snew(struct pageant_listen_state);
|
||||
pl->plugvt = &pageant_listener_plugvt;
|
||||
@ -877,7 +877,7 @@ struct pageant_listen_state *pageant_listener_new(Plug *plug)
|
||||
return pl;
|
||||
}
|
||||
|
||||
void pageant_listener_got_socket(struct pageant_listen_state *pl, Socket sock)
|
||||
void pageant_listener_got_socket(struct pageant_listen_state *pl, Socket *sock)
|
||||
{
|
||||
pl->listensock = sock;
|
||||
}
|
||||
|
@ -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);
|
||||
|
16
pinger.c
16
pinger.c
@ -5,18 +5,18 @@
|
||||
|
||||
#include "putty.h"
|
||||
|
||||
struct pinger_tag {
|
||||
struct Pinger {
|
||||
int interval;
|
||||
int pending;
|
||||
unsigned long when_set, next;
|
||||
Backend *backend;
|
||||
};
|
||||
|
||||
static void pinger_schedule(Pinger pinger);
|
||||
static void pinger_schedule(Pinger *pinger);
|
||||
|
||||
static void pinger_timer(void *ctx, unsigned long now)
|
||||
{
|
||||
Pinger pinger = (Pinger)ctx;
|
||||
Pinger *pinger = (Pinger *)ctx;
|
||||
|
||||
if (pinger->pending && now == pinger->next) {
|
||||
backend_special(pinger->backend, SS_PING, 0);
|
||||
@ -25,7 +25,7 @@ static void pinger_timer(void *ctx, unsigned long now)
|
||||
}
|
||||
}
|
||||
|
||||
static void pinger_schedule(Pinger pinger)
|
||||
static void pinger_schedule(Pinger *pinger)
|
||||
{
|
||||
unsigned long next;
|
||||
|
||||
@ -44,9 +44,9 @@ static void pinger_schedule(Pinger pinger)
|
||||
}
|
||||
}
|
||||
|
||||
Pinger pinger_new(Conf *conf, Backend *backend)
|
||||
Pinger *pinger_new(Conf *conf, Backend *backend)
|
||||
{
|
||||
Pinger pinger = snew(struct pinger_tag);
|
||||
Pinger *pinger = snew(Pinger);
|
||||
|
||||
pinger->interval = conf_get_int(conf, CONF_ping_interval);
|
||||
pinger->pending = FALSE;
|
||||
@ -56,7 +56,7 @@ Pinger pinger_new(Conf *conf, Backend *backend)
|
||||
return pinger;
|
||||
}
|
||||
|
||||
void pinger_reconfig(Pinger pinger, Conf *oldconf, Conf *newconf)
|
||||
void pinger_reconfig(Pinger *pinger, Conf *oldconf, Conf *newconf)
|
||||
{
|
||||
int newinterval = conf_get_int(newconf, CONF_ping_interval);
|
||||
if (conf_get_int(oldconf, CONF_ping_interval) != newinterval) {
|
||||
@ -65,7 +65,7 @@ void pinger_reconfig(Pinger pinger, Conf *oldconf, Conf *newconf)
|
||||
}
|
||||
}
|
||||
|
||||
void pinger_free(Pinger pinger)
|
||||
void pinger_free(Pinger *pinger)
|
||||
{
|
||||
expire_timer_context(pinger);
|
||||
sfree(pinger);
|
||||
|
24
portfwd.c
24
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;
|
||||
|
8
pproxy.c
8
pproxy.c
@ -8,10 +8,10 @@
|
||||
#include "network.h"
|
||||
#include "proxy.h"
|
||||
|
||||
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)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
50
proxy.c
50
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;
|
||||
|
8
proxy.h
8
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
|
||||
|
8
putty.h
8
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.
|
||||
|
47
raw.c
47
raw.c
@ -10,8 +10,9 @@
|
||||
|
||||
#define RAW_MAX_BACKLOG 4096
|
||||
|
||||
typedef struct raw_backend_data {
|
||||
Socket s;
|
||||
typedef struct Raw Raw;
|
||||
struct Raw {
|
||||
Socket *s;
|
||||
int closed_on_socket_error;
|
||||
int bufsize;
|
||||
Frontend *frontend;
|
||||
@ -21,25 +22,25 @@ typedef struct raw_backend_data {
|
||||
|
||||
const Plug_vtable *plugvt;
|
||||
Backend backend;
|
||||
} *Raw;
|
||||
};
|
||||
|
||||
static void raw_size(Backend *be, int width, int height);
|
||||
|
||||
static void c_write(Raw raw, const void *buf, int len)
|
||||
static void c_write(Raw *raw, const void *buf, int len)
|
||||
{
|
||||
int backlog = from_backend(raw->frontend, 0, buf, len);
|
||||
sk_set_frozen(raw->s, backlog > RAW_MAX_BACKLOG);
|
||||
}
|
||||
|
||||
static void raw_log(Plug plug, int type, SockAddr addr, int port,
|
||||
static void raw_log(Plug *plug, int type, SockAddr *addr, int port,
|
||||
const char *error_msg, int error_code)
|
||||
{
|
||||
Raw raw = FROMFIELD(plug, struct raw_backend_data, plugvt);
|
||||
Raw *raw = FROMFIELD(plug, Raw, plugvt);
|
||||
backend_socket_log(raw->frontend, type, addr, port,
|
||||
error_msg, error_code, raw->conf, raw->session_started);
|
||||
}
|
||||
|
||||
static void raw_check_close(Raw raw)
|
||||
static void raw_check_close(Raw *raw)
|
||||
{
|
||||
/*
|
||||
* Called after we send EOF on either the socket or the console.
|
||||
@ -54,10 +55,10 @@ static void raw_check_close(Raw raw)
|
||||
}
|
||||
}
|
||||
|
||||
static void raw_closing(Plug plug, const char *error_msg, int error_code,
|
||||
static void raw_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
int calling_back)
|
||||
{
|
||||
Raw raw = FROMFIELD(plug, struct raw_backend_data, plugvt);
|
||||
Raw *raw = FROMFIELD(plug, Raw, plugvt);
|
||||
|
||||
if (error_msg) {
|
||||
/* A socket error has occurred. */
|
||||
@ -87,18 +88,18 @@ static void raw_closing(Plug plug, const char *error_msg, int error_code,
|
||||
}
|
||||
}
|
||||
|
||||
static void raw_receive(Plug plug, int urgent, char *data, int len)
|
||||
static void raw_receive(Plug *plug, int urgent, char *data, int len)
|
||||
{
|
||||
Raw raw = FROMFIELD(plug, struct raw_backend_data, plugvt);
|
||||
Raw *raw = FROMFIELD(plug, Raw, plugvt);
|
||||
c_write(raw, data, len);
|
||||
/* We count 'session start', for proxy logging purposes, as being
|
||||
* when data is received from the network and printed. */
|
||||
raw->session_started = TRUE;
|
||||
}
|
||||
|
||||
static void raw_sent(Plug plug, int bufsize)
|
||||
static void raw_sent(Plug *plug, int bufsize)
|
||||
{
|
||||
Raw raw = FROMFIELD(plug, struct raw_backend_data, plugvt);
|
||||
Raw *raw = FROMFIELD(plug, Raw, plugvt);
|
||||
raw->bufsize = bufsize;
|
||||
}
|
||||
|
||||
@ -122,13 +123,13 @@ static const char *raw_init(Frontend *frontend, Backend **backend_handle,
|
||||
const char *host, int port, char **realhost,
|
||||
int nodelay, int keepalive)
|
||||
{
|
||||
SockAddr addr;
|
||||
SockAddr *addr;
|
||||
const char *err;
|
||||
Raw raw;
|
||||
Raw *raw;
|
||||
int addressfamily;
|
||||
char *loghost;
|
||||
|
||||
raw = snew(struct raw_backend_data);
|
||||
raw = snew(Raw);
|
||||
raw->plugvt = &Raw_plugvt;
|
||||
raw->backend.vt = &raw_backend;
|
||||
raw->s = NULL;
|
||||
@ -180,7 +181,7 @@ static const char *raw_init(Frontend *frontend, Backend **backend_handle,
|
||||
|
||||
static void raw_free(Backend *be)
|
||||
{
|
||||
Raw raw = FROMFIELD(be, struct raw_backend_data, backend);
|
||||
Raw *raw = FROMFIELD(be, Raw, backend);
|
||||
|
||||
if (raw->s)
|
||||
sk_close(raw->s);
|
||||
@ -200,7 +201,7 @@ static void raw_reconfig(Backend *be, Conf *conf)
|
||||
*/
|
||||
static int raw_send(Backend *be, const char *buf, int len)
|
||||
{
|
||||
Raw raw = FROMFIELD(be, struct raw_backend_data, backend);
|
||||
Raw *raw = FROMFIELD(be, Raw, backend);
|
||||
|
||||
if (raw->s == NULL)
|
||||
return 0;
|
||||
@ -215,7 +216,7 @@ static int raw_send(Backend *be, const char *buf, int len)
|
||||
*/
|
||||
static int raw_sendbuffer(Backend *be)
|
||||
{
|
||||
Raw raw = FROMFIELD(be, struct raw_backend_data, backend);
|
||||
Raw *raw = FROMFIELD(be, Raw, backend);
|
||||
return raw->bufsize;
|
||||
}
|
||||
|
||||
@ -233,7 +234,7 @@ static void raw_size(Backend *be, int width, int height)
|
||||
*/
|
||||
static void raw_special(Backend *be, SessionSpecialCode code, int arg)
|
||||
{
|
||||
Raw raw = FROMFIELD(be, struct raw_backend_data, backend);
|
||||
Raw *raw = FROMFIELD(be, Raw, backend);
|
||||
if (code == SS_EOF && raw->s) {
|
||||
sk_write_eof(raw->s);
|
||||
raw->sent_socket_eof= TRUE;
|
||||
@ -254,7 +255,7 @@ static const SessionSpecial *raw_get_specials(Backend *be)
|
||||
|
||||
static int raw_connected(Backend *be)
|
||||
{
|
||||
Raw raw = FROMFIELD(be, struct raw_backend_data, backend);
|
||||
Raw *raw = FROMFIELD(be, Raw, backend);
|
||||
return raw->s != NULL;
|
||||
}
|
||||
|
||||
@ -265,7 +266,7 @@ static int raw_sendok(Backend *be)
|
||||
|
||||
static void raw_unthrottle(Backend *be, int backlog)
|
||||
{
|
||||
Raw raw = FROMFIELD(be, struct raw_backend_data, backend);
|
||||
Raw *raw = FROMFIELD(be, Raw, backend);
|
||||
sk_set_frozen(raw->s, backlog > RAW_MAX_BACKLOG);
|
||||
}
|
||||
|
||||
@ -288,7 +289,7 @@ static void raw_provide_logctx(Backend *be, LogContext *logctx)
|
||||
|
||||
static int raw_exitcode(Backend *be)
|
||||
{
|
||||
Raw raw = FROMFIELD(be, struct raw_backend_data, backend);
|
||||
Raw *raw = FROMFIELD(be, Raw, backend);
|
||||
if (raw->s != NULL)
|
||||
return -1; /* still connected */
|
||||
else if (raw->closed_on_socket_error)
|
||||
|
51
rlogin.c
51
rlogin.c
@ -11,8 +11,9 @@
|
||||
|
||||
#define RLOGIN_MAX_BACKLOG 4096
|
||||
|
||||
typedef struct rlogin_tag {
|
||||
Socket s;
|
||||
typedef struct Rlogin Rlogin;
|
||||
struct Rlogin {
|
||||
Socket *s;
|
||||
int closed_on_socket_error;
|
||||
int bufsize;
|
||||
int firstbyte;
|
||||
@ -27,27 +28,27 @@ typedef struct rlogin_tag {
|
||||
|
||||
const Plug_vtable *plugvt;
|
||||
Backend backend;
|
||||
} *Rlogin;
|
||||
};
|
||||
|
||||
static void c_write(Rlogin rlogin, const void *buf, int len)
|
||||
static void c_write(Rlogin *rlogin, const void *buf, int len)
|
||||
{
|
||||
int backlog = from_backend(rlogin->frontend, 0, buf, len);
|
||||
sk_set_frozen(rlogin->s, backlog > RLOGIN_MAX_BACKLOG);
|
||||
}
|
||||
|
||||
static void rlogin_log(Plug plug, int type, SockAddr addr, int port,
|
||||
static void rlogin_log(Plug *plug, int type, SockAddr *addr, int port,
|
||||
const char *error_msg, int error_code)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(plug, struct rlogin_tag, plugvt);
|
||||
Rlogin *rlogin = FROMFIELD(plug, Rlogin, plugvt);
|
||||
backend_socket_log(rlogin->frontend, type, addr, port,
|
||||
error_msg, error_code,
|
||||
rlogin->conf, !rlogin->firstbyte);
|
||||
}
|
||||
|
||||
static void rlogin_closing(Plug plug, const char *error_msg, int error_code,
|
||||
static void rlogin_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
int calling_back)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(plug, struct rlogin_tag, plugvt);
|
||||
Rlogin *rlogin = FROMFIELD(plug, Rlogin, plugvt);
|
||||
|
||||
/*
|
||||
* We don't implement independent EOF in each direction for Telnet
|
||||
@ -69,9 +70,9 @@ static void rlogin_closing(Plug plug, const char *error_msg, int error_code,
|
||||
} /* Otherwise, the remote side closed the connection normally. */
|
||||
}
|
||||
|
||||
static void rlogin_receive(Plug plug, int urgent, char *data, int len)
|
||||
static void rlogin_receive(Plug *plug, int urgent, char *data, int len)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(plug, struct rlogin_tag, plugvt);
|
||||
Rlogin *rlogin = FROMFIELD(plug, Rlogin, plugvt);
|
||||
if (urgent == 2) {
|
||||
char c;
|
||||
|
||||
@ -106,13 +107,13 @@ static void rlogin_receive(Plug plug, int urgent, char *data, int len)
|
||||
}
|
||||
}
|
||||
|
||||
static void rlogin_sent(Plug plug, int bufsize)
|
||||
static void rlogin_sent(Plug *plug, int bufsize)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(plug, struct rlogin_tag, plugvt);
|
||||
Rlogin *rlogin = FROMFIELD(plug, Rlogin, plugvt);
|
||||
rlogin->bufsize = bufsize;
|
||||
}
|
||||
|
||||
static void rlogin_startup(Rlogin rlogin, const char *ruser)
|
||||
static void rlogin_startup(Rlogin *rlogin, const char *ruser)
|
||||
{
|
||||
char z = 0;
|
||||
char *p;
|
||||
@ -153,14 +154,14 @@ static const char *rlogin_init(Frontend *frontend, Backend **backend_handle,
|
||||
const char *host, int port, char **realhost,
|
||||
int nodelay, int keepalive)
|
||||
{
|
||||
SockAddr addr;
|
||||
SockAddr *addr;
|
||||
const char *err;
|
||||
Rlogin rlogin;
|
||||
Rlogin *rlogin;
|
||||
char *ruser;
|
||||
int addressfamily;
|
||||
char *loghost;
|
||||
|
||||
rlogin = snew(struct rlogin_tag);
|
||||
rlogin = snew(Rlogin);
|
||||
rlogin->plugvt = &Rlogin_plugvt;
|
||||
rlogin->backend.vt = &rlogin_backend;
|
||||
rlogin->s = NULL;
|
||||
@ -235,7 +236,7 @@ static const char *rlogin_init(Frontend *frontend, Backend **backend_handle,
|
||||
|
||||
static void rlogin_free(Backend *be)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(be, struct rlogin_tag, backend);
|
||||
Rlogin *rlogin = FROMFIELD(be, Rlogin, backend);
|
||||
|
||||
if (rlogin->prompt)
|
||||
free_prompts(rlogin->prompt);
|
||||
@ -257,7 +258,7 @@ static void rlogin_reconfig(Backend *be, Conf *conf)
|
||||
*/
|
||||
static int rlogin_send(Backend *be, const char *buf, int len)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(be, struct rlogin_tag, backend);
|
||||
Rlogin *rlogin = FROMFIELD(be, Rlogin, backend);
|
||||
bufchain bc;
|
||||
|
||||
if (rlogin->s == NULL)
|
||||
@ -299,7 +300,7 @@ static int rlogin_send(Backend *be, const char *buf, int len)
|
||||
*/
|
||||
static int rlogin_sendbuffer(Backend *be)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(be, struct rlogin_tag, backend);
|
||||
Rlogin *rlogin = FROMFIELD(be, Rlogin, backend);
|
||||
return rlogin->bufsize;
|
||||
}
|
||||
|
||||
@ -308,7 +309,7 @@ static int rlogin_sendbuffer(Backend *be)
|
||||
*/
|
||||
static void rlogin_size(Backend *be, int width, int height)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(be, struct rlogin_tag, backend);
|
||||
Rlogin *rlogin = FROMFIELD(be, Rlogin, backend);
|
||||
char b[12] = { '\xFF', '\xFF', 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
rlogin->term_width = width;
|
||||
@ -345,25 +346,25 @@ static const SessionSpecial *rlogin_get_specials(Backend *be)
|
||||
|
||||
static int rlogin_connected(Backend *be)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(be, struct rlogin_tag, backend);
|
||||
Rlogin *rlogin = FROMFIELD(be, Rlogin, backend);
|
||||
return rlogin->s != NULL;
|
||||
}
|
||||
|
||||
static int rlogin_sendok(Backend *be)
|
||||
{
|
||||
/* Rlogin rlogin = FROMFIELD(be, struct rlogin_tag, backend); */
|
||||
/* Rlogin *rlogin = FROMFIELD(be, Rlogin, backend); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void rlogin_unthrottle(Backend *be, int backlog)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(be, struct rlogin_tag, backend);
|
||||
Rlogin *rlogin = FROMFIELD(be, Rlogin, backend);
|
||||
sk_set_frozen(rlogin->s, backlog > RLOGIN_MAX_BACKLOG);
|
||||
}
|
||||
|
||||
static int rlogin_ldisc(Backend *be, int option)
|
||||
{
|
||||
/* Rlogin rlogin = FROMFIELD(be, struct rlogin_tag, backend); */
|
||||
/* Rlogin *rlogin = FROMFIELD(be, Rlogin, backend); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -379,7 +380,7 @@ static void rlogin_provide_logctx(Backend *be, LogContext *logctx)
|
||||
|
||||
static int rlogin_exitcode(Backend *be)
|
||||
{
|
||||
Rlogin rlogin = FROMFIELD(be, struct rlogin_tag, backend);
|
||||
Rlogin *rlogin = FROMFIELD(be, Rlogin, backend);
|
||||
if (rlogin->s != NULL)
|
||||
return -1; /* still connected */
|
||||
else if (rlogin->closed_on_socket_error)
|
||||
|
106
ssh.c
106
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;
|
||||
}
|
||||
|
32
ssh.h
32
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);
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
2
sshbpp.h
2
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
|
||||
|
6
sshppl.h
6
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
|
||||
|
24
sshshare.c
24
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))
|
||||
|
75
telnet.c
75
telnet.c
@ -168,8 +168,9 @@ static const struct Opt *const opts[] = {
|
||||
&o_we_sga, &o_they_sga, &o_we_bin, &o_they_bin, NULL
|
||||
};
|
||||
|
||||
typedef struct telnet_tag {
|
||||
Socket s;
|
||||
typedef struct Telnet Telnet;
|
||||
struct Telnet {
|
||||
Socket *s;
|
||||
int closed_on_socket_error;
|
||||
|
||||
Frontend *frontend;
|
||||
@ -194,24 +195,24 @@ typedef struct telnet_tag {
|
||||
|
||||
Conf *conf;
|
||||
|
||||
Pinger pinger;
|
||||
Pinger *pinger;
|
||||
|
||||
const Plug_vtable *plugvt;
|
||||
Backend backend;
|
||||
} *Telnet;
|
||||
};
|
||||
|
||||
#define TELNET_MAX_BACKLOG 4096
|
||||
|
||||
#define SB_DELTA 1024
|
||||
|
||||
static void c_write(Telnet telnet, const void *buf, int len)
|
||||
static void c_write(Telnet *telnet, const void *buf, int len)
|
||||
{
|
||||
int backlog;
|
||||
backlog = from_backend(telnet->frontend, 0, buf, len);
|
||||
sk_set_frozen(telnet->s, backlog > TELNET_MAX_BACKLOG);
|
||||
}
|
||||
|
||||
static void log_option(Telnet telnet, const char *sender, int cmd, int option)
|
||||
static void log_option(Telnet *telnet, const char *sender, int cmd, int option)
|
||||
{
|
||||
char *buf;
|
||||
/*
|
||||
@ -227,7 +228,7 @@ static void log_option(Telnet telnet, const char *sender, int cmd, int option)
|
||||
sfree(buf);
|
||||
}
|
||||
|
||||
static void send_opt(Telnet telnet, int cmd, int option)
|
||||
static void send_opt(Telnet *telnet, int cmd, int option)
|
||||
{
|
||||
unsigned char b[3];
|
||||
|
||||
@ -238,7 +239,7 @@ static void send_opt(Telnet telnet, int cmd, int option)
|
||||
log_option(telnet, "client", cmd, option);
|
||||
}
|
||||
|
||||
static void deactivate_option(Telnet telnet, const struct Opt *o)
|
||||
static void deactivate_option(Telnet *telnet, const struct Opt *o)
|
||||
{
|
||||
if (telnet->opt_states[o->index] == REQUESTED ||
|
||||
telnet->opt_states[o->index] == ACTIVE)
|
||||
@ -249,7 +250,7 @@ static void deactivate_option(Telnet telnet, const struct Opt *o)
|
||||
/*
|
||||
* Generate side effects of enabling or disabling an option.
|
||||
*/
|
||||
static void option_side_effects(Telnet telnet, const struct Opt *o, int enabled)
|
||||
static void option_side_effects(Telnet *telnet, const struct Opt *o, int enabled)
|
||||
{
|
||||
if (o->option == TELOPT_ECHO && o->send == DO)
|
||||
telnet->echoing = !enabled;
|
||||
@ -276,7 +277,7 @@ static void option_side_effects(Telnet telnet, const struct Opt *o, int enabled)
|
||||
}
|
||||
}
|
||||
|
||||
static void activate_option(Telnet telnet, const struct Opt *o)
|
||||
static void activate_option(Telnet *telnet, const struct Opt *o)
|
||||
{
|
||||
if (o->send == WILL && o->option == TELOPT_NAWS)
|
||||
backend_size(&telnet->backend,
|
||||
@ -294,7 +295,7 @@ static void activate_option(Telnet telnet, const struct Opt *o)
|
||||
option_side_effects(telnet, o, 1);
|
||||
}
|
||||
|
||||
static void refused_option(Telnet telnet, const struct Opt *o)
|
||||
static void refused_option(Telnet *telnet, const struct Opt *o)
|
||||
{
|
||||
if (o->send == WILL && o->option == TELOPT_NEW_ENVIRON &&
|
||||
telnet->opt_states[o_oenv.index] == INACTIVE) {
|
||||
@ -304,7 +305,7 @@ static void refused_option(Telnet telnet, const struct Opt *o)
|
||||
option_side_effects(telnet, o, 0);
|
||||
}
|
||||
|
||||
static void proc_rec_opt(Telnet telnet, int cmd, int option)
|
||||
static void proc_rec_opt(Telnet *telnet, int cmd, int option)
|
||||
{
|
||||
const struct Opt *const *o;
|
||||
|
||||
@ -356,7 +357,7 @@ static void proc_rec_opt(Telnet telnet, int cmd, int option)
|
||||
send_opt(telnet, (cmd == WILL ? DONT : WONT), option);
|
||||
}
|
||||
|
||||
static void process_subneg(Telnet telnet)
|
||||
static void process_subneg(Telnet *telnet)
|
||||
{
|
||||
unsigned char *b, *p, *q;
|
||||
int var, value, n, bsize;
|
||||
@ -523,7 +524,7 @@ static void process_subneg(Telnet telnet)
|
||||
}
|
||||
}
|
||||
|
||||
static void do_telnet_read(Telnet telnet, char *buf, int len)
|
||||
static void do_telnet_read(Telnet *telnet, char *buf, int len)
|
||||
{
|
||||
char *outbuf = NULL;
|
||||
int outbuflen = 0, outbufsize = 0;
|
||||
@ -641,19 +642,19 @@ static void do_telnet_read(Telnet telnet, char *buf, int len)
|
||||
sfree(outbuf);
|
||||
}
|
||||
|
||||
static void telnet_log(Plug plug, int type, SockAddr addr, int port,
|
||||
static void telnet_log(Plug *plug, int type, SockAddr *addr, int port,
|
||||
const char *error_msg, int error_code)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(plug, struct telnet_tag, plugvt);
|
||||
Telnet *telnet = FROMFIELD(plug, Telnet, plugvt);
|
||||
backend_socket_log(telnet->frontend, type, addr, port,
|
||||
error_msg, error_code, telnet->conf,
|
||||
telnet->session_started);
|
||||
}
|
||||
|
||||
static void telnet_closing(Plug plug, const char *error_msg, int error_code,
|
||||
static void telnet_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
int calling_back)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(plug, struct telnet_tag, plugvt);
|
||||
Telnet *telnet = FROMFIELD(plug, Telnet, plugvt);
|
||||
|
||||
/*
|
||||
* We don't implement independent EOF in each direction for Telnet
|
||||
@ -675,18 +676,18 @@ static void telnet_closing(Plug plug, const char *error_msg, int error_code,
|
||||
/* Otherwise, the remote side closed the connection normally. */
|
||||
}
|
||||
|
||||
static void telnet_receive(Plug plug, int urgent, char *data, int len)
|
||||
static void telnet_receive(Plug *plug, int urgent, char *data, int len)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(plug, struct telnet_tag, plugvt);
|
||||
Telnet *telnet = FROMFIELD(plug, Telnet, plugvt);
|
||||
if (urgent)
|
||||
telnet->in_synch = TRUE;
|
||||
telnet->session_started = TRUE;
|
||||
do_telnet_read(telnet, data, len);
|
||||
}
|
||||
|
||||
static void telnet_sent(Plug plug, int bufsize)
|
||||
static void telnet_sent(Plug *plug, int bufsize)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(plug, struct telnet_tag, plugvt);
|
||||
Telnet *telnet = FROMFIELD(plug, Telnet, plugvt);
|
||||
telnet->bufsize = bufsize;
|
||||
}
|
||||
|
||||
@ -709,13 +710,13 @@ static const char *telnet_init(Frontend *frontend, Backend **backend_handle,
|
||||
Conf *conf, const char *host, int port,
|
||||
char **realhost, int nodelay, int keepalive)
|
||||
{
|
||||
SockAddr addr;
|
||||
SockAddr *addr;
|
||||
const char *err;
|
||||
Telnet telnet;
|
||||
Telnet *telnet;
|
||||
char *loghost;
|
||||
int addressfamily;
|
||||
|
||||
telnet = snew(struct telnet_tag);
|
||||
telnet = snew(Telnet);
|
||||
telnet->plugvt = &Telnet_plugvt;
|
||||
telnet->backend.vt = &telnet_backend;
|
||||
telnet->conf = conf_copy(conf);
|
||||
@ -808,7 +809,7 @@ static const char *telnet_init(Frontend *frontend, Backend **backend_handle,
|
||||
|
||||
static void telnet_free(Backend *be)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
|
||||
sfree(telnet->sb_buf);
|
||||
if (telnet->s)
|
||||
@ -825,7 +826,7 @@ static void telnet_free(Backend *be)
|
||||
*/
|
||||
static void telnet_reconfig(Backend *be, Conf *conf)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
pinger_reconfig(telnet->pinger, telnet->conf, conf);
|
||||
conf_free(telnet->conf);
|
||||
telnet->conf = conf_copy(conf);
|
||||
@ -836,7 +837,7 @@ static void telnet_reconfig(Backend *be, Conf *conf)
|
||||
*/
|
||||
static int telnet_send(Backend *be, const char *buf, int len)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
unsigned char *p, *end;
|
||||
static const unsigned char iac[2] = { IAC, IAC };
|
||||
static const unsigned char cr[2] = { CR, NUL };
|
||||
@ -871,7 +872,7 @@ static int telnet_send(Backend *be, const char *buf, int len)
|
||||
*/
|
||||
static int telnet_sendbuffer(Backend *be)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
return telnet->bufsize;
|
||||
}
|
||||
|
||||
@ -880,7 +881,7 @@ static int telnet_sendbuffer(Backend *be)
|
||||
*/
|
||||
static void telnet_size(Backend *be, int width, int height)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
unsigned char b[24];
|
||||
int n;
|
||||
char *logbuf;
|
||||
@ -916,7 +917,7 @@ static void telnet_size(Backend *be, int width, int height)
|
||||
*/
|
||||
static void telnet_special(Backend *be, SessionSpecialCode code, int arg)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
unsigned char b[2];
|
||||
|
||||
if (telnet->s == NULL)
|
||||
@ -1021,25 +1022,25 @@ static const SessionSpecial *telnet_get_specials(Backend *be)
|
||||
|
||||
static int telnet_connected(Backend *be)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
return telnet->s != NULL;
|
||||
}
|
||||
|
||||
static int telnet_sendok(Backend *be)
|
||||
{
|
||||
/* Telnet telnet = FROMFIELD(be, struct telnet_tag, backend); */
|
||||
/* Telnet *telnet = FROMFIELD(be, Telnet, backend); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void telnet_unthrottle(Backend *be, int backlog)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
sk_set_frozen(telnet->s, backlog > TELNET_MAX_BACKLOG);
|
||||
}
|
||||
|
||||
static int telnet_ldisc(Backend *be, int option)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
if (option == LD_ECHO)
|
||||
return telnet->echoing;
|
||||
if (option == LD_EDIT)
|
||||
@ -1049,7 +1050,7 @@ static int telnet_ldisc(Backend *be, int option)
|
||||
|
||||
static void telnet_provide_ldisc(Backend *be, Ldisc *ldisc)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
telnet->ldisc = ldisc;
|
||||
}
|
||||
|
||||
@ -1060,7 +1061,7 @@ static void telnet_provide_logctx(Backend *be, LogContext *logctx)
|
||||
|
||||
static int telnet_exitcode(Backend *be)
|
||||
{
|
||||
Telnet telnet = FROMFIELD(be, struct telnet_tag, backend);
|
||||
Telnet *telnet = FROMFIELD(be, Telnet, backend);
|
||||
if (telnet->s != NULL)
|
||||
return -1; /* still connected */
|
||||
else if (telnet->closed_on_socket_error)
|
||||
|
@ -314,7 +314,7 @@ int init_ucs(struct unicode_data *ucsdata, char *line_codepage,
|
||||
/*
|
||||
* Spare function exported directly from uxnet.c.
|
||||
*/
|
||||
void *sk_getxdmdata(Socket sock, int *lenp);
|
||||
void *sk_getxdmdata(Socket *sock, int *lenp);
|
||||
|
||||
/*
|
||||
* General helpful Unix stuff: more helpful version of the FD_SET
|
||||
|
104
unix/uxnet.c
104
unix/uxnet.c
@ -63,7 +63,7 @@ typedef struct NetSocket NetSocket;
|
||||
struct NetSocket {
|
||||
const char *error;
|
||||
int s;
|
||||
Plug plug;
|
||||
Plug *plug;
|
||||
bufchain output_data;
|
||||
int connected; /* irrelevant for listening sockets */
|
||||
int writable;
|
||||
@ -79,7 +79,7 @@ struct NetSocket {
|
||||
int listener;
|
||||
int nodelay, keepalive; /* for connect()-type sockets */
|
||||
int privport, port; /* and again */
|
||||
SockAddr addr;
|
||||
SockAddr *addr;
|
||||
SockAddrStep step;
|
||||
/*
|
||||
* We sometimes need pairs of Socket structures to be linked:
|
||||
@ -92,7 +92,7 @@ struct NetSocket {
|
||||
const Socket_vtable *sockvt;
|
||||
};
|
||||
|
||||
struct SockAddr_tag {
|
||||
struct SockAddr {
|
||||
int refcount;
|
||||
const char *error;
|
||||
enum { UNRESOLVED, UNIX, IP } superfamily;
|
||||
@ -184,9 +184,9 @@ void sk_cleanup(void)
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
#ifndef NO_IPV6
|
||||
struct addrinfo hints;
|
||||
int err;
|
||||
@ -198,7 +198,7 @@ SockAddr sk_namelookup(const char *host, char **canonicalname, int address_famil
|
||||
char realhost[8192];
|
||||
|
||||
/* Clear the structure and default to IPv4. */
|
||||
memset(ret, 0, sizeof(struct SockAddr_tag));
|
||||
memset(ret, 0, sizeof(SockAddr));
|
||||
ret->superfamily = UNRESOLVED;
|
||||
*realhost = '\0';
|
||||
ret->error = NULL;
|
||||
@ -277,9 +277,9 @@ SockAddr sk_namelookup(const char *host, char **canonicalname, int address_famil
|
||||
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->superfamily = UNRESOLVED;
|
||||
strncpy(ret->hostname, host, lenof(ret->hostname));
|
||||
@ -293,7 +293,7 @@ SockAddr sk_nonamelookup(const char *host)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sk_nextaddr(SockAddr addr, SockAddrStep *step)
|
||||
static int sk_nextaddr(SockAddr *addr, SockAddrStep *step)
|
||||
{
|
||||
#ifndef NO_IPV6
|
||||
if (step->ai && step->ai->ai_next) {
|
||||
@ -311,7 +311,7 @@ static int sk_nextaddr(SockAddr addr, SockAddrStep *step)
|
||||
#endif
|
||||
}
|
||||
|
||||
void sk_getaddr(SockAddr addr, char *buf, int buflen)
|
||||
void sk_getaddr(SockAddr *addr, char *buf, int buflen)
|
||||
{
|
||||
if (addr->superfamily == UNRESOLVED || addr->superfamily == UNIX) {
|
||||
strncpy(buf, addr->hostname, buflen);
|
||||
@ -344,10 +344,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;
|
||||
|
||||
@ -363,7 +363,7 @@ static struct SockAddr_tag sk_extractaddr_tmp(
|
||||
return toret;
|
||||
}
|
||||
|
||||
int sk_addr_needs_port(SockAddr addr)
|
||||
int sk_addr_needs_port(SockAddr *addr)
|
||||
{
|
||||
if (addr->superfamily == UNRESOLVED || addr->superfamily == UNIX) {
|
||||
return FALSE;
|
||||
@ -399,7 +399,7 @@ static int sockaddr_is_loopback(struct sockaddr *sa)
|
||||
}
|
||||
}
|
||||
|
||||
int sk_address_is_local(SockAddr addr)
|
||||
int sk_address_is_local(SockAddr *addr)
|
||||
{
|
||||
if (addr->superfamily == UNRESOLVED)
|
||||
return 0; /* we don't know; assume not */
|
||||
@ -419,12 +419,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 addr->superfamily == UNIX;
|
||||
}
|
||||
|
||||
int sk_addrtype(SockAddr addr)
|
||||
int sk_addrtype(SockAddr *addr)
|
||||
{
|
||||
SockAddrStep step;
|
||||
int family;
|
||||
@ -438,7 +438,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;
|
||||
@ -463,7 +463,7 @@ void sk_addrcopy(SockAddr addr, char *buf)
|
||||
#endif
|
||||
}
|
||||
|
||||
void sk_addr_free(SockAddr addr)
|
||||
void sk_addr_free(SockAddr *addr)
|
||||
{
|
||||
if (--addr->refcount > 0)
|
||||
return;
|
||||
@ -476,22 +476,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,
|
||||
@ -499,13 +499,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 char *sk_net_peer_info(Socket s);
|
||||
static const char *sk_net_socket_error(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 char *sk_net_peer_info(Socket *s);
|
||||
static const char *sk_net_socket_error(Socket *s);
|
||||
|
||||
static struct Socket_vtable NetSocket_sockvt = {
|
||||
sk_net_plug,
|
||||
@ -519,7 +519,7 @@ static struct 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)
|
||||
{
|
||||
int sockfd = ctx.i;
|
||||
NetSocket *ret;
|
||||
@ -581,7 +581,7 @@ static int try_connect(NetSocket *sock)
|
||||
close(sock->s);
|
||||
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -752,15 +752,15 @@ static int 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, strerror(err), 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;
|
||||
int err;
|
||||
@ -804,8 +804,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)
|
||||
{
|
||||
int s;
|
||||
#ifndef NO_IPV6
|
||||
@ -1009,7 +1009,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)
|
||||
{
|
||||
NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
|
||||
|
||||
@ -1026,7 +1026,7 @@ static void sk_net_close(Socket sock)
|
||||
sfree(s);
|
||||
}
|
||||
|
||||
void *sk_getxdmdata(Socket sock, int *lenp)
|
||||
void *sk_getxdmdata(Socket *sock, int *lenp)
|
||||
{
|
||||
NetSocket *s;
|
||||
union sockaddr_union u;
|
||||
@ -1184,7 +1184,7 @@ void try_send(NetSocket *s)
|
||||
uxsel_tell(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);
|
||||
|
||||
@ -1210,7 +1210,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);
|
||||
|
||||
@ -1239,7 +1239,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);
|
||||
|
||||
@ -1417,7 +1417,7 @@ static void net_select_result(int fd, int event)
|
||||
* with the next candidate address, if we have
|
||||
* more than one.
|
||||
*/
|
||||
struct SockAddr_tag thisaddr;
|
||||
SockAddr thisaddr;
|
||||
assert(s->addr);
|
||||
|
||||
thisaddr = sk_extractaddr_tmp(s->addr, &s->step);
|
||||
@ -1462,17 +1462,17 @@ static void net_select_result(int fd, int event)
|
||||
* 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 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)
|
||||
@ -1481,7 +1481,7 @@ static void sk_net_set_frozen(Socket sock, int is_frozen)
|
||||
uxsel_tell(s);
|
||||
}
|
||||
|
||||
static char *sk_net_peer_info(Socket sock)
|
||||
static char *sk_net_peer_info(Socket *sock)
|
||||
{
|
||||
NetSocket *s = FROMFIELD(sock, NetSocket, sockvt);
|
||||
union sockaddr_union addr;
|
||||
@ -1572,9 +1572,9 @@ char *get_hostname(void)
|
||||
return hostname;
|
||||
}
|
||||
|
||||
SockAddr platform_get_x11_unix_address(const char *sockpath, int displaynum)
|
||||
SockAddr *platform_get_x11_unix_address(const char *sockpath, int displaynum)
|
||||
{
|
||||
SockAddr ret = snew(struct SockAddr_tag);
|
||||
SockAddr *ret = snew(SockAddr);
|
||||
int n;
|
||||
|
||||
memset(ret, 0, sizeof *ret);
|
||||
@ -1606,9 +1606,9 @@ SockAddr platform_get_x11_unix_address(const char *sockpath, int displaynum)
|
||||
return ret;
|
||||
}
|
||||
|
||||
SockAddr unix_sock_addr(const char *path)
|
||||
SockAddr *unix_sock_addr(const char *path)
|
||||
{
|
||||
SockAddr ret = snew(struct SockAddr_tag);
|
||||
SockAddr *ret = snew(SockAddr);
|
||||
int n;
|
||||
|
||||
memset(ret, 0, sizeof *ret);
|
||||
@ -1631,7 +1631,7 @@ SockAddr unix_sock_addr(const char *path)
|
||||
return ret;
|
||||
}
|
||||
|
||||
Socket new_unix_listener(SockAddr listenaddr, Plug plug)
|
||||
Socket *new_unix_listener(SockAddr *listenaddr, Plug *plug)
|
||||
{
|
||||
int s;
|
||||
union sockaddr_union u;
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include "misc.h"
|
||||
#include "pageant.h"
|
||||
|
||||
SockAddr unix_sock_addr(const char *path);
|
||||
Socket new_unix_listener(SockAddr listenaddr, Plug plug);
|
||||
SockAddr *unix_sock_addr(const char *path);
|
||||
Socket *new_unix_listener(SockAddr *listenaddr, Plug *plug);
|
||||
|
||||
void modalfatalbox(const char *p, ...)
|
||||
{
|
||||
@ -166,11 +166,11 @@ int chan_no_eager_close(Channel *chan, int s, int r) { return FALSE; }
|
||||
* except that x11_closing has to signal back to the main loop that
|
||||
* it's time to terminate.
|
||||
*/
|
||||
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) {}
|
||||
static void x11_receive(Plug plug, int urgent, char *data, int len) {}
|
||||
static void x11_sent(Plug plug, int bufsize) {}
|
||||
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_sent(Plug *plug, int bufsize) {}
|
||||
static void x11_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
int calling_back)
|
||||
{
|
||||
time_to_die = TRUE;
|
||||
@ -741,8 +741,8 @@ void run_agent(void)
|
||||
const char *err;
|
||||
char *username, *socketdir;
|
||||
struct pageant_listen_state *pl;
|
||||
Plug pl_plug;
|
||||
Socket sock;
|
||||
Plug *pl_plug;
|
||||
Socket *sock;
|
||||
unsigned long now;
|
||||
int *fdlist;
|
||||
int fd;
|
||||
@ -799,7 +799,7 @@ void run_agent(void)
|
||||
struct X11Display *disp;
|
||||
void *greeting;
|
||||
int greetinglen;
|
||||
Socket s;
|
||||
Socket *s;
|
||||
struct X11Connection *conn;
|
||||
|
||||
if (!display) {
|
||||
|
@ -20,7 +20,7 @@ typedef struct LocalProxySocket {
|
||||
|
||||
char *error;
|
||||
|
||||
Plug plug;
|
||||
Plug *plug;
|
||||
|
||||
bufchain pending_output_data;
|
||||
bufchain pending_input_data;
|
||||
@ -103,16 +103,16 @@ static int localproxy_errfd_find(void *av, void *bv)
|
||||
|
||||
/* basic proxy socket functions */
|
||||
|
||||
static Plug sk_localproxy_plug (Socket s, Plug p)
|
||||
static Plug *sk_localproxy_plug (Socket *s, Plug *p)
|
||||
{
|
||||
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
|
||||
Plug ret = ps->plug;
|
||||
Plug *ret = ps->plug;
|
||||
if (p)
|
||||
ps->plug = p;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sk_localproxy_close (Socket s)
|
||||
static void sk_localproxy_close (Socket *s)
|
||||
{
|
||||
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
|
||||
|
||||
@ -200,7 +200,7 @@ static int localproxy_try_send(LocalProxySocket *ps)
|
||||
return sent;
|
||||
}
|
||||
|
||||
static int sk_localproxy_write (Socket s, const void *data, int len)
|
||||
static int sk_localproxy_write (Socket *s, const void *data, int len)
|
||||
{
|
||||
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
|
||||
|
||||
@ -213,7 +213,7 @@ static int sk_localproxy_write (Socket s, const void *data, int len)
|
||||
return bufchain_size(&ps->pending_output_data);
|
||||
}
|
||||
|
||||
static int sk_localproxy_write_oob (Socket s, const void *data, int len)
|
||||
static int sk_localproxy_write_oob (Socket *s, const void *data, int len)
|
||||
{
|
||||
/*
|
||||
* oob data is treated as inband; nasty, but nothing really
|
||||
@ -222,7 +222,7 @@ static int sk_localproxy_write_oob (Socket s, const void *data, int len)
|
||||
return sk_localproxy_write(s, data, len);
|
||||
}
|
||||
|
||||
static void sk_localproxy_write_eof (Socket s)
|
||||
static void sk_localproxy_write_eof (Socket *s)
|
||||
{
|
||||
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
|
||||
|
||||
@ -232,13 +232,13 @@ static void sk_localproxy_write_eof (Socket s)
|
||||
localproxy_try_send(ps);
|
||||
}
|
||||
|
||||
static void sk_localproxy_flush (Socket s)
|
||||
static void sk_localproxy_flush (Socket *s)
|
||||
{
|
||||
/* LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt); */
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
static void sk_localproxy_set_frozen (Socket s, int is_frozen)
|
||||
static void sk_localproxy_set_frozen (Socket *s, int is_frozen)
|
||||
{
|
||||
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
|
||||
|
||||
@ -251,7 +251,7 @@ static void sk_localproxy_set_frozen (Socket s, int is_frozen)
|
||||
uxsel_set(ps->from_cmd, 1, localproxy_select_result);
|
||||
}
|
||||
|
||||
static const char * sk_localproxy_socket_error (Socket s)
|
||||
static const char * sk_localproxy_socket_error (Socket *s)
|
||||
{
|
||||
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
|
||||
return ps->error;
|
||||
@ -315,10 +315,10 @@ static const Socket_vtable LocalProxySocket_sockvt = {
|
||||
NULL, /* peer_info */
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
74
unix/uxpty.c
74
unix/uxpty.c
@ -60,7 +60,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct pty_tag *Pty;
|
||||
typedef struct Pty Pty;
|
||||
|
||||
/*
|
||||
* The pty_signal_pipe, along with the SIGCHLD handler, must be
|
||||
@ -68,7 +68,7 @@ typedef struct pty_tag *Pty;
|
||||
*/
|
||||
static int pty_signal_pipe[2] = { -1, -1 }; /* obviously bogus initial val */
|
||||
|
||||
struct pty_tag {
|
||||
struct Pty {
|
||||
Conf *conf;
|
||||
int master_fd, slave_fd;
|
||||
Frontend *frontend;
|
||||
@ -88,8 +88,8 @@ struct pty_tag {
|
||||
*/
|
||||
static int pty_compare_by_fd(void *av, void *bv)
|
||||
{
|
||||
Pty a = (Pty)av;
|
||||
Pty b = (Pty)bv;
|
||||
Pty *a = (Pty *)av;
|
||||
Pty *b = (Pty *)bv;
|
||||
|
||||
if (a->master_fd < b->master_fd)
|
||||
return -1;
|
||||
@ -101,7 +101,7 @@ static int pty_compare_by_fd(void *av, void *bv)
|
||||
static int pty_find_by_fd(void *av, void *bv)
|
||||
{
|
||||
int a = *(int *)av;
|
||||
Pty b = (Pty)bv;
|
||||
Pty *b = (Pty *)bv;
|
||||
|
||||
if (a < b->master_fd)
|
||||
return -1;
|
||||
@ -119,8 +119,8 @@ static tree234 *ptys_by_fd = NULL;
|
||||
*/
|
||||
static int pty_compare_by_pid(void *av, void *bv)
|
||||
{
|
||||
Pty a = (Pty)av;
|
||||
Pty b = (Pty)bv;
|
||||
Pty *a = (Pty *)av;
|
||||
Pty *b = (Pty *)bv;
|
||||
|
||||
if (a->child_pid < b->child_pid)
|
||||
return -1;
|
||||
@ -132,7 +132,7 @@ static int pty_compare_by_pid(void *av, void *bv)
|
||||
static int pty_find_by_pid(void *av, void *bv)
|
||||
{
|
||||
pid_t a = *(pid_t *)av;
|
||||
Pty b = (Pty)bv;
|
||||
Pty *b = (Pty *)bv;
|
||||
|
||||
if (a < b->child_pid)
|
||||
return -1;
|
||||
@ -158,7 +158,7 @@ static tree234 *ptys_by_pid = NULL;
|
||||
* be single-instance, so we can declare utmp-related variables
|
||||
* here.
|
||||
*/
|
||||
static Pty single_pty = NULL;
|
||||
static Pty *single_pty = NULL;
|
||||
|
||||
#ifndef OMIT_UTMP
|
||||
static pid_t pty_utmp_helper_pid = -1;
|
||||
@ -176,8 +176,8 @@ char **pty_argv;
|
||||
|
||||
char *pty_osx_envrestore_prefix;
|
||||
|
||||
static void pty_close(Pty pty);
|
||||
static void pty_try_write(Pty pty);
|
||||
static void pty_close(Pty *pty);
|
||||
static void pty_try_write(Pty *pty);
|
||||
|
||||
#ifndef OMIT_UTMP
|
||||
static void setup_utmp(char *ttyname, char *location)
|
||||
@ -286,7 +286,7 @@ static void fatal_sig_handler(int signum)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int pty_open_slave(Pty pty)
|
||||
static int pty_open_slave(Pty *pty)
|
||||
{
|
||||
if (pty->slave_fd < 0) {
|
||||
pty->slave_fd = open(pty->name, O_RDWR);
|
||||
@ -296,7 +296,7 @@ static int pty_open_slave(Pty pty)
|
||||
return pty->slave_fd;
|
||||
}
|
||||
|
||||
static void pty_open_master(Pty pty)
|
||||
static void pty_open_master(Pty *pty)
|
||||
{
|
||||
#ifdef BSD_PTYS
|
||||
const char chars1[] = "pqrstuvwxyz";
|
||||
@ -405,9 +405,9 @@ static void pty_open_master(Pty pty)
|
||||
add234(ptys_by_fd, pty);
|
||||
}
|
||||
|
||||
static Pty new_pty_struct(void)
|
||||
static Pty *new_pty_struct(void)
|
||||
{
|
||||
Pty pty = snew(struct pty_tag);
|
||||
Pty *pty = snew(Pty);
|
||||
pty->conf = NULL;
|
||||
bufchain_init(&pty->output_data);
|
||||
return pty;
|
||||
@ -430,7 +430,7 @@ void pty_pre_init(void)
|
||||
{
|
||||
#ifndef NO_PTY_PRE_INIT
|
||||
|
||||
Pty pty;
|
||||
Pty *pty;
|
||||
|
||||
#ifndef OMIT_UTMP
|
||||
pid_t pid;
|
||||
@ -580,7 +580,7 @@ void pty_pre_init(void)
|
||||
|
||||
}
|
||||
|
||||
void pty_real_select_result(Pty pty, int event, int status)
|
||||
void pty_real_select_result(Pty *pty, int event, int status)
|
||||
{
|
||||
char buf[4096];
|
||||
int ret;
|
||||
@ -684,7 +684,7 @@ void pty_real_select_result(Pty pty, int event, int status)
|
||||
|
||||
void pty_select_result(int fd, int event)
|
||||
{
|
||||
Pty pty;
|
||||
Pty *pty;
|
||||
|
||||
if (fd == pty_signal_pipe[0]) {
|
||||
pid_t pid;
|
||||
@ -711,7 +711,7 @@ void pty_select_result(int fd, int event)
|
||||
}
|
||||
}
|
||||
|
||||
static void pty_uxsel_setup(Pty pty)
|
||||
static void pty_uxsel_setup(Pty *pty)
|
||||
{
|
||||
int rwx;
|
||||
|
||||
@ -746,7 +746,7 @@ static const char *pty_init(Frontend *frontend, Backend **backend_handle,
|
||||
int got_windowid;
|
||||
long windowid;
|
||||
#endif
|
||||
Pty pty;
|
||||
Pty *pty;
|
||||
|
||||
if (single_pty) {
|
||||
pty = single_pty;
|
||||
@ -1041,7 +1041,7 @@ static const char *pty_init(Frontend *frontend, Backend **backend_handle,
|
||||
|
||||
static void pty_reconfig(Backend *be, Conf *conf)
|
||||
{
|
||||
Pty pty = FROMFIELD(be, struct pty_tag, backend);
|
||||
Pty *pty = FROMFIELD(be, Pty, backend);
|
||||
/*
|
||||
* We don't have much need to reconfigure this backend, but
|
||||
* unfortunately we do need to pick up the setting of Close On
|
||||
@ -1055,7 +1055,7 @@ static void pty_reconfig(Backend *be, Conf *conf)
|
||||
*/
|
||||
static void pty_free(Backend *be)
|
||||
{
|
||||
Pty pty = FROMFIELD(be, struct pty_tag, backend);
|
||||
Pty *pty = FROMFIELD(be, Pty, backend);
|
||||
|
||||
/* Either of these may fail `not found'. That's fine with us. */
|
||||
del234(ptys_by_pid, pty);
|
||||
@ -1076,7 +1076,7 @@ static void pty_free(Backend *be)
|
||||
}
|
||||
}
|
||||
|
||||
static void pty_try_write(Pty pty)
|
||||
static void pty_try_write(Pty *pty)
|
||||
{
|
||||
void *data;
|
||||
int len, ret;
|
||||
@ -1108,7 +1108,7 @@ static void pty_try_write(Pty pty)
|
||||
*/
|
||||
static int pty_send(Backend *be, const char *buf, int len)
|
||||
{
|
||||
Pty pty = FROMFIELD(be, struct pty_tag, backend);
|
||||
Pty *pty = FROMFIELD(be, Pty, backend);
|
||||
|
||||
if (pty->master_fd < 0)
|
||||
return 0; /* ignore all writes if fd closed */
|
||||
@ -1119,7 +1119,7 @@ static int pty_send(Backend *be, const char *buf, int len)
|
||||
return bufchain_size(&pty->output_data);
|
||||
}
|
||||
|
||||
static void pty_close(Pty pty)
|
||||
static void pty_close(Pty *pty)
|
||||
{
|
||||
if (pty->master_fd >= 0) {
|
||||
close(pty->master_fd);
|
||||
@ -1138,7 +1138,7 @@ static void pty_close(Pty pty)
|
||||
*/
|
||||
static int pty_sendbuffer(Backend *be)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1147,7 +1147,7 @@ static int pty_sendbuffer(Backend *be)
|
||||
*/
|
||||
static void pty_size(Backend *be, int width, int height)
|
||||
{
|
||||
Pty pty = FROMFIELD(be, struct pty_tag, backend);
|
||||
Pty *pty = FROMFIELD(be, Pty, backend);
|
||||
struct winsize size;
|
||||
|
||||
pty->term_width = width;
|
||||
@ -1168,7 +1168,7 @@ static void pty_size(Backend *be, int width, int height)
|
||||
*/
|
||||
static void pty_special(Backend *be, SessionSpecialCode code, int arg)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
/* Do nothing! */
|
||||
return;
|
||||
}
|
||||
@ -1179,7 +1179,7 @@ static void pty_special(Backend *be, SessionSpecialCode code, int arg)
|
||||
*/
|
||||
static const SessionSpecial *pty_get_specials(Backend *be)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
/*
|
||||
* Hmm. When I get round to having this actually usable, it
|
||||
* might be quite nice to have the ability to deliver a few
|
||||
@ -1191,43 +1191,43 @@ static const SessionSpecial *pty_get_specials(Backend *be)
|
||||
|
||||
static int pty_connected(Backend *be)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int pty_sendok(Backend *be)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void pty_unthrottle(Backend *be, int backlog)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
static int pty_ldisc(Backend *be, int option)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
return 0; /* neither editing nor echoing */
|
||||
}
|
||||
|
||||
static void pty_provide_ldisc(Backend *be, Ldisc *ldisc)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
/* This is a stub. */
|
||||
}
|
||||
|
||||
static void pty_provide_logctx(Backend *be, LogContext *logctx)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
/* This is a stub. */
|
||||
}
|
||||
|
||||
static int pty_exitcode(Backend *be)
|
||||
{
|
||||
Pty pty = FROMFIELD(be, struct pty_tag, backend);
|
||||
Pty *pty = FROMFIELD(be, Pty, backend);
|
||||
if (!pty->finished)
|
||||
return -1; /* not dead yet */
|
||||
else
|
||||
@ -1236,7 +1236,7 @@ static int pty_exitcode(Backend *be)
|
||||
|
||||
static int pty_cfg_info(Backend *be)
|
||||
{
|
||||
/* Pty pty = FROMFIELD(be, struct pty_tag, backend); */
|
||||
/* Pty *pty = FROMFIELD(be, Pty, backend); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
43
unix/uxser.c
43
unix/uxser.c
@ -17,14 +17,15 @@
|
||||
|
||||
#define SERIAL_MAX_BACKLOG 4096
|
||||
|
||||
typedef struct serial_backend_data {
|
||||
typedef struct Serial Serial;
|
||||
struct Serial {
|
||||
Frontend *frontend;
|
||||
int fd;
|
||||
int finished;
|
||||
int inbufsize;
|
||||
bufchain output_data;
|
||||
Backend backend;
|
||||
} *Serial;
|
||||
};
|
||||
|
||||
/*
|
||||
* We store our serial backends in a tree sorted by fd, so that
|
||||
@ -33,8 +34,8 @@ typedef struct serial_backend_data {
|
||||
*/
|
||||
static int serial_compare_by_fd(void *av, void *bv)
|
||||
{
|
||||
Serial a = (Serial)av;
|
||||
Serial b = (Serial)bv;
|
||||
Serial *a = (Serial *)av;
|
||||
Serial *b = (Serial *)bv;
|
||||
|
||||
if (a->fd < b->fd)
|
||||
return -1;
|
||||
@ -46,7 +47,7 @@ static int serial_compare_by_fd(void *av, void *bv)
|
||||
static int serial_find_by_fd(void *av, void *bv)
|
||||
{
|
||||
int a = *(int *)av;
|
||||
Serial b = (Serial)bv;
|
||||
Serial *b = (Serial *)bv;
|
||||
|
||||
if (a < b->fd)
|
||||
return -1;
|
||||
@ -58,10 +59,10 @@ static int serial_find_by_fd(void *av, void *bv)
|
||||
static tree234 *serial_by_fd = NULL;
|
||||
|
||||
static void serial_select_result(int fd, int event);
|
||||
static void serial_uxsel_setup(Serial serial);
|
||||
static void serial_try_write(Serial serial);
|
||||
static void serial_uxsel_setup(Serial *serial);
|
||||
static void serial_try_write(Serial *serial);
|
||||
|
||||
static const char *serial_configure(Serial serial, Conf *conf)
|
||||
static const char *serial_configure(Serial *serial, Conf *conf)
|
||||
{
|
||||
struct termios options;
|
||||
int bflag, bval, speed, flow, parity;
|
||||
@ -293,11 +294,11 @@ static const char *serial_init(Frontend *frontend, Backend **backend_handle,
|
||||
const char *host, int port, char **realhost,
|
||||
int nodelay, int keepalive)
|
||||
{
|
||||
Serial serial;
|
||||
Serial *serial;
|
||||
const char *err;
|
||||
char *line;
|
||||
|
||||
serial = snew(struct serial_backend_data);
|
||||
serial = snew(Serial);
|
||||
serial->backend.vt = &serial_backend;
|
||||
*backend_handle = &serial->backend;
|
||||
|
||||
@ -339,7 +340,7 @@ static const char *serial_init(Frontend *frontend, Backend **backend_handle,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void serial_close(Serial serial)
|
||||
static void serial_close(Serial *serial)
|
||||
{
|
||||
if (serial->fd >= 0) {
|
||||
close(serial->fd);
|
||||
@ -349,7 +350,7 @@ static void serial_close(Serial serial)
|
||||
|
||||
static void serial_free(Backend *be)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
|
||||
serial_close(serial);
|
||||
|
||||
@ -360,7 +361,7 @@ static void serial_free(Backend *be)
|
||||
|
||||
static void serial_reconfig(Backend *be, Conf *conf)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
|
||||
/*
|
||||
* FIXME: what should we do if this returns an error?
|
||||
@ -370,7 +371,7 @@ static void serial_reconfig(Backend *be, Conf *conf)
|
||||
|
||||
static void serial_select_result(int fd, int event)
|
||||
{
|
||||
Serial serial;
|
||||
Serial *serial;
|
||||
char buf[4096];
|
||||
int ret;
|
||||
int finished = FALSE;
|
||||
@ -421,7 +422,7 @@ static void serial_select_result(int fd, int event)
|
||||
}
|
||||
}
|
||||
|
||||
static void serial_uxsel_setup(Serial serial)
|
||||
static void serial_uxsel_setup(Serial *serial)
|
||||
{
|
||||
int rwx = 0;
|
||||
|
||||
@ -432,7 +433,7 @@ static void serial_uxsel_setup(Serial serial)
|
||||
uxsel_set(serial->fd, rwx, serial_select_result);
|
||||
}
|
||||
|
||||
static void serial_try_write(Serial serial)
|
||||
static void serial_try_write(Serial *serial)
|
||||
{
|
||||
void *data;
|
||||
int len, ret;
|
||||
@ -464,7 +465,7 @@ static void serial_try_write(Serial serial)
|
||||
*/
|
||||
static int serial_send(Backend *be, const char *buf, int len)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
|
||||
if (serial->fd < 0)
|
||||
return 0;
|
||||
@ -480,7 +481,7 @@ static int serial_send(Backend *be, const char *buf, int len)
|
||||
*/
|
||||
static int serial_sendbuffer(Backend *be)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
return bufchain_size(&serial->output_data);
|
||||
}
|
||||
|
||||
@ -498,7 +499,7 @@ static void serial_size(Backend *be, int width, int height)
|
||||
*/
|
||||
static void serial_special(Backend *be, SessionSpecialCode code, int arg)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
|
||||
if (serial->fd >= 0 && code == SS_BRK) {
|
||||
tcsendbreak(serial->fd, 0);
|
||||
@ -533,7 +534,7 @@ static int serial_sendok(Backend *be)
|
||||
|
||||
static void serial_unthrottle(Backend *be, int backlog)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
serial->inbufsize = backlog;
|
||||
serial_uxsel_setup(serial);
|
||||
}
|
||||
@ -558,7 +559,7 @@ static void serial_provide_logctx(Backend *be, LogContext *logctx)
|
||||
|
||||
static int serial_exitcode(Backend *be)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
if (serial->fd >= 0)
|
||||
return -1; /* still connected */
|
||||
else
|
||||
|
@ -27,8 +27,8 @@
|
||||
/*
|
||||
* Functions provided by uxnet.c to help connection sharing.
|
||||
*/
|
||||
SockAddr unix_sock_addr(const char *path);
|
||||
Socket new_unix_listener(SockAddr listenaddr, Plug plug);
|
||||
SockAddr *unix_sock_addr(const char *path);
|
||||
Socket *new_unix_listener(SockAddr *listenaddr, Plug *plug);
|
||||
|
||||
static char *make_parentdir_name(void)
|
||||
{
|
||||
@ -249,13 +249,13 @@ static char *make_dirname(const char *pi_name, char **logtext)
|
||||
}
|
||||
|
||||
int platform_ssh_share(const char *pi_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)
|
||||
{
|
||||
char *dirname, *lockname, *sockname, *err;
|
||||
int lockfd;
|
||||
Socket retsock;
|
||||
Socket *retsock;
|
||||
|
||||
/*
|
||||
* Sort out what we're going to call the directory in which we
|
||||
|
@ -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);
|
||||
|
108
windows/winnet.c
108
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;
|
||||
|
@ -16,16 +16,16 @@
|
||||
|
||||
#include "winsecur.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 new_named_pipe_client(const char *pipename, Plug plug)
|
||||
Socket *new_named_pipe_client(const char *pipename, Plug *plug)
|
||||
{
|
||||
HANDLE pipehandle;
|
||||
PSID usersid, pipeowner;
|
||||
PSECURITY_DESCRIPTOR psd;
|
||||
char *err;
|
||||
Socket ret;
|
||||
Socket *ret;
|
||||
|
||||
assert(strncmp(pipename, "\\\\.\\pipe\\", 9) == 0);
|
||||
assert(strchr(pipename + 9, '\\') == NULL);
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
#include "winsecur.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);
|
||||
|
||||
typedef struct NamedPipeServerSocket {
|
||||
/* Parameters for (repeated) creation of named pipe objects */
|
||||
@ -31,22 +31,22 @@ typedef struct NamedPipeServerSocket {
|
||||
struct handle *callback_handle; /* winhandl.c's reference */
|
||||
|
||||
/* PuTTY Socket machinery */
|
||||
Plug plug;
|
||||
Plug *plug;
|
||||
char *error;
|
||||
|
||||
const Socket_vtable *sockvt;
|
||||
} NamedPipeServerSocket;
|
||||
|
||||
static Plug sk_namedpipeserver_plug(Socket s, Plug p)
|
||||
static Plug *sk_namedpipeserver_plug(Socket *s, Plug *p)
|
||||
{
|
||||
NamedPipeServerSocket *ps = FROMFIELD(s, NamedPipeServerSocket, sockvt);
|
||||
Plug ret = ps->plug;
|
||||
Plug *ret = ps->plug;
|
||||
if (p)
|
||||
ps->plug = p;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sk_namedpipeserver_close(Socket s)
|
||||
static void sk_namedpipeserver_close(Socket *s)
|
||||
{
|
||||
NamedPipeServerSocket *ps = FROMFIELD(s, NamedPipeServerSocket, sockvt);
|
||||
|
||||
@ -63,13 +63,13 @@ static void sk_namedpipeserver_close(Socket s)
|
||||
sfree(ps);
|
||||
}
|
||||
|
||||
static const char *sk_namedpipeserver_socket_error(Socket s)
|
||||
static const char *sk_namedpipeserver_socket_error(Socket *s)
|
||||
{
|
||||
NamedPipeServerSocket *ps = FROMFIELD(s, NamedPipeServerSocket, sockvt);
|
||||
return ps->error;
|
||||
}
|
||||
|
||||
static char *sk_namedpipeserver_peer_info(Socket s)
|
||||
static char *sk_namedpipeserver_peer_info(Socket *s)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -114,7 +114,7 @@ static int create_named_pipe(NamedPipeServerSocket *ps, int first_instance)
|
||||
return ps->pipehandle != INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
static Socket named_pipe_accept(accept_ctx_t ctx, Plug plug)
|
||||
static Socket *named_pipe_accept(accept_ctx_t ctx, Plug *plug)
|
||||
{
|
||||
HANDLE conn = (HANDLE)ctx.p;
|
||||
|
||||
@ -122,10 +122,10 @@ static Socket named_pipe_accept(accept_ctx_t ctx, Plug plug)
|
||||
}
|
||||
|
||||
/*
|
||||
* Dummy SockAddr type which just holds a named pipe address. Only
|
||||
* Dummy SockAddr *type which just holds a named pipe address. Only
|
||||
* used for calling plug_log from named_pipe_accept_loop() here.
|
||||
*/
|
||||
SockAddr sk_namedpipe_addr(const char *pipename);
|
||||
SockAddr *sk_namedpipe_addr(const char *pipename);
|
||||
|
||||
static void named_pipe_accept_loop(NamedPipeServerSocket *ps,
|
||||
int got_one_already)
|
||||
@ -216,7 +216,7 @@ static const Socket_vtable NamedPipeServerSocket_sockvt = {
|
||||
sk_namedpipeserver_peer_info,
|
||||
};
|
||||
|
||||
Socket new_named_pipe_listener(const char *pipename, Plug plug)
|
||||
Socket *new_named_pipe_listener(const char *pipename, Plug *plug)
|
||||
{
|
||||
NamedPipeServerSocket *ret = snew(NamedPipeServerSocket);
|
||||
ret->sockvt = &NamedPipeServerSocket_sockvt;
|
||||
|
@ -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);
|
||||
|
@ -10,7 +10,8 @@
|
||||
|
||||
#define SERIAL_MAX_BACKLOG 4096
|
||||
|
||||
typedef struct serial_backend_data {
|
||||
typedef struct Serial Serial;
|
||||
struct Serial {
|
||||
HANDLE port;
|
||||
struct handle *out, *in;
|
||||
Frontend *frontend;
|
||||
@ -18,9 +19,9 @@ typedef struct serial_backend_data {
|
||||
long clearbreak_time;
|
||||
int break_in_progress;
|
||||
Backend backend;
|
||||
} *Serial;
|
||||
};
|
||||
|
||||
static void serial_terminate(Serial serial)
|
||||
static void serial_terminate(Serial *serial)
|
||||
{
|
||||
if (serial->out) {
|
||||
handle_free(serial->out);
|
||||
@ -40,7 +41,7 @@ static void serial_terminate(Serial serial)
|
||||
|
||||
static int serial_gotdata(struct handle *h, void *data, int len)
|
||||
{
|
||||
Serial serial = (Serial)handle_get_privdata(h);
|
||||
Serial *serial = (Serial *)handle_get_privdata(h);
|
||||
if (len <= 0) {
|
||||
const char *error_msg;
|
||||
|
||||
@ -72,7 +73,7 @@ static int serial_gotdata(struct handle *h, void *data, int len)
|
||||
|
||||
static void serial_sentdata(struct handle *h, int new_backlog)
|
||||
{
|
||||
Serial serial = (Serial)handle_get_privdata(h);
|
||||
Serial *serial = (Serial *)handle_get_privdata(h);
|
||||
if (new_backlog < 0) {
|
||||
const char *error_msg = "Error writing to serial device";
|
||||
|
||||
@ -88,7 +89,7 @@ static void serial_sentdata(struct handle *h, int new_backlog)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *serial_configure(Serial serial, HANDLE serport, Conf *conf)
|
||||
static const char *serial_configure(Serial *serial, HANDLE serport, Conf *conf)
|
||||
{
|
||||
DCB dcb;
|
||||
COMMTIMEOUTS timeouts;
|
||||
@ -203,12 +204,12 @@ static const char *serial_init(Frontend *frontend, Backend **backend_handle,
|
||||
Conf *conf, const char *host, int port,
|
||||
char **realhost, int nodelay, int keepalive)
|
||||
{
|
||||
Serial serial;
|
||||
Serial *serial;
|
||||
HANDLE serport;
|
||||
const char *err;
|
||||
char *serline;
|
||||
|
||||
serial = snew(struct serial_backend_data);
|
||||
serial = snew(Serial);
|
||||
serial->port = INVALID_HANDLE_VALUE;
|
||||
serial->out = serial->in = NULL;
|
||||
serial->bufsize = 0;
|
||||
@ -283,7 +284,7 @@ static const char *serial_init(Frontend *frontend, Backend **backend_handle,
|
||||
|
||||
static void serial_free(Backend *be)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
|
||||
serial_terminate(serial);
|
||||
expire_timer_context(serial);
|
||||
@ -292,7 +293,7 @@ static void serial_free(Backend *be)
|
||||
|
||||
static void serial_reconfig(Backend *be, Conf *conf)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
|
||||
serial_configure(serial, serial->port, conf);
|
||||
|
||||
@ -307,7 +308,7 @@ static void serial_reconfig(Backend *be, Conf *conf)
|
||||
*/
|
||||
static int serial_send(Backend *be, const char *buf, int len)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
|
||||
if (serial->out == NULL)
|
||||
return 0;
|
||||
@ -321,7 +322,7 @@ static int serial_send(Backend *be, const char *buf, int len)
|
||||
*/
|
||||
static int serial_sendbuffer(Backend *be)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
return serial->bufsize;
|
||||
}
|
||||
|
||||
@ -336,7 +337,7 @@ static void serial_size(Backend *be, int width, int height)
|
||||
|
||||
static void serbreak_timer(void *ctx, unsigned long now)
|
||||
{
|
||||
Serial serial = (Serial)ctx;
|
||||
Serial *serial = (Serial *)ctx;
|
||||
|
||||
if (now == serial->clearbreak_time && serial->port) {
|
||||
ClearCommBreak(serial->port);
|
||||
@ -350,7 +351,7 @@ static void serbreak_timer(void *ctx, unsigned long now)
|
||||
*/
|
||||
static void serial_special(Backend *be, SessionSpecialCode code, int arg)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
|
||||
if (serial->port && code == SS_BRK) {
|
||||
logevent(serial->frontend, "Starting serial break at user request");
|
||||
@ -398,7 +399,7 @@ static int serial_sendok(Backend *be)
|
||||
|
||||
static void serial_unthrottle(Backend *be, int backlog)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
if (serial->in)
|
||||
handle_unthrottle(serial->in, backlog);
|
||||
}
|
||||
@ -423,7 +424,7 @@ static void serial_provide_logctx(Backend *be, LogContext *logctx)
|
||||
|
||||
static int serial_exitcode(Backend *be)
|
||||
{
|
||||
Serial serial = FROMFIELD(be, struct serial_backend_data, backend);
|
||||
Serial *serial = FROMFIELD(be, Serial, backend);
|
||||
if (serial->port != INVALID_HANDLE_VALUE)
|
||||
return -1; /* still connected */
|
||||
else
|
||||
|
@ -116,17 +116,17 @@ static char *make_name(const char *prefix, const char *name)
|
||||
return retname;
|
||||
}
|
||||
|
||||
Socket new_named_pipe_client(const char *pipename, Plug plug);
|
||||
Socket new_named_pipe_listener(const char *pipename, Plug plug);
|
||||
Socket *new_named_pipe_client(const char *pipename, Plug *plug);
|
||||
Socket *new_named_pipe_listener(const char *pipename, Plug *plug);
|
||||
|
||||
int platform_ssh_share(const char *pi_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)
|
||||
{
|
||||
char *name, *mutexname, *pipename;
|
||||
HANDLE mutex;
|
||||
Socket retsock;
|
||||
Socket *retsock;
|
||||
PSECURITY_DESCRIPTOR psd;
|
||||
PACL acl;
|
||||
|
||||
|
14
x11fwd.c
14
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);
|
||||
|
Loading…
Reference in New Issue
Block a user