lib_xtcp is based on uIP and supporting a single interface only.
As I am building an ethernet bridge
[tab=30]eth network A - xcore - serial interface - [a lot of stuff] - serial interface - xcore - eth network B
with a web based configuration interface, i'd like to be able to access an xcores configuration from both ethernet networks. This requires access to the tcp stack via the serial interface and ethernet.
Unfortunately I dont know where to start.
The first idea was to adjust xtcp_process_incoming_packet() in xtcp() by adding a parameter that is used to store the source interface for a packet within the uIP stack. In xcoredev_send(), where packets are transmitted, the transmit interface is selected based on this parameter.
This might work if only a single packet is transmitted whenever a packet is received. But TCP might be sending retransmits after a timeout, keep-alives or multiple packets depending on the receivers RWin-size, so I think I have to store the interface for each connection. I cannot find any global state for connections tho.
What I found is "pending_event[MAX_XTCP_CLIENTS]", "notified[MAX_XTCP_CLIENTS]" and some more arrays using MAX_XTCP_CLIENTS as their index but that doesnt seem very handy.
Is there any existing approach adding multiple interfaces to the xtcp stack? If not, do you have an idea for an approach that doesnt require rewriting most of the library?
EDIT:
I found
Code: Select all
typedef struct xtcpd_state_t {
unsigned int linknum;
xtcp_connection_t conn;
xtcp_server_state_t s;
} xtcpd_state_t;