You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

keypairs_cache.h 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*-
  2. * Copyright 2016 Vsevolod Stakhov
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef KEYPAIRS_CACHE_H_
  17. #define KEYPAIRS_CACHE_H_
  18. #include "config.h"
  19. #include "keypair.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. struct rspamd_keypair_cache;
  24. /**
  25. * Create new keypair cache of the specified size
  26. * @param max_items defines maximum count of elements in the cache
  27. * @return new cache
  28. */
  29. struct rspamd_keypair_cache *rspamd_keypair_cache_new(unsigned int max_items);
  30. /**
  31. * Process local and remote keypair setting beforenm value as appropriate
  32. * @param c cache of keypairs
  33. * @param lk local key
  34. * @param rk remote key
  35. */
  36. void rspamd_keypair_cache_process(struct rspamd_keypair_cache *c,
  37. struct rspamd_cryptobox_keypair *lk,
  38. struct rspamd_cryptobox_pubkey *rk);
  39. /**
  40. * Destroy old keypair cache
  41. * @param c cache object
  42. */
  43. void rspamd_keypair_cache_destroy(struct rspamd_keypair_cache *c);
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif /* KEYPAIRS_CACHE_H_ */