1
0
mirror of https://github.com/solemnwarning/ipxwrapper synced 2024-12-30 16:45:37 +01:00
ipxwrapper/src/router.h

69 lines
2.2 KiB
C
Raw Normal View History

/* 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>
2011-08-29 10:57:19 +00:00
/* Represents a bound IPX address */
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) */
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 */
BOOL reuse; /* SO_REUSEADDR */
struct router_addr *next;
};
struct router_vars {
BOOL running;
2011-08-29 10:57:19 +00:00
struct ipx_interface *interfaces;
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;
};
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, BOOL reuse);
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);
int router_set_reuse(struct router_vars *router, SOCKET control, SOCKET sock, BOOL reuse);
2011-08-29 10:57:19 +00:00
#endif /* !IPXWRAPPER_ROUTER_H */