Commit c95f1a86 authored by yiwenshao's avatar yiwenshao

able to read from conf file, still not able to call get_onionlayout in main/schema.cc

parent e95a21bd
[onions for num] [onions for num]
oDET: DETJOIN DET RND oDET: DETJOIN DET RND
oOPE: OPE RND oOPE: OPEFOREIGN OPE RND
oAGG: HOM oAGG: HOM
[end] [end]
[onions for str] [onions for str]
oDET: DET RND oDET: DETJOIN DET RND
oOPE: OPE RND oOPE: OPEFOREIGN OPE RND
oSWP: SEARCH
[onions for num]
oDET: DETJOIN DET RND
oOPE: OPE RND
oAGG: HOM
[end]
[onions for str]
oDET: DET RND
oOPE: OPE RND
[onions for num]
oDET: DETJOIN DET RND
oOPE: OPE RND
oAGG: HOM
[end]
[onions for str]
oDET: DET RND
oOPE: OPE RND
oSWP: SEARCH
#include "util/onions.hh" #include "util/onions.hh"
#include <assert.h>
static
void is_onionlayout_equal(onionlayout &ol1,onionlayout &ol2){
for(auto item:ol1){
auto key = item.first;
assert(ol2.find(key)!=ol2.end());
assert(ol2[key]==ol1[key]);
}
}
int main(){ int main(){
const char *di = dir; const char *di = "conf/CURRENT.conf";
onion_conf of(di); onion_conf of(di);
auto res = of.get_onionlayout_for_num(); auto res = of.get_onionlayout_for_num();
auto res2 = of.get_onion_levels_str(); auto res2 = of.get_onionlayout_for_str();
is_onionlayout_equal(res,NUM_ONION_LAYOUT);
is_onionlayout_equal(NUM_ONION_LAYOUT,res);
is_onionlayout_equal(res2,STR_ONION_LAYOUT);
is_onionlayout_equal(STR_ONION_LAYOUT,res2);
return 0; return 0;
} }
...@@ -431,9 +431,11 @@ onionlayout FieldMeta::determineOnionLayout(const AES_KEY *const m_key, ...@@ -431,9 +431,11 @@ onionlayout FieldMeta::determineOnionLayout(const AES_KEY *const m_key,
/*we only support sensitive rating here*/ /*we only support sensitive rating here*/
if (SECURITY_RATING::SENSITIVE == sec_rating) { if (SECURITY_RATING::SENSITIVE == sec_rating) {
if (true == isMySQLTypeNumeric(f)) { if (true == isMySQLTypeNumeric(f)) {
return NUM_ONION_LAYOUT; return CURRENT_NUM_LAYOUT;
// return NUM_ONION_LAYOUT;
} else { } else {
return STR_ONION_LAYOUT; return CURRENT_STR_LAYOUT;
// return STR_ONION_LAYOUT;
} }
} else if (SECURITY_RATING::BEST_EFFORT == sec_rating) { } else if (SECURITY_RATING::BEST_EFFORT == sec_rating) {
if (true == isMySQLTypeNumeric(f)) { if (true == isMySQLTypeNumeric(f)) {
......
#comments
#typedef enum onion {
# oDET,
# oOPE,
# oAGG,
# oSWP,
# oPLAIN,
# oBESTEFFORT,
# oASHE,
# oINVALID,
#} onion;
#
#extern std::map<std::string,onion> string_to_onion;
#
#//Sec levels ordered such that
#// if a is less secure than b.
#// a appears before b
#// (note, this is not "iff")
#
#enum class SECLEVEL {
# INVALID,
# PLAINVAL,
# OPEFOREIGN,
# OPE,
# DETJOIN,
# DET,
# SEARCH,
# HOM,
# ASHE,//added
# RND,
#};
[onions for num]
oDET: DETJOIN DET RND
oOPE: OPE RND
oAGG: HOM
oASHE: ASHE
[end]
[onions for str]
oDET: DETJOIN DET RND
oOPE: OPE RND
oSWP: SEARCH
[end]
...@@ -141,7 +141,9 @@ onion_conf::~onion_conf(){ ...@@ -141,7 +141,9 @@ onion_conf::~onion_conf(){
} }
onion_conf global_onion_conf(dir);
onionlayout CURRENT_NUM_LAYOUT = global_onion_conf.get_onionlayout_for_num();
onionlayout CURRENT_STR_LAYOUT = global_onion_conf.get_onionlayout_for_str();
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <vector> #include <vector>
#include <assert.h> #include <assert.h>
extern const char *const dir;
typedef enum onion { typedef enum onion {
oDET, oDET,
oOPE, oOPE,
...@@ -188,4 +187,5 @@ public: ...@@ -188,4 +187,5 @@ public:
}; };
extern onionlayout CURRENT_NUM_LAYOUT;
extern onionlayout CURRENT_STR_LAYOUT;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment