|
Smart Home firewall
Profile-based Smart Home firewall
|
Wrapper for the netfilter_queue library. More...
#include "nfqueue.h"
Functions | |
| int | get_pkt_id (struct nfq_data *nfad) |
| int | nfqueue_callback (struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_data *nfad, void *data) |
| Full callback function, compliant to the nfq_callback type. More... | |
| void | bind_queue (uint16_t queue_num, basic_callback *callback, void *arg) |
| void * | nfqueue_thread (void *arg) |
| pthread wrapper for bind_queue. More... | |
| bool | is_timedout (double threshold, time_t last_request) |
| Check if the last request is too old to be accepted. More... | |
Wrapper for the netfilter_queue library.
| void bind_queue | ( | uint16_t | queue_num, |
| basic_callback * | callback, | ||
| void * | arg | ||
| ) |
Bind queue to callback function, and wait for packets.
| queue_num | the number of the queue to bind to |
| callback | the basic callback function, called upon packet reception The callback function must have the following signature: uint32_t callback(int pkt_id, uint8_t *payload, void *arg) |
| arg | the argument to pass to the basic callback function |
| int get_pkt_id | ( | struct nfq_data * | nfad | ) |
Retrieve the packet id from a nfq_data struct, or -1 in case of error.
| nfa | the given nfq_data struct |
| bool is_timedout | ( | double | threshold, |
| time_t | last_request | ||
| ) |
Check if the last request is too old to be accepted.
| threshold | time in sec before dropping the request |
| last_request | time of the last request |
| int nfqueue_callback | ( | struct nfq_q_handle * | qh, |
| struct nfgenmsg * | nfmsg, | ||
| struct nfq_data * | nfad, | ||
| void * | data | ||
| ) |
Full callback function, compliant to the nfq_callback type.
| qh | queue handle |
| nfmsg | message object that contains the packet |
| nfad | Netlink packet data handle |
| data | data to be used by the function. In this case, a pointer to a callback_struct_t, which contains a basic_callback function and its arguments. |
| void* nfqueue_thread | ( | void * | arg | ) |
pthread wrapper for bind_queue.
| arg | typeless pointer to the thread argument, which is a thread_arg_t struct containing the necessary arguments for bind_queue. |