appconfig.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. bool private_routing;
  30. uint16_t nthreads;
  31. // config for each node
  32. std::vector<NodeConfig> nodes;
  33. // Which node is this one?
  34. nodenum_t my_node_num;
  35. // Stub hardcoded master secret to generate keys for client <->
  36. // server communication (in reality, a key exchange would be done)
  37. sgx_aes_gcm_128bit_key_t master_secret;
  38. };
  39. bool config_parse(Config &config, const std::string configstr,
  40. const std::string &myname, threadid_t nthreads);
  41. #endif