chiark / gitweb /
WIP DNS bugfixes
[secnet.git] / secnet.h
index d330f64c5323bc720b1379fd6333455b33ea4691..a206d057684ba38be10e2f2edf078b6839926bcf 100644 (file)
--- a/secnet.h
+++ b/secnet.h
@@ -312,6 +312,7 @@ struct comm_addr {
     struct comm_if *comm;
     union {
        struct sockaddr_in sin;
+       uint32_t associd;
     } priv;
 };
 
@@ -325,12 +326,18 @@ typedef void comm_release_notify_fn(void *commst, void *nst,
                                    comm_notify_fn *fn);
 typedef bool_t comm_sendmsg_fn(void *commst, struct buffer_if *buf,
                               const struct comm_addr *dest);
-typedef bool_t comm_addr_construct_fn(void *commst, struct comm_addr *ca,
-                                     const struct sockaddr_in *sin);
-       /* Fills in ca->comm an ca->priv.  *sin must have no nonzero padding,
-          so must have been FILLZERO'd before its useful fields were filled in.
-          The resulting ca->comm has been constructed likewise, as required
-          above.  On failure, logs error, returns false on failure.*/
+typedef void *comm_peer_addr_config_fn(void *commst, dict_t*, struct cloc,
+                                      cstring_t desc);
+       /* Checks the config for the peer as specified in dict,
+        * and either returns NULL to mean the relevant parameters
+        * weren't specified, or a non-NULL void* which can be
+        * passed to comm_peer_addr_fn */
+typedef void comm_peer_addr_answer_fn(void *st, const struct comm_addr *ca);
+typedef bool_t comm_peer_addr_request_fn(void *commst, void *from_peer_config,
+                                comm_peer_addr_answer_fn *cb, void *cst);
+       /* Calls comm_peer_addr_answer_fn, either immediately or later,
+        * with a suitable comm_addr.  The caller's cb should
+        * memcpy ca.  On failure, logs error and calls cb with ca=NULL */
 typedef const char *comm_addr_to_string_fn(void *commst,
                                           const struct comm_addr *ca);
         /* Returned string is in a static buffer. */
@@ -341,7 +348,8 @@ struct comm_if {
     comm_request_notify_fn *request_notify;
     comm_release_notify_fn *release_notify;
     comm_sendmsg_fn *sendmsg;
-    comm_addr_construct_fn *addr_construct;
+    comm_peer_addr_config_fn *peer_addr_config;
+    comm_peer_addr_request_fn *peer_addr_request;
     comm_addr_to_string_fn *addr_to_string;
 };