// This Source Code Form is subject to the terms of the Mozilla Public // License, version 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #pragma once #include #include #include namespace libsignal { template struct deleter { void operator() (T *ptr) { SIGNAL_UNREF(ptr); } }; template<> struct deleter { void operator() (struct signal_context *ptr) { signal_context_destroy(ptr); } }; template<> struct deleter { void operator() (struct signal_protocol_store_context *ptr) { signal_protocol_store_context_destroy(ptr); } }; template<> struct deleter { void operator() (struct ratchet_identity_key_pair *ptr) { ratchet_identity_key_pair_destroy( reinterpret_cast(ptr)); } }; template using object = std::unique_ptr>; template object make(int (*fun)(T**,Args...), Args... args) { T *result; fun(&result, args...); return object(result); }; typedef object context; typedef object store_context; typedef object identity_key_pair; typedef object public_key; typedef object private_key; }