hwitag_find_nicaddr()
QNX SDP8.0C Library ReferenceAPIDeveloper
Get the NIC address of a device
Synopsis:
#include <drvr/hwinfo.h>
int hwitag_find_nicaddr( unsigned hwi_off,
unsigned *nicaddr_idx,
uint8_t *nicaddr );
Arguments:
- hwi_off
- The offset into the hwinfo section of the system page for the device, which you can get by calling hwi_find_device().
- nicaddr_idx
- NULL, or a pointer to a location that holds the index of the NIC address that you want to find; see below.
- nicaddr
- NULL, or a pointer to a location where the function can store the NIC address.
Library:
libdrvr
Use the -l drvr option to qcc to link against this library.
Description:
You can use hwitag_find_nicaddr() to find one or more NIC (MAC) addresses associated with the device at hwi_off in the hwinfo section of the syspage. If the specified NIC address exists and hwi_off isn't NULL, hwitag_find_nicaddr() stores the retrieved address in the location that nicaddr points to.
Some devices contain multiple NIC addresses. You can retrieve all of them by using the nicaddr_idx parameter as follows:
- On the first call, set *nicaddr_idx to 0. The first address (if one exists) is returned in *nicaddr.
- You can then continue to call hwitag_find_nicaddr() with the same arguments until the function sets in *nicaddr to NULL.
- If you know that there's more than one NIC address for the specified device, you can set *nicaddr_idx to the entry number of the desired address. If that entry exists, the address will be returned in *nicaddr. For example, to obtain the third address for hwi_off, set *nicaddr_idx to 2 (base-0 indexing applies).
- If you're interested only in the first address, you can pass NULL for nicaddr_idx (which is the same as setting *nicaddr_idx to 0).
Returns:
0 on success (whether or not hwi_off is NULL) or -1 on error.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | No |
Thread | Yes |
Page updated: