abort();
}
- logger(DEBUG_META, LOG_DEBUG, "send_meta_sptps(%s, %p, %zu)", c->name, buffer, length);
+ logger(DEBUG_META, LOG_DEBUG, "send_meta_sptps(%s, %p, %d)", c->name, buffer, (int)length);
buffer_add(&c->outbuf, buffer, length);
event_add(&c->outevent, NULL);
size_t outlen;
#if defined(SOL_IP) && defined(IP_TOS)
static int priority = 0;
- int origpriority = origpkt->priority;
#endif
+ int origpriority = origpkt->priority;
if(!n->status.reachable) {
logger(DEBUG_TRAFFIC, LOG_INFO, "Trying to send UDP packet to unreachable node %s (%s)", n->name, n->hostname);
b64encode(key, key, ECDH_SIZE + siglen);
- int result = send_request(to->nexthop->connection, "%d %s %s %s %d %d %zu %d", ANS_KEY,
+ int result = send_request(to->nexthop->connection, "%d %s %s %s %d %d %d %d", ANS_KEY,
myself->name, to->name, key,
cipher_get_nid(&myself->incipher),
digest_get_nid(&myself->indigest),
- digest_length(&myself->indigest),
+ (int)digest_length(&myself->indigest),
myself->incompression);
return result;
to->received_seqno = 0;
if(replaywin) memset(to->late, 0, replaywin);
- return send_request(to->nexthop->connection, "%d %s %s %s %d %d %zu %d", ANS_KEY,
+ return send_request(to->nexthop->connection, "%d %s %s %s %d %d %d %d", ANS_KEY,
myself->name, to->name, key,
cipher_get_nid(&to->incipher),
digest_get_nid(&to->indigest),
- digest_length(&to->indigest),
+ (int)digest_length(&to->indigest),
to->incompression);
}
*/
#include "system.h"
-#include "poll.h"
#include "crypto.h"
#include "ecdsa.h"
static bool send_data(void *handle, const char *data, size_t len) {
char hex[len * 2 + 1];
bin2hex(data, hex, len);
- fprintf(stderr, "Sending %zu bytes of data:\n%s\n", len, hex);
+ fprintf(stderr, "Sending %d bytes of data:\n%s\n", (int)len, hex);
const int *sock = handle;
if(send(*sock, data, len, 0) != len)
return false;
if(argc > 4)
initiator = true;
+#ifdef HAVE_MINGW
+ static struct WSAData wsa_state;
+ if(WSAStartup(MAKEWORD(2, 2), &wsa_state))
+ return 1;
+#endif
+
struct addrinfo *ai, hint;
memset(&hint, 0, sizeof hint);
while(true) {
char buf[65535] = "";
- struct pollfd fds[2];
- fds[0].fd = 0;
- fds[0].events = POLLIN;
- fds[1].fd = sock;
- fds[1].events = POLLIN;
- if(poll(fds, 2, -1) < 0)
+ fd_set fds;
+ FD_ZERO(&fds);
+#ifndef HAVE_MINGW
+ FD_SET(0, &fds);
+#endif
+ FD_SET(sock, &fds);
+ if(select(sock + 1, &fds, NULL, NULL, NULL) <= 0)
return 1;
- if(fds[0].revents) {
+ if(FD_ISSET(0, &fds)) {
ssize_t len = read(0, buf, sizeof buf);
if(len < 0) {
fprintf(stderr, "Could not read from stdin: %s\n", strerror(errno));
return 1;
}
- if(fds[1].revents) {
+ if(FD_ISSET(sock, &fds)) {
ssize_t len = recv(sock, buf, sizeof buf, 0);
if(len < 0) {
fprintf(stderr, "Could not read from socket: %s\n", strerror(errno));
}
char hex[len * 2 + 1];
bin2hex(buf, hex, len);
- fprintf(stderr, "Received %zd bytes of data:\n%s\n", len, hex);
+ fprintf(stderr, "Received %d bytes of data:\n%s\n", (int)len, hex);
if(!sptps_receive_data(&s, buf, len))
return 1;
}
#include "tincctl.h"
#include "top.h"
+#ifdef HAVE_MINGW
+#define mkdir(a, b) mkdir(a)
+#endif
+
/* The name this program was run with. */
static char *program_name = NULL;
#ifndef HAVE_MINGW
char *editor = getenv("VISUAL") ?: getenv("EDITOR") ?: "vi";
#else
- char *editor = "edit"
+ char *editor = "edit";
#endif
char *command;