#include <csignal>
#include <cerrno>
+#include <cstring>
#include "stg/raw_ip_packet.h"
#include "stg/traffcounter.h"
if (ipq_h == NULL)
{
ipq_destroy_handle(ipq_h);
- logger("Cannot create IPQ handle.");
+ logger("Cannot create IPQ handle. Error: '%s', '%s'", ipq_errstr(), strerror(errno));
errorStr = "Cannot create ipq handle!";
return -1;
}
};
#define IPQ_MAXERR IPQ_ERR_PROTOCOL
-/*struct ipq_errmap_t
+struct ipq_errmap_t
{
int errcode;
char *message;
{ IPQ_ERR_RECVBUF, "Receive buffer size invalid"},
{ IPQ_ERR_TIMEOUT, "Timeout"},
{ IPQ_ERR_PROTOCOL, "Invalid protocol specified"}
-};*/
+};
static int ipq_errno = IPQ_ERR_NONE;
return status;
}
//-----------------------------------------------------------------------------
-/*static char *ipq_strerror(int errcode)
+static char *ipq_strerror(int errcode)
{
if (errcode < 0 || errcode > IPQ_MAXERR)
errcode = IPQ_ERR_IMPL;
return ipq_errmap[errcode].message;
-}*/
+}
/****************************************************************************
*
return 1;
}
//-----------------------------------------------------------------------------
-/*char *ipq_errstr(void)
+char *ipq_errstr(void)
{
return ipq_strerror(ipq_errno);
-}*/
+}
//-----------------------------------------------------------------------------
/*void ipq_perror(const char *s)
{
#include "ip_queue_64.h"
typedef u_int64_t ipq_id_t;
#else
-#ifdef HAS_IP_QUEUE_H
#include <linux/netfilter_ipv4/ip_queue.h>
-#else
-#include "ip_queue.h"
#endif
typedef unsigned long ipq_id_t;
#endif
int ipq_ctl(const struct ipq_handle *h, int request, ...);
-/*char *ipq_errstr(void);
-void ipq_perror(const char *s);*/
+char *ipq_errstr(void);
+//void ipq_perror(const char *s);
#endif /* _LIBIPQ_H */