[sr-dev] #!IFMODULE

Olle E. Johansson oej at edvina.net
Wed Mar 27 08:13:12 CET 2013


26 mar 2013 kl. 23:53 skrev Daniel-Constantin Mierla <miconda at gmail.com>:

> Hello,
> 
> pushed a patch that defines MOD_modname for each loaded module.
> 
> It is easier than adding a new directive IFMODULE. Now it can be tested in config with:
> 
> #!ifdef MOD_xyz
> 
> I took module name from what is set as name in exported structure of the module, that is the module name (without any extension).
> 
> I would make all upercases, but wanted to check first if people will find a conflict by a potential case of different modules with same name but using different case letters. I say that shall not be the case, but theoretically is possible...
> 
> Btw, I just tested it compiles, give it a test and let me know the results.
Wow,
This is why I love Open Source. Open brainstorm, a developer that gets the idea and knows how to code it and it 
happens overnight!

Thank you, Daniel. Will sure try soon!

/O

> 
> Cheers,
> Daniel
> 
> On 3/26/13 6:48 PM, Olle E. Johansson wrote:
>> Hi!
>> 
>> Something I would like to see in Kamailio is something used heavily in Apache HTTPD, a config parser statement like #IFDEF for modules. WIth this a part of the config only applies if a module is loaded, like
>> 
>> #!IFMODULE SNMPSTATS.SO
>> modparam()
>> #!ENDIF
>> 
>> Another way to implement it would be to have modules publish a #!DEFINE, like
>> 
>> #!IFDEF MOD_SNMPSTATS.SO
>> 
>> Now, I don't know how Kamailio parses the configuration files. Is this at all possible? Either the module itself or the config file parser could inject these variables - but at module init it may be too late.
>> 
>> Any ideas, someone who understands the config file parsing?
>> 
>> /O
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> 
> -- 
> Daniel-Constantin Mierla - http://www.asipto.com
> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
> Kamailio World Conference, April 16-17, 2013, Berlin
> - http://conference.kamailio.com -
> 
> 
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev




More information about the sr-dev mailing list