
Writing your own program 145
Then, when a device is discovered, dblookup does the following:
1dblookup builds a SQL string with the device’s key attributes values and runs a query against the database to find a match.
2If no match is found, it waits for the next device.
3Otherwise it takes the best match, that is to say the one with as few stars as possible.
4If two full matches are returned, dblookup logs an error; otherwise, it takes the result of the first partial match encountered.
Writing your own If the standard attribute lookup programs fileattrs and dblookup
programare not sufficient for your requirements, you can write your own attribute lookup program.
In order to write your own
All example programs are included in
<installdir>\TraffixServer\examples.
Structure of an Every time Traffix Manager wants to find out attributes for a device, it Attribute Lookup calls all the attribute lookup programs in the
Program lookup configuration file (see “Contents of the
When you write your own attribute lookup program, your program has to respond to these requests from Traffix Manager and supply attributes for a particular device. Communication with Traffix Manager is done using the functions in the attripc.dll library which is in <installdir>\TraffixServer. Even if you do not know much about DLLs, these functions are designed to make writing your own attribute lookup program as simple as possible.
The main three functions provided by the attripc.dll library are GetNextLookup(), GetAttribute() and SetAttribute(). Below is an example of the central loop of a simple attribute lookup program