|
NAMEcnvlist_get , cnvlist_take ,
cnvlist_free —
API for managing name/value pairs by cookie.
LIBRARYName/value pairs library (libnv, -lnv)SYNOPSIS#include <sys/cnv.h>
const char *
int
bool
uint64_t
const char *
const nvlist_t *
const void *
const bool *
const uint64_t *
const char * const *
const nvlist_t * const *
int
const int *
bool
uint64_t
const char *
const nvlist_t *
const void *
const bool *
const uint64_t *
const char * const *
const nvlist_t * const *
int
const int *
void
void
void
void
void
void
void
void
void
void
void
void
DESCRIPTIONThelibnv library permits easy management of name/value
pairs and can send and receive them over sockets. For more information, also
see nv(9).
The concept of cookies is explained in
The The The The The EXAMPLESThe following example demonstrates how to deal with cnvlist API.int type; void *cookie, *scookie, *bcookie; nvlist_t *nvl; char *name; nvl = nvlist_create(0); nvlist_add_bool(nvl, "test", 1 == 2); nvlist_add_string(nvl, "test2", "cnvlist"); cookie = NULL; while (nvlist_next(nvl, &type, &cookie) != NULL) { switch (type) { case NV_TYPE_BOOL: printf("test: %d\n", cnvlist_get_bool(cookie)); bcookie = cookie; break; case NV_TYPE_STRING: printf("test2: %s\n", cnvlist_get_string(cookie)); scookie = cookie; break; } } name = cnvlist_take_string(scookie); cnvlist_free_bool(bcookie); printf("test2: %s\n", name); free(name); printf("nvlist_empty = %d\n", nvlist_empty(nvl)); nvlist_destroy(nvl); return (0); SEE ALSOclose(2), free(3), nv(9)AUTHORSThecnv API was created during the Google Summer Of Code
2016 by Adam Starak.
Visit the GSP FreeBSD Man Page Interface. |