[Devel] exporting pseudo variables
Klaus Darilion
klaus.mailinglists at pernau.at
Tue May 2 15:15:01 CEST 2006
Daniel-Constantin Mierla wrote:
> Hello Klaus,
>
> On 05/02/2006 02:24 PM, Klaus Darilion wrote:
>> Hi Daniel!
>>
>> If a module exports several pseudo variables, it might be nicer to
>> export them with the whole module paramters, e.g.
>>
>> static pseudo_export_t pseudo[] = {
>> {"tls_version", tls_version, 0},
>> {"tls_peer_subject", tls_parameter, TLS_PEER | TLS_SUBJECT},
>> {"tls_my_subject", tls_parameter, TLS_MY | TLS_SUBJECT},
>> {0, 0, 0}
>> }
>>
>> What do you think about this?
> not a bad idea at all. Now, should we allow full spec format, like the
> ones from item.c (see _xl_names_table, at line 1865) or something simpler?
IMO, a format like above is sufficient and easier for adding new pseudo
variables. I guess it will be converted into _xl_names_table format
during module loading thus internal handling is consistent.
I think this will be sufficient:
{ char *pseudo_name, static int function, xl_param_t param },
regards
klaus
> Cheers,
> Daniel
>
>>
>> regards
>> klaus
>>
>> Daniel-Constantin Mierla wrote:
>>> On 05/02/2006 01:24 PM, Klaus Darilion wrote:
>>>> Daniel-Constantin Mierla wrote:
>>>>> Hello Klaus,
>>>>>
>>>>> On 05/02/2006 01:03 PM, Klaus Darilion wrote:
>>>>>> Hi Daniel!
>>>>>>
>>>>>> Is it possible to do the parsing of the pseudo variable in the
>>>>>> module? E.g. for tls there will be similar paramters, for the peer
>>>>>> certificate and the local certificate. Is it possible to register
>>>>>> only a prefix, e.g. $tls_ and parse the latter in the module itself?
>>>>> no, the parsing is done by core. The modules can add new
>>>>> specifiers, but must be the full name, so they are visible in other
>>>>> modules as well.. You can add many specifiers with the same
>>>>> callback function and different values of the parameter.
>>>>
>>>> ok, consider a simple scenario: $tls_peer_subject and
>>>> $tls_my_subject (reflects the subjects of the local certificate and
>>>> the peer's certificate).
>>>>
>>>> I will register:
>>>>
>>>> mod_init {
>>>> xl_add_extra("tls_peer_subj", get_cert_parameter,
>>>> TLS_PEER|TLS_SUBJECT);
>>>> xl_add_extra("tls_my_subj", get_cert_parameter, TLS_MY|TLS_SUBJECT);
>>>> }
>>>>
>>>> How exactly will I retrieve the parameter inside get_cert_parameter?
>>>> I guess xl_parse_spec must be used. Can you give ma short code
>>>> snippet please?
>>> sorry, the xl_add_extra() has to be extended to accept the parameter.
>>> The core specifiers register and retrieve such parameter, just have a
>>> look at xl_get_from_attr() in items.c
>>>
>>> I will extend xl_add_extra().
>>>
>>> Cheers,
>>> Daniel
>>>
>>>>
>>>> thanks
>>>> kaus
>>>>
>>>>>
>>>>> Cheers,
>>>>> Daniel
>>>>>
>>>>>>
>>>>>>
>>>>>> regards
>>>>>> klaus
>>>>>>
>>>>>>
>>>>>> Daniel-Constantin Mierla wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> On 04/28/2006 12:05 PM, Klaus Darilion wrote:
>>>>>>>
>>>>>>>> Hi!
>>>>>>>>
>>>>>>>> I'm studying how to export pseudo variables.
>>>>>>>>
>>>>>>>> In tm.c there is this code:
>>>>>>>>
>>>>>>>> if(xl_add_extra("T_branch_idx", it_get_tm_branch_idx,
>>>>>>>> 100 )!=0)
>>>>>>>> {
>>>>>>>> LOG(L_ERR,"ERROR:tm:mod_init: failed to register
>>>>>>>> pvar "
>>>>>>>> "[T_branch_idx]\n");
>>>>>>>> return -1;
>>>>>>>> }
>>>>>>>>
>>>>>>>> Thus I guess the exported pseudo variable is called
>>>>>>>> $T_branch_idx, but the README says:
>>>>>>>>
>>>>>>>> $T_branch_index - the index (starting with 1 for the first
>>>>>>>> branch)...
>>>>>>>> ^^^^
>>>>>>>>
>>>>>>>> Is guess there is a typo.
>>>>>>>
>>>>>>> indeed.
>>>>>>>
>>>>>>>>
>>>>>>>> Further, do we have a schema how to name the exported pseudo
>>>>>>>> variables?
>>>>>>>
>>>>>>> There is none, but the name should be suggestive as much as
>>>>>>> possible. Somehow, we should find one to avoid duplicates.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Daniel
>>>>>>>
>>>>>>>>
>>>>>>>> regards
>>>>>>>> klaus
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Devel mailing list
>>>>>>>> Devel at openser.org
>>>>>>>> http://openser.org/cgi-bin/mailman/listinfo/devel
>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
More information about the Devel
mailing list