summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDuncan Roe <duncan_roe@optusnet.com.au>2021-09-27 13:53:30 +1000
committerPablo Neira Ayuso <pablo@netfilter.org>2021-09-28 12:21:03 +0200
commit758103bcea3f96b2e6b47ef94541041a7f6fd5b5 (patch)
treeee7adf51ce9f7d04d58407e753c211b1278f9668 /src
parentbf324dc4631a78e1fd5ce3dcc37aaf9653ce2694 (diff)
src: doc: Document nflog_callback_register() and nflog_handle_packet()
utils/nfulnl_test.c uses these functions Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/libnetfilter_log.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/libnetfilter_log.c b/src/libnetfilter_log.c
index 66669af..27a6a2d 100644
--- a/src/libnetfilter_log.c
+++ b/src/libnetfilter_log.c
@@ -323,6 +323,20 @@ struct nflog_handle *nflog_open(void)
* @}
*/
+/**
+ * \addtogroup Log
+ * @{
+ */
+
+/**
+ * nflog_callback_register - register function to process packets
+ *
+ * \param gh Netfilter log group handle obtained by call to nflog_bind_group()
+ * \param cb callback function to call for each logged packet
+ * \param data custom data to pass to the callback function
+ \return 0
+ */
+
int nflog_callback_register(struct nflog_g_handle *gh, nflog_callback *cb,
void *data)
{
@@ -332,12 +346,30 @@ int nflog_callback_register(struct nflog_g_handle *gh, nflog_callback *cb,
return 0;
}
+/**
+ * nflog_handle_packet - handle a packet received from the nflog subsystem
+ * \param h Netfilter log handle obtained via call to nflog_open()
+ * \param buf nflog data received from the kernel
+ * \param len length of packet data in buffer
+ *
+ * Triggers an associated callback for each packet contained in \b buf.
+ * Data can be read from the queue using nflog_fd() and \b recv().
+ * See example code in the Detailed Description.
+ * \return 0 on success, -1 if either the callback returned -ve or \b buf
+ * contains corrupt data. \b errno is not reliably set:
+ * caller should zeroise first if interested.
+ */
+
int nflog_handle_packet(struct nflog_handle *h, char *buf, int len)
{
return nfnl_handle_packet(h->nfnlh, buf, len);
}
/**
+ * @}
+ */
+
+/**
* \addtogroup LibrarySetup
*
* When the program has finished with libnetfilter_log, it has to call