log->debug(TAG, "Starting InputUDP command server on port {}", port);
- if (!udp4.init(static_cast<USHORT>(port)))
+ if (!udp6.init(static_cast<USHORT>(port)))
{
- log->debug(TAG, "UDP4 init error");
+ log->debug(TAG, "UDP6 init error");
initted = false;
return false;
}
{
log->error(TAG, "pipe2() fail");
#endif
- udp4.shutdown();
+ udp6.shutdown();
initted = false;
return false;
}
CLOSESOCKET(quitPipe);
#endif
- udp4.shutdown();
+ udp6.shutdown();
#ifndef WIN32
CLOSESOCKET(pfds[1]);
while(1)
{
#ifdef WIN32
- retval = udp4.waitforMessage(3, quitPipe);
+ retval = udp6.waitforMessage(3, quitPipe);
#else
- retval = udp4.waitforMessage(3, pfds[0]);
+ retval = udp6.waitforMessage(3, pfds[0]);
#endif
log->debug(TAG, "Back from waitForMessage");
if (retval == 2)
{
- processRequest(udp4.getData(), udp4.getDataLength());
+ processRequest(udp6.getData(), udp6.getDataLength());
}
else if (retval == 3) // quit
{
#endif
#include "defines.h"
-#include "udp4.h"
+#include "udp6.h"
#include "input.h"
class LogNT;
const char* modName() { return myModName; }
bool initted{};
- UDP4 udp4; // FIXME UDP6 ?
+ UDP6 udp6;
LogNT* log{};
std::thread listenThread;
if ((socketnum = socket(AF_INET6, SOCK_DGRAM, 0)) == -1)
{ perror("socket"); return 0; }
- // FIXME - implement server side
-
- /*
-
memset(&myAddr, 0, sizeof(myAddr));
myAddr.sin6_family = AF_INET6; // host byte order
myAddr.sin6_port = htons(myPort); // short, network byte order
+ myAddr.sin6_addr = in6addr_any;
-// myAddr.sin_addr.s_addr = getIPNumber(iterate_ip++); // auto-fill with my IP
-
- inet_pton(AF_INET6, "", &myAddr.sin6_addr);
+ /*
+ * FIXME This _might_ need porting to Windows
+ myAddr.sin_addr.s_addr = getIPNumber(iterate_ip++); // auto-fill with my IP
+ inet_pton(AF_INET6, "", &myAddr.sin6_addr);
+ */
-/ *
if (bind(socketnum, reinterpret_cast<struct sockaddr *>(&myAddr), addrlen) == -1)
- { perror("bind"); return 0; }
-* /
-
-*/
+ { perror("bind6"); return 0; }
FD_ZERO(&readfds);
FD_SET(socketnum, &readfds);
ULONG iterate_ip{};
int socketnum; // Socket descriptor
USHORT myPort{}; // My port number
-// struct sockaddr_in6 myAddr; // My address
+ struct sockaddr_in6 myAddr; // My address
struct sockaddr_in6 theirAddr; // User address
socklen_t addrlen; // length of sockaddr struct
char buf[MAXBUFLEN]; // main data buffer