RpcIfServer.h
上传用户:nvosite88
上传日期:2007-01-17
资源大小:4983k
文件大小:2k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* RpcIfServer -- Rpc Interface Server (either DCE or ORPC) */
  2. /* Copyright (c) 1999 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01j,19jul01,dbs  fix include path of vxdcomGlobals.h
  7. 01i,19jan00,nel  Modifications for Linux debug build
  8. 01h,20sep99,aim  added ThreadName parameter
  9. 01g,13aug99,aim  changed min/max thread params
  10. 01f,12aug99,aim  ThreadPool API changes
  11. 01e,30jul99,aim  added thread pooling
  12. 01d,15jul99,aim  added serverAddress
  13. 01c,09jul99,dbs  use final filenames
  14. 01b,08jun99,aim  rework
  15. 01a,27may99,aim  created
  16. */
  17. #ifndef __INCRpcIfServer_h
  18. #define __INCRpcIfServer_h
  19. #include "ReactorTypes.h"
  20. #include "Acceptor.h"
  21. #include "SockAcceptor.h"
  22. #include "INETSockAddr.h"
  23. #include "RpcEventHandler.h"
  24. #include "Reactor.h"
  25. #include "RpcDispatcher.h"
  26. #include "RpcStringBinding.h"
  27. #include "ThreadPool.h"
  28. #include "private/vxdcomGlobals.h"
  29. #if (defined VXDCOM_PLATFORM_WIN32 || defined VXDCOM_PLATFORM_VXWORKS)
  30. typedef Acceptor <RpcEventHandler, SockAcceptor, INETSockAddr> RpcServer;
  31. #elif (defined VXDCOM_PLATFORM_SOLARIS || defined VXDCOM_PLATFORM_LINUX)
  32. typedef Acceptor <RpcEventHandler, SockAcceptor> RpcServer;
  33. #endif
  34. class RpcIfServer : public RpcServer
  35.     {
  36.   public:
  37.     typedef RpcServer super;
  38.     enum concurrency_t {
  39. SingleThreaded = 1,
  40. ThreadPerConnection,
  41. ThreadPooled
  42.     };
  43.         
  44.     RpcIfServer
  45. (
  46. Reactor* reactor,
  47. RpcDispatcher* dispatcher,
  48. concurrency_t = SingleThreaded
  49. );
  50.     virtual ~RpcIfServer ();
  51.     virtual int open
  52. (
  53. const INETSockAddr& addr,
  54. Reactor* reactor,
  55. int reuseAddr = 1,
  56. int minThreads = g_vxdcomMinThreads,
  57. int maxThreads = g_vxdcomMaxThreads
  58. );
  59.     virtual int close ();
  60.     concurrency_t concurrency () const;
  61.     ThreadPool* threadPool ();
  62.     const RpcStringBinding& addressBinding ();
  63.     int rpcAddressFormat
  64. (
  65. BSTR* result,
  66. bool includePortNumber = true
  67. );
  68.   protected:
  69.     RpcIfServer ();
  70.     // ensure RpcIfServer is an ABC.
  71.     virtual int newSvcHandler (RpcEventHandler*&);
  72.     // override Acceptor
  73.   private:
  74.     RpcDispatcher* m_dispatcher;
  75.     RpcStringBinding m_addressBinding;
  76.     concurrency_t m_concurrency;
  77.     ThreadPool m_threadPool;
  78.     // unsupported
  79.     RpcIfServer (const RpcIfServer& other);
  80.     RpcIfServer& operator= (const RpcIfServer& rhs);
  81.     };
  82. #endif // __INCRpcIfServer_h