API Notes: SystemConfiguration framework


An introduction to PyObjC describes the general method for translating Objective-C calls into Python calls, including the handling of pass-by-reference arguments and buffers.

This document describes where the PyObjC bindings for this framework are different from the general rule, such as mentioning APIs that are not supported or where the interface is different than expected.

The full API is described in Apple’s documentation, both the C and Objective-C APIs are available (but see the API Notes below).

These bindings are accessed through the SystemConfiguration package (that is, import SystemConfiguration).

API Notes


There are several APIs that have a callback function and context structure in the (Objective-)C API. In all cases an arbitrary object can be passed as the context, PyObjC will wrap that in the proper context structure for you.


The context argument for SCDynamicStoreCreate is an arbitrary python object, not a SCDynamicStoreContext structure as it is in C. The bridge will manage that context structure for you.


The address argument should have a value that can also be used with the Python socket APIs (that is, a (host, port) tuple for IPv4 adresses or (host, port, flowinfo, scopeid) tuple for IPv6 addresses).

The addrlen argument should be objc._size_sockaddr_ip4 for IPv4 addresses and _size_sockaddr_ip4 for IPv6 adresses.