-uerr_t make_connection PARAMS ((int *, char *, unsigned short));
-uerr_t bindport PARAMS ((unsigned short *));
-uerr_t acceptport PARAMS ((int *));
-void closeport PARAMS ((int));
-unsigned char *conaddr PARAMS ((int));
-
-int iread PARAMS ((int, char *, int));
-int iwrite PARAMS ((int, char *, int));
+
+/* Returned by connect_to_host when host name cannot be resolved. */
+enum {
+ E_HOST = -100
+};
+int connect_to_host (const char *, int);
+int connect_to_ip (const ip_address *, int, const char *);
+
+int bind_local (const ip_address *, int *);
+int accept_connection (int);
+
+enum {
+ ENDPOINT_LOCAL,
+ ENDPOINT_PEER
+};
+bool socket_ip_address (int, ip_address *, int);
+int socket_family (int sock, int endpoint);
+
+bool retryable_socket_connect_error (int);
+
+/* Flags for select_fd's WAIT_FOR argument. */
+enum {
+ WAIT_FOR_READ = 1,
+ WAIT_FOR_WRITE = 2
+};
+int select_fd (int, double, int);
+bool test_socket_open (int);
+
+struct transport_implementation {
+ int (*reader) (int, char *, int, void *);
+ int (*writer) (int, char *, int, void *);
+ int (*poller) (int, double, int, void *);
+ int (*peeker) (int, char *, int, void *);
+ const char *(*errstr) (int, void *);
+ void (*closer) (int, void *);
+};
+
+void fd_register_transport (int, struct transport_implementation *, void *);
+void *fd_transport_context (int);
+int fd_read (int, char *, int, double);
+int fd_write (int, char *, int, double);
+int fd_peek (int, char *, int, double);
+const char *fd_errstr (int);
+void fd_close (int);