#include "queue.h"
 #include <stdbool.h>
+#include <stdint.h>
 #include <time.h>
 
 /* A wrapper around vconn that provides queuing and optionally reliability.
 bool rconn_is_connected(const struct rconn *);
 int rconn_disconnected_duration(const struct rconn *);
 
+uint32_t rconn_get_ip(const struct rconn *);
+
 #endif /* rconn.h */
 
 {
     return rconn_is_connected(rconn) ? 0 : time(0) - rconn->last_connected;
 }
+
+/* Returns the IP address of the peer, or 0 if the peer is not connected over
+ * an IP-based protocol or if its IP address is not known. */
+uint32_t
+rconn_get_ip(const struct rconn *rconn) 
+{
+    return rconn->vconn ? vconn_get_ip(rconn->vconn) : 0;
+}
 \f
 static struct rconn *
 create_rconn(const char *name, int txq_limit, int probe_interval,