mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Add Interactor methods to get/set LogPolicy and Seat.
Nothing uses this yet, but the next commit will.
This commit is contained in:
parent
44db74ec51
commit
aac5e096fa
@ -130,8 +130,29 @@ static char *raw_description(Interactor *itr)
|
||||
return dupstr(raw->description);
|
||||
}
|
||||
|
||||
static LogPolicy *raw_logpolicy(Interactor *itr)
|
||||
{
|
||||
Raw *raw = container_of(itr, Raw, interactor);
|
||||
return log_get_policy(raw->logctx);
|
||||
}
|
||||
|
||||
static Seat *raw_get_seat(Interactor *itr)
|
||||
{
|
||||
Raw *raw = container_of(itr, Raw, interactor);
|
||||
return raw->seat;
|
||||
}
|
||||
|
||||
static void raw_set_seat(Interactor *itr, Seat *seat)
|
||||
{
|
||||
Raw *raw = container_of(itr, Raw, interactor);
|
||||
raw->seat = seat;
|
||||
}
|
||||
|
||||
static const InteractorVtable Raw_interactorvt = {
|
||||
.description = raw_description,
|
||||
.logpolicy = raw_logpolicy,
|
||||
.get_seat = raw_get_seat,
|
||||
.set_seat = raw_set_seat,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -207,8 +207,29 @@ static char *rlogin_description(Interactor *itr)
|
||||
return dupstr(rlogin->description);
|
||||
}
|
||||
|
||||
static LogPolicy *rlogin_logpolicy(Interactor *itr)
|
||||
{
|
||||
Rlogin *rlogin = container_of(itr, Rlogin, interactor);
|
||||
return log_get_policy(rlogin->logctx);
|
||||
}
|
||||
|
||||
static Seat *rlogin_get_seat(Interactor *itr)
|
||||
{
|
||||
Rlogin *rlogin = container_of(itr, Rlogin, interactor);
|
||||
return rlogin->seat;
|
||||
}
|
||||
|
||||
static void rlogin_set_seat(Interactor *itr, Seat *seat)
|
||||
{
|
||||
Rlogin *rlogin = container_of(itr, Rlogin, interactor);
|
||||
rlogin->seat = seat;
|
||||
}
|
||||
|
||||
static const InteractorVtable Rlogin_interactorvt = {
|
||||
.description = rlogin_description,
|
||||
.logpolicy = rlogin_logpolicy,
|
||||
.get_seat = rlogin_get_seat,
|
||||
.set_seat = rlogin_set_seat,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -649,8 +649,29 @@ static char *supdup_description(Interactor *itr)
|
||||
return dupstr(supdup->description);
|
||||
}
|
||||
|
||||
static LogPolicy *supdup_logpolicy(Interactor *itr)
|
||||
{
|
||||
Supdup *supdup = container_of(itr, Supdup, interactor);
|
||||
return log_get_policy(supdup->logctx);
|
||||
}
|
||||
|
||||
static Seat *supdup_get_seat(Interactor *itr)
|
||||
{
|
||||
Supdup *supdup = container_of(itr, Supdup, interactor);
|
||||
return supdup->seat;
|
||||
}
|
||||
|
||||
static void supdup_set_seat(Interactor *itr, Seat *seat)
|
||||
{
|
||||
Supdup *supdup = container_of(itr, Supdup, interactor);
|
||||
supdup->seat = seat;
|
||||
}
|
||||
|
||||
static const InteractorVtable Supdup_interactorvt = {
|
||||
.description = supdup_description,
|
||||
.logpolicy = supdup_logpolicy,
|
||||
.get_seat = supdup_get_seat,
|
||||
.set_seat = supdup_set_seat,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -695,8 +695,29 @@ static char *telnet_description(Interactor *itr)
|
||||
return dupstr(telnet->description);
|
||||
}
|
||||
|
||||
static LogPolicy *telnet_logpolicy(Interactor *itr)
|
||||
{
|
||||
Telnet *telnet = container_of(itr, Telnet, interactor);
|
||||
return log_get_policy(telnet->logctx);
|
||||
}
|
||||
|
||||
static Seat *telnet_get_seat(Interactor *itr)
|
||||
{
|
||||
Telnet *telnet = container_of(itr, Telnet, interactor);
|
||||
return telnet->seat;
|
||||
}
|
||||
|
||||
static void telnet_set_seat(Interactor *itr, Seat *seat)
|
||||
{
|
||||
Telnet *telnet = container_of(itr, Telnet, interactor);
|
||||
telnet->seat = seat;
|
||||
}
|
||||
|
||||
static const InteractorVtable Telnet_interactorvt = {
|
||||
.description = telnet_description,
|
||||
.logpolicy = telnet_logpolicy,
|
||||
.get_seat = telnet_get_seat,
|
||||
.set_seat = telnet_set_seat,
|
||||
};
|
||||
|
||||
/*
|
||||
|
22
putty.h
22
putty.h
@ -661,10 +661,32 @@ struct InteractorVtable {
|
||||
* The returned string must be freed by the caller.
|
||||
*/
|
||||
char *(*description)(Interactor *itr);
|
||||
|
||||
/*
|
||||
* Returns the LogPolicy associated with this Interactor. (A
|
||||
* Backend can derive this from its logging context; a proxy
|
||||
* Interactor inherits it from the Interactor for the parent
|
||||
* network connection.)
|
||||
*/
|
||||
LogPolicy *(*logpolicy)(Interactor *itr);
|
||||
|
||||
/*
|
||||
* Gets and sets the Seat that this Interactor talks to. When a
|
||||
* Seat is borrowed and replaced with a TempSeat, this will be the
|
||||
* mechanism by which that replacement happens.
|
||||
*/
|
||||
Seat *(*get_seat)(Interactor *itr);
|
||||
void (*set_seat)(Interactor *itr, Seat *seat);
|
||||
};
|
||||
|
||||
static inline char *interactor_description(Interactor *itr)
|
||||
{ return itr->vt->description(itr); }
|
||||
static inline LogPolicy *interactor_logpolicy(Interactor *itr)
|
||||
{ return itr->vt->logpolicy(itr); }
|
||||
static inline Seat *interactor_get_seat(Interactor *itr)
|
||||
{ return itr->vt->get_seat(itr); }
|
||||
static inline void interactor_set_seat(Interactor *itr, Seat *seat)
|
||||
{ itr->vt->set_seat(itr, seat); }
|
||||
|
||||
/* Interactors that are Backends will find this helper function useful
|
||||
* in constructing their description strings */
|
||||
|
21
ssh/ssh.c
21
ssh/ssh.c
@ -732,8 +732,29 @@ static char *ssh_description(Interactor *itr)
|
||||
return dupstr(ssh->description);
|
||||
}
|
||||
|
||||
static LogPolicy *ssh_logpolicy(Interactor *itr)
|
||||
{
|
||||
Ssh *ssh = container_of(itr, Ssh, interactor);
|
||||
return log_get_policy(ssh->logctx);
|
||||
}
|
||||
|
||||
static Seat *ssh_get_seat(Interactor *itr)
|
||||
{
|
||||
Ssh *ssh = container_of(itr, Ssh, interactor);
|
||||
return ssh->seat;
|
||||
}
|
||||
|
||||
static void ssh_set_seat(Interactor *itr, Seat *seat)
|
||||
{
|
||||
Ssh *ssh = container_of(itr, Ssh, interactor);
|
||||
ssh->seat = seat;
|
||||
}
|
||||
|
||||
static const InteractorVtable Ssh_interactorvt = {
|
||||
.description = ssh_description,
|
||||
.logpolicy = ssh_logpolicy,
|
||||
.get_seat = ssh_get_seat,
|
||||
.set_seat = ssh_set_seat,
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user