mirror of
https://github.com/solemnwarning/ipxwrapper
synced 2024-12-30 16:45:37 +01:00
Dump most of the old "unit" tests which were more system tests and only tested a small amount of functionality against the host. The new test suite is a lot more thorough and tests an arbitrary Windows version over the network rather than testing within the host's WinSock environment. More documentation detailing how to run this will follow.
48 lines
1010 B
C
48 lines
1010 B
C
#ifndef IPXWRAPPER_TOOLS_H
|
|
#define IPXWRAPPER_TOOLS_H
|
|
|
|
#include <windows.h>
|
|
#include <winsock2.h>
|
|
#include <wsipx.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "addr.h"
|
|
|
|
static struct sockaddr_ipx read_sockaddr(const char *net_s, const char *node_s, const char *socket_s)
|
|
{
|
|
addr32_t net;
|
|
if(!addr32_from_string(&net, net_s))
|
|
{
|
|
fprintf(stderr, "Invalid network number: %s\n", net_s);
|
|
exit(1);
|
|
}
|
|
|
|
addr48_t node;
|
|
if(!addr48_from_string(&node, node_s))
|
|
{
|
|
fprintf(stderr, "Invalid node number: %s\n", node_s);
|
|
exit(1);
|
|
}
|
|
|
|
char *endptr;
|
|
int socket = strtol(socket_s, &endptr, 10);
|
|
|
|
if(socket_s[0] == '\0' || *endptr != '\0' || socket < 0 || socket > 65535)
|
|
{
|
|
fprintf(stderr, "Invalid socket number: %s\n", socket_s);
|
|
exit(1);
|
|
}
|
|
|
|
struct sockaddr_ipx sockaddr;
|
|
sockaddr.sa_family = AF_IPX;
|
|
addr32_out(sockaddr.sa_netnum, net);
|
|
addr48_out(sockaddr.sa_nodenum, node);
|
|
sockaddr.sa_socket = htons(socket);
|
|
|
|
return sockaddr;
|
|
}
|
|
|
|
#endif /* !IPXWRAPPER_TOOLS_H */
|