portfwd.c revision f0c792e78a8bf77c28c7814441e514bea7c5362b
/* -*- indent-tabs-mode: nil; -*- */
#include "winutils.h"
#include "portfwd.h"
#ifndef RT_OS_WINDOWS
#include <poll.h>
#else
# include "winpoll.h"
#endif
#include <stdio.h>
#include <string.h>
#include "proxy.h"
#include "proxy_pollmgr.h"
#include "pxremap.h"
struct portfwd_msg {
int add;
};
static int portfwd_chan_send(struct portfwd_msg *);
static struct pollmgr_handler portfwd_pmgr_chan_hdl;
void
portfwd_init(void)
{
/* add preconfigured forwarders */
fwtcp_init();
fwudp_init();
}
static int
{
if (nsent < 0) {
return -1;
}
return 0;
}
static int
{
struct portfwd_msg *msg;
return -1;
}
return portfwd_chan_send(msg);
}
int
{
}
int
{
return portfwd_rule_add_del(fwspec, 0);
}
/**
* POLLMGR_CHAN_PORTFWD handler.
*/
static int
{
}
else {
}
}
else { /* SOCK_DGRAM */
}
else {
}
}
return POLLIN;
}
int
{
int status;
int saf;
#if HAVE_SA_LEN
#endif
#if HAVE_SA_LEN
#endif
}
else { /* PF_INET6 */
#if HAVE_SA_LEN
#endif
#if HAVE_SA_LEN
#endif
}
LWIP_ASSERT1(status >= 0);
if (status == 0) {
return -1;
}
LWIP_ASSERT1(status >= 0);
if (status == 0) {
return -1;
}
return 0;
}
int
{
LWIP_ASSERT1(a != NULL);
LWIP_ASSERT1(b != NULL);
return 0;
}
}
else { /* PF_INET6 */
}
}
/**
* Set fwdsrc to the IP address of the peer.
*
* For port-forwarded connections originating from hosts loopback the
* source address is set to the address of one of lwIP interfaces.
*
* Currently we only have one interface so there's not much logic
* here. In the future we might need to additionally consult fwspec
* and routing table to determine which netif is used for connections
* to the specified guest.
*/
int
{
int mapping;
}
}
else {
}
return mapping;
}