appconfig.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #define CLIENT_AUTHENTICATE 0x00
  9. #define CLIENT_MESSAGE_BUNDLE 0x01
  10. // The per-node config
  11. struct NodeConfig {
  12. std::string name;
  13. sgx_ec256_public_t pubkey;
  14. std::string listenhost, listenport;
  15. std::string clistenhost, clistenport;
  16. std::string slistenhost, slistenport;
  17. uint8_t weight;
  18. uint8_t roles;
  19. };
  20. // The global config
  21. struct Config {
  22. // global params
  23. uint32_t user_count;
  24. uint16_t msg_size;
  25. uint8_t m_priv_out;
  26. uint8_t m_priv_in;
  27. uint8_t m_pub_out;
  28. uint8_t m_pub_in;
  29. uint16_t nthreads;
  30. // config for each node
  31. std::vector<NodeConfig> nodes;
  32. // Which node is this one?
  33. nodenum_t my_node_num;
  34. // Hardcoded master secret to generate keys for client -> server communication
  35. sgx_aes_gcm_128bit_key_t master_secret;
  36. };
  37. bool config_parse(Config &config, const std::string configstr,
  38. const std::string &myname, threadid_t nthreads);
  39. extern EnclaveAPIParams apiparams;
  40. #endif