};
struct PFwdPrivate {
- struct plug_function_table *fn;
+ const struct plug_function_table *fn;
/* the above variable absolutely *must* be the first in this structure */
void *c; /* (channel) data used by ssh.c */
void *backhandle; /* instance of SSH backend itself */
char *pfd_newconnect(Socket *s, char *hostname, int port, void *c,
const Config *cfg)
{
- static struct plug_function_table fn_table = {
+ static const struct plug_function_table fn_table = {
pfd_closing,
pfd_receive,
pfd_sent,
/*
* Open socket.
*/
- pr = (struct PFwdPrivate *) smalloc(sizeof(struct PFwdPrivate));
+ pr = snew(struct PFwdPrivate);
pr->fn = &fn_table;
pr->throttled = pr->throttle_override = 0;
pr->ready = 1;
static int pfd_accepting(Plug p, void *sock)
{
- static struct plug_function_table fn_table = {
+ static const struct plug_function_table fn_table = {
pfd_closing,
pfd_receive,
pfd_sent,
char *err;
org = (struct PFwdPrivate *)p;
- pr = (struct PFwdPrivate *) smalloc(sizeof(struct PFwdPrivate));
+ pr = snew(struct PFwdPrivate);
pr->fn = &fn_table;
pr->c = NULL;
char *pfd_addforward(char *desthost, int destport, char *srcaddr, int port,
void *backhandle, const Config *cfg)
{
- static struct plug_function_table fn_table = {
+ static const struct plug_function_table fn_table = {
pfd_closing,
pfd_receive, /* should not happen... */
pfd_sent, /* also should not happen */
/*
* Open socket.
*/
- pr = (struct PFwdPrivate *) smalloc(sizeof(struct PFwdPrivate));
+ pr = snew(struct PFwdPrivate);
pr->fn = &fn_table;
pr->c = NULL;
strcpy(pr->hostname, desthost);