comparison cli-tcpfwd.c @ 63:dcc43965928f

- A nice cleaner structure for tcp (acceptor) forwarding. - still a checkpoint-ish commit - sorted out listening on localhost only
author Matt Johnston <matt@ucc.asn.au>
date Wed, 11 Aug 2004 17:26:47 +0000
parents 20563735e8b5
children efb5e0b335cf
comparison
equal deleted inserted replaced
62:20563735e8b5 63:dcc43965928f
10 NULL, 10 NULL,
11 NULL, 11 NULL,
12 NULL 12 NULL
13 }; 13 };
14 14
15 void setup_localtcp() {
15 16
17 qv
16 18
19 }
17 20
18 static int cli_localtcp(char* port) { 21 static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
22 unsigned int remoteport) {
19 23
20 struct TCPListener* tcpinfo = NULL; 24 struct TCPListener* tcpinfo = NULL;
21 25
22 tcpinfo = (struct TCPListener*)m_malloc(sizeof(struct TCPListener*)); 26 tcpinfo = (struct TCPListener*)m_malloc(sizeof(struct TCPListener*));
23 tcpinfo->addr = NULL; 27 tcpinfo->sendaddr = remoteaddr;
24 tcpinfo->port = port; 28 tcpinfo->sendport = remoteport;
29 tcpinfo->listenport = listenport;
25 tcpinfo->chantype = &cli_chan_tcplocal; 30 tcpinfo->chantype = &cli_chan_tcplocal;
26 31
27 ret = listen_tcpfwd(tcpinfo); 32 ret = listen_tcpfwd(tcpinfo);
28 33
29 if (ret == DROPBEAR_FAILURE) { 34 if (ret == DROPBEAR_FAILURE) {
30 DROPBEAR_LOG(LOG_WARNING, "Failed to listen on port %s", port);
31 m_free(tcpinfo); 35 m_free(tcpinfo);
32 } 36 }
33 return ret; 37 return ret;
34 } 38 }