New Database Map Classes

New key maps can be added by creating a class initialization function and a lookup function. These are then added to the routine setupmaps.

The initialization function is called as

xxx_map_init(MAP *map, char *mapname, char *args)
The map is an internal data structure. The mapname is the name of the map (used for error messages). The args is a pointer to the rest of the configuration file line; flags and filenames can be extracted from this line. The initialization function must return if it successfully opened the map, otherwise.

The lookup function is called as

xxx_map_lookup(MAP *map, char buf[], int bufsize, char **av, int *statp)
The map defines the map internally. The parameters buf and bufsize have the input key. This may be (and often is) used destructively. The av is a list of arguments passed in from the rewrite line. The lookup function should return a pointer to the new value. IF the map lookup fails, *statp should be set to an exit status code; in particular, it should be set to if recovery is to be attempted by the higher level code.

[Contents] [Previous] [Next]

Questions or problems regarding this web site should be directed to Steve Gielda.
Copyright 1999  All rights reserved.
Last modified: Friday April 02, 1999.