Index: include/libroar/roardl.h
===================================================================
--- include/libroar/roardl.h	(revision 5501)
+++ include/libroar/roardl.h	(revision 5511)
@@ -48,19 +48,23 @@
 #define ROAR_DL_HANDLE_DEFAULT          ((struct roar_dl_lhandle*)(void*)0)
 #define ROAR_DL_HANDLE_NEXT             ((struct roar_dl_lhandle*)(void*)1)
-
-#define ROAR_DL_FN_DSTR                 0
-#define ROAR_DL_FN_CDRIVER              1
-#define ROAR_DL_FN_TRANSCODER           2
-#define ROAR_DL_FN_DRIVER               3
-#define ROAR_DL_FN_SOURCE               4
-#define ROAR_DL_FN_FILTER               5
-#define ROAR_DL_FN_FF                   6 /* file format */
-#define ROAR_DL_FN_AUTH                 7
-#define ROAR_DL_FN_BRIDGE               8
-#define ROAR_DL_FN_ROARDSCHED           9
-#define ROAR_DL_FN_APPSCHED            10
-#define ROAR_DL_FN_PROTO               11
-#define ROAR_DL_FN_NOTIFY              12
+#define ROAR_DL_HANDLE_LIBROAR          ((struct roar_dl_lhandle*)(void*)2)
+#define ROAR_DL_HANDLE_APPLICATION      ((struct roar_dl_lhandle*)(void*)3)
+
+#define ROAR_DL_FN_DSTR                 0 /* VIO and DSTR drivers */
+#define ROAR_DL_FN_CDRIVER              1 /* Client drivers, libroareio */
+#define ROAR_DL_FN_TRANSCODER           2 /* Transcoder, libroardsp */
+#define ROAR_DL_FN_DRIVER               3 /* Driver, roard? */
+#define ROAR_DL_FN_SOURCE               4 /* Sources, roard? */
+#define ROAR_DL_FN_FILTER               5 /* Filter, libroardsp */
+#define ROAR_DL_FN_FF                   6 /* file format??? */
+#define ROAR_DL_FN_AUTH                 7 /* Auth */
+#define ROAR_DL_FN_BRIDGE               8 /* Bridges, roard? */
+#define ROAR_DL_FN_ROARDSCHED           9 /* Like appsched, but roard specific, old */
+#define ROAR_DL_FN_APPSCHED            10 /* AppSched, old interface */
+#define ROAR_DL_FN_PROTO               11 /* Protocols, roard? */
+#define ROAR_DL_FN_NOTIFY              12 /* ??? */
 #define ROAR_DL_FN_INIT                13 /* global plugin instance init. should be avoided */
+#define ROAR_DL_FN_REGFN               14 /* FN Registrations */
+#define ROAR_DL_FN_APPLICATION         15 /* Application specific stuff */
 //#define ROAR_DL_FN_               9
 #define ROAR_DL_FN_MAX                 24
@@ -296,4 +300,53 @@
 int                      roar_dl_appsched_trigger(struct roar_dl_lhandle * lhandle, enum roar_dl_appsched_trigger trigger);
 
+// FN Registration:
+
+// Actions objects can emit:
+enum roar_dl_fnreg_action {
+ ROAR_DL_FNREG   = 1, // The object is been registered
+ ROAR_DL_FNUNREG = 2  // The object is been unregistered
+};
+
+// Callback for registering/unregistering objects:
+struct roar_dl_fnreg {
+ int fn;          // Filter: The FN of the registering object or -1 for any.
+ int subtype;     // Filter: The subtype of the registering object or -1 for any.
+ int version;     // Filter: The version of the registering object or -1 for any.
+ int (*callback)( // Callback to call on register/unregister.
+   enum roar_dl_fnreg_action action, // The action happening
+   int fn,                           // The FN of the object
+   int subtype,                      // The subtype of the object
+   const void * object,              // Pointer to the object
+   size_t objectlen,                 // Length of the object
+   int version,                      // Version of the object
+   int options,                      // Object Options.
+   void * userdata,                  // User data for the callback.
+   struct roar_dl_lhandle * lhandle  // The registering handle.
+                                     // This is valid until the object is unregistered.
+                                     // Only roar_dl_context_restore() and roar_dl_context_store()
+                                     // may be used on this object. Result of all other functions
+                                     // is undefined.
+ );
+ void * userdata; // The user data pointer passed to the callback.
+};
+
+// Parameters for FNREG registration:
+#define ROAR_DL_FNREG_SUBTYPE  0
+#define ROAR_DL_FNREG_VERSION  0
+#define ROAR_DL_FNREG_SIZE     sizeof(struct roar_dl_fnreg)
+
+
+// Reg FN:
+
+// Options:
+#define ROAR_DL_FNREG_OPT_NONE 0   /* no options */
+
+// Register an FN.
+int                      roar_dl_register_fn(struct roar_dl_lhandle * lhandle, int fn, int subtype, const void * object, size_t objectlen, int version, int options);
+
+// Unregister FN for the given plugin.
+// This should not be called directly and is called internally when needed.
+int                      roar_dl_unregister_fn(struct roar_dl_lhandle * lhandle);
+
 #endif
 
