Add subclassing capability to struct trans

This commit is contained in:
matt335672 2022-02-14 09:14:22 +00:00
parent d5f99f41ac
commit 8f4860cb55
2 changed files with 9 additions and 0 deletions

View File

@ -120,6 +120,12 @@ trans_delete(struct trans *self)
return; return;
} }
/* Call the user-specified destructor if one exists */
if (self->extra_destructor != NULL)
{
self->extra_destructor(self);
}
free_stream(self->in_s); free_stream(self->in_s);
free_stream(self->out_s); free_stream(self->out_s);

View File

@ -108,6 +108,9 @@ struct trans
char port[256]; char port[256];
int no_stream_init_on_data_in; int no_stream_init_on_data_in;
int extra_flags; /* user defined */ int extra_flags; /* user defined */
void *extra_data; /* user defined */
void (*extra_destructor)(struct trans *); /* user defined */
struct ssl_tls *tls; struct ssl_tls *tls;
const char *ssl_protocol; /* e.g. TLSv1, TLSv1.1, TLSv1.2, unknown */ const char *ssl_protocol; /* e.g. TLSv1, TLSv1.1, TLSv1.2, unknown */
const char *cipher_name; /* e.g. AES256-GCM-SHA384 */ const char *cipher_name; /* e.g. AES256-GCM-SHA384 */