+/*----- for udp-based comms -----*/
+
+#define UDP_MAX_SOCKETS 3 /* 2 ought to do really */
+
+struct udpsock {
+ union iaddr addr;
+ int fd;
+};
+
+struct udpsocks {
+ int n_socks;
+ struct udpsock socks[UDP_MAX_SOCKETS];
+ /* private for udp_socks_* */
+ struct udpcommon *uc; /* link to parent, for cfg, notify list, etc. */
+ struct poll_interest *interest;
+};
+
+struct udpcommon {
+ struct commcommon cc;
+ int port;
+ string_t authbind;
+ bool_t use_proxy;
+ union iaddr proxy;
+};
+
+bool_t udp_make_socket(struct udpcommon *uc, struct udpsock *us,
+ int failmsgclass);
+ /* Fills in us->fd. Logs any errors with lg_[v]perror. */
+
+void udp_destroy_socket(struct udpcommon *uc, struct udpsock *us);
+ /* Idempotent. No errors are possible. */
+
+void udp_socks_register(struct udpcommon *uc, struct udpsocks *socks);
+void udp_socks_deregister(struct udpcommon *uc, struct udpsocks *socks);
+
+#define UDP_APPLY_STANDARD(st,uc,desc) \
+ (uc)->use_proxy=False; \
+ (uc)->authbind=dict_read_string(d,"authbind",False,"udp",(uc)->cc.loc); \
+ (uc)->port=dict_read_number(d,"port",True,"udp",(uc)->cc.loc,0)
+ /* void UDP_APPLY_STANDARD(SOMETHING *st, struct udpcommon *uc,
+ * const char *desc);
+ * // Expects in scope: dict_t *d=...; as from COMM_APPLY_STANDARD
+ */
+