X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/735132076ce596a46936878532cbfe409b1be87d..9f8418e870a70c264eda1598f2d470e5428c216d:/h/netsec.h diff --git a/h/netsec.h b/h/netsec.h index 27d29382..e05e79f1 100644 --- a/h/netsec.h +++ b/h/netsec.h @@ -34,10 +34,11 @@ void netsec_shutdown(netsec_context *ns_context, int closeflag); * Arguments: * * ns_context - Network security context - * fd - File descriptor of network connection. + * readfd - Read file descriptor of remote connection. + * writefd - Write file descriptor of remote connection */ -void netsec_set_fd(netsec_context *ns_context, int fd); +void netsec_set_fd(netsec_context *ns_context, int readfd, int writefd); /* * Set the userid used to authenticate to this connection. @@ -83,10 +84,34 @@ void netsec_set_snoop(netsec_context *ns_context, int snoop); * ns_context - Network security context * string - String to output * len - Length of string + * context - "Extra" context information to be used by callback. */ -typedef void (*netsec_snoop_callback)(netsec_context *ns_context, - const char *string, size_t len); +typedef void (netsec_snoop_callback)(netsec_context *ns_context, + const char *string, size_t len, + void *context); + +/* + * Set the snoop callback function; will be used to handle protocol-specific + * messages. Set to NULL to disable. + * + * Arguments: + * + * ns_context - Network security context + * callback - Snoop callback + * context - Extra context information to be passed to callback. + */ + +void netsec_set_snoop_callback(netsec_context *ns_context, + netsec_snoop_callback *callback, void *context); + +/* + * A sample callback protocols can utilize; decode base64 tokens in the + * output. The context is a pointer to an int which contains an offset + * into the data to start decoding. + */ + +extern netsec_snoop_callback netsec_b64_snoop_decoder; /* * Set the read timeout for this connection. @@ -114,7 +139,7 @@ void netsec_set_timeout(netsec_context *ns_context, int timeout); * Returns pointer to string, or NULL on error. */ -char *netsec_readline(netsec_context *ns_context, size_t *lenght, +char *netsec_readline(netsec_context *ns_context, size_t *length, char **errstr); /*