tfSadbRecordGetByPolicy
Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference
| #include <trsocket.h> |
| int | tfSadbRecordGetByPolicy | ( | |
| ttUser32Bit options, | |||
| ttUser16Bit priority, | |||
| ttPolicyEntryPtr plcyPtr, | |||
| ttUser8Bit direction, | |||
| ttUserVoidPtrPtr iteratorPtr, | |||
| ttSadbDetailsPtr sadbDetailsPtr) | |||
| The highlighted parameters are conditional. | |||
| See the Parameters section for more details. | |||
Function Description
This function iterates through all SAs for a given IPsec policy.
Usage
The caller must call this function with iteratorPtr set to (ttUserVoidPtrPtr)0 the first time. The caller should use the returned value in subsequent calls to retrieve the next active SA for the IPsec Policy in plcyPtr. This iteratively returns sadbDetailsPtr.
The direction value must be TM_IPSEC_INBOUND or TM_IPSEC_OUTBOUND, but not both. To enumerate SAs for a single IPsec Policy for both directions, the caller should invoke this function once for the inbound direction and immediately make another call for the outbound direction keeping the iteratorPtr values independent of one another.
| This function requires Statistics to be enabled (TM_USE_SEC_STAT). |
Parameters
- options
- This is (rarely) set to TM_IPSEC_DATABASE_LOCKED if IPsec is locked, otherwise it is set to 0.
- priority
- This contains the 0-based Priority of the IKE Policy database entry. This is only present when using priority-based processing. NOTE: This parameter is conditional and only present when TM_USE_PRIORITIES is defined at compile time.
- plcyPtr
- This contains a pointer to the IPsec Policy of interest. This is only used when not using priority-based processing. direction This is set to TM_IPSEC_INBOUND or TM_IPSEC_OUTBOUND to determine SA direction. NOTE: This parameter is conditional and only present when TM_USE_PRIORITIES is not defined at compile time.
- iteratorPtr
- This is set to 0 on the first call. The returned value is used in subsequent calls to iterate.
- sadbDetailsPtr
- This is the SA information that is returned.
Returns
- TM_ENOERROR
- This indicates success. iteratorPtr will contain a value which must be used in subsequent calls. sadbDetailsPtr will contain SA information.
- TM_EUPDATED
- This indicates a change to the active set of SAs for the plcyPtr since the first call. Subsequent calls return all existing SAs that were present when the first call was made, however new SAs will not be returned. Typically, the caller will want to restart the enumeration.
- TM_ESANOTFOUND
- This indicates that there are no active SAs for the plcyPtr.
- TM_ENOENT
- This indicates completion of the iteration (no more SAs).
- TM_EINVAL
- This indicates failure. The kernel found invalid arguments in the call.
- TM_EIPSECNOTINITIALIZED
- This indicates failure. The kernel has not yet started IPsec/IKE.
Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference