#include <sys/types.h>
#include <err.h>
#include <libpfctl.h>
pfctl_get_status;
New port: net/libpfctl: library for interaction with pf(4)
The libpfctl port builds a shared library version of the base system
internal libpfctl library.
While the base system libpfctl API/ABI is not guaranteed to be stable
the ioctl interface is, so any version of libpfctl can be safely used.
"Real Programmers don't need comments -- the code is obvious."In absense of manual use the code.
libpfctl.c « libpfctl « lib - src - FreeBSD source tree
cgit.freebsd.org
Start with a simple status program and grow it..
Code:#include <sys/types.h> #include <err.h> #include <libpfctl.h> pfctl_get_status;
This is of course an overstatement ... but still true. If you need comments to explain what your code does, you're writing bad code."Real Programmers don't need comments -- the code is obvious."
Ed Post, Tektronix, Wilsonville
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <libpfctl.h>
#include <strings.h>
int main(int argc, char **argv)
{
printf(libpfctl_get_status)
};
The reasoning behind this is that I didn't want the in-tree libpfctl code to become a stable ABI, because that would just have moved the ABI stability problem rather than fixing it. It would have meant I still couldn't add fields to e.g. pfctl_rule for new features. As it is now the kernel still offers a stable ABI (even if it's nvlist-based for many new calls), and the ports version offers a stable ABI for ports consumers, while base can evolve more or less freely.Since I brought up the ports version of the library I have to ask about the path to the header file.
If you used the ports version of libpfctl would you have to point to /usr/local/lib/ version for the header?
It sound to me for portability of code use ports libpfctl. KP wrote it so I assume it is the best way.