'Twas brillig, and Tanu Kaskinen at 18/04/11 10:31 did gyre and gimble: > For publishing APIs: > > /* Returns a negative error code if the extra api is already registered. */ > int pa_extra_api_register(const char *name, void *api); > > void pa_extra_api_unregister(const_char *name); > > For consuming APIs: > > /* Returns the currently registered api object, > * or NULL if the api isn't registered right now. */ > void *pa_extra_api_get(const char *name); > > Additionally, there would be a couple of hooks defined for getting > notifications about APIs getting registered and unregistered. That seems sensible. > The "api object" would be a struct with function pointers. The API > provider would create instances of that struct and provide the function > implementation. The API consumer would talk to the provider using those > function pointers. OK, that all seems fine IMO. > The api object header could be located in > src/extra_apis - that would make the api not directly dependent on a > particular module. If the API is not dependant on a particular module, what code calls pa_extra_api_register? I'd be happy enough defining this extra API as an "IMC" (c.f. IPC) system and thus make it very much tied to modules. You could even have a call tracker module that just provides the code you posted earlier with nothing more than a .h file and pa__init and pa__done implementations and make sure this is loaded before any modules that happen to want to use it. > I've been using the term "extra api" here. I don't think it's the > greatest name in the world, but that's the best I could think of. I'd > like "extension" more, but that word is already used for other purposes. Yeah extension is already in use for protocol extensions I guess. How about pa_imc_*? (for inter-module comms) or is that perhaps too cryptic? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]