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

70 lines
2.1 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>
/* 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 */
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 */
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-08-29 10:57:19 +00:00
int router_bind(struct router_vars *router, SOCKET control, SOCKET sock, struct sockaddr_ipx *addr);
void router_set_port(struct router_vars *router, SOCKET control, SOCKET sock, uint16_t port);
void router_close(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
#endif /* !IPXWRAPPER_ROUTER_H */