mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-05 21:42:47 -05:00
Introduce a new 'Interactor' trait.
This trait will be implemented by anything that wants to display interactive prompts or notifications to the user in the course of setting up a network connection, _or_ anything that wants to make a network connection whose proxy setup might in turn need to do that. To begin with, that means every Backend that makes network connections at all must be an Interactor, because any of those network connections might be proxied via an SSH jump host which might need to interact with the user. I'll fill in the contents of this trait over the next few commits, to keep the patches comprehensible. For the moment, I've just introduced the trait, set up implementations of it in the five network backends, and given it a single 'description' method. The previous 'description' methods of Backend and Plug are now removed, and their work is done by the new Interactor method instead. (I changed my mind since last week about where that should best live.) This isn't too much of an upheaval, fortunately, because I hadn't got round yet to committing anything that used those methods!
This commit is contained in:
22
network.h
22
network.h
@ -129,26 +129,6 @@ struct PlugVtable {
|
||||
* want the connection for some reason, or 0 on success.
|
||||
*/
|
||||
int (*accepting)(Plug *p, accept_fn_t constructor, accept_ctx_t ctx);
|
||||
|
||||
/*
|
||||
* Returns a user-facing description of the nature of the network
|
||||
* connection being made. Used in interactive proxy authentication
|
||||
* to announce which connection attempt is now in control of the
|
||||
* Seat.
|
||||
*
|
||||
* The idea is not just to be written in natural language, but to
|
||||
* connect with the user's idea of _why_ they think some
|
||||
* connection is being made. For example, instead of saying 'TCP
|
||||
* connection to 123.45.67.89 port 22', you might say 'SSH
|
||||
* connection to [logical host name for SSH host key purposes]'.
|
||||
*
|
||||
* This function pointer may be NULL, or may exist but return
|
||||
* NULL, in which case no user-facing description is available.
|
||||
*
|
||||
* If a non-NULL string is returned, it must be freed by the
|
||||
* caller.
|
||||
*/
|
||||
char *(*description)(Plug *p);
|
||||
};
|
||||
|
||||
/* Proxy indirection layer.
|
||||
@ -256,8 +236,6 @@ static inline void plug_sent (Plug *p, size_t bufsize)
|
||||
{ p->vt->sent(p, bufsize); }
|
||||
static inline int plug_accepting(Plug *p, accept_fn_t cons, accept_ctx_t ctx)
|
||||
{ return p->vt->accepting(p, cons, ctx); }
|
||||
static inline char *plug_description(Plug *p)
|
||||
{ return p->vt->description ? p->vt->description(p) : NULL; }
|
||||
|
||||
/*
|
||||
* Special error values are returned from sk_namelookup and sk_new
|
||||
|
Reference in New Issue
Block a user