[Date Prev][Date Next]
Re: Developing new syntaxes and ordering rules
John Borwick writes:
> How does one go about creating a new syntax? Does it still require
> changing to the openldap source code?
Yes, schema_*.c. I don't know of any documentation, or even how
the indexing and filtering stuff works.
> I have the same question for ordering and substring. Is it possible to
> create an ordering or substring for a new syntax with openldap? Is
> there any documentation about how to implement these filters?
Check e.g. integerMatch() in schema_init.c, which also is used for
the integerOrderingMatch definition in mrule_defs further down.
> The idea is that it would be nice to store IP (v4) addresses using
> octets, and allow filters like
> (myIpHostNumber=1.2.3*) ( as an example: just 1.2.3.* domains )
If you use the syntax 1.2.3.* and do not allow '*' next to a number,
you can use quite normal substring matching rules. Unless you
want 001.2.3.* to match 18.104.22.168, but then I think you can add a
normalization step which removes unnecessary zeroes.
> With the IDEAL being something like
> (myIpHostNumber ~= 22.214.171.124/22 )
I think an approx matching rule must have the same assertion value
syntax as the equality matching rule, so you'd have to allow
(myIpHostNumber = 126.96.36.199/22) as well. Though I suppose you could
define the equality rule to return Undefined for that match.
BTW, if you only need to allow '*' at the end of the substring match,
maybe you'd want to use (myIpHostNumber ~= 1.2.3*) instead, and
represent that and (myIpHostNumber ~= 188.8.131.52/24) the same way
in an approx index.
Another note: I would either call these IPv4 syntaxes and matching rules
or make them support both IPv4 and IPv6 addresses. IPv6 will become
common Real Soon Now, you know:-)