home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume26 / mnl-rpc++-2.3.1 / part01 / rpc++ / request.h next >
Encoding:
C/C++ Source or Header  |  1993-04-24  |  4.4 KB  |  135 lines

  1. // -*- c++ -*-
  2. /* 
  3. Copyright (C) 1991 Peter Bersen
  4.  
  5. This file is part of the rpc++ Library.  This library is free
  6. software; you can redistribute it and/or modify it under the terms of
  7. the GNU Library General Public License as published by the Free
  8. Software Foundation; either version 2 of the License, or (at your
  9. option) any later version.  This library is distributed in the hope
  10. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  11. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE.  See the GNU Library General Public License for more details.
  13. You should have received a copy of the GNU Library General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  16.  
  17. Modified and partially rewritten March 1992 by Michael N. Lipp,
  18. mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
  19. conditions apply without change to any modified or new parts.
  20. */
  21.  
  22. #ifndef _RPCREQUEST_H_
  23. #define _RPCREQUEST_H_
  24. static char _rpcpp_request_h_[]
  25. = "request.h,v 2.6 1993/01/20 15:00:49 mnl Exp";
  26.  
  27. // request.h,v
  28. // Revision 2.6  1993/01/20  15:00:49  mnl
  29. // Updated for gcc-2.3.3.
  30. //
  31. // Revision 2.5  1992/12/06  18:58:12  mnl
  32. // Fixed various bugs and added some Methods.
  33. //
  34. // Revision 2.4  1992/08/08  13:11:46  mnl
  35. // RpcRequest(const RpcRequest&) added, 'cause RpcRequest has pointers
  36. // to heap.
  37. //
  38. // Revision 2.3  1992/06/15  19:13:28  mnl
  39. // Fixed a few bugs, clarified interface.
  40. //
  41. // Revision 2.2  1992/06/13  14:27:39  mnl
  42. // Adapted to (patched) gcc-2.2. Fixed several bugs.
  43. //
  44. // Revision 2.1.1.1  1992/03/08  13:28:43  mnl
  45. // Initial mnl version.
  46. //
  47.  
  48. #ifdef __GNUG__
  49. #pragma interface
  50. #endif
  51.  
  52. #include "rpc++/xdr++.h"
  53. #include <rpc/rpc.h>
  54.  
  55. // RpcRequest is a class that specifies an individual request that is
  56. // part of a service. Three parameters are required to specify a request:
  57. //  - the request number
  58. //  - the serializer (XdrInfo) for the input to the request
  59. //  - the serializer (XdrInfo) for the output from the request
  60. class RpcRequest
  61. {
  62. private:
  63.   void init (u_long req, int pars, int parsz,
  64.          const XdrInfo* out, const XdrInfo** in, int rt);
  65.  
  66. public:
  67.   // Construct a new request from a request id, the information about
  68.   // the input data and the information about the output data.
  69.   // Note that requests that are registered for a service are stored
  70.   // in an array using the request id as the index, so keep indices
  71.   // small.
  72.   typedef enum { normal, batched, async } ReqType;
  73.   // No input arg:
  74.   RpcRequest (u_long req, const XdrInfo* out, int t = normal);
  75.   // One input arg:
  76.   RpcRequest (u_long req, const XdrInfo* out, const XdrInfo* in,
  77.           int t = normal);
  78.   // Two input args:
  79.   RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
  80.           int t = normal);
  81.   // ...
  82.   RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
  83.           const XdrInfo*, int t = normal);
  84.   RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
  85.           const XdrInfo*, const XdrInfo*, int t = normal);
  86.   RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
  87.           const XdrInfo*, const XdrInfo*, const XdrInfo*, int t = normal);
  88.   RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
  89.           const XdrInfo*, const XdrInfo*, const XdrInfo*, const XdrInfo*,
  90.           int t = normal);
  91.   RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
  92.           const XdrInfo*, const XdrInfo*, const XdrInfo*, const XdrInfo*,
  93.           const XdrInfo*, int t = normal);
  94.   // N input args, conversion routines given as a NULL terminated array
  95.   // of XdrInfo*:
  96.   RpcRequest (u_long req, const XdrInfo* out, const XdrInfo**, int t = normal);
  97.   // A copy
  98.   RpcRequest (const RpcRequest&);
  99.   ~RpcRequest ();
  100.   int RequestNumber () const;
  101.   const XdrInfo** InInfo ();
  102.   const XdrInfo* OutInfo ();
  103.   ReqType Type ();
  104.   int Params () const;
  105.   int ParamSize ();
  106.  
  107. protected:
  108.   int params;
  109.   int parmsz;
  110.   u_long reqnum;
  111.   const XdrInfo** ininfo;
  112.   const XdrInfo* outinfo;
  113.   ReqType reqtype;
  114. };
  115.  
  116. inline RpcRequest::~RpcRequest ()
  117. { delete [] ininfo; }
  118.  
  119. inline int RpcRequest::Params () const
  120. { return params; }
  121.  
  122. inline int RpcRequest::RequestNumber () const
  123. { return reqnum; }
  124.  
  125. inline const XdrInfo** RpcRequest::InInfo ()
  126. { return ininfo; }
  127.  
  128. inline const XdrInfo* RpcRequest::OutInfo ()
  129. { return outinfo; }
  130.  
  131. inline RpcRequest::ReqType RpcRequest::Type ()
  132. { return reqtype; }
  133.  
  134. #endif
  135.