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 user-defined attribute program, you need Microsoft Visual C++ V5.0 or later, Microsoft Visual Basic or another tool which allows you to compile a program. The rest of this section assumes you are familiar with programming either C or Visual Basic.

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 user-defined attribute

Program lookup configuration file (see “Contents of the User-defined Attributes Configuration File” on page 138) and asks them to provide attributes for the device.

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

Page 145
Image 145
HP Transcend Traffix Manager manual All example programs are included, Installdir\TraffixServer\examples