[OpenSER-Devel] Accessing exported functions from another module

Henning Westerholt henning.westerholt at 1und1.de
Thu Jul 10 17:09:02 CEST 2008


On Thursday 10 July 2008, Ardjan Zwartjes wrote:
> > You should also
> > use the wrapper "find_export" instead of the "find_cmd_export_t".
>
> That was what I tried at first, only then I figured out that the
> parameter types of cmd_export_t functions aren't always what is
> specified in cmd_export_t. The textops functions use all kinds of
> pv_elem_t's so I wanted to use the fixup functions to generates these
> structs and to get the fixup functions I needed find_cmd_export_t. Quite
> ugly I know, but I really need these functions.

Hi Ardjan,

ok, understand. :-) Its probably easier in this case.

> > For your case "adding a header" i would simple write my own
> > function. 35 LOCs of duplication (e.g. see maxforward:add_maxfwd_header) 
> > are IMHO justifiable.
>
> If I was only adding a header I would agree, but I'm using more and more
> code from textops. I also remove headers, add parameters to the contact
> header and so on. So basically I would have to duplicate the entire
> textops module in my module. Perhaps it is a good idea to add an API to
> the textops module? If I write a patch for the textops module, what are
> the chances of it being included in openser releases?

If the API exports are created in a way that they're also usable from other 
modules then i think the chances are rather good. It should also use the same 
structure like the other APIs, for example with regards to the bind function 
naming, documentation and so on.

Cheers,

Henning



More information about the Devel mailing list