本文整理汇总了C++中OE::syslog方法的典型用法代码示例。如果您正苦于以下问题:C++ OE::syslog方法的具体用法?C++ OE::syslog怎么用?C++ OE::syslog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OE
的用法示例。
在下文中一共展示了OE::syslog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
static
int run(char * ip, uint myid, uint count, OE oe, MiniMacs mm) {
CArena mc = CArena_new(oe);
MpcPeer mission_control = 0;
if (mc->connect("87.104.238.146", 65000).rc != 0) {
oe->syslog(OSAL_LOGLEVEL_FATAL,"Failed to connect to the performance monitor.");
return -1;
};
mission_control = mc->get_peer(0);
if (!mission_control) {
oe->p("Failed connection to mission control. aborting.\n");
return -1;
}
if (mm->get_id() == 0) {
if (mm->invite(1,2020+myid) != 0) {
byte d[256] = {0};
char m[128] = {0};
osal_sprintf(m,"Failed to invite %u peers on port %u",1,2020+myid);
oe->p(m);
i2b(myid, d);
osal_sprintf(d+4,"error");
mission_control->send(Data_shallow(d,128));
return 0;
}
} else {
if (mm->connect(ip,2020+myid) != 0) {
char m[128] = {0};
osal_sprintf(m,"Failed to connect to peer %s:%u",ip,2020+myid);
oe->p(m);
return 0;
}
}
{
byte key[128] = {0};
byte ptxt[128] = {0};
mpc_aes(mm,ptxt, key,myid,count,mission_control);
CArena_destroy(&mc);
}
PrintMeasurements(oe);
return 0;
}
示例2: run
/*
* ] Connect to the monitor
*
* ] Listen for clients with ids greater than this client.
*
* ] Connect to clients with ids less than this client. (in this way
* client 1 connects to no one and listens for every one, vice verse
* client N connects to everyone and listens for no one.)
*
* ] Execute mpc_aes with the connected peers
*
* ] Destroy the CArena connected to comm with the monitor and leave.
*/
static
int run(char * ip, uint myid, uint count, OE oe, MiniMacs mm) {
CArena mc = CArena_new(oe);
MpcPeer mission_control = 0;
// connect to monitor
if (mc->connect(bitlab, 65000).rc != 0) {
oe->syslog(OSAL_LOGLEVEL_FATAL,"Failed to connect to the performance monitor.");
return -1;
};
mission_control = mc->get_peer(0);
if (!mission_control) {
oe->p("Failed connection to mission control. aborting.\n");
return -1;
}
// listen for all parties with id greater than mm->myid
{
byte msg[92] = {0};
uint port = 2020+100*mm->get_id();
uint wait4=mm->get_no_players()-(mm->get_id()+1);
osal_sprintf(msg,"Waiting for %u players to connect.",wait4);
oe->p(msg);
if (wait4 > 0) {
if (mm->invite(wait4,port) != 0) {
byte d[256] = {0};
char m[128] = {0};
osal_sprintf(m,"Failed to invite %u peers on port %u",wait4,2020+myid);
oe->syslog(OSAL_LOGLEVEL_FATAL,m);
i2b(myid, d);
osal_sprintf(d+4,"error");
mission_control->send(Data_shallow(d,128));
return 0;
};
}
}
// connect to all parties with id less than mm->myid
{
int id = 0;
for(id = mm->get_id()-1;id >= 0;--id) {
byte address[16] = {0};
byte msg[92] = {0};
uint port = 2020+100*id;
osal_sprintf(msg,"connecting to %u ...",port);
oe->p(msg);
osal_sprintf(address,"10.11.82.%d",id+1);
if (mm->connect(address,port) != 0) {
byte d[256] = {0};
char m[128] = {0};
osal_sprintf(m,"Failed to connect to %s peers on port %u",address,port);
oe->syslog(OSAL_LOGLEVEL_FATAL,m);
i2b(myid, d);
osal_sprintf(d+4,"error");
mission_control->send(Data_shallow(d,128));
return 0;
}
}
}
// invoke AES circuit with zero plaintext and zero key
{
byte key[128] = {0};
byte ptxt[128] = {0};
mpc_aes(mm,ptxt, key,myid,count,mission_control);
CArena_destroy(&mc);
}
// print time measurements if compiled in
PrintMeasurements(oe);
return 0;
}
示例3: string
COO_DEF(Rtz14,bool,executeProof, List circuit, byte * witness, char * ip, uint port) {
Rtz14Impl impl = (Rtz14Impl)this->impl;
OE oe = impl->oe;
Map input_gates = 0;
CircuitVisitor emitter = 0;
// TODO(rwz): take the igv as constructor argument.
CircuitVisitor igv = 0;
EmiterResult emitter_res = 0;
byte * emitted_circuit = 0;
CArena conn = 0;
CircuitVisitor proof_task_builder = 0;
List proof_tasks = 0;
CircuitVisitor gpam = 0;
CircuitVisitor poc = 0;
CircuitVisitor ogv = 0;
List output_gates = 0;
Rnd rnd = 0;
GPam gpam_res = 0;
DateTime d = DateTime_New(oe);
ull start = d->getMilliTime();
uint no_inputs = 0;
_Bool accept = 0;
ProofTask check_out_bit = (ProofTask)oe->getmem(sizeof(*check_out_bit));
// create and call helper strategies
// TODO(rwz): strategies should be given as constructor arguments instead
// of being created here. (for testability and maintainability)
// default one address is 0, however it can be set during create of
// RTZ14.
poc = PatchOneConstants_New(oe,impl->address_of_one);
if (!poc) return False;
// patch addresses.
poc->visit(circuit);
// compute map mapping addresses to input
igv = InputGateVisitor_New(oe);
if (!igv) return False;
input_gates = igv->visit(circuit);
if (!input_gates) return False;
no_inputs = input_gates->size();
ogv = OutputGateVisitor_New(oe);
if (!ogv) return False;
output_gates = ogv->visit(circuit);
if (!output_gates) {
return False;
}
if (output_gates->size() != 1) {
oe->syslog(OSAL_LOGLEVEL_FATAL,"The provided circuit does not have one unique output.");
return False;
}
check_out_bit->indicies[0] = output_gates->get_element(0);
check_out_bit->indicies[1] = impl->address_of_one;
check_out_bit->indicies[2] = impl->address_of_one;
OutputGateVisitor_Destroy(&ogv);
SingleLinkedList_destroy(&output_gates);
// go online
conn = CArena_new(oe);
if (!conn) return False;
if (ip == 0) {
// -----------------------------
// ----------- Prover ----------
// -----------------------------
MpcPeer verifier = 0;
byte and_challenge[1] = {0};
Data challenge_commitment = Data_new(oe,80);
XORcommitResult xom = 0;
Data epsilon = Data_new(oe,1);
Data delta = 0;
Data judgement = Data_new(oe,8);
// The message containing the evaluated circuit, input bits (witness)
// and the auxiliary informations for each and-gate.
Data message = 0;
if (witness == 0) {
oe->syslog(OSAL_LOGLEVEL_FATAL,"No witness !");
return False;
}
UserReport(oe,"Prover preparing ... ");
// compute evaluated circuit
emitter = EvaluationStringEmitter_New(oe, input_gates, witness);
if (!emitter) return False;
emitter_res = emitter->visit(circuit);
if (!emitter_res) return False;
//.........这里部分代码省略.........