[PATCH] specify extreply characters in vendor plugins

pHilipp Zabel philipp.zabel at gmail.com
Tue Jul 31 11:18:54 CEST 2007

On 7/31/07, Harald Welte <laforge at openmoko.org> wrote:
> On Sun, Jun 03, 2007 at 04:17:52PM +0200, Philipp Zabel wrote:
> > Hi,
> >
> > this is an updated patch to allow the vendor plugins to specify which
> > characters are used to start extended replies.
> I was about to add this, but then realised that it would have to be in
> both vendor and machine plugin.
> Looking at the current code, I think the separation between machine and
> vendor plugin has to be re-thought.
> I think it still makes sense to e.g. abstract TI-specific commands into some
> kind of generic plugin, i.e. what the vendor plugin was supposed to be.
> But then, all vendors (including OpenMoko now) hack the firmware to
> various degree and ad their own additional commands on top of e.g. the
> TI commands.  That's what should be in the machine plugin.
> So I think that we will have to end up with something like 'hooks' in
> the gsmd core code, and then any plugin can register callback functions
> at those hooks.  Part of the callback registration is some priority.
> When the code reaches one of those hooks, we iterate over all the
> callback functions of that hook, in order of their priority.
> Also, machine and vendor plugin can become _technically_ the same
> structure, and the difference is just a semantic one.
> Furthermore, since every hook would be identified by some constant, we
> don't have to add tons and tons of special-case callback functions to
> every plugin.
> Plugins would register something like
> struct gsmd_hook {
>         unsigned int hook;
>         unsigned int prio;
>         gsmd_hookfn *fn;
> };
> struct gsmd_hookfn init_setting_hook = {
>         .hook   = GSMD_HOOK_INIT_SETTINGS,
>         .prio   = 100,
>         .fn     = &init_settings,
> }
> gsmd_register_hookfn(&gsmd_hookfn);
> What do you think?

I like it. So you'd want to add a hook between the generic
extreply parsing and the information response pass-through
that can be used by machine plugins to parse for example
extended replys starting with '%' or '$'?
I'd like this to be done in a way that it is possible to handle
multiline replies with those special chars.


More information about the gsmd-devel mailing list