libifconfig: Initial code available, looking for feedback

Marie Helene Kvello-Aune marieheleneka at gmail.com
Sat Apr 9 13:59:41 UTC 2016


Hey!

Please see previous thread[1] for context on what libifconfig is.

I've just pushed an initial version of libifconfig to the github
repository[2]. I would appreciate feedback, in particular on the API design
and usage, and especially on how it communicates error state to the
application.

Expect the API to break frequently/often for the time being, as it is still
in very early stages of development.

Next, I'll be working on improving libifconfig_get_capability() to properly
communicate all relevant information, as it currently doesn't provide all
the information it should. This will allow libifconfig_set_capability()
(and applications) to use the aforementioned function instead of
duplicating code. After this, I'll be adding new features to the API, which
I'll post an update about when the time comes.

Example usage:
// Start example

#include <libifconfig/libifconfig.h>
// ...
int main (void) {
    char *desc;
    if (libifconfig_get_description("em0", &desc) == 0)
        printf("old description: %s\n", desc);
    if (libifconfig_unset_description("em0") == 0)
        printf("Successfully unset description.");
    else
        printf("Couldn't unset description. Lazy example writer is lazy,
and instructs reader to imagine using libifconfig_errstate to create useful
error messages.");
}

// End example

Links:
[1] libifconfig: A C API for ifconfig:
https://lists.freebsd.org/pipermail/freebsd-net/2016-March/044837.html
[2] libifconfig github repo: https://github.com/Savagedlight/libifconfig

Thanks,
Marie Helene Kvello-Aune


More information about the freebsd-net mailing list