+ /** Convert a human-readable address into an insp_inaddr.
+ *
+ * @param a A human-readable address
+ * @param n An insp_inaddr struct which the result
+ * will be copied into on success.
+ * @return This function will return 0 upon success,
+ * or any other number upon failure.
+ */
+ int insp_aton(const char* a, insp_inaddr* n);
+
+ /** Make a socket file descriptor a blocking socket
+ * @param s A valid file descriptor
+ */
+ void Blocking(int s);
+
+ /** Make a socket file descriptor into a nonblocking socket
+ * @param s A valid file descriptor
+ */
+ void NonBlocking(int s);
+
+ /** Create a new valid file descriptor using socket()
+ * @return On return this function will return a value >= 0 for success,
+ * or a negative value upon failure (negative values are invalid file
+ * descriptors)
+ */
+ int OpenTCPSocket();
+ };
+};
+
+/** This class handles incoming connections on client ports.
+ * It will create a new userrec for every valid connection
+ * and assign it a file descriptor.
+ */
+class ListenSocket : public EventHandler
+{
+ protected:
+ /** The creator/owner of this object
+ */
+ InspIRCd* ServerInstance;
+ public:
+ /** Create a new listening socket
+ */
+ ListenSocket(InspIRCd* Instance, int sockfd, irc::sockets::insp_sockaddr client, irc::sockets::insp_sockaddr server, int port, char* addr);
+ /** Handle an I/O event
+ */
+ void HandleEvent(EventType et);
+};