2011-08-29 10:03:58 +00:00
|
|
|
/* IPXWrapper - Router header
|
|
|
|
* Copyright (C) 2011 Daniel Collins <solemnwarning@solemnwarning.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published by
|
|
|
|
* the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc., 51
|
|
|
|
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef IPXWRAPPER_ROUTER_H
|
|
|
|
#define IPXWRAPPER_ROUTER_H
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <wsipx.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
/* Special address family for use when binding AF_IPX sockets, allows multiple
|
|
|
|
* sockets to share the same address.
|
|
|
|
*/
|
|
|
|
#define AF_IPX_SHARE 42
|
|
|
|
|
2011-08-29 10:57:19 +00:00
|
|
|
/* Represents a bound IPX address */
|
2011-08-29 10:03:58 +00:00
|
|
|
struct router_addr {
|
|
|
|
struct sockaddr_ipx addr;
|
|
|
|
|
2011-08-29 13:58:45 +00:00
|
|
|
uint16_t local_port; /* Local UDP port (NETWORK BYTE ORDER) */
|
2011-08-29 10:03:58 +00:00
|
|
|
SOCKET ws_socket; /* Application socket */
|
|
|
|
SOCKET control_socket; /* Control socket */
|
2011-08-29 13:58:45 +00:00
|
|
|
int filter_ptype; /* Packet type filter, negative to disable */
|
2011-08-29 10:03:58 +00:00
|
|
|
|
|
|
|
struct router_addr *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct router_vars {
|
|
|
|
BOOL running;
|
|
|
|
|
2011-08-29 10:57:19 +00:00
|
|
|
struct ipx_interface *interfaces;
|
|
|
|
|
2011-08-29 10:03:58 +00:00
|
|
|
SOCKET udp_sock;
|
|
|
|
SOCKET listner;
|
|
|
|
|
|
|
|
WSAEVENT wsa_event;
|
|
|
|
|
|
|
|
CRITICAL_SECTION crit_sec;
|
|
|
|
BOOL crit_sec_init;
|
|
|
|
|
|
|
|
struct router_addr *addrs;
|
2011-08-29 10:57:19 +00:00
|
|
|
|
|
|
|
char *recvbuf;
|
2011-08-29 10:03:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct router_vars *router_init(BOOL global);
|
|
|
|
void router_destroy(struct router_vars *router);
|
|
|
|
|
2011-09-07 20:03:16 +00:00
|
|
|
DWORD router_main(void *arg);
|
|
|
|
|
|
|
|
int router_bind(struct router_vars *router, SOCKET control, SOCKET sock, struct sockaddr_ipx *addr, uint32_t *nic_bcast);
|
2011-08-29 10:57:19 +00:00
|
|
|
void router_set_port(struct router_vars *router, SOCKET control, SOCKET sock, uint16_t port);
|
2011-09-07 20:03:16 +00:00
|
|
|
void router_unbind(struct router_vars *router, SOCKET control, SOCKET sock);
|
2011-08-29 13:58:45 +00:00
|
|
|
void router_set_filter(struct router_vars *router, SOCKET control, SOCKET sock, int ptype);
|
2011-08-29 10:57:19 +00:00
|
|
|
|
2011-08-29 10:03:58 +00:00
|
|
|
#endif /* !IPXWRAPPER_ROUTER_H */
|