Advertisement
zoltanb

Untitled

May 8th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. void* Dispatcher::Dispatch(void* raw) {
  2.   AuthenticationRequest request = ser_des_->Deserialize(raw);
  3.   RequestMethod method = request.GetRequestMethod();
  4.  
  5.   AuthenticationResponse response;
  6.   if (method == RequestMethod::AUTHENTICATE) {
  7.     printf("'authentication' dispatched!\n");
  8.     response = AuthenticationApi::GetInstance()->Authenticate(request);
  9.  
  10.   } else if (method == RequestMethod::INFO) {
  11.     printf("'info' dispatched!\n");
  12.     printf(AuthenticationApi::GetInstance()->Info().c_str());
  13.  
  14.   } else {
  15.     char* error_message;
  16.     sprintf(error_message, "mod_auth with invalid method called: %s", &method);
  17.  
  18.     throw std::invalid_argument(error_message);
  19.   }
  20.  
  21.   return ser_des_->Serialize(&response);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement