tfSadbRecordDeleteByDestination

Jump to: navigation, search

Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference


#include <trsocket.h>


int tfSadbRecordDeleteByDestination (
ttUser32Bit options,
struct sockaddr_storage TM_FAR * destination
);


Function Description

This procedure is called to delete all SA’s with the given destination IP address.



Parameters

  • options
    The options parameter is used to pass the following bit flags that can be or'ed together:
TM_IPSEC_INBOUND: delete all inbound security associations associated with specified peer.
TM_IPSEC_OUTBOUND: delete all outbound security associations associated with specified peer.
By default, if you specify 0 for options, this API deletes all outbound security associations associated with the specified peer.
  • destination
    The destination IP address, specified in sockaddr_storage format. By this means, we will keep this same API for IPv6.


Returns

  • TM_ENOERROR
    SA were successfully deleted
  • other value
    unsuccessful operation


Example

This example shows how to delete all SA’s destined to "2.2.2.1"

{
    struct sockaddr_storage  ipstorage;
    int                      errorCode;
 
    tm_bzero(&ipstorage, sizeof(struct sockaddr_storage));
    ipstorage.ss_family = PF_INET;
    ipstorage.ss_len = sizeof(struct sockaddr_in);
    ipstorage.addr.ipv4.sin_addr.s_addr = inet_addr("2.2.2.1");
    errorCode = tfSadbRecordDeleteByDestination(0, &ipstorage);
...
 }

Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference