HBA_RegisterForTargetEvents function (hbaapi.h)
Registers for target events with a specified target, or with all targets associated with an adapter.
Syntax
HBA_STATUS HBA_API HBA_RegisterForTargetEvents(
void(* )(void *pData,HBA_WWN hbaPortWWN,HBA_WWN discoveredPortWWN,HBA_UINT32 eventType) callback,
void *pUserData,
HBA_HANDLE Handle,
HBA_WWN HbaPortWWN,
HBA_WWN DiscoveredPortWWN,
HBA_CALLBACKHANDLE *pCallbackHandle,
HBA_UINT32 AllTargets
);
Parameters
callback
Pointer to a callback routine to be called when the event occurs. Define your callback routine with this prototype:
void(*)(void *pData, HBA_WWN PortWWN, HBA_UINT32 eventType, HBA_UINT32 fabricPortID)
When your callback routine is called, the following parameters are passed to it:
- pData. Pointer to a buffer that contains data that you provided when registering this callback routine. You can use this data to correlate the event with the source of the event registration.
- PortWWN. A 64-bit world-wide name (WWN) that uniquely identifies the host bus adapter (HBA) port from which port events are reported. The callback routine is called whenever an event occurs for this port. For a discussion of worldwide names, see the T11 committee's Fibre Channel HBA API specification.
- eventType. Indicates the event type. The values assigned to this member correspond to the values associated with the EVENT_TYPE_QUALIFIERS property qualifier. In particular, this member can have one of the following values: HBA_EVENT_PORT_FABRIC (a local port has received a registered state change notification, or RSCN, command. When this event occurs, fabricPortID contains the port identifier page for the sub-section of the fabric that has changed, as explained in the T11 committee's Fibre Channel Framing and Signaling, or FC-FS, specification), or HBA_EVENT_PORT_OFFLINE (a local port has gone offline), or HBA_EVENT_PORT_NEW_TARGETS (a local port has added target devices to its discovered remote ports), or HBA_EVENT_PORT_ONLINE (a local port has come online), or HBA_EVENT_PORT_UNKNOWN (the port event is unknown).
- fabricPortID. Pointer to a buffer that contains the port ID page for the sub-section of the fabric that has changed, as explained in the T11 committee's Fibre Channel Framing and Signaling (FC-FS) specification.
pUserData
Pointer to a buffer that will be passed to the callback routine with each event. This data correlates the event with the source of the event registration.
Handle
Contains a value (returned by the routine HBA_OpenAdapter) that identifies the HBA for which event callbacks are requested.
HbaPortWWN
A 64-bit world-wide name (WWN) that uniquely identifies the remote host bus adapter (HBA) port from which port events are reported. For a discussion of worldwide names, see the T11 committee's Fibre Channel HBA API specification.
DiscoveredPortWWN
A 64-bit world-wide name (WWN) that uniquely identifies the host bus adapter (HBA) port from which the target was discovered.
pCallbackHandle
Contains an opaque identifier that you can pass to HBA_RemoveCallback to de-register the callback routine.
AllTargets
Indicates, when nonzero, that the value in discoveredPortWWN will be ignored, and the callback will be called for events associated with all current and future discovered targets. If this member is 0, then only events associated with the target specified by discoveredPortWWN will be reported.
Return value
A value of type HBA_STATUS that indicates the status of the HBA. In particular, it returns one of the following values.
Return code | Description |
---|---|
HBA_STATUS_OK | The callback routine was successfully registered. |
HBA_STATUS_ERROR_ILLEGAL_WWN | Returned if the HBA referenced by handle doesn't have a port with a name that matches the value in discoveredPortWWN. |
HBA_STATUS_ERROR | An unspecified error occurred that prevented the registration of the callback routine. |
Requirements
Requirement | Value |
---|---|
Header | hbaapi.h |
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for