Electroneum
LevinFuzzer Class Reference
Inheritance diagram for LevinFuzzer:
Collaboration diagram for LevinFuzzer:

Public Member Functions

 LevinFuzzer ()
 
virtual int init ()
 
virtual int run (const std::string &filename)
 

Detailed Description

Definition at line 282 of file levin.cpp.

Constructor & Destructor Documentation

◆ LevinFuzzer()

LevinFuzzer::LevinFuzzer ( )
inline

Definition at line 285 of file levin.cpp.

285 {} //: handler(endpoint, config, context) {}

Member Function Documentation

◆ init()

int LevinFuzzer::init ( )
virtual

Reimplemented from Fuzzer.

Definition at line 294 of file levin.cpp.

295 {
296  return 0;
297 }

◆ run()

int LevinFuzzer::run ( const std::string &  filename)
virtual

Implements Fuzzer.

Definition at line 299 of file levin.cpp.

300 {
301  std::string s;
302 
303 #if 0
304  epee::levin::bucket_head2 req_head;
305  req_head.m_signature = LEVIN_SIGNATURE;
306  req_head.m_cb = 0;
307  req_head.m_have_to_return_data = true;
308  req_head.m_command = 2000;
309  req_head.m_flags = LEVIN_PACKET_REQUEST;
311  req_head.m_return_code = 0;
312  FILE *f=fopen("/tmp/out.levin", "w");
313  fwrite(&req_head,sizeof(req_head),1, f);
314  fclose(f);
315 #endif
317  {
318  std::cout << "Error: failed to load file " << filename << std::endl;
319  return 1;
320  }
321  try
322  {
323  //std::unique_ptr<test_connection> conn = new test();
324  boost::asio::io_service io_service;
325  test_levin_protocol_handler_config m_handler_config;
326  test_levin_commands_handler *m_pcommands_handler = new test_levin_commands_handler();
327  m_handler_config.set_handler(m_pcommands_handler, [](epee::levin::levin_commands_handler<test_levin_connection_context> *handler) { delete handler; });
328  std::unique_ptr<test_connection> conn(new test_connection(io_service, m_handler_config));
329  conn->start();
330  //m_commands_handler.invoke_out_buf(expected_out_data);
331  //m_commands_handler.return_code(expected_return_code);
332  conn->m_protocol_handler.handle_recv(s.data(), s.size());
333  }
334  catch (const std::exception &e)
335  {
336  std::cerr << "Failed to test http client: " << e.what() << std::endl;
337  return 1;
338  }
339  return 0;
340 }
epee::net_utils::connection< test_levin_protocol_handler > test_connection
#define LEVIN_SIGNATURE
Definition: levin_base.h:34
::std::string string
Definition: gtest-port.h:1097
#define LEVIN_PACKET_REQUEST
Definition: levin_base.h:73
bool load_file_to_string(const std::string &path_to_file, std::string &target_str, size_t max_size=1000000000)
epee::levin::async_protocol_handler_config< test_connection_context > test_levin_protocol_handler_config
#define LEVIN_PROTOCOL_VER_1
Definition: levin_base.h:78
Here is the call graph for this function:

The documentation for this class was generated from the following file: