Files
flipper/xplat/Sonar/ConnectionContextStore.h
John Knox afea2f63ec Extract file system interaction from SonarWebSocketImpl
Summary:
SonarWebSocketImpl has got pretty bloated. So I'm extracting all the file interaction out of it into
ConnectionContextStore. The purpose of this class is to provide all the context needed to establish a connection.
This makes SonarWebSocketImpl more functional and therefore testable.

Reviewed By: priteshrnandgaonkar

Differential Revision: D9540089

fbshipit-source-id: 0cd1d69f2b11eaf9f569245a2da14f85cc140427
2018-09-03 11:12:28 -07:00

34 lines
703 B
C++

#pragma once
#include <string>
#include <folly/io/async/SSLContext.h>
#include <folly/dynamic.h>
#include "SonarInitConfig.h"
using namespace folly;
namespace facebook {
namespace sonar {
class ConnectionContextStore {
public:
ConnectionContextStore(DeviceData deviceData);
bool hasRequiredFiles();
std::string createCertificateSigningRequest();
std::shared_ptr<SSLContext> getSSLContext();
std::string getCertificateDirectoryPath();
std::string getDeviceId();
void storeConnectionConfig(folly::dynamic& config);
private:
DeviceData deviceData_;
std::string absoluteFilePath(const char* filename);
bool ensureSonarDirExists();
};
} // namespace sonar
} //namespace facebook