12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #ifndef __PRSONA_NETWORK_CLIENT_HPP
- #define __PRSONA_NETWORK_CLIENT_HPP
- #include <string>
- #include <vector>
- #include <random>
- #include "client.hpp"
- #include "networking.hpp"
- // #define BGN_TMP_FILE (TMP_DIR "bgn")
- // #define GEN_TMP_FILE (TMP_DIR "generator")
- // #define EPOCH_GEN_TMP_FILE (TMP_DIR "epoch")
- class PrsonaClientWebSocketHandler : public CivetWebSocketHandler {
- public:
- // CONSTRUCTORS
- PrsonaClientWebSocketHandler(
- const PrsonaClient *prsonaClient,
- const std::vector<std::string>& serverIPs,
- const std::string& selfIP,
- const std::default_random_engine *generator);
- virtual bool handleConnection(
- CivetServer *server,
- const struct mg_connection *conn);
- virtual void handleReadyState(
- CivetServer *server,
- struct mg_connection *conn);
- virtual bool handleData(
- CivetServer *server,
- struct mg_connection *conn,
- int bits,
- char *data,
- size_t data_len);
- virtual void handleClose(
- CivetServer *server,
- const struct mg_connection *conn);
- private:
- const PrsonaClient *prsonaClient;
- const std::vector<std::string> serverIPs;
- const std::string selfIP;
- const std::default_random_engine *generator;
- void verify_reputation_proof(struct mg_connection *c) const;
- }
- template <typename T>
- T get_committed_val_from_file(
- struct synchronization_tool *sync,
- char *filename,
- Proof& pi);
- template <typename T>
- T get_first_committed_val(
- const std::string& server,
- Proof& pi,
- const Twistpoint& shortTermPublicKey,
- const char *firstUri);
- Proof get_commitment_from_file(
- struct synchronization_tool *sync,
- char *filename);
- void get_additional_commitment(
- const std::vector<std::string>& servers,
- const std::string& skip,
- std::vector<Proof>& pi,
- const Twistpoint& shortTermPublicKey,
- char *which);
- template <typename T>
- T get_server_committed_val(
- std::default_random_engine *generator,
- const std::vector<std::string>& serverIPs,
- std::vector<Proof>& pi,
- const Twistpoint& shortTermPublicKey,
- const char *firstUri
- const char *commitUri);
- #endif
|