+ struct tunnel_node *tn;
+
+ for (tn = tunnels; tn; tn = tn->next)
+ if (tn->tops == tops) return (0);
+ if (tops->init()) return (-1);
+ tn = CREATE(struct tunnel_node);
+ tn->next = 0; tn->tops = tops;
+ *tunnels_tail = tn; tunnels_tail = &tn->next;
+ if (!dflttun) dflttun = tops;
+ return (0);
+}
+
+/* --- @p_setdflttun@ --- *
+ *
+ * Arguments: @const tunnel_ops *tops@ = tunnel ops to set
+ *
+ * Returns: ---
+ *
+ * Use: Sets the default tunnel. It must already be registered. The
+ * old default is forgotten.
+ */
+
+void p_setdflttun(const tunnel_ops *tops)
+ { dflttun = tops; }
+
+/* --- @p_dflttun@ --- *
+ *
+ * Arguments: ---
+ *
+ * Returns: A pointer to the current default tunnel operations, or null
+ * if no tunnels are defined.
+ */
+
+const tunnel_ops *p_dflttun(void) { return (dflttun); }
+
+/* --- @p_findtun@ --- *
+ *
+ * Arguments: @const char *name@ = tunnel name
+ *
+ * Returns: Pointer to the tunnel operations, or null.
+ *
+ * Use: Finds the operations for a named tunnel class.
+ */
+
+const tunnel_ops *p_findtun(const char *name)
+{
+ const struct tunnel_node *tn;