spir_ffi.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef __SPIR_FFI_H__
  2. #define __SPIR_FFI_H__
  3. #include <stdint.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef size_t DBEntry;
  8. typedef struct {
  9. const char *data;
  10. size_t len;
  11. size_t capacity;
  12. } VecData;
  13. typedef struct {
  14. void *client;
  15. VecData pub_params;
  16. } ClientNewRet;
  17. extern void spir_init(uint32_t num_threads);
  18. extern ClientNewRet spir_client_new(uint8_t r);
  19. extern void spir_client_free(void *client);
  20. extern VecData spir_client_preproc(void *client, uint32_t num_preproc);
  21. extern void spir_client_preproc_finish(void *client,
  22. const char *msgdata, size_t msglen);
  23. extern VecData spir_client_query(void *client, size_t idx);
  24. extern DBEntry spir_client_query_finish(void *client,
  25. const char *msgdata, size_t msglen);
  26. extern void* spir_server_new(uint8_t r, const char *pub_params,
  27. size_t pub_params_len);
  28. extern void spir_server_free(void *server);
  29. extern VecData spir_server_preproc_process(void *server,
  30. const char *msgdata, size_t msglen);
  31. extern VecData spir_server_query_process(void *server,
  32. const char *msgdata, size_t msglen, const DBEntry *db,
  33. size_t rot, DBEntry blind);
  34. extern void spir_vecdata_free(VecData vecdata);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif