IPQ_CREATE_HANDLE(3)

okay bestie, gather round β€” this is IPQ_CREATE_HANDLE(3) from the Linux Programmer's Manual, and we're talking about creating and destroying libipq handles like it's main character energy πŸ’…βœ¨

🌸 NAME 🌸

ipq_create_handle, ipq_destroy_handle β€” bestie, these two literally create and destroy libipq handles 🫢

πŸŽ€ SYNOPSIS πŸŽ€

#include <linux/netfilter.h>
#include <libipq.h>

struct ipq_handle *ipq_create_handle(uint32_t flags, uint32_t protocol);
int ipq_destroy_handle(struct ipq_handle *h);

✨ DESCRIPTION ✨

So ipq_create_handle initialises libipq for an application β€” it attempts to bind to the Netlink socket used by ip_queue, and returns an opaque context handle 😌✨ It should be the first libipq function your app calls, no cap. And the handle it returns? Use that same handle in all subsequent library calls that require a handle parameter, periodt.

The flags parameter is not currently used, so the application should set it to zero for forward compatibility β€” it's giving "placeholder but make it future-proof" πŸŽ€

The protocol parameter specifies the protocol of the packets to be queued. Valid values are NFPROTO_IPV4 for IPv4 and NFPROTO_IPV6 for IPv6. Currently, only one protocol may be queued at a time for a handle β€” that's the vibe check, bestie.

The ipq_destroy_handle function frees up resources allocated by ipq_create_handle, and should be used when the handle is no longer required by the application. Cleanup queen behavior, honestly πŸ§ΉπŸ‘‘

🌈 RETURN VALUES 🌈

  • On success, ipq_create_handle returns a pointer to a context handle. On failure, NULL is returned 😭
  • On success, ipq_destroy_handle returns zero. On failure, -1 is returned πŸ’€

🚨 ERRORS 🚨

On failure, a descriptive error message will be available via the ipq_errstr function. So if something goes sideways, go ask ipq_errstr β€” it's literally the receipts πŸ”₯

πŸ› BUGS πŸ›

None known. Iconic, honestly. No known bugs, no drama πŸ’…βœ¨

πŸ‘‘ AUTHOR πŸ‘‘

James Morris <jmorris@intercode.com.au> 🫢

Copyright (c) 2000-2001 Netfilter Core Team.

Distributed under the GNU General Public License.

πŸ¦‹ SEE ALSO πŸ¦‹


and that's the page, bestie β€” from Linux iptables 1.2, dated 16 October 2001. mwah, go slay your queue πŸ’–πŸ«Άβœ¨

πŸ“¦ where this page comes from