Writing your own program, Structure of an attribute lookup program – HP Transcend Traffix Manager User Manual

Page 145

Advertising
background image

Writing your own program

145

Then, when a device is discovered,

dblookup

does the following:

1

dblookup

builds a SQL string with the device’s key attributes values and

runs a query against the database to find a match.

2 If no match is found, it waits for the next device.

3 Otherwise it takes the best match, that is to say the one with as few stars

as possible.

4 If two full matches are returned,

dblookup

logs an error; otherwise, it

takes the result of the first partial match encountered.

Writing your own
program

If the standard attribute lookup programs

fileattrs

and

dblookup

are 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

Attribute Lookup

Program

Every time Traffix Manager wants to find out attributes for a device, it
calls all the attribute lookup programs in the user-defined attribute
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

Advertising