xref: /haiku/src/add-ons/kernel/file_systems/userlandfs/private/SingleReplyRequestHandler.cpp (revision 9642f7705b27e5c270c15fa526d14e1848c2c27d)
1 // SingleReplyRequestHandler.cpp
2 
3 #include "SingleReplyRequestHandler.h"
4 
5 #include "Compatibility.h"
6 #include "Debug.h"
7 #include "Request.h"
8 
9 // constructor
10 SingleReplyRequestHandler::SingleReplyRequestHandler()
11 	: RequestHandler(),
12 	  fAcceptAnyRequest(true),
13 	  fExpectedReply(0)
14 {
15 }
16 
17 // constructor
18 SingleReplyRequestHandler::SingleReplyRequestHandler(uint32 expectedReply)
19 	: RequestHandler(),
20 	  fAcceptAnyRequest(false),
21 	  fExpectedReply(expectedReply)
22 {
23 }
24 
25 // HandleRequest
26 status_t
27 SingleReplyRequestHandler::HandleRequest(Request* request)
28 {
29 	if (!fAcceptAnyRequest && request->GetType() != fExpectedReply) {
30 		PRINT(("SingleReplyRequestHandler::HandleRequest(): unexpected "
31 			"request: %" B_PRIu32 " expected was: %" B_PRIu32 "\n",
32 			request->GetType(), fExpectedReply));
33 #if USER
34 		debugger("SingleReplyRequestHandler::HandleRequest(): unexpected "
35 			"request!");
36 #endif
37 		return B_BAD_DATA;
38 	}
39 	fDone = true;
40 	return B_OK;
41 }
42 
43