]> diplodocus.org Git - nmh/blobdiff - h/netsec.h
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / h / netsec.h
index 27d29382422abc9593225a9703885d88c54b5fbd..e05e79f1ea1138db6de040cf57599953285598a4 100644 (file)
@@ -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);
 
 /*