// $Id$ // ============================================================================ // // = LIBRARY // tests // // = FILENAME // Cache_Accept_Conn_Test.h // // = DESCRIPTION // Define class needed for generating templates. IBM C++ requires this to // be in its own file for auto template instantiation. // // = AUTHOR // Kirthika Parameswaran // // ============================================================================ #ifndef ACE_TESTS_CACHED_ACCEPT_CONN_TEST_H #define ACE_TESTS_CACHED_ACCEPT_CONN_TEST_H #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Stream.h" #include "ace/INET_Addr.h" #include "ace/Acceptor.h" #include "ace/Connector.h" #include "ace/Svc_Handler.h" #include "ace/Caching_Utility_T.h" #include "ace/Cached_Connect_Strategy_T.h" #include "ace/Handle_Gobbler.h" class Client_Svc_Handler : public ACE_Svc_Handler { public: Client_Svc_Handler (ACE_Thread_Manager *t = 0); int open (void *v = 0); int close (u_long flags = 0); }; class Server_Svc_Handler : public ACE_Svc_Handler { public: Server_Svc_Handler (ACE_Thread_Manager *t = 0); int open (void *v = 0); }; typedef size_t ATTRIBUTES; typedef ACE_Pair CACHED_HANDLER; typedef ACE_Refcounted_Hash_Recyclable ACE_ADDR; typedef ACE_Hash H_KEY; typedef ACE_Equal_To C_KEYS; typedef ACE_Hash_Map_Manager_Ex HASH_MAP; typedef ACE_Hash_Map_Iterator_Ex HASH_MAP_ITERATOR; typedef ACE_Hash_Map_Reverse_Iterator_Ex HASH_MAP_REVERSE_ITERATOR; typedef ACE_Recyclable_Handler_Cleanup_Strategy CLEANUP_STRATEGY; typedef ACE_Recyclable_Handler_Caching_Utility CACHING_UTILITY; typedef ACE_LRU_Caching_Strategy LRU_CACHING_STRATEGY; typedef ACE_LFU_Caching_Strategy LFU_CACHING_STRATEGY; typedef ACE_FIFO_Caching_Strategy FIFO_CACHING_STRATEGY; typedef ACE_Null_Caching_Strategy NULL_CACHING_STRATEGY; typedef ACE_Caching_Strategy_Adapter LRU_CACHING_STRATEGY_ADAPTER; typedef ACE_Caching_Strategy_Adapter LFU_CACHING_STRATEGY_ADAPTER; typedef ACE_Caching_Strategy_Adapter FIFO_CACHING_STRATEGY_ADAPTER; typedef ACE_Caching_Strategy_Adapter NULL_CACHING_STRATEGY_ADAPTER; typedef ACE_Caching_Strategy CACHING_STRATEGY; typedef ACE_Strategy_Acceptor ACCEPTOR; typedef ACE_Strategy_Connector STRATEGY_CONNECTOR; typedef ACE_NOOP_Creation_Strategy NULL_CREATION_STRATEGY; typedef ACE_NOOP_Concurrency_Strategy NULL_ACTIVATION_STRATEGY; typedef ACE_Cached_Connect_Strategy_Ex CACHED_CONNECT_STRATEGY; template class Accept_Strategy : public ACE_Accept_Strategy { public: Accept_Strategy (CACHED_CONNECT_STRATEGY &caching_connect_strategy); // Constructor. int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, bool restart = false); // Initialize the with . If the // process runs out of descriptors, the unsed svc_handlers from the // CONNECTION CACHE are removed. int accept_svc_handler (SVC_HANDLER *svc_handler); // The default behavior delegates to the method of the // PEER_ACCEPTOR. A check is made here for the process running out // of file descriptors. If so, the CONNECTION CACHE is purged of // some idle svc_handlers. protected: typedef ACE_Accept_Strategy ACCEPT_STRATEGY_BASE; int out_of_sockets_handler (void); // Handler for removing cached connections. CACHED_CONNECT_STRATEGY &caching_connect_strategy_; }; #endif /* ACE_TESTS_CACHED_ACCEPT_CONN_TEST_H */