Example #1
0
struct nflog_handle *nflog_open(void)
{
	struct nfnl_handle *nfnlh;
	struct nflog_handle *lh;

	nfnlh = nfnl_open();
	if (!nfnlh) {
		/* FIXME: nflog_errno */
		return NULL;
	}

	lh = nflog_open_nfnl(nfnlh);
	if (!lh)
		nfnl_close(nfnlh);

	return lh;
}
/**
 * nflog_open - open a nflog handler
 *
 * This function obtains a netfilter log connection handle. When you are
 * finished with the handle returned by this function, you should destroy
 * it by calling nflog_close(). A new netlink connection is obtained internally
 * and associated with the log connection handle returned.
 *
 * \return a pointer to a new log handle or NULL on failure.
 */
struct nflog_handle *nflog_open(void)
{
	struct nfnl_handle *nfnlh;
	struct nflog_handle *lh;

	nfnlh = nfnl_open();
	if (!nfnlh) {
		/* FIXME: nflog_errno */
		return NULL;
	}

	/* disable netlink sequence tracking by default */
	nfnl_unset_sequence_tracking(nfnlh);

	lh = nflog_open_nfnl(nfnlh);
	if (!lh)
		nfnl_close(nfnlh);

	return lh;
}