+/**
+ * Get PROC_STAT sub-process structure of a connection.
+ *
+ * @param Idx Connection index number.
+ * @returns PROC_STAT structure.
+ */
+GLOBAL PROC_STAT *
+Conn_GetProcStat(CONN_ID Idx)
+{
+ CONNECTION *c;
+
+ assert(Idx >= 0);
+ c = array_get(&My_ConnArray, sizeof (CONNECTION), (size_t)Idx);
+ assert(c != NULL);
+ return &c->proc_stat;
+} /* Conn_GetProcStat */
+
+
+/**
+ * Get CONN_ID from file descriptor associated to a subprocess structure.
+ *
+ * @param fd File descriptor.
+ * @returns CONN_ID or NONE (-1).
+ */
+GLOBAL CONN_ID
+Conn_GetFromProc(int fd)
+{
+ int i;
+
+ assert(fd > 0);
+ for (i = 0; i < Pool_Size; i++) {
+ if ((My_Connections[i].sock != NONE)
+ && (Proc_GetPipeFd(&My_Connections[i].proc_stat) == fd))
+ return i;
+ }
+ return NONE;
+} /* Conn_GetFromProc */
+
+
+#ifndef STRICT_RFC
+
+GLOBAL long
+Conn_GetAuthPing(CONN_ID Idx)
+{
+ assert (Idx != NONE);
+ return My_Connections[Idx].auth_ping;
+} /* Conn_GetAuthPing */
+
+GLOBAL void
+Conn_SetAuthPing(CONN_ID Idx, long ID)
+{
+ assert (Idx != NONE);
+ My_Connections[Idx].auth_ping = ID;
+} /* Conn_SetAuthPing */
+
+#endif
+
+
+#ifdef SSL_SUPPORT
+
+/**
+ * Get information about used SSL chiper.
+ *
+ * @param Idx Connection index number.
+ * @param buf Buffer for returned information text.
+ * @param len Size of return buffer "buf".
+ * @returns true on success, false otherwise.
+ */
+GLOBAL bool
+Conn_GetCipherInfo(CONN_ID Idx, char *buf, size_t len)
+{
+ if (Idx < 0)
+ return false;
+ assert(Idx < (int) array_length(&My_ConnArray, sizeof(CONNECTION)));
+ return ConnSSL_GetCipherInfo(&My_Connections[Idx], buf, len);
+}
+
+
+/**
+ * Check if a connection is SSL-enabled or not.
+ *
+ * @param Idx Connection index number.
+ * @return true if connection is SSL-enabled, false otherwise.
+ */
+GLOBAL bool
+Conn_UsesSSL(CONN_ID Idx)
+{
+ if (Idx < 0)
+ return false;
+ assert(Idx < (int) array_length(&My_ConnArray, sizeof(CONNECTION)));
+ return Conn_OPTION_ISSET(&My_Connections[Idx], CONN_SSL);
+}
+
+#endif
+
+
+#ifdef DEBUG
+
+/**
+ * Dump internal state of the "connection module".
+ */
+GLOBAL void
+Conn_DebugDump(void)
+{
+ int i;
+
+ Log(LOG_DEBUG, "Connection status:");
+ for (i = 0; i < Pool_Size; i++) {
+ if (My_Connections[i].sock == NONE)
+ continue;
+ Log(LOG_DEBUG,
+ " - %d: host=%s, lastdata=%ld, lastping=%ld, delaytime=%ld, flag=%d, options=%d, bps=%d, client=%s",
+ My_Connections[i].sock, My_Connections[i].host,
+ My_Connections[i].lastdata, My_Connections[i].lastping,
+ My_Connections[i].delaytime, My_Connections[i].flag,
+ My_Connections[i].options, My_Connections[i].bps,
+ My_Connections[i].client ? Client_ID(My_Connections[i].client) : "-");
+ }
+} /* Conn_DumpClients */
+
+#endif
+
+