1 /* 2 * Copyright 2012 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Paweł Dziepak, pdziepak@quarnos.org 7 */ 8 #ifndef REQUEST_H 9 #define REQUEST_H 10 11 12 #include "ReplyInterpreter.h" 13 #include "RequestBuilder.h" 14 #include "RPCServer.h" 15 16 17 struct Cookie; 18 class FileSystem; 19 20 class Request { 21 public: 22 inline Request(RPC::Server* server, 23 FileSystem* fileSystem); 24 25 inline RequestBuilder& Builder(); 26 inline ReplyInterpreter& Reply(); 27 28 status_t Send(Cookie* cookie = NULL); 29 void Reset(); 30 31 private: 32 status_t _SendUDP(Cookie* cookie); 33 status_t _SendTCP(Cookie* cookie); 34 35 RPC::Server* fServer; 36 FileSystem* fFileSystem; 37 38 RequestBuilder fBuilder; 39 ReplyInterpreter fReply; 40 }; 41 42 43 inline 44 Request::Request(RPC::Server* server, FileSystem* fileSystem) 45 : 46 fServer(server), 47 fFileSystem(fileSystem) 48 { 49 ASSERT(server != NULL); 50 } 51 52 53 inline RequestBuilder& 54 Request::Builder() 55 { 56 return fBuilder; 57 } 58 59 60 inline ReplyInterpreter& 61 Request::Reply() 62 { 63 return fReply; 64 } 65 66 67 #endif // REQUEST_H 68 69