appconfig.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. uint8_t weight;
  17. uint8_t roles;
  18. };
  19. // The global config
  20. struct Config {
  21. // global params
  22. uint32_t user_count;
  23. uint16_t msg_size;
  24. uint8_t m_priv_out;
  25. uint8_t m_priv_in;
  26. uint8_t m_pub_out;
  27. uint8_t m_pub_in;
  28. uint16_t nthreads;
  29. // config for each node
  30. std::vector<NodeConfig> nodes;
  31. // Which node is this one?
  32. nodenum_t my_node_num;
  33. // Hardcoded master secret to generate keys for client -> server communication
  34. sgx_aes_gcm_128bit_key_t master_secret;
  35. };
  36. bool config_parse(Config &config, const std::string configstr,
  37. const std::string &myname, threadid_t nthreads);
  38. extern EnclaveAPIParams apiparams;
  39. #endif