X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..d12e0d85ae649d5c903a61c1150f4e6c48f96309:/projects/stargazer/plugins/capture/ipq_linux/libipq.c?ds=sidebyside diff --git a/projects/stargazer/plugins/capture/ipq_linux/libipq.c b/projects/stargazer/plugins/capture/ipq_linux/libipq.c index 798faebb..4c734110 100644 --- a/projects/stargazer/plugins/capture/ipq_linux/libipq.c +++ b/projects/stargazer/plugins/capture/ipq_linux/libipq.c @@ -61,7 +61,7 @@ enum }; #define IPQ_MAXERR IPQ_ERR_PROTOCOL -/*struct ipq_errmap_t +struct ipq_errmap_t { int errcode; char *message; @@ -83,11 +83,11 @@ enum { IPQ_ERR_RECVBUF, "Receive buffer size invalid"}, { IPQ_ERR_TIMEOUT, "Timeout"}, { IPQ_ERR_PROTOCOL, "Invalid protocol specified"} -};*/ +}; static int ipq_errno = IPQ_ERR_NONE; -static ssize_t ipq_netlink_sendto(const struct ipq_handle *h, +static ssize_t ipq_netlink_sendto(const struct ipq_handle *h, const void *msg, size_t len); static ssize_t ipq_netlink_recvfrom(const struct ipq_handle *h, @@ -205,12 +205,12 @@ static ssize_t ipq_netlink_recvfrom(const struct ipq_handle *h, 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; -}*/ +} /**************************************************************************** * @@ -296,7 +296,7 @@ int ipq_set_mode(const struct ipq_handle *h, ipq_peer_msg_t pm; char s[FAKE_ARRAY_SIZE]; } req; - + memset(&req, 0, sizeof(req)); req.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(req)-FAKE_ARRAY_SIZE); req.nlh.nlmsg_flags = NLM_F_REQUEST; @@ -323,13 +323,6 @@ int ipq_message_type(const unsigned char *buf) return((struct nlmsghdr*)buf)->nlmsg_type; } //----------------------------------------------------------------------------- -int ipq_get_msgerr(const unsigned char *buf) -{ - struct nlmsghdr *h = (struct nlmsghdr *)buf; - struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); - return -err->error; -} -//----------------------------------------------------------------------------- ipq_packet_msg_t *ipq_get_packet(const unsigned char *buf) { return(ipq_packet_msg_t *)(NLMSG_DATA((struct nlmsghdr *)(buf))); @@ -380,16 +373,10 @@ int ipq_set_verdict(const struct ipq_handle *h, return ipq_netlink_sendmsg(h, &msg, 0); } //----------------------------------------------------------------------------- -/* Not implemented yet */ -int ipq_ctl(const struct ipq_handle __attribute__((unused)) * handle, int __attribute__((unused)) request, ...) -{ - return 1; -} -//----------------------------------------------------------------------------- -/*char *ipq_errstr(void) +char *ipq_errstr(void) { return ipq_strerror(ipq_errno); -}*/ +} //----------------------------------------------------------------------------- /*void ipq_perror(const char *s) {