Service Calling Conventions
6-3
Network Tools Library Services
typedef struct _ntargs {
int CallMode; // Determines desired calling mode
#define NT_MODE_IFIDX 1 // Call by specifying IfIdx
#define NT_MODE_IPADDR 2 // Call by specifying IPAddr
int IfIdx; // Physical interface index (0–n)
IPN IPAddr; // IP Address
HANDLE hCallback; // Handle to pass to callback function
void(*pCb)( HANDLE, uint ); // Callback for status change
} NTARGS;
Note that this structure is a simplified version of that provided by the configura-
tion system. This structure also contains a callback function. The callback
function is a subset of that in the configuration system, and codes returned by
this callback are passed through the configuration callback to the application.
The individual fields are defined as follows:
-
int CallMode;
This parameter determines how the service is launched, either by IP ad-
dress or by interface index (1 to n).
Some services can be launched either on a specific interface (1 to n) or on
a specific IP address (which can also be the wildcard INADDR_ANY).
Generally, any service that accepts an IP address can also accept an inter-
face. The service will simply lookup the IP address for the specified inter-
face.
Other services can only be executed by interface and are independent of
IP address. These are said to be compatible with NT_MODE_IFIDX only.
The value of CallMode can be one of the following:
J
NT_MODE_IFIDX – Call by specifying the interface index (1 to n)
J
NT_MODE_IPADDR – Call by specifying IP address in network for-
mat
-
int IfIdx;
This is the physical interface index (1 to n) on which the service is to be
executed. For example, when launching a DHCP server service, the
physical interface is that connected to the home network. For more gener-
ic services (like Telnet), the service can be launched by a pre–defined IP
address (or INADDR_ANY as a wildcard). When launching by IP address
only, this field is left NULL. When this field is used, CallMode should be set
to NT_MODE_IFIDX.
-
IPN IPAddr;
This is the IP address (in network format) on which to initiate the service.
This IP address can specify the wildcard INADDR_ANY, in which case the