#ifndef __API_SUPPORT__
#define __API_SUPPORT__
#include <CoreFoundation/CoreFoundation.h>
#include <net/pfkeyv2.h>
#include "racoon_types.h"
#include <sys/socket.h>
#include <SNIPSecIKEDefinitions.h>
#include <SNIPSecDBDefinitions.h>
#include <SNIPSecIKE.h>
#include <SNIPSecDB.h>
struct isakmp_cfg_state;
struct ikev2_traffic_selector;
#define kSNIPSecDBSrcRangeEndAddress CFSTR("SrcRangeEndAddress")
#define kSNIPSecDBDstRangeEndAddress CFSTR("DstRangeEndAddress")
#define kSNIPSecDBSrcRangeEndPort CFSTR("SrcRangeEndPort")
#define kSNIPSecDBDstRangeEndPort CFSTR("DstRangeEndPort")
#define kSNIPSecDBPolicyID CFSTR("PolicyID")
#define kSNIPSecDBPolicyType CFSTR("PolicyType")
#define kSNIPSecDBValPolicyTypeDiscard CFSTR("Discard")
#define kSNIPSecDBValPolicyTypeNone CFSTR("None")
#define kSNIPSecDBValPolicyTypeIPSec CFSTR("IPSec")
#define kSNIPSecDBValPolicyTypeEntrust CFSTR("Entrust")
#define kSNIPSecDBValPolicyTypeBypass CFSTR("Bypass")
#define kSNIPSecDBValPolicyTypeGenerate CFSTR("Generate")
#define kSNIPSecDBSACreateTime CFSTR("CreateTime")
#define kSNIPSecDBSACurrentTime CFSTR("CurrentTime")
#define kSNIPSecDBSADiffTime CFSTR("DiffTime")
#define kSNIPSecDBSAHardLifetime CFSTR("HardLifetime")
#define kSNIPSecDBSASoftLifetime CFSTR("SoftLifetime")
#define kSNIPSecDBSALastUseTime CFSTR("LastUseTime")
#define kSNIPSecDBSAHardUseTime CFSTR("HardUseTime")
#define kSNIPSecDBSASoftUseTime CFSTR("SoftUseTime")
#define kSNIPSecDBSACurrentBytes CFSTR("CurrentBytes")
#define kSNIPSecDBSAHardBytes CFSTR("HardBytes")
#define kSNIPSecDBSASoftBytes CFSTR("SoftBytes")
#define kSNIPSecDBSACurrentAllocations CFSTR("CurrentAllocations")
#define kSNIPSecDBSAHardAllocations CFSTR("HardAllocations")
#define kSNIPSecDBSASoftAllocations CFSTR("SoftAllocations")
#define kSNIPSecDBSAState CFSTR("State")
#define kSNIPSecDBValSAStateLarval CFSTR("Larval")
#define kSNIPSecDBValSAStateMature CFSTR("Mature")
#define kSNIPSecDBValSAStateDying CFSTR("Dying")
#define kSNIPSecDBValSAStateDead CFSTR("Dead")
#define kSNIPSecIKEAssignedPCSCFIPv6Address CFSTR("AssignedPCSCFIPv6Address")
typedef uint32_t InternalSessionRef;
typedef uint32_t InternalItemRef;
typedef InternalSessionRef InternalDBRef;
typedef InternalItemRef InternalDBSARef;
typedef InternalItemRef InternalDBPolicyRef;
typedef InternalItemRef InternalDBInterfaceRef;
#define kInternalDBRefInvalid 0
#define kInternalDBSARefInvalid 0
#define kInternalDBPolicyRefInvalid 0
#define kInternalDBInterfaceRefInvalid 0
typedef InternalSessionRef InternalIKESARef;
typedef InternalItemRef InternalChildSARef;
#define kInternalIKESARefInvalid 0
#define kInternalChildSARefInvalid 0
void ASSendXPCReply (InternalSessionRef sessionRef, InternalItemRef objRef, int callType, void *retVal, Boolean success);
void ASSendXPCMessage(uint32_t message, void *messageobj, uint32_t sessionID, uint32_t itemID);
InternalDBRef ASDBCreate (void);
InternalDBSARef ASDBGetSPI (InternalDBRef ref, CFDictionaryRef sadata);
InternalDBSARef ASDBCreateSA (InternalDBRef ref, CFDictionaryRef sadata);
Boolean ASDBUpdateSA (InternalDBRef ref, InternalDBSARef saref, CFDictionaryRef sadata);
Boolean ASDBDeleteSA (InternalDBRef ref, InternalDBSARef saref);
Boolean ASDBCopySA (InternalDBRef ref, InternalDBSARef saref);
Boolean ASDBFlushSA (InternalDBRef ref, Boolean *blockForResponse);
CFArrayRef ASDBCopySAIDs (InternalDBRef ref);
InternalDBPolicyRef ASDBAddPolicy (InternalDBRef ref, CFDictionaryRef spdata);
Boolean ASDBDeletePolicy (InternalDBRef ref, InternalDBPolicyRef policyref);
Boolean ASDBCopyPolicy (InternalDBRef ref, InternalDBPolicyRef policyref);
Boolean ASDBFlushPolicy (InternalDBRef ref, Boolean *blockForResponse);
CFArrayRef ASDBCopyPolicyIDs (InternalDBRef ref);
Boolean ASDBFlushAll (InternalDBRef ref, Boolean *blockForResponse);
Boolean ASDBDispose (InternalDBRef ref, Boolean *blockForResponse);
InternalDBInterfaceRef ASDBCreateIPSecInterface (InternalDBRef ref, struct sockaddr_storage *address, struct sockaddr_storage *netmask, struct sockaddr_storage *v6address, int v6prefix);
Boolean ASDBFlushInterfaces (InternalDBRef ref);
InternalIKESARef ASIKECreate (CFDictionaryRef ikedata, CFDictionaryRef childData);
InternalChildSARef ASIKEStartConnection (InternalIKESARef ref);
Boolean ASIKEStopConnection (InternalIKESARef ref);
InternalChildSARef ASIKEStartChildSA (InternalIKESARef ref, CFDictionaryRef ikechilddata);
Boolean ASIKEStopChildSA (InternalIKESARef ref, InternalChildSARef childref);
SNIPSecIKEStatus ASIKEGetConnectionStatus (InternalIKESARef ref);
SNIPSecIKEStatus ASIKEGetChildStatus (InternalIKESARef ref, InternalChildSARef childref);
Boolean ASIKEDispose (InternalIKESARef ref, Boolean *blockForResponse);
Boolean ASIKEEnableAll (InternalIKESARef ref);
Boolean ASIKEDisableAll (InternalIKESARef ref);
InternalDBSARef ASDBGetSPIFromIKE (InternalDBRef ref, phase2_handle_t *phase2);
Boolean ASDBAddSAFromIKE (InternalDBRef ref, phase2_handle_t *phase2, Boolean update);
Boolean ASDBDeleteSAFromIKE (InternalDBRef ref, struct sockaddr_storage *dst, uint32_t spi, int ipsecProtocol);
Boolean ASDBFlushAllForIKEChildSA (InternalDBRef ref, InternalChildSARef childRef);
InternalDBPolicyRef ASDBAddPolicyFromIKE (InternalDBRef ref, phase2_handle_t *phase2);
Boolean ASDBReceivePFKeyMessage (caddr_t *message, int array_size);
Boolean ASDBGetIPSecInterfaceName (InternalDBRef ref, char *buf, int bufLen);
Boolean ASIKEConnectionAddChildSAFromIKE (InternalIKESARef ref, phase2_handle_t *childSA);
Boolean ASIKEConnectionSwapChildSAs (InternalIKESARef ref, InternalChildSARef oldChildSA, InternalChildSARef newChildSA);
void ASIKEConnectionExpireChildSAFromIKE (InternalIKESARef ref, InternalChildSARef childSARef);
Boolean ASHasValidSessions (void);
void ASIKEUpdateLocalAddressesFromIKE (void);
void ASIKEUpdateStatusFromIKE (InternalIKESARef ref, InternalChildSARef childRef, uint32_t status, uint32_t reason);
phase2_handle_t *ASIKEConnectionGetChildSAFromIKE (InternalIKESARef ref, InternalChildSARef childSARef);
void ASIKEUpdateConfigurationFromIKE (InternalIKESARef ref, struct isakmp_cfg_state *config);
void ASIKEUpdateTrafficSelectorsFromIKE (InternalIKESARef ref, InternalChildSARef childRef, struct ikev2_traffic_selector *local, struct ikev2_traffic_selector *remote);
void ASIKEStopConnectionFromIKE (InternalIKESARef ref);
#endif