xref: /haiku/src/add-ons/kernel/file_systems/userlandfs/private/SingleReplyRequestHandler.cpp (revision ed6250c95736c0b55da79d6e9dd01369532260c0)
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 request: %lu "
31 "expected was: %lu\n", request->GetType(), fExpectedReply));
32 #if USER
33 debugger("SingleReplyRequestHandler::HandleRequest(): unexpected request!");
34 #endif
35 		return B_BAD_DATA;
36 	}
37 	fDone = true;
38 	return B_OK;
39 }
40 
41