Bonobo API Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# bonobo-storage-plugin

## Name

bonobo-storage-plugin -- The interface for pluggable bonobo storage modules

## Synopsis

    #define     BONOBO_STORAGE_VERSION
    struct      StoragePlugin;
    gint        (*StoragePluginInitFn)          (StoragePlugin *plugin);
    BonoboStorage* (*BonoboStorageOpenFn)       (const char *path,
                                                 gint flags,
                                                 gint mode,
                                                 CORBA_Environment *ev);
    BonoboStream* (*BonoboStreamOpenFn)         (const char *path,
                                                 gint flags,
                                                 gint mode,
                                                 CORBA_Environment *ev);
    extern      GList *storage_plugin_list;
    gint        init_storage_plugin             (StoragePlugin *plugin);
    void        bonobo_storage_load_plugins     (void);
    StoragePlugin* bonobo_storage_plugin_find   (const gchar *name);

## Description

This header is only needed by BonoboStorage and BonoboStream implementation plugins. Essentialy these are shared library modules that implement only 1 public function `init_storage_plugin`. It is unlikely that most Bonobo users will wish to implement a storage or stream plugin.

The init function fills out a StoragePlugin structure, most importantly it fills in a version string that defines the plugin ABI version built against, this is defined by the version of bonobo-storage-plugin.h you build against.

Example 1. Sample Storage plugin init function

    gint
    init_storage_plugin (StoragePlugin *plugin)
    {
    	g_return_val_if_fail (plugin != NULL, -1);

    	plugin->name = "fs";
    	plugin->description = "Native Filesystem Driver";
    	plugin->version = BONOBO_STORAGE_VERSION;

    	plugin->storage_open = bonobo_storage_fs_open;
    	plugin->stream_open = bonobo_stream_fs_open;

    	return 0;
    }

The callbacks for opening streams and storages are registered and these are used by the `bonobo_storage_open` and `bonobo_stream_open` functions when your plugin name is passed to these.

## Details

### BONOBO_STORAGE_VERSION

    #define BONOBO_STORAGE_VERSION "1.0"

### struct StoragePlugin

    struct StoragePlugin {
    	/* public, read only */
    	gchar               *filename;
    	gchar               *name;         /* efs, file */
    	gchar               *description;
    	gchar               *version;
    	BonoboStorageOpenFn  storage_open;
    	BonoboStreamOpenFn   stream_open;
    	/* private */
    	GModule             *handle;
    };

### StoragePluginInitFn ()

    gint        (*StoragePluginInitFn)          (StoragePlugin *plugin);

`plugin` : |
Returns : |

### BonoboStorageOpenFn ()

    BonoboStorage* (*BonoboStorageOpenFn)       (const char *path,
                                                 gint flags,
                                                 gint mode,
                                                 CORBA_Environment *ev);

`path` : |
`flags` : |
`mode` : |
`ev` : |
Returns : |

### BonoboStreamOpenFn ()

    BonoboStream* (*BonoboStreamOpenFn)         (const char *path,
                                                 gint flags,
                                                 gint mode,
                                                 CORBA_Environment *ev);

`path` : |
`flags` : |
`mode` : |
`ev` : |
Returns : |

### storage_plugin_list

    extern GList *storage_plugin_list;

### init_storage_plugin ()

    gint        init_storage_plugin             (StoragePlugin *plugin);

`plugin` : |
Returns : |

### bonobo_storage_load_plugins ()

    void        bonobo_storage_load_plugins     (void);

### bonobo_storage_plugin_find ()

    StoragePlugin* bonobo_storage_plugin_find   (const gchar *name);

`name` : |
Returns : |

## See Also

BonoboStorage, BonoboStream

<<< Previous Page | Home | Up | Next Page >>>
bonobo-stream-client | Controls