#ifndef _sec_SOSRingTypes_
#define _sec_SOSRingTypes_
#include <CoreFoundation/CFRuntime.h>
#include <CoreFoundation/CoreFoundation.h>
#include "keychain/SecureObjectSync/SOSAccount.h"
#include "keychain/SecureObjectSync/SOSRingUtils.h"
typedef struct ringfuncs_t {
char *typeName;
int version;
SOSRingRef (*sosRingCreate)(CFStringRef name, CFStringRef myPeerID, CFErrorRef *error);
bool (*sosRingResetToEmpty)(SOSRingRef ring, CFStringRef myPeerID, CFErrorRef *error);
bool (*sosRingResetToOffering)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
SOSRingStatus (*sosRingDeviceIsInRing)(SOSRingRef ring, CFStringRef peerID);
bool (*sosRingApply)(SOSRingRef ring, SecKeyRef user_pubkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
bool (*sosRingWithdraw)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
bool (*sosRingGenerationSign)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
bool (*sosRingConcordanceSign)(SOSRingRef ring, SOSFullPeerInfoRef requestor, CFErrorRef *error);
SOSConcordanceStatus (*sosRingConcordanceTrust)(SOSFullPeerInfoRef me, CFSetRef peers,
SOSRingRef knownRing, SOSRingRef proposedRing,
SecKeyRef knownPubkey, SecKeyRef userPubkey,
CFStringRef excludePeerID, CFErrorRef *error);
bool (*sosRingAccept)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
bool (*sosRingReject)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
bool (*sosRingSetPayload)(SOSRingRef ring, SecKeyRef user_privkey, CFDataRef payload, SOSFullPeerInfoRef requestor, CFErrorRef *error);
CFDataRef (*sosRingGetPayload)(SOSRingRef ring, CFErrorRef *error);
} ringFuncStruct, *ringFuncs;
static inline SOSRingRef SOSRingCreate_ForType(CFStringRef name, SOSRingType type, CFStringRef myPeerID, CFErrorRef *error) {
SOSRingRef retval = NULL;
retval = SOSRingCreate_Internal(name, type, error);
if(!retval) return NULL;
SOSRingSetLastModifier(retval, myPeerID);
return retval;
}
#endif