#ifndef   SCDYNAMICSTORE_H
#define SCDYNAMICSTORE_H

#include <AvailabilityMacros.h>
#include <sys/cdefs.h>
#include <CoreFoundation/CoreFoundation.h>

/*SCDynamicStoreRef

typedef const struct __SCDynamicStore * SCDynamicStoreRef;  
Discussion 

This is the handle to an open a dynamic store session with the system configuration daemon.*/
typedef const struct __SCDynamicStore * SCDynamicStoreRef;

/*SCDynamicStoreCallBack

typedef void (*SCDynamicStoreCallBack) ( 
    SCDynamicStoreRef store, 
    CFArrayRef changedKeys, 
    void *info );  
Parameters
store
The dynamic store session.
changedKeys
The list of changed keys.
info
A C pointer to a user-specified block of data.
Discussion 

Type of callback function used when notification of changes to the dynamic store is delivered.*/
typedef void (*SCDynamicStoreCallBack) ( 
    SCDynamicStoreRef store, 
    CFArrayRef changedKeys, 
    void *info );  

/*SCDynamicStoreContext

typedef struct { 
    CFIndex version; 
    void *info; 
    const void *(*retain)(
        const void *info); 
    void (*release)(
        const void *info); 
    CFStringRef (*copyDescription)(
        const void *info); 
} SCDynamicStoreContext;  
Fields
version
The version number of the structure type being passed in as a parameter to the SCDynamicStore creation function. This structure is version 0.
info
A C pointer to a user-specified block of data.
retain
The callback used to add a retain for the info field. If this parameter is not a pointer to a function of the correct prototype, the behavior is undefined. The value may be NULL.
release
The calllback used to remove a retain previously added for the info field. If this parameter is not a pointer to a function of the correct prototype, the behavior is undefined. The value may be NULL.
copyDescription
The callback used to provide a description of the info field.
Discussion 

Structure containing user-specified data and callbacks for an SCDynamicStore session.*/

typedef struct { 
    CFIndex version; 
    void *info; 
    const void *(*retain)(
        const void *info); 
    void (*release)(
        const void *info); 
    CFStringRef (*copyDescription)(
        const void *info); 
} SCDynamicStoreContext;  


//function

/*SCDynamicStoreCreate

SCDynamicStoreRef SCDynamicStoreCreate ( 
    CFAllocatorRef allocator, 
    CFStringRef name, 
    SCDynamicStoreCallBack callout, 
    SCDynamicStoreContext *context );  
Parameters
allocator
The CFAllocator that should be used to allocate memory for the local dynamic store object. This parameter may be NULL in which case the current default CFAllocator is used. If this reference is not a valid CFAllocator, the behavior is undefined.
name
A string that describes the name of the calling process or plug-in of the caller.
callout
The function to be called when a watched value in the dynamic store is changed. A NULL value can be specified if no callouts are desired.
context
The SCDynamicStoreContext associated with the callout.
Return Value

Returns a reference to the new SCDynamicStore session. You must release the returned value. 
Discussion 

Creates a new session used to interact with the dynamic store maintained by the System Configuration server.*/
SCDynamicStoreRef SCDynamicStoreCreate ( 
    CFAllocatorRef allocator, 
    CFStringRef name, 
    SCDynamicStoreCallBack callout, 
    SCDynamicStoreContext *context );  

/*SCDynamicStoreSetNotificationKeys

Boolean SCDynamicStoreSetNotificationKeys ( 
    SCDynamicStoreRef store, 
    CFArrayRef keys, 
    CFArrayRef patterns );  
Parameters
store
The dynamic store session being watched.
keys
An array of keys to be monitored; NULL if no specific keys are to be monitored.
patterns
An array of regex(3) pattern strings used to match keys to be monitored; NULL if no key patterns are to be monitored.
Return Value

Returns TRUE if the set of notification keys and patterns was successfully updated; FALSE if an error was encountered. 
Discussion 

Specifies a set of specific keys and key patterns that should be monitored for changes.*/
Boolean SCDynamicStoreSetNotificationKeys ( 
    SCDynamicStoreRef store, 
    CFArrayRef keys, 
    CFArrayRef patterns );  

/*SCDynamicStoreCreateRunLoopSource

CFRunLoopSourceRef SCDynamicStoreCreateRunLoopSource ( 
    CFAllocatorRef allocator, 
    SCDynamicStoreRef store, 
    CFIndex order );  
Parameters
allocator
The CFAllocator that should be used to allocate memory for this run loop source. This parameter may be NULL in which case the current default CFAllocator is used. If this reference is not a valid CFAllocator, the behavior is undefined.
store
A reference to the dynamic store session.
order
On platforms which support it, for source versions which support it, this parameter determines the order in which the sources which are ready to be processed are handled. A lower order number causes processing before higher order number sources. It is inadvisable to depend on the order number for any architectural or design aspect of code. In the absence of any reason to do otherwise, zero should be used.
Return Value

A reference to the new CFRunLoopSource. You must release the returned value. 

Discussion 

Creates a CFRunLoopSource object that can be added to the application's run loop. All dynamic store notifications are delivered using this run loop source.*/

CFRunLoopSourceRef SCDynamicStoreCreateRunLoopSource ( 
    CFAllocatorRef allocator, 
    SCDynamicStoreRef store, 
    CFIndex order );  

#endif