-#include "signals.h"
-#include "gdb_string.h"
-
-struct tcp_ttystate
-{
- int bogus;
-};
-
-static int tcp_open PARAMS ((serial_t scb, const char *name));
-static void tcp_raw PARAMS ((serial_t scb));
-static int wait_for PARAMS ((serial_t scb, int timeout));
-static int tcp_readchar PARAMS ((serial_t scb, int timeout));
-static int tcp_setbaudrate PARAMS ((serial_t scb, int rate));
-static int tcp_setstopbits PARAMS ((serial_t scb, int num));
-static int tcp_write PARAMS ((serial_t scb, const char *str, int len));
-/* FIXME: static void tcp_restore PARAMS ((serial_t scb)); */
-static void tcp_close PARAMS ((serial_t scb));
-static serial_ttystate tcp_get_tty_state PARAMS ((serial_t scb));
-static int tcp_set_tty_state PARAMS ((serial_t scb, serial_ttystate state));
-static int tcp_return_0 PARAMS ((serial_t));
-static int tcp_noflush_set_tty_state PARAMS ((serial_t, serial_ttystate,
- serial_ttystate));
-static void tcp_print_tty_state PARAMS ((serial_t, serial_ttystate));
-
-void _initialize_ser_tcp PARAMS ((void));
-
-/* Open up a raw tcp socket */
-
-static int
-tcp_open(scb, name)
- serial_t scb;
- const char *name;
-{
- char *port_str;
- int port;
- struct hostent *hostent;
- struct sockaddr_in sockaddr;
- int tmp;
- char hostname[100];
- struct protoent *protoent;
- int i;
-
- port_str = strchr (name, ':');
-
- if (!port_str)
- error ("tcp_open: No colon in host name!"); /* Shouldn't ever happen */
-
- tmp = min (port_str - name, (int) sizeof hostname - 1);
- strncpy (hostname, name, tmp); /* Don't want colon */
- hostname[tmp] = '\000'; /* Tie off host name */
- port = atoi (port_str + 1);
-
- hostent = gethostbyname (hostname);
-
- if (!hostent)
- {
- fprintf_unfiltered (gdb_stderr, "%s: unknown host\n", hostname);
- errno = ENOENT;
- return -1;
- }
-
- for (i = 1; i <= 15; i++)
- {
- scb->fd = socket (PF_INET, SOCK_STREAM, 0);
- if (scb->fd < 0)
- return -1;
-
- /* Allow rapid reuse of this port. */
- tmp = 1;
- setsockopt (scb->fd, SOL_SOCKET, SO_REUSEADDR, (char *)&tmp, sizeof(tmp));