appconfig.hpp 855 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef __CONFIG_HPP__
  2. #define __CONFIG_HPP__
  3. #include <string>
  4. #include <vector>
  5. #include <cstdint>
  6. #include "sgx_tcrypto.h"
  7. #include "../Enclave/enclave_api.h"
  8. // The per-node config
  9. struct NodeConfig {
  10. std::string name;
  11. sgx_ec256_public_t pubkey;
  12. std::string listenhost, listenport;
  13. std::string clistenhost, clistenport;
  14. uint8_t weight;
  15. uint8_t roles;
  16. };
  17. // The global config
  18. struct Config {
  19. // global params
  20. uint32_t user_count;
  21. uint16_t msg_size;
  22. uint8_t m_priv_out;
  23. uint8_t m_priv_in;
  24. uint8_t m_pub_out;
  25. uint8_t m_pub_in;
  26. uint16_t nthreads;
  27. // config for each node
  28. std::vector<NodeConfig> nodes;
  29. // Which node is this one?
  30. nodenum_t my_node_num;
  31. };
  32. bool config_parse(Config &config, const std::string configstr,
  33. const std::string &myname, threadid_t nthreads);
  34. #endif