Main Page   Modules   Data Structures   File List   Data Fields   Related Pages  

A hierarchy of objects with container-contained relationship
[D-BUS internal implementation details]

DBusObjectTree is used by DBusConnection to track the object tree. More...

Data Structures

struct  DBusObjectSubtree
 Struct representing a single registered subtree handler, or node that's a parent of a registered subtree handler. More...

struct  DBusObjectTree
 Internals of DBusObjectTree. More...


Defines

#define VERBOSE_FIND   0
 Set to 1 to get a bunch of debug spew about finding the subtree nodes.


Typedefs

typedef DBusObjectSubtree DBusObjectSubtree
 Subnode of the object hierarchy.


Functions

DBusObjectTree * _dbus_object_tree_new (DBusConnection *connection)
 Creates a new object tree, representing a mapping from paths to handler vtables. More...

DBusObjectTree * _dbus_object_tree_ref (DBusObjectTree *tree)
 Increment the reference count. More...

void _dbus_object_tree_unref (DBusObjectTree *tree)
 Decrement the reference count. More...

dbus_bool_t _dbus_object_tree_register (DBusObjectTree *tree, dbus_bool_t fallback, const char **path, const DBusObjectPathVTable *vtable, void *user_data)
 Registers a new subtree in the global object tree. More...

void _dbus_object_tree_unregister_and_unlock (DBusObjectTree *tree, const char **path)
 Unregisters an object subtree that was registered with the same path. More...

void _dbus_object_tree_free_all_unlocked (DBusObjectTree *tree)
 Free all the handlers in the tree. More...

DBusHandlerResult _dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree, DBusMessage *message)
 Tries to dispatch a message by directing it to handler for the object path listed in the message header, if any. More...

dbus_bool_t _dbus_object_tree_list_registered_and_unlock (DBusObjectTree *tree, const char **parent_path, char ***child_entries)
 Lists the registered fallback handlers and object path handlers at the given parent_path. More...

dbus_bool_t _dbus_object_tree_test (void)

Detailed Description

DBusObjectTree is used by DBusConnection to track the object tree.

Types and functions related to DBusObjectTree. These are all library-internal.


Function Documentation

DBusHandlerResult _dbus_object_tree_dispatch_and_unlock DBusObjectTree   tree,
DBusMessage   message
 

Tries to dispatch a message by directing it to handler for the object path listed in the message header, if any.

Messages are dispatched first to the registered handler that matches the largest number of path elements; that is, message to /foo/bar/baz would go to the handler for /foo/bar before the one for /foo.

Todo:
thread problems
Parameters:
tree  the global object tree
message  the message to dispatch
Returns:
whether message was handled successfully

Definition at line 673 of file dbus-object-tree.c.

References connection, DBusList::data, DBusObjectSubtree::invoke_as_fallback, DBusObjectSubtree::message_function, DBusObjectSubtree::parent, and DBusObjectSubtree::user_data.

void _dbus_object_tree_free_all_unlocked DBusObjectTree   tree
 

Free all the handlers in the tree.

Lock on tree's connection must not be held.

Parameters:
tree  the object tree

Definition at line 558 of file dbus-object-tree.c.

References connection, and root.

dbus_bool_t _dbus_object_tree_list_registered_and_unlock DBusObjectTree   tree,
const char **    parent_path,
char ***    child_entries
 

Lists the registered fallback handlers and object path handlers at the given parent_path.

The returned array should be freed with dbus_free_string_array().

Parameters:
tree  the object tree
parent_path  the path to list the child handlers of
child_entries  returns NULL-terminated array of children
Returns:
FALSE if no memory to allocate the child entries

Definition at line 924 of file dbus-object-tree.c.

References connection.

DBusObjectTree* _dbus_object_tree_new DBusConnection   connection
 

Creates a new object tree, representing a mapping from paths to handler vtables.

Parameters:
connection  the connection this tree belongs to
Returns:
the new tree or NULL if no memory

Definition at line 90 of file dbus-object-tree.c.

References connection, DBusObjectSubtree::invoke_as_fallback, refcount, and root.

DBusObjectTree* _dbus_object_tree_ref DBusObjectTree   tree
 

Increment the reference count.

Parameters:
tree  the object tree
Returns:
the object tree

Definition at line 127 of file dbus-object-tree.c.

References refcount.

dbus_bool_t _dbus_object_tree_register DBusObjectTree   tree,
dbus_bool_t    fallback,
const char **    path,
const DBusObjectPathVTable   vtable,
void *    user_data
 

Registers a new subtree in the global object tree.

Parameters:
tree  the global object tree
fallback  TRUE to handle messages to children of this path
path  NULL-terminated array of path elements giving path to subtree
vtable  the vtable used to traverse this subtree
user_data  user data to pass to methods in the vtable
Returns:
FALSE if not enough memory

Definition at line 400 of file dbus-object-tree.c.

References DBusObjectSubtree::invoke_as_fallback, DBusObjectPathVTable::message_function, DBusObjectSubtree::message_function, DBusObjectSubtree::unregister_function, DBusObjectPathVTable::unregister_function, and DBusObjectSubtree::user_data.

dbus_bool_t _dbus_object_tree_test void   
 

Unit test for DBusObjectTree

Returns:
TRUE on success.

Definition at line 1573 of file dbus-object-tree.c.

void _dbus_object_tree_unref DBusObjectTree   tree
 

Decrement the reference count.

Parameters:
tree  the object tree

Definition at line 141 of file dbus-object-tree.c.

References refcount.

void _dbus_object_tree_unregister_and_unlock DBusObjectTree   tree,
const char **    path
 

Unregisters an object subtree that was registered with the same path.

Parameters:
tree  the global object tree
path  path to the subtree (same as the one passed to _dbus_object_tree_register())

Definition at line 443 of file dbus-object-tree.c.

References connection, DBusObjectSubtree::message_function, DBusObjectSubtree::n_subtrees, DBusObjectSubtree::parent, DBusObjectSubtree::subtrees, DBusObjectSubtree::unregister_function, and DBusObjectSubtree::user_data.


Generated on Wed Jun 9 05:01:28 2004 for D-BUS by doxygen1.2.15