146APPENDIX E: AUTOMATIC ATTRIBUTE ASSIGNMENT
(there is one version in Visual Basic and one in C):
Figure 19 Simple attribute lookup process in C
while ( GetNextLookup() )
{
if ( strcmp( GetAttribute( "NL Type" ), "IP" ) == 0 ) SetAttribute( "New Device", "TRUE" );
}
Figure 20 Simple attribute lookup process in Visual Basic
While GetNextLookup <> 0
If GetAttribute "NL Type" = "IP" Then
SetAttribute "New Device", "TRUE"
End If
Wend
The idea behind this program is that every newly discovered IP device on the network is assigned a value of TRUE for the New Device attribute. You could use this attribute assignment to group together all the newly discovered devices on your network with the Map.
This shows the fundamental structure of any attribute lookup program:
■Calling the GetNextLookup function causes your program to wait until Traffix Manager wants your program to lookup another attribute, or until Traffix Manager exits. The function returns the value 1 if there is a device whose attributes should be looked up, or 0 if it wants your program to exit.
■When GetNextLookup returns 1, Traffix Manager expects the program to determine attributes for one device. The GetAttribute function can be used to discover the value of any attribute for the device, and the SetAttribute function can be used to set an attribute assignment.
■In this program, for each device, the program checks the value of the NLType using GetAttribute. If this attribute is set to IP, then it sets