PROPLIB(3) | Library Functions Manual | PROPLIB(3)

# NAME

`proplib` — property container object library

# LIBRARY

Property Container Object Library (libprop, -lprop)

# SYNOPSIS

`#include <prop/proplib.h>`

# DESCRIPTION

The `proplib` library provides an abstract interface for creating and manipulating property lists. Property lists have object types for boolean values, opaque data, numbers, and strings. Structure is provided by the array and dictionary collection types.

Property lists can be passed across protection boundaries by translating them to an external representation. There are two formats availavble for external representation:

- An XML document whose format is described by the following DTD:

      http://www.apple.com/DTDs/PropertyList-1.0.dtd

- A JSON document whose format is described by RFC 8259.

Property container objects are reference counted. When an object is created, its reference count is set to 1. Any code that keeps a reference to an object, including the collection types (arrays and dictionaries), must “retain” the object (increment its reference count). When that reference is dropped, the object must be “released” (reference count decremented). When an object's reference count drops to 0, it is automatically freed.

The rules for managing reference counts are very simple:

- If you create an object and do not explicitly maintain a reference to it, you must release it.
- If you get a reference to an object from other code and wish to maintain a reference to it, you must retain the object. You are responsible for releasing the object once you drop that reference.
- You must never release an object unless you create it or retain it.

Object collections may be iterated by creating a special iterator object. Iterator objects are special; they may not be retained, and they are released using an iterator-specific release function.

# SEE ALSO

prop_array(3), prop_array_util(3), prop_bool(3), prop_data(3), prop_dictionary(3), prop_dictionary_util(3), prop_number(3), prop_object(3), prop_send_ioctl(3), prop_send_syscall(3), prop_string(3)

# HISTORY

The `proplib` property container object library first appeared in NetBSD 4.0. Support for the JSON serialization format was added in NetBSD 11.0.

# CAVEATS

`proplib` does not have a ‘date’ object type, and thus will not parse ‘date’ elements from an Apple XML property list.

`proplib` does not have a ‘null’ object type, and thus will not parse ‘null’ elements from a JSON document.

The `proplib` ‘number’ object type differs from the Apple XML property list format in the following ways:

- The external representation for unsigned numbers is in base 16, not base 10. `proplib` is able to parse base 8, base 10, and base 16 ‘integer’ elements. Signed numbers are represented in base 10.
- `proplib` does not support floating point numbers, so ‘real’ elements from an Apple XML property list will not be parsed.

Similarly, `proplib` does not parse floating point numbers (as described in RFC 8259) in JSON documents. For JSON documents, all numbers are represented in base 10.

JSON does not have an opaque data element that is functionally equivalent to the ‘data’ elements in XML property lists. As such, a property list containing ‘data’ objects cannot be externalized into a JSON document.

In order to facilitate use of `proplib` in kernel, standalone, and user space environments, the `proplib` parser is not a real XML parser. It is hard-coded to parse only the property list external representation.

April 20, 2025 | NetBSD 11.0