Skip to content

Commit

Permalink
rename some functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
richkmeli committed Aug 31, 2017
1 parent 4143ef3 commit 9b6c821
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
* Copyright 2016 Riccardo Melioli. All Rights Reserved.
*/

#include <iostream>
#include "src/richkware.h"

int main() {
Richkware richkware("Richk","richktest");
Richkware richkware("Richk","richktest","rms-richk.rhcloud.com", "80");

// PUT YOUR CODE HERE

Expand Down
6 changes: 3 additions & 3 deletions src/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ std::string Network::RawRequest(const char* serverAddress, const char* port, con
}


bool Network::UploadInfoToRichkwareManagerServer(const char * serverAddress, const char* port) {
bool Network::UploadInfoToRMS(const char * serverAddress, const char* port) {
const char* serverPort = server.getPort();
Crypto crypto(encryptionKey);

Expand All @@ -152,12 +152,12 @@ bool Network::UploadInfoToRichkwareManagerServer(const char * serverAddress, con
return true;
}

std::string Network::KeyExchange(const char * serverAddress, const char* port){
std::string Network::GetEncryptionKeyFromRMS(const char * serverAddress, const char* port){
Crypto crypto(encryptionKey);
std::string key = "";

// create a database entry into the Richkware-Manager-Server, to obtain the encryption key server-side generated
UploadInfoToRichkwareManagerServer(serverAddress,port);
UploadInfoToRMS(serverAddress,port);

// Primary key in RMS database.
std::string name = getenv("COMPUTERNAME");
Expand Down
5 changes: 3 additions & 2 deletions src/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ class Network {

std::string RawRequest(const char* serverAddress, const char* port, const char* request);
const char* ResolveAddress(const char* address);
std::string KeyExchange(const char * serverAddress, const char* port);
bool UploadInfoToRichkwareManagerServer(const char * serverAddress, const char* port);
std::string GetEncryptionKeyFromRMS(const char * serverAddress, const char* port);
// upload info to Richkware-Manager-Server
bool UploadInfoToRMS(const char * serverAddress, const char* port);
};

class Device {
Expand Down
2 changes: 1 addition & 1 deletion src/richkware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Richkware::Richkware(const char *AppNameArg, const char *defaultEncryptionKey, c
if (encKey.empty()) {
// Key Exchange with Richkware-Manager-Server, using defaultEncryptionKey.
Network network1(defaultEncryptionKey);
encKey = network1.KeyExchange(serverAddress, port);
encKey = network1.GetEncryptionKeyFromRMS(serverAddress, port);

if (encKey.empty() || (encKey.compare("Error") == 0)) {
// Key Exchange failed
Expand Down

0 comments on commit 9b6c821

Please sign in to comment.