#include <stddef.h>
#include <stdlib.h>
#include <signal.h>
+
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
-#include <sys/un.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+
+#ifndef _WIN32
+#include <sys/un.h>
#include <netinet/tcp.h>
+#endif
+
+/*
+#if defined(_WIN32)
+ #ifdef HAVE_WINDOWS_H
+ #include <windows.h>
+ #endif
+
+ #include <ws2tcpip.h>
+
+ #ifdef HAVE_WINSOCK2_H
+ #include <winsock2.h>
+ #endif
+#endif
+*/
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
#include <wsutil/strtoi.h>
{
int fd = -1;
+#ifndef _WIN32
if (!strncmp(path, "unix:", 5))
{
struct sockaddr_un s_un;
}
}
+#endif
#ifdef SHARKD_TCP_SUPPORT
- else if (!strncmp(path, "tcp:", 4))
+ if (!strncmp(path, "tcp:", 4))
{
struct sockaddr_in s_in;
int one = 1;
return -1;
}
}
-#endif
else
{
+#endif
return -1;
+#ifdef SHARKD_TCP_SUPPORT
}
+#endif
+#ifndef _WIN32
if (listen(fd, SOMAXCONN))
{
close(fd);
return -1;
}
-
+#endif
return fd;
}
int
sharkd_init(int argc, char **argv)
{
+#ifndef _WIN32
int fd;
pid_t pid;
}
_server_fd = fd;
+#endif
return 0;
}
int
sharkd_loop(void)
{
+#ifndef _WIN32
while (1)
{
int fd;
close(fd);
}
-
+#endif
return 0;
}
#include <glib.h>
#include <wsutil/wsjsmn.h>
+#include <wsutil/ws_printf.h>
#include <file.h>
#include <epan/exceptions.h>
#ifdef HAVE_GEOIP
if (addr->type == AT_IPv4)
{
- uint32_t ip = pntoh32(addr->data);
+ guint32 ip = pntoh32(addr->data);
guint num_dbs = geoip_db_num_dbs();
guint dbnum;
taps_data[i] = NULL;
- snprintf(tapbuf, sizeof(tapbuf), "tap%d", i);
+ ws_snprintf(tapbuf, sizeof(tapbuf), "tap%d", i);
tok_tap = json_find_attr(buf, tokens, count, tapbuf);
if (!tok_tap)
break;
for (framenum = 1; framenum <= cfile.count; framenum++)
{
frame_data *fdata = frame_data_sequence_find(cfile.frames, framenum);
- int msec_rel;
+ time_t msec_rel;
int new_idx;
if (start_ts == NULL)
continue;
/* TODO, make it 64-bit, to avoid msec overflow after 24days */
- msec_rel = ((fdata->abs_ts.secs - start_ts->secs) * 1000 + (fdata->abs_ts.nsecs - start_ts->nsecs) / 1000000);
+ msec_rel = (time_t)((fdata->abs_ts.secs - start_ts->secs) * 1000 + (fdata->abs_ts.nsecs - start_ts->nsecs) / 1000000);
new_idx = msec_rel / interval_ms;
if (idx != new_idx)
if (!tok_name || tok_name[0] == '\0' || !tok_value)
return;
- snprintf(pref, sizeof(pref), "%s:%s", tok_name, tok_value);
+ ws_snprintf(pref, sizeof(pref), "%s:%s", tok_name, tok_value);
ret = prefs_set_pref(pref);
printf("{\"err\":%d}\n", ret);
else if (!strcmp(tok_req, "dumpconf"))
sharkd_session_process_dumpconf(buf, tokens, count);
else if (!strcmp(tok_req, "bye"))
- _Exit(0);
+ exit(0);
else
fprintf(stderr, "::: req = %s\n", tok_req);
int tokens_max = -1;
fprintf(stderr, "Hello in child!\n");
+#ifndef _WIN32
setlinebuf(stdout);
+#endif
while (fgets(buf, sizeof(buf), stdin))
{