From 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae Mon Sep 17 00:00:00 2001 From: "William R. Otte" Date: Mon, 24 Jul 2006 15:50:11 +0000 Subject: Repo restructuring --- ace/.cvsignore | 2 - ace/ACE.cpp | 3497 ------------------- ace/ACE.h | 842 ----- ace/ACE.inl | 336 -- ace/ACE.pc.in | 10 - ace/ACE_FlReactor.pc.in | 11 - ace/ACE_FlReactor_export.h | 58 - ace/ACE_QtReactor.pc.in | 11 - ace/ACE_QtReactor_export.h | 58 - ace/ACE_TkReactor.pc.in | 11 - ace/ACE_TkReactor_export.h | 58 - ace/ACE_XtReactor.pc.in | 11 - ace/ACE_XtReactor_export.h | 58 - ace/ACE_crc32.cpp | 161 - ace/ACE_crc_ccitt.cpp | 128 - ace/ACE_export.h | 74 - ace/ARGV.cpp | 303 -- ace/ARGV.h | 245 -- ace/ARGV.inl | 69 - ace/ATM_Acceptor.cpp | 309 -- ace/ATM_Acceptor.h | 123 - ace/ATM_Acceptor.inl | 42 - ace/ATM_Addr.cpp | 522 --- ace/ATM_Addr.h | 197 -- ace/ATM_Addr.inl | 37 - ace/ATM_Connector.cpp | 138 - ace/ATM_Connector.h | 169 - ace/ATM_Connector.inl | 132 - ace/ATM_Params.cpp | 20 - ace/ATM_Params.h | 214 -- ace/ATM_Params.inl | 235 -- ace/ATM_QoS.cpp | 631 ---- ace/ATM_QoS.h | 115 - ace/ATM_QoS.inl | 29 - ace/ATM_Stream.cpp | 290 -- ace/ATM_Stream.h | 107 - ace/ATM_Stream.inl | 133 - ace/Acceptor.cpp | 1228 ------- ace/Acceptor.h | 683 ---- ace/Activation_Queue.cpp | 135 - ace/Activation_Queue.h | 174 - ace/Activation_Queue.inl | 31 - ace/Active_Map_Manager.cpp | 9 - ace/Active_Map_Manager.h | 116 - ace/Active_Map_Manager.inl | 95 - ace/Active_Map_Manager_T.cpp | 22 - ace/Active_Map_Manager_T.h | 211 -- ace/Active_Map_Manager_T.inl | 311 -- ace/Addr.cpp | 72 - ace/Addr.h | 104 - ace/Addr.inl | 61 - ace/Arg_Shifter.cpp | 230 -- ace/Arg_Shifter.h | 221 -- ace/Argv_Type_Converter.cpp | 204 -- ace/Argv_Type_Converter.h | 119 - ace/Argv_Type_Converter.inl | 44 - ace/Array.h | 29 - ace/Array_Base.cpp | 206 -- ace/Array_Base.h | 211 -- ace/Array_Base.inl | 91 - ace/Array_Map.cpp | 282 -- ace/Array_Map.h | 325 -- ace/Array_Map.inl | 133 - ace/Assert.cpp | 24 - ace/Assert.h | 38 - ace/Asynch_Acceptor.cpp | 527 --- ace/Asynch_Acceptor.h | 296 -- ace/Asynch_Connector.cpp | 296 -- ace/Asynch_Connector.h | 172 - ace/Asynch_IO.cpp | 1335 ------- ace/Asynch_IO.h | 1678 --------- ace/Asynch_IO_Impl.cpp | 117 - ace/Asynch_IO_Impl.h | 816 ----- ace/Asynch_IO_Impl.inl | 106 - ace/Asynch_Pseudo_Task.cpp | 132 - ace/Asynch_Pseudo_Task.h | 72 - ace/Atomic_Op.cpp | 280 -- ace/Atomic_Op.h | 257 -- ace/Atomic_Op.inl | 301 -- ace/Atomic_Op_Sparc.c | 113 - ace/Atomic_Op_Sparc.h | 14 - ace/Atomic_Op_T.cpp | 77 - ace/Atomic_Op_T.h | 254 -- ace/Atomic_Op_T.inl | 283 -- ace/Auto_Event.cpp | 49 - ace/Auto_Event.h | 73 - ace/Auto_Event.inl | 12 - ace/Auto_Functor.cpp | 42 - ace/Auto_Functor.h | 145 - ace/Auto_Functor.inl | 149 - ace/Auto_IncDec_T.cpp | 34 - ace/Auto_IncDec_T.h | 91 - ace/Auto_IncDec_T.inl | 25 - ace/Auto_Ptr.cpp | 21 - ace/Auto_Ptr.h | 217 -- ace/Auto_Ptr.inl | 171 - ace/Barrier.cpp | 197 -- ace/Barrier.h | 214 -- ace/Barrier.inl | 22 - ace/Base_Thread_Adapter.cpp | 120 - ace/Base_Thread_Adapter.h | 186 - ace/Base_Thread_Adapter.inl | 48 - ace/Based_Pointer_Repository.cpp | 121 - ace/Based_Pointer_Repository.h | 91 - ace/Based_Pointer_T.cpp | 121 - ace/Based_Pointer_T.h | 205 -- ace/Based_Pointer_T.inl | 139 - ace/Basic_Stats.cpp | 76 - ace/Basic_Stats.h | 87 - ace/Basic_Stats.inl | 53 - ace/Basic_Types.cpp | 139 - ace/Basic_Types.h | 796 ----- ace/Basic_Types.inl | 954 ----- ace/Bound_Ptr.h | 344 -- ace/Bound_Ptr.inl | 488 --- ace/CDR_Base.cpp | 639 ---- ace/CDR_Base.h | 302 -- ace/CDR_Base.inl | 210 -- ace/CDR_Size.cpp | 250 -- ace/CDR_Size.h | 241 -- ace/CDR_Size.inl | 420 --- ace/CDR_Stream.cpp | 1740 ---------- ace/CDR_Stream.h | 1309 ------- ace/CDR_Stream.inl | 1752 ---------- ace/CE_Screen_Output.cpp | 158 - ace/CE_Screen_Output.h | 109 - ace/CORBA_macros.h | 552 --- ace/Cache_Map_Manager_T.cpp | 420 --- ace/Cache_Map_Manager_T.h | 405 --- ace/Cache_Map_Manager_T.inl | 245 -- ace/Cached_Connect_Strategy_T.cpp | 734 ---- ace/Cached_Connect_Strategy_T.h | 262 -- ace/Caching_Strategies_T.cpp | 59 - ace/Caching_Strategies_T.h | 552 --- ace/Caching_Strategies_T.inl | 465 --- ace/Caching_Utility_T.cpp | 499 --- ace/Caching_Utility_T.h | 347 -- ace/Capabilities.cpp | 355 -- ace/Capabilities.h | 216 -- ace/Capabilities.inl | 52 - ace/Cleanup.cpp | 192 - ace/Cleanup.h | 137 - ace/Cleanup.inl | 12 - ace/Cleanup_Strategies_T.cpp | 95 - ace/Cleanup_Strategies_T.h | 155 - ace/Codecs.cpp | 227 -- ace/Codecs.h | 119 - ace/Codeset_IBM1047.cpp | 317 -- ace/Codeset_IBM1047.h | 128 - ace/Codeset_Registry.cpp | 113 - ace/Codeset_Registry.h | 104 - ace/Codeset_Registry.inl | 102 - ace/Codeset_Registry_db.cpp | 28 - ace/Codeset_Symbols.h | 220 -- ace/Condition_Recursive_Thread_Mutex.cpp | 129 - ace/Condition_Recursive_Thread_Mutex.h | 118 - ace/Condition_T.cpp | 123 - ace/Condition_T.h | 167 - ace/Condition_T.inl | 51 - ace/Condition_Thread_Mutex.cpp | 126 - ace/Condition_Thread_Mutex.h | 190 - ace/Condition_Thread_Mutex.inl | 74 - ace/Configuration.cpp | 2185 ------------ ace/Configuration.h | 892 ----- ace/Configuration_Import_Export.cpp | 650 ---- ace/Configuration_Import_Export.h | 215 -- ace/Connection_Recycling_Strategy.cpp | 13 - ace/Connection_Recycling_Strategy.h | 63 - ace/Connector.cpp | 964 ------ ace/Connector.h | 573 --- ace/Containers.cpp | 12 - ace/Containers.h | 71 - ace/Containers.inl | 25 - ace/Containers_T.cpp | 1937 ----------- ace/Containers_T.h | 2026 ----------- ace/Containers_T.inl | 479 --- ace/Copy_Disabled.cpp | 23 - ace/Copy_Disabled.h | 65 - ace/Countdown_Time.cpp | 66 - ace/Countdown_Time.h | 80 - ace/DEV.cpp | 43 - ace/DEV.h | 78 - ace/DEV.inl | 18 - ace/DEV_Addr.cpp | 108 - ace/DEV_Addr.h | 90 - ace/DEV_Addr.inl | 51 - ace/DEV_Connector.cpp | 53 - ace/DEV_Connector.h | 110 - ace/DEV_Connector.inl | 34 - ace/DEV_IO.cpp | 131 - ace/DEV_IO.h | 185 - ace/DEV_IO.inl | 126 - ace/DLL.cpp | 271 -- ace/DLL.h | 196 -- ace/DLL_Manager.cpp | 756 ---- ace/DLL_Manager.h | 271 -- ace/Date_Time.cpp | 10 - ace/Date_Time.h | 125 - ace/Date_Time.inl | 219 -- ace/Default_Constants.h | 576 --- ace/Dev_Poll_Reactor.cpp | 2652 -------------- ace/Dev_Poll_Reactor.h | 1281 ------- ace/Dev_Poll_Reactor.inl | 228 -- ace/Dirent.cpp | 7 - ace/Dirent.h | 122 - ace/Dirent.inl | 99 - ace/Dirent_Selector.cpp | 59 - ace/Dirent_Selector.h | 75 - ace/Dirent_Selector.inl | 19 - ace/Dump.cpp | 141 - ace/Dump.h | 172 - ace/Dump_T.cpp | 48 - ace/Dump_T.h | 82 - ace/Dynamic.cpp | 34 - ace/Dynamic.h | 75 - ace/Dynamic.inl | 34 - ace/Dynamic_Service.cpp | 63 - ace/Dynamic_Service.h | 89 - ace/Dynamic_Service.inl | 40 - ace/Dynamic_Service_Base.cpp | 121 - ace/Dynamic_Service_Base.h | 79 - ace/Dynamic_Service_Dependency.cpp | 51 - ace/Dynamic_Service_Dependency.h | 70 - ace/Encoding_Converter.cpp | 12 - ace/Encoding_Converter.h | 70 - ace/Encoding_Converter_Factory.cpp | 74 - ace/Encoding_Converter_Factory.h | 54 - ace/Env_Value_T.cpp | 12 - ace/Env_Value_T.h | 166 - ace/Env_Value_T.inl | 60 - ace/Event.cpp | 91 - ace/Event.h | 142 - ace/Event.inl | 18 - ace/Event_Handler.cpp | 409 --- ace/Event_Handler.h | 390 --- ace/Event_Handler.inl | 12 - ace/Event_Handler_T.cpp | 125 - ace/Event_Handler_T.h | 191 - ace/Event_Handler_T.inl | 135 - ace/Exception_Macros.h | 55 - ace/FIFO.cpp | 78 - ace/FIFO.h | 85 - ace/FIFO.inl | 25 - ace/FIFO_Recv.cpp | 88 - ace/FIFO_Recv.h | 85 - ace/FIFO_Recv.inl | 24 - ace/FIFO_Recv_Msg.cpp | 67 - ace/FIFO_Recv_Msg.h | 138 - ace/FIFO_Recv_Msg.inl | 111 - ace/FIFO_Send.cpp | 58 - ace/FIFO_Send.h | 75 - ace/FIFO_Send.inl | 24 - ace/FIFO_Send_Msg.cpp | 80 - ace/FIFO_Send_Msg.h | 91 - ace/FIFO_Send_Msg.inl | 53 - ace/FILE.cpp | 151 - ace/FILE.h | 139 - ace/FILE.inl | 18 - ace/FILE_Addr.cpp | 128 - ace/FILE_Addr.h | 90 - ace/FILE_Addr.inl | 34 - ace/FILE_Connector.cpp | 85 - ace/FILE_Connector.h | 115 - ace/FILE_Connector.inl | 36 - ace/FILE_IO.cpp | 142 - ace/FILE_IO.h | 170 - ace/FILE_IO.inl | 152 - ace/File_Lock.cpp | 72 - ace/File_Lock.h | 170 - ace/File_Lock.inl | 94 - ace/Filecache.cpp | 751 ---- ace/Filecache.h | 353 -- ace/FlReactor.cpp | 330 -- ace/FlReactor.h | 110 - ace/Flag_Manip.cpp | 95 - ace/Flag_Manip.h | 58 - ace/Flag_Manip.inl | 26 - ace/Framework_Component.cpp | 280 -- ace/Framework_Component.h | 210 -- ace/Framework_Component.inl | 39 - ace/Framework_Component_T.cpp | 33 - ace/Framework_Component_T.h | 71 - ace/Free_List.cpp | 157 - ace/Free_List.h | 150 - ace/Functor.cpp | 46 - ace/Functor.h | 593 ---- ace/Functor.inl | 289 -- ace/Functor_String.cpp | 7 - ace/Functor_String.h | 141 - ace/Functor_String.inl | 56 - ace/Functor_T.cpp | 49 - ace/Functor_T.h | 158 - ace/Functor_T.inl | 42 - ace/Future.cpp | 434 --- ace/Future.h | 390 --- ace/Future_Set.cpp | 136 - ace/Future_Set.h | 146 - ace/Get_Opt.cpp | 738 ---- ace/Get_Opt.h | 474 --- ace/Get_Opt.inl | 43 - ace/Global_Macros.h | 1141 ------ ace/Guard_T.cpp | 61 - ace/Guard_T.h | 365 -- ace/Guard_T.inl | 171 - ace/Handle_Gobbler.h | 69 - ace/Handle_Gobbler.inl | 97 - ace/Handle_Ops.cpp | 50 - ace/Handle_Ops.h | 50 - ace/Handle_Set.cpp | 578 ---- ace/Handle_Set.h | 247 -- ace/Handle_Set.inl | 190 - ace/Hash_Cache_Map_Manager_T.cpp | 232 -- ace/Hash_Cache_Map_Manager_T.h | 214 -- ace/Hash_Cache_Map_Manager_T.inl | 73 - ace/Hash_Map_Manager.h | 31 - ace/Hash_Map_Manager_T.cpp | 535 --- ace/Hash_Map_Manager_T.h | 1038 ------ ace/Hash_Map_Manager_T.inl | 1034 ------ ace/Hash_Map_With_Allocator_T.cpp | 35 - ace/Hash_Map_With_Allocator_T.h | 112 - ace/Hash_Map_With_Allocator_T.inl | 82 - ace/Hashable.cpp | 36 - ace/Hashable.h | 65 - ace/Hashable.inl | 14 - ace/High_Res_Timer.cpp | 546 --- ace/High_Res_Timer.h | 322 -- ace/High_Res_Timer.inl | 177 - ace/ICMP_Socket.cpp | 186 - ace/ICMP_Socket.h | 110 - ace/INET_Addr.cpp | 1089 ------ ace/INET_Addr.h | 373 -- ace/INET_Addr.inl | 220 -- ace/IOStream.cpp | 665 ---- ace/IOStream.h | 512 --- ace/IOStream_T.cpp | 247 -- ace/IOStream_T.h | 297 -- ace/IOStream_T.inl | 121 - ace/IO_Cntl_Msg.cpp | 51 - ace/IO_Cntl_Msg.h | 112 - ace/IO_Cntl_Msg.inl | 61 - ace/IO_SAP.cpp | 142 - ace/IO_SAP.h | 96 - ace/IO_SAP.inl | 42 - ace/IPC_SAP.cpp | 193 -- ace/IPC_SAP.h | 96 - ace/IPC_SAP.inl | 40 - ace/If_Then_Else.h | 89 - ace/Init_ACE.cpp | 45 - ace/Init_ACE.h | 62 - ace/Intrusive_List.cpp | 153 - ace/Intrusive_List.h | 141 - ace/Intrusive_List.inl | 31 - ace/Intrusive_List_Node.cpp | 27 - ace/Intrusive_List_Node.h | 85 - ace/Intrusive_List_Node.inl | 31 - ace/LOCK_SOCK_Acceptor.cpp | 35 - ace/LOCK_SOCK_Acceptor.h | 67 - ace/LSOCK.cpp | 181 - ace/LSOCK.h | 84 - ace/LSOCK.inl | 43 - ace/LSOCK_Acceptor.cpp | 143 - ace/LSOCK_Acceptor.h | 95 - ace/LSOCK_CODgram.cpp | 62 - ace/LSOCK_CODgram.h | 78 - ace/LSOCK_CODgram.inl | 30 - ace/LSOCK_Connector.cpp | 59 - ace/LSOCK_Connector.h | 91 - ace/LSOCK_Connector.inl | 27 - ace/LSOCK_Dgram.cpp | 71 - ace/LSOCK_Dgram.h | 74 - ace/LSOCK_Dgram.inl | 22 - ace/LSOCK_Stream.cpp | 137 - ace/LSOCK_Stream.h | 82 - ace/LSOCK_Stream.inl | 25 - ace/Lib_Find.cpp | 773 ----- ace/Lib_Find.h | 131 - ace/Local_Memory_Pool.cpp | 144 - ace/Local_Memory_Pool.h | 133 - ace/Local_Name_Space.cpp | 168 - ace/Local_Name_Space.h | 132 - ace/Local_Name_Space_T.cpp | 966 ------ ace/Local_Name_Space_T.h | 280 -- ace/Local_Tokens.cpp | 1616 --------- ace/Local_Tokens.h | 1121 ------ ace/Local_Tokens.inl | 289 -- ace/Lock.cpp | 88 - ace/Lock.h | 161 - ace/Lock.inl | 12 - ace/Lock_Adapter_T.cpp | 117 - ace/Lock_Adapter_T.h | 123 - ace/Lock_Adapter_T.inl | 16 - ace/Log_Msg.cpp | 2648 -------------- ace/Log_Msg.h | 725 ---- ace/Log_Msg_Backend.cpp | 14 - ace/Log_Msg_Backend.h | 68 - ace/Log_Msg_Callback.cpp | 13 - ace/Log_Msg_Callback.h | 69 - ace/Log_Msg_IPC.cpp | 102 - ace/Log_Msg_IPC.h | 71 - ace/Log_Msg_NT_Event_Log.cpp | 160 - ace/Log_Msg_NT_Event_Log.h | 72 - ace/Log_Msg_UNIX_Syslog.cpp | 207 -- ace/Log_Msg_UNIX_Syslog.h | 76 - ace/Log_Priority.h | 85 - ace/Log_Record.cpp | 372 -- ace/Log_Record.h | 212 -- ace/Log_Record.inl | 123 - ace/Logging_Strategy.cpp | 557 --- ace/Logging_Strategy.h | 190 - ace/MEM_Acceptor.cpp | 266 -- ace/MEM_Acceptor.h | 192 - ace/MEM_Acceptor.inl | 103 - ace/MEM_Addr.cpp | 170 - ace/MEM_Addr.h | 156 - ace/MEM_Addr.inl | 111 - ace/MEM_Connector.cpp | 149 - ace/MEM_Connector.h | 179 - ace/MEM_Connector.inl | 30 - ace/MEM_IO.cpp | 541 --- ace/MEM_IO.h | 310 -- ace/MEM_IO.inl | 233 -- ace/MEM_SAP.cpp | 97 - ace/MEM_SAP.h | 169 - ace/MEM_SAP.inl | 64 - ace/MEM_Stream.cpp | 47 - ace/MEM_Stream.h | 158 - ace/MEM_Stream.inl | 180 - ace/MMAP_Memory_Pool.cpp | 540 --- ace/MMAP_Memory_Pool.h | 313 -- ace/MMAP_Memory_Pool.inl | 21 - ace/Makefile.am | 1408 -------- ace/Malloc.cpp | 188 - ace/Malloc.h | 396 --- ace/Malloc.inl | 26 - ace/Malloc_Allocator.cpp | 361 -- ace/Malloc_Allocator.h | 146 - ace/Malloc_Allocator.inl | 16 - ace/Malloc_Base.h | 168 - ace/Malloc_T.cpp | 1262 ------- ace/Malloc_T.h | 909 ----- ace/Malloc_T.inl | 184 - ace/Managed_Object.cpp | 25 - ace/Managed_Object.h | 168 - ace/Managed_Object.inl | 23 - ace/Manual_Event.cpp | 48 - ace/Manual_Event.h | 74 - ace/Manual_Event.inl | 12 - ace/Map.h | 32 - ace/Map_Manager.cpp | 701 ---- ace/Map_Manager.h | 718 ---- ace/Map_Manager.inl | 721 ---- ace/Map_T.cpp | 1343 ------- ace/Map_T.h | 1611 --------- ace/Map_T.inl | 415 --- ace/Mem_Map.cpp | 372 -- ace/Mem_Map.h | 229 -- ace/Mem_Map.inl | 261 -- ace/Memory_Pool.h | 31 - ace/Message_Block.cpp | 1373 -------- ace/Message_Block.h | 1051 ------ ace/Message_Block.inl | 626 ---- ace/Message_Block_T.cpp | 54 - ace/Message_Block_T.h | 88 - ace/Message_Block_T.inl | 31 - ace/Message_Queue.cpp | 602 ---- ace/Message_Queue.h | 629 ---- ace/Message_Queue.inl | 148 - ace/Message_Queue_T.cpp | 2813 --------------- ace/Message_Queue_T.h | 1411 -------- ace/Method_Object.h | 38 - ace/Method_Request.cpp | 30 - ace/Method_Request.h | 100 - ace/Metrics_Cache.h | 140 - ace/Metrics_Cache_T.cpp | 238 -- ace/Metrics_Cache_T.h | 243 -- ace/Metrics_Cache_T.inl | 240 -- ace/Min_Max.h | 81 - ace/Module.cpp | 273 -- ace/Module.h | 212 -- ace/Module.inl | 65 - ace/Msg_WFMO_Reactor.cpp | 94 - ace/Msg_WFMO_Reactor.h | 120 - ace/Msg_WFMO_Reactor.inl | 35 - ace/Multihomed_INET_Addr.cpp | 300 -- ace/Multihomed_INET_Addr.h | 198 -- ace/Multihomed_INET_Addr.inl | 15 - ace/Multiplexor.cpp | 14 - ace/Multiplexor.h | 86 - ace/Multiplexor.inl | 95 - ace/Mutex.cpp | 125 - ace/Mutex.h | 190 - ace/Mutex.inl | 175 - ace/NT_Service.cpp | 618 ---- ace/NT_Service.h | 439 --- ace/NT_Service.inl | 85 - ace/Name_Proxy.cpp | 209 -- ace/Name_Proxy.h | 101 - ace/Name_Request_Reply.cpp | 568 --- ace/Name_Request_Reply.h | 265 -- ace/Name_Space.cpp | 73 - ace/Name_Space.h | 165 - ace/Naming_Context.cpp | 685 ---- ace/Naming_Context.h | 383 -- ace/Netlink_Addr.cpp | 68 - ace/Netlink_Addr.h | 120 - ace/Netlink_Addr.inl | 51 - ace/Node.cpp | 48 - ace/Node.h | 87 - ace/Notification_Strategy.cpp | 22 - ace/Notification_Strategy.h | 77 - ace/Notification_Strategy.inl | 31 - ace/Null_Barrier.h | 59 - ace/Null_Condition.h | 85 - ace/Null_Mutex.h | 226 -- ace/Null_Semaphore.h | 104 - ace/Numeric_Limits.h | 204 -- ace/OS.cpp | 53 - ace/OS.h | 329 -- ace/OS.inl | 89 - ace/OS_Dirent.h | 32 - ace/OS_Errno.cpp | 46 - ace/OS_Errno.h | 100 - ace/OS_Errno.inl | 67 - ace/OS_Log_Msg_Attributes.cpp | 9 - ace/OS_Log_Msg_Attributes.h | 90 - ace/OS_Log_Msg_Attributes.inl | 12 - ace/OS_Memory.h | 267 -- ace/OS_NS_Thread.cpp | 5578 ------------------------------ ace/OS_NS_Thread.h | 2033 ----------- ace/OS_NS_Thread.inl | 3794 -------------------- ace/OS_NS_arpa_inet.cpp | 53 - ace/OS_NS_arpa_inet.h | 74 - ace/OS_NS_arpa_inet.inl | 89 - ace/OS_NS_ctype.cpp | 11 - ace/OS_NS_ctype.h | 130 - ace/OS_NS_ctype.inl | 150 - ace/OS_NS_dirent.cpp | 285 -- ace/OS_NS_dirent.h | 128 - ace/OS_NS_dirent.inl | 185 - ace/OS_NS_dlfcn.cpp | 10 - ace/OS_NS_dlfcn.h | 69 - ace/OS_NS_dlfcn.inl | 284 -- ace/OS_NS_errno.cpp | 11 - ace/OS_NS_errno.h | 100 - ace/OS_NS_errno.inl | 101 - ace/OS_NS_fcntl.cpp | 231 -- ace/OS_NS_fcntl.h | 83 - ace/OS_NS_fcntl.inl | 23 - ace/OS_NS_macros.h | 74 - ace/OS_NS_math.cpp | 10 - ace/OS_NS_math.h | 61 - ace/OS_NS_math.inl | 35 - ace/OS_NS_netdb.cpp | 415 --- ace/OS_NS_netdb.h | 146 - ace/OS_NS_netdb.inl | 532 --- ace/OS_NS_poll.cpp | 10 - ace/OS_NS_poll.h | 66 - ace/OS_NS_poll.inl | 45 - ace/OS_NS_pwd.cpp | 10 - ace/OS_NS_pwd.h | 81 - ace/OS_NS_pwd.inl | 121 - ace/OS_NS_regex.cpp | 10 - ace/OS_NS_regex.h | 65 - ace/OS_NS_regex.inl | 39 - ace/OS_NS_signal.cpp | 26 - ace/OS_NS_signal.h | 153 - ace/OS_NS_signal.inl | 232 -- ace/OS_NS_stdio.cpp | 410 --- ace/OS_NS_stdio.h | 423 --- ace/OS_NS_stdio.inl | 1093 ------ ace/OS_NS_stdlib.cpp | 691 ---- ace/OS_NS_stdlib.h | 291 -- ace/OS_NS_stdlib.inl | 513 --- ace/OS_NS_string.cpp | 412 --- ace/OS_NS_string.h | 485 --- ace/OS_NS_string.inl | 563 --- ace/OS_NS_strings.cpp | 84 - ace/OS_NS_strings.h | 86 - ace/OS_NS_strings.inl | 59 - ace/OS_NS_stropts.cpp | 195 -- ace/OS_NS_stropts.h | 172 - ace/OS_NS_stropts.inl | 201 -- ace/OS_NS_sys_mman.cpp | 10 - ace/OS_NS_sys_mman.h | 97 - ace/OS_NS_sys_mman.inl | 332 -- ace/OS_NS_sys_msg.cpp | 10 - ace/OS_NS_sys_msg.h | 77 - ace/OS_NS_sys_msg.inl | 78 - ace/OS_NS_sys_resource.cpp | 10 - ace/OS_NS_sys_resource.h | 67 - ace/OS_NS_sys_resource.inl | 96 - ace/OS_NS_sys_select.cpp | 10 - ace/OS_NS_sys_select.h | 77 - ace/OS_NS_sys_select.inl | 82 - ace/OS_NS_sys_sendfile.cpp | 53 - ace/OS_NS_sys_sendfile.h | 65 - ace/OS_NS_sys_sendfile.inl | 24 - ace/OS_NS_sys_shm.cpp | 10 - ace/OS_NS_sys_shm.h | 74 - ace/OS_NS_sys_shm.inl | 76 - ace/OS_NS_sys_socket.cpp | 161 - ace/OS_NS_sys_socket.h | 302 -- ace/OS_NS_sys_socket.inl | 887 ----- ace/OS_NS_sys_stat.cpp | 10 - ace/OS_NS_sys_stat.h | 122 - ace/OS_NS_sys_stat.inl | 311 -- ace/OS_NS_sys_time.cpp | 10 - ace/OS_NS_sys_time.h | 69 - ace/OS_NS_sys_time.inl | 96 - ace/OS_NS_sys_uio.cpp | 130 - ace/OS_NS_sys_uio.h | 80 - ace/OS_NS_sys_uio.inl | 55 - ace/OS_NS_sys_utsname.cpp | 239 -- ace/OS_NS_sys_utsname.h | 71 - ace/OS_NS_sys_wait.cpp | 9 - ace/OS_NS_sys_wait.h | 87 - ace/OS_NS_sys_wait.inl | 109 - ace/OS_NS_time.cpp | 632 ---- ace/OS_NS_time.h | 300 -- ace/OS_NS_time.inl | 478 --- ace/OS_NS_unistd.cpp | 776 ----- ace/OS_NS_unistd.h | 373 -- ace/OS_NS_unistd.inl | 1144 ------ ace/OS_NS_wchar.cpp | 377 -- ace/OS_NS_wchar.h | 199 -- ace/OS_NS_wchar.inl | 87 - ace/OS_QoS.cpp | 476 --- ace/OS_QoS.h | 392 --- ace/OS_String.h | 32 - ace/OS_TLI.cpp | 9 - ace/OS_TLI.h | 293 -- ace/OS_TLI.inl | 390 --- ace/OS_Thread_Adapter.cpp | 153 - ace/OS_Thread_Adapter.h | 72 - ace/OS_main.cpp | 114 - ace/OS_main.h | 239 -- ace/Obchunk.cpp | 36 - ace/Obchunk.h | 77 - ace/Obchunk.inl | 12 - ace/Object_Manager.cpp | 853 ----- ace/Object_Manager.h | 460 --- ace/Object_Manager.inl | 40 - ace/Object_Manager_Base.cpp | 506 --- ace/Object_Manager_Base.h | 248 -- ace/Obstack.h | 31 - ace/Obstack_T.cpp | 208 -- ace/Obstack_T.h | 134 - ace/Obstack_T.inl | 37 - ace/PI_Malloc.cpp | 166 - ace/PI_Malloc.h | 213 -- ace/PI_Malloc.inl | 33 - ace/POSIX_Asynch_IO.cpp | 2416 ------------- ace/POSIX_Asynch_IO.h | 1303 ------- ace/POSIX_CB_Proactor.cpp | 184 - ace/POSIX_CB_Proactor.h | 100 - ace/POSIX_Proactor.cpp | 2063 ----------- ace/POSIX_Proactor.h | 660 ---- ace/POSIX_Proactor.inl | 13 - ace/Pagefile_Memory_Pool.cpp | 385 --- ace/Pagefile_Memory_Pool.h | 201 -- ace/Pagefile_Memory_Pool.inl | 54 - ace/Pair.h | 32 - ace/Pair_T.cpp | 16 - ace/Pair_T.h | 129 - ace/Pair_T.inl | 90 - ace/Parse_Node.cpp | 832 ----- ace/Parse_Node.h | 523 --- ace/Ping_Socket.cpp | 377 -- ace/Ping_Socket.h | 119 - ace/Ping_Socket.inl | 13 - ace/Pipe.cpp | 344 -- ace/Pipe.h | 165 - ace/Pipe.inl | 188 - ace/Priority_Reactor.cpp | 182 - ace/Priority_Reactor.h | 99 - ace/Proactor.cpp | 1177 ------- ace/Proactor.h | 691 ---- ace/Proactor.inl | 80 - ace/Proactor_Impl.cpp | 21 - ace/Proactor_Impl.h | 265 -- ace/Process.cpp | 1201 ------- ace/Process.h | 610 ---- ace/Process.inl | 412 --- ace/Process_Manager.cpp | 1032 ------ ace/Process_Manager.h | 449 --- ace/Process_Manager.inl | 13 - ace/Process_Mutex.cpp | 90 - ace/Process_Mutex.h | 216 -- ace/Process_Mutex.inl | 118 - ace/Process_Semaphore.cpp | 116 - ace/Process_Semaphore.h | 168 - ace/Process_Semaphore.inl | 66 - ace/Profile_Timer.cpp | 438 --- ace/Profile_Timer.h | 139 - ace/Profile_Timer.inl | 129 - ace/QoS/ACE_QoS.pc.in | 11 - ace/QoS/ACE_QoS_Export.h | 46 - ace/QoS/Makefile.am | 74 - ace/QoS/QoS_Decorator.cpp | 165 - ace/QoS/QoS_Decorator.h | 179 - ace/QoS/QoS_Manager.cpp | 41 - ace/QoS/QoS_Manager.h | 74 - ace/QoS/QoS_Session.h | 183 - ace/QoS/QoS_Session_Factory.cpp | 105 - ace/QoS/QoS_Session_Factory.h | 96 - ace/QoS/QoS_Session_Impl.cpp | 724 ---- ace/QoS/QoS_Session_Impl.h | 265 -- ace/QoS/QoS_Session_Impl.i | 229 -- ace/QoS/README | 55 - ace/QoS/SOCK_Dgram_Mcast_QoS.cpp | 258 -- ace/QoS/SOCK_Dgram_Mcast_QoS.h | 142 - ace/QoS/SOCK_Dgram_Mcast_QoS.i | 57 - ace/QoS/qos.mpc | 16 - ace/QtReactor.cpp | 629 ---- ace/QtReactor.h | 222 -- ace/RB_Tree.cpp | 1201 ------- ace/RB_Tree.h | 904 ----- ace/RB_Tree.inl | 1169 ------- ace/README | 1849 ---------- ace/RW_Mutex.cpp | 55 - ace/RW_Mutex.h | 141 - ace/RW_Mutex.inl | 83 - ace/RW_Process_Mutex.cpp | 54 - ace/RW_Process_Mutex.h | 133 - ace/RW_Process_Mutex.inl | 77 - ace/RW_Thread_Mutex.cpp | 45 - ace/RW_Thread_Mutex.h | 74 - ace/RW_Thread_Mutex.inl | 19 - ace/Reactor.cpp | 946 ----- ace/Reactor.h | 870 ----- ace/Reactor.inl | 101 - ace/Reactor_Impl.cpp | 15 - ace/Reactor_Impl.h | 569 --- ace/Reactor_Notification_Strategy.cpp | 38 - ace/Reactor_Notification_Strategy.h | 67 - ace/Reactor_Notification_Strategy.inl | 19 - ace/Reactor_Timer_Interface.cpp | 16 - ace/Reactor_Timer_Interface.h | 60 - ace/Reactor_Token_T.cpp | 70 - ace/Reactor_Token_T.h | 93 - ace/Read_Buffer.cpp | 176 - ace/Read_Buffer.h | 130 - ace/Read_Buffer.inl | 32 - ace/Recursive_Thread_Mutex.cpp | 128 - ace/Recursive_Thread_Mutex.h | 194 -- ace/Recursive_Thread_Mutex.inl | 95 - ace/Recyclable.cpp | 22 - ace/Recyclable.h | 83 - ace/Recyclable.inl | 20 - ace/Refcountable.cpp | 20 - ace/Refcountable.h | 58 - ace/Refcountable.inl | 31 - ace/Refcounted_Auto_Ptr.cpp | 18 - ace/Refcounted_Auto_Ptr.h | 197 -- ace/Refcounted_Auto_Ptr.inl | 191 - ace/Registry.cpp | 1139 ------ ace/Registry.h | 563 --- ace/Registry_Name_Space.cpp | 293 -- ace/Registry_Name_Space.h | 140 - ace/Remote_Name_Space.cpp | 380 -- ace/Remote_Name_Space.h | 147 - ace/Remote_Tokens.cpp | 527 --- ace/Remote_Tokens.h | 322 -- ace/Remote_Tokens.inl | 48 - ace/Reverse_Lock_T.cpp | 93 - ace/Reverse_Lock_T.h | 149 - ace/Reverse_Lock_T.inl | 19 - ace/SOCK.cpp | 185 - ace/SOCK.h | 138 - ace/SOCK.inl | 39 - ace/SOCK_Acceptor.cpp | 406 --- ace/SOCK_Acceptor.h | 178 - ace/SOCK_Acceptor.inl | 13 - ace/SOCK_CODgram.cpp | 112 - ace/SOCK_CODgram.h | 78 - ace/SOCK_CODgram.inl | 19 - ace/SOCK_Connector.cpp | 330 -- ace/SOCK_Connector.h | 329 -- ace/SOCK_Connector.inl | 38 - ace/SOCK_Dgram.cpp | 736 ---- ace/SOCK_Dgram.h | 239 -- ace/SOCK_Dgram.inl | 167 - ace/SOCK_Dgram_Bcast.cpp | 380 -- ace/SOCK_Dgram_Bcast.h | 140 - ace/SOCK_Dgram_Bcast.inl | 37 - ace/SOCK_Dgram_Mcast.cpp | 993 ------ ace/SOCK_Dgram_Mcast.h | 417 --- ace/SOCK_Dgram_Mcast.inl | 52 - ace/SOCK_IO.cpp | 181 - ace/SOCK_IO.h | 163 - ace/SOCK_IO.inl | 155 - ace/SOCK_Netlink.cpp | 113 - ace/SOCK_Netlink.h | 106 - ace/SOCK_Netlink.inl | 37 - ace/SOCK_SEQPACK_Acceptor.cpp | 596 ---- ace/SOCK_SEQPACK_Acceptor.h | 190 - ace/SOCK_SEQPACK_Acceptor.inl | 13 - ace/SOCK_SEQPACK_Association.cpp | 339 -- ace/SOCK_SEQPACK_Association.h | 202 -- ace/SOCK_SEQPACK_Association.inl | 177 - ace/SOCK_SEQPACK_Connector.cpp | 443 --- ace/SOCK_SEQPACK_Connector.h | 331 -- ace/SOCK_SEQPACK_Connector.inl | 38 - ace/SOCK_Stream.cpp | 40 - ace/SOCK_Stream.h | 187 - ace/SOCK_Stream.inl | 177 - ace/SPIPE.cpp | 82 - ace/SPIPE.h | 116 - ace/SPIPE.inl | 18 - ace/SPIPE_Acceptor.cpp | 337 -- ace/SPIPE_Acceptor.h | 168 - ace/SPIPE_Addr.cpp | 167 - ace/SPIPE_Addr.h | 122 - ace/SPIPE_Addr.inl | 59 - ace/SPIPE_Connector.cpp | 160 - ace/SPIPE_Connector.h | 118 - ace/SPIPE_Connector.inl | 15 - ace/SPIPE_Stream.cpp | 104 - ace/SPIPE_Stream.h | 171 - ace/SPIPE_Stream.inl | 277 -- ace/SSL/ACE_SSL.pc.in | 11 - ace/SSL/Makefile.am | 83 - ace/SSL/SSL_Asynch_BIO.cpp | 252 -- ace/SSL/SSL_Asynch_BIO.h | 42 - ace/SSL/SSL_Asynch_Stream.cpp | 1038 ------ ace/SSL/SSL_Asynch_Stream.h | 425 --- ace/SSL/SSL_Context.cpp | 612 ---- ace/SSL/SSL_Context.h | 387 --- ace/SSL/SSL_Context.inl | 112 - ace/SSL/SSL_Export.h | 44 - ace/SSL/SSL_SOCK.cpp | 72 - ace/SSL/SSL_SOCK.h | 103 - ace/SSL/SSL_SOCK.i | 71 - ace/SSL/SSL_SOCK_Acceptor.cpp | 249 -- ace/SSL/SSL_SOCK_Acceptor.h | 198 -- ace/SSL/SSL_SOCK_Acceptor.i | 85 - ace/SSL/SSL_SOCK_Connector.cpp | 411 --- ace/SSL/SSL_SOCK_Connector.h | 318 -- ace/SSL/SSL_SOCK_Connector.i | 28 - ace/SSL/SSL_SOCK_Stream.cpp | 586 ---- ace/SSL/SSL_SOCK_Stream.h | 321 -- ace/SSL/SSL_SOCK_Stream.i | 323 -- ace/SSL/ssl.mpc | 12 - ace/SSL/sslconf.h | 55 - ace/SString.cpp | 551 --- ace/SString.h | 499 --- ace/SString.inl | 299 -- ace/SStringfwd.h | 49 - ace/SUN_Proactor.cpp | 324 -- ace/SUN_Proactor.h | 126 - ace/SV_Message.cpp | 24 - ace/SV_Message.h | 67 - ace/SV_Message.inl | 37 - ace/SV_Message_Queue.cpp | 44 - ace/SV_Message_Queue.h | 105 - ace/SV_Message_Queue.inl | 81 - ace/SV_Semaphore_Complex.cpp | 259 -- ace/SV_Semaphore_Complex.h | 159 - ace/SV_Semaphore_Complex.inl | 84 - ace/SV_Semaphore_Simple.cpp | 237 -- ace/SV_Semaphore_Simple.h | 197 -- ace/SV_Semaphore_Simple.inl | 128 - ace/SV_Shared_Memory.cpp | 88 - ace/SV_Shared_Memory.h | 122 - ace/SV_Shared_Memory.inl | 119 - ace/Sample_History.cpp | 65 - ace/Sample_History.h | 91 - ace/Sample_History.inl | 26 - ace/Sbrk_Memory_Pool.cpp | 124 - ace/Sbrk_Memory_Pool.h | 118 - ace/Sched_Params.cpp | 330 -- ace/Sched_Params.h | 232 -- ace/Sched_Params.inl | 141 - ace/Select_Reactor.h | 69 - ace/Select_Reactor_Base.cpp | 1259 ------- ace/Select_Reactor_Base.h | 581 ---- ace/Select_Reactor_Base.inl | 87 - ace/Select_Reactor_T.cpp | 1600 --------- ace/Select_Reactor_T.h | 718 ---- ace/Select_Reactor_T.inl | 235 -- ace/Semaphore.cpp | 62 - ace/Semaphore.h | 182 - ace/Semaphore.inl | 119 - ace/Service_Config.cpp | 632 ---- ace/Service_Config.h | 610 ---- ace/Service_Config.inl | 158 - ace/Service_Gestalt.cpp | 1210 ------- ace/Service_Gestalt.h | 452 --- ace/Service_Gestalt.inl | 64 - ace/Service_Manager.cpp | 384 -- ace/Service_Manager.h | 120 - ace/Service_Object.cpp | 165 - ace/Service_Object.h | 204 -- ace/Service_Object.inl | 72 - ace/Service_Repository.cpp | 504 --- ace/Service_Repository.h | 223 -- ace/Service_Repository.inl | 51 - ace/Service_Templates.h | 29 - ace/Service_Types.cpp | 461 --- ace/Service_Types.h | 202 -- ace/Service_Types.inl | 32 - ace/Shared_Memory.cpp | 13 - ace/Shared_Memory.h | 58 - ace/Shared_Memory_MM.cpp | 111 - ace/Shared_Memory_MM.h | 120 - ace/Shared_Memory_MM.inl | 42 - ace/Shared_Memory_Pool.cpp | 459 --- ace/Shared_Memory_Pool.h | 209 -- ace/Shared_Memory_SV.cpp | 88 - ace/Shared_Memory_SV.h | 101 - ace/Shared_Memory_SV.inl | 30 - ace/Shared_Object.cpp | 54 - ace/Shared_Object.h | 59 - ace/Shared_Object.inl | 12 - ace/Sig_Adapter.cpp | 80 - ace/Sig_Adapter.h | 81 - ace/Sig_Handler.cpp | 620 ---- ace/Sig_Handler.h | 238 -- ace/Sig_Handler.inl | 15 - ace/Signal.cpp | 221 -- ace/Signal.h | 267 -- ace/Signal.inl | 265 -- ace/Singleton.cpp | 534 --- ace/Singleton.h | 327 -- ace/Singleton.inl | 42 - ace/Sock_Connect.cpp | 1529 -------- ace/Sock_Connect.h | 91 - ace/Static_Object_Lock.h | 78 - ace/Stats.cpp | 617 ---- ace/Stats.h | 278 -- ace/Stats.inl | 104 - ace/Strategies.h | 33 - ace/Strategies_T.cpp | 1499 -------- ace/Strategies_T.h | 1076 ------ ace/Strategies_T.inl | 230 -- ace/Stream.cpp | 619 ---- ace/Stream.h | 241 -- ace/Stream.inl | 51 - ace/Stream_Modules.cpp | 380 -- ace/Stream_Modules.h | 166 - ace/String_Base.cpp | 553 --- ace/String_Base.h | 599 ---- ace/String_Base.inl | 152 - ace/String_Base_Const.cpp | 11 - ace/String_Base_Const.h | 49 - ace/Svc_Conf.h | 107 - ace/Svc_Conf.y | 416 --- ace/Svc_Conf_Lexer.cpp | 657 ---- ace/Svc_Conf_Lexer.h | 70 - ace/Svc_Conf_Param.h | 140 - ace/Svc_Conf_Tokens.h | 81 - ace/Svc_Conf_y.cpp | 1739 ---------- ace/Svc_Handler.cpp | 527 --- ace/Svc_Handler.h | 340 -- ace/Swap.cpp | 22 - ace/Swap.h | 54 - ace/Swap.inl | 21 - ace/Synch.h | 65 - ace/Synch_Options.cpp | 110 - ace/Synch_Options.h | 154 - ace/Synch_T.cpp | 22 - ace/Synch_T.h | 42 - ace/Synch_Traits.h | 152 - ace/System_Time.cpp | 136 - ace/System_Time.h | 90 - ace/TLI.cpp | 273 -- ace/TLI.h | 116 - ace/TLI.inl | 50 - ace/TLI_Acceptor.cpp | 553 --- ace/TLI_Acceptor.h | 123 - ace/TLI_Connector.cpp | 256 -- ace/TLI_Connector.h | 130 - ace/TLI_Connector.inl | 49 - ace/TLI_Stream.cpp | 229 -- ace/TLI_Stream.h | 141 - ace/TLI_Stream.inl | 25 - ace/TP_Reactor.cpp | 732 ---- ace/TP_Reactor.h | 370 -- ace/TP_Reactor.inl | 114 - ace/TSS_Adapter.cpp | 45 - ace/TSS_Adapter.h | 61 - ace/TSS_T.cpp | 733 ---- ace/TSS_T.h | 257 -- ace/TSS_T.inl | 42 - ace/TTY_IO.cpp | 586 ---- ace/TTY_IO.h | 122 - ace/Task.cpp | 287 -- ace/Task.h | 306 -- ace/Task.inl | 77 - ace/Task_Ex_T.cpp | 114 - ace/Task_Ex_T.h | 208 -- ace/Task_Ex_T.inl | 112 - ace/Task_T.cpp | 108 - ace/Task_T.h | 198 -- ace/Task_T.inl | 108 - ace/Test_and_Set.cpp | 51 - ace/Test_and_Set.h | 75 - ace/Thread.cpp | 95 - ace/Thread.h | 278 -- ace/Thread.inl | 284 -- ace/Thread_Adapter.cpp | 225 -- ace/Thread_Adapter.h | 100 - ace/Thread_Adapter.inl | 13 - ace/Thread_Control.cpp | 96 - ace/Thread_Control.h | 102 - ace/Thread_Control.inl | 46 - ace/Thread_Exit.cpp | 123 - ace/Thread_Exit.h | 111 - ace/Thread_Hook.cpp | 33 - ace/Thread_Hook.h | 65 - ace/Thread_Manager.cpp | 2327 ------------- ace/Thread_Manager.h | 1162 ------- ace/Thread_Manager.inl | 320 -- ace/Thread_Mutex.cpp | 78 - ace/Thread_Mutex.h | 239 -- ace/Thread_Mutex.inl | 172 - ace/Thread_Semaphore.cpp | 62 - ace/Thread_Semaphore.h | 89 - ace/Thread_Semaphore.inl | 12 - ace/Time_Request_Reply.cpp | 196 -- ace/Time_Request_Reply.h | 139 - ace/Time_Value.cpp | 260 -- ace/Time_Value.h | 350 -- ace/Time_Value.inl | 403 --- ace/Timeprobe.cpp | 15 - ace/Timeprobe.h | 200 -- ace/Timeprobe.inl | 14 - ace/Timeprobe_T.cpp | 411 --- ace/Timeprobe_T.h | 222 -- ace/Timer_Hash.cpp | 12 - ace/Timer_Hash.h | 75 - ace/Timer_Hash_T.cpp | 789 ----- ace/Timer_Hash_T.h | 328 -- ace/Timer_Heap.cpp | 16 - ace/Timer_Heap.h | 41 - ace/Timer_Heap_T.cpp | 888 ----- ace/Timer_Heap_T.h | 338 -- ace/Timer_List.cpp | 13 - ace/Timer_List.h | 42 - ace/Timer_List_T.cpp | 416 --- ace/Timer_List_T.h | 226 -- ace/Timer_Queue.cpp | 14 - ace/Timer_Queue.h | 52 - ace/Timer_Queue_Adapters.cpp | 363 -- ace/Timer_Queue_Adapters.h | 260 -- ace/Timer_Queue_Adapters.inl | 29 - ace/Timer_Queue_T.cpp | 477 --- ace/Timer_Queue_T.h | 562 --- ace/Timer_Queue_T.inl | 222 -- ace/Timer_Queuefwd.h | 38 - ace/Timer_Wheel.cpp | 12 - ace/Timer_Wheel.h | 42 - ace/Timer_Wheel_T.cpp | 964 ------ ace/Timer_Wheel_T.h | 228 -- ace/TkReactor.cpp | 439 --- ace/TkReactor.h | 136 - ace/Token.cpp | 551 --- ace/Token.h | 376 -- ace/Token.inl | 176 - ace/Token_Collection.cpp | 294 -- ace/Token_Collection.h | 243 -- ace/Token_Collection.inl | 17 - ace/Token_Invariants.cpp | 355 -- ace/Token_Invariants.h | 245 -- ace/Token_Manager.cpp | 273 -- ace/Token_Manager.h | 150 - ace/Token_Manager.inl | 25 - ace/Token_Request_Reply.cpp | 186 - ace/Token_Request_Reply.h | 270 -- ace/Token_Request_Reply.inl | 206 -- ace/Trace.cpp | 137 - ace/Trace.h | 96 - ace/Truncate.h | 84 - ace/Typed_SV_Message.cpp | 30 - ace/Typed_SV_Message.h | 107 - ace/Typed_SV_Message.inl | 96 - ace/Typed_SV_Message_Queue.cpp | 56 - ace/Typed_SV_Message_Queue.h | 92 - ace/Typed_SV_Message_Queue.inl | 80 - ace/UNIX_Addr.cpp | 151 - ace/UNIX_Addr.h | 117 - ace/UNIX_Addr.inl | 57 - ace/UPIPE_Acceptor.cpp | 129 - ace/UPIPE_Acceptor.h | 99 - ace/UPIPE_Acceptor.inl | 14 - ace/UPIPE_Addr.h | 33 - ace/UPIPE_Connector.cpp | 101 - ace/UPIPE_Connector.h | 115 - ace/UPIPE_Connector.inl | 34 - ace/UPIPE_Stream.cpp | 231 -- ace/UPIPE_Stream.h | 141 - ace/UPIPE_Stream.inl | 14 - ace/UTF16_Encoding_Converter.cpp | 364 -- ace/UTF16_Encoding_Converter.h | 86 - ace/UTF16_Encoding_Converter.inl | 76 - ace/UTF32_Encoding_Converter.cpp | 254 -- ace/UTF32_Encoding_Converter.h | 67 - ace/UTF8_Encoding_Converter.cpp | 92 - ace/UTF8_Encoding_Converter.h | 72 - ace/UUID.cpp | 481 --- ace/UUID.h | 232 -- ace/UUID.inl | 201 -- ace/Unbounded_Queue.cpp | 434 --- ace/Unbounded_Queue.h | 297 -- ace/Unbounded_Queue.inl | 27 - ace/Unbounded_Set.cpp | 452 --- ace/Unbounded_Set.h | 319 -- ace/Unbounded_Set.inl | 23 - ace/Value_Ptr.h | 167 - ace/Vector_T.cpp | 165 - ace/Vector_T.h | 314 -- ace/Vector_T.inl | 95 - ace/Version.h | 10 - ace/Versioned_Namespace.h | 51 - ace/WFMO_Reactor.cpp | 2714 --------------- ace/WFMO_Reactor.h | 1357 -------- ace/WFMO_Reactor.inl | 1173 ------- ace/WIN32_Asynch_IO.cpp | 3755 -------------------- ace/WIN32_Asynch_IO.h | 1936 ----------- ace/WIN32_Proactor.cpp | 804 ----- ace/WIN32_Proactor.h | 325 -- ace/XML_Svc_Conf.cpp | 15 - ace/XML_Svc_Conf.h | 65 - ace/XTI_ATM_Mcast.cpp | 70 - ace/XTI_ATM_Mcast.h | 137 - ace/XTI_ATM_Mcast.inl | 65 - ace/XtReactor.cpp | 450 --- ace/XtReactor.h | 140 - ace/ace.mpc | 462 --- ace/ace.mwc | 14 - ace/ace.rc | 38 - ace/ace_ce_dll.cfg | 1 - ace/ace_flreactor.mpc | 30 - ace/ace_for_tao.mpc | 381 -- ace/ace_message_table.bin | Bin 28 -> 0 bytes ace/ace_qtreactor.mpc | 34 - ace/ace_tkreactor.mpc | 30 - ace/ace_wchar.h | 352 -- ace/ace_wchar.inl | 127 - ace/ace_xtreactor.mpc | 30 - ace/codecs.mpb | 8 - ace/config-WinCE.h | 231 -- ace/config-aix-4.1.x.h | 8 - ace/config-aix-4.2.x.h | 8 - ace/config-aix-4.3.x.h | 8 - ace/config-aix-4.x.h | 341 -- ace/config-aix-5.x.h | 59 - ace/config-all.h | 81 - ace/config-borland-common.h | 74 - ace/config-cray.h | 231 -- ace/config-cxx-common.h | 89 - ace/config-cygwin32.h | 206 -- ace/config-dgux-4.11-epc.h | 189 - ace/config-dgux-4.x-ghs.h | 208 -- ace/config-doxygen.h | 116 - ace/config-freebsd.h | 272 -- ace/config-g++-common.h | 118 - ace/config-ghs-common.h | 44 - ace/config-hpux-11.00.h | 506 --- ace/config-icc-common.h | 67 - ace/config-integritySCA.h | 237 -- ace/config-irix5.2.h | 67 - ace/config-irix5.3-g++.h | 117 - ace/config-irix5.3-sgic++.h | 120 - ace/config-irix6.5.x-sgic++.h | 20 - ace/config-irix6.x-common.h | 267 -- ace/config-irix6.x-g++.h | 23 - ace/config-irix6.x-sgic++-nothreads.h | 5 - ace/config-irix6.x-sgic++.h | 42 - ace/config-linux-common.h | 414 --- ace/config-linux.h | 64 - ace/config-lite.h | 104 - ace/config-lynxos.h | 207 -- ace/config-m88k.h | 225 -- ace/config-macosx-panther.h | 199 -- ace/config-macosx-tiger.h | 230 -- ace/config-macosx.h | 199 -- ace/config-macros.h | 638 ---- ace/config-minimal.h | 39 - ace/config-mit-pthread.h | 49 - ace/config-mklinux.h | 20 - ace/config-mvs.h | 114 - ace/config-netbsd.h | 166 - ace/config-openbsd.h | 242 -- ace/config-openvms.h | 191 - ace/config-pharlap.h | 66 - ace/config-posix.h | 84 - ace/config-qnx-neutrino.h | 143 - ace/config-qnx-rtp-62x.h | 129 - ace/config-qnx-rtp-common.h | 46 - ace/config-qnx-rtp-pre62x.h | 154 - ace/config-qnx-rtp.h | 20 - ace/config-rtems.h | 158 - ace/config-sco-4.2-nothread.h | 110 - ace/config-sco-5.0.0-fsu-pthread.h | 15 - ace/config-sco-5.0.0-mit-pthread.h | 164 - ace/config-sco-5.0.0-nothread.h | 14 - ace/config-sco-5.0.0.h | 100 - ace/config-suncc-common.h | 69 - ace/config-sunos4-g++.h | 103 - ace/config-sunos4-lucid3.2.h | 93 - ace/config-sunos4-sun3.x.h | 81 - ace/config-sunos4-sun4.1.4.h | 89 - ace/config-sunos4-sun4.x.h | 98 - ace/config-sunos5.10.h | 17 - ace/config-sunos5.4-centerline-2.x.h | 157 - ace/config-sunos5.4-g++.h | 180 - ace/config-sunos5.4-sunc++-4.x.h | 191 - ace/config-sunos5.5.h | 405 --- ace/config-sunos5.6.h | 137 - ace/config-sunos5.7.h | 88 - ace/config-sunos5.8.h | 37 - ace/config-sunos5.9.h | 17 - ace/config-tandem-nsk-mips-v2.h | 424 --- ace/config-tandem-nsk-mips-v3.h | 471 --- ace/config-tandem.h | 192 - ace/config-tru64.h | 187 - ace/config-unixware-2.01-g++.h | 106 - ace/config-unixware-2.1.2-g++.h | 94 - ace/config-unixware-7.1.0.h | 422 --- ace/config-unixware-7.1.0.udk.h | 492 --- ace/config-visualage.h | 20 - ace/config-vxworks5.x.h | 331 -- ace/config-vxworks6.2.h | 321 -- ace/config-vxworks6.3.h | 283 -- ace/config-win32-borland.h | 130 - ace/config-win32-common.h | 623 ---- ace/config-win32-dmc.h | 111 - ace/config-win32-ghs.h | 97 - ace/config-win32-interix.h | 105 - ace/config-win32-mingw.h | 106 - ace/config-win32-msvc-7.h | 126 - ace/config-win32-msvc-8.h | 127 - ace/config-win32-msvc.h | 172 - ace/config-win32-visualage.h | 137 - ace/config-win32.h | 51 - ace/filecache.mpb | 8 - ace/gethrtime.cpp | 63 - ace/iosfwd.h | 99 - ace/os_include/arpa/os_inet.h | 74 - ace/os_include/net/os_if.h | 67 - ace/os_include/netinet/os_in.h | 140 - ace/os_include/netinet/os_tcp.h | 42 - ace/os_include/os_aio.h | 47 - ace/os_include/os_assert.h | 46 - ace/os_include/os_complex.h | 42 - ace/os_include/os_cpio.h | 42 - ace/os_include/os_ctype.h | 45 - ace/os_include/os_dirent.h | 108 - ace/os_include/os_dlfcn.h | 107 - ace/os_include/os_errno.h | 149 - ace/os_include/os_fcntl.h | 106 - ace/os_include/os_fenv.h | 42 - ace/os_include/os_float.h | 42 - ace/os_include/os_fmtmsg.h | 42 - ace/os_include/os_fnmatch.h | 42 - ace/os_include/os_ftw.h | 44 - ace/os_include/os_glob.h | 44 - ace/os_include/os_grp.h | 44 - ace/os_include/os_iconv.h | 44 - ace/os_include/os_inttypes.h | 46 - ace/os_include/os_iso646.h | 42 - ace/os_include/os_langinfo.h | 44 - ace/os_include/os_libgen.h | 42 - ace/os_include/os_limits.h | 143 - ace/os_include/os_local.h | 44 - ace/os_include/os_math.h | 44 - ace/os_include/os_monetary.h | 44 - ace/os_include/os_mqueue.h | 44 - ace/os_include/os_ndbm.h | 44 - ace/os_include/os_netdb.h | 80 - ace/os_include/os_nl_types.h | 42 - ace/os_include/os_poll.h | 42 - ace/os_include/os_pthread.h | 459 --- ace/os_include/os_pwd.h | 58 - ace/os_include/os_regex.h | 48 - ace/os_include/os_sched.h | 52 - ace/os_include/os_search.h | 44 - ace/os_include/os_semaphore.h | 77 - ace/os_include/os_setjmp.h | 42 - ace/os_include/os_signal.h | 280 -- ace/os_include/os_spawn.h | 46 - ace/os_include/os_stdarg.h | 42 - ace/os_include/os_stdbool.h | 42 - ace/os_include/os_stddef.h | 95 - ace/os_include/os_stdint.h | 141 - ace/os_include/os_stdio.h | 110 - ace/os_include/os_stdlib.h | 78 - ace/os_include/os_string.h | 72 - ace/os_include/os_strings.h | 52 - ace/os_include/os_stropts.h | 120 - ace/os_include/os_syslog.h | 42 - ace/os_include/os_tar.h | 42 - ace/os_include/os_termios.h | 46 - ace/os_include/os_tgmath.h | 45 - ace/os_include/os_time.h | 123 - ace/os_include/os_trace.h | 44 - ace/os_include/os_ucontext.h | 48 - ace/os_include/os_ulimit.h | 42 - ace/os_include/os_unistd.h | 167 - ace/os_include/os_utime.h | 44 - ace/os_include/os_utmpx.h | 44 - ace/os_include/os_wchar.h | 49 - ace/os_include/os_wctype.h | 45 - ace/os_include/os_wordexp.h | 44 - ace/os_include/sys/os_ipc.h | 74 - ace/os_include/sys/os_loadavg.h | 41 - ace/os_include/sys/os_mman.h | 122 - ace/os_include/sys/os_msg.h | 62 - ace/os_include/sys/os_pstat.h | 42 - ace/os_include/sys/os_resource.h | 108 - ace/os_include/sys/os_select.h | 70 - ace/os_include/sys/os_sem.h | 90 - ace/os_include/sys/os_shm.h | 48 - ace/os_include/sys/os_socket.h | 213 -- ace/os_include/sys/os_stat.h | 127 - ace/os_include/sys/os_statvfs.h | 44 - ace/os_include/sys/os_sysctl.h | 41 - ace/os_include/sys/os_time.h | 60 - ace/os_include/sys/os_timeb.h | 49 - ace/os_include/sys/os_times.h | 44 - ace/os_include/sys/os_types.h | 151 - ace/os_include/sys/os_uio.h | 85 - ace/os_include/sys/os_un.h | 52 - ace/os_include/sys/os_utsname.h | 42 - ace/os_include/sys/os_wait.h | 97 - ace/other.mpb | 15 - ace/post.h | 22 - ace/pre.h | 24 - ace/streams.h | 141 - ace/svc_export.h | 44 - ace/svcconf.mpb | 64 - ace/token.mpb | 15 - ace/uuid.mpb | 8 - 1334 files changed, 320058 deletions(-) delete mode 100644 ace/.cvsignore delete mode 100644 ace/ACE.cpp delete mode 100644 ace/ACE.h delete mode 100644 ace/ACE.inl delete mode 100644 ace/ACE.pc.in delete mode 100644 ace/ACE_FlReactor.pc.in delete mode 100644 ace/ACE_FlReactor_export.h delete mode 100644 ace/ACE_QtReactor.pc.in delete mode 100644 ace/ACE_QtReactor_export.h delete mode 100644 ace/ACE_TkReactor.pc.in delete mode 100644 ace/ACE_TkReactor_export.h delete mode 100644 ace/ACE_XtReactor.pc.in delete mode 100644 ace/ACE_XtReactor_export.h delete mode 100644 ace/ACE_crc32.cpp delete mode 100644 ace/ACE_crc_ccitt.cpp delete mode 100644 ace/ACE_export.h delete mode 100644 ace/ARGV.cpp delete mode 100644 ace/ARGV.h delete mode 100644 ace/ARGV.inl delete mode 100644 ace/ATM_Acceptor.cpp delete mode 100644 ace/ATM_Acceptor.h delete mode 100644 ace/ATM_Acceptor.inl delete mode 100644 ace/ATM_Addr.cpp delete mode 100644 ace/ATM_Addr.h delete mode 100644 ace/ATM_Addr.inl delete mode 100644 ace/ATM_Connector.cpp delete mode 100644 ace/ATM_Connector.h delete mode 100644 ace/ATM_Connector.inl delete mode 100644 ace/ATM_Params.cpp delete mode 100644 ace/ATM_Params.h delete mode 100644 ace/ATM_Params.inl delete mode 100644 ace/ATM_QoS.cpp delete mode 100644 ace/ATM_QoS.h delete mode 100644 ace/ATM_QoS.inl delete mode 100644 ace/ATM_Stream.cpp delete mode 100644 ace/ATM_Stream.h delete mode 100644 ace/ATM_Stream.inl delete mode 100644 ace/Acceptor.cpp delete mode 100644 ace/Acceptor.h delete mode 100644 ace/Activation_Queue.cpp delete mode 100644 ace/Activation_Queue.h delete mode 100644 ace/Activation_Queue.inl delete mode 100644 ace/Active_Map_Manager.cpp delete mode 100644 ace/Active_Map_Manager.h delete mode 100644 ace/Active_Map_Manager.inl delete mode 100644 ace/Active_Map_Manager_T.cpp delete mode 100644 ace/Active_Map_Manager_T.h delete mode 100644 ace/Active_Map_Manager_T.inl delete mode 100644 ace/Addr.cpp delete mode 100644 ace/Addr.h delete mode 100644 ace/Addr.inl delete mode 100644 ace/Arg_Shifter.cpp delete mode 100644 ace/Arg_Shifter.h delete mode 100644 ace/Argv_Type_Converter.cpp delete mode 100644 ace/Argv_Type_Converter.h delete mode 100644 ace/Argv_Type_Converter.inl delete mode 100644 ace/Array.h delete mode 100644 ace/Array_Base.cpp delete mode 100644 ace/Array_Base.h delete mode 100644 ace/Array_Base.inl delete mode 100644 ace/Array_Map.cpp delete mode 100644 ace/Array_Map.h delete mode 100644 ace/Array_Map.inl delete mode 100644 ace/Assert.cpp delete mode 100644 ace/Assert.h delete mode 100644 ace/Asynch_Acceptor.cpp delete mode 100644 ace/Asynch_Acceptor.h delete mode 100644 ace/Asynch_Connector.cpp delete mode 100644 ace/Asynch_Connector.h delete mode 100644 ace/Asynch_IO.cpp delete mode 100644 ace/Asynch_IO.h delete mode 100644 ace/Asynch_IO_Impl.cpp delete mode 100644 ace/Asynch_IO_Impl.h delete mode 100644 ace/Asynch_IO_Impl.inl delete mode 100644 ace/Asynch_Pseudo_Task.cpp delete mode 100644 ace/Asynch_Pseudo_Task.h delete mode 100644 ace/Atomic_Op.cpp delete mode 100644 ace/Atomic_Op.h delete mode 100644 ace/Atomic_Op.inl delete mode 100644 ace/Atomic_Op_Sparc.c delete mode 100644 ace/Atomic_Op_Sparc.h delete mode 100644 ace/Atomic_Op_T.cpp delete mode 100644 ace/Atomic_Op_T.h delete mode 100644 ace/Atomic_Op_T.inl delete mode 100644 ace/Auto_Event.cpp delete mode 100644 ace/Auto_Event.h delete mode 100644 ace/Auto_Event.inl delete mode 100644 ace/Auto_Functor.cpp delete mode 100644 ace/Auto_Functor.h delete mode 100644 ace/Auto_Functor.inl delete mode 100644 ace/Auto_IncDec_T.cpp delete mode 100644 ace/Auto_IncDec_T.h delete mode 100644 ace/Auto_IncDec_T.inl delete mode 100644 ace/Auto_Ptr.cpp delete mode 100644 ace/Auto_Ptr.h delete mode 100644 ace/Auto_Ptr.inl delete mode 100644 ace/Barrier.cpp delete mode 100644 ace/Barrier.h delete mode 100644 ace/Barrier.inl delete mode 100644 ace/Base_Thread_Adapter.cpp delete mode 100644 ace/Base_Thread_Adapter.h delete mode 100644 ace/Base_Thread_Adapter.inl delete mode 100644 ace/Based_Pointer_Repository.cpp delete mode 100644 ace/Based_Pointer_Repository.h delete mode 100644 ace/Based_Pointer_T.cpp delete mode 100644 ace/Based_Pointer_T.h delete mode 100644 ace/Based_Pointer_T.inl delete mode 100644 ace/Basic_Stats.cpp delete mode 100644 ace/Basic_Stats.h delete mode 100644 ace/Basic_Stats.inl delete mode 100644 ace/Basic_Types.cpp delete mode 100644 ace/Basic_Types.h delete mode 100644 ace/Basic_Types.inl delete mode 100644 ace/Bound_Ptr.h delete mode 100644 ace/Bound_Ptr.inl delete mode 100644 ace/CDR_Base.cpp delete mode 100644 ace/CDR_Base.h delete mode 100644 ace/CDR_Base.inl delete mode 100644 ace/CDR_Size.cpp delete mode 100644 ace/CDR_Size.h delete mode 100644 ace/CDR_Size.inl delete mode 100644 ace/CDR_Stream.cpp delete mode 100644 ace/CDR_Stream.h delete mode 100644 ace/CDR_Stream.inl delete mode 100644 ace/CE_Screen_Output.cpp delete mode 100644 ace/CE_Screen_Output.h delete mode 100644 ace/CORBA_macros.h delete mode 100644 ace/Cache_Map_Manager_T.cpp delete mode 100644 ace/Cache_Map_Manager_T.h delete mode 100644 ace/Cache_Map_Manager_T.inl delete mode 100644 ace/Cached_Connect_Strategy_T.cpp delete mode 100644 ace/Cached_Connect_Strategy_T.h delete mode 100644 ace/Caching_Strategies_T.cpp delete mode 100644 ace/Caching_Strategies_T.h delete mode 100644 ace/Caching_Strategies_T.inl delete mode 100644 ace/Caching_Utility_T.cpp delete mode 100644 ace/Caching_Utility_T.h delete mode 100644 ace/Capabilities.cpp delete mode 100644 ace/Capabilities.h delete mode 100644 ace/Capabilities.inl delete mode 100644 ace/Cleanup.cpp delete mode 100644 ace/Cleanup.h delete mode 100644 ace/Cleanup.inl delete mode 100644 ace/Cleanup_Strategies_T.cpp delete mode 100644 ace/Cleanup_Strategies_T.h delete mode 100644 ace/Codecs.cpp delete mode 100644 ace/Codecs.h delete mode 100644 ace/Codeset_IBM1047.cpp delete mode 100644 ace/Codeset_IBM1047.h delete mode 100644 ace/Codeset_Registry.cpp delete mode 100644 ace/Codeset_Registry.h delete mode 100644 ace/Codeset_Registry.inl delete mode 100644 ace/Codeset_Registry_db.cpp delete mode 100644 ace/Codeset_Symbols.h delete mode 100644 ace/Condition_Recursive_Thread_Mutex.cpp delete mode 100644 ace/Condition_Recursive_Thread_Mutex.h delete mode 100644 ace/Condition_T.cpp delete mode 100644 ace/Condition_T.h delete mode 100644 ace/Condition_T.inl delete mode 100644 ace/Condition_Thread_Mutex.cpp delete mode 100644 ace/Condition_Thread_Mutex.h delete mode 100644 ace/Condition_Thread_Mutex.inl delete mode 100644 ace/Configuration.cpp delete mode 100644 ace/Configuration.h delete mode 100644 ace/Configuration_Import_Export.cpp delete mode 100644 ace/Configuration_Import_Export.h delete mode 100644 ace/Connection_Recycling_Strategy.cpp delete mode 100644 ace/Connection_Recycling_Strategy.h delete mode 100644 ace/Connector.cpp delete mode 100644 ace/Connector.h delete mode 100644 ace/Containers.cpp delete mode 100644 ace/Containers.h delete mode 100644 ace/Containers.inl delete mode 100644 ace/Containers_T.cpp delete mode 100644 ace/Containers_T.h delete mode 100644 ace/Containers_T.inl delete mode 100644 ace/Copy_Disabled.cpp delete mode 100644 ace/Copy_Disabled.h delete mode 100644 ace/Countdown_Time.cpp delete mode 100644 ace/Countdown_Time.h delete mode 100644 ace/DEV.cpp delete mode 100644 ace/DEV.h delete mode 100644 ace/DEV.inl delete mode 100644 ace/DEV_Addr.cpp delete mode 100644 ace/DEV_Addr.h delete mode 100644 ace/DEV_Addr.inl delete mode 100644 ace/DEV_Connector.cpp delete mode 100644 ace/DEV_Connector.h delete mode 100644 ace/DEV_Connector.inl delete mode 100644 ace/DEV_IO.cpp delete mode 100644 ace/DEV_IO.h delete mode 100644 ace/DEV_IO.inl delete mode 100644 ace/DLL.cpp delete mode 100644 ace/DLL.h delete mode 100644 ace/DLL_Manager.cpp delete mode 100644 ace/DLL_Manager.h delete mode 100644 ace/Date_Time.cpp delete mode 100644 ace/Date_Time.h delete mode 100644 ace/Date_Time.inl delete mode 100644 ace/Default_Constants.h delete mode 100644 ace/Dev_Poll_Reactor.cpp delete mode 100644 ace/Dev_Poll_Reactor.h delete mode 100644 ace/Dev_Poll_Reactor.inl delete mode 100644 ace/Dirent.cpp delete mode 100644 ace/Dirent.h delete mode 100644 ace/Dirent.inl delete mode 100644 ace/Dirent_Selector.cpp delete mode 100644 ace/Dirent_Selector.h delete mode 100644 ace/Dirent_Selector.inl delete mode 100644 ace/Dump.cpp delete mode 100644 ace/Dump.h delete mode 100644 ace/Dump_T.cpp delete mode 100644 ace/Dump_T.h delete mode 100644 ace/Dynamic.cpp delete mode 100644 ace/Dynamic.h delete mode 100644 ace/Dynamic.inl delete mode 100644 ace/Dynamic_Service.cpp delete mode 100644 ace/Dynamic_Service.h delete mode 100644 ace/Dynamic_Service.inl delete mode 100644 ace/Dynamic_Service_Base.cpp delete mode 100644 ace/Dynamic_Service_Base.h delete mode 100644 ace/Dynamic_Service_Dependency.cpp delete mode 100644 ace/Dynamic_Service_Dependency.h delete mode 100644 ace/Encoding_Converter.cpp delete mode 100644 ace/Encoding_Converter.h delete mode 100644 ace/Encoding_Converter_Factory.cpp delete mode 100644 ace/Encoding_Converter_Factory.h delete mode 100644 ace/Env_Value_T.cpp delete mode 100644 ace/Env_Value_T.h delete mode 100644 ace/Env_Value_T.inl delete mode 100644 ace/Event.cpp delete mode 100644 ace/Event.h delete mode 100644 ace/Event.inl delete mode 100644 ace/Event_Handler.cpp delete mode 100644 ace/Event_Handler.h delete mode 100644 ace/Event_Handler.inl delete mode 100644 ace/Event_Handler_T.cpp delete mode 100644 ace/Event_Handler_T.h delete mode 100644 ace/Event_Handler_T.inl delete mode 100644 ace/Exception_Macros.h delete mode 100644 ace/FIFO.cpp delete mode 100644 ace/FIFO.h delete mode 100644 ace/FIFO.inl delete mode 100644 ace/FIFO_Recv.cpp delete mode 100644 ace/FIFO_Recv.h delete mode 100644 ace/FIFO_Recv.inl delete mode 100644 ace/FIFO_Recv_Msg.cpp delete mode 100644 ace/FIFO_Recv_Msg.h delete mode 100644 ace/FIFO_Recv_Msg.inl delete mode 100644 ace/FIFO_Send.cpp delete mode 100644 ace/FIFO_Send.h delete mode 100644 ace/FIFO_Send.inl delete mode 100644 ace/FIFO_Send_Msg.cpp delete mode 100644 ace/FIFO_Send_Msg.h delete mode 100644 ace/FIFO_Send_Msg.inl delete mode 100644 ace/FILE.cpp delete mode 100644 ace/FILE.h delete mode 100644 ace/FILE.inl delete mode 100644 ace/FILE_Addr.cpp delete mode 100644 ace/FILE_Addr.h delete mode 100644 ace/FILE_Addr.inl delete mode 100644 ace/FILE_Connector.cpp delete mode 100644 ace/FILE_Connector.h delete mode 100644 ace/FILE_Connector.inl delete mode 100644 ace/FILE_IO.cpp delete mode 100644 ace/FILE_IO.h delete mode 100644 ace/FILE_IO.inl delete mode 100644 ace/File_Lock.cpp delete mode 100644 ace/File_Lock.h delete mode 100644 ace/File_Lock.inl delete mode 100644 ace/Filecache.cpp delete mode 100644 ace/Filecache.h delete mode 100644 ace/FlReactor.cpp delete mode 100644 ace/FlReactor.h delete mode 100644 ace/Flag_Manip.cpp delete mode 100644 ace/Flag_Manip.h delete mode 100644 ace/Flag_Manip.inl delete mode 100644 ace/Framework_Component.cpp delete mode 100644 ace/Framework_Component.h delete mode 100644 ace/Framework_Component.inl delete mode 100644 ace/Framework_Component_T.cpp delete mode 100644 ace/Framework_Component_T.h delete mode 100644 ace/Free_List.cpp delete mode 100644 ace/Free_List.h delete mode 100644 ace/Functor.cpp delete mode 100644 ace/Functor.h delete mode 100644 ace/Functor.inl delete mode 100644 ace/Functor_String.cpp delete mode 100644 ace/Functor_String.h delete mode 100644 ace/Functor_String.inl delete mode 100644 ace/Functor_T.cpp delete mode 100644 ace/Functor_T.h delete mode 100644 ace/Functor_T.inl delete mode 100644 ace/Future.cpp delete mode 100644 ace/Future.h delete mode 100644 ace/Future_Set.cpp delete mode 100644 ace/Future_Set.h delete mode 100644 ace/Get_Opt.cpp delete mode 100644 ace/Get_Opt.h delete mode 100644 ace/Get_Opt.inl delete mode 100644 ace/Global_Macros.h delete mode 100644 ace/Guard_T.cpp delete mode 100644 ace/Guard_T.h delete mode 100644 ace/Guard_T.inl delete mode 100644 ace/Handle_Gobbler.h delete mode 100644 ace/Handle_Gobbler.inl delete mode 100644 ace/Handle_Ops.cpp delete mode 100644 ace/Handle_Ops.h delete mode 100644 ace/Handle_Set.cpp delete mode 100644 ace/Handle_Set.h delete mode 100644 ace/Handle_Set.inl delete mode 100644 ace/Hash_Cache_Map_Manager_T.cpp delete mode 100644 ace/Hash_Cache_Map_Manager_T.h delete mode 100644 ace/Hash_Cache_Map_Manager_T.inl delete mode 100644 ace/Hash_Map_Manager.h delete mode 100644 ace/Hash_Map_Manager_T.cpp delete mode 100644 ace/Hash_Map_Manager_T.h delete mode 100644 ace/Hash_Map_Manager_T.inl delete mode 100644 ace/Hash_Map_With_Allocator_T.cpp delete mode 100644 ace/Hash_Map_With_Allocator_T.h delete mode 100644 ace/Hash_Map_With_Allocator_T.inl delete mode 100644 ace/Hashable.cpp delete mode 100644 ace/Hashable.h delete mode 100644 ace/Hashable.inl delete mode 100644 ace/High_Res_Timer.cpp delete mode 100644 ace/High_Res_Timer.h delete mode 100644 ace/High_Res_Timer.inl delete mode 100644 ace/ICMP_Socket.cpp delete mode 100644 ace/ICMP_Socket.h delete mode 100644 ace/INET_Addr.cpp delete mode 100644 ace/INET_Addr.h delete mode 100644 ace/INET_Addr.inl delete mode 100644 ace/IOStream.cpp delete mode 100644 ace/IOStream.h delete mode 100644 ace/IOStream_T.cpp delete mode 100644 ace/IOStream_T.h delete mode 100644 ace/IOStream_T.inl delete mode 100644 ace/IO_Cntl_Msg.cpp delete mode 100644 ace/IO_Cntl_Msg.h delete mode 100644 ace/IO_Cntl_Msg.inl delete mode 100644 ace/IO_SAP.cpp delete mode 100644 ace/IO_SAP.h delete mode 100644 ace/IO_SAP.inl delete mode 100644 ace/IPC_SAP.cpp delete mode 100644 ace/IPC_SAP.h delete mode 100644 ace/IPC_SAP.inl delete mode 100644 ace/If_Then_Else.h delete mode 100644 ace/Init_ACE.cpp delete mode 100644 ace/Init_ACE.h delete mode 100644 ace/Intrusive_List.cpp delete mode 100644 ace/Intrusive_List.h delete mode 100644 ace/Intrusive_List.inl delete mode 100644 ace/Intrusive_List_Node.cpp delete mode 100644 ace/Intrusive_List_Node.h delete mode 100644 ace/Intrusive_List_Node.inl delete mode 100644 ace/LOCK_SOCK_Acceptor.cpp delete mode 100644 ace/LOCK_SOCK_Acceptor.h delete mode 100644 ace/LSOCK.cpp delete mode 100644 ace/LSOCK.h delete mode 100644 ace/LSOCK.inl delete mode 100644 ace/LSOCK_Acceptor.cpp delete mode 100644 ace/LSOCK_Acceptor.h delete mode 100644 ace/LSOCK_CODgram.cpp delete mode 100644 ace/LSOCK_CODgram.h delete mode 100644 ace/LSOCK_CODgram.inl delete mode 100644 ace/LSOCK_Connector.cpp delete mode 100644 ace/LSOCK_Connector.h delete mode 100644 ace/LSOCK_Connector.inl delete mode 100644 ace/LSOCK_Dgram.cpp delete mode 100644 ace/LSOCK_Dgram.h delete mode 100644 ace/LSOCK_Dgram.inl delete mode 100644 ace/LSOCK_Stream.cpp delete mode 100644 ace/LSOCK_Stream.h delete mode 100644 ace/LSOCK_Stream.inl delete mode 100644 ace/Lib_Find.cpp delete mode 100644 ace/Lib_Find.h delete mode 100644 ace/Local_Memory_Pool.cpp delete mode 100644 ace/Local_Memory_Pool.h delete mode 100644 ace/Local_Name_Space.cpp delete mode 100644 ace/Local_Name_Space.h delete mode 100644 ace/Local_Name_Space_T.cpp delete mode 100644 ace/Local_Name_Space_T.h delete mode 100644 ace/Local_Tokens.cpp delete mode 100644 ace/Local_Tokens.h delete mode 100644 ace/Local_Tokens.inl delete mode 100644 ace/Lock.cpp delete mode 100644 ace/Lock.h delete mode 100644 ace/Lock.inl delete mode 100644 ace/Lock_Adapter_T.cpp delete mode 100644 ace/Lock_Adapter_T.h delete mode 100644 ace/Lock_Adapter_T.inl delete mode 100644 ace/Log_Msg.cpp delete mode 100644 ace/Log_Msg.h delete mode 100644 ace/Log_Msg_Backend.cpp delete mode 100644 ace/Log_Msg_Backend.h delete mode 100644 ace/Log_Msg_Callback.cpp delete mode 100644 ace/Log_Msg_Callback.h delete mode 100644 ace/Log_Msg_IPC.cpp delete mode 100644 ace/Log_Msg_IPC.h delete mode 100644 ace/Log_Msg_NT_Event_Log.cpp delete mode 100644 ace/Log_Msg_NT_Event_Log.h delete mode 100644 ace/Log_Msg_UNIX_Syslog.cpp delete mode 100644 ace/Log_Msg_UNIX_Syslog.h delete mode 100644 ace/Log_Priority.h delete mode 100644 ace/Log_Record.cpp delete mode 100644 ace/Log_Record.h delete mode 100644 ace/Log_Record.inl delete mode 100644 ace/Logging_Strategy.cpp delete mode 100644 ace/Logging_Strategy.h delete mode 100644 ace/MEM_Acceptor.cpp delete mode 100644 ace/MEM_Acceptor.h delete mode 100644 ace/MEM_Acceptor.inl delete mode 100644 ace/MEM_Addr.cpp delete mode 100644 ace/MEM_Addr.h delete mode 100644 ace/MEM_Addr.inl delete mode 100644 ace/MEM_Connector.cpp delete mode 100644 ace/MEM_Connector.h delete mode 100644 ace/MEM_Connector.inl delete mode 100644 ace/MEM_IO.cpp delete mode 100644 ace/MEM_IO.h delete mode 100644 ace/MEM_IO.inl delete mode 100644 ace/MEM_SAP.cpp delete mode 100644 ace/MEM_SAP.h delete mode 100644 ace/MEM_SAP.inl delete mode 100644 ace/MEM_Stream.cpp delete mode 100644 ace/MEM_Stream.h delete mode 100644 ace/MEM_Stream.inl delete mode 100644 ace/MMAP_Memory_Pool.cpp delete mode 100644 ace/MMAP_Memory_Pool.h delete mode 100644 ace/MMAP_Memory_Pool.inl delete mode 100644 ace/Makefile.am delete mode 100644 ace/Malloc.cpp delete mode 100644 ace/Malloc.h delete mode 100644 ace/Malloc.inl delete mode 100644 ace/Malloc_Allocator.cpp delete mode 100644 ace/Malloc_Allocator.h delete mode 100644 ace/Malloc_Allocator.inl delete mode 100644 ace/Malloc_Base.h delete mode 100644 ace/Malloc_T.cpp delete mode 100644 ace/Malloc_T.h delete mode 100644 ace/Malloc_T.inl delete mode 100644 ace/Managed_Object.cpp delete mode 100644 ace/Managed_Object.h delete mode 100644 ace/Managed_Object.inl delete mode 100644 ace/Manual_Event.cpp delete mode 100644 ace/Manual_Event.h delete mode 100644 ace/Manual_Event.inl delete mode 100644 ace/Map.h delete mode 100644 ace/Map_Manager.cpp delete mode 100644 ace/Map_Manager.h delete mode 100644 ace/Map_Manager.inl delete mode 100644 ace/Map_T.cpp delete mode 100644 ace/Map_T.h delete mode 100644 ace/Map_T.inl delete mode 100644 ace/Mem_Map.cpp delete mode 100644 ace/Mem_Map.h delete mode 100644 ace/Mem_Map.inl delete mode 100644 ace/Memory_Pool.h delete mode 100644 ace/Message_Block.cpp delete mode 100644 ace/Message_Block.h delete mode 100644 ace/Message_Block.inl delete mode 100644 ace/Message_Block_T.cpp delete mode 100644 ace/Message_Block_T.h delete mode 100644 ace/Message_Block_T.inl delete mode 100644 ace/Message_Queue.cpp delete mode 100644 ace/Message_Queue.h delete mode 100644 ace/Message_Queue.inl delete mode 100644 ace/Message_Queue_T.cpp delete mode 100644 ace/Message_Queue_T.h delete mode 100644 ace/Method_Object.h delete mode 100644 ace/Method_Request.cpp delete mode 100644 ace/Method_Request.h delete mode 100644 ace/Metrics_Cache.h delete mode 100644 ace/Metrics_Cache_T.cpp delete mode 100644 ace/Metrics_Cache_T.h delete mode 100644 ace/Metrics_Cache_T.inl delete mode 100644 ace/Min_Max.h delete mode 100644 ace/Module.cpp delete mode 100644 ace/Module.h delete mode 100644 ace/Module.inl delete mode 100644 ace/Msg_WFMO_Reactor.cpp delete mode 100644 ace/Msg_WFMO_Reactor.h delete mode 100644 ace/Msg_WFMO_Reactor.inl delete mode 100644 ace/Multihomed_INET_Addr.cpp delete mode 100644 ace/Multihomed_INET_Addr.h delete mode 100644 ace/Multihomed_INET_Addr.inl delete mode 100644 ace/Multiplexor.cpp delete mode 100644 ace/Multiplexor.h delete mode 100644 ace/Multiplexor.inl delete mode 100644 ace/Mutex.cpp delete mode 100644 ace/Mutex.h delete mode 100644 ace/Mutex.inl delete mode 100644 ace/NT_Service.cpp delete mode 100644 ace/NT_Service.h delete mode 100644 ace/NT_Service.inl delete mode 100644 ace/Name_Proxy.cpp delete mode 100644 ace/Name_Proxy.h delete mode 100644 ace/Name_Request_Reply.cpp delete mode 100644 ace/Name_Request_Reply.h delete mode 100644 ace/Name_Space.cpp delete mode 100644 ace/Name_Space.h delete mode 100644 ace/Naming_Context.cpp delete mode 100644 ace/Naming_Context.h delete mode 100644 ace/Netlink_Addr.cpp delete mode 100644 ace/Netlink_Addr.h delete mode 100644 ace/Netlink_Addr.inl delete mode 100644 ace/Node.cpp delete mode 100644 ace/Node.h delete mode 100644 ace/Notification_Strategy.cpp delete mode 100644 ace/Notification_Strategy.h delete mode 100644 ace/Notification_Strategy.inl delete mode 100644 ace/Null_Barrier.h delete mode 100644 ace/Null_Condition.h delete mode 100644 ace/Null_Mutex.h delete mode 100644 ace/Null_Semaphore.h delete mode 100755 ace/Numeric_Limits.h delete mode 100644 ace/OS.cpp delete mode 100644 ace/OS.h delete mode 100644 ace/OS.inl delete mode 100644 ace/OS_Dirent.h delete mode 100644 ace/OS_Errno.cpp delete mode 100644 ace/OS_Errno.h delete mode 100644 ace/OS_Errno.inl delete mode 100644 ace/OS_Log_Msg_Attributes.cpp delete mode 100644 ace/OS_Log_Msg_Attributes.h delete mode 100644 ace/OS_Log_Msg_Attributes.inl delete mode 100644 ace/OS_Memory.h delete mode 100644 ace/OS_NS_Thread.cpp delete mode 100644 ace/OS_NS_Thread.h delete mode 100644 ace/OS_NS_Thread.inl delete mode 100644 ace/OS_NS_arpa_inet.cpp delete mode 100644 ace/OS_NS_arpa_inet.h delete mode 100644 ace/OS_NS_arpa_inet.inl delete mode 100644 ace/OS_NS_ctype.cpp delete mode 100644 ace/OS_NS_ctype.h delete mode 100644 ace/OS_NS_ctype.inl delete mode 100644 ace/OS_NS_dirent.cpp delete mode 100644 ace/OS_NS_dirent.h delete mode 100644 ace/OS_NS_dirent.inl delete mode 100644 ace/OS_NS_dlfcn.cpp delete mode 100644 ace/OS_NS_dlfcn.h delete mode 100644 ace/OS_NS_dlfcn.inl delete mode 100644 ace/OS_NS_errno.cpp delete mode 100644 ace/OS_NS_errno.h delete mode 100644 ace/OS_NS_errno.inl delete mode 100644 ace/OS_NS_fcntl.cpp delete mode 100644 ace/OS_NS_fcntl.h delete mode 100644 ace/OS_NS_fcntl.inl delete mode 100644 ace/OS_NS_macros.h delete mode 100644 ace/OS_NS_math.cpp delete mode 100644 ace/OS_NS_math.h delete mode 100644 ace/OS_NS_math.inl delete mode 100644 ace/OS_NS_netdb.cpp delete mode 100644 ace/OS_NS_netdb.h delete mode 100644 ace/OS_NS_netdb.inl delete mode 100644 ace/OS_NS_poll.cpp delete mode 100644 ace/OS_NS_poll.h delete mode 100644 ace/OS_NS_poll.inl delete mode 100644 ace/OS_NS_pwd.cpp delete mode 100644 ace/OS_NS_pwd.h delete mode 100644 ace/OS_NS_pwd.inl delete mode 100644 ace/OS_NS_regex.cpp delete mode 100644 ace/OS_NS_regex.h delete mode 100644 ace/OS_NS_regex.inl delete mode 100644 ace/OS_NS_signal.cpp delete mode 100644 ace/OS_NS_signal.h delete mode 100644 ace/OS_NS_signal.inl delete mode 100644 ace/OS_NS_stdio.cpp delete mode 100644 ace/OS_NS_stdio.h delete mode 100644 ace/OS_NS_stdio.inl delete mode 100644 ace/OS_NS_stdlib.cpp delete mode 100644 ace/OS_NS_stdlib.h delete mode 100644 ace/OS_NS_stdlib.inl delete mode 100644 ace/OS_NS_string.cpp delete mode 100644 ace/OS_NS_string.h delete mode 100644 ace/OS_NS_string.inl delete mode 100644 ace/OS_NS_strings.cpp delete mode 100644 ace/OS_NS_strings.h delete mode 100644 ace/OS_NS_strings.inl delete mode 100644 ace/OS_NS_stropts.cpp delete mode 100644 ace/OS_NS_stropts.h delete mode 100644 ace/OS_NS_stropts.inl delete mode 100644 ace/OS_NS_sys_mman.cpp delete mode 100644 ace/OS_NS_sys_mman.h delete mode 100644 ace/OS_NS_sys_mman.inl delete mode 100644 ace/OS_NS_sys_msg.cpp delete mode 100644 ace/OS_NS_sys_msg.h delete mode 100644 ace/OS_NS_sys_msg.inl delete mode 100644 ace/OS_NS_sys_resource.cpp delete mode 100644 ace/OS_NS_sys_resource.h delete mode 100644 ace/OS_NS_sys_resource.inl delete mode 100644 ace/OS_NS_sys_select.cpp delete mode 100644 ace/OS_NS_sys_select.h delete mode 100644 ace/OS_NS_sys_select.inl delete mode 100644 ace/OS_NS_sys_sendfile.cpp delete mode 100644 ace/OS_NS_sys_sendfile.h delete mode 100644 ace/OS_NS_sys_sendfile.inl delete mode 100644 ace/OS_NS_sys_shm.cpp delete mode 100644 ace/OS_NS_sys_shm.h delete mode 100644 ace/OS_NS_sys_shm.inl delete mode 100644 ace/OS_NS_sys_socket.cpp delete mode 100644 ace/OS_NS_sys_socket.h delete mode 100644 ace/OS_NS_sys_socket.inl delete mode 100644 ace/OS_NS_sys_stat.cpp delete mode 100644 ace/OS_NS_sys_stat.h delete mode 100644 ace/OS_NS_sys_stat.inl delete mode 100644 ace/OS_NS_sys_time.cpp delete mode 100644 ace/OS_NS_sys_time.h delete mode 100644 ace/OS_NS_sys_time.inl delete mode 100644 ace/OS_NS_sys_uio.cpp delete mode 100644 ace/OS_NS_sys_uio.h delete mode 100644 ace/OS_NS_sys_uio.inl delete mode 100644 ace/OS_NS_sys_utsname.cpp delete mode 100644 ace/OS_NS_sys_utsname.h delete mode 100644 ace/OS_NS_sys_wait.cpp delete mode 100644 ace/OS_NS_sys_wait.h delete mode 100644 ace/OS_NS_sys_wait.inl delete mode 100644 ace/OS_NS_time.cpp delete mode 100644 ace/OS_NS_time.h delete mode 100644 ace/OS_NS_time.inl delete mode 100644 ace/OS_NS_unistd.cpp delete mode 100644 ace/OS_NS_unistd.h delete mode 100644 ace/OS_NS_unistd.inl delete mode 100644 ace/OS_NS_wchar.cpp delete mode 100644 ace/OS_NS_wchar.h delete mode 100644 ace/OS_NS_wchar.inl delete mode 100644 ace/OS_QoS.cpp delete mode 100644 ace/OS_QoS.h delete mode 100644 ace/OS_String.h delete mode 100644 ace/OS_TLI.cpp delete mode 100644 ace/OS_TLI.h delete mode 100644 ace/OS_TLI.inl delete mode 100644 ace/OS_Thread_Adapter.cpp delete mode 100644 ace/OS_Thread_Adapter.h delete mode 100644 ace/OS_main.cpp delete mode 100644 ace/OS_main.h delete mode 100644 ace/Obchunk.cpp delete mode 100644 ace/Obchunk.h delete mode 100644 ace/Obchunk.inl delete mode 100644 ace/Object_Manager.cpp delete mode 100644 ace/Object_Manager.h delete mode 100644 ace/Object_Manager.inl delete mode 100644 ace/Object_Manager_Base.cpp delete mode 100644 ace/Object_Manager_Base.h delete mode 100644 ace/Obstack.h delete mode 100644 ace/Obstack_T.cpp delete mode 100644 ace/Obstack_T.h delete mode 100644 ace/Obstack_T.inl delete mode 100644 ace/PI_Malloc.cpp delete mode 100644 ace/PI_Malloc.h delete mode 100644 ace/PI_Malloc.inl delete mode 100644 ace/POSIX_Asynch_IO.cpp delete mode 100644 ace/POSIX_Asynch_IO.h delete mode 100644 ace/POSIX_CB_Proactor.cpp delete mode 100644 ace/POSIX_CB_Proactor.h delete mode 100644 ace/POSIX_Proactor.cpp delete mode 100644 ace/POSIX_Proactor.h delete mode 100644 ace/POSIX_Proactor.inl delete mode 100644 ace/Pagefile_Memory_Pool.cpp delete mode 100644 ace/Pagefile_Memory_Pool.h delete mode 100644 ace/Pagefile_Memory_Pool.inl delete mode 100644 ace/Pair.h delete mode 100644 ace/Pair_T.cpp delete mode 100644 ace/Pair_T.h delete mode 100644 ace/Pair_T.inl delete mode 100644 ace/Parse_Node.cpp delete mode 100644 ace/Parse_Node.h delete mode 100644 ace/Ping_Socket.cpp delete mode 100644 ace/Ping_Socket.h delete mode 100644 ace/Ping_Socket.inl delete mode 100644 ace/Pipe.cpp delete mode 100644 ace/Pipe.h delete mode 100644 ace/Pipe.inl delete mode 100644 ace/Priority_Reactor.cpp delete mode 100644 ace/Priority_Reactor.h delete mode 100644 ace/Proactor.cpp delete mode 100644 ace/Proactor.h delete mode 100644 ace/Proactor.inl delete mode 100644 ace/Proactor_Impl.cpp delete mode 100644 ace/Proactor_Impl.h delete mode 100644 ace/Process.cpp delete mode 100644 ace/Process.h delete mode 100644 ace/Process.inl delete mode 100644 ace/Process_Manager.cpp delete mode 100644 ace/Process_Manager.h delete mode 100644 ace/Process_Manager.inl delete mode 100644 ace/Process_Mutex.cpp delete mode 100644 ace/Process_Mutex.h delete mode 100644 ace/Process_Mutex.inl delete mode 100644 ace/Process_Semaphore.cpp delete mode 100644 ace/Process_Semaphore.h delete mode 100644 ace/Process_Semaphore.inl delete mode 100644 ace/Profile_Timer.cpp delete mode 100644 ace/Profile_Timer.h delete mode 100644 ace/Profile_Timer.inl delete mode 100644 ace/QoS/ACE_QoS.pc.in delete mode 100644 ace/QoS/ACE_QoS_Export.h delete mode 100644 ace/QoS/Makefile.am delete mode 100644 ace/QoS/QoS_Decorator.cpp delete mode 100644 ace/QoS/QoS_Decorator.h delete mode 100644 ace/QoS/QoS_Manager.cpp delete mode 100644 ace/QoS/QoS_Manager.h delete mode 100644 ace/QoS/QoS_Session.h delete mode 100644 ace/QoS/QoS_Session_Factory.cpp delete mode 100644 ace/QoS/QoS_Session_Factory.h delete mode 100644 ace/QoS/QoS_Session_Impl.cpp delete mode 100644 ace/QoS/QoS_Session_Impl.h delete mode 100644 ace/QoS/QoS_Session_Impl.i delete mode 100644 ace/QoS/README delete mode 100644 ace/QoS/SOCK_Dgram_Mcast_QoS.cpp delete mode 100644 ace/QoS/SOCK_Dgram_Mcast_QoS.h delete mode 100644 ace/QoS/SOCK_Dgram_Mcast_QoS.i delete mode 100644 ace/QoS/qos.mpc delete mode 100644 ace/QtReactor.cpp delete mode 100644 ace/QtReactor.h delete mode 100644 ace/RB_Tree.cpp delete mode 100644 ace/RB_Tree.h delete mode 100644 ace/RB_Tree.inl delete mode 100644 ace/README delete mode 100644 ace/RW_Mutex.cpp delete mode 100644 ace/RW_Mutex.h delete mode 100644 ace/RW_Mutex.inl delete mode 100644 ace/RW_Process_Mutex.cpp delete mode 100644 ace/RW_Process_Mutex.h delete mode 100644 ace/RW_Process_Mutex.inl delete mode 100644 ace/RW_Thread_Mutex.cpp delete mode 100644 ace/RW_Thread_Mutex.h delete mode 100644 ace/RW_Thread_Mutex.inl delete mode 100644 ace/Reactor.cpp delete mode 100644 ace/Reactor.h delete mode 100644 ace/Reactor.inl delete mode 100644 ace/Reactor_Impl.cpp delete mode 100644 ace/Reactor_Impl.h delete mode 100644 ace/Reactor_Notification_Strategy.cpp delete mode 100644 ace/Reactor_Notification_Strategy.h delete mode 100644 ace/Reactor_Notification_Strategy.inl delete mode 100644 ace/Reactor_Timer_Interface.cpp delete mode 100644 ace/Reactor_Timer_Interface.h delete mode 100644 ace/Reactor_Token_T.cpp delete mode 100644 ace/Reactor_Token_T.h delete mode 100644 ace/Read_Buffer.cpp delete mode 100644 ace/Read_Buffer.h delete mode 100644 ace/Read_Buffer.inl delete mode 100644 ace/Recursive_Thread_Mutex.cpp delete mode 100644 ace/Recursive_Thread_Mutex.h delete mode 100644 ace/Recursive_Thread_Mutex.inl delete mode 100644 ace/Recyclable.cpp delete mode 100644 ace/Recyclable.h delete mode 100644 ace/Recyclable.inl delete mode 100644 ace/Refcountable.cpp delete mode 100644 ace/Refcountable.h delete mode 100644 ace/Refcountable.inl delete mode 100644 ace/Refcounted_Auto_Ptr.cpp delete mode 100644 ace/Refcounted_Auto_Ptr.h delete mode 100644 ace/Refcounted_Auto_Ptr.inl delete mode 100644 ace/Registry.cpp delete mode 100644 ace/Registry.h delete mode 100644 ace/Registry_Name_Space.cpp delete mode 100644 ace/Registry_Name_Space.h delete mode 100644 ace/Remote_Name_Space.cpp delete mode 100644 ace/Remote_Name_Space.h delete mode 100644 ace/Remote_Tokens.cpp delete mode 100644 ace/Remote_Tokens.h delete mode 100644 ace/Remote_Tokens.inl delete mode 100644 ace/Reverse_Lock_T.cpp delete mode 100644 ace/Reverse_Lock_T.h delete mode 100644 ace/Reverse_Lock_T.inl delete mode 100644 ace/SOCK.cpp delete mode 100644 ace/SOCK.h delete mode 100644 ace/SOCK.inl delete mode 100644 ace/SOCK_Acceptor.cpp delete mode 100644 ace/SOCK_Acceptor.h delete mode 100644 ace/SOCK_Acceptor.inl delete mode 100644 ace/SOCK_CODgram.cpp delete mode 100644 ace/SOCK_CODgram.h delete mode 100644 ace/SOCK_CODgram.inl delete mode 100644 ace/SOCK_Connector.cpp delete mode 100644 ace/SOCK_Connector.h delete mode 100644 ace/SOCK_Connector.inl delete mode 100644 ace/SOCK_Dgram.cpp delete mode 100644 ace/SOCK_Dgram.h delete mode 100644 ace/SOCK_Dgram.inl delete mode 100644 ace/SOCK_Dgram_Bcast.cpp delete mode 100644 ace/SOCK_Dgram_Bcast.h delete mode 100644 ace/SOCK_Dgram_Bcast.inl delete mode 100644 ace/SOCK_Dgram_Mcast.cpp delete mode 100644 ace/SOCK_Dgram_Mcast.h delete mode 100644 ace/SOCK_Dgram_Mcast.inl delete mode 100644 ace/SOCK_IO.cpp delete mode 100644 ace/SOCK_IO.h delete mode 100644 ace/SOCK_IO.inl delete mode 100644 ace/SOCK_Netlink.cpp delete mode 100644 ace/SOCK_Netlink.h delete mode 100644 ace/SOCK_Netlink.inl delete mode 100644 ace/SOCK_SEQPACK_Acceptor.cpp delete mode 100644 ace/SOCK_SEQPACK_Acceptor.h delete mode 100644 ace/SOCK_SEQPACK_Acceptor.inl delete mode 100644 ace/SOCK_SEQPACK_Association.cpp delete mode 100644 ace/SOCK_SEQPACK_Association.h delete mode 100644 ace/SOCK_SEQPACK_Association.inl delete mode 100644 ace/SOCK_SEQPACK_Connector.cpp delete mode 100644 ace/SOCK_SEQPACK_Connector.h delete mode 100644 ace/SOCK_SEQPACK_Connector.inl delete mode 100644 ace/SOCK_Stream.cpp delete mode 100644 ace/SOCK_Stream.h delete mode 100644 ace/SOCK_Stream.inl delete mode 100644 ace/SPIPE.cpp delete mode 100644 ace/SPIPE.h delete mode 100644 ace/SPIPE.inl delete mode 100644 ace/SPIPE_Acceptor.cpp delete mode 100644 ace/SPIPE_Acceptor.h delete mode 100644 ace/SPIPE_Addr.cpp delete mode 100644 ace/SPIPE_Addr.h delete mode 100644 ace/SPIPE_Addr.inl delete mode 100644 ace/SPIPE_Connector.cpp delete mode 100644 ace/SPIPE_Connector.h delete mode 100644 ace/SPIPE_Connector.inl delete mode 100644 ace/SPIPE_Stream.cpp delete mode 100644 ace/SPIPE_Stream.h delete mode 100644 ace/SPIPE_Stream.inl delete mode 100644 ace/SSL/ACE_SSL.pc.in delete mode 100644 ace/SSL/Makefile.am delete mode 100644 ace/SSL/SSL_Asynch_BIO.cpp delete mode 100644 ace/SSL/SSL_Asynch_BIO.h delete mode 100644 ace/SSL/SSL_Asynch_Stream.cpp delete mode 100644 ace/SSL/SSL_Asynch_Stream.h delete mode 100644 ace/SSL/SSL_Context.cpp delete mode 100644 ace/SSL/SSL_Context.h delete mode 100644 ace/SSL/SSL_Context.inl delete mode 100644 ace/SSL/SSL_Export.h delete mode 100644 ace/SSL/SSL_SOCK.cpp delete mode 100644 ace/SSL/SSL_SOCK.h delete mode 100644 ace/SSL/SSL_SOCK.i delete mode 100644 ace/SSL/SSL_SOCK_Acceptor.cpp delete mode 100644 ace/SSL/SSL_SOCK_Acceptor.h delete mode 100644 ace/SSL/SSL_SOCK_Acceptor.i delete mode 100644 ace/SSL/SSL_SOCK_Connector.cpp delete mode 100644 ace/SSL/SSL_SOCK_Connector.h delete mode 100644 ace/SSL/SSL_SOCK_Connector.i delete mode 100644 ace/SSL/SSL_SOCK_Stream.cpp delete mode 100644 ace/SSL/SSL_SOCK_Stream.h delete mode 100644 ace/SSL/SSL_SOCK_Stream.i delete mode 100644 ace/SSL/ssl.mpc delete mode 100644 ace/SSL/sslconf.h delete mode 100644 ace/SString.cpp delete mode 100644 ace/SString.h delete mode 100644 ace/SString.inl delete mode 100644 ace/SStringfwd.h delete mode 100644 ace/SUN_Proactor.cpp delete mode 100644 ace/SUN_Proactor.h delete mode 100644 ace/SV_Message.cpp delete mode 100644 ace/SV_Message.h delete mode 100644 ace/SV_Message.inl delete mode 100644 ace/SV_Message_Queue.cpp delete mode 100644 ace/SV_Message_Queue.h delete mode 100644 ace/SV_Message_Queue.inl delete mode 100644 ace/SV_Semaphore_Complex.cpp delete mode 100644 ace/SV_Semaphore_Complex.h delete mode 100644 ace/SV_Semaphore_Complex.inl delete mode 100644 ace/SV_Semaphore_Simple.cpp delete mode 100644 ace/SV_Semaphore_Simple.h delete mode 100644 ace/SV_Semaphore_Simple.inl delete mode 100644 ace/SV_Shared_Memory.cpp delete mode 100644 ace/SV_Shared_Memory.h delete mode 100644 ace/SV_Shared_Memory.inl delete mode 100644 ace/Sample_History.cpp delete mode 100644 ace/Sample_History.h delete mode 100644 ace/Sample_History.inl delete mode 100644 ace/Sbrk_Memory_Pool.cpp delete mode 100644 ace/Sbrk_Memory_Pool.h delete mode 100644 ace/Sched_Params.cpp delete mode 100644 ace/Sched_Params.h delete mode 100644 ace/Sched_Params.inl delete mode 100644 ace/Select_Reactor.h delete mode 100644 ace/Select_Reactor_Base.cpp delete mode 100644 ace/Select_Reactor_Base.h delete mode 100644 ace/Select_Reactor_Base.inl delete mode 100644 ace/Select_Reactor_T.cpp delete mode 100644 ace/Select_Reactor_T.h delete mode 100644 ace/Select_Reactor_T.inl delete mode 100644 ace/Semaphore.cpp delete mode 100644 ace/Semaphore.h delete mode 100644 ace/Semaphore.inl delete mode 100644 ace/Service_Config.cpp delete mode 100644 ace/Service_Config.h delete mode 100644 ace/Service_Config.inl delete mode 100644 ace/Service_Gestalt.cpp delete mode 100644 ace/Service_Gestalt.h delete mode 100644 ace/Service_Gestalt.inl delete mode 100644 ace/Service_Manager.cpp delete mode 100644 ace/Service_Manager.h delete mode 100644 ace/Service_Object.cpp delete mode 100644 ace/Service_Object.h delete mode 100644 ace/Service_Object.inl delete mode 100644 ace/Service_Repository.cpp delete mode 100644 ace/Service_Repository.h delete mode 100644 ace/Service_Repository.inl delete mode 100644 ace/Service_Templates.h delete mode 100644 ace/Service_Types.cpp delete mode 100644 ace/Service_Types.h delete mode 100644 ace/Service_Types.inl delete mode 100644 ace/Shared_Memory.cpp delete mode 100644 ace/Shared_Memory.h delete mode 100644 ace/Shared_Memory_MM.cpp delete mode 100644 ace/Shared_Memory_MM.h delete mode 100644 ace/Shared_Memory_MM.inl delete mode 100644 ace/Shared_Memory_Pool.cpp delete mode 100644 ace/Shared_Memory_Pool.h delete mode 100644 ace/Shared_Memory_SV.cpp delete mode 100644 ace/Shared_Memory_SV.h delete mode 100644 ace/Shared_Memory_SV.inl delete mode 100644 ace/Shared_Object.cpp delete mode 100644 ace/Shared_Object.h delete mode 100644 ace/Shared_Object.inl delete mode 100644 ace/Sig_Adapter.cpp delete mode 100644 ace/Sig_Adapter.h delete mode 100644 ace/Sig_Handler.cpp delete mode 100644 ace/Sig_Handler.h delete mode 100644 ace/Sig_Handler.inl delete mode 100644 ace/Signal.cpp delete mode 100644 ace/Signal.h delete mode 100644 ace/Signal.inl delete mode 100644 ace/Singleton.cpp delete mode 100644 ace/Singleton.h delete mode 100644 ace/Singleton.inl delete mode 100644 ace/Sock_Connect.cpp delete mode 100644 ace/Sock_Connect.h delete mode 100644 ace/Static_Object_Lock.h delete mode 100644 ace/Stats.cpp delete mode 100644 ace/Stats.h delete mode 100644 ace/Stats.inl delete mode 100644 ace/Strategies.h delete mode 100644 ace/Strategies_T.cpp delete mode 100644 ace/Strategies_T.h delete mode 100644 ace/Strategies_T.inl delete mode 100644 ace/Stream.cpp delete mode 100644 ace/Stream.h delete mode 100644 ace/Stream.inl delete mode 100644 ace/Stream_Modules.cpp delete mode 100644 ace/Stream_Modules.h delete mode 100644 ace/String_Base.cpp delete mode 100644 ace/String_Base.h delete mode 100644 ace/String_Base.inl delete mode 100644 ace/String_Base_Const.cpp delete mode 100644 ace/String_Base_Const.h delete mode 100644 ace/Svc_Conf.h delete mode 100644 ace/Svc_Conf.y delete mode 100644 ace/Svc_Conf_Lexer.cpp delete mode 100644 ace/Svc_Conf_Lexer.h delete mode 100644 ace/Svc_Conf_Param.h delete mode 100644 ace/Svc_Conf_Tokens.h delete mode 100644 ace/Svc_Conf_y.cpp delete mode 100644 ace/Svc_Handler.cpp delete mode 100644 ace/Svc_Handler.h delete mode 100644 ace/Swap.cpp delete mode 100644 ace/Swap.h delete mode 100644 ace/Swap.inl delete mode 100644 ace/Synch.h delete mode 100644 ace/Synch_Options.cpp delete mode 100644 ace/Synch_Options.h delete mode 100644 ace/Synch_T.cpp delete mode 100644 ace/Synch_T.h delete mode 100644 ace/Synch_Traits.h delete mode 100644 ace/System_Time.cpp delete mode 100644 ace/System_Time.h delete mode 100644 ace/TLI.cpp delete mode 100644 ace/TLI.h delete mode 100644 ace/TLI.inl delete mode 100644 ace/TLI_Acceptor.cpp delete mode 100644 ace/TLI_Acceptor.h delete mode 100644 ace/TLI_Connector.cpp delete mode 100644 ace/TLI_Connector.h delete mode 100644 ace/TLI_Connector.inl delete mode 100644 ace/TLI_Stream.cpp delete mode 100644 ace/TLI_Stream.h delete mode 100644 ace/TLI_Stream.inl delete mode 100644 ace/TP_Reactor.cpp delete mode 100644 ace/TP_Reactor.h delete mode 100644 ace/TP_Reactor.inl delete mode 100644 ace/TSS_Adapter.cpp delete mode 100644 ace/TSS_Adapter.h delete mode 100644 ace/TSS_T.cpp delete mode 100644 ace/TSS_T.h delete mode 100644 ace/TSS_T.inl delete mode 100644 ace/TTY_IO.cpp delete mode 100644 ace/TTY_IO.h delete mode 100644 ace/Task.cpp delete mode 100644 ace/Task.h delete mode 100644 ace/Task.inl delete mode 100644 ace/Task_Ex_T.cpp delete mode 100644 ace/Task_Ex_T.h delete mode 100644 ace/Task_Ex_T.inl delete mode 100644 ace/Task_T.cpp delete mode 100644 ace/Task_T.h delete mode 100644 ace/Task_T.inl delete mode 100644 ace/Test_and_Set.cpp delete mode 100644 ace/Test_and_Set.h delete mode 100644 ace/Thread.cpp delete mode 100644 ace/Thread.h delete mode 100644 ace/Thread.inl delete mode 100644 ace/Thread_Adapter.cpp delete mode 100644 ace/Thread_Adapter.h delete mode 100644 ace/Thread_Adapter.inl delete mode 100644 ace/Thread_Control.cpp delete mode 100644 ace/Thread_Control.h delete mode 100644 ace/Thread_Control.inl delete mode 100644 ace/Thread_Exit.cpp delete mode 100644 ace/Thread_Exit.h delete mode 100644 ace/Thread_Hook.cpp delete mode 100644 ace/Thread_Hook.h delete mode 100644 ace/Thread_Manager.cpp delete mode 100644 ace/Thread_Manager.h delete mode 100644 ace/Thread_Manager.inl delete mode 100644 ace/Thread_Mutex.cpp delete mode 100644 ace/Thread_Mutex.h delete mode 100644 ace/Thread_Mutex.inl delete mode 100644 ace/Thread_Semaphore.cpp delete mode 100644 ace/Thread_Semaphore.h delete mode 100644 ace/Thread_Semaphore.inl delete mode 100644 ace/Time_Request_Reply.cpp delete mode 100644 ace/Time_Request_Reply.h delete mode 100644 ace/Time_Value.cpp delete mode 100644 ace/Time_Value.h delete mode 100644 ace/Time_Value.inl delete mode 100644 ace/Timeprobe.cpp delete mode 100644 ace/Timeprobe.h delete mode 100644 ace/Timeprobe.inl delete mode 100644 ace/Timeprobe_T.cpp delete mode 100644 ace/Timeprobe_T.h delete mode 100644 ace/Timer_Hash.cpp delete mode 100644 ace/Timer_Hash.h delete mode 100644 ace/Timer_Hash_T.cpp delete mode 100644 ace/Timer_Hash_T.h delete mode 100644 ace/Timer_Heap.cpp delete mode 100644 ace/Timer_Heap.h delete mode 100644 ace/Timer_Heap_T.cpp delete mode 100644 ace/Timer_Heap_T.h delete mode 100644 ace/Timer_List.cpp delete mode 100644 ace/Timer_List.h delete mode 100644 ace/Timer_List_T.cpp delete mode 100644 ace/Timer_List_T.h delete mode 100644 ace/Timer_Queue.cpp delete mode 100644 ace/Timer_Queue.h delete mode 100644 ace/Timer_Queue_Adapters.cpp delete mode 100644 ace/Timer_Queue_Adapters.h delete mode 100644 ace/Timer_Queue_Adapters.inl delete mode 100644 ace/Timer_Queue_T.cpp delete mode 100644 ace/Timer_Queue_T.h delete mode 100644 ace/Timer_Queue_T.inl delete mode 100644 ace/Timer_Queuefwd.h delete mode 100644 ace/Timer_Wheel.cpp delete mode 100644 ace/Timer_Wheel.h delete mode 100644 ace/Timer_Wheel_T.cpp delete mode 100644 ace/Timer_Wheel_T.h delete mode 100644 ace/TkReactor.cpp delete mode 100644 ace/TkReactor.h delete mode 100644 ace/Token.cpp delete mode 100644 ace/Token.h delete mode 100644 ace/Token.inl delete mode 100644 ace/Token_Collection.cpp delete mode 100644 ace/Token_Collection.h delete mode 100644 ace/Token_Collection.inl delete mode 100644 ace/Token_Invariants.cpp delete mode 100644 ace/Token_Invariants.h delete mode 100644 ace/Token_Manager.cpp delete mode 100644 ace/Token_Manager.h delete mode 100644 ace/Token_Manager.inl delete mode 100644 ace/Token_Request_Reply.cpp delete mode 100644 ace/Token_Request_Reply.h delete mode 100644 ace/Token_Request_Reply.inl delete mode 100644 ace/Trace.cpp delete mode 100644 ace/Trace.h delete mode 100644 ace/Truncate.h delete mode 100644 ace/Typed_SV_Message.cpp delete mode 100644 ace/Typed_SV_Message.h delete mode 100644 ace/Typed_SV_Message.inl delete mode 100644 ace/Typed_SV_Message_Queue.cpp delete mode 100644 ace/Typed_SV_Message_Queue.h delete mode 100644 ace/Typed_SV_Message_Queue.inl delete mode 100644 ace/UNIX_Addr.cpp delete mode 100644 ace/UNIX_Addr.h delete mode 100644 ace/UNIX_Addr.inl delete mode 100644 ace/UPIPE_Acceptor.cpp delete mode 100644 ace/UPIPE_Acceptor.h delete mode 100644 ace/UPIPE_Acceptor.inl delete mode 100644 ace/UPIPE_Addr.h delete mode 100644 ace/UPIPE_Connector.cpp delete mode 100644 ace/UPIPE_Connector.h delete mode 100644 ace/UPIPE_Connector.inl delete mode 100644 ace/UPIPE_Stream.cpp delete mode 100644 ace/UPIPE_Stream.h delete mode 100644 ace/UPIPE_Stream.inl delete mode 100644 ace/UTF16_Encoding_Converter.cpp delete mode 100644 ace/UTF16_Encoding_Converter.h delete mode 100644 ace/UTF16_Encoding_Converter.inl delete mode 100644 ace/UTF32_Encoding_Converter.cpp delete mode 100644 ace/UTF32_Encoding_Converter.h delete mode 100644 ace/UTF8_Encoding_Converter.cpp delete mode 100644 ace/UTF8_Encoding_Converter.h delete mode 100644 ace/UUID.cpp delete mode 100644 ace/UUID.h delete mode 100644 ace/UUID.inl delete mode 100644 ace/Unbounded_Queue.cpp delete mode 100644 ace/Unbounded_Queue.h delete mode 100644 ace/Unbounded_Queue.inl delete mode 100644 ace/Unbounded_Set.cpp delete mode 100644 ace/Unbounded_Set.h delete mode 100644 ace/Unbounded_Set.inl delete mode 100644 ace/Value_Ptr.h delete mode 100644 ace/Vector_T.cpp delete mode 100644 ace/Vector_T.h delete mode 100644 ace/Vector_T.inl delete mode 100644 ace/Version.h delete mode 100644 ace/Versioned_Namespace.h delete mode 100644 ace/WFMO_Reactor.cpp delete mode 100644 ace/WFMO_Reactor.h delete mode 100644 ace/WFMO_Reactor.inl delete mode 100644 ace/WIN32_Asynch_IO.cpp delete mode 100644 ace/WIN32_Asynch_IO.h delete mode 100644 ace/WIN32_Proactor.cpp delete mode 100644 ace/WIN32_Proactor.h delete mode 100644 ace/XML_Svc_Conf.cpp delete mode 100644 ace/XML_Svc_Conf.h delete mode 100644 ace/XTI_ATM_Mcast.cpp delete mode 100644 ace/XTI_ATM_Mcast.h delete mode 100644 ace/XTI_ATM_Mcast.inl delete mode 100644 ace/XtReactor.cpp delete mode 100644 ace/XtReactor.h delete mode 100644 ace/ace.mpc delete mode 100644 ace/ace.mwc delete mode 100644 ace/ace.rc delete mode 100644 ace/ace_ce_dll.cfg delete mode 100644 ace/ace_flreactor.mpc delete mode 100644 ace/ace_for_tao.mpc delete mode 100644 ace/ace_message_table.bin delete mode 100644 ace/ace_qtreactor.mpc delete mode 100644 ace/ace_tkreactor.mpc delete mode 100644 ace/ace_wchar.h delete mode 100644 ace/ace_wchar.inl delete mode 100644 ace/ace_xtreactor.mpc delete mode 100644 ace/codecs.mpb delete mode 100644 ace/config-WinCE.h delete mode 100644 ace/config-aix-4.1.x.h delete mode 100644 ace/config-aix-4.2.x.h delete mode 100644 ace/config-aix-4.3.x.h delete mode 100644 ace/config-aix-4.x.h delete mode 100644 ace/config-aix-5.x.h delete mode 100644 ace/config-all.h delete mode 100644 ace/config-borland-common.h delete mode 100644 ace/config-cray.h delete mode 100644 ace/config-cxx-common.h delete mode 100644 ace/config-cygwin32.h delete mode 100644 ace/config-dgux-4.11-epc.h delete mode 100644 ace/config-dgux-4.x-ghs.h delete mode 100644 ace/config-doxygen.h delete mode 100644 ace/config-freebsd.h delete mode 100644 ace/config-g++-common.h delete mode 100644 ace/config-ghs-common.h delete mode 100644 ace/config-hpux-11.00.h delete mode 100644 ace/config-icc-common.h delete mode 100644 ace/config-integritySCA.h delete mode 100644 ace/config-irix5.2.h delete mode 100644 ace/config-irix5.3-g++.h delete mode 100644 ace/config-irix5.3-sgic++.h delete mode 100644 ace/config-irix6.5.x-sgic++.h delete mode 100644 ace/config-irix6.x-common.h delete mode 100644 ace/config-irix6.x-g++.h delete mode 100644 ace/config-irix6.x-sgic++-nothreads.h delete mode 100644 ace/config-irix6.x-sgic++.h delete mode 100644 ace/config-linux-common.h delete mode 100644 ace/config-linux.h delete mode 100644 ace/config-lite.h delete mode 100644 ace/config-lynxos.h delete mode 100644 ace/config-m88k.h delete mode 100644 ace/config-macosx-panther.h delete mode 100644 ace/config-macosx-tiger.h delete mode 100644 ace/config-macosx.h delete mode 100644 ace/config-macros.h delete mode 100644 ace/config-minimal.h delete mode 100644 ace/config-mit-pthread.h delete mode 100644 ace/config-mklinux.h delete mode 100644 ace/config-mvs.h delete mode 100644 ace/config-netbsd.h delete mode 100644 ace/config-openbsd.h delete mode 100644 ace/config-openvms.h delete mode 100644 ace/config-pharlap.h delete mode 100644 ace/config-posix.h delete mode 100644 ace/config-qnx-neutrino.h delete mode 100644 ace/config-qnx-rtp-62x.h delete mode 100644 ace/config-qnx-rtp-common.h delete mode 100644 ace/config-qnx-rtp-pre62x.h delete mode 100644 ace/config-qnx-rtp.h delete mode 100644 ace/config-rtems.h delete mode 100644 ace/config-sco-4.2-nothread.h delete mode 100644 ace/config-sco-5.0.0-fsu-pthread.h delete mode 100644 ace/config-sco-5.0.0-mit-pthread.h delete mode 100644 ace/config-sco-5.0.0-nothread.h delete mode 100644 ace/config-sco-5.0.0.h delete mode 100644 ace/config-suncc-common.h delete mode 100644 ace/config-sunos4-g++.h delete mode 100644 ace/config-sunos4-lucid3.2.h delete mode 100644 ace/config-sunos4-sun3.x.h delete mode 100644 ace/config-sunos4-sun4.1.4.h delete mode 100644 ace/config-sunos4-sun4.x.h delete mode 100644 ace/config-sunos5.10.h delete mode 100644 ace/config-sunos5.4-centerline-2.x.h delete mode 100644 ace/config-sunos5.4-g++.h delete mode 100644 ace/config-sunos5.4-sunc++-4.x.h delete mode 100644 ace/config-sunos5.5.h delete mode 100644 ace/config-sunos5.6.h delete mode 100644 ace/config-sunos5.7.h delete mode 100644 ace/config-sunos5.8.h delete mode 100644 ace/config-sunos5.9.h delete mode 100644 ace/config-tandem-nsk-mips-v2.h delete mode 100644 ace/config-tandem-nsk-mips-v3.h delete mode 100644 ace/config-tandem.h delete mode 100644 ace/config-tru64.h delete mode 100644 ace/config-unixware-2.01-g++.h delete mode 100644 ace/config-unixware-2.1.2-g++.h delete mode 100644 ace/config-unixware-7.1.0.h delete mode 100644 ace/config-unixware-7.1.0.udk.h delete mode 100644 ace/config-visualage.h delete mode 100644 ace/config-vxworks5.x.h delete mode 100644 ace/config-vxworks6.2.h delete mode 100644 ace/config-vxworks6.3.h delete mode 100644 ace/config-win32-borland.h delete mode 100644 ace/config-win32-common.h delete mode 100644 ace/config-win32-dmc.h delete mode 100644 ace/config-win32-ghs.h delete mode 100644 ace/config-win32-interix.h delete mode 100644 ace/config-win32-mingw.h delete mode 100644 ace/config-win32-msvc-7.h delete mode 100644 ace/config-win32-msvc-8.h delete mode 100644 ace/config-win32-msvc.h delete mode 100644 ace/config-win32-visualage.h delete mode 100644 ace/config-win32.h delete mode 100644 ace/filecache.mpb delete mode 100644 ace/gethrtime.cpp delete mode 100644 ace/iosfwd.h delete mode 100644 ace/os_include/arpa/os_inet.h delete mode 100644 ace/os_include/net/os_if.h delete mode 100644 ace/os_include/netinet/os_in.h delete mode 100644 ace/os_include/netinet/os_tcp.h delete mode 100644 ace/os_include/os_aio.h delete mode 100644 ace/os_include/os_assert.h delete mode 100644 ace/os_include/os_complex.h delete mode 100644 ace/os_include/os_cpio.h delete mode 100644 ace/os_include/os_ctype.h delete mode 100644 ace/os_include/os_dirent.h delete mode 100644 ace/os_include/os_dlfcn.h delete mode 100644 ace/os_include/os_errno.h delete mode 100644 ace/os_include/os_fcntl.h delete mode 100644 ace/os_include/os_fenv.h delete mode 100644 ace/os_include/os_float.h delete mode 100644 ace/os_include/os_fmtmsg.h delete mode 100644 ace/os_include/os_fnmatch.h delete mode 100644 ace/os_include/os_ftw.h delete mode 100644 ace/os_include/os_glob.h delete mode 100644 ace/os_include/os_grp.h delete mode 100644 ace/os_include/os_iconv.h delete mode 100644 ace/os_include/os_inttypes.h delete mode 100644 ace/os_include/os_iso646.h delete mode 100644 ace/os_include/os_langinfo.h delete mode 100644 ace/os_include/os_libgen.h delete mode 100644 ace/os_include/os_limits.h delete mode 100644 ace/os_include/os_local.h delete mode 100644 ace/os_include/os_math.h delete mode 100644 ace/os_include/os_monetary.h delete mode 100644 ace/os_include/os_mqueue.h delete mode 100644 ace/os_include/os_ndbm.h delete mode 100644 ace/os_include/os_netdb.h delete mode 100644 ace/os_include/os_nl_types.h delete mode 100644 ace/os_include/os_poll.h delete mode 100644 ace/os_include/os_pthread.h delete mode 100644 ace/os_include/os_pwd.h delete mode 100644 ace/os_include/os_regex.h delete mode 100644 ace/os_include/os_sched.h delete mode 100644 ace/os_include/os_search.h delete mode 100644 ace/os_include/os_semaphore.h delete mode 100644 ace/os_include/os_setjmp.h delete mode 100644 ace/os_include/os_signal.h delete mode 100644 ace/os_include/os_spawn.h delete mode 100644 ace/os_include/os_stdarg.h delete mode 100644 ace/os_include/os_stdbool.h delete mode 100644 ace/os_include/os_stddef.h delete mode 100644 ace/os_include/os_stdint.h delete mode 100644 ace/os_include/os_stdio.h delete mode 100644 ace/os_include/os_stdlib.h delete mode 100644 ace/os_include/os_string.h delete mode 100644 ace/os_include/os_strings.h delete mode 100644 ace/os_include/os_stropts.h delete mode 100644 ace/os_include/os_syslog.h delete mode 100644 ace/os_include/os_tar.h delete mode 100644 ace/os_include/os_termios.h delete mode 100644 ace/os_include/os_tgmath.h delete mode 100644 ace/os_include/os_time.h delete mode 100644 ace/os_include/os_trace.h delete mode 100644 ace/os_include/os_ucontext.h delete mode 100644 ace/os_include/os_ulimit.h delete mode 100644 ace/os_include/os_unistd.h delete mode 100644 ace/os_include/os_utime.h delete mode 100644 ace/os_include/os_utmpx.h delete mode 100644 ace/os_include/os_wchar.h delete mode 100644 ace/os_include/os_wctype.h delete mode 100644 ace/os_include/os_wordexp.h delete mode 100644 ace/os_include/sys/os_ipc.h delete mode 100644 ace/os_include/sys/os_loadavg.h delete mode 100644 ace/os_include/sys/os_mman.h delete mode 100644 ace/os_include/sys/os_msg.h delete mode 100644 ace/os_include/sys/os_pstat.h delete mode 100644 ace/os_include/sys/os_resource.h delete mode 100644 ace/os_include/sys/os_select.h delete mode 100644 ace/os_include/sys/os_sem.h delete mode 100644 ace/os_include/sys/os_shm.h delete mode 100644 ace/os_include/sys/os_socket.h delete mode 100644 ace/os_include/sys/os_stat.h delete mode 100644 ace/os_include/sys/os_statvfs.h delete mode 100644 ace/os_include/sys/os_sysctl.h delete mode 100644 ace/os_include/sys/os_time.h delete mode 100644 ace/os_include/sys/os_timeb.h delete mode 100644 ace/os_include/sys/os_times.h delete mode 100644 ace/os_include/sys/os_types.h delete mode 100644 ace/os_include/sys/os_uio.h delete mode 100644 ace/os_include/sys/os_un.h delete mode 100644 ace/os_include/sys/os_utsname.h delete mode 100644 ace/os_include/sys/os_wait.h delete mode 100644 ace/other.mpb delete mode 100644 ace/post.h delete mode 100644 ace/pre.h delete mode 100644 ace/streams.h delete mode 100644 ace/svc_export.h delete mode 100644 ace/svcconf.mpb delete mode 100644 ace/token.mpb delete mode 100644 ace/uuid.mpb (limited to 'ace') diff --git a/ace/.cvsignore b/ace/.cvsignore deleted file mode 100644 index 89227cc8b5d..00000000000 --- a/ace/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -QtReactor_moc.cpp -QtReactor_moc.cpp diff --git a/ace/ACE.cpp b/ace/ACE.cpp deleted file mode 100644 index 5367e60018d..00000000000 --- a/ace/ACE.cpp +++ /dev/null @@ -1,3497 +0,0 @@ -// $Id$ - -#include "ace/ACE.h" - -#include "ace/Basic_Types.h" -#include "ace/Handle_Set.h" -#include "ace/Auto_Ptr.h" -#include "ace/SString.h" -#include "ace/Version.h" -#include "ace/Message_Block.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_select.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_strings.h" -#include "ace/OS_NS_signal.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_sys_resource.h" -#include "ace/OS_NS_sys_wait.h" -#include "ace/OS_NS_sys_time.h" -#include "ace/OS_NS_time.h" -#include "ace/OS_NS_sys_uio.h" -#include "ace/OS_NS_sys_stat.h" -#include "ace/OS_NS_ctype.h" -#include "ace/OS_TLI.h" - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -extern "C" int maxFiles; -#endif /* ACE_VXWORKS */ - -#if !defined (__ACE_INLINE__) -#include "ace/ACE.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) -# include "ace/OS_NS_poll.h" -#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ - - -ACE_RCSID (ace, - ACE, - "$Id$") - - -// Open versioned namespace, if enabled by the user. - ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE -{ - // private: - // Used internally so not exported. - - // Size of allocation granularity. - size_t allocation_granularity_ = 0; - - // Size of a VM page. - size_t pagesize_ = 0; - - // Are we debugging ACE? - // Keeps track of whether we're in some global debug mode. - char debug_; -} - - -int -ACE::out_of_handles (int error) -{ - // EMFILE is common to all platforms. - if (error == EMFILE || -#if defined (ACE_WIN32) - // On Win32, we need to check for ENOBUFS also. - error == ENOBUFS || -#elif defined (HPUX) - // On HPUX, we need to check for EADDRNOTAVAIL also. - error == EADDRNOTAVAIL || -#elif defined (linux) - // On linux, we need to check for ENOENT also. - error == ENOENT || - // For RedHat5.2, need to check for EINVAL too. - error == EINVAL || - // Without threads check for EOPNOTSUPP - error == EOPNOTSUPP || -#elif defined (sun) - // On sun, we need to check for ENOSR also. - error == ENOSR || - // Without threads check for ENOTSUP - error == ENOTSUP || -#elif defined (__FreeBSD__) - // On FreeBSD we need to check for EOPNOTSUPP (LinuxThreads) or - // ENOSYS (libc_r threads) also. - error == EOPNOTSUPP || - error == ENOSYS || -#elif defined (__OpenBSD__) - // OpenBSD appears to return EBADF. - error == EBADF || -#elif defined (__sgi) // irix - error == ENOTSUP || -#elif defined (DIGITAL_UNIX) // osf1 - error == ENOTSUP || -#endif /* ACE_WIN32 */ - error == ENFILE) - return 1; - else - return 0; -} - -u_int -ACE::major_version (void) -{ - return ACE_MAJOR_VERSION; -} - -u_int -ACE::minor_version (void) -{ - return ACE_MINOR_VERSION; -} - -u_int -ACE::beta_version (void) -{ - return ACE_BETA_VERSION; -} - -const ACE_TCHAR * -ACE::compiler_name (void) -{ -#ifdef ACE_CC_NAME - return ACE_CC_NAME; -#else - return ACE_LIB_TEXT (""); -#endif -} - -u_int -ACE::compiler_major_version (void) -{ -#ifdef ACE_CC_MAJOR_VERSION - return ACE_CC_MAJOR_VERSION; -#else - return 0; -#endif -} - -u_int -ACE::compiler_minor_version (void) -{ -#ifdef ACE_CC_MINOR_VERSION - return ACE_CC_MINOR_VERSION; -#else - return 0; -#endif -} - -u_int -ACE::compiler_beta_version (void) -{ -#ifdef ACE_CC_BETA_VERSION - return ACE_CC_BETA_VERSION; -#else - return 0; -#endif -} - -bool -ACE::debug (void) -{ - static const char* debug = ACE_OS::getenv ("ACE_DEBUG"); - return (ACE::debug_ != 0) ? ACE::debug_ : (debug != 0 ? (*debug != '0'): false); -} - -void -ACE::debug (bool onoff) -{ - ACE::debug_ = onoff; -} - -int -ACE::select (int width, - ACE_Handle_Set *readfds, - ACE_Handle_Set *writefds, - ACE_Handle_Set *exceptfds, - const ACE_Time_Value *timeout) -{ - int result = ACE_OS::select (width, - readfds ? readfds->fdset () : 0, - writefds ? writefds->fdset () : 0, - exceptfds ? exceptfds->fdset () : 0, - timeout); - if (result > 0) - { -# if !defined (ACE_WIN32) - // This isn't needed for Windows... it's a no-op anyway. - if (readfds) - readfds->sync ((ACE_HANDLE) width); - if (writefds) - writefds->sync ((ACE_HANDLE) width); - if (exceptfds) - exceptfds->sync ((ACE_HANDLE) width); -#endif /* ACE_WIN32 */ - } - return result; -} - -int -ACE::select (int width, - ACE_Handle_Set &readfds, - const ACE_Time_Value *timeout) -{ - int result = ACE_OS::select (width, - readfds.fdset (), - 0, - 0, - timeout); - -#if !defined (ACE_WIN32) - if (result > 0) - readfds.sync ((ACE_HANDLE) width); -#endif /* ACE_WIN32 */ - return result; -} - -int -ACE::terminate_process (pid_t pid) -{ -#if defined (ACE_HAS_PHARLAP) - ACE_UNUSED_ARG (pid); - ACE_NOTSUP_RETURN (-1); -#elif defined (ACE_WIN32) - // Create a handle for the given process id. - ACE_HANDLE process_handle = - ::OpenProcess (PROCESS_TERMINATE, - FALSE, // New handle is not inheritable. - pid); - - if (process_handle == ACE_INVALID_HANDLE - || process_handle == 0) - return -1; - else - { - // Kill the process associated with process_handle. - BOOL terminate_result = - ::TerminateProcess (process_handle, 0); - // Free up the kernel resources. - ACE_OS::close (process_handle); - return terminate_result ? 0 : -1; - } -#else - return ACE_OS::kill (pid, 9); -#endif /* ACE_HAS_PHARLAP */ -} - -int -ACE::process_active (pid_t pid) -{ -#if !defined(ACE_WIN32) - int retval = ACE_OS::kill (pid, 0); - - if (retval == 0) - return 1; - else if (errno == ESRCH) - return 0; - else - return -1; -#else - // Create a handle for the given process id. - ACE_HANDLE process_handle = - ::OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, pid); - if (process_handle == ACE_INVALID_HANDLE - || process_handle == 0) - return 0; - else - { - DWORD status; - int result = 1; - if (::GetExitCodeProcess (process_handle, - &status) == 0 - || status != STILL_ACTIVE) - result = 0; - - ::CloseHandle (process_handle); - return result; - } -#endif /* !ACE_WIN32 */ -} - -const ACE_TCHAR * -ACE::execname (const ACE_TCHAR *old_name) -{ -#if defined (ACE_WIN32) - const ACE_TCHAR *suffix = ACE_OS::strrchr (old_name, ACE_LIB_TEXT ('.')); - if (suffix == 0 || ACE_OS::strcasecmp (suffix, ACE_LIB_TEXT (".exe")) != 0) - { - ACE_TCHAR *new_name; - - size_t size = - ACE_OS::strlen (old_name) - + ACE_OS::strlen (ACE_LIB_TEXT (".exe")) - + 1; - - ACE_NEW_RETURN (new_name, - ACE_TCHAR[size], - 0); - ACE_TCHAR *end = new_name; - - end = ACE_OS::strecpy (new_name, old_name); - - // Concatenate the .exe suffix onto the end of the executable. - // end points _after_ the terminating nul. - ACE_OS::strcpy (end - 1, ACE_LIB_TEXT (".exe")); - - return new_name; - } -#endif /* ACE_WIN32 */ - return old_name; -} - -u_long -ACE::hash_pjw (const char *str, size_t len) -{ - u_long hash = 0; - - for (size_t i = 0; i < len; i++) - { - const char temp = str[i]; - hash = (hash << 4) + (temp * 13); - - u_long g = hash & 0xf0000000; - - if (g) - { - hash ^= (g >> 24); - hash ^= g; - } - } - - return hash; -} - -u_long -ACE::hash_pjw (const char *str) -{ - return ACE::hash_pjw (str, ACE_OS::strlen (str)); -} - -#if defined (ACE_HAS_WCHAR) -u_long -ACE::hash_pjw (const wchar_t *str, size_t len) -{ - u_long hash = 0; - - for (size_t i = 0; i < len; i++) - { - // @@ UNICODE: Does this function do the correct thing with wchar's? - - const wchar_t temp = str[i]; - hash = (hash << 4) + (temp * 13); - - u_long g = hash & 0xf0000000; - - if (g) - { - hash ^= (g >> 24); - hash ^= g; - } - } - - return hash; -} - -u_long -ACE::hash_pjw (const wchar_t *str) -{ - return ACE::hash_pjw (str, ACE_OS::strlen (str)); -} -#endif /* ACE_HAS_WCHAR */ - -#if !defined (ACE_HAS_WINCE) -ACE_TCHAR * -ACE::strenvdup (const ACE_TCHAR *str) -{ - ACE_TRACE ("ACE::strenvdup"); - - return ACE_OS::strenvdup (str); -} -#endif /* ACE_HAS_WINCE */ - -/* - -Examples: - -Source NT UNIX -================================================================== -netsvc netsvc.dll libnetsvc.so -(PATH will be (LD_LIBRARY_PATH -evaluated) evaluated) - -libnetsvc.dll libnetsvc.dll libnetsvc.dll + warning -netsvc.so netsvc.so + warning libnetsvc.so - -..\../libs/netsvc ..\..\libs\netsvc.dll ../../libs/netsvc.so -(absolute path used) (absolute path used) - -*/ - -const ACE_TCHAR * -ACE::basename (const ACE_TCHAR *pathname, ACE_TCHAR delim) -{ - ACE_TRACE ("ACE::basename"); - const ACE_TCHAR *temp = ACE_OS::strrchr (pathname, delim); - - if (temp == 0) - return pathname; - else - return temp + 1; -} - -const ACE_TCHAR * -ACE::dirname (const ACE_TCHAR *pathname, ACE_TCHAR delim) -{ - ACE_TRACE ("ACE::dirname"); - static ACE_TCHAR return_dirname[MAXPATHLEN + 1]; - - const ACE_TCHAR *temp = ACE_OS::strrchr (pathname, delim); - - if (temp == 0) - { - return_dirname[0] = '.'; - return_dirname[1] = '\0'; - - return return_dirname; - } - else - { - // When the len is truncated, there are problems! This should - // not happen in normal circomstances - size_t len = temp - pathname + 1; - if (len > (sizeof return_dirname / sizeof (ACE_TCHAR))) - len = sizeof return_dirname / sizeof (ACE_TCHAR); - - ACE_OS::strsncpy (return_dirname, - pathname, - len); - return return_dirname; - } -} - -ssize_t -ACE::recv (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::recv (handle, (char *) buf, len, flags); - else - { -#if defined (ACE_HAS_RECV_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday (); - timespec_t ts = copy; - return ::recv_timedwait (handle, buf, len, flags, &ts); -#else - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) ==-1) - return -1; - else - { - ssize_t bytes_transferred = - ACE_OS::recv (handle, (char *) buf, len, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_RECV_TIMEDWAIT */ - } -} - -#if defined (ACE_HAS_TLI) - -ssize_t -ACE::t_rcv (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::t_rcv (handle, (char *) buf, len, flags); - else - { - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) ==-1) - return -1; - else - { - ssize_t bytes_transferred = - ACE_OS::t_rcv (handle, (char *) buf, len, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -#endif /* ACE_HAS_TLI */ - -ssize_t -ACE::recv (ACE_HANDLE handle, - void *buf, - size_t n, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::recv_i (handle, buf, n); - else - { -#if defined (ACE_HAS_READ_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday (); - timespec_t ts = copy; - return ::read_timedwait (handle, buf, n, &ts); -#else - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE::recv_i (handle, buf, n); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_READ_TIMEDWAIT */ - } -} - -ssize_t -ACE::recvmsg (ACE_HANDLE handle, - struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::recvmsg (handle, msg, flags); - else - { -#if defined (ACE_HAS_RECVMSG_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday (); - timespec_t ts = copy; - return ::recvmsg_timedwait (handle, msg, flags, &ts); -#else - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE_OS::recvmsg (handle, msg, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_RECVMSG_TIMEDWAIT */ - } -} - -ssize_t -ACE::recvfrom (ACE_HANDLE handle, - char *buf, - int len, - int flags, - struct sockaddr *addr, - int *addrlen, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::recvfrom (handle, buf, len, flags, addr, addrlen); - else - { -#if defined (ACE_HAS_RECVFROM_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday (); - timespec_t ts = copy; - return ::recvfrom_timedwait (handle, buf, len, flags, addr, addrlen, &ts); -#else - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = - ACE_OS::recvfrom (handle, buf, len, flags, addr, addrlen); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_RECVFROM_TIMEDWAIT */ - } -} - -ssize_t -ACE::recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE_OS::recv (handle, - static_cast (buf) + bytes_transferred, - len - bytes_transferred, - flags); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK) - { - // Wait for the blocking to subside. - int result = ACE::handle_read_ready (handle, - 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return static_cast (bytes_transferred); -} - -ssize_t -ACE::recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE_OS::recv (handle, - static_cast (buf) + bytes_transferred, - len - bytes_transferred, - flags); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK) - { - // Wait upto for the blocking to subside. - int rtn = ACE::handle_read_ready (handle, - timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return static_cast (bytes_transferred); -} - -#if defined (ACE_HAS_TLI) - -ssize_t -ACE::t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE_OS::t_rcv (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK) - { - // Wait for the blocking to subside. - int result = ACE::handle_read_ready (handle, - 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return bytes_transferred; -} - -ssize_t -ACE::t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE_OS::t_rcv (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK) - { - // Wait upto for the blocking to subside. - int rtn = ACE::handle_read_ready (handle, - timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return bytes_transferred; -} - -#endif /* ACE_HAS_TLI */ - -ssize_t -ACE::recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE::recv_i (handle, - static_cast (buf) + bytes_transferred, - len - bytes_transferred); - // Check EOF. - if (n == 0) - { - return 0; - } - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK) - { - // Wait for the blocking to subside. - int result = ACE::handle_read_ready (handle, - 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return static_cast (bytes_transferred); -} - -ssize_t -ACE::recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE::recv_i (handle, - static_cast (buf) + bytes_transferred, - len - bytes_transferred); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK) - { - // Wait upto for the blocking to subside. - int rtn = ACE::handle_read_ready (handle, - timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return static_cast (bytes_transferred); -} - -// This is basically an interface to ACE_OS::readv, that doesn't use -// the struct iovec explicitly. The ... can be passed as an arbitrary -// number of (char *ptr, int len) tuples. However, the count N is the -// *total* number of trailing arguments, *not* a couple of the number -// of tuple pairs! - -ssize_t -ACE::recv (ACE_HANDLE handle, size_t n, ...) -{ - va_list argp; - int total_tuples = static_cast (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::recvv (handle, iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -ssize_t -ACE::recvv (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::recvv (handle, iov, iovcnt); - else - { -#if defined (ACE_HAS_READV_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday (); - timespec_t ts = copy; - return ::readv_timedwait (handle, iov, iovcnt, &ts); -#else - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE_OS::recvv (handle, iov, iovcnt); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_READV_TIMEDWAIT */ - } -} - -ssize_t -ACE::recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - for (int s = 0; - s < iovcnt; - ) - { - // Try to transfer as much of the remaining data as possible. - ssize_t n = ACE_OS::recvv (handle, - iov + s, - iovcnt - s); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK) - { - // Wait for the blocking to subside. - int result = ACE::handle_read_ready (handle, - 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = static_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - return bytes_transferred; -} - -ssize_t -ACE::recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (int s = 0; - s < iovcnt; - ) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - ssize_t n = ACE_OS::recvv (handle, - iov + s, - iovcnt - s); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK) - { - // Wait upto for the blocking to subside. - int rtn = ACE::handle_read_ready (handle, - timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return bytes_transferred; -} - -ssize_t -ACE::recv_n (ACE_HANDLE handle, - ACE_Message_Block *message_block, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - while (message_block != 0) - { - // Our current message block chain. - const ACE_Message_Block *current_message_block = message_block; - - while (current_message_block != 0) - { - size_t current_message_block_length = - current_message_block->length (); - char *this_rd_ptr = current_message_block->rd_ptr (); - - // Check if this block has any space for incoming data. - while (current_message_block_length > 0) - { - u_long this_chunk_length; - if (current_message_block_length > ULONG_MAX) - this_chunk_length = ULONG_MAX; - else - this_chunk_length = - static_cast (current_message_block_length); - // Collect the data in the iovec. - iov[iovcnt].iov_base = this_rd_ptr; - iov[iovcnt].iov_len = this_chunk_length; - current_message_block_length -= this_chunk_length; - this_rd_ptr += this_chunk_length; - - // Increment iovec counter. - ++iovcnt; - - // The buffer is full make a OS call. @@ TODO find a way to - // find ACE_IOV_MAX for platforms that do not define it rather - // than simply setting ACE_IOV_MAX to some arbitrary value such - // as 16. - if (iovcnt == ACE_IOV_MAX) - { - size_t current_transfer = 0; - - ssize_t result = ACE::recvv_n (handle, - iov, - iovcnt, - timeout, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - - // Reset iovec counter. - iovcnt = 0; - } - } - - // Select the next message block in the chain. - current_message_block = current_message_block->cont (); - } - - // Selection of the next message block chain. - message_block = message_block->next (); - } - - // Check for remaining buffers to be sent. This will happen when - // ACE_IOV_MAX is not a multiple of the number of message blocks. - if (iovcnt != 0) - { - size_t current_transfer = 0; - - ssize_t result = ACE::recvv_n (handle, - iov, - iovcnt, - timeout, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - } - - // Return total bytes transferred. - return bytes_transferred; -} - -ssize_t -ACE::send (ACE_HANDLE handle, - const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::send (handle, (const char *) buf, n, flags); - else - { -#if defined (ACE_HAS_SEND_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday(); - timespec_t ts = copy; - return ::send_timedwait (handle, buf, n, flags, &ts); -#else - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE_OS::send (handle, (const char *) buf, n, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_SEND_TIMEDWAIT */ - } -} - -#if defined (ACE_HAS_TLI) - -ssize_t -ACE::t_snd (ACE_HANDLE handle, - const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::t_snd (handle, (const char *) buf, n, flags); - else - { - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE_OS::t_snd (handle, (const char *) buf, n, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -#endif /* ACE_HAS_TLI */ - -ssize_t -ACE::send (ACE_HANDLE handle, - const void *buf, - size_t n, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::send_i (handle, buf, n); - else - { -#if defined (ACE_HAS_WRITE_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday (); - timespec_t ts = copy; - return ::write_timedwait (handle, buf, n, &ts); -#else - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE::send_i (handle, buf, n); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_WRITE_TIMEDWAIT */ - } -} - -ssize_t -ACE::sendmsg (ACE_HANDLE handle, - const struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::sendmsg (handle, msg, flags); - else - { -#if defined (ACE_HAS_SENDMSG_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday (); - timespec_t ts = copy; - return ::sendmsg_timedwait (handle, msg, flags, &ts); -#else - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE_OS::sendmsg (handle, msg, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_SENDMSG_TIMEDWAIT */ - } -} - -ssize_t -ACE::sendto (ACE_HANDLE handle, - const char *buf, - int len, - int flags, - const struct sockaddr *addr, - int addrlen, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::sendto (handle, buf, len, flags, addr, addrlen); - else - { -#if defined (ACE_HAS_SENDTO_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday (); - timespec_t ts = copy; - return ::sendto_timedwait (handle, buf, len, flags, addr, addrlen, ts); -#else - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = - ACE_OS::sendto (handle, buf, len, flags, addr, addrlen); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_SENDTO_TIMEDWAIT */ - } -} - -ssize_t -ACE::send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE_OS::send (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait for the blocking to subside. - int result = ACE::handle_write_ready (handle, - 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return bytes_transferred; -} - -ssize_t -ACE::send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE_OS::send (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait upto for the blocking to subside. - int rtn = ACE::handle_write_ready (handle, - timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return bytes_transferred; -} - -#if defined (ACE_HAS_TLI) - -ssize_t -ACE::t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE_OS::t_snd (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait for the blocking to subside. - int result = ACE::handle_write_ready (handle, - 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return bytes_transferred; -} - -ssize_t -ACE::t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE_OS::t_snd (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait upto for the blocking to subside. - int rtn = ACE::handle_write_ready (handle, - timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return bytes_transferred; -} - -#endif /* ACE_HAS_TLI */ - -ssize_t -ACE::send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE::send_i (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait for the blocking to subside. - int result = ACE::handle_write_ready (handle, - 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return bytes_transferred; -} - -ssize_t -ACE::send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE::send_i (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait upto for the blocking to subside. - int rtn = ACE::handle_write_ready (handle, - timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return bytes_transferred; -} - -// Send N char *ptrs and int lengths. Note that the char *'s precede -// the ints (basically, an varargs version of writev). The count N is -// the *total* number of trailing arguments, *not* a couple of the -// number of tuple pairs! - -ssize_t -ACE::send (ACE_HANDLE handle, size_t n, ...) -{ - va_list argp; - int total_tuples = static_cast (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::sendv (handle, iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -ssize_t -ACE::sendv (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::sendv (handle, iov, iovcnt); - else - { -#if defined (ACE_HAS_WRITEV_TIMEDWAIT) - ACE_Time_Value copy = *timeout; - copy += ACE_OS::gettimeofday (); - timespec_t ts = copy; - return ::sendv_timedwait (handle, iov, iovcnt, &ts); -#else - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE_OS::sendv (handle, iov, iovcnt); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } -#endif /* ACE_HAS_WRITEV_TIMEDWAIT */ - } -} - -ssize_t -ACE::sendv_n_i (ACE_HANDLE handle, - const iovec *i, - int iovcnt, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec *iov = const_cast (i); - - for (int s = 0; - s < iovcnt; - ) - { - // Try to transfer as much of the remaining data as possible. - ssize_t n = ACE_OS::sendv (handle, - iov + s, - iovcnt - s); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait for the blocking to subside. - int result = ACE::handle_write_ready (handle, - 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - return bytes_transferred; -} - -ssize_t -ACE::sendv_n_i (ACE_HANDLE handle, - const iovec *i, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - iovec *iov = const_cast (i); - - for (int s = 0; - s < iovcnt; - ) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - ssize_t n = ACE_OS::sendv (handle, - iov + s, - iovcnt - s); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait upto for the blocking to subside. - int rtn = ACE::handle_write_ready (handle, - timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return bytes_transferred; -} - -ssize_t -ACE::write_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - while (message_block != 0) - { - // Our current message block chain. - const ACE_Message_Block *current_message_block = message_block; - - while (current_message_block != 0) - { - size_t current_message_block_length = - current_message_block->length (); - char *this_block_ptr = current_message_block->rd_ptr (); - - // Check if this block has any data to be sent. - while (current_message_block_length > 0) - { - u_long this_chunk_length; - if (current_message_block_length > ULONG_MAX) - this_chunk_length = ULONG_MAX; - else - this_chunk_length = - static_cast (current_message_block_length); - // Collect the data in the iovec. - iov[iovcnt].iov_base = this_block_ptr; - iov[iovcnt].iov_len = this_chunk_length; - current_message_block_length -= this_chunk_length; - this_block_ptr += this_chunk_length; - - // Increment iovec counter. - ++iovcnt; - - // The buffer is full make a OS call. @@ TODO find a way to - // find ACE_IOV_MAX for platforms that do not define it rather - // than simply setting ACE_IOV_MAX to some arbitrary value such - // as 16. - if (iovcnt == ACE_IOV_MAX) - { - size_t current_transfer = 0; - - ssize_t result = ACE::writev_n (handle, - iov, - iovcnt, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - - // Reset iovec counter. - iovcnt = 0; - } - } - - // Select the next message block in the chain. - current_message_block = current_message_block->cont (); - } - - // Selection of the next message block chain. - message_block = message_block->next (); - } - - // Check for remaining buffers to be sent. This will happen when - // ACE_IOV_MAX is not a multiple of the number of message blocks. - if (iovcnt != 0) - { - size_t current_transfer = 0; - - ssize_t result = ACE::writev_n (handle, - iov, - iovcnt, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - } - - // Return total bytes transferred. - return bytes_transferred; -} - -ssize_t -ACE::send_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - while (message_block != 0) - { - // Our current message block chain. - const ACE_Message_Block *current_message_block = message_block; - - while (current_message_block != 0) - { - char *this_block_ptr = current_message_block->rd_ptr (); - size_t current_message_block_length = - current_message_block->length (); - - // Check if this block has any data to be sent. - while (current_message_block_length > 0) - { - u_long this_chunk_length; - if (current_message_block_length > ULONG_MAX) - this_chunk_length = ULONG_MAX; - else - this_chunk_length = - static_cast (current_message_block_length); - // Collect the data in the iovec. - iov[iovcnt].iov_base = this_block_ptr; - iov[iovcnt].iov_len = this_chunk_length; - current_message_block_length -= this_chunk_length; - this_block_ptr += this_chunk_length; - - // Increment iovec counter. - ++iovcnt; - - // The buffer is full make a OS call. @@ TODO find a way to - // find ACE_IOV_MAX for platforms that do not define it rather - // than simply setting ACE_IOV_MAX to some arbitrary value such - // as 16. - if (iovcnt == ACE_IOV_MAX) - { - size_t current_transfer = 0; - - ssize_t result = ACE::sendv_n (handle, - iov, - iovcnt, - timeout, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - - // Reset iovec counter. - iovcnt = 0; - } - } - - // Select the next message block in the chain. - current_message_block = current_message_block->cont (); - } - - // Selection of the next message block chain. - message_block = message_block->next (); - } - - // Check for remaining buffers to be sent. This will happen when - // ACE_IOV_MAX is not a multiple of the number of message blocks. - if (iovcnt != 0) - { - size_t current_transfer = 0; - - ssize_t result = ACE::sendv_n (handle, - iov, - iovcnt, - timeout, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - } - - // Return total bytes transferred. - return bytes_transferred; -} - -ssize_t -ACE::readv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - for (int s = 0; - s < iovcnt; - ) - { - ssize_t n = ACE_OS::readv (handle, - iov + s, - iovcnt - s); - - if (n == -1 || n == 0) - return n; - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - return bytes_transferred; -} - -ssize_t -ACE::writev_n (ACE_HANDLE handle, - const iovec *i, - int iovcnt, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec *iov = const_cast (i); - - for (int s = 0; - s < iovcnt; - ) - { - ssize_t n = ACE_OS::writev (handle, - iov + s, - iovcnt - s); - if (n == -1 || n == 0) - return n; - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - return bytes_transferred; -} - -int -ACE::handle_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int read_ready, - int write_ready, - int exception_ready) -{ -#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) - ACE_UNUSED_ARG (write_ready); - ACE_UNUSED_ARG (exception_ready); - - struct pollfd fds; - - fds.fd = handle; - fds.events = read_ready ? POLLIN : POLLOUT; - fds.revents = 0; - - int result = ACE_OS::poll (&fds, 1, timeout); -#else - ACE_Handle_Set handle_set; - handle_set.set_bit (handle); - - // Wait for data or for the timeout to elapse. - int select_width; -# if defined (ACE_WIN32) - // This arg is ignored on Windows and causes pointer truncation - // warnings on 64-bit compiles. - select_width = 0; -# else - select_width = int (handle) + 1; -# endif /* ACE_WIN64 */ - int result = ACE_OS::select (select_width, - read_ready ? handle_set.fdset () : 0, // read_fds. - write_ready ? handle_set.fdset () : 0, // write_fds. - exception_ready ? handle_set.fdset () : 0, // exception_fds. - timeout); - -#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ - - switch (result) - { - case 0: // Timer expired. - errno = ETIME; - /* FALLTHRU */ - case -1: // we got here directly - select() returned -1. - return -1; - case 1: // Handle has data. - /* FALLTHRU */ - default: // default is case result > 0; return a - // ACE_ASSERT (result == 1); - return result; - } -} - -int -ACE::enter_recv_timedwait (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int &val) -{ - int result = ACE::handle_read_ready (handle, - timeout); - - if (result == -1) - return -1; - - ACE::record_and_set_non_blocking_mode (handle, - val); - - return result; -} - -int -ACE::enter_send_timedwait (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int &val) -{ - int result = ACE::handle_write_ready (handle, - timeout); - - if (result == -1) - return -1; - - ACE::record_and_set_non_blocking_mode (handle, - val); - - return result; -} - -void -ACE::record_and_set_non_blocking_mode (ACE_HANDLE handle, - int &val) -{ - // We need to record whether we are already *in* nonblocking mode, - // so that we can correctly reset the state when we're done. - val = ACE::get_flags (handle); - - if (ACE_BIT_DISABLED (val, ACE_NONBLOCK)) - // Set the handle into non-blocking mode if it's not already in - // it. - ACE::set_flags (handle, ACE_NONBLOCK); -} - -void -ACE::restore_non_blocking_mode (ACE_HANDLE handle, - int val) -{ - if (ACE_BIT_DISABLED (val, - ACE_NONBLOCK)) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - // Only disable ACE_NONBLOCK if we weren't in non-blocking mode - // originally. - ACE::clr_flags (handle, ACE_NONBLOCK); - } -} - - -// Format buffer into printable format. This is useful for debugging. -// Portions taken from mdump by J.P. Knight (J.P.Knight@lut.ac.uk) -// Modifications by Todd Montgomery. - -size_t -ACE::format_hexdump (const char *buffer, - size_t size, - ACE_TCHAR *obuf, - size_t obuf_sz) -{ - ACE_TRACE ("ACE::format_hexdump"); - - u_char c; - ACE_TCHAR textver[16 + 1]; - - // We can fit 16 bytes output in text mode per line, 4 chars per byte. - size_t maxlen = (obuf_sz / 68) * 16; - - if (size > maxlen) - size = maxlen; - - size_t i; - - size_t lines = size / 16; - for (i = 0; i < lines; i++) - { - size_t j; - - for (j = 0 ; j < 16; j++) - { - c = (u_char) buffer[(i << 4) + j]; // or, buffer[i*16+j] - ACE_OS::sprintf (obuf, - ACE_LIB_TEXT ("%02x "), - c); - obuf += 3; - if (j == 7) - { - ACE_OS::sprintf (obuf, - ACE_LIB_TEXT (" ")); - ++obuf; - } - textver[j] = ACE_OS::ace_isprint (c) ? c : '.'; - } - - textver[j] = 0; - - ACE_OS::sprintf (obuf, - ACE_LIB_TEXT (" %s\n"), - textver); - - while (*obuf != '\0') - obuf++; - } - - if (size % 16) - { - for (i = 0 ; i < size % 16; i++) - { - c = (u_char) buffer[size - size % 16 + i]; - ACE_OS::sprintf (obuf, - ACE_LIB_TEXT ("%02x "), - c); - obuf += 3; - if (i == 7) - { - ACE_OS::sprintf (obuf, - ACE_LIB_TEXT (" ")); - ++obuf; - } - textver[i] = ACE_OS::ace_isprint (c) ? c : '.'; - } - - for (i = size % 16; i < 16; i++) - { - ACE_OS::sprintf (obuf, - ACE_LIB_TEXT (" ")); - obuf += 3; - if (i == 7) - { - ACE_OS::sprintf (obuf, - ACE_LIB_TEXT (" ")); - obuf++; - } - textver[i] = ' '; - } - - textver[i] = 0; - ACE_OS::sprintf (obuf, - ACE_LIB_TEXT (" %s\n"), - textver); - } - return size; -} - -// Returns the current timestamp in the form -// "hour:minute:second:microsecond." The month, day, and year are -// also stored in the beginning of the date_and_time array. - -ACE_TCHAR * -ACE::timestamp (ACE_TCHAR date_and_time[], - int date_and_timelen, - int return_pointer_to_first_digit) -{ - //ACE_TRACE ("ACE::timestamp"); - - if (date_and_timelen < 35) - { - errno = EINVAL; - return 0; - } - -#if defined (WIN32) - // Emulate Unix. Win32 does NOT support all the UNIX versions - // below, so DO we need this ifdef. - static const ACE_TCHAR *day_of_week_name[] = - { - ACE_LIB_TEXT ("Sun"), - ACE_LIB_TEXT ("Mon"), - ACE_LIB_TEXT ("Tue"), - ACE_LIB_TEXT ("Wed"), - ACE_LIB_TEXT ("Thu"), - ACE_LIB_TEXT ("Fri"), - ACE_LIB_TEXT ("Sat") - }; - - static const ACE_TCHAR *month_name[] = - { - ACE_LIB_TEXT ("Jan"), - ACE_LIB_TEXT ("Feb"), - ACE_LIB_TEXT ("Mar"), - ACE_LIB_TEXT ("Apr"), - ACE_LIB_TEXT ("May"), - ACE_LIB_TEXT ("Jun"), - ACE_LIB_TEXT ("Jul"), - ACE_LIB_TEXT ("Aug"), - ACE_LIB_TEXT ("Sep"), - ACE_LIB_TEXT ("Oct"), - ACE_LIB_TEXT ("Nov"), - ACE_LIB_TEXT ("Dec") - }; - - SYSTEMTIME local; - ::GetLocalTime (&local); - - ACE_OS::sprintf (date_and_time, - ACE_LIB_TEXT ("%3s %3s %2d %04d %02d:%02d:%02d.%06d"), - day_of_week_name[local.wDayOfWeek], - month_name[local.wMonth - 1], - (int) local.wDay, - (int) local.wYear, - (int) local.wHour, - (int) local.wMinute, - (int) local.wSecond, - (int) (local.wMilliseconds * 1000)); - return &date_and_time[15 + (return_pointer_to_first_digit != 0)]; -#else /* UNIX */ - ACE_TCHAR timebuf[26]; // This magic number is based on the ctime(3c) man page. - ACE_Time_Value cur_time = ACE_OS::gettimeofday (); - time_t secs = cur_time.sec (); - - ACE_OS::ctime_r (&secs, - timebuf, - sizeof timebuf); - // date_and_timelen > sizeof timebuf! - ACE_OS::strsncpy (date_and_time, - timebuf, - date_and_timelen); - ACE_TCHAR yeartmp[5]; - ACE_OS::strsncpy (yeartmp, - &date_and_time[20], - 5); - ACE_TCHAR timetmp[9]; - ACE_OS::strsncpy (timetmp, - &date_and_time[11], - 9); - ACE_OS::sprintf (&date_and_time[11], -# if defined (ACE_USES_WCHAR) - ACE_LIB_TEXT ("%ls %ls.%06ld"), -# else - ACE_LIB_TEXT ("%s %s.%06ld"), -# endif /* ACE_USES_WCHAR */ - yeartmp, - timetmp, - cur_time.usec ()); - date_and_time[33] = '\0'; - return &date_and_time[15 + (return_pointer_to_first_digit != 0)]; -#endif /* WIN32 */ -} - -// This function rounds the request to a multiple of the page size. - -size_t -ACE::round_to_pagesize (off_t len) -{ - ACE_TRACE ("ACE::round_to_pagesize"); - - if (ACE::pagesize_ == 0) - ACE::pagesize_ = ACE_OS::getpagesize (); - - return (len + (ACE::pagesize_ - 1)) & ~(ACE::pagesize_ - 1); -} - -size_t -ACE::round_to_allocation_granularity (off_t len) -{ - ACE_TRACE ("ACE::round_to_allocation_granularity"); - - if (ACE::allocation_granularity_ == 0) - ACE::allocation_granularity_ = ACE_OS::allocation_granularity (); - - return (len + (ACE::allocation_granularity_ - 1)) & ~(ACE::allocation_granularity_ - 1); -} - -ACE_HANDLE -ACE::handle_timed_complete (ACE_HANDLE h, - const ACE_Time_Value *timeout, - int is_tli) -{ - ACE_TRACE ("ACE::handle_timed_complete"); - -#if !defined (ACE_WIN32) && defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) - - struct pollfd fds; - - fds.fd = h; - fds.events = POLLIN | POLLOUT; - fds.revents = 0; - -#else - ACE_Handle_Set rd_handles; - ACE_Handle_Set wr_handles; - - rd_handles.set_bit (h); - wr_handles.set_bit (h); -#endif /* !ACE_WIN32 && ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ - -#if defined (ACE_WIN32) - // Winsock is different - it sets the exception bit for failed connect, - // unlike other platforms, where the read bit is set. - ACE_Handle_Set ex_handles; - ex_handles.set_bit (h); -#endif /* ACE_WIN32 */ - - int need_to_check = 0; - int known_failure = 0; - -#if defined (ACE_WIN32) - int n = ACE_OS::select (0, // Ignored on Windows: int (h) + 1, - 0, - wr_handles, - ex_handles, - timeout); -#else -# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) - - int n = ACE_OS::poll (&fds, 1, timeout); - -# else - int n = ACE_OS::select (int (h) + 1, - rd_handles, - wr_handles, - 0, - timeout); -# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ -#endif /* ACE_WIN32 */ - - // If we failed to connect within the time period allocated by the - // caller, then we fail (e.g., the remote host might have been too - // busy to accept our call). - if (n <= 0) - { - if (n == 0 && timeout != 0) - errno = ETIME; - return ACE_INVALID_HANDLE; - } - - // Usually, a ready-for-write handle is successfully connected, and - // ready-for-read (exception on Win32) is a failure. On fails, we - // need to grab the error code via getsockopt. On possible success for - // any platform where we can't tell just from select() (e.g. AIX), - // we also need to check for success/fail. -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (is_tli); - - // On Win32, ex_handle set indicates a failure. We'll do the check - // to try and get an errno value, but the connect failed regardless of - // what getsockopt says about the error. - if (ex_handles.is_set (h)) - { - need_to_check = 1; - known_failure = 1; - } -#elif defined (ACE_VXWORKS) - ACE_UNUSED_ARG (is_tli); - - // Force the check on VxWorks. The read handle for "h" is not set, - // so "need_to_check" is false at this point. The write handle is - // set, for what it's worth. - need_to_check = 1; -#else - if (is_tli) - -# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) - need_to_check = (fds.revents & POLLIN) && !(fds.revents & POLLOUT); -# else - need_to_check = rd_handles.is_set (h) && !wr_handles.is_set (h); -# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ - - else -#if defined(AIX) - // AIX is broken... both success and failed connect will set the - // write handle only, so always check. - need_to_check = 1; -#else -# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) - need_to_check = (fds.revents & POLLIN); -# else - need_to_check = rd_handles.is_set (h); -# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ -#endif /* AIX */ -#endif /* ACE_WIN32 */ - - if (need_to_check) - { -#if defined (SOL_SOCKET) && defined (SO_ERROR) - int sock_err = 0; - int sock_err_len = sizeof (sock_err); - int sockopt_ret = ACE_OS::getsockopt (h, SOL_SOCKET, SO_ERROR, - (char *)&sock_err, &sock_err_len); - if (sockopt_ret < 0) - { - h = ACE_INVALID_HANDLE; - } - - if (sock_err != 0 || known_failure) - { - h = ACE_INVALID_HANDLE; - errno = sock_err; - } -#else - char dummy; - - // The following recv() won't block provided that the - // ACE_NONBLOCK flag has not been turned off . - n = ACE::recv (h, &dummy, 1, MSG_PEEK); - - // If no data was read/peeked at, check to see if it's because - // of a non-connected socket (and therefore an error) or there's - // just no data yet. - if (n <= 0) - { - if (n == 0) - { - errno = ECONNREFUSED; - h = ACE_INVALID_HANDLE; - } - else if (errno != EWOULDBLOCK && errno != EAGAIN) - h = ACE_INVALID_HANDLE; - } -#endif - } - - // 1. The HANDLE is ready for writing and doesn't need to be checked or - // 2. recv() returned an indication of the state of the socket - if there is - // either data present, or a recv is legit but there's no data yet, - // the connection was successfully established. - return h; -} - -// Wait up to amount of time to accept a connection. - -int -ACE::handle_timed_accept (ACE_HANDLE listener, - ACE_Time_Value *timeout, - int restart) -{ - ACE_TRACE ("ACE::handle_timed_accept"); - // Make sure we don't bomb out on erroneous values. - if (listener == ACE_INVALID_HANDLE) - return -1; - -#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) - - struct pollfd fds; - - fds.fd = listener; - fds.events = POLLIN; - fds.revents = 0; - -#else - // Use the select() implementation rather than poll(). - ACE_Handle_Set rd_handle; - rd_handle.set_bit (listener); -#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ - - // We need a loop here if is enabled. - - for (;;) - { -#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) - - int n = ACE_OS::poll (&fds, 1, timeout); - -#else - int select_width; -# if defined (ACE_WIN32) - // This arg is ignored on Windows and causes pointer truncation - // warnings on 64-bit compiles. - select_width = 0; -# else - select_width = int (listener) + 1; -# endif /* ACE_WIN32 */ - int n = ACE_OS::select (select_width, - rd_handle, 0, 0, - timeout); -#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ - - switch (n) - { - case -1: - if (errno == EINTR && restart) - continue; - else - return -1; - /* NOTREACHED */ - case 0: - if (timeout != 0 - && timeout->sec () == 0 - && timeout->usec () == 0) - errno = EWOULDBLOCK; - else - errno = ETIMEDOUT; - return -1; - /* NOTREACHED */ - case 1: - return 0; - /* NOTREACHED */ - default: - errno = EINVAL; - return -1; - /* NOTREACHED */ - } - } -} - -// Make the current process a UNIX daemon. This is based on Stevens -// code from APUE. - -int -ACE::daemonize (const ACE_TCHAR pathname[], - int close_all_handles, - const ACE_TCHAR program_name[]) -{ - ACE_TRACE ("ACE::daemonize"); -#if !defined (ACE_LACKS_FORK) - pid_t pid = ACE_OS::fork (); - - if (pid == -1) - return -1; - else if (pid != 0) - ACE_OS::exit (0); // Parent exits. - - // 1st child continues. - ACE_OS::setsid (); // Become session leader. - - ACE_OS::signal (SIGHUP, SIG_IGN); - - pid = ACE_OS::fork (program_name); - - if (pid != 0) - ACE_OS::exit (0); // First child terminates. - - // Second child continues. - - if (pathname != 0) - // change working directory. - ACE_OS::chdir (pathname); - - ACE_OS::umask (0); // clear our file mode creation mask. - - // Close down the I/O handles. - if (close_all_handles) - for (int i = ACE::max_handles () - 1; i >= 0; i--) - ACE_OS::close (i); - - return 0; -#else - ACE_UNUSED_ARG (pathname); - ACE_UNUSED_ARG (close_all_handles); - ACE_UNUSED_ARG (program_name); - - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_LACKS_FORK */ -} - -pid_t -ACE::fork (const ACE_TCHAR *program_name, - int avoid_zombies) -{ - if (avoid_zombies == 0) - return ACE_OS::fork (program_name); - else - { - // This algorithm is adapted from an example in the Stevens book - // "Advanced Programming in the Unix Environment" and an item in - // Andrew Gierth's Unix Programming FAQ. It creates an orphan - // process that's inherited by the init process; init cleans up - // when the orphan process terminates. - // - // Another way to avoid zombies is to ignore or catch the - // SIGCHLD signal; we don't use that approach here. - - pid_t pid = ACE_OS::fork (); - if (pid == 0) - { - // The child process forks again to create a grandchild. - switch (ACE_OS::fork (program_name)) - { - case 0: // grandchild returns 0. - return 0; - case -1: // assumes all errnos are < 256 - ACE_OS::_exit (errno); - default: // child terminates, orphaning grandchild - ACE_OS::_exit (0); - } - } - - // Parent process waits for child to terminate. -#if defined (ACE_HAS_UNION_WAIT) - union wait status; - if (pid < 0 || ACE_OS::waitpid (pid, &(status.w_status), 0) < 0) -#else - ACE_exitcode status; - if (pid < 0 || ACE_OS::waitpid (pid, &status, 0) < 0) -#endif /* ACE_HAS_UNION_WAIT */ - return -1; - - // child terminated by calling exit()? - if (WIFEXITED ((status))) - { - // child terminated normally? - if (WEXITSTATUS ((status)) == 0) - return 1; - else - errno = WEXITSTATUS ((status)); - } - else - // child didn't call exit(); perhaps it received a signal? - errno = EINTR; - - return -1; - } -} - -int -ACE::max_handles (void) -{ - ACE_TRACE ("ACE::max_handles"); -#if defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT) - rlimit rl; - int r = ACE_OS::getrlimit (RLIMIT_NOFILE, &rl); -# if !defined (RLIM_INFINITY) - if (r == 0) - return rl.rlim_cur; -#else - if (r == 0 && rl.rlim_cur != RLIM_INFINITY) - return rl.rlim_cur; - // If == RLIM_INFINITY, fall through to the ACE_LACKS_RLIMIT sections -# endif /* RLIM_INFINITY */ -#endif /* RLIMIT_NOFILE && !ACE_LACKS_RLIMIT */ - -#if defined (_SC_OPEN_MAX) - return ACE_OS::sysconf (_SC_OPEN_MAX); -#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) - return maxFiles; -#elif defined (FD_SETSIZE) - return FD_SETSIZE; -#else - ACE_NOTSUP_RETURN (-1); -#endif /* _SC_OPEN_MAX */ -} - -// Set the number of currently open handles in the process. -// -// If NEW_LIMIT == -1 set the limit to the maximum allowable. -// Otherwise, set it to be the value of NEW_LIMIT. - -int -ACE::set_handle_limit (int new_limit, - int increase_limit_only) -{ - ACE_TRACE ("ACE::set_handle_limit"); - int cur_limit = ACE::max_handles (); - int max_limit = cur_limit; - - if (cur_limit == -1) - return -1; - -#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) - struct rlimit rl; - - ACE_OS::memset ((void *) &rl, 0, sizeof rl); - int r = ACE_OS::getrlimit (RLIMIT_NOFILE, &rl); - if (r == 0) - max_limit = rl.rlim_max; -#endif /* ACE_LACKS_RLIMIT */ - - if (new_limit == -1) - new_limit = max_limit; - - if (new_limit < 0) - { - errno = EINVAL; - return -1; - } - else if (new_limit > cur_limit) - { - // Increase the limit. -#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) - rl.rlim_cur = new_limit; - return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl); -#else - // Must return EINVAL errno. - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_LACKS_RLIMIT */ - } - else if (increase_limit_only == 0) - { - // Decrease the limit. -#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) - rl.rlim_cur = new_limit; - return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl); -#else - // We give a chance to platforms without RLIMIT to work. - // Instead of ACE_NOTSUP_RETURN (0), just return 0 because - // new_limit is <= cur_limit, so it's a no-op. - return 0; -#endif /* ACE_LACKS_RLIMIT */ - } - - return 0; -} - -int -ACE::map_errno (int error) -{ - switch (error) - { -#if defined (ACE_WIN32) - case WSAEWOULDBLOCK: - return EAGAIN; // Same as UNIX errno EWOULDBLOCK. -#endif /* ACE_WIN32 */ - } - - return error; -} - -// Euclid's greatest common divisor algorithm. -u_long -ACE::gcd (u_long x, u_long y) -{ - while (y != 0) - { - u_long r = x % y; - x = y; - y = r; - } - - return x; -} - - -// Calculates the minimum enclosing frame size for the given values. -u_long -ACE::minimum_frame_size (u_long period1, u_long period2) -{ - // if one of the periods is zero, treat it as though it as - // uninitialized and return the other period as the frame size - if (0 == period1) - { - return period2; - } - if (0 == period2) - { - return period1; - } - - // if neither is zero, find the greatest common divisor of the two periods - u_long greatest_common_divisor = ACE::gcd (period1, period2); - - // explicitly consider cases to reduce risk of possible overflow errors - if (greatest_common_divisor == 1) - { - // periods are relative primes: just multiply them together - return period1 * period2; - } - else if (greatest_common_divisor == period1) - { - // the first period divides the second: return the second - return period2; - } - else if (greatest_common_divisor == period2) - { - // the second period divides the first: return the first - return period1; - } - else - { - // the current frame size and the entry's effective period - // have a non-trivial greatest common divisor: return the - // product of factors divided by those in their gcd. - return (period1 * period2) / greatest_common_divisor; - } -} - - -u_long -ACE::is_prime (const u_long n, - const u_long min_factor, - const u_long max_factor) -{ - if (n > 3) - for (u_long factor = min_factor; - factor <= max_factor; - ++factor) - if (n / factor * factor == n) - return factor; - - return 0; -} - -const ACE_TCHAR * -ACE::sock_error (int error) -{ -#if defined (ACE_WIN32) - static ACE_TCHAR unknown_msg[64]; - - switch (error) - { - case WSAVERNOTSUPPORTED: - return ACE_LIB_TEXT ("version of WinSock not supported"); - /* NOTREACHED */ - case WSASYSNOTREADY: - return ACE_LIB_TEXT ("WinSock not present or not responding"); - /* NOTREACHED */ - case WSAEINVAL: - return ACE_LIB_TEXT ("app version not supported by DLL"); - /* NOTREACHED */ - case WSAHOST_NOT_FOUND: - return ACE_LIB_TEXT ("Authoritive: Host not found"); - /* NOTREACHED */ - case WSATRY_AGAIN: - return ACE_LIB_TEXT ("Non-authoritive: host not found or server failure"); - /* NOTREACHED */ - case WSANO_RECOVERY: - return ACE_LIB_TEXT ("Non-recoverable: refused or not implemented"); - /* NOTREACHED */ - case WSANO_DATA: - return ACE_LIB_TEXT ("Valid name, no data record for type"); - /* NOTREACHED */ - /* - case WSANO_ADDRESS: - return "Valid name, no MX record"; - */ - case WSANOTINITIALISED: - return ACE_LIB_TEXT ("WSA Startup not initialized"); - /* NOTREACHED */ - case WSAENETDOWN: - return ACE_LIB_TEXT ("Network subsystem failed"); - /* NOTREACHED */ - case WSAEINPROGRESS: - return ACE_LIB_TEXT ("Blocking operation in progress"); - /* NOTREACHED */ - case WSAEINTR: - return ACE_LIB_TEXT ("Blocking call cancelled"); - /* NOTREACHED */ - case WSAEAFNOSUPPORT: - return ACE_LIB_TEXT ("address family not supported"); - /* NOTREACHED */ - case WSAEMFILE: - return ACE_LIB_TEXT ("no file handles available"); - /* NOTREACHED */ - case WSAENOBUFS: - return ACE_LIB_TEXT ("no buffer space available"); - /* NOTREACHED */ - case WSAEPROTONOSUPPORT: - return ACE_LIB_TEXT ("specified protocol not supported"); - /* NOTREACHED */ - case WSAEPROTOTYPE: - return ACE_LIB_TEXT ("protocol wrong type for this socket"); - /* NOTREACHED */ - case WSAESOCKTNOSUPPORT: - return ACE_LIB_TEXT ("socket type not supported for address family"); - /* NOTREACHED */ - case WSAENOTSOCK: - return ACE_LIB_TEXT ("handle is not a socket"); - /* NOTREACHED */ - case WSAEWOULDBLOCK: - return ACE_LIB_TEXT ("resource temporarily unavailable"); - /* NOTREACHED */ - case WSAEADDRINUSE: - return ACE_LIB_TEXT ("address already in use"); - /* NOTREACHED */ - case WSAECONNABORTED: - return ACE_LIB_TEXT ("connection aborted"); - /* NOTREACHED */ - case WSAECONNRESET: - return ACE_LIB_TEXT ("connection reset"); - /* NOTREACHED */ - case WSAENOTCONN: - return ACE_LIB_TEXT ("not connected"); - /* NOTREACHED */ - case WSAETIMEDOUT: - return ACE_LIB_TEXT ("connection timed out"); - /* NOTREACHED */ - case WSAECONNREFUSED: - return ACE_LIB_TEXT ("connection refused"); - /* NOTREACHED */ - case WSAEHOSTDOWN: - return ACE_LIB_TEXT ("host down"); - /* NOTREACHED */ - case WSAEHOSTUNREACH: - return ACE_LIB_TEXT ("host unreachable"); - /* NOTREACHED */ - case WSAEADDRNOTAVAIL: - return ACE_LIB_TEXT ("address not available"); - /* NOTREACHED */ - case WSAEISCONN: - return ACE_LIB_TEXT ("socket is already connected"); - /* NOTREACHED */ - case WSAENETRESET: - return ACE_LIB_TEXT ("network dropped connection on reset"); - /* NOTREACHED */ - case WSAEMSGSIZE: - return ACE_LIB_TEXT ("message too long"); - /* NOTREACHED */ - case WSAENETUNREACH: - return ACE_LIB_TEXT ("network is unreachable"); - /* NOTREACHED */ - case WSAEFAULT: - return ACE_LIB_TEXT ("bad address"); - /* NOTREACHED */ - case WSAEDISCON: - return ACE_LIB_TEXT ("graceful shutdown in progress"); - /* NOTREACHED */ - case WSAEACCES: - return ACE_LIB_TEXT ("permission denied"); - /* NOTREACHED */ - case WSAESHUTDOWN: - return ACE_LIB_TEXT ("cannot send after socket shutdown"); - /* NOTREACHED */ - case WSAEPROCLIM: - return ACE_LIB_TEXT ("too many processes"); - /* NOTREACHED */ - case WSAEALREADY: - return ACE_LIB_TEXT ("operation already in progress"); - /* NOTREACHED */ - case WSAEPFNOSUPPORT: - return ACE_LIB_TEXT ("protocol family not supported"); - /* NOTREACHED */ - case WSAENOPROTOOPT: - return ACE_LIB_TEXT ("bad protocol option"); - /* NOTREACHED */ - case WSATYPE_NOT_FOUND: - return ACE_LIB_TEXT ("class type not found"); - /* NOTREACHED */ - case WSAEOPNOTSUPP: - return ACE_LIB_TEXT ("operation not supported"); - /* NOTREACHED */ - case WSAEDESTADDRREQ: - return ACE_LIB_TEXT ("destination address required"); - /* NOTREACHED */ - default: - ACE_OS::sprintf (unknown_msg, ACE_LIB_TEXT ("unknown error: %d"), error); - return unknown_msg; - /* NOTREACHED */ - } -#else - ACE_UNUSED_ARG (error); - ACE_NOTSUP_RETURN (0); -#endif /* ACE_WIN32 */ -} - -bool -ACE::is_sock_error (int error) -{ -#if defined (ACE_WIN32) - switch (error) - { - case WSAVERNOTSUPPORTED: - case WSASYSNOTREADY: - case WSAEINVAL: - case WSAHOST_NOT_FOUND: - case WSATRY_AGAIN: - case WSANO_RECOVERY: - case WSANO_DATA: - /* - case WSANO_ADDRESS: - */ - case WSANOTINITIALISED: - case WSAENETDOWN: - case WSAEINPROGRESS: - case WSAEINTR: - case WSAEAFNOSUPPORT: - case WSAEMFILE: - case WSAENOBUFS: - case WSAEPROTONOSUPPORT: - case WSAEPROTOTYPE: - case WSAESOCKTNOSUPPORT: - case WSAENOTSOCK: - case WSAEWOULDBLOCK: - case WSAEADDRINUSE: - case WSAECONNABORTED: - case WSAECONNRESET: - case WSAENOTCONN: - case WSAETIMEDOUT: - case WSAECONNREFUSED: - case WSAEHOSTDOWN: - case WSAEHOSTUNREACH: - case WSAEADDRNOTAVAIL: - case WSAEISCONN: - case WSAENETRESET: - case WSAEMSGSIZE: - case WSAENETUNREACH: - case WSAEFAULT: - case WSAEDISCON: - case WSAEACCES: - case WSAESHUTDOWN: - case WSAEPROCLIM: - case WSAEALREADY: - case WSAEPFNOSUPPORT: - case WSAENOPROTOOPT: - case WSATYPE_NOT_FOUND: - case WSAEOPNOTSUPP: - return true; - } -#else - ACE_UNUSED_ARG (error); -#endif /* ACE_WIN32 */ - return false; -} - -char * -ACE::strndup (const char *str, size_t n) -{ - const char *t = str; - size_t len; - - // Figure out how long this string is (remember, it might not be - // NUL-terminated). - - for (len = 0; - len < n && *t++ != '\0'; - len++) - continue; - - char *s; - ACE_ALLOCATOR_RETURN (s, - (char *) ACE_OS::malloc (len + 1), - 0); - return ACE_OS::strsncpy (s, str, len + 1); -} - -#if defined (ACE_HAS_WCHAR) -wchar_t * -ACE::strndup (const wchar_t *str, size_t n) -{ - const wchar_t *t = str; - size_t len; - - // Figure out how long this string is (remember, it might not be - // NUL-terminated). - - for (len = 0; - len < n && *t++ != '\0'; - len++) - continue; - - wchar_t *s; - ACE_ALLOCATOR_RETURN (s, - static_cast ( - ACE_OS::malloc ((len + 1) * sizeof (wchar_t))), - 0); - return ACE_OS::strsncpy (s, str, len + 1); -} -#endif /* ACE_HAS_WCHAR */ - -char * -ACE::strnnew (const char *str, size_t n) -{ - const char *t = str; - size_t len; - - // Figure out how long this string is (remember, it might not be - // NUL-terminated). - - for (len = 0; - len < n && *t++ != L'\0'; - len++) - continue; - - char *s; - ACE_NEW_RETURN (s, - char[len + 1], - 0); - return ACE_OS::strsncpy (s, str, len + 1); -} - -#if defined (ACE_HAS_WCHAR) -wchar_t * -ACE::strnnew (const wchar_t *str, size_t n) -{ - const wchar_t *t = str; - size_t len; - - // Figure out how long this string is (remember, it might not be - // NUL-terminated). - - for (len = 0; - len < n && *t++ != ACE_TEXT_WIDE ('\0'); - len++) - continue; - - wchar_t *s; - ACE_NEW_RETURN (s, - wchar_t[len + 1], - 0); - return ACE_OS::strsncpy (s, str, len + 1); -} -#endif /* ACE_HAS_WCHAR */ - -const char * -ACE::strend (const char *s) -{ - while (*s++ != '\0') - continue; - - return s; -} - -#if defined ACE_HAS_WCHAR -const wchar_t * -ACE::strend (const wchar_t *s) -{ - while (*s++ != ACE_TEXT_WIDE ('\0')) - continue; - - return s; -} -#endif - -char * -ACE::strnew (const char *s) -{ - if (s == 0) - return 0; - char *t = 0; - ACE_NEW_RETURN (t, - char [::strlen (s) + 1], - 0); - if (t == 0) - return 0; - else - return ACE_OS::strcpy (t, s); -} - -#if defined (ACE_HAS_WCHAR) -wchar_t * -ACE::strnew (const wchar_t *s) -{ - if (s == 0) - return 0; - wchar_t *t = 0; - ACE_NEW_RETURN (t, - wchar_t[ACE_OS::strlen (s) + 1], - 0); - if (t == 0) - return 0; - else - return ACE_OS::strcpy (t, s); -} -#endif /* ACE_HAS_WCHAR */ - -inline static bool equal_char(char a, char b, bool case_sensitive) -{ - if (case_sensitive) - return a == b; - return ACE_OS::ace_tolower(a) == ACE_OS::ace_tolower(b); -} - -bool -ACE::wild_match(const char* str, const char* pat, bool case_sensitive) -{ - if (str == pat) - return true; - if (pat == 0 || str == 0) - return false; - - bool star = false; - const char* s = str; - const char* p = pat; - while (*s != '\0') - { - if (*p == '*') - { - star = true; - pat = p; - while (*++pat == '*'); - - if (*pat == '\0') - return true; - p = pat; - } - else if (*p == '?') - { - ++s; - ++p; - } - else if (! equal_char(*s, *p, case_sensitive)) - { - if (!star) - return false; - s = ++str; - p = pat; - } - else - { - ++s; - ++p; - } - } - if (*p == '*') - while (*++p == '*'); - - return *p == '\0'; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ACE.h b/ace/ACE.h deleted file mode 100644 index 0c2abd32ff3..00000000000 --- a/ace/ACE.h +++ /dev/null @@ -1,842 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ACE.h - * - * $Id$ - * - * This file contains value added ACE functions that extend the - * behavior of the UNIX and Win32 OS calls. - * - * All these ACE static functions are consolidated in a single place - * in order to manage the namespace better. These functions are put - * here rather than in @c ACE_OS in order to separate concerns. - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ACE_H -#define ACE_ACE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Flag_Manip.h" -#include "ace/Handle_Ops.h" -#include "ace/Lib_Find.h" -#include "ace/Init_ACE.h" -#include "ace/Sock_Connect.h" -#include "ace/Default_Constants.h" - -#if defined (CYGWIN32) -// Include math.h. math.h defines a macro log2 that conflicts with ACE::log2() -// which seems to only cause a problem on cygwin. Insuring that math.h is -// included first solves it since we define acelog2 as log2, then -// undefines log2. -# include "ace/os_include/os_math.h" -#endif - -// When log2 is defined as macro redefine it as acelog2 -#if defined (log2) -# define acelog2 log2 -# undef log2 -#endif /* log2 */ - -#if defined (ACE_EXPORT_MACRO) -# undef ACE_EXPORT_MACRO -#endif -#define ACE_EXPORT_MACRO ACE_Export - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -class ACE_Time_Value; -class ACE_Message_Block; -class ACE_Handle_Set; - -/** - * @namespace ACE - * - * @brief The namespace containing the ACE framework itself. - * - * The ACE namespace contains all types (classes, structures, - * typedefs, etc), and global functions and variables in the ACE - * framework. - */ -namespace ACE -{ - // = ACE version information. - /// e.g., the "5" in ACE 5.1.12. - extern ACE_Export u_int major_version (void); - - /// e.g., the "1" in ACE 5.1.12. - extern ACE_Export u_int minor_version (void); - - /// e.g., the "12" in ACE 5.1.12. - /// Returns 0 for "stable" (non-beta) releases. - extern ACE_Export u_int beta_version (void); - - // = C++ compiler version information. - /// E.g., the "SunPro C++" in SunPro C++ 4.32.0 - extern ACE_Export const ACE_TCHAR * compiler_name (void); - - /// E.g., the "4" in SunPro C++ 4.32.0 - extern ACE_Export u_int compiler_major_version (void); - - /// E.g., the "32" in SunPro C++ 4.32.0 - extern ACE_Export u_int compiler_minor_version (void); - - /// E.g., the "0" in SunPro C++ 4.32.0 - extern ACE_Export u_int compiler_beta_version (void); - - /// Check if error indicates the process being out of handles (file - /// descriptors). - extern ACE_Export int out_of_handles (int error); - - /// Simple wildcard matching function supporting '*' and '?' - /// return true if string s matches pattern. - extern ACE_Export bool wild_match(const char* s, const char* pattern, bool case_sensitive = true); - - /** - * @name I/O operations - * - * Notes on common parameters: - * - * @a handle is the connected endpoint that will be used for I/O. - * - * @a buf is the buffer to write from or receive into. - * - * @a len is the number of bytes to transfer. - * - * The @a timeout parameter in the following methods indicates how - * long to blocking trying to transfer data. If @a timeout == 0, - * then the call behaves as a normal send/recv call, i.e., for - * blocking sockets, the call will block until action is possible; - * for non-blocking sockets, @c EWOULDBLOCK will be returned if no - * action is immediately possible. - * - * If @a timeout != 0, the call will wait until the relative time - * specified in @a *timeout elapses. - * - * The "_n()" I/O methods keep looping until all the data has been - * transferred. These methods also work for sockets in non-blocking - * mode i.e., they keep looping on @c EWOULDBLOCK. @a timeout is - * used to make sure we keep making progress, i.e., the same timeout - * value is used for every I/O operation in the loop and the timeout - * is not counted down. - * - * The return values for the "*_n()" methods match the return values - * from the non "_n()" methods and are specified as follows: - * - * - On complete transfer, the number of bytes transferred is returned. - * - On timeout, -1 is returned, @c errno == @c ETIME. - * - On error, -1 is returned, @c errno is set to appropriate error. - * - On @c EOF, 0 is returned, @c errno is irrelevant. - * - * On partial transfers, i.e., if any data is transferred before - * timeout / error / @c EOF, @a bytes_transferred> will contain the - * number of bytes transferred. - * - * Methods with @a iovec parameter are I/O vector variants of the - * I/O operations. - * - * Methods with the extra @a flags argument will always result in - * @c send getting called. Methods without the extra @a flags - * argument will result in @c send getting called on Win32 - * platforms, and @c write getting called on non-Win32 platforms. - */ - //@{ - extern ACE_Export ssize_t recv (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0); - -#if defined (ACE_HAS_TLI) - - extern ACE_Export ssize_t t_rcv (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout = 0); - -#endif /* ACE_HAS_TLI */ - - extern ACE_Export ssize_t recv (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout = 0); - - extern ACE_Export ssize_t recvmsg (ACE_HANDLE handle, - struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout = 0); - - extern ACE_Export ssize_t recvfrom (ACE_HANDLE handle, - char *buf, - int len, - int flags, - struct sockaddr *addr, - int *addrlen, - const ACE_Time_Value *timeout = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - -#if defined (ACE_HAS_TLI) - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t t_rcv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - -#endif /* ACE_HAS_TLI */ - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - /// Receive into a variable number of pieces. - /** - * Accepts a variable, caller-specified, number of pointer/length - * pairs. Arguments following @a n are char *, size_t pairs. - * - * @param handle The I/O handle to receive on - * @param n The total number of char *, size_t pairs following @a n. - * - * @return -1 on error, else total number of bytes received. - */ - extern ACE_Export ssize_t recv (ACE_HANDLE handle, size_t n, ...); - - extern ACE_Export ssize_t recvv (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t recvv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - extern ACE_Export ssize_t recv_n (ACE_HANDLE handle, - ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - extern ACE_Export ssize_t send (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0); - -#if defined (ACE_HAS_TLI) - - extern ACE_Export ssize_t t_snd (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0); - -#endif /* ACE_HAS_TLI */ - - extern ACE_Export ssize_t send (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout = 0); - - extern ACE_Export ssize_t sendmsg (ACE_HANDLE handle, - const struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout = 0); - - extern ACE_Export ssize_t sendto (ACE_HANDLE handle, - const char *buf, - int len, - int flags, - const struct sockaddr *addr, - int addrlen, - const ACE_Time_Value *timeout = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - -#if defined (ACE_HAS_TLI) - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t t_snd_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - -#endif /* ACE_HAS_TLI */ - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - /// Varargs variant. - extern ACE_Export ssize_t send (ACE_HANDLE handle, size_t n, ...); - - extern ACE_Export ssize_t sendv (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t sendv_n (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - /// Send all the @a message_blocks chained through their @c next and - /// @c cont pointers. This call uses the underlying OS gather-write - /// operation to reduce the domain-crossing penalty. - extern ACE_Export ssize_t send_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - // = File system I/O functions (these don't support timeouts). - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t read_n (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bytes_transferred = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t write_n (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bytes_transferred = 0); - - /// Write all the @a message_blocks chained through their @c next - /// and @c cont pointers. This call uses the underlying OS - /// gather-write operation to reduce the domain-crossing penalty. - extern ACE_Export ssize_t write_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - size_t *bytes_transferred = 0); - - extern ACE_Export ssize_t readv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bytes_transferred = 0); - - extern ACE_Export ssize_t writev_n (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - size_t *bytes_transferred = 0); - //@} - - /** - * Wait up to @a timeout amount of time to passively establish a - * connection. This method doesn't perform the @c accept, it just - * does the timed wait. - */ - extern ACE_Export int handle_timed_accept (ACE_HANDLE listener, - ACE_Time_Value *timeout, - int restart); - - /** - * Wait up to @a timeout amount of time to complete an actively - * established non-blocking connection. If @a is_tli is non-0 then - * we are being called by a TLI wrapper (which behaves slightly - * differently from a socket wrapper). - */ - extern ACE_Export ACE_HANDLE handle_timed_complete ( - ACE_HANDLE listener, - const ACE_Time_Value *timeout, - int is_tli = 0); - - /** - * Reset the limit on the number of open handles. If @a new_limit - * == -1 set the limit to the maximum allowable. Otherwise, set - * the limit value to @a new_limit. If @a increase_limit_only is - * non-0 then only allow increases to the limit. - */ - extern ACE_Export int set_handle_limit (int new_limit = -1, - int increase_limit_only = 0); - - /** - * Returns the maximum number of open handles currently permitted in - * this process. This maximum may be extended using - * @c ACE::set_handle_limit. - */ - extern ACE_Export int max_handles (void); - - // = String functions -#if !defined (ACE_HAS_WINCE) - /** - * Return a dynamically allocated duplicate of @a str, substituting - * the environment variable if @c str[0] @c == @c '$'. Note that - * the pointer is allocated with @c ACE_OS::malloc and must be freed - * by @c ACE_OS::free. - */ - extern ACE_Export ACE_TCHAR *strenvdup (const ACE_TCHAR *str); -#endif /* ACE_HAS_WINCE */ - - /// Returns a pointer to the "end" of the string, i.e., the character - /// past the '\0'. - extern ACE_Export const char *strend (const char *s); - - /// This method is just like @c strdup, except that it uses - /// @c operator @c new rather than @c malloc. If @a s is NULL - /// returns NULL rather than segfaulting. - extern ACE_Export char *strnew (const char *s); - - /// Delete the memory allocated by @c strnew. - ACE_NAMESPACE_INLINE_FUNCTION void strdelete (char *s); - - /// Create a fresh new copy of @a str, up to @a n chars long. Uses - /// @c ACE_OS::malloc to allocate the new string. - extern ACE_Export char *strndup (const char *str, size_t n); - - /// Create a fresh new copy of @a str, up to @a n chars long. Uses - /// @c ACE_OS::malloc to allocate the new string. - extern ACE_Export char *strnnew (const char *str, size_t n); - -#if defined (ACE_HAS_WCHAR) - extern ACE_Export const wchar_t *strend (const wchar_t *s); - - extern ACE_Export wchar_t *strnew (const wchar_t *s); - - ACE_NAMESPACE_INLINE_FUNCTION void strdelete (wchar_t *s); - - extern ACE_Export wchar_t *strndup (const wchar_t *str, size_t n); - - extern ACE_Export wchar_t *strnnew (const wchar_t *str, size_t n); - -#endif /* ACE_HAS_WCHAR */ - - /** - * On Windows, determines if a specified pathname ends with ".exe" - * (not case sensitive). If on Windows and there is no ".exe" suffix, - * a new ACE_TCHAR array is allocated and a copy of @c pathname with - * the ".exe" suffix is copied into it. In this case, the caller is - * responsible for calling delete [] on the returned pointer. - * - * @param pathname The name to check for a proper suffix. - * - * @retval @c pathname if there is a proper suffix for Windows. This is - * always the return value for non-Windows platforms. - * @retval If a suffix needs to be added, returns a pointer to new[] - * allocated memory containing the original @c pathname plus - * a ".exe" suffix. The caller is responsible for freeing the - * memory using delete []. - */ - extern ACE_Export const ACE_TCHAR *execname (const ACE_TCHAR *pathname); - - /** - * Returns the "basename" of a @a pathname separated by @a delim. - * For instance, the basename of "/tmp/foo.cpp" is "foo.cpp" when - * @a delim is @a '/'. - */ - extern ACE_Export const ACE_TCHAR *basename (const ACE_TCHAR *pathname, - ACE_TCHAR delim = - ACE_DIRECTORY_SEPARATOR_CHAR); - - /** - * Returns the "dirname" of a @a pathname. For instance, the - * dirname of "/tmp/foo.cpp" is "/tmp" when @a delim is @a '/'. If - * @a pathname has no @a delim ".\0" is returned. This method does - * not modify @a pathname and is not reentrant. - */ - extern ACE_Export const ACE_TCHAR *dirname (const ACE_TCHAR *pathname, - ACE_TCHAR delim = - ACE_DIRECTORY_SEPARATOR_CHAR); - - /** - * Returns the current timestamp in the form - * "hour:minute:second:microsecond." The month, day, and year are - * also stored in the beginning of the @a date_and_time array, which - * is a user-supplied array of size @a time_len> @c ACE_TCHARs. - * Returns 0 if unsuccessful, else returns pointer to beginning of the - * "time" portion of @a date_and_time. If @a - * return_pointer_to_first_digit is 0 then return a pointer to the - * space before the time, else return a pointer to the beginning of - * the time portion. - */ - extern ACE_Export ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[], - int time_len, - int return_pointer_to_first_digit = - 0); - - /** - * if @a avoid_zombies == 0 call @c ACE_OS::fork directly, else - * create an orphan process that's inherited by the init process; - * init cleans up when the orphan process terminates so we don't - * create zombies. Returns -1 on failure and either the child PID - * on success if @a avoid_zombies == 0 or 1 on success if @a - * avoid_zombies != 0 (this latter behavior is a known bug that - * needs to be fixed). - */ - extern ACE_Export pid_t fork ( - const ACE_TCHAR *program_name = ACE_LIB_TEXT (""), - int avoid_zombies = 0); - - /** - * Become a daemon process using the algorithm in Richard Stevens - * "Advanced Programming in the UNIX Environment." If - * @a close_all_handles is non-zero then all open file handles are - * closed. - */ - extern ACE_Export int daemonize ( - const ACE_TCHAR pathname[] = ACE_LIB_TEXT ("/"), - int close_all_handles = ACE_DEFAULT_CLOSE_ALL_HANDLES, - const ACE_TCHAR program_name[] = ACE_LIB_TEXT ("")); - - // = Miscellaneous functions. - /// Rounds the request to a multiple of the page size. - extern ACE_Export size_t round_to_pagesize (off_t len); - - /// Rounds the request to a multiple of the allocation granularity. - extern ACE_Export size_t round_to_allocation_granularity (off_t len); - - // @@ UNICODE what about buffer? - /// Format buffer into printable format. This is useful for - /// debugging. - extern ACE_Export size_t format_hexdump (const char *buffer, size_t size, - ACE_TCHAR *obuf, size_t obuf_sz); - - /// Computes the hash value of {str} using the "Hash PJW" routine. - extern ACE_Export u_long hash_pjw (const char *str); - - /// Computes the hash value of {str} using the "Hash PJW" routine. - extern ACE_Export u_long hash_pjw (const char *str, size_t len); - -#if defined (ACE_HAS_WCHAR) - /// Computes the hash value of {str} using the "Hash PJW" routine. - extern ACE_Export u_long hash_pjw (const wchar_t *str); - - /// Computes the hash value of {str} using the "Hash PJW" routine. - extern ACE_Export u_long hash_pjw (const wchar_t *str, size_t len); -#endif /* ACE_HAS_WCHAR */ - - /// Computes CRC-CCITT for the string. - extern ACE_Export ACE_UINT16 crc_ccitt(const char *str); - - /// Computes CRC-CCITT for the buffer. - extern ACE_Export ACE_UINT16 crc_ccitt(const void *buf, size_t len, - ACE_UINT16 crc = 0); - - /// Computes CRC-CCITT for the @ len iovec buffers. - extern ACE_Export ACE_UINT16 crc_ccitt(const iovec *iov, int len, - ACE_UINT16 crc = 0); - - /// Computes the ISO 8802-3 standard 32 bits CRC for the string. - extern ACE_Export ACE_UINT32 crc32 (const char *str); - - /// Computes the ISO 8802-3 standard 32 bits CRC for the buffer. - extern ACE_Export ACE_UINT32 crc32 (const void *buf, size_t len, - ACE_UINT32 crc = 0); - - /// Computes the ISO 8802-3 standard 32 bits CRC for the - /// @ len iovec buffers. - extern ACE_Export ACE_UINT32 crc32 (const iovec *iov, int len, - ACE_UINT32 crc = 0); - - /// Euclid's greatest common divisor algorithm. - extern ACE_Export u_long gcd (u_long x, u_long y); - - /// Calculates the minimum enclosing frame size for the given values. - extern ACE_Export u_long minimum_frame_size (u_long period1, u_long period2); - - /** - * Function that can burn up noticeable CPU time: brute-force - * determination of whether number @a n is prime. Returns 0 if - * it is prime, or the smallest factor if it is not prime. - * @a min_factor and @a max_factor can be used to partition the work - * among threads. For just one thread, typical values are 2 and - * n/2. - */ - extern ACE_Export u_long is_prime (const u_long n, - const u_long min_factor, - const u_long max_factor); - - /// Map troublesome win32 errno values to values that standard C - /// strerr function understands. Thank you Microsoft. - extern ACE_Export int map_errno (int error); - - /// Returns a string containing the error message corresponding to a - /// WinSock error. This works around an omission in the Win32 API. - /// @internal - extern ACE_Export const ACE_TCHAR * sock_error (int error); - - /// Determins whether the given error code corresponds to to a - /// WinSock error. If so returns true, false otherwise. - /// @internal - extern ACE_Export bool is_sock_error (int error); - - /** - * Checks if process with {pid} is still alive. Returns 1 if it is - * still alive, 0 if it isn't alive, and -1 if something weird - * happened. - */ - extern ACE_Export int process_active (pid_t pid); - - /** - * Terminate the process abruptly with id @a pid. On Win32 platforms - * this uses {TerminateProcess} and on POSIX platforms is uses - * {kill} with the -9 (SIGKILL) signal, which cannot be caught or - * ignored. Note that this call is potentially dangerous to use - * since the process being terminated may not have a chance to - * cleanup before it shuts down. - */ - extern ACE_Export int terminate_process (pid_t pid); - - /** - * This method uses process id and object pointer to come up with a - * machine wide unique name. The process ID will provide uniqueness - * between processes on the same machine. The "this" pointer of the - * {object} will provide uniqueness between other "live" objects in - * the same process. The uniqueness of this name is therefore only - * valid for the life of {object}. - */ - ACE_NAMESPACE_INLINE_FUNCTION void unique_name (const void *object, - ACE_TCHAR *name, - size_t length); - - /// Computes the base 2 logarithm of {num}. - ACE_NAMESPACE_INLINE_FUNCTION u_long log2 (u_long num); - - /// Hex conversion utility. - ACE_NAMESPACE_INLINE_FUNCTION ACE_TCHAR nibble2hex (u_int n); - - /// Convert a hex character to its byte representation. - ACE_NAMESPACE_INLINE_FUNCTION u_char hex2byte (ACE_TCHAR c); - - // = Set/get the debug level. - extern ACE_Export bool debug (void); - extern ACE_Export void debug (bool onoff); - - /// Wrapper facade for @c select that uses @c ACE_Handle_Sets. - extern ACE_Export int select (int width, - ACE_Handle_Set *readfds, - ACE_Handle_Set *writefds = 0, - ACE_Handle_Set *exceptfds = 0, - const ACE_Time_Value *timeout = 0); - - /// Wrapper facade for the most common use of @c select that uses - /// @c ACE_Handle_Sets. - extern ACE_Export int select (int width, - ACE_Handle_Set &readfds, - const ACE_Time_Value *timeout = 0); - - /// Timed wait for handle to get read ready. - ACE_NAMESPACE_INLINE_FUNCTION - int handle_read_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout); - - /// Timed wait for handle to get write ready. - ACE_NAMESPACE_INLINE_FUNCTION - int handle_write_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout); - - /// Timed wait for handle to get exception ready. - ACE_NAMESPACE_INLINE_FUNCTION - int handle_exception_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout); - - /// Timed wait for handle to get read, write, or exception ready. - extern ACE_Export int handle_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int read_ready, - int write_ready, - int exception_ready); - - /// Wait for @a timeout before proceeding to a @c recv operation. - /// @a val keeps track of whether we're in non-blocking mode or - /// not. - extern ACE_Export int enter_recv_timedwait (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int &val); - - /// Wait for @a timeout before proceeding to a @c send operation. - /// @a val keeps track of whether we're in non-blocking mode or - /// not. - extern ACE_Export int enter_send_timedwait (ACE_HANDLE handle, - const ACE_Time_Value* timeout, - int &val); - - /// This makes sure that @a handle is set into non-blocking mode. - /// @a val keeps track of whether were in non-blocking mode or not. - extern ACE_Export void record_and_set_non_blocking_mode (ACE_HANDLE handle, - int &val); - - /// Cleanup after a timed operation, restore the appropriate - /// non-blocking status of @a handle. - extern ACE_Export void restore_non_blocking_mode (ACE_HANDLE handle, - int val); - - // private: - // These functions aren't meant to be used internally, so they are - // not exported. - - // - // = Recv_n helpers - // - - ACE_NAMESPACE_INLINE_FUNCTION ssize_t recv_i (ACE_HANDLE handle, - void *buf, - size_t len); - - extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - size_t *bytes_transferred); - - extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -#if defined (ACE_HAS_TLI) - - extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - size_t *bytes_transferred); - - extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -#endif /* ACE_HAS_TLI */ - - extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bytes_transferred); - - extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - - extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bytes_transferred); - - extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - - // - // = Send_n helpers - // - - ACE_NAMESPACE_INLINE_FUNCTION ssize_t send_i (ACE_HANDLE handle, - const void *buf, - size_t len); - - extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bytes_transferred); - - extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -#if defined (ACE_HAS_TLI) - - extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bytes_transferred); - - extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -#endif /* ACE_HAS_TLI */ - - extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bytes_transferred); - - extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - - extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - size_t *bytes_transferred); - - extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ACE.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (acelog2) -# define log2 acelog2 -#endif /* acelog2 */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ACE_H */ diff --git a/ace/ACE.inl b/ace/ACE.inl deleted file mode 100644 index 704941a5b20..00000000000 --- a/ace/ACE.inl +++ /dev/null @@ -1,336 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_Thread.h" -#include "ace/os_include/os_ctype.h" -#include "ace/OS_NS_sys_socket.h" - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - - -// Wrappers for methods that have been moved to ACE_OS. - -ACE_INLINE ssize_t -ACE::read_n (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bytes_transferred) -{ - return ACE_OS::read_n (handle, - buf, - len, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::write_n (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bytes_transferred) -{ - return ACE_OS::write_n (handle, - buf, - len, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::recv_n_i (handle, - buf, - len, - flags, - bytes_transferred); - else - return ACE::recv_n_i (handle, - buf, - len, - flags, - timeout, - bytes_transferred); -} - -#if defined (ACE_HAS_TLI) - -ACE_INLINE ssize_t -ACE::t_rcv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::t_rcv_n_i (handle, - buf, - len, - flags, - bytes_transferred); - else - return ACE::t_rcv_n_i (handle, - buf, - len, - flags, - timeout, - bytes_transferred); -} - -#endif /* ACE_HAS_TLI */ - -ACE_INLINE ssize_t -ACE::recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::recv_n_i (handle, - buf, - len, - bytes_transferred); - else - return ACE::recv_n_i (handle, - buf, - len, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::recvv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::recvv_n_i (handle, - iov, - iovcnt, - bytes_transferred); - else - return ACE::recvv_n_i (handle, - iov, - iovcnt, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::send_n_i (handle, - buf, - len, - flags, - bytes_transferred); - else - return ACE::send_n_i (handle, - buf, - len, - flags, - timeout, - bytes_transferred); -} - -#if defined (ACE_HAS_TLI) - -ACE_INLINE ssize_t -ACE::t_snd_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::t_snd_n_i (handle, - buf, - len, - flags, - bytes_transferred); - else - return ACE::t_snd_n_i (handle, - buf, - len, - flags, - timeout, - bytes_transferred); -} - -#endif /* ACE_HAS_TLI */ - -ACE_INLINE ssize_t -ACE::send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::send_n_i (handle, - buf, - len, - bytes_transferred); - else - return ACE::send_n_i (handle, - buf, - len, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::sendv_n (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::sendv_n_i (handle, - iov, - iovcnt, - bytes_transferred); - else - return ACE::sendv_n_i (handle, - iov, - iovcnt, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len) -{ -#if defined (ACE_WIN32) || defined (HPUX) - return ACE_OS::send (handle, (const char *) buf, len); -#else - return ACE_OS::write (handle, (const char *) buf, len); -#endif /* ACE_WIN32 */ -} - -ACE_INLINE ssize_t -ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len) -{ -#if defined (ACE_WIN32) || defined (ACE_OPENVMS) || defined (ACE_TANDEM_T1248_PTHREADS) - return ACE_OS::recv (handle, (char *) buf, len); -#else - return ACE_OS::read (handle, (char *) buf, len); -#endif /* ACE_WIN32 */ -} - -ACE_INLINE int -ACE::handle_read_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout) -{ - return ACE::handle_ready (handle, - timeout, - 1, - 0, - 0); -} - -ACE_INLINE int -ACE::handle_write_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout) -{ - return ACE::handle_ready (handle, - timeout, - 0, - 1, - 0); -} - -ACE_INLINE int -ACE::handle_exception_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout) -{ - return ACE::handle_ready (handle, - timeout, - 0, - 0, - 1); -} - -ACE_INLINE void -ACE::strdelete (char *s) -{ - delete [] s; -} - -#if defined (ACE_HAS_WCHAR) -ACE_INLINE void -ACE::strdelete (wchar_t *s) -{ - delete [] s; -} -#endif /* ACE_HAS_WCHAR */ - -ACE_INLINE void -ACE::unique_name (const void *object, - ACE_TCHAR *name, - size_t length) -{ - ACE_OS::unique_name (object, name, length); -} - -ACE_INLINE u_long -ACE::log2 (u_long num) -{ - u_long log = 0; - - for (; num > 1; ++log) - num >>= 1; - - return log; -} - -ACE_INLINE ACE_TCHAR -ACE::nibble2hex (u_int n) -{ - // Hexadecimal characters. -#if defined (ACE_VXWORKS) && !defined (__DCPLUSPLUS__) - // temporary solution to prevent Windriver GNU toolchains from spewing - // loads of warnings when inlining. - // problem (incorrect warning leftover from older GNU) has been reported as - // TSR to Windriver. - const ACE_TCHAR hex_chars[] = ACE_LIB_TEXT ("0123456789abcdef"); -#else - static const ACE_TCHAR hex_chars[] = ACE_LIB_TEXT ("0123456789abcdef"); -#endif - - // @@ UNICODE does this work? - return hex_chars[n & 0x0f]; -} - -ACE_INLINE u_char -ACE::hex2byte (ACE_TCHAR c) -{ - if (isdigit (c)) - return (u_char) (c - ACE_LIB_TEXT ('0')); - else if (islower (c)) - return (u_char) (10 + c - ACE_LIB_TEXT ('a')); - else - return (u_char) (10 + c - ACE_LIB_TEXT ('A')); -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ACE.pc.in b/ace/ACE.pc.in deleted file mode 100644 index 90b2a9eebd7..00000000000 --- a/ace/ACE.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ACE -Description: ADAPTIVE Communication Environment -Version: @VERSION@ -Libs: -L${libdir} -lACE @LIBS@ -Cflags: -I${includedir} diff --git a/ace/ACE_FlReactor.pc.in b/ace/ACE_FlReactor.pc.in deleted file mode 100644 index c284481585d..00000000000 --- a/ace/ACE_FlReactor.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ACE_FlReactor -Description: ACE FlReactor Library -Requires: ACE -Version: @VERSION@ -Libs: -L${libdir} -lACE_FlReactor -Cflags: -I${includedir} diff --git a/ace/ACE_FlReactor_export.h b/ace/ACE_FlReactor_export.h deleted file mode 100644 index ad2cd587f3a..00000000000 --- a/ace/ACE_FlReactor_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s ACE_FlReactor -// ------------------------------ -#ifndef ACE_FLREACTOR_EXPORT_H -#define ACE_FLREACTOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_FLREACTOR_HAS_DLL) -# define ACE_FLREACTOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_FLREACTOR_HAS_DLL */ - -#if !defined (ACE_FLREACTOR_HAS_DLL) -# define ACE_FLREACTOR_HAS_DLL 1 -#endif /* ! ACE_FLREACTOR_HAS_DLL */ - -#if defined (ACE_FLREACTOR_HAS_DLL) && (ACE_FLREACTOR_HAS_DLL == 1) -# if defined (ACE_FLREACTOR_BUILD_DLL) -# define ACE_FlReactor_Export ACE_Proper_Export_Flag -# define ACE_FLREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_FLREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_FLREACTOR_BUILD_DLL */ -# define ACE_FlReactor_Export ACE_Proper_Import_Flag -# define ACE_FLREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_FLREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_FLREACTOR_BUILD_DLL */ -#else /* ACE_FLREACTOR_HAS_DLL == 1 */ -# define ACE_FlReactor_Export -# define ACE_FLREACTOR_SINGLETON_DECLARATION(T) -# define ACE_FLREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_FLREACTOR_HAS_DLL == 1 */ - -// Set ACE_FLREACTOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_FLREACTOR_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_FLREACTOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_FLREACTOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_FLREACTOR_NTRACE */ - -#if (ACE_FLREACTOR_NTRACE == 1) -# define ACE_FLREACTOR_TRACE(X) -#else /* (ACE_FLREACTOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_FLREACTOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_FLREACTOR_NTRACE == 1) */ - -#endif /* ACE_FLREACTOR_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/ACE_QtReactor.pc.in b/ace/ACE_QtReactor.pc.in deleted file mode 100644 index 4e7aa83e6be..00000000000 --- a/ace/ACE_QtReactor.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ACE_QtReactor -Description: ACE QtReactor Library -Requires: ACE -Version: @VERSION@ -Libs: -L${libdir} -lACE_QtReactor -Cflags: -I${includedir} diff --git a/ace/ACE_QtReactor_export.h b/ace/ACE_QtReactor_export.h deleted file mode 100644 index 850d2d4dab1..00000000000 --- a/ace/ACE_QtReactor_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s ACE_QtReactor -// ------------------------------ -#ifndef ACE_QTREACTOR_EXPORT_H -#define ACE_QTREACTOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_QTREACTOR_HAS_DLL) -# define ACE_QTREACTOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_QTREACTOR_HAS_DLL */ - -#if !defined (ACE_QTREACTOR_HAS_DLL) -# define ACE_QTREACTOR_HAS_DLL 1 -#endif /* ! ACE_QTREACTOR_HAS_DLL */ - -#if defined (ACE_QTREACTOR_HAS_DLL) && (ACE_QTREACTOR_HAS_DLL == 1) -# if defined (ACE_QTREACTOR_BUILD_DLL) -# define ACE_QtReactor_Export ACE_Proper_Export_Flag -# define ACE_QTREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_QTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_QTREACTOR_BUILD_DLL */ -# define ACE_QtReactor_Export ACE_Proper_Import_Flag -# define ACE_QTREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_QTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_QTREACTOR_BUILD_DLL */ -#else /* ACE_QTREACTOR_HAS_DLL == 1 */ -# define ACE_QtReactor_Export -# define ACE_QTREACTOR_SINGLETON_DECLARATION(T) -# define ACE_QTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_QTREACTOR_HAS_DLL == 1 */ - -// Set ACE_QTREACTOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_QTREACTOR_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_QTREACTOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_QTREACTOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_QTREACTOR_NTRACE */ - -#if (ACE_QTREACTOR_NTRACE == 1) -# define ACE_QTREACTOR_TRACE(X) -#else /* (ACE_QTREACTOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_QTREACTOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_QTREACTOR_NTRACE == 1) */ - -#endif /* ACE_QTREACTOR_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/ACE_TkReactor.pc.in b/ace/ACE_TkReactor.pc.in deleted file mode 100644 index e53797e600c..00000000000 --- a/ace/ACE_TkReactor.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ACE_TkReactor -Description: ACE TkReactor Library -Requires: ACE -Version: @VERSION@ -Libs: -L${libdir} -lACE_TkReactor -Cflags: -I${includedir} diff --git a/ace/ACE_TkReactor_export.h b/ace/ACE_TkReactor_export.h deleted file mode 100644 index 096828b9b0e..00000000000 --- a/ace/ACE_TkReactor_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s ACE_TkReactor -// ------------------------------ -#ifndef ACE_TKREACTOR_EXPORT_H -#define ACE_TKREACTOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_TKREACTOR_HAS_DLL) -# define ACE_TKREACTOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_TKREACTOR_HAS_DLL */ - -#if !defined (ACE_TKREACTOR_HAS_DLL) -# define ACE_TKREACTOR_HAS_DLL 1 -#endif /* ! ACE_TKREACTOR_HAS_DLL */ - -#if defined (ACE_TKREACTOR_HAS_DLL) && (ACE_TKREACTOR_HAS_DLL == 1) -# if defined (ACE_TKREACTOR_BUILD_DLL) -# define ACE_TkReactor_Export ACE_Proper_Export_Flag -# define ACE_TKREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_TKREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_TKREACTOR_BUILD_DLL */ -# define ACE_TkReactor_Export ACE_Proper_Import_Flag -# define ACE_TKREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_TKREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_TKREACTOR_BUILD_DLL */ -#else /* ACE_TKREACTOR_HAS_DLL == 1 */ -# define ACE_TkReactor_Export -# define ACE_TKREACTOR_SINGLETON_DECLARATION(T) -# define ACE_TKREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_TKREACTOR_HAS_DLL == 1 */ - -// Set ACE_TKREACTOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_TKREACTOR_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_TKREACTOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_TKREACTOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_TKREACTOR_NTRACE */ - -#if (ACE_TKREACTOR_NTRACE == 1) -# define ACE_TKREACTOR_TRACE(X) -#else /* (ACE_TKREACTOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_TKREACTOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_TKREACTOR_NTRACE == 1) */ - -#endif /* ACE_TKREACTOR_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/ACE_XtReactor.pc.in b/ace/ACE_XtReactor.pc.in deleted file mode 100644 index 118c61c5632..00000000000 --- a/ace/ACE_XtReactor.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ACE_XtReactor -Description: ACE XtReactor Library -Requires: ACE -Version: @VERSION@ -Libs: -L${libdir} -lACE_XtReactor -Cflags: -I${includedir} diff --git a/ace/ACE_XtReactor_export.h b/ace/ACE_XtReactor_export.h deleted file mode 100644 index b7e6a55cd08..00000000000 --- a/ace/ACE_XtReactor_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s ACE_XtReactor -// ------------------------------ -#ifndef ACE_XTREACTOR_EXPORT_H -#define ACE_XTREACTOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_XTREACTOR_HAS_DLL) -# define ACE_XTREACTOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_XTREACTOR_HAS_DLL */ - -#if !defined (ACE_XTREACTOR_HAS_DLL) -# define ACE_XTREACTOR_HAS_DLL 1 -#endif /* ! ACE_XTREACTOR_HAS_DLL */ - -#if defined (ACE_XTREACTOR_HAS_DLL) && (ACE_XTREACTOR_HAS_DLL == 1) -# if defined (ACE_XTREACTOR_BUILD_DLL) -# define ACE_XtReactor_Export ACE_Proper_Export_Flag -# define ACE_XTREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_XTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_XTREACTOR_BUILD_DLL */ -# define ACE_XtReactor_Export ACE_Proper_Import_Flag -# define ACE_XTREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_XTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_XTREACTOR_BUILD_DLL */ -#else /* ACE_XTREACTOR_HAS_DLL == 1 */ -# define ACE_XtReactor_Export -# define ACE_XTREACTOR_SINGLETON_DECLARATION(T) -# define ACE_XTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_XTREACTOR_HAS_DLL == 1 */ - -// Set ACE_XTREACTOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_XTREACTOR_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_XTREACTOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_XTREACTOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_XTREACTOR_NTRACE */ - -#if (ACE_XTREACTOR_NTRACE == 1) -# define ACE_XTREACTOR_TRACE(X) -#else /* (ACE_XTREACTOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_XTREACTOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_XTREACTOR_NTRACE == 1) */ - -#endif /* ACE_XTREACTOR_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/ACE_crc32.cpp b/ace/ACE_crc32.cpp deleted file mode 100644 index f9e91c652ce..00000000000 --- a/ace/ACE_crc32.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// $Id$ - -#include "ace/ACE.h" - -ACE_RCSID (ace, - ACE_crc32, - "$Id$") - - -namespace -{ - /*****************************************************************/ - /* */ - /* CRC LOOKUP TABLE */ - /* ================ */ - /* The following CRC lookup table was generated automagically */ - /* by the Rocksoft^tm Model CRC Algorithm Table Generation */ - /* Program V1.0 using the following model parameters: */ - /* */ - /* Width : 4 bytes. */ - /* Poly : 0x04C11DB7L */ - /* Reverse : TRUE. */ - /* */ - /* For more information on the Rocksoft^tm Model CRC Algorithm, */ - /* see the document titled "A Painless Guide to CRC Error */ - /* Detection Algorithms" by Ross Williams */ - /* (ross@guest.adelaide.edu.au.). This document is likely to be */ - /* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ - /* */ - /*****************************************************************/ - - const ACE_UINT32 crc_table[] = - { - 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, - 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, - 0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L, - 0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L, - 0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL, - 0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L, - 0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL, - 0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L, - 0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L, - 0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL, - 0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L, - 0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L, - 0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L, - 0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL, - 0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L, - 0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL, - 0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL, - 0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L, - 0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L, - 0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L, - 0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL, - 0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L, - 0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL, - 0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L, - 0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L, - 0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL, - 0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L, - 0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L, - 0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L, - 0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL, - 0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L, - 0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL, - 0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL, - 0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L, - 0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L, - 0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L, - 0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL, - 0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L, - 0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL, - 0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L, - 0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L, - 0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL, - 0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L, - 0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L, - 0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L, - 0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL, - 0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L, - 0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL, - 0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL, - 0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L, - 0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L, - 0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L, - 0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL, - 0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L, - 0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL, - 0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L, - 0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L, - 0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL, - 0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L, - 0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L, - 0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L, - 0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL, - 0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L, - 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL - }; - - /*****************************************************************/ - /* End of CRC Lookup Table */ - /*****************************************************************/ -} - -#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_UINT32 -ACE::crc32 (const char *string) -{ - ACE_UINT32 crc = 0xFFFFFFFF; - - for (const char *p = string; - *p != 0; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT32 -ACE::crc32 (const void *buffer, size_t len, ACE_UINT32 crc) -{ - crc = ~crc; - - for (const char *p = (const char *) buffer, - *e = (const char *) buffer + len; - p != e; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT32 -ACE::crc32 (const iovec *iov, int len, ACE_UINT32 crc) -{ - crc = ~crc; - - for (int i = 0; i < len; ++i) - { - for (const char *p = (const char *) iov[i].iov_base, - *e = (const char *) iov[i].iov_base + iov[i].iov_len; - p != e; - ++p) - COMPUTE (crc, *p); - } - - return ~crc; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#undef COMPUTE diff --git a/ace/ACE_crc_ccitt.cpp b/ace/ACE_crc_ccitt.cpp deleted file mode 100644 index f591b53aa10..00000000000 --- a/ace/ACE_crc_ccitt.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// $Id$ - -#include "ace/ACE.h" - -ACE_RCSID (ace, - ACE_crc_ccitt, - "$Id$") - -namespace -{ - /*****************************************************************/ - /* */ - /* CRC LOOKUP TABLE */ - /* ================ */ - /* The following CRC lookup table was generated automagically */ - /* by the Rocksoft^tm Model CRC Algorithm Table Generation */ - /* Program V1.0 using the following model parameters: */ - /* */ - /* Width : 2 bytes. */ - /* Poly : 0x1021 */ - /* Reverse : TRUE. */ - /* */ - /* For more information on the Rocksoft^tm Model CRC Algorithm, */ - /* see the document titled "A Painless Guide to CRC Error */ - /* Detection Algorithms" by Ross Williams */ - /* (ross@guest.adelaide.edu.au.). This document is likely to be */ - /* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ - /* */ - /*****************************************************************/ - - const ACE_UINT16 crc_table[] = - { - 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, - 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, - 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, - 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, - 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, - 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, - 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, - 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, - 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, - 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, - 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, - 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, - 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, - 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, - 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, - 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, - 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, - 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, - 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, - 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, - 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, - 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, - 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, - 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, - 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, - 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, - 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, - 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, - 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, - 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, - 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, - 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 - }; - - /*****************************************************************/ - /* End of CRC Lookup Table */ - /*****************************************************************/ -} - -#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_UINT16 -ACE::crc_ccitt (const char *string) -{ - ACE_UINT16 crc = 0xFFFF; - - for (const char *p = string; - *p != 0; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT16 -ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc) -{ - crc = ~crc; - - for (const char *p = (const char *) buffer, - *e = (const char *) buffer + len; - p != e; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT16 -ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc) -{ - crc = ~crc; - - for (int i = 0; i < len; ++i) - { - for (const char *p = (const char *) iov[i].iov_base, - *e = (const char *) iov[i].iov_base + iov[i].iov_len; - p != e; - ++p) - COMPUTE (crc, *p); - } - - return ~crc; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#undef COMPUTE diff --git a/ace/ACE_export.h b/ace/ACE_export.h deleted file mode 100644 index 0261c704c68..00000000000 --- a/ace/ACE_export.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by -// generate_export_file.pl -// ------------------------------ - -#ifndef ACE_EXPORT_H -#define ACE_EXPORT_H - -#include "ace/config-lite.h" - -#if defined (ACE_AS_STATIC_LIBS) - -# if !defined (ACE_HAS_DLL) -# define ACE_HAS_DLL 0 -# endif /* ! ACE_HAS_DLL */ -#else -# if !defined (ACE_HAS_DLL) -# define ACE_HAS_DLL 1 -# endif /* ! ACE_HAS_DLL */ -#endif /* ACE_AS_STATIC_LIB */ - -#if defined (ACE_HAS_DLL) -# if (ACE_HAS_DLL == 1) -# if defined (ACE_BUILD_DLL) -# define ACE_Export ACE_Proper_Export_Flag -# define ACE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else -# define ACE_Export ACE_Proper_Import_Flag -# define ACE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_BUILD_DLL */ -# else -# define ACE_Export -# define ACE_SINGLETON_DECLARATION(T) -# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ! ACE_HAS_DLL == 1 */ -#else -# define ACE_Export -# define ACE_SINGLETON_DECLARATION(T) -# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_HAS_DLL */ - -// Added by hand to help with ACE_OS namespace -#if defined (__TANDEM) && defined (USE_EXPLICIT_EXPORT) -#define ACE_NAMESPACE_STORAGE_CLASS ACE_EXPORT_MACRO extern -#else -#define ACE_NAMESPACE_STORAGE_CLASS extern ACE_EXPORT_MACRO -#endif - -#if defined (__ACE_INLINE__) -# if defined (_MSC_VER) || defined (__MINGW32__) || defined (CYGWIN32) || \ - (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x560) || \ - (defined (__HP_aCC) && (__HP_aCC >= 60500)) -# define ACE_NAMESPACE_INLINE_FUNCTION inline -# else -# define ACE_NAMESPACE_INLINE_FUNCTION ACE_NAMESPACE_STORAGE_CLASS inline -# endif -# define ACE_INLINE_TEMPLATE_FUNCTION inline -#else -# define ACE_NAMESPACE_INLINE_FUNCTION ACE_NAMESPACE_STORAGE_CLASS -// Microsoft Visual C++ will accept 'extern'; others refuse. -# if defined (_MSC_VER) || defined (__BORLANDC__) -# define ACE_INLINE_TEMPLATE_FUNCTION ACE_Export -# else -# define ACE_INLINE_TEMPLATE_FUNCTION -# endif -#endif - -#endif /* ACE_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/ARGV.cpp b/ace/ARGV.cpp deleted file mode 100644 index 8ef7d441afb..00000000000 --- a/ace/ARGV.cpp +++ /dev/null @@ -1,303 +0,0 @@ -// $Id$ - -#ifndef ACE_ARGV_CPP -#define ACE_ARGV_CPP - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_Memory.h" - -#if !defined (__ACE_INLINE__) -#include "ace/ARGV.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, ARGV, "$Id$") - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_ARGV) - -template -void -ACE_ARGV_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ARGV_T::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("argc_ = %d"), this->argc_)); - - ACE_ARGV *this_obj = const_cast (this); - - for (int i = 0; i < this->argc_; i++) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\nargv_[%i] = %s"), - i, - this_obj->argv ()[i])); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nbuf = %s\n"), this->buf_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Creates this->argv_ out of this->buf_. New memory is allocated for -// each element of the array. This is used by the array-to-string -// style constructor and for creating this->argv_ when in iterative -// mode. - -template -int -ACE_ARGV_T::string_to_argv (void) -{ - ACE_TRACE ("ACE_ARGV_T::string_to_argv"); - - return ACE_OS::string_to_argv (this->buf_, - this->argc_, - this->argv_, - this->substitute_env_args_); -} - -template -int -ACE_ARGV_T::argv_to_string (CHAR_TYPE **argv, CHAR_TYPE *&buf) -{ - return ACE_OS::argv_to_string (argv, buf); -} - -template -ACE_ARGV_T::ACE_ARGV_T (const CHAR_TYPE buf[], - bool substitute_env_args) - : substitute_env_args_ (substitute_env_args), - iterative_ (false), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE[] to CHAR_TYPE *[]"); - - if (buf == 0 || buf[0] == 0) - return; - - // Make an internal copy of the string. - ACE_NEW (this->buf_, - CHAR_TYPE[ACE_OS::strlen (buf) + 1]); - ACE_OS::strcpy (this->buf_, buf); - - // Create this->argv_. - if (this->string_to_argv () == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("string_to_argv"))); -} - -template -ACE_ARGV_T::ACE_ARGV_T (CHAR_TYPE *argv[], - bool substitute_env_args) - : substitute_env_args_ (substitute_env_args), - iterative_ (false), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE*[] to CHAR_TYPE[]"); - - if (argv == 0 || argv[0] == 0) - return; - - this->argc_ = ACE_OS::argv_to_string (argv, this->buf_, substitute_env_args); -} - -template -ACE_ARGV_T::ACE_ARGV_T (CHAR_TYPE *first_argv[], - CHAR_TYPE *second_argv[], - bool substitute_env_args) - : substitute_env_args_ (substitute_env_args), - iterative_ (false), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE*[] + CHAR_TYPE *[] to CHAR_TYPE[]"); - - int first_argc; - int second_argc; - - CHAR_TYPE *first_buf; - CHAR_TYPE *second_buf; - - // convert the first argv to a string - first_argc = this->argv_to_string (first_argv, first_buf); - - // convert the second argv to a string - second_argc = this->argv_to_string (second_argv, second_buf); - - // Add the number of arguments in both the argvs. - this->argc_ = first_argc + second_argc; - - size_t buf_len = - ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1; - - // Allocate memory to the lenght of the combined argv string. - ACE_NEW (this->buf_, - CHAR_TYPE[buf_len + 1]); - - // copy the first argv string to the buffer - ACE_OS::strcpy (this->buf_, first_buf); - - // concatenate the second argv string to the buffer - ACE_OS::strcat (this->buf_, second_buf); - - // Delete the first and second buffers - - delete [] first_buf; - - delete [] second_buf; -} - -template -ACE_ARGV_T::ACE_ARGV_T (bool substitute_env_args) - : substitute_env_args_ (substitute_env_args), - iterative_ (true), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T Iterative"); - - // Nothing to do yet -- the user puts in arguments via add () -} - -template -int -ACE_ARGV_T::add (const CHAR_TYPE *next_arg) -{ - // Only allow this to work in the "iterative" verion -- the - // ACE_ARGVs created with the one argument constructor. - if (!this->iterative_) - { - errno = EINVAL; - return -1; - } - - // Put the new argument at the end of the queue. - if (this->queue_.enqueue_tail (const_cast (next_arg)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("Can't add more to ARGV queue")), - -1); - - this->length_ += ACE_OS::strlen (next_arg); - - this->argc_++; - - // Wipe argv_ and buf_ away so that they will be recreated if the - // user calls argv () or buf (). - if (this->argv_ != 0) - { - for (int i = 0; this->argv_[i] != 0; i++) - ACE_OS::free ((void *) this->argv_[i]); - - delete [] this->argv_; - this->argv_ = 0; - } - - delete [] this->buf_; - this->buf_ = 0; - - return 0; -} - -template -int -ACE_ARGV_T::add (CHAR_TYPE *argv[]) -{ - for (int i = 0; argv[i] != 0; i++) - if (this->add (argv[i]) == -1) - return -1; - - return 0; -} - -// Free up argv_ and buf_ - -template -ACE_ARGV_T::~ACE_ARGV_T (void) -{ - ACE_TRACE ("ACE_ARGV_T::~ACE_ARGV_T"); - - if (this->argv_ != 0) - for (int i = 0; this->argv_[i] != 0; i++) - ACE_OS::free ((void *) this->argv_[i]); - - delete [] this->argv_; - delete [] this->buf_; -} - -// Create buf_ out of the queue_. This is only used in the -// "iterative" mode. - -template -int -ACE_ARGV_T::create_buf_from_queue (void) -{ - ACE_TRACE ("ACE_ARGV_T::create_buf_from_queue"); - - // If the are no arguments, don't do anything - if (this->argc_ <= 0) - return -1; - - delete [] this->buf_; - - ACE_NEW_RETURN (this->buf_, - CHAR_TYPE[this->length_ + this->argc_], - -1); - - // Get an iterator over the queue - ACE_Unbounded_Queue_Iterator iter (this->queue_); - - CHAR_TYPE **arg = 0; - CHAR_TYPE *ptr = this->buf_; - size_t len; - int more = 0; - - while (!iter.done ()) - { - // Get next argument from the queue. - iter.next (arg); - - more = iter.advance (); - - len = ACE_OS::strlen (*arg); - - // Copy the argument into buf_ - ACE_OS::memcpy ((void *) ptr, - (const void *) (*arg), - len * sizeof (CHAR_TYPE)); - // Move the pointer down. - ptr += len; - - // Put in an argument separating space. - if (more != 0) - *ptr++ = ' '; - } - - // Put in the NUL terminator - *ptr = '\0'; - - return 0; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ARGV_CPP */ diff --git a/ace/ARGV.h b/ace/ARGV.h deleted file mode 100644 index 5ab4ae296c1..00000000000 --- a/ace/ARGV.h +++ /dev/null @@ -1,245 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file ARGV.h - * - * $Id$ - * - * @author Doug Schmidt - * @author Everett Anderson - */ -//========================================================================== - -#ifndef ACE_ARGUMENT_VECTOR_H -#define ACE_ARGUMENT_VECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Unbounded_Queue.h" - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ARGV_T - * - * @brief Builds a counted argument vector (ala argc/argv) from either - * a string or a set of separate tokens. This class preserves whitespace - * within tokens only if the whitespace-containing token is enclosed in - * either single (') or double (") quotes. This is consistent with the - * expected behavior if an argument vector obtained using this class is - * passed to, for example, ACE_Get_Opt. - * - * This class can substitute environment variable values for tokens that - * are environment variable references (e.g., @c $VAR). This only works - * if the token is an environment variable reference and nothing else; it - * doesn't substitute environment variable references within a token. - * For example, @c $HOME/file will not substitute the value of the HOME - * environment variable. - */ -template -class ACE_ARGV_T -{ -public: - // = Initialization and termination. - /** - * Splits the specified string into an argument vector. Arguments in the - * string are delimited by whitespace. Whitespace-containing arguments - * must be enclosed in quotes, either single (') or double ("). - * - * @param buf A nul-terminated CHAR_TYPE array to split into arguments - * for the vector. - * - * @param substitute_env_args If non-zero, any token that is an - * environment variable reference (e.g., @c $VAR) will have - * its environment variable value in the resultant vector - * in place of the environment variable name. - */ - ACE_ARGV_T (const CHAR_TYPE buf[], - bool substitute_env_args = true); - - /** - * Initializes the argument vector from a set of arguments. Any environment - * variable references are translated (if applicable) during execution of - * this method. - * - * @param argv An array of tokens to initialize the object with. The - * array must be terminated with a 0 pointer. All needed - * data is copied from @a argv during this call; the pointers - * in @a argv are not needed after this call, and the memory - * referred to by @a argv is not referenced by this object. - * - * @param substitute_env_args If non-zero, any element of @a argv that is - * an environment variable reference (e.g., @c $VAR) will have - * its environment variable value in the resultant vector - * in place of the environment variable name. - */ - ACE_ARGV_T (CHAR_TYPE *argv[], - bool substitute_env_args = true); - - /** - * Initializes the argument vector from two combined argument vectors. - * - * @param first_argv An array of tokens to initialize the object with. - * The array must be terminated with a 0 pointer. - * @param second_argv An array of tokens that is concatenated with the - * the tokens in @a first_argv. The array must be - * terminated with a 0 pointer. - * @param substitute_env_args If non-zero, any element of @a first_argv - * or @a second_argv that is an environment variable - * reference (e.g., @c $VAR) will have its environment - * variable value in the resultant vector in place - * of the environment variable name. - */ - ACE_ARGV_T (CHAR_TYPE *first_argv[], - CHAR_TYPE *second_argv[], - bool substitute_env_args = true); - - /** - * Initialize this object so arguments can be added later using one - * of the add methods. This is referred to as the @i iterative method - * of adding arguments to this object. - */ - ACE_ARGV_T (bool substitute_env_args = true); - - /// Destructor. - ~ACE_ARGV_T (void); - - /** @name Accessor methods - * - * These methods access the argument vector contained in this object. - */ - //@{ - /** - * Returns the specified element of the current argument vector. - * - * @param index Index to the desired element. - * - * @retval Pointer to the indexed string. - * @retval 0 if @a index is out of bounds. - */ - const CHAR_TYPE *operator[] (size_t index); - - /** - * Returns the current argument vector. The returned pointers are to data - * maintained internally to this class. Do not change or delete either the - * pointers or the memory to which they refer. - */ - CHAR_TYPE **argv (void); - - /// Returns the current number of arguments. - int argc (void) const; - - /** - * Returns a single string form of the current arguments. The returned - * pointer refers to memory maintained internally to this class. Do not - * change or delete it. - */ - const CHAR_TYPE *buf (void); - - //@} - - /// Dump the state of this object. - void dump (void) const; - - // Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /** - * Add another argument. This only works in the iterative mode. - * - * @note This method copies the specified pointer, but not the data - * contained in the referenced memory. Thus, if the content of - * the memory referred to by @a next_arg are changed after this - * method returns, the results are undefined. - * - * @param next_arg Pointer to the next argument to add to the vector. - * - * @retval 0 on success; -1 on failure. Most likely @c errno values are: - * - EINVAL: This object is not in iterative mode. - * - ENOMEM: Not enough memory available to save @a next_arg. - */ - int add (const CHAR_TYPE *next_arg); - - /** - * Add an array of arguments. This only works in the iterative mode. - * - * @note This method copies the specified pointers, but not the data - * contained in the referenced memory. Thus, if the content of - * the memory referred to by any of the @a argv elements is - * changed after this method returns, the results are undefined. - * - * @param argv Pointers to the arguments to add to the vector. - * @a argv must be terminated by a 0 pointer. - * - * @retval 0 on success; -1 on failure. Most likely @c errno values are: - * - EINVAL: This object is not in iterative mode. - * - ENOMEM: Not enough memory available to save @a next_arg. - */ - int add (CHAR_TYPE *argv[]); - -private: - /// Copy constructor not implemented. - ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T (const ACE_ARGV_T&)) - - /// Assignment operator not implemented. - ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T operator= (const ACE_ARGV_T&)) - - /// Creates buf_ from the queue of added args, deletes previous buf_. - int create_buf_from_queue (void); - - /// Converts buf_ into the CHAR_TYPE *argv[] format. - int string_to_argv (void); - - /// Returns the string created from argv in buf and - /// returns the number of arguments. - int argv_to_string (CHAR_TYPE **argv, CHAR_TYPE *&buf); - - /// Replace args with environment variable values? - bool substitute_env_args_; - - bool iterative_; - - /// Number of arguments in the ARGV array. - int argc_; - - /// The array of string arguments. - CHAR_TYPE **argv_; - - /// Buffer containing the contents. - CHAR_TYPE *buf_; - - /// Total length of the arguments in the queue, not counting - /// separating spaces - size_t length_; - - /// Queue which keeps user supplied arguments. This is only - /// active in the "iterative" mode. - ACE_Unbounded_Queue queue_; -}; - -typedef ACE_ARGV_T ACE_ARGV; - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ARGV.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/ARGV.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("ARGV.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_ARGUMENT_VECTOR_H */ diff --git a/ace/ARGV.inl b/ace/ARGV.inl deleted file mode 100644 index 6924a95cca4..00000000000 --- a/ace/ARGV.inl +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#include "ace/Global_Macros.h" - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Return the number of args -template -ACE_INLINE int -ACE_ARGV_T::argc (void) const -{ - ACE_TRACE ("ACE_ARGV_T::argc"); - return this->argc_; -} - -// Return the arguments in a space-separated string -template -ACE_INLINE const CHAR_TYPE * -ACE_ARGV_T::buf (void) -{ - ACE_TRACE ("ACE_ARGV_T::buf"); - - if (this->buf_ == 0 && this->iterative_) - this->create_buf_from_queue (); - - return (const CHAR_TYPE *) this->buf_; -} - -// Return the arguments in an entry-per-argument array - -template -ACE_INLINE CHAR_TYPE ** -ACE_ARGV_T::argv (void) -{ - ACE_TRACE ("ACE_ARGV_T::argv"); - - // Try to create the argv_ if it isn't there - if (this->argv_ == 0) - { - if (this->iterative_ && this->buf_ == 0) - this->create_buf_from_queue (); - - // Convert buf_ to argv_ - if (this->string_to_argv () == -1) - return (CHAR_TYPE **) 0; - } - - return (CHAR_TYPE **) this->argv_; -} - -// Subscript operator. - -template -ACE_INLINE const CHAR_TYPE * -ACE_ARGV_T::operator[] (size_t i) -{ - ACE_TRACE ("ACE_ARGV_T::operator[]"); - - // Don't go out of bounds. - if (i >= static_cast (this->argc_)) - return 0; - - return (const CHAR_TYPE *) this->argv ()[i]; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Acceptor.cpp b/ace/ATM_Acceptor.cpp deleted file mode 100644 index 1210917a0c5..00000000000 --- a/ace/ATM_Acceptor.cpp +++ /dev/null @@ -1,309 +0,0 @@ -// $Id$ - -#include "ace/ATM_Acceptor.h" - -ACE_RCSID(ace, ATM_Acceptor, "$Id$") - -#if defined (ACE_HAS_ATM) - -#if defined (ACE_HAS_LINUX_ATM) -#include /**/ "linux/atmdev.h" -#endif /* ACE_HAS_LINUX_ATM */ - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Put the actual definitions of the ACE_ATM_Request and -// ACE_ATM_Request_Queue classes here to hide them from clients... - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Acceptor) - -ACE_ATM_Acceptor::ACE_ATM_Acceptor (void) -{ - ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor"); -} - -ACE_ATM_Acceptor::~ACE_ATM_Acceptor (void) -{ - ACE_TRACE ("ACE_ATM_Acceptor::~ACE_ATM_Acceptor"); -} - -int -ACE_ATM_Acceptor::get_local_addr (ACE_ATM_Addr &local_addr) -{ - ACE_TRACE ("ACE_ATM_Acceptor::get_local_addr"); - -#if defined (ACE_HAS_FORE_ATM_WS2) - unsigned long ret = 0; - DWORD deviceID = 0; - ATM_ADDRESS addr; - struct sockaddr_atm *laddr; - - if (::WSAIoctl ((int) ((ACE_SOCK_Acceptor *)this) -> get_handle (), - SIO_GET_ATM_ADDRESS, - (LPVOID) &deviceID, - sizeof (DWORD), - (LPVOID)&addr, - sizeof (ATM_ADDRESS), - &ret, - 0, - 0) == SOCKET_ERROR) { - ACE_OS::printf ("ATM_Acceptor (get_local_addr): WSIoctl: %d\n", - ::WSAGetLastError ()); - return -1; - } - - laddr = (struct sockaddr_atm *)local_addr.get_addr (); - ACE_OS::memcpy ((void *)& (laddr -> satm_number), - (void *)&addr, - ATM_ADDR_SIZE - 1); - - return 0; -#elif defined (ACE_HAS_FORE_ATM_XTI) - ACE_UNUSED_ARG (local_addr); - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) - ATM_Addr *myaddr = (ATM_Addr *)local_addr.get_addr (); - int addrlen = sizeof (myaddr->sockaddratmsvc); - - if (ACE_OS::getsockname (acceptor_.get_handle (), - (struct sockaddr *) & (myaddr->sockaddratmsvc), - &addrlen) < 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ATM_Acceptor (get_local_addr): ioctl: %d\n"), - errno)); - return -1; - } - - return (0); -#else - ACE_UNUSED_ARG (local_addr); - - return 0; -#endif /* ACE_HAS_FORE_ATM_WS2 && ACE_HAS_FORE_ATM_XTI */ -} - -ACE_HANDLE -ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap, - int backlog, - ACE_ATM_Params params) -{ - ACE_TRACE ("ACE_ATM_Acceptor::open"); -#if defined (ACE_HAS_FORE_ATM_XTI) - ACE_HANDLE handle = acceptor_.open (remote_sap, - params.get_reuse_addr (), - params.get_oflag (), - params.get_info (), - backlog, - params.get_device ()); - return (handle == ACE_INVALID_HANDLE ? -1 : 0); -#elif defined (ACE_HAS_FORE_ATM_WS2) - struct sockaddr_atm local_atm_addr; - ACE_HANDLE ret; - DWORD flags = 0; - - /* Create a local endpoint of communication */ - - // Only leaves can listen. - flags = ACE_FLAG_MULTIPOINT_C_LEAF | ACE_FLAG_MULTIPOINT_D_LEAF; - - if ((ret = ACE_OS::socket (AF_ATM, - SOCK_RAW, - ATMPROTO_AAL5, - 0, - 0, - flags)) - == ACE_INVALID_HANDLE) { - ACE_OS::printf ("Acceptor (open): socket %d\n", - ::WSAGetLastError ()); - return (ret); - } - - ((ACE_SOCK_Acceptor *)this) -> set_handle (ret); - - /* Set up the address information to become a server */ - ACE_OS::memset ((void *) &local_atm_addr, 0, sizeof local_atm_addr); - local_atm_addr.satm_family = AF_ATM; - local_atm_addr.satm_number.AddressType = SAP_FIELD_ANY_AESA_REST; - local_atm_addr.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] - = ((ACE_ATM_Addr *)&remote_sap) -> get_selector (); - local_atm_addr.satm_blli.Layer2Protocol = SAP_FIELD_ANY; - local_atm_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; - local_atm_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; - - /* Associate address with endpoint */ - if (ACE_OS::bind (((ACE_SOCK_Acceptor *)this) -> get_handle (), - reinterpret_cast (&local_atm_addr), - sizeof local_atm_addr) == -1) { - ACE_OS::printf ("Acceptor (open): bind %d\n", ::WSAGetLastError ()); - return (ACE_INVALID_HANDLE); - } - - /* Make endpoint listen for service requests */ - if (ACE_OS::listen (( (ACE_SOCK_Acceptor *)this) -> get_handle (), - backlog) - == -1) { - ACE_OS::printf ("Acceptor (open): listen %d\n", ::WSAGetLastError ()); - return (ACE_INVALID_HANDLE); - } - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) - //we need to set the qos before binding to the socket - //use remote_sap as local_sap - - ACE_ATM_Addr local_sap; - ATM_Addr *local_sap_addr = (ATM_Addr*)local_sap.get_addr (); - ACE_ATM_QoS def_qos; - ATM_QoS qos = def_qos.get_qos (); - - ACE_HANDLE handle; - if ((handle = ACE_OS::socket (params.get_protocol_family (), - params.get_type (), - params.get_protocol (), - params.get_protocol_info (), - params.get_sock_group (), - params.get_flags () - )) - == ACE_INVALID_HANDLE) { - ACE_DEBUG (LM_DEBUG, - ACE_LIB_TEXT ("Acceptor (socket): socket %d\n"), - errno); - return (ACE_INVALID_HANDLE); - } - - ((ACE_SOCK_Acceptor *)this) -> set_handle (handle); - if (ACE_OS::setsockopt (handle, - SOL_ATM, - SO_ATMQOS, - reinterpret_cast (&qos), - sizeof (qos)) < 0) { - ACE_OS::printf ("Acceptor (setsockopt): setsockopt:%d\n", - errno); - } - - struct atmif_sioc req; - struct sockaddr_atmsvc aux_addr[1024]; - - req.number = 0; - req.arg = aux_addr; - req.length = sizeof (aux_addr); - if (ACE_OS::ioctl (handle, - ATM_GETADDR, - &req) < 0) { - ACE_OS::perror ("Acceptor (setsockopt): ioctl:"); - } - else { - local_sap_addr->sockaddratmsvc = aux_addr[0]; - } - local_sap.set_selector (( (ACE_ATM_Addr*)&remote_sap)->get_selector ()); - - if (ACE_OS::bind (handle, - reinterpret_cast ( - &(local_sap_addr->sockaddratmsvc)), - sizeof (local_sap_addr->sockaddratmsvc) - ) == -1) { - ACE_DEBUG (LM_DEBUG, - ACE_LIB_TEXT ("Acceptor (open): bind %d\n"), - errno); - return -1; - } - // Make endpoint listen for service requests - if (ACE_OS::listen (handle, - backlog) - == -1) { - ACE_DEBUG (LM_DEBUG, - ACE_LIB_TEXT ("Acceptor (listen): listen %d\n"), - errno); - return -1; - } - - return 0; -#else - ACE_UNUSED_ARG (remote_sap); - ACE_UNUSED_ARG (backlog); - ACE_UNUSED_ARG (params); -#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */ -} - -int -ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle, - ACE_ATM_Params params, - ACE_ATM_QoS qos) -{ - ACE_TRACE ("ACE_ATM_Acceptor::accept"); -#if defined (ACE_HAS_FORE_ATM_XTI) - ATM_QoS optbuf = qos.get_qos (); - - return (acceptor_.accept (new_sap.get_stream (), - remote_addr, - timeout, - restart, - reset_new_handle, - params.get_rw_flag (), - params.get_user_data (), - &optbuf)); -#elif defined (ACE_HAS_FORE_ATM_WS2) - ACE_HANDLE n_handle; - ACE_HANDLE s_handle = ((ACE_SOCK_Acceptor *) this) -> get_handle (); - struct sockaddr_atm *cli_addr - = (struct sockaddr_atm *)remote_addr -> get_addr (); - int caddr_len = sizeof (struct sockaddr_atm); - - do { - n_handle = ACE_OS::accept (s_handle, - reinterpret_cast (cli_addr), - &caddr_len); - } while (n_handle == ACE_INVALID_HANDLE && errno == EINTR); - - ((ACE_ATM_Addr *)remote_addr) -> set (cli_addr, - ((ACE_ATM_Addr *)remote_addr) -> get_selector ()); - ((ACE_IPC_SAP *)&new_sap) -> set_handle (n_handle); - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) - ACE_UNUSED_ARG (params); - - ACE_HANDLE s_handle = ((ACE_SOCK_Acceptor *) this) -> get_handle (); - struct atm_qos accept_qos = qos.get_qos (); - - if (ACE_OS::setsockopt (s_handle, - SOL_ATM, - SO_ATMQOS, - reinterpret_cast (&accept_qos), - sizeof (accept_qos)) < 0) { - ACE_OS::printf ("Acceptor (accept): error setting Qos"); - } - - return (acceptor_.accept (new_sap.get_stream (), - remote_addr, - timeout, - restart, - reset_new_handle)); -#else - ACE_UNUSED_ARG (new_sap); - ACE_UNUSED_ARG (remote_addr); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (restart); - ACE_UNUSED_ARG (reset_new_handle); - ACE_UNUSED_ARG (params); - ACE_UNUSED_ARG (qos); - return (0); -#endif /* ACE_HAS_FORE_ATM_XTI */ -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - - -#endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_Acceptor.h b/ace/ATM_Acceptor.h deleted file mode 100644 index 2f48f07638f..00000000000 --- a/ace/ATM_Acceptor.h +++ /dev/null @@ -1,123 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ATM_Acceptor.h - * - * $Id$ - * - * @author Joe Hoffert - */ -//============================================================================= - - -#ifndef ACE_ATM_ACCEPTOR_H -#define ACE_ATM_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include "ace/ATM_Stream.h" -#include "ace/ATM_Params.h" -#include "ace/ATM_QoS.h" - -#if defined (ACE_HAS_LINUX_ATM) -#include /**/ "atm.h" -#endif /* ACE_HAS_LINUX_ATM */ - -#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) -#include "ace/SOCK_Acceptor.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_SOCK_Acceptor ATM_Acceptor; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_FORE_ATM_XTI) -#include "ace/TLI_Acceptor.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_TLI_Acceptor ATM_Acceptor; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif // ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -class ACE_Time_Value; - -/** - * @class ACE_ATM_Acceptor - * - * @brief Defines the member functions for ACE_ATM_Acceptor abstraction. - * - * This class wraps up the ACE_SOCK_Acceptor and ACE_TLI_Acceptor - * to make the mechanism for the ATM protocol transparent. - */ -class ACE_Export ACE_ATM_Acceptor -{ - -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_ATM_Acceptor (void); - - ~ACE_ATM_Acceptor (); - - /// Initiate a passive mode connection. - ACE_ATM_Acceptor (const ACE_Addr &remote_sap, - int backlog = ACE_DEFAULT_BACKLOG, - ACE_ATM_Params params = ACE_ATM_Params()); - - /// Initiate a passive mode socket. - ACE_HANDLE open (const ACE_Addr &remote_sap, - int backlog = ACE_DEFAULT_BACKLOG, - ACE_ATM_Params params = ACE_ATM_Params()); - - /// Close down the acceptor and release resources. - int close (void); - - // = Passive connection acceptance method. - - /// Accept a new data transfer connection. A @a timeout of 0 means - /// block forever, a @a timeout of {0, 0} means poll. @a restart == 1 - /// means "restart if interrupted." - int accept (ACE_ATM_Stream &new_sap, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0, - ACE_ATM_Params params = ACE_ATM_Params(), - ACE_ATM_QoS qos = ACE_ATM_QoS()); - - /// Get the local address currently listening on - int get_local_addr( ACE_ATM_Addr &local_addr ); - - // = Meta-type info - typedef ACE_ATM_Addr PEER_ADDR; - typedef ACE_ATM_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - ATM_Acceptor acceptor_; -}; - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_ACCEPTOR_H */ diff --git a/ace/ATM_Acceptor.inl b/ace/ATM_Acceptor.inl deleted file mode 100644 index b63b68a9621..00000000000 --- a/ace/ATM_Acceptor.inl +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Acceptor::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_Acceptor::ACE_ATM_Acceptor (const ACE_Addr &remote_sap, - int backlog, - ACE_ATM_Params params) -{ - ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor"); - if (open (remote_sap, - backlog, - params) < 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_ATM_Acceptor::ACE_ATM_Acceptor"))); -} - -ACE_INLINE -int -ACE_ATM_Acceptor::close (void) -{ -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - return (acceptor_.close()); -#else - return 0; -#endif // ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Addr.cpp b/ace/ATM_Addr.cpp deleted file mode 100644 index 1c30b7f7a9a..00000000000 --- a/ace/ATM_Addr.cpp +++ /dev/null @@ -1,522 +0,0 @@ -// $Id$ - -// Defines the Internet domain address family address format. - -#include "ace/ATM_Addr.h" -#if defined (ACE_HAS_ATM) - -#include "ace/Log_Msg.h" - -#if defined (ACE_HAS_FORE_ATM_WS2) -#include /**/ "forews2.h" -#endif /* ACE_HAS_FORE_ATM_WS2 */ - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Addr.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, ATM_Addr, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Addr) - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) -#define BHLI_MAGIC "FORE_ATM" -// This is line rate in cells/s for an OC-3 MM interface. -const long ACE_ATM_Addr::LINE_RATE = 353207; -const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0x1; -const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0x2; -const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x99; -#elif defined (ACE_HAS_LINUX_ATM) -//pbrandao:for Linux: -//pbrandao:for now stick with current definitions -//pbrandao:see if later need to change -const long ACE_ATM_Addr::LINE_RATE = 353207; -const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0; -const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0; -const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x99; -#else -const long ACE_ATM_Addr::LINE_RATE = 0L; -const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0; -const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0; -const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - -// Default constructor - -ACE_ATM_Addr::ACE_ATM_Addr (u_char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - : ACE_Addr (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - : ACE_Addr (PF_ATMSVC, -#else - : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_) -{ - // ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); - (void) ACE_OS::memset ((void *) &this->atm_addr_, - 0, - sizeof this->atm_addr_); - this->init (selector); -} - -// Copy constructor. - -ACE_ATM_Addr::ACE_ATM_Addr (const ACE_ATM_Addr &sap, - u_char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - : ACE_Addr (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - : ACE_Addr (PF_ATMSVC, -#else - : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_) -{ - ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); - this->set (sap, selector); -#if defined (ACE_HAS_LINUX_ATM) - this->atm_addr_.sockaddratmsvc.sas_family = PF_ATMSVC; - this->atm_addr_.atmsap.blli[0].l3_proto = ATM_L3_NONE; - this->atm_addr_.atmsap.blli[0].l2_proto = ATM_L2_NONE; - this->atm_addr_.atmsap.bhli.hl_type = ATM_HL_NONE; -#endif /* ACE_HAS_LINUX_ATM */ -} - -ACE_ATM_Addr::ACE_ATM_Addr (const ATM_Addr *sap, - u_char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - : ACE_Addr (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - : ACE_Addr (PF_ATMSVC, -#else - : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_) -{ - ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); - this->set (sap, selector); -} - - -ACE_ATM_Addr::ACE_ATM_Addr (const ACE_TCHAR sap[], - u_char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - : ACE_Addr (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - : ACE_Addr (PF_ATMSVC, -#else - : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_) -{ - ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); - this->set (sap, selector); -} - -ACE_ATM_Addr::~ACE_ATM_Addr (void) -{ -} - -// Return the address. - -void * -ACE_ATM_Addr::get_addr (void) const -{ - ACE_TRACE ("ACE_ATM_Addr::get_addr"); - return (void *) &this->atm_addr_; -} - -void -ACE_ATM_Addr::init (u_char selector) -{ -#if defined (ACE_HAS_FORE_ATM_XTI) - // Note: this approach may be FORE implementation-specific. When we - // bind with tag_addr ABSENT and tag_selector PRESENT, only the - // selector (i.e. address[19]) is used by the TP. The rest of the - // local address is filled in by the TP and can be obtained via the - // 'ret' parameter or with t_getname ()/t_getprotaddr (). - - atm_addr_.addressType = (u_int16_t) AF_ATM; - - atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr = (int8_t) T_ATM_ABSENT; - atm_addr_.sap.t_atm_sap_addr.SVE_tag_selector = (int8_t) T_ATM_PRESENT; - - atm_addr_.sap.t_atm_sap_addr.address_format = (u_int8_t) T_ATM_ENDSYS_ADDR; - atm_addr_.sap.t_atm_sap_addr.address_length = ATMNSAP_ADDR_LEN; - atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1] = selector; - - atm_addr_.sap.t_atm_sap_layer2.SVE_tag = (int8_t) T_ATM_ABSENT; - atm_addr_.sap.t_atm_sap_layer3.SVE_tag = (int8_t) T_ATM_ABSENT; - - atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT; - atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID; - - ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID, - BHLI_MAGIC, - sizeof atm_addr_.sap.t_atm_sap_appl.ID); -#elif defined (ACE_HAS_FORE_ATM_WS2) - ACE_OS::memset ((void *)&atm_addr_, 0, sizeof atm_addr_); - atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] = (char)selector; - atm_addr_.satm_family = AF_ATM; - atm_addr_.satm_number.AddressType = ATM_NSAP; - atm_addr_.satm_number.NumofDigits = ATM_ADDR_SIZE; - atm_addr_.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT; - atm_addr_.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; - atm_addr_.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; - - // Need to know the correspondence. - //atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT; - //atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID; - //ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID, - // BHLI_MAGIC, - // sizeof atm_addr_.sap.t_atm_sap_appl.ID); -#elif defined (ACE_HAS_LINUX_ATM) - atm_addr_.sockaddratmsvc.sas_family = AF_ATMSVC; - atm_addr_.sockaddratmsvc.sas_addr.prv[ATM_ESA_LEN - 1] = (char)selector; - atm_addr_.atmsap.blli[0].l3_proto = ATM_L3_NONE; - atm_addr_.atmsap.blli[0].l2_proto = ATM_L2_NONE; - atm_addr_.atmsap.bhli.hl_type = ATM_HL_NONE; -#else - ACE_UNUSED_ARG (selector); -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -int -ACE_ATM_Addr::set (const ACE_ATM_Addr &sap, - u_char selector) -{ - ACE_TRACE ("ACE_ATM_Addr::set"); - - this->init (selector); - - this->ACE_Addr::base_set (sap.get_type (), - sap.get_size ()); - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - ACE_ASSERT (sap.get_type () == AF_ATM); -#elif defined (ACE_HAS_LINUX_ATM) - ACE_ASSERT (sap.get_type () == PF_ATMSVC); -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ - - (void) ACE_OS::memcpy ((void *) &this->atm_addr_, - (void *) &sap.atm_addr_, - sizeof this->atm_addr_); - return 0; -} - -int -ACE_ATM_Addr::set (const ATM_Addr *sap, - u_char selector) -{ - ACE_TRACE ("ACE_ATM_Addr::set"); - - this->init (selector); - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - this->ACE_Addr::base_set (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - this->ACE_Addr::base_set (PF_ATMSVC, -#else - this->ACE_Addr::base_set (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ - sizeof (*sap)); - - (void) ACE_OS::memcpy ((void *) &this->atm_addr_, - (void *) sap, - sizeof this->atm_addr_); - return 0; -} - -int -ACE_ATM_Addr::set (const ACE_TCHAR address[], - u_char selector) -{ - ACE_TRACE ("ACE_ATM_Addr::set"); - int ret; - - this->init (selector); - -#if defined (ACE_HAS_FORE_ATM_XTI) - atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr = - (int8_t) T_ATM_PRESENT; -#endif /* ACE_HAS_FORE_ATM_XTI */ - - ret = this -> string_to_addr (address); - this -> set_selector (selector); - return ret; -} - -// Transform the string into the current addressing format. - -int -ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[]) -{ - ACE_TRACE ("ACE_ATM_Addr::string_to_addr"); - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - this->ACE_Addr::base_set (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - this->ACE_Addr::base_set (PF_ATMSVC, -#else - this->ACE_Addr::base_set (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_); -#if defined (ACE_HAS_FORE_ATM_XTI) - struct hostent *entry; - struct atmnsap_addr *nsap; - - // Yow, someone gave us a NULL ATM address! - if (sap == 0) - { - errno = EINVAL; - return -1; - } - else if ((entry = gethostbyname_atmnsap ((ACE_TCHAR *)sap)) != 0) - { - ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_addr.address, - entry->h_addr_list[0], - ATMNSAP_ADDR_LEN - 1); - } - else if ((nsap = atmnsap_addr (sap)) != 0) - { - ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_addr.address, - nsap->atmnsap, - ATMNSAP_ADDR_LEN); - } - else { - errno = EINVAL; - return -1; - } -#elif defined (ACE_HAS_FORE_ATM_WS2) - DWORD dwValue; - HANDLE hLookup; - WSAQUERYSETW qsRestrictions; - CSADDR_INFO csaBuffer; - WCHAR tmpWStr[100]; - - MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, sap, -1, tmpWStr, 100); - - csaBuffer.LocalAddr.iSockaddrLength = sizeof (struct sockaddr_atm); - csaBuffer.LocalAddr.lpSockaddr = (struct sockaddr *)&atm_addr_; - csaBuffer.RemoteAddr.iSockaddrLength = sizeof (struct sockaddr_atm); - csaBuffer.RemoteAddr.lpSockaddr = (struct sockaddr *)&atm_addr_; - - qsRestrictions.dwSize = sizeof (WSAQUERYSETW); - qsRestrictions.lpszServiceInstanceName = 0; - qsRestrictions.lpServiceClassId = &FORE_NAME_CLASS; - qsRestrictions.lpVersion = 0; - qsRestrictions.lpszComment = 0; - qsRestrictions.dwNameSpace = FORE_NAME_SPACE; - qsRestrictions.lpNSProviderId = 0; - qsRestrictions.lpszContext = L""; - qsRestrictions.dwNumberOfProtocols = 0; - qsRestrictions.lpafpProtocols = 0; - qsRestrictions.lpszQueryString = tmpWStr; - qsRestrictions.dwNumberOfCsAddrs = 1; - qsRestrictions.lpcsaBuffer = &csaBuffer; - qsRestrictions.lpBlob = 0; //&blob; - - if (::WSALookupServiceBeginW (&qsRestrictions, LUP_RETURN_ALL, &hLookup) - == SOCKET_ERROR) { - ACE_OS::printf ("Error: WSALookupServiceBeginW failed! %d\n", - ::WSAGetLastError ()); - return -1; - } - - dwValue = sizeof (WSAQUERYSETW); - - if (::WSALookupServiceNextW (hLookup, 0, &dwValue, &qsRestrictions) - == SOCKET_ERROR) { - if (WSAGetLastError () != WSA_E_NO_MORE) { - ACE_OS::printf ("Error: WSALookupServiceNextW failed! %d\n", - ::WSAGetLastError ()); - return -1; - } - } - - if (WSALookupServiceEnd (hLookup) == SOCKET_ERROR) { - ACE_OS::printf ("Error : WSALookupServiceEnd failed! %d \n", - ::WSAGetLastError ()); - errno = EINVAL; - return -1; - } -#elif defined (ACE_HAS_LINUX_ATM) - if (sap == 0 || !ACE_OS::strcmp (sap,"")) { - errno = EINVAL; - return -1; - } - - if (text2atm ((ACE_TCHAR *)sap, - (struct sockaddr *)& (atm_addr_.sockaddratmsvc), - sizeof (atm_addr_.sockaddratmsvc), - T2A_SVC | T2A_NAME) < 0) { - ACE_DEBUG (LM_DEBUG, - "Error : text2atm failed!\n"); - errno = EINVAL; - return -1; - } -#else - ACE_UNUSED_ARG (sap); - - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ -} - -// Transform the current address into string format. - -int -ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[], - size_t addrlen) const -{ - ACE_TRACE ("ACE_ATM_Addr::addr_to_string"); - -#if defined (ACE_HAS_FORE_ATM_XTI) - ACE_TCHAR buffer[MAXNAMELEN + 1]; - struct atmnsap_addr nsap; - ACE_OS::memcpy (nsap.atmnsap, - atm_addr_.sap.t_atm_sap_addr.address, - ATMNSAP_ADDR_LEN); - ACE_OS::sprintf (buffer, - ACE_LIB_TEXT ("%s"), - atmnsap_ntoa (nsap)); - - size_t total_len = ACE_OS::strlen (buffer) + sizeof ('\0'); - - if (addrlen < total_len) - return -1; - else - ACE_OS::strcpy (addr, buffer); - - return 0; -#elif defined (ACE_HAS_FORE_ATM_WS2) - ACE_TCHAR buffer[MAXNAMELEN + 1]; - int i; - - if (addrlen < ATM_ADDR_SIZE + 1) - return -1; - - for (i = 0; i < ATM_ADDR_SIZE; i++) { - buffer[ i * 3 ] = '\0'; - ACE_OS::sprintf (buffer, ACE_LIB_TEXT ("%s%02x."), - buffer, - atm_addr_.satm_number.Addr[ i ]); - } - - buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0'; - ACE_OS::strcpy (addr, buffer); - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) - ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1]; - int total_len; - if ((total_len = atm2text (buffer, - sizeof buffer, - (struct sockaddr *)& (atm_addr_.sockaddratmsvc), - A2T_PRETTY)) < 0) { - ACE_DEBUG ((LM_DEBUG,"ACE_ATM_Addr (addr_to_string): atm2text failed\n")); - return -1; - } - if (addrlen < (size_t)total_len) - return -1; - else - ACE_OS::strcpy (addr, - buffer); - - return 0; -#else - ACE_UNUSED_ARG (addr); - ACE_UNUSED_ARG (addrlen); - return -1; -#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ -} - -const ACE_TCHAR * -ACE_ATM_Addr::addr_to_string (void) const -{ - ACE_TRACE ("ACE_ATM_Addr::addr_to_string"); - - static ACE_TCHAR addr[MAXHOSTNAMELEN + 1]; - if (this->addr_to_string (addr, - MAXHOSTNAMELEN + 1) < 0) - return 0; - - return addr; -} - -// Set a pointer to the address. -void -ACE_ATM_Addr::set_addr (void *addr, int len) -{ - ACE_TRACE ("ACE_ATM_Addr::set_addr"); - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - this->ACE_Addr::base_set (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - this->ACE_Addr::base_set (PF_ATMSVC, -#else - this->ACE_Addr::base_set (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_WS2 */ - len); - ACE_OS::memcpy ((void *) &this->atm_addr_, - (void *) addr, len); -} - -// Compare two addresses for inequality. - -bool -ACE_ATM_Addr::operator != (const ACE_ATM_Addr &sap) const -{ - ACE_TRACE ("ACE_ATM_Addr::operator !="); - return ! ((*this) == sap); -} - -// Compare two addresses for equality. - -bool -ACE_ATM_Addr::operator == (const ACE_ATM_Addr &sap) const -{ - ACE_TRACE ("ACE_ATM_Addr::operator =="); - -#if defined (ACE_HAS_LINUX_ATM) - return (atm_equal ((const struct sockaddr *)& (this->atm_addr_.sockaddratmsvc), - (const struct sockaddr *)& (sap.atm_addr_.sockaddratmsvc), - 0, - 0) - && - sap_equal (& (this->atm_addr_.atmsap), - & (sap.atm_addr_.atmsap), - 0)); -#else - return ACE_OS::memcmp (&atm_addr_, - &sap.atm_addr_, - sizeof (ATM_Addr)) == 0; -#endif /* ACE_HAS_LINUX_ATM */ -} - -void -ACE_ATM_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Addr::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_TCHAR s[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16]; - ACE_OS::sprintf (s, - ACE_LIB_TEXT ("%s"), - this->addr_to_string ()); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("%s"), s)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_Addr.h b/ace/ATM_Addr.h deleted file mode 100644 index 551b5ca1b5c..00000000000 --- a/ace/ATM_Addr.h +++ /dev/null @@ -1,197 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file ATM_Addr.h - * - * $Id$ - * - * @author Joe Hoffert - */ -//========================================================================== - -#ifndef ACE_ATM_ADDR_H -#define ACE_ATM_ADDR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include "ace/ACE_export.h" -#include "ace/Addr.h" - -#if defined (ACE_HAS_FORE_ATM_XTI) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ATMSAPAddress ATM_Addr; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_FORE_ATM_WS2) -#define FORE_NAME_SPACE NS_ALL -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef struct sockaddr_atm ATM_Addr; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_LINUX_ATM) - -#include /**/ "atm.h" - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -//pbrandao:as Linux has this 2 structs separeted we "link it" here -typedef struct _linux_atm_addr -{ - struct sockaddr_atmsvc sockaddratmsvc; - struct atm_sap atmsap; -} ATM_Addr; -#else -typedef int ATM_Addr; -#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */ - -/** - * @class ACE_ATM_Addr - * - * @brief Defines the ATM domain address family address format. - */ -class ACE_Export ACE_ATM_Addr : public ACE_Addr -{ -public: - // Constants used for ATM options - static const long LINE_RATE; - static const int OPT_FLAGS_CPID; - static const int OPT_FLAGS_PMP; - static const int DEFAULT_SELECTOR; - - // = Initialization methods. - /// Default constructor. - ACE_ATM_Addr (u_char selector = DEFAULT_SELECTOR); - - /// Copy constructor. - ACE_ATM_Addr (const ACE_ATM_Addr &, - u_char selector = DEFAULT_SELECTOR); - - /** - * Creates an ACE_ATM_Addr from an ATMSAPAddress structure. This - * is vendor specific (FORE systems). May need to change when other - * vendors are supported. - */ - ACE_ATM_Addr (const ATM_Addr *, - u_char selector = DEFAULT_SELECTOR); - - /** - * Initializes an ACE_ATM_Addr from the which can be - * "atm-address" (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" - * (e.g., "frisbee.cs.wustl.edu"). - */ - ACE_ATM_Addr (const ACE_TCHAR sap[], - u_char selector = DEFAULT_SELECTOR); - - /// Default dtor. - ~ACE_ATM_Addr (void); - - // = Initialization methods (useful after object construction). - /// Default initialization for non-address values (e.g., - /// t_atm_sap_addr.SVE_tag_addr, t_atm_sap_addr.SVE_tag_selector) - void init (u_char selector = DEFAULT_SELECTOR); - - /// Initializes from another ACE_ATM_Addr. - int set (const ACE_ATM_Addr &, - u_char selector = DEFAULT_SELECTOR); - - /** - * Initializes an ACE_ATM_Addr from an ATMSAPAddress/sockaddr_atm - * structure. This is vendor specific (FORE systems). May need to - * change when other vendors are supported. - */ - int set (const ATM_Addr *, - u_char selector = DEFAULT_SELECTOR); - - /** - * Initializes an ACE_ATM_Addr from the which can be - * "atm-address" (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" - * (e.g., "frisbee.cs.wustl.edu"). - */ - int set (const ACE_TCHAR sap[], - u_char selector = DEFAULT_SELECTOR); - - /** - * Initializes an ACE_ATM_Addr from the which can be - * "atm-address" (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" - * (e.g., "frisbee.cs.wustl.edu"). - */ - virtual int string_to_addr (const ACE_TCHAR sap[]); - - /** - * Return the character representation of the ATM address (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") storing it in - * the (which is assumed to be bytes long). This - * version is reentrant. Returns -1 if the of the - * is too small, else 0. - */ - virtual int addr_to_string (ACE_TCHAR addr[], - size_t addrlen) const; - - /** - * Return the character representation of the ATM address (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00"). Returns -1 - * if the of the is too small, else 0.(This version - * is non-reentrant since it returns a pointer to a static data - * area.) - */ - const ACE_TCHAR *addr_to_string (void) const; - - /// Return a pointer to the underlying network address. - virtual void *get_addr (void) const; - - /// Set a pointer to the address. - virtual void set_addr (void *, int); - - /// Return the selector for network address. - u_char get_selector (void) const; - - /// Set the selector for the network address. - void set_selector (u_char selector); - - /** - * Compare two addresses for equality. The addresses are considered - * equal if they contain the same ATM address. Q: Is there any - * other check for equality needed for ATM? - */ - bool operator == (const ACE_ATM_Addr &SAP) const; - - /// Compare two addresses for inequality. - bool operator != (const ACE_ATM_Addr &SAP) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -// char *construct_options (ACE_HANDLE fd, -// int qos_kb, -// int flags, -// long *optsize); -// // Construct options for ATM connections - -private: - ATM_Addr atm_addr_; -}; - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_ADDR_H */ diff --git a/ace/ATM_Addr.inl b/ace/ATM_Addr.inl deleted file mode 100644 index 8120c6d11d5..00000000000 --- a/ace/ATM_Addr.inl +++ /dev/null @@ -1,37 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE u_char -ACE_ATM_Addr::get_selector (void) const -{ - ACE_TRACE ("ACE_ATM_Addr::get_selector"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1]; -#elif defined (ACE_HAS_FORE_ATM_WS2) - return atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ]; -#elif defined (ACE_HAS_LINUX_ATM) - return atm_addr_.sockaddratmsvc.sas_addr.prv[ATM_ESA_LEN - 1]; -#else - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -ACE_INLINE void -ACE_ATM_Addr::set_selector (u_char selector) -{ - ACE_TRACE ("ACE_ATM_Addr::set_selector"); -#if defined (ACE_HAS_FORE_ATM_XTI) - atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1] = selector; -#elif defined (ACE_HAS_FORE_ATM_WS2) - atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] = selector; -#elif defined (ACE_HAS_LINUX_ATM) - atm_addr_.sockaddratmsvc.sas_addr.prv[ATM_ESA_LEN - 1] = selector; -#else - ACE_UNUSED_ARG (selector); -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Connector.cpp b/ace/ATM_Connector.cpp deleted file mode 100644 index bff8ddad5bd..00000000000 --- a/ace/ATM_Connector.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// ATM_Connector.cpp -// $Id$ - -#include "ace/ATM_Connector.h" -#if defined (ACE_HAS_ATM) - -#include "ace/Handle_Set.h" - -ACE_RCSID(ace, ATM_Connector, "$Id$") - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Connector.inl" -#endif /* __ACE_INLINE__ */ - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Connector) - -ACE_ATM_Connector::ACE_ATM_Connector (void) -{ - ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector"); -} - -// Actively connect and produce a new ACE_ATM_Stream if things go well... -// Connect the to the , waiting up to -// amount of time if necessary. - -int -ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream, - const ACE_ATM_Addr &remote_sap, - ACE_ATM_Params params, - ACE_ATM_QoS options, - ACE_Time_Value *timeout, - const ACE_ATM_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_ATM_Connector::connect"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return connector_.connect(new_stream.get_stream(), - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms, - params.get_device(), - params.get_info(), - params.get_rw_flag(), - params.get_user_data(), - &options.get_qos()); -#elif defined (ACE_HAS_FORE_ATM_WS2) - ACE_DEBUG(LM_DEBUG, - ACE_LIB_TEXT ("ATM_Connector(connect): set QoS parameters\n" )); - - ACE_HANDLE s = new_stream.get_handle(); - struct sockaddr_atm *saddr = ( struct sockaddr_atm *)remote_sap.get_addr(); - ACE_QoS cqos = options.get_qos(); - - ACE_QoS_Params qos_params = ACE_QoS_Params(0, - 0, - &cqos, - 0, - 0); - - ACE_DEBUG(LM_DEBUG, - ACE_LIB_TEXT ("ATM_Connector(connect): connecting...\n")); - - int result = ACE_OS::connect( s, - ( struct sockaddr *)saddr, - sizeof( struct sockaddr_atm ), - qos_params ); - - if ( result != 0 ) - ACE_OS::printf( "ATM_Connector(connect): connection failed, %d\n", - ::WSAGetLastError()); - - return result; -#elif defined (ACE_HAS_LINUX_ATM) - ACE_UNUSED_ARG (params); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (reuse_addr); - ACE_UNUSED_ARG (perms); - ACE_UNUSED_ARG (flags); - - ACE_HANDLE handle = new_stream.get_handle(); - ATM_QoS qos =options.get_qos(); - ATM_Addr *local_addr=(ATM_Addr*)local_sap.get_addr(), - *remote_addr=(ATM_Addr*)remote_sap.get_addr(); - - if (ACE_OS::setsockopt(handle, - SOL_ATM, - SO_ATMSAP, - reinterpret_cast (&(local_addr->atmsap)), - sizeof(local_addr->atmsap)) < 0) { - ACE_OS::printf( "ATM_Connector(connect): unable to set atmsap %d\nContinuing...", - errno); - } - if (ACE_OS::setsockopt(handle, - SOL_ATM, - SO_ATMQOS, - reinterpret_cast (&qos), - sizeof(qos)) < 0) { - ACE_DEBUG((LM_DEBUG,ACE_LIB_TEXT ("ATM_Connector(connect): unable to set qos %d\n"), - errno)); - return -1; - } - - int result = ACE_OS::connect(handle, - (struct sockaddr *)&(remote_addr->sockaddratmsvc), - sizeof( remote_addr->sockaddratmsvc)); - - if ( result != 0 ) - ACE_DEBUG(LM_DEBUG, - ACE_LIB_TEXT ("ATM_Connector(connect): connection failed, %d\n"), - errno); - - return result; -#else - ACE_UNUSED_ARG (new_stream); - ACE_UNUSED_ARG (remote_sap); - ACE_UNUSED_ARG (params); - ACE_UNUSED_ARG (options); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (local_sap); - ACE_UNUSED_ARG (reuse_addr); - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (perms); - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_Connector.h b/ace/ATM_Connector.h deleted file mode 100644 index 8ac6b970439..00000000000 --- a/ace/ATM_Connector.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file ATM_Connector.h - * - * $Id$ - * - * @author Joe Hoffert - */ -//============================================================================= - -#ifndef ACE_ATM_CONNECTOR_H -#define ACE_ATM_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include "ace/ATM_Stream.h" -#include "ace/ATM_Params.h" -#include "ace/ATM_QoS.h" - -#if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM) -#include "ace/SOCK_Connector.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_SOCK_Connector ATM_Connector; -ACE_END_VERSIONED_NAMESPACE_DECL -#else -#include "ace/XTI_ATM_Mcast.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_XTI_ATM_Mcast ATM_Connector; -// Open versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL -#endif - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ATM_Connector - * - * @brief Defines an active connection factory for the ACE_ATM C++ - * wrappers. - */ -class ACE_Export ACE_ATM_Connector -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_ATM_Connector (void); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The are the parameters needed for either socket - * or XTI/ATM connections. The is the amount of time to - * wait to connect. If it's 0 then we block indefinitely. If - * *timeout == {0, 0} then the connection is done using non-blocking - * mode. In this case, if the connection can't be made immediately - * the value of -1 is returned with . If - * *timeout > {0, 0} then this is the maximum amount of time to wait before - * timing out. If the time expires before the connection is made - * . The is the value of local address - * to bind to. If it's the default value of then - * the user is letting the OS do the binding. If == 1 - * then the is reused, even if it hasn't been cleanedup yet. - */ - ACE_ATM_Connector (ACE_ATM_Stream &new_stream, - const ACE_ATM_Addr &remote_sap, - ACE_ATM_Params params = ACE_ATM_Params(), - ACE_ATM_QoS options = ACE_ATM_QoS(), - ACE_Time_Value *timeout = 0, - const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", 0 ), - int reuse_addr = 0, -#if defined (ACE_WIN32) - int flags = 0, -#else - int flags = O_RDWR, -#endif /* ACE_WIN32 */ - int perms = 0); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The are the parameters needed for either socket - * or XTI/ATM connections. The is the amount of time to - * wait to connect. If it's 0 then we block indefinitely. If - * *timeout == {0, 0} then the connection is done using non-blocking - * mode. In this case, if the connection can't be made immediately - * the value of -1 is returned with . If - * *timeout > {0, 0} then this is the maximum amount of time to wait before - * timing out. If the time expires before the connection is made - * . The is the value of local address - * to bind to. If it's the default value of then - * the user is letting the OS do the binding. If == 1 - * then the is reused, even if it hasn't been cleanedup yet. - */ - int connect (ACE_ATM_Stream &new_stream, - const ACE_ATM_Addr &remote_sap, - ACE_ATM_Params params = ACE_ATM_Params(), - ACE_ATM_QoS options = ACE_ATM_QoS(), - ACE_Time_Value *timeout = 0, - const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", - 0 ), - int reuse_addr = 0, -#if defined (ACE_WIN32) - int flags = 0, -#else - int flags = O_RDWR, -#endif /* ACE_WIN32 */ - int perms = 0); - - /** - * Try to complete a non-blocking connection. - * If connection completion is successful then contains - * the connected ACE_SOCK_Stream. If is non-NULL then it - * will contain the address of the connected peer. - */ - int complete (ACE_ATM_Stream &new_stream, - ACE_ATM_Addr *remote_sap, - ACE_Time_Value *tv); - - //int add_leaf (ACE_ATM_Stream ¤t_stream, - // const ACE_Addr &remote_sap, - // ACE_INT32 leaf_id, - // ACE_Time_Value *timeout = 0); - - /** - * Actively add a leaf to the root (i.e., point-to-multipoint). The - * is the address of the leaf that we - * are trying to add. - */ - int add_leaf (ACE_ATM_Stream ¤t_stream, - const ACE_Addr &remote_sap, - ACE_ATM_QoS &qos); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - // = Meta-type info - typedef ACE_ATM_Addr PEER_ADDR; - typedef ACE_ATM_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - ATM_Connector connector_; -}; - -// Open versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_CONNECTOR_H */ diff --git a/ace/ATM_Connector.inl b/ace/ATM_Connector.inl deleted file mode 100644 index f301aa781f5..00000000000 --- a/ace/ATM_Connector.inl +++ /dev/null @@ -1,132 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Connector::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream, - const ACE_ATM_Addr &remote_sap, - ACE_ATM_Params params, - ACE_ATM_QoS options, - ACE_Time_Value *timeout, - const ACE_ATM_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector"); - if ((ACE_HANDLE)this->connect (new_stream, - remote_sap, - params, - options, - timeout, - local_sap, - reuse_addr, - flags, - perms) == ACE_INVALID_HANDLE - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_ATM_Stream::ACE_ATM_Stream"))); -} - -// Try to complete a non-blocking connection. - -ACE_INLINE -int -ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream, - ACE_ATM_Addr *remote_sap, - ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_ATM_Connector::complete"); -#if defined (ACE_HAS_ATM) - return connector_.complete(new_stream.get_stream(), - remote_sap, - tv); -#else - ACE_UNUSED_ARG(new_stream); - ACE_UNUSED_ARG(remote_sap); - ACE_UNUSED_ARG(tv); - return 0; -#endif -} - -ACE_INLINE -int -ACE_ATM_Connector::add_leaf (ACE_ATM_Stream ¤t_stream, - const ACE_Addr &remote_sap, - ACE_ATM_QoS &qos) -{ - ACE_TRACE ("ACE_ATM_Connector::add_leaf"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return connector_.add_leaf(current_stream.get_stream(), - remote_sap, - leaf_id, - timeout); -#elif defined (ACE_HAS_FORE_ATM_WS2) - struct sockaddr_atm *saddr = (struct sockaddr_atm *)remote_sap.get_addr(); - ACE_QoS cqos = qos.get_qos(); - int addr_len = sizeof( struct sockaddr_atm ); - - ACE_QoS_Params qos_params(0, - 0, - &cqos, - 0, - (JL_SENDER_ONLY)); - - ACE_OS::printf( "ATM_Connector::add_leaf: connecting...\n" ); - - ACE_HANDLE result = ACE_OS::join_leaf(current_stream.get_handle(), - (struct sockaddr *)saddr, - addr_len, - qos_params); - - if ( result == ACE_INVALID_HANDLE ) - ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n", - ::WSAGetLastError()); - - return (result != ACE_INVALID_HANDLE); -#elif defined (ACE_HAS_LINUX_ATM) - ACE_OS::printf("ATM_Connector(add_leaf): not yet implemented in Linux \n"); - - ACE_UNUSED_ARG(current_stream); - ACE_UNUSED_ARG(remote_sap); - ACE_UNUSED_ARG(leaf_id); - ACE_UNUSED_ARG(timeout); - - return 0; -#else - ACE_UNUSED_ARG(current_stream); - ACE_UNUSED_ARG(remote_sap); - ACE_UNUSED_ARG(leaf_id); - ACE_UNUSED_ARG(timeout); - return 0; -#endif -} - -ACE_INLINE -int -ACE_ATM_Connector::reset_new_handle (ACE_HANDLE handle) -{ -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - // Reset the event association - return ::WSAEventSelect ((SOCKET) handle, - 0, - 0); -#else /* !defined ACE_HAS_WINSOCK2 */ - ACE_UNUSED_ARG (handle); - return 0; -#endif /* ACE_WIN32 */ -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Params.cpp b/ace/ATM_Params.cpp deleted file mode 100644 index cc6ec674ece..00000000000 --- a/ace/ATM_Params.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// $Id$ - -#include "ace/ATM_Params.h" - -#if defined (ACE_HAS_ATM) - -ACE_RCSID(ace, ATM_Params, "$Id$") - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Params.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Params) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ - diff --git a/ace/ATM_Params.h b/ace/ATM_Params.h deleted file mode 100644 index 2ae36a6a4a4..00000000000 --- a/ace/ATM_Params.h +++ /dev/null @@ -1,214 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file ATM_Params.h - * - * $Id$ - * - * @author Joe Hoffert - */ -//========================================================================== - - -#ifndef ACE_ATM_PARAMS_H -#define ACE_ATM_PARAMS_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include "ace/ACE_export.h" - -#if defined (ACE_HAS_FORE_ATM_XTI) -#include "ace/TLI.h" -#define ATM_PROTOCOL_DEFAULT 0 -typedef struct t_info Param_Info; -typedef struct netbuf Param_Udata; -#elif defined (ACE_HAS_FORE_ATM_WS2) -#include "ace/SOCK.h" -#define ATM_PROTOCOL_DEFAULT ATMPROTO_AAL5 -#define ACE_XTI_ATM_DEVICE "" -typedef int Param_Info; -typedef int Param_Udata; -#elif defined (ACE_HAS_LINUX_ATM) -#include /**/ "atm.h" -#define AF_ATM PF_ATMSVC -#define ACE_XTI_ATM_DEVICE "" -#define ATM_PROTOCOL_DEFAULT ATM_AAL5 -typedef int Param_Info; -typedef int Param_Udata; -#else -#define ACE_XTI_ATM_DEVICE "" -typedef int Param_Info; -typedef int Param_Udata; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ATM_Params - * - * @brief Wrapper class that simplifies the information passed to the ATM - * enabled ACE_ATM_Connector class. - */ -class ACE_Export ACE_ATM_Params -{ -public: - /** - * Initialize the data members. This class combines options from - * ACE_SOCK_Connector (, , , - * , , and ) and - * ACE_TLI_Connector (, , , , and ) - * so that either mechanism can be used transparently for ATM. - */ - ACE_ATM_Params (int rw_flag = 1, - const char device[] = ACE_XTI_ATM_DEVICE, - Param_Info *info = 0, - Param_Udata *udata = 0, - int oflag = O_RDWR, - int protocol_family = AF_ATM, - int protocol = ATM_PROTOCOL_DEFAULT, - int type = -#if defined (ACE_HAS_LINUX_ATM) - SOCK_DGRAM, -#else - SOCK_RAW, -#endif /* ACE_HAS_LINUX_ATM */ - ACE_Protocol_Info *protocol_info = 0, - ACE_SOCK_GROUP g = 0, - u_long flags - = ACE_FLAG_MULTIPOINT_C_ROOT - | ACE_FLAG_MULTIPOINT_D_ROOT, // connector by default - int reuse_addr = 0); - - /// Destructor. - ~ACE_ATM_Params (); - - /// Get protocol family. - int get_protocol_family (void) const; - - /// Set protocol family. - void set_protocol_family (int); - - /// Get protocol. - int get_protocol (void) const; - - /// Set protocol. - void set_protocol (int); - - /// Get type. - int get_type (void) const; - - /// Set type. - void set_type (int); - - /// Get protocol info. - ACE_Protocol_Info *get_protocol_info( void ); - - /// Set protocol info. - void set_protocol_info( ACE_Protocol_Info *); - - /// Get socket group. - ACE_SOCK_GROUP get_sock_group( void ); - - /// Set socket group. - void set_sock_group( ACE_SOCK_GROUP ); - - /// Get socket flags. - u_long get_flags( void ); - - /// Set socket flags. - void set_flags( u_long ); - - /// Get reuse_addr flag. - int get_reuse_addr (void) const; - - /// Set reuse_addr flag. - void set_reuse_addr (int); - - /// Get device. - const char* get_device (void) const; - - /// Get info. - Param_Info* get_info (void) const; - - /// Set info. - void set_info (Param_Info *); - - /// Get r/w flag. - int get_rw_flag (void) const; - - /// Set r/w flag. - void set_rw_flag (int); - - /// Get user data. - Param_Udata* get_user_data (void) const; - - /// Set user data. - void set_user_data (Param_Udata*); - - /// Get open flag. - int get_oflag (void) const; - - /// Set open flag. - void set_oflag (int); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Protocol family for sockets connections. - int protocol_family_; - - /// Protocol for sockets connections. - int protocol_; - - /// Type for opening sockets. - int type_; - - /// Information about the protocol. - ACE_Protocol_Info *protocol_info_; - - /// Socket group used (for sockets only). - ACE_SOCK_GROUP group_; - - /// Flags for sockets (for sockets only). - u_long flags_; - - /// Flag for reusing address for opening sockets. - int reuse_addr_; - - /// Device name for XTI/ATM connections. - const char *device_; - - /// Info for XTI/ATM connections. - Param_Info *info_; - - /// R/W flag for XTI/ATM connections. - int rw_flag_; - - /// User data for XTI/ATM connections. - Param_Udata *udata_; - - /// Open flag for XTI/ATM connections. - int oflag_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Params.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_PARAMS_H */ diff --git a/ace/ATM_Params.inl b/ace/ATM_Params.inl deleted file mode 100644 index 5d60f6ba920..00000000000 --- a/ace/ATM_Params.inl +++ /dev/null @@ -1,235 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_Params::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Params::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_Params::ACE_ATM_Params (int rw_flag, - const char device[], - Param_Info *info, - Param_Udata *udata, - int oflag, - int protocol_family, - int protocol, - int type, - ACE_Protocol_Info *protocol_info, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr) - : protocol_family_(protocol_family), - protocol_(protocol), - type_(type), - protocol_info_(protocol_info), - group_(g), - flags_(flags), - reuse_addr_(reuse_addr), - device_(device), - info_(info), - rw_flag_(rw_flag), - udata_(udata), - oflag_(oflag) -{ - ACE_TRACE ("ACE_ATM_Params::ACE_ATM_Params"); -} - -// Default dtor. -ACE_INLINE -ACE_ATM_Params::~ACE_ATM_Params (void) -{ - ACE_TRACE ("ACE_ATM_Params::~ACE_ATM_Params"); -} - -ACE_INLINE -int -ACE_ATM_Params::get_protocol_family (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_protocol_family"); - return protocol_family_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_protocol_family (int family) -{ - ACE_TRACE ("ACE_ATM_Params::set_protocol_family"); - protocol_family_ = family; -} - -ACE_INLINE -int -ACE_ATM_Params::get_protocol (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_protocol"); - return protocol_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_protocol (int protocol) -{ - ACE_TRACE ("ACE_ATM_Params::set_protocol"); - protocol_ = protocol; -} - -ACE_INLINE -int -ACE_ATM_Params::get_type (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_type"); - return type_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_type (int type) -{ - ACE_TRACE ("ACE_ATM_Params::set_type"); - type_ = type; -} - -ACE_INLINE -ACE_Protocol_Info* -ACE_ATM_Params::get_protocol_info( void ) -{ - ACE_TRACE ("ACE_ATM_Params::get_protocol_info"); - return protocol_info_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_protocol_info( ACE_Protocol_Info *protocol_info ) -{ - ACE_TRACE ("ACE_ATM_Params::set_protocol_info"); - protocol_info_ = protocol_info; -} - -ACE_INLINE -ACE_SOCK_GROUP -ACE_ATM_Params::get_sock_group( void ) -{ - ACE_TRACE ("ACE_ATM_Params::get_sock_group"); - return group_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_sock_group( ACE_SOCK_GROUP g ) -{ - ACE_TRACE ("ACE_ATM_Params::set_sock_group"); - group_ = g; -} - -ACE_INLINE -u_long -ACE_ATM_Params::get_flags( void ) -{ - ACE_TRACE ("ACE_ATM_Params::get_flags"); - return flags_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_flags( u_long flags) -{ - ACE_TRACE ("ACE_ATM_Params::set_flags"); - flags_ = flags; -} - -ACE_INLINE -int -ACE_ATM_Params::get_reuse_addr (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_reuse_addr"); - return reuse_addr_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_reuse_addr (int reuse_addr) -{ - ACE_TRACE ("ACE_ATM_Params::set_reuse_addr"); - reuse_addr_ = reuse_addr; -} - -ACE_INLINE -const char* -ACE_ATM_Params::get_device (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_device"); - return device_; -} - -ACE_INLINE -Param_Info* -ACE_ATM_Params::get_info (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_info"); - return info_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_info (Param_Info* info) -{ - ACE_TRACE ("ACE_ATM_Params::set_info"); - info_ = info; -} - -ACE_INLINE -int -ACE_ATM_Params::get_rw_flag (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_rw_flag"); - return rw_flag_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_rw_flag (int rw_flag) -{ - ACE_TRACE ("ACE_ATM_Params::set_rw_flag"); - rw_flag_ = rw_flag; -} - -ACE_INLINE -Param_Udata* -ACE_ATM_Params::get_user_data (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_user_data"); - return udata_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_user_data (Param_Udata *udata) -{ - ACE_TRACE ("ACE_ATM_Params::set_user_data"); - udata_ = udata; -} - -ACE_INLINE -int -ACE_ATM_Params::get_oflag (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_oflag"); - return oflag_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_oflag (int oflag) -{ - ACE_TRACE ("ACE_ATM_Params::set_oflag"); - oflag_ = oflag; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_QoS.cpp b/ace/ATM_QoS.cpp deleted file mode 100644 index 814834571cf..00000000000 --- a/ace/ATM_QoS.cpp +++ /dev/null @@ -1,631 +0,0 @@ -// $Id$ - -#include "ace/ATM_QoS.h" - -ACE_RCSID(ace, ATM_QoS, "$Id$") - -#if defined (ACE_HAS_ATM) - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_QoS.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) -#define BHLI_MAGIC "FORE_ATM" -// This is line rate in cells/s for an OC-3 MM interface. -const long ACE_ATM_QoS::LINE_RATE = 353207; -const int ACE_ATM_QoS::OPT_FLAGS_CPID = 0x1; -const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0x2; -const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x99; -const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 8192; -#elif defined (ACE_HAS_LINUX_ATM) -//pbrandao:for Linux: -//pbrandao:for now stick with current definitions -//pbrandao:see if later need to change -const long ACE_ATM_QoS::LINE_RATE = 353207; -const int ACE_ATM_QoS::OPT_FLAGS_CPID = 0x1; -const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0x2; -const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x99; -const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 8192; -#else -const long ACE_ATM_QoS::LINE_RATE = 0L; -const int ACE_ATM_QoS::OPT_FLAGS_CPID = 0; -const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0; -const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x0; -const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_QoS) - -ACE_ATM_QoS::ACE_ATM_QoS (int pktSize) -{ - ACE_TRACE ("ACE_ATM_QoS::ACE_ATM_QoS"); -#if defined (ACE_HAS_LINUX_ATM) - ACE_OS::memset(&qos_, 0, sizeof(qos_)); - qos_.aal = ATM_PROTOCOL_DEFAULT; - qos_.rxtp.traffic_class = ATM_ANYCLASS; - qos_.rxtp.max_sdu = pktSize; - qos_.txtp.traffic_class = ATM_ANYCLASS; - qos_.txtp.max_sdu = pktSize; -#else - ACE_UNUSED_ARG (pktSize); -#endif /* ACE_HAS_LINUX_ATM */ -} - -ACE_ATM_QoS::ACE_ATM_QoS(int rate, - int pktSize) -{ - ACE_TRACE( "ACE_ATM_QoS::ACE_ATM_QoS" ); -#if defined (ACE_HAS_FORE_ATM_WS2) - AAL_PARAMETERS_IE ie_aalparams; - ATM_TRAFFIC_DESCRIPTOR_IE ie_td; - ATM_BROADBAND_BEARER_CAPABILITY_IE ie_bbc; - ATM_QOS_CLASS_IE ie_qos; - Q2931_IE *ie_ptr; - int size; - - // Setting up cbr parameters ... - ie_aalparams.AALType = AALTYPE_5; - ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize - = pktSize; // was 1516; - ie_aalparams.AALSpecificParameters.AAL5Parameters.BackwardMaxCPCSSDUSize - = pktSize; // was 1516; - ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE; - ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL; - - size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE); - - ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.PeakCellRate_CLP01 = rate; - ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; - ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; - ie_td.Forward.Tagging = SAP_FIELD_ABSENT; - - ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.PeakCellRate_CLP01 = rate; - ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; - ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; - ie_td.Backward.Tagging = SAP_FIELD_ABSENT; - - ie_td.BestEffort = 0; // Note: this must be set to zero for CBR. - - size += sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); - - ie_bbc.BearerClass = BCOB_X; - ie_bbc.TrafficType = TT_CBR; - ie_bbc.TimingRequirements = TR_END_TO_END; - ie_bbc.ClippingSusceptability = CLIP_NOT; - ie_bbc.UserPlaneConnectionConfig = UP_P2P; - - size += sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ); - - ie_qos.QOSClassForward = QOS_CLASS1; - ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used - // since we do only simplex data xfer. - - size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE); - - qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size); - if (qos_.ProviderSpecific.buf == 0) { - ACE_ERROR((LM_ERROR, - ACE_LIB_TEXT ("ACE_ATM_QoS::ACE_ATM_QoS: Unable to allocate %d bytes for qos_.ProviderSpecific.buf\n"), - size)); - return; - } - qos_.ProviderSpecific.len = size; - ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size); - - ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf; - ie_ptr->IEType = IE_AALParameters; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( AAL_PARAMETERS_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_TrafficDescriptor; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_BroadbandBearerCapability; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ); - ACE_OS::memcpy(ie_ptr->IE, - &ie_bbc, - sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_QOSClass; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_QOS_CLASS_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE)); - - // qos_.SendingFlowspec.TokenRate = 0xffffffff; - // qos_.SendingFlowspec.TokenBucketSize = 0xffffffff; - // qos_.SendingFlowspec.PeakBandwidth = 0xffffffff; - // qos_.SendingFlowspec.Latency = 0xffffffff; - // qos_.SendingFlowspec.DelayVariation = 0xffffffff; - // qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; - // This will most probably be ignored by the service provider. - // qos_.SendingFlowspec.MaxSduSize = 0xffffffff; - // qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff; - - // qos_.ReceivingFlowspec.TokenRate = 0xffffffff; - // qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff; - // qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff; - // qos_.ReceivingFlowspec.Latency = 0xffffffff; - // qos_.ReceivingFlowspec.DelayVariation = 0xffffffff; - // qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; - // This will most probably be ignored by the service provider. - // qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff; - // qos_.ReceivingFlowspec.MinimumPolicedSize = 0; - - ACE_Flow_Spec send_fspec( 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - SERVICETYPE_BESTEFFORT, - // This will most probably ignored by SP. - 0xffffffff, - 0xffffffff, - 15, - ACE_DEFAULT_THREAD_PRIORITY ), - recv_fspec( 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - SERVICETYPE_BESTEFFORT, - // This will most probably ignored by SP. - 0xffffffff, - 0, - 15, - ACE_DEFAULT_THREAD_PRIORITY ); - - qos_.sending_flowspec (send_fspec); - qos_.receiving_flowspec (recv_fspec); -#elif defined (ACE_HAS_FORE_ATM_XTI) - ACE_UNUSED_ARG (rate); - ACE_UNUSED_ARG (pktSize); -#elif defined (ACE_HAS_LINUX_ATM) - ACE_OS::memset(&qos_, - 0, - sizeof(qos_)); - qos_.aal = ATM_PROTOCOL_DEFAULT; - qos_.rxtp.max_sdu = pktSize; - - if (rate > 0) { - qos_.rxtp.pcr = rate; - qos_.rxtp.traffic_class = ATM_CBR; - qos_.txtp.traffic_class = ATM_CBR; - qos_.txtp.pcr = rate; - } - else { - qos_.rxtp.traffic_class = ATM_UBR; - qos_.txtp.traffic_class = ATM_UBR; - } - - qos_.txtp.max_sdu = pktSize; -#else - ACE_UNUSED_ARG (rate); -#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ -} - -void -ACE_ATM_QoS::set_cbr_rate (int rate, - int pktSize) -{ - ACE_TRACE ("ACE_ATM_QoS::set_cbr_rate"); -#if defined (ACE_HAS_FORE_ATM_WS2) - /* - AAL_PARAMETERS_IE ie_aalparams; - ATM_TRAFFIC_DESCRIPTOR_IE ie_td; - ATM_BROADBAND_BEARER_CAPABILITY_IE ie_bbc; - ATM_QOS_CLASS_IE ie_qos; - Q2931_IE *ie_ptr; - int size; - */ - - ACE_OS::printf( "ATM_QoS(set_cbr_rate): set rate to %d c/s\n", rate ); - - // Setting up cbr parameters ... - /* - FORE has changed this - we no longer specify QoS this way - ie_aalparams.AALType = AALTYPE_5; - ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize - = pktSize; // was 1516; - ie_aalparams.AALSpecificParameters.AAL5Parameters.BackwardMaxCPCSSDUSize - = pktSize; // was 1516; - ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE; - ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL; - - size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE); - - ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.PeakCellRate_CLP01 = rate; - ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; - ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; - ie_td.Forward.Tagging = SAP_FIELD_ABSENT; - - ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.PeakCellRate_CLP01 = rate; - ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; - ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; - ie_td.Backward.Tagging = SAP_FIELD_ABSENT; - - ie_td.BestEffort = 0; // Note: this must be set to zero for CBR. - - size += sizeof( Q2931_IE_TYPE ) + - sizeof( ULONG ) + - sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); - - ie_bbc.BearerClass = BCOB_X; - ie_bbc.TrafficType = TT_CBR; - ie_bbc.TimingRequirements = TR_END_TO_END; - ie_bbc.ClippingSusceptability = CLIP_NOT; - ie_bbc.UserPlaneConnectionConfig = UP_P2P; - - size += sizeof(Q2931_IE_TYPE) + - sizeof(ULONG) + - sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE); - - ie_qos.QOSClassForward = QOS_CLASS1; - ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used - // since we only simplex data xfer. - - size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE); - - qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size); - if (qos_.ProviderSpecific.buf == 0) { - ACE_ERROR((LM_ERROR, - ACE_LIB_TEXT ("ACE_ATM_QoS::ACE_ATM_QoS: Unable to allocate %d bytes for qos_.ProviderSpecific.buf\n"), - size)); - return; - } - qos_.ProviderSpecific.len = size; - ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size); - - ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf; - ie_ptr->IEType = IE_AALParameters; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + - sizeof( ULONG ) + - sizeof( AAL_PARAMETERS_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_TrafficDescriptor; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + - sizeof( ULONG ) + - sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_BroadbandBearerCapability; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + - sizeof( ULONG ) + - sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ); - ACE_OS::memcpy( ie_ptr->IE, - &ie_bbc, - sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE )); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_QOSClass; - ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + - sizeof(ATM_QOS_CLASS_IE); - ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE)); - */ - - const int BYTES_PER_ATM_CELL = 53; - ACE_OS::memset(&qos_, 0, sizeof(ATM_QoS)); - // Setting the token rate sets the minimum rate. 3 Mbits/sec seems too high. - // Certainly for Vaudeville audio, we only need about 1000 c/s which is - // 424000 bits/sec which is 53000 bytes/sec. - //qos_.SendingFlowspec.TokenRate = 3*(1024*128); // 3Mbits/sec - qos_.SendingFlowspec.TokenRate = 53000; // 1000 cells/sec - qos_.SendingFlowspec.TokenBucketSize = 32*1024; // our block size - //ourQos.SendingFlowspec.PeakBandwidth = ourQos.SendingFlowspec.TokenRate; - qos_.SendingFlowspec.ServiceType = SERVICETYPE_GUARANTEED; - // Peak bandwidth is in bytes/sec. The rate is specified in cells/sec so - // we need to convert from cells/sec to bytes/sec (i.e., multiply by 53). - qos_.SendingFlowspec.PeakBandwidth = rate * BYTES_PER_ATM_CELL; - qos_.SendingFlowspec.Latency = -1; // we don't care too much - qos_.SendingFlowspec.DelayVariation = -1; // we don't care too much - // no provider-specific data allowed on ATM - qos_.ProviderSpecific.buf=0; - qos_.ProviderSpecific.len=0; - // unidirectional P2MP; we don't need to setup the Receiving flowspec - - //qos_.SendingFlowspec.TokenRate = 0xffffffff; - //qos_.SendingFlowspec.TokenBucketSize = 0xffffffff; - //qos_.SendingFlowspec.PeakBandwidth = 0xffffffff; - //qos_.SendingFlowspec.Latency = 0xffffffff; - //qos_.SendingFlowspec.DelayVariation = 0xffffffff; - //qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; - // This will most probably be ignored by the service provider. - //qos_.SendingFlowspec.MaxSduSize = 0xffffffff; - //qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff; - - //qos_.ReceivingFlowspec.TokenRate = 0xffffffff; - //qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff; - //qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff; - //qos_.ReceivingFlowspec.Latency = 0xffffffff; - //qos_.ReceivingFlowspec.DelayVariation = 0xffffffff; - //qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; - // This will most probably be ignored by the service provider. - //qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff; - //qos_.ReceivingFlowspec.MinimumPolicedSize = 0; - - /* - ACE_Flow_Spec send_fspec( 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - SERVICETYPE_BESTEFFORT, - // This will most probably ignored by SP. - 0xffffffff, - 0xffffffff, - 15, - ACE_DEFAULT_THREAD_PRIORITY ), - recv_fspec( 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - SERVICETYPE_BESTEFFORT, - // This will most probably ignored by SP. - 0xffffffff, - 0, - 15, - ACE_DEFAULT_THREAD_PRIORITY ); - - qos_.sending_flowspec( send_fspec ); - qos_.receiving_flowspec( recv_fspec ); - */ -#elif defined (ACE_HAS_FORE_ATM_XTI) - ACE_UNUSED_ARG (rate); - ACE_UNUSED_ARG (pktSize); -#elif defined (ACE_HAS_LINUX_ATM) - ACE_UNUSED_ARG (pktSize); - - qos_.rxtp.traffic_class = ATM_CBR; - qos_.rxtp.pcr = rate; - qos_.txtp.traffic_class = ATM_CBR; - qos_.txtp.pcr = rate; -#else - ACE_UNUSED_ARG (rate); -#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ -} - -void -ACE_ATM_QoS::set_rate (ACE_HANDLE fd, - int rate, - int flags) -{ - ACE_TRACE ("ACE_ATM_QoS::set_rate"); -#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - set_cbr_rate( rate ); - - ACE_UNUSED_ARG( fd ); - ACE_UNUSED_ARG( flags ); -#elif defined (ACE_HAS_FORE_ATM_XTI) - long optlen = 0; - qos_.buf = construct_options(fd, - rate, - flags, - &optlen); - qos_.len = optlen; -#else - ACE_UNUSED_ARG (rate); -#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM || ACE_HAS_FORE_ATM_XTI */ -} - -char* -ACE_ATM_QoS::construct_options (ACE_HANDLE fd, - int rate, - int flags, - long *len) -{ -#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - ACE_UNUSED_ARG (fd); - ACE_UNUSED_ARG (rate); - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (len); - return (0); -#elif defined (ACE_HAS_FORE_ATM_XTI) - struct t_opthdr *popt; - char *buf; - int qos_cells; - struct t_info info; - - if (ACE_OS::t_getinfo (fd, &info) == -1) - { - ACE_OS::t_error ("t_getinfo"); - return 0; - } - - buf = (char *) ACE_OS::malloc (info.options); - - if (buf == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("Unable to allocate %d bytes for options\n"), - info.options), - 0); - - popt = (struct t_opthdr *) buf; - - if (flags & OPT_FLAGS_CPID) - { - // This constructs the T_ATM_ORIG_ADDR option, which is used to - // signal the UNI 3.1 Calling Party ID Information Element. - t_atm_addr *source_addr; - - popt->len = sizeof (struct t_opthdr) + sizeof (t_atm_addr); - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_ORIG_ADDR; - popt->status = 0; - - source_addr = - (t_atm_addr *)((char *) popt + sizeof (struct t_opthdr)); - - source_addr->address_format = T_ATM_ENDSYS_ADDR; - source_addr->address_length = ATMNSAP_ADDR_LEN; - - ATMSAPAddress local_addr; - struct t_bind boundaddr; - - boundaddr.addr.maxlen = sizeof(local_addr); - boundaddr.addr.buf = (char *) &local_addr; - - //if (ACE_OS::t_getprotaddr(fd, &boundaddr, 0) < 0) { - if (ACE_OS::t_getname(fd, - &boundaddr.addr, - LOCALNAME) < 0) - { - ACE_OS::t_error("t_getname (local_address)"); - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Can't get local address!\n"))); - ACE_OS::free (buf); - return 0; - } - - ACE_OS::memcpy(source_addr->address, - local_addr.sap.t_atm_sap_addr.address, - ATMNSAP_ADDR_LEN); - - popt = T_OPT_NEXTHDR (buf, info.options , popt); - } - - // This constructs all options necessary (bearer cap., QoS, and - // Traffic Descriptor) to signal for a CBR connection with the - // specified QoS in kbit/sec., and/or specify a PMP connection. - - // For FORE 200e cards, the adapter shapes traffic to CBR with rate - // equal to PCR CLP=0+1 (traffic.forward.PCR_all_traffic) - - qos_cells = (rate * 1000) / (48*8); - - if ((qos_cells > 0 && qos_cells < LINE_RATE) - || (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP))) - { - struct t_atm_bearer *bearer; - struct t_atm_traffic *traffic; - - // T_ATM_BEARER_CAP: Broadband bearer capability - popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_bearer); - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_BEARER_CAP; - popt->status = 0; - - bearer = (struct t_atm_bearer *)((char *) popt + - sizeof (struct t_opthdr)); - bearer->bearer_class = T_ATM_CLASS_X; - - if (qos_cells) - { - bearer->traffic_type = T_ATM_CBR; - bearer->timing_requirements = T_ATM_END_TO_END; - } - else - { - bearer->traffic_type = 0; // UBR - bearer->timing_requirements = 0; - } - bearer->clipping_susceptibility = T_ATM_NULL; - - if (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP)) - bearer->connection_configuration = T_ATM_1_TO_MANY; - else - bearer->connection_configuration = T_ATM_1_TO_1; - - popt = T_OPT_NEXTHDR (buf, info.options, popt); - - // T_ATM_TRAFFIC: traffic descriptor - popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_traffic); - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_TRAFFIC; - popt->status = 0; - - traffic = (struct t_atm_traffic *)((char *) popt + - sizeof (struct t_opthdr)); - - traffic->forward.PCR_high_priority = T_ATM_ABSENT; - traffic->forward.PCR_all_traffic = qos_cells ? qos_cells : LINE_RATE; - traffic->forward.SCR_high_priority = T_ATM_ABSENT; - traffic->forward.SCR_all_traffic = T_ATM_ABSENT; - traffic->forward.MBS_high_priority = T_ATM_ABSENT; - traffic->forward.MBS_all_traffic = T_ATM_ABSENT; - traffic->forward.tagging = T_NO; - - traffic->backward.PCR_high_priority = T_ATM_ABSENT; - traffic->backward.PCR_all_traffic = - (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP)) - ? 0 : qos_cells ? qos_cells : LINE_RATE; - traffic->backward.SCR_high_priority = T_ATM_ABSENT; - traffic->backward.SCR_all_traffic = T_ATM_ABSENT; - traffic->backward.MBS_high_priority = T_ATM_ABSENT; - traffic->backward.MBS_all_traffic = T_ATM_ABSENT; - traffic->backward.tagging = T_NO; - - traffic->best_effort = qos_cells ? T_NO : T_YES; - - popt = T_OPT_NEXTHDR (buf, - info.options, - popt); - } - - if (qos_cells > 0 && qos_cells < LINE_RATE) - { - struct t_atm_qos *qos; - - // T_ATM_QOS: Quality of Service - popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_qos); - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_QOS; - popt->status = 0; - - qos = (struct t_atm_qos *)((char *) popt + sizeof (struct t_opthdr)); - qos->coding_standard = T_ATM_ITU_CODING; - qos->forward.qos_class = T_ATM_QOS_CLASS_1; - qos->backward.qos_class = T_ATM_QOS_CLASS_1; - - popt = T_OPT_NEXTHDR (buf, info.options, popt); - } - - // Return actual size of options and option buffer to user. - *len = (char *) popt - buf; - - return buf; -#else - ACE_UNUSED_ARG (fd); - ACE_UNUSED_ARG (rate); - ACE_UNUSED_ARG (flag); - ACE_UNUSED_ARG (len); - return (0); -#endif /* ACE_HAS_FORE_ATM_WS2 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ - diff --git a/ace/ATM_QoS.h b/ace/ATM_QoS.h deleted file mode 100644 index 41a4dafab6e..00000000000 --- a/ace/ATM_QoS.h +++ /dev/null @@ -1,115 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file ATM_QoS.h - * - * $Id$ - * - * @author Joe Hoffert - */ -//========================================================================== - - -#ifndef ACE_ATM_QoS_H -#define ACE_ATM_QoS_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined(ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#if defined (ACE_HAS_FORE_ATM_WS2) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// just map to WS2 GQOS struct -typedef ACE_QoS ATM_QoS; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_FORE_ATM_XTI) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef struct netbuf ATM_QoS; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_LINUX_ATM) -#include /**/ "atm.h" -#include "ace/ATM_Params.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef struct atm_qos ATM_QoS; -ACE_END_VERSIONED_NAMESPACE_DECL -#else -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef int ATM_QoS; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ATM_QoS - * - * @brief Define the QoS parameters for ATM - * - * This class wraps up QoS parameters for both ATM/XTI and - * ATM/WinSock2 to make the mechanism for the ATM protocol - * transparent. - */ -class ACE_Export ACE_ATM_QoS -{ -public: - // Constants used for ATM options - static const long LINE_RATE; - static const int OPT_FLAGS_CPID; - static const int OPT_FLAGS_PMP; - static const int DEFAULT_SELECTOR; - static const int DEFAULT_PKT_SIZE; - - // = Initializattion and termination methods. - /// Default constructor. - ACE_ATM_QoS(int = DEFAULT_PKT_SIZE); - - /// Constructor with a CBR rate. - ACE_ATM_QoS(int, - int = DEFAULT_PKT_SIZE); - - ~ACE_ATM_QoS (); - - /// Set the rate. - void set_rate (ACE_HANDLE, - int, - int); - - /// Set CBR rate in cells per second. - void set_cbr_rate (int, - int = DEFAULT_PKT_SIZE); - - /// Get ATM_QoS struct. - ATM_QoS get_qos (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Construct QoS options. - char* construct_options(ACE_HANDLE, - int, - int, - long*); - -private: - ATM_QoS qos_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ATM_QoS.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_QoS_H */ diff --git a/ace/ATM_QoS.inl b/ace/ATM_QoS.inl deleted file mode 100644 index 283baa3f560..00000000000 --- a/ace/ATM_QoS.inl +++ /dev/null @@ -1,29 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_QoS::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_QoS::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_QoS::~ACE_ATM_QoS () -{ - ACE_TRACE ("ACE_ATM_QoS::~ACE_ATM_QoS"); -} - -ACE_INLINE -ATM_QoS -ACE_ATM_QoS::get_qos (void) -{ - ACE_TRACE ("ACE_ATM_QoS::get_qos"); - return qos_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Stream.cpp b/ace/ATM_Stream.cpp deleted file mode 100644 index c6de5d4b533..00000000000 --- a/ace/ATM_Stream.cpp +++ /dev/null @@ -1,290 +0,0 @@ -// $Id$ - -#include "ace/ATM_Stream.h" - -ACE_RCSID (ace, ATM_Stream, "$Id$") - -#if defined (ACE_HAS_ATM) - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Stream.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_ATM_Stream) - -char* -ACE_ATM_Stream::get_peer_name (void) const -{ - ACE_TRACE ("ACE_ATM_Stream::get_peer_name"); -#if defined (ACE_HAS_FORE_ATM_XTI) - // // Use t_getprotaddr for XTI/ATM - // struct t_bind *localaddr - // = (struct t_bind *) ACE_OS::t_alloc (get_handle (), - // T_BIND, - // T_ADDR); - // struct t_bind *peeraddr - // = (struct t_bind *) ACE_OS::t_alloc (get_handle (), - // T_BIND, - // T_ADDR); - // ::t_getprotaddr (get_handle (), - // localaddr, - // peeraddr); - - // char* connected_name = (char*) ACE_OS::malloc (peeraddr->addr.len + 1); - // ACE_OS::strcpy (connected_name, - // peeraddr->addr.buf); - // ACE_OS::t_free ((char *) localaddr, - // T_BIND); - // ACE_OS::t_free ((char *) peeraddr, - // T_BIND); - // return (connected_name); - -#error "This doesn't seem to work. May need to jimmy-rig something with the" -#error "/etc/xti_hosts file - Ugh!" - - ACE_ATM_Addr sa; - struct netbuf name; - name.maxlen = sa.get_size (); - name.buf = (char *) sa.get_addr (); - ACE_OS::t_getname (this->get_handle (), &name, REMOTENAME); - // ACE_OS::ioctl (this->get_handle (), - // TI_GETPEERNAME, - // &name); - return (name.buf); - -#elif defined (ACE_HAS_FORE_ATM_WS2) - // Use getpeername for WinSock2. - struct sockaddr_atm name; - ACE_OS::memset (&name, 0, sizeof (name)); - int nameSize = sizeof (name); - - if (ACE_OS::getpeername (this->get_handle (), - (struct sockaddr *) &name, - &nameSize) != 0) { - return 0; - } - - char buffer[256]; - for (unsigned int index = 0; index < ATM_ADDR_SIZE - 1; index++) { - buffer[ index * 3 ] = '\0'; - sprintf (buffer, "%s%02x.", buffer, name.satm_number.Addr[ index ]); - } - buffer[ (ATM_ADDR_SIZE - 1) * 3 ] = '\0'; - sprintf (buffer, "%s%02x.", buffer, 0); - buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0'; - for (index = 0; index < ACE_OS::strlen (buffer); ++index) - buffer[index] = tolower (buffer[index]); - - ifstream atm_hosts ("C:/WINNT/atmhosts"); - assert (atm_hosts.is_open ()); - - // Find the host address in the ATM hosts file and return the - // host name - char line[256]; - char *host_ptr, *host_name = 0; - ACE_NEW_RETURN (host_name, char[256], 0); - while (!atm_hosts.eof ()) { - atm_hosts.getline (line, 256); - // Convert the line to lower case to ease comparison - for (index = 0; index < ACE_OS::strlen (line); ++index) - line[index] = tolower (line[index]); - if (ACE_OS::strstr (line, buffer) != 0) - { - char *strtok_p; - // Grab the second token which is the host name - ACE_OS::strtok_r (line, " \t", &strtok_p); - host_ptr = strtok (0, " \t", &strtok_p); - ACE_OS::strcpy (host_name, host_ptr); - break; - } - } - - return host_name; -#elif defined (ACE_HAS_LINUX_ATM) - ATM_Addr name; - int nameSize = sizeof (name.sockaddratmsvc); - - if (ACE_OS::getpeername (this->get_handle (), - (struct sockaddr *) & (name.sockaddratmsvc), - &nameSize) < 0) { - ACE_OS::perror ("ACE_ATM_Stream (get_peer_name) : "); - return 0; - } - - static ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1]; - int total_len; - if ((total_len = atm2text (buffer,sizeof buffer, - (struct sockaddr *) & (name.sockaddratmsvc), - A2T_PRETTY|A2T_NAME)) < 0) { - ACE_DEBUG ((LM_DEBUG,ACE_LIB_TEXT ("ACE_ATM_Stream (get_peer_name) :%d"),errno)); - return 0; - } - - return (char*) buffer; -#else - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -ACE_HANDLE -ACE_ATM_Stream::get_handle (void) const -{ - ACE_TRACE ("ACE_ATM_Stream::get_handle"); -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - return stream_.get_handle (); -#else - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -int -ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi, - ACE_UINT16 &vci) const -{ - ACE_TRACE ("ACE_ATM_Stream::get_vpi_vci"); -#if defined (ACE_HAS_FORE_ATM_XTI) - struct t_atm_conn_prop conn_prop; - char* connect_opts = (char *) &conn_prop; - int opt_size = sizeof (t_atm_conn_prop); - struct t_info info; - struct t_optmgmt opt_req, opt_ret; - - if (ACE_OS::t_getinfo (stream_.get_handle (), - &info) < 0) - { - ACE_OS::t_error ("t_getinfo"); - return -1; - } - - char *buf_req = (char *) ACE_OS::malloc (info.options); - if (buf_req == 0) - { - ACE_OS::fprintf (stderr, - "Unable to allocate %ld bytes for options\n", - info.options); - return -1; - } - - char *buf_ret = (char *) ACE_OS::malloc (info.options); - if (buf_ret == 0) - { - ACE_OS::fprintf (stderr, - "Unable to allocate %ld bytes for options\n", - info.options); - return -1; - } - - ACE_OS::memset (&opt_req, 0, sizeof (opt_req)); - ACE_OS::memset (&opt_ret, 0, sizeof (opt_ret)); - - struct t_opthdr *popt = (struct t_opthdr *) buf_req; - struct t_opthdr *popt_ret = (struct t_opthdr *) buf_ret; - - popt->len= sizeof (struct t_opthdr) + opt_size; - - // We are only concerned with SVCs so no other check or values are needed - // here. - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_CONN_PROP; - popt->status = 0; - - opt_req.opt.len = popt->len; - opt_req.opt.buf = (char *) popt; - opt_req.flags = T_CURRENT; - - popt = T_OPT_NEXTHDR (buf_req, - info.options, - popt); - opt_ret.opt.maxlen = info.options; - opt_ret.opt.buf = (char *) popt_ret; - - if (ACE_OS::t_optmgmt (stream_.get_handle (), - &opt_req, - &opt_ret) < 0) { - ACE_OS::t_error ("t_optmgmt"); - return -1; - } - - ACE_OS::memcpy (connect_opts, - (char *) popt_ret + sizeof (struct t_opthdr), - opt_size); - - ACE_OS::free (buf_ret); - ACE_OS::free (buf_req); - - vpi = conn_prop.vpi; - vci = conn_prop.vci; - return (0); -#elif defined (ACE_HAS_FORE_ATM_WS2) - ATM_CONNECTION_ID connID; - DWORD bytes = 0; - - if (::WSAIoctl ((int) this -> get_handle (), - SIO_GET_ATM_CONNECTION_ID, - 0, - 0, - (LPVOID) &connID, - sizeof (ATM_CONNECTION_ID), - &bytes, - 0, - 0) - == SOCKET_ERROR) { - ACE_OS::printf ("Error: WSAIoctl %d\n", WSAGetLastError ()); - } - - vpi = (ACE_UINT16) connID.VPI; - vci = (ACE_UINT16) connID.VCI; - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) -#if defined (SO_ATMPVC) /* atm version>=0.62 */ - struct sockaddr_atmpvc mypvcaddr; - int addrpvclen = sizeof (mypvcaddr); - if (ACE_OS::getsockopt (stream_.get_handle (), - SOL_ATM, - SO_ATMPVC, - reinterpret_cast (&mypvcaddr), - &addrpvclen) < 0) { - ACE_DEBUG (LM_DEBUG, - ACE_LIB_TEXT ("ACE_ATM_Stream::get_vpi_vci: getsockopt %d\n"), - errno); - return -1; - } - vpi = (ACE_UINT16) mypvcaddr.sap_addr.vpi; - vci = (ACE_UINT16) mypvcaddr.sap_addr.vci; - - return 0; -#elif defined (SO_VCID) /* patch for atm version 0.59 */ - struct atm_vcid mypvcid; - int pvcidlen = sizeof (mypvcid); - if (ACE_OS::getsockopt (stream_.get_handle (), - SOL_ATM,SO_VCID, - reinterpret_cast (&mypvcid), - &pvcidlen) < 0) { - ACE_DEBUG (LM_DEBUG, - ACE_LIB_TEXT ("ACE_ATM_Stream::get_vpi_vci: getsockopt %d\n"), - errno); - return -1; - } - vpi = (ACE_UINT16) mypvcid.vpi; - vci = (ACE_UINT16) mypvcid.vci; - - return 0; -#else - ACE_DEBUG (LM_DEBUG, - ACE_LIB_TEXT ("ACE_ATM_Stream::get_vpi_vci: Not implemented in this ATM version. Update to >= 0.62\n Or patch 0.59")); - ACE_UNUSED_ARG (vci); - ACE_UNUSED_ARG (vpi); - - return (-1); -#endif /* SO_ATMPVC || SO_VCID */ -#else - return (-1); -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_Stream.h b/ace/ATM_Stream.h deleted file mode 100644 index e1bb9257c9e..00000000000 --- a/ace/ATM_Stream.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file ATM_Stream.h - * - * $Id$ - * - * @author Joe Hoffert - */ -//============================================================================= - - -#ifndef ACE_ATM_STREAM_H -#define ACE_ATM_STREAM_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include "ace/ATM_Addr.h" -#include "ace/ATM_Params.h" - -#if defined (ACE_WIN32) -#include "ace/SOCK_Stream.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_SOCK_Stream ATM_Stream; -ACE_END_VERSIONED_NAMESPACE_DECL -#else -#include "ace/TLI_Stream.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_TLI_Stream ATM_Stream; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ATM_Stream - * - * @brief Defines the member functions for ACE_ATM_Stream abstraction. - */ -class ACE_Export ACE_ATM_Stream -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_ATM_Stream (void); - - // = ATM-specific open and shutdown operations. - /// open the stream. - int open (ACE_ATM_Params params = ACE_ATM_Params()); - - /// Close down and release resources. - int close (void); - - /// Get the underlying handle. - ACE_HANDLE get_handle (void) const; - - /// Get the underlying stream. - ATM_Stream& get_stream (void); - - /// Get the name of the connected host. - char* get_peer_name (void) const; - - /// Get the VPI and VCI of the stream. - int get_vpi_vci (ACE_UINT16 &vpi, - ACE_UINT16 &vci) const; - - /// Recv an n byte buffer from the connected transport mechanism. - ssize_t recv (void *buf, - size_t n, - int *flags = 0) const; - - /// Send exactly n bytes to the connected transport mechanism. - ssize_t send_n (const void *buf, - size_t n, - int flags) const; - - // = Meta-type info - typedef ACE_ATM_Addr PEER_ADDR; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Typedef'd to the appropriate stream mechanism above. - ATM_Stream stream_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Stream.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_STREAM_H */ diff --git a/ace/ATM_Stream.inl b/ace/ATM_Stream.inl deleted file mode 100644 index b796af474e7..00000000000 --- a/ace/ATM_Stream.inl +++ /dev/null @@ -1,133 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_Stream::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Stream::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_Stream::ACE_ATM_Stream (void) -{ - ACE_TRACE ("ACE_ATM_Stream::ACE_ATM_Stream"); -} - -ACE_INLINE -int -ACE_ATM_Stream::open (ACE_ATM_Params params) -{ - ACE_TRACE ("ACE_ATM_Stream::open"); -#if defined (ACE_HAS_FORE_ATM_XTI) - ACE_HANDLE handle = stream_.open (params.get_device(), - params.get_oflag(), - params.get_info()); - return (handle == ACE_INVALID_HANDLE ? -1 : 0); -#elif defined (ACE_HAS_FORE_ATM_WS2) - params.set_flags( ACE_FLAG_MULTIPOINT_C_ROOT | ACE_FLAG_MULTIPOINT_D_ROOT ); - - int retval = stream_.open (params.get_type(), - params.get_protocol_family(), - params.get_protocol(), - params.get_protocol_info(), - params.get_sock_group(), - params.get_flags(), - params.get_reuse_addr()); - if (retval == -1) - return -1; - - struct sockaddr_atm sock_addr; - - ACE_OS::memset(&sock_addr, 0, sizeof(struct sockaddr_atm)); - sock_addr.satm_family = AF_ATM; - sock_addr.satm_number.AddressType=ADDR_ANY; - sock_addr.satm_number.NumofDigits = ATM_ADDR_SIZE; - sock_addr.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT; - sock_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; - sock_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; - if (ACE_OS::bind(get_handle(), - (struct sockaddr FAR *)&sock_addr, - sizeof(struct sockaddr_atm)) < 0) - { - ACE_OS::printf("Error binding local address: %d",WSAGetLastError()); - return -1; - } - - return 0; -#else - ACE_UNUSED_ARG(params); - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ -} - -ACE_INLINE -int -ACE_ATM_Stream::close (void) -{ - ACE_TRACE ("ACE_ATM_Stream::close"); -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - return stream_.close (); -#else - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ -} - -ACE_INLINE -ATM_Stream& -ACE_ATM_Stream::get_stream (void) -{ - ACE_TRACE ("ACE_ATM_Stream::get_stream"); - return stream_; -} - -ACE_INLINE -ssize_t -ACE_ATM_Stream::recv (void *buf, - size_t n, - int *flags) const -{ - ACE_TRACE ("ACE_ATM_Stream::recv"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return stream_.recv (buf, - n, - flags); -#elif defined (ACE_HAS_FORE_ATM_WS2) - return stream_.recv (buf, - n); -#else - ACE_UNUSED_ARG(buf); - ACE_UNUSED_ARG(n); - ACE_UNUSED_ARG(flags); - return (0); -#endif /* ACE_HAS_FORE_ATM_XTI */ -} - -ACE_INLINE -ssize_t -ACE_ATM_Stream::send_n (const void *buf, - size_t n, - int flags) const -{ - ACE_TRACE ("ACE_ATM_Stream::send_n"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return stream_.send_n (buf, - n, - flags); -#elif defined (ACE_HAS_FORE_ATM_WS2) - return stream_.send_n (buf, - n, - flags); -#else - ACE_UNUSED_ARG(buf); - ACE_UNUSED_ARG(n); - ACE_UNUSED_ARG(flags); - return (0); -#endif /* ACE_HAS_FORE_ATM_XTI */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp deleted file mode 100644 index 9a106440236..00000000000 --- a/ace/Acceptor.cpp +++ /dev/null @@ -1,1228 +0,0 @@ -#ifndef ACE_ACCEPTOR_CPP -#define ACE_ACCEPTOR_CPP - -#include "ace/ACE.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Acceptor.h" -#include "ace/Handle_Set.h" -#include "ace/Svc_Handler.h" -#include "ace/WFMO_Reactor.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_sys_select.h" - -ACE_RCSID (ace, - Acceptor, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Acceptor) - -template void -ACE_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Acceptor::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->peer_acceptor_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Acceptor::operator ACE_PEER_ACCEPTOR & () const -{ - ACE_TRACE ("ACE_Acceptor::operator ACE_PEER_ACCEPTOR &"); - return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; -} - -template ACE_PEER_ACCEPTOR & -ACE_Acceptor::acceptor (void) const -{ - ACE_TRACE ("ACE_Acceptor::acceptor"); - return const_cast (this->peer_acceptor_); -} - -// Returns ACE_HANDLE of the underlying Acceptor_Strategy. - -template ACE_HANDLE -ACE_Acceptor::get_handle (void) const -{ - ACE_TRACE ("ACE_Acceptor::get_handle"); - return this->peer_acceptor_.get_handle (); -} - -// Initialize the appropriate strategies for creation, passive -// connection acceptance, and concurrency, and then register -// with the Reactor and listen for connection requests at the -// designated . - -template int -ACE_Acceptor::open - (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor, - int flags, - int use_select, - int reuse_addr) -{ - ACE_TRACE ("ACE_Acceptor::open"); - this->flags_ = flags; - this->use_select_ = use_select; - this->reuse_addr_ = reuse_addr; - this->peer_acceptor_addr_ = local_addr; - - // Must supply a valid Reactor to Acceptor::open()... - - if (reactor == 0) - { - errno = EINVAL; - return -1; - } - - if (this->peer_acceptor_.open (local_addr, reuse_addr) == -1) - return -1; - - // Set the peer acceptor's handle into non-blocking mode. This is a - // safe-guard against the race condition that can otherwise occur - // between the time when indicates that a passive-mode - // socket handle is "ready" and when we call . During this - // interval, the client can shutdown the connection, in which case, - // the call can hang! - if (this->accept_strategy_->acceptor ().enable (ACE_NONBLOCK) != 0) - return -1; - - // Initialize the concurrency strategy. - - if (con_s == 0) - { - ACE_NEW_RETURN (con_s, - CONCURRENCY_STRATEGY, - -1); - this->delete_concurrency_strategy_ = 1; - } - this->concurrency_strategy_ = con_s; - - // Initialize the scheduling strategy. - - if (sch_s == 0) - { - ACE_NEW_RETURN (sch_s, - SCHEDULING_STRATEGY, - -1); - this->delete_scheduling_strategy_ = 1; - } - this->scheduling_strategy_ = sch_s; - - this->use_select_ = use_select; - - return this->reactor ()->register_handler - (this, - ACE_Event_Handler::ACCEPT_MASK); -} - -// Simple constructor. - -template -ACE_Strategy_Acceptor::ACE_Strategy_Acceptor - (const ACE_TCHAR service_name[], - const ACE_TCHAR service_description[], - int use_select, - int reuse_addr) - : creation_strategy_ (0), - delete_creation_strategy_ (0), - accept_strategy_ (0), - delete_accept_strategy_ (0), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (0), - scheduling_strategy_ (0), - delete_scheduling_strategy_ (0), - service_name_ (0), - service_description_ (0) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"); - - if (service_name != 0) - ACE_ALLOCATOR (this->service_name_, - ACE_OS::strdup (service_name)); - if (service_description != 0) - ACE_ALLOCATOR (this->service_description_, - ACE_OS::strdup (service_description)); - this->use_select_ = use_select; - this->reuse_addr_ = reuse_addr; -} - -template -ACE_Strategy_Acceptor::ACE_Strategy_Acceptor - (const ACE_PEER_ACCEPTOR_ADDR &addr, - ACE_Reactor *reactor, - ACE_Creation_Strategy *cre_s, - ACE_Accept_Strategy *acc_s, - ACE_Concurrency_Strategy *con_s, - ACE_Scheduling_Strategy *sch_s, - const ACE_TCHAR service_name[], - const ACE_TCHAR service_description[], - int use_select, - int reuse_addr) - : creation_strategy_ (0), - delete_creation_strategy_ (0), - accept_strategy_ (0), - delete_accept_strategy_ (0), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (0), - scheduling_strategy_ (0), - delete_scheduling_strategy_ (0), - service_name_ (0), - service_description_ (0) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"); - - if (this->open (addr, - reactor, - cre_s, - acc_s, - con_s, - sch_s, - service_name, - service_description, - use_select, - reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"))); -} - -// Perform termination activities when is removed from the -// . - -template int -ACE_Strategy_Acceptor::handle_close (ACE_HANDLE, - ACE_Reactor_Mask) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::handle_close"); - // Guard against multiple closes. - if (this->reactor () != 0) - { - ACE_HANDLE handle = this->get_handle (); - - if (this->delete_creation_strategy_) - delete this->creation_strategy_; - this->delete_creation_strategy_ = 0; - this->creation_strategy_ = 0; - - if (this->delete_accept_strategy_) - delete this->accept_strategy_; - this->delete_accept_strategy_ = 0; - this->accept_strategy_ = 0; - - if (this->delete_concurrency_strategy_) - delete this->concurrency_strategy_; - this->delete_concurrency_strategy_ = 0; - this->concurrency_strategy_ = 0; - - if (this->delete_scheduling_strategy_) - delete this->scheduling_strategy_; - this->delete_scheduling_strategy_ = 0; - this->scheduling_strategy_ = 0; - - // We must use the obtained *before* we deleted the - // accept_strategy_... - - this->reactor ()->remove_handler - (handle, - ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - - // Set the Reactor to 0 so that we don't try to close down - // again. - this->reactor (0); - } - return 0; -} - -// Bridge method for creating a . The strategy for -// creating a are configured into the Acceptor via it's -// . The default is to create a new -// . However, subclasses can override this strategy to -// perform creation in any way that they like (such as -// creating subclass instances of , using a singleton, -// dynamically linking the handler, etc.). - -template int -ACE_Strategy_Acceptor::make_svc_handler (SVC_HANDLER *&sh) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::make_svc_handler"); - return this->creation_strategy_->make_svc_handler (sh); -} - -// Bridge method for accepting the new connection into the -// . The default behavior delegates to the -// in the Acceptor_Strategy. - -template int -ACE_Strategy_Acceptor::accept_svc_handler - (SVC_HANDLER *svc_handler) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::accept_svc_handler"); - return this->accept_strategy_->accept_svc_handler (svc_handler); -} - -// Bridge method for activating a with the appropriate -// concurrency strategy. The default behavior of this method is to -// activate the SVC_HANDLER by calling its open() method (which allows -// the SVC_HANDLER to define its own concurrency strategy). However, -// subclasses can override this strategy to do more sophisticated -// concurrency activations (such as creating the SVC_HANDLER as an -// "active object" via multi-threading or multi-processing). - -template int -ACE_Strategy_Acceptor::activate_svc_handler - (SVC_HANDLER *svc_handler) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::activate_svc_handler"); - return this->concurrency_strategy_->activate_svc_handler - (svc_handler, - (void *) this); -} - -template -ACE_Strategy_Acceptor::~ACE_Strategy_Acceptor (void) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::~ACE_Strategy_Acceptor"); - ACE_OS::free ((void *) this->service_name_); - ACE_OS::free ((void *) this->service_description_); - this->handle_close (); -} - -// Signal the server to shutdown gracefully. - -template int -ACE_Strategy_Acceptor::handle_signal (int, siginfo_t *, ucontext_t *) -{ - ACE_Reactor::instance()->end_reactor_event_loop (); - return 0; -} - -template int -ACE_Strategy_Acceptor::info (ACE_TCHAR **strp, - size_t length) const -{ - ACE_TRACE ("ACE_Strategy_Acceptor::info"); - - ACE_TCHAR buf[BUFSIZ]; - ACE_TCHAR service_addr_str[BUFSIZ]; - ACE_PEER_ACCEPTOR_ADDR addr; - - if (this->acceptor ().get_local_addr (addr) == -1) - return -1; - else if (addr.addr_to_string (service_addr_str, - sizeof service_addr_str) == -1) - return -1; - - // @@ Should add the protocol in... - ACE_OS::sprintf (buf, - ACE_LIB_TEXT ("%s\t %s #%s\n"), - this->service_name_ == 0 - ? ACE_LIB_TEXT ("") - : this->service_name_, - service_addr_str, - this->service_description_ == 0 - ? ACE_LIB_TEXT ("") - : this->service_description_); - - if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) - return -1; - else - ACE_OS::strsncpy (*strp, buf, length); - return static_cast (ACE_OS::strlen (buf)); -} - -template int -ACE_Strategy_Acceptor::fini (void) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::fini"); - return this->ACE_Strategy_Acceptor::handle_close (); -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Oneshot_Acceptor) - -template void -ACE_Oneshot_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Oneshot_Acceptor::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nsvc_handler_ = %x"), this->svc_handler_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nrestart_ = %d"), this->restart_)); - this->peer_acceptor_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("delete_concurrency_strategy_ = %d"), - delete_concurrency_strategy_)); - this->concurrency_strategy_->dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Oneshot_Acceptor::open - (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor, - ACE_Concurrency_Strategy *con_s) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::open"); - this->reactor (reactor); - - // Initialize the concurrency strategy. - - if (con_s == 0) - { - ACE_NEW_RETURN (con_s, - ACE_Concurrency_Strategy, - -1); - this->delete_concurrency_strategy_ = 1; - } - this->concurrency_strategy_ = con_s; - - // Reuse the addr, even if it is already in use...! - return this->peer_acceptor_.open (local_addr, 1); -} - -template -ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor (void) - : delete_concurrency_strategy_ (0) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"); - this->reactor (0); -} - -template -ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor - (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor, - ACE_Concurrency_Strategy *cs) - : delete_concurrency_strategy_ (0) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"); - if (this->open (local_addr, reactor, cs) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"))); -} - -template -ACE_Oneshot_Acceptor::~ACE_Oneshot_Acceptor (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::~ACE_Oneshot_Acceptor"); - this->handle_close (); -} - -template int -ACE_Oneshot_Acceptor::close (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::close"); - return this->handle_close (); -} - -template int -ACE_Oneshot_Acceptor::handle_close (ACE_HANDLE, - ACE_Reactor_Mask) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::handle_close"); - - // Guard against multiple closes. - if (this->delete_concurrency_strategy_) - { - delete this->concurrency_strategy_; - this->delete_concurrency_strategy_ = 0; - this->concurrency_strategy_ = 0; - } - // Note that if we aren't actually registered with the - // ACE_Reactor then it's ok for this call to fail... - - if (this->reactor ()) - this->reactor ()->remove_handler - (this, - ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - - if (this->peer_acceptor_.close () == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("close\n"))); - return 0; -} - -template int -ACE_Oneshot_Acceptor::handle_timeout - (const ACE_Time_Value &tv, - const void *arg) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::handle_timeout"); - errno = ETIME; - - if (this->svc_handler_->handle_timeout (tv, arg) == -1) - this->svc_handler_->handle_close (this->svc_handler_->get_handle (), - ACE_Event_Handler::TIMER_MASK); - - // Since we aren't necessarily registered with the Reactor, don't - // bother to check the return value here... - if (this->reactor ()) - this->reactor ()->remove_handler (this, - ACE_Event_Handler::ACCEPT_MASK); - return 0; -} - -template int -ACE_Oneshot_Acceptor::cancel (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::cancel"); - return this->reactor () && this->reactor ()->cancel_timer (this); -} - -template int -ACE_Oneshot_Acceptor::register_handler - (SVC_HANDLER *svc_handler, - const ACE_Synch_Options &synch_options, - int restart) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::register_handler"); - // Can't do this if we don't have a Reactor. - if (this->reactor () == 0) - { - errno = EINVAL; - return -1; - } - else - { - this->svc_handler_ = svc_handler; - this->restart_ = restart; - ACE_Time_Value *tv = (ACE_Time_Value *) synch_options.time_value (); - - if (tv != 0 - && this->reactor ()->schedule_timer (this, - synch_options.arg (), - *tv) == 0) - return -1; - else - return this->reactor ()->register_handler - (this, - ACE_Event_Handler::ACCEPT_MASK); - } -} - -// Bridge method for activating a with the appropriate -// concurrency strategy. The default behavior of this method is to -// activate the SVC_HANDLER by calling its open() method (which allows -// the SVC_HANDLER to define its own concurrency strategy). However, -// subclasses can override this strategy to do more sophisticated -// concurrency activations (such as creating the SVC_HANDLER as an -// "active object" via multi-threading or multi-processing). - -template int -ACE_Oneshot_Acceptor::activate_svc_handler - (SVC_HANDLER *svc_handler) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::activate_svc_handler"); - return this->concurrency_strategy_->activate_svc_handler - (svc_handler, - (void *) this); -} - -// Factors out the code shared between the and -// methods. - -template int -ACE_Oneshot_Acceptor::shared_accept - (SVC_HANDLER *svc_handler, - ACE_PEER_ACCEPTOR_ADDR *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::shared_accept"); - if (svc_handler == 0) - return -1; - - // Accept connection into the Svc_Handler. - else if (this->peer_acceptor_.accept (svc_handler->peer (), // stream - remote_addr, // remote address - timeout, // timeout - restart, // restart - reset_new_handle // reset new handle - ) == -1) - { - // Check whether we just timed out or whether we failed... - if (!(errno == EWOULDBLOCK || errno == ETIME)) - // Close down handler to avoid memory leaks. - svc_handler->close (0); - return -1; - } - // Activate the using the designated concurrency - // strategy (note that this method becomes responsible for handling - // errors and freeing up the memory if things go awry...) - else - return this->activate_svc_handler (svc_handler); -} - -// Make a SVC_HANDLER, accept the connection into the SVC_HANDLER, and -// then activate the SVC_HANDLER. Note that SVC_HANDLER::open() -// decides what type of concurrency strategy to use. - -template int -ACE_Oneshot_Acceptor::accept - (SVC_HANDLER *svc_handler, - ACE_PEER_ACCEPTOR_ADDR *remote_addr, - const ACE_Synch_Options &synch_options, - int restart, - int reset_new_handle) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::accept"); - // Note that if timeout == ACE_Time_Value (x, y) where (x > 0 || y > - // 0) then this->connector_.connect() will block synchronously. If - // is set then we don't want this to happen (since we - // want the ACE_Reactor to do the timeout asynchronously). - // Therefore, we'll force this->connector_ to use ACE_Time_Value (0, - // 0) in this case... - - ACE_Time_Value *timeout; - int use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR]; - - if (use_reactor) - timeout = (ACE_Time_Value *) &ACE_Time_Value::zero; - else - timeout = (ACE_Time_Value *) synch_options.time_value (); - - if (this->shared_accept (svc_handler, // stream - remote_addr, // remote address - timeout, // timeout - restart, // restart - reset_new_handle // reset new handler - ) == -1) - { - if (use_reactor && errno == EWOULDBLOCK) - // We couldn't accept right away, so let's wait in the - // . - this->register_handler (svc_handler, - synch_options, - restart); - return -1; - } - return 0; -} - -// Accepts one pending connection from a client (since we're the -// "oneshot" Acceptor). - -template int -ACE_Oneshot_Acceptor::handle_input (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::handle_input"); - int result = 0; - - // Cancel any timer that might be pending. - this->cancel (); - - // Try to find out if the implementation of the reactor that we are - // using requires us to reset the event association for the newly - // created handle. This is because the newly created handle will - // inherit the properties of the listen handle, including its event - // associations. - int reset_new_handle = this->reactor ()->uses_event_associations (); - - // There is a use-case whereby this object will be gone upon return - // from shared_accept - if the Svc_Handler deletes this Oneshot_Acceptor - // during the shared_accept/activation steps. So, do whatever we need - // to do with this object before calling shared_accept. - if (this->reactor ()) - this->reactor ()->remove_handler - (this, - ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - - if (this->shared_accept (this->svc_handler_, // stream - 0, // remote address - 0, // timeout - this->restart_, // restart - reset_new_handle // reset new handle - ) == -1) - result = -1; - - return result; -} - -// Hook called by the explicit dynamic linking facility. - -template int -ACE_Oneshot_Acceptor::init (int, ACE_TCHAR *[]) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::init"); - return -1; -} - -template int -ACE_Oneshot_Acceptor::fini (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::fini"); - return this->handle_close (); -} - -template int -ACE_Oneshot_Acceptor::info (ACE_TCHAR **strp, - size_t length) const -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::info"); - ACE_TCHAR buf[BUFSIZ]; - ACE_TCHAR addr_str[BUFSIZ]; - ACE_PEER_ACCEPTOR_ADDR addr; - - if (this->peer_acceptor_.get_local_addr (addr) == -1) - return -1; - else if (addr.addr_to_string (addr_str, sizeof addr_str) == -1) - return -1; - - ACE_OS::sprintf (buf, - ACE_LIB_TEXT ("%s\t %s %s"), - ACE_LIB_TEXT ("ACE_Oneshot_Acceptor"), - addr_str, - ACE_LIB_TEXT ("#oneshot acceptor factory\n")); - - if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) - return -1; - else - ACE_OS::strsncpy (*strp, buf, length); - return static_cast (ACE_OS::strlen (buf)); -} - -template int -ACE_Oneshot_Acceptor::suspend (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::suspend"); - return this->reactor () && this->reactor ()->suspend_handler (this); -} - -template int -ACE_Oneshot_Acceptor::resume (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::resume"); - return this->reactor () && this->reactor ()->resume_handler (this); -} - -// Returns ACE_HANDLE of the underlying peer_acceptor. - -template ACE_HANDLE -ACE_Oneshot_Acceptor::get_handle (void) const -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::get_handle"); - return this->peer_acceptor_.get_handle (); -} - -template ACE_PEER_ACCEPTOR & -ACE_Oneshot_Acceptor::acceptor (void) const -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::acceptor"); - return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; -} - -template -ACE_Oneshot_Acceptor::operator ACE_PEER_ACCEPTOR & () const -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::operator ACE_PEER_ACCEPTOR &"); - return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ACCEPTOR_CPP */ diff --git a/ace/Acceptor.h b/ace/Acceptor.h deleted file mode 100644 index a1ebcd9c055..00000000000 --- a/ace/Acceptor.h +++ /dev/null @@ -1,683 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Acceptor.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ACCEPTOR_H -#define ACE_ACCEPTOR_H - -#include /**/ "ace/pre.h" - -#include "ace/Service_Object.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Strategies_T.h" -#include "ace/Synch_Options.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Acceptor - * - * @brief Abstract factory for creating a service handler - * (SVC_HANDLER), accepting into the SVC_HANDLER, and - * activating the SVC_HANDLER. - * - * Implements the basic strategy for passively establishing - * connections with clients. An ACE_Acceptor is parameterized - * by concrete types that conform to the interfaces of - * PEER_ACCEPTOR and SVC_HANDLER. The PEER_ACCEPTOR is - * instantiated with a transport mechanism that passively - * establishes connections. The SVC_HANDLER is instantiated - * with a concrete type that performs the application-specific - * service. An ACE_Acceptor inherits from ACE_Service_Object, - * which in turn inherits from ACE_Event_Handler. This enables - * the ACE_Reactor to dispatch the ACE_Acceptor's handle_input - * method when connection events occur. The handle_input method - * performs the ACE_Acceptor's default creation, connection - * establishment, and service activation strategies. These - * strategies can be overridden by subclasses individually or as - * a group. - */ -template -class ACE_Acceptor : public ACE_Service_Object -{ -public: - - // Useful STL-style traits. - typedef ACE_PEER_ACCEPTOR_ADDR addr_type; - typedef ACE_PEER_ACCEPTOR acceptor_type; - typedef SVC_HANDLER handler_type; - typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - - /// "Do-nothing" constructor. - ACE_Acceptor (ACE_Reactor * = 0, - int use_select = 1); - - /** - * Open the contained @c PEER_ACCEPTOR object to begin listening, and - * register with the specified reactor for accept events. An - * acceptor can only listen to one port at a time, so make sure to - * @c close() the acceptor before calling @c open() again. - * - * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a - * safeguard against the race condition that can otherwise occur - * between the time when the passive-mode socket handle is "ready" - * and when the actual @c accept() call is made. During this - * interval, the client can shutdown the connection, in which case, - * the @c accept() call can hang. - * - * @param local_addr The address to listen at. - * @param reactor Pointer to the ACE_Reactor instance to register - * this object with. The default is the singleton. - * @param flags Flags to control what mode an accepted socket - * will be put into after it is accepted. The only - * legal value for this argument is @c ACE_NONBLOCK, - * which enables non-blocking mode on the accepted - * peer stream object in @c SVC_HANDLER. The default - * is 0. - * @param use_select Affects behavior when called back by the reactor - * when a connection can be accepted. If non-zero, - * this object will accept all pending connections, - * intead of just the one that triggered the reactor - * callback. Uses ACE_OS::select() internally to - * detect any remaining acceptable connections. - * The default is 1. - * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with - * @p local_addr. Generally used to request that the - * OS allow reuse of the listen port. The default is 1. - */ - ACE_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor * = ACE_Reactor::instance (), - int flags = 0, - int use_select = 1, - int reuse_addr = 1); - - /** - * Open the contained @c PEER_ACCEPTOR object to begin listening, and - * register with the specified reactor for accept events. An - * acceptor can only listen to one port at a time, so make sure to - * @c close() the acceptor before calling @c open() again. - * - * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a - * safeguard against the race condition that can otherwise occur - * between the time when the passive-mode socket handle is "ready" - * and when the actual @c accept() call is made. During this - * interval, the client can shutdown the connection, in which case, - * the @c accept() call can hang. - * - * @param local_addr The address to listen at. - * @param reactor Pointer to the ACE_Reactor instance to register - * this object with. The default is the singleton. - * @param flags Flags to control what mode an accepted socket - * will be put into after it is accepted. The only - * legal value for this argument is @c ACE_NONBLOCK, - * which enables non-blocking mode on the accepted - * peer stream object in @c SVC_HANDLER. The default - * is 0. - * @param use_select Affects behavior when called back by the reactor - * when a connection can be accepted. If non-zero, - * this object will accept all pending connections, - * intead of just the one that triggered the reactor - * callback. Uses ACE_OS::select() internally to - * detect any remaining acceptable connections. - * The default is 1. - * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with - * @p local_addr. Generally used to request that the - * OS allow reuse of the listen port. The default is 1. - * - * @retval 0 Success - * @retval -1 Failure, @c errno contains an error code. - */ - virtual int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor = ACE_Reactor::instance (), - int flags = 0, - int use_select = 1, - int reuse_addr = 1); - - /// Close down the Acceptor's resources. - virtual ~ACE_Acceptor (void); - - /// Return the underlying PEER_ACCEPTOR object. - virtual operator ACE_PEER_ACCEPTOR &() const; - - /// Return the underlying PEER_ACCEPTOR object. - virtual ACE_PEER_ACCEPTOR &acceptor (void) const; - - /// Returns the listening acceptor's {ACE_HANDLE}. - virtual ACE_HANDLE get_handle (void) const; - - /// Close down the Acceptor - virtual int close (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = The following three methods define the Acceptor's strategies - // for creating, accepting, and activating SVC_HANDLER's, - // respectively. - - /** - * Bridge method for creating a SVC_HANDLER. The default is to - * create a new {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged. - * However, subclasses can override this policy to perform - * SVC_HANDLER creation in any way that they like (such as creating - * subclass instances of SVC_HANDLER, using a singleton, dynamically - * linking the handler, etc.). Returns -1 on failure, else 0. - */ - virtual int make_svc_handler (SVC_HANDLER *&sh); - - /** - * Bridge method for accepting the new connection into the - * . The default behavior delegates to the - * PEER_ACCEPTOR::accept. - */ - virtual int accept_svc_handler (SVC_HANDLER *svc_handler); - - /** - * Bridge method for activating a {svc_handler} with the appropriate - * concurrency strategy. The default behavior of this method is to - * activate the SVC_HANDLER by calling its {open} method (which - * allows the SVC_HANDLER to define its own concurrency strategy). - * However, subclasses can override this strategy to do more - * sophisticated concurrency activations (such as making the - * SVC_HANDLER as an "active object" via multi-threading or - * multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - // = Demultiplexing hooks. - /// Perform termination activities when {this} is removed from the - /// {reactor}. - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Accepts all pending connections from clients, and creates and - /// activates SVC_HANDLERs. - virtual int handle_input (ACE_HANDLE); - - // = Dynamic linking hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int init (int argc, ACE_TCHAR *argv[]); - - /// Calls {handle_close}. - virtual int fini (void); - - /// Default version returns address info in {buf}. - virtual int info (ACE_TCHAR **buf, size_t) const; - -public: - // = Service management hooks. - /// This method calls {Reactor::suspend}. - virtual int suspend (void); - - /// This method calls {Reactor::resume}. - virtual int resume (void); - -protected: - /// Concrete factory for accepting connections from clients... - ACE_PEER_ACCEPTOR peer_acceptor_; - - /// Needed to reopen the socket if {accept} fails. - ACE_PEER_ACCEPTOR_ADDR peer_acceptor_addr_; - - /** - * Flags that indicate how {SVC_HANDLER}'s should be initialized - * prior to being activated. Right now, the only flag that is - * processed is {ACE_NONBLOCK}, which enabled non-blocking I/O on - * the {SVC_HANDLER} when it is opened. - */ - int flags_; - - /// Flag that indicates whether it shall use {select} in the - /// {accept}-loop. - int use_select_; - - /// Needed to reopen the socket if {accept} fails. - int reuse_addr_; -}; - -/** - * @class ACE_Strategy_Acceptor - * - * @brief Abstract factory for creating a service handler - * (SVC_HANDLER), accepting into the SVC_HANDLER, and activating - * the SVC_HANDLER. - * - * Implements a flexible and extensible set of strategies for - * passively establishing connections with clients. There are - * three main strategies: (1) creating a SVC_HANDLER, (2) - * passively accepting a new connection from a client into the - * SVC_HANDLER, and (3) activating the SVC_HANDLER with a - * particular concurrency mechanism. - */ -template -class ACE_Strategy_Acceptor - : public ACE_Acceptor -{ -public: - - // Useful STL-style traits. - typedef ACE_Creation_Strategy - creation_strategy_type; - typedef ACE_Accept_Strategy - accept_strategy_type; - typedef ACE_Concurrency_Strategy - concurrency_strategy_type; - typedef ACE_Scheduling_Strategy scheduling_strategy_type; - typedef ACE_Acceptor - base_type; - - // = Define some useful (old style) traits. - typedef ACE_Creation_Strategy CREATION_STRATEGY; - typedef ACE_Accept_Strategy ACCEPT_STRATEGY; - typedef ACE_Concurrency_Strategy CONCURRENCY_STRATEGY; - typedef ACE_Scheduling_Strategy SCHEDULING_STRATEGY; - - - - /// Default constructor. - ACE_Strategy_Acceptor (const ACE_TCHAR service_name[] = 0, - const ACE_TCHAR service_description[] = 0, - int use_select = 1, - int reuse_addr = 1); - - /** - * Initialize the appropriate strategies for creation, passive - * connection acceptance, and concurrency, and then register {this} - * with the Reactor and listen for connection requests at the - * designated {local_addr}. - */ - ACE_Strategy_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor * = ACE_Reactor::instance (), - ACE_Creation_Strategy * = 0, - ACE_Accept_Strategy * = 0, - ACE_Concurrency_Strategy * = 0, - ACE_Scheduling_Strategy * = 0, - const ACE_TCHAR service_name[] = 0, - const ACE_TCHAR service_description[] = 0, - int use_select = 1, - int reuse_addr = 1); - - /** - * Open the contained @c PEER_ACCEPTOR object to begin listening, and - * register with the specified reactor for accept events. - * - * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a - * safeguard against the race condition that can otherwise occur - * between the time when the passive-mode socket handle is "ready" - * and when the actual @c accept call is made. During this - * interval, the client can shutdown the connection, in which case, - * the {accept} call can hang. - * - * @param local_addr The address to listen at. - * @param reactor Pointer to the ACE_Reactor instance to register - * this object with. The default is the singleton. - * @param flags Flags to control what mode an accepted socket - * will be put into after it is accepted. The only - * legal value for this argument is @c ACE_NONBLOCK, - * which enables non-blocking mode on the accepted - * peer stream object in @c SVC_HANDLER. The default - * is 0. - * @param use_select Affects behavior when called back by the reactor - * when a connection can be accepted. If non-zero, - * this object will accept all pending connections, - * intead of just the one that triggered the reactor - * callback. Uses ACE_OS::select() internally to - * detect any remaining acceptable connections. - * The default is 1. - * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with - * @p local_addr. Generally used to request that the - * OS allow reuse of the listen port. The default is 1. - * - * @retval 0 Success - * @retval -1 Failure, @c errno contains an error code. - */ - virtual int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor, - int flags = 0, - int use_select = 1, - int reuse_addr = 1); - - /** - * Initialize the appropriate strategies for creation, passive - * connection acceptance, and concurrency, and then register {this} - * with the Reactor and listen for connection requests at the - * designated {local_addr}. - */ - virtual int open (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor * = ACE_Reactor::instance (), - ACE_Creation_Strategy * = 0, - ACE_Accept_Strategy * =0, - ACE_Concurrency_Strategy * = 0, - ACE_Scheduling_Strategy * = 0, - const ACE_TCHAR *service_name = 0, - const ACE_TCHAR *service_description = 0, - int use_select = 1, - int reuse_addr = 1); - - /// Close down the Strategy_Acceptor's resources. - virtual ~ACE_Strategy_Acceptor (void); - - /// Return the underlying PEER_ACCEPTOR object. - virtual operator ACE_PEER_ACCEPTOR &() const; - - /// Return the underlying PEER_ACCEPTOR object. - virtual ACE_PEER_ACCEPTOR &acceptor (void) const; - - /// Returns the listening acceptor's {ACE_HANDLE}. - virtual ACE_HANDLE get_handle (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Service management hooks. - - /// This method delegates to the {Scheduling_Strategy}'s {suspend} - /// method. - virtual int suspend (void); - - /// This method delegates to the {Scheduling_Strategy}'s {resume} - /// method. - virtual int resume (void); - - /// Calls {handle_close} when dynamically unlinked. - virtual int fini (void); - - /// Default version returns address info in {buf}. - virtual int info (ACE_TCHAR **buf, size_t) const; - - // = The following three methods define the {Acceptor}'s strategies - // for creating, accepting, and activating {SVC_HANDLER}'s, - // respectively. - - /** - * Bridge method for creating a {SVC_HANDLER}. The strategy for - * creating a {SVC_HANDLER} are configured into the Acceptor via - * it's {creation_strategy_}. The default is to create a new - * {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged. However, - * subclasses can override this policy to perform {SVC_HANDLER} - * creation in any way that they like (such as creating subclass - * instances of {SVC_HANDLER}, using a singleton, dynamically - * linking the handler, etc.). Returns -1 on failure, else 0. - */ - virtual int make_svc_handler (SVC_HANDLER *&); - - /** - * Bridge method for accepting the new connection into the - * {SVC_HANDLER}. The default behavior delegates to the - * {PEER_ACCEPTOR::accept} in the {Acceptor_Strategy}. - */ - virtual int accept_svc_handler (SVC_HANDLER *svc_handler); - - /** - * Bridge method for activating a {SVC_HANDLER} with the appropriate - * concurrency strategy. The default behavior of this method is to - * activate the {SVC_HANDLER} by calling its {open} method (which - * allows the {SVC_HANDLER} to define its own concurrency strategy). - * However, subclasses can override this strategy to do more - * sophisticated concurrency activations (such as creating the - * {SVC_HANDLER} as an "active object" via multi-threading or - * multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - // = Demultiplexing hooks. - /// Perform termination activities when {this} is removed from the - /// {Reactor}. - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Handle SIGINT. - virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); - - // = These data members are "logically private" but are put in the - // protected part in case subclasses want to access them. - - // = Strategy objects. - - /// Creation strategy for an Acceptor. - CREATION_STRATEGY *creation_strategy_; - - /// 1 if {Acceptor} created the creation strategy and thus should - /// delete it, else 0. - int delete_creation_strategy_; - - /// Accept strategy for an {Acceptor}. - ACCEPT_STRATEGY *accept_strategy_; - - /// 1 if {Acceptor} created the accept strategy and thus should delete - /// it, else 0. - int delete_accept_strategy_; - - /// Concurrency strategy for an {Acceptor}. - CONCURRENCY_STRATEGY *concurrency_strategy_; - - /// 1 if {Acceptor} created the concurrency strategy and thus should - /// delete it, else 0. - int delete_concurrency_strategy_; - - /// Scheduling strategy for an {Acceptor}. - SCHEDULING_STRATEGY *scheduling_strategy_; - - /// 1 if {Acceptor} created the scheduling strategy and thus should - /// delete it, else 0. - int delete_scheduling_strategy_; - - // = Service information objects. - - /// Name of the service. - ACE_TCHAR *service_name_; - - /// Description of the service. - ACE_TCHAR *service_description_; - - /// Address that the {Strategy_Acceptor} uses to listen for - /// connections. - ACE_PEER_ACCEPTOR_ADDR service_addr_; -}; - -/** - * @class ACE_Oneshot_Acceptor - * - * @brief Generic factory for passively connecting clients and creating - * exactly one service handler (SVC_HANDLER). - * - * This class works similarly to the regular {ACE_Acceptor}, - * with the following differences: - * 1. This class doesn't automagically register {this} with the - * {ACE_Reactor} since it expects to have its {accept} method - * called directly. However, it stashes the {ACE_Reactor} - * pointer away in case it's needed later to finish accepting - * a connection asynchronously. - * 2. The class doesn't need an {ACE_Creation_Strategy} (since - * the user supplies the SVC_HANDLER) or an - * {ACE_Accept_Strategy} (since this class only accepts one - * connection and then removes all traces of itself from the - * {ACE_Reactor} if it was registered for asynchronous - * accepts). - */ -template -class ACE_Oneshot_Acceptor : public ACE_Service_Object -{ -public: - - // Useful STL-style traits. - typedef ACE_PEER_ACCEPTOR_ADDR addr_type; - typedef ACE_PEER_ACCEPTOR acceptor_type; - typedef SVC_HANDLER handler_type; - typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - - /// Constructor. - ACE_Oneshot_Acceptor (void); - - /** - * Initialize the appropriate strategies for concurrency and then - * open the {peer_acceptor} at the designated {local_addr}. Note - * that unlike the {ACE_Acceptor} and {ACE_Strategy_Acceptor}, this - * method does NOT register {this} acceptor with the {reactor} at - * this point -- it just stashes the {reactor} away in case it's - * needed later. - */ - ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor = ACE_Reactor::instance (), - ACE_Concurrency_Strategy * = 0); - - /** - * Initialize the appropriate strategies for concurrency and then - * open the {peer_acceptor} at the designated {local_addr}. Note - * that unlike the {ACE_Acceptor} and {ACE_Strategy_Acceptor}, this - * method does NOT register {this} acceptor with the {reactor} at - * this point -- it just stashes the {reactor} away in case it's - * needed later. - */ - int open (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor *reactor = ACE_Reactor::instance (), - ACE_Concurrency_Strategy * = 0); - - /// Close down the {Oneshot_Acceptor}. - virtual ~ACE_Oneshot_Acceptor (void); - - // = Explicit factory operation. - /// Create a {SVC_HANDLER}, accept the connection into the - /// {SVC_HANDLER}, and activate the {SVC_HANDLER}. - virtual int accept (SVC_HANDLER * = 0, - ACE_PEER_ACCEPTOR_ADDR *remote_addr = 0, - const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, - int restart = 1, - int reset_new_handle = 0); - - /// Cancel a oneshot acceptor that was started asynchronously. - virtual int cancel (void); - - /// Return the underlying {PEER_ACCEPTOR} object. - virtual operator ACE_PEER_ACCEPTOR &() const; - - /// Return the underlying {PEER_ACCEPTOR} object. - virtual ACE_PEER_ACCEPTOR &acceptor (void) const; - - /// Close down the {Oneshot_Acceptor}. - virtual int close (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /** - * Bridge method for activating a {svc_handler} with the appropriate - * concurrency strategy. Default behavior is to activate the - * {SVC_HANDLER} as a "passive object." However, subclasses can - * override this strategy to do more sophisticated concurrency - * activations (such as creating the {SVC_HANDLER} as an "active - * object" via multi-threading or multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - /// Factors out the code shared between the {accept} and - /// {handle_input} methods. - int shared_accept (SVC_HANDLER *svc_handler, - ACE_PEER_ACCEPTOR_ADDR *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle); - - // = Demultiplexing hooks. - /// Returns the listening acceptor's {ACE_HANDLE}. - virtual ACE_HANDLE get_handle (void) const; - - /// Perform termination activities when {this} is removed from the - /// {reactor}. - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Accept one connection from a client and activates the - /// SVC_HANDLER. - virtual int handle_input (ACE_HANDLE); - - /// Called when an acceptor times out... - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg); - - // = Dynamic linking hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int init (int argc, ACE_TCHAR *argv[]); - - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int fini (void); - - /// Default version returns address info in {buf}. - virtual int info (ACE_TCHAR **, size_t) const; - - // = Service management hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int suspend (void); - - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int resume (void); - -private: - /** - * Insert ourselves into the {ACE_Reactor} so that we can continue - * accepting this connection asynchronously. This method should NOT - * be called by developers directly. - */ - int register_handler (SVC_HANDLER *svc_handler, - const ACE_Synch_Options &options, - int restart); - - /// Hold the svc_handler_ across asynchrony boundaries. - SVC_HANDLER *svc_handler_; - - /// Hold the restart flag across asynchrony boundaries. - int restart_; - - /// Factory that establishes connections passively. - ACE_PEER_ACCEPTOR peer_acceptor_; - - /// Concurrency strategy for an Acceptor. - ACE_Concurrency_Strategy *concurrency_strategy_; - - /// 1 if Acceptor created the concurrency strategy and thus should - /// delete it, else 0. - int delete_concurrency_strategy_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Acceptor.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Acceptor.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ACCEPTOR_H */ diff --git a/ace/Activation_Queue.cpp b/ace/Activation_Queue.cpp deleted file mode 100644 index 0bad62f3911..00000000000 --- a/ace/Activation_Queue.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include "ace/Activation_Queue.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Activation_Queue.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/Method_Request.h" -#include "ace/Malloc_Base.h" -#include "ace/Time_Value.h" - -ACE_RCSID (ace, - Activation_Queue, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Activation_Queue::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("delete_queue_ = %d\n"), - this->delete_queue_)); - ACE_DEBUG ((LM_INFO, ACE_LIB_TEXT ("queue_: \n"))); - if (this->queue_) - this->queue_->dump(); - else - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(NULL)\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Activation_Queue::ACE_Activation_Queue (ACE_Message_Queue *new_queue, - ACE_Allocator *alloc, - ACE_Allocator *db_alloc) - : delete_queue_ (0) - , allocator_(alloc) - , data_block_allocator_(db_alloc) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - if (new_queue) - this->queue_ = new_queue; - else - { - ACE_NEW (this->queue_, - ACE_Message_Queue); - this->delete_queue_ = 1; - } -} - -void -ACE_Activation_Queue::queue (ACE_Message_Queue *q) -{ - // Destroy the internal queue if one exist. - if (this->delete_queue_ != 0) - { - // Destroy the current queue. - delete this->queue_; - - // Set the flag to false. NOTE that the delete_queue_ flag is a - // flag used to only indicate whether or not if an internal - // ACE_Message_Queue has been created, therefore, it will not - // affect the user if the user decided to replace the queue with - // their own queue no matter how many time they call on this - // function. - this->delete_queue_ = 0; - } - - queue_ = q; -} - -ACE_Activation_Queue::~ACE_Activation_Queue (void) -{ - if (this->delete_queue_ != 0) - delete this->queue_; -} - -ACE_Method_Request * -ACE_Activation_Queue::dequeue (ACE_Time_Value *tv) -{ - ACE_Message_Block *mb = 0; - - // Dequeue the message. - if (this->queue_->dequeue_head (mb, tv) != -1) - { - // Get the next . - ACE_Method_Request *mr = - reinterpret_cast (mb->base ()); - // Delete the message block. - mb->release (); - return mr; - } - else - return 0; -} - -int -ACE_Activation_Queue::enqueue (ACE_Method_Request *mr, - ACE_Time_Value *tv) -{ - ACE_Message_Block *mb = 0; - - // We pass sizeof (*mr) here so that flow control will work - // correctly. Since we also pass note that no unnecessary - // memory is actually allocated -- just the size field is set. - ACE_NEW_MALLOC_RETURN (mb, - static_cast (this->allocator_->malloc (sizeof (ACE_Message_Block))), - ACE_Message_Block (sizeof (*mr), // size - ACE_Message_Block::MB_DATA, // type - 0, // cont - (char *) mr, // data - 0, // allocator - 0, // locking strategy - mr->priority (), // priority - ACE_Time_Value::zero, // execution time - ACE_Time_Value::max_time, // absolute time of deadline - this->data_block_allocator_, // data_block allocator - this->allocator_), // message_block allocator - -1); - - // Enqueue in priority order. - int const result = this->queue_->enqueue_prio (mb, tv); - - // Free ACE_Message_Block if enqueue_prio failed. - if (result == -1) - ACE_DES_FREE (mb, this->allocator_->free, ACE_Message_Block); - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Activation_Queue.h b/ace/Activation_Queue.h deleted file mode 100644 index 26d51c9dcf1..00000000000 --- a/ace/Activation_Queue.h +++ /dev/null @@ -1,174 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Activation_Queue.h - * - * $Id$ - * - * @author Andres Kruse - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ACTIVATION_QUEUE_H -#define ACE_ACTIVATION_QUEUE_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Message_Queue.h" -#include "ace/Condition_Thread_Mutex.h" - -/// Define to be compatible with the terminology in the POSA2 book! -#define ACE_Activation_List ACE_Activation_Queue - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Method_Request; - -/** - * @class ACE_Activation_Queue - * - * @brief Reifies a method into a request. Subclasses typically - * represent necessary state and behavior. - * - * Maintains a priority-ordered queue of ACE_Method_Request objects. - * A scheduler class (often derived from ACE_Task) subsequently removes - * each method request and invokes its @c call() method. - * - * This class is discussed in depth in the Active Object chapter - * of POSA2. In that book, it is referred to as an Activation List. - * - * @sa ACE_Method_Request - */ -class ACE_Export ACE_Activation_Queue -{ -public: - // = Initialization and termination methods. - /// Constructor. - /** - * Initializes a new activation queue. - * - * @param new_queue The activation queue uses an ACE_Message_Queue to - * queue and order the method requests. If this argument - * is 0, a new ACE_Message_Queue is created for this - * object's use and will be deleted when this object is - * destroyed. If a non-zero pointer is supplied, the - * passed object will be used and will not be deleted when - * this object is destroyed. If an ACE_Task is being created - * to act as the scheduler, for instance, its - * ACE_Message_Queue pointer can be passed to this object. - * @param alloc Optional, the allocator to use when allocating - * ACE_Message_Block instances that wrap the method requests - * queued to this activation queue. Defaults to - * ACE_Allocator::instance(). - * @param db_alloc Optional, the allocator to use when allocating - * data blocks for the ACE_Message_Block instances that - * wrap the method requests queued to this activation queue. - * Defaults to ACE_Allocator::instance(). - */ - ACE_Activation_Queue (ACE_Message_Queue *new_queue = 0, - ACE_Allocator *alloc = 0, - ACE_Allocator *db_alloc = 0); - - /// Destructor. - virtual ~ACE_Activation_Queue (void); - - // = Activate Queue operations. - - /// Dequeue the next available ACE_Method_Request. - /** - * @param tv If 0, the method will block until a method request is - * available, else will wait until the absolute time specified - * in the referenced ACE_Time_Value. This method will return, - * earlier, however, if queue is closed, deactivated, or when - * a signal occurs. - * - * @retval Pointer to the dequeued ACE_Method_Request object. - * @retval 0 an error occurs; errno contains further information. If - * the specified timeout elapses, errno will be @c EWOULDBLOCK. - */ - ACE_Method_Request *dequeue (ACE_Time_Value *tv = 0); - - /// Enqueue the ACE_Method_Request in priority order. - /** - * The priority of the method request is obtained via the @c priority() - * method of the queued method request. Priority ordering is determined - * by the ACE_Message_Queue class; 0 is the lowest priority. - * - * @param new_method_request Pointer to the ACE_Method_Request object to - * queue. This object's @c priority() method is called to obtain - * the priority. - * @param tv If 0, the method will block until the method request can - * be queued, else will wait until the absolute time specified - * in the referenced ACE_Time_Value. This method will return, - * earlier, however, if queue is closed, deactivated, or when - * a signal occurs. - * - * @retval >0 The number of method requests on the queue after adding - * the specified request. - * @retval -1 if an error occurs; errno contains further information. If - * the specified timeout elapses, errno will be @c EWOULDBLOCK. - */ - int enqueue (ACE_Method_Request *new_method_request, - ACE_Time_Value *tv = 0); - - /// Get the current number of method objects in the queue. - size_t method_count (void) const; - - /// Returns 1 if the queue is empty, 0 otherwise. - int is_empty (void) const; - - /// Returns 1 if the queue is full, 0 otherwise. - int is_full (void) const; - - /// Dump the state of an request. - void dump (void) const; - - /// Get a pointer to the underlying queue. - ACE_Message_Queue *queue (void) const; - - /// Set the pointer to the underlying queue. - void queue (ACE_Message_Queue *q); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - // = Prevent copying and assignment. - ACE_Activation_Queue (const ACE_Activation_Queue &); - void operator= (const ACE_Activation_Queue &); - -protected: - - /// Stores the Method_Requests. - ACE_Message_Queue *queue_; - - /// Keeps track of whether we need to delete the queue. - int delete_queue_; - -private: - - /// Allocation strategy of the queue. - ACE_Allocator *allocator_; - - /// Allocation strategy of the message blocks. - ACE_Allocator *data_block_allocator_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Activation_Queue.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_ACTIVATION_QUEUE_H */ diff --git a/ace/Activation_Queue.inl b/ace/Activation_Queue.inl deleted file mode 100644 index 50127f607d1..00000000000 --- a/ace/Activation_Queue.inl +++ /dev/null @@ -1,31 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE size_t -ACE_Activation_Queue::method_count (void) const -{ - return queue_->message_count (); -} - -ACE_INLINE int -ACE_Activation_Queue::is_full (void) const -{ - return queue_->is_full (); -} - -ACE_INLINE int -ACE_Activation_Queue::is_empty (void) const -{ - return queue_->is_empty (); -} - -ACE_INLINE ACE_Message_Queue * -ACE_Activation_Queue::queue (void) const -{ - return queue_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Active_Map_Manager.cpp b/ace/Active_Map_Manager.cpp deleted file mode 100644 index 6f4b66191c7..00000000000 --- a/ace/Active_Map_Manager.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// $Id$ - -#include "ace/Active_Map_Manager.h" - -ACE_RCSID(ace, Active_Map_Manager, "$Id$") - -#if !defined (__ACE_INLINE__) -#include "ace/Active_Map_Manager.inl" -#endif /* __ACE_INLINE__ */ diff --git a/ace/Active_Map_Manager.h b/ace/Active_Map_Manager.h deleted file mode 100644 index 7e3bb348058..00000000000 --- a/ace/Active_Map_Manager.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Active_Map_Manager.h - * - * $Id$ - * - * @author Irfan Pyarali - */ -//============================================================================= - - -#ifndef ACE_ACTIVE_MAP_MANAGER_H -#define ACE_ACTIVE_MAP_MANAGER_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Basic_Types.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Active_Map_Manager_Key - * - * @brief Key used in the Active Object Map. - * - * This key keeps information of the index and the generation - * count of the slot it represents. Since the index information - * is part of the key, lookups are super fast and predictable, - */ -class ACE_Export ACE_Active_Map_Manager_Key -{ -public: - /// Default constructor. - ACE_Active_Map_Manager_Key (void); - - /** - * Constructor given the @a slot_index and @a slot_generation number. - * This is useful once the user has somehow recovered the - * @a slot_index and @a slot_generation number from the client. - */ - ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index, - ACE_UINT32 slot_generation); - - /// Get the . - ACE_UINT32 slot_index (void) const; - - /// Set the . - void slot_index (ACE_UINT32 i); - - /// Get the number. - ACE_UINT32 slot_generation (void) const; - - /// Set the number. - void slot_generation (ACE_UINT32 g); - - /// Size required to store information about active key. - static size_t size (void); - - /// Recover state of active key from @a data. User must make sure - /// that @a data encoded using the encode() method. - void decode (const void *data); - - /// Encode state of the active key into @a data. @a data must be as - /// big as the value returned from . - void encode (void *data) const; - - /// Compare keys. - bool operator== (const ACE_Active_Map_Manager_Key &rhs) const; - bool operator!= (const ACE_Active_Map_Manager_Key &rhs) const; - - // = This really should be protected but because of template - // friends, they are not. - - /// Increment the number. - void increment_slot_generation_count (void); - -private: - - /** - * @brief Data for the Active Object Map Key. - * - * This separate structure makes it easier to manage copying - * the index and the generation to and from the user buffer. - * - */ - struct key_data - { - /// Slot index in the active map. - ACE_UINT32 slot_index_; - - /// Slot generation number of slot in the active map. - ACE_UINT32 slot_generation_; - }; - - /// Data for the Active Object Map Key. - key_data key_data_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Active_Map_Manager.inl" -#endif /* __ACE_INLINE__ */ - -// Include the templates here. -#include "ace/Active_Map_Manager_T.h" - -#include /**/ "ace/post.h" -#endif /* ACE_ACTIVE_MAP_MANAGER_H */ diff --git a/ace/Active_Map_Manager.inl b/ace/Active_Map_Manager.inl deleted file mode 100644 index 652cf7c1f71..00000000000 --- a/ace/Active_Map_Manager.inl +++ /dev/null @@ -1,95 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (void) -{ - // If you change ~0, please change ACE_Map_Manager::free_list_id() - // accordingly. - this->key_data_.slot_index_ = (ACE_UINT32) ~0; - this->key_data_.slot_generation_ = 0; -} - -ACE_INLINE -ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index, - ACE_UINT32 slot_generation) -{ - this->key_data_.slot_index_ = slot_index; - this->key_data_.slot_generation_ = slot_generation; -} - -ACE_INLINE ACE_UINT32 -ACE_Active_Map_Manager_Key::slot_index (void) const -{ - return this->key_data_.slot_index_; -} - -ACE_INLINE ACE_UINT32 -ACE_Active_Map_Manager_Key::slot_generation (void) const -{ - return this->key_data_.slot_generation_; -} - -ACE_INLINE bool -ACE_Active_Map_Manager_Key::operator== (const ACE_Active_Map_Manager_Key &rhs) const -{ - return - this->key_data_.slot_index_ == rhs.key_data_.slot_index_ && - this->key_data_.slot_generation_ == rhs.key_data_.slot_generation_; -} - -ACE_INLINE bool -ACE_Active_Map_Manager_Key::operator!= (const ACE_Active_Map_Manager_Key &rhs) const -{ - return !this->operator== (rhs); -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::slot_index (ACE_UINT32 i) -{ - this->key_data_.slot_index_ = i; -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::slot_generation (ACE_UINT32 g) -{ - this->key_data_.slot_generation_ = g; -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::increment_slot_generation_count (void) -{ - ++this->key_data_.slot_generation_; -} - -/* static */ -ACE_INLINE size_t -ACE_Active_Map_Manager_Key::size (void) -{ - return sizeof (ACE_UINT32) + sizeof (ACE_UINT32); -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::decode (const void *data) -{ - // Copy the information from the user buffer into the key. - ACE_OS::memcpy (&this->key_data_, - data, - sizeof this->key_data_); -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::encode (void *data) const -{ - // Copy the key data to the user buffer. - ACE_OS::memcpy (data, - &this->key_data_, - sizeof this->key_data_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Active_Map_Manager_T.cpp b/ace/Active_Map_Manager_T.cpp deleted file mode 100644 index b8cd14446ac..00000000000 --- a/ace/Active_Map_Manager_T.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -#ifndef ACE_ACTIVE_MAP_MANAGER_T_CPP -#define ACE_ACTIVE_MAP_MANAGER_T_CPP - -#include "ace/Active_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Active_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Active_Map_Manager) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ACTIVE_MAP_MANAGER_T_CPP */ diff --git a/ace/Active_Map_Manager_T.h b/ace/Active_Map_Manager_T.h deleted file mode 100644 index 2194f8194de..00000000000 --- a/ace/Active_Map_Manager_T.h +++ /dev/null @@ -1,211 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Active_Map_Manager_T.h - * - * $Id$ - * - * @author Irfan Pyarali - */ -//============================================================================= - - -#ifndef ACE_ACTIVE_MAP_MANAGER_T_H -#define ACE_ACTIVE_MAP_MANAGER_T_H -#include /**/ "ace/pre.h" - -#include "ace/Map_Manager.h" -#include "ace/Active_Map_Manager.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Null_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Active_Map_Manager - * - * @brief Define a map abstraction that associates system generated - * keys with user specified values. - * - * Since the key is system generated, searches are very fast and - * take a constant amount of time. - */ -template -class ACE_Active_Map_Manager : public ACE_Map_Manager -{ -public: - - // = Traits. - typedef ACE_Active_Map_Manager_Key key_type; - typedef T mapped_type; - - typedef ACE_Map_Entry ENTRY; - typedef ACE_Map_Iterator ITERATOR; - typedef ACE_Map_Reverse_Iterator REVERSE_ITERATOR; - - typedef ENTRY entry; - typedef ITERATOR iterator; - typedef REVERSE_ITERATOR reverse_iterator; - - // = Initialization and termination methods. - /// Initialize a with the . - ACE_Active_Map_Manager (ACE_Allocator *alloc = 0); - - /// Initialize a with entries. - ACE_Active_Map_Manager (size_t size, - ACE_Allocator *alloc = 0); - - /// Close down a and release dynamically - /// allocated resources. - ~ACE_Active_Map_Manager (void); - - /// Initialize a with size . - int open (size_t length = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *alloc = 0); - - /// Close down a and release dynamically - /// allocated resources. - int close (void); - - /// Add to the map, and the corresponding key produced by the - /// Active_Map_Manager is returned through . - int bind (const T &value, - ACE_Active_Map_Manager_Key &key); - - /// Add to the map. The user does not care about the - /// corresponding key produced by the Active_Map_Manager. - int bind (const T &value); - - /** - * Reserves a slot in the internal structure and returns the key and - * a pointer to the value. User should place their into - * <*internal_value>. This method is useful in reducing the number - * of copies required in some cases. Note that is - * only a temporary pointer and will change when the map resizes. - * Therefore, the user should use the pointer immediately and not - * hold on to it. - */ - int bind (ACE_Active_Map_Manager_Key &key, - T *&internal_value); - - /// Reassociate with . The function fails if is - /// not in the map. - int rebind (const ACE_Active_Map_Manager_Key &key, - const T &value); - - /** - * Reassociate with , storing the old value into the - * "out" parameter . The function fails if is not - * in the map. - */ - int rebind (const ACE_Active_Map_Manager_Key &key, - const T &value, - T &old_value); - - /** - * Reassociate with , storing the old key and value - * into the "out" parameter and . The function - * fails if is not in the map. - */ - int rebind (const ACE_Active_Map_Manager_Key &key, - const T &value, - ACE_Active_Map_Manager_Key &old_key, - T &old_value); - - /// Locate associated with . - int find (const ACE_Active_Map_Manager_Key &key, - T &value) const; - - /// Is in the map? - int find (const ACE_Active_Map_Manager_Key &key) const; - - /** - * Locate associated with . The value is returned via - * and hence a copy is saved. Note that - * is only a temporary pointer and will change when - * the map resizes. Therefore, the user should use the pointer - * immediately and not hold on to it. - */ - int find (const ACE_Active_Map_Manager_Key &key, - T *&internal_value) const; - - // Creates a key. User should place their into - // <*internal_value>. This method is useful in reducing the number - // of copies required in some cases. - - /// Remove from the map. - int unbind (const ACE_Active_Map_Manager_Key &key); - - /// Remove from the map, and return the associated with - /// . - int unbind (const ACE_Active_Map_Manager_Key &key, - T &value); - - /** - * Locate associated with . The value is returned via - * and hence a copy is saved. Note that - * is only a temporary pointer and will change when - * the map resizes or when this slot is reused. Therefore, the user - * should use the pointer immediately and not hold on to it. - */ - int unbind (const ACE_Active_Map_Manager_Key &key, - T *&internal_value); - - /// Return the current size of the map. - size_t current_size (void) const; - - /// Return the total size of the map. - size_t total_size (void) const; - - /// Returns a key that cannot be found in the map. - static const ACE_Active_Map_Manager_Key npos (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iterator factory functions. - - /// Return forward iterator. - ACE_Map_Iterator begin (void); - ACE_Map_Iterator end (void); - - /// Return reverse iterator. - ACE_Map_Reverse_Iterator rbegin (void); - ACE_Map_Reverse_Iterator rend (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - /// Private base class - typedef ACE_Map_Manager ACE_AMM_BASE; - -private: - - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Active_Map_Manager &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager (const ACE_Active_Map_Manager &)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Active_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Active_Map_Manager_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Active_Map_Manager_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_ACTIVE_MAP_MANAGER_T_H */ diff --git a/ace/Active_Map_Manager_T.inl b/ace/Active_Map_Manager_T.inl deleted file mode 100644 index 124f76c48c4..00000000000 --- a/ace/Active_Map_Manager_T.inl +++ /dev/null @@ -1,311 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Active_Map_Manager::bind (ACE_Active_Map_Manager_Key &key, - T *&internal_value) -{ - ACE_UINT32 slot_index; - int result = this->next_free (slot_index); - - if (result == 0) - { - // Move from free list to occupied list - this->move_from_free_list_to_occupied_list (slot_index); - - // Reset the key. - this->search_structure_[slot_index].ext_id_.increment_slot_generation_count (); - this->search_structure_[slot_index].ext_id_.slot_index (slot_index); - - // Copy the key for the user. - key = this->search_structure_[slot_index].ext_id_; - - // This is where the user should place the value. - internal_value = &this->search_structure_[slot_index].int_id_; - - // Update the current size. - ++this->cur_size_; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::bind (const T &value, - ACE_Active_Map_Manager_Key &key) -{ - T *internal_value = 0; - int result = this->bind (key, - internal_value); - - if (result == 0) - { - // Store new value. - *internal_value = value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::bind (const T &value) -{ - ACE_Active_Map_Manager_Key key; - return this->bind (value, key); -} - -template ACE_INLINE int -ACE_Active_Map_Manager::find (const ACE_Active_Map_Manager_Key &key, - T *&internal_value) const -{ - ACE_UINT32 slot_index = key.slot_index (); - ACE_UINT32 slot_generation = key.slot_generation (); - - if (slot_index > this->total_size_ || -#if defined (ACE_HAS_LAZY_MAP_MANAGER) - this->search_structure_[slot_index].free_ || -#endif /* ACE_HAS_LAZY_MAP_MANAGER */ - this->search_structure_[slot_index].ext_id_.slot_generation () != slot_generation || - this->search_structure_[slot_index].ext_id_.slot_index () == - (ACE_UINT32)this->free_list_id ()) - { - return -1; - } - else - { - // This is where the user value is. - internal_value = &this->search_structure_[slot_index].int_id_; - } - - return 0; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::find (const ACE_Active_Map_Manager_Key &key) const -{ - T *internal_value = 0; - return this->find (key, - internal_value); -} - -template ACE_INLINE int -ACE_Active_Map_Manager::find (const ACE_Active_Map_Manager_Key &key, - T &value) const -{ - T *internal_value = 0; - int result = this->find (key, - internal_value); - - if (result == 0) - value = *internal_value; - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::rebind (const ACE_Active_Map_Manager_Key &key, - const T &value) -{ - int result = this->find (key); - - if (result == 0) - { - // Store new value. - this->search_structure_[key.slot_index ()].int_id_ = value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::rebind (const ACE_Active_Map_Manager_Key &key, - const T &value, - T &old_value) -{ - int result = this->find (key); - - if (result == 0) - { - // Copy old value. - old_value = this->search_structure_[key.slot_index ()].int_id_; - - // Store new value. - this->search_structure_[key.slot_index ()].int_id_ = value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::rebind (const ACE_Active_Map_Manager_Key &key, - const T &value, - ACE_Active_Map_Manager_Key &old_key, - T &old_value) -{ - int result = this->find (key); - - if (result == 0) - { - // Copy old key. - old_key = this->search_structure_[key.slot_index ()].ext_id_; - - // Copy old value. - old_value = this->search_structure_[key.slot_index ()].int_id_; - - // Store new value. - this->search_structure_[key.slot_index ()].int_id_ = value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::unbind (const ACE_Active_Map_Manager_Key &key, - T *&internal_value) -{ - int result = this->find (key, - internal_value); - - if (result == 0) - { - ACE_UINT32 slot_index = key.slot_index (); - -#if defined (ACE_HAS_LAZY_MAP_MANAGER) - - // - // In the case of lazy map managers, the movement of free slots - // from the occupied list to the free list is delayed until we - // run out of free slots in the free list. - // - - this->search_structure_[slot_index].free_ = 1; - -#else - - // Move from occupied list to free list. - this->move_from_occupied_list_to_free_list (slot_index); - -#endif /* ACE_HAS_LAZY_MAP_MANAGER */ - - // Reset the slot_index. This will tell us that this entry is free. - this->search_structure_[slot_index].ext_id_.slot_index (this->free_list_id ()); - - // Update the current size. - --this->cur_size_; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::unbind (const ACE_Active_Map_Manager_Key &key, - T &value) -{ - T *internal_value; - int result = this->unbind (key, - internal_value); - - if (result == 0) - { - // Copy old value. - value = *internal_value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::unbind (const ACE_Active_Map_Manager_Key &key) -{ - T *internal_value; - return this->unbind (key, - internal_value); -} - -template ACE_INLINE -ACE_Active_Map_Manager::ACE_Active_Map_Manager (ACE_Allocator *alloc) - : ACE_AMM_BASE (alloc) -{ -} - -template ACE_INLINE -ACE_Active_Map_Manager::ACE_Active_Map_Manager (size_t size, - ACE_Allocator *alloc) - : ACE_AMM_BASE (size, - alloc) -{ -} - -template ACE_INLINE -ACE_Active_Map_Manager::~ACE_Active_Map_Manager (void) -{ -} - -template ACE_INLINE int -ACE_Active_Map_Manager::open (size_t length, - ACE_Allocator *alloc) -{ - return ACE_AMM_BASE::open (length, alloc); -} - -template ACE_INLINE int -ACE_Active_Map_Manager::close (void) -{ - return ACE_AMM_BASE::close (); -} - -template ACE_INLINE size_t -ACE_Active_Map_Manager::current_size (void) const -{ - return ACE_AMM_BASE::current_size (); -} - -template ACE_INLINE size_t -ACE_Active_Map_Manager::total_size (void) const -{ - return ACE_AMM_BASE::total_size (); -} - -/* static */ -template ACE_INLINE const ACE_Active_Map_Manager_Key -ACE_Active_Map_Manager::npos (void) -{ - return ACE_Active_Map_Manager_Key (~0, ~0); -} - -template ACE_INLINE void -ACE_Active_Map_Manager::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_AMM_BASE::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_Map_Iterator -ACE_Active_Map_Manager::begin (void) -{ - return ACE_AMM_BASE::begin (); -} - -template ACE_INLINE ACE_Map_Iterator -ACE_Active_Map_Manager::end (void) -{ - return ACE_AMM_BASE::end (); -} - -template ACE_INLINE ACE_Map_Reverse_Iterator -ACE_Active_Map_Manager::rbegin (void) -{ - return ACE_AMM_BASE::rbegin (); -} - -template ACE_INLINE ACE_Map_Reverse_Iterator -ACE_Active_Map_Manager::rend (void) -{ - return ACE_AMM_BASE::rend (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Addr.cpp b/ace/Addr.cpp deleted file mode 100644 index 6b4e3770f33..00000000000 --- a/ace/Addr.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ - -#include "ace/Addr.h" - - -ACE_RCSID (ace, - Addr, - "$Id$") - - -#if !defined (__ACE_INLINE__) -#include "ace/Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/os_include/sys/os_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Note: this object requires static construction and destruction. -/* static */ -const ACE_Addr ACE_Addr::sap_any (AF_ANY, -1); - -ACE_ALLOC_HOOK_DEFINE(ACE_Addr) - - -// Initializes instance variables. Note that 0 is an unspecified -// protocol family type... - -ACE_Addr::ACE_Addr (int type, int size) -{ - this->base_set (type, size); -} - -ACE_Addr::~ACE_Addr (void) -{ -} - -void * -ACE_Addr::get_addr (void) const -{ - return 0; -} - -void -ACE_Addr::set_addr (void *, int) -{ -} - -// Initializes instance variables. - -void -ACE_Addr::base_set (int type, int size) -{ - this->addr_type_ = type; - this->addr_size_ = size; -} - -void -ACE_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Addr::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("addr_type_ = %d"), this->addr_type_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\naddr_size_ = %d"), this->addr_size_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Addr.h b/ace/Addr.h deleted file mode 100644 index 53fba544456..00000000000 --- a/ace/Addr.h +++ /dev/null @@ -1,104 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Addr.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ADDR_H -#define ACE_ADDR_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Addr - * - * @brief Defines the base class for the "address family independent" - * address format. - */ -class ACE_Export ACE_Addr -{ -public: - // = Initialization and termination methods. - /// Initializes instance variables. - ACE_Addr (int type = -1, - int size = -1); - - /// Destructor. - virtual ~ACE_Addr (void); - - // = Get/set the size of the address. - - /// Return the size of the address. - int get_size (void) const; - - /// Sets the size of the address. - void set_size (int size); - - // = Get/set the type of the address. - - /// Get the type of the address. - int get_type (void) const; - - /// Set the type of the address. - void set_type (int type); - - /// Return a pointer to the address. - virtual void *get_addr (void) const; - - /// Set a pointer to the address. - virtual void set_addr (void *, int len); - - // = Equality/inequality tests - /// Check for address equality. - bool operator == (const ACE_Addr &sap) const; - - /// Check for address inequality. - bool operator != (const ACE_Addr &sap) const; - - /// Initializes instance variables. - void base_set (int type, int size); - - /// Wild-card address. - static const ACE_Addr sap_any; - - /// Returns a hash value. This should be overwritten by a subclass - /// that can produce a better hash value. - virtual unsigned long hash (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// e.g., AF_UNIX, AF_INET, AF_SPIPE, etc. - int addr_type_; - - /// Number of bytes in the address. - int addr_size_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ADDR_H */ diff --git a/ace/Addr.inl b/ace/Addr.inl deleted file mode 100644 index 3780e04b6aa..00000000000 --- a/ace/Addr.inl +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// Return the address of the address. - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE bool -ACE_Addr::operator == (const ACE_Addr &sap) const -{ - return (sap.addr_type_ == this->addr_type_ && - sap.addr_size_ == this->addr_size_ ); -} - -ACE_INLINE bool -ACE_Addr::operator != (const ACE_Addr &sap) const -{ - return (sap.addr_type_ != this->addr_type_ || - sap.addr_size_ != this->addr_size_ ); -} - -// Return the size of the address. - -ACE_INLINE int -ACE_Addr::get_size (void) const -{ - return this->addr_size_; -} - -// Sets the size of the address. - -ACE_INLINE void -ACE_Addr::set_size (int size) -{ - this->addr_size_ = size; -} - -// Return the type of the address. - -ACE_INLINE int -ACE_Addr::get_type (void) const -{ - return this->addr_type_; -} - -// Set the type of the address. - -ACE_INLINE void -ACE_Addr::set_type (int type) -{ - this->addr_type_ = type; -} - -ACE_INLINE unsigned long -ACE_Addr::hash (void) const -{ - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Arg_Shifter.cpp b/ace/Arg_Shifter.cpp deleted file mode 100644 index b8b5c7d564c..00000000000 --- a/ace/Arg_Shifter.cpp +++ /dev/null @@ -1,230 +0,0 @@ -#ifndef ACE_ARG_SHIFTER_T_CPP -#define ACE_ARG_SHIFTER_T_CPP - -#include "ace/Arg_Shifter.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_strings.h" -#include "ace/OS_Errno.h" -#include "ace/OS_Memory.h" - -ACE_RCSID (ace, - Arg_Shifter, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Arg_Shifter_T::ACE_Arg_Shifter_T (int& argc, - const CHAR_TYPE** argv, - const CHAR_TYPE** temp) - : argc_ (argc), - total_size_ (argc), - temp_ (temp), - argv_ (argv), - current_index_ (0), - back_ (argc - 1), - front_ (0) -{ - this->init (); -} - -template -ACE_Arg_Shifter_T::ACE_Arg_Shifter_T (int& argc, - CHAR_TYPE** argv, - CHAR_TYPE** temp) - : argc_ (argc), - total_size_ (argc), - temp_ ((const CHAR_TYPE **) temp), - argv_ ((const CHAR_TYPE **) argv), - current_index_ (0), - back_ (argc - 1), - front_ (0) -{ - this->init (); -} - -template -void -ACE_Arg_Shifter_T::init (void) -{ - // If not provided with one, allocate a temporary array. - if (this->temp_ == 0) - ACE_NEW (this->temp_, - const CHAR_TYPE *[this->total_size_]); - - if (this->temp_ != 0) - { - // Fill the temporary array. - this->argc_ = 0; - for (int i = 0; i < this->total_size_; i++) - { - this->temp_[i] = this->argv_[i]; - this->argv_[i] = 0; - } - } - else - { - // Allocation failed, prohibit iteration. - this->current_index_ = this->argc_; - this->front_ = this->argc_; - } -} - -template -ACE_Arg_Shifter_T::~ACE_Arg_Shifter_T (void) -{ - // Delete the temporary vector. - delete [] temp_; -} - -template -const CHAR_TYPE * -ACE_Arg_Shifter_T::get_current (void) const -{ - const CHAR_TYPE * retval = 0; - - if (this->is_anything_left ()) - retval = this->temp_[current_index_]; - - return retval; -} - -template -const CHAR_TYPE * -ACE_Arg_Shifter_T::get_the_parameter (const CHAR_TYPE *flag) -{ - // the return 0's abound because this method - // would otherwise be a deep if { } else { } - - // check to see if any arguments still exist - if (!this->is_anything_left()) - return 0; - - // check to see if the flag is the argument - int const offset = this->cur_arg_strncasecmp (flag); - if (offset == -1) - return 0; - - if (offset == 0) - { - this->consume_arg (); - - if (!this->is_parameter_next()) - { - return 0; - } - } - // the paramter is in the middle somewhere... - return this->temp_[current_index_] + offset; -} - -template -int -ACE_Arg_Shifter_T::cur_arg_strncasecmp (const CHAR_TYPE *flag) -{ - // Check for a current argument - if (this->is_anything_left()) - { - size_t const flag_length = ACE_OS::strlen (flag); - - // Check for presence of the flag - if (ACE_OS::strncasecmp(this->temp_[current_index_], - flag, - flag_length) == 0) - { - if (ACE_OS::strlen(temp_[current_index_]) == - flag_length) - { - // match and lengths are equal - return 0; - } - else - { - // matches, with more info to boot! - size_t const remaining = ACE_OS::strspn - (this->temp_[current_index_] + flag_length, - ACE_LIB_TEXT (" ")) + flag_length; - return static_cast (remaining); - } - } - } - // failure - return -1; -} - -template -int -ACE_Arg_Shifter_T::consume_arg (int number) -{ - int retval = 0; - - // Stick knowns at the end of the vector (consumed). - if (this->is_anything_left() >= number) - { - for (int i = 0, j = this->back_ - (number - 1); - i < number; - ++i, ++j, ++this->current_index_) - this->argv_[j] = this->temp_[this->current_index_]; - - this->back_ -= number; - retval = 1; - } - - return retval; -} - -template -int -ACE_Arg_Shifter_T::ignore_arg (int number) -{ - int retval = 0; - - // Keep unknowns at the head of the vector. - if (this->is_anything_left () >= number) - { - for (int i = 0; - i < number; - i++, this->current_index_++, this->front_++) - this->argv_[this->front_] = this->temp_[this->current_index_]; - - retval = 1; - this->argc_ += number; - } - - return retval; -} - -template -int -ACE_Arg_Shifter_T::is_anything_left (void) const -{ - return this->total_size_ - this->current_index_; -} - -template -int -ACE_Arg_Shifter_T::is_option_next (void) const -{ - return this->is_anything_left () && - this->temp_[this->current_index_][0] == '-'; -} - -template -int -ACE_Arg_Shifter_T::is_parameter_next (void) const -{ - return this->is_anything_left () - && this->temp_[this->current_index_][0] != '-'; -} - -template -int -ACE_Arg_Shifter_T::num_ignored_args (void) const -{ - return this->front_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ATOMIC_OP_T_CPP */ diff --git a/ace/Arg_Shifter.h b/ace/Arg_Shifter.h deleted file mode 100644 index 7c285708f2f..00000000000 --- a/ace/Arg_Shifter.h +++ /dev/null @@ -1,221 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Arg_Shifter.h - * - * $Id$ - * - * @author Seth Widoff - */ -//============================================================================= - -#ifndef ACE_ARG_SHIFTER_H -#define ACE_ARG_SHIFTER_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Arg_Shifter_T - * - * @brief This ADT operates on a specified set of arguments (@a argv). - * As known arguments are scanned, they are shifted to the back of the - * @a argv vector, so deeper levels of argument parsing can locate the yet - * unprocessed arguments at the beginning of the vector. - * - * The @c ACE_Arg_Shifter copies the pointers of the @a argv vector - * into a temporary array. As the @c ACE_Arg_Shifter iterates over - * the copied vector, it places known arguments in the rear of the - * vector, leaving the unknown ones in the beginning. So, after having - * visited all the arguments in the temporary vector, @c ACE_Arg_Shifter - * has placed all the unknown arguments in their original order at - * the front of original @a argv. - */ -template -class ACE_Arg_Shifter_T -{ -public: - // = Initialization and termination methods. - /** - * Initialize the ACE_Arg_Shifter to the vector over which to - * iterate. Optionally, also provide the temporary array for - * use in shifting the arguments. If ACE_Arg_Shifter must allocate - * the temporary vector internally and dynamic allocation fails, the - * ACE_Arg_Shifter will set all indicators to end of the vector, - * forbidding iteration. Following iteration over @a argv, the - * @a argc value will be updated to contain the number of - * unconsumed arguments. - * @param argc The number of strings in @a argv. @a argc will be - * updated to reflect the number of unconsumed arguments. - * @param argv The argument vector to shift. The string pointers in - * the vector will be reordered to place the @a argc unconsumed - * arguments at the front of the vector. - * @param temp A vector of @c CHAR_TYPE pointers at least @a argc - * elements long. The vector will be used for argument shifting as - * the specified @a argv vector is consumed. The vector must not - * be modified while this object exists. If this argument is 0 - * (the default) the object will allocate and free the temporary - * vector transparently. - */ - ACE_Arg_Shifter_T (int& argc, - const CHAR_TYPE **argv, - const CHAR_TYPE **temp = 0); - - /// Same behavior as the preceding constructor, but without the - /// "const" qualifier. - ACE_Arg_Shifter_T (int& argc, - CHAR_TYPE **argv, - CHAR_TYPE **temp = 0); - - /// Destructor. - ~ACE_Arg_Shifter_T (void); - - /// Get the current head of the vector. - const CHAR_TYPE *get_current (void) const; - - /** - * If the @a flag matches the current_arg of arg shifter - * this method will attempt to return the associated - * parameter value - * - * Safe to call without checking that a current arg exists - * - * In the following examples, a pointer to the char* "value" is ret - * - * eg: main -foobar value, main -FooBar value - * main -FOOBARvalue - * - * all of the above will all match the @a flag == -FooBar - * and will return a char* to "value" - * - * main -foobar 4 would succeed and return a char* to "4" - * main -foobar -4 does not succeed (-4 is not a parameter) - * but instead, would return 0 - * - * 0 is returned: - * If the current argument does not match flag - * If there is no parameter found after a 'matched' flag - * - * If the flag is matched and the flag and paramter DO NOT RUN - * together, the flag is consumed, the parameter is returned, - * and the new current argument is the parameter value. - * ie '-foobarflag VALUE' leaves the new cur arg == "VALUE" - * - * If the flag is matched and the flag and parameter RUN - * together '-foobarflagVALUE', the flag is NOT consumed - * and the cur arg is left pointing to the entire flag/value pair - */ - const CHAR_TYPE *get_the_parameter (const CHAR_TYPE* flag); - - /** - * Check if the current argument matches (case insensitive) - * - * ------------------------------------------------------------ - * - * Case A: Perfect Match (case insensitive) - * 0 is returned. - * - * ie: when current_arg = "-foobar" or "-FOOBAR" or "-fooBAR" - * this->cur_arg_strncasecmp ("-FooBar); - * will return 0 - * - * ------------------------------------------------------------ - * - * Case B: Perfect Match (case insensitive) but the current_arg - * is longer than the flag. Returns a number equal to the index - * in the char* indicating the start of the extra characters - * - * ie: when current_arg = "-foobar98023" - * this->cur_arg_strncasecmp ("-FooBar); - * will return 7 - * - * Notice: this number will always be > 0 - * - * ------------------------------------------------------------ - * - * Case C: If neither of Case A or B is met (no match) - * then -1 is returned - */ - int cur_arg_strncasecmp (const CHAR_TYPE *flag); - - /// Consume @a number argument(s) by sticking them/it on the end of - /// the vector. - int consume_arg (int number = 1); - - /// Place @a number arguments in the same relative order ahead of the - /// known arguments in the vector. - int ignore_arg (int number = 1); - - /// Returns the number of args left to see in the vector. - int is_anything_left (void) const; - - /// Returns 1 if there's a next item in the vector and it begins with - /// '-'. - int is_option_next (void) const; - - /// Returns 1 if there's a next item in the vector and it doesn't - /// begin with '-'. - int is_parameter_next (void) const; - - /// Returns the number of irrelevant args seen. - int num_ignored_args (void) const; - -private: - /// Copy Constructor should not be used. - ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T (const ACE_Arg_Shifter_T&)) - - /// Assignment '=' operator should not be used. - ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T operator= (const ACE_Arg_Shifter_T&)) - - /// Refactor the constructor logic. - void init (void); - - /// The size of the argument vector. - int& argc_; - - /// The size of argv_. - int total_size_; - - /// The temporary array over which we traverse. - const CHAR_TYPE **temp_; - - /// The array in which the arguments are reordered. - const CHAR_TYPE **argv_; - - /// The element in we're currently examining. - int current_index_; - - /// The index of in which we'll stick the next unknown - /// argument. - int back_; - - /// The index of in which we'll stick the next known - /// argument. - int front_; -}; - -typedef ACE_Arg_Shifter_T ACE_Arg_Shifter; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Arg_Shifter.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Arg_Shifter.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ARG_SHIFTER_H */ diff --git a/ace/Argv_Type_Converter.cpp b/ace/Argv_Type_Converter.cpp deleted file mode 100644 index e12bda80ff3..00000000000 --- a/ace/Argv_Type_Converter.cpp +++ /dev/null @@ -1,204 +0,0 @@ -// $Id$ - -#include "ace/Argv_Type_Converter.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Argv_Type_Converter.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - Argv_Type_Converter, - "$Id$") - -#include "ace/OS_NS_string.h" -#include "ace/OS_Errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_USES_WCHAR) -ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv) - : saved_argc_ (argc), - char_argv_ (0), - wchar_argv_ (argv), - before_pass_argc_ (argc), - original_type_ (1), - wchar_passed_ (0), - char_passed_ (0) -{ - this->initialize (); - - for (int i = 0; i < argc; ++i) - this->char_argv_[i] = ACE_OS::strdup (ACE_TEXT_ALWAYS_CHAR (argv[i])); -} -#endif // ACE_USES_WCHAR - - -ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char** argv) - : saved_argc_(argc), - char_argv_(argv) -#if defined (ACE_USES_WCHAR) - , wchar_argv_(0), - before_pass_argc_(argc), - original_type_(0), - wchar_passed_(0), - char_passed_(0) -{ - this->initialize(); - - for (int i = 0; i < argc; ++i) - this->wchar_argv_[i] = ACE_OS::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i])); -} -#else -{ -} -#endif // ACE_USES_WCHAR - -ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void) -{ -#if defined (ACE_USES_WCHAR) - // selectively delete the 'copy' of argv - if (this->original_type_) - { - // if original type is wchar_t - if (this->char_passed_) - this->align_wchar_with_char (); - - for (int i = 0; i < this->before_pass_argc_; ++i) - ACE_OS::free (this->char_argv_[i]); - - delete [] this->char_argv_; - } - else - { - // if original type is char - if (this->wchar_passed_) - this->align_char_with_wchar (); - - for (int i = 0; i < this->before_pass_argc_; ++i) - ACE_OS::free (this->wchar_argv_[i]); - - delete [] this->wchar_argv_; - } -#endif // ACE_USES_WCHAR -} - -#if defined (ACE_USES_WCHAR) -void -ACE_Argv_Type_Converter::initialize (void) -{ - if (this->original_type_) - { - // Make a copy of argv in 'char'. type Create one more argv entry - // than original argc for the NULL. - ACE_NEW (char_argv_, - char *[this->saved_argc_ + 1]); - this->char_argv_[saved_argc_] = 0; // last entry of argv is - // always a NULL - } - else - { - // make a copy of argv in 'wchar_t' type - ACE_NEW (this->wchar_argv_, - wchar_t*[this->saved_argc_ + 1]); - this->wchar_argv_[saved_argc_] = 0; - } -} - - -void -ACE_Argv_Type_Converter::align_char_with_wchar (void) -{ - int wchar_argv_index = 0; - wchar_t* match_argv = this->wchar_argv_[0]; // pick the initial entry - - while (wchar_argv_index < this->saved_argc_) - { - // if n'th entries of both argv lists are different - if (ACE_OS::strcmp (this->char_argv_[wchar_argv_index], - ACE_TEXT_ALWAYS_CHAR (match_argv)) != 0) - { - // loop through the wchar argv list entries that are after - // wchar_argv_index - for (int i = wchar_argv_index + 1; i < before_pass_argc_; ++i) - { - if (ACE_OS::strcmp (this->char_argv_[i], - ACE_TEXT_ALWAYS_CHAR (match_argv)) == 0) - { - // swap the pointers in the char argv list - char *temp = this->char_argv_[wchar_argv_index]; - this->char_argv_[wchar_argv_index] = this->char_argv_[i]; - this->char_argv_[i] = temp; - break; - } - } - } - - // move to the next wchar argv list entry - match_argv = this->wchar_argv_[++wchar_argv_index]; - } - - this->cleanup (); -} - -void -ACE_Argv_Type_Converter::align_wchar_with_char (void) -{ - int char_argv_index = 0; - char* match_argv = this->char_argv_[0]; // pick the initial entry - - while (char_argv_index < saved_argc_) - { - // if n'th entries of both argv lists are different - if (ACE_OS::strcmp ( - ACE_TEXT_ALWAYS_CHAR (this->wchar_argv_[char_argv_index]), - match_argv) != 0) - { - // loop through the wchar argv list entries that are after - // wchar_argv_index - for (int i = char_argv_index + 1; i < this->before_pass_argc_; ++i) - { - if (ACE_OS::strcmp ( - ACE_TEXT_ALWAYS_CHAR(this->wchar_argv_[i]), - match_argv) == 0) { - // swap the pointers in the char argv list - wchar_t* temp = this->wchar_argv_[char_argv_index]; - this->wchar_argv_[char_argv_index] = this->wchar_argv_[i]; - this->wchar_argv_[i] = temp; - break; - } - } - } - - // move to the next wchar argv list entry - match_argv = this->char_argv_[++char_argv_index]; - } - - this->cleanup(); -} - -void -ACE_Argv_Type_Converter::cleanup (void) -{ - for (int i = this->saved_argc_; i < this->before_pass_argc_; ++i) - { - // Check whether it's ours to delete. - if (original_type_ == 1) - { - ACE_OS::free (this->char_argv_[i]); - this->char_argv_[i] = 0; - } - else - { - ACE_OS::free (this->wchar_argv_[i]); - this->wchar_argv_[i] = 0; - } - } - - this->before_pass_argc_ = this->saved_argc_; - - this->wchar_passed_ = 0; - this->char_passed_ = 0; -} -#endif // ACE_USES_WCHAR - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Argv_Type_Converter.h b/ace/Argv_Type_Converter.h deleted file mode 100644 index 89ba35c6220..00000000000 --- a/ace/Argv_Type_Converter.h +++ /dev/null @@ -1,119 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Argv_Type_Converter.h - * - * $Id$ - * - * @author Si Mong Park - */ -//============================================================================= - -#ifndef ACE_ARGV_TYPE_CONVERTER_H -#define ACE_ARGV_TYPE_CONVERTER_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" -#include "ace/OS_Memory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Argv_Type_Converter - * - * @brief To convert 'char' input/command line parameter to 'wchar_t'. - * - * This class is to convert 'char' type command line paramter to - * wide-character (wchar_t) format and stores the copy of it. - * This is useful for all classes that use 'char**' argv but cannot - * be converted into 'ACE_TCHAR**' version. - * Note that the converted data will be lost upon destruction, so - * classes should use this class as their data member. - */ -class ACE_Export ACE_Argv_Type_Converter -{ -public: - - ACE_Argv_Type_Converter (int &argc, char** argv); - -#if defined (ACE_USES_WCHAR) - ACE_Argv_Type_Converter (int &argc, wchar_t** argv); -#endif // ACE_USES_WCHAR - - ~ACE_Argv_Type_Converter (void); - - /// Returns the pointer of converted command line. - ACE_TCHAR** get_TCHAR_argv (void); - - /// Returns the pointer of ASCII (char) command line. - char** get_ASCII_argv (void); - - /// Returns the number of sub paramters (argc). - int& get_argc (void); - -private: - - /// Copy Constructor should not be used. - ACE_Argv_Type_Converter (const ACE_Argv_Type_Converter&); - - /// Assignment '=' operator should not be used. - ACE_Argv_Type_Converter operator= (const ACE_Argv_Type_Converter&); - -#if defined (ACE_USES_WCHAR) - - /// Perform common initialization for two Ctor's. - void initialize (void); - - /// Align all entries in the char type argv list with wchar_t type - /// argv list. - void align_char_with_wchar (void); - - /// Align all entries in the wchar_t type argv list with char type - /// argv list. - void align_wchar_with_char (void); - - /// Clean up removed (comsumed) argv entries and reset the pass flags. - void cleanup (void); -#endif // ACE_USES_WCHAR - -private: - /// Original number of input paramter, same as 'argc'. - int &saved_argc_; - - /// Data member pointer that contains converted argv in ACE_ANTI_TCHAR. - char** char_argv_; - -#if defined (ACE_USES_WCHAR) - /// Data member pointer that contains converted argv in ACE_TCHAR. - wchar_t** wchar_argv_; - - /// argc value before any argv has been passed. - int before_pass_argc_; - - /// FALSE represents original argv passed in is char, and TRUE - /// represents wchar_t. - const int original_type_; - - /// TRUE indicates wchar_t type argv has been passed. - int wchar_passed_; - - /// TRUE indicates char type argv has been passed. - int char_passed_; -#endif /* ACE_USES_WCHAR */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Argv_Type_Converter.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ARGV_TYPE_CONVERTER_H */ diff --git a/ace/Argv_Type_Converter.inl b/ace/Argv_Type_Converter.inl deleted file mode 100644 index f56c83146b3..00000000000 --- a/ace/Argv_Type_Converter.inl +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_TCHAR** -ACE_Argv_Type_Converter::get_TCHAR_argv (void) -{ -#if defined (ACE_USES_WCHAR) - if (this->char_passed_) - { - this->align_wchar_with_char (); - } - - this->wchar_passed_ = true; - return this->wchar_argv_; -#else - return this->char_argv_; -#endif // ACE_USES_WCHAR -} - -ACE_INLINE char** -ACE_Argv_Type_Converter::get_ASCII_argv (void) -{ -#if defined (ACE_USES_WCHAR) - if (this->wchar_passed_) - { - this->align_char_with_wchar (); - } - - this->char_passed_ = 1; -#endif // ACE_USES_WCHAR - - return this->char_argv_; -} - -ACE_INLINE int& -ACE_Argv_Type_Converter::get_argc (void) -{ - return this->saved_argc_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Array.h b/ace/Array.h deleted file mode 100644 index c3159cd7a89..00000000000 --- a/ace/Array.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Array.h - * - * $Id$ - * - * @deprecated - * - * @note This file has been deprecated and will soon go away. You - * should directly include "Containers_T.h" instead. - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ARRAY_H -#define ACE_ARRAY_H -#include /**/ "ace/pre.h" - -#include "ace/Containers_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "ace/post.h" -#endif /* ACE_ARRAY_H */ diff --git a/ace/Array_Base.cpp b/ace/Array_Base.cpp deleted file mode 100644 index ece933009d6..00000000000 --- a/ace/Array_Base.cpp +++ /dev/null @@ -1,206 +0,0 @@ -// $Id$ - -#ifndef ACE_ARRAY_BASE_CPP -#define ACE_ARRAY_BASE_CPP - -#include "ace/Array_Base.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Array_Base.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Malloc_Base.h" -#include "ace/os_include/os_errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Dynamically initialize an array. -template -ACE_Array_Base::ACE_Array_Base (size_t size, - ACE_Allocator *alloc) - : max_size_ (size), - cur_size_ (size), - allocator_ (alloc) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - if (size != 0) - { - ACE_ALLOCATOR (this->array_, - (T *) this->allocator_->malloc (size * sizeof (T))); - for (size_t i = 0; i < size; ++i) - new (&array_[i]) T; - } - else - this->array_ = 0; -} - -template -ACE_Array_Base::ACE_Array_Base (size_t size, - const T &default_value, - ACE_Allocator *alloc) - : max_size_ (size), - cur_size_ (size), - allocator_ (alloc) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - if (size != 0) - { - ACE_ALLOCATOR (this->array_, - (T *) this->allocator_->malloc (size * sizeof (T))); - for (size_t i = 0; i < size; ++i) - new (&array_[i]) T (default_value); - } - else - this->array_ = 0; -} - -// The copy constructor (performs initialization). - -template -ACE_Array_Base::ACE_Array_Base (const ACE_Array_Base &s) - : max_size_ (s.size ()), - cur_size_ (s.size ()), - allocator_ (s.allocator_) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_ALLOCATOR (this->array_, - (T *) this->allocator_->malloc (s.size () * sizeof (T))); - for (size_t i = 0; i < this->size (); i++) - new (&this->array_[i]) T (s.array_[i]); -} - -// Assignment operator (performs assignment). - -template void -ACE_Array_Base::operator= (const ACE_Array_Base &s) -{ - // Check for "self-assignment". - - if (this != &s) - { - if (this->max_size_ < s.size ()) - { - ACE_DES_ARRAY_FREE (this->array_, - this->max_size_, - this->allocator_->free, - T); - ACE_ALLOCATOR (this->array_, - (T *) this->allocator_->malloc (s.size () * sizeof (T))); - this->max_size_ = s.size (); - } - else - { - ACE_DES_ARRAY_NOFREE (this->array_, - s.size (), - T); - } - - this->cur_size_ = s.size (); - - for (size_t i = 0; i < this->size (); i++) - new (&this->array_[i]) T (s.array_[i]); - } -} - -// Set an item in the array at location slot. - -template int -ACE_Array_Base::set (const T &new_item, size_t slot) -{ - if (this->in_range (slot)) - { - this->array_[slot] = new_item; - return 0; - } - else - return -1; -} - -// Get an item in the array at location slot. - -template int -ACE_Array_Base::get (T &item, size_t slot) const -{ - if (this->in_range (slot)) - { - // Copies the item. If you don't want to copy, use operator [] - // instead (but then you'll be responsible for range checking). - item = this->array_[slot]; - return 0; - } - else - return -1; -} - -template int -ACE_Array_Base::max_size (size_t new_size) -{ - if (new_size > this->max_size_) - { - T *tmp = 0; - - ACE_ALLOCATOR_RETURN (tmp, - (T *) this->allocator_->malloc (new_size * sizeof (T)), - -1); - for (size_t i = 0; i < this->cur_size_; ++i) - new (&tmp[i]) T (this->array_[i]); - - // Initialize the new portion of the array that exceeds the - // previously allocated section. - for (size_t j = this->cur_size_; j < new_size; j++) - new (&tmp[j]) T; - - ACE_DES_ARRAY_FREE (this->array_, - this->max_size_, - this->allocator_->free, - T); - this->array_ = tmp; - this->max_size_ = new_size; - this->cur_size_ = new_size; - } - - return 0; -} - -template int -ACE_Array_Base::size (size_t new_size) -{ - int r = this->max_size (new_size); - if (r != 0) - return r; - this->cur_size_ = new_size; - return 0; -} - -// **************************************************************** - -template int -ACE_Array_Iterator::next (T *&item) -{ - // ACE_TRACE ("ACE_Array_Iterator::next"); - - if (this->done ()) - { - item = 0; - return 0; - } - else - { - item = &array_[current_]; - return 1; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ARRAY_BASE_CPP */ diff --git a/ace/Array_Base.h b/ace/Array_Base.h deleted file mode 100644 index dd02278dc90..00000000000 --- a/ace/Array_Base.h +++ /dev/null @@ -1,211 +0,0 @@ -//============================================================================= -/** - * @file Array_Base.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ARRAY_BASE_H -#define ACE_ARRAY_BASE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" -#include "ace/Malloc_Base.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -template class ACE_Array_Iterator; - -/** - * @class ACE_Array_Base - * - * @brief Implement a simple dynamic array - * - * This parametric class implements a simple dynamic array; - * resizing must be controlled by the user. No comparison or find - * operations are implemented. - */ -template -class ACE_Array_Base -{ -public: - - // Define a "trait" - typedef T TYPE; - typedef ACE_Array_Iterator ITERATOR; - - // = Initialization and termination methods. - - /// Dynamically create an uninitialized array. - ACE_Array_Base (size_t size = 0, - ACE_Allocator *the_allocator = 0); - - /// Dynamically initialize the entire array to the . - ACE_Array_Base (size_t size, - const T &default_value, - ACE_Allocator *the_allocator = 0); - - /** - * The copy constructor performs initialization by making an exact - * copy of the contents of parameter , i.e., *this == s will - * return true. - */ - ACE_Array_Base (const ACE_Array_Base &s); - - /** - * Assignment operator performs an assignment by making an exact - * copy of the contents of parameter , i.e., *this == s will - * return true. Note that if the of is >= than - * we can copy it without reallocating. However, if - * is < we must delete the , - * reallocate a new , and then copy the contents of . - */ - void operator= (const ACE_Array_Base &s); - - /// Clean up the array (e.g., delete dynamically allocated memory). - ~ACE_Array_Base (void); - - // = Set/get methods. - - /// Set item in the array at location . Doesn't - /// perform range checking. - T &operator [] (size_t slot); - - /// Get item in the array at location . Doesn't - /// perform range checking. - const T &operator [] (size_t slot) const; - - /// Set an item in the array at location . Returns - /// -1 if is not in range, else returns 0. - int set (const T &new_item, size_t slot); - - /** - * Get an item in the array at location . Returns -1 if - * is not in range, else returns 0. Note that this function - * copies the item. If you want to avoid the copy, you can use - * the const operator [], but then you'll be responsible for range checking. - */ - int get (T &item, size_t slot) const; - - /// Returns the of the array. - size_t size (void) const; - - /** - * Changes the size of the array to match . - * It copies the old contents into the new array. - * Return -1 on failure. - */ - int size (size_t new_size); - - /// Returns the of the array. - size_t max_size (void) const; - - /** - * Changes the size of the array to match . - * It copies the old contents into the new array. - * Return -1 on failure. - * It does not affect new_size - */ - int max_size (size_t new_size); - -protected: - /// Returns 1 if is within range, i.e., 0 >= < - /// , else returns 0. - int in_range (size_t slot) const; - - /// Maximum size of the array, i.e., the total number of elements - /// in . - size_t max_size_; - - /** - * Current size of the array. This starts out being == to - * . However, if we are assigned a smaller array, then - * will become less than . The purpose of - * keeping track of both sizes is to avoid reallocating memory if we - * don't have to. - */ - size_t cur_size_; - - /// Pointer to the array's storage buffer. - T *array_; - - /// Allocation strategy of the ACE_Array_Base. - ACE_Allocator *allocator_; - - friend class ACE_Array_Iterator; -}; - -// **************************************************************** - -/** - * @class ACE_Array_Iterator - * - * @brief Implement an iterator over an ACE_Array. - * - * This iterator is safe in the face of array element deletions. - * But it is NOT safe if the array is resized (via the ACE_Array - * assignment operator) during iteration. That would be very - * odd, and dangerous. - */ -template -class ACE_Array_Iterator -{ -public: - // = Initialization method. - ACE_Array_Iterator (ACE_Array_Base &); - - // = Iteration methods. - - /// Pass back the that hasn't been seen in the Array. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the Array. Returns 0 when all the - /// items in the Array have been seen, else 1. - int advance (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Pointer to the current item in the iteration. - size_t current_; - - /// Pointer to the Array we're iterating over. - ACE_Array_Base &array_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Array_Base.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Array_Base.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Array_Base.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ARRAY_BASE_H */ diff --git a/ace/Array_Base.inl b/ace/Array_Base.inl deleted file mode 100644 index 3afc27e69b8..00000000000 --- a/ace/Array_Base.inl +++ /dev/null @@ -1,91 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// Clean up the array (e.g., delete dynamically allocated memory). - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Array_Base::~ACE_Array_Base (void) -{ - ACE_DES_ARRAY_FREE (this->array_, - this->max_size_, - this->allocator_->free, - T); -} - -template ACE_INLINE size_t -ACE_Array_Base::size (void) const -{ - return this->cur_size_; -} - -template ACE_INLINE size_t -ACE_Array_Base::max_size (void) const -{ - return this->max_size_; -} - -template ACE_INLINE int -ACE_Array_Base::in_range (size_t index) const -{ - return index < this->cur_size_; -} - -template ACE_INLINE T & -ACE_Array_Base::operator[] (size_t index) -{ - return this->array_[index]; -} - -template ACE_INLINE const T & -ACE_Array_Base::operator[] (size_t index) const -{ - return this->array_[index]; -} - -// **************************************************************** - -template ACE_INLINE void -ACE_Array_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Array_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Array_Iterator::ACE_Array_Iterator (ACE_Array_Base &a) - : current_ (0), - array_ (a) -{ - // ACE_TRACE ("ACE_Array_Iterator::ACE_Array_Iterator"); -} - -template ACE_INLINE int -ACE_Array_Iterator::advance (void) -{ - // ACE_TRACE ("ACE_Array_Iterator::advance"); - - if (this->current_ < array_.size ()) - { - ++this->current_; - return 1; - } - else - { - // Already finished iterating. - return 0; - } -} - -template ACE_INLINE int -ACE_Array_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Array_Iterator::done"); - - return this->current_ >= array_.size (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Array_Map.cpp b/ace/Array_Map.cpp deleted file mode 100644 index 3db24968a63..00000000000 --- a/ace/Array_Map.cpp +++ /dev/null @@ -1,282 +0,0 @@ -// $Id$ - -#ifndef ACE_ARRAY_MAP_CPP -#define ACE_ARRAY_MAP_CPP - -#include "ace/Array_Map.h" - -#ifndef __ACE_INLINE__ -# include "ace/Array_Map.inl" -#endif /* !__ACE_INLINE__ */ - -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#ifndef ACE_LACKS_MEMBER_TEMPLATES -template -template -ACE_Array_Map::ACE_Array_Map (InputIterator f, - InputIterator l) - : size_ (l - f) - , capacity_ (size_) - , nodes_ (size_ == 0 ? 0 : new value_type[size_]) -{ - (void) std::copy (f, l, this->begin ()); - -// iterator n = this->begin (); - -// for (InputIterator i = f; i != l; ++i, ++n) -// *n = *i; -} -#else -template -ACE_Array_Map::ACE_Array_Map ( - typename ACE_Array_Map::const_iterator f, - typename ACE_Array_Map::const_iterator l) - : size_ (l - f) - , capacity_ (size_) - , nodes_ (size_ == 0 ? 0 : new value_type[size_]) -{ - (void) std::copy (f, l, this->begin ()); - -// iterator n = this->begin (); - -// for (const_iterator i = f; i != l; ++i, ++n) -// *n = *i; -} -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ - -template -ACE_Array_Map::ACE_Array_Map ( - ACE_Array_Map const & map) - : size_ (map.size_) - , capacity_ (map.size_) - , nodes_ (size_ == 0 ? 0 : new value_type[size_]) -{ - std::copy (map.begin (), map.end (), this->begin ()); - -// iterator f = map.begin (); -// iterator l = map.end (); -// iterator n = this->begin (); - -// for (iterator i = f; i != l; ++i, ++n) -// *n = *i; -} - -template -ACE_Array_Map::~ACE_Array_Map (void) -{ - delete[] this->nodes_; -} - -template -void -ACE_Array_Map::swap ( - ACE_Array_Map & map) -{ - std::swap (this->size_, map.size_); - std::swap (this->capacity_, map.capacity_); - std::swap (this->nodes_, map.nodes_); -} - -template -std::pair::iterator, bool> -ACE_Array_Map::insert ( - typename ACE_Array_Map::value_type const & x) -{ - // Linear insertion due to linear duplicate key search. - - bool inserted = false; - iterator i = this->find (x.first); - - if (i == this->end ()) - { - // Add the element to the array. - - size_type const old_size = this->size (); - this->grow (1); // Increase size by at least one. - - i = this->begin () + old_size; - *i = x; - - ++this->size_; - - inserted = true; - } - - return std::make_pair (i, inserted); -} - -#ifndef ACE_LACKS_MEMBER_TEMPLATES -template -template -void -ACE_Array_Map::insert (InputIterator f, InputIterator l) -{ - this->grow (l - f); // Preallocate storage. - - for (InputIterator i = f; i != l; ++i) - { - (void) this->insert (*i); - } -} -#else -template -void -ACE_Array_Map::insert ( - typename ACE_Array_Map::const_iterator f, - typename ACE_Array_Map::const_iterator l) -{ - this->grow (l - f); // Preallocate storage. - - for (const_iterator i = f; i != l; ++i) - { - (void) this->insert (*i); - } -} -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ - -template -void -ACE_Array_Map::erase ( - typename ACE_Array_Map::iterator pos) -{ - iterator const first = this->begin (); - iterator const last = this->end (); - - if (pos >= first && pos < last) - { - if (pos != last - 1) - { - // Relocate the tail element to the location of the erased - // element to prevent introduction of "holes" in the - // underlying array. - *pos = *(last - 1); - } - - // Explicitly destroy the tail element by assigning a default - // constructed instance to it. Note that this also works for - // the case of a map of size 1. - *(last - 1) = value_type (); - - --this->size_; - } -} - -template -typename ACE_Array_Map::size_type -ACE_Array_Map::erase ( - typename ACE_Array_Map::key_type const & k) -{ - iterator pos = this->find (k); - - size_type const old_size = this->size_; - - this->erase (pos); - - return old_size - this->size_; -} - -template -void -ACE_Array_Map::erase ( - typename ACE_Array_Map::iterator first, - typename ACE_Array_Map::iterator last) -{ - if (this->begin () <= first && first < last && last < this->end ()) - for (iterator i = first; i != last; ++i) - this->erase (i); -} - -template -void -ACE_Array_Map::clear (void) -{ - this->size_ = 0; // No need to deallocate array nor destroy elements. -} - -template -typename ACE_Array_Map::iterator -ACE_Array_Map::find ( - typename ACE_Array_Map::key_type const & k) -{ - iterator const the_end = this->end (); - - EqualTo eq; - - for (iterator i = this->begin (); i != the_end; ++i) - if (eq (k, i->first)) - return i; - - return this->end (); -} - -template -typename ACE_Array_Map::const_iterator -ACE_Array_Map::find ( - typename ACE_Array_Map::key_type const & k) const -{ - const_iterator const the_end = this->end (); - - EqualTo eq; - - for (const_iterator i = this->begin (); i != the_end; ++i) - if (eq (k, i->first)) - return i; - - return this->end (); -} - -template -void -ACE_Array_Map::grow ( - typename ACE_Array_Map::size_type s) -{ - if (this->size () + s > this->capacity_) - { - // This implementation focuses more on static footprint than - // speed. - - // Strongly exception safe. - - ACE_Array_Map temp (this->size () + s); - - std::copy (this->begin (), this->end (), temp.begin ()); - - size_type const n = this->size (); // Do not swap out the size - // since we bypassed the - // temporary map's element - // counting code. - this->swap (temp); - - this->size_ = n; - } -} - -// --------------------------------------------------------------- - -template -bool -operator== (ACE_Array_Map const & lhs, - ACE_Array_Map const & rhs) -{ - // Do not include Array_Map capacity in comparison. It isn't useful - // in this case. - - return (lhs.size () == rhs.size () - && std::equal (lhs.begin (), lhs.end (), rhs.begin ())); -} - -template -bool -operator< (ACE_Array_Map const & lhs, - ACE_Array_Map const & rhs) -{ - return std::lexicographical_compare (lhs.begin (), lhs.end (), - rhs.begin (), rhs.end ()); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ARRAY_MAP_CPP */ diff --git a/ace/Array_Map.h b/ace/Array_Map.h deleted file mode 100644 index 743d6b06ff3..00000000000 --- a/ace/Array_Map.h +++ /dev/null @@ -1,325 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Array_Map.h - * - * $Id$ - * - * Light weight array-based map with fast iteration but linear - * (i.e. O(n)) search times. STL-style interface is exposed. - * - * @note This class requires the STL generic algorithms and - * reverse_iterator adapter. - * - * @author Ossama Othman - */ -//============================================================================= - - -#ifndef ACE_ARRAY_MAP_H -#define ACE_ARRAY_MAP_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include -#include -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Array_Map - * - * @brief Light weight array-based map with fast iteration, but linear - * (i.e. O(n)) search times. - * - * Map implementation that focuses on small footprint and fast - * iteration. Search times are, however, linear (O(n)) meaning that - * this map isn't suitable for large data sets that will be searched - * in performance critical areas of code. Iteration over large data - * sets, however, is faster than linked list-based maps, for example, - * since spatial locality is maximized through the use of contiguous - * arrays as the underlying storage. - * @par - * An @c ACE_Array_Map is a unique associative container, meaning that - * duplicate values may not be added to the map. It is also pair - * associative (value_type is a std::pair<>). It is not a sorted - * container. - * @par - * An STL @c std::map -like interface is exposed by this class - * portability. Furthermore, this map's iterators are compatible with - * STL algorithms. - * @par - * Requirements and Performance Characteristics - * - Internal Structure - * Array - * - Duplicates allowed? - * No - * - Random access allowed? - * Yes - * - Search speed - * O(n) - * - Insert/replace speed - * O(n), can be longer if the map has to resize - * - Iterator still valid after change to container? - * No - * - Frees memory for removed elements? - * Yes - * - Items inserted by - * Value - * - Requirements for key type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * - Requirements for object type - * -# Default constructor - * -# Copy constructor - * -# operator= - */ -template > -class ACE_Array_Map -{ -public: - - // STL-style typedefs/traits. - typedef Key key_type; - typedef Value data_type; - typedef std::pair value_type; - typedef value_type * iterator; - typedef value_type const * const_iterator; - typedef value_type & reference; - typedef value_type const & const_reference; - typedef value_type * pointer; - typedef value_type const * const_pointer; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - -#if ((defined (_MSC_VER) && !defined (_CPPLIB_VER))) - // the latest Platform SDK's doesn't define a standard's compliant - // reverse_iterator, - // It seems when there is no _CPPLIB_VER defined, then we can assume - // also that the SDK is old. - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; -#elif defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x580 \ - && defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; -#else - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; -#endif /* _MSC_VER */ - - /// Default Constructor. - /** - * Create an empty map with a preallocated buffer of size @a s. - */ - ACE_Array_Map (size_type s = 0); - -#ifndef ACE_LACKS_MEMBER_TEMPLATES - template - ACE_Array_Map (InputIterator f, InputIterator l); -#else - ACE_Array_Map (const_iterator f, const_iterator l); -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ - - ACE_Array_Map (ACE_Array_Map const & map); - ACE_Array_Map & operator= (ACE_Array_Map const & map); - - /// Destructor. - ~ACE_Array_Map (void); - - /** - * @name Forward Iterator Accessors - * - * Forward iterator accessors. - */ - //@{ - iterator begin (void); - iterator end (void); - const_iterator begin (void) const; - const_iterator end (void) const; - //@} - - /** - * @name Reverse Iterator Accessors - * - * Reverse iterator accessors. - */ - //@{ - reverse_iterator rbegin (void); - reverse_iterator rend (void); - const_reverse_iterator rbegin (void) const; - const_reverse_iterator rend (void) const; - //@} - - /// Return current size of map. - /** - * @return The number of elements in the map. - */ - size_type size (void) const; - - /// Maximum number of elements the map can hold. - size_type max_size (void) const; - - /// Return @c true if the map is empty, else @c false. - bool is_empty (void) const; - - /** - * Return @c true if the map is empty, else @c false. We recommend - * using @c is_empty() instead since it's more consistent with the - * ACE container naming conventions. - */ - bool empty (void) const; - - /// Swap the contents of this map with the given @a map in an - /// exception-safe manner. - void swap (ACE_Array_Map & map); - - /// Insert the value @a x into the map. - /** - * STL-style map insertion method. - * - * @param x @c std::pair containing key and datum. - * - * @return @c std::pair::second will be @c false if the map already - * contains a value with the same key as @a x. - */ - std::pair insert (value_type const & x); - -#ifndef ACE_LACKS_MEMBER_TEMPLATES - /// Insert range of elements into map. - template - void insert (InputIterator f, InputIterator l); -#else - /// Insert range of elements into map. - void insert (const_iterator f, const_iterator l); -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ - - /// Remove element at position @a pos from the map. - void erase (iterator pos); - - /// Remove element corresponding to key @a k from the map. - /** - * @return Number of elements that were erased. - */ - size_type erase (key_type const & k); - - /// Remove range of elements [@a first, @a last) from the map. - /** - * @note [@a first, @a last) must be valid range within the map. - */ - void erase (iterator first, iterator last); - - /// Clear contents of map. - /** - * @note This a constant time (O(1)) operation. - */ - void clear (void); - - /** - * @name Search Operations - * - * Search the map for data corresponding to key @a k. - */ - //@{ - /** - * @return @c end() if data corresponding to key @a k is not in the - * map. - */ - iterator find (key_type const & k); - - /** - * @return @c end() if data corresponding to key @a k is not in the - * map. - */ - const_iterator find (key_type const & k) const; - //@} - - /// Count the number of elements corresponding to key @a k. - /** - * @return In the case of this map, the count will always be one if - * such exists in the map. - */ - size_type count (key_type const & k); - - /// Convenience array index operator. - /** - * Array index operator that allows insertion and retrieval of - * elements using an array index syntax, such as: - * @par - * map["Foo"] = 12; - */ - data_type & operator[] (key_type const & k); - -private: - - /// Increase size of underlying buffer by @a s. - void grow (size_type s); - -private: - - /// Number of elements in the map. - size_type size_; - - /// Current size of underlying array. - /** - * @note @c capacity_ is always greater than or equal to @c size_; - */ - size_type capacity_; - - /// Underlying array containing keys and data. - value_type * nodes_; - -}; - -// -------------------------------------------------------------- - -/// @c ACE_Array_Map equality operator. -template -bool operator== (ACE_Array_Map const & lhs, - ACE_Array_Map const & rhs); - -/// @c ACE_Array_Map lexicographical comparison operator. -template -bool operator< (ACE_Array_Map const & lhs, - ACE_Array_Map const & rhs); - -// -------------------------------------------------------------- - -ACE_END_VERSIONED_NAMESPACE_DECL - -#ifdef __ACE_INLINE__ -# include "ace/Array_Map.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -# include "ace/Array_Map.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Array_Map.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ARRAY_MAP_H */ diff --git a/ace/Array_Map.inl b/ace/Array_Map.inl deleted file mode 100644 index 86a26d3f3aa..00000000000 --- a/ace/Array_Map.inl +++ /dev/null @@ -1,133 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_INLINE -ACE_Array_Map::ACE_Array_Map ( - typename ACE_Array_Map::size_type s) - : size_ (0) - , capacity_ (s) - , nodes_ (s == 0 ? 0 : new value_type[s]) -{ -} - -template -ACE_INLINE ACE_Array_Map & -ACE_Array_Map::operator= ( - ACE_Array_Map const & map) -{ - // Strongly exception-safe assignment. - - ACE_Array_Map temp (map); - this->swap (temp); - return *this; -} - -template -ACE_INLINE typename ACE_Array_Map::iterator -ACE_Array_Map::begin (void) -{ - return this->nodes_; -} - -template -ACE_INLINE typename ACE_Array_Map::iterator -ACE_Array_Map::end (void) -{ - return this->nodes_ + this->size_; -} - -template -ACE_INLINE typename ACE_Array_Map::const_iterator -ACE_Array_Map::begin (void) const -{ - return this->nodes_; -} - -template -ACE_INLINE typename ACE_Array_Map::const_iterator -ACE_Array_Map::end (void) const -{ - return this->nodes_ + this->size_; -} - -template -ACE_INLINE typename ACE_Array_Map::reverse_iterator -ACE_Array_Map::rbegin (void) -{ - return reverse_iterator (this->end ()); -} - -template -ACE_INLINE typename ACE_Array_Map::reverse_iterator -ACE_Array_Map::rend (void) -{ - return reverse_iterator (this->begin ()); -} - -template -ACE_INLINE typename ACE_Array_Map::const_reverse_iterator -ACE_Array_Map::rbegin (void) const -{ - return const_reverse_iterator (this->end ()); -} - -template -ACE_INLINE typename ACE_Array_Map::const_reverse_iterator -ACE_Array_Map::rend (void) const -{ - return const_reverse_iterator (this->begin ()); -} - -template -ACE_INLINE typename ACE_Array_Map::size_type -ACE_Array_Map::size (void) const -{ - return this->size_; -} - -template -ACE_INLINE typename ACE_Array_Map::size_type -ACE_Array_Map::max_size (void) const -{ - return size_type (-1) / sizeof (value_type); -} - -template -ACE_INLINE bool -ACE_Array_Map::is_empty (void) const -{ - return this->size_ == 0; -} - -// The following method is deprecated. - -template -ACE_INLINE bool -ACE_Array_Map::empty (void) const -{ - return this->is_empty (); -} - -template -ACE_INLINE typename ACE_Array_Map::size_type -ACE_Array_Map::count ( - typename ACE_Array_Map::key_type const & k) -{ - return - (this->find (k) == this->end () ? 0 : 1); // Only one datum per key. -} - -template -ACE_INLINE typename ACE_Array_Map::data_type & -ACE_Array_Map::operator[] ( - typename ACE_Array_Map::key_type const & k) -{ - iterator i = (this->insert (value_type (k, data_type ()))).first; - return (*i).second; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Assert.cpp b/ace/Assert.cpp deleted file mode 100644 index c46d30793ab..00000000000 --- a/ace/Assert.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// $Id$ - -#include "ace/Assert.h" -#include "ace/Log_Msg.h" - -ACE_RCSID(ace, Assert, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The following ASSERT macro is courtesy of Alexandre Karev -// . -void -__ace_assert(const char *file, int line, const ACE_TCHAR *expression) -{ - int error = ACE_Log_Msg::last_error_adapter (); - ACE_Log_Msg *log = ACE_Log_Msg::instance (); - - log->set (file, line, -1, error, log->restart (), - log->msg_ostream (), log->msg_callback ()); - - log->log (LM_ERROR, ACE_LIB_TEXT ("ACE_ASSERT: file %N, line %l assertion failed for '%s'.%a\n"), expression, -1); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Assert.h b/ace/Assert.h deleted file mode 100644 index a8830394d52..00000000000 --- a/ace/Assert.h +++ /dev/null @@ -1,38 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Assert.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ASSERT_H -#define ACE_ASSERT_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#include "ace/config-all.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -ACE_Export void __ace_assert(const char *file, int line, const ACE_TCHAR *expression); -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_NDEBUG) -#define ACE_ASSERT(x) \ - (static_cast(0)) -#else -#define ACE_ASSERT(X) \ - ((X) \ - ? static_cast(0) \ - : ACE_VERSIONED_NAMESPACE_NAME::__ace_assert(__FILE__, __LINE__, ACE_TEXT_CHAR_TO_TCHAR (#X))) -#endif /* ACE_NDEBUG */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ASSERT */ diff --git a/ace/Asynch_Acceptor.cpp b/ace/Asynch_Acceptor.cpp deleted file mode 100644 index 374658afefe..00000000000 --- a/ace/Asynch_Acceptor.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_ASYNCH_ACCEPTOR_C -#define ACE_ASYNCH_ACCEPTOR_C - -#include "ace/Asynch_Acceptor.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_RCSID(ace, Asynch_Acceptor, "$Id$") - -#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE) -// This only works on platforms that support async i/o. - -#include "ace/OS_Errno.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_sys_socket.h" -#include "ace/Log_Msg.h" -#include "ace/Message_Block.h" -#include "ace/INET_Addr.h" -#include "ace/SOCK_Stream.h" -#include "ace/Sock_Connect.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Asynch_Acceptor::ACE_Asynch_Acceptor (void) - : listen_handle_ (ACE_INVALID_HANDLE), - pass_addresses_ (0), - validate_new_connection_ (0), - reissue_accept_ (1), - bytes_to_read_ (0) -{ -} - -template -ACE_Asynch_Acceptor::~ACE_Asynch_Acceptor (void) -{ - // Close down the listen socket - if (this->listen_handle_ != ACE_INVALID_HANDLE) - { - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - } -} - -template int -ACE_Asynch_Acceptor::open (const ACE_INET_Addr &address, - size_t bytes_to_read, - int pass_addresses, - int backlog, - int reuse_addr, - ACE_Proactor *proactor, - int validate_new_connection, - int reissue_accept, - int number_of_initial_accepts) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::open"); - - this->proactor (proactor); - this->pass_addresses_ = pass_addresses; - this->bytes_to_read_ = bytes_to_read; - this->validate_new_connection_ = validate_new_connection; - this->reissue_accept_ = reissue_accept; - this->addr_family_ = address.get_type (); - - // Create the listener socket - this->listen_handle_ = ACE_OS::socket (address.get_type (), SOCK_STREAM, 0); - if (this->listen_handle_ == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_OS::socket")), - -1); - // Initialize the ACE_Asynch_Accept - if (this->asynch_accept_.open (*this, - this->listen_handle_, - 0, - this->proactor ()) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Asynch_Accept::open"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - - if (reuse_addr) - { - // Reuse the address - int one = 1; - if (ACE_OS::setsockopt (this->listen_handle_, - SOL_SOCKET, - SO_REUSEADDR, - (const char*) &one, - sizeof one) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_OS::setsockopt"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - } - - // If port is not specified, bind to any port. - static ACE_INET_Addr sa (ACE_sap_any_cast (const ACE_INET_Addr &)); - - if (address == sa && - ACE::bind_port (this->listen_handle_, - INADDR_ANY, - address.get_type()) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE::bind_port"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - - // Bind to the specified port. - if (ACE_OS::bind (this->listen_handle_, - reinterpret_cast (address.get_addr ()), - address.get_size ()) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_OS::bind"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - - // Start listening. - if (ACE_OS::listen (this->listen_handle_, backlog) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_OS::listen"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - - // For the number of . - if (number_of_initial_accepts == -1) - number_of_initial_accepts = backlog; - - for (int i = 0; i < number_of_initial_accepts; i++) - { - // Initiate accepts. - if (this->accept (bytes_to_read) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Asynch_Acceptor::accept"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - } - - return 0; -} - -template int -ACE_Asynch_Acceptor::set_handle (ACE_HANDLE listen_handle) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::set_handle"); - - // Take ownership of the - this->listen_handle_ = listen_handle; - - // Reinitialize the ACE_Asynch_Accept - if (this->asynch_accept_.open (*this, - this->listen_handle_, - 0, - this->proactor ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Asynch_Accept::open")), - -1); - return 0; -} - -template ACE_HANDLE -ACE_Asynch_Acceptor::get_handle (void) const -{ - return this->listen_handle_; -} - -template int -ACE_Asynch_Acceptor::accept (size_t bytes_to_read, const void *act) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::accept"); - - ACE_Message_Block *message_block = 0; - // The space_needed calculation is drive by needs of Windows. POSIX doesn't - // need to extra 16 bytes, but it doesn't hurt. - size_t space_needed = sizeof (sockaddr_in) + 16; -#if defined (ACE_HAS_IPV6) - if (PF_INET6 == this->addr_family_) - space_needed = sizeof (sockaddr_in6) + 16; -#endif /* ACE_HAS_IPV6 */ - space_needed = (2 * space_needed) + bytes_to_read; - - // Create a new message block big enough for the addresses and data - ACE_NEW_RETURN (message_block, - ACE_Message_Block (space_needed), - -1); - - // Initiate asynchronous accepts - if (this->asynch_accept_.accept (*message_block, - bytes_to_read, - ACE_INVALID_HANDLE, - act, - 0, - ACE_SIGRTMIN, - this->addr_family_) == -1) - { - // Cleanup on error - message_block->release (); - return -1; - } - return 0; -} - -template void -ACE_Asynch_Acceptor::handle_accept (const ACE_Asynch_Accept::Result &result) -{ -#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || defined (ACE_HAS_AIO_CALLS) - - ACE_TRACE ("ACE_Asynch_Acceptor<>::handle_accept"); - - // Variable for error tracking - int error = 0; - - // If the asynchronous accept fails. - if (!result.success () || result.accept_handle () == ACE_INVALID_HANDLE) - { - error = 1; - } - -#if !defined (ACE_HAS_AIO_CALLS) - // In order to use accept handle with other Window Sockets 1.1 - // functions, we call the setsockopt function with the - // SO_UPDATE_ACCEPT_CONTEXT option. This option initializes the - // socket so that other Windows Sockets routines to access the - // socket correctly. - if (!error && - ACE_OS::setsockopt (result.accept_handle (), - SOL_SOCKET, - SO_UPDATE_ACCEPT_CONTEXT, - (char *) &this->listen_handle_, - sizeof (this->listen_handle_)) == -1) - { - error = 1; - } -#endif /* ACE_HAS_AIO_CALLS */ - - // Parse address. - ACE_INET_Addr local_address; - ACE_INET_Addr remote_address; - if (!error && - (this->validate_new_connection_ || this->pass_addresses_)) - // Parse the addresses. - this->parse_address (result, - remote_address, - local_address); - - // Validate remote address - if (!error && - this->validate_new_connection_ && - (this->validate_connection (result, remote_address, local_address) == -1 - || this->validate_new_connection (remote_address) == -1)) - { - error = 1; - } - - HANDLER *new_handler = 0; - if (!error) - { - // The Template method - new_handler = this->make_handler (); - if (new_handler == 0) - { - error = 1; - } - } - - // If no errors - if (!error) - { - // Update the Proactor. - new_handler->proactor (this->proactor ()); - - // Pass the addresses - if (this->pass_addresses_) - new_handler->addresses (remote_address, - local_address); - - // Pass the ACT - if (result.act () != 0) - new_handler->act (result.act ()); - - // Set up the handler's new handle value - new_handler->handle (result.accept_handle ()); - - // Initiate the handler - new_handler->open (result.accept_handle (), - result.message_block ()); - } - - // On failure, no choice but to close the socket - if (error && - result.accept_handle() != ACE_INVALID_HANDLE ) - ACE_OS::closesocket (result.accept_handle ()); - - // Delete the dynamically allocated message_block - result.message_block ().release (); - - // Start off another asynchronous accept to keep the backlog going, - // unless we closed the listen socket already (from the destructor), - // or this callback is the result of a canceled/aborted accept. - if (this->should_reissue_accept () && - this->listen_handle_ != ACE_INVALID_HANDLE -#if defined (ACE_WIN32) - && result.error () != ERROR_OPERATION_ABORTED -#else - && result.error () != ECANCELED -#endif - ) - this->accept (this->bytes_to_read_); -#endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || defined (ACE_HAS_AIO_CALLS */ -} - -template int -ACE_Asynch_Acceptor::validate_connection - (const ACE_Asynch_Accept::Result& /* result */, - const ACE_INET_Addr& /* remote */, - const ACE_INET_Addr& /* local */) -{ - // Default implementation always validates the remote address. - return 0; -} - -template int -ACE_Asynch_Acceptor::validate_new_connection (const ACE_INET_Addr&) -{ - // Default implementation always validates the remote address. - return 0; -} - -template int -ACE_Asynch_Acceptor::cancel (void) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::cancel"); - - // All I/O operations that are canceled will complete with the error - // ERROR_OPERATION_ABORTED. All completion notifications for the I/O - // operations will occur normally. -#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) \ - && ( defined (_MSC_VER) || (defined (__BORLANDC__))) - return (int) ::CancelIo (this->listen_handle_); -#else - // Supported now - return this->asynch_accept_.cancel(); - -#endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) && ((defined (_MSC_VER)) || (defined (__BORLANDC__))) */ -} - -template void -ACE_Asynch_Acceptor::parse_address (const - ACE_Asynch_Accept::Result &result, - ACE_INET_Addr &remote_address, - ACE_INET_Addr &local_address) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::parse_address"); - -#if defined (ACE_HAS_AIO_CALLS) - - // Use an ACE_SOCK to get the addresses - it knows how to deal with - // ACE_INET_Addr objects and get IPv4/v6 addresses. - ACE_SOCK_Stream str (result.accept_handle ()); - str.get_local_addr (local_address); - str.get_remote_addr (remote_address); - -#elif (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) - - ACE_Message_Block &message_block = result.message_block (); - - sockaddr *local_addr = 0; - sockaddr *remote_addr = 0; - int local_size = 0; - int remote_size = 0; - // This matches setup in accept(). - size_t addr_size = sizeof (sockaddr_in) + 16; -#if defined (ACE_HAS_IPV6) - if (this->addr_family_ == PF_INET6) - addr_size = sizeof (sockaddr_in6) + 16; -#endif /* ACE_HAS_IPV6 */ - - ::GetAcceptExSockaddrs (message_block.rd_ptr (), - static_cast (this->bytes_to_read_), - static_cast (addr_size), - static_cast (addr_size), - &local_addr, - &local_size, - &remote_addr, - &remote_size); - - local_address.set (reinterpret_cast (local_addr), - local_size); - remote_address.set (reinterpret_cast (remote_addr), - remote_size); -#else - // just in case - errno = ENOTSUP; -#endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) */ - return; -} - -template ACE_HANDLE -ACE_Asynch_Acceptor::handle (void) const -{ - return this->listen_handle_; -} - -template void -ACE_Asynch_Acceptor::handle (ACE_HANDLE h) -{ - ACE_Handler::handle (h); -} - -template ACE_Asynch_Accept & -ACE_Asynch_Acceptor::asynch_accept (void) -{ - return this->asynch_accept_; -} - -template HANDLER * -ACE_Asynch_Acceptor::make_handler (void) -{ - // Default behavior - HANDLER *handler = 0; - ACE_NEW_RETURN (handler, - HANDLER, - 0); - return handler; -} - -/* static */ -template size_t -ACE_Asynch_Acceptor::address_size (void) -{ - return sizeof (sockaddr) + sizeof (sockaddr_in); -} - -template int -ACE_Asynch_Acceptor::pass_addresses (void) const -{ - return this->pass_addresses_; -} - -template void -ACE_Asynch_Acceptor::pass_addresses (int new_value) -{ - this->pass_addresses_ = new_value; -} - -template int -ACE_Asynch_Acceptor::validate_new_connection (void) const -{ - return this->validate_new_connection_; -} - -template void -ACE_Asynch_Acceptor::validate_new_connection (int new_value) -{ - this->validate_new_connection_ = new_value; -} - -template int -ACE_Asynch_Acceptor::reissue_accept (void) const -{ - return this->reissue_accept_; -} - -template void -ACE_Asynch_Acceptor::reissue_accept (int new_value) -{ - this->reissue_accept_ = new_value; -} - -template size_t -ACE_Asynch_Acceptor::bytes_to_read (void) const -{ - return this->bytes_to_read_; -} - -template void -ACE_Asynch_Acceptor::bytes_to_read (size_t new_value) -{ - this->bytes_to_read_ = new_value; -} - -template int -ACE_Asynch_Acceptor::should_reissue_accept (void) -{ - return this->reissue_accept_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ -#endif /* ACE_ASYNCH_ACCEPTOR_C */ diff --git a/ace/Asynch_Acceptor.h b/ace/Asynch_Acceptor.h deleted file mode 100644 index e8cb490794d..00000000000 --- a/ace/Asynch_Acceptor.h +++ /dev/null @@ -1,296 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Asynch_Acceptor.h - * - * $Id$ - * - * @author Irfan Pyarali (irfan@cs.wustl.edu) - */ -//============================================================================= - -#ifndef ACE_ASYNCH_ACCEPTOR_H -#define ACE_ASYNCH_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE) -// This only works on platforms that support async i/o. - -#include "ace/Default_Constants.h" -#include "ace/Asynch_IO.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations -class ACE_Message_Block; -class ACE_INET_Addr; - -/** - * @class ACE_Asynch_Acceptor - * - * @brief This class is an example of the Acceptor Pattern. This class - * will accept new connections and create new HANDLER to handle - * the new connections. - * - * Unlike the ACE_Acceptor, however, this class is designed to - * be used asynchronously. - */ -template -class ACE_Asynch_Acceptor : public ACE_Handler -{ -public: - /// A do nothing constructor. - ACE_Asynch_Acceptor (void); - - /// Virtual destruction - virtual ~ACE_Asynch_Acceptor (void); - - /** - * @c open starts one or more asynchronous accept requests on a - * @a address. Each accept operation may optionally read an - * initial buffer from the new connection when accepted. - * - * @param address The address to listen/accept connections on. - * If the address does not specify a port, a random - * port is selected and bound. - * @param bytes_to_read Optional, specifies the maximum number of bytes - * to read with the accept. The buffer for the initial - * data is allocated internally and passed to the - * @c ACE_Service_Handler::open() hook method. It is - * legitimate only during the @c open() method and must - * be copied if required after @c open() returns. - * This pre-read function works only on Windows. - * @param pass_addresses Optional, a non-zero value indicates that - * the local and peer addresses should be passed to the - * associated @c ACE_Service_Handler::addresses() method - * after any call to @c validate_new_connection() and prior - * to the @c open() hook method call. - * @param backlog Optional, defaulting to @c ACE_DEFAULT_ASYNCH_BACKLOG (which - * can be adjusted in your platform's @c config.h file). - * Specifies the listening backlog for the listening socket. - * @param reuse_addr Optional, indicates whether the @c SO_REUSEADDR - * option is set on the listening socket or not. - * @param proactor Optional, pointer to the @c ACE_Proactor to use for - * demultiplexing asynchronous accepts. If 0, the - * process's singleton @c ACE_Proactor is used. - * @param validate_new_connection Optional, if non-zero, this object's - * @c validate_connection() method is called after - * the accept completes, but before the service handler's - * @c open() hook method is called. If @c - * validate_connection() returns -1, the newly-accepted - * socket is immediately closed, and the @c addresses() - * method is not called. - * @param reissue_accept Optional, if non-zero (the default), a new - * asynchronous accept operation is started after each - * completion, whether the completion is for success or - * failure, and whether or not a successfully-accepted - * connection is subsequently refused. - * @param number_of_initial_accepts Optional, the number of asynchronous - * accepts that are started immediately. If -1 (the - * default), the value of @a backlog is used. - * - * @note On Windows, the peer address is only available at the time - * the connection is accepted. Therefore, if you require the peer - * address on Windows, do not rely on the - * @c ACE_SOCK::get_remote_addr() method - it won't work. You must - * supply a non-zero value for @a pass_addresses and obtain the - * peer address in the @c ACE_Service_Handler::addresses() method. - * - * @see ACE_INET_Addr - * @see ACE_Service_Handler - */ - virtual int open (const ACE_INET_Addr &address, - size_t bytes_to_read = 0, - int pass_addresses = 0, - int backlog = ACE_DEFAULT_ASYNCH_BACKLOG, - int reuse_addr = 1, - ACE_Proactor *proactor = 0, - int validate_new_connection = 0, - int reissue_accept = 1, - int number_of_initial_accepts = -1); - - /// Get the underlying handle. - virtual ACE_HANDLE get_handle (void) const; - - /** - * Set the underlying listen handle. It is the user's responsibility - * to make sure that the old listen handle has been appropriately - * closed and the all outstanding asynchronous operations have - * either completed or have been canceled on the old listen handle. - */ - virtual int set_handle (ACE_HANDLE handle); - - /// This initiates a new asynchronous accept operation. - /** - * You need only call this method if the @a reissue_accept argument - * passed to @c open() was 0. - */ - virtual int accept (size_t bytes_to_read = 0, const void *act = 0); - - /** - * Cancels all pending accepts operations issued by this object. - * - * @note On Windows, only accept operations initiated by the calling thread - * are canceled. - */ - virtual int cancel (void); - - /** - * Template method to validate peer before service is opened. - * This method is called after a new connection is accepted if the - * @a validate_connection argument to @c open() was non-zero or - * the @c validate_new_connection() method is called to turn this - * feature on. The default implementation returns 0. Users can - * reimplement this method to perform validation of the peer - * using it's address, running an authentication procedure (such as - * SSL) or anything else necessary or desireable. The return value - * from this method determines whether or not ACE will continue - * opening the service or abort the connection. - * - * @param result Result of the connection acceptance. - * @param remote Peer's address. - * @param local Local address connection was accepted at. - * - * @retval -1 ACE_Asynch_Acceptor will close the connection, and - * the service will not be opened. - * @retval 0 Service opening will proceeed. - */ - virtual int validate_connection (const ACE_Asynch_Accept::Result& result, - const ACE_INET_Addr &remote, - const ACE_INET_Addr& local); - - /** - * @deprecated Use validate_connection() instead. Will be removed after - * ACE 5.3. - * - * Template method for address validation. - * - * This hook method is called after a connection is accepted if - * so specified on the call to the @c open() method. If this - * method returns -1, the connection is immediately closed and - * the service handler is not opened. - * - * The default implemenation always return 0. - */ - virtual int validate_new_connection (const ACE_INET_Addr &remote_address); - - /** - * Template method for deciding whether to reissue accept. - * - * This hook method is called after each accept completes to decide if - * another accept should be initiated. If the method returns a non-zero - * value, another accept is initiated. - * - * The default implemenation always returns the value passed as the - * @c open() method's @a reissue_accept argument. That value can also - * be changed using the @c reissue_accept() method. - */ - virtual int should_reissue_accept (void); - - // - // These are low level tweaking methods - // - - /// Get flag that indicates if parsing and passing of addresses to - /// the service_handler is necessary. - virtual int pass_addresses (void) const; - - /// Set flag that indicates if parsing and passing of addresses to - /// the service_handler is necessary. - virtual void pass_addresses (int new_value); - - /// Get flag that indicates if address validation is required. - virtual int validate_new_connection (void) const; - - /// Set flag that indicates if address validation is required. - virtual void validate_new_connection (int new_value); - - /// Get flag that indicates if a new accept should be reissued when a accept - /// completes. - virtual int reissue_accept (void) const; - - /// Set flag that indicates if a new accept should be reissued when a accept - /// completes. - virtual void reissue_accept (int new_value); - - /// Get bytes to be read with the call. - virtual size_t bytes_to_read (void) const; - - /// Set bytes to be read with the call. - virtual void bytes_to_read (size_t new_value); - - /// @deprecated address_size() assumes IPv4 use, so is not always valid. - /// This method will be removed after ACE 5.5. Internal uses have been - /// changes to base needed sizes on the addr_family_ member. - static size_t address_size (void); - -protected: - - /// This is called when an outstanding accept completes. - virtual void handle_accept (const ACE_Asynch_Accept::Result &result); - - /// Return the listen handle. - ACE_HANDLE handle (void) const; - /// Set the listen handle. - void handle (ACE_HANDLE h); - - /// This parses the address from read buffer. - void parse_address (const ACE_Asynch_Accept::Result &result, - ACE_INET_Addr &remote_address, - ACE_INET_Addr &local_address); - - /// Return the asynch accept object. - ACE_Asynch_Accept &asynch_accept (void); - - /** - * This is the template method used to create new handler. - * Subclasses must overwrite this method if a new handler creation - * strategy is required. - */ - virtual HANDLER *make_handler (void); - -private: - /// Handle used to listen for new connections. - ACE_HANDLE listen_handle_; - - /// Asynch_Accept used to make life easier :-) - ACE_Asynch_Accept asynch_accept_; - - /// Flag that indicates if parsing of addresses is necessary. - int pass_addresses_; - - /// Flag that indicates if address validation is required. - int validate_new_connection_; - - /// Flag that indicates if a new accept should be reissued when a - /// accept completes. - int reissue_accept_; - - /// Bytes to be read with the call. - size_t bytes_to_read_; - - /// Address family used to open this object. Obtained from @a address passed - /// to @c open(). - int addr_family_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Asynch_Acceptor.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Asynch_Acceptor.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ -#include /**/ "ace/post.h" -#endif /* ACE_ASYNCH_ACCEPTOR_H */ diff --git a/ace/Asynch_Connector.cpp b/ace/Asynch_Connector.cpp deleted file mode 100644 index 65b23f9a60c..00000000000 --- a/ace/Asynch_Connector.cpp +++ /dev/null @@ -1,296 +0,0 @@ -// $Id$ - -#ifndef ACE_ASYNCH_CONNECTOR_CPP -#define ACE_ASYNCH_CONNECTOR_CPP - -#include "ace/Asynch_Connector.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE) -// This only works on platforms that support async I/O. - -#include "ace/OS_NS_sys_socket.h" -#include "ace/OS_Memory.h" -#include "ace/Flag_Manip.h" -#include "ace/Log_Msg.h" -#include "ace/Message_Block.h" -#include "ace/INET_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Asynch_Connector::ACE_Asynch_Connector (void) - : pass_addresses_ (0), - validate_new_connection_ (0) -{ -} - -template -ACE_Asynch_Connector::~ACE_Asynch_Connector (void) -{ - //this->asynch_connect_.close (); -} - -template int -ACE_Asynch_Connector::open (int pass_addresses, - ACE_Proactor *proactor, - int validate_new_connection) -{ - this->proactor (proactor); - this->pass_addresses_ = pass_addresses; - this->validate_new_connection_ = validate_new_connection; - - // Initialize the ACE_Asynch_Connect - if (this->asynch_connect_.open (*this, - ACE_INVALID_HANDLE, - 0, - this->proactor ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Asynch_Connect::open")), - -1); - return 0; -} - -template int -ACE_Asynch_Connector::connect (const ACE_INET_Addr & remote_sap, - const ACE_INET_Addr & local_sap, - int reuse_addr, - const void *act) -{ - // Initiate asynchronous connect - if (this->asynch_connect_.connect (ACE_INVALID_HANDLE, - remote_sap, - local_sap, - reuse_addr, - act) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Asynch_Connect::connect")), - -1); - return 0; -} - -template void -ACE_Asynch_Connector::handle_connect (const ACE_Asynch_Connect::Result &result) -{ - // Variable for error tracking - int error = 0; - - // If the asynchronous connect fails. - if (!result.success () || - result.connect_handle () == ACE_INVALID_HANDLE) - { - error = 1; - } - - if (result.error () != 0) - { - error = 1; - } - - // set blocking mode - if (!error && - ACE::clr_flags - (result.connect_handle (), ACE_NONBLOCK) != 0) - { - error = 1; - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Asynch_Connector::handle_connect : Set blocking mode"))); - } - - // Parse the addresses. - ACE_INET_Addr local_address; - ACE_INET_Addr remote_address; - if (!error && - (this->validate_new_connection_ || this->pass_addresses_)) - this->parse_address (result, - remote_address, - local_address); - - // Call validate_connection even if there was an error - it's the only - // way the application can learn the connect disposition. - if (this->validate_new_connection_ && - this->validate_connection (result, remote_address, local_address) == -1) - { - error = 1; - } - - HANDLER *new_handler = 0; - if (!error) - { - // The Template method - new_handler = this->make_handler (); - if (new_handler == 0) - { - error = 1; - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Asynch_Connector::handle_connect : Making of new handler failed"))); - } - } - - // If no errors - if (!error) - { - // Update the Proactor. - new_handler->proactor (this->proactor ()); - - // Pass the addresses - if (this->pass_addresses_) - new_handler->addresses (remote_address, - local_address); - - // Pass the ACT - if (result.act () != 0) - new_handler->act (result.act ()); - - // Set up the handler's new handle value - new_handler->handle (result.connect_handle ()); - - ACE_Message_Block mb; - - // Initiate the handler with empty message block; - new_handler->open (result.connect_handle (), mb); - } - - // On failure, no choice but to close the socket - if (error && - result.connect_handle() != ACE_INVALID_HANDLE) - ACE_OS::closesocket (result.connect_handle ()); -} - -template int -ACE_Asynch_Connector::validate_connection - (const ACE_Asynch_Connect::Result &, - const ACE_INET_Addr & /* remote_address */, - const ACE_INET_Addr & /* local_address */) -{ - // Default implementation always validates the remote address. - return 0; -} - -template int -ACE_Asynch_Connector::cancel (void) -{ - return this->asynch_connect_.cancel (); -} - -template void -ACE_Asynch_Connector::parse_address (const ACE_Asynch_Connect::Result &result, - ACE_INET_Addr &remote_address, - ACE_INET_Addr &local_address) -{ -#if defined (ACE_HAS_IPV6) - // Getting the addresses. - sockaddr_in6 local_addr; - sockaddr_in6 remote_addr; -#else - // Getting the addresses. - sockaddr_in local_addr; - sockaddr_in remote_addr; -#endif /* ACE_HAS_IPV6 */ - - // Get the length. - int local_size = sizeof (local_addr); - int remote_size = sizeof (remote_addr); - - // Get the local address. - if (ACE_OS::getsockname (result.connect_handle (), - reinterpret_cast (&local_addr), - &local_size) < 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT("%p\n"), - ACE_LIB_TEXT("ACE_Asynch_Connector:: failed"))); - - // Get the remote address. - if (ACE_OS::getpeername (result.connect_handle (), - reinterpret_cast (&remote_addr), - &remote_size) < 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT("%p\n"), - ACE_LIB_TEXT("ACE_Asynch_Connector:: failed"))); - - // Set the addresses. - local_address.set (reinterpret_cast (&local_addr), - local_size); - remote_address.set (reinterpret_cast (&remote_addr), - remote_size); - -#if 0 - // @@ Just debugging. - char local_address_buf [BUFSIZ]; - char remote_address_buf [BUFSIZ]; - - if (local_address.addr_to_string (local_address_buf, - sizeof local_address_buf) == -1) - ACE_ERROR ((LM_ERROR, - "Error:%m:can't obtain local_address's address string")); - - ACE_DEBUG ((LM_DEBUG, - "ACE_Asynch_Connector::parse_address : " - "Local address %s\n", - local_address_buf)); - - if (remote_address.addr_to_string (remote_address_buf, - sizeof remote_address_buf) == -1) - ACE_ERROR ((LM_ERROR, - "Error:%m:can't obtain remote_address's address string")); - - ACE_DEBUG ((LM_DEBUG, - "ACE_Asynch_Connector::parse_address : " - "Remote address %s\n", - remote_address_buf)); -#endif /* 0 */ - - return; -} - - -template ACE_Asynch_Connect & -ACE_Asynch_Connector::asynch_connect (void) -{ - return this->asynch_connect_; -} - -template HANDLER * -ACE_Asynch_Connector::make_handler (void) -{ - // Default behavior - HANDLER *handler = 0; - ACE_NEW_RETURN (handler, HANDLER, 0); - return handler; -} - -template int -ACE_Asynch_Connector::pass_addresses (void) const -{ - return this->pass_addresses_; -} - -template void -ACE_Asynch_Connector::pass_addresses (int new_value) -{ - this->pass_addresses_ = new_value; -} - -template int -ACE_Asynch_Connector::validate_new_connection (void) const -{ - return this->validate_new_connection_; -} - -template void -ACE_Asynch_Connector::validate_new_connection (int new_value) -{ - this->validate_new_connection_ = new_value; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ -#endif /* ACE_ASYNCH_CONNECTOR_CPP */ diff --git a/ace/Asynch_Connector.h b/ace/Asynch_Connector.h deleted file mode 100644 index 06e9bb41382..00000000000 --- a/ace/Asynch_Connector.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Asynch_Connector.h - * - * $Id$ - * - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_ASYNCH_CONNECTOR_H -#define ACE_ASYNCH_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE) -// This only works on platforms that support async i/o. - -#include "ace/Asynch_IO.h" -#include "ace/INET_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations -class ACE_Message_Block; - -/** - * @class ACE_Asynch_Connector - * - * @brief This class is an example of the Connector pattern. This class - * will establish new connections and create new HANDLER objects to handle - * the new connections. - * - * Unlike the ACE_Connector, however, this class is designed to - * be used asynchronously with the ACE Proactor framework. - */ - -template -class ACE_Asynch_Connector : public ACE_Handler -{ -public: - /// A do nothing constructor. - ACE_Asynch_Connector (void); - - /// Virtual destruction - virtual ~ACE_Asynch_Connector (void); - - /** - * This opens asynch connector - */ - virtual int open (int pass_addresses = 0, - ACE_Proactor *proactor = 0, - int validate_new_connection = 1); - - /// This initiates a new asynchronous connect - virtual int connect (const ACE_INET_Addr &remote_sap, - const ACE_INET_Addr &local_sap = - (const ACE_INET_Addr &)ACE_Addr::sap_any, - int reuse_addr = 1, - const void *act = 0); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. - * - * @note On Windows, this method does not cancel connect operations - * issued by other threads. - * - * @note On POSIX, delegates cancelation to ACE_POSIX_Asynch_Connect. - */ - virtual int cancel (void); - - - /** - * Template method to validate peer before service is opened. - * This method is called when the connection attempt completes, - * whether it succeeded or failed, if the @a validate_connection - * argument to @c open() was non-zero or the @c validate_new_connection() - * method is called to turn this feature on. The default implementation - * returns 0. Users can (and probably should) reimplement this method - * to learn about the success or failure of the connection attempt. - * If the connection completed successfully, this method can be used to - * perform validation of the peer using it's address, running an - * authentication procedure (such as SSL) or anything else necessary or - * desireable. The return value from this method determines whether or - * not ACE will continue opening the service or abort the connection. - * - * @param result Result of the connection acceptance. Use - * result.success() to determine success or failure of - * the connection attempt. - * @param remote Peer's address. If the connection failed, this object - * is undefined. - * @param local Local address connection was completed from. If the - * connection failed, this object is undefined. - * - * @retval -1 ACE_Asynch_Connector will close the connection, and - * the service will not be opened. - * @retval 0 Service opening will proceeed. - * @return Return value is ignored if the connection attempt failed. - */ - virtual int validate_connection (const ACE_Asynch_Connect::Result& result, - const ACE_INET_Addr &remote, - const ACE_INET_Addr& local); - - // - // These are low level tweaking methods - // - - /// Set and get flag that indicates if parsing and passing of - /// addresses to the service_handler is necessary. - virtual int pass_addresses (void) const; - virtual void pass_addresses (int new_value); - - /// Set and get flag that indicates if address validation is - /// required. - virtual int validate_new_connection (void) const; - virtual void validate_new_connection (int new_value); - -protected: - - /// This is called when an outstanding accept completes. - virtual void handle_connect (const ACE_Asynch_Connect::Result &result); - - - /// This parses the address from read buffer. - void parse_address (const ACE_Asynch_Connect::Result &result, - ACE_INET_Addr &remote_address, - ACE_INET_Addr &local_address); - - /// Return the asynch Connect object. - ACE_Asynch_Connect & asynch_connect (void); - - /** - * This is the template method used to create new handler. - * Subclasses must overwrite this method if a new handler creation - * strategy is required. - */ - virtual HANDLER *make_handler (void); - -private: - - /// Asynch_Connect used to make life easier :-) - ACE_Asynch_Connect asynch_connect_; - - /// Flag that indicates if parsing of addresses is necessary. - int pass_addresses_; - - /// Flag that indicates if address validation is required. - int validate_new_connection_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Asynch_Connector.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Asynch_Connector.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ -#include /**/ "ace/post.h" -#endif /* ACE_ASYNCH_CONNECTOR_H */ diff --git a/ace/Asynch_IO.cpp b/ace/Asynch_IO.cpp deleted file mode 100644 index cfcaf28aa2c..00000000000 --- a/ace/Asynch_IO.cpp +++ /dev/null @@ -1,1335 +0,0 @@ -// $Id$ - -#include "ace/Asynch_IO.h" - -ACE_RCSID(ace, Asynch_IO, "$Id$") - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS)) -// This only works on platforms with Asynchronous IO - -#include "ace/Proactor.h" -#include "ace/Message_Block.h" -#include "ace/INET_Addr.h" -#include "ace/Asynch_IO_Impl.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -size_t -ACE_Asynch_Result::bytes_transferred (void) const -{ - return this->implementation ()->bytes_transferred (); -} - -const void * -ACE_Asynch_Result::act (void) const -{ - return this->implementation ()->act (); -} - -int -ACE_Asynch_Result::success (void) const -{ - return this->implementation ()->success (); -} - -const void * -ACE_Asynch_Result::completion_key (void) const -{ - return this->implementation ()->completion_key (); -} - -unsigned long -ACE_Asynch_Result::error (void) const -{ - return this->implementation ()->error (); -} - -ACE_HANDLE -ACE_Asynch_Result::event (void) const -{ - return this->implementation ()->event (); -} - -unsigned long -ACE_Asynch_Result::offset (void) const -{ - return this->implementation ()->offset (); -} - -unsigned long -ACE_Asynch_Result::offset_high (void) const -{ - return this->implementation ()->offset_high (); -} - -int -ACE_Asynch_Result::priority (void) const -{ - return this->implementation ()->priority (); -} - -int -ACE_Asynch_Result::signal_number (void) const -{ - return this->implementation ()->signal_number (); -} - -ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation) - : implementation_ (implementation) -{ -} - -ACE_Asynch_Result::~ACE_Asynch_Result (void) -{ - // Proactor deletes the implementation when the finishes. -} - -ACE_Asynch_Result_Impl * -ACE_Asynch_Result::implementation (void) const -{ - return this->implementation_; -} - -// ********************************************************************* - -int -ACE_Asynch_Operation::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return this->implementation ()->open (handler.proxy (), - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Operation::cancel (void) -{ - return this->implementation ()->cancel (); -} - -ACE_Proactor * -ACE_Asynch_Operation::proactor (void) const -{ - return this->implementation ()->proactor (); -} - -ACE_Asynch_Operation::ACE_Asynch_Operation (void) -{ -} - -ACE_Asynch_Operation::~ACE_Asynch_Operation (void) -{ -} - -ACE_Proactor * -ACE_Asynch_Operation::get_proactor (ACE_Proactor *user_proactor, - ACE_Handler &handler) const -{ - if (user_proactor == 0) - { - // Grab the singleton proactor if proactor> is zero - user_proactor = handler.proactor (); - if (user_proactor == 0) - user_proactor = ACE_Proactor::instance (); - } - - return user_proactor; -} - -// ************************************************************ - -ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Read_Stream::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_read_stream ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Read_Stream::read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->read (message_block, - bytes_to_read, - act, - priority, - signal_number); -} - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) -int -ACE_Asynch_Read_Stream::readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->readv (message_block, - bytes_to_read, - act, - priority, - signal_number); -} -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */ - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Read_Stream::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -size_t -ACE_Asynch_Read_Stream::Result::bytes_to_read (void) const -{ - return this->implementation ()->bytes_to_read (); -} - -ACE_Message_Block & -ACE_Asynch_Read_Stream::Result::message_block (void) const -{ - return this->implementation ()->message_block (); -} - -ACE_HANDLE -ACE_Asynch_Read_Stream::Result::handle (void) const -{ - return this->implementation ()->handle (); -} - -ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Read_Stream::Result::~Result (void) -{ - // Proactor will delete the implementation after is - // finished. -} - -ACE_Asynch_Read_Stream_Result_Impl * -ACE_Asynch_Read_Stream::Result::implementation (void) const -{ - return this->implementation_; -} - -// *************************************************** - -ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Write_Stream::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_write_stream ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Write_Stream::write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->write (message_block, - bytes_to_write, - act, - priority, - signal_number); -} - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) -int -ACE_Asynch_Write_Stream::writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->writev (message_block, - bytes_to_write, - act, - priority, - signal_number); -} -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */ - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Write_Stream::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -size_t -ACE_Asynch_Write_Stream::Result::bytes_to_write (void) const -{ - return this->implementation ()->bytes_to_write (); -} - -ACE_Message_Block & -ACE_Asynch_Write_Stream::Result::message_block (void) const -{ - return this->implementation ()->message_block (); -} - -ACE_HANDLE -ACE_Asynch_Write_Stream::Result::handle (void) const -{ - return this->implementation ()->handle (); -} - -ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Write_Stream::Result::~Result (void) -{ - // Proactor will delte the implementation when the call - // finishes. -} - -ACE_Asynch_Write_Stream_Result_Impl * -ACE_Asynch_Write_Stream::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Read_File::ACE_Asynch_Read_File (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Read_File::~ACE_Asynch_Read_File (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Read_File::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_read_file ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Read_File::read (ACE_Message_Block &message_block, - size_t bytes_to_read, - unsigned long offset, - unsigned long offset_high, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->read (message_block, - bytes_to_read, - offset, - offset_high, - act, - priority, - signal_number); -} - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) -int -ACE_Asynch_Read_File::readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - unsigned long offset, - unsigned long offset_high, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->readv (message_block, - bytes_to_read, - offset, - offset_high, - act, - priority, - signal_number); -} -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Read_File::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl *implementation) - : ACE_Asynch_Read_Stream::Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Read_File::Result::~Result (void) -{ - // Proactor will delete the implementation when call - // completes. -} - -ACE_Asynch_Read_File_Result_Impl * -ACE_Asynch_Read_File::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Write_File::ACE_Asynch_Write_File (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Write_File::~ACE_Asynch_Write_File (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Write_File::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_write_file ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Write_File::write (ACE_Message_Block &message_block, - size_t bytes_to_write, - unsigned long offset, - unsigned long offset_high, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->write (message_block, - bytes_to_write, - offset, - offset_high, - act, - priority, - signal_number); -} - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) -int -ACE_Asynch_Write_File::writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - unsigned long offset, - unsigned long offset_high, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->writev (message_block, - bytes_to_write, - offset, - offset_high, - act, - priority, - signal_number); -} -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Write_File::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl *implementation) - : ACE_Asynch_Write_Stream::Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Write_File::Result::~Result (void) -{ - // Proactor will delete the implementation when the call - // completes. -} - -ACE_Asynch_Write_File_Result_Impl * -ACE_Asynch_Write_File::Result::implementation (void) const -{ - return this->implementation_; -} - -// ********************************************************************* - -ACE_Asynch_Accept::ACE_Asynch_Accept (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Accept::~ACE_Asynch_Accept (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Accept::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_accept ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Accept::accept (ACE_Message_Block &message_block, - size_t bytes_to_read, - ACE_HANDLE accept_handle, - const void *act, - int priority, - int signal_number, - int addr_family) -{ - return this->implementation_->accept (message_block, - bytes_to_read, - accept_handle, - act, - priority, - signal_number, - addr_family); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Accept::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -size_t -ACE_Asynch_Accept::Result::bytes_to_read (void) const -{ - return this->implementation ()->bytes_to_read (); -} - -ACE_Message_Block & -ACE_Asynch_Accept::Result::message_block (void) const -{ - return this->implementation ()->message_block (); -} - -ACE_HANDLE -ACE_Asynch_Accept::Result::listen_handle (void) const -{ - return this->implementation ()->listen_handle (); -} - -ACE_HANDLE -ACE_Asynch_Accept::Result::accept_handle (void) const -{ - return this->implementation ()->accept_handle (); -} - -ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Accept::Result::~Result (void) -{ - // Proactor will delete the implementation when the call - // completes. -} - -ACE_Asynch_Accept_Result_Impl * -ACE_Asynch_Accept::Result::implementation (void) const -{ - return this->implementation_; -} - - - -// ********************************************************************* - -ACE_Asynch_Connect::ACE_Asynch_Connect (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Connect::~ACE_Asynch_Connect (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Connect::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_connect ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle, - const ACE_Addr & remote_sap, - const ACE_Addr & local_sap, - int reuse_addr, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->connect (connect_handle, - remote_sap, - local_sap, - reuse_addr, - act, - priority, - signal_number); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Connect::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Connect::Result::~Result (void) -{ - // Proactor will delete the implementation when the call - // completes. -} - -ACE_HANDLE -ACE_Asynch_Connect::Result::connect_handle (void) const -{ - return this->implementation ()->connect_handle (); -} - - -ACE_Asynch_Connect_Result_Impl * -ACE_Asynch_Connect::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Transmit_File::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_transmit_file ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, - Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - unsigned long offset, - unsigned long offset_high, - size_t bytes_per_send, - unsigned long flags, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->transmit_file (file, - header_and_trailer, - bytes_to_write, - offset, - offset_high, - bytes_per_send, - flags, - act, - priority, - signal_number); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Transmit_File::implementation (void) const -{ - return this->implementation_; -} - -// **************************************************************************** - -ACE_HANDLE -ACE_Asynch_Transmit_File::Result::socket (void) const -{ - return this->implementation ()->socket (); -} - -ACE_HANDLE -ACE_Asynch_Transmit_File::Result::file (void) const -{ - return this->implementation ()->file (); -} - -ACE_Asynch_Transmit_File::Header_And_Trailer * -ACE_Asynch_Transmit_File::Result::header_and_trailer (void) const -{ - return this->implementation ()->header_and_trailer (); -} - -size_t -ACE_Asynch_Transmit_File::Result::bytes_to_write (void) const -{ - return this->implementation ()->bytes_to_write (); -} - -size_t -ACE_Asynch_Transmit_File::Result::bytes_per_send (void) const -{ - return this->implementation ()->bytes_per_send (); -} - -unsigned long -ACE_Asynch_Transmit_File::Result::flags (void) const -{ - return this->implementation ()->flags (); -} - -ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Transmit_File::Result::~Result (void) -{ -} - -ACE_Asynch_Transmit_File_Result_Impl * -ACE_Asynch_Transmit_File::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block *header, - size_t header_bytes, - ACE_Message_Block *trailer, - size_t trailer_bytes) - : header_ (header), - header_bytes_ (header_bytes), - trailer_ (trailer), - trailer_bytes_ (trailer_bytes) -{ -} - -ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer (void) -{ -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block *header, - size_t header_bytes, - ACE_Message_Block *trailer, - size_t trailer_bytes) -{ - this->header (header); - this->header_bytes (header_bytes); - this->trailer (trailer); - this->trailer_bytes (trailer_bytes); -} - -ACE_Message_Block * -ACE_Asynch_Transmit_File::Header_And_Trailer::header (void) const -{ - return this->header_; -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block *message_block) -{ - this->header_ = message_block; -} - -size_t -ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (void) const -{ - return this->header_bytes_; -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes) -{ - this->header_bytes_ = bytes; -} - -ACE_Message_Block * -ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (void) const -{ - return this->trailer_; -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block *message_block) -{ - this->trailer_ = message_block; -} - -size_t -ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (void) const -{ - return this->trailer_bytes_; -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes) -{ - this->trailer_bytes_ = bytes; -} - -ACE_LPTRANSMIT_FILE_BUFFERS -ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void) -{ - // If both are zero, return zero - if (this->header_ == 0 && this->trailer_ == 0) - return 0; - else - { - // Something is valid - - // If header is valid, set the fields - if (this->header_ != 0) - { - this->transmit_buffers_.Head = this->header_->rd_ptr (); -#if defined(ACE_WIN64) - this->transmit_buffers_.HeadLength = - static_cast (this->header_bytes_); -#else - this->transmit_buffers_.HeadLength = this->header_bytes_; -#endif /* ACE_WIN64 */ - } - else - { - this->transmit_buffers_.Head = 0; - this->transmit_buffers_.HeadLength = 0; - } - - // If trailer is valid, set the fields - if (this->trailer_ != 0) - { - this->transmit_buffers_.Tail = this->trailer_->rd_ptr (); -#if defined(ACE_WIN64) - this->transmit_buffers_.TailLength = - static_cast (this->trailer_bytes_); -#else - this->transmit_buffers_.TailLength = this->trailer_bytes_; -#endif /* ACE_WIN64 */ - } - else - { - this->transmit_buffers_.Tail = 0; - this->transmit_buffers_.TailLength = 0; - } - - // Return the transmit buffers - return &this->transmit_buffers_; - } -} - -// ********************************************************************* - -ACE_Handler::ACE_Handler (void) - : proactor_ (0), handle_ (ACE_INVALID_HANDLE) -{ - ACE_Handler::Proxy *p; - ACE_NEW (p, ACE_Handler::Proxy (this)); - this->proxy_.reset (p); -} - -ACE_Handler::ACE_Handler (ACE_Proactor *d) - : proactor_ (d), handle_ (ACE_INVALID_HANDLE) -{ - ACE_Handler::Proxy *p; - ACE_NEW (p, ACE_Handler::Proxy (this)); - this->proxy_.reset (p); -} - -ACE_Handler::~ACE_Handler (void) -{ - ACE_Handler::Proxy *p = this->proxy_.get (); - if (p) - p->reset (); -} - -void -ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result & /* result */) -{ -} - -void -ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result & /* result */) -{ -} - -void -ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result & /* result */) -{ -} - -void -ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result & /* result */) -{ -} - -void -ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result & /* result */) -{ -} - -void -ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result & /* result */) -{ -} - -void -ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result & /* result */) -{ -} - -void -ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result & /* result */) -{ -} - -void -ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result & /* result */) -{ -} - -void -ACE_Handler::handle_time_out (const ACE_Time_Value & /* tv */, - const void * /* act */) -{ -} - -void -ACE_Handler::handle_wakeup (void) -{ -} - -ACE_Proactor * -ACE_Handler::proactor (void) -{ - return this->proactor_; -} - -void -ACE_Handler::proactor (ACE_Proactor *p) -{ - this->proactor_ = p; -} - -ACE_HANDLE -ACE_Handler::handle (void) const -{ - return this->handle_; -} - -void -ACE_Handler::handle (ACE_HANDLE h) -{ - this->handle_ = h; -} - -ACE_Refcounted_Auto_Ptr & -ACE_Handler::proxy (void) -{ - return this->proxy_; -} - -// ************************************************************ - -ACE_Service_Handler::ACE_Service_Handler (void) -{ -} - -ACE_Service_Handler::~ACE_Service_Handler (void) -{ -} - -void -ACE_Service_Handler::addresses (const ACE_INET_Addr & /* remote_address */, - const ACE_INET_Addr & /* local_address */ ) -{ -} - -void -ACE_Service_Handler::act (const void *) -{ -} - -void -ACE_Service_Handler::open (ACE_HANDLE, - ACE_Message_Block &) -{ -} - - -// ************************************************************ - -ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Read_Dgram::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_read_dgram ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -ssize_t -ACE_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, - size_t &number_of_bytes_recvd, - int flags, - int protocol_family, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->recv (message_block, - number_of_bytes_recvd, - flags, - protocol_family, - act, - priority, - signal_number); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Read_Dgram::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -int -ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr& addr) const -{ - return this->implementation ()->remote_address (addr); -} - -ACE_Message_Block* -ACE_Asynch_Read_Dgram::Result::message_block (void) const -{ - return this->implementation ()->message_block (); -} - -int -ACE_Asynch_Read_Dgram::Result::flags (void) const -{ - return this->implementation ()->flags (); -} - -size_t -ACE_Asynch_Read_Dgram::Result::bytes_to_read (void) const -{ - return this->implementation ()->bytes_to_read (); -} - -ACE_HANDLE -ACE_Asynch_Read_Dgram::Result::handle (void) const -{ - return this->implementation ()->handle(); -} - -ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation) -: ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Read_Dgram::Result::~Result (void) -{ -} - -ACE_Asynch_Read_Dgram_Result_Impl * -ACE_Asynch_Read_Dgram::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - - -ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Write_Dgram::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_write_dgram ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -ssize_t -ACE_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr& remote_addr, - const void *act, - int priority, - int signal_number) -{ - return this->implementation_->send (message_block, - number_of_bytes_sent, - flags, - remote_addr, - act, - priority, - signal_number); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Write_Dgram::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -size_t -ACE_Asynch_Write_Dgram::Result::bytes_to_write (void) const -{ - return this->implementation ()->bytes_to_write (); -} - -ACE_Message_Block* -ACE_Asynch_Write_Dgram::Result::message_block () const -{ - return this->implementation ()->message_block (); -} - -int -ACE_Asynch_Write_Dgram::Result::flags (void) const -{ - return this->implementation ()->flags (); -} - -ACE_HANDLE -ACE_Asynch_Write_Dgram::Result::handle (void) const -{ - return this->implementation ()->handle (); -} - -ACE_Asynch_Write_Dgram_Result_Impl * -ACE_Asynch_Write_Dgram::Result::implementation (void) const -{ - return this->implementation_; -} - -ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation) -: ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Write_Dgram::Result::~Result (void) -{ -} - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Asynch_IO.h b/ace/Asynch_IO.h deleted file mode 100644 index e4733562440..00000000000 --- a/ace/Asynch_IO.h +++ /dev/null @@ -1,1678 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Asynch_IO.h - * - * $Id$ - * - * This works on Win32 (#if defined (ACE_WIN32) && !defined - * (ACE_HAS_WINCE)) platforms and on POSIX4 platforms with {aio_*} - * routines (#if defined (ACE_HAS_AIO_CALLS)) - * - * On Win32 platforms, the implementation of - * {ACE_Asynch_Transmit_File} and {ACE_Asynch_Accept} are only - * supported if ACE_HAS_WINSOCK2 is defined or you are on WinNT 4.0 - * or higher. - * - * @author Irfan Pyarali - * @author Tim Harrison - * @author Alexander Babu Arulanthu - * @author Roger Tragin - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_ASYNCH_IO_H -#define ACE_ASYNCH_IO_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS)) - -#include "ace/Synch_Traits.h" -#if defined (ACE_HAS_THREADS) -# include "ace/Thread_Mutex.h" -#else -# include "ace/Null_Mutex.h" -#endif /* ACE_HAS_THREADS */ -#include "ace/Refcounted_Auto_Ptr.h" - -#include "ace/os_include/os_signal.h" -#include "ace/os_include/sys/os_socket.h" -#include "ace/os_include/sys/os_types.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_WIN32) && ! defined (ACE_HAS_WINCE) \ - && ! defined (ACE_HAS_PHARLAP) -typedef TRANSMIT_FILE_BUFFERS ACE_TRANSMIT_FILE_BUFFERS; -typedef LPTRANSMIT_FILE_BUFFERS ACE_LPTRANSMIT_FILE_BUFFERS; -typedef PTRANSMIT_FILE_BUFFERS ACE_PTRANSMIT_FILE_BUFFERS; - -# define ACE_INFINITE INFINITE -# define ACE_STATUS_TIMEOUT STATUS_TIMEOUT -# define ACE_WAIT_FAILED WAIT_FAILED -# define ACE_WAIT_TIMEOUT WAIT_TIMEOUT -# else /* ACE_WIN32 */ -struct ACE_TRANSMIT_FILE_BUFFERS -{ - void *Head; - size_t HeadLength; - void *Tail; - size_t TailLength; -}; -typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_PTRANSMIT_FILE_BUFFERS; -typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_LPTRANSMIT_FILE_BUFFERS; - -# if !defined (ACE_INFINITE) -# define ACE_INFINITE LONG_MAX -# endif /* ACE_INFINITE */ -# define ACE_STATUS_TIMEOUT LONG_MAX -# define ACE_WAIT_FAILED LONG_MAX -# define ACE_WAIT_TIMEOUT LONG_MAX -# endif /* ACE_WIN32 */ - -// Forward declarations -class ACE_Proactor; -class ACE_Handler; -class ACE_Message_Block; -class ACE_INET_Addr; -class ACE_Addr; - -// Forward declarations -class ACE_Asynch_Result_Impl; -class ACE_Time_Value; - -/** - * @class ACE_Asynch_Result - * - * @brief An interface base class which allows users access to common - * information related to an asynchronous operation. - * - * An interface base class from which you can obtain some basic - * information like the number of bytes transferred, the ACT - * associated with the asynchronous operation, indication of - * success or failure, etc. Subclasses may want to store more - * information that is particular to the asynchronous operation - * it represents. - */ -class ACE_Export ACE_Asynch_Result -{ - -public: - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This is the ACT associated with the handle on which the - * Asynch_Operation takes place. - * - * On WIN32, this returns the ACT associated with the handle when it - * was registered with the I/O completion port. - * - * @@ This is not implemented for POSIX4 platforms. Returns 0. - */ - const void *completion_key (void) const; - - /// Error value if the operation fails. - unsigned long error (void) const; - - /** - * On WIN32, this returns the event associated with the OVERLAPPED - * structure. - * - * This returns ACE_INVALID_HANDLE on POSIX4-Unix platforms. - */ - ACE_HANDLE event (void) const; - - /** - * This really makes sense only when doing file I/O. - * - * On WIN32, these are represented in the OVERLAPPED datastructure. - * - * @@ On POSIX4-Unix, offset_high should be supported using - * aiocb64. - */ - unsigned long offset (void) const; - unsigned long offset_high (void) const; - - /** - * Priority of the operation. - * - * On POSIX4-Unix, this is supported. Priority works like {nice} in - * Unix. Negative values are not allowed. 0 means priority of the - * operation same as the process priority. 1 means priority of the - * operation is one less than process. And so forth. - * - * On Win32, this is a no-op. - */ - int priority (void) const; - - /** - * POSIX4 real-time signal number to be used for the - * operation. {signal_number} ranges from ACE_SIGRTMIN to ACE_SIGRTMAX. By - * default, ACE_SIGRTMIN is used to issue {aio_} calls. This is a no-op - * on non-POSIX4 systems and returns 0. - */ - int signal_number (void) const; - - - /// Destructor. - virtual ~ACE_Asynch_Result (void); - -protected: - /// Constructor. This implementation will not be deleted. The - /// implementation will be deleted by the Proactor. - ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation); - - /// Get the implementation class. - ACE_Asynch_Result_Impl *implementation (void) const; - - /// Implementation class. - ACE_Asynch_Result_Impl *implementation_; -}; - -// Forward declarations -class ACE_Asynch_Operation_Impl; - -/** - * @class ACE_Asynch_Operation - * - * @brief This is an interface base class for all asynch - * operations. The resposiblility of this class is to forward - * all methods to its delegation/implementation class, e.g., - * ACE_WIN32_Asynch_Operation or ACE_POSIX_Asynch_Operation. - * - * There are some attributes and functionality which is common - * to all asychronous operations. The delegation classes of this - * class will factor out this code. - */ -class ACE_Export ACE_Asynch_Operation -{ - -public: - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * (Attempts to) cancel the asynchronous operation pending against - * the {handle} registered with this Operation. - * - * All completion notifications for the I/O operations will occur - * normally. - * - * = Return Values: - * - * -1 : Operation failed. (can get only in POSIX). - * 0 : All the operations were cancelled. - * 1 : All the operations were already finished in this - * handle. Unable to cancel them. - * 2 : Atleast one of the requested operations cannot be - * cancelled. - * - * There is slight difference in the semantics between NT and POSIX - * platforms which is given below. - * - * = Win32 : - * - * cancels all pending accepts operations that were issued by the - * calling thread. The function does not cancel asynchronous - * operations issued by other threads. - * All I/O operations that are canceled will complete with the - * error ERROR_OPERATION_ABORTED. - * - * = POSIX: - * - * Attempts to cancel one or more asynchronous I/O requests - * currently outstanding against the {handle} registered in this - * operation. - * For requested operations that are successfully canceled, the - * associated error status is set to ECANCELED. - */ - int cancel (void); - - - // = Access methods. - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - - /// Destructor. - virtual ~ACE_Asynch_Operation (void); - -protected: - /// Constructor. - ACE_Asynch_Operation (void); - - /// Return the underlying implementation class. - virtual ACE_Asynch_Operation_Impl *implementation (void) const = 0; - - /// Get a proactor for/from the user - ACE_Proactor *get_proactor (ACE_Proactor *user_proactor, - ACE_Handler &handler) const; -}; - -// Forward declarations -class ACE_Asynch_Read_Stream_Result_Impl; -class ACE_Asynch_Read_Stream_Impl; - -/** - * @class ACE_Asynch_Read_Stream - * - * @brief This class is a factory for starting off asynchronous reads - * on a stream. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {read}s can - * started using this class. An ACE_Asynch_Read_Stream::Result - * will be passed back to the {handler} when the asynchronous - * reads completes through the {ACE_Handler::handle_read_stream} - * callback. - */ -class ACE_Export ACE_Asynch_Read_Stream : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Read_Stream (void); - - /// Destructor - virtual ~ACE_Asynch_Read_Stream (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. - * - * @arg handler The ACE_Handler that will be called to handle completions - * for operations initiated using this factory. - * @arg handle The handle that future read operations will use. - * If handle == @c ACE_INVALID_HANDLE, - * ACE_Handler::handle() will be called on @ handler - * to get the correct handle. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous read. Upto {bytes_to_read} will - * be read and stored in the {message_block}. {message_block}'s - * {wr_ptr} will be updated to reflect the added bytes if the read - * operation is successful completed. Priority of the - * operation is specified by {priority}. On POSIX4-Unix, this is - * supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, {priority} is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - int read (ACE_Message_Block &message_block, - size_t num_bytes_to_read, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - */ - int readv (ACE_Message_Block &message_block, - size_t num_bytes_to_read, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */ - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation class that all methods will be forwarded to. - ACE_Asynch_Read_Stream_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is the class which will be passed back to the - * {handler} when the asynchronous read completes. This class - * forwards all the methods to the implementation classes. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous read. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Read_Stream_Result; - friend class ACE_WIN32_Asynch_Read_Stream_Result; - - public: - /// The number of bytes which were requested at the start of the - /// asynchronous read. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for reading. - ACE_HANDLE handle (void) const; - - /// Get the implementation class. - ACE_Asynch_Read_Stream_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Read_Stream_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Read_Stream_Result_Impl *implementation_; - }; -}; - -// Forward declarations -class ACE_Asynch_Write_Stream_Impl; -class ACE_Asynch_Write_Stream_Result_Impl; - -/** - * @class ACE_Asynch_Write_Stream - * - * @brief This class is a factory for starting off asynchronous writes - * on a stream. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {writes}s can - * started using this class. An ACE_Asynch_Write_Stream::Result - * will be passed back to the {handler} when the asynchronous - * write completes through the - * {ACE_Handler::handle_write_stream} callback. - */ -class ACE_Export ACE_Asynch_Write_Stream : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Write_Stream (void); - - /// Destructor. - virtual ~ACE_Asynch_Write_Stream (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous write. Upto {bytes_to_write} - * will be written from the {message_block}. Upon successful completion - * of the write operation, {message_block}'s {rd_ptr} is updated to - * reflect the data that was written. Priority of the - * operation is specified by {priority}. On POSIX4-Unix, this is - * supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this argument is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - */ - int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */ - - /// Return the underlying implementation class. - /// @todo (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation class that all methods will be forwarded to. - ACE_Asynch_Write_Stream_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous write completes. This class - * forwards all the methods to the implementation class. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous write. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Write_Stream_Result; - friend class ACE_WIN32_Asynch_Write_Stream_Result; - - public: - /// The number of bytes which were requested at the start of the - /// asynchronous write. - size_t bytes_to_write (void) const; - - /// Message block that contains the data to be written. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for writing. - ACE_HANDLE handle (void) const; - - /// Get the implementation class. - ACE_Asynch_Write_Stream_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Write_Stream_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// Implementation class. - ACE_Asynch_Write_Stream_Result_Impl *implementation_; - }; -}; - -// Forward declarations -class ACE_Asynch_Read_File_Impl; -class ACE_Asynch_Read_File_Result_Impl; - -/** - * @class ACE_Asynch_Read_File - * - * @brief This class is a factory for starting off asynchronous reads - * on a file. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {read}s can - * started using this class. An ACE_Asynch_Read_File::Result - * will be passed back to the {handler} when the asynchronous - * reads completes through the {ACE_Handler::handle_read_file} - * callback. - * This class differs slightly from ACE_Asynch_Read_Stream as it - * allows the user to specify an offset for the read. - */ -class ACE_Export ACE_Asynch_Read_File : public ACE_Asynch_Read_Stream -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Read_File (void); - - /// Destructor. - virtual ~ACE_Asynch_Read_File (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous read. Upto {bytes_to_read} will - * be read and stored in the {message_block}. The read will start - * at {offset} from the beginning of the file. Priority of the - * operation is specified by {priority}. On POSIX4-Unix, this is - * supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this argument is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - unsigned long offset = 0, - unsigned long offset_high = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - * @note In win32 Each data block payload must be at least the size of a system - * memory page and must be aligned on a system memory page size boundary - */ - int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - unsigned long offset = 0, - unsigned long offset_high = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Delegation/implementation class that all methods will be - /// forwarded to. - ACE_Asynch_Read_File_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous read completes. This class - * forwards all the methods to the implementation class. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous read. - * This class differs slightly from - * ACE_Asynch_Read_Stream::Result as it calls back - * {ACE_Handler::handle_read_file} on the {handler} instead of - * {ACE_Handler::handle_read_stream}. No additional state is - * required by this class as ACE_Asynch_Result can store the - * {offset}. - */ - class ACE_Export Result : public ACE_Asynch_Read_Stream::Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Read_File_Result; - friend class ACE_WIN32_Asynch_Read_File_Result; - - public: - /// Get the implementation class. - ACE_Asynch_Read_File_Result_Impl *implementation (void) const; - - protected: - /// Constructor. This implementation will not be deleted. - Result (ACE_Asynch_Read_File_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Read_File_Result_Impl *implementation_; - - private: - /// Here just to provide an dummpy implementation, since the - /// one auto generated by MSVC is flagged as infinitely recursive - void operator= (Result &) {} - }; -}; - -// Forward declarations -class ACE_Asynch_Write_File_Impl; -class ACE_Asynch_Write_File_Result_Impl; - -/** - * @class ACE_Asynch_Write_File - * - * @brief This class is a factory for starting off asynchronous writes - * on a file. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {write}s can be - * started using this class. A ACE_Asynch_Write_File::Result - * will be passed back to the {handler} when the asynchronous - * writes completes through the {ACE_Handler::handle_write_file} - * callback. - * This class differs slightly from ACE_Asynch_Write_Stream as - * it allows the user to specify an offset for the write. - */ -class ACE_Export ACE_Asynch_Write_File : public ACE_Asynch_Write_Stream -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Write_File (void); - - /// Destructor. - virtual ~ACE_Asynch_Write_File (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous write. Upto {bytes_to_write} - * will be written from the {message_block}, starting at the - * block's {rd_ptr}. The write will go to the file, starting - * {offset} bytes from the beginning of the file. Priority of the - * operation is specified by {priority}. On POSIX4-Unix, this is - * supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - unsigned long offset = 0, - unsigned long offset_high = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - * @note In win32 Each data block payload must be at least the size of a system - * memory page and must be aligned on a system memory page size boundary - */ - int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - unsigned long offset = 0, - unsigned long offset_high = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation object. - ACE_Asynch_Write_File_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous write completes. This class - * forwards all the methods to the implementation class. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous write. - * This class differs slightly from - * ACE_Asynch_Write_Stream::Result as it calls back - * {ACE_Handler::handle_write_file} on the {handler} instead - * of {ACE_Handler::handle_write_stream}. No additional state - * is required by this class as ACE_Asynch_Result can store - * the {offset}. - */ - class ACE_Export Result : public ACE_Asynch_Write_Stream::Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Write_File_Result; - friend class ACE_WIN32_Asynch_Write_File_Result; - - public: - /// Get the implementation class. - ACE_Asynch_Write_File_Result_Impl *implementation (void) const; - - protected: - /// Constructor. This implementation will not be deleted. - Result (ACE_Asynch_Write_File_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Write_File_Result_Impl *implementation_; - - private: - /// Here just to provide an dummpy implementation, since the - /// one auto generated by MSVC is flagged as infinitely recursive - void operator= (Result &) {}; - }; -}; - -// Forward declarations -class ACE_Asynch_Accept_Result_Impl; -class ACE_Asynch_Accept_Impl; - -/** - * @class ACE_Asynch_Accept - * - * @brief This class is a factory for starting off asynchronous accepts - * on a listen handle. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {accept}s can - * started using this class. A ACE_Asynch_Accept::Result will - * be passed back to the {handler} when the asynchronous accept - * completes through the {ACE_Handler::handle_accept} - * callback. - */ -class ACE_Export ACE_Asynch_Accept : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Accept (void); - - /// Destructor. - virtual ~ACE_Asynch_Accept (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous accept. The asynchronous accept - * call also allows any initial data to be returned to the - * handler specified to @c open(). - * @param message_block A message block to receive initial data, as well - * as the local and remote addresses when the - * connection is made. Since the block receives - * the addresses regardless of whether or not - * initial data is available or requested, the - * message block size must be at least - * @a bytes_to_read plus two times the size of - * the addresses used (IPv4 or IPv6). - * @param bytes_to_read The maximum number of bytes of initial data - * to read into @a message_block. - * @param accept_handle The handle that the new connection will be - * accepted on. If @c INVALID_HANDLE, a new - * handle will be created using @a addr_family. - * @param act Value to be passed in result when operation - * completes. - * @param priority Priority of the operation. On POSIX4-Unix, this - * is supported. Works like @c nice in Unix. - * Negative values are not allowed. 0 means - * priority of the operation same as the process - * priority. 1 means priority of the operation is - * one less than process. And so forth. - * On Win32, this argument is ignored. - * @param signal_number The POSIX4 real-time signal number to be used - * for the operation. Value range is from - * @c ACE_SIGRTMIN to @c ACE_SIGRTMAX. - * This argument is ignored on non-POSIX4 systems. - * @param addr_family The address family to use if @a accept_handle - * is @c ACE_INVALID_HANDLE and a new handle must - * be opened. Values are @c AF_INET and @c PF_INET6. - */ - int accept (ACE_Message_Block &message_block, - size_t bytes_to_read, - ACE_HANDLE accept_handle = ACE_INVALID_HANDLE, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN, - int addr_family = AF_INET); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Delegation/implementation class that all methods will be - /// forwarded to. - ACE_Asynch_Accept_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous accept completes. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous accept. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Accept_Result; - friend class ACE_WIN32_Asynch_Accept_Result; - - public: - /// The number of bytes which were requested at the start of the - /// asynchronous accept. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for accepting new connections. - ACE_HANDLE listen_handle (void) const; - - /// I/O handle for the new connection. - ACE_HANDLE accept_handle (void) const; - - /// Get the implementation. - ACE_Asynch_Accept_Result_Impl *implementation (void) const; - - protected: - /// Contructor. Implementation will not be deleted. - Result (ACE_Asynch_Accept_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// Impelmentation class. - ACE_Asynch_Accept_Result_Impl *implementation_; - }; -}; -// Forward declarations -class ACE_Asynch_Connect_Result_Impl; -class ACE_Asynch_Connect_Impl; - -/** - * @class ACE_Asynch_Connect - * - * @brief This class is a factory for starting off asynchronous connects - * This class forwards all methods to its implementation class. - * - * Once @c open is called, multiple asynchronous connect operationss can - * started using this class. A ACE_Asynch_Connect::Result will - * be passed back to the associated ACE_Handler when the asynchronous connect - * completes through the ACE_Handler::handle_connect() callback. - */ -class ACE_Export ACE_Asynch_Connect : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Connect (void); - - /// Destructor. - virtual ~ACE_Asynch_Connect (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. - * - * @note @arg handle is ignored and should be @c ACE_INVALID_HANDLE. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous Connect. - */ - int connect (ACE_HANDLE connect_handle, - const ACE_Addr & remote_sap, - const ACE_Addr & local_sap, - int reuse_addr, - const void *act=0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Delegation/implementation class that all methods will be - /// forwarded to. - ACE_Asynch_Connect_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * handler when the asynchronous connect completes. - * - * This class has all the information necessary for the - * handler to uniquely identify the completion of the - * asynchronous connect. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Connect_Result; - friend class ACE_WIN32_Asynch_Connect_Result; - - public: - - /// I/O handle for the connection. - ACE_HANDLE connect_handle (void) const; - - /// Get the implementation. - ACE_Asynch_Connect_Result_Impl *implementation (void) const; - - protected: - /// Contructor. Implementation will not be deleted. - Result (ACE_Asynch_Connect_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// Impelmentation class. - ACE_Asynch_Connect_Result_Impl *implementation_; - }; -}; - -// Forward declarations -class ACE_Asynch_Transmit_File_Result_Impl; -class ACE_Asynch_Transmit_File_Impl; - -/** - * @class ACE_Asynch_Transmit_File - * - * @brief This class is a factory for starting off asynchronous - * transmit files on a stream. - * - * Once {open} is called, multiple asynchronous {transmit_file}s - * can started using this class. A - * ACE_Asynch_Transmit_File::Result will be passed back to the - * {handler} when the asynchronous transmit file completes - * through the {ACE_Handler::handle_transmit_file} callback. - * The transmit_file function transmits file data over a - * connected network connection. The function uses the operating - * system's cache manager to retrieve the file data. This - * function provides high-performance file data transfer over - * network connections. This function would be of great use in - * a Web Server, Image Server, etc. - */ -class ACE_Export ACE_Asynch_Transmit_File : public ACE_Asynch_Operation -{ - -public: - // Forward declarations - class Header_And_Trailer; - - /// A do nothing constructor. - ACE_Asynch_Transmit_File (void); - - /// Destructor. - virtual ~ACE_Asynch_Transmit_File (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous transmit file. The {file} is a - * handle to an open file. {header_and_trailer} is a pointer to a - * data structure that contains pointers to data to send before and - * after the file data is sent. Set this parameter to 0 if you only - * want to transmit the file data. Upto {bytes_to_write} will be - * written to the {socket}. If you want to send the entire file, - * let {bytes_to_write} = 0. {bytes_per_send} is the size of each - * block of data sent per send operation. Please read the Win32 - * documentation on what the flags should be. Priority of the - * operation is specified by {priority}. On POSIX4-Unix, this is - * supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - int transmit_file (ACE_HANDLE file, - Header_And_Trailer *header_and_trailer = 0, - size_t bytes_to_write = 0, - unsigned long offset = 0, - unsigned long offset_high = 0, - size_t bytes_per_send = 0, - unsigned long flags = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// The implementation class. - ACE_Asynch_Transmit_File_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous transmit file completes. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous transmit file. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Transmit_File_Result; - friend class ACE_WIN32_Asynch_Transmit_File_Result; - - public: - /// Socket used for transmitting the file. - ACE_HANDLE socket (void) const; - - /// File from which the data is read. - ACE_HANDLE file (void) const; - - /// Header and trailer data associated with this transmit file. - Header_And_Trailer *header_and_trailer (void) const; - - /// The number of bytes which were requested at the start of the - /// asynchronous transmit file. - size_t bytes_to_write (void) const; - - /// Number of bytes per send requested at the start of the transmit - /// file. - size_t bytes_per_send (void) const; - - /// Flags which were passed into transmit file. - unsigned long flags (void) const; - - /// Get the implementation class. - ACE_Asynch_Transmit_File_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Transmit_File_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Transmit_File_Result_Impl *implementation_; - }; - -/** - * @class Header_And_Trailer - * - * @brief The class defines a data structure that contains pointers - * to data to send before and after the file data is sent. - * - * This class provides a wrapper over TRANSMIT_FILE_BUFFERS - * and provided a consistent use of ACE_Message_Blocks. - */ - class ACE_Export Header_And_Trailer - { - - public: - /// Constructor. - Header_And_Trailer (ACE_Message_Block *header = 0, - size_t header_bytes = 0, - ACE_Message_Block *trailer = 0, - size_t trailer_bytes = 0); - - /// Destructor - virtual ~Header_And_Trailer (void); - - /// This method allows all the member to be set in one fell swoop. - void header_and_trailer (ACE_Message_Block *header = 0, - size_t header_bytes = 0, - ACE_Message_Block *trailer = 0, - size_t trailer_bytes = 0); - - /// Get header which goes before the file data. - ACE_Message_Block *header (void) const; - - /// Set header which goes before the file data. - void header (ACE_Message_Block *message_block); - - /// Get size of the header data. - size_t header_bytes (void) const; - - /// Set size of the header data. - void header_bytes (size_t bytes); - - /// Get trailer which goes after the file data. - ACE_Message_Block *trailer (void) const; - - /// Set trailer which goes after the file data. - void trailer (ACE_Message_Block *message_block); - - /// Get size of the trailer data. - size_t trailer_bytes (void) const; - - /// Set size of the trailer data. - void trailer_bytes (size_t bytes); - - /// Conversion routine. - ACE_LPTRANSMIT_FILE_BUFFERS transmit_buffers (void); - - protected: - /// Header data. - ACE_Message_Block *header_; - - /// Size of header data. - size_t header_bytes_; - - /// Trailer data. - ACE_Message_Block *trailer_; - - /// Size of trailer data. - size_t trailer_bytes_; - - /// Target data structure. - ACE_TRANSMIT_FILE_BUFFERS transmit_buffers_; - }; -}; - - -// Forward declarations -class ACE_Asynch_Read_Dgram_Result_Impl; -class ACE_Asynch_Read_Dgram_Impl; -class ACE_Addr; - -/** - * @class ACE_Asynch_Read_Dgram - * - * @brief This class is a factory for starting off asynchronous reads - * on a UDP socket. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {read}s can be - * started using this class. An ACE_Asynch_Read_Dgram::Result - * will be passed back to the {handler} when the asynchronous - * reads completes through the {ACE_Handler::handle_read_dgram} - * callback. - */ -class ACE_Export ACE_Asynch_Read_Dgram : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Read_Dgram (void); - - /// Destructor - virtual ~ACE_Asynch_Read_Dgram (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** This starts off an asynchronous read. Upto - * {message_block->total_size()} will be read and stored in the - * {message_block}. {message_block}'s {wr_ptr} will be updated to reflect - * the added bytes if the read operation is successfully completed. - * Return code of 1 means immediate success and {number_of_bytes_recvd} - * will contain number of bytes read. The {ACE_Handler::handle_read_dgram} - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the {message_block->cont()} - * method. Up to ACE_IOV_MAX {message_block}'s are supported. Upto - * {message_block->size()} bytes will be read into each {message block} for - * a total of {message_block->total_size()} bytes. All {message_block}'s - * {wr_ptr}'s will be updated to reflect the added bytes for each - * {message_block} - * - * Priority of the operation is specified by {priority}. On POSIX4-Unix, - * this is supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, {priority} is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - ssize_t recv (ACE_Message_Block *message_block, - size_t &number_of_bytes_recvd, - int flags, - int protocol_family = PF_INET, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation class that all methods will be forwarded to. - ACE_Asynch_Read_Dgram_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is the class which will be passed back to the - * {handler} when the asynchronous read completes. This class - * forwards all the methods to the implementation classes. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous read. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Read_Dgram_Result; - friend class ACE_WIN32_Asynch_Read_Dgram_Result; - - public: - - /// The number of bytes which were requested at the start of the - /// asynchronous read. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data - ACE_Message_Block *message_block (void) const; - - /// The flags used in the read - int flags (void) const; - - /// The address of where the packet came from - int remote_address (ACE_Addr& addr) const; - - /// I/O handle used for reading. - ACE_HANDLE handle (void) const; - - /// Get the implementation class. - ACE_Asynch_Read_Dgram_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Read_Dgram_Result_Impl *implementation_; - }; -}; - -// Forward declarations -class ACE_Asynch_Write_Dgram_Impl; -class ACE_Asynch_Write_Dgram_Result_Impl; - -/** - * @class ACE_Asynch_Write_Dgram - * - * @brief This class is a factory for starting off asynchronous writes - * on a UDP socket. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {writes}s can - * started using this class. An ACE_Asynch_Write_Dgram::Result - * will be passed back to the {handler} when the asynchronous - * write completes through the - * {ACE_Handler::handle_write_dgram} callback. - */ -class ACE_Export ACE_Asynch_Write_Dgram : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Write_Dgram (void); - - /// Destructor. - virtual ~ACE_Asynch_Write_Dgram (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** This starts off an asynchronous send. Upto - * {message_block->total_length()} will be sent. {message_block}'s - * {rd_ptr} will be updated to reflect the sent bytes if the send operation - * is successfully completed. - * Return code of 1 means immediate success and {number_of_bytes_sent} - * is updated to number of bytes sent. The {ACE_Handler::handle_write_dgram} - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the {message_block->cont()} - * method. Up to ACE_IOV_MAX {message_block}'s are supported. Upto - * {message_block->length()} bytes will be sent from each {message block} - * for a total of {message_block->total_length()} bytes. All - * {message_block}'s {rd_ptr}'s will be updated to reflect the bytes sent - * from each {message_block}. - * - * Priority of the operation is specified by {priority}. On POSIX4-Unix, - * this is supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this argument is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - ssize_t send (ACE_Message_Block *message_block, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr& remote_addr, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation class that all methods will be forwarded to. - ACE_Asynch_Write_Dgram_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous write completes. This class - * forwards all the methods to the implementation class. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous write. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Write_Dgram_Result; - friend class ACE_WIN32_Asynch_Write_Dgram_Result; - - public: - - /// The number of bytes which were requested at the start of the - /// asynchronous write. - size_t bytes_to_write (void) const; - - /// Message block which contains the sent data - ACE_Message_Block *message_block (void) const; - - /// The flags using in the write - int flags (void) const; - - /// I/O handle used for writing. - ACE_HANDLE handle (void) const; - - /// Get the implementation class. - ACE_Asynch_Write_Dgram_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// Implementation class. - ACE_Asynch_Write_Dgram_Result_Impl *implementation_; - }; -}; - - -/** - * @class ACE_Handler - * - * @brief This base class defines the interface for receiving the - * results of asynchronous operations. - * - * Subclasses of this class will fill in appropriate methods. - */ -class ACE_Export ACE_Handler -{ -public: - /// A do nothing constructor. - ACE_Handler (void); - - /// A do nothing constructor which allows proactor to be set to \. - ACE_Handler (ACE_Proactor *p); - - /// Virtual destruction. - virtual ~ACE_Handler (void); - - /// This method will be called when an asynchronous read completes on - /// a stream. - virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); - - /// This method will be called when an asynchronous write completes - /// on a UDP socket. - virtual void handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result); - - /// This method will be called when an asynchronous read completes on - /// a UDP socket. - virtual void handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result); - - /// This method will be called when an asynchronous write completes - /// on a stream. - virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); - - /// This method will be called when an asynchronous read completes on - /// a file. - virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result); - - /// This method will be called when an asynchronous write completes - /// on a file. - virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result); - - /// This method will be called when an asynchronous accept completes. - virtual void handle_accept (const ACE_Asynch_Accept::Result &result); - - /// This method will be called when an asynchronous connect completes. - virtual void handle_connect (const ACE_Asynch_Connect::Result &result); - - /// This method will be called when an asynchronous transmit file - /// completes. - virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result); - - /// Called when timer expires. {tv} was the requested time value and - /// {act} is the ACT passed when scheduling the timer. - virtual void handle_time_out (const ACE_Time_Value &tv, - const void *act = 0); - - /** - * This is method works with the {run_event_loop} of the - * ACE_Proactor. A special {Wake_Up_Completion} is used to wake up - * all the threads that are blocking for completions. - */ - virtual void handle_wakeup (void); - - /// Get the proactor associated with this handler. - ACE_Proactor *proactor (void); - - /// Set the proactor. - void proactor (ACE_Proactor *p); - - /** - * Get the I/O handle used by this {handler}. This method will be - * called by the ACE_Asynch_* classes when an ACE_INVALID_HANDLE is - * passed to {open}. - */ - virtual ACE_HANDLE handle (void) const; - - /// Set the ACE_HANDLE value for this Handler. - virtual void handle (ACE_HANDLE); - - /** - * @class Proxy - * - * @brief The Proxy class acts as a proxy for dispatch of completions - * to operations issued for the associated handler. It allows the handler - * to be deleted while operations are outstanding. The proxy must be used - * to get the ACE_Handler pointer for dispatching, and if it's 0, the - * handler is no longer valid and the result should not be dispatched. - */ - class ACE_Export Proxy - { - public: - Proxy (ACE_Handler *handler) : handler_ (handler) {}; - void reset (void) { this->handler_ = 0; }; - ACE_Handler *handler (void) { return this->handler_; }; - private: - ACE_Handler *handler_; - }; - typedef ACE_Refcounted_Auto_Ptr - Proxy_Ptr; - - Proxy_Ptr &proxy (void); - -protected: - /// The proactor associated with this handler. - ACE_Proactor *proactor_; - - /// The ACE_HANDLE in use with this handler. - ACE_HANDLE handle_; - - /// Refers to proxy for this handler. - ACE_Refcounted_Auto_Ptr proxy_; -}; - -// Forward declarations -class ACE_INET_Addr; - -// Forward declarations -template -class ACE_Asynch_Acceptor; - -/** - * @class ACE_Service_Handler - * - * @brief This base class defines the interface for the - * ACE_Asynch_Acceptor to call into when new connection are - * accepted. - * - * Subclasses of this class will fill in appropriate methods to - * define application specific behavior. - */ -class ACE_Export ACE_Service_Handler : public ACE_Handler -{ - - /// The Acceptor is the factory and therefore should have special - /// privileges. - friend class ACE_Asynch_Acceptor; - -public: - /// A do nothing constructor. - ACE_Service_Handler (void); - - /// Virtual destruction. - virtual ~ACE_Service_Handler (void); - - /** - * {open} is called by ACE_Asynch_Acceptor to initialize a new - * instance of ACE_Service_Handler that has been created after the - * new connection is accepted. The handle for the new connection is - * passed along with the initial data that may have shown up. - */ - virtual void open (ACE_HANDLE new_handle, - ACE_Message_Block &message_block); - - // protected: - // This should be corrected after the correct semantics of the - // friend has been figured out. - - /// Called by ACE_Asynch_Acceptor to pass the addresses of the new - /// connections. - virtual void addresses (const ACE_INET_Addr &remote_address, - const ACE_INET_Addr &local_address); - - /// Called by ACE_Asynch_Acceptor to pass the act. - virtual void act (const void *); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS*/ -#include /**/ "ace/post.h" -#endif /* ACE_ASYNCH_IO_H */ diff --git a/ace/Asynch_IO_Impl.cpp b/ace/Asynch_IO_Impl.cpp deleted file mode 100644 index 8dba289d6ec..00000000000 --- a/ace/Asynch_IO_Impl.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// $Id$ - -#include "ace/Asynch_IO_Impl.h" - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS)) -// This only works on Win32 platforms and on Unix platforms supporting -// aio calls. - -#if !defined (__ACE_INLINE__) -#include "ace/Asynch_IO_Impl.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Asynch_Result_Impl::~ACE_Asynch_Result_Impl (void) -{ -} - -ACE_Asynch_Operation_Impl::~ACE_Asynch_Operation_Impl (void) -{ -} - -ACE_Asynch_Read_Stream_Impl::~ACE_Asynch_Read_Stream_Impl (void) -{ -} - -ACE_Asynch_Read_Stream_Result_Impl::~ACE_Asynch_Read_Stream_Result_Impl (void) -{ -} - -ACE_Asynch_Write_Stream_Impl::~ACE_Asynch_Write_Stream_Impl (void) -{ -} - -ACE_Asynch_Write_Stream_Result_Impl::~ACE_Asynch_Write_Stream_Result_Impl (void) -{ -} - -ACE_Asynch_Read_File_Impl::~ACE_Asynch_Read_File_Impl (void) -{ -} - -ACE_Asynch_Write_File_Impl::~ACE_Asynch_Write_File_Impl (void) -{ -} - -ACE_Asynch_Read_File_Result_Impl::~ACE_Asynch_Read_File_Result_Impl (void) -{ -} - -ACE_Asynch_Write_File_Result_Impl::~ACE_Asynch_Write_File_Result_Impl (void) -{ -} - -ACE_Asynch_Accept_Result_Impl::~ACE_Asynch_Accept_Result_Impl (void) -{ -} - -ACE_Asynch_Connect_Result_Impl::~ACE_Asynch_Connect_Result_Impl (void) -{ -} - -ACE_Asynch_Accept_Impl::~ACE_Asynch_Accept_Impl (void) -{ -} - -ACE_Asynch_Connect_Impl::~ACE_Asynch_Connect_Impl (void) -{ -} - -ACE_Asynch_Transmit_File_Impl::~ACE_Asynch_Transmit_File_Impl (void) -{ -} - -ACE_Asynch_Transmit_File_Result_Impl::~ACE_Asynch_Transmit_File_Result_Impl (void) -{ -} - -ACE_Asynch_Read_Dgram_Impl::~ACE_Asynch_Read_Dgram_Impl (void) -{ -} - -ACE_Asynch_Read_Dgram_Impl::ACE_Asynch_Read_Dgram_Impl (void) -{ -} - -ACE_Asynch_Write_Dgram_Impl::~ACE_Asynch_Write_Dgram_Impl (void) -{ -} - -ACE_Asynch_Write_Dgram_Impl::ACE_Asynch_Write_Dgram_Impl (void) -{ -} - -//*********************************************** - -ACE_Asynch_Read_Dgram_Result_Impl::~ACE_Asynch_Read_Dgram_Result_Impl (void) -{ -} - -ACE_Asynch_Read_Dgram_Result_Impl::ACE_Asynch_Read_Dgram_Result_Impl (void) -{ -} - -//*********************************************** - -ACE_Asynch_Write_Dgram_Result_Impl::~ACE_Asynch_Write_Dgram_Result_Impl (void) -{ -} - -ACE_Asynch_Write_Dgram_Result_Impl::ACE_Asynch_Write_Dgram_Result_Impl (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 || ACE_HAS_WINCE */ diff --git a/ace/Asynch_IO_Impl.h b/ace/Asynch_IO_Impl.h deleted file mode 100644 index 7dc5f283126..00000000000 --- a/ace/Asynch_IO_Impl.h +++ /dev/null @@ -1,816 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Asynch_IO_Impl.h - * - * $Id$ - * - * - * This class contains asbtract base classes for all the concrete - * implementation classes for the various asynchronous operations - * that are used with the Praoctor. - * - * - * @author Irfan Pyarali (irfan@cs.wustl.edu) - * @author Tim Harrison (harrison@cs.wustl.edu) - * @author Alexander Babu Arulanthu - * @author Roger Tragin - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_ASYNCH_IO_IMPL_H -#define ACE_ASYNCH_IO_IMPL_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS)) -// This only works on Win32 platforms and on Unix platforms supporting -// aio calls. - -#include "ace/Asynch_IO.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -class ACE_Proactor_Impl; - -/** - * @class ACE_Asynch_Result_Impl - * - * @brief Abstract base class for the all the classes that provide - * concrete implementations for ACE_Asynch_Result. - * - */ -class ACE_Export ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Result_Impl (void); - - /// Number of bytes transferred by the operation. - virtual size_t bytes_transferred (void) const = 0; - - /// ACT associated with the operation. - virtual const void *act (void) const = 0; - - /// Did the operation succeed? - virtual int success (void) const = 0; - - /// This ACT is not the same as the ACT associated with the - /// asynchronous operation. - virtual const void *completion_key (void) const = 0; - - /// Error value if the operation fail. - virtual u_long error (void) const = 0; - - /// Event associated with the OVERLAPPED structure. - virtual ACE_HANDLE event (void) const = 0; - - /// This really make sense only when doing file I/O. - virtual u_long offset (void) const = 0; - virtual u_long offset_high (void) const = 0; - - /// Priority of the operation. - virtual int priority (void) const = 0; - - /** - * POSIX4 real-time signal number to be used for the - * operation. ranges from SIGRTMIN to SIGRTMAX. By - * default, SIGRTMIN is used to issue calls. This is a no-op - * on non-POSIX4 systems and returns 0. - */ - virtual int signal_number (void) const = 0; - - // protected: - // - // These two should really be protected. But sometimes it - // simplifies code to be able to "fake" a result. Use carefully. - /// This is called when the asynchronous operation completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error = 0) = 0; - - /// Post to the Proactor's completion port. - virtual int post_completion (ACE_Proactor_Impl *proactor) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Operation_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Operation. - */ -class ACE_Export ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Operation_Impl (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If @a handle == ACE_INVALID_HANDLE, - * ACE_Handler::handle() will be called on the proxied handler to get the - * correct handle. - */ - virtual int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) = 0; - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - virtual int cancel (void) = 0; - - // = Access methods. - - /// Return the underlying proactor. - virtual ACE_Proactor* proactor (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Operation_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_Stream_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_Stream - * - */ -class ACE_Export ACE_Asynch_Read_Stream_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Read_Stream_Impl (void); - - /// This starts off an asynchronous read. Upto will - /// be read and stored in the . - virtual int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - */ - virtual int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_Stream_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_Stream_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_Stream::Result class. - * - */ -class ACE_Export ACE_Asynch_Read_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Read_Stream_Result_Impl (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous read. - virtual size_t bytes_to_read (void) const = 0; - - /// Message block which contains the read data. - virtual ACE_Message_Block &message_block (void) const = 0; - - /// I/O handle used for reading. - virtual ACE_HANDLE handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_Stream_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_Stream_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_Stream class. - * - */ -class ACE_Export ACE_Asynch_Write_Stream_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Write_Stream_Impl (void); - - /// This starts off an asynchronous write. Upto - /// will be written from the . - virtual int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - */ - virtual int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_Stream_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_Stream_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_Stream::Result. - * - */ -class ACE_Export ACE_Asynch_Write_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Write_Stream_Result_Impl (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous write. - virtual size_t bytes_to_write (void) const = 0; - - /// Message block that contains the data to be written. - virtual ACE_Message_Block &message_block (void) const = 0; - - /// I/O handle used for writing. - virtual ACE_HANDLE handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_Stream_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_File_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_File::Result. - * - */ -class ACE_Export ACE_Asynch_Read_File_Impl : public virtual ACE_Asynch_Read_Stream_Impl -{ -public: - virtual ~ACE_Asynch_Read_File_Impl (void); - - /** - * This starts off an asynchronous read. Upto will - * be read and stored in the . The read will start - * at from the beginning of the file. - */ - virtual int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - * @note In win32 Each data block payload must be at least the size of a system - * memory page and must be aligned on a system memory page size boundary - */ - virtual int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - - /// This starts off an asynchronous read. Upto will - /// be read and stored in the . - virtual int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - */ - virtual int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_File_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_File_Result_Impl - * - * @brief This is the abstract base class for all the concrete - * implementation classes for ACE_Asynch_Read_File::Result. - * - */ -class ACE_Export ACE_Asynch_Read_File_Result_Impl : public virtual ACE_Asynch_Read_Stream_Result_Impl -{ -public: - /// Destructor. - virtual ~ACE_Asynch_Read_File_Result_Impl (void); - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_File_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_File_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_File. - * - */ -class ACE_Export ACE_Asynch_Write_File_Impl : public virtual ACE_Asynch_Write_Stream_Impl -{ -public: - virtual ~ACE_Asynch_Write_File_Impl (void); - - /** - * This starts off an asynchronous write. Upto - * will be write and stored in the . The write will - * start at from the beginning of the file. - */ - virtual int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - * @note In win32 Each data block payload must be at least the size of a system - * memory page and must be aligned on a system memory page size boundary - */ - virtual int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - - /// This starts off an asynchronous write. Upto @a bytes_to_write - /// will be written from the @a message_block. - virtual int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - */ - virtual int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_File_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_File_Result_Impl - * - * @brief This is the abstract base class for all the concrete - * implementation classes that provide different implementations - * for the ACE_Asynch_Write_File::Result. - * - */ -class ACE_Export ACE_Asynch_Write_File_Result_Impl : public virtual ACE_Asynch_Write_Stream_Result_Impl -{ -public: - virtual ~ACE_Asynch_Write_File_Result_Impl (void); - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_File_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Accept_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Accept. - * - */ -class ACE_Export ACE_Asynch_Accept_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Accept_Impl (void); - - /** - * This starts off an asynchronous accept. The asynchronous accept - * call also allows any initial data to be returned to the - * . Upto @a bytes_to_read will be read and stored in the - * . The @a accept_handle will be used for the - * call. If (@a accept_handle == INVALID_HANDLE), a new - * handle will be created. - * - * @a message_block must be specified. This is because the address of - * the new connection is placed at the end of this buffer. - */ - virtual int accept (ACE_Message_Block &message_block, - size_t bytes_to_read, - ACE_HANDLE accept_handle, - const void *act, - int priority, - int signal_number, - int addr_family) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Accept_Impl (void); -}; - -/** - * @class ACE_Asynch_Accept_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Accept. - * - */ -class ACE_Export ACE_Asynch_Accept_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Accept_Result_Impl (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous accept. - virtual size_t bytes_to_read (void) const = 0; - - /// Message block which contains the read data. - virtual ACE_Message_Block &message_block (void) const = 0; - - /// I/O handle used for accepting new connections. - virtual ACE_HANDLE listen_handle (void) const = 0; - - /// I/O handle for the new connection. - virtual ACE_HANDLE accept_handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Accept_Result_Impl (void); -}; - - -/** - * @class ACE_Asynch_Connect_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Connect. - * - */ -class ACE_Export ACE_Asynch_Connect_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Connect_Impl (void); - - /** - * This starts off an asynchronous connect - */ - virtual int connect (ACE_HANDLE connect_handle, - const ACE_Addr & remote_sap, - const ACE_Addr & local_sap, - int reuse_addr, - const void *act, - int priority, - int signal_number) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Connect_Impl (void); -}; - -/** - * @class ACE_Asynch_Connect_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Connect. - * - */ -class ACE_Export ACE_Asynch_Connect_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Connect_Result_Impl (void); - - /// I/O handle for the connection. - virtual ACE_HANDLE connect_handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Connect_Result_Impl (void); -}; - - -/** - * @class ACE_Asynch_Transmit_File_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Transmit_File. - * - */ -class ACE_Asynch_Transmit_File_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Transmit_File_Impl (void); - - /// This starts off an asynchronous transmit file. - virtual int transmit_file (ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - int priority, - int signal_number) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Transmit_File_Impl (void); -}; - -/** - * @class ACE_Asynch_Transmit_File_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Transmit_File::Result. - * - */ -class ACE_Export ACE_Asynch_Transmit_File_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Transmit_File_Result_Impl (void); - - /// Socket used for transmitting the file. - virtual ACE_HANDLE socket (void) const = 0; - - /// File from which the data is read. - virtual ACE_HANDLE file (void) const = 0; - - /// Header and trailer data associated with this transmit file. - virtual ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const = 0; - - /// The number of bytes which were requested at the start of the - /// asynchronous transmit file. - virtual size_t bytes_to_write (void) const = 0; - - /// Number of bytes per send requested at the start of the transmit - /// file. - virtual size_t bytes_per_send (void) const = 0; - - /// Flags which were passed into transmit file. - virtual u_long flags (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Transmit_File_Result_Impl (void); -}; - - -/** - * @class ACE_Asynch_Read_Dgram_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_Dgram - * - */ -class ACE_Export ACE_Asynch_Read_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Read_Dgram_Impl (void); - - /** This starts off an asynchronous read. Upto - * total_size()> will be read and stored in the - * . 's will be updated to reflect - * the added bytes if the read operation is successful completed. - * Return code of 1 means immediate success and - * will contain number of bytes read. The - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the cont()> - * method. Up to ACE_IOV_MAX 's are supported. Upto - * size()> bytes will be read into each for - * a total of total_size()> bytes. All 's - * 's will be updated to reflect the added bytes for each - * - * - * Priority of the operation is specified by . On POSIX4-Unix, - * this is supported. Works like in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, is a no-op. - * is the POSIX4 real-time signal number to be used - * for the operation. ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - virtual ssize_t recv (ACE_Message_Block *message_block, - size_t &number_of_bytes_recvd, - int flags, - int protocol_family, - const void *act, - int priority, - int signal_number) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_Dgram_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_Dgram_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_Dgram::Result class. - * - */ -class ACE_Export ACE_Asynch_Read_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Read_Dgram_Result_Impl (void); - - /// Message block which contains the read data - virtual ACE_Message_Block *message_block (void) const = 0; - - /// The number of bytes which were requested at the start of the - /// asynchronous read. - virtual size_t bytes_to_read (void) const = 0; - - /// The address of where the packet came from - virtual int remote_address (ACE_Addr& addr) const = 0; - - /// The flags used in the read - virtual int flags (void) const = 0; - - /// I/O handle used for reading. - virtual ACE_HANDLE handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_Dgram_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_Dgram_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_Dgram class. - * - */ -class ACE_Export ACE_Asynch_Write_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Write_Dgram_Impl (void); - - /** This starts off an asynchronous send. Upto - * total_length()> will be sent. 's - * will be updated to reflect the sent bytes if the send operation - * is successful completed. - * Return code of 1 means immediate success and - * is updated to number of bytes sent. The - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the cont()> - * method. Up to ACE_IOV_MAX 's are supported. Upto - * length()> bytes will be sent from each - * for a total of total_length()> bytes. All - * 's 's will be updated to reflect the bytes sent - * from each . - * - * Priority of the operation is specified by . On POSIX4-Unix, - * this is supported. Works like in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this argument is a no-op. - * is the POSIX4 real-time signal number to be used - * for the operation. ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - virtual ssize_t send (ACE_Message_Block *message_block, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr &addr, - const void *act, - int priority, - int signal_number) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_Dgram_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_Dgram_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_Dgram::Result class. - * - */ -class ACE_Export ACE_Asynch_Write_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Write_Dgram_Result_Impl (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous write. - virtual size_t bytes_to_write (void) const = 0; - - /// Message block which contains the sent data - virtual ACE_Message_Block *message_block (void) const = 0; - - /// The flags using in the write - virtual int flags (void) const = 0; - - /// I/O handle used for writing. - virtual ACE_HANDLE handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_Dgram_Result_Impl (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Asynch_IO_Impl.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_AIO_CALLS || !ACE_HAS_WINCE && ACE_WIN32 */ -#include /**/ "ace/post.h" -#endif /* ACE_ASYNCH_IO_IMPL_H */ diff --git a/ace/Asynch_IO_Impl.inl b/ace/Asynch_IO_Impl.inl deleted file mode 100644 index 495a768a972..00000000000 --- a/ace/Asynch_IO_Impl.inl +++ /dev/null @@ -1,106 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Asynch_Result_Impl::ACE_Asynch_Result_Impl (void) -{ -} - -ACE_INLINE -ACE_Asynch_Operation_Impl::ACE_Asynch_Operation_Impl (void) -{ -} - -ACE_INLINE -ACE_Asynch_Read_Stream_Impl::ACE_Asynch_Read_Stream_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Read_Stream_Result_Impl::ACE_Asynch_Read_Stream_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Write_Stream_Impl::ACE_Asynch_Write_Stream_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Write_Stream_Result_Impl::ACE_Asynch_Write_Stream_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Read_File_Impl::ACE_Asynch_Read_File_Impl (void) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Read_Stream_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Read_File_Result_Impl::ACE_Asynch_Read_File_Result_Impl (void) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Read_Stream_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Write_File_Impl::ACE_Asynch_Write_File_Impl (void) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Write_Stream_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Write_File_Result_Impl::ACE_Asynch_Write_File_Result_Impl (void) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Write_Stream_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Accept_Impl::ACE_Asynch_Accept_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Accept_Result_Impl::ACE_Asynch_Accept_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Connect_Impl::ACE_Asynch_Connect_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Connect_Result_Impl::ACE_Asynch_Connect_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - - -ACE_INLINE -ACE_Asynch_Transmit_File_Impl::ACE_Asynch_Transmit_File_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Transmit_File_Result_Impl::ACE_Asynch_Transmit_File_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Asynch_Pseudo_Task.cpp b/ace/Asynch_Pseudo_Task.cpp deleted file mode 100644 index b3e25ef0298..00000000000 --- a/ace/Asynch_Pseudo_Task.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// $Id$ - -#include "ace/Asynch_Pseudo_Task.h" - -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_signal.h" - -ACE_RCSID(ace, Asynch_Pseudo_Task, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task() - : select_reactor_ (), // should be initialized before reactor_ - reactor_ (&select_reactor_, 0) // don't delete implementation -{ -} - -ACE_Asynch_Pseudo_Task::~ACE_Asynch_Pseudo_Task() -{ - this->stop(); -} - -int -ACE_Asynch_Pseudo_Task::start (void) -{ - if (this->reactor_.initialized () == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%N:%l:%p\n"), - ACE_LIB_TEXT ("start reactor is not initialized")), - -1); - - return this->activate () == -1 ? -1 : 0; // If started, return 0 -} - -int -ACE_Asynch_Pseudo_Task::stop (void) -{ - if (this->thr_count () == 0) // already stopped - return 0; - - if (this->reactor_.end_reactor_event_loop () == -1) - return -1; - - this->wait (); - this->reactor_.close (); - return 0; -} - -int -ACE_Asynch_Pseudo_Task::svc (void) -{ -#if !defined (ACE_WIN32) - - sigset_t RT_signals; - - sigemptyset (&RT_signals); - for (int si = ACE_SIGRTMIN; si <= ACE_SIGRTMAX; si++) - sigaddset (&RT_signals, si); - - if (ACE_OS::pthread_sigmask (SIG_BLOCK, &RT_signals, 0) != 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Error:(%P | %t):%p\n"), - ACE_LIB_TEXT ("pthread_sigmask"))); -#endif - - reactor_.owner (ACE_Thread::self()); - reactor_.run_reactor_event_loop (); - - return 0; -} - - - -int -ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask, - int flg_suspend) -{ - // Register the handler with the reactor. - if (-1 == this->reactor_.register_handler (handle, handler, mask)) - return -1; - - if (flg_suspend == 0) - return 0; - - // Suspend the handle now. Enable only when the accept is issued - // by the application. - if (this->reactor_.suspend_handler (handle) == -1) - { - ACE_ERROR - ((LM_ERROR, - ACE_LIB_TEXT ("%N:%l:%p\n"), - ACE_LIB_TEXT ("register_io_handler (suspended)"))); - this->reactor_.remove_handler (handle, - ACE_Event_Handler::ALL_EVENTS_MASK - | ACE_Event_Handler::DONT_CALL); - return -1; - } - - return 0; -} - -int -ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_HANDLE handle) -{ - return this->reactor_.remove_handler (handle , - ACE_Event_Handler::ALL_EVENTS_MASK - | ACE_Event_Handler::DONT_CALL); -} - -int -ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_Handle_Set &set) -{ - return this->reactor_.remove_handler (set, - ACE_Event_Handler::ALL_EVENTS_MASK - | ACE_Event_Handler::DONT_CALL); -} - -int -ACE_Asynch_Pseudo_Task::suspend_io_handler (ACE_HANDLE handle) -{ - return this->reactor_.suspend_handler (handle); -} - -int -ACE_Asynch_Pseudo_Task::resume_io_handler (ACE_HANDLE handle) -{ - return this->reactor_.resume_handler (handle); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Asynch_Pseudo_Task.h b/ace/Asynch_Pseudo_Task.h deleted file mode 100644 index 7fc68e16b70..00000000000 --- a/ace/Asynch_Pseudo_Task.h +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Asynch_Pseudo_Task.h - * - * $Id$ - * - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_ASYNCH_PSEUDO_TASK_H -#define ACE_ASYNCH_PSEUDO_TASK_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Reactor.h" -#include "ace/Select_Reactor.h" -#include "ace/Task.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/* - * Specialization hook to replace the Reactor with the - * concrete Reactor implementation, e.g., select_st, - * select_mt etc. - */ -//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK - -/** - * @class ACE_Asynch_Pseudo_Task - * - */ -class ACE_Export ACE_Asynch_Pseudo_Task : public ACE_Task -{ -public: - ACE_Asynch_Pseudo_Task(); - virtual ~ACE_Asynch_Pseudo_Task(); - - int start (void); - int stop (void); - - int register_io_handler (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask, - int flg_suspend); - - int remove_io_handler (ACE_HANDLE handle); - int remove_io_handler (ACE_Handle_Set &set); - int resume_io_handler (ACE_HANDLE handle); - int suspend_io_handler (ACE_HANDLE handle); - -protected: - virtual int svc (void); - - ACE_Select_Reactor select_reactor_; - // should be initialized before reactor_ - ACE_Reactor reactor_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_ASYNCH_PSEUDO_TASK_H */ diff --git a/ace/Atomic_Op.cpp b/ace/Atomic_Op.cpp deleted file mode 100644 index 84dd1763565..00000000000 --- a/ace/Atomic_Op.cpp +++ /dev/null @@ -1,280 +0,0 @@ -// $Id$ - -#include "ace/Atomic_Op.h" -#include "ace/OS_NS_unistd.h" - -ACE_RCSID (ace, - Atomic_Op, - "$Id$") - -#if !defined (__ACE_INLINE__) -#include "ace/Atomic_Op.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_HAS_BUILTIN_ATOMIC_OP) - -#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC) -# include "ace/Atomic_Op_Sparc.h" -#endif /* ACE_INCLUDE_ATOMIC_OP_SPARC */ - -namespace { - -#if defined (_MSC_VER) -// Disable "no return value" warning, as we will be putting -// the return values directly into the EAX register. -#pragma warning (push) -#pragma warning (disable: 4035) -#endif /* _MSC_VER */ - -long -single_cpu_increment (volatile long *value) -{ -#if defined (__GNUC__) && (defined (ACE_HAS_PENTIUM) || defined (__amd64__)) - long tmp = 1; - unsigned long addr = reinterpret_cast (value); - asm( "xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); - return tmp + 1; -#elif defined (sun) - return ace_atomic_add_long ( - reinterpret_cast (value), 1); -#else /* __GNUC__ && ACE_HAS_PENTIUM */ - ACE_UNUSED_ARG (value); - ACE_NOTSUP_RETURN (-1); -#endif /* __GNUC__ && ACE_HAS_PENTIUM */ -} - -long -single_cpu_decrement (volatile long *value) -{ -#if defined (__GNUC__) && (defined (ACE_HAS_PENTIUM) || defined (__amd64__)) - long tmp = -1; - unsigned long addr = reinterpret_cast (value); - asm( "xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); - return tmp - 1; -#elif defined (sun) - return ace_atomic_add_long ( - reinterpret_cast (value), -1); -#else /* __GNUC__ && ACE_HAS_PENTIUM */ - ACE_UNUSED_ARG (value); - ACE_NOTSUP_RETURN (-1); -#endif /* __GNUC__ && ACE_HAS_PENTIUM */ -} - -long -single_cpu_exchange (volatile long *value, long rhs) -{ -#if defined (__GNUC__) && (defined (ACE_HAS_PENTIUM) || defined (__amd64__)) - unsigned long addr = reinterpret_cast (value); - asm( "xchg %0, (%1)" : "+r"(rhs) : "r"(addr) ); - return rhs; -#elif defined (sun) - return ace_atomic_swap_long ( - reinterpret_cast (value), rhs); -#else /* __GNUC__ && ACE_HAS_PENTIUM */ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -#endif /* __GNUC__ && ACE_HAS_PENTIUM */ -} - -long -single_cpu_exchange_add (volatile long *value, long rhs) -{ -#if defined (__GNUC__) && (defined (ACE_HAS_PENTIUM) || defined (__amd64__)) - unsigned long addr = reinterpret_cast (value); - asm( "xadd %0, (%1)" : "+r"(rhs) : "r"(addr) ); - return rhs; -#elif defined (sun) - return ace_atomic_swap_add_long ( - reinterpret_cast (value), rhs); -#elif defined (WIN32) && !defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) -# if defined (_MSC_VER) - __asm - { - mov eax, rhs - mov edx, value - xadd [edx], eax - } - // Return value is already in EAX register. -# elif defined (__BORLANDC__) - _EAX = rhs; - _EDX = reinterpret_cast (value); - __emit__(0x0F, 0xC1, 0x02); // xadd [edx], eax - // Return value is already in EAX register. -# else /* _MSC_VER */ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -# endif /* _MSC_VER */ -#else /* __GNUC__ && ACE_HAS_PENTIUM */ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -#endif /* __GNUC__ && ACE_HAS_PENTIUM */ -} - -long -multi_cpu_increment (volatile long *value) -{ -#if defined (__GNUC__) && (defined (ACE_HAS_PENTIUM) || defined (__amd64__)) - long tmp = 1; - unsigned long addr = reinterpret_cast (value); - asm( "lock ; xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); - return tmp + 1; -#elif defined (sun) - return ace_atomic_add_long ( - reinterpret_cast (value), 1); -#else /* __GNUC__ && ACE_HAS_PENTIUM */ - ACE_UNUSED_ARG (value); - ACE_NOTSUP_RETURN (-1); -#endif /* __GNUC__ && ACE_HAS_PENTIUM */ -} - -long -multi_cpu_decrement (volatile long *value) -{ -#if defined (__GNUC__) && (defined (ACE_HAS_PENTIUM) || defined (__amd64__)) - long tmp = -1; - unsigned long addr = reinterpret_cast (value); - asm( "lock ; xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); - return tmp - 1; -#elif defined (sun) - return ace_atomic_add_long ( - reinterpret_cast (value), -1); -#else /* __GNUC__ && ACE_HAS_PENTIUM */ - ACE_UNUSED_ARG (value); - ACE_NOTSUP_RETURN (-1); -#endif /* __GNUC__ && ACE_HAS_PENTIUM */ -} - -long -multi_cpu_exchange (volatile long *value, long rhs) -{ -#if defined (__GNUC__) && (defined (ACE_HAS_PENTIUM) || defined (__amd64__)) - unsigned long addr = reinterpret_cast (value); - // The XCHG instruction automatically follows LOCK semantics - asm( "xchg %0, (%1)" : "+r"(rhs) : "r"(addr) ); - return rhs; -#elif defined (sun) - return ace_atomic_swap_long ( - reinterpret_cast (value), rhs); -#else /* __GNUC__ && ACE_HAS_PENTIUM */ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -#endif /* __GNUC__ && ACE_HAS_PENTIUM */ -} - -long -multi_cpu_exchange_add (volatile long *value, long rhs) -{ -#if defined (__GNUC__) && (defined (ACE_HAS_PENTIUM) || defined (__amd64__)) - unsigned long addr = reinterpret_cast (value); - asm( "lock ; xadd %0, (%1)" : "+r"(rhs) : "r"(addr) ); - return rhs; -#elif defined (sun) - return ace_atomic_swap_add_long ( - reinterpret_cast (value), rhs); -#elif defined (WIN32) && !defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) -# if defined (_MSC_VER) - __asm - { - mov eax, rhs - mov edx, value - lock xadd [edx], eax - } - // Return value is already in EAX register. -# elif defined (__BORLANDC__) - _EAX = rhs; - _EDX = reinterpret_cast (value); - __emit__(0xF0, 0x0F, 0xC1, 0x02); // lock xadd [edx], eax - // Return value is already in EAX register. -# else /* _MSC_VER */ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -# endif /* _MSC_VER */ -#else /* __GNUC__ && ACE_HAS_PENTIUM */ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -#endif /* __GNUC__ && ACE_HAS_PENTIUM */ -} - -#if defined (_MSC_VER) -#pragma warning (pop) -#endif /* _MSC_VER */ - -} // end namespace - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -long (*ACE_Atomic_Op::increment_fn_) (volatile long *) = 0; -long (*ACE_Atomic_Op::decrement_fn_) (volatile long *) = 0; -long (*ACE_Atomic_Op::exchange_fn_) (volatile long *, long) = 0; -long (*ACE_Atomic_Op::exchange_add_fn_) (volatile long *, long) = 0; - -void -ACE_Atomic_Op::init_functions (void) -{ - if (ACE_OS::num_processors () == 1) - { - increment_fn_ = single_cpu_increment; - decrement_fn_ = single_cpu_decrement; - exchange_fn_ = single_cpu_exchange; - exchange_add_fn_ = single_cpu_exchange_add; - } - else - { - increment_fn_ = multi_cpu_increment; - decrement_fn_ = multi_cpu_decrement; - exchange_fn_ = multi_cpu_exchange; - exchange_add_fn_ = multi_cpu_exchange_add; - } -} - -void -ACE_Atomic_Op::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -long (*ACE_Atomic_Op::increment_fn_) (volatile long *) = 0; -long (*ACE_Atomic_Op::decrement_fn_) (volatile long *) = 0; -long (*ACE_Atomic_Op::exchange_fn_) (volatile long *, long) = 0; -long (*ACE_Atomic_Op::exchange_add_fn_) (volatile long *, long) = 0; - -void -ACE_Atomic_Op::init_functions (void) -{ - if (ACE_OS::num_processors () == 1) - { - increment_fn_ = single_cpu_increment; - decrement_fn_ = single_cpu_decrement; - exchange_fn_ = single_cpu_exchange; - exchange_add_fn_ = single_cpu_exchange_add; - } - else - { - increment_fn_ = multi_cpu_increment; - decrement_fn_ = multi_cpu_decrement; - exchange_fn_ = multi_cpu_exchange; - exchange_add_fn_ = multi_cpu_exchange_add; - } -} - -void -ACE_Atomic_Op::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ diff --git a/ace/Atomic_Op.h b/ace/Atomic_Op.h deleted file mode 100644 index 6941752c243..00000000000 --- a/ace/Atomic_Op.h +++ /dev/null @@ -1,257 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Atomic_Op.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ATOMIC_OP_H -#define ACE_ATOMIC_OP_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Thread_Mutex.h" - -// Include the templates here. -#include "ace/Atomic_Op_T.h" - -// Determine whether builtin atomic op support is -// available on this platform. -#if defined (ACE_HAS_THREADS) -# if defined (WIN32) -# if defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) -# define ACE_HAS_BUILTIN_ATOMIC_OP -# else /* ACE_HAS_INTERLOCKED_EXCHANGEADD */ - // Inline assembly emulation of InterlockedExchangeAdd - // is currently only implemented for MSVC (x86 only) and Borland. -# if (defined (_MSC_VER) && defined (_M_IX86)) || defined (__BORLANDC__) -# define ACE_HAS_BUILTIN_ATOMIC_OP -# endif /* _MSC_VER || __BORLANDC__ */ -# endif /* ACE_HAS_INTERLOCKED_EXCHANGEADD */ -# elif defined (__GNUC__) && (defined (ACE_HAS_PENTIUM) || defined (__amd64__)) -# define ACE_HAS_BUILTIN_ATOMIC_OP -# endif /* WIN32 */ -#endif /* ACE_HAS_THREADS */ - -#if defined (ACE_HAS_BUILTIN_ATOMIC_OP) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Atomic_Op - * - * @brief Specialization of ACE_Atomic_Op for platforms that - * support atomic integer operations. - * - * Specialization of ACE_Atomic_Op for platforms that support atomic - * integer operations. - */ -template<> -class ACE_Export ACE_Atomic_Op -{ -public: - /// Initialize to 0. - ACE_Atomic_Op (void); - - /// Initialize to c. - ACE_Atomic_Op (long c); - - /// Manage copying... - ACE_Atomic_Op (const ACE_Atomic_Op &c); - - /// Atomically pre-increment . - long operator++ (void); - - /// Atomically post-increment . - long operator++ (int); - - /// Atomically increment by rhs. - long operator+= (long rhs); - - /// Atomically pre-decrement . - long operator-- (void); - - /// Atomically post-decrement . - long operator-- (int); - - /// Atomically decrement by rhs. - long operator-= (long rhs); - - /// Atomically compare with rhs. - bool operator== (long rhs) const; - - /// Atomically compare with rhs. - bool operator!= (long rhs) const; - - /// Atomically check if greater than or equal to rhs. - bool operator>= (long rhs) const; - - /// Atomically check if greater than rhs. - bool operator> (long rhs) const; - - /// Atomically check if less than or equal to rhs. - bool operator<= (long rhs) const; - - /// Atomically check if less than rhs. - bool operator< (long rhs) const; - - /// Atomically assign rhs to . - ACE_Atomic_Op &operator= (long rhs); - - /// Atomically assign to . - ACE_Atomic_Op &operator= (const ACE_Atomic_Op &rhs); - - /// Explicitly return . - long value (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Explicitly return (by reference). - volatile long &value_i (void); - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - - /// Used during ACE object manager initialization to optimize the fast - /// atomic op implementation according to the number of CPUs. - static void init_functions (void); - -private: - - // This function cannot be supported by this template specialization. - // If you need access to an underlying lock, use the ACE_Atomic_Op_Ex - // template instead. - ACE_Thread_Mutex &mutex (void); - -private: - - /// Current object decorated by the atomic op. - volatile long value_; - - // Pointers to selected atomic op implementations. - static long (*increment_fn_) (volatile long *); - static long (*decrement_fn_) (volatile long *); - static long (*exchange_fn_) (volatile long *, long); - static long (*exchange_add_fn_) (volatile long *, long); -}; - -/** - * @class ACE_Atomic_Op - * - * @brief Specialization of ACE_Atomic_Op for platforms that - * support atomic integer operations. - * - * Specialization of ACE_Atomic_Op for platforms that support atomic - * integer operations. - */ -template<> -class ACE_Export ACE_Atomic_Op -{ -public: - /// Initialize to 0. - ACE_Atomic_Op (void); - - /// Initialize to c. - ACE_Atomic_Op (unsigned long c); - - /// Manage copying... - ACE_Atomic_Op (const ACE_Atomic_Op &c); - - /// Atomically pre-increment . - unsigned long operator++ (void); - - /// Atomically post-increment . - unsigned long operator++ (int); - - /// Atomically increment by rhs. - unsigned long operator+= (unsigned long rhs); - - /// Atomically pre-decrement . - unsigned long operator-- (void); - - /// Atomically post-decrement . - unsigned long operator-- (int); - - /// Atomically decrement by rhs. - unsigned long operator-= (unsigned long rhs); - - /// Atomically compare with rhs. - bool operator== (unsigned long rhs) const; - - /// Atomically compare with rhs. - bool operator!= (unsigned long rhs) const; - - /// Atomically check if greater than or equal to rhs. - bool operator>= (unsigned long rhs) const; - - /// Atomically check if greater than rhs. - bool operator> (unsigned long rhs) const; - - /// Atomically check if less than or equal to rhs. - bool operator<= (unsigned long rhs) const; - - /// Atomically check if less than rhs. - bool operator< (unsigned long rhs) const; - - /// Atomically assign rhs to . - ACE_Atomic_Op &operator= (unsigned long rhs); - - /// Atomically assign to . - ACE_Atomic_Op &operator= (const ACE_Atomic_Op &rhs); - - /// Explicitly return . - unsigned long value (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Explicitly return (by reference). - volatile unsigned long &value_i (void); - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - - /// Used during ACE object manager initialization to optimize the fast - /// atomic op implementation according to the number of CPUs. - static void init_functions (void); - -private: - - // This function cannot be supported by this template specialization. - // If you need access to an underlying lock, use the ACE_Atomic_Op_Ex - // template instead. - ACE_Thread_Mutex &mutex (void); - -private: - - /// Current object decorated by the atomic op. - volatile unsigned long value_; - - // Pointers to selected atomic op implementations. - static long (*increment_fn_) (volatile long *); - static long (*decrement_fn_) (volatile long *); - static long (*exchange_fn_) (volatile long *, long); - static long (*exchange_add_fn_) (volatile long *, long); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ - -#if defined (__ACE_INLINE__) -#include "ace/Atomic_Op.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /*ACE_ATOMIC_OP_H*/ diff --git a/ace/Atomic_Op.inl b/ace/Atomic_Op.inl deleted file mode 100644 index 81bf9d8a9f3..00000000000 --- a/ace/Atomic_Op.inl +++ /dev/null @@ -1,301 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - - -#if defined (ACE_HAS_BUILTIN_ATOMIC_OP) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) - : value_ (0) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (long c) - : value_ (c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op ( - const ACE_Atomic_Op &rhs) - : value_ (rhs.value_) -{ -} - -ACE_INLINE long -ACE_Atomic_Op::operator++ (void) -{ -#if defined (WIN32) - return ::InterlockedIncrement (const_cast (&this->value_)); -#else /* WIN32 */ - return (*increment_fn_) (&this->value_); -#endif /* WIN32 */ -} - -ACE_INLINE long -ACE_Atomic_Op::operator++ (int) -{ - return ++*this - 1; -} - -ACE_INLINE long -ACE_Atomic_Op::operator-- (void) -{ -#if defined (WIN32) - return ::InterlockedDecrement (const_cast (&this->value_)); -#else /* WIN32 */ - return (*decrement_fn_) (&this->value_); -#endif /* WIN32 */ -} - -ACE_INLINE long -ACE_Atomic_Op::operator-- (int) -{ - return --*this + 1; -} - -ACE_INLINE long -ACE_Atomic_Op::operator+= (long rhs) -{ -#if defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) - return ::InterlockedExchangeAdd (const_cast (&this->value_), - rhs) + rhs; -#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ - return (*exchange_add_fn_) (&this->value_, rhs) + rhs; -#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ -} - -ACE_INLINE long -ACE_Atomic_Op::operator-= (long rhs) -{ -#if defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) - return ::InterlockedExchangeAdd (const_cast (&this->value_), - -rhs) - rhs; -#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ - return (*exchange_add_fn_) (&this->value_, -rhs) - rhs; -#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ -} - -ACE_INLINE bool -ACE_Atomic_Op::operator== (long rhs) const -{ - return (this->value_ == rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator!= (long rhs) const -{ - return (this->value_ != rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator>= (long rhs) const -{ - return (this->value_ >= rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator> (long rhs) const -{ - return (this->value_ > rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator<= (long rhs) const -{ - return (this->value_ <= rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator< (long rhs) const -{ - return (this->value_ < rhs); -} - -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= (long rhs) -{ -#if defined (WIN32) - ::InterlockedExchange (const_cast (&this->value_), rhs); -#else /* WIN32 */ - (*exchange_fn_) (&this->value_, rhs); -#endif /* WIN32 */ - return *this; -} - -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= ( - const ACE_Atomic_Op &rhs) -{ -#if defined (WIN32) - ::InterlockedExchange (const_cast (&this->value_), rhs.value_); -#else /* WIN32 */ - (*exchange_fn_) (&this->value_, rhs.value_); -#endif /* WIN32 */ - return *this; -} - -ACE_INLINE long -ACE_Atomic_Op::value (void) const -{ - return this->value_; -} - -ACE_INLINE volatile long & -ACE_Atomic_Op::value_i (void) -{ - return this->value_; -} - - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) - : value_ (0) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (unsigned long c) - : value_ (c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op ( - const ACE_Atomic_Op &rhs) - : value_ (rhs.value_) -{ -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator++ (void) -{ -#if defined (WIN32) - return static_cast (::InterlockedIncrement (const_cast (reinterpret_cast(&this->value_)))); -#else /* WIN32 */ - return static_cast ((*increment_fn_) (reinterpret_cast (&this->value_))); -#endif /* WIN32 */ -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator++ (int) -{ - return ++*this - 1; -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator-- (void) -{ -#if defined (WIN32) - return static_cast (::InterlockedDecrement (const_cast (reinterpret_cast(&this->value_)))); -#else /* WIN32 */ - return static_cast ((*decrement_fn_) (reinterpret_cast (&this->value_))); -#endif /* WIN32 */ -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator-- (int) -{ - return --*this + 1; -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator+= (unsigned long rhs) -{ -#if defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) - return static_cast (::InterlockedExchangeAdd (const_cast (reinterpret_cast (&this->value_)), - rhs)) + rhs; -#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ - return static_cast ((*exchange_add_fn_) (reinterpret_cast (&this->value_), rhs)) + rhs; -#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator-= (unsigned long rhs) -{ -#if defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) - return static_cast (::InterlockedExchangeAdd (const_cast (reinterpret_cast(&this->value_)), - -static_cast(rhs))) - rhs; -#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ - return static_cast ((*exchange_add_fn_) (reinterpret_cast (&this->value_), -rhs)) - rhs; -#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ -} - -ACE_INLINE bool -ACE_Atomic_Op::operator== (unsigned long rhs) const -{ - return (this->value_ == rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator!= (unsigned long rhs) const -{ - return (this->value_ != rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator>= (unsigned long rhs) const -{ - return (this->value_ >= rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator> (unsigned long rhs) const -{ - return (this->value_ > rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator<= (unsigned long rhs) const -{ - return (this->value_ <= rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator< (unsigned long rhs) const -{ - return (this->value_ < rhs); -} - -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= (unsigned long rhs) -{ -#if defined (WIN32) - ::InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs); -#else /* WIN32 */ - (*exchange_fn_) (reinterpret_cast (&this->value_), rhs); -#endif /* WIN32 */ - return *this; -} - -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= ( - const ACE_Atomic_Op &rhs) -{ -#if defined (WIN32) - ::InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs.value_); -#else /* WIN32 */ - (*exchange_fn_) (reinterpret_cast (&this->value_), rhs.value_); -#endif /* WIN32 */ - return *this; -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::value (void) const -{ - return this->value_; -} - -ACE_INLINE volatile unsigned long & -ACE_Atomic_Op::value_i (void) -{ - return this->value_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ diff --git a/ace/Atomic_Op_Sparc.c b/ace/Atomic_Op_Sparc.c deleted file mode 100644 index f301de5b85f..00000000000 --- a/ace/Atomic_Op_Sparc.c +++ /dev/null @@ -1,113 +0,0 @@ -/* $Id$ - * - * This is a C file for a reason. The Sun C++ compiler does not accept - * inline assembler. - * - * Portions of this code are based on atomic operations found in the - * linux kernel source code. - */ - -#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC) - -# if defined (__sparcv9) - -unsigned long -ace_atomic_add_long (volatile unsigned long *dest, long rhs) -{ - __asm ("restore\n" - "ldx [%o0], %o2\n" - ".again_add:\n" - "add %o2, %o1, %o3\n" - "casx [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %xcc, .again_add\n" - "mov %o3, %o2\n" - "retl\n" - "add %o2, %o1, %o0\n"); -} - -unsigned long -ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs) -{ - __asm ("restore\n" - "ldx [%o0], %o2\n" - ".again_swap:\n" - "mov %o1, %o3\n" - "casx [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %xcc, .again_swap\n" - "mov %o3, %o2\n" - "retl\n" - "mov %o3, %o0\n"); -} - -unsigned long -ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs) -{ - __asm ("restore\n" - "ldx [%o0], %o2\n" - ".again_swap_add:\n" - "mov %o2, %o4\n" - "add %o2, %o1, %o3\n" - "casx [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %xcc, .again_swap_add\n" - "mov %o3, %o2\n" - "retl\n" - "mov %o4, %o0\n"); -} - -#else - -unsigned long -ace_atomic_add_long (volatile unsigned long *dest, long rhs) -{ - __asm ("restore\n" - "ld [%o0], %o2\n" - ".again_add:\n" - "add %o2, %o1, %o3\n" - "cas [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %icc, .again_add\n" - "mov %o3, %o2\n" - "retl\n" - "add %o2, %o1, %o0\n"); -} - -unsigned long -ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs) -{ - __asm ("restore\n" - "ld [%o0], %o2\n" - ".again_swap:\n" - "mov %o1, %o3\n" - "cas [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %icc, .again_swap\n" - "mov %o3, %o2\n" - "retl\n" - "mov %o3, %o0\n"); -} - -unsigned long -ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs) -{ - __asm ("restore\n" - "ld [%o0], %o2\n" - ".again_swap_add:\n" - "mov %o2, %o4\n" - "add %o2, %o1, %o3\n" - "cas [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %icc, .again_swap_add\n" - "mov %o3, %o2\n" - "retl\n" - "mov %o4, %o0\n"); -} - -# endif /* __sparcv9 */ - -#elif !defined (__GNUC__) -/* Make compilers stop complaining about an empty translation unit */ -static int shut_up_compiler = 0; -#endif /* ACE_INCLUDE_ATOMIC_OP_SPARC */ diff --git a/ace/Atomic_Op_Sparc.h b/ace/Atomic_Op_Sparc.h deleted file mode 100644 index 6e238e5e909..00000000000 --- a/ace/Atomic_Op_Sparc.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_ATOMIC_OP_SPARC_H -#define ACE_ATOMIC_OP_SPARC_H - -extern "C" -{ - unsigned long ace_atomic_add_long (volatile unsigned long *dest, long rhs); - unsigned long ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs); - unsigned long ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs); -} - -#endif /* ACE_ATOMIC_OP_SPARC_H */ diff --git a/ace/Atomic_Op_T.cpp b/ace/Atomic_Op_T.cpp deleted file mode 100644 index d31e49e081a..00000000000 --- a/ace/Atomic_Op_T.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef ACE_ATOMIC_OP_T_CPP -#define ACE_ATOMIC_OP_T_CPP - -#include "ace/Atomic_Op_T.h" -#include "ace/Log_Msg.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Atomic_Op_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op_Ex) -ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op) - -ACE_RCSID(ace, Atomic_Op_T, "$Id$") - -// ************************************************* -template ACE_LOCK & -ACE_Atomic_Op_Ex::mutex (void) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::mutex"); - return this->mutex_; -} - -template void -ACE_Atomic_Op_Ex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Atomic_Op_Ex::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->mutex_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex - (ACE_LOCK &mtx) - : mutex_ (mtx), - value_ (0) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); -} - -template -ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex - (ACE_LOCK &mtx, const TYPE &c) - : mutex_ (mtx), - value_ (c) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); -} - -// **************************************************************** - -template -ACE_Atomic_Op::ACE_Atomic_Op (void) - : impl_ (this->own_mutex_) -{ - // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); -} - -template -ACE_Atomic_Op::ACE_Atomic_Op (const TYPE &c) - : impl_ (this->own_mutex_, c) -{ - // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ATOMIC_OP_T_CPP */ diff --git a/ace/Atomic_Op_T.h b/ace/Atomic_Op_T.h deleted file mode 100644 index 549ee67274b..00000000000 --- a/ace/Atomic_Op_T.h +++ /dev/null @@ -1,254 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Atomic_Op_T.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ATOMIC_OP_T_H -#define ACE_ATOMIC_OP_T_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Atomic_Op_Ex - * - * @brief Transparently parameterizes synchronization into basic - * arithmetic operations. - * - * This class is described in an article in the July/August 1994 - * issue of the C++ Report magazine. It implements a - * templatized version of the Decorator pattern from the GoF book. - * - * ACE_Atomic_Op_Ex objects must be constructed with a reference - * to an existing lock. A single lock can be shared between - * multiple ACE_Atomic_Op_Ex objects. If you do not require this - * ability consider using the ACE_Atomic_Op class instead, which - * may be able to take advantage of platform-specific - * optimisations to provide atomic operations without requiring a - * lock. - */ -template -class ACE_Atomic_Op_Ex -{ -public: - // = Initialization methods. - - /// Initialize to 0. - ACE_Atomic_Op_Ex (ACE_LOCK &mtx); - - /// Initialize to c. - ACE_Atomic_Op_Ex (ACE_LOCK &mtx, const TYPE &c); - - // = Accessors. - - /// Atomically pre-increment . - TYPE operator++ (void); - - /// Atomically post-increment . - TYPE operator++ (int); - - /// Atomically increment by rhs. - TYPE operator+= (const TYPE &rhs); - - /// Atomically pre-decrement . - TYPE operator-- (void); - - /// Atomically post-decrement . - TYPE operator-- (int); - - /// Atomically decrement by rhs. - TYPE operator-= (const TYPE &rhs); - - /// Atomically compare with rhs. - bool operator== (const TYPE &rhs) const; - - /// Atomically compare with rhs. - bool operator!= (const TYPE &rhs) const; - - /// Atomically check if greater than or equal to rhs. - bool operator>= (const TYPE &rhs) const; - - /// Atomically check if greater than rhs. - bool operator> (const TYPE &rhs) const; - - /// Atomically check if less than or equal to rhs. - bool operator<= (const TYPE &rhs) const; - - /// Atomically check if less than rhs. - bool operator< (const TYPE &rhs) const; - - /// Atomically assign rhs to . - ACE_Atomic_Op_Ex &operator= (const TYPE &rhs); - - /// Atomically assign to . - ACE_Atomic_Op_Ex &operator= (const ACE_Atomic_Op_Ex &rhs); - - /// Explicitly return . - TYPE value (void) const; - - /// Dump the state of an object. - void dump (void) const; - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - - /// Manage copying... - ACE_Atomic_Op_Ex (const ACE_Atomic_Op_Ex &); - - /** - * Returns a reference to the underlying . This makes it - * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the with an - * ACE_Recursive_Mutex or ACE_Process_Mutex. @note the right - * name would be lock_, but HP/C++ will choke on that! - */ - ACE_LOCK &mutex (void); - - /** - * Explicitly return (by reference). This gives the user - * full, unrestricted access to the underlying value. This method - * will usually be used in conjunction with explicit access to the - * lock. Use with care ;-) - */ - TYPE &value_i (void); - -private: - /// Type of synchronization mechanism. - ACE_LOCK &mutex_; - - /// Current object decorated by the atomic op. - TYPE value_; -}; - -/** - * @class ACE_Atomic_Op - * - * @brief Transparently parameterizes synchronization into basic - * arithmetic operations. - * - * This class is described in an article in the July/August 1994 - * issue of the C++ Report magazine. It implements a - * templatized version of the Decorator pattern from the GoF book. - * - * Certain platforms may provide a template specialization for - * ACE_Atomic_Op that provides optimized - * atomic integer operations without actually requiring a mutex. - */ -template -class ACE_Atomic_Op -{ -public: - /// Initialize to 0. - ACE_Atomic_Op (void); - - /// Initialize to c. - ACE_Atomic_Op (const TYPE &c); - - /// Manage copying... - ACE_Atomic_Op (const ACE_Atomic_Op &c); - - /// Atomically assign rhs to . - ACE_Atomic_Op &operator= (const TYPE &rhs); - - /// Atomically assign to . - ACE_Atomic_Op &operator= (const ACE_Atomic_Op &rhs); - - /// Atomically pre-increment . - TYPE operator++ (void); - - /// Atomically post-increment . - TYPE operator++ (int); - - /// Atomically increment by rhs. - TYPE operator+= (const TYPE &rhs); - - /// Atomically pre-decrement . - TYPE operator-- (void); - - /// Atomically post-decrement . - TYPE operator-- (int); - - /// Atomically decrement by rhs. - TYPE operator-= (const TYPE &rhs); - - /// Atomically compare with rhs. - bool operator== (const TYPE &rhs) const; - - /// Atomically compare with rhs. - bool operator!= (const TYPE &rhs) const; - - /// Atomically check if greater than or equal to rhs. - bool operator>= (const TYPE &rhs) const; - - /// Atomically check if greater than rhs. - bool operator> (const TYPE &rhs) const; - - /// Atomically check if less than or equal to rhs. - bool operator<= (const TYPE &rhs) const; - - /// Atomically check if less than rhs. - bool operator< (const TYPE &rhs) const; - - /// Explicitly return . - TYPE value (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /** - * Returns a reference to the underlying . This makes it - * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the ACE_Atomic_Op with an - * ACE_Recursive_Mutex or ACE_Process_Mutex. - * - * @deprecated This member function is deprecated and so may go away in - * the future. If you need access to the underlying mutex, consider - * using the ACE_Atomic_Op_Ex template instead. - */ - ACE_LOCK &mutex (void); - - /** - * Explicitly return (by reference). This gives the user - * full, unrestricted access to the underlying value. This method - * will usually be used in conjunction with explicit access to the - * lock. Use with care ;-) - */ - TYPE &value_i (void); - -private: - /// Type of synchronization mechanism. - ACE_LOCK own_mutex_; - - /// Underlying atomic op implementation. - ACE_Atomic_Op_Ex impl_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Atomic_Op_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Atomic_Op_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Atomic_Op_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /*ACE_ATOMIC_OP_T_H*/ diff --git a/ace/Atomic_Op_T.inl b/ace/Atomic_Op_T.inl deleted file mode 100644 index 41b7ccd2af0..00000000000 --- a/ace/Atomic_Op_T.inl +++ /dev/null @@ -1,283 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Guard_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// -// ACE_Atomic_Op_Ex inline functions -// - -template ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator++ (void) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator++"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return ++this->value_; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator+= (const TYPE &rhs) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator+="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return this->value_ += rhs; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator-- (void) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator--"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return --this->value_; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator-= (const TYPE &rhs) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator-="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return this->value_ -= rhs; -} - -template ACE_INLINE -ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex (const ACE_Atomic_Op_Ex &rhs) - : mutex_ (rhs.mutex_) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); - *this = rhs; // Invoke the assignment operator. -} - -template ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator++ (int) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator++"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return this->value_++; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator-- (int) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator--"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return this->value_--; -} - -template ACE_INLINE bool -ACE_Atomic_Op_Ex::operator== (const TYPE &rhs) const -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator=="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); - return this->value_ == rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op_Ex::operator!= (const TYPE &rhs) const -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator!="); - return !(*this == rhs); -} - -template ACE_INLINE bool -ACE_Atomic_Op_Ex::operator>= (const TYPE &rhs) const -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator>="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); - return this->value_ >= rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op_Ex::operator> (const TYPE &rhs) const -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator>"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); - return this->value_ > rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op_Ex::operator<= (const TYPE &rhs) const -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator<="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); - return this->value_ <= rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op_Ex::operator< (const TYPE &rhs) const -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator<"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); - return this->value_ < rhs; -} - -template ACE_INLINE ACE_Atomic_Op_Ex & -ACE_Atomic_Op_Ex::operator= (const ACE_Atomic_Op_Ex &rhs) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator="); - if (&rhs == this) - return *this; // Avoid deadlock... - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this); - // This will call ACE_Atomic_Op_Ex::TYPE(), which will ensure the - // value of is acquired atomically. - - this->value_ = rhs.value (); - return *this; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op_Ex::value (void) const -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::value"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, this->value_); - return this->value_; -} - -template ACE_INLINE TYPE & -ACE_Atomic_Op_Ex::value_i (void) -{ - // Explicitly return (by reference). This gives the user - // full, unrestricted access to the underlying value. This method - // will usually be used in conjunction with explicit access to the - // lock. Use with care ;-) - return this->value_; -} - -template ACE_INLINE ACE_Atomic_Op_Ex & -ACE_Atomic_Op_Ex::operator= (const TYPE &rhs) -{ -// ACE_TRACE ("ACE_Atomic_Op_Ex::operator="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this); - this->value_ = rhs; - return *this; -} - -// -// ACE_Atomic_Op inline functions -// - -template ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op - (const ACE_Atomic_Op &rhs) - : impl_ (this->own_mutex_, rhs.value ()) -{ -// ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); -} - - -template ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= (const TYPE &i) -{ - this->impl_ = i; - return *this; -} - -template ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= (const ACE_Atomic_Op &rhs) -{ - this->impl_ = rhs.impl_; - return *this; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op::operator++ (void) -{ - return ++this->impl_; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op::operator++ (int) -{ - return this->impl_++; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op::operator+= (const TYPE &rhs) -{ - return this->impl_ += rhs; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op::operator-- (void) -{ - return --this->impl_; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op::operator-- (int) -{ - return this->impl_--; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op::operator-= (const TYPE &rhs) -{ - return this->impl_ -= rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op::operator== (const TYPE &rhs) const -{ - return this->impl_ == rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op::operator!= (const TYPE &rhs) const -{ - return this->impl_ != rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op::operator>= (const TYPE &rhs) const -{ - return this->impl_ >= rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op::operator> (const TYPE &rhs) const -{ - return this->impl_ > rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op::operator<= (const TYPE &rhs) const -{ - return this->impl_ <= rhs; -} - -template ACE_INLINE bool -ACE_Atomic_Op::operator< (const TYPE &rhs) const -{ - return this->impl_ < rhs; -} - -template ACE_INLINE TYPE -ACE_Atomic_Op::value (void) const -{ - return this->impl_.value (); -} - -template ACE_INLINE void -ACE_Atomic_Op::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->impl_.dump (); -#endif /* ACE_HAS_DUMP */ - return; -} - -template ACE_INLINE ACE_LOCK & -ACE_Atomic_Op::mutex (void) -{ - return this->own_mutex_; -} - -template ACE_INLINE TYPE & -ACE_Atomic_Op::value_i (void) -{ - return this->impl_.value_i (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_Event.cpp b/ace/Auto_Event.cpp deleted file mode 100644 index 9e106ac8119..00000000000 --- a/ace/Auto_Event.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// $Id$ - -#include "ace/Auto_Event.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Auto_Event.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - Auto_Event, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Auto_Event::ACE_Auto_Event (int initial_state, - int type, - const char *name, - void *arg) - : ACE_Event (0, - initial_state, - type, - ACE_TEXT_CHAR_TO_TCHAR (name), - arg) -{ -} - -#if defined (ACE_HAS_WCHAR) -ACE_Auto_Event::ACE_Auto_Event (int initial_state, - int type, - const wchar_t *name, - void *arg) - : ACE_Event (0, - initial_state, - type, - ACE_TEXT_WCHAR_TO_TCHAR (name), - arg) -{ -} -#endif /* ACE_HAS_WCHAR */ - -void -ACE_Auto_Event::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_Event::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_Event.h b/ace/Auto_Event.h deleted file mode 100644 index d7279a13150..00000000000 --- a/ace/Auto_Event.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Auto_Event.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_AUTO_EVENT_H -#define ACE_AUTO_EVENT_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Event.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Auto_Event - * - * @brief Auto Events. - * - * Specialization of Event mechanism which wakes up one waiting - * thread on . All platforms support process-scope locking - * support. However, only Win32 platforms support global naming and - * system-scope locking support. - */ -class ACE_Export ACE_Auto_Event : public ACE_Event -{ -public: - /// Constructor which will create auto event - ACE_Auto_Event (int initial_state = 0, - int type = USYNC_THREAD, - const char *name = 0, - void *arg = 0); - -#if defined (ACE_HAS_WCHAR) - /// Constructor which will create auto event (wchar_t version) - ACE_Auto_Event (int initial_state, - int type, - const wchar_t *name, - void *arg = 0); -#endif /* ACE_HAS_WCHAR */ - - /// Default dtor. - ~ACE_Auto_Event (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Auto_Event.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_AUTO_EVENT_H */ diff --git a/ace/Auto_Event.inl b/ace/Auto_Event.inl deleted file mode 100644 index 80048c29b99..00000000000 --- a/ace/Auto_Event.inl +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Auto_Event::~ACE_Auto_Event (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_Functor.cpp b/ace/Auto_Functor.cpp deleted file mode 100644 index 91dbad1952b..00000000000 --- a/ace/Auto_Functor.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - -#ifndef ACE_AUTO_FUNCTOR_CPP -#define ACE_AUTO_FUNCTOR_CPP - -#include "ace/Auto_Functor.h" - -#if !defined(__ACE_INLINE__) -# include "ace/Auto_Functor.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Utils::Auto_Functor::~Auto_Functor() - ACE_THROW_SPEC (()) -{ - reset(0); -} - -template void -ACE_Utils::Auto_Functor::reset(X * p) - ACE_THROW_SPEC (()) -{ - if(p_ != 0) - { - f_(p_); - } - p_ = p; -} - -templatevoid -ACE_Utils::Auto_Functor::reset(X * p, Functor f) - ACE_THROW_SPEC (()) -{ - reset(p); - f_ = f; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /*ACE_AUTO_FUNCTOR_CPP*/ diff --git a/ace/Auto_Functor.h b/ace/Auto_Functor.h deleted file mode 100644 index b9bcf8342b1..00000000000 --- a/ace/Auto_Functor.h +++ /dev/null @@ -1,145 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file Auto_Functor.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ -//============================================================================= -#ifndef ACE_AUTO_FUNCTOR_H -#define ACE_AUTO_FUNCTOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE_Utils -{ -/** - * @class Auto_Functor_Ref - * - * @brief Helper class to implement assignment and copy-construction - * as expected - */ -template -struct Auto_Functor_Ref -{ - X * p_; - Functor f_; - - Auto_Functor_Ref(X * p, Functor f); -}; - -/** - * @class Auto_Functor - * - * @brief Helper template to implement auto_ptr<>-like classes, but - * executing a functor in the destructor, instead of always - * deleting things. - * - * The functor is called in the destructor, and it must implement: - * - * Functor() throw();
- * Functor(Functor const &) throw();
- * Functor & operator=(Functor const &) throw();
- * void operator()(X * p) throw();
- * - */ -template -class Auto_Functor -{ -public: - typedef X element_type; - typedef Functor functor_type; - - /// Constructor - explicit Auto_Functor (X * p = 0, - Functor functor = Functor()) - ACE_THROW_SPEC (()); - - Auto_Functor (Auto_Functor & rhs) - ACE_THROW_SPEC (()); - - Auto_Functor& operator= (Auto_Functor & rhs) - ACE_THROW_SPEC (()); - -#if !defined(ACE_LACKS_MEMBER_TEMPLATES) - template - Auto_Functor(Auto_Functor& rhs) - ACE_THROW_SPEC (()); - - template - Auto_Functor& operator= (Auto_Functor& rhs) - ACE_THROW_SPEC (()); -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ - - ~Auto_Functor() - ACE_THROW_SPEC (()); - - X & operator*() const - ACE_THROW_SPEC (()); - - X * operator->() const - ACE_THROW_SPEC (()); - - X * get() - ACE_THROW_SPEC (()); - - X * release() - ACE_THROW_SPEC (()); - - void reset (X * p = 0) - ACE_THROW_SPEC (()); - - void reset (X * p, Functor f) - ACE_THROW_SPEC (()); - - Functor const & functor() const - ACE_THROW_SPEC (()); - - Auto_Functor(Auto_Functor_Ref rhs) - ACE_THROW_SPEC (()); - - Auto_Functor & operator=(Auto_Functor_Ref rhs) - ACE_THROW_SPEC (()); - -#if !defined(ACE_LACKS_MEMBER_TEMPLATES) - template operator Auto_Functor_Ref() - ACE_THROW_SPEC (()); - - template operator Auto_Functor() - ACE_THROW_SPEC (()); -#else - operator Auto_Functor_Ref() - ACE_THROW_SPEC (()); -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ - -private: - X * p_; - - Functor f_; -}; - -} // namespace ACE_Utils - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -# include "ace/Auto_Functor.inl" -#endif /* __ACE_INLINE__ */ - -#if defined(ACE_TEMPLATES_REQUIRE_SOURCE) -# include "ace/Auto_Functor.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#include /**/ "ace/post.h" -#endif /* ACE_AUTO_FUNCTOR_H*/ diff --git a/ace/Auto_Functor.inl b/ace/Auto_Functor.inl deleted file mode 100644 index 31c2dc25f97..00000000000 --- a/ace/Auto_Functor.inl +++ /dev/null @@ -1,149 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Utils::Auto_Functor_Ref:: -Auto_Functor_Ref(X * p, Functor f) - : p_(p) - , f_(f) -{ -} - -template ACE_INLINE -ACE_Utils::Auto_Functor::Auto_Functor(X * p, Functor f) - ACE_THROW_SPEC (()) - : p_(p) - , f_(f) -{ -} - -template ACE_INLINE -ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor & rhs) - ACE_THROW_SPEC (()) - : p_(rhs.release()) - , f_(rhs.f_) -{ -} - -template -ACE_INLINE ACE_Utils::Auto_Functor& -ACE_Utils::Auto_Functor:: operator=(Auto_Functor & rhs) - ACE_THROW_SPEC (()) -{ - reset(rhs.release()); - f_ = rhs.f_; - return *this; -} - -#if !defined(ACE_LACKS_MEMBER_TEMPLATES) -template template ACE_INLINE -ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor& rhs) - ACE_THROW_SPEC (()) - : p_(rhs.release()) - , f_(rhs.f_) -{ -} - -template template -ACE_INLINE ACE_Utils::Auto_Functor& -ACE_Utils::Auto_Functor::operator=(Auto_Functor& rhs) - ACE_THROW_SPEC (()) -{ - reset(rhs.release()); - return *this; -} -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ - -template ACE_INLINE X & -ACE_Utils::Auto_Functor::operator*() const - ACE_THROW_SPEC (()) -{ - return *p_; -} - -template -ACE_INLINE X * -ACE_Utils::Auto_Functor::operator->() const - ACE_THROW_SPEC (()) -{ - return p_; -} - -template -ACE_INLINE X * -ACE_Utils::Auto_Functor::get() - ACE_THROW_SPEC (()) -{ - return p_; -} - -template -ACE_INLINE X * -ACE_Utils::Auto_Functor::release() - ACE_THROW_SPEC (()) -{ - X * tmp = p_; - p_ = 0; - return tmp; -} - -template -ACE_INLINE Functor const & -ACE_Utils::Auto_Functor::functor() const - ACE_THROW_SPEC (()) -{ - return f_; -} - -template ACE_INLINE -ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor_Ref rhs) - ACE_THROW_SPEC (()) - : p_(rhs.p_) - , f_(rhs.f_) -{ -} - -template -ACE_INLINE ACE_Utils::Auto_Functor & -ACE_Utils::Auto_Functor::operator=(Auto_Functor_Ref rhs) - ACE_THROW_SPEC (()) -{ - if(rhs.p_ != p_) - { - reset(rhs.p_); - f_ = rhs.f_; - } - return *this; -} - -#if !defined(ACE_LACKS_MEMBER_TEMPLATES) - -template template ACE_INLINE -ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor_Ref() - ACE_THROW_SPEC (()) -{ - return ACE_Utils::Auto_Functor_Ref(release(), f_); -} - -template template ACE_INLINE -ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor() - ACE_THROW_SPEC (()) -{ - return ACE_Utils::Auto_Functor(release(), f_); -} - -#else - -templateACE_INLINE -ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor_Ref() - ACE_THROW_SPEC (()) -{ - return ACE_Utils::Auto_Functor_Ref(release(), f_); -} - -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_IncDec_T.cpp b/ace/Auto_IncDec_T.cpp deleted file mode 100644 index cf33efd7d6e..00000000000 --- a/ace/Auto_IncDec_T.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// $Id$ - -#ifndef ACE_AUTO_INCDEC_T_CPP -#define ACE_AUTO_INCDEC_T_CPP - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Auto_IncDec_T.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Auto_IncDec_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Auto_IncDec) - -template void -ACE_Auto_IncDec::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Auto_IncDec::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_AUTO_INCDEC_T_CPP */ diff --git a/ace/Auto_IncDec_T.h b/ace/Auto_IncDec_T.h deleted file mode 100644 index 2aeefe27247..00000000000 --- a/ace/Auto_IncDec_T.h +++ /dev/null @@ -1,91 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Auto_IncDec_T.h - * - * $Id$ - * - * @author Edan Ayal - */ -//============================================================================= - - -#ifndef ACE_AUTO_INCDEC_T_H -#define ACE_AUTO_INCDEC_T_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Auto_IncDec - * - * @brief This class automatically increments and decrements a - * parameterized counter. - * - * This data structure is meant to be used within a method, - * function, or scope. The actual parameter given for the - * template parameter - * must provide at least operators ++ and --. - */ -template -class ACE_Auto_IncDec -{ -public: - - /// Implicitly increment the counter. - ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter); - - /// Implicitly decrement the counter. - ~ACE_Auto_IncDec (void); - - /// Dump the state of an object. - void dump (void) const; - -protected: - /// Reference to the counter - /// we're incrementing/decrementing. - ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter_; - -private: - // = Prevent assignment and initialization. - ACE_UNIMPLEMENTED_FUNC (void operator= (const - ACE_Auto_IncDec &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Auto_IncDec (const - ACE_Auto_IncDec &)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Auto_IncDec_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Auto_IncDec_T.cpp" -// On Win32 platforms, this code will be included as template source -// code and will not be inlined. Therefore, we first turn off -// ACE_INLINE, set it to be nothing, include the code, and then turn -// ACE_INLINE back to its original setting. All this nonsense is -// necessary, since the generic template code that needs to be -// specialized cannot be inlined, else the compiler will ignore the -// specialization code. Also, the specialization code *must* be -// inlined or the compiler will ignore the specializations. -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Auto_IncDec_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_AUTO_INCDEC_T_H */ diff --git a/ace/Auto_IncDec_T.inl b/ace/Auto_IncDec_T.inl deleted file mode 100644 index 51daac0e84d..00000000000 --- a/ace/Auto_IncDec_T.inl +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Implicitly and automatically increment the counter. - -template ACE_INLINE -ACE_Auto_IncDec::ACE_Auto_IncDec - (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter) - : counter_ (counter) -{ - ++this->counter_; -} - -// Implicitly and automatically decrement the counter. - -template ACE_INLINE -ACE_Auto_IncDec::~ACE_Auto_IncDec (void) -{ - --this->counter_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_Ptr.cpp b/ace/Auto_Ptr.cpp deleted file mode 100644 index 081744ce316..00000000000 --- a/ace/Auto_Ptr.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// $Id$ - -#ifndef ACE_AUTO_PTR_CPP -#define ACE_AUTO_PTR_CPP - -#include "ace/Auto_Ptr.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Auto_Ptr.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, Auto_Ptr, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Ptr) -ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Array_Ptr) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_AUTO_PTR_CPP */ diff --git a/ace/Auto_Ptr.h b/ace/Auto_Ptr.h deleted file mode 100644 index 5fe2908937f..00000000000 --- a/ace/Auto_Ptr.h +++ /dev/null @@ -1,217 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Auto_Ptr.h - * - * $Id$ - * - * @author Doug Schmidt - * @author Irfan Pyarali - * @author Jack Reeves - * @author Dr. Harald M. Mueller - */ -//============================================================================= - -#ifndef ACE_AUTO_PTR_H -#define ACE_AUTO_PTR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (_MSC_VER) -// Suppress warning e.g. "return type for -// 'ACE_Auto_Array_Pointer::operator ->' is 'type *' (i.e., not a UDT -// or reference to a UDT. Will produce errors if applied using infix -// notation)" -# pragma warning(push) -# pragma warning(disable: 4284) -#endif /* _MSC_VER */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Auto_Basic_Ptr - * - * @brief Implements the draft C++ standard auto_ptr abstraction. - * This class allows one to work on non-object (basic) types - */ -template -class ACE_Auto_Basic_Ptr -{ -public: - // = Initialization and termination methods - explicit ACE_Auto_Basic_Ptr (X *p = 0) : p_ (p) {} - - ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr &ap); - ACE_Auto_Basic_Ptr &operator= (ACE_Auto_Basic_Ptr &rhs); - ~ACE_Auto_Basic_Ptr (void); - - // = Accessor methods. - X &operator *() const; - X *get (void) const; - X *release (void); - void reset (X *p = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - X *p_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if !defined (ACE_LACKS_AUTO_PTR) && \ - defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ - (ACE_HAS_STANDARD_CPP_LIBRARY != 0) -#include -#if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) -using std::auto_ptr; -#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ -#else /* ACE_HAS_STANDARD_CPP_LIBRARY */ - -/** - * @class auto_ptr - * - * @brief Implements the draft C++ standard auto_ptr abstraction. - */ -template -class auto_ptr : public ACE_Auto_Basic_Ptr -{ -public: - // = Initialization and termination methods - explicit auto_ptr (X *p = 0) : ACE_Auto_Basic_Ptr (p) {} - auto_ptr (auto_ptr &ap) : ACE_Auto_Basic_Ptr (ap.release()) {} - - X *operator-> () const; -}; - -#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @brief Implements the draft C++ standard auto_ptr abstraction. - * This version can be used instead of auto_ptr, and obviates - * the need for the ACE_AUTO_PTR_RESET macro on platforms like - * VC6 where the auto_ptr is broken. - */ -template -class ACE_Auto_Ptr : public ACE_Auto_Basic_Ptr -{ -public: - // = Initialization and termination methods - explicit ACE_Auto_Ptr (X *p = 0) : ACE_Auto_Basic_Ptr (p) {} - - X *operator-> () const; -}; - -/** - * @class ACE_Auto_Basic_Array_Ptr - * - * @brief Implements an extension to the draft C++ standard auto_ptr - * abstraction. This class allows one to work on non-object - * (basic) types that must be treated as an array, e.g., - * deallocated via "delete [] foo". - */ -template -class ACE_Auto_Basic_Array_Ptr -{ -public: - // = Initialization and termination methods. - explicit ACE_Auto_Basic_Array_Ptr (X *p = 0) : p_ (p) {} - - ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr &ap); - ACE_Auto_Basic_Array_Ptr &operator= (ACE_Auto_Basic_Array_Ptr &rhs); - ~ACE_Auto_Basic_Array_Ptr (void); - - // = Accessor methods. - X &operator* () const; - X &operator[] (int i) const; - X *get (void) const; - X *release (void); - void reset (X *p = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - X *p_; -}; - -/** - * @class ACE_Auto_Array_Ptr - * - * @brief Implements an extension to the draft C++ standard auto_ptr - * abstraction. - */ -template -class ACE_Auto_Array_Ptr : public ACE_Auto_Basic_Array_Ptr -{ -public: - // = Initialization and termination methods. - explicit ACE_Auto_Array_Ptr (X *p = 0) - : ACE_Auto_Basic_Array_Ptr (p) {} - - X *operator-> () const; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Some platforms have an older version of auto_ptr -// support, which lacks reset, and cannot be disabled -// easily. Portability to these platforms requires -// use of the following ACE_AUTO_PTR_RESET macro. -// -// Note that this macro correctly handles the case where NEWPTR may be -// a call to operator new(), e.g. "new foo", by making sure it is only -// evaluated once. -# if defined (ACE_AUTO_PTR_LACKS_RESET) -# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \ - do { \ - TYPE * tmp_ptr = NEWPTR; \ - if (tmp_ptr != AUTOPTR.get ()) \ - { \ - delete AUTOPTR.release (); \ - AUTOPTR = auto_ptr (tmp_ptr); \ - } \ - } while (0) -# else /* ! ACE_AUTO_PTR_LACKS_RESET */ -# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \ - do { \ - AUTOPTR.reset (NEWPTR); \ - } while (0) -# endif /* ACE_AUTO_PTR_LACKS_RESET */ - -#if defined (__ACE_INLINE__) -#include "ace/Auto_Ptr.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Auto_Ptr.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Auto_Ptr.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#if defined (_MSC_VER) -// Restore the warning state to what it was before entry. -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include /**/ "ace/post.h" -#endif /* ACE_AUTO_PTR_H */ diff --git a/ace/Auto_Ptr.inl b/ace/Auto_Ptr.inl deleted file mode 100644 index 57adb236261..00000000000 --- a/ace/Auto_Ptr.inl +++ /dev/null @@ -1,171 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE void -ACE_Auto_Basic_Ptr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Auto_Basic_Ptr::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE void -ACE_Auto_Basic_Array_Ptr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Auto_Basic_Ptr::ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr &rhs) - : p_ (rhs.release ()) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::ACE_Auto_Basic_Ptr"); -} - -template ACE_INLINE X * -ACE_Auto_Basic_Ptr::get (void) const -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::get"); - return this->p_; -} - -template ACE_INLINE X * -ACE_Auto_Basic_Ptr::release (void) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::release"); - X *old = this->p_; - this->p_ = 0; - return old; -} - -template ACE_INLINE void -ACE_Auto_Basic_Ptr::reset (X *p) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::reset"); - if (this->get () != p) - delete this->get (); - this->p_ = p; -} - -template ACE_INLINE ACE_Auto_Basic_Ptr & -ACE_Auto_Basic_Ptr::operator= (ACE_Auto_Basic_Ptr &rhs) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::operator="); - if (this != &rhs) - { - this->reset (rhs.release ()); - } - return *this; -} - -template ACE_INLINE -ACE_Auto_Basic_Ptr::~ACE_Auto_Basic_Ptr (void) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::~ACE_Auto_Basic_Ptr"); - delete this->get (); -} - -template ACE_INLINE X & -ACE_Auto_Basic_Ptr::operator *() const -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::operator *()"); - return *this->get (); -} - -#if defined (ACE_LACKS_AUTO_PTR) || \ - !defined (ACE_HAS_STANDARD_CPP_LIBRARY) || \ - (ACE_HAS_STANDARD_CPP_LIBRARY == 0) - -template ACE_INLINE X * -auto_ptr::operator-> () const -{ - ACE_TRACE ("auto_ptr::operator->"); - return this->get (); -} - -#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ - -template ACE_INLINE X * -ACE_Auto_Ptr::operator-> () const -{ - ACE_TRACE ("ACE_Auto_Ptr::operator->"); - return this->get (); -} - -template ACE_INLINE X * -ACE_Auto_Basic_Array_Ptr::get (void) const -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::get"); - return this->p_; -} - -template ACE_INLINE X * -ACE_Auto_Basic_Array_Ptr::release (void) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::release"); - X *old = this->p_; - this->p_ = 0; - return old; -} - -template ACE_INLINE void -ACE_Auto_Basic_Array_Ptr::reset (X *p) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::reset"); - if (this->get () != p) - delete [] this->get (); - this->p_ = p; -} - -template ACE_INLINE -ACE_Auto_Basic_Array_Ptr::ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr &rhs) - : p_ (rhs.release ()) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::ACE_Auto_Basic_Array_Ptr"); -} - -template ACE_INLINE ACE_Auto_Basic_Array_Ptr & -ACE_Auto_Basic_Array_Ptr::operator= (ACE_Auto_Basic_Array_Ptr &rhs) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::operator="); - if (this != &rhs) - { - this->reset (rhs.release ()); - } - return *this; -} - -template ACE_INLINE -ACE_Auto_Basic_Array_Ptr::~ACE_Auto_Basic_Array_Ptr (void) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::~ACE_Auto_Basic_Array_Ptr"); - delete [] this->get (); -} - -template ACE_INLINE X & -ACE_Auto_Basic_Array_Ptr::operator *() const -{ - return *this->get (); -} - -template ACE_INLINE X & -ACE_Auto_Basic_Array_Ptr::operator[](int i) const -{ - X *array = this->get (); - return array[i]; -} - -template ACE_INLINE X * -ACE_Auto_Array_Ptr::operator->() const -{ - return this->get (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Barrier.cpp b/ace/Barrier.cpp deleted file mode 100644 index 739e249cd76..00000000000 --- a/ace/Barrier.cpp +++ /dev/null @@ -1,197 +0,0 @@ -// $Id$ - -#include "ace/Barrier.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/Barrier.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Guard_T.h" -#include "ace/OS_NS_errno.h" - -#if defined (ACE_HAS_DUMP) -# include "ace/Log_Msg.h" -#endif /* ACE_HAS_DUMP */ - -ACE_RCSID (ace, - Barrier, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Sub_Barrier) - -void -ACE_Sub_Barrier::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Sub_Barrier::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->barrier_finished_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("running_threads_ = %d"), this->running_threads_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Sub_Barrier::ACE_Sub_Barrier (unsigned int count, - ACE_Thread_Mutex &lock, - const ACE_TCHAR *name, - void *arg) - : barrier_finished_ (lock, name, arg), - running_threads_ (count) -{ -// ACE_TRACE ("ACE_Sub_Barrier::ACE_Sub_Barrier"); -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Barrier) - -void -ACE_Barrier::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Barrier::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("current_generation_ = %d"), this->current_generation_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncount_ = %d"), this->count_)); - this->sub_barrier_1_.dump (); - this->sub_barrier_2_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Barrier::ACE_Barrier (unsigned int count, - const ACE_TCHAR *name, - void *arg) - : lock_ (name, (ACE_mutexattr_t *) arg), - current_generation_ (0), - count_ (count), - sub_barrier_1_ (count, lock_, name, arg), - sub_barrier_2_ (count, lock_, name, arg) -{ - ACE_TRACE ("ACE_Barrier::ACE_Barrier"); - this->sub_barrier_[0] = &this->sub_barrier_1_; - this->sub_barrier_[1] = &this->sub_barrier_2_; -} - -int -ACE_Barrier::wait (void) -{ - ACE_TRACE ("ACE_Barrier::wait"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - - ACE_Sub_Barrier *sbp = - this->sub_barrier_[this->current_generation_]; - - // Check for shutdown... - if (sbp == 0) - { - errno = ESHUTDOWN; - return -1; - } - - int retval = 0; - - if (sbp->running_threads_ == 1) - { - // We're the last running thread, so swap generations and tell - // all the threads waiting on the barrier to continue on their - // way. - sbp->running_threads_ = this->count_; - // Swap generations. - this->current_generation_ = 1 - this->current_generation_; - sbp->barrier_finished_.broadcast (); - } - else - { - --sbp->running_threads_; - - // Block until all the other threads wait(). - while (sbp->running_threads_ != this->count_) - sbp->barrier_finished_.wait (); - - // We're awake and the count has completed. See if it completed - // because all threads hit the barrier, or because the barrier - // was shut down. - if (this->sub_barrier_[this->current_generation_] == 0) - { - errno = ESHUTDOWN; - retval = -1; - } - } - - return retval; -} - -int -ACE_Barrier::shutdown (void) -{ - ACE_TRACE ("ACE_Barrier::shutdown"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - - ACE_Sub_Barrier *sbp = - this->sub_barrier_[this->current_generation_]; - - // Check for shutdown... - if (sbp == 0) - { - errno = ESHUTDOWN; - return -1; - } - - // Flag the shutdown - this->sub_barrier_[0] = 0; - this->sub_barrier_[1] = 0; - // Tell all the threads waiting on the barrier to continue on their way. - sbp->running_threads_ = this->count_; - sbp->barrier_finished_.broadcast (); - - return 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Barrier) - -ACE_Thread_Barrier::ACE_Thread_Barrier (unsigned int count, - const ACE_TCHAR *name) - : ACE_Barrier (count, name) -{ -// ACE_TRACE ("ACE_Thread_Barrier::ACE_Thread_Barrier"); -} - -void -ACE_Thread_Barrier::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Thread_Barrier::dump"); - ACE_Barrier::dump (); -#endif /* ACE_HAS_DUMP */ -} - -#if 0 -ACE_ALLOC_HOOK_DEFINE(ACE_Process_Barrier) - -ACE_Process_Barrier::ACE_Process_Barrier (u_int count, - const ACE_TCHAR *name) - : ACE_Barrier (count, USYNC_PROCESS, name) -{ -// ACE_TRACE ("ACE_Process_Barrier::ACE_Process_Barrier"); -} - -void -ACE_Process_Barrier::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Process_Barrier::dump"); - ACE_Barrier::dump (); -#endif /* ACE_HAS_DUMP */ -} -#endif /* 0 */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/Barrier.h b/ace/Barrier.h deleted file mode 100644 index 7939aed1d24..00000000000 --- a/ace/Barrier.h +++ /dev/null @@ -1,214 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Barrier.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_BARRIER_H -#define ACE_BARRIER_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/config-all.h" - -// ACE platform supports some form of threading. -#if !defined (ACE_HAS_THREADS) - -#include "ace/OS_NS_errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Barrier - * - * @brief This is a no-op to make ACE "syntactically consistent." - */ -class ACE_Export ACE_Barrier -{ -public: - ACE_Barrier (unsigned int, const ACE_TCHAR * = 0, void * = 0) {} - ~ACE_Barrier (void) {} - int wait (void) { ACE_NOTSUP_RETURN (-1); } - void dump (void) const {} -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#else /* ACE_HAS_THREADS */ - -#include "ace/Condition_Thread_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -struct ACE_Export ACE_Sub_Barrier -{ - // = Initialization. - ACE_Sub_Barrier (unsigned int count, - ACE_Thread_Mutex &lock, - const ACE_TCHAR *name = 0, - void *arg = 0); - - ~ACE_Sub_Barrier (void); - - /// True if this generation of the barrier is done. - ACE_Condition_Thread_Mutex barrier_finished_; - - /// Number of threads that are still running. - int running_threads_; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Barrier - * - * @brief Implements "barrier synchronization". - * - * This class allows number of threads to synchronize - * their completion of (one round of) a task, which is known as - * "barrier synchronization". After all the threads call - * on the barrier they are all atomically released and can begin a new - * round. - * - * This implementation uses a "sub-barrier generation numbering" - * scheme to avoid overhead and to ensure that all threads wait to - * leave the barrier correct. This code is based on an article from - * SunOpsis Vol. 4, No. 1 by Richard Marejka - * (Richard.Marejka@canada.sun.com). - */ -class ACE_Export ACE_Barrier -{ -public: - /// Initialize the barrier to synchronize @a count threads. - ACE_Barrier (unsigned int count, - const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Default dtor. - ~ACE_Barrier (void); - - /// Block the caller until all @c count threads have called @c wait and - /// then allow all the caller threads to continue in parallel. - /// - /// @retval 0 after successfully waiting for all threads to wait. -1 if - /// an error occurs or the barrier is shut down (@sa shutdown ()). - int wait (void); - - /// Shut the barrier down, aborting the wait of all waiting threads. - /// Any threads waiting on the barrier when it is shut down will return with - /// value -1, errno ESHUTDOWN. - /// - /// @retval 0 for success, -1 if already shut down. - /// - /// @since ACE beta 5.4.9. - int shutdown (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Serialize access to the barrier state. - ACE_Thread_Mutex lock_; - - /// Either 0 or 1, depending on whether we are the first generation - /// of waiters or the next generation of waiters. - int current_generation_; - - /// Total number of threads that can be waiting at any one time. - int count_; - - /** - * We keep two @c sub_barriers, one for the first "generation" of - * waiters, and one for the next "generation" of waiters. This - * efficiently solves the problem of what to do if all the first - * generation waiters don't leave the barrier before one of the - * threads calls wait() again (i.e., starts up the next generation - * barrier). - */ - ACE_Sub_Barrier sub_barrier_1_; - ACE_Sub_Barrier sub_barrier_2_; - ACE_Sub_Barrier *sub_barrier_[2]; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Barrier &); - ACE_Barrier (const ACE_Barrier &); -}; - -#if 0 -/** - * @class ACE_Process_Barrier - * - * @brief Implements "barrier synchronization" using ACE_Process_Mutexes! - * - * This class is just a simple wrapper for ACE_Barrier that - * selects the USYNC_PROCESS variant for the locks. - */ -class ACE_Export ACE_Process_Barrier : public ACE_Barrier -{ -public: - /// Create a Process_Barrier, passing in the optional . - ACE_Process_Barrier (unsigned int count, const ACE_TCHAR *name = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; -#endif /* 0 */ - -/** - * @class ACE_Thread_Barrier - * - * @brief Implements "barrier synchronization" using ACE_Thread_Mutexes! - * - * This class is just a simple wrapper for ACE_Barrier that - * selects the USYNC_THREAD variant for the locks. - */ -class ACE_Export ACE_Thread_Barrier : public ACE_Barrier -{ -public: - /// Create a Thread_Barrier, passing in the optional @a name. - ACE_Thread_Barrier (unsigned int count, const ACE_TCHAR *name = 0); - - /// Default dtor. - ~ACE_Thread_Barrier (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Barrier.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_BARRIER_H */ diff --git a/ace/Barrier.inl b/ace/Barrier.inl deleted file mode 100644 index 9ab5c9fb111..00000000000 --- a/ace/Barrier.inl +++ /dev/null @@ -1,22 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Sub_Barrier::~ACE_Sub_Barrier (void) -{ -} - -ACE_INLINE -ACE_Barrier::~ACE_Barrier (void) -{ -} - -ACE_INLINE -ACE_Thread_Barrier::~ACE_Thread_Barrier (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Base_Thread_Adapter.cpp b/ace/Base_Thread_Adapter.cpp deleted file mode 100644 index 2ba31a4328e..00000000000 --- a/ace/Base_Thread_Adapter.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// $Id$ - -#include "ace/Base_Thread_Adapter.h" - -ACE_RCSID (ace, - Base_Thread_Adapter, - "$Id$") - -#if !defined (ACE_HAS_INLINED_OSCALLS) -# include "ace/Base_Thread_Adapter.inl" -#endif /* ACE_HAS_INLINED_OSCALLS */ - -#if defined (ACE_HAS_TSS_EMULATION) -# include "ace/OS_NS_Thread.h" -#endif /* ACE_HAS_TSS_EMULATION */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::init_log_msg_hook_ = 0; -ACE_INHERIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = 0; -ACE_CLOSE_LOG_MSG_HOOK ACE_Base_Thread_Adapter::close_log_msg_hook_ = 0; -ACE_SYNC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::sync_log_msg_hook_ = 0; -ACE_THR_DESC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = 0; - -ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter ( - ACE_THR_FUNC user_func, - void *arg, - ACE_THR_C_FUNC entry_point, - ACE_OS_Thread_Descriptor *td -#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector - , ACE_SEH_EXCEPT_HANDLER handler -#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ) - : user_func_ (user_func) - , arg_ (arg) - , entry_point_ (entry_point) - , thr_desc_ (td) -{ - ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter"); - - if (ACE_Base_Thread_Adapter::init_log_msg_hook_ != 0) - (*ACE_Base_Thread_Adapter::init_log_msg_hook_) ( - this->log_msg_attributes_ -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , selector - , handler -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ); -#ifdef ACE_USES_GPROF - getitimer (ITIMER_PROF, &itimer_); -#endif // ACE_USES_GPROF -} - -ACE_Base_Thread_Adapter::~ACE_Base_Thread_Adapter (void) -{ -} - -void -ACE_Base_Thread_Adapter::inherit_log_msg (void) -{ - if (ACE_Base_Thread_Adapter::inherit_log_msg_hook_ != 0) - (*ACE_Base_Thread_Adapter::inherit_log_msg_hook_)( - this->thr_desc_, - this->log_msg_attributes_); -} - -void -ACE_Base_Thread_Adapter::close_log_msg (void) -{ - if (ACE_Base_Thread_Adapter::close_log_msg_hook_ != 0) - (*ACE_Base_Thread_Adapter::close_log_msg_hook_) (); -} - -void -ACE_Base_Thread_Adapter::sync_log_msg (const ACE_TCHAR *prg) -{ - if (ACE_Base_Thread_Adapter::sync_log_msg_hook_ != 0) - (*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg); -} - -ACE_OS_Thread_Descriptor * -ACE_Base_Thread_Adapter::thr_desc_log_msg (void) -{ - if (ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ != 0) - return (*ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_) (); - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Run the thread entry point for the . This must -// be an extern "C" to make certain compilers happy... - -extern "C" ACE_THR_FUNC_RETURN -ACE_THREAD_ADAPTER_NAME (void *args) -{ - ACE_OS_TRACE ("ACE_THREAD_ADAPTER_NAME"); - -#if defined (ACE_HAS_TSS_EMULATION) - // As early as we can in the execution of the new thread, allocate - // its local TS storage. Allocate it on the stack, to save dynamic - // allocation/dealloction. - void *ts_storage[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX]; - ACE_TSS_Emulation::tss_open (ts_storage); -#endif /* ACE_HAS_TSS_EMULATION */ - - ACE_Base_Thread_Adapter * const thread_args = - static_cast (args); - -#ifdef ACE_USES_GPROF - setitimer (ITIMER_PROF, thread_args->timerval (), 0); -#endif // ACE_USES_GPROF - - // Invoke the user-supplied function with the args. - ACE_THR_FUNC_RETURN status = thread_args->invoke (); - - return status; -} - diff --git a/ace/Base_Thread_Adapter.h b/ace/Base_Thread_Adapter.h deleted file mode 100644 index 98ba0473a40..00000000000 --- a/ace/Base_Thread_Adapter.h +++ /dev/null @@ -1,186 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Base_Thread_Adapter.h - * - * $Id$ - * - * @author Nanbor Wang - */ -//============================================================================= - -#ifndef ACE_BASE_THREAD_ADAPTER_H -#define ACE_BASE_THREAD_ADAPTER_H -#include /**/ "ace/pre.h" - -#include "ace/OS_Log_Msg_Attributes.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/ACE_export.h" -#include "ace/OS_Log_Msg_Attributes.h" - -#ifdef ACE_USES_GPROF -#include "os_include/sys/os_time.h" -#endif // ACE_USES_GPROF - -#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) -# define ACE_THREAD_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_thread_adapter) -#else -# define ACE_THREAD_ADAPTER_NAME ace_thread_adapter -#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ - -// Run the thread entry point for the ACE_Thread_Adapter. This must -// be an extern "C" to make certain compilers happy... - -extern "C" ACE_Export ACE_THR_FUNC_RETURN ACE_THREAD_ADAPTER_NAME (void *args); - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_OS_Thread_Descriptor - * - * @brief Parent class of all ACE_Thread_Descriptor classes. - * = - * Container for ACE_Thread_Descriptor members that are - * used in ACE_OS. - */ -class ACE_Export ACE_OS_Thread_Descriptor -{ -public: - /// Get the thread creation flags. - long flags (void) const; - -protected: - /// For use by ACE_Thread_Descriptor. - ACE_OS_Thread_Descriptor (long flags = 0); - - /** - * Keeps track of whether this thread was created "detached" or not. - * If a thread is *not* created detached then if someone calls - * , we need to join with that thread (and - * close down the handle). - */ - long flags_; -}; - -/** - * @class ACE_Base_Thread_Adapter - * - * @brief Base class for all the Thread_Adapters. - * - * Converts a C++ function into a function that can be - * called from a thread creation routine - * (e.g., pthread_create() or _beginthreadex()) that expects an - * extern "C" entry point. This class also makes it possible to - * transparently provide hooks to register a thread with an - * ACE_Thread_Manager. - * This class is used in ACE_OS::thr_create(). In general, the - * thread that creates an object of this class is different from - * the thread that calls @c invoke() on this object. Therefore, - * the @c invoke() method is responsible for deleting itself. - */ -class ACE_Export ACE_Base_Thread_Adapter -{ -public: - - virtual ~ACE_Base_Thread_Adapter (void); - - /// Virtual method invoked by the thread entry point. - virtual ACE_THR_FUNC_RETURN invoke (void) = 0; - - /// Accessor for the C entry point function to the OS thread creation - /// routine. - ACE_THR_C_FUNC entry_point (void); - -#ifdef ACE_USES_GPROF - /// Accessor to the itimer_ - /// followed http://sam.zoy.org/writings/programming/gprof.html - struct itimerval* timerval (void); -#endif // ACE_USES_PROF - - /// Invoke the close_log_msg_hook, if it is present - static void close_log_msg (void); - - /// Invoke the sync_log_msg_hook, if it is present - static void sync_log_msg (const ACE_TCHAR *prog_name); - - /// Invoke the thr_desc_log_msg_hook, if it is present - static ACE_OS_Thread_Descriptor *thr_desc_log_msg (void); - -protected: - /// Constructor. - ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func, - void *arg, - ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, - ACE_OS_Thread_Descriptor *td = 0 -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector = 0 - , ACE_SEH_EXCEPT_HANDLER handler = 0 -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ); - /// Inherit the logging features if the parent thread has an - /// ACE_Log_Msg. - void inherit_log_msg (void); - -private: - /// The hooks to inherit and cleanup the Log_Msg attributes - static ACE_INIT_LOG_MSG_HOOK init_log_msg_hook_; - static ACE_INHERIT_LOG_MSG_HOOK inherit_log_msg_hook_; - static ACE_CLOSE_LOG_MSG_HOOK close_log_msg_hook_; - static ACE_SYNC_LOG_MSG_HOOK sync_log_msg_hook_; - static ACE_THR_DESC_LOG_MSG_HOOK thr_desc_log_msg_hook_; - - /// Set the Log_Msg hooks - static void set_log_msg_hooks (ACE_INIT_LOG_MSG_HOOK init_hook, - ACE_INHERIT_LOG_MSG_HOOK inherit_hook, - ACE_CLOSE_LOG_MSG_HOOK close_hook, - ACE_SYNC_LOG_MSG_HOOK sync_hook, - ACE_THR_DESC_LOG_MSG_HOOK thr_desc); - - /// Allow the ACE_Log_Msg class to set its hooks. - friend class ACE_Log_Msg; - -protected: - /// Thread startup function passed in by the user (C++ linkage). - ACE_THR_FUNC user_func_; - - /// Argument to thread startup function. - void *arg_; - - /// Entry point to the underlying OS thread creation call (C - /// linkage). - ACE_THR_C_FUNC entry_point_; - - /** - * Optional thread descriptor. Passing this pointer in will force - * the spawned thread to cache this location in and wait - * until fills in all information in thread - * descriptor. - */ - ACE_OS_Thread_Descriptor *thr_desc_; - - /// The ACE_Log_Msg attributes. - ACE_OS_Log_Msg_Attributes log_msg_attributes_; - /// That is usefull for gprof, define itimerval -#ifdef ACE_USES_GPROF - struct itimerval itimer_; -#endif // ACE_USES_GPROF - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_HAS_INLINED_OSCALLS) -# if defined (ACE_INLINE) -# undef ACE_INLINE -# endif /* ACE_INLINE */ -# define ACE_INLINE inline -# include "ace/Base_Thread_Adapter.inl" -# endif /* ACE_HAS_INLINED_OSCALLS */ - -#include /**/ "ace/post.h" -#endif /* ACE_BASE_THREAD_ADAPTER_H */ diff --git a/ace/Base_Thread_Adapter.inl b/ace/Base_Thread_Adapter.inl deleted file mode 100644 index 7fa3959034b..00000000000 --- a/ace/Base_Thread_Adapter.inl +++ /dev/null @@ -1,48 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE long -ACE_OS_Thread_Descriptor::flags (void) const -{ - return flags_; -} - -ACE_INLINE -ACE_OS_Thread_Descriptor::ACE_OS_Thread_Descriptor (long flags) - : flags_ (flags) -{ -} - -ACE_INLINE void -ACE_Base_Thread_Adapter::set_log_msg_hooks ( - ACE_INIT_LOG_MSG_HOOK init_hook, - ACE_INHERIT_LOG_MSG_HOOK inherit_hook, - ACE_CLOSE_LOG_MSG_HOOK close_hook, - ACE_SYNC_LOG_MSG_HOOK sync_hook, - ACE_THR_DESC_LOG_MSG_HOOK thr_desc_hook) -{ - ACE_Base_Thread_Adapter::init_log_msg_hook_ = init_hook; - ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = inherit_hook; - ACE_Base_Thread_Adapter::close_log_msg_hook_ = close_hook; - ACE_Base_Thread_Adapter::sync_log_msg_hook_ = sync_hook; - ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = thr_desc_hook; -} - -ACE_INLINE ACE_THR_C_FUNC -ACE_Base_Thread_Adapter::entry_point (void) -{ - return this->entry_point_; -} - -#ifdef ACE_USES_GPROF -ACE_INLINE itimerval* -ACE_Base_Thread_Adapter::timerval (void) -{ - return &(this->itimer_); -} -#endif // ACE_USES_GPROF - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Based_Pointer_Repository.cpp b/ace/Based_Pointer_Repository.cpp deleted file mode 100644 index 74ea8994c6d..00000000000 --- a/ace/Based_Pointer_Repository.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// $Id$ - -#include "ace/Map_Manager.h" -#include "ace/Based_Pointer_Repository.h" -#include "ace/Guard_T.h" -#include "ace/Null_Mutex.h" -#include "ace/Synch_Traits.h" -#include "ace/RW_Thread_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Based_Pointer_Repository_Rep - * - * @brief Implementation for the ACE_Based_Pointer_Repository. - * - * Every memory pool in ACE binds it's mapping base address and - * the mapped size to this repository every time it maps/remaps a - * new chunk of memory successfully. - */ -class ACE_Based_Pointer_Repository_Rep -{ -public: - // Useful typedefs. - typedef ACE_Map_Manager MAP_MANAGER; - typedef ACE_Map_Iterator < void *, size_t, ACE_Null_Mutex> MAP_ITERATOR; - typedef ACE_Map_Entry MAP_ENTRY; - - /// Keeps track of the mapping between addresses and their associated - /// values. - MAP_MANAGER addr_map_; - - /// Synchronize concurrent access to the map. - ACE_SYNCH_MUTEX lock_; -}; - -ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository (void) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository"); - ACE_NEW (this->rep_, - ACE_Based_Pointer_Repository_Rep); -} - -ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository (void) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository"); - delete this->rep_; -} - -// Search for appropriate base address in repository - -int -ACE_Based_Pointer_Repository::find (void *addr, - void *&base_addr) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::find"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); - ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0; - - for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_); - iter.next (ce) != 0; - iter.advance ()) - // Check to see if is within any of the regions. - if (addr >= ce->ext_id_ - && addr < ((char *) ce->ext_id_ + ce->int_id_)) - { - // Assign the base address. - base_addr = ce->ext_id_; - return 1; - } - - // Assume base address 0 (e.g., if new'ed). - base_addr = 0; - return 0; -} - -// Bind a new entry to the repository or update the size of an -// existing entry. - -int -ACE_Based_Pointer_Repository::bind (void *addr, - size_t size) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::bind"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); - - return this->rep_->addr_map_.rebind (addr, size); -} - -// Unbind a base from the repository. - -int -ACE_Based_Pointer_Repository::unbind (void *addr) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::unbind"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); - ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0; - - // Search for service handlers that requested notification. - - for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_); - iter.next (ce) != 0; - iter.advance ()) - { - // Check to see if is within any of the regions and if - // so, unbind the key from the map. - if (addr >= ce->ext_id_ - && addr < ((char *) ce->ext_id_ + ce->int_id_)) - // Unbind base address. - return this->rep_->addr_map_.unbind (ce->ext_id_); - } - - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) -template ACE_Singleton * - ACE_Singleton::singleton_; -#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Based_Pointer_Repository.h b/ace/Based_Pointer_Repository.h deleted file mode 100644 index 5d0b1b8fe41..00000000000 --- a/ace/Based_Pointer_Repository.h +++ /dev/null @@ -1,91 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Based_Pointer_Repository.h - * - * $Id$ - * - * @author Dietrich Quehl - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_BASED_POINTER_REPOSITORY_H -#define ACE_BASED_POINTER_REPOSITORY_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Singleton.h" -#include "ace/Synch_Traits.h" -#include "ace/os_include/os_stddef.h" - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl., using the "Cheshire Cat" technique. -class ACE_Based_Pointer_Repository_Rep; - -/** - * @class ACE_Based_Pointer_Repository - * - * @brief Maps pointers to the base address of the region to which each - * pointer belongs. - */ -class ACE_Export ACE_Based_Pointer_Repository -{ -public: - // = Use ACE_Null_Mutex to allow locking while iterating. - - // = Initialization and termination methods. - ACE_Based_Pointer_Repository (void); - ~ACE_Based_Pointer_Repository (void); - - // = Search structure methods. - /** - * Return the appropriate @a base_addr region that contains @a addr. - * Returns 1 on success and 0 if the @a addr isn't contained in any - * @a base_addr region. - */ - int find (void *addr, - void *&base_addr); - - /// Bind a new entry to the repository or update the size of an - /// existing entry. Returns 0 on success and -1 on failure. - int bind (void *addr, - size_t size); - - /// Unbind from the repository the that is - /// contained within. - int unbind (void *addr); - -private: - - /// Use the "Cheshire-Cat" technique to hide the implementation in - /// order to avoid circular #include dependencies. - ACE_Based_Pointer_Repository_Rep *rep_; - -}; - -// ---------------------------------- - -/// Declare a process wide singleton -ACE_SINGLETON_DECLARE (ACE_Singleton, - ACE_Based_Pointer_Repository, - ACE_SYNCH_RW_MUTEX) - -/// Provide a Singleton access point to the based pointer repository. -typedef ACE_Singleton - ACE_BASED_POINTER_REPOSITORY; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_BASED_POINTER_REPOSITORY_H */ diff --git a/ace/Based_Pointer_T.cpp b/ace/Based_Pointer_T.cpp deleted file mode 100644 index 2155bc3a734..00000000000 --- a/ace/Based_Pointer_T.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// $Id$ - -#ifndef ACE_BASED_POINTER_T_CPP -#define ACE_BASED_POINTER_T_CPP - -#include "ace/Based_Pointer_T.h" -#include "ace/Based_Pointer_Repository.h" -#include "ace/Log_Msg.h" - -# define ACE_TRACEX(X) ACE_Trace ____ (ACE_LIB_TEXT (X), __LINE__, ACE_LIB_TEXT (__FILE__)) - -#if !defined (__ACE_INLINE__) -#include "ace/Based_Pointer_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Based_Pointer::ACE_Based_Pointer (void) -{ - ACE_TRACE ("ACE_Based_Pointer::ACE_Based_Pointer"); -} - -template void -ACE_Based_Pointer_Basic::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Based_Pointer_Basic::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntarget_ = %d\n"), this->target_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("base_offset_ = %d\n"), this->base_offset_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("computed pointer = %x\n"), - (CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this)))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Based_Pointer::ACE_Based_Pointer (CONCRETE *initial) - : ACE_Based_Pointer_Basic (initial) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); -} - -template -ACE_Based_Pointer::ACE_Based_Pointer (const void* base_addr, int) - : ACE_Based_Pointer_Basic (base_addr, 0) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); -} - -template -ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (void) - : target_ (0), - base_offset_ (0) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); - void *base_addr = 0; - - // Find the base address associated with our pointer. Note - // that it's ok for to return 0, which simply indicates that - // the address is not in memory-mapped virtual address space. - ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, - base_addr); - this->base_offset_ = (char *) this - (char *) base_addr; -} - -template -ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (const void *base_addr, int) - : target_ (0), - base_offset_ (0) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); - this->base_offset_ = (char *) this - (char *) base_addr; -} - -template -ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (CONCRETE *rhs) - : target_ (0), - base_offset_ (0) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); - - if (rhs == 0) - // Store a value of that indicate "NULL" pointer. - this->target_ = -1; - else - { - void *base_addr = 0; - - // Find the base address associated with the pointer. - // Note that it's ok for to return 0, which simply - // indicates that the address is not in memory-mapped virtual - // address space. - ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, - base_addr); - this->base_offset_ = (char *) this - (char *) base_addr; - this->target_ = ((char *) rhs - (char *) base_addr); - } -} - -template -ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic &) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); - - ACE_ASSERT (0); // not implemented. -} - -template -ACE_Based_Pointer::ACE_Based_Pointer (const ACE_Based_Pointer &rhs) - : ACE_Based_Pointer_Basic (rhs) -{ - ACE_TRACE ("ACE_Based_Pointer::ACE_Based_Pointer"); - ACE_ASSERT (0); // not implemented. -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_BASED_POINTER_T_CPP */ diff --git a/ace/Based_Pointer_T.h b/ace/Based_Pointer_T.h deleted file mode 100644 index 1d778639211..00000000000 --- a/ace/Based_Pointer_T.h +++ /dev/null @@ -1,205 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Based_Pointer_T.h - * - * $Id$ - * - * @author Dietrich Quehl - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_BASED_POINTER_T_H -#define ACE_BASED_POINTER_T_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" -#include "ace/Basic_Types.h" - -#if defined (_MSC_VER) -// Suppress warning e.g. "return type for -// 'ACE_Based_Pointer::operator ->' is 'long *' (i.e., not a UDT -// or reference to a UDT. Will produce errors if applied using infix -// notation)" -#pragma warning(disable: 4284) -#endif /* _MSC_VER */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Based_Pointer_Basic - * - * @brief A proxy that keeps track of the relative offset of a "pointer" - * from its base address. - * This class makes it possible to transparently use "pointers" in - * shared memory as easily as programming with pointers to local - * memory. In particular, we don't need to ensure that the base - * addresses of all the pointers are mapped into separate - * processes at the same absolute memory base address. - */ -template -class ACE_Based_Pointer_Basic -{ -public: - /** - * This constructor initializes the by asking the - * Singleton for the base address of - * the memory region within which it is instantiated. Two results - * are possible: - * - * 1. An has stored a base address/size pair and the - * new based-pointer instance is located between the base address and - * the base address + size - 1. In this case, the repository - * returns the base address. - * - * 2. No suitable address/size pair was found. The repository - * assumes an address in the regular (not mapped) virtual address - * space of the process and returns 0. In this case, the - * based-pointer uses its address as an offset to it's base - * address 0. - */ - ACE_Based_Pointer_Basic (void); - - /** - * Initialize this object using the pointer. This - * constructor initializes the by asking the - * Singleton for the base address of - * the memory region within which it is instantiated. Three results - * are possible: - * - * 1. An has stored a base address/size pair and the - * new based-pointer instance is located between the base address and - * the base address + size - 1. In this case, the repository - * returns the base address. - * - * 2. No suitable address/size pair was found. The repository - * assumes an address in the regular (not mapped) virtual address - * space of the process and returns 0. In this case, the - * based-pointer uses its address as an offset to its base - * address 0. - * - * 3. If is 0 then set the value of to -1, which - * indicates a "NULL" pointer. - */ - ACE_Based_Pointer_Basic (CONCRETE *initial); - - /// Copy constructor. - ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic &); - - /// Constructor for know base address. is only used to - /// resolve overload ambiguity. - ACE_Based_Pointer_Basic (const void *base_addr, int o); - - /// Pseudo-assignment operator. - void operator = (CONCRETE *from); - - /// Pseudo-assignment operator. - void operator = (const ACE_Based_Pointer_Basic &); - - /// Dereference operator. - CONCRETE operator * (void) const; - - /// Less than operator. - bool operator < (const ACE_Based_Pointer_Basic &) const; - - /// Less than or equal operator. - bool operator <= (const ACE_Based_Pointer_Basic &) const; - - /// Greater than operator. - bool operator > (const ACE_Based_Pointer_Basic &) const; - - /// Greater than or equal operator. - bool operator >= (const ACE_Based_Pointer_Basic &) const; - - /// Equality operator. - bool operator == (const ACE_Based_Pointer_Basic &) const; - - /// Inequality operator. - bool operator != (const ACE_Based_Pointer_Basic &) const; - - /// Subscript operator. - CONCRETE operator [](int index) const; - - /// Increment operator. - void operator+= (int index); - - /// Returns the underlying memory address of the smart pointer. - operator CONCRETE *() const; - - /// Returns the underlying memory address of the smart pointer. - CONCRETE *addr (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// Dump the state of the object. - void dump (void) const; - -protected: - ptrdiff_t target_; - - /// Keep track of our offset from the base pointer. - ptrdiff_t base_offset_; -}; - -/** - * @class ACE_Based_Pointer - * - * @brief A smart proxy that keeps track of the relative offset of a - * "pointer" from its base address. - * - * This class makes it possible to transparently use "pointers" in - * shared memory as easily as programming with pointers to local - * memory by overloading the C++ delegation operator ->(). - */ -template -class ACE_Based_Pointer : public ACE_Based_Pointer_Basic -{ -public: - // = Initialization method. - /// Constructor. See constructor for ACE_Based_Pointer_Basic for - /// details. - ACE_Based_Pointer (void); - - /// Initialize this object using the pointer. See - /// constructor for ACE_Based_Pointer_Basic for details. - ACE_Based_Pointer (CONCRETE *initial); - - /// Initialize this object with known @a base_addr. @a dummy is - /// a dummy value used to resolve overload ambiguity and it - /// otherwise ignored. - ACE_Based_Pointer (const void *base_addr, int dummy); - - /// Copy constructor (not implemented yet). - ACE_Based_Pointer (const ACE_Based_Pointer &); - - /// Assignment operator. - void operator = (const ACE_Based_Pointer &); - - /// Pseudo-assignment operator. - void operator = (CONCRETE *from); - - /// The C++ "delegation operator". - CONCRETE *operator-> (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Based_Pointer_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Based_Pointer_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Based_Pointer_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_BASED_POINTER_T_H */ diff --git a/ace/Based_Pointer_T.inl b/ace/Based_Pointer_T.inl deleted file mode 100644 index 4d6b86e0c41..00000000000 --- a/ace/Based_Pointer_T.inl +++ /dev/null @@ -1,139 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_) -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE CONCRETE * -ACE_Based_Pointer::operator->(void) -{ - ACE_TRACE ("ACE_Based_Pointer::operator->"); - return reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); -} - -template ACE_INLINE void -ACE_Based_Pointer_Basic::operator = (CONCRETE *rhs) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator ="); - if (rhs == 0) - // Store a value of that indicate "NULL" pointer. - this->target_ = -1; - else - this->target_ = ((char *) rhs - - ((char *) this - this->base_offset_)); -} - -template ACE_INLINE void -ACE_Based_Pointer::operator = (CONCRETE *rhs) -{ - ACE_TRACE ("ACE_Based_Pointer::operator ="); - if (rhs == 0) - // Store a value of that indicate "NULL" pointer. - this->target_ = -1; - else - this->target_ = ((char *) rhs - - ((char *) this - this->base_offset_)); -} - -template ACE_INLINE CONCRETE -ACE_Based_Pointer_Basic::operator *(void) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator *"); - return *reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); -} - -template ACE_INLINE CONCRETE * -ACE_Based_Pointer_Basic::addr (void) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::addr"); - - if (this->target_ == -1) - return 0; - else - return reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); -} - -template ACE_INLINE -ACE_Based_Pointer_Basic::operator CONCRETE *() const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator CONCRETE *()"); - - return this->addr (); -} - -template ACE_INLINE CONCRETE -ACE_Based_Pointer_Basic::operator [] (int index) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator []"); - CONCRETE *c = - reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); - return c[index]; -} - -template ACE_INLINE void -ACE_Based_Pointer_Basic::operator += (int index) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator +="); - this->base_offset_ += (index * sizeof (CONCRETE)); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator == (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator =="); - return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator != (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator !="); - return !(*this == rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator < (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator <"); - return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator <= (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator <="); - return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator > (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator >"); - return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator >= (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator >="); - return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE void -ACE_Based_Pointer_Basic::operator= (const ACE_Based_Pointer_Basic &rhs) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator="); - *this = rhs.addr (); -} - -template ACE_INLINE void -ACE_Based_Pointer::operator= (const ACE_Based_Pointer &rhs) -{ - ACE_TRACE ("ACE_Based_Pointer::operator="); - *this = rhs.addr (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Basic_Stats.cpp b/ace/Basic_Stats.cpp deleted file mode 100644 index f81b29bfcaa..00000000000 --- a/ace/Basic_Stats.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// $Id$ - -#include "ace/Basic_Stats.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Basic_Stats.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, - Basic_Stats, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs) -{ - if (rhs.samples_count_ == 0) - return; - - if (this->samples_count_ == 0) - { - this->min_ = rhs.min_; - this->min_at_ = rhs.min_at_; - - this->max_ = rhs.max_; - this->max_at_ = rhs.max_at_; - } - else - { - if (this->min_ > rhs.min_) - { - this->min_ = rhs.min_; - this->min_at_ = rhs.min_at_; - } - if (this->max_ < rhs.max_) - { - this->max_ = rhs.max_; - this->max_at_ = rhs.max_at_; - } - } - - this->samples_count_ += rhs.samples_count_; - this->sum_ += rhs.sum_; -} - -void -ACE_Basic_Stats::dump_results (const ACE_TCHAR *msg, - ACE_UINT32 sf) const -{ -#ifndef ACE_NLOGGING - if (this->samples_count () == 0u) - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("%s : no data collected\n"), msg)); - return; - } - - ACE_UINT64 avg = this->sum_ / this->samples_count_; - - ACE_UINT64 l_min = this->min_ / sf; - ACE_UINT64 l_max = this->max_ / sf; - ACE_UINT64 l_avg = avg / sf; - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("%s latency : %Q[%d]/%Q/%Q[%d] (min/avg/max)\n"), - msg, - l_min, this->min_at_, - l_avg, - l_max, this->max_at_)); - -#endif /* ACE_NLOGGING */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Basic_Stats.h b/ace/Basic_Stats.h deleted file mode 100644 index 2dc50694e63..00000000000 --- a/ace/Basic_Stats.h +++ /dev/null @@ -1,87 +0,0 @@ - -//============================================================================= -/** - * @file Basic_Stats.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ -//============================================================================= - - -#ifndef ACE_BASIC_STATS_H -#define ACE_BASIC_STATS_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" -#include "ace/Basic_Types.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/// Collect basic stats about a series of samples -/** - * Compute the average and standard deviation (aka jitter) for an - * arbitrary number of samples, using constant space. - * Normally used for latency statistics. - */ -class ACE_Export ACE_Basic_Stats -{ -public: - /// Constructor - /** - * The number of samples is pre-allocated, and cannot changes once - * the class is initialized. - */ - ACE_Basic_Stats (void); - - /// The number of samples received so far - ACE_UINT32 samples_count (void) const; - - /// Record one sample. - void sample (ACE_UINT64 value); - - /// Update the values to reflect the stats in @a rhs. - void accumulate (const ACE_Basic_Stats &rhs); - - /// Dump all the samples - /** - * Prints out the results, using @a msg as a prefix for each message and - * scaling all the numbers by @a scale_factor. The latter is useful because - * high resolution timer samples are acquired in clock ticks, but often - * presented in microseconds. - */ - void dump_results (const ACE_TCHAR *msg, - ACE_UINT32 scale_factor) const; - - /// The number of samples - ACE_UINT32 samples_count_; - - /// The minimum value - ACE_UINT64 min_; - - /// The number of the sample that had the minimum value - ACE_UINT32 min_at_; - - /// The maximum value - ACE_UINT64 max_; - - /// The number of the sample that had the maximum value - ACE_UINT32 max_at_; - - /// The sum of all the values - ACE_UINT64 sum_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Basic_Stats.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_BASIC_STATS_H */ diff --git a/ace/Basic_Stats.inl b/ace/Basic_Stats.inl deleted file mode 100644 index bbdce099907..00000000000 --- a/ace/Basic_Stats.inl +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Basic_Stats::ACE_Basic_Stats (void) - : samples_count_ (0) - , min_ (0) - , min_at_ (0) - , max_ (0) - , max_at_ (0) - , sum_ (0) -{ -} - -ACE_INLINE ACE_UINT32 -ACE_Basic_Stats::samples_count (void) const -{ - return this->samples_count_; -} - -ACE_INLINE void -ACE_Basic_Stats::sample (ACE_UINT64 value) -{ - ++this->samples_count_; - - if (this->samples_count_ == 1u) - { - this->min_ = value; - this->min_at_ = this->samples_count_; - this->max_ = value; - this->max_at_ = this->samples_count_; - } - else - { - if (this->min_ > value) - { - this->min_ = value; - this->min_at_ = this->samples_count_; - } - if (this->max_ < value) - { - this->max_ = value; - this->max_at_ = this->samples_count_; - } - } - - this->sum_ += value; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Basic_Types.cpp b/ace/Basic_Types.cpp deleted file mode 100644 index 53544d079eb..00000000000 --- a/ace/Basic_Types.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include "ace/Basic_Types.h" - -#if !defined (__ACE_INLINE__) -# include "ace/Basic_Types.inl" -#endif /* ! __ACE_INLINE__ */ - - -ACE_RCSID (ace, - Basic_Types, - "$Id$") - - -#if defined (ACE_LACKS_LONGLONG_T) && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -# include "ace/Log_Msg.h" -# include "ace/OS_NS_stdio.h" -# include "ace/OS_NS_string.h" -# if !defined (ACE_LACKS_IOSTREAM_TOTALLY) -// FUZZ: disable check_for_streams_include -# include "ace/streams.h" -# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_U_LongLong::output (FILE *file) const -{ - if (h_ () > 0) - ACE_OS::fprintf (file, "0x%lx%0*lx", h_ (), 2 * sizeof l_ (), l_ ()); - else - ACE_OS::fprintf (file, "0x%lx", l_ ()); -} - - -ACE_TCHAR * -ACE_U_LongLong::as_string (ACE_TCHAR *output, - unsigned int base, - unsigned int uppercase) const -{ - if (*this == 0) - { - ACE_OS::strcpy(output, "0"); - } - else - { - switch(base) - { - case 8: - { - unsigned int index = 0; - int bshift = 31; - while(bshift >= 1) - { - unsigned int sval = (this->h_ () >> bshift) & 7; - if (sval > 0 || index != 0) - { - output[index] = sval + '0'; - index++; - } - bshift -= 3; - } - bshift = 30; - while(bshift >= 0) - { - unsigned int sval = (this->l_ () >> bshift) & 7; - // Combine the last bit of hi with the first 3-bit digit - if (bshift == 30) - { - sval |= (this->h_ () & 1) << 2; - } - if (sval > 0 || index != 0) - { - output[index] = sval + '0'; - index++; - } - bshift -= 3; - } - output[index] = '\0'; - break; - } - case 10: - { - ACE_OS::sprintf(output, "%.0f", *this / 1.0); - break; - } - case 16: - { - if (this->h_ () != 0) - { - ACE_OS::sprintf(output, - (uppercase ? "%lX%0*lX" : "%lx%0*lx"), - this->h_ (), 2 * sizeof this->l_ (), - this->l_ ()); - } - else - { - ACE_OS::sprintf(output, - (uppercase ? "%lX" : "%lx"), this->l_ ()); - - } - break; - } - default: - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Unsupported base = %u\n"), base)); - output[0] = '\0'; - } - } - } - - return output; -} - - -# if !defined (ACE_LACKS_IOSTREAM_TOTALLY) -ostream& -operator<< (ostream& os, const ACE_U_LongLong& ll) -{ -#ifdef __TANDEM && (__CPLUSPLUS_VERSION >= 3) - unsigned long flags = os.flags(); -#else - unsigned long flags = os.setf(0); -#endif - char buffer[32]; - - if ((flags & ios::oct) != 0) - os << ll.as_string (buffer, 8); - else if ((flags & ios::hex) != 0) - os << ll.as_string (buffer, 16, (flags & ios::uppercase)); - else - os << ll.as_string (buffer); - return os; -} -# endif - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_LONGLONG_T */ - diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h deleted file mode 100644 index fad156c7621..00000000000 --- a/ace/Basic_Types.h +++ /dev/null @@ -1,796 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Basic_Types.h - * - * $Id$ - * - * @author David L. Levine - * - * #defines the list of preprocessor macros below. The config.h file can - * pre-define any of these to short-cut the definitions. This is usually - * only necessary if the preprocessor does all of its math using integers. - * - * Sizes of built-in types: - * - ACE_SIZEOF_CHAR - * - ACE_SIZEOF_WCHAR - * - ACE_SIZEOF_SHORT - * - ACE_SIZEOF_INT - * - ACE_SIZEOF_LONG - * - ACE_SIZEOF_LONG_LONG - * - ACE_SIZEOF_VOID_P - * - ACE_SIZEOF_FLOAT - * - ACE_SIZEOF_DOUBLE - * - ACE_SIZEOF_LONG_DOUBLE - * - * Wrappers for built-in types of specific sizes: - * - ACE_USHORT16 (For backward compatibility. Use ACE_UINT16 instead.) - * - ACE_INT8 - * - ACE_UINT8 - * - ACE_INT16 - * - ACE_UINT16 - * - ACE_INT32 - * - ACE_UINT32 - * - ACE_UINT64 - * (@note ACE_INT64 is partly defined, there is no ACE_LongLong for - * platforms that don't have a native 8-byte integer type.) - * - * Byte-order (endian-ness) determination: - * ACE_BYTE_ORDER, to either ACE_BIG_ENDIAN or ACE_LITTLE_ENDIAN - * - * - */ -//============================================================================= - -#include "ace/config-lite.h" - -#ifndef ACE_BASIC_TYPES_H -# define ACE_BASIC_TYPES_H - -# include /**/ "ace/pre.h" - -# if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -# endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Pull in definitions -# include "ace/os_include/os_limits.h" // Integer limits -# include "ace/os_include/os_float.h" // Floating point limits -# include "ace/os_include/os_stdlib.h" // Other types -# include "ace/os_include/os_stddef.h" // Get ptrdiff_t - see further comments below - -# if defined(ACE_LACKS_LONGLONG_T) -# include "ace/os_include/os_stdio.h" // For long long emulation -# endif /* ACE_LACKS_LONGLONG_T */ - -# include "ace/os_include/sys/os_types.h" - -# if !defined (ACE_LACKS_SYS_PARAM_H) -# include /**/ -# endif /* ACE_LACKS_SYS_PARAM_H */ - -# include "ace/ACE_export.h" - -# if !defined (ACE_LACKS_STDINT_H) -# include -# endif -# if !defined (ACE_LACKS_INTTYPES_H) -# include -# endif - -// A char always has 1 byte, by definition. -# define ACE_SIZEOF_CHAR 1 - -// Unfortunately, there isn't a portable way to determine the size of a wchar. -// So we just define them on a platform basis. If the platform doesn't -// define it and it's an XPG4 system, assume wchar_t is 4 bytes. Some code -// uses ACE_SIZEOF_WCHAR in preprocessor statements, so sizeof() isn't valid. -// If the platform config doesn't set this, and this guess is wrong, -// Basic_Types_Test should catch the inconsistency. -# if defined (ACE_HAS_WCHAR) -# if !defined (ACE_SIZEOF_WCHAR) -# if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) -# define ACE_SIZEOF_WCHAR 4 -# else -// 0 so the Basic_Types test will catch this. -# define ACE_SIZEOF_WCHAR 0 -# endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ -# endif /* !ACE_SIZEOF_WCHAR */ -# endif /* ACE_HAS_WCHAR */ - -// The number of bytes in a short. -# if !defined (ACE_SIZEOF_SHORT) -# if (USHRT_MAX) == 255U -# define ACE_SIZEOF_SHORT 1 -# elif (USHRT_MAX) == 65535U -# define ACE_SIZEOF_SHORT 2 -# elif (USHRT_MAX) == 4294967295U -# define ACE_SIZEOF_SHORT 4 -# elif (USHRT_MAX) == 18446744073709551615U -# define ACE_SIZEOF_SHORT 8 -# else -# error: unsupported short size, must be updated for this platform! -# endif /* USHRT_MAX */ -# endif /* !defined (ACE_SIZEOF_SHORT) */ - -// The number of bytes in an int. -# if !defined (ACE_SIZEOF_INT) -# if (UINT_MAX) == 65535U -# define ACE_SIZEOF_INT 2 -# elif (UINT_MAX) == 4294967295U -# define ACE_SIZEOF_INT 4 -# elif (UINT_MAX) == 18446744073709551615U -# define ACE_SIZEOF_INT 8 -# else -# error: unsupported int size, must be updated for this platform! -# endif /* UINT_MAX */ -# endif /* !defined (ACE_SIZEOF_INT) */ - -// The number of bytes in a long. -# if !defined (ACE_SIZEOF_LONG) -# if (ULONG_MAX) == 65535UL -# define ACE_SIZEOF_LONG 2 -# elif ((ULONG_MAX) == 4294967295UL) -# define ACE_SIZEOF_LONG 4 -# elif ((ULONG_MAX) == 18446744073709551615UL) -# define ACE_SIZEOF_LONG 8 -# else -# error: unsupported long size, must be updated for this platform! -# endif /* ULONG_MAX */ -# endif /* !defined (ACE_SIZEOF_LONG) */ - -// The number of bytes in a long long. -# if !defined (ACE_SIZEOF_LONG_LONG) -# if defined (ACE_LACKS_LONGLONG_T) -# define ACE_SIZEOF_LONG_LONG 8 -# elif defined (ULLONG_MAX) -# if ((ULLONG_MAX) == 4294967295ULL) -# define ACE_SIZEOF_LONG_LONG 4 -# elif ((ULLONG_MAX) == 18446744073709551615ULL) -# define ACE_SIZEOF_LONG_LONG 8 -# endif -# elif defined (ULONGLONG_MAX) -# if ((ULONGLONG_MAX) == 4294967295ULL) -# define ACE_SIZEOF_LONG_LONG 4 -# elif ((ULONGLONG_MAX) == 18446744073709551615ULL) -# define ACE_SIZEOF_LONG_LONG 8 -# endif -# endif -# // If we can't determine the size of long long, assume it is 8 -# // instead of erroring out. (Either ULLONG_MAX and ULONGLONG_MAX -# // may not be supported; or an extended C/C++ dialect may need to -# // be selected. If this assumption is wrong, it can be addressed -# // in the platform-specific config header. -# if !defined (ACE_SIZEOF_LONG_LONG) -# define ACE_SIZEOF_LONG_LONG 8 -# endif -# endif /* !defined (ACE_SIZEOF_LONG_LONG) */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The sizes of the commonly implemented types are now known. Set up -// typedefs for whatever we can. Some of these are needed for certain -// cases of ACE_UINT64, so do them before the 64-bit stuff. - -#if defined (ACE_INT8_TYPE) - typedef ACE_INT8_TYPE ACE_INT8; -#elif defined (ACE_HAS_INT8_T) - typedef int8_t ACE_INT8; -#elif !defined (ACE_LACKS_SIGNED_CHAR) - typedef signed char ACE_INT8; -#else - typedef char ACE_INT8; -#endif /* defined (ACE_INT8_TYPE) */ - -#if defined (ACE_UINT8_TYPE) - typedef ACE_UINT8_TYPE ACE_UINT8; -#elif defined (ACE_HAS_UINT8_T) - typedef uint8_t ACE_UINT8; -#else - typedef unsigned char ACE_UINT8; -#endif /* defined (ACE_UINT8_TYPE) */ - -#if defined (ACE_INT16_TYPE) - typedef ACE_INT16_TYPE ACE_INT16; -#elif defined (ACE_HAS_INT16_T) - typedef int16_t ACE_INT16; -#elif ACE_SIZEOF_SHORT == 2 - typedef short ACE_INT16; -#elif ACE_SIZEOF_INT == 2 - typedef int ACE_INT16; -#else -# error Have to add to the ACE_INT16 type setting -#endif /* defined (ACE_INT16_TYPE) */ - -#if defined (ACE_UINT16_TYPE) - typedef ACE_UINT16_TYPE ACE_UINT16; -#elif defined (ACE_HAS_UINT16_T) - typedef uint16_t ACE_UINT16; -#elif ACE_SIZEOF_SHORT == 2 - typedef unsigned short ACE_UINT16; -#elif ACE_SIZEOF_INT == 2 - typedef unsigned int ACE_UINT16; -#else -# error Have to add to the ACE_UINT16 type setting -#endif /* defined (ACE_UINT16_TYPE) */ - -#if defined (ACE_INT32_TYPE) - typedef ACE_INT32_TYPE ACE_INT32; -#elif defined (ACE_HAS_INT32_T) - typedef int32_t ACE_INT32; -#elif ACE_SIZEOF_INT == 4 - typedef int ACE_INT32; -#elif ACE_SIZEOF_LONG == 4 - typedef long ACE_INT32; -#else -# error Have to add to the ACE_INT32 type setting -#endif /* defined (ACE_INT32_TYPE) */ - -#if defined (ACE_UINT32_TYPE) - typedef ACE_UINT32_TYPE ACE_UINT32; -#elif defined (ACE_HAS_UINT32_T) - typedef uint32_t ACE_UINT32; -#elif ACE_SIZEOF_INT == 4 - typedef unsigned int ACE_UINT32; -#elif ACE_SIZEOF_LONG == 4 - typedef unsigned long ACE_UINT32; -#else -# error Have to add to the ACE_UINT32 type setting -#endif /* defined (ACE_UINT32_TYPE) */ - -#if defined (ACE_INT64_TYPE) - typedef ACE_INT64_TYPE ACE_INT64; -#elif defined (ACE_HAS_INT64_T) - typedef int64_t ACE_INT64; -#elif ACE_SIZEOF_LONG == 8 - typedef long ACE_INT64; -#elif !defined (ACE_LACKS_LONGLONG_T) && ACE_SIZEOF_LONG_LONG == 8 -# ifdef __GNUC__ - // Silence g++ "-pedantic" warnings regarding use of "long long" - // type. - __extension__ -# endif /* __GNUC__ */ - typedef long long ACE_INT64; -#endif /* defined (ACE_INT64_TYPE) */ - -#if !(defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)) -/* See matching #if around ACE_U_LongLong class declaration below */ - -# if defined (ACE_UINT64_TYPE) - typedef ACE_UINT64_TYPE ACE_UINT64; -# elif defined (ACE_HAS_UINT64_T) - typedef uint64_t ACE_UINT64; -# elif ACE_SIZEOF_LONG == 8 - typedef unsigned long ACE_UINT64; -# elif ACE_SIZEOF_LONG_LONG == 8 -# ifdef __GNUC__ - // Silence g++ "-pedantic" warnings regarding use of "long long" - // type. - __extension__ -# endif /* __GNUC__ */ - typedef unsigned long long ACE_UINT64; -# endif /* defined (ACE_UINT64_TYPE) */ -#endif /* !(ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T) */ - - -typedef ACE_UINT16 ACE_USHORT16; // @@ Backward compatibility. - -// Define a generic byte for use in codecs -typedef unsigned char ACE_Byte; - -// Define a pseudo wide character type when wchar is not supported so we -// can support basic wide character string operations. - -# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) -# define ACE_WINT_T wint_t -# define ACE_WCHAR_T wchar_t -# else -# define ACE_WINT_T ACE_UINT16 -# define ACE_WCHAR_T ACE_UINT16 -# endif /* ACE_HAS_WCHAR */ - -// The number of bytes in a void *. -# ifndef ACE_SIZEOF_VOID_P -# define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG -# endif /* ACE_SIZEOF_VOID_P */ - -// Type for doing arithmetic on pointers ... as elsewhere, we assume -// that unsigned versions of a type are the same size as the signed -// version of the same type. -# if defined (ACE_HAS_WINCE) && (_WIN32_WCE < 400) -typedef unsigned long ptrdiff_t; // evc3, PocketPC don't defined ptrdiff_t -# endif - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Byte-order (endian-ness) determination. -# if defined (BYTE_ORDER) -# if (BYTE_ORDER == LITTLE_ENDIAN) -# define ACE_LITTLE_ENDIAN 0x0123 -# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN -# elif (BYTE_ORDER == BIG_ENDIAN) -# define ACE_BIG_ENDIAN 0x3210 -# define ACE_BYTE_ORDER ACE_BIG_ENDIAN -# else -# error: unknown BYTE_ORDER! -# endif /* BYTE_ORDER */ -# elif defined (_BYTE_ORDER) -# if (_BYTE_ORDER == _LITTLE_ENDIAN) -# define ACE_LITTLE_ENDIAN 0x0123 -# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN -# elif (_BYTE_ORDER == _BIG_ENDIAN) -# define ACE_BIG_ENDIAN 0x3210 -# define ACE_BYTE_ORDER ACE_BIG_ENDIAN -# else -# error: unknown _BYTE_ORDER! -# endif /* _BYTE_ORDER */ -# elif defined (__BYTE_ORDER) -# if (__BYTE_ORDER == __LITTLE_ENDIAN) -# define ACE_LITTLE_ENDIAN 0x0123 -# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN -# elif (__BYTE_ORDER == __BIG_ENDIAN) -# define ACE_BIG_ENDIAN 0x3210 -# define ACE_BYTE_ORDER ACE_BIG_ENDIAN -# else -# error: unknown __BYTE_ORDER! -# endif /* __BYTE_ORDER */ -# else /* ! BYTE_ORDER && ! __BYTE_ORDER */ - // We weren't explicitly told, so we have to figure it out . . . -# if defined (i386) || defined (__i386__) || defined (_M_IX86) || \ - defined (vax) || defined (__alpha) || defined (__LITTLE_ENDIAN__) ||\ - defined (ARM) || defined (_M_IA64) || \ - defined (_M_AMD64) || defined (__amd64) - // We know these are little endian. -# define ACE_LITTLE_ENDIAN 0x0123 -# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN -# else - // Otherwise, we assume big endian. -# define ACE_BIG_ENDIAN 0x3210 -# define ACE_BYTE_ORDER ACE_BIG_ENDIAN -# endif -# endif /* ! BYTE_ORDER && ! __BYTE_ORDER */ - -// Byte swapping macros to deal with differences between little endian -// and big endian machines. Note that "long" here refers to 32 bit -// quantities. -# define ACE_SWAP_LONG(L) ((ACE_SWAP_WORD ((L) & 0xFFFF) << 16) \ - | ACE_SWAP_WORD(((L) >> 16) & 0xFFFF)) -# define ACE_SWAP_WORD(L) ((((L) & 0x00FF) << 8) | (((L) & 0xFF00) >> 8)) - -# if defined (ACE_LITTLE_ENDIAN) -# define ACE_HTONL(X) ACE_SWAP_LONG (X) -# define ACE_NTOHL(X) ACE_SWAP_LONG (X) -# define ACE_IDL_NCTOHL(X) (X) -# define ACE_IDL_NSTOHL(X) (X) -# else -# define ACE_HTONL(X) X -# define ACE_NTOHL(X) X -# define ACE_IDL_NCTOHL(X) (X << 24) -# define ACE_IDL_NSTOHL(X) ((X) << 16) -# endif /* ACE_LITTLE_ENDIAN */ - -# if defined (ACE_LITTLE_ENDIAN) -# define ACE_HTONS(x) ACE_SWAP_WORD(x) -# define ACE_NTOHS(x) ACE_SWAP_WORD(x) -# else -# define ACE_HTONS(x) x -# define ACE_NTOHS(x) x -# endif /* ACE_LITTLE_ENDIAN */ - -#if defined (ACE_LACKS_LONGLONG_T) - // This throws away the high 32 bits. It's very unlikely that a - // pointer will be more than 32 bits wide if the platform does not - // support 64-bit integers. -# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ - reinterpret_cast (L.lo ()) -#else /* ! ACE_LACKS_LONGLONG_T */ -# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ - reinterpret_cast (static_cast (L)) -#endif /* ! ACE_LACKS_LONGLONG_T */ - -// If the platform lacks an unsigned long long, define one. -#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -// Forward declaration for streams -# include "ace/iosfwd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_U_LongLong - * - * @brief Unsigned long long for platforms that don't have one. - * - * Provide our own unsigned long long. This is intended to be - * use with ACE_High_Res_Timer, so the division operator assumes - * that the quotient fits into a u_long. - * Please note that the constructor takes (optionally) two values. - * The high one contributes 0x100000000 times its value. So, - * for example, (0, 2) is _not_ 20000000000, but instead - * 0x200000000. To emphasize this, the default values are expressed - * in hex, and output () dumps the value in hex. - */ - class ACE_Export ACE_U_LongLong - { - public: - // = Initialization and termination methods. -#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - ACE_U_LongLong (const long long value = 0x0); -#else - ACE_U_LongLong (const ACE_UINT32 lo = 0x0, const ACE_UINT32 hi = 0x0); -#endif - ACE_U_LongLong (const ACE_U_LongLong &); - ACE_U_LongLong &operator= (const ACE_U_LongLong &); - ACE_U_LongLong &operator= (const ACE_INT32 &); - ACE_U_LongLong &operator= (const ACE_UINT32 &); - ~ACE_U_LongLong (void); - - // = Overloaded relation operators. - bool operator== (const ACE_U_LongLong &) const; - bool operator== (const ACE_UINT32) const; - bool operator!= (const ACE_U_LongLong &) const; - bool operator!= (const ACE_UINT32) const; - bool operator< (const ACE_U_LongLong &) const; - bool operator< (const ACE_UINT32) const; - bool operator<= (const ACE_U_LongLong &) const; - bool operator<= (const ACE_UINT32) const; - bool operator> (const ACE_U_LongLong &) const; - bool operator> (const ACE_UINT32) const; - bool operator>= (const ACE_U_LongLong &) const; - bool operator>= (const ACE_UINT32) const; - - ACE_U_LongLong operator+ (const ACE_U_LongLong &) const; - ACE_U_LongLong operator+ (const ACE_UINT32) const; - ACE_U_LongLong operator- (const ACE_U_LongLong &) const; - ACE_U_LongLong operator- (const ACE_UINT32) const; - ACE_U_LongLong operator* (const ACE_UINT32) const; - ACE_U_LongLong &operator*= (const ACE_UINT32); - - ACE_U_LongLong operator<< (const unsigned int) const; - ACE_U_LongLong &operator<<= (const unsigned int); - ACE_U_LongLong operator>> (const unsigned int) const; - ACE_U_LongLong &operator>>= (const unsigned int); - - double operator/ (const double) const; - - ACE_U_LongLong &operator+= (const ACE_U_LongLong &); - ACE_U_LongLong &operator+= (const ACE_UINT32); - ACE_U_LongLong &operator-= (const ACE_U_LongLong &); - ACE_U_LongLong &operator-= (const ACE_UINT32); - ACE_U_LongLong &operator++ (); - ACE_U_LongLong &operator-- (); - const ACE_U_LongLong operator++ (int); - const ACE_U_LongLong operator-- (int); - ACE_U_LongLong &operator|= (const ACE_U_LongLong); - ACE_U_LongLong &operator|= (const ACE_UINT32); - ACE_U_LongLong &operator&= (const ACE_U_LongLong); - ACE_U_LongLong &operator&= (const ACE_UINT32); - - // Note that the following take ACE_UINT32 arguments. These are - // typical use cases, and easy to implement. But, they limit the - // return values to 32 bits as well. There are no checks for - // overflow. - ACE_UINT32 operator/ (const ACE_UINT32) const; - ACE_UINT32 operator% (const ACE_UINT32) const; - - // The following only operate on the lower 32 bits (they take only - // 32 bit arguments). - ACE_UINT32 operator| (const ACE_INT32) const; - ACE_UINT32 operator& (const ACE_INT32) const; - - // The following operators convert their arguments to - // ACE_UINT32. So, there may be information loss if they are - // used. - ACE_U_LongLong operator* (const ACE_INT32) const; - ACE_U_LongLong &operator*= (const ACE_INT32); - ACE_UINT32 operator/ (const ACE_INT32) const; -# if ACE_SIZEOF_INT == 4 - ACE_UINT32 operator/ (const unsigned long) const; - ACE_UINT32 operator/ (const long) const; -# else /* ACE_SIZEOF_INT != 4 */ - ACE_UINT32 operator/ (const unsigned int) const; - ACE_UINT32 operator/ (const int) const; -# endif /* ACE_SIZEOF_INT != 4 */ - - // = Helper methods. - /// Outputs the value to the FILE, in hex. - void output (FILE * = stdout) const; - - ACE_TCHAR *as_string (ACE_TCHAR *string, - unsigned int base = 10, - unsigned int uppercase = 0) const; - - ACE_UINT32 hi (void) const; - ACE_UINT32 lo (void) const; - - void hi (const ACE_UINT32 hi); - void lo (const ACE_UINT32 lo); - -#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - long long to_int64 (void) const; -# endif - - private: - -#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - long long data_; -#else - public: - struct ace_hi_lo_correct_endian - { -# if defined (ACE_BIG_ENDIAN) - /// High 32 bits. - ACE_UINT32 hi_; - /// Low 32 bits. - ACE_UINT32 lo_; - -# else - - /// Low 32 bits. - ACE_UINT32 lo_; - /// High 32 bits. - ACE_UINT32 hi_; -# endif /* ! ACE_BIG_ENDIAN */ - }; - private: - union - { - struct ace_hi_lo_correct_endian data_; - - /// To ensure alignment on 8-byte boundary. - double for_alignment_; - }; - - // @note the following four accessors are inlined here in - // order to minimize the extent of the data_ struct. It's - // only used here; the .i and .cpp files use the accessors. - - /// Internal utility function to hide access through struct. - const ACE_UINT32 &h_ () const { return data_.hi_; } - - /// Internal utility function to hide access through struct. - ACE_UINT32 &h_ () { return data_.hi_; } - - /// Internal utility function to hide access through struct. - const ACE_UINT32 &l_ () const { return data_.lo_; } - - /// Internal utility function to hide access through struct. - ACE_UINT32 &l_ () { return data_.lo_; } - - // @note the above four accessors are inlined here in - // order to minimize the extent of the data_ struct. It's - // only used here; the .i and .cpp files use the accessors. - - /// These functions are used to implement multiplication. - ACE_UINT32 ul_shift (ACE_UINT32 a, - ACE_UINT32 c_in, - ACE_UINT32 *c_out) const; - ACE_U_LongLong ull_shift (ACE_U_LongLong a, - ACE_UINT32 c_in, - ACE_UINT32 *c_out) const; - ACE_U_LongLong ull_add (ACE_U_LongLong a, - ACE_U_LongLong b, - ACE_UINT32 *carry) const; - ACE_U_LongLong ull_mult (ACE_U_LongLong a, - ACE_UINT32 b, - ACE_UINT32 *carry) const; -#endif // ACE_LACKS_UNSIGNEDLONGLONG_T - }; - - typedef ACE_U_LongLong ACE_UINT64; - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) - ostream &operator<< (ostream &, const ACE_U_LongLong &); -#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -# endif /* ACE_LACKS_LONGLONG_T */ - -// Conversions from ACE_UINT64 to ACE_UINT32. ACE_CU64_TO_CU32 should -// be used on const ACE_UINT64's. -# if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -# define ACE_U64_TO_U32(n) ((n).lo ()) -# define ACE_CU64_TO_CU32(n) ((n).lo ()) -# else /* ! ACE_LACKS_LONGLONG_T */ -# define ACE_U64_TO_U32(n) (static_cast (n)) -# define ACE_CU64_TO_CU32(n) \ - (static_cast (n)) -# endif /* ! ACE_LACKS_LONGLONG_T */ - -// 64-bit literals require special marking on some platforms. -# if defined (ACE_LACKS_LONGLONG_T) - // Can only specify 32-bit arguments. -# define ACE_UINT64_LITERAL(n) n ## UL - // This one won't really work, but it'll keep - // some compilers happy until we have better support -# define ACE_INT64_LITERAL(n) n ## L -# elif defined (ACE_WIN32) -# if defined (__IBMCPP__) && (__IBMCPP__ >= 400) -# define ACE_UINT64_LITERAL(n) n ## LL -# define ACE_INT64_LITERAL(n) n ## LL -# elif defined (__MINGW32__) -# define ACE_UINT64_LITERAL(n) n ## ull -# define ACE_INT64_LITERAL(n) n ## ll -# else -# define ACE_UINT64_LITERAL(n) n ## ui64 -# define ACE_INT64_LITERAL(n) n ## i64 -# endif /* defined (__IBMCPP__) && (__IBMCPP__ >= 400) */ -# elif defined (__TANDEM) -# define ACE_UINT64_LITERAL(n) n ## LL -# define ACE_INT64_LITERAL(n) n ## LL -# else /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ -# define ACE_UINT64_LITERAL(n) n ## ull -# define ACE_INT64_LITERAL(n) n ## ll -# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ - -#if !defined (ACE_INT8_FORMAT_SPECIFIER) -# if defined (PRId8) -# define ACE_INT8_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRId8) -# else -# define ACE_INT8_FORMAT_SPECIFIER ACE_LIB_TEXT ("%d") -# endif /* defined (PRId8) */ -#endif /* ACE_INT8_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT8_FORMAT_SPECIFIER) -# if defined (PRIu8) -# define ACE_UINT8_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRIu8) -# else -# define ACE_UINT8_FORMAT_SPECIFIER ACE_LIB_TEXT ("%u") -# endif /* defined (PRIu8) */ -#endif /* ACE_UINT8_FORMAT_SPECIFIER */ - -#if !defined (ACE_INT16_FORMAT_SPECIFIER) -# if defined (PRId16) -# define ACE_INT16_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRId16) -# else -# define ACE_INT16_FORMAT_SPECIFIER ACE_LIB_TEXT ("%d") -# endif /* defined (PRId16) */ -#endif /* ACE_INT16_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT16_FORMAT_SPECIFIER) -# if defined (PRIu16) -# define ACE_UINT16_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRIu16) -# else -# define ACE_UINT16_FORMAT_SPECIFIER ACE_LIB_TEXT ("%u") -# endif /* defined (PRIu16) */ -#endif /* ACE_UINT16_FORMAT_SPECIFIER */ - -#if !defined (ACE_INT32_FORMAT_SPECIFIER) -# if defined (PRId32) -# define ACE_INT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRId32) -# elif ACE_SIZEOF_INT == 4 -# define ACE_INT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%d") -# else -# define ACE_INT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld") -# endif /* defined (PRId32) */ -#endif /* ACE_INT32_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT32_FORMAT_SPECIFIER) -# if defined (PRIu32) -# define ACE_UINT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRIu32) -# elif ACE_SIZEOF_INT == 4 -# define ACE_UINT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%u") -# else -# define ACE_UINT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") -# endif /* defined (PRIu32) */ -#endif /* ACE_UINT32_FORMAT_SPECIFIER */ - -#if !defined (ACE_INT64_FORMAT_SPECIFIER) -# if defined (PRId64) -# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRId64) -# elif ACE_SIZEOF_LONG == 8 -# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld") -# else -# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lld") -# endif /* defined (PRId64) */ -#endif /* ACE_INT64_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT64_FORMAT_SPECIFIER) -# if defined (PRIu64) -# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRIu64) -# elif ACE_SIZEOF_LONG == 8 -# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") -# else -# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%llu") -# endif /* defined (PRIu64) */ -#endif /* ACE_UINT64_FORMAT_SPECIFIER */ - -#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER) -# if defined (ACE_WIN64) -# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d") -# else -# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%d") -# endif /* ACE_WIN64 */ -#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */ - -#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER) -# if defined (ACE_WIN64) -# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u") -# else -# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%u") -# endif /* ACE_WIN64 */ -#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */ - -// Cast from UINT64 to a double requires an intermediate cast to INT64 -// on some platforms. -# if defined (ACE_LACKS_LONGLONG_T) - // Only use the low 32 bits. -# define ACE_UINT64_DBLCAST_ADAPTER(n) ACE_U64_TO_U32 (n) -# elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -# define ACE_UINT64_DBLCAST_ADAPTER(n) ((n).to_int64 ()) -# elif defined (ACE_WIN32) -# define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n) -# else /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ -# define ACE_UINT64_DBLCAST_ADAPTER(n) (n) -# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ - - -// The number of bytes in a float. -# ifndef ACE_SIZEOF_FLOAT -# if FLT_MAX_EXP == 128 -# define ACE_SIZEOF_FLOAT 4 -# elif FLT_MAX_EXP == 1024 -# define ACE_SIZEOF_FLOAT 8 -# else -# error: unsupported float size, must be updated for this platform! -# endif /* FLT_MAX_EXP */ -# endif /* ACE_SIZEOF_FLOAT */ - -// The number of bytes in a double. -# ifndef ACE_SIZEOF_DOUBLE -# if DBL_MAX_EXP == 128 -# define ACE_SIZEOF_DOUBLE 4 -# elif DBL_MAX_EXP == 1024 -# define ACE_SIZEOF_DOUBLE 8 -# else -# error: unsupported double size, must be updated for this platform! -# endif /* DBL_MAX_EXP */ -# endif /* ACE_SIZEOF_DOUBLE */ - -// The number of bytes in a long double. -# ifndef ACE_SIZEOF_LONG_DOUBLE -# if LDBL_MAX_EXP == 128 -# define ACE_SIZEOF_LONG_DOUBLE 4 -# elif LDBL_MAX_EXP == 1024 -# define ACE_SIZEOF_LONG_DOUBLE 8 -# elif LDBL_MAX_EXP == 16384 -# if defined (LDBL_DIG) && LDBL_DIG == 18 -# if defined (__ia64) || defined (__x86_64) -# define ACE_SIZEOF_LONG_DOUBLE 16 -# else /* ! __ia64 */ -# define ACE_SIZEOF_LONG_DOUBLE 12 -# endif /* __ia64 */ -# else /* ! LDBL_DIG || LDBL_DIG != 18 */ -# define ACE_SIZEOF_LONG_DOUBLE 16 -# endif /* ! LDBL_DIG || LDBL_DIG != 18 */ -# else -# error: unsupported double size, must be updated for this platform! -# endif /* LDBL_MAX_EXP */ -# endif /* ACE_SIZEOF_LONG_DOUBLE */ - -// Max and min sizes for the ACE integer types. -#define ACE_CHAR_MAX 0x7F -#define ACE_CHAR_MIN -(ACE_CHAR_MAX)-1 -#define ACE_OCTET_MAX 0xFF -#define ACE_INT16_MAX 0x7FFF -#define ACE_INT16_MIN -(ACE_INT16_MAX)-1 -#define ACE_UINT16_MAX 0xFFFF -#define ACE_WCHAR_MAX ACE_UINT16_MAX -#define ACE_INT32_MAX 0x7FFFFFFF -#define ACE_INT32_MIN -(ACE_INT32_MAX)-1 -#define ACE_UINT32_MAX 0xFFFFFFFF -#define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF) -#define ACE_INT64_MIN -(ACE_INT64_MAX)-1 -#define ACE_UINT64_MAX ACE_UINT64_LITERAL(0xFFFFFFFFFFFFFFFF) -// These use ANSI/IEEE format. -#define ACE_FLT_MAX 3.402823466e+38F -#define ACE_DBL_MAX 1.7976931348623158e+308 - -# if defined (__ACE_INLINE__) -# include "ace/Basic_Types.inl" -# endif /* __ACE_INLINE__ */ - -# include /**/ "ace/post.h" -#endif /* ACE_BASIC_TYPES_H */ diff --git a/ace/Basic_Types.inl b/ace/Basic_Types.inl deleted file mode 100644 index 15f9a9a1ab6..00000000000 --- a/ace/Basic_Types.inl +++ /dev/null @@ -1,954 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -# if !defined (ACE_LACKS_LONGLONG_T) && defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Implementation for ACE_U_LongLong when we have signed long long -// but no unsigned long long. - -ACE_INLINE -ACE_U_LongLong::ACE_U_LongLong (const long long value) - : data_ (value) -{ -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::hi (void) const -{ - return (data_ >> 32) & 0xFFFFFFFF; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::lo (void) const -{ - return data_ & 0xFFFFFFFF; -} - -ACE_INLINE void -ACE_U_LongLong::hi (const ACE_UINT32 hi) -{ - data_ = hi; - data_ <<= 32; -} - -ACE_INLINE void -ACE_U_LongLong::lo (const ACE_UINT32 lo) -{ - data_ = lo; -} - -ACE_INLINE long long -ACE_U_LongLong::to_int64 (void) const -{ - return data_; -} - -ACE_INLINE -ACE_U_LongLong::~ACE_U_LongLong (void) -{ -} - -ACE_INLINE bool -ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const -{ - return data_ == n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator== (const ACE_UINT32 n) const -{ - return data_ == n; -} - -ACE_INLINE bool -ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const -{ - return ! (*this == n); -} - -ACE_INLINE bool -ACE_U_LongLong::operator!= (const ACE_UINT32 n) const -{ - return ! (*this == n); -} - -ACE_INLINE bool -ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const -{ - if (data_ > 0) - if (n.data_ > 0) - return data_ < n.data_; - else - return true; - else - if (n.data_ > 0) - return false; - else - return data_ < n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator< (const ACE_UINT32 n) const -{ - return operator< (static_cast (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const -{ - if (data_ == n.data_) return true; - - return data_ < n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator<= (const ACE_UINT32 n) const -{ - return operator<= (static_cast (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const -{ - if (data_ > 0) - if (n.data_ > 0) - return data_ > n.data_; - else - return false; - else - if (n.data_ > 0) - return true; - else - return data_ > n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator> (const ACE_UINT32 n) const -{ - return operator> (static_cast (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const -{ - if (data_ == n.data_) return true; - - return data_ > n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator>= (const ACE_UINT32 n) const -{ - return operator>= (static_cast (n)); -} - -ACE_INLINE -ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n) - : data_ (n.data_) -{ -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_U_LongLong &n) -{ - data_ = n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_INT32 &rhs) -{ - if (rhs >= 0) - { - data_ = rhs; - data_ &= 0xFFFFFFFF; - } - else - { - // We do not handle the case where a negative 32 bit integer is - // assigned to this representation of a 64 bit unsigned integer. - // The "undefined behavior" behavior performed by this - // implementation is to simply set all bits to zero. - data_ = 0; - } - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_UINT32 &rhs) -{ - data_ = rhs; - - return *this; -} - - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const -{ - return data_ + n.data_; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator+ (const ACE_UINT32 n) const -{ - return operator+ (static_cast (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const -{ - return data_ - n.data_; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator- (const ACE_UINT32 n) const -{ - return operator- (static_cast (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator<< (const u_int n) const -{ - return data_ << n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator<<= (const u_int n) -{ - data_ <<= n; - - return *this; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator>> (const u_int n) const -{ - return data_ >> n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator>>= (const u_int n) -{ - data_ >>= n; - - return *this; -} - -ACE_INLINE double -ACE_U_LongLong::operator/ (const double n) const -{ - return data_ / n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator+= (const ACE_U_LongLong &n) -{ - data_ += n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator+= (const ACE_UINT32 n) -{ - return operator+= (static_cast (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator* (const ACE_UINT32 n) const -{ - return data_ * n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator*= (const ACE_UINT32 n) -{ - data_ *= n; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-= (const ACE_U_LongLong &n) -{ - data_ -= n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-= (const ACE_UINT32 n) -{ - return operator-= (static_cast (n)); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator++ () -{ - ++data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-- () -{ - --data_; - - return *this; -} - -ACE_INLINE const ACE_U_LongLong -ACE_U_LongLong::operator++ (int) -{ - // Post-increment operator should always be implemented in terms of - // the pre-increment operator to enforce consistent semantics. - ACE_U_LongLong temp (*this); - ++*this; - return temp; -} - -ACE_INLINE const ACE_U_LongLong -ACE_U_LongLong::operator-- (int) -{ - // Post-decrement operator should always be implemented in terms of - // the pre-decrement operator to enforce consistent semantics. - ACE_U_LongLong temp (*this); - --*this; - return temp; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator|= (const ACE_U_LongLong n) -{ - data_ |= n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator|= (const ACE_UINT32 n) -{ - return operator|= (static_cast (n)); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator&= (const ACE_U_LongLong n) -{ - data_ &= n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator&= (const ACE_UINT32 n) -{ - return operator&= (static_cast (n)); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const ACE_UINT32 n) const -{ - return data_ / n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator% (const ACE_UINT32 n) const -{ - return data_ % n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator| (const ACE_INT32 n) const -{ - return data_ | n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator& (const ACE_INT32 n) const -{ - return data_ & n; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator* (const ACE_INT32 n) const -{ - return operator* ((ACE_UINT32) n); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator*= (const ACE_INT32 n) -{ - return operator*= ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const ACE_INT32 n) const -{ - return operator/ ((ACE_UINT32) n); -} - -#if ACE_SIZEOF_INT == 4 -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const u_long n) const -{ - return operator/ ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const long n) const -{ - return operator/ ((ACE_UINT32) n); -} - -#else /* ACE_SIZEOF_INT != 4 */ -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const u_int n) const -{ - return operator/ ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const int n) const -{ - return operator/ ((ACE_UINT32) n); -} -#endif - -ACE_END_VERSIONED_NAMESPACE_DECL - -#elif defined (ACE_LACKS_LONGLONG_T) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_U_LongLong::ACE_U_LongLong (const ACE_UINT32 lo, const ACE_UINT32 hi) -{ - h_ () = hi; - l_ () = lo; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::hi (void) const -{ - return h_ (); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::lo (void) const -{ - return l_ (); -} - -ACE_INLINE void -ACE_U_LongLong::hi (const ACE_UINT32 hi) -{ - h_ () = hi; -} - -ACE_INLINE void -ACE_U_LongLong::lo (const ACE_UINT32 lo) -{ - l_ () = lo; -} - -ACE_INLINE -ACE_U_LongLong::~ACE_U_LongLong (void) -{ -} - -ACE_INLINE bool -ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const -{ - return h_ () == n.h_ () && l_ () == n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator== (const ACE_UINT32 n) const -{ - return h_ () == 0 && l_ () == n; -} - -ACE_INLINE bool -ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const -{ - return ! (*this == n); -} - -ACE_INLINE bool -ACE_U_LongLong::operator!= (const ACE_UINT32 n) const -{ - return ! (*this == n); -} - -ACE_INLINE bool -ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const -{ - return h_ () < n.h_ () ? 1 - : h_ () > n.h_ () ? 0 - : l_ () < n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator< (const ACE_UINT32 n) const -{ - return operator< (static_cast (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const -{ - return h_ () < n.h_ () ? 1 - : h_ () > n.h_ () ? 0 - : l_ () <= n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator<= (const ACE_UINT32 n) const -{ - return operator<= (static_cast (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const -{ - return h_ () > n.h_ () ? 1 - : h_ () < n.h_ () ? 0 - : l_ () > n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator> (const ACE_UINT32 n) const -{ - return operator> (static_cast (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const -{ - return h_ () > n.h_ () ? 1 - : h_ () < n.h_ () ? 0 - : l_ () >= n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator>= (const ACE_UINT32 n) const -{ - return operator>= (static_cast (n)); -} - -ACE_INLINE -ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n) -{ - h_ () = n.h_ (); - l_ () = n.l_ (); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_U_LongLong &n) -{ - h_ () = n.h_ (); - l_ () = n.l_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_INT32 &rhs) -{ - if (rhs >= 0) - { - l_ () = static_cast (rhs); - h_ () = 0; - } - else - { - // We do not handle the case where a negative 32 bit integer is - // assigned to this representation of a 64 bit unsigned integer. - // The "undefined behavior" behavior performed by this - // implementation is to simply set all bits to zero. - l_ () = 0; - h_ () = 0; - } - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_UINT32 &rhs) -{ - l_ () = rhs; - h_ () = 0; - - return *this; -} - - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const -{ - ACE_U_LongLong ret (l_ () + n.l_ (), h_ () + n.h_ ()); - if (ret.l_ () < n.l_ ()) /* carry */ ++ret.h_ (); - - return ret; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator+ (const ACE_UINT32 n) const -{ - return operator+ (static_cast (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const -{ - ACE_U_LongLong ret (l_ () - n.l_ (), h_ () - n.h_ ()); - if (l_ () < n.l_ ()) /* borrow */ --ret.h_ (); - - return ret; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator- (const ACE_UINT32 n) const -{ - return operator- (static_cast (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator<< (const u_int n) const -{ - const ACE_UINT32 carry_mask = l_ () >> (32 - n); - ACE_U_LongLong ret (n < 32 ? l_ () << n : 0, - n < 32 ? (h_ () << n) | carry_mask : carry_mask); - - return ret; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator<<= (const u_int n) -{ - const ACE_UINT32 carry_mask = l_ () >> (32 - n); - h_ () = n < 32 ? (h_ () << n) | carry_mask : carry_mask; - - // g++ 2.7.2.3/Solaris 2.5.1 doesn't modify l_ () if shifted by 32. - l_ () = n < 32 ? l_ () << n : 0; - - return *this; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator>> (const u_int n) const -{ - const ACE_UINT32 carry_mask = h_ () << (32 - n); - ACE_U_LongLong ret (n < 32 ? (l_ () >> n) | carry_mask : 0, - n < 32 ? h_ () >> n : 0); - - return ret; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator>>= (const u_int n) -{ - const ACE_UINT32 carry_mask = h_ () << (32 - n); - l_ () = n < 32 ? (l_ () >> n) | carry_mask : carry_mask; - h_ () = n < 32 ? h_ () >> n : 0; - - return *this; -} - -ACE_INLINE double -ACE_U_LongLong::operator/ (const double n) const -{ - // See the derivation above in operator/ (const ACE_UINT32). - - return ((double) 0xffffffffu - n + 1.0) / n * h_ () + - (double) h_ () + (double) l_ () / n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator+= (const ACE_U_LongLong &n) -{ - h_ () += n.h_ (); - l_ () += n.l_ (); - if (l_ () < n.l_ ()) /* carry */ ++h_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator+= (const ACE_UINT32 n) -{ - return operator+= (static_cast (n)); -} - -#define ACE_HIGHBIT (~(~0UL >> 1)) - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::ul_shift (ACE_UINT32 a, ACE_UINT32 c_in, ACE_UINT32 *c_out) const -{ - const ACE_UINT32 b = (a << 1) | c_in; - *c_out = (*c_out << 1) + ((a & ACE_HIGHBIT) > 0); - - return b; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::ull_shift (ACE_U_LongLong a, - ACE_UINT32 c_in, - ACE_UINT32 *c_out) const -{ - ACE_U_LongLong b; - - b.l_ () = (a.l_ () << 1) | c_in; - c_in = ((a.l_ () & ACE_HIGHBIT) > 0); - b.h_ () = (a.h_ () << 1) | c_in; - *c_out = (*c_out << 1) + ((a.h_ () & ACE_HIGHBIT) > 0); - - return b; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::ull_add (ACE_U_LongLong a, ACE_U_LongLong b, ACE_UINT32 *carry) const -{ - ACE_U_LongLong r (0, 0); - ACE_UINT32 c1, c2, c3, c4; - - c1 = a.l_ () % 2; - c2 = b.l_ () % 2; - c3 = 0; - - r.l_ () = a.l_ ()/2 + b.l_ ()/2 + (c1+c2)/2; - r.l_ () = ul_shift (r.l_ (), (c1+c2)%2, &c3); - - c1 = a.h_ () % 2; - c2 = b.h_ () % 2; - c4 = 0; - - r.h_ () = a.h_ ()/2 + b.h_ ()/2 + (c1+c2+c3)/2; - r.h_ () = ul_shift (r.h_ (), (c1+c2+c3)%2, &c4); - - *carry = c4; - - return r; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::ull_mult (ACE_U_LongLong a, ACE_UINT32 b, ACE_UINT32 *carry) const -{ - register ACE_UINT32 mask = ACE_HIGHBIT; - const ACE_U_LongLong zero (0, 0); - ACE_U_LongLong accum (0, 0); - ACE_UINT32 c; - - *carry = 0; - if (b > 0) - do - { - accum = ull_shift (accum, 0U, carry); - if (b & mask) - accum = ull_add (accum, a, &c); - else - accum = ull_add (accum, zero, &c); - *carry += c; - mask >>= 1; - } - while (mask > 0); - - return accum; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator* (const ACE_UINT32 n) const -{ - ACE_UINT32 carry; // will throw the carry away - - return ull_mult (*this, n, &carry); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator*= (const ACE_UINT32 n) -{ - ACE_UINT32 carry; // will throw the carry away - - return *this = ull_mult (*this, n, &carry); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-= (const ACE_U_LongLong &n) -{ - h_ () -= n.h_ (); - if (l_ () < n.l_ ()) /* borrow */ --h_ (); - l_ () -= n.l_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-= (const ACE_UINT32 n) -{ - return operator-= (static_cast (n)); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator++ () -{ - ++l_ (); - if (l_ () == 0) /* carry */ ++h_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-- () -{ - if (l_ () == 0) /* borrow */ --h_ (); - --l_ (); - - return *this; -} - -ACE_INLINE const ACE_U_LongLong -ACE_U_LongLong::operator++ (int) -{ - // Post-increment operator should always be implemented in terms of - // the pre-increment operator to enforce consistent semantics. - ACE_U_LongLong temp (*this); - ++*this; - return temp; -} - -ACE_INLINE const ACE_U_LongLong -ACE_U_LongLong::operator-- (int) -{ - // Post-decrement operator should always be implemented in terms of - // the pre-decrement operator to enforce consistent semantics. - ACE_U_LongLong temp (*this); - --*this; - return temp; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator|= (const ACE_U_LongLong n) -{ - l_ () |= n.l_ (); - h_ () |= n.h_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator|= (const ACE_UINT32 n) -{ - return operator|= (static_cast (n)); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator&= (const ACE_U_LongLong n) -{ - l_ () &= n.l_ (); - h_ () &= n.h_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator&= (const ACE_UINT32 n) -{ - return operator&= (static_cast (n)); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const ACE_UINT32 n) const -{ - // This takes advantage of the fact that the return type has only 32 - // bits. Replace 0x100000000 with 0xffffffff + 1 because the former - // has 33 bits. - // Quotient = (0x100000000u * hi_ + lo_) / n - // = ((0x100000000u - n + n) * hi_ + lo_) / n - // = ((0x100000000u - n) / n * hi_ + hi_ * n / n + lo_ / n - // = (0x100000000u - n) / n * hi_ + hi_ + lo_ / n - // = (0xffffffffu - n + 1) / n * hi_ + hi_ + lo_ / n - - return (0xffffffffu - n + 1) / n * h_ () + h_ () + l_ () / n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator% (const ACE_UINT32 n) const -{ - // Because the argument is an ACE_UINT32, the result can never be - // bigger than 32 bits. Replace 0x100000000 with 0xffffffff + 1 - // because the former has 33 bits. - // Mod = (0x100000000u * hi_ + lo_) % n - // = (0x100000000u % n * hi_ + lo_ % n) % n - // = ((0x100000000u - n) % n * hi_ + lo_ % n) % n - // = ((0xffffffffu - n + 1) % n * hi_ + lo_ % n) % n - - return ((0xffffffff - n + 1) % n * h_ () + l_ () % n) % n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator| (const ACE_INT32 n) const -{ - return l_ () | n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator& (const ACE_INT32 n) const -{ - return l_ () & n; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator* (const ACE_INT32 n) const -{ - return operator* ((ACE_UINT32) n); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator*= (const ACE_INT32 n) -{ - return operator*= ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const ACE_INT32 n) const -{ - return operator/ ((ACE_UINT32) n); -} - -#if ACE_SIZEOF_INT == 4 -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const u_long n) const -{ - return operator/ ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const long n) const -{ - return operator/ ((ACE_UINT32) n); -} - -#else /* ACE_SIZEOF_INT != 4 */ -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const u_int n) const -{ - return operator/ ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const int n) const -{ - return operator/ ((ACE_UINT32) n); -} -#endif /* ACE_SIZEOF_INT != 4 */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ diff --git a/ace/Bound_Ptr.h b/ace/Bound_Ptr.h deleted file mode 100644 index c80fe91dc65..00000000000 --- a/ace/Bound_Ptr.h +++ /dev/null @@ -1,344 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Bound_Ptr.h - * - * $Id$ - * - * @author Christopher Kohlhoff - */ -//============================================================================= - -#ifndef ACE_BOUND_PTR_H -#define ACE_BOUND_PTR_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Auto_Ptr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Bound_Ptr_Counter - * - * @brief An ACE_Bound_Ptr_Counter object encapsulates an - * object reference count. - * - * Do not use this class directly, use ACE_Strong_Bound_Ptr or - * ACE_Weak_Bound_Ptr instead. - */ -template -class ACE_Bound_Ptr_Counter -{ -public: - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - ACE_Bound_Ptr_Counter (int init_obj_ref_count = 0); - ~ACE_Bound_Ptr_Counter (void); - - /// Create a ACE_Bound_Ptr_Counter and initialize the - /// reference count to indicate ownership by a strong pointer. - static ACE_Bound_Ptr_Counter *create_strong (void); - - /// Increase both the object and counter reference counts and return - /// the new object reference count. A return value of -1 indicates - /// that the object has already been destroyed. - static int attach_strong (ACE_Bound_Ptr_Counter *counter); - - /// Decreases both the object and counter reference counts and - /// deletes whichever has no more references. Returns the new object - /// reference count. - static int detach_strong (ACE_Bound_Ptr_Counter *counter); - - /// Create a ACE_Bound_Ptr_Counter and initialize the - /// reference count to indicate no ownership. - static ACE_Bound_Ptr_Counter *create_weak (void); - - /// Increase the counter reference count and return argument. - static void attach_weak (ACE_Bound_Ptr_Counter *counter); - - /// Decreases the counter reference count and deletes the counter if - /// it has no more references. - static void detach_weak (ACE_Bound_Ptr_Counter *counter); - - /// Determine whether the object has been deleted. - static int object_was_deleted (ACE_Bound_Ptr_Counter *counter); - -private: - - /// Allocate a new ACE_Bound_Ptr_Counter instance, - /// returning NULL if it cannot be created. - static ACE_Bound_Ptr_Counter *internal_create (int init_obj_ref_count); - -private: - - /// Reference count of underlying object. Is set to -1 once the - /// object has been destroyed to indicate to all weak pointers that - /// it is no longer valid. - int obj_ref_count_; - - /// Reference count of this counter. - int self_ref_count_; - - /// Mutex variable to synchronize access to the reference counts. - ACE_LOCK lock_; -}; - -// Forward decl. -template class ACE_Weak_Bound_Ptr; - -/** - * @class ACE_Strong_Bound_Ptr - * - * @brief This class implements support for a reference counted - * pointer. - * - * Assigning or copying instances of an ACE_Strong_Bound_Ptr will - * automatically increment the reference count of the underlying object. - * When the last instance of an ACE_Strong_Bound_Ptr that references a - * particular object is destroyed or overwritten, it will invoke delete - * on its underlying pointer. - */ -template -class ACE_Strong_Bound_Ptr -{ -public: - /// Constructor that initializes an ACE_Strong_Bound_Ptr to point to the - /// object \ immediately. - explicit ACE_Strong_Bound_Ptr (X *p = 0); - - /// Constructor that initializes an ACE_Strong_Bound_Ptr by stealing - /// ownership of an object from an auto_ptr. - explicit ACE_Strong_Bound_Ptr (auto_ptr p); - - /// Copy constructor binds and to the same object. - ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr &r); - - /// Constructor binds and to the same object. - ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr &r); - - /// Destructor. - ~ACE_Strong_Bound_Ptr (void); - - /// Assignment operator that binds and to the same object. - void operator = (const ACE_Strong_Bound_Ptr &r); - - /// Assignment operator that binds and to the same object. - void operator = (const ACE_Weak_Bound_Ptr &r); - - /// Equality operator that returns @c true if both - /// ACE_Strong_Bound_Ptr instances point to the same underlying - /// object. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ - bool operator == (const ACE_Strong_Bound_Ptr &r) const; - - /// Equality operator that returns true if the ACE_Strong_Bound_Ptr - /// and ACE_Weak_Bound_Ptr objects point to the same underlying - /// object. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ - bool operator == (const ACE_Weak_Bound_Ptr &r) const; - - /// Equality operator that returns @c true if the - /// ACE_Strong_Bound_Ptr and the raw pointer point to the same - /// underlying object. - bool operator == (X *p) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (const ACE_Strong_Bound_Ptr &r) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (const ACE_Weak_Bound_Ptr &r) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (X *p) const; - - /// Redirection operator - X *operator-> (void) const; - - /// Dereference operator - X &operator * (void) const; - - /// Get the pointer value. - X *get (void) const; - - /// Resets the ACE_Strong_Bound_Ptr to refer to a different - /// underlying object. - void reset (X *p = 0); - - /// Resets the ACE_Strong_Bound_Ptr to refer to a different - /// underlying object, ownership of which is stolen from the - /// auto_ptr. - void reset (auto_ptr p); - - /// Allows us to check for NULL on all ACE_Strong_Bound_Ptr - /// objects. - int null (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - friend class ACE_Weak_Bound_Ptr; - - /// The ACE_Bound_Ptr_Counter type. - typedef ACE_Bound_Ptr_Counter COUNTER; - - /// The reference counter. - COUNTER *counter_; - - /// The underlying object. - X *ptr_; -}; - -/** - * @class ACE_Weak_Bound_Ptr - * - * @brief This class implements support for a weak pointer that complements - * ACE_Strong_Bound_Ptr. - * - * Unlike ACE_Strong_Bound_Ptr, assigning or copying instances of an - * ACE_Weak_Bound_Ptr will not automatically increment the reference - * count of the underlying object. What ACE_Weak_Bound_Ptr does is - * preserve the knowledge that the object is in fact reference - * counted, and thus provides an alternative to raw pointers where - * non-ownership associations must be maintained. When the last - * instance of an ACE_Strong_Bound_Ptr that references a particular - * object is destroyed or overwritten, the corresponding - * ACE_Weak_Bound_Ptr instances are set to NULL. - */ -template -class ACE_Weak_Bound_Ptr -{ -public: - /// Constructor that initializes an ACE_Weak_Bound_Ptr to point to - /// the object \ immediately. - explicit ACE_Weak_Bound_Ptr (X *p = 0); - - /// Copy constructor binds and to the same object. - ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr &r); - - /// Constructor binds and to the same object. - ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr &r); - - /// Destructor. - ~ACE_Weak_Bound_Ptr (void); - - /// Assignment operator that binds and to the same object. - void operator = (const ACE_Weak_Bound_Ptr &r); - - /// Assignment operator that binds and to the same object. - void operator = (const ACE_Strong_Bound_Ptr &r); - - /// Equality operator that returns @c true if both - /// ACE_Weak_Bound_Ptr objects point to the same underlying object. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ - bool operator == (const ACE_Weak_Bound_Ptr &r) const; - - /// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr - /// and ACE_Strong_Bound_Ptr objects point to the same underlying - /// object. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ - bool operator == (const ACE_Strong_Bound_Ptr &r) const; - - /// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr - /// and the raw pointer point to the same underlying object. - bool operator == (X *p) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (const ACE_Weak_Bound_Ptr &r) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (const ACE_Strong_Bound_Ptr &r) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (X *p) const; - - /// Redirection operator. - /** - * It returns a temporary strong pointer and makes use of the - * chaining properties of operator-> to ensure that the underlying - * object does not disappear while you are using it. If you are - * certain of the lifetimes of the object, and do not want to incur - * the locking overhead, then use the unsafe_get method instead. - */ - ACE_Strong_Bound_Ptr operator-> (void) const; - - /// Obtain a strong pointer corresponding to this weak pointer. This - /// function is useful to create a temporary strong pointer for - /// conversion to a reference. - ACE_Strong_Bound_Ptr strong (void) const; - - /// Get the pointer value. Warning: this does not affect the - /// reference count of the underlying object, so it may disappear on - /// you while you are using it if you are not careful. - X *unsafe_get (void) const; - - /// Resets the ACE_Weak_Bound_Ptr to refer to a different underlying - /// object. - void reset (X *p = 0); - - /// Increment the reference count on the underlying object. - /** - * Returns the new reference count on the object. This function may - * be used to integrate the bound pointers into an external - * reference counting mechanism such as those used by COM or CORBA - * servants. - */ - int add_ref (void); - - /// Decrement the reference count on the underlying object, which is deleted - /// if the count has reached zero. - /** - * Returns the new reference count on the object. This function may - * be used to integrate the bound pointers into an external - * reference counting mechanism such as those used by COM or CORBA - * servants. - */ - int remove_ref (void); - - /// Allows us to check for NULL on all ACE_Weak_Bound_Ptr objects. - int null (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - friend class ACE_Strong_Bound_Ptr; - - /// The ACE_Bound_Ptr_Counter type. - typedef ACE_Bound_Ptr_Counter COUNTER; - - /// The reference counter. - COUNTER *counter_; - - /// The underlying object. - X *ptr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include "ace/Bound_Ptr.inl" - -#include /**/ "ace/post.h" - -#endif /* ACE_BOUND_PTR_H */ diff --git a/ace/Bound_Ptr.inl b/ace/Bound_Ptr.inl deleted file mode 100644 index 7f6797156f9..00000000000 --- a/ace/Bound_Ptr.inl +++ /dev/null @@ -1,488 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// Bound_Ptr.i - -#include "ace/Guard_T.h" -#if !defined (ACE_NEW_THROWS_EXCEPTIONS) -# include "ace/Log_Msg.h" -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template inline ACE_Bound_Ptr_Counter * -ACE_Bound_Ptr_Counter::internal_create (int init_obj_ref_count) -{ - ACE_Bound_Ptr_Counter *temp = 0; - ACE_NEW_RETURN (temp, - ACE_Bound_Ptr_Counter (init_obj_ref_count), - 0); - return temp; -} - -template inline ACE_Bound_Ptr_Counter * -ACE_Bound_Ptr_Counter::create_strong (void) -{ - // Set initial object reference count to 1. - ACE_Bound_Ptr_Counter *temp = internal_create (1); -#if defined (ACE_NEW_THROWS_EXCEPTIONS) - if (temp == 0) - ACE_throw_bad_alloc; -#else - ACE_ASSERT (temp != 0); -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - return temp; -} - - - -template inline int -ACE_Bound_Ptr_Counter::attach_strong (ACE_Bound_Ptr_Counter* counter) -{ - ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1); - - // Can't attach a strong pointer to an object that has already been deleted. - if (counter->obj_ref_count_ == -1) - return -1; - - int new_obj_ref_count = ++counter->obj_ref_count_; - ++counter->self_ref_count_; - - return new_obj_ref_count; -} - -template inline int -ACE_Bound_Ptr_Counter::detach_strong (ACE_Bound_Ptr_Counter* counter) -{ - ACE_Bound_Ptr_Counter *counter_del = 0; - int new_obj_ref_count; - - { - ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1); - - if ((new_obj_ref_count = --counter->obj_ref_count_) == 0) - // Change the object reference count to -1 to indicate that the - // object has been deleted, as opposed to a weak pointer that - // simply hasn't had any strong pointers created from it yet. - counter->obj_ref_count_ = -1; - - if (--counter->self_ref_count_ == 0) - // Since counter contains the lock held by the ACE_Guard, the - // guard needs to be released before freeing the memory holding - // the lock. So save the pointer to free, then release, then - // free. - counter_del = counter; - - } // Release the lock - - delete counter_del; - - return new_obj_ref_count; -} - -template inline ACE_Bound_Ptr_Counter * -ACE_Bound_Ptr_Counter::create_weak (void) -{ - // Set initial object reference count to 0. - - ACE_Bound_Ptr_Counter *temp = internal_create (0); -#if defined (ACE_NEW_THROWS_EXCEPTIONS) - if (temp == 0) - ACE_throw_bad_alloc; -#else - ACE_ASSERT (temp != 0); -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - return temp; -} - -template inline void -ACE_Bound_Ptr_Counter::attach_weak (ACE_Bound_Ptr_Counter* counter) -{ - ACE_GUARD (ACE_LOCK, guard, counter->lock_); - - ++counter->self_ref_count_; -} - -template inline void -ACE_Bound_Ptr_Counter::detach_weak (ACE_Bound_Ptr_Counter* counter) -{ - ACE_Bound_Ptr_Counter *counter_del = 0; - - { - ACE_GUARD (ACE_LOCK, guard, counter->lock_); - - if (--counter->self_ref_count_ == 0) - // Since counter contains the lock held by the ACE_Guard, the - // guard needs to be released before freeing the memory holding - // the lock. So save the pointer to free, then release, then - // free. - counter_del = counter; - - } // Release the lock - - delete counter_del; -} - -template inline int -ACE_Bound_Ptr_Counter::object_was_deleted (ACE_Bound_Ptr_Counter *counter) -{ - ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, 0); - - return counter->obj_ref_count_ == -1; -} - -template inline -ACE_Bound_Ptr_Counter::ACE_Bound_Ptr_Counter (int init_obj_ref_count) - : obj_ref_count_ (init_obj_ref_count), - self_ref_count_ (1) -{ -} - -template inline -ACE_Bound_Ptr_Counter::~ACE_Bound_Ptr_Counter (void) -{ -} - -template inline -ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (X *p) - : counter_ (COUNTER::create_strong ()), - ptr_ (p) -{ -} - -template inline -ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (auto_ptr p) - : counter_ (COUNTER::create_strong ()), - ptr_ (p.release()) -{ -} - -template inline -ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr &r) - : counter_ (r.counter_), - ptr_ (r.ptr_) -{ - COUNTER::attach_strong (this->counter_); -} - -template inline -ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr &r) - : counter_ (r.counter_), - ptr_ (r.ptr_) -{ - // When creating a strong pointer from a weak one we can't assume that the - // underlying object still exists. Therefore we must check for a return value - // of -1, which indicates that the object has been destroyed. - if (COUNTER::attach_strong (this->counter_) == -1) - { - // Underlying object has already been deleted, so set this pointer to null. - this->counter_ = COUNTER::create_strong (); - this->ptr_ = 0; - } -} - -template inline -ACE_Strong_Bound_Ptr::~ACE_Strong_Bound_Ptr (void) -{ - if (COUNTER::detach_strong (this->counter_) == 0) - delete this->ptr_; -} - -template inline void -ACE_Strong_Bound_Ptr::operator = (const ACE_Strong_Bound_Ptr &rhs) -{ - // This will work if &r == this, by first increasing the ref count - - COUNTER *new_counter = rhs.counter_; - X* new_ptr = rhs.ptr_; - COUNTER::attach_strong (new_counter); - if (COUNTER::detach_strong (this->counter_) == 0) - delete this->ptr_; - this->counter_ = new_counter; - this->ptr_ = new_ptr; -} - -template inline void -ACE_Strong_Bound_Ptr::operator = (const ACE_Weak_Bound_Ptr &rhs) -{ - // This will work if &r == this, by first increasing the ref count - - COUNTER *new_counter = rhs.counter_; - X* new_ptr = rhs.ptr_; - - // When creating a strong pointer from a weak one we can't assume that the - // underlying object still exists. Therefore we must check for a return value - // of -1, which indicates that the object has been destroyed. - if (COUNTER::attach_strong (new_counter) == -1) - { - // Underlying object has already been deleted, so set this pointer to null. - new_counter = COUNTER::create_strong (); - new_ptr = 0; - } - - if (COUNTER::detach_strong (this->counter_) == 0) - delete this->ptr_; - this->counter_ = new_counter; - this->ptr_ = new_ptr; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator== (const ACE_Strong_Bound_Ptr &r) const -{ - return this->ptr_ == r.ptr_; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator== (const ACE_Weak_Bound_Ptr &r) const -{ - // Use the weak pointer's operator== since it will check for null. - return r == *this; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator== (X *p) const -{ - return this->ptr_ == p; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator!= (const ACE_Strong_Bound_Ptr &r) const -{ - return this->ptr_ != r.ptr_; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator!= (const ACE_Weak_Bound_Ptr &r) const -{ - // Use the weak pointer's operator!= since it will check for null. - return r != *this; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator!= (X *p) const -{ - return this->ptr_ != p; -} - -template inline X * -ACE_Strong_Bound_Ptr::operator-> (void) const -{ - return this->ptr_; -} - -template inline X & -ACE_Strong_Bound_Ptr::operator *() const -{ - return *this->ptr_; -} - -template inline X* -ACE_Strong_Bound_Ptr::get (void) const -{ - return this->ptr_; -} - -template inline int -ACE_Strong_Bound_Ptr::null (void) const -{ - return this->ptr_ == 0; -} - -template inline void -ACE_Strong_Bound_Ptr::reset (X *p) -{ - COUNTER *old_counter = this->counter_; - X* old_ptr = this->ptr_; - this->counter_ = COUNTER::create_strong (); - this->ptr_ = p; - if (COUNTER::detach_strong (old_counter) == 0) - delete old_ptr; -} - -template inline void -ACE_Strong_Bound_Ptr::reset (auto_ptr p) -{ - COUNTER *old_counter = this->counter_; - X* old_ptr = this->ptr_; - this->counter_ = COUNTER::create_strong (); - this->ptr_ = p.release (); - if (COUNTER::detach_strong (old_counter) == 0) - delete old_ptr; -} - -template inline -ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr (X *p) - : counter_ (COUNTER::create_weak ()), - ptr_ (p) -{ -} - -template inline -ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr &r) - : counter_ (r.counter_), - ptr_ (r.ptr_) -{ - COUNTER::attach_weak (this->counter_); -} - -template inline -ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr &r) - : counter_ (r.counter_), - ptr_ (r.ptr_) -{ - COUNTER::attach_weak (this->counter_); -} - -template inline -ACE_Weak_Bound_Ptr::~ACE_Weak_Bound_Ptr (void) -{ - COUNTER::detach_weak (this->counter_); -} - -template inline void -ACE_Weak_Bound_Ptr::operator = (const ACE_Weak_Bound_Ptr &rhs) -{ - // This will work if &rhs == this, by first increasing the ref count - COUNTER *new_counter = rhs.counter_; - COUNTER::attach_weak (new_counter); - COUNTER::detach_weak (this->counter_); - this->counter_ = new_counter; - this->ptr_ = rhs.ptr_; -} - -template inline void -ACE_Weak_Bound_Ptr::operator = (const ACE_Strong_Bound_Ptr &rhs) -{ - // This will work if &rhs == this, by first increasing the ref count - COUNTER *new_counter = rhs.counter_; - COUNTER::attach_weak (new_counter); - COUNTER::detach_weak (this->counter_); - this->counter_ = new_counter; - this->ptr_ = rhs.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator== (const ACE_Weak_Bound_Ptr &r) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return r.ptr_ == 0; - - return this->ptr_ == r.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator== (const ACE_Strong_Bound_Ptr &r) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return r.ptr_ == 0; - - return this->ptr_ == r.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator== (X *p) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return p == 0; - - return this->ptr_ == p; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator!= (const ACE_Weak_Bound_Ptr &r) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return r.ptr_ != 0; - - return this->ptr_ != r.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator!= (const ACE_Strong_Bound_Ptr &r) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return r.ptr_ != 0; - - return this->ptr_ != r.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator!= (X *p) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return p != 0; - - return this->ptr_ != p; -} - -template inline ACE_Strong_Bound_Ptr -ACE_Weak_Bound_Ptr::operator-> (void) const -{ - return ACE_Strong_Bound_Ptr (*this); -} - -template inline ACE_Strong_Bound_Ptr -ACE_Weak_Bound_Ptr::strong (void) const -{ - return ACE_Strong_Bound_Ptr (*this); -} - -template inline X* -ACE_Weak_Bound_Ptr::unsafe_get (void) const -{ - // We do not check if the object has been deleted, since this operation - // is defined to be unsafe! - return this->ptr_; -} - -template inline int -ACE_Weak_Bound_Ptr::null (void) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return 1; - - return this->ptr_ == 0; -} - -template inline void -ACE_Weak_Bound_Ptr::reset (X *p) -{ - COUNTER *old_counter = this->counter_; - this->counter_ = COUNTER::create_weak (); - this->ptr_ = p; - COUNTER::detach_weak (old_counter); -} - -template inline int -ACE_Weak_Bound_Ptr::add_ref () -{ - return COUNTER::attach_strong (counter_); -} - -template inline int -ACE_Weak_Bound_Ptr::remove_ref () -{ - int new_obj_ref_count = COUNTER::detach_strong (counter_); - if (new_obj_ref_count == 0) - { - delete this->ptr_; - this->ptr_ = 0; - } - return new_obj_ref_count; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Base.cpp b/ace/CDR_Base.cpp deleted file mode 100644 index 8b051985eba..00000000000 --- a/ace/CDR_Base.cpp +++ /dev/null @@ -1,639 +0,0 @@ -#include "ace/CDR_Base.h" - -#if !defined (__ACE_INLINE__) -# include "ace/CDR_Base.inl" -#endif /* ! __ACE_INLINE__ */ - -#include "ace/Message_Block.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID (ace, - CDR_Base, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// -// See comments in CDR_Base.inl about optimization cases for swap_XX_array. -// - -void -ACE_CDR::swap_2_array (char const * orig, char* target, size_t n) -{ - // ACE_ASSERT(n > 0); The caller checks that n > 0 - - // We pretend that AMD64/GNU G++ systems have a Pentium CPU to - // take advantage of the inline assembly implementation. - - // Later, we try to read in 32 or 64 bit chunks, - // so make sure we don't do that for unaligned addresses. -#if ACE_SIZEOF_LONG == 8 && \ - !(defined(__amd64__) && defined(__GNUG__)) - char const * const o8 = ACE_ptr_align_binary (orig, 8); - while (orig < o8 && n > 0) - { - ACE_CDR::swap_2 (orig, target); - orig += 2; - target += 2; - --n; - } -#else - char const * const o4 = ACE_ptr_align_binary (orig, 4); - // this is an _if_, not a _while_. The mistmatch can only be by 2. - if (orig != o4) - { - ACE_CDR::swap_2 (orig, target); - orig += 2; - target += 2; - --n; - } -#endif - if (n == 0) - return; - - // - // Loop unrolling. Here be dragons. - // - - // (n & (~3)) is the greatest multiple of 4 not bigger than n. - // In the while loop ahead, orig will move over the array by 8 byte - // increments (4 elements of 2 bytes). - // end marks our barrier for not falling outside. - char const * const end = orig + 2 * (n & (~3)); - - // See if we're aligned for writting in 64 or 32 bit chunks... -#if ACE_SIZEOF_LONG == 8 && \ - !(defined(__amd64__) && defined(__GNUG__)) - if (target == ACE_ptr_align_binary (target, 8)) -#else - if (target == ACE_ptr_align_binary (target, 4)) -#endif - { - while (orig < end) - { -#if (defined (ACE_HAS_PENTIUM) || defined(__amd64__)) && defined (__GNUG__) - unsigned int a = - * reinterpret_cast (orig); - unsigned int b = - * reinterpret_cast (orig + 4); - asm ( "bswap %1" : "=r" (a) : "0" (a) ); - asm ( "bswap %1" : "=r" (b) : "0" (b) ); - asm ( "rol $16, %1" : "=r" (a) : "0" (a) ); - asm ( "rol $16, %1" : "=r" (b) : "0" (b) ); - * reinterpret_cast (target) = a; - * reinterpret_cast (target + 4) = b; -#elif defined(ACE_HAS_PENTIUM) \ - && (defined(_MSC_VER) || defined(__BORLANDC__)) \ - && !defined(ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ecx, orig; - __asm mov edx, target; - __asm mov eax, [ecx]; - __asm mov ebx, 4[ecx]; - __asm bswap eax; - __asm bswap ebx; - __asm rol eax, 16; - __asm rol ebx, 16; - __asm mov [edx], eax; - __asm mov 4[edx], ebx; -#elif ACE_SIZEOF_LONG == 8 - // 64 bit architecture. - register unsigned long a = - * reinterpret_cast (orig); - - register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8; - register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8; - - a = (a1 | a2); - - * reinterpret_cast (target) = a; -#else - register ACE_UINT32 a = - * reinterpret_cast (orig); - register ACE_UINT32 b = - * reinterpret_cast (orig + 4); - - register ACE_UINT32 a1 = (a & 0x00ff00ffU) << 8; - register ACE_UINT32 b1 = (b & 0x00ff00ffU) << 8; - register ACE_UINT32 a2 = (a & 0xff00ff00U) >> 8; - register ACE_UINT32 b2 = (b & 0xff00ff00U) >> 8; - - a = (a1 | a2); - b = (b1 | b2); - - * reinterpret_cast (target) = a; - * reinterpret_cast (target + 4) = b; -#endif - orig += 8; - target += 8; - } - } - else - { - // We're out of luck. We have to write in 2 byte chunks. - while (orig < end) - { -#if (defined (ACE_HAS_PENTIUM) || defined(__amd64__)) && defined (__GNUG__) - unsigned int a = - * reinterpret_cast (orig); - unsigned int b = - * reinterpret_cast (orig + 4); - asm ( "bswap %1" : "=r" (a) : "0" (a) ); - asm ( "bswap %1" : "=r" (b) : "0" (b) ); - // We're little endian. - * reinterpret_cast (target + 2) - = (unsigned short) (a & 0xffff); - * reinterpret_cast (target + 6) - = (unsigned short) (b & 0xffff); - asm ( "shrl $16, %1" : "=r" (a) : "0" (a) ); - asm ( "shrl $16, %1" : "=r" (b) : "0" (b) ); - * reinterpret_cast (target + 0) - = (unsigned short) (a & 0xffff); - * reinterpret_cast (target + 4) - = (unsigned short) (b & 0xffff); -#elif defined (ACE_HAS_PENTIUM) \ - && (defined (_MSC_VER) || defined (__BORLANDC__)) \ - && !defined (ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ecx, orig; - __asm mov edx, target; - __asm mov eax, [ecx]; - __asm mov ebx, 4[ecx]; - __asm bswap eax; - __asm bswap ebx; - // We're little endian. - __asm mov 2[edx], ax; - __asm mov 6[edx], bx; - __asm shr eax, 16; - __asm shr ebx, 16; - __asm mov 0[edx], ax; - __asm mov 4[edx], bx; -#elif ACE_SIZEOF_LONG == 8 - // 64 bit architecture. - register unsigned long a = - * reinterpret_cast (orig); - - register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8; - register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8; - - a = (a1 | a2); - - ACE_UINT16 b1 = static_cast (a >> 48); - ACE_UINT16 b2 = static_cast ((a >> 32) & 0xffff); - ACE_UINT16 b3 = static_cast ((a >> 16) & 0xffff); - ACE_UINT16 b4 = static_cast (a & 0xffff); - -#if defined(ACE_LITTLE_ENDIAN) - * reinterpret_cast (target) = b4; - * reinterpret_cast (target + 2) = b3; - * reinterpret_cast (target + 4) = b2; - * reinterpret_cast (target + 6) = b1; -#else - * reinterpret_cast (target) = b1; - * reinterpret_cast (target + 2) = b2; - * reinterpret_cast (target + 4) = b3; - * reinterpret_cast (target + 6) = b4; -#endif -#else - register ACE_UINT32 a = - * reinterpret_cast (orig); - register ACE_UINT32 b = - * reinterpret_cast (orig + 4); - - register ACE_UINT32 a1 = (a & 0x00ff00ff) << 8; - register ACE_UINT32 b1 = (b & 0x00ff00ff) << 8; - register ACE_UINT32 a2 = (a & 0xff00ff00) >> 8; - register ACE_UINT32 b2 = (b & 0xff00ff00) >> 8; - - a = (a1 | a2); - b = (b1 | b2); - - ACE_UINT32 c1 = static_cast (a >> 16); - ACE_UINT32 c2 = static_cast (a & 0xffff); - ACE_UINT32 c3 = static_cast (b >> 16); - ACE_UINT32 c4 = static_cast (b & 0xffff); - -#if defined(ACE_LITTLE_ENDIAN) - * reinterpret_cast (target) = c2; - * reinterpret_cast (target + 2) = c1; - * reinterpret_cast (target + 4) = c4; - * reinterpret_cast (target + 6) = c3; -#else - * reinterpret_cast (target) = c1; - * reinterpret_cast (target + 2) = c2; - * reinterpret_cast (target + 4) = c3; - * reinterpret_cast (target + 6) = c4; -#endif -#endif - - orig += 8; - target += 8; - } - } - - // (n & 3) == (n % 4). - switch (n&3) { - case 3: - ACE_CDR::swap_2 (orig, target); - orig += 2; - target += 2; - case 2: - ACE_CDR::swap_2 (orig, target); - orig += 2; - target += 2; - case 1: - ACE_CDR::swap_2 (orig, target); - } -} - -void -ACE_CDR::swap_4_array (char const * orig, char* target, size_t n) -{ - // ACE_ASSERT (n > 0); The caller checks that n > 0 - -#if ACE_SIZEOF_LONG == 8 - // Later, we read from *orig in 64 bit chunks, - // so make sure we don't generate unaligned readings. - char const * const o8 = ACE_ptr_align_binary (orig, 8); - // The mismatch can only be by 4. - if (orig != o8) - { - ACE_CDR::swap_4 (orig, target); - orig += 4; - target += 4; - --n; - } -#endif /* ACE_SIZEOF_LONG == 8 */ - - if (n == 0) - return; - - // - // Loop unrolling. Here be dragons. - // - - // (n & (~3)) is the greatest multiple of 4 not bigger than n. - // In the while loop, orig will move over the array by 16 byte - // increments (4 elements of 4 bytes). - // ends marks our barrier for not falling outside. - char const * const end = orig + 4 * (n & (~3)); - -#if ACE_SIZEOF_LONG == 8 - // 64 bits architecture. - // See if we can write in 8 byte chunks. - if (target == ACE_ptr_align_binary (target, 8)) - { - while (orig < end) - { - register unsigned long a = - * reinterpret_cast (orig); - register unsigned long b = - * reinterpret_cast (orig + 8); - -#if defined(__amd64__) && defined(__GNUC__) - asm ("bswapq %1" : "=r" (a) : "0" (a)); - asm ("bswapq %1" : "=r" (b) : "0" (b)); - asm ("rol $32, %1" : "=r" (a) : "0" (a)); - asm ("rol $32, %1" : "=r" (b) : "0" (b)); -#else - register unsigned long a84 = (a & 0x000000ff000000ffL) << 24; - register unsigned long b84 = (b & 0x000000ff000000ffL) << 24; - register unsigned long a73 = (a & 0x0000ff000000ff00L) << 8; - register unsigned long b73 = (b & 0x0000ff000000ff00L) << 8; - register unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8; - register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8; - register unsigned long a51 = (a & 0xff000000ff000000L) >> 24; - register unsigned long b51 = (b & 0xff000000ff000000L) >> 24; - - a = (a84 | a73 | a62 | a51); - b = (b84 | b73 | b62 | b51); -#endif - - * reinterpret_cast (target) = a; - * reinterpret_cast (target + 8) = b; - - orig += 16; - target += 16; - } - } - else - { - // We are out of luck, we have to write in 4 byte chunks. - while (orig < end) - { - register unsigned long a = - * reinterpret_cast (orig); - register unsigned long b = - * reinterpret_cast (orig + 8); - -#if defined(__amd64__) && defined(__GNUC__) - asm ("bswapq %1" : "=r" (a) : "0" (a)); - asm ("bswapq %1" : "=r" (b) : "0" (b)); - asm ("rol $32, %1" : "=r" (a) : "0" (a)); - asm ("rol $32, %1" : "=r" (b) : "0" (b)); -#else - register unsigned long a84 = (a & 0x000000ff000000ffL) << 24; - register unsigned long b84 = (b & 0x000000ff000000ffL) << 24; - register unsigned long a73 = (a & 0x0000ff000000ff00L) << 8; - register unsigned long b73 = (b & 0x0000ff000000ff00L) << 8; - register unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8; - register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8; - register unsigned long a51 = (a & 0xff000000ff000000L) >> 24; - register unsigned long b51 = (b & 0xff000000ff000000L) >> 24; - - a = (a84 | a73 | a62 | a51); - b = (b84 | b73 | b62 | b51); -#endif - - ACE_UINT32 c1 = static_cast (a >> 32); - ACE_UINT32 c2 = static_cast (a & 0xffffffff); - ACE_UINT32 c3 = static_cast (b >> 32); - ACE_UINT32 c4 = static_cast (b & 0xffffffff); - -#if defined (ACE_LITTLE_ENDIAN) - * reinterpret_cast (target + 0) = c2; - * reinterpret_cast (target + 4) = c1; - * reinterpret_cast (target + 8) = c4; - * reinterpret_cast (target + 12) = c3; -#else - * reinterpret_cast (target + 0) = c1; - * reinterpret_cast (target + 4) = c2; - * reinterpret_cast (target + 8) = c3; - * reinterpret_cast (target + 12) = c4; -#endif - orig += 16; - target += 16; - } - } - -#else /* ACE_SIZEOF_LONG != 8 */ - - while (orig < end) - { -#if defined (ACE_HAS_PENTIUM) && defined (__GNUG__) - register unsigned int a = - *reinterpret_cast (orig); - register unsigned int b = - *reinterpret_cast (orig + 4); - register unsigned int c = - *reinterpret_cast (orig + 8); - register unsigned int d = - *reinterpret_cast (orig + 12); - - asm ("bswap %1" : "=r" (a) : "0" (a)); - asm ("bswap %1" : "=r" (b) : "0" (b)); - asm ("bswap %1" : "=r" (c) : "0" (c)); - asm ("bswap %1" : "=r" (d) : "0" (d)); - - *reinterpret_cast (target) = a; - *reinterpret_cast (target + 4) = b; - *reinterpret_cast (target + 8) = c; - *reinterpret_cast (target + 12) = d; -#elif defined (ACE_HAS_PENTIUM) \ - && (defined (_MSC_VER) || defined (__BORLANDC__)) \ - && !defined (ACE_LACKS_INLINE_ASSEMBLY) - __asm mov eax, orig - __asm mov esi, target - __asm mov edx, [eax] - __asm mov ecx, 4[eax] - __asm mov ebx, 8[eax] - __asm mov eax, 12[eax] - __asm bswap edx - __asm bswap ecx - __asm bswap ebx - __asm bswap eax - __asm mov [esi], edx - __asm mov 4[esi], ecx - __asm mov 8[esi], ebx - __asm mov 12[esi], eax -#else - register ACE_UINT32 a = - * reinterpret_cast (orig); - register ACE_UINT32 b = - * reinterpret_cast (orig + 4); - register ACE_UINT32 c = - * reinterpret_cast (orig + 8); - register ACE_UINT32 d = - * reinterpret_cast (orig + 12); - - // Expect the optimizer reordering this A LOT. - // We leave it this way for clarity. - a = (a << 24) | ((a & 0xff00) << 8) | ((a & 0xff0000) >> 8) | (a >> 24); - b = (b << 24) | ((b & 0xff00) << 8) | ((b & 0xff0000) >> 8) | (b >> 24); - c = (c << 24) | ((c & 0xff00) << 8) | ((c & 0xff0000) >> 8) | (c >> 24); - d = (d << 24) | ((d & 0xff00) << 8) | ((d & 0xff0000) >> 8) | (d >> 24); - - * reinterpret_cast (target) = a; - * reinterpret_cast (target + 4) = b; - * reinterpret_cast (target + 8) = c; - * reinterpret_cast (target + 12) = d; -#endif - - orig += 16; - target += 16; - } - -#endif /* ACE_SIZEOF_LONG == 8 */ - - // (n & 3) == (n % 4). - switch (n & 3) { - case 3: - ACE_CDR::swap_4 (orig, target); - orig += 4; - target += 4; - case 2: - ACE_CDR::swap_4 (orig, target); - orig += 4; - target += 4; - case 1: - ACE_CDR::swap_4 (orig, target); - } -} - -// -// We don't benefit from unrolling in swap_8_array and swap_16_array -// (swap_8 and swap_16 are big enough). -// -void -ACE_CDR::swap_8_array (char const * orig, char* target, size_t n) -{ - // ACE_ASSERT(n > 0); The caller checks that n > 0 - - char const * const end = orig + 8*n; - while (orig < end) - { - swap_8 (orig, target); - orig += 8; - target += 8; - } -} - -void -ACE_CDR::swap_16_array (char const * orig, char* target, size_t n) -{ - // ACE_ASSERT(n > 0); The caller checks that n > 0 - - char const * const end = orig + 16*n; - while (orig < end) - { - swap_16 (orig, target); - orig += 16; - target += 16; - } -} - -void -ACE_CDR::mb_align (ACE_Message_Block *mb) -{ -#if !defined (ACE_CDR_IGNORE_ALIGNMENT) - char * const start = ACE_ptr_align_binary (mb->base (), - ACE_CDR::MAX_ALIGNMENT); -#else - char * const start = mb->base (); -#endif /* ACE_CDR_IGNORE_ALIGNMENT */ - mb->rd_ptr (start); - mb->wr_ptr (start); -} - -int -ACE_CDR::grow (ACE_Message_Block *mb, size_t minsize) -{ - size_t newsize = - ACE_CDR::first_size (minsize + ACE_CDR::MAX_ALIGNMENT); - - if (newsize <= mb->size ()) - return 0; - - ACE_Data_Block *db = - mb->data_block ()->clone_nocopy (0, newsize); - - if (db == 0) - return -1; - - // Do the equivalent of ACE_CDR::mb_align() here to avoid having - // to allocate an ACE_Message_Block on the stack thereby avoiding - // the manipulation of the data blocks reference count - size_t mb_len = mb->length (); - char *start = ACE_ptr_align_binary (db->base (), - ACE_CDR::MAX_ALIGNMENT); - - ACE_OS::memcpy (start, mb->rd_ptr (), mb_len); - mb->data_block (db); - - // Setting the data block on the mb resets the read and write - // pointers back to the beginning. We must set the rd_ptr to the - // aligned start and adjust the write pointer to the end - mb->rd_ptr (start); - mb->wr_ptr (start + mb_len); - - // Remove the DONT_DELETE flags from mb - mb->clr_self_flags (ACE_Message_Block::DONT_DELETE); - - return 0; -} - -size_t -ACE_CDR::total_length (const ACE_Message_Block* begin, - const ACE_Message_Block* end) -{ - size_t l = 0; - // Compute the total size. - for (const ACE_Message_Block *i = begin; - i != end; - i = i->cont ()) - l += i->length (); - return l; -} - -void -ACE_CDR::consolidate (ACE_Message_Block *dst, - const ACE_Message_Block *src) -{ - if (src == 0) - return; - - size_t newsize = - ACE_CDR::first_size (ACE_CDR::total_length (src, 0) - + ACE_CDR::MAX_ALIGNMENT); - dst->size (newsize); - -#if !defined (ACE_CDR_IGNORE_ALIGNMENT) - // We must copy the contents of into the new buffer, but - // respecting the alignment. - ptrdiff_t srcalign = - ptrdiff_t(src->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - ptrdiff_t dstalign = - ptrdiff_t(dst->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - ptrdiff_t offset = srcalign - dstalign; - if (offset < 0) - offset += ACE_CDR::MAX_ALIGNMENT; - dst->rd_ptr (static_cast (offset)); - dst->wr_ptr (dst->rd_ptr ()); -#endif /* ACE_CDR_IGNORE_ALIGNMENT */ - - for (const ACE_Message_Block* i = src; - i != 0; - i = i->cont ()) - { - // If the destination and source are the same, do not - // attempt to copy the data. Just update the write pointer. - if (dst->wr_ptr () != i->rd_ptr ()) - dst->copy (i->rd_ptr (), i->length ()); - else - dst->wr_ptr (i->length ()); - } -} - -#if defined (NONNATIVE_LONGLONG) -bool -ACE_CDR::LongLong::operator== (const ACE_CDR::LongLong &rhs) const -{ - return this->h == rhs.h && this->l == rhs.l; -} - -bool -ACE_CDR::LongLong::operator!= (const ACE_CDR::LongLong &rhs) const -{ - return this->l != rhs.l || this->h != rhs.h; -} - -#endif /* NONNATIVE_LONGLONG */ - -#if defined (NONNATIVE_LONGDOUBLE) -bool -ACE_CDR::LongDouble::operator== (const ACE_CDR::LongDouble &rhs) const -{ - return ACE_OS::memcmp (this->ld, rhs.ld, 16) == 0; -} - -bool -ACE_CDR::LongDouble::operator!= (const ACE_CDR::LongDouble &rhs) const -{ - return ACE_OS::memcmp (this->ld, rhs.ld, 16) != 0; -} - -#endif /* NONNATIVE_LONGDOUBLE */ - -#if defined(_UNICOS) && !defined(_CRAYMPP) -// placeholders to get things compiling -ACE_CDR::Float::Float (void) -{ -} - -ACE_CDR::Float::Float (const float & /* init */) -{ -} - -ACE_CDR::Float & -ACE_CDR::Float::operator= (const float & /* rhs */) -{ - return *this; -} - -bool -ACE_CDR::Float::operator!= (const ACE_CDR::Float & /* rhs */) const -{ - return false; -} -#endif /* _UNICOS */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Base.h b/ace/CDR_Base.h deleted file mode 100644 index 8b04184fcc8..00000000000 --- a/ace/CDR_Base.h +++ /dev/null @@ -1,302 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CDR_Base.h - * - * $Id$ - * - * ACE Common Data Representation (CDR) basic types. - * - * The current implementation assumes that the host has 1-byte, - * 2-byte and 4-byte integral types, and that it has single - * precision and double precision IEEE floats. - * Those assumptions are pretty good these days, with Crays being - * the only known exception. - * - * - * @author TAO version by - * @author Aniruddha Gokhale - * @author Carlos O'Ryan - * @author ACE version by - * @author Jeff Parsons - * @author Istvan Buki - */ -//============================================================================= - - -#ifndef ACE_CDR_BASE_H -#define ACE_CDR_BASE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Basic_Types.h" -#include "ace/Default_Constants.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Message_Block; - -/** - * @class ACE_CDR - * - * @brief Keep constants and some routines common to both Output and - * Input CDR streams. - */ -class ACE_Export ACE_CDR -{ -public: - // = Constants defined by the CDR protocol. - // By defining as many of these constants as possible as enums we - // ensure they get inlined and avoid pointless static memory - // allocations. - - enum - { - // Note that some of these get reused as part of the standard - // binary format: unsigned is the same size as its signed cousin, - // float is LONG_SIZE, and double is LONGLONG_SIZE. - - OCTET_SIZE = 1, - SHORT_SIZE = 2, - LONG_SIZE = 4, - LONGLONG_SIZE = 8, - LONGDOUBLE_SIZE = 16, - - OCTET_ALIGN = 1, - SHORT_ALIGN = 2, - LONG_ALIGN = 4, - LONGLONG_ALIGN = 8, - /// @note the CORBA LongDouble alignment requirements do not - /// match its size... - LONGDOUBLE_ALIGN = 8, - - /// Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "CDR::Long - /// double", size as above). - MAX_ALIGNMENT = 8, - - /// The default buffer size. - /** - * @todo We want to add options to control this - * default value, so this constant should be read as the default - * default value ;-) - */ - DEFAULT_BUFSIZE = ACE_DEFAULT_CDR_BUFSIZE, - - /// The buffer size grows exponentially until it reaches this size; - /// afterwards it grows linearly using the next constant - EXP_GROWTH_MAX = ACE_DEFAULT_CDR_EXP_GROWTH_MAX, - - /// Once exponential growth is ruled out the buffer size increases - /// in chunks of this size, note that this constants have the same - /// value right now, but it does not need to be so. - LINEAR_GROWTH_CHUNK = ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK - }; - - /** - * Do byte swapping for each basic IDL type size. There exist only - * routines to put byte, halfword (2 bytes), word (4 bytes), - * doubleword (8 bytes) and quadword (16 byte); because those are - * the IDL basic type sizes. - */ - static void swap_2 (char const *orig, char *target); - static void swap_4 (char const *orig, char *target); - static void swap_8 (char const *orig, char *target); - static void swap_16 (char const *orig, char *target); - static void swap_2_array (char const *orig, - char *target, - size_t length); - static void swap_4_array (char const *orig, - char *target, - size_t length); - static void swap_8_array (char const *orig, - char *target, - size_t length); - static void swap_16_array (char const *orig, - char *target, - size_t length); - - /// Align the message block to ACE_CDR::MAX_ALIGNMENT, - /// set by the CORBA spec at 8 bytes. - static void mb_align (ACE_Message_Block *mb); - - /** - * Compute the size of the smallest buffer that can contain at least - * @a minsize bytes. - * To understand how a "best fit" is computed look at the - * algorithm in the code. - * Basically the buffers grow exponentially, up to a certain point, - * then the buffer size grows linearly. - * The advantage of this algorithm is that is rapidly grows to a - * large value, but does not explode at the end. - */ - static size_t first_size (size_t minsize); - - /// Compute not the smallest, but the second smallest buffer that - /// will fir @a minsize bytes. - static size_t next_size (size_t minsize); - - /** - * Increase the capacity of mb to contain at least @a minsize bytes. - * If @a minsize is zero the size is increased by an amount at least - * large enough to contain any of the basic IDL types. - * @retval -1 Failure - * @retval 0 Success. - */ - static int grow (ACE_Message_Block *mb, size_t minsize); - - /// Copy a message block chain into a single message block, - /// preserving the alignment of the first message block of the - /// original stream, not the following message blocks. - static void consolidate (ACE_Message_Block *dst, - const ACE_Message_Block *src); - - static size_t total_length (const ACE_Message_Block *begin, - const ACE_Message_Block *end); - - /** - * @name Basic OMG IDL Types - * - * These types are for use in the CDR classes. The cleanest way to - * avoid complaints from all compilers is to define them all. - */ - //@{ - typedef bool Boolean; - typedef unsigned char Octet; - typedef char Char; - typedef ACE_WCHAR_T WChar; - typedef ACE_INT16 Short; - typedef ACE_UINT16 UShort; - typedef ACE_INT32 Long; - typedef ACE_UINT32 ULong; - typedef ACE_UINT64 ULongLong; - -# if (defined (_MSC_VER)) || (defined (__BORLANDC__)) - typedef __int64 LongLong; -# elif ACE_SIZEOF_LONG == 8 && !defined(_CRAYMPP) - typedef long LongLong; -# elif defined(__TANDEM) - typedef long long LongLong; -# elif ACE_SIZEOF_LONG_LONG == 8 && !defined (ACE_LACKS_LONGLONG_T) -# if defined (sun) && !defined (ACE_LACKS_U_LONGLONG_T) - // sun #defines u_longlong_t, maybe other platforms do also. - // Use it, at least with g++, so that its -pedantic doesn't - // complain about no ANSI C++ long long. - typedef longlong_t LongLong; -# else - // LynxOS 2.5.0 and Linux don't have u_longlong_t. - typedef long long LongLong; -# endif /* sun */ -# else /* no native 64 bit integer type */ -# define NONNATIVE_LONGLONG - struct ACE_Export LongLong - { -# if defined (ACE_BIG_ENDIAN) - ACE_CDR::Long h; - ACE_CDR::Long l; -# else - ACE_CDR::Long l; - ACE_CDR::Long h; -# endif /* ! ACE_BIG_ENDIAN */ - - /** - * @name Overloaded Relation Operators. - * - * The canonical comparison operators. - */ - //@{ - bool operator== (const LongLong &rhs) const; - bool operator!= (const LongLong &rhs) const; - //@} - }; -# endif /* no native 64 bit integer type */ - -# if defined (NONNATIVE_LONGLONG) -# define ACE_CDR_LONGLONG_INITIALIZER {0,0} -# else -# define ACE_CDR_LONGLONG_INITIALIZER 0 -# endif /* NONNATIVE_LONGLONG */ - -# if ACE_SIZEOF_FLOAT == 4 - typedef float Float; -# else /* ACE_SIZEOF_FLOAT != 4 */ - struct Float - { -# if ACE_SIZEOF_INT == 4 - // Use unsigned int to get word alignment. - unsigned int f; -# else /* ACE_SIZEOF_INT != 4 */ - // Applications will probably have trouble with this. - char f[4]; -# if defined(_UNICOS) && !defined(_CRAYMPP) - Float (void); - Float (const float &init); - Float & operator= (const float &rhs); - bool operator!= (const Float &rhs) const; -# endif /* _UNICOS */ -# endif /* ACE_SIZEOF_INT != 4 */ - }; -# endif /* ACE_SIZEOF_FLOAT != 4 */ - -# if ACE_SIZEOF_DOUBLE == 8 - typedef double Double; -# else /* ACE_SIZEOF_DOUBLE != 8 */ - struct Double - { -# if ACE_SIZEOF_LONG == 8 - // Use u long to get word alignment. - unsigned long f; -# else /* ACE_SIZEOF_INT != 8 */ - // Applications will probably have trouble with this. - char f[8]; -# endif /* ACE_SIZEOF_INT != 8 */ - }; -# endif /* ACE_SIZEOF_DOUBLE != 8 */ - - // 94-9-32 Appendix A defines a 128 bit floating point "long - // double" data type, with greatly extended precision and four - // more bits of exponent (compared to "double"). This is an IDL - // extension, not yet standard. - -# if ACE_SIZEOF_LONG_DOUBLE == 16 - typedef long double LongDouble; -# define ACE_CDR_LONG_DOUBLE_INITIALIZER 0 -# else -# define NONNATIVE_LONGDOUBLE -# define ACE_CDR_LONG_DOUBLE_INITIALIZER {{0}} - struct ACE_Export LongDouble - { - char ld[16]; - bool operator== (const LongDouble &rhs) const; - bool operator!= (const LongDouble &rhs) const; - // @@ also need other comparison operators. - }; -# endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */ - - //@} - -#if !defined (ACE_CDR_GIOP_MAJOR_VERSION) -# define ACE_CDR_GIOP_MAJOR_VERSION 1 -#endif /*ACE_CDR_GIOP_MAJOR_VERSION */ - -#if !defined (ACE_CDR_GIOP_MINOR_VERSION) -# define ACE_CDR_GIOP_MINOR_VERSION 2 -#endif /* ACE_CDR_GIOP_MINOR_VERSION */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/CDR_Base.inl" -#endif /* __ACE_INLINE__ */ - - -#include /**/ "ace/post.h" - -#endif /* ACE_CDR_BASE_H */ diff --git a/ace/CDR_Base.inl b/ace/CDR_Base.inl deleted file mode 100644 index 3a2026e9cb3..00000000000 --- a/ace/CDR_Base.inl +++ /dev/null @@ -1,210 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// -// The ACE_CDR::swap_X and ACE_CDR::swap_X_array routines are broken -// in 4 cases for optimization: -// -// * AMD64 CPU + gnu g++ -// => gcc amd64 inline assembly. -// -// * x86 Pentium CPU + gnu g++ -// (ACE_HAS_PENTIUM && __GNUG__) -// => gcc x86 inline assembly. -// -// * x86 Pentium CPU and (_MSC_VER) or BORLAND C++) -// (ACE_HAS_PENTIUM && ( _MSC_VER || __BORLANDC__ ) -// => MSC x86 inline assembly. -// -// * 64 bit architecture -// (ACE_SIZEOF_LONG == 8) -// => shift/masks using 64bit words. -// -// * default -// (none of the above) -// => shift/masks using 32bit words. -// -// -// Some things you could find useful to know if you intend to mess -// with this optimizations for swaps: -// -// * MSVC++ don't assume register values are conserved between -// statements. So you can clobber any register you want, -// whenever you want (well not *anyone* really, see manual). -// The MSVC++ optimizer will try to pick different registers -// for the C++ statements sorrounding your asm block, and if -// it's not possible will use the stack. -// -// * If you clobber registers with asm statements in gcc, you -// better do it in an asm-only function, or save/restore them -// before/after in the stack. If not, sorrounding C statements -// could end using the same registers and big-badda-bum (been -// there, done that...). The big-badda-bum could happen *even -// if you specify the clobbered register in your asm's*. -// Even better, use gcc asm syntax for detecting the register -// asigned to a certain variable so you don't have to clobber any -// register directly. -// - -ACE_INLINE void -ACE_CDR::swap_2 (const char *orig, char* target) -{ -#if (defined(ACE_HAS_PENTIUM) || defined (__amd64__)) && defined(__GNUG__) - unsigned short a = - *reinterpret_cast (orig); - asm( "rolw $8, %0" : "=r" (a) : "0" (a) ); - *reinterpret_cast (target) = a; -#elif defined (ACE_HAS_PENTIUM) \ - && (defined(_MSC_VER) || defined(__BORLANDC__)) \ - && !defined(ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ebx, orig; - __asm mov ecx, target; - __asm mov ax, [ebx]; - __asm rol ax, 8; - __asm mov [ecx], ax; -#else - register ACE_UINT16 usrc = * reinterpret_cast (orig); - register ACE_UINT16* udst = reinterpret_cast (target); - *udst = (usrc << 8) | (usrc >> 8); -#endif /* ACE_HAS_PENTIUM */ -} - -ACE_INLINE void -ACE_CDR::swap_4 (const char* orig, char* target) -{ -#if (defined(ACE_HAS_PENTIUM) || defined (__amd64__)) && defined(__GNUG__) - // We have ACE_HAS_PENTIUM, so we know the sizeof's. - register unsigned int j = - *reinterpret_cast (orig); - asm ("bswap %1" : "=r" (j) : "0" (j)); - *reinterpret_cast (target) = j; -#elif defined(ACE_HAS_PENTIUM) \ - && (defined(_MSC_VER) || defined(__BORLANDC__)) \ - && !defined(ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ebx, orig; - __asm mov ecx, target; - __asm mov eax, [ebx]; - __asm bswap eax; - __asm mov [ecx], eax; -#else - register ACE_UINT32 x = * reinterpret_cast (orig); - x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24); - * reinterpret_cast (target) = x; -#endif -} - -ACE_INLINE void -ACE_CDR::swap_8 (const char* orig, char* target) -{ -#if defined(__amd64__) && defined(__GNUG__) - register unsigned long x = - * reinterpret_cast (orig); - asm ("bswapq %1" : "=r" (x) : "0" (x)); - *reinterpret_cast (target) = x; -#elif defined(ACE_HAS_PENTIUM) && defined(__GNUG__) - register unsigned int i = - *reinterpret_cast (orig); - register unsigned int j = - *reinterpret_cast (orig + 4); - asm ("bswap %1" : "=r" (i) : "0" (i)); - asm ("bswap %1" : "=r" (j) : "0" (j)); - *reinterpret_cast (target + 4) = i; - *reinterpret_cast (target) = j; -#elif defined(ACE_HAS_PENTIUM) \ - && (defined(_MSC_VER) || defined(__BORLANDC__)) \ - && !defined(ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ecx, orig; - __asm mov edx, target; - __asm mov eax, [ecx]; - __asm mov ebx, 4[ecx]; - __asm bswap eax; - __asm bswap ebx; - __asm mov 4[edx], eax; - __asm mov [edx], ebx; -#elif ACE_SIZEOF_LONG == 8 - // 64 bit architecture. - register unsigned long x = - * reinterpret_cast (orig); - register unsigned long x84 = (x & 0x000000ff000000ffUL) << 24; - register unsigned long x73 = (x & 0x0000ff000000ff00UL) << 8; - register unsigned long x62 = (x & 0x00ff000000ff0000UL) >> 8; - register unsigned long x51 = (x & 0xff000000ff000000UL) >> 24; - x = (x84 | x73 | x62 | x51); - x = (x << 32) | (x >> 32); - *reinterpret_cast (target) = x; -#else - register ACE_UINT32 x = - * reinterpret_cast (orig); - register ACE_UINT32 y = - * reinterpret_cast (orig + 4); - x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24); - y = (y << 24) | ((y & 0xff00) << 8) | ((y & 0xff0000) >> 8) | (y >> 24); - * reinterpret_cast (target) = y; - * reinterpret_cast (target + 4) = x; -#endif -} - -ACE_INLINE void -ACE_CDR::swap_16 (const char* orig, char* target) -{ - swap_8 (orig + 8, target); - swap_8 (orig, target + 8); -} - -ACE_INLINE size_t -ACE_CDR::first_size (size_t minsize) -{ - if (minsize == 0) - return ACE_CDR::DEFAULT_BUFSIZE; - - size_t newsize = ACE_CDR::DEFAULT_BUFSIZE; - while (newsize < minsize) - { - if (newsize < ACE_CDR::EXP_GROWTH_MAX) - { - // We grow exponentially at the beginning, this is fast and - // reduces the number of allocations. - - // Quickly multiply by two using a bit shift. This is - // guaranteed to work since the variable is an unsigned - // integer. - newsize <<= 1; - } - else - { - // but continuing with exponential growth can result in over - // allocations and easily yield an allocation failure. - // So we grow linearly when the buffer is too big. - newsize += ACE_CDR::LINEAR_GROWTH_CHUNK; - } - } - return newsize; -} - -ACE_INLINE size_t -ACE_CDR::next_size (size_t minsize) -{ - size_t newsize = - ACE_CDR::first_size (minsize); - - if (newsize == minsize) - { - // If necessary increment the size - if (newsize < ACE_CDR::EXP_GROWTH_MAX) - // Quickly multiply by two using a bit shift. This is - // guaranteed to work since the variable is an unsigned - // integer. - newsize <<= 1; - else - newsize += ACE_CDR::LINEAR_GROWTH_CHUNK; - } - - return newsize; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** diff --git a/ace/CDR_Size.cpp b/ace/CDR_Size.cpp deleted file mode 100644 index f9f759ad227..00000000000 --- a/ace/CDR_Size.cpp +++ /dev/null @@ -1,250 +0,0 @@ -#include "ace/CDR_Size.h" -#include "ace/SString.h" - -#if !defined (__ACE_INLINE__) -# include "ace/CDR_Size.inl" -#endif /* ! __ACE_INLINE__ */ - -ACE_RCSID (ace, - CDR_Size, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_CDR::Boolean -ACE_SizeCDR::write_wchar (ACE_CDR::WChar x) -{ - // Note: translator framework is not supported. - // - if (ACE_OutputCDR::wchar_maxbytes () == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len = - static_cast (ACE_OutputCDR::wchar_maxbytes ()); - if (this->write_1 (&len)) - { - if (ACE_OutputCDR::wchar_maxbytes () == sizeof(ACE_CDR::WChar)) - return - this->write_octet_array ( - reinterpret_cast (&x), - static_cast (len)); - else - if (ACE_OutputCDR::wchar_maxbytes () == 2) - { - ACE_CDR::Short sx = static_cast (x); - return - this->write_octet_array ( - reinterpret_cast (&sx), - static_cast (len)); - } - else - { - ACE_CDR::Octet ox = static_cast (x); - return - this->write_octet_array ( - reinterpret_cast (&ox), - static_cast (len)); - } - } - } - else if (static_cast (minor_version_) == 0) - { // wchar is not allowed with GIOP 1.0. - errno = EINVAL; - return (this->good_bit_ = false); - } - if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar)) - return this->write_4 (reinterpret_cast (&x)); - else if (ACE_OutputCDR::wchar_maxbytes () == 2) - { - ACE_CDR::Short sx = static_cast (x); - return this->write_2 (reinterpret_cast (&sx)); - } - ACE_CDR::Octet ox = static_cast (x); - return this->write_1 (reinterpret_cast (&ox)); -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_string (ACE_CDR::ULong len, - const ACE_CDR::Char *x) -{ - // Note: translator framework is not supported. - // - if (len != 0) - { - if (this->write_ulong (len + 1)) - return this->write_char_array (x, len + 1); - } - else - { - // Be nice to programmers: treat nulls as empty strings not - // errors. (OMG-IDL supports languages that don't use the C/C++ - // notion of null v. empty strings; nulls aren't part of the OMG-IDL - // string model.) - if (this->write_ulong (1)) - return this->write_char (0); - } - - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_string (const ACE_CString &x) -{ - // @@ Leave this method in here, not the `.i' file so that we don't - // have to unnecessarily pull in the `ace/SString.h' header. - return this->write_string (static_cast (x.length ()), - x.c_str()); -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_wstring (ACE_CDR::ULong len, - const ACE_CDR::WChar *x) -{ - // Note: translator framework is not supported. - // - if (ACE_OutputCDR::wchar_maxbytes () == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - - if (static_cast (this->major_version_) == 1 - && static_cast (this->minor_version_) == 2) - { - if (x != 0) - { - //In GIOP 1.2 the length field contains the number of bytes - //the wstring occupies rather than number of wchars - //Taking sizeof might not be a good way! This is a temporary fix. - if (this->write_ulong (ACE_OutputCDR::wchar_maxbytes () * len)) - return this->write_wchar_array (x, len); - } - else - //In GIOP 1.2 zero length wstrings are legal - return this->write_ulong (0); - } - - else - if (x != 0) - { - if (this->write_ulong (len + 1)) - return this->write_wchar_array (x, len + 1); - } - else if (this->write_ulong (1)) - return this->write_wchar (0); - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_1 (const ACE_CDR::Octet *x) -{ - ACE_UNUSED_ARG (x); - this->adjust (1); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_2 (const ACE_CDR::UShort *x) -{ - ACE_UNUSED_ARG (x); - this->adjust (ACE_CDR::SHORT_SIZE); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_4 (const ACE_CDR::ULong *x) -{ - ACE_UNUSED_ARG (x); - this->adjust (ACE_CDR::LONG_SIZE); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_8 (const ACE_CDR::ULongLong *x) -{ - ACE_UNUSED_ARG (x); - this->adjust (ACE_CDR::LONGLONG_SIZE); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_16 (const ACE_CDR::LongDouble *x) -{ - ACE_UNUSED_ARG (x); - this->adjust (ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_wchar_array_i (const ACE_CDR::WChar *x, - ACE_CDR::ULong length) -{ - ACE_UNUSED_ARG (x); - - if (length == 0) - return true; - - const size_t align = (ACE_OutputCDR::wchar_maxbytes () == 2) ? - ACE_CDR::SHORT_ALIGN : - ACE_CDR::OCTET_ALIGN; - - this->adjust (ACE_OutputCDR::wchar_maxbytes () * length, align); - return true; -} - - -ACE_CDR::Boolean -ACE_SizeCDR::write_array (const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - ACE_UNUSED_ARG (x); - - if (length == 0) - return true; - - this->adjust (size * length, align); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_boolean_array (const ACE_CDR::Boolean* x, - ACE_CDR::ULong length) -{ - ACE_UNUSED_ARG (x); - this->adjust (length, 1); - return true; -} - -void -ACE_SizeCDR::adjust (size_t size) -{ - adjust (size, size); -} - -void -ACE_SizeCDR::adjust (size_t size, - size_t align) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - const size_t offset = ACE_align_binary (size_, align) - size_; - size_ += offset; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - size_ += size; -} - -ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, const ACE_CString &x) -{ - ss.write_string (x); - return ss.good_bit (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Size.h b/ace/CDR_Size.h deleted file mode 100644 index f2bf59ce98c..00000000000 --- a/ace/CDR_Size.h +++ /dev/null @@ -1,241 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CDR_Size.h - * - * $Id$ - * - * - * ACE Common Data Representation (CDR) size-calculating stream. - * - * - * The current implementation assumes that the host has 1-byte, - * 2-byte and 4-byte integral types, and that it has single - * precision and double precision IEEE floats. - * Those assumptions are pretty good these days, with Crays beign - * the only known exception. - * - * - * @author Boris Kolpackov - * - */ -//============================================================================= - -#ifndef ACE_CDR_SIZE_H -#define ACE_CDR_SIZE_H - -#include /**/ "ace/pre.h" - -#include "ace/CDR_Base.h" -#include "ace/CDR_Stream.h" // for ACE_OutputCDR::from_* - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SStringfwd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SizeCDR - * - * @brief A CDR stream for calculating size of the representation. - * - */ -class ACE_Export ACE_SizeCDR -{ -public: - /// Default constructor. - ACE_SizeCDR (ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /// Returns @c false if an error has ocurred. - bool good_bit (void) const; - - - /// Reset current size. - void reset (void); - - - /// Return current size. - size_t total_length (void) const; - - - // Return 0 on failure and 1 on success. - //@{ @name Size-calculating pseudo-write operations - ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x); - ACE_CDR::Boolean write_char (ACE_CDR::Char x); - ACE_CDR::Boolean write_wchar (ACE_CDR::WChar x); - ACE_CDR::Boolean write_octet (ACE_CDR::Octet x); - ACE_CDR::Boolean write_short (ACE_CDR::Short x); - ACE_CDR::Boolean write_ushort (ACE_CDR::UShort x); - ACE_CDR::Boolean write_long (ACE_CDR::Long x); - ACE_CDR::Boolean write_ulong (ACE_CDR::ULong x); - ACE_CDR::Boolean write_longlong (const ACE_CDR::LongLong &x); - ACE_CDR::Boolean write_ulonglong (const ACE_CDR::ULongLong &x); - ACE_CDR::Boolean write_float (ACE_CDR::Float x); - ACE_CDR::Boolean write_double (const ACE_CDR::Double &x); - ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x); - - /// For string we offer methods that accept a precomputed length. - ACE_CDR::Boolean write_string (const ACE_CDR::Char *x); - ACE_CDR::Boolean write_string (ACE_CDR::ULong len, - const ACE_CDR::Char *x); - ACE_CDR::Boolean write_string (const ACE_CString &x); - ACE_CDR::Boolean write_wstring (const ACE_CDR::WChar *x); - ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length, - const ACE_CDR::WChar *x); - //@} - - /// @note the portion written starts at and ends - /// at . - /// The length is *NOT* stored into the CDR stream. - //@{ @name Array write operations - ACE_CDR::Boolean write_boolean_array (const ACE_CDR::Boolean *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_char_array (const ACE_CDR::Char *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_wchar_array (const ACE_CDR::WChar* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_octet_array (const ACE_CDR::Octet* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_short_array (const ACE_CDR::Short *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ushort_array (const ACE_CDR::UShort *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_long_array (const ACE_CDR::Long *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ulong_array (const ACE_CDR::ULong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_longlong_array (const ACE_CDR::LongLong* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ulonglong_array (const ACE_CDR::ULongLong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_float_array (const ACE_CDR::Float *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_double_array (const ACE_CDR::Double *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x, - ACE_CDR::ULong length); - - /// - /// Adjust to and count octets. - void adjust (size_t size); - - /// As above, but now the size and alignment requirements may be - /// different. - void adjust (size_t size, - size_t align); - -private: - /// disallow copying... - ACE_SizeCDR (const ACE_SizeCDR& rhs); - ACE_SizeCDR& operator= (const ACE_SizeCDR& rhs); - - ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x); - ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x); - ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x); - ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x); - ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x); - - /** - * write an array of elements, each of bytes and the - * start aligned at a multiple of . The elements are assumed - * to be packed with the right alignment restrictions. It is mostly - * designed for buffers of the basic types. - * - * This operation uses ; as explained above it is expected - * that using assignment is faster that for one element, - * but for several elements should be more efficient, it - * could be interesting to find the break even point and optimize - * for that case, but that would be too platform dependent. - */ - ACE_CDR::Boolean write_array (const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - - ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x, - ACE_CDR::ULong length); - -private: - /// Set to false when an error ocurrs. - bool good_bit_; - - /// Current size. - size_t size_; - -protected: - /// GIOP version information - ACE_CDR::Octet major_version_; - ACE_CDR::Octet minor_version_; -}; - -// @@ This operator should not be inlined since they force SString.h -// to be included in this header. -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - const ACE_CString &x); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/CDR_Size.inl" -#else /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Not used by CORBA or TAO -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Char x); - -// CDR size-calculating output operators for primitive types - -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Short x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::UShort x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Long x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::ULong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::LongLong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::ULongLong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR& ss, - ACE_CDR::LongDouble x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Float x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Double x); - -// CDR size-calculating output operator from helper classes - -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_boolean x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_char x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_wchar x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_octet x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_string x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_wstring x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - const ACE_CDR::Char* x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - const ACE_CDR::WChar* x); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* __ACE_INLINE__ */ - - -#include /**/ "ace/post.h" - -#endif /* ACE_CDR_SIZE_H */ diff --git a/ace/CDR_Size.inl b/ace/CDR_Size.inl deleted file mode 100644 index 4c835067ce8..00000000000 --- a/ace/CDR_Size.inl +++ /dev/null @@ -1,420 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SizeCDR::ACE_SizeCDR (ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : good_bit_ (true), - size_ (0), - major_version_ (major_version), - minor_version_ (minor_version) -{ -} - -ACE_INLINE bool -ACE_SizeCDR::good_bit (void) const -{ - return this->good_bit_; -} - -ACE_INLINE void -ACE_SizeCDR::reset (void) -{ - this->size_ = 0; -} - -ACE_INLINE size_t -ACE_SizeCDR::total_length (void) const -{ - return this->size_; -} - - -// Encode the CDR stream. - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_octet (ACE_CDR::Octet x) -{ - return this->write_1 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_boolean (ACE_CDR::Boolean x) -{ - return (ACE_CDR::Boolean) this->write_octet (x ? (ACE_CDR::Octet) 1 : (ACE_CDR::Octet) 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_char (ACE_CDR::Char x) -{ - // Note: translator framework is not supported. - // - return this->write_1 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_short (ACE_CDR::Short x) -{ - return this->write_2 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ushort (ACE_CDR::UShort x) -{ - return this->write_2 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_long (ACE_CDR::Long x) -{ - return this->write_4 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ulong (ACE_CDR::ULong x) -{ - return this->write_4 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_longlong (const ACE_CDR::LongLong &x) -{ - return this->write_8 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ulonglong (const ACE_CDR::ULongLong &x) -{ - return this->write_8 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_float (ACE_CDR::Float x) -{ - return this->write_4 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_double (const ACE_CDR::Double &x) -{ - return this->write_8 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_longdouble (const ACE_CDR::LongDouble &x) -{ - return this->write_16 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_string (const ACE_CDR::Char *x) -{ - if (x != 0) - { - const ACE_CDR::ULong len = - static_cast (ACE_OS::strlen (x)); - return this->write_string (len, x); - } - return this->write_string (0, 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_wstring (const ACE_CDR::WChar *x) -{ - if (x != 0) - { - ACE_CDR::ULong len = - static_cast (ACE_OS::strlen (x)); - return this->write_wstring (len, x); - } - return this->write_wstring (0, 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_char_array (const ACE_CDR::Char *x, - ACE_CDR::ULong length) -{ - // Note: translator framework is not supported. - // - return this->write_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_wchar_array (const ACE_CDR::WChar* x, - ACE_CDR::ULong length) -{ - // Note: translator framework is not supported. - // - if (ACE_OutputCDR::wchar_maxbytes () == 0) - { - errno = EACCES; - return (ACE_CDR::Boolean) (this->good_bit_ = false); - } - if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar)) - return this->write_array (x, - sizeof (ACE_CDR::WChar), - sizeof (ACE_CDR::WChar) == 2 - ? ACE_CDR::SHORT_ALIGN - : ACE_CDR::LONG_ALIGN, - length); - return this->write_wchar_array_i (x,length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_octet_array (const ACE_CDR::Octet* x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_short_array (const ACE_CDR::Short *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ushort_array (const ACE_CDR::UShort *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_long_array (const ACE_CDR::Long *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ulong_array (const ACE_CDR::ULong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_longlong_array (const ACE_CDR::LongLong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_float_array (const ACE_CDR::Float *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_double_array (const ACE_CDR::Double *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_longdouble_array (const ACE_CDR::LongDouble* x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - length); -} - - -// **************************************************************** - - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Char x) -{ - ss.write_char (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Short x) -{ - ss.write_short (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::UShort x) -{ - ss.write_ushort (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Long x) -{ - ss.write_long (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::ULong x) -{ - ss.write_ulong (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::LongLong x) -{ - ss.write_longlong (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::ULongLong x) -{ - ss.write_ulonglong (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::LongDouble x) -{ - ss.write_longdouble (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Float x) -{ - ss.write_float (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Double x) -{ - ss.write_double (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, const ACE_CDR::Char *x) -{ - ss.write_string (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, const ACE_CDR::WChar *x) -{ - ss.write_wstring (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -// The following use the helper classes -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_boolean x) -{ - ss.write_boolean (x.val_); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_char x) -{ - ss.write_char (x.val_); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_wchar x) -{ - ss.write_wchar (x.val_); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_octet x) -{ - ss.write_octet (x.val_); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_string x) -{ - ACE_CDR::ULong len = 0; - - if (x.val_ != 0) - { - len = static_cast (ACE_OS::strlen (x.val_)); - } - - ss.write_string (len, x.val_); - return - (ACE_CDR::Boolean) (ss.good_bit () && (!x.bound_ || len <= x.bound_)); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_wstring x) -{ - ACE_CDR::ULong len = 0; - - if (x.val_ != 0) - { - len = static_cast (ACE_OS::strlen (x.val_)); - } - - ss.write_wstring (len, x.val_); - return - (ACE_CDR::Boolean) (ss.good_bit () && (!x.bound_ || len <= x.bound_)); -} - - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp deleted file mode 100644 index d7030235d5d..00000000000 --- a/ace/CDR_Stream.cpp +++ /dev/null @@ -1,1740 +0,0 @@ -#include "ace/CDR_Stream.h" -#include "ace/SString.h" - -#if !defined (__ACE_INLINE__) -# include "ace/CDR_Stream.inl" -#endif /* ! __ACE_INLINE__ */ - -ACE_RCSID (ace, - CDR_Stream, - "$Id$") - -// **************************************************************** - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -int ACE_OutputCDR::wchar_maxbytes_ = sizeof (ACE_CDR::WChar); - -ACE_OutputCDR::ACE_OutputCDR (size_t size, - int byte_order, - ACE_Allocator *buffer_allocator, - ACE_Allocator *data_block_allocator, - ACE_Allocator *message_block_allocator, - size_t memcpy_tradeoff, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ ((size ? size : (size_t) ACE_CDR::DEFAULT_BUFSIZE) + ACE_CDR::MAX_ALIGNMENT, - ACE_Message_Block::MB_DATA, - 0, - 0, - buffer_allocator, - 0, - 0, - ACE_Time_Value::zero, - ACE_Time_Value::max_time, - data_block_allocator, - message_block_allocator), -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - current_alignment_ (0), -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - current_is_writable_ (true), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - memcpy_tradeoff_ (memcpy_tradeoff), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) - -{ - ACE_CDR::mb_align (&this->start_); - this->current_ = &this->start_; -} - -ACE_OutputCDR::ACE_OutputCDR (char *data, - size_t size, - int byte_order, - ACE_Allocator *buffer_allocator, - ACE_Allocator *data_block_allocator, - ACE_Allocator *message_block_allocator, - size_t memcpy_tradeoff, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (size, - ACE_Message_Block::MB_DATA, - 0, - data, - buffer_allocator, - 0, - 0, - ACE_Time_Value::zero, - ACE_Time_Value::max_time, - data_block_allocator, - message_block_allocator), -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - current_alignment_ (0), -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - current_is_writable_ (true), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - memcpy_tradeoff_ (memcpy_tradeoff), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ - // We cannot trust the buffer to be properly aligned - ACE_CDR::mb_align (&this->start_); - this->current_ = &this->start_; -} - -ACE_OutputCDR::ACE_OutputCDR (ACE_Data_Block *data_block, - int byte_order, - ACE_Allocator *message_block_allocator, - size_t memcpy_tradeoff, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (data_block, - ACE_Message_Block::DONT_DELETE, - message_block_allocator), - current_alignment_ (0), - current_is_writable_ (true), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - memcpy_tradeoff_ (memcpy_tradeoff), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ - // We cannot trust the buffer to be properly aligned - ACE_CDR::mb_align (&this->start_); - this->current_ = &this->start_; -} - -ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data, - int byte_order, - size_t memcpy_tradeoff, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (data->data_block ()->duplicate ()), -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - current_alignment_ (0), -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - current_is_writable_ (true), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - memcpy_tradeoff_ (memcpy_tradeoff), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ - // We cannot trust the buffer to be properly aligned - ACE_CDR::mb_align (&this->start_); - this->current_ = &this->start_; -} - -/*static*/ void -ACE_OutputCDR::wchar_maxbytes (int maxbytes) -{ - ACE_OutputCDR::wchar_maxbytes_ = maxbytes; -} - -/*static*/ int -ACE_OutputCDR::wchar_maxbytes () -{ - return ACE_OutputCDR::wchar_maxbytes_; -} - -int -ACE_OutputCDR::grow_and_adjust (size_t size, - size_t align, - char*& buf) -{ - if (!this->current_is_writable_ - || this->current_->cont () == 0 - || this->current_->cont ()->size () < size + ACE_CDR::MAX_ALIGNMENT) - { - // Calculate the new buffer's length; if growing for encode, we - // don't grow in "small" chunks because of the cost. - size_t cursize = this->current_->size (); - if (this->current_->cont () != 0) - cursize = this->current_->cont ()->size (); - size_t minsize = size; - -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - minsize += ACE_CDR::MAX_ALIGNMENT; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - // Make sure that there is enough room for bytes, but - // also make it bigger than whatever our current size is. - if (minsize < cursize) - minsize = cursize; - - const size_t newsize = ACE_CDR::next_size (minsize); - - this->good_bit_ = false; - ACE_Message_Block* tmp = 0; - ACE_NEW_RETURN (tmp, - ACE_Message_Block (newsize, - ACE_Message_Block::MB_DATA, - 0, - 0, - this->current_->data_block ()->allocator_strategy (), - 0, - 0, - ACE_Time_Value::zero, - ACE_Time_Value::max_time, - this->current_->data_block ()->data_block_allocator ()), - -1); - this->good_bit_ = true; - -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - // The new block must start with the same alignment as the - // previous block finished. - ptrdiff_t tmpalign = - ptrdiff_t(tmp->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - ptrdiff_t curalign = - ptrdiff_t(this->current_alignment_) % ACE_CDR::MAX_ALIGNMENT; - ptrdiff_t offset = curalign - tmpalign; - if (offset < 0) - offset += ACE_CDR::MAX_ALIGNMENT; - tmp->rd_ptr (static_cast (offset)); - tmp->wr_ptr (tmp->rd_ptr ()); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - // grow the chain and set the current block. - tmp->cont (this->current_->cont ()); - this->current_->cont (tmp); - } - this->current_ = this->current_->cont (); - this->current_is_writable_ = true; - - return this->adjust (size, align, buf); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) -{ - if (this->wchar_translator_ != 0) - return (this->good_bit_ = this->wchar_translator_->write_wchar (*this, x)); - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len = - static_cast (ACE_OutputCDR::wchar_maxbytes_); - if (this->write_1 (&len)) - { - if (ACE_OutputCDR::wchar_maxbytes_ == sizeof(ACE_CDR::WChar)) - return - this->write_octet_array ( - reinterpret_cast (&x), - static_cast (len)); - else - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::Short sx = static_cast (x); - return - this->write_octet_array ( - reinterpret_cast (&sx), - static_cast (len)); - } - else - { - ACE_CDR::Octet ox = static_cast (x); - return - this->write_octet_array ( - reinterpret_cast (&ox), - static_cast (len)); - } - } - } - else if (static_cast (minor_version_) == 0) - { // wchar is not allowed with GIOP 1.0. - errno = EINVAL; - return (this->good_bit_ = false); - } - if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) - return this->write_4 (reinterpret_cast (&x)); - else if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::Short sx = static_cast (x); - return this->write_2 (reinterpret_cast (&sx)); - } - ACE_CDR::Octet ox = static_cast (x); - return this->write_1 (reinterpret_cast (&ox)); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_string (ACE_CDR::ULong len, - const ACE_CDR::Char *x) -{ - // @@ This is a slight violation of "Optimize for the common case", - // i.e. normally the translator will be 0, but OTOH the code is - // smaller and should be better for the cache ;-) ;-) - if (this->char_translator_ != 0) - return this->char_translator_->write_string (*this, len, x); - - if (len != 0) - { - if (this->write_ulong (len + 1)) - return this->write_char_array (x, len + 1); - } - else - { - // Be nice to programmers: treat nulls as empty strings not - // errors. (OMG-IDL supports languages that don't use the C/C++ - // notion of null v. empty strings; nulls aren't part of the OMG-IDL - // string model.) - if (this->write_ulong (1)) - return this->write_char (0); - } - - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_string (const ACE_CString &x) -{ - // @@ Leave this method in here, not the `.i' file so that we don't - // have to unnecessarily pull in the `ace/SString.h' header. - return this->write_string (static_cast (x.length ()), - x.c_str()); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, - const ACE_CDR::WChar *x) -{ - // @@ This is a slight violation of "Optimize for the common case", - // i.e. normally the translator will be 0, but OTOH the code is - // smaller and should be better for the cache ;-) ;-) - // What do we do for GIOP 1.2??? - if (this->wchar_translator_ != 0) - return this->wchar_translator_->write_wstring (*this, len, x); - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - - if (static_cast (this->major_version_) == 1 - && static_cast (this->minor_version_) == 2) - { - if (x != 0) - { - //In GIOP 1.2 the length field contains the number of bytes - //the wstring occupies rather than number of wchars - //Taking sizeof might not be a good way! This is a temporary fix. - if (this->write_ulong (ACE_OutputCDR::wchar_maxbytes_ * len)) - return this->write_wchar_array (x, len); - } - else - //In GIOP 1.2 zero length wstrings are legal - return this->write_ulong (0); - } - - else - if (x != 0) - { - if (this->write_ulong (len + 1)) - return this->write_wchar_array (x, len + 1); - } - else if (this->write_ulong (1)) - return this->write_wchar (0); - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) -{ - // If the buffer is small and it fits in the current message - // block it is be cheaper just to copy the buffer. - for (const ACE_Message_Block* i = mb; - i != 0; - i = i->cont ()) - { - const size_t length = i->length (); - - // If the mb does not own its data we are forced to make a copy. - if (ACE_BIT_ENABLED (i->flags (), - ACE_Message_Block::DONT_DELETE)) - { - if (! this->write_array (i->rd_ptr (), - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - static_cast (length))) - return (this->good_bit_ = false); - continue; - } - - if (length < this->memcpy_tradeoff_ - && this->current_->wr_ptr () + length < this->current_->end ()) - { - if (! this->write_array (i->rd_ptr (), - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - static_cast (length))) - return (this->good_bit_ = false); - continue; - } - - ACE_Message_Block* cont = 0; - this->good_bit_ = false; - ACE_NEW_RETURN (cont, - ACE_Message_Block (i->data_block ()->duplicate ()), - 0); - this->good_bit_ = true; - - if (cont != 0) - { - if (this->current_->cont () != 0) - ACE_Message_Block::release (this->current_->cont ()); - cont->rd_ptr (i->rd_ptr ()); - cont->wr_ptr (i->wr_ptr ()); - - this->current_->cont (cont); - this->current_ = cont; - this->current_is_writable_ = false; -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - this->current_alignment_ = - (this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - } - else - { - this->good_bit_ = false; - return false; - } - } - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_1 (const ACE_CDR::Octet *x) -{ - char *buf = 0; - if (this->adjust (1, buf) == 0) - { - *reinterpret_cast (buf) = *x; - return true; - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_2 (const ACE_CDR::UShort *x) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0) - { -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (buf) = *x; - return true; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (buf) = *x; - return true; - } - else - { - ACE_CDR::swap_2 (reinterpret_cast (x), buf); - return true; - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_4 (const ACE_CDR::ULong *x) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) - { -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (buf) = *x; - return true; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (buf) = *x; - return true; - } - else - { - ACE_CDR::swap_4 (reinterpret_cast (x), buf); - return true; - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_8 (const ACE_CDR::ULongLong *x) -{ - char *buf = 0; - - if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) - { -#if defined (__arm__) - // Convert to Intel format (12345678 => 56781234) - const char *orig = reinterpret_cast (x); - char *target = buf; - register ACE_UINT32 x = - *reinterpret_cast (orig); - register ACE_UINT32 y = - *reinterpret_cast (orig + 4); - *reinterpret_cast (target) = y; - *reinterpret_cast (target + 4) = x; - return true; -#else -# if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (buf) = *x; - return true; -# else - if (!this->do_byte_swap_) - { - *reinterpret_cast (buf) = *x; - return true; - } - else - { - ACE_CDR::swap_8 (reinterpret_cast (x), buf); - return true; - } -# endif /* ACE_ENABLE_SWAP_ON_WRITE */ -#endif /* !__arm__ */ - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_16 (const ACE_CDR::LongDouble *x) -{ - char* buf = 0; - if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - buf) == 0) - { -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (buf) = *x; - return 1; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (buf) = *x; - return true; - } - else - { - ACE_CDR::swap_16 (reinterpret_cast (x), buf); - return true; - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_wchar_array_i (const ACE_CDR::WChar *x, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - char* buf = 0; - const size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? - ACE_CDR::SHORT_ALIGN : - ACE_CDR::OCTET_ALIGN; - - if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0) - { - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::UShort *sb = reinterpret_cast (buf); - for (size_t i = 0; i < length; ++i) -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - sb[i] = static_cast (x[i]); -#else - if (!this->do_byte_swap_) - sb[i] = static_cast (x[i]); - else - { - ACE_CDR::UShort sx = static_cast (x[i]); - ACE_CDR::swap_2 (reinterpret_cast (&sx), &buf[i * 2]); - } -#endif /* ACE_DISABLE_SWAP_ON_READ */ - } - else - { - for (size_t i = 0; i < length; ++i) - buf[i] = static_cast (x[i]); - } - return this->good_bit_; - } - return false; -} - - -ACE_CDR::Boolean -ACE_OutputCDR::write_array (const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - char *buf = 0; - if (this->adjust (size * length, align, buf) == 0) - { -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - ACE_OS::memcpy (buf, x, size*length); - return true; -#else - if (!this->do_byte_swap_ || size == 1) - { - ACE_OS::memcpy (buf, x, size*length); - return true; - } - else - { - const char *source = reinterpret_cast (x); - switch (size) - { - case 2: - ACE_CDR::swap_2_array (source, buf, length); - return true; - case 4: - ACE_CDR::swap_4_array (source, buf, length); - return true; - case 8: - ACE_CDR::swap_8_array (source, buf, length); - return true; - case 16: - ACE_CDR::swap_16_array (source, buf, length); - return true; - default: - // TODO: print something? - this->good_bit_ = false; - return false; - } - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - } - this->good_bit_ = false; - return false; -} - - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc) -{ - if (this->find (loc) == 0) - return false; - -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (loc) = x; -#else - if (!strm->do_byte_swap ()) - { - *reinterpret_cast (loc) = x; - } - else - { - ACE_CDR::swap_4 (reinterpret_cast (&x), loc); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - - return true; -} - - -ACE_CDR::Boolean -ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x, - ACE_CDR::ULong length) -{ - // It is hard to optimize this, the spec requires that on the wire - // booleans be represented as a byte with value 0 or 1, but in - // memoery it is possible (though very unlikely) that a boolean has - // a non-zero value (different from 1). - // We resort to a simple loop. - const ACE_CDR::Boolean* end = x + length; - - for (const ACE_CDR::Boolean* i = x; - i != end && this->good_bit (); - ++i) - this->write_boolean (*i); - - return this->good_bit (); -} - - -ACE_Message_Block* -ACE_OutputCDR::find (char* loc) -{ - ACE_Message_Block* mb = 0; - for (mb = &this->start_; mb != 0; mb = mb->cont ()) - { - if (loc <= mb->wr_ptr () && loc >= mb->rd_ptr ()) - { - break; - } - } - - return mb; -} - - -// **************************************************************** - -ACE_InputCDR::ACE_InputCDR (const char *buf, - size_t bufsiz, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (buf, bufsiz), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (1), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ - this->start_.wr_ptr (bufsiz); -} - -ACE_InputCDR::ACE_InputCDR (size_t bufsiz, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (bufsiz), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (1), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ -} - -ACE_InputCDR::ACE_InputCDR (const ACE_Message_Block *data, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version, - ACE_Lock* lock) -: start_ (0, ACE_Message_Block::MB_DATA, 0, 0, 0, lock), - good_bit_ (1), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) - -{ - this->reset (data, byte_order); -} - -ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (data, flag), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (1), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) - -{ -} - -ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag, - size_t rd_pos, - size_t wr_pos, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (data, flag), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (1), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) - -{ - // Set the read pointer - this->start_.rd_ptr (rd_pos); - - // Set the write pointer after doing a sanity check. - char* wrpos = this->start_.base () + wr_pos; - - if (this->start_.end () >= wrpos) - { - this->start_.wr_ptr (wr_pos); - } -} - - -ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size, - ACE_CDR::Long offset) - : start_ (rhs.start_, - ACE_CDR::MAX_ALIGNMENT), - do_byte_swap_ (rhs.do_byte_swap_), - good_bit_ (1), - major_version_ (rhs.major_version_), - minor_version_ (rhs.minor_version_), - char_translator_ (rhs.char_translator_), - wchar_translator_ (rhs.wchar_translator_) - -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - // Align the base pointer assuming that the incoming stream is also - // aligned the way we are aligned - char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), - ACE_CDR::MAX_ALIGNMENT); -#else - char *incoming_start = rhs.start_.base (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - const size_t newpos = - (rhs.start_.rd_ptr() - incoming_start) + offset; - - if (newpos <= this->start_.space () - && newpos + size <= this->start_.space ()) - { - this->start_.rd_ptr (newpos); - this->start_.wr_ptr (newpos + size); - } - else - this->good_bit_ = false; -} - -ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size) - : start_ (rhs.start_, - ACE_CDR::MAX_ALIGNMENT), - do_byte_swap_ (rhs.do_byte_swap_), - good_bit_ (1), - major_version_ (rhs.major_version_), - minor_version_ (rhs.minor_version_), - char_translator_ (rhs.char_translator_), - wchar_translator_ (rhs.wchar_translator_) - -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - // Align the base pointer assuming that the incoming stream is also - // aligned the way we are aligned - char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), - ACE_CDR::MAX_ALIGNMENT); -#else - char *incoming_start = rhs.start_.base (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - const size_t newpos = - rhs.start_.rd_ptr() - incoming_start; - - if (newpos <= this->start_.space () - && newpos + size <= this->start_.space ()) - { - // Notice that ACE_Message_Block::duplicate may leave the - // wr_ptr() with a higher value than what we actually want. - this->start_.rd_ptr (newpos); - this->start_.wr_ptr (newpos + size); - - ACE_CDR::Octet byte_order = 0; - this->read_octet (byte_order); - this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); - } - else - this->good_bit_ = false; -} - -ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs) - : start_ (rhs.start_, - ACE_CDR::MAX_ALIGNMENT), - do_byte_swap_ (rhs.do_byte_swap_), - good_bit_ (1), - major_version_ (rhs.major_version_), - minor_version_ (rhs.minor_version_), - char_translator_ (rhs.char_translator_), - wchar_translator_ (rhs.wchar_translator_) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - char *buf = ACE_ptr_align_binary (rhs.start_.base (), - ACE_CDR::MAX_ALIGNMENT); -#else - char *buf = rhs.start_.base (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - size_t rd_offset = rhs.start_.rd_ptr () - buf; - size_t wr_offset = rhs.start_.wr_ptr () - buf; - this->start_.rd_ptr (rd_offset); - this->start_.wr_ptr (wr_offset); -} - -ACE_InputCDR::ACE_InputCDR (ACE_InputCDR::Transfer_Contents x) - : start_ (x.rhs_.start_.data_block ()), - do_byte_swap_ (x.rhs_.do_byte_swap_), - good_bit_ (1), - major_version_ (x.rhs_.major_version_), - minor_version_ (x.rhs_.minor_version_), - char_translator_ (x.rhs_.char_translator_), - wchar_translator_ (x.rhs_.wchar_translator_) -{ - - this->start_.rd_ptr (x.rhs_.start_.rd_ptr ()); - this->start_.wr_ptr (x.rhs_.start_.wr_ptr ()); - - ACE_Data_Block* db = this->start_.data_block ()->clone_nocopy (); - (void) x.rhs_.start_.replace_data_block (db); -} - -ACE_InputCDR& -ACE_InputCDR::operator= (const ACE_InputCDR& rhs) -{ - if (this != &rhs) - { - this->start_.data_block (rhs.start_.data_block ()->duplicate ()); - this->start_.rd_ptr (rhs.start_.rd_ptr ()); - this->start_.wr_ptr (rhs.start_.wr_ptr ()); - this->do_byte_swap_ = rhs.do_byte_swap_; - this->good_bit_ = true; - this->char_translator_ = rhs.char_translator_; - this->major_version_ = rhs.major_version_; - this->minor_version_ = rhs.minor_version_; - } - return *this; -} - -ACE_InputCDR::ACE_InputCDR (const ACE_OutputCDR& rhs, - ACE_Allocator* buffer_allocator, - ACE_Allocator* data_block_allocator, - ACE_Allocator* message_block_allocator) - : start_ (rhs.total_length () + ACE_CDR::MAX_ALIGNMENT, - ACE_Message_Block::MB_DATA, - 0, - 0, - buffer_allocator, - 0, - 0, - ACE_Time_Value::zero, - ACE_Time_Value::max_time, - data_block_allocator, - message_block_allocator), - do_byte_swap_ (rhs.do_byte_swap_), - good_bit_ (1), - major_version_ (rhs.major_version_), - minor_version_ (rhs.minor_version_), - char_translator_ (rhs.char_translator_), - wchar_translator_ (rhs.wchar_translator_) -{ - ACE_CDR::mb_align (&this->start_); - for (const ACE_Message_Block *i = rhs.begin (); - i != rhs.end (); - i = i->cont ()) - this->start_.copy (i->rd_ptr (), i->length ()); -} - -ACE_CDR::Boolean -ACE_InputCDR::skip_wchar (void) -{ - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len; - if (this->read_1 (&len)) - return this->skip_bytes (static_cast (len)); - } - else - { - ACE_CDR::WChar x; - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - return this->read_2 (reinterpret_cast (&x)); - else - return this->read_4 (reinterpret_cast (&x)); - } - - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) -{ - if (this->wchar_translator_ != 0) - { - this->good_bit_ = this->wchar_translator_->read_wchar (*this,x); - return this->good_bit_; - } - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - - if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) - { - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len; - - if (this->read_1 (&len)) - return this->read_array - (reinterpret_cast (&x), - static_cast (len), - ACE_CDR::OCTET_ALIGN, - 1); - - else - return (this->good_bit_ = false); - } - - if (sizeof (ACE_CDR::WChar) == 2) - return this->read_2 (reinterpret_cast (&x)); - else - return this->read_4 (reinterpret_cast (&x)); - } - - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len; - - if (this->read_1 (&len)) - { - if (len == 2) - { - ACE_CDR::Short sx; - if (this->read_array - (reinterpret_cast (&sx), - static_cast (len), - ACE_CDR::OCTET_ALIGN, - 1)) - { - x = static_cast (sx); - return true; - } - } - else - { - ACE_CDR::Octet ox; - if (this->read_array - (reinterpret_cast (&ox), - static_cast (len), - ACE_CDR::OCTET_ALIGN, - 1)) - { - x = static_cast (ox); - return true; - } - } - } - } - else - { - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::UShort sx; - if (this->read_2 (reinterpret_cast (&sx))) - { - x = static_cast (sx); - return true; - } - } - else - { - ACE_CDR::Octet ox; - if (this->read_1 (&ox)) - { - x = static_cast (ox); - return true; - } - - } - } - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_InputCDR::read_string (ACE_CDR::Char *&x) -{ - // @@ This is a slight violation of "Optimize for the common case", - // i.e. normally the translator will be 0, but OTOH the code is - // smaller and should be better for the cache ;-) ;-) - if (this->char_translator_ != 0) - { - this->good_bit_ = this->char_translator_->read_string (*this, x); - return this->good_bit_; - } - - ACE_CDR::ULong len = 0; - - if (!this->read_ulong (len)) - return false; - - // A check for the length being too great is done later in the - // call to read_char_array but we want to have it done before - // the memory is allocated. - if (len > 0 && len <= this->length()) - { - ACE_NEW_RETURN (x, - ACE_CDR::Char[len], - 0); - if (this->read_char_array (x, len)) - return true; - - delete [] x; - } - else if (len == 0) - { - // Convert any null strings to empty strings since empty - // strings can cause crashes. (See bug 58.) - ACE_NEW_RETURN (x, - ACE_CDR::Char[1], - 0); - ACE_OS::strcpy (const_cast (x), ""); - return true; - } - - x = 0; - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_InputCDR::read_string (ACE_CString &x) -{ - ACE_CDR::Char *data = 0; - if (this->read_string (data)) - { - x = data; - delete [] data; - return true; - } - - x = ""; - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) -{ - // @@ This is a slight violation of "Optimize for the common case", - // i.e. normally the translator will be 0, but OTOH the code is - // smaller and should be better for the cache ;-) ;-) - if (this->wchar_translator_ != 0) - { - this->good_bit_ = this->wchar_translator_->read_wstring (*this, x); - return this->good_bit_; - } - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - - ACE_CDR::ULong len = 0; - if (!this->read_ulong (len)) - return false; - - // A check for the length being too great is done later in the - // call to read_char_array but we want to have it done before - // the memory is allocated. - if (len > 0 && len <= this->length ()) - { - - if (static_cast (this->major_version_) == 1 - && static_cast (this->minor_version_) == 2) - { - len /= ACE_OutputCDR::wchar_maxbytes_; - - //allocating one extra for the null character needed by applications - ACE_NEW_RETURN (x, - ACE_CDR::WChar [len + 1], - false); - - if (this->read_wchar_array (x, len)) - { - - //Null character used by applications to find the end of - //the wstring - //Is this okay with the GIOP 1.2 spec?? - x[len] = '\x00'; - - return true; - } - } - else - { - ACE_NEW_RETURN (x, - ACE_CDR::WChar [len], - false); - - if (this->read_wchar_array (x, len)) - return true; - } - - delete [] x; - } - else if (len == 0) - { - // Convert any null strings to empty strings since empty - // strings can cause crashes. (See bug 58.) - ACE_NEW_RETURN (x, - ACE_CDR::WChar[1], - false); - x[0] = '\x00'; - return true; - } - - this->good_bit_ = false; - x = 0; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_array (void* x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - char* buf = 0; - - if (this->adjust (size * length, align, buf) == 0) - { -#if defined (ACE_DISABLE_SWAP_ON_READ) - ACE_OS::memcpy (x, buf, size*length); -#else - if (!this->do_byte_swap_ || size == 1) - ACE_OS::memcpy (x, buf, size*length); - else - { - char *target = reinterpret_cast (x); - switch (size) - { - case 2: - ACE_CDR::swap_2_array (buf, target, length); - break; - case 4: - ACE_CDR::swap_4_array (buf, target, length); - break; - case 8: - ACE_CDR::swap_8_array (buf, target, length); - break; - case 16: - ACE_CDR::swap_16_array (buf, target, length); - break; - default: - // TODO: print something? - this->good_bit_ = false; - return false; - } - } -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return this->good_bit_; - } - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - char* buf = 0; - const size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? - ACE_CDR::SHORT_ALIGN : - ACE_CDR::OCTET_ALIGN; - - if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0) - { - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::UShort *sb = reinterpret_cast (buf); - for (size_t i = 0; i < length; ++i) -#if defined (ACE_DISABLE_SWAP_ON_READ) - x[i] = static_cast (sb[i]); -#else - if (!this->do_byte_swap_) - x[i] = static_cast (sb[i]); - else - { - ACE_CDR::UShort sx; - ACE_CDR::swap_2 (&buf[i * 2], reinterpret_cast (&sx)); - x[i] = static_cast (sx); - } -#endif /* ACE_DISABLE_SWAP_ON_READ */ - } - else - { - for (size_t i = 0; i < length; ++i) - x[i] = static_cast (buf[i]); - } - return this->good_bit_; - } - return false; -} - - -ACE_CDR::Boolean -ACE_InputCDR::read_boolean_array (ACE_CDR::Boolean *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length > this->length ()) - { - this->good_bit_ = false; - return false; - } - - // It is hard to optimize this, the spec requires that on the wire - // booleans be represented as a byte with value 0 or 1, but in - // memoery it is possible (though very unlikely) that a boolean has - // a non-zero value (different from 1). - // We resort to a simple loop. - for (ACE_CDR::ULong i = 0; i != length && this->good_bit_; ++i) - this->read_boolean (x[i]); - - return this->good_bit_; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_1 (ACE_CDR::Octet *x) -{ - if (this->rd_ptr () < this->wr_ptr ()) - { - *x = *reinterpret_cast (this->rd_ptr ()); - this->start_.rd_ptr (1); - return true; - } - - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_2 (ACE_CDR::UShort *x) -{ - char *buf; - if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0) - { -#if !defined (ACE_DISABLE_SWAP_ON_READ) - if (!this->do_byte_swap_) - *x = *reinterpret_cast (buf); - else - ACE_CDR::swap_2 (buf, reinterpret_cast (x)); -#else - *x = *reinterpret_cast (buf); -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return true; - } - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_4 (ACE_CDR::ULong *x) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) - { -#if !defined (ACE_DISABLE_SWAP_ON_READ) - if (!this->do_byte_swap_) - *x = *reinterpret_cast (buf); - else - ACE_CDR::swap_4 (buf, reinterpret_cast (x)); -#else - *x = *reinterpret_cast (buf); -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return true; - } - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_8 (ACE_CDR::ULongLong *x) -{ - char *buf = 0; - - if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) - { -#if !defined (ACE_DISABLE_SWAP_ON_READ) -# if defined (__arm__) - if (!this->do_byte_swap_) - { - // Convert from Intel format (12345678 => 56781234) - const char *orig = buf; - char *target = reinterpret_cast (x); - register ACE_UINT32 x = - *reinterpret_cast (orig); - register ACE_UINT32 y = - *reinterpret_cast (orig + 4); - *reinterpret_cast (target) = y; - *reinterpret_cast (target + 4) = x; - } - else - { - // Convert from Sparc format (12345678 => 43218765) - const char *orig = buf; - char *target = reinterpret_cast (x); - register ACE_UINT32 x = - *reinterpret_cast (orig); - register ACE_UINT32 y = - *reinterpret_cast (orig + 4); - x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24); - y = (y << 24) | ((y & 0xff00) << 8) | ((y & 0xff0000) >> 8) | (y >> 24); - *reinterpret_cast (target) = x; - *reinterpret_cast (target + 4) = y; - } -# else - if (!this->do_byte_swap_) - *x = *reinterpret_cast (buf); - else - ACE_CDR::swap_8 (buf, reinterpret_cast (x)); -# endif /* !__arm__ */ -#else - *x = *reinterpret_cast (buf); -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return true; - } - - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_16 (ACE_CDR::LongDouble *x) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - buf) == 0) - { -#if !defined (ACE_DISABLE_SWAP_ON_READ) - if (!this->do_byte_swap_) - *x = *reinterpret_cast (buf); - else - ACE_CDR::swap_16 (buf, reinterpret_cast (x)); -#else - *x = *reinterpret_cast (buf); -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return true; - } - - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::skip_string (void) -{ - ACE_CDR::ULong len = 0; - if (this->read_ulong (len)) - { - if (this->rd_ptr () + len <= this->wr_ptr ()) - { - this->rd_ptr (len); - return true; - } - this->good_bit_ = false; - } - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::skip_wstring (void) -{ - ACE_CDR::Boolean continue_skipping = true; - ACE_CDR::ULong len = 0; - - continue_skipping = read_ulong (len); - - if (continue_skipping != false && len != 0) - { - if (static_cast (this->major_version_) == 1 - && static_cast (this->minor_version_) == 2) - continue_skipping = this->skip_bytes ((size_t)len); - else - while (continue_skipping != false && len--) - continue_skipping = this->skip_wchar (); - } - return continue_skipping; -} - -ACE_CDR::Boolean -ACE_InputCDR::skip_bytes (size_t len) -{ - if (this->rd_ptr () + len <= this->wr_ptr ()) - { - this->rd_ptr (len); - return true; - } - this->good_bit_ = false; - return false; -} - -int -ACE_InputCDR::grow (size_t newsize) -{ - if (ACE_CDR::grow (&this->start_, newsize) == -1) - return -1; - - ACE_CDR::mb_align (&this->start_); - this->start_.wr_ptr (newsize); - return 0; -} - -void -ACE_InputCDR::reset (const ACE_Message_Block* data, - int byte_order) -{ - this->reset_byte_order (byte_order); - ACE_CDR::consolidate (&this->start_, data); -} - -void -ACE_InputCDR::steal_from (ACE_InputCDR &cdr) -{ - this->do_byte_swap_ = cdr.do_byte_swap_; - this->start_.data_block (cdr.start_.data_block ()->duplicate ()); - - // If the message block had a DONT_DELETE flags, just clear it off.. - this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); - this->start_.rd_ptr (cdr.start_.rd_ptr ()); - - this->start_.wr_ptr (cdr.start_.wr_ptr ()); - this->major_version_ = cdr.major_version_; - this->minor_version_ = cdr.minor_version_; - cdr.reset_contents (); -} - -void -ACE_InputCDR::exchange_data_blocks (ACE_InputCDR &cdr) -{ - // Exchange byte orders - int byte_order = cdr.do_byte_swap_; - cdr.do_byte_swap_ = this->do_byte_swap_; - this->do_byte_swap_ = byte_order; - - // Get the destination read and write pointers - size_t drd_pos = - cdr.start_.rd_ptr () - cdr.start_.base (); - size_t dwr_pos = - cdr.start_.wr_ptr () - cdr.start_.base (); - - // Get the source read & write pointers - size_t srd_pos = - this->start_.rd_ptr () - this->start_.base (); - size_t swr_pos = - this->start_.wr_ptr () - this->start_.base (); - - // Exchange data_blocks. Dont release any of the data blocks. - ACE_Data_Block *dnb = - this->start_.replace_data_block (cdr.start_.data_block ()); - cdr.start_.replace_data_block (dnb); - - // Exchange the flags information.. - ACE_Message_Block::Message_Flags df = cdr.start_.self_flags (); - ACE_Message_Block::Message_Flags sf = this->start_.self_flags (); - - cdr.start_.clr_self_flags (df); - this->start_.clr_self_flags (sf); - - cdr.start_.set_self_flags (sf); - this->start_.set_self_flags (df); - - // Reset the pointers to zero before it is set again. - cdr.start_.reset (); - this->start_.reset (); - - // Set the read and write pointers. - if (cdr.start_.size () >= srd_pos) - cdr.start_.rd_ptr (srd_pos); - - if (cdr.start_.size () >= swr_pos) - cdr.start_.wr_ptr (swr_pos); - - if (this->start_.size () >= drd_pos) - this->start_.rd_ptr (drd_pos); - - if (this->start_.size () >= dwr_pos) - this->start_.wr_ptr (dwr_pos); - - ACE_CDR::Octet dmajor = cdr.major_version_; - ACE_CDR::Octet dminor = cdr.minor_version_; - - // Exchange the GIOP version info - cdr.major_version_ = this->major_version_; - cdr.minor_version_ = this->minor_version_; - - this->major_version_ = dmajor; - this->minor_version_ = dminor; -} - -ACE_Data_Block * -ACE_InputCDR::clone_from (ACE_InputCDR &cdr) -{ - this->do_byte_swap_ = cdr.do_byte_swap_; - - // Get the read & write pointer positions in the incoming CDR - // streams - char *rd_ptr = cdr.start_.rd_ptr (); - char *wr_ptr = cdr.start_.wr_ptr (); - - // Now reset the incoming CDR stream - cdr.start_.reset (); - - // As we have reset the stream, try to align the underlying message - // block in the incoming stream - ACE_CDR::mb_align (&cdr.start_); - - // Get the read & write pointer positions again - char *nrd_ptr = cdr.start_.rd_ptr (); - char *nwr_ptr = cdr.start_.wr_ptr (); - - // Actual length of the stream is.. - // @todo: This will look idiotic, but we dont seem to have much of a - // choice. How do we calculate the length of the incoming stream? - // Calling the method before calling reset () would give us the - // wrong length of the stream that needs copying. So we do the - // calulation like this - // (1) We get the and positions of the incoming - // stream. - // (2) Then we reset the stream and then align it. - // (3) We get the and positions again. (Points #1 - // thru #3 has been done already) - // (4) The difference in the and positions gives - // us the following, the actual bytes traversed by the and - // . - // (5) The bytes traversed by the is the actual length of - // the stream. - - // Actual bytes traversed - size_t rd_bytes = rd_ptr - nrd_ptr; - size_t wr_bytes = wr_ptr - nwr_ptr; - - ACE_CDR::mb_align (&this->start_); - - ACE_Data_Block *db = - this->start_.data_block (); - - // If the size of the data that needs to be copied are higher than - // what is available, then do a reallocation. - if (wr_bytes > (this->start_.size () - ACE_CDR::MAX_ALIGNMENT)) - { - // @@NOTE: We need to probably add another method to the message - // block interface to simplify this - db = - cdr.start_.data_block ()->clone_nocopy (); - - if (db->size ((wr_bytes) + - ACE_CDR::MAX_ALIGNMENT) == -1) - return 0; - - // Replace our data block by using the incoming CDR stream. - db = this->start_.replace_data_block (db); - - // Align the start_ message block. - ACE_CDR::mb_align (&this->start_); - - // Clear the DONT_DELETE flag if it has been set - this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); - } - - // Now do the copy - (void) ACE_OS::memcpy (this->start_.wr_ptr (), - cdr.start_.rd_ptr (), - wr_bytes); - - // Set the read pointer position to the same point as that was in - // cdr. - this->start_.rd_ptr (rd_bytes); - this->start_.wr_ptr (wr_bytes); - - // We have changed the read & write pointers for the incoming - // stream. Set them back to the positions that they were before.. - cdr.start_.rd_ptr (rd_bytes); - cdr.start_.wr_ptr (wr_bytes); - - this->major_version_ = cdr.major_version_; - this->minor_version_ = cdr.minor_version_; - - return db; -} - -ACE_Message_Block* -ACE_InputCDR::steal_contents (void) -{ - ACE_Message_Block* block = - this->start_.clone (); - this->start_.data_block (block->data_block ()->clone ()); - - // If at all our message had a DONT_DELETE flag set, just clear it - // off. - this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); - - ACE_CDR::mb_align (&this->start_); - - return block; -} - -void -ACE_InputCDR::reset_contents (void) -{ - this->start_.data_block (this->start_.data_block ()->clone_nocopy - ()); - - // Reset the flags... - this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); -} - -// -------------------------------------------------------------- - -ACE_Char_Codeset_Translator::~ACE_Char_Codeset_Translator (void) -{ -} - -// -------------------------------------------------------------- - -ACE_WChar_Codeset_Translator::~ACE_WChar_Codeset_Translator (void) -{ -} - -// -------------------------------------------------------------- - -ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, const ACE_CString &x) -{ - os.write_string (x); - return os.good_bit (); -} - -ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CString &x) -{ - is.read_string (x); - return is.good_bit (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h deleted file mode 100644 index ca09b31cc93..00000000000 --- a/ace/CDR_Stream.h +++ /dev/null @@ -1,1309 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CDR_Stream.h - * - * $Id$ - * - * ACE Common Data Representation (CDR) marshaling and demarshaling - * classes. - * - * This implementation was inspired in the CDR class in SunSoft's - * IIOP engine, but has a completely different implementation and a - * different interface too. - * - * The current implementation assumes that the host has 1-byte, - * 2-byte and 4-byte integral types, and that it has single - * precision and double precision IEEE floats. - * Those assumptions are pretty good these days, with Crays beign - * the only known exception. - * - * Optimizations - * ------------- - * ACE_LACKS_CDR_ALIGNMENT - * @author Arvind S. Krishna - * - * CDR stream ignores alignment when marshaling data. Use this option - * only when ACE_DISABLE_SWAP_ON_READ can be enabled. This option requires - * ACE CDR engine to do both marshaling and demarshaling. - * - * - * @author TAO version by Aniruddha Gokhale - * @author Carlos O'Ryan - * @author ACE version by Jeff Parsons - * @author Istvan Buki - * @author Codeset translation by Jim Rogers - */ -//============================================================================= - -#ifndef ACE_CDR_STREAM_H -#define ACE_CDR_STREAM_H - -#include /**/ "ace/pre.h" - -#include "ace/CDR_Base.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SStringfwd.h" -#include "ace/Message_Block.h" - - -// Stuff used by the ACE CDR classes. -#if defined ACE_LITTLE_ENDIAN -# define ACE_CDR_BYTE_ORDER 1 -// little endian encapsulation byte order has value = 1 -#else /* ! ACE_LITTLE_ENDIAN */ -# define ACE_CDR_BYTE_ORDER 0 -// big endian encapsulation byte order has value = 0 -#endif /* ! ACE_LITTLE_ENDIAN */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Char_Codeset_Translator; -class ACE_WChar_Codeset_Translator; - -class ACE_InputCDR; - -/** - * @class ACE_OutputCDR - * - * @brief A CDR stream for writing, i.e. for marshalling. - * - * This class is based on the the CORBA spec for Java (98-02-29), - * java class omg.org.CORBA.portable.OutputStream. It diverts in - * a few ways: - * + Operations taking arrays don't have offsets, because in C++ - * it is easier to describe an array starting from x+offset. - * + Operations return an error status, because exceptions are - * not widely available in C++ (yet). - */ -class ACE_Export ACE_OutputCDR -{ -public: - /** - * The Codeset translators need access to some private members to - * efficiently marshal arrays - * For reading from an output CDR stream. - */ - friend class ACE_Char_Codeset_Translator; - friend class ACE_WChar_Codeset_Translator; - friend class ACE_InputCDR; - - /// Default constructor, allocates bytes in the internal - /// buffer, if == 0 it allocates the default size. - ACE_OutputCDR (size_t size = 0, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_Allocator* buffer_allocator = 0, - ACE_Allocator* data_block_allocator = 0, - ACE_Allocator* message_block_allocator = 0, - size_t memcpy_tradeoff = - ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); - - /// Build a CDR stream with an initial buffer, it will *not* remove - /// , since it did not allocated it. It's important to be careful - /// with the alignment of . - /** - * Create an output stream from an arbitrary buffer, care must be - * exercised with alignment, because this contructor will align if - * needed. In this case @a data will not point to the start of the - * output stream. @c begin()->rd_ptr() points to the start of the - * output stream. See @c ACE_ptr_align_binary() to properly align a - * pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment. - */ - ACE_OutputCDR (char *data, - size_t size, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_Allocator* buffer_allocator = 0, - ACE_Allocator* data_block_allocator = 0, - ACE_Allocator* message_block_allocator = 0, - size_t memcpy_tradeoff= - ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet giop_major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet giop_minor_version = - ACE_CDR_GIOP_MINOR_VERSION); - - /// Build a CDR stream with an initial data block, it will *not* remove - /// , since it did not allocated it. It's important to be - // careful with the alignment of . - /** - * Create an output stream from an arbitrary data block, care must be - * exercised with alignment, because this contructor will align if - * needed. In this case the buffer will not point to the - * start off the output stream. begin()->rd_prt() points to the start - * off the output stream. See ACE_ptr_align_binary() to properly align a - * pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment. - */ - ACE_OutputCDR (ACE_Data_Block *data_block, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_Allocator* message_block_allocator = 0, - size_t memcpy_tradeoff= - ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet giop_major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet giop_minor_version = - ACE_CDR_GIOP_MINOR_VERSION); - - /// Build a CDR stream with an initial Message_Block chain, it will - /// *not* remove @a data, since it did not allocate it. - ACE_OutputCDR (ACE_Message_Block *data, - int byte_order = ACE_CDR_BYTE_ORDER, - size_t memcpy_tradeoff = - ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet giop_major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet giop_minor_version = - ACE_CDR_GIOP_MINOR_VERSION); - - /// destructor - ~ACE_OutputCDR (void); - - /** - * Disambiguate overload when inserting booleans, octets, chars, and - * bounded strings. - */ - //@{ @name Helper classes - - struct ACE_Export from_boolean - { - explicit from_boolean (ACE_CDR::Boolean b); - ACE_CDR::Boolean val_; - }; - - struct ACE_Export from_octet - { - explicit from_octet (ACE_CDR::Octet o); - ACE_CDR::Octet val_; - }; - - struct ACE_Export from_char - { - explicit from_char (ACE_CDR::Char c); - ACE_CDR::Char val_; - }; - - struct ACE_Export from_wchar - { - explicit from_wchar (ACE_CDR::WChar wc); - ACE_CDR::WChar val_; - }; - - struct ACE_Export from_string - { - from_string (ACE_CDR::Char* s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); - from_string (const ACE_CDR::Char* s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); - ACE_CDR::Char *val_; - ACE_CDR::ULong bound_; - ACE_CDR::Boolean nocopy_; - }; - - struct ACE_Export from_wstring - { - from_wstring (ACE_CDR::WChar* ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); - from_wstring (const ACE_CDR::WChar* ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); - ACE_CDR::WChar *val_; - ACE_CDR::ULong bound_; - ACE_CDR::Boolean nocopy_; - }; - //@} - - // Return 0 on failure and 1 on success. - //@{ @name Write operations - ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x); - ACE_CDR::Boolean write_char (ACE_CDR::Char x); - ACE_CDR::Boolean write_wchar (ACE_CDR::WChar x); - ACE_CDR::Boolean write_octet (ACE_CDR::Octet x); - ACE_CDR::Boolean write_short (ACE_CDR::Short x); - ACE_CDR::Boolean write_ushort (ACE_CDR::UShort x); - ACE_CDR::Boolean write_long (ACE_CDR::Long x); - ACE_CDR::Boolean write_ulong (ACE_CDR::ULong x); - ACE_CDR::Boolean write_longlong (const ACE_CDR::LongLong &x); - ACE_CDR::Boolean write_ulonglong (const ACE_CDR::ULongLong &x); - ACE_CDR::Boolean write_float (ACE_CDR::Float x); - ACE_CDR::Boolean write_double (const ACE_CDR::Double &x); - ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x); - - // Overwrite the stream at the specified location that is previously - // written as a long type placeholder. There is no alignment required - // since the alignment is done before writing the long type placeholder. - ACE_CDR::Boolean replace (ACE_CDR::Long x, char* loc); - - /// For string we offer methods that accept a precomputed length. - ACE_CDR::Boolean write_string (const ACE_CDR::Char *x); - ACE_CDR::Boolean write_string (ACE_CDR::ULong len, - const ACE_CDR::Char *x); - ACE_CDR::Boolean write_string (const ACE_CString &x); - ACE_CDR::Boolean write_wstring (const ACE_CDR::WChar *x); - ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length, - const ACE_CDR::WChar *x); - //@} - - /// @note the portion written starts at and ends - /// at . - /// The length is *NOT* stored into the CDR stream. - //@{ @name Array write operations - ACE_CDR::Boolean write_boolean_array (const ACE_CDR::Boolean *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_char_array (const ACE_CDR::Char *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_wchar_array (const ACE_CDR::WChar* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_octet_array (const ACE_CDR::Octet* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_short_array (const ACE_CDR::Short *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ushort_array (const ACE_CDR::UShort *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_long_array (const ACE_CDR::Long *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ulong_array (const ACE_CDR::ULong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_longlong_array (const ACE_CDR::LongLong* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ulonglong_array (const ACE_CDR::ULongLong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_float_array (const ACE_CDR::Float *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_double_array (const ACE_CDR::Double *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x, - ACE_CDR::ULong length); - - /// Write an octet array contained inside a MB, this can be optimized - /// to minimize copies. - ACE_CDR::Boolean write_octet_array_mb (const ACE_Message_Block* mb); - //@} - - /** - * Return 0 on failure and 1 on success. - */ - //@{ @name Append contents of own CDR stream to another - ACE_CDR::Boolean append_boolean (ACE_InputCDR &); - ACE_CDR::Boolean append_char (ACE_InputCDR &); - ACE_CDR::Boolean append_wchar (ACE_InputCDR &); - ACE_CDR::Boolean append_octet (ACE_InputCDR &); - ACE_CDR::Boolean append_short (ACE_InputCDR &); - ACE_CDR::Boolean append_ushort (ACE_InputCDR &); - ACE_CDR::Boolean append_long (ACE_InputCDR &); - ACE_CDR::Boolean append_ulong (ACE_InputCDR &); - ACE_CDR::Boolean append_longlong (ACE_InputCDR &); - ACE_CDR::Boolean append_ulonglong (ACE_InputCDR &); - ACE_CDR::Boolean append_float (ACE_InputCDR &); - ACE_CDR::Boolean append_double (ACE_InputCDR &); - ACE_CDR::Boolean append_longdouble (ACE_InputCDR &); - - ACE_CDR::Boolean append_wstring (ACE_InputCDR &); - ACE_CDR::Boolean append_string (ACE_InputCDR &); - //@} - - /// Returns @c false if an error has ocurred. - /** - * @note The only expected error is to run out of memory. - */ - bool good_bit (void) const; - - /// Reuse the CDR stream to write on the old buffer. - void reset (void); - - /// Add the length of each message block in the chain. - size_t total_length (void) const; - - /** - * Return the start of the message block chain for this CDR stream. - * @note The complete CDR stream is represented by a chain of - * message blocks. - */ - const ACE_Message_Block *begin (void) const; - - /// Return the last message in the chain that is is use. - const ACE_Message_Block *end (void) const; - - /// Return the message block in chain. - const ACE_Message_Block *current (void) const; - - /** - * Access the underlying buffer (read only). @note This - * method only returns a pointer to the first block in the - * chain. - */ - const char *buffer (void) const; - - /** - * Return the start and size of the internal buffer.@note This - * method only returns information about the first block in the - * chain. - */ - size_t length (void) const; - - /** - * Utility function to allow the user more flexibility. - * Pads the stream up to the nearest -byte boundary. - * Argument MUST be a power of 2. - * Returns 0 on success and -1 on failure. - */ - int align_write_ptr (size_t alignment); - - /// Access the codeset translators. They can be null! - ACE_Char_Codeset_Translator *char_translator (void) const; - ACE_WChar_Codeset_Translator *wchar_translator (void) const; - - /// Set the char codeset translator. - void char_translator (ACE_Char_Codeset_Translator *); - /// Set the wchar codeset translator. - void wchar_translator (ACE_WChar_Codeset_Translator *); - - /// set the global size of serialized wchars. This may be different - /// than the size of a wchar_t. - static void wchar_maxbytes (int ); - - /// access the serialized size of wchars. - static int wchar_maxbytes (void); - - /** - * Return alignment of the wr_ptr(), with respect to the start of - * the CDR stream. This is not the same as the alignment of - * current->wr_ptr()! - */ - size_t current_alignment (void) const; - - /** - * Returns (in ) the next position in the buffer aligned to - * , it advances the Message_Block wr_ptr past the data - * (i.e., + ). If necessary it grows the Message_Block - * buffer. Sets the good_bit to 0 and returns a -1 on failure. - */ - int adjust (size_t size, - char *&buf); - - /// As above, but now the size and alignment requirements may be - /// different. - int adjust (size_t size, - size_t align, - char *&buf); - - /// If non-zero then this stream is writing in non-native byte order, - /// this is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined. - bool do_byte_swap (void) const; - - /// If returns 0, this returns ACE_CDR_BYTE_ORDER else - /// it returns !ACE_CDR_BYTE_ORDER. - int byte_order (void) const; - - /// For use by a gateway, which creates the output stream for the - /// reply to the client in its native byte order, but which must - /// send the reply in the byte order of the target's reply to the - /// gateway. - void reset_byte_order (int byte_order); - - /// set GIOP version info - int set_version (ACE_CDR::Octet major, - ACE_CDR::Octet minor); - - /// Set the underlying GIOP version.. - int get_version (ACE_CDR::Octet &major, - ACE_CDR::Octet &minor); - -private: - - // Find the message block in the chain of message blocks - // that the provide location locates. - ACE_Message_Block* find (char* loc); - - /// disallow copying... - ACE_OutputCDR (const ACE_OutputCDR& rhs); - ACE_OutputCDR& operator= (const ACE_OutputCDR& rhs); - - ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x); - ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x); - ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x); - ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x); - ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x); - - /** - * write an array of elements, each of bytes and the - * start aligned at a multiple of . The elements are assumed - * to be packed with the right alignment restrictions. It is mostly - * designed for buffers of the basic types. - * - * This operation uses ; as explained above it is expected - * that using assignment is faster that for one element, - * but for several elements should be more efficient, it - * could be interesting to find the break even point and optimize - * for that case, but that would be too platform dependent. - */ - ACE_CDR::Boolean write_array (const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - - ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x, - ACE_CDR::ULong length); - - - /** - * Grow the CDR stream. When it returns contains a pointer to - * memory in the CDR stream, with at least bytes ahead of it - * and aligned to an boundary. It moved the to . - */ - int grow_and_adjust (size_t size, - size_t align, - char *&buf); - -private: - /// The start of the chain of message blocks. - ACE_Message_Block start_; - - /// The current block in the chain were we are writing. - ACE_Message_Block *current_; - -#if !defined (ACE_LACKS_CDR_IALIGNMENT) - /** - * The current alignment as measured from the start of the buffer. - * Usually this coincides with the alignment of the buffer in - * memory, but, when we chain another buffer this "quasi invariant" - * is broken. - * The current_alignment is used to readjust the buffer following - * the stolen message block. - */ - size_t current_alignment_; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - /** - * Is the current block writable. When we steal a buffer from the - * user and just chain it into the message block we are not supposed - * to write on it, even if it is past the start and end of the - * buffer. - */ - bool current_is_writable_; - - /** - * If not zero swap bytes at writing so the created CDR stream byte - * order does *not* match the machine byte order. The motivation - * for such a beast is that in some setting a few (fast) machines - * can be serving hundreds of slow machines with the opposite byte - * order, so it makes sense (as a load balancing device) to put the - * responsibility in the writers. THIS IS NOT A STANDARD IN CORBA, - * USE AT YOUR OWN RISK - */ - bool do_byte_swap_; - - /// Set to 0 when an error ocurrs. - bool good_bit_; - - /// Break-even point for copying. - size_t const memcpy_tradeoff_; - -protected: - /// GIOP version information - ACE_CDR::Octet major_version_; - ACE_CDR::Octet minor_version_; - - /// If not nil, invoke for translation of character and string data. - ACE_Char_Codeset_Translator *char_translator_; - ACE_WChar_Codeset_Translator *wchar_translator_; - - /** - * Some wide char codesets may be defined with a maximum number - * of bytes that is smaller than the size of a wchar_t. This means - * that the CDR cannot simply memcpy a block of wchars to and from - * the stream, but must instead realign the bytes appropriately. - * In cases when wchar i/o is not allowed, such as with GIOP 1.0, - * or not having a native wchar codeset defined, the maxbytes is - * set to zero, indicating no wchar data is allowed. - */ - static int wchar_maxbytes_; -}; - - -// **************************************************************** - -/** - * @class ACE_InputCDR - * - * @brief A CDR stream for reading, i.e. for demarshalling. - * - * This class is based on the the CORBA spec for Java (98-02-29), - * java class omg.org.CORBA.portable.InputStream. It diverts in a - * few ways: - * + Operations to retrieve basic types take parameters by - * reference. - * + Operations taking arrays don't have offsets, because in C++ - * it is easier to describe an array starting from x+offset. - * + Operations return an error status, because exceptions are - * not widely available in C++ (yet). - */ -class ACE_Export ACE_InputCDR -{ -public: - /// The translator need privileged access to efficiently demarshal - /// arrays and the such - friend class ACE_Char_Codeset_Translator; - friend class ACE_WChar_Codeset_Translator; - - /** - * Create an input stream from an arbitrary buffer. The buffer must - * be properly aligned because this contructor will *not* work if - * the buffer is aligned unproperly.See ACE_ptr_align_binary() for - * instructions on how to align a pointer properly and use - * ACE_CDR::MAX_ALIGNMENT for the correct alignment. - */ - ACE_InputCDR (const char *buf, - size_t bufsiz, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); - - /// Create an empty input stream. The caller is responsible for - /// putting the right data and providing the right alignment. - ACE_InputCDR (size_t bufsiz, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); - - /// Create an input stream from an ACE_Message_Block - /** - * The alignment of the @arg data block is carried into the new - * ACE_InputCDR object. This constructor either increments the - * @arg data reference count, or copies the data (if it's a compound - * message block) so the caller can release the block immediately - * upon return. - */ - ACE_InputCDR (const ACE_Message_Block *data, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION, - ACE_Lock* lock = 0); - - /// Create an input stream from an ACE_Data_Block. The - /// indicates whether the can be deleted by the CDR stream - /// or not - ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag = 0, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); - - /// Create an input stream from an ACE_Data_Block. It also sets the - /// read and write pointers at the desired positions. This would be - /// helpful if the applications desires to create a new CDR stream - /// from a semi-processed datablock. - ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag, - size_t read_pointer_position, - size_t write_pointer_position, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); - - /** - * These make a copy of the current stream state, but do not copy - * the internal buffer, so the same stream can be read multiple - * times efficiently. - */ - ACE_InputCDR (const ACE_InputCDR& rhs); - - ACE_InputCDR& operator= (const ACE_InputCDR& rhs); - - /// When interpreting indirected TypeCodes it is useful to make a - /// "copy" of the stream starting in the new position. - ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size, - ACE_CDR::Long offset); - - /// This creates an encapsulated stream, the first byte must be (per - /// the spec) the byte order of the encapsulation. - ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size); - - /// Create an input CDR from an output CDR. - ACE_InputCDR (const ACE_OutputCDR& rhs, - ACE_Allocator* buffer_allocator = 0, - ACE_Allocator* data_block_allocator = 0, - ACE_Allocator* message_block_allocator = 0); - - /// Helper class to transfer the contents from one input CDR to - /// another without requiring any extra memory allocations, data - /// copies or too many temporaries. - struct ACE_Export Transfer_Contents - { - Transfer_Contents (ACE_InputCDR &rhs); - - ACE_InputCDR &rhs_; - }; - /// Transfer the contents from to a new CDR - ACE_InputCDR (Transfer_Contents rhs); - - /// Destructor - ~ACE_InputCDR (void); - - /// Disambiguate overloading when extracting octets, chars, - /// booleans, and bounded strings - //@{ @name Helper classes - - struct ACE_Export to_boolean - { - explicit to_boolean (ACE_CDR::Boolean &b); - ACE_CDR::Boolean &ref_; - }; - - struct ACE_Export to_char - { - explicit to_char (ACE_CDR::Char &c); - ACE_CDR::Char &ref_; - }; - - struct ACE_Export to_wchar - { - explicit to_wchar (ACE_CDR::WChar &wc); - ACE_CDR::WChar &ref_; - }; - - struct ACE_Export to_octet - { - explicit to_octet (ACE_CDR::Octet &o); - ACE_CDR::Octet &ref_; - }; - - struct ACE_Export to_string - { - /** - * @deprecated The constructor taking a non-const string is now - * deprecated (C++ mapping 00-01-02), but we keep it - * around for backward compatibility. - */ - to_string (ACE_CDR::Char *&s, - ACE_CDR::ULong b); - to_string (const ACE_CDR::Char *&s, - ACE_CDR::ULong b); - const ACE_CDR::Char *&val_; - ACE_CDR::ULong bound_; - }; - - struct ACE_Export to_wstring - { - /// The constructor taking a non-const wstring is - /// now deprecated (C++ mapping 00-01-02), but we - /// keep it around for backward compatibility. - to_wstring (ACE_CDR::WChar *&ws, - ACE_CDR::ULong b); - to_wstring (const ACE_CDR::WChar *&ws, - ACE_CDR::ULong b); - const ACE_CDR::WChar *&val_; - ACE_CDR::ULong bound_; - }; - //@} - - /** - * Return @c false on failure and @c true on success. - */ - //@{ @name Read basic IDL types - ACE_CDR::Boolean read_boolean (ACE_CDR::Boolean& x); - ACE_CDR::Boolean read_char (ACE_CDR::Char &x); - ACE_CDR::Boolean read_wchar (ACE_CDR::WChar& x); - ACE_CDR::Boolean read_octet (ACE_CDR::Octet& x); - ACE_CDR::Boolean read_short (ACE_CDR::Short &x); - ACE_CDR::Boolean read_ushort (ACE_CDR::UShort &x); - ACE_CDR::Boolean read_long (ACE_CDR::Long &x); - ACE_CDR::Boolean read_ulong (ACE_CDR::ULong &x); - ACE_CDR::Boolean read_longlong (ACE_CDR::LongLong& x); - ACE_CDR::Boolean read_ulonglong (ACE_CDR::ULongLong& x); - ACE_CDR::Boolean read_float (ACE_CDR::Float &x); - ACE_CDR::Boolean read_double (ACE_CDR::Double &x); - ACE_CDR::Boolean read_longdouble (ACE_CDR::LongDouble &x); - - ACE_CDR::Boolean read_string (ACE_CDR::Char *&x); - ACE_CDR::Boolean read_string (ACE_CString &x); - ACE_CDR::Boolean read_wstring (ACE_CDR::WChar*& x); - //@} - - /** - * The buffer @a x must be large enough to contain @a length - * elements. - * Return @c false on failure and @c true on success. - */ - //@{ @name Read basic IDL types arrays - ACE_CDR::Boolean read_boolean_array (ACE_CDR::Boolean* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_char_array (ACE_CDR::Char *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_wchar_array (ACE_CDR::WChar* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_octet_array (ACE_CDR::Octet* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_short_array (ACE_CDR::Short *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_ushort_array (ACE_CDR::UShort *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_long_array (ACE_CDR::Long *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_ulong_array (ACE_CDR::ULong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_longlong_array (ACE_CDR::LongLong* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_ulonglong_array (ACE_CDR::ULongLong* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_float_array (ACE_CDR::Float *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_double_array (ACE_CDR::Double *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble* x, - ACE_CDR::ULong length); - //@} - - /** - * Return @c false on failure and @c true on success. - */ - //@{ @name Skip elements - ACE_CDR::Boolean skip_boolean (void); - ACE_CDR::Boolean skip_char (void); - ACE_CDR::Boolean skip_wchar (void); - ACE_CDR::Boolean skip_octet (void); - ACE_CDR::Boolean skip_short (void); - ACE_CDR::Boolean skip_ushort (void); - ACE_CDR::Boolean skip_long (void); - ACE_CDR::Boolean skip_ulong (void); - ACE_CDR::Boolean skip_longlong (void); - ACE_CDR::Boolean skip_ulonglong (void); - ACE_CDR::Boolean skip_float (void); - ACE_CDR::Boolean skip_double (void); - ACE_CDR::Boolean skip_longdouble (void); - //@} - - /** - * The next field must be a string, this method skips it. It is - * useful in parsing a TypeCode. - * @return @c false on failure and @c true on success. - */ - ACE_CDR::Boolean skip_wstring (void); - ACE_CDR::Boolean skip_string (void); - - /// Skip @a n bytes in the CDR stream. - /** - * @return @c false on failure and @c true on success. - */ - ACE_CDR::Boolean skip_bytes (size_t n); - - /// returns @c false if a problem has been detected. - bool good_bit (void) const; - - /** - * @return The start of the message block chain for this CDR - * stream. - * - * @note In the current implementation the chain has length 1, but - * we are planning to change that. - */ - const ACE_Message_Block* start (void) const; - - // = The following functions are useful to read the contents of the - // CDR stream from a socket or file. - - /** - * Grow the internal buffer, reset @c rd_ptr to the first byte in - * the new buffer that is properly aligned, and set @c wr_ptr to @c - * rd_ptr @c + @c newsize - */ - int grow (size_t newsize); - - /** - * After reading and partially parsing the contents the user can - * detect a change in the byte order, this method will let him/her - * change it. - */ - void reset_byte_order (int byte_order); - - /// Re-initialize the CDR stream, copying the contents of the chain - /// of message_blocks starting from @a data. - void reset (const ACE_Message_Block *data, - int byte_order); - - /// Steal the contents from the current CDR. - ACE_Message_Block *steal_contents (void); - - /// Steal the contents of @a cdr and make a shallow copy into this - /// stream. - void steal_from (ACE_InputCDR &cdr); - - /// Exchange data blocks with the caller of this method. The read - /// and write pointers are also exchanged. - /** - * @note We now do only with the start_ message block. - */ - void exchange_data_blocks (ACE_InputCDR &cdr); - - /// Copy the data portion from the @c cdr to this cdr and return the - /// data content (ie. the ACE_Data_Block) from this CDR to the - /// caller. - /** - * @note The caller is responsible for managing the memory of the - * returned ACE_Data_Block. - */ - ACE_Data_Block* clone_from (ACE_InputCDR &cdr); - - /// Re-initialize the CDR stream, forgetting about the old contents - /// of the stream and allocating a new buffer (from the allocators). - void reset_contents (void); - - /// Returns the current position for the @c rd_ptr. - char* rd_ptr (void); - - /// Returns the current position for the @c wr_ptr. - char* wr_ptr (void); - - /// Return how many bytes are left in the stream. - size_t length (void) const; - - /** - * Utility function to allow the user more flexibility. - * Skips up to the nearest @a alignment-byte boundary. - * Argument MUST be a power of 2. - * - * @return 0 on success and -1 on failure. - */ - int align_read_ptr (size_t alignment); - - /// If @c true then this stream is writing in non-native byte order. - /// This is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined. - bool do_byte_swap (void) const; - - /// If @c do_byte_swap() returns @c false, this returns - /// ACE_CDR_BYTE_ORDER else it returns !ACE_CDR_BYTE_ORDER. - int byte_order (void) const; - - /// Access the codeset translators. They can be nil! - ACE_Char_Codeset_Translator *char_translator (void) const; - ACE_WChar_Codeset_Translator *wchar_translator (void) const; - - /// Set the codeset translators. - void char_translator (ACE_Char_Codeset_Translator *); - void wchar_translator (ACE_WChar_Codeset_Translator *); - - /** - * Returns (in @a buf) the next position in the buffer aligned to - * @a size. It advances the Message_Block @c rd_ptr past the data - * (i.e., @c buf @c + @c size). Sets the good_bit to @c false and - * returns a -1 on failure. - */ - int adjust (size_t size, - char *&buf); - - /// As above, but now the size and alignment requirements may be - /// different. - int adjust (size_t size, - size_t align, - char *&buf); - - /// Set the underlying GIOP version.. - int set_version (ACE_CDR::Octet major, - ACE_CDR::Octet minor); - - /// Set the underlying GIOP version.. - int get_version (ACE_CDR::Octet &major, - ACE_CDR::Octet &minor); - -protected: - - /// The start of the chain of message blocks, even though in the - /// current version the chain always has length 1. - ACE_Message_Block start_; - - /// The CDR stream byte order does not match the one on the machine, - /// swapping is needed while reading. - bool do_byte_swap_; - - /// set to @c false when an error occurs. - bool good_bit_; - - /// The GIOP versions for this stream - ACE_CDR::Octet major_version_; - ACE_CDR::Octet minor_version_; - - /// If not nil, invoke for translation of character and string data. - ACE_Char_Codeset_Translator *char_translator_; - ACE_WChar_Codeset_Translator *wchar_translator_; - -private: - - ACE_CDR::Boolean read_1 (ACE_CDR::Octet *x); - ACE_CDR::Boolean read_2 (ACE_CDR::UShort *x); - ACE_CDR::Boolean read_4 (ACE_CDR::ULong *x); - ACE_CDR::Boolean read_8 (ACE_CDR::ULongLong *x); - ACE_CDR::Boolean read_16 (ACE_CDR::LongDouble *x); - - // Several types can be read using the same routines, since TAO - // tries to use native types with known size for each CORBA type. - // We could use void* or char* to make the interface more - // consistent, but using native types let us exploit the strict - // alignment requirements of CDR streams and implement the - // operations using asignment. - - /** - * Read an array of elements, each of bytes and the - * start aligned at a multiple of . The elements are assumed - * to be packed with the right alignment restrictions. It is mostly - * designed for buffers of the basic types. - * - * This operation uses ; as explained above it is expected - * that using assignment is faster that for one element, - * but for several elements should be more efficient, it - * could be interesting to find the break even point and optimize - * for that case, but that would be too platform dependent. - */ - ACE_CDR::Boolean read_array (void* x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * On those occasions when the native codeset for wchar is smaller than - * the size of a wchar_t, such as using UTF-16 with a 4-byte wchar_t, a - * special form of reading the array is needed. Actually, this should be - * a default translator. - */ - ACE_CDR::Boolean read_wchar_array_i (ACE_CDR::WChar * x, - ACE_CDR::ULong length); - - /// Move the rd_ptr ahead by bytes. - void rd_ptr (size_t offset); - - /// Points to the continuation field of the current message block. - char* end (void); -}; - -// **************************************************************** - -/** - * @class ACE_Char_Codeset_Translator - * - * @brief Codeset translation routines common to both Output and Input - * CDR streams. - * - * This class is a base class for defining codeset translation - * routines to handle the character set translations required by - * both CDR Input streams and CDR Output streams. - * - * Translators are reference counted. This allows for stateful as well - * as stateless translators. Stateless translators will be allocated - * once whereas CDR Streams own their own copy of a stateful translator. - */ -class ACE_Export ACE_Char_Codeset_Translator -{ -public: - virtual ~ACE_Char_Codeset_Translator (); - - /// Read a single character from the stream, converting from the - /// stream codeset to the native codeset - virtual ACE_CDR::Boolean read_char (ACE_InputCDR&, - ACE_CDR::Char&) = 0; - - /// Read a string from the stream, including the length, converting - /// the characters from the stream codeset to the native codeset - virtual ACE_CDR::Boolean read_string (ACE_InputCDR&, - ACE_CDR::Char *&) = 0; - - /// Read an array of characters from the stream, converting the - /// characters from the stream codeset to the native codeset. - virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR&, - ACE_CDR::Char*, - ACE_CDR::ULong) = 0; - - /// Write a single character to the stream, converting from the - /// native codeset to the stream codeset - virtual ACE_CDR::Boolean write_char (ACE_OutputCDR&, - ACE_CDR::Char) = 0; - - /// Write a string to the stream, including the length, converting - /// from the native codeset to the stream codeset - virtual ACE_CDR::Boolean write_string (ACE_OutputCDR&, - ACE_CDR::ULong, - const ACE_CDR::Char*) = 0; - - /// Write an array of characters to the stream, converting from the - /// native codeset to the stream codeset - virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR&, - const ACE_CDR::Char*, - ACE_CDR::ULong) = 0; - - virtual ACE_CDR::ULong ncs () = 0; - virtual ACE_CDR::ULong tcs () = 0; -protected: - /// Children have access to low-level routines because they cannot - /// use read_char or something similar (it would recurse). - ACE_CDR::Boolean read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x); - ACE_CDR::Boolean write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x); - - /// Efficiently read elements of size each from - /// into ; the data must be aligned to . - ACE_CDR::Boolean read_array (ACE_InputCDR& input, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * Efficiently write elements of size from into - * . Before inserting the elements enough padding is added - * to ensure that the elements will be aligned to in the - * stream. - */ - ACE_CDR::Boolean write_array (ACE_OutputCDR& output, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * Exposes the stream implementation of , this is useful in - * many cases to minimize memory allocations during marshaling. - * On success will contain a contiguous area in the CDR stream - * that can hold bytes aligned to . - * Results - */ - int adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf); - - /// Used by derived classes to set errors in the CDR stream. - void good_bit (ACE_OutputCDR& out, bool bit); - - /// Obtain the CDR Stream's major & minor version values. - ACE_CDR::Octet major_version (ACE_InputCDR& input); - ACE_CDR::Octet minor_version (ACE_InputCDR& input); - ACE_CDR::Octet major_version (ACE_OutputCDR& output); - ACE_CDR::Octet minor_version (ACE_OutputCDR& output); -}; - -// **************************************************************** - -/** - * @class ACE_WChar_Codeset_Translator - * - * @brief Codeset translation routines common to both Output and Input - * CDR streams. - * - * This class is a base class for defining codeset translation - * routines to handle the character set translations required by - * both CDR Input streams and CDR Output streams. - */ -class ACE_Export ACE_WChar_Codeset_Translator -{ -public: - virtual ~ACE_WChar_Codeset_Translator (); - - virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR&, - ACE_CDR::WChar&) = 0; - virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&, - ACE_CDR::WChar *&) = 0; - virtual ACE_CDR::Boolean read_wchar_array (ACE_InputCDR&, - ACE_CDR::WChar*, - ACE_CDR::ULong) = 0; - virtual ACE_CDR::Boolean write_wchar (ACE_OutputCDR&, - ACE_CDR::WChar) = 0; - virtual ACE_CDR::Boolean write_wstring (ACE_OutputCDR&, - ACE_CDR::ULong, - const ACE_CDR::WChar*) = 0; - virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR&, - const ACE_CDR::WChar*, - ACE_CDR::ULong) = 0; - - virtual ACE_CDR::ULong ncs () = 0; - virtual ACE_CDR::ULong tcs () = 0; -protected: - /// Children have access to low-level routines because they cannot - /// use read_char or something similar (it would recurse). - ACE_CDR::Boolean read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x); - ACE_CDR::Boolean read_2 (ACE_InputCDR& input, - ACE_CDR::UShort *x); - ACE_CDR::Boolean read_4 (ACE_InputCDR& input, - ACE_CDR::ULong *x); - ACE_CDR::Boolean write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x); - ACE_CDR::Boolean write_2 (ACE_OutputCDR& output, - const ACE_CDR::UShort *x); - ACE_CDR::Boolean write_4 (ACE_OutputCDR& output, - const ACE_CDR::ULong *x); - - /// Efficiently read elements of size each from - /// into ; the data must be aligned to . - ACE_CDR::Boolean read_array (ACE_InputCDR& input, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * Efficiently write elements of size from into - * . Before inserting the elements enough padding is added - * to ensure that the elements will be aligned to in the - * stream. - */ - ACE_CDR::Boolean write_array (ACE_OutputCDR& output, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * Exposes the stream implementation of , this is useful in - * many cases to minimize memory allocations during marshaling. - * On success will contain a contiguous area in the CDR stream - * that can hold bytes aligned to . - * Results - */ - int adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf); - - /// Used by derived classes to set errors in the CDR stream. - void good_bit (ACE_OutputCDR& out, bool bit); - - /// Obtain the CDR Stream's major & minor version values. - ACE_CDR::Octet major_version (ACE_InputCDR& input); - ACE_CDR::Octet minor_version (ACE_InputCDR& input); - ACE_CDR::Octet major_version (ACE_OutputCDR& output); - ACE_CDR::Octet minor_version (ACE_OutputCDR& output); - -}; - -// @@ These operators should not be inlined since they force SString.h -// to be included in this header. -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - const ACE_CString &x); - -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CString &x); - - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/CDR_Stream.inl" -#else /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Not used by CORBA or TAO -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Char x); -// CDR output operators for primitive types - -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Short x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::UShort x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Long x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::ULong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::LongLong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::ULongLong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR& os, - ACE_CDR::LongDouble x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Float x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Double x); - -// CDR output operator from helper classes - -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_boolean x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_char x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_wchar x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_octet x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_string x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_wstring x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - const ACE_CDR::Char* x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - const ACE_CDR::WChar* x); - -// Not used by CORBA or TAO -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Char &x); -// CDR input operators for primitive types - -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Short &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::UShort &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Long &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::ULong &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::LongLong &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::ULongLong &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::LongDouble &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Float &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Double &x); - -// CDR input operator from helper classes - -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_boolean x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_char x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_wchar x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_octet x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_string x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_wstring x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Char*& x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::WChar*& x); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CDR_STREAM_H */ diff --git a/ace/CDR_Stream.inl b/ace/CDR_Stream.inl deleted file mode 100644 index 9ac90d4ff8f..00000000000 --- a/ace/CDR_Stream.inl +++ /dev/null @@ -1,1752 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_string.h" -#include "ace/OS_Memory.h" - -// **************************************************************** - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// implementing the special types -ACE_INLINE -ACE_OutputCDR::from_boolean::from_boolean (ACE_CDR::Boolean b) - : val_ (b) -{ -} - -ACE_INLINE -ACE_InputCDR::to_boolean::to_boolean (ACE_CDR::Boolean &b) - : ref_ (b) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_octet::from_octet (ACE_CDR::Octet o) - : val_ (o) -{ -} - -ACE_INLINE -ACE_InputCDR::to_octet::to_octet (ACE_CDR::Octet &o) - : ref_ (o) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_char::from_char (ACE_CDR::Char c) - : val_ (c) -{ -} - -ACE_INLINE -ACE_InputCDR::to_char::to_char (ACE_CDR::Char &c) - : ref_ (c) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_wchar::from_wchar (ACE_CDR::WChar wc) - : val_ (wc) -{ -} - -ACE_INLINE -ACE_InputCDR::to_wchar::to_wchar (ACE_CDR::WChar &wc) - : ref_ (wc) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_string::from_string (ACE_CDR::Char *s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy) - : val_ (s), - bound_ (b), - nocopy_ (nocopy) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_string::from_string (const ACE_CDR::Char *s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy) - : val_ (const_cast (s)), - bound_ (b), - nocopy_ (nocopy) -{ -} - -ACE_INLINE -ACE_InputCDR::to_string::to_string (ACE_CDR::Char *&s, - ACE_CDR::ULong b) - : val_ (const_cast (s)), - bound_ (b) -{ -} - -ACE_INLINE -ACE_InputCDR::to_string::to_string (const ACE_CDR::Char *&s, - ACE_CDR::ULong b) - : val_ (s), - bound_ (b) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_wstring::from_wstring (ACE_CDR::WChar *ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy) - : val_ (ws), - bound_ (b), - nocopy_ (nocopy) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_wstring::from_wstring (const ACE_CDR::WChar *ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy) - : val_ (const_cast (ws)), - bound_ (b), - nocopy_ (nocopy) -{ -} - -ACE_INLINE -ACE_InputCDR::to_wstring::to_wstring (ACE_CDR::WChar *&ws, - ACE_CDR::ULong b) - : val_ (const_cast (ws)), - bound_ (b) -{ -} - -ACE_INLINE -ACE_InputCDR::to_wstring::to_wstring (const ACE_CDR::WChar *&ws, - ACE_CDR::ULong b) - : val_ (ws), - bound_ (b) -{ -} - -ACE_INLINE -ACE_InputCDR::Transfer_Contents::Transfer_Contents (ACE_InputCDR &rhs) - : rhs_ (rhs) -{ -} - -// **************************************************************** - -ACE_INLINE -ACE_OutputCDR::~ACE_OutputCDR (void) -{ - if (this->start_.cont () != 0) - { - ACE_Message_Block::release (this->start_.cont ()); - this->start_.cont (0); - } - this->current_ = 0; -} - -ACE_INLINE void -ACE_OutputCDR::reset (void) -{ - this->current_ = &this->start_; - this->current_is_writable_ = true; - ACE_CDR::mb_align (&this->start_); - -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - this->current_alignment_ = 0; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - // It is tempting not to remove the memory, but we need to do so to - // release any potential user buffers chained in the continuation - // field. - - ACE_Message_Block * const cont = this->start_.cont (); - if (cont) - { - ACE_Message_Block::release (cont); - this->start_.cont (0); - } -} - -// Encode the CDR stream. - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_octet (ACE_CDR::Octet x) -{ - void const * temp = &x; - return this->write_1 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_boolean (ACE_CDR::Boolean x) -{ - return - static_cast ( - this->write_octet ( - x - ? static_cast (1) - : static_cast (0))); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_char (ACE_CDR::Char x) -{ - if (this->char_translator_ == 0) - { - void const * temp = &x; - return this->write_1 (reinterpret_cast (temp)); - } - return this->char_translator_->write_char (*this, x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_short (ACE_CDR::Short x) -{ - const void *temp = &x; - return this->write_2 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ushort (ACE_CDR::UShort x) -{ - const void *temp = &x; - return this->write_2 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_long (ACE_CDR::Long x) -{ - const void *temp = &x; - return this->write_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ulong (ACE_CDR::ULong x) -{ - const void *temp = &x; - return this->write_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_longlong (const ACE_CDR::LongLong &x) -{ - const void *temp = &x; - return this->write_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ulonglong (const ACE_CDR::ULongLong &x) -{ - const void *temp = &x; - return this->write_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_float (ACE_CDR::Float x) -{ - const void *temp = &x; - return this->write_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_double (const ACE_CDR::Double &x) -{ - const void *temp = &x; - return this->write_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_longdouble (const ACE_CDR::LongDouble &x) -{ - const void *temp = &x; - return this->write_16 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_string (const ACE_CDR::Char *x) -{ - if (x) - { - const ACE_CDR::ULong len = - static_cast (ACE_OS::strlen (x)); - return this->write_string (len, x); - } - - return this->write_string (0, 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_wstring (const ACE_CDR::WChar *x) -{ - if (x) - { - ACE_CDR::ULong len = - static_cast (ACE_OS::strlen (x)); - return this->write_wstring (len, x); - } - - return this->write_wstring (0, 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_char_array (const ACE_CDR::Char *x, - ACE_CDR::ULong length) -{ - if (this->char_translator_ == 0) - return this->write_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); - return this->char_translator_->write_char_array (*this, x, length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_wchar_array (const ACE_CDR::WChar* x, - ACE_CDR::ULong length) -{ - if (this->wchar_translator_) - return this->wchar_translator_->write_wchar_array (*this, x, length); - - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (ACE_CDR::Boolean) (this->good_bit_ = false); - } - - if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) - return this->write_array (x, - sizeof (ACE_CDR::WChar), - sizeof (ACE_CDR::WChar) == 2 - ? ACE_CDR::SHORT_ALIGN - : ACE_CDR::LONG_ALIGN, - length); - return this->write_wchar_array_i (x,length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_octet_array (const ACE_CDR::Octet* x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_short_array (const ACE_CDR::Short *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ushort_array (const ACE_CDR::UShort *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_long_array (const ACE_CDR::Long *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ulong_array (const ACE_CDR::ULong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_longlong_array (const ACE_CDR::LongLong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_float_array (const ACE_CDR::Float *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_double_array (const ACE_CDR::Double *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_longdouble_array (const ACE_CDR::LongDouble* x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - length); -} - -ACE_INLINE bool -ACE_OutputCDR::good_bit (void) const -{ - return this->good_bit_; -} - -ACE_INLINE int -ACE_OutputCDR::adjust (size_t size, - size_t align, - char*& buf) -{ - if (!this->current_is_writable_) - return this->grow_and_adjust (size, align, buf); - -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - const size_t offset = - ACE_align_binary (this->current_alignment_, align) - - this->current_alignment_; - - buf = this->current_->wr_ptr () + offset; -#else - buf = this->current_->wr_ptr (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - char *end = buf + size; - - if (end <= this->current_->end () && - end >= buf) - { -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - this->current_alignment_ += offset + size; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - this->current_->wr_ptr (end); - return 0; - } - - return this->grow_and_adjust (size, align, buf); -} - -ACE_INLINE int -ACE_OutputCDR::adjust (size_t size, char*& buf) -{ - return this->adjust (size, size, buf); -} - -ACE_INLINE int -ACE_OutputCDR::set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor) -{ - this->major_version_ = major; - this->minor_version_ = minor; - return 0; -} - -ACE_INLINE int -ACE_OutputCDR::get_version (ACE_CDR::Octet &major, - ACE_CDR::Octet &minor) -{ - major = this->major_version_; - minor = this->minor_version_; - return 0; -} - - -ACE_INLINE const ACE_Message_Block* -ACE_OutputCDR::begin (void) const -{ - return &this->start_; -} - -ACE_INLINE const ACE_Message_Block* -ACE_OutputCDR::end (void) const -{ - return this->current_->cont (); -} - -ACE_INLINE const ACE_Message_Block* -ACE_OutputCDR::current (void) const -{ - return this->current_; -} - -ACE_INLINE size_t -ACE_OutputCDR::total_length (void) const -{ - return ACE_CDR::total_length (this->begin (), this->end ()); -} - -ACE_INLINE const char* -ACE_OutputCDR::buffer (void) const -{ - return this->start_.rd_ptr (); -} - -ACE_INLINE size_t -ACE_OutputCDR::length (void) const -{ - return this->start_.length (); -} - -ACE_INLINE bool -ACE_OutputCDR::do_byte_swap (void) const -{ - return this->do_byte_swap_; -} - -ACE_INLINE int -ACE_OutputCDR::byte_order (void) const -{ - if (this->do_byte_swap ()) - return !ACE_CDR_BYTE_ORDER; - else - return ACE_CDR_BYTE_ORDER; -} - -ACE_INLINE void -ACE_OutputCDR::reset_byte_order (int byte_order) -{ - this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); -} - -ACE_INLINE size_t -ACE_OutputCDR::current_alignment (void) const -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - return this->current_alignment_; -#else - // Default value set to 0 - return 0; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ -} - -ACE_INLINE int -ACE_OutputCDR::align_write_ptr (size_t alignment) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - char *dummy; - return this->adjust (0, alignment, dummy); -#else - ACE_UNUSED_ARG (alignment); - // A return value of -1 from this function is used - // to indicate failure, returning 0 - return 0; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ -} - -ACE_INLINE ACE_Char_Codeset_Translator * -ACE_OutputCDR::char_translator (void) const -{ - return this->char_translator_; -} - -ACE_INLINE ACE_WChar_Codeset_Translator * -ACE_OutputCDR::wchar_translator (void) const -{ - return this->wchar_translator_; -} - -ACE_INLINE void -ACE_OutputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) -{ - this->char_translator_ = ctran; -} - -ACE_INLINE void -ACE_OutputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) -{ - this->wchar_translator_ = wctran; -} - -// **************************************************************** - -ACE_INLINE -ACE_InputCDR::~ACE_InputCDR (void) -{ -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_octet (ACE_CDR::Octet& x) -{ - return this->read_1 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_boolean (ACE_CDR::Boolean& x) -{ - ACE_CDR::Octet tmp = 0; - this->read_octet (tmp); - x = tmp ? true : false; - return (ACE_CDR::Boolean) this->good_bit_; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_char (ACE_CDR::Char &x) -{ - if (this->char_translator_ == 0) - { - void *temp = &x; - return this->read_1 (reinterpret_cast (temp)); - } - return this->char_translator_->read_char (*this, x); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_short (ACE_CDR::Short &x) -{ - void *temp = &x; - return this->read_2 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ushort (ACE_CDR::UShort &x) -{ - void *temp = &x; - return this->read_2 (reinterpret_cast (temp)); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_long (ACE_CDR::Long &x) -{ - void *temp = &x; - return this->read_4 (reinterpret_cast (temp)); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ulong (ACE_CDR::ULong &x) -{ - void *temp = &x; - return this->read_4 (reinterpret_cast (temp)); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_longlong (ACE_CDR::LongLong &x) -{ - void *temp = &x; - return this->read_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ulonglong (ACE_CDR::ULongLong &x) -{ - void *temp = &x; - return this->read_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_float (ACE_CDR::Float &x) -{ - void *temp = &x; - return this->read_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_double (ACE_CDR::Double &x) -{ - void *temp = &x; - return this->read_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_longdouble (ACE_CDR::LongDouble &x) -{ - void *temp = &x; - return this->read_16 (reinterpret_cast (temp)); -} - -ACE_INLINE size_t -ACE_InputCDR::length (void) const -{ - return this->start_.length (); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_char_array (ACE_CDR::Char* x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length > this->length ()) - { - this->good_bit_ = false; - return false; - } - - if (this->char_translator_ == 0) - return this->read_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); - return this->char_translator_->read_char_array (*this, x, length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_wchar_array (ACE_CDR::WChar* x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_OutputCDR::wchar_maxbytes_ > this->length ()) - { - this->good_bit_ = false; - return false; - } - - if (this->wchar_translator_ != 0) - return this->wchar_translator_->read_wchar_array (*this, x, length); - if (ACE_OutputCDR::wchar_maxbytes_ != sizeof (ACE_CDR::WChar)) - return this->read_wchar_array_i (x, length); - return this->read_array (x, - sizeof (ACE_CDR::WChar), - sizeof (ACE_CDR::WChar) == 2 - ? ACE_CDR::SHORT_ALIGN - : ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_octet_array (ACE_CDR::Octet* x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::OCTET_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_short_array (ACE_CDR::Short *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::SHORT_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ushort_array (ACE_CDR::UShort *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::SHORT_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_long_array (ACE_CDR::Long *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ulong_array (ACE_CDR::ULong *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_longlong_array (ACE_CDR::LongLong *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ulonglong_array (ACE_CDR::ULongLong *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_float_array (ACE_CDR::Float *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_double_array (ACE_CDR::Double *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONGDOUBLE_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - return this->read_array (x, - ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_char (void) -{ - ACE_CDR::Char x; - void *temp = &x; - return this->read_1 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_octet (void) -{ - ACE_CDR::Octet x; - return this->read_1 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_boolean (void) -{ - ACE_CDR::Octet tmp; - this->read_octet (tmp); - return (ACE_CDR::Boolean) this->good_bit_; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_short (void) -{ - ACE_CDR::Short x; - void *temp = &x; - return this->read_2 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_ushort (void) -{ - ACE_CDR::UShort x; - void *temp = &x; - return this->read_2 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_long (void) -{ - ACE_CDR::Long x; - void *temp = &x; - return this->read_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_ulong (void) -{ - ACE_CDR::ULong x; - void *temp = &x; - return this->read_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_longlong (void) -{ - ACE_CDR::LongLong x; - void *temp = &x; - return this->read_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_ulonglong (void) -{ - ACE_CDR::ULongLong x; - void *temp = &x; - return this->read_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_float (void) -{ - // Changing this removes the warning for GHS and it - // stops the compiler from getting an internal error. - ACE_CDR::ULong value; - void *temp = &value; - return this->read_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_double (void) -{ - double x; - void *temp = &x; - return this->read_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_longdouble (void) -{ - ACE_CDR::LongDouble x; - void *temp = &x; - return this->read_16 (reinterpret_cast (temp)); -} - -ACE_INLINE char* -ACE_InputCDR::end (void) -{ - return this->start_.end (); -} - -ACE_INLINE void -ACE_InputCDR::rd_ptr (size_t offset) -{ - this->start_.rd_ptr (offset); -} - -ACE_INLINE char* -ACE_InputCDR::rd_ptr (void) -{ - return this->start_.rd_ptr (); -} - -ACE_INLINE char* -ACE_InputCDR::wr_ptr (void) -{ - return this->start_.wr_ptr (); -} - -ACE_INLINE int -ACE_InputCDR::adjust (size_t size, - size_t align, - char*& buf) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - buf = ACE_ptr_align_binary (this->rd_ptr (), align); -#else - buf = this->rd_ptr (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - char *end = buf + size; - if (end <= this->wr_ptr ()) - { - this->start_.rd_ptr (end); - return 0; - } - - this->good_bit_ = false; - return -1; -#if defined (ACE_LACKS_CDR_ALIGNMENT) - ACE_UNUSED_ARG (align); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ -} - -ACE_INLINE int -ACE_InputCDR::adjust (size_t size, - char*& buf) -{ - return this->adjust (size, size, buf); -} - -ACE_INLINE const ACE_Message_Block* -ACE_InputCDR::start (void) const -{ - return &this->start_; -} - -ACE_INLINE bool -ACE_InputCDR::good_bit (void) const -{ - return this->good_bit_; -} - -// **************************************************************** - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Char x) -{ - os.write_char (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Short x) -{ - os.write_short (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::UShort x) -{ - os.write_ushort (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Long x) -{ - os.write_long (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::ULong x) -{ - os.write_ulong (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::LongLong x) -{ - os.write_longlong (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::ULongLong x) -{ - os.write_ulonglong (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::LongDouble x) -{ - os.write_longdouble (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Float x) -{ - os.write_float (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Double x) -{ - os.write_double (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, const ACE_CDR::Char *x) -{ - os.write_string (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, const ACE_CDR::WChar *x) -{ - os.write_wstring (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -// The following use the helper classes -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_boolean x) -{ - os.write_boolean (x.val_); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_char x) -{ - os.write_char (x.val_); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wchar x) -{ - os.write_wchar (x.val_); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_octet x) -{ - os.write_octet (x.val_); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_string x) -{ - ACE_CDR::ULong len = 0; - - if (x.val_ != 0) - { - len = static_cast (ACE_OS::strlen (x.val_)); - } - - os.write_string (len, x.val_); - return - (ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_)); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x) -{ - ACE_CDR::ULong len = 0; - - if (x.val_ != 0) - { - len = static_cast (ACE_OS::strlen (x.val_)); - } - - os.write_wstring (len, x.val_); - return - (ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_)); -} - -// **************************************************************** - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Char &x) -{ - is.read_char (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Short &x) -{ - is.read_short (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::UShort &x) -{ - is.read_ushort (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>>(ACE_InputCDR &is, ACE_CDR::Long &x) -{ - is.read_long (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::ULong &x) -{ - is.read_ulong (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR& is, ACE_CDR::LongLong &x) -{ - is.read_longlong (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR& is, ACE_CDR::ULongLong &x) -{ - is.read_ulonglong (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR& is, ACE_CDR::LongDouble &x) -{ - is.read_longdouble (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Float &x) -{ - is.read_float (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Double &x) -{ - is.read_double (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Char *&x) -{ - is.read_string (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::WChar *&x) -{ - is.read_wstring (x); - return (ACE_CDR::Boolean) is.good_bit (); -} - -// The following use the helper classes -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_boolean x) -{ - is.read_boolean (x.ref_); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_char x) -{ - is.read_char (x.ref_); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wchar x) -{ - is.read_wchar (x.ref_); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_octet x) -{ - is.read_octet (x.ref_); - return (ACE_CDR::Boolean) is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_string x) -{ - is.read_string (const_cast (x.val_)); - // check if the bounds are satisfied - return - (ACE_CDR::Boolean) (is.good_bit () - && (!x.bound_ - || ACE_OS::strlen (x.val_) <= x.bound_)); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wstring x) -{ - is.read_wstring (const_cast (x.val_)); - // check if the bounds are satisfied - return - (ACE_CDR::Boolean) (is.good_bit () - && (!x.bound_ - || ACE_OS::strlen (x.val_) <= x.bound_)); -} - -// *************************************************************************** -// We must define these methods here because they use the "read_*" inlined -// methods of the ACE_InputCDR class -// *************************************************************************** - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_boolean (ACE_InputCDR &stream) -{ - ACE_CDR::Boolean x; - return stream.read_boolean (x) ? this->write_boolean (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_char (ACE_InputCDR &stream) -{ - ACE_CDR::Char x; - return stream.read_char (x) ? this->write_char (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_wchar (ACE_InputCDR &stream) -{ - ACE_CDR::WChar x; - return stream.read_wchar (x) ? this->write_wchar (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_octet (ACE_InputCDR &stream) -{ - ACE_CDR::Octet x; - return stream.read_octet (x) ? this->write_octet (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_short (ACE_InputCDR &stream) -{ - ACE_CDR::Short x; - return stream.read_short (x) ? this->write_short (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_ushort (ACE_InputCDR &stream) -{ - ACE_CDR::UShort x; - return stream.read_ushort (x) ? this->write_ushort (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_long (ACE_InputCDR &stream) -{ - ACE_CDR::Long x; - return stream.read_long (x) ? this->write_long (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_ulong (ACE_InputCDR &stream) -{ - ACE_CDR::ULong x; - return stream.read_ulong (x) ? this->write_ulong (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_longlong (ACE_InputCDR &stream) -{ - ACE_CDR::LongLong x; - return stream.read_longlong (x) ? this->write_longlong (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_ulonglong (ACE_InputCDR &stream) -{ - ACE_CDR::ULongLong x; - return stream.read_ulonglong (x) ? this->write_ulonglong (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_float (ACE_InputCDR &stream) -{ - ACE_CDR::Float x; - return stream.read_float (x) ? this->write_float (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_double (ACE_InputCDR &stream) -{ - ACE_CDR::Double x; - return stream.read_double (x) ? this->write_double (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_longdouble (ACE_InputCDR &stream) -{ - ACE_CDR::LongDouble x; - return stream.read_longdouble (x) ? this->write_longdouble (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_string (ACE_InputCDR &stream) -{ - ACE_CDR::Char *x; - const ACE_CDR::Boolean flag = - (stream.read_string (x) ? this->write_string (x) : false); - delete [] x; - return flag; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_wstring (ACE_InputCDR &stream) -{ - ACE_CDR::WChar *x; - const ACE_CDR::Boolean flag = - (stream.read_wstring (x) ? this->write_wstring (x) : false); - delete [] x; - return flag; -} - -ACE_INLINE void -ACE_InputCDR::reset_byte_order (int byte_order) -{ - this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); -} - -ACE_INLINE bool -ACE_InputCDR::do_byte_swap (void) const -{ - return this->do_byte_swap_; -} - -ACE_INLINE int -ACE_InputCDR::byte_order (void) const -{ - return this->do_byte_swap () ? !ACE_CDR_BYTE_ORDER : ACE_CDR_BYTE_ORDER; -} - -ACE_INLINE int -ACE_InputCDR::align_read_ptr (size_t alignment) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - char *buf = ACE_ptr_align_binary (this->rd_ptr (), - alignment); -#else - char *buf = this->rd_ptr (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - if (buf <= this->wr_ptr ()) - { - this->start_.rd_ptr (buf); - return 0; - } - - this->good_bit_ = false; - return -1; -} - -ACE_INLINE int -ACE_InputCDR::set_version (ACE_CDR::Octet major, - ACE_CDR::Octet minor) -{ - this->major_version_ = major; - this->minor_version_ = minor; - return 0; -} - -ACE_INLINE int -ACE_InputCDR::get_version (ACE_CDR::Octet &major, - ACE_CDR::Octet &minor) -{ - major = this->major_version_; - minor = this->minor_version_; - return 0; -} - -ACE_INLINE ACE_Char_Codeset_Translator * -ACE_InputCDR::char_translator (void) const -{ - return this->char_translator_; -} - -ACE_INLINE ACE_WChar_Codeset_Translator * -ACE_InputCDR::wchar_translator (void) const -{ - return this->wchar_translator_; -} - - -ACE_INLINE void -ACE_InputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) -{ - this->char_translator_ = ctran; -} - -ACE_INLINE void -ACE_InputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) -{ - this->wchar_translator_ = wctran; -} - -// **************************************************************** - -ACE_INLINE ACE_CDR::Boolean -ACE_Char_Codeset_Translator::read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x) -{ - return input.read_1 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_Char_Codeset_Translator::write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x) -{ - return output.write_1 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_Char_Codeset_Translator::read_array (ACE_InputCDR& in, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - return in.read_array (x, size, align, length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_Char_Codeset_Translator::write_array (ACE_OutputCDR& out, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - return out.write_array(x, size, align, length); -} - -ACE_INLINE int -ACE_Char_Codeset_Translator::adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf) -{ - return out.adjust(size, align, buf); -} - -ACE_INLINE void -ACE_Char_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit) -{ - out.good_bit_ = bit; -} - -ACE_INLINE ACE_CDR::Octet -ACE_Char_Codeset_Translator::major_version (ACE_InputCDR& input) -{ - return input.major_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_Char_Codeset_Translator::minor_version (ACE_InputCDR& input) -{ - return input.minor_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_Char_Codeset_Translator::major_version (ACE_OutputCDR& output) -{ - return output.major_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_Char_Codeset_Translator::minor_version (ACE_OutputCDR& output) -{ - return output.minor_version_; -} - -// **************************************************************** - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x) -{ - return input.read_1 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::read_2 (ACE_InputCDR& input, - ACE_CDR::UShort *x) -{ - return input.read_2 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::read_4 (ACE_InputCDR& input, - ACE_CDR::ULong *x) -{ - return input.read_4 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x) -{ - return output.write_1 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::write_2 (ACE_OutputCDR& output, - const ACE_CDR::UShort *x) -{ - return output.write_2 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::write_4 (ACE_OutputCDR& output, - const ACE_CDR::ULong *x) -{ - return output.write_4 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::read_array (ACE_InputCDR& in, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - return in.read_array (x, size, align, length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::write_array (ACE_OutputCDR& out, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - return out.write_array(x, size, align, length); -} - -ACE_INLINE int -ACE_WChar_Codeset_Translator::adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf) -{ - return out.adjust(size, align, buf); -} - -ACE_INLINE void -ACE_WChar_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit) -{ - out.good_bit_ = bit; -} - -ACE_INLINE ACE_CDR::Octet -ACE_WChar_Codeset_Translator::major_version (ACE_InputCDR& input) -{ - return input.major_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_WChar_Codeset_Translator::minor_version (ACE_InputCDR& input) -{ - return input.minor_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_WChar_Codeset_Translator::major_version (ACE_OutputCDR& output) -{ - return output.major_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_WChar_Codeset_Translator::minor_version (ACE_OutputCDR& output) -{ - return output.minor_version_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CE_Screen_Output.cpp b/ace/CE_Screen_Output.cpp deleted file mode 100644 index 3afc5325d9a..00000000000 --- a/ace/CE_Screen_Output.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// $Id$ - -#include "ace/CE_Screen_Output.h" -#if defined (ACE_HAS_WINCE) - -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_CE_Screen_Output::ACE_CE_Screen_Output(HWND hEdit) -: handler_(hEdit) -, pFile_(0) -{ -} - -ACE_CE_Screen_Output::ACE_CE_Screen_Output() -: handler_(0) -, pFile_(0) -{ -} - -ACE_CE_Screen_Output::~ACE_CE_Screen_Output() -{ - if (pFile_ != 0) { - fclose(pFile_); - } -} - -void ACE_CE_Screen_Output::log(ACE_Log_Record &log_record) -{ - ACE_TCHAR verbose_msg[ACE_Log_Record::MAXVERBOSELOGMSGLEN]; - int result = log_record.format_msg (ACE_LIB_TEXT("WindozeCE"), // host name - 0, // verbose flag - verbose_msg); - - if (result == 0) - { - verbose_msg[ ACE_OS::strlen(verbose_msg) - 1 ] = 0; // CE does not like '\n' by itself. - *this << verbose_msg << endl; - } -} - -void ACE_CE_Screen_Output::SetOutputWindow(HWND hEdit) -{ - handler_ = hEdit; -} - -void ACE_CE_Screen_Output::clear() -{ - SetWindowText(handler_, 0); -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_TCHAR* output) -{ - int length = GetWindowTextLength(handler_); - SendMessage(handler_, EM_SETSEL, length, length); - SendMessage(handler_, EM_REPLACESEL, 0, (LPARAM)output); - - if (pFile_ != 0) - { - fwprintf(pFile_, L"%s", output); - } - - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_TCHAR* output) -{ - ACE_TCHAR* buffer = ACE_OS::strdup(output); - if (buffer != 0) - { - *this << buffer; - delete buffer; - } - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_ANTI_TCHAR* output) -{ - *this << ACE_TEXT_CHAR_TO_TCHAR(output); - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_ANTI_TCHAR* output) -{ - *this << ACE_TEXT_CHAR_TO_TCHAR(output); - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (char output) -{ - *this << (int)output; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned char output) -{ - *this << (int)output; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned short output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_LIB_TEXT("%u"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (int output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_LIB_TEXT("%d"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned int output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_LIB_TEXT("%du"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (float output) -{ - ACE_TCHAR buffer[20]; - swprintf(buffer, ACE_LIB_TEXT("%f"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (long output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_LIB_TEXT("%l"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned long output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_LIB_TEXT("%lu"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (FILE* pFile) -{ - pFile_ = pFile; - return *this; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif // ACE_HAS_WINCE diff --git a/ace/CE_Screen_Output.h b/ace/CE_Screen_Output.h deleted file mode 100644 index 48e9d54cb13..00000000000 --- a/ace/CE_Screen_Output.h +++ /dev/null @@ -1,109 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CE_Screen_Output.h - * - * $Id$ - * - * @author Si Mong Park - */ -//============================================================================= - -#ifndef ACE_CE_SCREEN_OUTPUT_H -#define ACE_CE_SCREEN_OUTPUT_H - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_WINCE) - -#include "ace/Log_Msg_Callback.h" -#include "ace/Log_Record.h" - -namespace -{ - const ACE_TCHAR endl[] = ACE_LIB_TEXT("\r\n"); - const ACE_TCHAR tab[] = ACE_LIB_TEXT("\t"); -} - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_CE_Screen_Output - * - * @brief Replacement of text output for Windows CE. - * - * This class allows standard text output to be displayed on - * text window for Windows CE. Generally, all ACE output will - * go through under CE if and only if user uses WindozeCE - * implementation by using main_ce instead of main. - * Also, for the easier debugging purpose, object pointer of - * this class can be gotten from ACE_Log_Msg::msg_callback() - * and then can be used directly by user just like cout stream. - */ -class ACE_Export ACE_CE_Screen_Output : public ACE_Log_Msg_Callback -{ -public: - - ACE_CE_Screen_Output (HWND hEdit); - - ACE_CE_Screen_Output (void); - - virtual ~ACE_CE_Screen_Output(); - - /// Implementation of pure virtual function from ACE_Log_Msg_Callback. - virtual void log (ACE_Log_Record &log_record); - - /// Interface to specify active window handle. - void SetOutputWindow (HWND hWnd); - - void clear (void); - - /// Stream insertion operator that performs actual print out. - /** - * @note This is the only one operator that performs output. All - * other perators convert the type and use this operator - * underneath. - */ - ACE_CE_Screen_Output& operator << (ACE_TCHAR*); - ACE_CE_Screen_Output& operator << (const ACE_TCHAR*); - - ACE_CE_Screen_Output& operator << (ACE_ANTI_TCHAR* output); - ACE_CE_Screen_Output& operator << (const ACE_ANTI_TCHAR* output); - - ACE_CE_Screen_Output& operator << (char output); - ACE_CE_Screen_Output& operator << (unsigned char output); - - ACE_CE_Screen_Output& operator << (unsigned short output); - - ACE_CE_Screen_Output& operator << (int output); - ACE_CE_Screen_Output& operator << (unsigned int output); - - ACE_CE_Screen_Output& operator << (float output); - - ACE_CE_Screen_Output& operator << (long output); - ACE_CE_Screen_Output& operator << (unsigned long output); - - ACE_CE_Screen_Output& operator << (FILE* pFile); - -private: - - ACE_CE_Screen_Output (ACE_CE_Screen_Output&); - -private: - - HWND handler_; - - /// FILE pointer that used to save output to file. This class does - /// not own the file handler pointer. - FILE* pFile_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif // ACE_HAS_WINCE -#endif // ACE_CE_SCREEN_OUTPUT_H diff --git a/ace/CORBA_macros.h b/ace/CORBA_macros.h deleted file mode 100644 index 93f49ac0c30..00000000000 --- a/ace/CORBA_macros.h +++ /dev/null @@ -1,552 +0,0 @@ -// -*- C++ -*- - -// ============================================================================ -/** - * @file CORBA_macros.h - * - * $Id$ - * - * Writing code that is portable between platforms with or without - * native C++ exceptions is hard. The following macros offer some - * help on this task, mostly oriented to making the ORB code and the - * IDL generated code portable. - * - * @author Nanbor Wang - * @author Aniruddha Gokhale - * @author Carlos O'Ryan , et al. - */ -// ============================================================================ - -// Macros for handling CORBA exceptions. - -#ifndef ACE_CORBA_MACROS_H -#define ACE_CORBA_MACROS_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -# if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -# endif /* ACE_LACKS_PRAGMA_ONCE */ - -#define ACE_ENV_POLLUTE_NAMES - -#include "ace/Exception_Macros.h" - -// If you wish to you use these macros for emulating exceptions on -// platforms which lack native exception support, you need to do the -// following: -// 1. Define a class Exception. You can name it as you please. This class -// should be at the root of the inheritance hierarchy of all the -// exceptions used in your application. It should define at a minimum -// the following pure virtual methods: -// a) _downcast () - Which allows narrowing of the base exception type to a -// derived type. -// b) _raise() - Which throws an exception of type Exception. -// -// Classes which derive from these should implement these operations. -// -// 2. Define a class Environment. You can name it as you please. This class -// is an exception holder. This class is always on the stack. It should -// support at a minimum the following methods: -// a) exception() - Which returns the Exception held in the current -// Environment. -// b) exception (Exception* foo) - Which replaces/sets the Exception -// held in the current Environment with foo. -// b) clear() - Which resets a particular instance of Environment. -// c) A copy constructor and an assignment operator. -// -// Note that the above description assumes that you use the following -// macros only within a particular domain. For example, if your -// application has to interoperate across domains, then you need to define -// an exception adapter to translate exceptions from one domain to -// exceptions in the other. Please refer to Stroustrup's book on how to do -// this. If your use case is this complex, you would be better off with -// going with native exceptions rather than emulated exceptions, though -// the macros should still work if you defined your adapter class as -// ACE_EXCEPTION_TYPE. - - -// The following macros assume that an environment variable is passed -// in/out of each function that can throw an exception. The type of the -// environment variable is defined by ACE_ENV_TYPE. - -#if !defined (ACE_ENV_TYPE) -# define ACE_ENV_TYPE CORBA::Environment -#endif /* ACE_ENV_TYPE */ - -// The name of the variable is defined by ACE_TRY_ENV. Below is the name -// that we use by default. If you wish to change it you can redefine -// ACE_TRY_ENV to change the default name. Also ACE_ADOPT_ENV allows the -// use of non-standard name within a scope. - -#if !defined (ACE_TRY_ENV) -# define ACE_TRY_ENV _ACE_CORBA_Environment_variable -#endif /* ACE_TRY_ENV */ - -// The base type of Exception from which all the other exception types are -// derived. You can set this to any type as you please. By default, it is -// set to CORBA::Exception. - -#if !defined (ACE_EXCEPTION_TYPE) -# define ACE_EXCEPTION_TYPE CORBA::Exception -#endif /* ACE_EXCEPTION_TYPE */ - -// This method is used to get the default value of the Environment -// variable. In the case of TAO, this variable is part of the TSS ORB -// resources and the method TAO_default_environment() returns the -// Environment variable. - -#if !defined (ACE_DEFAULT_GET_ENV_METHOD) -# define ACE_DEFAULT_GET_ENV_METHOD TAO_default_environment -#endif /* ACE_DEFAULT_GET_ENV_METHOD */ - -// This is the exception caught by ACE_CATCHANY. -#if !defined (ACE_ANY_EXCEPTION) -# define ACE_ANY_EXCEPTION ex -#endif /* ACE_ANY_EXCEPTION */ - -// Declare a new environment variable on the stack. The type of the -// environment variable is determined by ACE_ENV_TYPE. -#if defined (ACE_USES_NATIVE_EXCEPTIONS) -// Don't instantiate an emulated exception environment at all when -// using native C++ exception support. It won't be used. -# define ACE_DECLARE_NEW_ENV -#else -# define ACE_DECLARE_NEW_ENV \ - ACE_ENV_TYPE ACE_TRY_ENV -#endif /* ACE_USES_NATIVE_EXCEPTIONS */ - -// Provided for backward compatibility purposes. Don't use it in new code. -// Use the definition above along with defining ACE_ENV_TYPE. - -#if defined (ACE_ENV_POLLUTE_NAMES) -# define ACE_DECLARE_NEW_CORBA_ENV ACE_DECLARE_NEW_ENV -#endif /* ACE_ENV_POLLUTE_NAMES */ - -#if defined (ACE_USES_NATIVE_EXCEPTIONS) -// ----------------------------------------------------------------- - -// Provided for backward compatibility purposes. Don't use it in new code. -#if defined (ACE_ENV_POLLUTE_NAMES) -# define ACE_ADOPT_CORBA_ENV(ENV) -#endif /* ACE_ENV_POLLUTE_NAMES */ - -#define ACE_ADOPT_ENV (ENV) - -// No need to check. Native exceptions handle the control flow -// automatically when an exception occurs. -# define ACE_CHECK - -// Used when the function requires a return value. -# define ACE_CHECK_RETURN(RETV) - -// ACE_THROW_INT should not be used by the user. -# define ACE_THROW_INT(EXCEPTION) \ - throw EXCEPTION - -// Throwing an exception is easy. These two macros should _NOT_ be -// used within try blocks. -# define ACE_THROW(EXCEPTION) \ - throw EXCEPTION - -// Throwing an exception when the function requires a return value. -# if defined (__HP_aCC) -# define ACE_THROW_RETURN(EXCEPTION, RETV) \ - do \ - { \ - throw EXCEPTION; \ - return RETV; \ - } while (0) -# else -# define ACE_THROW_RETURN(EXCEPTION,RETV) \ - throw EXCEPTION -# endif - -// For compilers with native exceptions, we can simply use try to try. ;-) -// do {} while (0) is required to avoid compilation warnings. -# define ACE_TRY \ - do \ - { \ - try \ - { -# define ACE_TRY_NEW_ENV \ - do \ - { \ - try \ - { -# define ACE_TRY_EX(LABEL) \ - do \ - { \ - try \ - { - -// No need to check for exceptions within try block for compilers with -// native exceptions. -# define ACE_TRY_CHECK -# define ACE_TRY_CHECK_EX(LABEL) - -// Likewise, throwing exceptions within try blocks is easy. -# define ACE_TRY_THROW(EXCEPTION) throw EXCEPTION -# define ACE_TRY_THROW_EX(EXCEPTION,LABEL) throw EXCEPTION - -// Same thing for catch. -# define ACE_CATCH(EXCEPTION,VAR) \ - } \ - catch (EXCEPTION & VAR) \ - { \ - ACE_UNUSED_ARG (VAR); - -# define ACE_CATCHANY \ - ACE_CATCH(ACE_EXCEPTION_TYPE, ACE_ANY_EXCEPTION) - -# define ACE_CATCHALL \ - } \ - catch (...) \ - { - -# if defined (ACE_HAS_DEPRECATED_ACE_RETHROW) -# define ACE_RETHROW throw -# endif /* ACE_HAS_DEPRECATED_ACE_RETHROW */ - -// Rethrowing the exception from catch blocks. -# define ACE_RE_THROW throw -# define ACE_RE_THROW_EX(LABEL) throw - -// Close the catch block. -# define ACE_ENDTRY \ - } \ - } while (0) - -#else /* ! ACE_USES_NATIVE_EXCEPTIONS */ -// ----------------------------------------------------------------- - -// When handling compilers without native exceptions, things get a bit -// hairy. Exceptions are simulated using ACE_ENV_TYPE. The trick here is to -// make sure the flow-of-control can simulate the case when native -// exceptions occur... - -#if defined (ACE_ENV_POLLUTE_NAMES) -# define ACE_ADOPT_CORBA_ENV(ENV) ACE_ENV_TYPE &ACE_TRY_ENV = ENV -#endif /* ACE_ENV_POLLUTE_NAMES */ - -# define ACE_ADOPT_ENV(ENV) ACE_ENV_TYPE &ACE_TRY_ENV = ENV - -// Follow every statement that could throw exceptions with ACE_CHECK or -// ACE_CHECK_RETURN. These two macros should _NOT_ be used within try -// blocks. Use ACE_TRY_CHECK or ACE_TRY_CHECK_EX instead. -# define ACE_CHECK \ - if (ACE_TRY_ENV . exception () != 0) \ - return -// When function requires a return value -# define ACE_CHECK_RETURN(RETV) \ - if (ACE_TRY_ENV . exception () != 0) \ - return RETV - -// ACE_THROW_INT should not be used by the user. -# define ACE_THROW_INT(EXCEPTION) ACE_TRY_ENV.exception (new EXCEPTION) - -// Throwing exceptions will inevitably cause a return from the current -// function. These two macros should _NOT_ be used within try blocks. Use -// ACE_TRY_THROW or ACE_TRY_THROW_EX instead. -# define ACE_THROW(EXCEPTION) \ - do \ - { \ - ACE_TRY_ENV.exception (new EXCEPTION); \ - return; \ - } while (0) - -# define ACE_THROW_RETURN(EXCEPTION,RETV) \ - do \ - { \ - ACE_TRY_ENV.exception (new EXCEPTION); \ - return RETV; \ - } while (0) - -// ACE_TRY sets up flags to control program flow. ACE_TRY_FLAG acts like a -// one-shot flip-flop. When an exception occurs (detected using -// ACE_TRY_CHECK,) ACE_TRY_FLAG will be reset and the control goes back -// into ACE_TRY_LABEL. Since ACE_TRY_FLAG is reset, the try block won't get -// executed again and the control proceeds to the following catch blocks. -// ACE_EXCEPTION_NOT_CAUGHT flag is used to prevent catching an exception -// twice. This macro assumes there's already an ACE_ENV_TYPE variable -// ACE_TRY_ENV defined (which should be the case normally) -# define ACE_TRY \ - do { \ - int ACE_TRY_FLAG = 1; \ - int ACE_EXCEPTION_NOT_CAUGHT = 1; \ - ACE_TRY_LABEL: \ - if (ACE_TRY_FLAG) \ - do { - -// ACE_TRY_NEW_ENV functions like the macro ACE_TRY but defines a new -// ACE_ENV_TYPE variable ACE_TRY_ENV. It is most often used in the outer -// most function where no ACE_TRY_ENV is available. -# define ACE_TRY_NEW_ENV \ - do { \ - ACE_DECLARE_NEW_ENV;\ - int ACE_TRY_FLAG = 1; \ - int ACE_EXCEPTION_NOT_CAUGHT = 1; \ - ACE_TRY_LABEL: \ - if (ACE_TRY_FLAG) \ - do { - -// ACE_TRY_EX works exactly like ACE_TRY macro except the label used in the -// try block is customizable to avoid name clashing. It should be used when -// nested try blocks or multiple try blocks are required, in the same -// function. -# define ACE_TRY_EX(LABEL) \ - do { \ - int ACE_TRY_FLAG = 1; \ - int ACE_EXCEPTION_NOT_CAUGHT = 1; \ - ACE_TRY_LABEL ## LABEL: \ - if (ACE_TRY_FLAG) \ - do { - -// Check for exceptions within try blocks. -# define ACE_TRY_CHECK \ - { \ - if (ACE_TRY_ENV.exception () != 0) \ - { \ - ACE_TRY_FLAG = 0; \ - goto ACE_TRY_LABEL; \ - } \ - } - -// Checking exception within EX try blocks. -# define ACE_TRY_CHECK_EX(LABEL) \ - { \ - if (ACE_TRY_ENV.exception () != 0) \ - { \ - ACE_TRY_FLAG = 0; \ - goto ACE_TRY_LABEL ## LABEL; \ - } \ - } - -// Throwing exception within TRY blocks. -# define ACE_TRY_THROW(EXCEPTION) \ - { \ - ACE_TRY_ENV.exception (new EXCEPTION); \ - ACE_TRY_FLAG = 0; \ - goto ACE_TRY_LABEL; \ - } - -# define ACE_TRY_THROW_EX(EXCEPTION,LABEL) \ - { \ - ACE_TRY_ENV.exception (new EXCEPTION); \ - ACE_TRY_FLAG = 0; \ - goto ACE_TRY_LABEL ## LABEL; \ - } - -// When exceptions occur or try block finishes execution without exception, -// control will continue in the catch block. This macro first checks if -// there's any uncaught exception left. If all the conditions are met, we -// have caught an exception. It then resets ACE_EXCEPTION_NOT_CAUGHT to -// prevent subsequent catch blocks from catching the same exception again, -// and extracts out the underlying exception in ACE_TRY_ENV. We also make a -// copy of ACE_TRY_ENV in ACE_CAUGHT_ENV, in case we want to rethrow the -// exception. ACE_TRY_ENV is cleared out after the exception is caught so -// you should not use ACE_TRY_ENV within the catch block(You should use the -// exception directly). -# define ACE_CATCH(TYPE,VAR) \ - } while (0); \ - do \ - if (ACE_TRY_ENV.exception () != 0 && ACE_EXCEPTION_NOT_CAUGHT && \ - TYPE::_downcast(ACE_TRY_ENV.exception ()) != 0) \ - { \ - ACE_ENV_TYPE ACE_CAUGHT_ENV = ACE_TRY_ENV;\ - ACE_EXCEPTION_NOT_CAUGHT = 0; \ - TYPE &VAR = *TYPE::_downcast (ACE_CAUGHT_ENV.exception ()); \ - ACE_UNUSED_ARG (VAR); \ - ACE_TRY_ENV.clear (); - -// ACE_CATCHANY uses ACE_CATCH to catch all exceptions derived from -// ACE_EXCEPTION_TYPE -# define ACE_CATCHANY ACE_CATCH (ACE_EXCEPTION_TYPE, ACE_ANY_EXCEPTION) - -// Since there's no other exception for compilers without exception -// support, we simply catch all ACE_EXCEPTION_TYPE exceptions for -// ACE_CATCHALL. -# define ACE_CATCHALL ACE_CATCHANY - -# if defined (ACE_HAS_DEPRECATED_ACE_RETHROW) -# define ACE_RETHROW \ - do \ - ACE_TRY_ENV = ACE_CAUGHT_ENV; \ - while (0) -# endif /* ACE_HAS_DEPRECATED_ACE_RETHROW */ - -// Rethrowing exception within catch blocks. Notice that we depend on the -// ACE_CHECK/ACE_CHECK_RETURN following the ACE_ENDTRY, or ACE_TRY_CHECK/ -// ACE_TRY_CHECK_EX following the ACE_ENDTRY when the catch block is within -// another try block, to do the "Right Thing[TM]." -# define ACE_RE_THROW \ - do {\ - ACE_TRY_ENV = ACE_CAUGHT_ENV; \ - goto ACE_TRY_LABEL; \ - } while (0) -# define ACE_RE_THROW_EX(LABEL) \ - do {\ - ACE_TRY_ENV = ACE_CAUGHT_ENV; \ - goto ACE_TRY_LABEL ## LABEL; \ - } while (0) - -// Close the try block. Since exceptions may not get caught, and exceptions -// can also be rethrown from the catch block, it's always a good idea to -// follow ACE_ENDTRY with ACE_CHECK or ACE_TRY_CHECK (depending on the -// context.) -# define ACE_ENDTRY \ - } while (0); \ - } while (0) - -#endif /* ! ACE_CORBA_HAS_EXCEPTIONS */ - -// ACE_HAS_EXCEPTIONS is not the same as ACE_NEW_THROWS_EXCEPTIONS. -#if defined(ACE_NEW_THROWS_EXCEPTIONS) - -# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; ACE_THROW_INT (EXCEPTION); } \ - } while (0) - -#else /* ! ACE_NEW_THROWS_EXCEPTIONS */ - -# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; ACE_THROW_INT (EXCEPTION); } \ - } while (0) - -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - -# define ACE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ - ACE_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) ACE_THROW_INT (EXCEPTION); - -# define ACE_READ_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ - ACE_Read_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) ACE_THROW_INT (EXCEPTION); - -# define ACE_WRITE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ - ACE_Write_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) ACE_THROW_INT (EXCEPTION); - -//@{ -/** - * @name Native C++ exceptions portability macros. - * - * The following macros are used to write code portable between platforms - * with and without native C++ exception support. Their main goal is to - * hide the presence of the ACE_ENV_TYPE argument, but they collaborate - * with the ACE_TRY_* macros to emulate the try/catch blocks. - */ - -/// Define a macro to emit code only when ACE_ENV_TYPE is used -#if !defined (ACE_USES_NATIVE_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT) -# define ACE_ENV_EMIT_CODE(X) X -#else -# define ACE_ENV_EMIT_CODE(X) -#endif /* ACE_USES_NATIVE_EXCEPTIONS && ! ACE_ENV_BKWD_COMPAT */ - -/// Another macro to emit code only when ACE_ENV_TYPE is used -#if !defined (ACE_USES_NATIVE_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT) -# define ACE_ENV_EMIT_CODE2(X,Y) X,Y -#else -# define ACE_ENV_EMIT_CODE2(X,Y) -#endif /* ACE_USES_NATIVE_EXCEPTIONS && ! ACE_ENV_BKWD_COMPAT */ - -/// Helper macro -#define ACE_ENV_EMIT_DUMMY - -/// Declare a ACE_ENV_TYPE argument as the last argument of a -/// function -/** - * Normally this macro is used as follows: - * - * void my_funct (int x, int y ACE_ENV_ARG_DECL); - * - * Its purpose is to provide developers (and users) with a mechanism to - * write code that is portable to platforms with and without native C++ - * exceptions. - */ -#define ACE_ENV_ARG_DECL \ - ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \ - ACE_ENV_TYPE &ACE_TRY_ENV) - -/// Declare a ACE_ENV_TYPE argument with the default value obtained from -/// the ORB/application. -/** - * It is similar to ACE_ENV_ARG_DECL. The name of the default environment - * getter method needs to be changed when switching ORBs or when used with - * another application. - */ -#define ACE_ENV_ARG_DECL_WITH_DEFAULTS \ - ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \ - ACE_ENV_TYPE &ACE_TRY_ENV = \ - ACE_DEFAULT_GET_ENV_METHOD ()) - -/// Declare a ACE_ENV_TYPE argument that is not used by the -/// function definition. -/** - * Similar to ACE_ENV_ARG_DECL, but the formal parameter name is dropped to - * avoid warnings about unused parameters - */ -#define ACE_ENV_ARG_DECL_NOT_USED \ - ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \ - ACE_ENV_TYPE &) - -/// Declare a ACE_ENV_TYPE argument for methods that do not take any other -/// parameters -#define ACE_ENV_SINGLE_ARG_DECL \ - ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &ACE_TRY_ENV) - -/// Declare a ACE_ENV_TYPE argument with a default value for methods that -/// do not take any other parameters. The name of the default environment -/// getter method needs to be changed when switching ORBs or when used in -/// another application. -#define ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS \ - ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &ACE_TRY_ENV = \ - ACE_DEFAULT_GET_ENV_METHOD ()) - -/// Declare a ACE_ENV_TYPE argument for methods which don't use it. -#define ACE_ENV_SINGLE_ARG_DECL_NOT_USED \ - ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &) - -/// Use the ACE_ENV_TYPE argument in a nested call -#define ACE_ENV_ARG_PARAMETER \ - ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \ - ACE_TRY_ENV) - -/// Use the ACE_ENV_TYPE argument in a nested call, assuming that the -/// called function takes only the ACE_TRY_ENV argument. -#define ACE_ENV_SINGLE_ARG_PARAMETER \ - ACE_ENV_EMIT_CODE(ACE_TRY_ENV) - -/// Eliminate unused argument warnings about ACE_TRY_ENV -#define ACE_ENV_ARG_NOT_USED \ - ACE_ENV_EMIT_CODE(ACE_UNUSED_ARG(ACE_TRY_ENV)) -//@} - -#if !defined (ACE_USES_NATIVE_EXCEPTIONS) -// This thing can be moved above when we drop ACE_ENV_BKWD_COMPAT. -# define ACE_ENV_RAISE(ex) ACE_TRY_ENV.exception (ex) -#else -# define ACE_ENV_RAISE(ex) (ex)->_raise () -#endif /* ACE_CORBA_HAS_EXCEPTIONS */ - -// ============================================================ - -// Print out a TAO exception. This is not CORBA compliant. -# define ACE_PRINT_TAO_EXCEPTION(EX,INFO) \ - EX._tao_print_exception (INFO) - -// Print out a CORBA exception. There is not portable way to -// dump a CORBA exception. If you are using other ORB implementation, -// redefine the macro to get what you want. -# if !defined ACE_PRINT_EXCEPTION -# define ACE_PRINT_EXCEPTION(EX,INFO) ACE_PRINT_TAO_EXCEPTION(EX,INFO) -# endif /* ACE_PRINT_EXCEPTION */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CORBA_MACROS_H */ diff --git a/ace/Cache_Map_Manager_T.cpp b/ace/Cache_Map_Manager_T.cpp deleted file mode 100644 index effa6f7d208..00000000000 --- a/ace/Cache_Map_Manager_T.cpp +++ /dev/null @@ -1,420 +0,0 @@ -// $Id$ - -#ifndef ACE_CACHE_MAP_MANAGER_T_CPP -#define ACE_CACHE_MAP_MANAGER_T_CPP - -#include "ace/Cache_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Log_Msg.h" -#include "ace/Malloc_Base.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Cache_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Manager) - -ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Iterator) - -ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Reverse_Iterator) - -#define ACE_T1 class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES -#define ACE_T2 KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES - -template -ACE_Cache_Map_Manager::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s, - size_t size, - ACE_Allocator *alloc) - : caching_strategy_ (caching_s) -{ - if (this->open (size, alloc) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Cache_Map_Manager::ACE_Cache_Map_Manager"))); - -} - -template -ACE_Cache_Map_Manager::~ACE_Cache_Map_Manager (void) -{ - this->close (); -} - -template int -ACE_Cache_Map_Manager::open (size_t length, - ACE_Allocator *alloc) -{ - return this->map_.open (length, - alloc); -} - -template int -ACE_Cache_Map_Manager::close (void) -{ - return this->map_.close (); -} - -template int -ACE_Cache_Map_Manager::bind (const KEY &key, - const VALUE &value) -{ - // Insert an entry which has the and the which - // is the combination of the and the attributes of the - // caching strategy. - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - int bind_result = this->map_.bind (key, - cache_value); - - if (bind_result != -1) - { - - int result = this->caching_strategy_.notify_bind (bind_result, - cache_value.second ()); - - if (result == -1) - { - - this->map_.unbind (key); - - // Unless the notification goes thru the bind operation is - // not complete. - bind_result = -1; - - } - - } - - return bind_result; -} - - -template int -ACE_Cache_Map_Manager::rebind (const KEY &key, - const VALUE &value) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - int rebind_result = this->map_.rebind (key, - cache_value); - - if (rebind_result != -1) - { - - int result = this->caching_strategy_.notify_rebind (rebind_result, - cache_value.second ()); - - if (result == -1) - { - - // Make sure the unbind operation is done only when the - // notification fails after a bind which is denoted by - // rebind_result = 0 - if (rebind_result == 0) - this->map_.unbind (key); - - // Unless the notification goes thru the rebind operation is - // not complete. - rebind_result = -1; - - } - - } - - return rebind_result; -} - - -template int -ACE_Cache_Map_Manager::rebind (const KEY &key, - const VALUE &value, - VALUE &old_value) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - CACHE_VALUE old_cache_value (old_value, - this->caching_strategy_.attributes ()); - - int rebind_result = this->map_.rebind (key, - cache_value, - old_cache_value); - - if (rebind_result != -1) - { - - int result = this->caching_strategy_.notify_rebind (rebind_result, - cache_value.second ()); - - if (result == -1) - { - - // Make sure the unbind operation is done only when the - // notification fails after a bind which is denoted by - // rebind_result = 0 - if (rebind_result == 0) - this->map_.unbind (key); - - // Unless the notification goes thru the rebind operation is - // not complete. - rebind_result = -1; - - } - else - { - - old_value = old_cache_value.first (); - - } - - } - - return rebind_result; -} - -template int -ACE_Cache_Map_Manager::rebind (const KEY &key, - const VALUE &value, - KEY &old_key, - VALUE &old_value) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - CACHE_VALUE old_cache_value (old_value, - this->caching_strategy_.attributes ()); - - int rebind_result = this->map_.rebind (key, - cache_value, - old_key, - old_cache_value); - - if (rebind_result != -1) - { - - int result = this->caching_strategy_.notify_rebind (rebind_result, - cache_value.second ()); - - if (result == -1) - { - - // Make sure the unbind operation is done only when the - // notification fails after a bind which is denoted by - // rebind_result = 0 - if (rebind_result == 0) - this->map_.unbind (key); - - // Unless the notification goes thru the rebind operation is - // not complete. - rebind_result = -1; - - } - else - { - - old_value = old_cache_value.first (); - - } - - } - - return rebind_result; -} - -template int -ACE_Cache_Map_Manager::trybind (const KEY &key, - VALUE &value) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - int trybind_result = this->map_.trybind (key, - cache_value); - - if (trybind_result != -1) - { - - int result = this->caching_strategy_.notify_trybind (trybind_result, - cache_value.second ()); - - if (result == -1) - { - - // If the entry has got inserted into the map, it is removed - // due to failure. - if (trybind_result == 0) - this->map_.unbind (key); - - trybind_result = -1; - - } - else - { - - // If an attempt is made to bind an existing entry the value - // is overwritten with the value from the map. - if (trybind_result == 1) - value = cache_value.first (); - - } - - } - - return trybind_result; -} - -template int -ACE_Cache_Map_Manager::find (const KEY &key, - VALUE &value) -{ - // Lookup the key and populate the . - CACHE_VALUE cache_value; - - int find_result = this->map_.find (key, - cache_value); - - if (find_result != -1) - { - - int result = this->caching_strategy_.notify_find (find_result, - cache_value.second ()); - - // Unless the find and notification operations go thru, this - // method is not successful. - if (result == -1) - find_result = -1; - else - { - - // Since the has now changed after the - // notification, we need to bind to the map again. - int rebind_result = this->map_.rebind (key, - cache_value); - if (rebind_result == -1) - find_result = -1; - else - value = cache_value.first (); - - } - - } - - return find_result; -} - -template int -ACE_Cache_Map_Manager::find (const KEY &key) -{ - // Lookup the key and populate the . - CACHE_VALUE cache_value; - - int find_result = this->map_.find (key, - cache_value); - - if (find_result != -1) - { - - int result = this->caching_strategy_.notify_find (find_result, - cache_value.second ()); - - // Unless the find and notification operations go thru, this - // method is not successful. - if (result == -1) - find_result = -1; - else - { - - // Since the has now changed after the - // notification, we need to bind to the map again. - int rebind_result = this->map_.rebind (key, - cache_value); - - if (rebind_result == -1) - find_result = -1; - - } - - } - - return find_result; -} - - -template int -ACE_Cache_Map_Manager::unbind (const KEY &key) -{ - // Remove the entry from the cache. - CACHE_VALUE cache_value; - - int unbind_result = this->map_.unbind (key, - cache_value); - - if (unbind_result != -1) - { - - int result = this->caching_strategy_.notify_unbind (unbind_result, - cache_value.second ()); - - if (result == -1) - unbind_result = -1; - - } - - return unbind_result; -} - -template int -ACE_Cache_Map_Manager::unbind (const KEY &key, - VALUE &value) -{ - // Remove the entry from the cache. - CACHE_VALUE cache_value; - - int unbind_result = this->map_.unbind (key, - cache_value); - - if (unbind_result != -1) - { - - int result = this->caching_strategy_.notify_unbind (unbind_result, - cache_value.second ()); - - if (result == -1) - unbind_result = -1; - else - value = cache_value.first (); - - } - - return unbind_result; -} - -template void -ACE_Cache_Map_Manager::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->map_.dump (); - - this->caching_strategy_.dump (); -#endif /* ACE_HAS_DUMP */ -} - -#undef ACE_T1 -#undef ACE_T2 - -template -ACE_Cache_Map_Iterator::~ACE_Cache_Map_Iterator (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CACHE_MAP_MANAGER_T_CPP */ diff --git a/ace/Cache_Map_Manager_T.h b/ace/Cache_Map_Manager_T.h deleted file mode 100644 index ad014e696e2..00000000000 --- a/ace/Cache_Map_Manager_T.h +++ /dev/null @@ -1,405 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Cache_Map_Manager_T.h - * - * $Id$ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef ACE_CACHE_MAP_MANAGER_T_H -#define ACE_CACHE_MAP_MANAGER_T_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Default_Constants.h" -#include "ace/Global_Macros.h" -#include "ace/Pair_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -class ACE_Allocator; - -#define ACE_Cache_Map_Iterator ACMI -#define ACE_Cache_Map_Reverse_Iterator ACMRI - -template -class ACE_Cache_Map_Iterator; - -template -class ACE_Cache_Map_Reverse_Iterator; - -// For linkers that cant grok long names. -#define ACE_Cache_Map_Manager ACMM - -/** - * @class ACE_Cache_Map_Manager - * - * @brief Defines a abstraction that will purge entries from a map. - * - * The will manage the map it contains - * and provide purging on demand from the map. The strategy for - * caching is decided by the user and provided to the Cache - * Manager. The Cache Manager acts as a agent and communicates - * between the Map and the Strategy for purging entries from the - * map. - * No locking mechanism provided since locking at this level - * isn't efficient. Locking has to be provided by the - * application. - */ -template -class ACE_Cache_Map_Manager -{ -public: - - // = Traits. - typedef KEY key_type; - typedef VALUE mapped_type; - typedef CMAP_TYPE map_type; - typedef CACHING_STRATEGY caching_strategy_type; - - typedef ITERATOR_IMPL ITERATOR_IMPLEMENTATION; - typedef REVERSE_ITERATOR_IMPL REVERSE_ITERATOR_IMPLEMENTATION; - - friend class ACE_Cache_Map_Iterator; - friend class ACE_Cache_Map_Reverse_Iterator; - - // = ACE-style iterator typedefs. - typedef ACE_Cache_Map_Iterator - ITERATOR; - typedef ACE_Cache_Map_Reverse_Iterator - REVERSE_ITERATOR; - - // = STL-style iterator typedefs. - typedef ITERATOR - iterator; - typedef REVERSE_ITERATOR - reverse_iterator; - - /** - * The actual value mapped to the key in the map. The - * are used by the strategy and is transparent to the user of this - * class. - */ - typedef ACE_Pair CACHE_VALUE; - - // = Initialization and termination methods. - - /// Initialize a with and - /// entries. - ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_strategy, - size_t size = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *alloc = 0); - - /// Close down a and release dynamically allocated - /// resources. - virtual ~ACE_Cache_Map_Manager (void); - - /// Initialize a cache with size . - int open (size_t length = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *alloc = 0); - - /// Close down a cache and release dynamically allocated resources. - int close (void); - - /** - * Associate with . If is already in the CMAP_TYPE - * then the ENTRY is not changed. Returns 0 if a new entry is bound - * successfully, returns 1 if an attempt is made to bind an existing - * entry, and returns -1 if failures occur. - */ - int bind (const KEY &key, - const VALUE &value); - - /** - * Lookup entry in the cache. If it is not found, returns -1. - * If the is located in the CMAP_TYPE object, the CACHING_STRATEGY is - * notified of it via notify_find (int result, ATTRIBUTES &attribute). - * If notify_find also returns 0 (success), then this function returns - * 0 (success) and sets the cached value in . - */ - int find (const KEY &key, - VALUE &value); - - /** - * Lookup entry in the cache. If it is not found, returns -1. - * If the is located in the CMAP_TYPE object, the CACHING_STRATEGY is - * notified of it via notify_find (int result, ATTRIBUTES &attribute). - * If notify_find also returns 0 (success), then this function returns - * 0 (success). - */ - int find (const KEY &key); - - /** - * Reassociate the with . If the already exists - * in the cache then returns 1, on a new bind returns 0 and returns - * -1 in case of any failures. - */ - int rebind (const KEY &key, - const VALUE &value); - - /** - * Reassociate with , storing the old value into the - * "out" parameter . The function fails if is not - * in the cache for caches that do not allow user specified keys. - * However, for caches that allow user specified keys, if the key is - * not in the cache, a new / association is created. - */ - int rebind (const KEY &key, - const VALUE &value, - VALUE &old_value); - - /** - * Reassociate with , storing the old key and value - * into the "out" parameters and . The - * function fails if is not in the cache for caches that do - * not allow user specified keys. However, for caches that allow - * user specified keys, if the key is not in the cache, a new - * / association is created. - */ - int rebind (const KEY &key, - const VALUE &value, - KEY &old_key, - VALUE &old_value); - - /** - * Associate with if and only if is not in the - * cache. If is already in the cache, then the - * parameter is overwritten with the existing value in the - * cache. Returns 0 if a new / association is created. - * Returns 1 if an attempt is made to bind an existing entry. This - * function fails for maps that do not allow user specified keys. - */ - int trybind (const KEY &key, - VALUE &value); - - /// Remove from the cache. - int unbind (const KEY &key); - - /// Remove from the cache, and return the associated with - /// . - int unbind (const KEY &key, - VALUE &value); - - /// Remove entries from the cache depending upon the strategy. - int purge (void); - - /// Return the current size of the cache. - size_t current_size (void) const; - - /// Return the total size of the cache. - size_t total_size (void) const; - - /// Dumps the state of the object. - void dump (void) const; - - // = STL styled iterator factory functions. - - /// Return forward iterator. - ITERATOR begin (void); - ITERATOR end (void); - - /// Return reverse iterator. - REVERSE_ITERATOR rbegin (void); - REVERSE_ITERATOR rend (void); - - /// The map managed by the Cache_Map_Manager. - CMAP_TYPE &map (void); - - /// The caching strategy used on the cache. - CACHING_STRATEGY &caching_strategy (void); - -protected: - - /// The underlying map which needs to be cached. - CMAP_TYPE map_; - - /// The strategy to be followed for caching entries in the map. - CACHING_STRATEGY &caching_strategy_; - -private: - - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Cache_Map_Manager &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Cache_Map_Manager (const ACE_Cache_Map_Manager &)) - -}; - -/** - * @class ACE_Cache_Map_Iterator - * - * @brief Defines a iterator for the Cache_Map_Manager. - * - * Implementation to be provided by the iterator of the map - * managed by the ACE_Cache_Map_Manager. - */ -template -class ACE_Cache_Map_Iterator -{ - -public: - - // = Traits. - /// The actual value mapped to the key in the cache. The - /// are used by the strategy and is transperant to the cache user. - typedef ACE_Reference_Pair - value_type; - typedef ACE_Pair - CACHE_VALUE; - - // = Initialisation and termination methods. - - ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl); - - /// Copy constructor. - ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator &rhs); - - virtual ~ACE_Cache_Map_Iterator (void); - - // = Iteration methods. - - /// assignment operator. - ACE_Cache_Map_Iterator &operator= - (const ACE_Cache_Map_Iterator &rhs); - - /// Comparision operators. - bool operator== (const ACE_Cache_Map_Iterator &rhs) const; - bool operator!= (const ACE_Cache_Map_Iterator &rhs) const; - - /// Returns a reference to the internal element is pointing - /// to. - ACE_Reference_Pair operator* (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance - ACE_Cache_Map_Iterator &operator++ (void); - - /// Postfix advance. - ACE_Cache_Map_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Cache_Map_Iterator &operator-- (void); - - /// Postfix reverse. - ACE_Cache_Map_Iterator operator-- (int); - - /// Returns the iterator of the internal map in the custody of the - /// Cache_Map_Manager. - IMPLEMENTATION &iterator_implementation (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// The actual iterator which iterates internally on the map - /// belonging to the Cache_Map_Manager. - IMPLEMENTATION iterator_implementation_; -}; - -/** - * @class ACE_Cache_Map_Reverse_Iterator - * - * @brief Defines a reverse iterator for the Cache_Map_Manager. - * - * Implementation to be provided by the reverse iterator of the map - * managed by thr Cache_Map_manager. - */ -template -class ACE_Cache_Map_Reverse_Iterator -{ -public: - - // = Traits. - /// The actual value mapped to the key in the cache. The - /// are used by the strategy and is transperant to the cache user. - typedef ACE_Reference_Pair value_type; - typedef ACE_Pair CACHE_VALUE; - - // = Initialisation and termination methods. - - ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl); - - /// Copy constructor. - ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator &rhs); - - ~ACE_Cache_Map_Reverse_Iterator (void); - - // = Iteration methods. - - /// Assignment operator. - ACE_Cache_Map_Reverse_Iterator &operator= - (const ACE_Cache_Map_Reverse_Iterator &rhs); - - /// Comparision operators. - bool operator== (const ACE_Cache_Map_Reverse_Iterator &rhs) const; - bool operator!= (const ACE_Cache_Map_Reverse_Iterator &rhs) const; - - /// Returns a reference to the internal element is pointing - /// to. - ACE_Reference_Pair operator* (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance - ACE_Cache_Map_Reverse_Iterator &operator++ (void); - - /// Postfix advance. - ACE_Cache_Map_Reverse_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Cache_Map_Reverse_Iterator &operator-- (void); - - /// Postfix reverse. - ACE_Cache_Map_Reverse_Iterator operator-- (int); - - /// Returns the iterator of the internal map in the custody of the - /// Cache_Map_Manager. - REVERSE_IMPLEMENTATION &iterator_implementation (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// The actual iterator which iterates internally on the map - /// belonging to the Cache_Map_Manager. - REVERSE_IMPLEMENTATION reverse_iterator_implementation_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Cache_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Cache_Map_Manager_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Cache_Map_Manager_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CACHE_MAP_MANAGER_T_H */ diff --git a/ace/Cache_Map_Manager_T.inl b/ace/Cache_Map_Manager_T.inl deleted file mode 100644 index ba30c528dd6..00000000000 --- a/ace/Cache_Map_Manager_T.inl +++ /dev/null @@ -1,245 +0,0 @@ -// -*- C++ -*- -// -//$Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Cache_Map_Manager::purge (void) -{ - return this->caching_strategy ().caching_utility ().clear_cache (this->map_, - this->caching_strategy ().purge_percent ()); -} - -template ACE_INLINE size_t -ACE_Cache_Map_Manager::current_size (void) const -{ - return this->map_.current_size (); -} - -template ACE_INLINE size_t -ACE_Cache_Map_Manager::total_size (void) const -{ - return this->map_.total_size (); -} - -template ACE_INLINE CMAP_TYPE & -ACE_Cache_Map_Manager::map (void) -{ - return this->map_; -} - -template ACE_INLINE CACHING_STRATEGY & -ACE_Cache_Map_Manager::caching_strategy (void) -{ - return this->caching_strategy_; -} - -template ACE_INLINE ACE_Cache_Map_Iterator -ACE_Cache_Map_Manager::begin (void) -{ - return ITERATOR (this->map_.begin ()); -} - -template ACE_INLINE ACE_Cache_Map_Iterator -ACE_Cache_Map_Manager::end (void) -{ - return ITERATOR (this->map_.end ()); -} - -template ACE_INLINE ACE_Cache_Map_Reverse_Iterator -ACE_Cache_Map_Manager::rbegin (void) -{ - return REVERSE_ITERATOR (this->map_.rbegin ()); -} -template ACE_INLINE ACE_Cache_Map_Reverse_Iterator -ACE_Cache_Map_Manager::rend (void) -{ - return REVERSE_ITERATOR (this->map_.rend ()); -} - -//////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE -ACE_Cache_Map_Iterator::ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator &rhs) - : iterator_implementation_ (rhs.iterator_implementation_) -{ -} - -template ACE_INLINE ACE_Cache_Map_Iterator & -ACE_Cache_Map_Iterator::operator= (const ACE_Cache_Map_Iterator &rhs) -{ - this->iterator_implementation_ = rhs.iterator_implementation_; - return *this; -} - -template ACE_INLINE bool -ACE_Cache_Map_Iterator::operator== (const ACE_Cache_Map_Iterator &rhs) const -{ - return this->iterator_implementation_ == rhs.iterator_implementation_; -} - -template ACE_INLINE bool -ACE_Cache_Map_Iterator::operator!= (const ACE_Cache_Map_Iterator &rhs) const -{ - return this->iterator_implementation_ != rhs.iterator_implementation_; -} - -template ACE_INLINE ACE_Reference_Pair -ACE_Cache_Map_Iterator::operator* (void) const -{ - value_type retn ((*this->iterator_implementation_).ext_id_, - (*this->iterator_implementation_).int_id_.first ()); - return retn; -} - -template ACE_INLINE -ACE_Cache_Map_Iterator & -ACE_Cache_Map_Iterator::operator++ (void) -{ - ++this->iterator_implementation_; - return *this; -} - -template ACE_INLINE -ACE_Cache_Map_Iterator -ACE_Cache_Map_Iterator::operator++ (int) -{ - ACE_Cache_Map_Iterator retn = *this; - ++this->iterator_implementation_; - return retn; -} - -template ACE_INLINE -ACE_Cache_Map_Iterator & -ACE_Cache_Map_Iterator::operator-- (void) -{ - --this->iterator_implementation_; - return *this; -} - -template ACE_INLINE -ACE_Cache_Map_Iterator -ACE_Cache_Map_Iterator::operator-- (int) -{ - ACE_Cache_Map_Iterator retn = *this; - --this->iterator_implementation_; - return retn; -} - -template ACE_INLINE void -ACE_Cache_Map_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->iterator_implementation_.dump (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Cache_Map_Iterator::ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl) - : iterator_implementation_ (iterator_impl) -{ -} - -template ACE_INLINE IMPLEMENTATION & -ACE_Cache_Map_Iterator::iterator_implementation (void) -{ - return this->iterator_implementation_; -} - -//////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator::ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator &rhs) - : reverse_iterator_implementation_ (rhs.reverse_iterator_implementation_) -{ -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator::~ACE_Cache_Map_Reverse_Iterator (void) -{ -} - -template ACE_INLINE ACE_Cache_Map_Reverse_Iterator & -ACE_Cache_Map_Reverse_Iterator::operator= (const ACE_Cache_Map_Reverse_Iterator &rhs) -{ - this->reverse_iterator_implementation_ = rhs.reverse_iterator_implementation_; - return *this; -} - -template ACE_INLINE bool -ACE_Cache_Map_Reverse_Iterator::operator== (const ACE_Cache_Map_Reverse_Iterator &rhs) const -{ - return this->reverse_iterator_implementation_ == rhs.reverse_iterator_implementation_; -} - -template ACE_INLINE bool -ACE_Cache_Map_Reverse_Iterator::operator!= (const ACE_Cache_Map_Reverse_Iterator &rhs) const -{ - return this->reverse_iterator_implementation_ != rhs.reverse_iterator_implementation_; -} - -template ACE_INLINE ACE_Reference_Pair -ACE_Cache_Map_Reverse_Iterator::operator* (void) const -{ - value_type retv ((*this->reverse_iterator_implementation_).ext_id_, - (*this->reverse_iterator_implementation_).int_id_.first ()); - return retv; -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator & -ACE_Cache_Map_Reverse_Iterator::operator++ (void) -{ - ++this->reverse_iterator_implementation_; - return *this; -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator -ACE_Cache_Map_Reverse_Iterator::operator++ (int) -{ - ACE_Cache_Map_Reverse_Iterator retn = *this; - ++this->reverse_iterator_implementation_; - return retn; -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator & -ACE_Cache_Map_Reverse_Iterator::operator-- (void) -{ - --this->reverse_iterator_implementation_; - return *this; -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator -ACE_Cache_Map_Reverse_Iterator::operator-- (int) -{ - ACE_Cache_Map_Reverse_Iterator retn = *this; - --this->reverse_iterator_implementation_; - return retn; -} - - -template ACE_INLINE void -ACE_Cache_Map_Reverse_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->reverse_iterator_implementation_.dump (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator::ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl) - : reverse_iterator_implementation_(iterator_impl) -{ -} - -template ACE_INLINE REVERSE_IMPLEMENTATION & -ACE_Cache_Map_Reverse_Iterator::iterator_implementation (void) -{ - return this->reverse_iterator_implementation_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Cached_Connect_Strategy_T.cpp b/ace/Cached_Connect_Strategy_T.cpp deleted file mode 100644 index 706142c640d..00000000000 --- a/ace/Cached_Connect_Strategy_T.cpp +++ /dev/null @@ -1,734 +0,0 @@ -//$Id$ - -#ifndef ACE_CACHED_CONNECT_STRATEGY_T_CPP -#define ACE_CACHED_CONNECT_STRATEGY_T_CPP - -#include "ace/Cached_Connect_Strategy_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/ACE.h" -#include "ace/Service_Repository.h" -#include "ace/Service_Types.h" -#include "ace/Thread_Manager.h" -#include "ace/WFMO_Reactor.h" -#include "ace/Pair_T.h" - -#define ACE_T1 class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX -#define ACE_T2 SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Cached_Connect_Strategy_Ex::ACE_Cached_Connect_Strategy_Ex -(CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy *cre_s, - ACE_Concurrency_Strategy *con_s, - ACE_Recycling_Strategy *rec_s, - MUTEX *lock, - int delete_lock) - : CCSBASE (cre_s, con_s, rec_s, lock, delete_lock), - connection_cache_ (caching_s) -{ - if (this->open (cre_s, con_s, rec_s) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Cached_Connect_Strategy_Ex\n"))); -} - -template -ACE_Cached_Connect_Strategy_Ex::~ACE_Cached_Connect_Strategy_Ex (void) -{ - cleanup (); -} - - -template int -ACE_Cached_Connect_Strategy_Ex::check_hint_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, ACE_Pair > *&entry, - int &found) -{ - ACE_UNUSED_ARG (remote_addr); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (local_addr); - ACE_UNUSED_ARG (reuse_addr); - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (perms); - - found = 0; - - // Get the recycling act for the svc_handler - CONNECTION_CACHE_ENTRY *possible_entry = (CONNECTION_CACHE_ENTRY *) sh->recycling_act (); - - // Check to see if the hint svc_handler has been closed down - if (possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED) - { - // If close, decrement refcount - if (possible_entry->ext_id_.decrement () == 0) - { - // If refcount goes to zero, close down the svc_handler - possible_entry->int_id_.first ()->recycler (0, 0); - possible_entry->int_id_.first ()->close (); - this->purge_i (possible_entry); - } - - // Hint not successful - found = 0; - - // Reset hint - sh = 0; - } - - // If hint is not closed, see if it is connected to the correct - // address and is recyclable - else if ((possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || - possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) && - possible_entry->ext_id_.subject () == remote_addr) - { - // Hint successful - found = 1; - - // Tell the that it should prepare itself for - // being recycled. - this->prepare_for_recycling (sh); - - // - // Update the caching attributes directly since we don't do a - // find() on the cache map. - // - - // Indicates successful find. - int find_result = 0; - - int result = this->caching_strategy ().notify_find (find_result, - possible_entry->int_id_.second ()); - - if (result == -1) - return result; - } - else - { - // This hint will not be used. - possible_entry->ext_id_.decrement (); - - // Hint not successful - found = 0; - - // If is not connected to the correct address or is busy, - // we will not use it. - sh = 0; - } - - if (found) - entry = possible_entry; - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::find_or_create_svc_handler_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, ACE_Pair > *&entry, - int &found) -{ - REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr); - - // Try to find the address in the cache. Only if we don't find it - // do we create a new and connect it with the server. - while (this->find (search_addr, entry) != -1) - { - // We found a cached svc_handler. - // Get the cached - sh = entry->int_id_.first (); - - // Is the connection clean? - int state_result = - ACE::handle_ready (sh->peer ().get_handle (), - &ACE_Time_Value::zero, - 1, // read ready - 0, // write ready - 1);// exception ready - - if (state_result == 1) - { - - if (sh->close () == -1) - return -1; - - sh = 0; - - // Cycle it once again.. - } - else if ((state_result == -1) && (errno == ETIME)) - { - // Found!!! - // Set the flag - found = 1; - - // Tell the that it should prepare itself for - // being recycled. - if (this->prepare_for_recycling (sh) == -1) - return -1; - - return 0; - } - else - { - return -1; - } - } - - // Not found... - - // Set the flag - found = 0; - - // We need to use a temporary variable here since we are not - // allowed to change because other threads may use this - // when we let go of the lock during the OS level connect. - // - // Note that making a new svc_handler, connecting remotely, - // binding to the map, and assigning of the hint and recycler - // should be atomic to the outside world. - SVC_HANDLER *potential_handler = 0; - - // Create a new svc_handler - if (this->make_svc_handler (potential_handler) == -1) - return -1; - - // Connect using the svc_handler. - if (this->cached_connect (potential_handler, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms) == -1) - { - // Close the svc handler. - potential_handler->close (0); - - return -1; - } - else - { - // Insert the new SVC_HANDLER instance into the cache. - if (this->connection_cache_.bind (search_addr, - potential_handler, - entry) == -1) - { - // Close the svc handler and reset . - potential_handler->close (0); - - return -1; - } - - // Everything succeeded as planned. Assign to - // . - sh = potential_handler; - - // Set the recycler and the recycling act - - this->assign_recycler (sh, this, entry); - } - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::cached_connect (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - // Actively establish the connection. This is a timed blocking - // connect. - if (this->new_connection (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms) == -1) - { - // If connect() failed because of timeouts, we have to reject - // the connection entirely. This is necessary since currently - // there is no way for the non-blocking connects to complete and - // for the to notify the cache of the completion of - // connect(). - - if (errno == EWOULDBLOCK || errno == ETIMEDOUT) - errno = ENOTSUP; - else if (ACE::out_of_handles (errno) || errno == EADDRINUSE) - { - // If the connect failed due to the process running out of - // file descriptors then, auto_purging of some connections - // are done from the CONNECTION_CACHE. This frees the - // descriptors which get used in the connect process and - // hence the same method is called again! - if (this->purge_connections () == -1) - return -1; - - // Try connecting again. - if (this->new_connection (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms) == -1) - { - if (errno == EWOULDBLOCK || errno == ETIMEDOUT) - errno = ENOTSUP; - return -1; - } - } - else - { - return -1; - } - } - - return 0; - -} - - -template int -ACE_Cached_Connect_Strategy_Ex::connect_svc_handler_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - int& found) -{ - CONNECTION_CACHE_ENTRY *entry = 0; - - // Check if the user passed a hint svc_handler - if (sh != 0) - { - int result = this->check_hint_i (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms, - entry, - found); - if (result != 0) - return result; - } - - // If not found - if (!found) - { - int result = this->find_or_create_svc_handler_i (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms, - entry, - found); - - if (result != 0) - return result; - - // Increment the refcount - entry->ext_id_.increment (); - } - - // For all successful cases: mark the in the cache - // as being . Therefore recyclable is BUSY. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY); - - return 0; -} - - -template int -ACE_Cached_Connect_Strategy_Ex::cache_i (const void *recycling_act) -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Mark the in the cache as not being . - // Therefore recyclable is IDLE. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_IDLE_AND_PURGABLE); - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::recycle_state_i (const void *recycling_act, - ACE_Recyclable_State new_state) -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Mark the in the cache as not being . - // Therefore recyclable is IDLE. - entry->ext_id_.recycle_state (new_state); - - return 0; -} - -template ACE_Recyclable_State -ACE_Cached_Connect_Strategy_Ex::recycle_state_i (const void *recycling_act) const -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Mark the in the cache as not being . - // Therefore recyclable is IDLE. - return entry->ext_id_.recycle_state (); -} - -template int -ACE_Cached_Connect_Strategy_Ex::purge_i (const void *recycling_act) -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - return this->connection_cache_.unbind (entry); -} - - -template int -ACE_Cached_Connect_Strategy_Ex::mark_as_closed_i (const void *recycling_act) -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Mark the in the cache as CLOSED. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_CLOSED); - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::cleanup_hint_i (const void *recycling_act, - void **act_holder) -{ - // Reset the <*act_holder> in the confines and protection of the - // lock. - if (act_holder) - *act_holder = 0; - - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Decrement the refcount on the . - int refcount = entry->ext_id_.decrement (); - - // If the svc_handler state is closed and the refcount == 0, call - // close() on svc_handler. - if (entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED && - refcount == 0) - { - entry->int_id_.first ()->recycler (0, 0); - entry->int_id_.first ()->close (); - this->purge_i (entry); - } - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::purge_connections (void) -{ - return this->connection_cache_.purge (); -} - -template CACHING_STRATEGY & -ACE_Cached_Connect_Strategy_Ex::caching_strategy (void) -{ - return this->connection_cache_.caching_strategy (); -} - -template int -ACE_Cached_Connect_Strategy_Ex::find (ACE_Refcounted_Hash_Recyclable &search_addr, - ACE_Hash_Map_Entry, ACE_Pair > *&entry) -{ - typedef ACE_Hash_Map_Bucket_Iterator, - ACE_Hash, - ACE_Equal_To, - ACE_Null_Mutex> - CONNECTION_CACHE_BUCKET_ITERATOR; - - CONNECTION_CACHE_BUCKET_ITERATOR iterator (this->connection_cache_.map (), - search_addr); - - CONNECTION_CACHE_BUCKET_ITERATOR end (this->connection_cache_.map (), - search_addr, - 1); - - for (; - iterator != end; - ++iterator) - { - REFCOUNTED_HASH_RECYCLABLE_ADDRESS &addr = (*iterator).ext_id_; - - if (addr.recycle_state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE && - addr.recycle_state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) - continue; - - if (addr.subject () != search_addr.subject ()) - continue; - - entry = &(*iterator); - - // - // Update the caching attributes directly since we don't do a - // find() on the cache map. - // - - // Indicates successful find. - int find_result = 0; - - int result = this->caching_strategy ().notify_find (find_result, - entry->int_id_.second ()); - - if (result == -1) - return result; - - return 0; - } - - return -1; -} - -template void -ACE_Cached_Connect_Strategy_Ex::cleanup (void) -{ - // Excluded other threads from changing the cache while we cleanup - ACE_GUARD (MUTEX, ace_mon, *this->lock_); - - // Close down all cached service handlers. - ACE_TYPENAME CONNECTION_CACHE::ITERATOR iter = - this->connection_cache_.begin (); - while (iter != this->connection_cache_.end ()) - { - if ((*iter).second () != 0) - { - // save entry for future use - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) - (*iter).second ()->recycling_act (); - - // close handler - (*iter).second ()->recycler (0, 0); - (*iter).second ()->close (); - - // remember next iter - ACE_TYPENAME CONNECTION_CACHE::ITERATOR next_iter = iter; - ++next_iter; - - // purge the item from the hash - this->purge_i (entry); - - // assign next iter - iter = next_iter; - } - else - ++iter; - } -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Cached_Connect_Strategy_Ex) -///////////////////////////////////////////////////////////////////////// - -template -ACE_Bounded_Cached_Connect_Strategy::ACE_Bounded_Cached_Connect_Strategy -(size_t max_size, - CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy *cre_s, - ACE_Concurrency_Strategy *con_s, - ACE_Recycling_Strategy *rec_s, - MUTEX *lock, - int delete_lock) - : CCSEBASE (caching_s, cre_s, con_s, rec_s, lock, delete_lock), - max_size_ (max_size) -{ -} - -template -ACE_Bounded_Cached_Connect_Strategy::~ACE_Bounded_Cached_Connect_Strategy(void) -{ -} - -template -int -ACE_Bounded_Cached_Connect_Strategy::find_or_create_svc_handler_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, - ACE_Pair > *&entry, - int &found) -{ - - REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr); - - // Try to find the address in the cache. Only if we don't find it - // do we create a new and connect it with the server. - while (this->find (search_addr, entry) != -1) - { - // We found a cached svc_handler. - // Get the cached - sh = entry->int_id_.first (); - - // Is the connection clean? - int state_result= ACE::handle_ready (sh->peer ().get_handle (), - &ACE_Time_Value::zero, - 1, // read ready - 0, // write ready - 1);// exception ready - - if (state_result == 1) - { - // The connection was disconnected during idle. - // close the svc_handler down. - if (sh->close () == -1) - { - ACE_ASSERT (0); - return -1; - } - sh = 0; - // and rotate once more... - } - else if ((state_result == -1) && (errno == ETIME)) - { - // Found!!! - // Set the flag - found = 1; - - // Tell the that it should prepare itself for - // being recycled. - if (this->prepare_for_recycling (sh) == -1) - { - ACE_ASSERT (0); - return -1; - } - - return 0; - } - else // some other return value or error... - { - ACE_ASSERT (0); // just to see it coming - - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("(%t)ACE_Bounded_Cached_Connect_Strategy<>::") - ACE_LIB_TEXT ("find_or_create_svc_handler_i - ") - ACE_LIB_TEXT ("error polling server socket state.\n"))); - - return -1; - } - } - - // Not found... - - // Set the flag - found = 0; - - // Check the limit of handlers... - if ((this->max_size_ > 0) && - (this->connection_cache_.current_size () >= this->max_size_)) - { - // Try to purge idle connections - if (this->purge_connections () == -1) - return -1; - - // Check limit again. - if (this->connection_cache_.current_size () >= this->max_size_) - // still too much! - return -1; - - // OK, we have room now... - } - - // We need to use a temporary variable here since we are not - // allowed to change because other threads may use this - // when we let go of the lock during the OS level connect. - // - // Note that making a new svc_handler, connecting remotely, - // binding to the map, and assigning of the hint and recycler - // should be atomic to the outside world. - SVC_HANDLER *potential_handler = 0; - - // Create a new svc_handler - if (this->make_svc_handler (potential_handler) == -1) - return -1; - - // Connect using the svc_handler. - if (this->cached_connect (potential_handler, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms) == -1) - { - // Close the svc handler. - potential_handler->close (0); - return -1; - } - else - { - // Insert the new SVC_HANDLER instance into the cache. - if (this->connection_cache_.bind (search_addr, - potential_handler, - entry) == -1) - { - // Close the svc handler and reset . - potential_handler->close (0); - - return -1; - } - - // Everything succeeded as planned. Assign to - // . - sh = potential_handler; - - // Set the recycler and the recycling act - this->assign_recycler (sh, this, entry); - } - - return 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Cached_Connect_Strategy) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#undef ACE_T1 -#undef ACE_T2 - -#endif /* ACE_CACHED_CONNECT_STRATEGY_T_CPP */ diff --git a/ace/Cached_Connect_Strategy_T.h b/ace/Cached_Connect_Strategy_T.h deleted file mode 100644 index 4d928e57f54..00000000000 --- a/ace/Cached_Connect_Strategy_T.h +++ /dev/null @@ -1,262 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Cached_Connect_Strategy_T.h - * - * $Id$ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef CACHED_CONNECT_STRATEGY_T_H -#define CACHED_CONNECT_STRATEGY_T_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Strategies_T.h" -#include "ace/Hash_Cache_Map_Manager_T.h" -#include "ace/Caching_Strategies_T.h" -#include "ace/Functor_T.h" -#include "ace/Pair_T.h" - -// For linkers which cant grok long names... -#define ACE_Cached_Connect_Strategy_Ex ACCSE - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Cached_Connect_Strategy_Ex - * - * @brief A connection strategy which caches connections to peers - * (represented by instances), thereby allowing - * subsequent re-use of unused, but available, connections. - * - * is intended to be used as a - * plug-in connection strategy for ACE_Strategy_Connector. - * It's added value is re-use of established connections and - * tweaking the role of the cache as per the caching strategy. - */ -template -class ACE_Cached_Connect_Strategy_Ex - : public ACE_Cached_Connect_Strategy -{ -public: - /// Constructor - ACE_Cached_Connect_Strategy_Ex ( - CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy *cre_s = 0, - ACE_Concurrency_Strategy *con_s = 0, - ACE_Recycling_Strategy *rec_s = 0, - MUTEX *lock = 0, - int delete_lock = 0); - - /// Destructor - virtual ~ACE_Cached_Connect_Strategy_Ex (void); - - /// Explicit purging of connection entries from the connection cache. - virtual int purge_connections (void); - - /// Mark as closed (non-locking version). This is used during the cleanup of the - /// connections purged. - virtual int mark_as_closed_i (const void *recycling_act); - - /** - * Since g++ version < 2.8 arent happy with templates, this special - * method had to be devised to avoid memory leaks and perform - * cleanup of the . - */ - void cleanup (void); - - // = Typedefs for managing the map - typedef ACE_Refcounted_Hash_Recyclable - REFCOUNTED_HASH_RECYCLABLE_ADDRESS; - typedef ACE_Hash_Cache_Map_Manager, - ACE_Equal_To, - CACHING_STRATEGY, - ATTRIBUTES> - CONNECTION_CACHE; - typedef ACE_TYPENAME CONNECTION_CACHE::CACHE_ENTRY CONNECTION_CACHE_ENTRY; - typedef ACE_TYPENAME CONNECTION_CACHE::key_type KEY; - typedef ACE_TYPENAME CONNECTION_CACHE::mapped_type VALUE; - - typedef ACE_Recyclable_Handler_Cleanup_Strategy, - ACE_Hash_Map_Manager_Ex, - ACE_Hash, - ACE_Equal_To, - MUTEX> > - CLEANUP_STRATEGY; - - typedef ACE_Cached_Connect_Strategy - CCSBASE; - - // = Accessor. - CACHING_STRATEGY &caching_strategy (void); - -protected: - - /// Find an idle handle. - int find (ACE_Refcounted_Hash_Recyclable &search_addr, - ACE_Hash_Map_Entry, ACE_Pair > *&entry); - - /// Remove from cache (non-locking version). - virtual int purge_i (const void *recycling_act); - - /// Add to cache (non-locking version). - virtual int cache_i (const void *recycling_act); - - /// Get/Set (non-locking version). - virtual int recycle_state_i (const void *recycling_act, - ACE_Recyclable_State new_state); - virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const; - - /// Cleanup hint and reset <*act_holder> to zero if . - virtual int cleanup_hint_i (const void *recycling_act, - void **act_holder); - - // = Helpers - int check_hint_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, ACE_Pair > *&entry, - int &found); - - virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, ACE_Pair > *&entry, - int &found); - - virtual int connect_svc_handler_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - int &found); - - /** - * Connection of the svc_handler with the remote host. This method - * also encapsulates the connection done with auto_purging under the - * hood. If the connect failed due to the process running out of - * file descriptors then, auto_purging of some connections are done - * from the CONNECTION_CACHE. This frees the descriptors which get - * used in the connect process and hence the connect operation can - * succeed. - */ - virtual int cached_connect (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /// Table that maintains the cache of connected s. - CONNECTION_CACHE connection_cache_; -}; - -///////////////////////////////////////////////////////////////////////////// - -// For linkers which cant grok long names... -#define ACE_Bounded_Cached_Connect_Strategy ABCCS - -/** - * @class ACE_Bounded_Cached_Connect_Strategy - * - * @brief A connection strategy which caches connections to peers - * (represented by instances), thereby allowing - * subsequent re-use of unused, but available, connections. - * This strategy should be used when the cache is bounded by - * maximum size. - * - * is intended to be used as a - * plug-in connection strategy for ACE_Strategy_Connector. - * It's added value is re-use of established connections and - * tweaking the role of the cache as per the caching strategy. - * Thanks to Edan Ayal for contributing this - * class and Susan Liebeskind for - * brainstorming about it. - */ -template -class ACE_Bounded_Cached_Connect_Strategy - : public ACE_Cached_Connect_Strategy_Ex -{ - - typedef ACE_Cached_Connect_Strategy_Ex - CCSEBASE; - - // = Typedefs for managing the map - typedef ACE_Refcounted_Hash_Recyclable - REFCOUNTED_HASH_RECYCLABLE_ADDRESS; - -public: - - /// Constructor - ACE_Bounded_Cached_Connect_Strategy (size_t max_size, - CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy *cre_s = 0, - ACE_Concurrency_Strategy *con_s = 0, - ACE_Recycling_Strategy *rec_s = 0, - MUTEX *lock = 0, - int delete_lock = 0); - - /// Destructor - virtual ~ACE_Bounded_Cached_Connect_Strategy (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, - ACE_Pair > *&entry, - int &found); - -protected: - - /// max items in the cache, used as a bound for the creation of svc_handlers. - size_t max_size_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Cached_Connect_Strategy_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Cached_Connect_Strategy_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* CACHED_CONNECT_STRATEGY_T_H */ diff --git a/ace/Caching_Strategies_T.cpp b/ace/Caching_Strategies_T.cpp deleted file mode 100644 index db2f9067ec9..00000000000 --- a/ace/Caching_Strategies_T.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//$Id$ - -#ifndef ACE_CACHING_STRATEGIES_T_CPP -#define ACECACHING_STRATEGIES_T_CPP - -#include "ace/Caching_Strategies_T.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Caching_Strategies_T.inl" -#endif /* __ACE_INLINE__ */ - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Caching_Strategy::~ACE_Caching_Strategy (void) -{ -} - -////////////////////////////////////////////////////////////////////////////////// - -template -ACE_LRU_Caching_Strategy::ACE_LRU_Caching_Strategy (void) - : timer_ (0), - purge_percent_ (10) -{ -} - -//////////////////////////////////////////////////////////////////////////////////////////////// - -template -ACE_LFU_Caching_Strategy::ACE_LFU_Caching_Strategy (void) - : purge_percent_ (10) -{ -} - -//////////////////////////////////////////////////////////////////////////////////////////////// - -template -ACE_FIFO_Caching_Strategy::ACE_FIFO_Caching_Strategy (void) - : order_ (0), - purge_percent_ (10) -{ -} - -//////////////////////////////////////////////////////////////////////////////////////////////// - -ACE_ALLOC_HOOK_DEFINE(ACE_LRU_Caching_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_LFU_Caching_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Caching_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_Null_Caching_Strategy) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CACHING_STRATEGIES_T_CPP */ diff --git a/ace/Caching_Strategies_T.h b/ace/Caching_Strategies_T.h deleted file mode 100644 index 74f7ff2b1fe..00000000000 --- a/ace/Caching_Strategies_T.h +++ /dev/null @@ -1,552 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Caching_Strategies_T.h - * - * $Id$ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef ACE_CACHING_STRATEGIES_H -#define ACE_CACHING_STRATEGIES_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" -#include "ace/Caching_Utility_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined(_MSC_VER) -#pragma warning(disable:4503) -#endif /* _MSC_VER */ - -// For linkers that cant grok long names. -#define ACE_Caching_Strategy ACS - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Caching_Strategy - * - * @brief This class is an abstract base class for a caching strategy. - * - * This class consists of all the interfaces a caching strategy should - * have and is used in association with the - * ACE_Caching_Strategy_Adaptor. - */ -template -class ACE_Caching_Strategy -{ -public: - /// Destructor. - virtual ~ACE_Caching_Strategy (void); - - /// Accessor method for the timer attributes. - virtual ATTRIBUTES attributes (void) = 0; - - /// Get the percentage of entries to purge. - virtual double purge_percent (void) = 0; - - /// Set the percentage of entries to purge. - virtual void purge_percent (double percentage) = 0; - - // = Strategy related Operations - - /// This method acts as a notification about the CONTAINERs bind - /// method call. - virtual int notify_bind (int result, - const ATTRIBUTES &attr) = 0; - - /// This method acts as a notification about the CONTAINERs find - /// method call - virtual int notify_find (int result, - ATTRIBUTES &attr) = 0; - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - virtual int notify_unbind (int result, - const ATTRIBUTES &attr) = 0; - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - virtual int notify_trybind (int result, - ATTRIBUTES &attr) = 0; - - /// This method acts as a notification about the CONTAINERs rebind - /// method call - virtual int notify_rebind (int result, - const ATTRIBUTES &attr) = 0; - - /// Purge the cache. - virtual CACHING_UTILITY &caching_utility (void) = 0; - - /// Dumps the state of the object. - virtual void dump (void) const = 0; -}; - -////////////////////////////////////////////////////////////////////////// - -#define ACE_Caching_Strategy_Adapter ACSA - -/** - * @class ACE_Caching_Strategy_Adapter - * - * @brief This class follows the Adaptor pattern and is used to provide - * External Polymorphism by deriving from ACE_Caching_Strategy. - * - * This class simply delegates all requests to the - * IMPLEMNETATION object within. This class should be passed in - * place of the the abstract base ACE_Caching_Strategy class as - * part of the External Polymorphism pattern. - */ -template -class ACE_Caching_Strategy_Adapter - : public ACE_Caching_Strategy -{ - -public: - - /// Constructor. - ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation = 0, - int delete_implementation = 0); - - /// Destructor. - ~ACE_Caching_Strategy_Adapter (void); - - /// Accessor method for the timer attributes. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// This method acts as a notification about the CONTAINERs bind - /// method call. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs find - /// method call - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs rebind - /// method call - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Accessor to the implementation. - IMPLEMENTATION &implementation (void); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// Implementation class. - IMPLEMENTATION *implementation_; - - /// Do we need to delete the implementation? - int delete_implementation_; -}; - -////////////////////////////////////////////////////////////////////////// -#define ACE_LRU_Caching_Strategy ALRU - -/** - * @class ACE_LRU_Caching_Strategy - * - * @brief Defines a Least Recently Used strategy which will decide on - * the item to be removed from the cache. - * - * This is a strategy which makes use of a virtual timer which - * is updated whenever an item is inserted or looked up in the - * container. When the need of purging entries arises, the items - * with the lowest timer values are removed. - * Explanation of the template parameter list: - * CONTAINER is any map with entries of type . - * The ATTRIBUTES are the deciding factor for purging of entries - * and should logically be included with the VALUE. Some ways of - * doing this are: As being a member of the VALUE or VALUE being - * ACE_Pair. The CACHING_UTILITY is the - * class which can be plugged in and which decides the entries - * to purge. - */ -template -class ACE_LRU_Caching_Strategy -{ -public: - - // Traits. - typedef ATTRIBUTES CACHING_ATTRIBUTES; - - // = Initialisation and termination. - - /** - * The is the map in which the entries reside. The - * timer attribute is initialed to zero in this constructor. And - * the field denotes the percentage of the entries - * in the cache which can be purged automagically and by default is - * set to 10%. - */ - ACE_LRU_Caching_Strategy (void); - - // = Operations of the strategy. - - /// Accessor method for the timer attributes. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// This method acts as a notification about the CONTAINERs bind - /// method call. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs find - /// method call - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs rebind - /// method call - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// This element is the one which is the deciding factor for purging - /// of an ITEM. - ATTRIBUTES timer_; - - /// The level about which the purging will happen automagically. - double purge_percent_; - - /// This is the helper class which will decide and expunge entries - /// from the cache. - CACHING_UTILITY caching_utility_; -}; - -////////////////////////////////////////////////////////////////////////// -#define ACE_LFU_Caching_Strategy ALFU - -/** - * @class ACE_LFU_Caching_Strategy - * - * @brief Defines a Least Frequently Used strategy for which will decide on - * the item to be removed from the cache. - * - * A attribute is tagged to each item which increments whenever - * the item is bound or looked up in the cache. Thus it denotes - * the frequency of use. According to the value of the attribute - * the item is removed from the CONTAINER i.e cache. - * Explanation of the template parameter list: - * CONTAINER is any map with entries of type . - * The ATTRIBUTES are the deciding factor for purging of entries - * and should logically be included with the VALUE. Some ways of - * doing this are: As being a member of the VALUE or VALUE being - * ACE_Pair. The CACHING_UTILITY is the - * class which can be plugged in and which decides the entries - * to purge. - */ -template -class ACE_LFU_Caching_Strategy -{ - -public: - - // Traits. - typedef ATTRIBUTES CACHING_ATTRIBUTES; - - // = Initialisation and termination methods. - - /** - * The is the map in which the entries reside. The - * timer attribute is initialed to zero in this constructor. And - * the field denotes the percentage of the entries - * in the cache which can be purged automagically and by default is - * set to 10%. - */ - ACE_LFU_Caching_Strategy (void); - - // = Strategy methods. - - /// Access the attributes. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// This method acts as a notification about the CONTAINERs bind - /// method call. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// Lookup notification. - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs rebind - /// method call - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// The level about which the purging will happen automagically. - double purge_percent_; - - /// This is the helper class which will decide and expunge entries - /// from the cache. - CACHING_UTILITY caching_utility_; -}; - -///////////////////////////////////////////////////////////// -#define ACE_FIFO_Caching_Strategy AFIFO - -/** - * @class ACE_FIFO_Caching_Strategy - * - * @brief The First In First Out strategy is implemented wherein each - * item is ordered. - * - * The order tag of each item is used to decide the item to be - * removed from the cache. The items with least order are removed. - * Explanation of the template parameter list: - * CONTAINER is any map with entries of type . - * The ATTRIBUTES are the deciding factor for purging of entries - * and should logically be included with the VALUE. Some ways of - * doing this are: As being a member of the VALUE or VALUE being - * ACE_Pair. The CACHING_UTILITY is the - * class which can be plugged in and which decides the entries - * to purge. - */ -template -class ACE_FIFO_Caching_Strategy -{ - -public: - - typedef ATTRIBUTES CACHING_ATTRIBUTES; - - // = Initialisation and termination. - - /** - * The is the map in which the entries reside. The - * timer attribute is initialed to zero in this constructor. And - * the field denotes the percentage of the entries - * in the cache which can be purged automagically and by default is - * set to 10%. - */ - ACE_FIFO_Caching_Strategy (void); - - // = Strategy methods. - - /// Accessor method. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// Notification for an item getting bound into the cache. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs find - /// method call - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// Notification for an item getting bound again into the cache. - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// The order is the deciding factor for the item to be removed from - /// the cache. - ATTRIBUTES order_; - - /// The level about which the purging will happen automagically. - double purge_percent_; - - /// This is the helper class which will decide and expunge entries - /// from the cache. - CACHING_UTILITY caching_utility_; -}; - -////////////////////////////////////////////////////////////////////// -#define ACE_Null_Caching_Strategy ANULL - -/** - * @class ACE_Null_Caching_Strategy - * - * @brief The is a special caching strategy which doesnt have the purging - * feature. - * - * No purging provided. To be used when purging might be too expensive - * an operation. - */ -template -class ACE_Null_Caching_Strategy -{ - -public: - - // = Traits. - typedef ATTRIBUTES CACHING_ATTRIBUTES; - - // = Strategy methods. All are NO_OP methods!!! - - /// Accessor method. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// Notification for an item getting bound into the cache. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs find - /// method call - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// Notification for an item getting bound again into the cache. - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// This is the helper class which will decide and expunge entries - /// from the cache. - CACHING_UTILITY caching_utility_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Caching_Strategies_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Caching_Strategies_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Caching_Strategies_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CACHING_STRATEGIES_H */ diff --git a/ace/Caching_Strategies_T.inl b/ace/Caching_Strategies_T.inl deleted file mode 100644 index cbe5f9c35ff..00000000000 --- a/ace/Caching_Strategies_T.inl +++ /dev/null @@ -1,465 +0,0 @@ -// -*-C++-*- -// -//$Id$ - -////////////////////////////////////////////////////////////////////////////////// - -#include "ace/OS_Memory.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Caching_Strategy_Adapter::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation, - int delete_implementation) - : implementation_ (implementation), - delete_implementation_ (delete_implementation) -{ - if (this->implementation_ == 0) - { - ACE_NEW (this->implementation_, - IMPLEMENTATION); - this->delete_implementation_ = 1; - } -} - -template ACE_INLINE -ACE_Caching_Strategy_Adapter::~ACE_Caching_Strategy_Adapter (void) -{ - if (this->delete_implementation_) - { - delete this->implementation_; - this->delete_implementation_ = 0; - this->implementation_ = 0; - } -} - -template ACE_INLINE ATTRIBUTES -ACE_Caching_Strategy_Adapter::attributes (void) -{ - return this->implementation_->attributes (); -} - -template ACE_INLINE double -ACE_Caching_Strategy_Adapter::purge_percent (void) -{ - return this->implementation_->purge_percent (); -} - -template ACE_INLINE void -ACE_Caching_Strategy_Adapter::purge_percent (double percentage) -{ - this->implementation_->purge_percent (percentage); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_bind (int result, - const ATTRIBUTES &attr) -{ - return this->implementation_->notify_bind (result, - attr); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_find (int result, - ATTRIBUTES &attr) -{ - return this->implementation_->notify_find (result, - attr); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_unbind (int result, - const ATTRIBUTES &attr) -{ - return this->implementation_->notify_unbind (result, - attr); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_trybind (int result, - ATTRIBUTES &attr) -{ - return this->implementation_->notify_trybind (result, - attr); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_rebind (int result, - const ATTRIBUTES &attr) -{ - return this->implementation_->notify_rebind (result, - attr); -} - -template ACE_INLINE IMPLEMENTATION & -ACE_Caching_Strategy_Adapter::implementation (void) -{ - return *this->implementation_; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_Caching_Strategy_Adapter::caching_utility (void) -{ - return this->implementation_->caching_utility (); -} - -template ACE_INLINE void -ACE_Caching_Strategy_Adapter::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Caching_Strategy_Adapter::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -////////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE ATTRIBUTES -ACE_LRU_Caching_Strategy::attributes (void) -{ - return this->timer_; -} - -template ACE_INLINE double -ACE_LRU_Caching_Strategy::purge_percent (void) -{ - return this->purge_percent_; -} - -template ACE_INLINE void -ACE_LRU_Caching_Strategy::purge_percent (double percentage) -{ - this->purge_percent_ = percentage; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_bind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - if (result == 0) - ++this->timer_; - - return result; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_find (int result, - ATTRIBUTES &attr) -{ - if (result == 0) - { - attr = this->timer_; - ++this->timer_; - } - - return result; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_unbind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - return result; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_trybind (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_rebind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - if (result == 0) - ++this->timer_; - - return result; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_LRU_Caching_Strategy::caching_utility (void) -{ - return this->caching_utility_; -} - -template ACE_INLINE void -ACE_LRU_Caching_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_LRU_Caching_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("timer_ = %d "), this->timer_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -////////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE ATTRIBUTES -ACE_LFU_Caching_Strategy::attributes (void) -{ - return 0; -} - -template ACE_INLINE double -ACE_LFU_Caching_Strategy::purge_percent (void) -{ - return this->purge_percent_; -} - -template ACE_INLINE void -ACE_LFU_Caching_Strategy::purge_percent (double percentage) -{ - this->purge_percent_ = percentage; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_bind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_find (int result, - ATTRIBUTES &attr) -{ - if (result == 0) - ++attr; - - return result; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_trybind (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_rebind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_unbind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_LFU_Caching_Strategy::caching_utility (void) -{ - return this->caching_utility_; -} - -template ACE_INLINE void -ACE_LFU_Caching_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_LFU_Caching_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -////////////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE ATTRIBUTES -ACE_FIFO_Caching_Strategy::attributes (void) -{ - return this->order_; -} - -template ACE_INLINE double -ACE_FIFO_Caching_Strategy::purge_percent (void) -{ - return this->purge_percent_; -} - -template ACE_INLINE void -ACE_FIFO_Caching_Strategy::purge_percent (double percentage) -{ - this->purge_percent_ = percentage; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_bind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - if (result == 0) - ++this->order_; - - return result; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_find (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_unbind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_trybind (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_rebind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - if (result == 0) - ++this->order_; - - return result; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_FIFO_Caching_Strategy::caching_utility (void) -{ - return this->caching_utility_; -} - -template ACE_INLINE void -ACE_FIFO_Caching_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("order_ = %d "), this->order_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -////////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE ATTRIBUTES -ACE_Null_Caching_Strategy::attributes (void) -{ - return 0; -} - -template ACE_INLINE double -ACE_Null_Caching_Strategy::purge_percent (void) -{ - return 0; -} - -template ACE_INLINE void -ACE_Null_Caching_Strategy::purge_percent (double percentage) -{ - ACE_UNUSED_ARG (percentage); -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_bind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_find (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_unbind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_trybind (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_rebind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_Null_Caching_Strategy::caching_utility (void) -{ - return this->caching_utility_; -} - -template ACE_INLINE void -ACE_Null_Caching_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Null_Caching_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -////////////////////////////////////////////////////////////////////////////////// diff --git a/ace/Caching_Utility_T.cpp b/ace/Caching_Utility_T.cpp deleted file mode 100644 index c8b7a48e807..00000000000 --- a/ace/Caching_Utility_T.cpp +++ /dev/null @@ -1,499 +0,0 @@ -// $Id$ - -#ifndef ACE_CACHING_UTILITY_T_CPP -#define ACE_CACHING_UTILITY_T_CPP - -#include "ace/Caching_Utility_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Min_Max.h" -#include "ace/OS_Memory.h" -#include "ace/Recyclable.h" - -////////////////////////////////////////////////////////////////////////////// - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Pair_Caching_Utility::ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - int delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = 1; - } -} - -template -ACE_Pair_Caching_Utility::~ACE_Pair_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Pair_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - // Check that the purge_percent is non-zero. - if (purge_percent == 0) - return 0; - - // Get the number of entries in the container. - size_t current_map_size = container.current_size (); - - // Also whether the number of entries in the cache! - // Oops! then there is no way out but exiting. So return an error. - if (current_map_size == 0) - return 0; - - // Calculate the no of entries to remove from the cache depending - // upon the . - size_t const entries_to_remove - = ACE_MAX (static_cast (1), - static_cast (static_cast (purge_percent) - / 100 * current_map_size)); - KEY *key_to_remove = 0; - VALUE *value_to_remove = 0; - - for (size_t i = 0; i < entries_to_remove ; ++i) - { - this->minimum (container, - key_to_remove, - value_to_remove); - - // Simply verifying that the key is non-zero. - // This is important for strategies where the minimum - // entry cant be found due to constraints on the type of entry - // to remove. - if (key_to_remove == 0) - return 0; - - if (this->cleanup_strategy_->cleanup (container, - key_to_remove, - value_to_remove) == -1) - return -1; - - } - - return 0; -} - -template void -ACE_Pair_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - // Starting values. - ITERATOR iter = container.begin (); - ITERATOR end = container.end (); - ATTRIBUTES min = (*iter).int_id_.second (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - - // The iterator moves thru the container searching for the entry - // with the lowest ATTRIBUTES. - for (++iter; - iter != end; - ++iter) - { - if (min > (*iter).int_id_.second ()) - { - // Ah! an item with lower ATTTRIBUTES... - min = (*iter).int_id_.second (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - } - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////// - -template -ACE_Recyclable_Handler_Caching_Utility::ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - int delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = 1; - } -} - -template -ACE_Recyclable_Handler_Caching_Utility::~ACE_Recyclable_Handler_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Recyclable_Handler_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - // Check that the purge_percent is non-zero. - if (purge_percent == 0) - return 0; - - // Get the number of entries in the container. - size_t current_map_size = container.current_size (); - - // Also whether the number of entries in the cache is just one! - // Oops! then there is no way out but exiting. So return an error. - // if (current_map_size <= 1) - if (current_map_size == 0) - return 0; - - // Calculate the no of entries to remove from the cache depending - // upon the . - size_t const entries_to_remove - = ACE_MAX (static_cast (1), - static_cast (static_cast (purge_percent) - / 100 * current_map_size)); - - KEY *key_to_remove = 0; - VALUE *value_to_remove = 0; - - for (size_t i = 0; i < entries_to_remove ; ++i) - { - this->minimum (container, - key_to_remove, - value_to_remove); - - // Simply verifying that the key is non-zero. - // This is important for strategies where the minimum - // entry cant be found due to constraints on the type of entry - // to remove. - if (key_to_remove == 0) - return 0; - - if (this->cleanup_strategy_->cleanup (container, - key_to_remove, - value_to_remove) == -1) - return -1; - } - - return 0; -} - -template void -ACE_Recyclable_Handler_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - // Starting values. - ITERATOR end = container.end (); - ITERATOR iter = container.begin (); - ATTRIBUTES min = (*iter).int_id_.second (); - key_to_remove = 0; - value_to_remove = 0; - // Found the minimum entry to be purged? - int found = 0; - - // The iterator moves thru the container searching for the entry - // with the lowest ATTRIBUTES. - for (; - iter != end; - ++iter) - { - // If the entry isnt IDLE_AND_PURGABLE continue until you reach - // the first entry which can be purged. This is the minimum with - // which you will compare the rest of the purgable entries. - if ((*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || - (*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE) - { - if (found == 0) - { - min = (*iter).int_id_.second (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - found = 1; - } - else - { - // Ah! an entry with lower ATTTRIBUTES... - if (min > (*iter).int_id_.second ()) - { - min = (*iter).int_id_.second (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - } - } - } - } -} - -//////////////////////////////////////////////////////////////////////////////// - -template -ACE_Refcounted_Recyclable_Handler_Caching_Utility::ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - int delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy), - marked_as_closed_entries_ (0) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = 1; - } -} - -template -ACE_Refcounted_Recyclable_Handler_Caching_Utility::~ACE_Refcounted_Recyclable_Handler_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Refcounted_Recyclable_Handler_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - // Check that the purge_percent is non-zero. - if (purge_percent == 0) - return 0; - - // Get the number of entries in the container which can be considered for purging. - size_t const available_entries = - container.current_size () - this->marked_as_closed_entries_; - - // Also whether the number of entries in the cache zero. - // Oops! then there is no way out but exiting. - if (available_entries <= 0) - return 0; - - // Calculate the no of entries to remove from the cache depending - // upon the . - size_t entries_to_remove - = ACE_MAX (static_cast (1), - static_cast (static_cast (purge_percent) - / 100 * available_entries)); - - if (entries_to_remove >= available_entries || entries_to_remove == 0) - entries_to_remove = available_entries - 1; - - KEY *key_to_remove = 0; - VALUE *value_to_remove = 0; - - for (size_t i = 0; i < entries_to_remove ; ++i) - { - this->minimum (container, - key_to_remove, - value_to_remove); - - // Simply verifying that the key is non-zero. - // This is important for strategies where the minimum - // entry cant be found due to constraints on the type of entry - // to remove. - if (key_to_remove == 0) - return 0; - - if (this->cleanup_strategy_->cleanup (container, - key_to_remove, - value_to_remove) == -1) - return -1; - - ++this->marked_as_closed_entries_; - } - - return 0; -} - -template void -ACE_Refcounted_Recyclable_Handler_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - // Starting values. - ITERATOR end = container.end (); - ITERATOR iter = container.begin (); - ATTRIBUTES min = (*iter).int_id_.second (); - key_to_remove = 0; - value_to_remove = 0; - // Found the minimum entry to be purged? - int found = 0; - - // The iterator moves thru the container searching for the entry - // with the lowest ATTRIBUTES. - for (; - iter != end; - ++iter) - { - // If the entry isnt IDLE_AND_PURGABLE continue until you reach - // the first entry which can be purged. This is the minimum with - // which you will compare the rest of the purgable entries. - if ((*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || - (*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE) - { - if (found == 0) - { - min = (*iter).int_id_.second (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - found = 1; - } - else - { - // Ah! an entry with lower ATTTRIBUTES... - if (min > (*iter).int_id_.second ()) - { - min = (*iter).int_id_.second (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - } - } - } - } -} - -//////////////////////////////////////////////////////////////////////////////// - -template -ACE_Handler_Caching_Utility::ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - int delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = 1; - } -} - -template -ACE_Handler_Caching_Utility::~ACE_Handler_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Handler_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - // Check that the purge_percent is non-zero. - if (purge_percent == 0) - return 0; - - // Get the number of entries in the container. - size_t current_map_size = container.current_size (); - - // Also whether the number of entries in the cache is just one! - // Oops! then there is no way out but exiting. So return an error. - if (current_map_size == 0) - return 0; - - // Calculate the no of entries to remove from the cache depending - // upon the . - size_t entries_to_remove - = ACE_MAX (static_cast (1), - static_cast (static_cast (purge_percent) - / 100 * current_map_size)); - - KEY *key_to_remove = 0; - VALUE *value_to_remove = 0; - - for (size_t i = 0; i < entries_to_remove ; ++i) - { - this->minimum (container, - key_to_remove, - value_to_remove); - - if (this->cleanup_strategy_->cleanup (container, - key_to_remove, - value_to_remove) == -1) - return -1; - } - - return 0; -} - -template void -ACE_Handler_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - // Starting values. - ITERATOR iter = container.begin (); - ITERATOR end = container.end (); - ATTRIBUTES min = (*iter).int_id_->caching_attributes (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - - // The iterator moves thru the container searching for the entry - // with the lowest ATTRIBUTES. - for (++iter; - iter != end; - ++iter) - { - if (min > (*iter).int_id_->caching_attributes () && - (*iter).int_id_->active () != 1) - { - // Ah! an item with lower ATTTRIBUTES... - min = (*iter).int_id_->caching_attributes (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - } - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////// - -template -ACE_Null_Caching_Utility::ACE_Null_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - int delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = 1; - } -} - -template -ACE_Null_Caching_Utility::~ACE_Null_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Null_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - ACE_UNUSED_ARG (container); - ACE_UNUSED_ARG (purge_percent); - - return 0; -} - -template void -ACE_Null_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - ACE_UNUSED_ARG (container); - ACE_UNUSED_ARG (key_to_remove); - ACE_UNUSED_ARG (value_to_remove); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CACHING_UTILITY_T_CPP */ diff --git a/ace/Caching_Utility_T.h b/ace/Caching_Utility_T.h deleted file mode 100644 index 0112e3f2b7d..00000000000 --- a/ace/Caching_Utility_T.h +++ /dev/null @@ -1,347 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Caching_Utility_T.h - * - * $Id$ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef ACE_CACHING_UTILITY_H -#define ACE_CACHING_UTILITY_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" -#include "ace/Cleanup_Strategies_T.h" - -// For linkers that cant grok long names. -#define ACE_Pair_Caching_Utility APUTIL - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Pair_Caching_Utility - * - * @brief Defines a helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: method which - * decides and purges the entry from the container. @note This - * class helps in the caching_strategies using a container - * containing entries of > - * kind. The attributes helps in deciding the entries to be - * purged. The Cleanup_Strategy is the callback class to which the - * entries to be cleaned up will be delegated. - */ -template -class ACE_Pair_Caching_Utility -{ -public: - - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY; - - /// Constructor. - ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - int delete_cleanup_strategy = 0); - - /// Destructor. - ~ACE_Pair_Caching_Utility (void); - - /** - * Purge entries from the . The Cleanup_Strategy will do the actual - * job of cleanup once the entries to be cleaned up are decided. - */ - int clear_cache (CONTAINER &container, - double purge_percent); - -protected: - - /// Find the entry with minimum caching attributes. - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// The cleanup strategy which can be used to destroy the entries of - /// the container. - CLEANUP_STRATEGY *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - int delete_cleanup_strategy_; - - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Pair_Caching_Utility &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Pair_Caching_Utility (const ACE_Pair_Caching_Utility &)) -}; - -//////////////////////////////////////////////////////////////////////////////// -#define ACE_Recyclable_Handler_Caching_Utility ARHUTIL - -/** - * @class ACE_Recyclable_Handler_Caching_Utility - * - * @brief Defines a helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: method which - * decides and purges the entry from the container. @note This - * class helps in the caching_strategies using a container - * containing entries of kind. The attributes - * helps in deciding the entries to be purged. The - * Cleanup_Strategy is the callback class to which the entries to - * be cleaned up will be delegated. - */ -template -class ACE_Recyclable_Handler_Caching_Utility -{ - -public: - - typedef ACE_Recyclable_Handler_Cleanup_Strategy CLEANUP_STRATEGY; - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; - - /// Constructor. - ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - int delete_cleanup_strategy = 0); - - /// Destructor. - ~ACE_Recyclable_Handler_Caching_Utility (void); - - /** - * Purge entries from the . The Cleanup_Strategy will do - * the actual job of cleanup once the entries to be cleaned up are - * decided. - */ - int clear_cache (CONTAINER &container, - double purge_percent); - -protected: - - /// Find the entry with minimum caching attributes. - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// This is the default Cleanup Strategy for this utility. - CLEANUP_STRATEGY_BASE *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - int delete_cleanup_strategy_; - -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Recyclable_Handler_Caching_Utility &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Recyclable_Handler_Caching_Utility (const ACE_Recyclable_Handler_Caching_Utility &)) -}; - -/////////////////////////////////////////////////////////////////////////// -#define ACE_Refcounted_Recyclable_Handler_Caching_Utility ARRHUTIL - -/** - * @class ACE_Refcounted_Recyclable_Handler_Caching_Utility - * - * @brief Defines a helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: clear_cache () method which - * decides and purges the entry from the container. @note This - * class helps in the caching_strategies using a container - * containing entries of kind. The attributes helps in - * deciding the entries to be purged. The Cleanup_Strategy is the - * callback class to which the entries to be cleaned up will be - * delegated. - */ -template -class ACE_Refcounted_Recyclable_Handler_Caching_Utility -{ - -public: - - typedef ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy CLEANUP_STRATEGY; - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; - - /// Constructor. - ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - int delete_cleanup_strategy = 0); - - /// Destructor. - ~ACE_Refcounted_Recyclable_Handler_Caching_Utility (void); - - /** - * Purge entries from the . The Cleanup_Strategy will do - * the actual job of cleanup once the entries to be cleaned up are - * decided. - */ - int clear_cache (CONTAINER &container, - double purge_percent); - -protected: - - /// Find the entry with minimum caching attributes. - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// This is the default Cleanup Strategy for this utility. - CLEANUP_STRATEGY_BASE *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - int delete_cleanup_strategy_; - - /** - * This figure denotes the number of entries are there in the - * container which have been marked as closed already but might - * not have been unbound from the container. - */ - size_t marked_as_closed_entries_; - -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Refcounted_Recyclable_Handler_Caching_Utility &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Refcounted_Recyclable_Handler_Caching_Utility (const ACE_Refcounted_Recyclable_Handler_Caching_Utility &)) -}; - -//////////////////////////////////////////////////////////////////////////////////////// - -/** - * @class ACE_Handler_Caching_Utility - * - * @brief Defines a helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: method which - * decides and purges the entry from the container. @note This - * class helps in the caching_strategies using a container - * containing entries of kind where the HANDLER - * contains the caching attributes which help in deciding the - * entries to be purged. The Cleanup_Strategy is the callback - * class to which the entries to be cleaned up will be delegated. - */ -template -class ACE_Handler_Caching_Utility -{ -public: - - typedef ACE_Handler_Cleanup_Strategy CLEANUP_STRATEGY; - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; - - /// Constructor. - ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - int delete_cleanup_strategy = 0); - - /// Destructor. - ~ACE_Handler_Caching_Utility (void); - - /** - * Purge entries from the . The Cleanup_Strategy will do - * the actual job of cleanup once the entries to be cleaned up are - * decided. - */ - int clear_cache (CONTAINER &container, - double purge_percent); - -protected: - - /** - * Find the entry with minimum caching attributes. This is handler - * specific since this utility is to be used very specifically for - * handler who have caching_attributes for server side acched - * connection management. - */ - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// The cleanup strategy which can be used to destroy the entries of - /// the container. - CLEANUP_STRATEGY_BASE *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - int delete_cleanup_strategy_; - -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Handler_Caching_Utility &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Handler_Caching_Utility (const ACE_Handler_Caching_Utility &)) -}; - -/////////////////////////////////////////////////////////////////////////// -#define ACE_Null_Caching_Utility ANUTIL -/** - * @class ACE_Null_Caching_Utility - * - * @brief Defines a dummy helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: method which - * decides and purges the entry from the container. @note This - * class is be used with the Null_Caching_Strategy. The - * Cleanup_Strategy is the callback class to which the entries to - * be cleaned up will be delegated. - */ -template -class ACE_Null_Caching_Utility -{ -public: - - typedef ACE_Null_Cleanup_Strategy CLEANUP_STRATEGY; - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; - - /// Constructor. - ACE_Null_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - int delete_cleanup_strategy = 0); - - /// Destructor. - ~ACE_Null_Caching_Utility (void); - - /** - * Purge entries from the . The Cleanup_Strategy will do - * the actual job of cleanup once the entries to be cleaned up are - * decided. @note Here it is a no-op. - */ - int clear_cache (CONTAINER &container, - double purge_percent); - -protected: - - /** - * Find the entry with minimum caching attributes. This is handler - * specific since this utility is to be used very specifically for - * handler who have caching_attributes for server side acched - * connection management.@note Here it is a no-op. - */ - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// The cleanup strategy which can be used to destroy the entries of - /// the container. - CLEANUP_STRATEGY_BASE *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - int delete_cleanup_strategy_; - -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Null_Caching_Utility &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Null_Caching_Utility (const ACE_Null_Caching_Utility &)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Caching_Utility_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Caching_Utility_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CACHING_UTILITY_H */ diff --git a/ace/Capabilities.cpp b/ace/Capabilities.cpp deleted file mode 100644 index 24a650ef1ff..00000000000 --- a/ace/Capabilities.cpp +++ /dev/null @@ -1,355 +0,0 @@ -#include "ace/Capabilities.h" -#include "ace/os_include/os_ctype.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Capabilities.inl" -#endif /* !__ACE_INLINE__ */ - -#include "ace/OS_NS_stdio.h" - -ACE_RCSID (ace, - Capabilities, - "$Id$") - - -#define ACE_ESC ((ACE_TCHAR)0x1b) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_CapEntry::~ACE_CapEntry (void) -{ -} - -ACE_Capabilities::ACE_Capabilities (void) - : caps_ () -{ -} - -ACE_Capabilities::~ACE_Capabilities (void) -{ - this->resetcaps (); -} - -const ACE_TCHAR * -ACE_Capabilities::parse (const ACE_TCHAR *buf, ACE_TString &cap) -{ - while (*buf != ACE_LIB_TEXT ('\0') && *buf != ACE_LIB_TEXT (',')) - { - if (*buf == ACE_LIB_TEXT ('\\')) - { - ++buf; - if (*buf == ACE_LIB_TEXT ('E') || *buf == ACE_LIB_TEXT ('e')) - { - cap += ACE_ESC; - ++buf; - continue; - } - else if (*buf == ACE_LIB_TEXT ('r')) - { - cap += ACE_LIB_TEXT ('\r'); - ++buf; - continue; - } - else if (*buf == ACE_LIB_TEXT ('n')) - { - cap += ACE_LIB_TEXT ('\n'); - ++buf; - continue; - } - else if (*buf == ACE_LIB_TEXT ('t')) - { - cap += ACE_LIB_TEXT ('\t'); - ++buf; - continue; - } - else if (*buf == ACE_LIB_TEXT ('\\')) - { - cap += *buf++; - continue; - } - if (isdigit(*buf)) - { - // @@ UNICODE Does this work with unicode? - int oc = 0; - for (int i = 0; - i < 3 && *buf && isdigit (*buf); - i++) - oc = oc * 8 + (*buf++ - ACE_LIB_TEXT ('0')); - - cap += (ACE_TCHAR) oc; - continue; - } - } - cap += *buf++; - } - return buf; -} - -const ACE_TCHAR * -ACE_Capabilities::parse (const ACE_TCHAR *buf, int &cap) -{ - int n = 0; - - while (*buf && isdigit (*buf)) - n = n * 10 + (*buf++ - ACE_LIB_TEXT ('0')); - - cap = n; - - return buf; -} - -void -ACE_Capabilities::resetcaps (void) -{ - for (CAPABILITIES_MAP::ITERATOR iter (this->caps_); - !iter.done (); - iter.advance ()) - { - CAPABILITIES_MAP::ENTRY *entry = 0; - iter.next (entry); - delete entry->int_id_; - } - - this->caps_.close (); - this->caps_.open (); -} - -int -ACE_Capabilities::fillent (const ACE_TCHAR *buf) -{ - this->resetcaps (); - while (*buf) - { - ACE_TString s; - int n; - ACE_TString name; - ACE_CapEntry *ce; - - // Skip blanks - while (*buf && isspace(*buf)) buf++; - // If we get end of line return - - if (*buf == ACE_LIB_TEXT ('\0')) - break; - - if (*buf == ACE_LIB_TEXT ('#')) - { - while (*buf && *buf != ACE_LIB_TEXT ('\n')) - buf++; - if (*buf == ACE_LIB_TEXT ('\n')) - buf++; - continue; - } - while(*buf && *buf != ACE_LIB_TEXT ('=') - && *buf!= ACE_LIB_TEXT ('#') - && *buf != ACE_LIB_TEXT (',')) - name += *buf++; - - // If name is null. - switch (*buf) - { - case ACE_LIB_TEXT ('='): - // String property - buf = this->parse (buf + 1, s); - ACE_NEW_RETURN (ce, - ACE_StringCapEntry (s), - -1); - if (this->caps_.bind (name, ce) == -1) - { - delete ce; - return -1; - } - break; - case ACE_LIB_TEXT ('#'): - // Integer property - buf = this->parse (buf + 1, n); - ACE_NEW_RETURN (ce, - ACE_IntCapEntry (n), - -1); - if (this->caps_.bind (name, ce) == -1) - { - delete ce; - return -1; - } - break; - case ACE_LIB_TEXT (','): - // Boolean - ACE_NEW_RETURN (ce, - ACE_BoolCapEntry (1), - -1); - if (this->caps_.bind (name, ce) == -1) - { - delete ce; - return -1; - } - break; - default: - return 0; - } - - if (*buf++ != ACE_LIB_TEXT (',')) - return -1; - } - - return 0; -} - -int -ACE_Capabilities::is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line) -{ - for (;;) - { - // Skip blanks or irrelevant characters - while (*line && isspace(*line)) - ++line; - - // End of line reached - if (*line == ACE_LIB_TEXT ('\0')) - break; - - // Build the entry name - ACE_TString nextname; - while (*line && *line != ACE_LIB_TEXT ('|') && *line != ACE_LIB_TEXT (',')) - nextname += *line++; - - // We have found the required entry? - if (ACE_OS::strcmp (nextname.c_str (), name) == 0) - return 1; - - // Skip puntuaction char if neccesary. - if (*line == ACE_LIB_TEXT ('|') || *line == ACE_LIB_TEXT (',')) - ++line; - else - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Invalid entry\n"))); - break; - } - } - return 0; -} - -int -ACE_Capabilities::getline (FILE *fp, ACE_TString &line) -{ - int ch; - - line.set (0, 0); - - while ((ch = fgetc (fp)) != EOF && ch != ACE_LIB_TEXT ('\n')) - line += (ACE_TCHAR) ch; - - if (ch == EOF && line.length () == 0) - return -1; - else - return 0; -} - -int -ACE_Capabilities::getval (const ACE_TCHAR *keyname, ACE_TString &val) -{ - ACE_CapEntry* cap = 0; - if (this->caps_.find (keyname, cap) == -1) - return -1; - - ACE_StringCapEntry *scap = - dynamic_cast (cap); - if (scap == 0) - return -1; - - val = scap->getval (); - return 0; -} - -int -ACE_Capabilities::getval (const ACE_TCHAR *keyname, int &val) -{ - ACE_CapEntry *cap = 0; - if (this->caps_.find (keyname, cap) == -1) - return -1; - - ACE_IntCapEntry *icap = - dynamic_cast (cap); - if (icap != 0) - { - val = icap->getval (); - return 0; - } - - ACE_BoolCapEntry *bcap = - dynamic_cast (cap); - - if (bcap == 0) - return -1; - - val = bcap->getval (); - return 0; -} - -#if !defined (ACE_IS_SPLITTING) -static int -is_empty (const ACE_TCHAR *line) -{ - while (*line && isspace (*line)) - ++line; - - return *line == ACE_LIB_TEXT ('\0') || *line == ACE_LIB_TEXT ('#'); -} - -static int -is_line (const ACE_TCHAR *line) -{ - while (*line && isspace (*line)) - ++line; - - return *line != ACE_LIB_TEXT ('\0'); -} -#endif /* !ACE_IS_SPLITTING */ - -int -ACE_Capabilities::getent (const ACE_TCHAR *fname, const ACE_TCHAR *name) -{ - FILE *fp = ACE_OS::fopen (fname, ACE_LIB_TEXT ("r")); - - if (fp == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("Can't open %s file\n"), - fname), - -1); - - int done; - ACE_TString line; - - while (0 == (done = (this->getline (fp, line) == -1)) - && is_empty (line.c_str ())) - continue; - - while (!done) - { - ACE_TString newline; - ACE_TString description; - - while (0 == (done = (this->getline (fp, newline) == -1))) - if (is_line (newline.c_str ())) - description += newline; - else - break; - - if (this->is_entry (name, line.c_str())) - { - ACE_OS::fclose (fp); - return this->fillent (description.c_str ()); - } - - line = newline; - while (!done && is_empty (line.c_str ())) - done = this->getline (fp, line) == -1; - } - - ACE_OS::fclose (fp); - return -1; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Capabilities.h b/ace/Capabilities.h deleted file mode 100644 index 609f3ddaa06..00000000000 --- a/ace/Capabilities.h +++ /dev/null @@ -1,216 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Capabilities.h - * - * $Id$ - * - * @author Arturo Montes - */ -//============================================================================= - - -#ifndef ACE_CAPABILITIES_H -#define ACE_CAPABILITIES_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Null_Mutex.h" -#include "ace/Hash_Map_Manager_T.h" -#include "ace/Containers.h" -#include "ace/SString.h" -#include "ace/Functor_String.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_CapEntry - * - * @brief This class is the base class for all ACE Capabilities entry - * subclasses. - * - * This class is not instantiable and does not provide accessors - * or methods. If you want to add a new kind of attribute subclass - * this class and dynamic_cast to proper subclass. - */ -class ACE_Export ACE_CapEntry -{ -public: - - virtual ~ACE_CapEntry (void); - -protected: - - enum - { - ACE_INTCAP = 0, - ACE_STRINGCAP = 1, - ACE_BOOLCAP = 2 - }; - - ACE_CapEntry (int captype); - -protected: - - int captype_; - -}; - -/** - * @class ACE_IntCapEntry - * - * @brief This class implement the ACE Integer Capability subclass. - * - * This is a container class for ACE Capabilities integer container - * values. - */ -class ACE_Export ACE_IntCapEntry : public ACE_CapEntry -{ -public: - ACE_IntCapEntry (int val); - int getval (void) const; - -protected: - int val_; -}; - -/** - * @class ACE_StringCapEntry - * - * @brief This class implement the ACE String Capability subclass. - * - * This is a container class for ACE Capabilities String container - * values. - */ -class ACE_Export ACE_StringCapEntry : public ACE_CapEntry -{ -public: - ACE_StringCapEntry (const ACE_TString &val); - ACE_TString getval (void) const; - -protected: - ACE_TString val_; -}; - -/** - * @class ACE_BoolCapEntry - * - * @brief This class implement the ACE Bool Capability subclass. - * - * This is a container class for ACE Capabilities bool container - * values. - */ -class ACE_Export ACE_BoolCapEntry : public ACE_CapEntry -{ -public: - ACE_BoolCapEntry (int val); - int getval (void) const; - -protected: - int val_; -}; - -/** - * @class ACE_Capabilities - * - * @brief This class implement the ACE Capabilities. - * - * This is a container class for ACE Capabilities - * values. Currently exist three different capability values: - * (integer), (bool) and - * (String). An ACE_Capabilities is a - * unordered set of pair = (, *). Where - * the first component is the name of capability and the second - * component is a pointer to the capability value container. A - * is a container for ACE_Capabilities, the - * ACE_Capabilities has a name in the file, as a termcap file. - */ -class ACE_Export ACE_Capabilities -{ -public: - - typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> CAPABILITIES_MAP; - - /// The Constructor - ACE_Capabilities (void); - - /// The Destructor - ~ACE_Capabilities(void); - -public: - - /// Get a string entry. - int getval (const ACE_TCHAR *ent, ACE_TString &val); - - /// Get an integer entry. - int getval (const ACE_TCHAR *ent, int &val); - - /// Get the ACE_Capabilities name from FILE fname and load the - /// associated capabitily entries in map. - int getent (const ACE_TCHAR *fname, const ACE_TCHAR *name); - -protected: - - /// Parse an integer property - const ACE_TCHAR *parse (const ACE_TCHAR *buf, int &cap); - - /// Parse a string property - const ACE_TCHAR *parse (const ACE_TCHAR *buf, ACE_TString &cap); - - /// Fill the ACE_Capabilities with description in ent. - int fillent(const ACE_TCHAR *ent); - - /// Parse a cap entry - int parseent (const ACE_TCHAR *name, ACE_TCHAR *line); - - /// Get a line from FILE input stream - int getline (FILE* fp, - ACE_TString &line); - - /// Is a valid entry - int is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line); - - /// Reset the set of capabilities - void resetcaps (void); - -private: - - /// This is the set of ACE_CapEntry. - CAPABILITIES_MAP caps_; - -}; - -#if defined (ACE_IS_SPLITTING) -int -is_empty (const ACE_TCHAR *line) -{ - while (*line && isspace (*line)) - ++line; - - return *line == ACE_LIB_TEXT ('\0') || *line == ACE_LIB_TEXT ('#'); -} - -int -is_line (const ACE_TCHAR *line) -{ - while (*line && isspace (*line)) - ++line; - - return *line != ACE_LIB_TEXT ('\0'); -} -#endif /* ACE_IS_SPLITTING */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Capabilities.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* __ACE_CAPABILITIES_H__ */ diff --git a/ace/Capabilities.inl b/ace/Capabilities.inl deleted file mode 100644 index 053e0ecf7b6..00000000000 --- a/ace/Capabilities.inl +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_CapEntry::ACE_CapEntry (int captype) - : captype_ (captype) -{ -} - -ACE_INLINE -ACE_IntCapEntry::ACE_IntCapEntry (int val) - : ACE_CapEntry (ACE_INTCAP), - val_ (val) -{ -} - -ACE_INLINE int -ACE_IntCapEntry::getval (void) const -{ - return val_; -} - -ACE_INLINE -ACE_StringCapEntry::ACE_StringCapEntry (const ACE_TString &val) - : ACE_CapEntry (ACE_STRINGCAP), - val_ (val) -{ -} - -ACE_INLINE ACE_TString -ACE_StringCapEntry::getval (void) const -{ - return val_; -} - -ACE_INLINE -ACE_BoolCapEntry::ACE_BoolCapEntry (int val) - : ACE_CapEntry (ACE_BOOLCAP), - val_(val) -{ -} - -ACE_INLINE int -ACE_BoolCapEntry::getval (void) const -{ - return val_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Cleanup.cpp b/ace/Cleanup.cpp deleted file mode 100644 index a6fc5de6a78..00000000000 --- a/ace/Cleanup.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// $Id$ - -#include "ace/Cleanup.h" - -ACE_RCSID (ace, - Cleanup, - "$Id$") - -#if !defined (ACE_HAS_INLINED_OSCALLS) -# include "ace/Cleanup.inl" -#endif /* ACE_HAS_INLINED_OSCALLS */ - -#include "ace/OS_Memory.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Cleanup::cleanup (void *) -{ - delete this; -} - - -ACE_Cleanup::~ACE_Cleanup (void) -{ -} - -/*****************************************************************************/ - -extern "C" void -ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *object, void *param) -{ - object->cleanup (param); -} - -/*****************************************************************************/ - -ACE_Cleanup_Info::ACE_Cleanup_Info (void) - : object_ (0), - cleanup_hook_ (0), - param_ (0) -{ -} - -bool -ACE_Cleanup_Info::operator== (const ACE_Cleanup_Info &o) const -{ - return o.object_ == this->object_ - && o.cleanup_hook_ == this->cleanup_hook_ - && o.param_ == this->param_; -} - -bool -ACE_Cleanup_Info::operator!= (const ACE_Cleanup_Info &o) const -{ - return !(*this == o); -} - -/*****************************************************************************/ - -/** - * @class ACE_Cleanup_Info_Node - * - * @brief For maintaining a list of ACE_Cleanup_Info items. - * - * For internal use by ACE_Object_Manager. - */ -class ACE_Cleanup_Info_Node -{ -public: - ACE_Cleanup_Info_Node (void); - ACE_Cleanup_Info_Node (const ACE_Cleanup_Info &new_info, - ACE_Cleanup_Info_Node *next); - ~ACE_Cleanup_Info_Node (void); - ACE_Cleanup_Info_Node *insert (const ACE_Cleanup_Info &); -private: - ACE_Cleanup_Info cleanup_info_; - ACE_Cleanup_Info_Node *next_; - - friend class ACE_OS_Exit_Info; -}; - -ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (void) - : cleanup_info_ (), - next_ (0) -{ -} - -ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (const ACE_Cleanup_Info &new_info, - ACE_Cleanup_Info_Node *next) - : cleanup_info_ (new_info), - next_ (next) -{ -} - -ACE_Cleanup_Info_Node::~ACE_Cleanup_Info_Node (void) -{ - delete next_; -} - -ACE_Cleanup_Info_Node * -ACE_Cleanup_Info_Node::insert (const ACE_Cleanup_Info &new_info) -{ - ACE_Cleanup_Info_Node *new_node = 0; - - ACE_NEW_RETURN (new_node, - ACE_Cleanup_Info_Node (new_info, this), - 0); - - return new_node; -} - -/*****************************************************************************/ - -ACE_OS_Exit_Info::ACE_OS_Exit_Info (void) -{ - ACE_NEW (registered_objects_, ACE_Cleanup_Info_Node); -} - -ACE_OS_Exit_Info::~ACE_OS_Exit_Info (void) -{ - delete registered_objects_; - registered_objects_ = 0; -} - -int -ACE_OS_Exit_Info::at_exit_i (void *object, - ACE_CLEANUP_FUNC cleanup_hook, - void *param) -{ - ACE_Cleanup_Info new_info; - new_info.object_ = object; - new_info.cleanup_hook_ = cleanup_hook; - new_info.param_ = param; - - // Return -1 and sets errno if unable to allocate storage. Enqueue - // at the head and dequeue from the head to get LIFO ordering. - - ACE_Cleanup_Info_Node *new_node = 0; - - if ((new_node = registered_objects_->insert (new_info)) == 0) - return -1; - else - { - registered_objects_ = new_node; - return 0; - } -} - -int -ACE_OS_Exit_Info::find (void *object) -{ - // Check for already in queue, and return 1 if so. - for (ACE_Cleanup_Info_Node *iter = registered_objects_; - iter && iter->next_ != 0; - iter = iter->next_) - { - if (iter->cleanup_info_.object_ == object) - { - // The object has already been registered. - return 1; - } - } - - return 0; -} - -void -ACE_OS_Exit_Info::call_hooks (void) -{ - // Call all registered cleanup hooks, in reverse order of - // registration. - for (ACE_Cleanup_Info_Node *iter = registered_objects_; - iter && iter->next_ != 0; - iter = iter->next_) - { - ACE_Cleanup_Info &info = iter->cleanup_info_; - if (info.cleanup_hook_ == reinterpret_cast ( - ACE_CLEANUP_DESTROYER_NAME)) - // The object is an ACE_Cleanup. - ACE_CLEANUP_DESTROYER_NAME ( - reinterpret_cast (info.object_), - info.param_); - else if (info.object_ == &ace_exit_hook_marker) - // The hook is an ACE_EXIT_HOOK. - (* reinterpret_cast (info.cleanup_hook_)) (); - else - (*info.cleanup_hook_) (info.object_, info.param_); - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Cleanup.h b/ace/Cleanup.h deleted file mode 100644 index bd1f9c2e23c..00000000000 --- a/ace/Cleanup.h +++ /dev/null @@ -1,137 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Cleanup.h - * - * $Id$ - * - * @author Douglas C. Schmidt - * @author Jesper S. M|ller - * @author and a cast of thousands... - * - * Originally in OS.h. - */ -//============================================================================= - -#ifndef ACE_CLEANUP_H -# define ACE_CLEANUP_H - -# include /**/ "ace/pre.h" - -# include "ace/config-lite.h" - -# if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -# endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/ACE_export.h" - -#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) -# include "ace/Global_Macros.h" -# define ACE_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_cleanup_destroyer) -#else -# define ACE_CLEANUP_DESTROYER_NAME ace_cleanup_destroyer -#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Cleanup - * - * @brief Base class for objects that are cleaned by ACE_Object_Manager. - */ -class ACE_Export ACE_Cleanup -{ -public: - /// No-op constructor. - ACE_Cleanup (void); - - /// Destructor. - virtual ~ACE_Cleanup (void); - - /// Cleanup method that, by default, simply deletes itself. - virtual void cleanup (void *param = 0); -}; - -// Adapter for cleanup, used by ACE_Object_Manager. -extern "C" ACE_Export -void ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *, void *param = 0); - -/** - * @class ACE_Cleanup_Info - * - * @brief Hold cleanup information for thread/process - */ -class ACE_Export ACE_Cleanup_Info -{ -public: - /// Default constructor. - ACE_Cleanup_Info (void); - - /// Equality operator. - bool operator== (const ACE_Cleanup_Info &o) const; - - /// Inequality operator. - bool operator!= (const ACE_Cleanup_Info &o) const; - - /// Point to object that gets passed into the . - void *object_; - - /// Cleanup hook that gets called back. - ACE_CLEANUP_FUNC cleanup_hook_; - - /// Parameter passed to the . - void *param_; -}; - -class ACE_Cleanup_Info_Node; - -/** - * @class ACE_OS_Exit_Info - * - * @brief Hold Object Manager cleanup (exit) information. - * - * For internal use by the ACE library, only. - */ -class ACE_Export ACE_OS_Exit_Info -{ -public: - /// Default constructor. - ACE_OS_Exit_Info (void); - - /// Destructor. - ~ACE_OS_Exit_Info (void); - - /// Use to register a cleanup hook. - int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param); - - /// Look for a registered cleanup hook object. Returns 1 if already - /// registered, 0 if not. - int find (void *object); - - /// Call all registered cleanup hooks, in reverse order of - /// registration. - void call_hooks (); - -private: - /** - * Keeps track of all registered objects. The last node is only - * used to terminate the list (it doesn't contain a valid - * ACE_Cleanup_Info). - */ - ACE_Cleanup_Info_Node *registered_objects_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_HAS_INLINED_OSCALLS) -# if defined (ACE_INLINE) -# undef ACE_INLINE -# endif /* ACE_INLINE */ -# define ACE_INLINE inline -# include "ace/Cleanup.inl" -# endif /* ACE_HAS_INLINED_OSCALLS */ - -# include /**/ "ace/post.h" -#endif /* ACE_CLEANUP_H */ diff --git a/ace/Cleanup.inl b/ace/Cleanup.inl deleted file mode 100644 index 02d3c223f8d..00000000000 --- a/ace/Cleanup.inl +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Cleanup::ACE_Cleanup (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Cleanup_Strategies_T.cpp b/ace/Cleanup_Strategies_T.cpp deleted file mode 100644 index 10804ba21ca..00000000000 --- a/ace/Cleanup_Strategies_T.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//$Id$ - -#ifndef ACE_CLEANUP_STRATEGIES_T_CPP -#define ACE_CLEANUP_STRATEGIES_T_CPP - -#include "ace/Cleanup_Strategies_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -//////////////////////////////////////////////////////////////////////////// - -template -ACE_Cleanup_Strategy::~ACE_Cleanup_Strategy (void) -{ -} - -template int -ACE_Cleanup_Strategy::cleanup (CONTAINER &container, - KEY *key, - VALUE *) -{ - return container.unbind (*key); -} - -//////////////////////////////////////////////////////////////////////////// - -template int -ACE_Recyclable_Handler_Cleanup_Strategy::cleanup ( - CONTAINER &container, - KEY *key, - VALUE *) -{ - VALUE value; - - if (container.unbind (*key, value) == -1) - return -1; - - value.first ()->recycler (0, 0); - - value.first ()->close (); - - return 0; -} - -///////////////////////////////////////////////////////////////////////////// - -template int -ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy::cleanup ( - CONTAINER &, - KEY *, - VALUE *value) -{ - return value->first ()->handle_close_i (); -} - -//////////////////////////////////////////////////////////////////////////// - -template int -ACE_Handler_Cleanup_Strategy::cleanup ( - CONTAINER &container, - KEY *key, - VALUE *value) -{ - // Remove the item from cache only if the handler isnt in use. - if ((*value)->active () == 0) - { - (*value)->close (); - - if (container.unbind (*key) == -1) - return -1; - - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////// - -template int -ACE_Null_Cleanup_Strategy::cleanup (CONTAINER &, - KEY *, - VALUE *) -{ - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CLEANUP_STRATEGIES_T_CPP */ diff --git a/ace/Cleanup_Strategies_T.h b/ace/Cleanup_Strategies_T.h deleted file mode 100644 index d31a812d70c..00000000000 --- a/ace/Cleanup_Strategies_T.h +++ /dev/null @@ -1,155 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Cleanup_Strategies_T.h - * - * $Id$ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - - -#ifndef CLEANUP_STRATEGIES_H -#define CLEANUP_STRATEGIES_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// For linkers that cant grok long names. -#define ACE_Cleanup_Strategy ACLE - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Cleanup_Strategy - * - * @brief Defines a default strategy to be followed for cleaning up - * entries from a map which is the container. - * - * By default the entry to be cleaned up is removed from the - * container. - */ -template -class ACE_Cleanup_Strategy -{ - -public: - - /// Destructor. - virtual ~ACE_Cleanup_Strategy (void); - - /// The method which will do the cleanup of the entry in the container. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -////////////////////////////////////////////////////////////////////// -#define ACE_Recyclable_Handler_Cleanup_Strategy ARHCLE - -/** - * @class ACE_Recyclable_Handler_Cleanup_Strategy - * - * @brief Defines a strategy to be followed for cleaning up - * entries which are svc_handlers from a container. - * - * The entry to be cleaned up is removed from the container. - * Here, since we are dealing with svc_handlers specifically, we - * perform a couple of extra operations. @note To be used when - * the handler is recyclable. - */ -template -class ACE_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy -{ - -public: - - /// The method which will do the cleanup of the entry in the container. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -////////////////////////////////////////////////////////////////////// -#define ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy ARRHCLE - -/** - * @class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy - * - * @brief Defines a strategy to be followed for cleaning up - * entries which are svc_handlers from a container. - * - * The entry to be cleaned up is removed from the container. - * Here, since we are dealing with recyclable svc_handlers with - * addresses which are refcountable specifically, we perform a - * couple of extra operations and do so without any locking. - */ -template -class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy -{ - -public: - - /// The method which will do the cleanup of the entry in the container. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -////////////////////////////////////////////////////////////////////// - -/** - * @class ACE_Handler_Cleanup_Strategy - * - * @brief Defines a strategy to be followed for cleaning up - * entries which are svc_handlers from a container. - * - * The entry to be cleaned up is removed from the container. - * Here, since we are dealing with svc_handlers specifically, we - * perform a couple of extra operations. @note This cleanup strategy - * should be used in the case when the handler has the caching - * attributes. - */ -template -class ACE_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy -{ - -public: - - /// The method which will do the cleanup of the entry in the container. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -////////////////////////////////////////////////////////////////////// -#define ACE_Null_Cleanup_Strategy ANCLE - -/** - * @class ACE_Null_Cleanup_Strategy - * - * @brief Defines a do-nothing implementation of the cleanup strategy. - * - * This class simply does nothing at all! Can be used to nullify - * the effect of the Cleanup Strategy. - */ -template -class ACE_Null_Cleanup_Strategy : public ACE_Cleanup_Strategy -{ - -public: - - /// The dummy cleanup method. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Cleanup_Strategies_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Cleanup_Strategies_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* CLEANUP_STRATEGIES_H */ diff --git a/ace/Codecs.cpp b/ace/Codecs.cpp deleted file mode 100644 index d28cda908d1..00000000000 --- a/ace/Codecs.cpp +++ /dev/null @@ -1,227 +0,0 @@ -#include "ace/Codecs.h" -#include "ace/Log_Msg.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_ctype.h" - -ACE_RCSID (ace, - Codecs, - "$Id$") - -namespace -{ - // Just in case ... -#undef alphabet -#undef pad -#undef max_columns - - // Symbols which form the Base64 alphabet (Defined as per RFC 2045) - ACE_Byte const alphabet[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - // The padding character used in the encoding - ACE_Byte const pad = '='; - - // Number of columns per line of encoded output (Can have a maximum - // value of 76). - int const max_columns = 72; -} - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -bool ACE_Base64::init_ = false; - -ACE_Byte ACE_Base64::decoder_[256]; - -ACE_Byte ACE_Base64::member_[256]; - -ACE_Byte* -ACE_Base64::encode (const ACE_Byte* input, - const size_t input_len, - size_t* output_len) -{ - if (!ACE_Base64::init_) - ACE_Base64::init(); - - if (!input) - return 0; - - ACE_Byte* result = 0; - - size_t length = ((input_len + 2) / 3) * 4; - size_t num_lines = length / max_columns + 1; - length += num_lines + 1; - ACE_NEW_RETURN (result, ACE_Byte[length], 0); - - int char_count = 0; - int bits = 0; - size_t pos = 0; - int cols = 0; - - for (size_t i = 0; i < input_len; ++i) - { - bits += input[i]; - char_count++; - - if (char_count == 3) - { - result[pos++] = alphabet[bits >> 18]; - result[pos++] = alphabet[(bits >> 12) & 0x3f]; - result[pos++] = alphabet[(bits >> 6) & 0x3f]; - result[pos++] = alphabet[bits & 0x3f]; - cols += 4; - if (cols == max_columns) { - result[pos++] = '\n'; - cols = 0; - } - bits = 0; - char_count = 0; - } - else - { - bits <<= 8; - } - } - - if (char_count != 0) - { - bits <<= (16 - (8 * char_count)); - result[pos++] = alphabet[bits >> 18]; - result[pos++] = alphabet[(bits >> 12) & 0x3f]; - if (char_count == 1) - { - result[pos++] = pad; - result[pos++] = pad; - } - else - { - result[pos++] = alphabet[(bits >> 6) & 0x3f]; - result[pos++] = pad; - } - if (cols > 0) - result[pos++] = '\n'; - } - result[pos] = 0; - *output_len = pos; - return result; -} - -size_t -ACE_Base64::length (const ACE_Byte* input) -{ - if (!ACE_Base64::init_) - ACE_Base64::init(); - - ACE_Byte* ptr = const_cast (input); - while (*ptr != 0 && - (member_[*(ptr)] == 1 || *ptr == pad - || ACE_OS::ace_isspace (*ptr))) - ptr++; - size_t len = ptr - input; - len = ((len + 3) / 4) * 3 + 1 ; - return len; -} - -ACE_Byte* -ACE_Base64::decode (const ACE_Byte* input, size_t* output_len) -{ - if (!ACE_Base64::init_) - ACE_Base64::init(); - - if (!input) - return 0; - - size_t result_len = ACE_Base64::length (input); - ACE_Byte* result = 0; - ACE_NEW_RETURN (result, ACE_Byte[result_len], 0); - - ACE_Byte* ptr = const_cast (input); - while (*ptr != 0 && - (member_[*(ptr)] == 1 || *ptr == pad - || ACE_OS::ace_isspace (*ptr))) - ptr++; - size_t input_len = ptr - input; - - int char_count = 0; - int bits = 0; - size_t pos = 0; - - size_t i = 0; - for (; i < input_len; ++i) - { - if (input[i] == pad) - break; - if (!ACE_Base64::member_[input[i]]) - continue; - bits += decoder_[input[i]]; - char_count++; - - if (char_count == 4) - { - result[pos++] = static_cast (bits >> 16); - result[pos++] = static_cast ((bits >> 8) & 0xff); - result[pos++] = static_cast (bits & 0xff); - bits = 0; - char_count = 0; - } - else - { - bits <<= 6; - } - } - - int errors = 0; - if ( i == input_len) - { - if (char_count) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Decoding incomplete: atleast %d bits truncated\n"), - (4 - char_count) * 6)); - errors++; - } - } - else - { - switch (char_count) - { - case 1: - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Decoding incomplete: atleast 2 bits missing\n"))); - errors++; - break; - case 2: - result[pos++] = static_cast (bits >> 10); - break; - case 3: - result[pos++] = static_cast (bits >> 16); - result[pos++] = static_cast ((bits >> 8) & 0xff); - break; - } - } - - if (errors) - { - delete[] result; - return 0; - } - result[pos] = 0; - *output_len = pos; - return result; -} - -void -ACE_Base64::init () -{ - if (!ACE_Base64::init_) - { - for (ACE_Byte i = 0; i < sizeof (alphabet); ++i) - { - ACE_Base64::decoder_[alphabet[i]] = i; - ACE_Base64::member_ [alphabet[i]] = 1; - } - ACE_Base64::init_ = true; - } - return; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Codecs.h b/ace/Codecs.h deleted file mode 100644 index 3159a312c95..00000000000 --- a/ace/Codecs.h +++ /dev/null @@ -1,119 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Codecs.h - * - * $Id$ - * - * @author Krishnakumar B - * - * Codecs is a generic wrapper for various encoding and decoding - * mechanisms. Currently it includes Base64 content transfer-encoding as - * specified by RFC 2045, Multipurpose Internet Mail Extensions (MIME) Part - * One: Format of Internet Message Bodies. - * - */ -//============================================================================= - -#ifndef ACE_CODECS_H -#define ACE_CODECS_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Basic_Types.h" -#include "ace/Global_Macros.h" - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Base64 - * - * @brief Encode/Decode a stream of bytes according to Base64 encoding. - * - * This class provides methods to encode or decode a stream of bytes - * to/from Base64 encoding. It doesn't convert the input stream to a - * canonical form before encoding. - * - */ -class ACE_Export ACE_Base64 -{ -public: - - //@{ - - /** - * Encodes a stream of bytes to Base64 data - * - * @param input Binary data in byte stream. - * @param input_len Length of the byte stream. - * @param output_len Length of the encoded Base64 byte stream. - * @return Encoded Base64 data in byte stream or NULL if input data cannot - * be encoded. - */ - - static ACE_Byte* encode (const ACE_Byte* input, - const size_t input_len, - size_t* output_len); - /** - * Decodes a stream of Base64 to bytes data - * - * @param input Encoded Base64 data in byte stream. - * @param output_len Length of the binary byte stream. - * @return Binary data in byte stream or NULL if input data cannot - * be encoded. - */ - static ACE_Byte* decode (const ACE_Byte* input, - size_t* output_len); - - /** - * Return the length of the encoded input data - * - * @param input Encoded Base64 data in byte stream. - * @return Length of the encoded Base64 data. - * - */ - static size_t length (const ACE_Byte* input); - - //@} - -protected: - - // Prevent default construction. - ACE_Base64 (void) {} - -private: - - // Preventing copying and assignment. - ACE_Base64 (ACE_Base64 const &); - ACE_Base64 & operator= (ACE_Base64 const &); - - /// Initialize the tables for encoding/decoding. - static void init (void); - -private: - - /// Alphabet used for decoding i.e decoder_[alphabet_[i = 0..63]] = i - static ACE_Byte decoder_[]; - - /// Alphabet used to check valid range of encoded input i.e - /// member_[alphabet_[0..63]] = 1 - static ACE_Byte member_[]; - - /// Boolean to denote whether initialization is complete - static bool init_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_CODECS_H */ diff --git a/ace/Codeset_IBM1047.cpp b/ace/Codeset_IBM1047.cpp deleted file mode 100644 index 469c15089c4..00000000000 --- a/ace/Codeset_IBM1047.cpp +++ /dev/null @@ -1,317 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Codeset_IBM1047.cpp -// -// = DESCRIPTION -// Defines the arrays required to convert between ISO8859 (aka -// Latin/1) and IBM1047 (aka EBCDIC). -// -// = AUTHOR -// Jim Rogers (jrogers@viasoft.com) -// -// ============================================================================ - -#include "ace/Codeset_IBM1047.h" - -#if defined(ACE_MVS) - -ACE_RCSID (ace, - Codeset_IBM1047, - "$Id$") - -// **************************************************************** - -namespace -{ - char const to_IBM1047[] = - { - "\x00\x01\x02\x03\x37\x2D\x2E\x2F\x16\x05\x25\x0B\x0C\x0D\x0E\x0F" // 00-0F - "\x10\x11\x12\x13\x3C\x3D\x32\x26\x18\x19\x3F\x27\x22\x1D\x35\x1F" // 10-1F - "\x40\x5A\x7F\x7B\x5B\x6C\x50\x7D\x4D\x5D\x5C\x4E\x6B\x60\x4B\x61" // 20-2F - "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\x7A\x5E\x4C\x7E\x6E\x6F" // 30-3F - "\x7C\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xD1\xD2\xD3\xD4\xD5\xD6" // 40-4F - "\xD7\xD8\xD9\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xAD\xE0\xBD\x5F\x6D" // 50-5F - "\x79\x81\x82\x83\x84\x85\x86\x87\x88\x89\x91\x92\x93\x94\x95\x96" // 60-6F - "\x97\x98\x99\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xC0\x4F\xD0\xA1\x07" // 70-7F - "\x43\x20\x21\x1C\x23\xEB\x24\x9B\x71\x28\x38\x49\x90\xBA\xEC\xDF" // 80-8F - "\x45\x29\x2A\x9D\x72\x2B\x8A\x9A\x67\x56\x64\x4A\x53\x68\x59\x46" // 90-9F - "\xEA\xDA\x2C\xDE\x8B\x55\x41\xFE\x58\x51\x52\x48\x69\xDB\x8E\x8D" // A0-AF - "\x73\x74\x75\xFA\x15\xB0\xB1\xB3\xB4\xB5\x6A\xB7\xB8\xB9\xCC\xBC" // B0-BF - "\xAB\x3E\x3B\x0A\xBF\x8F\x3A\x14\xA0\x17\xCB\xCA\x1A\x1B\x9C\x04" // C0-CF - "\x34\xEF\x1E\x06\x08\x09\x77\x70\xBE\xBB\xAC\x54\x63\x65\x66\x62" // D0-DF - "\x30\x42\x47\x57\xEE\x33\xB6\xE1\xCD\xED\x36\x44\xCE\xCF\x31\xAA" // E0-EF - "\xFC\x9E\xAE\x8C\xDD\xDC\x39\xFB\x80\xAF\xFD\x78\x76\xB2\x9F\xFF" // F0-FF -}; - - char const from_IBM1047[] = - { - "\x00\x01\x02\x03\xCF\x09\xD3\x7F\xD4\xD5\xC3\x0B\x0C\x0D\x0E\x0F" // 00-0F - "\x10\x11\x12\x13\xC7\xB4\x08\xC9\x18\x19\xCC\xCD\x83\x1D\xD2\x1F" // 10-1F - "\x81\x82\x1C\x84\x86\x0A\x17\x1B\x89\x91\x92\x95\xA2\x05\x06\x07" // 20-2F - "\x20\xEE\x16\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xC1\x1A" // 30-3F - "\x20\xA6\xE1\x80\xEB\x90\x9F\xE2\xAB\x8B\x9B\x2E\x3C\x28\x2B\x7C" // 40-4F - "\x26\xA9\xAA\x9C\xDB\xA5\x99\xE3\xA8\x9E\x21\x24\x2A\x29\x3B\x5E" // 50-5F - "\x2D\x2F\xDF\xDC\x9A\xDD\xDE\x98\x9D\xAC\xBA\x2C\x25\x5F\x3E\x3F" // 60-6F - "\xD7\x88\x94\xB0\xB1\xB2\xFC\xD6\xFB\x60\x3A\x23\x40\x27\x3D\x22" // 70-7F - "\xF8\x61\x62\x63\x64\x65\x66\x67\x68\x69\x96\xA4\xF3\xAF\xAE\xC5" // 80-8F - "\x8C\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x97\x87\xCE\x93\xF1\xFE" // 90-9F - "\xC8\x7E\x73\x74\x75\x76\x77\x78\x79\x7A\xEF\xC0\xDA\x5B\xF2\xF9" // A0-AF - "\xB5\xB6\xFD\xB7\xB8\xB9\xE6\xBB\xBC\xBD\x8D\xD9\xBF\x5D\xD8\xC4" // B0-BF - "\x7B\x41\x42\x43\x44\x45\x46\x47\x48\x49\xCB\xCA\xBE\xE8\xEC\xED" // C0-CF - "\x7D\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\xA1\xAD\xF5\xF4\xA3\x8F" // D0-DF - "\x5C\xE7\x53\x54\x55\x56\x57\x58\x59\x5A\xA0\x85\x8E\xE9\xE4\xD1" // E0-EF - "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\xB3\xF7\xF0\xFA\xA7\xFF" // F0-FF - }; -} - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_IBM1047_ISO8859::ACE_IBM1047_ISO8859 (void) -{ -} - -ACE_IBM1047_ISO8859::~ACE_IBM1047_ISO8859 (void) -{ -} - -ACE_CDR::ULong -ACE_IBM1047_ISO8859::ncs () -{ - return 0x10020417; -} - -ACE_CDR::ULong -ACE_IBM1047_ISO8859::tcs () -{ - return 0x00010001; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::read_char (ACE_InputCDR &in, - ACE_CDR::Char &x) -{ - if (this->read_1 (in, reinterpret_cast (&x))) - { - x = to_IBM1047[x]; - return 1; - } - return 0; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::read_string (ACE_InputCDR& in, - ACE_CDR::Char *& x) -{ - ACE_CDR::ULong len; - - in.read_ulong (len); - - if (len > 0) - { - ACE_NEW_RETURN (x, - ACE_CDR::Char[len], - 0); - - if (this->read_char_array (in, x, len)) - return 1; - - delete [] x; - } - - x = 0; - return 0; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::read_char_array (ACE_InputCDR& in, - ACE_CDR::Char* x, - ACE_CDR::ULong len) -{ - if (this->read_array (in, - x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - len)) - { - for (ACE_CDR::ULong i = 0; i != len; ++i) - x[i] = to_IBM1047[x[i]]; - - return 1; - } - - return 0; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::write_char (ACE_OutputCDR& out, - ACE_CDR::Char x) -{ - return - this->write_1 (out, - reinterpret_cast (&from_IBM1047[x])); -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::write_string (ACE_OutputCDR& out, - ACE_CDR::ULong len, - const ACE_CDR::Char* x) -{ - if (out.write_ulong (len + 1)) - return this->write_char_array (out, x, len + 1); - return 0; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::write_char_array (ACE_OutputCDR& out, - const ACE_CDR::Char* x, - ACE_CDR::ULong len) -{ - char *buf; - if (this->adjust (out, len, 1, buf) == 0) - { - ACE_OS::memcpy (buf, x, len); - - for (ACE_CDR::ULong i = 0; i != len; ++i) - buf[i] = from_IBM1047[buf[i]]; - - return 1; - } - - this->good_bit(out, 0); - return 0; -} - -// **************************************************************** - -ACE_ISO8859_IBM1047::ACE_ISO8859_IBM1047 (void) -{ -} - -ACE_ISO8859_IBM1047::~ACE_ISO8859_IBM1047 (void) -{ -} - -ACE_CDR::ULong -ACE_ISO8859_IBM1047::ncs () -{ - return 0x00010001; -} - -ACE_CDR::ULong -ACE_ISO8859_IBM1047::tcs () -{ - return 0x10020417; -} - - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::read_char (ACE_InputCDR& in, - ACE_CDR::Char& x) -{ - if (this->read_1 (in, reinterpret_cast (&x))) - { - x = from_IBM1047[x]; - return 1; - } - return 0; -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::read_string (ACE_InputCDR &in, - ACE_CDR::Char *&x) -{ - ACE_CDR::ULong len; - - in.read_ulong (len); - - if (len > 0) - { - ACE_NEW_RETURN (x, - ACE_CDR::Char[len], - 0); - - if (this->read_char_array (in, x, len)) - return 1; - - delete [] x; - } - - x = 0; - return 0; -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::read_char_array (ACE_InputCDR &in, - ACE_CDR::Char *x, - ACE_CDR::ULong len) -{ - if (this->read_array (in, - x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - len)) - { - for (ACE_CDR::ULong i = 0; i != len; ++i) - x[i] = from_IBM1047[x[i]]; - - return 1; - } - - return 0; -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::write_char (ACE_OutputCDR &out, - ACE_CDR::Char x) -{ - return - this->write_1 (out, - reinterpret_cast (&to_IBM1047[x])); -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::write_string (ACE_OutputCDR& out, - ACE_CDR::ULong len, - const ACE_CDR::Char* x) -{ - if (out.write_ulong (len + 1)) - return this->write_char_array (out, x, len + 1); - else - return 0; -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::write_char_array (ACE_OutputCDR &out, - const ACE_CDR::Char *x, - ACE_CDR::ULong len) -{ - char *buf; - - if (this->adjust (out, len, 1, buf) == 0) - { - ACE_OS::memcpy (buf, x, len); - - for (ACE_CDR::ULong i = 0; i != len; ++i) - buf[i] = to_IBM1047[buf[i]]; - - return 1; - } - - this->good_bit (out, 0); - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -#elif defined (__HP_aCC) -// Make aC++ stop complaining about an empty translation unit -static int const shut_up_aCC = 0; -#endif /* ACE_MVS */ diff --git a/ace/Codeset_IBM1047.h b/ace/Codeset_IBM1047.h deleted file mode 100644 index 9f9231a41a9..00000000000 --- a/ace/Codeset_IBM1047.h +++ /dev/null @@ -1,128 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Codeset_IBM1047.h - * - * $Id$ - * - * Declares the arrays required to convert between ISO8859 (aka - * Latin/1) and IBM1047 (aka EBCDIC). - * - * - * @author Jim Rogers (jrogers@viasoft.com) - */ -//============================================================================= - - -#ifndef ACE_CODESET_IMB1047_H -#define ACE_CODESET_IMB1047_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined(ACE_MVS) - -#include "ace/CDR_Stream.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -/** - * @class ACE_IBM1047_ISO8859 - * - * @brief Codeset translation specialization. - * - * This class performs the codeset translation: - * - Native: IBM_1047 (i.e. EBCDIC) - * - Stream: ISO-8859 (i.e. Latin/1) - */ -class ACE_Export ACE_IBM1047_ISO8859 : public ACE_Char_Codeset_Translator -{ -public: - /// A do nothing constructor. - ACE_IBM1047_ISO8859 (void); - - /// Virtual destruction - virtual ~ACE_IBM1047_ISO8859 (void); - - // = Documented in $ACE_ROOT/ace/CDR_Stream.h - virtual ACE_CDR::Boolean read_char (ACE_InputCDR &, - ACE_CDR::Char &); - virtual ACE_CDR::Boolean read_string (ACE_InputCDR &, - ACE_CDR::Char *&); - virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR &, - ACE_CDR::Char *, - ACE_CDR::ULong); - virtual ACE_CDR::Boolean write_char (ACE_OutputCDR &, - ACE_CDR::Char); - virtual ACE_CDR::Boolean write_string (ACE_OutputCDR &, - ACE_CDR::ULong, - const ACE_CDR::Char *); - virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &, - const ACE_CDR::Char *, - ACE_CDR::ULong); - - /// return the native codeset ID as defined in the OSF code and character - /// set registry, 0x10020417 - virtual ACE_CDR::ULong ncs (); - /// return the translated codeset ID as defined in the OSF code and character - /// set registry, 0x00010001 - virtual ACE_CDR::ULong tcs (); -}; - -/** - * @class ACE_ISO8859_IBM1047 - * - * @brief Codeset translation specialization. - * - * This class performs the codeset translation: - * - Native: ISO-8859 (i.e. Latin/1) - * - Stream: IBM-1047 (i.e. EBCDIC) - */ -class ACE_Export ACE_ISO8859_IBM1047 : public ACE_Char_Codeset_Translator -{ -public: - /// A do nothing constructor. - ACE_ISO8859_IBM1047 (void); - - /// Virtual destruction - virtual ~ACE_ISO8859_IBM1047 (void); - - // = Documented in $ACE_ROOT/ace/CDR_Stream.h - virtual ACE_CDR::Boolean read_char (ACE_InputCDR &, - ACE_CDR::Char &); - virtual ACE_CDR::Boolean read_string (ACE_InputCDR &, - ACE_CDR::Char *&); - virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR &, - ACE_CDR::Char *, - ACE_CDR::ULong); - virtual ACE_CDR::Boolean write_char (ACE_OutputCDR &, - ACE_CDR::Char); - virtual ACE_CDR::Boolean write_string (ACE_OutputCDR &, - ACE_CDR::ULong, - const ACE_CDR::Char *); - virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &, - const ACE_CDR::Char *, - ACE_CDR::ULong); - - /// return the native codeset ID as defined in the OSF code and character - /// set registry, 0x00010001 - virtual ACE_CDR::ULong ncs (); - /// return the translated codeset ID as defined in the OSF code and character - /// set registry, 0x10020417 - virtual ACE_CDR::ULong tcs (); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_MVS */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CODESET_IMB1047_H */ diff --git a/ace/Codeset_Registry.cpp b/ace/Codeset_Registry.cpp deleted file mode 100644 index 5d3c6abb59b..00000000000 --- a/ace/Codeset_Registry.cpp +++ /dev/null @@ -1,113 +0,0 @@ -//============================================================================= -/** - * @file Codeset_Registry.cpp - * - * $Id$ - * - * emulated codset regstry functions - * - * - * @author Phil Mesnier - */ -//============================================================================= - -#include "ace/Codeset_Registry.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" - -// $Id$ - -#if !defined (__ACE_INLINE__) -#include "ace/Codeset_Registry.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - Codeset_Registry, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -int -ACE_Codeset_Registry::locale_to_registry_i (const ACE_CString &locale, - ACE_CDR::ULong &codeset_id, - ACE_CDR::UShort *num_sets, - ACE_CDR::UShort **char_sets) -{ - registry_entry const * element = 0; - for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) - if (ACE_OS::strcmp(registry_db_[i].loc_name_,locale.c_str()) == 0) - element = ®istry_db_[i]; - if (element == 0) - return 0; - codeset_id = element->codeset_id_; - if (num_sets != 0) - *num_sets = element->num_sets_; - if (char_sets != 0) - { - ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); - ACE_OS::memcpy (*char_sets, - element->char_sets_, - element->num_sets_ * sizeof (ACE_CDR::UShort)); - } - return 1; -} - -int -ACE_Codeset_Registry::registry_to_locale_i (ACE_CDR::ULong codeset_id, - ACE_CString &locale, - ACE_CDR::UShort *num_sets, - ACE_CDR::UShort **char_sets) -{ - registry_entry const * element = 0; - for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) - if (codeset_id == registry_db_[i].codeset_id_) - element = ®istry_db_[i]; - if (element == 0) - return 0; - locale.set(element->loc_name_); - if (num_sets != 0) - *num_sets = element->num_sets_; - if (char_sets != 0) - { - ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); - ACE_OS::memcpy (*char_sets, - element->char_sets_, - element->num_sets_ * sizeof (ACE_CDR::UShort)); - } - return 1; -} - -int -ACE_Codeset_Registry::is_compatible_i (ACE_CDR::ULong codeset_id, - ACE_CDR::ULong other) -{ - registry_entry const * lhs = 0; - registry_entry const * rhs = 0; - for (size_t i = 0; (lhs == 0 || rhs == 0) && i < num_registry_entries_; i++) - { - if (codeset_id == registry_db_[i].codeset_id_) - lhs = ®istry_db_[i]; - if (other == registry_db_[i].codeset_id_) - rhs = ®istry_db_[i]; - } - - if (lhs == 0 || rhs == 0) - return 0; - - for (ACE_CDR::UShort l = 0; l < lhs->num_sets_; l++) - for (ACE_CDR::UShort r = 0; r < rhs->num_sets_; r++) - if (rhs->char_sets_[r] == lhs->char_sets_[l]) - return 1; - return 0; -} - -ACE_CDR::Short -ACE_Codeset_Registry::get_max_bytes_i (ACE_CDR::ULong codeset_id) -{ - for (size_t i = 0; i < num_registry_entries_; i++) - if (codeset_id == registry_db_[i].codeset_id_) - return registry_db_[i].max_bytes_; - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Codeset_Registry.h b/ace/Codeset_Registry.h deleted file mode 100644 index eb8d013d4af..00000000000 --- a/ace/Codeset_Registry.h +++ /dev/null @@ -1,104 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file Codeset_Registry.h - * - * $Id$ - * - * ACE wrapper around access functions for the OSF's DCE codeset registry - * access functions - * - * For environments that intrinsicly support the DCE defined access functions, - * the methods in this class are simply wrappers. On other platforms, emulation - * is provided. The motivation for this class is to support interoperability - * via translators and the CDR streams, primarily in TAO, but this capability - * is not restricted to CORBA. - * - * The emulated functionalty supports Open Group RFC #40, currently RFC 40.2, - * www.opengroup.org/tech/rfc/rfc40.2.html - * - * @author Phil Mesnier - */ -//============================================================================= - -#ifndef ACE_CODESET_REGISTRY_H -#define ACE_CODESET_REGISTRY_H - -#include /**/ "ace/pre.h" -#include "ace/SString.h" -#include "ace/CDR_Base.h" -#include "ace/Codeset_Symbols.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) -#include /**/ -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Export ACE_Codeset_Registry -{ -public: - - /// Based on a locale string, find the registry value and optional codeset - /// collection. This wraps the dce_cs_loc_to_rgy function, or emulates it. - static int locale_to_registry (const ACE_CString &locale, - ACE_CDR::ULong &codeset_id, - ACE_CDR::UShort * = 0, - ACE_CDR::UShort ** = 0); - - /// Based on a registry value, find the locale string and optional codeset - /// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it. - static int registry_to_locale (ACE_CDR::ULong codeset_id, - ACE_CString &locale, - ACE_CDR::UShort * = 0, - ACE_CDR::UShort ** = 0); - - /// Tell if two codesets are compatible. This wraps the - /// rpc_cs_char_set_compat_check function. - static int is_compatible (ACE_CDR::ULong codeset_id, - ACE_CDR::ULong other); - - /// Return the max number of bytes required to represent a single character. - /// This wraps the rpc_rgy_get_max_bytes function. - static ACE_CDR::Short get_max_bytes (ACE_CDR::ULong codeset_id); - - enum {max_charsets_ = 5}; -protected: - typedef struct { - const char * desc_; - const char * loc_name_; - ACE_CDR::ULong codeset_id_; - ACE_CDR::UShort num_sets_; - ACE_CDR::UShort char_sets_[max_charsets_]; - ACE_CDR::UShort max_bytes_; - } registry_entry; - -private: - static size_t const num_registry_entries_; - static registry_entry const registry_db_[]; - - static int locale_to_registry_i (const ACE_CString &locale, - ACE_CDR::ULong &codeset_id, - ACE_CDR::UShort * = 0, - ACE_CDR::UShort ** = 0); - static int registry_to_locale_i (ACE_CDR::ULong codeset_id, - ACE_CString &locale, - ACE_CDR::UShort * = 0, - ACE_CDR::UShort ** = 0); - static int is_compatible_i (ACE_CDR::ULong codeset_id, - ACE_CDR::ULong other); - static ACE_CDR::Short get_max_bytes_i (ACE_CDR::ULong codeset_id); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Codeset_Registry.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_CODESET_REGISTRY_H */ diff --git a/ace/Codeset_Registry.inl b/ace/Codeset_Registry.inl deleted file mode 100644 index d24e07cc83b..00000000000 --- a/ace/Codeset_Registry.inl +++ /dev/null @@ -1,102 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file Codeset_Registry.inl - * - * $Id$ - * - * ACE wrapper around access functions for the OSF's DCE codeset registry - * access functions - the inline functions either call the system supplied - * DCE based codeset regsitry function, or calls the emulation - * - * - * @author Phil Mesnier - */ -//============================================================================= - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -int -ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale, - ACE_CDR::ULong &codeset_id, - ACE_CDR::UShort *num_sets, - ACE_CDR::UShort **char_sets) -{ -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) - error_status_t result; - dce_cs_loc_to_rgy (locale.c_str(), - &codeset_id, - num_sets, - char_sets, - &result); - return (result == dce_cs_c_ok) ? 1 : 0; -#else - return ACE_Codeset_Registry::locale_to_registry_i (locale, - codeset_id, - num_sets, - char_sets); -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ -} - -// based on a registry value, find the locale string and optional codeset -// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it. -ACE_INLINE -int -ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id, - ACE_CString &locale, - ACE_CDR::UShort *num_sets, - ACE_CDR::UShort **char_sets) -{ -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) - error_status_t result; - char *buffer; - dce_cs_rgy_to_loc (codeset_id, - &buffer, - num_sets, - char_sets, - &result); - locale.set(buffer); // does a copy :-( - free (buffer); - return (result == dce_cs_c_ok) ? 1 : 0; -#else - return ACE_Codeset_Registry::registry_to_locale_i (codeset_id, - locale, - num_sets, - char_sets); -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ -} - -// Tell if two codesets are compatible. This wraps the -// rpc_cs_char_set_compat_check function. -ACE_INLINE -int -ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id, - ACE_CDR::ULong other) -{ -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) - error_status_t result; - rpc_cs_char_set_compat_check(codeset_id,other,&result); - return (result == rpc_s_ok) ? 1 : 0; -#else - return ACE_Codeset_Registry::is_compatible_i (codeset_id,other); -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ -} - -// Return the max number of bytes required to represent a single character. -// This wraps the rpc_rgy_get_max_bytes function. -ACE_INLINE -ACE_CDR::Short -ACE_Codeset_Registry::get_max_bytes (ACE_CDR::ULong codeset_id) -{ -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) - error_status_t result; - short max_bytes; - rpc_rgy_get_max_bytes(codeset_id,&max_bytes,&result); - return (result == rpc_s_ok) ? (short)max_bytes : 0; -#else - return ACE_Codeset_Registry::get_max_bytes_i (codeset_id); -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Codeset_Registry_db.cpp b/ace/Codeset_Registry_db.cpp deleted file mode 100644 index cd6e29760af..00000000000 --- a/ace/Codeset_Registry_db.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* $Id$ - * Codeset registry DB, generated Fri Feb 28 21:01:30 2003 - * source: code_set_registry1.2g.txt - * - * To populate the registry_db, construct a codeset registry text file based - * on the OSF's Character and Code Set Registry. See DCE RFC 40.1 for details - * on obtaining the full text for the current registry. Once you have composed - * a text file containing all the desired codeset information, build and run - * mkcsregdb. The source is in $ACE_ROOT/apps/mkcsregdb. It will generate a new - * copy of this file, with the registry_db_ array properly initialized. - */ - -#include "ace/Codeset_Registry.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Codeset_Registry::registry_entry const -ACE_Codeset_Registry::registry_db_[] = -{ - {"ISO 8859-1:1987; Latin Alphabet No. 1","ASCII",0x00010001,1,{0x0011},1}, - {"IBM-1047 (CCSID 01047); Latin-1 Open System","EBCDIC",0x10020417,1,{0x0011},1}, - {"ISO/IEC 10646-1:1993; UCS-4, Level 1","UCS-4",0x00010104,1,{0x1000},4}, - {"ISO/IEC 10646-1:1993; UTF-16, UCS Transformation Format 16-bit form","Unicode",0x00010109,1,{0x1000},2} -}; - -size_t const ACE_Codeset_Registry::num_registry_entries_ = 4; - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Codeset_Symbols.h b/ace/Codeset_Symbols.h deleted file mode 100644 index d2d20ce036b..00000000000 --- a/ace/Codeset_Symbols.h +++ /dev/null @@ -1,220 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Codeset_Symbols.h - * - * $Id$ - * - * Symbolic names for codeset ids. - * - * @author Dale Wilson (wilson_d@ociweb.com) - */ -//============================================================================= -#ifndef CODESET_SYMBOLS_H -#define CODESET_SYMBOLS_H - -// These numbers are assigned by the OpenGroup, a database is -// available at -// -// ftp://ftp.opengroup.org/pub/code_set_registry/ -// -// Alas, the database is in a semi-regular text file -- difficult to use. -// The following C/C++-friendly version of the codeset ids was captured -// from Version 1.2g of the registry. -// -#define ACE_CODESET_ID_ISO_8859_1 0x00010001U -#define ACE_CODESET_ID_ISO_8859_2 0x00010002U -#define ACE_CODESET_ID_ISO_8859_3 0x00010003U -#define ACE_CODESET_ID_ISO_8859_4 0x00010004U -#define ACE_CODESET_ID_ISO_8859_5 0x00010005U -#define ACE_CODESET_ID_ISO_8859_6 0x00010006U -#define ACE_CODESET_ID_ISO_8859_7 0x00010007U -#define ACE_CODESET_ID_ISO_8859_8 0x00010008U -#define ACE_CODESET_ID_ISO_8859_9 0x00010009U -#define ACE_CODESET_ID_ISO_8859_10 0x0001000AU -#define ACE_CODESET_ID_ISO_8859_15 0x0001000FU -#define ACE_CODESET_ID_ISO_646 0x00010020U -#define ACE_CODESET_ID_ISO_UCS_2_LEVEL_1 0x00010100U -#define ACE_CODESET_ID_ISO_UCS_2_LEVEL_2 0x00010101U -#define ACE_CODESET_ID_ISO_UCS_2_LEVEL_3 0x00010102U -#define ACE_CODESET_ID_ISO_UCS_4_LEVEL_1 0x00010104U -#define ACE_CODESET_ID_ISO_UCS_4_LEVEL_2 0x00010105U -#define ACE_CODESET_ID_ISO_UCS_4_LEVEL_3 0x00010106U -#define ACE_CODESET_ID_ISO_UTF_8 0x00010108U -#define ACE_CODESET_ID_ISO_UTF_16 0x00010109U -#define ACE_CODESET_ID_JIS_X0201 0x00030001U -#define ACE_CODESET_ID_JIS_X0208_1978 0x00030004U -#define ACE_CODESET_ID_JIS_X0208_1983 0x00030005U -#define ACE_CODESET_ID_JIS_X0208_1990 0x00030006U -#define ACE_CODESET_ID_JIS_X0212 0x0003000AU -#define ACE_CODESET_ID_JIS_EUCJP 0x00030010U -#define ACE_CODESET_ID_KS_C5601 0x00040001U -#define ACE_CODESET_ID_KS_C5657 0x00040002U -#define ACE_CODESET_ID_KS_EUCKR 0x0004000AU -#define ACE_CODESET_ID_CNS_11643_1986 0x00050001U -#define ACE_CODESET_ID_CNS_11643_1992 0x00050002U -#define ACE_CODESET_ID_CNS_EUCTW_1991 0x0005000AU -#define ACE_CODESET_ID_CNS_EUCTW_1993 0x00050010U -#define ACE_CODESET_ID_TIS_620_25290X000B0001U -#define ACE_CODESET_ID_TTB_CCDC 0x000D0001U -#define ACE_CODESET_ID_OSF_JAPANESE_UJIS 0x05000010U -#define ACE_CODESET_ID_OSF_JAPANESE_SJIS_1 0x05000011U -#define ACE_CODESET_ID_OSF_JAPANESE_SJIS_2 0x05000012U -#define ACE_CODESET_ID_XOPEN_UTF_8 0x05010001U -#define ACE_CODESET_ID_JVC_EUCJP 0x05020001U -#define ACE_CODESET_ID_JVC_SJIS 0x05020002U -#define ACE_CODESET_ID_DEC_KANJI 0x10000001U -#define ACE_CODESET_ID_SUPER_DEC_KANJI 0x10000002U -#define ACE_CODESET_ID_DEC_SHIFT_JIS 0x10000003U -#define ACE_CODESET_ID_HP_ROMAN8 0x10010001U -#define ACE_CODESET_ID_HP_KANA8 0x10010002U -#define ACE_CODESET_ID_HP_ARABIC8 0x10010003U -#define ACE_CODESET_ID_HP_GREEK8 0x10010004U -#define ACE_CODESET_ID_HP_HEBREW8 0x10010005U -#define ACE_CODESET_ID_HP_TURKISH8 0x10010006U -#define ACE_CODESET_ID_HP15CN 0x10010007U -#define ACE_CODESET_ID_HP_BIG5 0x10010008U -#define ACE_CODESET_ID_HP_JAPANESE15__SJIS_ 0x10010009U -#define ACE_CODESET_ID_HP_SJISHI 0x1001000AU -#define ACE_CODESET_ID_HP_SJISPC 0x1001000BU -#define ACE_CODESET_ID_HP_UJIS 0x1001000CU -#define ACE_CODESET_ID_IBM_037 0x10020025U -#define ACE_CODESET_ID_IBM_273 0x10020111U -#define ACE_CODESET_ID_IBM_277 0x10020115U -#define ACE_CODESET_ID_IBM_278 0x10020116U -#define ACE_CODESET_ID_IBM_280 0x10020118U -#define ACE_CODESET_ID_IBM_282 0x1002011AU -#define ACE_CODESET_ID_IBM_284 0x1002011CU -#define ACE_CODESET_ID_IBM_285 0x1002011DU -#define ACE_CODESET_ID_IBM_290 0x10020122U -#define ACE_CODESET_ID_IBM_297 0x10020129U -#define ACE_CODESET_ID_IBM_300 0x1002012CU -#define ACE_CODESET_ID_IBM_301 0x1002012DU -#define ACE_CODESET_ID_IBM_420 0x100201A4U -#define ACE_CODESET_ID_IBM_424 0x100201A8U -#define ACE_CODESET_ID_IBM_437 0x100201B5U -#define ACE_CODESET_ID_IBM_500 0x100201F4U -#define ACE_CODESET_ID_IBM_833 0x10020341U -#define ACE_CODESET_ID_IBM_834 0x10020342U -#define ACE_CODESET_ID_IBM_835 0x10020343U -#define ACE_CODESET_ID_IBM_836 0x10020344U -#define ACE_CODESET_ID_IBM_837 0x10020345U -#define ACE_CODESET_ID_IBM_838 0x10020346U -#define ACE_CODESET_ID_IBM_839 0x10020347U -#define ACE_CODESET_ID_IBM_850 0x10020352U -#define ACE_CODESET_ID_IBM_852 0x10020354U -#define ACE_CODESET_ID_IBM_855 0x10020357U -#define ACE_CODESET_ID_IBM_856 0x10020358U -#define ACE_CODESET_ID_IBM_857 0x10020359U -#define ACE_CODESET_ID_IBM_861 0x1002035DU -#define ACE_CODESET_ID_IBM_862 0x1002035EU -#define ACE_CODESET_ID_IBM_863 0x1002035FU -#define ACE_CODESET_ID_IBM_864 0x10020360U -#define ACE_CODESET_ID_IBM_866 0x10020362U -#define ACE_CODESET_ID_IBM_868 0x10020364U -#define ACE_CODESET_ID_IBM_869 0x10020365U -#define ACE_CODESET_ID_IBM_870 0x10020366U -#define ACE_CODESET_ID_IBM_871 0x10020367U -#define ACE_CODESET_ID_IBM_874 0x1002036AU -#define ACE_CODESET_ID_IBM_875 0x1002036BU -#define ACE_CODESET_ID_IBM_880 0x10020370U -#define ACE_CODESET_ID_IBM_891 0x1002037BU -#define ACE_CODESET_ID_IBM_896 0x10020380U -#define ACE_CODESET_ID_IBM_897 0x10020381U -#define ACE_CODESET_ID_IBM_903 0x10020387U -#define ACE_CODESET_ID_IBM_904 0x10020388U -#define ACE_CODESET_ID_IBM_918 0x10020396U -#define ACE_CODESET_ID_IBM_921 0x10020399U -#define ACE_CODESET_ID_IBM_922 0x1002039AU -#define ACE_CODESET_ID_IBM_926 0x1002039EU -#define ACE_CODESET_ID_IBM_927 0x1002039FU -#define ACE_CODESET_ID_IBM_928 0x100203A0U -#define ACE_CODESET_ID_IBM_929 0x100203A1U -#define ACE_CODESET_ID_IBM_930 0x100203A2U -#define ACE_CODESET_ID_IBM_932 0x100203A4U -#define ACE_CODESET_ID_IBM_933 0x100203A5U -#define ACE_CODESET_ID_IBM_934 0x100203A6U -#define ACE_CODESET_ID_IBM_935 0x100203A7U -#define ACE_CODESET_ID_IBM_936 0x100203A8U -#define ACE_CODESET_ID_IBM_937 0x100203A9U -#define ACE_CODESET_ID_IBM_938 0x100203AAU -#define ACE_CODESET_ID_IBM_939 0x100203ABU -#define ACE_CODESET_ID_IBM_941 0x100203ADU -#define ACE_CODESET_ID_IBM_942 0x100203AEU -#define ACE_CODESET_ID_IBM_943 0x100203AFU -#define ACE_CODESET_ID_IBM_946 0x100203B2U -#define ACE_CODESET_ID_IBM_947 0x100203B3U -#define ACE_CODESET_ID_IBM_948 0x100203B4U -#define ACE_CODESET_ID_IBM_949 0x100203B5U -#define ACE_CODESET_ID_IBM_950 0x100203B6U -#define ACE_CODESET_ID_IBM_951 0x100203B7U -#define ACE_CODESET_ID_IBM_955 0x100203BBU -#define ACE_CODESET_ID_IBM_964 0x100203C4U -#define ACE_CODESET_ID_IBM_970 0x100203CAU -#define ACE_CODESET_ID_IBM_1006 0x100203EEU -#define ACE_CODESET_ID_IBM_1025 0x10020401U -#define ACE_CODESET_ID_IBM_1026 0x10020402U -#define ACE_CODESET_ID_IBM_1027 0x10020403U -#define ACE_CODESET_ID_IBM_1040 0x10020410U -#define ACE_CODESET_ID_IBM_1041 0x10020411U -#define ACE_CODESET_ID_IBM_1043 0x10020413U -#define ACE_CODESET_ID_IBM_1046 0x10020416U -#define ACE_CODESET_ID_IBM_1047 0x10020417U -#define ACE_CODESET_ID_IBM_1088 0x10020440U -#define ACE_CODESET_ID_IBM_1097 0x10020449U -#define ACE_CODESET_ID_IBM_1098 0x1002044AU -#define ACE_CODESET_ID_IBM_1112 0x10020458U -#define ACE_CODESET_ID_IBM_1114 0x1002045AU -#define ACE_CODESET_ID_IBM_1115 0x1002045BU -#define ACE_CODESET_ID_IBM_1122 0x10020462U -#define ACE_CODESET_ID_IBM_1250 0x100204E2U -#define ACE_CODESET_ID_IBM_1251 0x100204E3U -#define ACE_CODESET_ID_IBM_1252 0x100204E4U -#define ACE_CODESET_ID_IBM_1253 0x100204E5U -#define ACE_CODESET_ID_IBM_1254 0x100204E6U -#define ACE_CODESET_ID_IBM_1255 0x100204E7U -#define ACE_CODESET_ID_IBM_1256 0x100204E8U -#define ACE_CODESET_ID_IBM_1257 0x100204E9U -#define ACE_CODESET_ID_IBM_1380 0x10020564U -#define ACE_CODESET_ID_IBM_1381 0x10020565U -#define ACE_CODESET_ID_IBM_1383 0x10020567U -#define ACE_CODESET_ID_IBM_4396 0x1002112CU -#define ACE_CODESET_ID_IBM_4946 0x10021352U -#define ACE_CODESET_ID_IBM_4948 0x10021354U -#define ACE_CODESET_ID_IBM_4951 0x10021357U -#define ACE_CODESET_ID_IBM_4952 0x10021358U -#define ACE_CODESET_ID_IBM_4953 0x10021359U -#define ACE_CODESET_ID_IBM_4960 0x10021360U -#define ACE_CODESET_ID_IBM_4964 0x10021364U -#define ACE_CODESET_ID_IBM_4965 0x10021365U -#define ACE_CODESET_ID_IBM_5026 0x100213A2U -#define ACE_CODESET_ID_IBM_5031 0x100213A7U -#define ACE_CODESET_ID_IBM_5035 0x100213ABU -#define ACE_CODESET_ID_IBM_5048 0x100213B8U -#define ACE_CODESET_ID_IBM_5049 0x100213B9U -#define ACE_CODESET_ID_IBM_5067 0x100213CBU -#define ACE_CODESET_ID_IBM_8612 0x100221A4U -#define ACE_CODESET_ID_IBM_9025 0x10022341U -#define ACE_CODESET_ID_IBM_9026 0x10022342U -#define ACE_CODESET_ID_IBM_9030 0x10022346U -#define ACE_CODESET_ID_IBM_9056 0x10022360U -#define ACE_CODESET_ID_IBM_9066 0x1002236AU -#define ACE_CODESET_ID_IBM_9125 0x100223A5U -#define ACE_CODESET_ID_IBM_25426 0x10026352U -#define ACE_CODESET_ID_IBM_25432 0x10026358U -#define ACE_CODESET_ID_IBM_1042 0x10026412U -#define ACE_CODESET_ID_IBM_28709 0x10027025U -#define ACE_CODESET_ID_IBM_33624 0x10028358U -#define ACE_CODESET_ID_IBM_33722 0x100283BAU -#define ACE_CODESET_ID_HTCSJIS 0x10030001U -#define ACE_CODESET_ID_HTCUJIS 0x10030002U -#define ACE_CODESET_ID_FUJITSU_U90 0x10040001U -#define ACE_CODESET_ID_FUJITSU_S90 0x10040002U -#define ACE_CODESET_ID_FUJITSU_R90 0x10040003U -#define ACE_CODESET_ID_EBCDIC_ASCII_AND_JEF 0x10040004U -#define ACE_CODESET_ID_EBCDIC_KATAKANA_AND_JEF 0x10040005U -#define ACE_CODESET_ID_EBCDIC_JAPANESE_ENGLISH_AND_JEF 0x10040006U - -#define ACE_CODESET_ID_TAO_BACKWARD_COMPATIBLE 0xf54414F0U -#endif // CODESET_SYMBOLS_H diff --git a/ace/Condition_Recursive_Thread_Mutex.cpp b/ace/Condition_Recursive_Thread_Mutex.cpp deleted file mode 100644 index 06301818247..00000000000 --- a/ace/Condition_Recursive_Thread_Mutex.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// -*- C++ -*- - -/** - * @file Condition_Recursive_Thread_Mutex.cpp - * - * $Id$ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/Condition_Recursive_Thread_Mutex.h" - -#if defined (ACE_HAS_THREADS) - -#if defined (ACE_HAS_DUMP) -# include "ace/Log_Msg.h" -#endif /* ACE_HAS_DUMP */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -int -ACE_Condition::remove (void) -{ - return ACE_OS::cond_destroy (&this->cond_); -} - -void -ACE_Condition::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Condition::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - // No dump method for ACE_cond_t even in emulated mode. - // cond_.dump (); - this->mutex_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Condition::~ACE_Condition (void) -{ - this->remove (); -} - -ACE_Condition::ACE_Condition (ACE_Recursive_Thread_Mutex &m) - : mutex_ (m) -{ - ACE_OS::cond_init (&this->cond_); -} - -int -ACE_Condition::wait (const ACE_Time_Value *abstime) -{ - return this->wait (this->mutex_, abstime); -} - -int -ACE_Condition::wait (ACE_Recursive_Thread_Mutex &mutex, - const ACE_Time_Value *abstime) -{ - ACE_recursive_mutex_state mutex_state_holder; - ACE_recursive_thread_mutex_t &recursive_mutex = mutex.mutex (); - - if (ACE_OS::recursive_mutex_cond_unlock (&recursive_mutex, - mutex_state_holder) == -1) - return -1; - - // We wait on the condition, specifying the nesting mutex. For platforms - // with ACE_HAS_RECURSIVE_MUTEXES, this is the recursive mutex itself, - // and is the same as recursive_mutex, above. The caller should have been - // holding the lock on entry to this method, and it is still held. - // For other platforms, this is the nesting mutex that guards the - // ACE_recursive_mutex_t internals, and recursive_mutex_cond_unlock() - // returned with the lock held, but waiters primed and waiting to be - // released. At cond_wait below, the mutex will be released. - // On return, it will be reacquired. - const int result = abstime == 0 - ? ACE_OS::cond_wait (&this->cond_, - &mutex.get_nesting_mutex ()) - : ACE_OS::cond_timedwait (&this->cond_, - &mutex.get_nesting_mutex (), - const_cast (abstime)); - // We are holding the mutex, whether the wait succeeded or failed. - // Stash errno (in case it failed) and then we need to reset the - // recursive mutex state to what it was on entry to this method. - // Resetting it may require a wait for another thread to release - // the ACE_recursive_thread_mutex_t if this is a platform without - // ACE_HAS_RECURSIVE_MUTEXES, and recursive_mutex_cond_relock() takes - // care of that. - { - ACE_Errno_Guard error (errno); - ACE_OS::recursive_mutex_cond_relock (&recursive_mutex, - mutex_state_holder); - } - - return result; -} - -int -ACE_Condition::signal (void) -{ - return ACE_OS::cond_signal (&this->cond_); -} - -int -ACE_Condition::broadcast (void) -{ - return ACE_OS::cond_broadcast (&this->cond_); -} - -ACE_Recursive_Thread_Mutex & -ACE_Condition::mutex (void) -{ - return this->mutex_; -} - -ACE_Condition_Recursive_Thread_Mutex::ACE_Condition_Recursive_Thread_Mutex ( - ACE_Recursive_Thread_Mutex &m) : - ACE_Condition (m) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/Condition_Recursive_Thread_Mutex.h b/ace/Condition_Recursive_Thread_Mutex.h deleted file mode 100644 index 0c4607a5c2e..00000000000 --- a/ace/Condition_Recursive_Thread_Mutex.h +++ /dev/null @@ -1,118 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Condition_Recursive_Thread_Mutex.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H -#define ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_HAS_THREADS) -# include "ace/Null_Condition.h" -#else /* ACE_HAS_THREADS */ -#include "ace/Recursive_Thread_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template class ACE_Condition; - -/** - * @class ACE_Condition - * - * @brief ACE_Condition template specialization written using - * @a ACE_Recursive_Thread_Mutex. This allows threads to block until - * shared data changes state using recursive mutexes. - */ -template<> -class ACE_Export ACE_Condition -{ -public: - /// Initialize the condition variable with a recursive mutex. - ACE_Condition (ACE_Recursive_Thread_Mutex &m); - - /// Implicitly destroy the condition variable. - ~ACE_Condition (void); - - /** - * Explicitly destroy the condition variable. Note that only one - * thread should call this method since it doesn't protect against - * race conditions. - */ - int remove (void); - - /** - * Block on condition, or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" semantics. Else, if - * != 0 and the call times out before the condition is signaled - * returns -1 and sets errno to ETIME. - */ - int wait (const ACE_Time_Value *abstime = 0); - - /** - * Block on condition or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" wait() semantics on the recursive @a mutex - * passed as a parameter (this is useful if you need to store the - * in shared memory). Else, if != 0 and the - * call times out before the condition is signaled returns -1 - * and sets errno to ETIME. - */ - int wait (ACE_Recursive_Thread_Mutex &mutex, - const ACE_Time_Value *abstime = 0); - - /// Signal one waiting thread. - int signal (void); - - /// Signal *all* waiting threads. - int broadcast (void); - - /// Returns a reference to the underlying mutex; - ACE_Recursive_Thread_Mutex &mutex (void); - - /// Dump the state of an object. - void dump (void) const; - -private: - - // = Prevent assignment and copying. - void operator= (const ACE_Condition &); - ACE_Condition (const ACE_Condition &); - -private: - - /// A normal (i.e., non-recursive) condition variable. - ACE_cond_t cond_; - - /// Reference to the recursive mutex. - ACE_Recursive_Thread_Mutex &mutex_; - -}; - -class ACE_Export ACE_Condition_Recursive_Thread_Mutex - : public ACE_Condition -{ -public: - /// Initialize the condition variable with a recursive mutex. - ACE_Condition_Recursive_Thread_Mutex (ACE_Recursive_Thread_Mutex &m); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H */ diff --git a/ace/Condition_T.cpp b/ace/Condition_T.cpp deleted file mode 100644 index df125ee0816..00000000000 --- a/ace/Condition_T.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// $Id$ - -#ifndef ACE_CONDITION_T_CPP -#define ACE_CONDITION_T_CPP - -#include "ace/Condition_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_THREADS) - -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Condition_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Condition) - -template void -ACE_Condition::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Condition::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Thread_Condition::ACE_Thread_Condition (MUTEX &m, - const ACE_TCHAR *name, - void *arg) - : ACE_Condition (m, USYNC_THREAD, name, arg) -{ -// ACE_TRACE ("ACE_Thread_Condition::ACE_Thread_Condition"); -} - -template void -ACE_Thread_Condition::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Thread_Condition::dump"); - - ACE_Condition::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Condition::ACE_Condition (MUTEX &m, - int type, - const ACE_TCHAR *name, - void *arg) - : - mutex_ (m) -{ - // ACE_TRACE ("ACE_Condition::ACE_Condition"); - - if (ACE_OS::cond_init (&this->cond_, - (short) type, - name, - arg) != 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Condition::ACE_Condition"))); -} - -template -ACE_Condition::~ACE_Condition (void) -{ - // ACE_TRACE ("ACE_Condition::~ACE_Condition"); - - if (this->remove () == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Condition::~ACE_Condition"))); -} - -template int -ACE_Condition::wait (void) -{ - // ACE_TRACE ("ACE_Condition::wait"); - return ACE_OS::cond_wait (&this->cond_, - &this->mutex_.lock_); -} - -template int -ACE_Condition::wait (MUTEX &mutex, - const ACE_Time_Value *abstime) -{ -// ACE_TRACE ("ACE_Condition::wait"); - if (abstime == 0) - return this->wait (); - else - { - return ACE_OS::cond_timedwait (&this->cond_, - &mutex.lock_, - (ACE_Time_Value *) abstime); - } -} - -// Peform an "alertable" timed wait. If the argument ABSTIME == 0 -// then we do a regular cond_wait(), else we do a timed wait for up to -// ABSTIME using the Solaris cond_timedwait() function. - -template int -ACE_Condition::wait (const ACE_Time_Value *abstime) -{ -// ACE_TRACE ("ACE_Condition::wait"); - return this->wait (this->mutex_, abstime); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ - -#endif /* ACE_CONDITION_T_CPP */ diff --git a/ace/Condition_T.h b/ace/Condition_T.h deleted file mode 100644 index 535642a77e8..00000000000 --- a/ace/Condition_T.h +++ /dev/null @@ -1,167 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Condition_T.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_CONDITION_T_H -#define ACE_CONDITION_T_H - -#include /**/ "ace/pre.h" - -#include "ace/OS_NS_Thread.h" -#include "ace/Lock.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_THREADS) /* ACE platform supports some form of threading. */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_Condition - * - * @brief ACE_Condition variable wrapper, which allows threads to block - * until shared data changes state. - * - * A condition variable enables threads to atomically block and - * test the condition under the protection of a mutual exclu- - * sion lock (mutex) until the condition is satisfied. That is, - * the mutex must have been held by the thread before calling - * wait or signal on the condition. If the condition is false, - * a thread blocks on a condition variable and atomically - * releases the mutex that is waiting for the condition to - * change. If another thread changes the condition, it may wake - * up waiting threads by signaling the associated condition - * variable. The waiting threads, upon awakening, reacquire the - * mutex and re-evaluate the condition. - * Note, you can only parameterize with - * @a ACE_Thread_Mutex, @a ACE_Recursive_Thread_Mutex, or @a ACE_Null_Mutex. - */ -template -class ACE_Condition -{ -public: - // = Initialiation and termination methods. - /// Initialize the condition variable. - ACE_Condition (MUTEX &m, int type = USYNC_THREAD, - const ACE_TCHAR *name = 0, void *arg = 0); - - /// Implicitly destroy the condition variable. - ~ACE_Condition (void); - - // = Lock accessors. - /** - * Block on condition, or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" semantics. Else, if - * != 0 and the call times out before the condition is signaled - * returns -1 and sets errno to ETIME. - */ - int wait (const ACE_Time_Value *abstime); - - /// Block on condition. - int wait (void); - - /** - * Block on condition or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" wait() semantics on the - * passed as a parameter (this is useful if you need to store the - * in shared memory). Else, if != 0 and the - * call times out before the condition is signaled returns -1 - * and sets errno to ETIME. - */ - int wait (MUTEX &mutex, const ACE_Time_Value *abstime = 0); - - /// Signal one waiting thread. - int signal (void); - - /// Signal *all* waiting threads. - int broadcast (void); - - // = Utility methods. - /// Explicitly destroy the condition variable. - int remove (void); - - /// Returns a reference to the underlying mutex_; - MUTEX &mutex (void); - - /// Dump the state of an object. - void dump (void) const; - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -protected: - /// Condition variable. - ACE_cond_t cond_; - - /// Reference to mutex lock. - MUTEX &mutex_; - -private: - // = Prevent assignment and initialization. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Condition &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Condition (const ACE_Condition &)) -}; - -/** - * @class ACE_Thread_Condition - * - * @brief ACE_Condition variable wrapper that works within processes. - * - * A condition variable enables threads to atomically block and - * test the condition under the protection of a mutual exclu- - * sion lock (mutex) until the condition is satisfied. That is, - * the mutex must have been held by the thread before calling - * wait or signal on the condition. If the condition is false, - * a thread blocks on a condition variable and atomically - * releases the mutex that is waiting for the condition to - * change. If another thread changes the condition, it may wake - * up waiting threads by signaling the associated condition - * variable. The waiting threads, upon awakening, reacquire the - * mutex and re-evaluate the condition. - */ -template -class ACE_Thread_Condition : public ACE_Condition -{ -public: - // = Initialization method. - ACE_Thread_Condition (MUTEX &m, const ACE_TCHAR *name = 0, void *arg = 0); - - /// Dump the state of an object. - void dump (void) const; - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Condition_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Condition_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Condition_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONDITION_T_H */ diff --git a/ace/Condition_T.inl b/ace/Condition_T.inl deleted file mode 100644 index fd7bdb7abdc..00000000000 --- a/ace/Condition_T.inl +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Condition::remove (void) -{ - // ACE_TRACE ("ACE_Condition::remove"); - - // cond_destroy() is called in a loop if the condition variable is - // BUSY. This avoids a condition where a condition is signaled and - // because of some timing problem, the thread that is to be signaled - // has called the cond_wait routine after the signal call. Since - // the condition signal is not queued in any way, deadlock occurs. - - int result = 0; - - while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1 - && errno == EBUSY) - { - ACE_OS::cond_broadcast (&this->cond_); - ACE_OS::thr_yield (); - } - - return result; -} - -template ACE_INLINE MUTEX & -ACE_Condition::mutex (void) -{ - // ACE_TRACE ("ACE_Condition::mutex"); - return this->mutex_; -} - -template ACE_INLINE int -ACE_Condition::signal (void) -{ -// ACE_TRACE ("ACE_Condition::signal"); - return ACE_OS::cond_signal (&this->cond_); -} - -template ACE_INLINE int -ACE_Condition::broadcast (void) -{ -// ACE_TRACE ("ACE_Condition::broadcast"); - return ACE_OS::cond_broadcast (&this->cond_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Condition_Thread_Mutex.cpp b/ace/Condition_Thread_Mutex.cpp deleted file mode 100644 index d7aa83f9b6f..00000000000 --- a/ace/Condition_Thread_Mutex.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file Condition_Thread_Mutex.cpp - * - * $Id$ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/Condition_Thread_Mutex.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/Condition_Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" - -ACE_RCSID(ace, Condition_Thread_Mutex, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Condition_Thread_Mutex) - -void -ACE_Condition_Thread_Mutex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Condition_Thread_Mutex::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); -#if defined (ACE_WIN32) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("waiters = %d\n"), - this->cond_.waiters ())); -#endif /* ACE_WIN32 */ - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex (const ACE_Thread_Mutex &m, - const ACE_TCHAR *name, - void *arg) - : mutex_ ((ACE_Thread_Mutex &) m), - removed_ (0) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"); - if (ACE_OS::cond_init (&this->cond_, - (short) USYNC_THREAD, - name, - arg) != 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"))); -} - -ACE_Condition_Thread_Mutex:: -ACE_Condition_Thread_Mutex (const ACE_Thread_Mutex &m, - ACE_Condition_Attributes &attributes, - const ACE_TCHAR *name, - void *arg) - : mutex_ ((ACE_Thread_Mutex &) m), - removed_ (0) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"); - if (ACE_OS::cond_init (&this->cond_, attributes.attributes_, - name, arg) != 0) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"))); -} - -ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex (void) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex"); - this->remove (); -} - -// Peform an "alertable" timed wait. If the argument == 0 -// then we do a regular , else we do a timed wait for up to -// using the function. - -int -ACE_Condition_Thread_Mutex::wait (void) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait"); - return ACE_OS::cond_wait (&this->cond_, &this->mutex_.lock_); -} - -int -ACE_Condition_Thread_Mutex::wait (ACE_Thread_Mutex &mutex, - const ACE_Time_Value *abstime) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait"); - return ACE_OS::cond_timedwait (&this->cond_, - &mutex.lock_, - const_cast (abstime)); -} - -int -ACE_Condition_Thread_Mutex::wait (const ACE_Time_Value *abstime) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait"); - return this->wait (this->mutex_, abstime); -} - -int -ACE_Condition_Thread_Mutex::signal (void) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::signal"); - return ACE_OS::cond_signal (&this->cond_); -} - -int -ACE_Condition_Thread_Mutex::broadcast (void) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::broadcast"); - return ACE_OS::cond_broadcast (&this->cond_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/Condition_Thread_Mutex.h b/ace/Condition_Thread_Mutex.h deleted file mode 100644 index 01a465e8f33..00000000000 --- a/ace/Condition_Thread_Mutex.h +++ /dev/null @@ -1,190 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Condition_Thread_Mutex.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_CONDITION_THREAD_MUTEX_H -#define ACE_CONDITION_THREAD_MUTEX_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_HAS_THREADS) -# include "ace/Null_Condition.h" -#else /* ACE_HAS_THREADS */ -// ACE platform supports some form of threading. - -#include "ace/Thread_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -class ACE_Export ACE_Condition_Attributes -{ -public: - /// Constructor - ACE_Condition_Attributes (int type = ACE_DEFAULT_SYNCH_TYPE); - - /// Destructor - ~ACE_Condition_Attributes (void); - -private: - friend class ACE_Condition_Thread_Mutex; - - /// The attributes - ACE_condattr_t attributes_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Condition_Attributes &); - ACE_Condition_Attributes (const ACE_Condition_Attributes &); -}; - -/** - * @class ACE_Condition_Thread_Mutex - * - * @brief ACE_Condition variable wrapper written using ACE_Mutexes This - * allows threads to block until shared data changes state. - * A condition variable enables threads to atomically block and - * test the condition under the protection of a mutual exclu- - * sion lock (mutex) until the condition is satisfied. That is, - * the mutex must have been held by the thread before calling - * wait or signal on the condition. If the condition is false, - * a thread blocks on a condition variable and atomically - * releases the mutex that is waiting for the condition to - * change. If another thread changes the condition, it may wake - * up waiting threads by signaling the associated condition - * variable. The waiting threads, upon awakening, reacquire the - * mutex and re-evaluate the condition. - * - * This should be an instantiation of ACE_Condition but problems - * with compilers precludes this... - */ -class ACE_Export ACE_Condition_Thread_Mutex -{ -public: - /// Initialize the condition variable. - ACE_Condition_Thread_Mutex (const ACE_Thread_Mutex &m, - const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Initialize the condition variable. - ACE_Condition_Thread_Mutex (const ACE_Thread_Mutex &m, - ACE_Condition_Attributes &attributes, - const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Implicitly destroy the condition variable. - ~ACE_Condition_Thread_Mutex (void); - - /** - * Explicitly destroy the condition variable. Note that only one - * thread should call this method since it doesn't protect against - * race conditions. - */ - int remove (void); - - /** - * Block on condition, or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" semantics. Else, if - * != 0 and the call times out before the condition is signaled - * returns -1 and sets errno to ETIME. - */ - int wait (const ACE_Time_Value *abstime); - - /// Block on condition. - int wait (void); - - /** - * Block on condition or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" wait() semantics on the - * passed as a parameter (this is useful if you need to store the - * in shared memory). Else, if != 0 and the - * call times out before the condition is signaled returns -1 - * and sets errno to ETIME. - */ - int wait (ACE_Thread_Mutex &mutex, const ACE_Time_Value *abstime = 0); - - /// Signal one waiting thread. - int signal (void); - - /// Signal *all* waiting threads. - int broadcast (void); - - /// Returns a reference to the underlying mutex; - ACE_Thread_Mutex &mutex (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Condition variable. - ACE_cond_t cond_; - - /// Reference to mutex lock. - ACE_Thread_Mutex &mutex_; - - /// Keeps track of whether has been called yet to avoid - /// multiple calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure - /// that you don't have multiple threads simultaneously calling - /// on the same object, which is a bad idea anyway... - int removed_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Condition_Thread_Mutex &); - ACE_Condition_Thread_Mutex (const ACE_Condition_Thread_Mutex &); -}; - -#if 0 -// The following class is commented out since there doesn't -// appear to be a portable and robust means of implementing this -// functionality across platforms. If you know of a portable and -// robust way to implement this functionality please let us know. - -/** - * @class ACE_Process_Condition - * - * @brief ACE_Condition variable wrapper that works across processes. - */ -class ACE_Export ACE_Process_Condition -{ -public: - ACE_Process_Condition (MUTEX &m, const ACE_TCHAR *name = 0, void *arg = 0); - - /// Dump the state of an object. - void dump (void) const; - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. -}; -#endif /* 0 */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Condition_Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONDITION_THREAD_MUTEX_H */ diff --git a/ace/Condition_Thread_Mutex.inl b/ace/Condition_Thread_Mutex.inl deleted file mode 100644 index 3e12c9c911a..00000000000 --- a/ace/Condition_Thread_Mutex.inl +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Condition_Attributes::ACE_Condition_Attributes (int type) -{ - (void) ACE_OS::condattr_init (this->attributes_, type); -} - -ACE_INLINE -ACE_Condition_Attributes::~ACE_Condition_Attributes (void) -{ - ACE_OS::condattr_destroy (this->attributes_); -} - -ACE_INLINE int -ACE_Condition_Thread_Mutex::remove (void) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::remove"); - - // is called in a loop if the condition variable is - // BUSY. This avoids a condition where a condition is signaled and - // because of some timing problem, the thread that is to be signaled - // has called the cond_wait routine after the signal call. Since - // the condition signal is not queued in any way, deadlock occurs. - - int result = 0; - - if (this->removed_ == 0) - { - this->removed_ = 1; - - while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1 - && errno == EBUSY) - { - ACE_OS::cond_broadcast (&this->cond_); - ACE_OS::thr_yield (); - } - } - return result; -} - -ACE_INLINE ACE_Thread_Mutex & -ACE_Condition_Thread_Mutex::mutex (void) -{ -// ACE_TRACE ("ACE_Condition_Thread_Mutex::mutex"); - return this->mutex_; -} - -#if 0 -template void -ACE_Process_Condition::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Process_Condition::dump"); - - ACE_Condition::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Process_Condition::ACE_Process_Condition (MUTEX &m, - const ACE_TCHAR *name, - void *arg) - : ACE_Condition (m, USYNC_PROCESS, name, arg) -{ -// ACE_TRACE ("ACE_Process_Condition::ACE_Process_Condition"); -} -#endif /* 0 */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp deleted file mode 100644 index 07e1eb0a12b..00000000000 --- a/ace/Configuration.cpp +++ /dev/null @@ -1,2185 +0,0 @@ -// $Id$ -#include "ace/Configuration.h" -#include "ace/Auto_Ptr.h" -#include "ace/SString.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_strings.h" - -// Can remove this when import_config and export_config are removed from -// ACE_Configuration. They're deprecated at ACE 5.2. -#include "ace/Configuration_Import_Export.h" - -#if !defined (ACE_LACKS_ACCESS) -# include "ace/OS_NS_unistd.h" -#endif /* ACE_LACKS_ACCESS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Section_Key_Internal::ACE_Section_Key_Internal (void) - : ref_count_ (0) -{ -} - -ACE_Section_Key_Internal::~ACE_Section_Key_Internal (void) -{ -} - -int -ACE_Section_Key_Internal::add_ref (void) -{ - ++ref_count_; - return 0; -} - -int -ACE_Section_Key_Internal::dec_ref (void) -{ - if (!--ref_count_) - delete this; - return 0; -} - -ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (void) - : key_ (0) -{ -} - -ACE_Configuration_Section_Key::~ACE_Configuration_Section_Key (void) -{ - if (key_) - key_->dec_ref (); -} - -ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (ACE_Section_Key_Internal* key) - : key_ (key) -{ - if (key_) - key_->add_ref (); -} - -ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key& rhs) - : key_ (rhs.key_) -{ - if (key_) - key_->add_ref (); -} - -ACE_Configuration_Section_Key& -ACE_Configuration_Section_Key::operator= (const ACE_Configuration_Section_Key& rhs) -{ - if (this != &rhs) - { - if (key_) - key_->dec_ref (); - - key_ = rhs.key_; - - if (key_) - key_->add_ref (); - } - return *this; -} - -////////////////////////////////////////////////////////////////////////////// - -ACE_TCHAR ACE_Configuration::NULL_String_ = '\0'; - -ACE_Configuration::ACE_Configuration (void) - : root_ () -{ -} - -ACE_Configuration::~ACE_Configuration (void) -{ -} - -ACE_Section_Key_Internal* -ACE_Configuration::get_internal_key (const ACE_Configuration_Section_Key& key) -{ - return key.key_; -} - -int -ACE_Configuration::expand_path (const ACE_Configuration_Section_Key& key, - const ACE_TString& path_in, - ACE_Configuration_Section_Key& key_out, - int create) -{ - // Make a copy of key - ACE_Configuration_Section_Key current_section = key; - ACE_Auto_Basic_Array_Ptr pData (path_in.rep ()); - ACE_Tokenizer parser (pData.get ()); - parser.delimiter_replace ('\\', '\0'); - parser.delimiter_replace ('/', '\0'); - - for (ACE_TCHAR *temp = parser.next (); - temp != 0; - temp = parser.next ()) - { - // Open the section - if (open_section (current_section, - temp, - create, - key_out)) - return -1; - - current_section = key_out; - } - - return 0; - -} - -// import_config and export_config are here for backward compatibility, -// and have been deprecated. -int -ACE_Configuration::export_config (const ACE_TCHAR* filename) -{ - ACE_Registry_ImpExp exporter (*this); - return exporter.export_config (filename); -} - -int -ACE_Configuration::import_config (const ACE_TCHAR* filename) -{ - ACE_Registry_ImpExp importer (*this); - return importer.import_config (filename); -} - -int -ACE_Configuration::validate_name (const ACE_TCHAR* name, int allow_path) -{ - // Invalid character set - const ACE_TCHAR* reject = - allow_path ? ACE_LIB_TEXT ("][") : ACE_LIB_TEXT ("\\]["); - - // Position of the first invalid character or terminating null. - size_t pos = ACE_OS::strcspn (name, reject); - - // Check if it is an invalid character. - if (name[pos] != ACE_LIB_TEXT ('\0')) - { - errno = EINVAL; - return -1; - } - - // The first character can never be a path separator. - if (name[0] == ACE_LIB_TEXT ('\\')) - { - errno = EINVAL; - return -1; - } - - // Validate length. - if (pos == 0 || pos > 255) - { - errno = ENAMETOOLONG; - return -1; - } - - return 0; -} - -int -ACE_Configuration::validate_value_name (const ACE_TCHAR* name) -{ - if (name == 0 || *name == this->NULL_String_) - return 0; - - return this->validate_name (name); -} - -const ACE_Configuration_Section_Key& -ACE_Configuration::root_section (void) const -{ - return root_; -} - -/** - * Determine if the contents of this object is the same as the - * contents of the object on the right hand side. - * Returns 1 (True) if they are equal and 0 (False) if they are not equal - */ -bool -ACE_Configuration::operator== (const ACE_Configuration& rhs) const -{ - bool rc = true; - int sectionIndex = 0; - ACE_TString sectionName; - ACE_Configuration *nonconst_this = const_cast (this); - ACE_Configuration &nonconst_rhs = const_cast (rhs); - - const ACE_Configuration_Section_Key& rhsRoot = rhs.root_section (); - ACE_Configuration_Section_Key rhsSection; - ACE_Configuration_Section_Key thisSection; - - // loop through each section in this object - while ((rc) && (nonconst_this->enumerate_sections (this->root_, - sectionIndex, - sectionName) == 0)) - { - // find that section in the rhs object - if (nonconst_rhs.open_section (rhsRoot, - sectionName.c_str (), - 0, - rhsSection) != 0) - { - // If the rhs object does not contain the section then we are - // not equal. - rc = false; - } - else if (nonconst_this->open_section (this->root_, - sectionName.c_str (), - 0, - thisSection) != 0) - { - // if there is some error opening the section in this object - rc = false; - } - else - { - // Well the sections match - int valueIndex = 0; - ACE_TString valueName; - VALUETYPE valueType; - VALUETYPE rhsType; - - // Enumerate each value in this section - while ((rc) && nonconst_this->enumerate_values (thisSection, - valueIndex, - valueName, - valueType) == 0) - { - // look for the same value in the rhs section - if (nonconst_rhs.find_value (rhsSection, - valueName.c_str (), - rhsType) != 0) - { - // We're not equal if the same value cannot - // be found in the rhs object. - rc = false; - } - else if (valueType != rhsType) - { - // we're not equal if the types do not match. - rc = false; - } - else - { - // finally compare values. - if (valueType == STRING) - { - ACE_TString thisString, rhsString; - if (nonconst_this->get_string_value (thisSection, - valueName.c_str (), - thisString) != 0) - { - // we're not equal if we cannot get this string - rc = false; - } - else if (nonconst_rhs.get_string_value ( - rhsSection, - valueName.c_str (), - rhsString) != 0) - { - // we're not equal if we cannot get rhs string - rc = false; - } - rc = (thisString == rhsString); - } - else if (valueType == INTEGER) - { - u_int thisInt = 0; - u_int rhsInt = 0; - if (nonconst_this->get_integer_value ( - thisSection, - valueName.c_str (), - thisInt) != 0) - { - // we're not equal if we cannot get this int - rc = false; - } - else if (nonconst_rhs.get_integer_value ( - rhsSection, - valueName.c_str (), - rhsInt) != 0) - { - // we're not equal if we cannot get rhs int - rc = false; - } - rc = (thisInt == rhsInt); - } - else if (valueType == BINARY) - { - void* thisData = 0; - void* rhsData = 0; - size_t thisLength = 0; - size_t rhsLength = 0; - if (nonconst_this->get_binary_value (thisSection, - valueName.c_str (), - thisData, - thisLength) != 0) - { - // we're not equal if we cannot get this data - rc = false; - } - else if (nonconst_rhs.get_binary_value ( - rhsSection, - valueName.c_str (), - rhsData, - rhsLength) != 0) - { - // we're not equal if we cannot get this data - rc = false; - } - - rc = (thisLength == rhsLength); - // are the length's the same? - - if (rc) - { - unsigned char* thisCharData = - (unsigned char*)thisData; - unsigned char* rhsCharData = (unsigned char*)rhsData; - // yes, then check each element - for (size_t count = 0; - (rc) && (count < thisLength); - count++) - { - rc = (* (thisCharData + count) == * (rhsCharData + count)); - } - - delete [] thisCharData; - delete [] rhsCharData; - }// end if the length's match - } - // We should never have valueTypes of INVALID, therefore - // we're not comparing them. How would we since we have - // no get operation for invalid types. - // So, if we have them, we guess they are equal. - - }// end else if values match. - - ++valueIndex; - - }// end value while loop - - // look in the rhs for values not in this - valueIndex = 0; - while ((rc) && (nonconst_rhs.enumerate_values (rhsSection, - valueIndex, - valueName, - rhsType) == 0)) - { - // look for the same value in this section - if (nonconst_this->find_value (thisSection, - valueName.c_str (), - valueType) != 0) - { - // We're not equal if the same value cannot - // be found in the rhs object. - rc = false; - } - ++valueIndex; - }// end while for rhs values not in this. - - }// end else if sections match. - - sectionIndex++; - - }// end section while loop - - // Finally, make sure that there are no sections in rhs that do not - // exist in this - sectionIndex = 0; - while ((rc) - && (nonconst_rhs.enumerate_sections (rhsRoot, - sectionIndex, - sectionName) == 0)) - { - // find the section in this - if (nonconst_this->open_section (this->root_, - sectionName.c_str (), - 0, - thisSection) != 0) - { - // if there is some error opening the section in this object - rc = false; - } - else if (nonconst_rhs.open_section (rhsRoot, - sectionName.c_str (), - 0, - rhsSection) != 0) - { - // If the rhs object does not contain the section then we - // are not equal. - rc = false; - } - ++sectionIndex; - } - return rc; -} - -bool -ACE_Configuration::operator!= (const ACE_Configuration& rhs) const -{ - return !(*this == rhs); -} - -////////////////////////////////////////////////////////////////////////////// - -#if defined (WIN32) - -static const int ACE_DEFAULT_BUFSIZE = 256; - -static const ACE_TCHAR *temp_name (const ACE_TCHAR *name) -{ - if (name && *name == ACE_Configuration::NULL_String_) - return 0; - return name; -} - -ACE_Section_Key_Win32::ACE_Section_Key_Win32 (HKEY hKey) - : hKey_ (hKey) -{ -} - -ACE_Section_Key_Win32::~ACE_Section_Key_Win32 (void) -{ - ::RegCloseKey (hKey_); -} - -////////////////////////////////////////////////////////////////////////////// - -bool -ACE_Configuration_Win32Registry::operator== (const ACE_Configuration_Win32Registry &rhs) const -{ - ACE_UNUSED_ARG (rhs); - return true; -} - -bool -ACE_Configuration_Win32Registry::operator!= (const ACE_Configuration_Win32Registry &rhs) const -{ - ACE_UNUSED_ARG (rhs); - return true; -} - -ACE_Configuration_Win32Registry::ACE_Configuration_Win32Registry (HKEY hKey) -{ - ACE_Section_Key_Win32 *temp; - - ACE_NEW (temp, ACE_Section_Key_Win32 (hKey)); - - root_ = ACE_Configuration_Section_Key (temp); -} - - -ACE_Configuration_Win32Registry::~ACE_Configuration_Win32Registry (void) -{ -} - -int -ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, - ACE_Configuration_Section_Key& result) -{ - if (validate_name (sub_section, 1)) - return -1; - - HKEY base_key; - if (load_key (base, base_key)) - return -1; - - int errnum; - HKEY result_key; - if ((errnum = ACE_TEXT_RegOpenKeyEx (base_key, - sub_section, - 0, - KEY_ALL_ACCESS, - &result_key)) != ERROR_SUCCESS) - { - if (!create) - { - errno = errnum; - return -1; - } - - if ((errnum = ACE_TEXT_RegCreateKeyEx (base_key, - sub_section, - 0, - 0, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - 0, - &result_key, -#if defined (__MINGW32__) - (PDWORD) 0 -#else - 0 -#endif /* __MINGW32__ */ - )) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - } - - ACE_Section_Key_Win32 *temp; - - ACE_NEW_RETURN (temp, ACE_Section_Key_Win32 (result_key), -1); - result = ACE_Configuration_Section_Key (temp); - return 0; -} - -int -ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* sub_section, - int recursive) -{ - if (validate_name (sub_section)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - if (recursive) - { - ACE_Configuration_Section_Key section; - if (open_section (key, sub_section, 0, section)) - return -1; - - HKEY sub_key; - if (load_key (section, sub_key)) - return -1; - - ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; - DWORD buffer_size = ACE_DEFAULT_BUFSIZE; - // Note we don't increment the index because the - // enumeration becomes invalid if we change the - // subkey, which we do when we delete it. By leaving - // it 0, we always delete the top entry - while (ACE_TEXT_RegEnumKeyEx (sub_key, - 0, - name_buffer, - &buffer_size, - 0, - 0, - 0, - 0) == ERROR_SUCCESS) - { - remove_section (section, name_buffer, 1); - buffer_size = ACE_DEFAULT_BUFSIZE; - } - } - - int errnum; -#if (ACE_HAS_WINNT4 != 0) - errnum = ACE_TEXT_RegDeleteKey (base_key, sub_section); - if (errnum != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } -#else - if (!recursive) - { - ACE_Configuration_Section_Key section; - if (open_section (key, sub_section, 0, section)) - return -1; - - HKEY sub_key; - if (load_key (section, sub_key)) - return -1; - - ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; - DWORD buffer_size = ACE_DEFAULT_BUFSIZE; - // Check for a an entry under the sub_key - if (ACE_TEXT_RegEnumKeyEx (sub_key, - 0, - name_buffer, - &buffer_size, - 0, - 0, - 0, - 0) == ERROR_SUCCESS) - { - errno = ERROR_DIR_NOT_EMPTY; - return -1; - } - } - errnum = ACE_TEXT_RegDeleteKey (base_key, sub_section); - if (errnum != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } -#endif - - return 0; -} - -int -ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type) -{ - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; - DWORD buffer_size = ACE_DEFAULT_BUFSIZE; - DWORD value_type; - - int rc = ACE_TEXT_RegEnumValue (base_key, - index, - name_buffer, - &buffer_size, - 0, - &value_type, - 0, - 0); - if (rc == ERROR_NO_MORE_ITEMS) - return 1; - else if (rc != ERROR_SUCCESS) - { - errno = rc; - return -1; - } - - name = name_buffer; - - switch (value_type) - { - case REG_BINARY: - type = BINARY; - break; - case REG_SZ: - type = STRING; - break; - case REG_DWORD: - type = INTEGER; - break; - default: - type = INVALID; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name) -{ - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; - DWORD buffer_size = ACE_DEFAULT_BUFSIZE; - int rc = ACE_TEXT_RegEnumKeyEx (base_key, - index, - name_buffer, - &buffer_size, - 0, - 0, - 0, - 0); - if (rc == ERROR_NO_MORE_ITEMS) - return 1; - else if (rc != ERROR_MORE_DATA && rc != ERROR_SUCCESS) - { - errno = rc; - return -1; - } - - name = name_buffer; - - return 0; -} - -int -ACE_Configuration_Win32Registry::set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - DWORD len = static_cast (value.length () + 1); - len *= sizeof (ACE_TCHAR); - if ((errnum = ACE_TEXT_RegSetValueEx (base_key, - t_name, - 0, - REG_SZ, - (BYTE *) value.fast_rep (), - len)) - != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - if ((errnum = ACE_TEXT_RegSetValueEx (base_key, - t_name, - 0, - REG_DWORD, - (BYTE *) &value, - sizeof (value))) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - if ((errnum = ACE_TEXT_RegSetValueEx (base_key, - t_name, - 0, - REG_BINARY, - (BYTE *) data, - static_cast (length))) - != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - // Get the size of the binary data from windows - int errnum; - DWORD buffer_length = 0; - DWORD type; - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - (BYTE *) 0, - &buffer_length)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - if (type != REG_SZ) - { - errno = ERROR_INVALID_DATATYPE; - return -1; - } - - ACE_TCHAR *temp = 0; - ACE_NEW_RETURN (temp, - ACE_TCHAR[buffer_length], - -1); - - ACE_Auto_Basic_Array_Ptr buffer (temp); - - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - (BYTE *) buffer.get (), - &buffer_length)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - value = buffer.get (); - return 0; -} - -int -ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - DWORD length = sizeof (value); - DWORD type; - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - (BYTE *) &value, - &length)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - if (type != REG_DWORD) - { - errno = ERROR_INVALID_DATATYPE; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::get_binary_value (const ACE_Configuration_Section_Key &key, - const ACE_TCHAR *name, - void *&data, - size_t &length) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - // Get the size of the binary data from windows - int errnum; - DWORD buffer_length = 0; - DWORD type; - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - (BYTE *) 0, - &buffer_length)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - if (type != REG_BINARY) - { - errno = ERROR_INVALID_DATATYPE; - return -1; - } - - length = buffer_length; - - ACE_NEW_RETURN (data, BYTE[length], -1); - - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - (BYTE *) data, - &buffer_length)) != ERROR_SUCCESS) - { - delete [] (BYTE *) data; - data = 0; - errno = errnum; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::find_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type_out) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - DWORD buffer_length=0; - DWORD type; - int result=ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - 0, - &buffer_length); - if (result != ERROR_SUCCESS) - { - errno = result; - return -1; - } - - switch (type) - { - case REG_SZ: - type_out = STRING; - break; - case REG_DWORD: - type_out = INTEGER; - break; - case REG_BINARY: - type_out = BINARY; - break; - default: - return -1; // unknown type - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - if ((errnum = ACE_TEXT_RegDeleteValue (base_key, t_name)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - return 0; -} - - -int -ACE_Configuration_Win32Registry::load_key (const ACE_Configuration_Section_Key& key, - HKEY& hKey) -{ - ACE_Section_Key_Win32* pKey = dynamic_cast (get_internal_key (key)); - if (!pKey) - return -1; - - hKey = pKey->hKey_; - return 0; -} - -HKEY -ACE_Configuration_Win32Registry::resolve_key (HKEY hKey, - const ACE_TCHAR* path, - int create) -{ - HKEY result = 0; - // Make a copy of hKey - int errnum; -#if defined (ACE_HAS_WINCE) - if ((errnum = RegOpenKeyEx (hKey, 0, 0, 0, &result)) != ERROR_SUCCESS) -#else - if ((errnum = RegOpenKey (hKey, 0, &result)) != ERROR_SUCCESS) -#endif // ACE_HAS_WINCE - { - errno = errnum; - return 0; - } - - // recurse through the path - ACE_TCHAR *temp_path = 0; - ACE_NEW_RETURN (temp_path, - ACE_TCHAR[ACE_OS::strlen (path) + 1], - 0); - ACE_Auto_Basic_Array_Ptr pData (temp_path); - ACE_OS::strcpy (pData.get (), path); - ACE_Tokenizer parser (pData.get ()); - parser.delimiter_replace ('\\', '\0'); - parser.delimiter_replace ('/', '\0'); - - for (ACE_TCHAR *temp = parser.next (); - temp != 0; - temp = parser.next ()) - { - // Open the key - HKEY subkey; - -#if defined (ACE_HAS_WINCE) - if ((errnum = ACE_TEXT_RegOpenKeyEx (result, - temp, - 0, - 0, - &subkey)) != ERROR_SUCCESS) -#else - if ((errnum = ACE_TEXT_RegOpenKey (result, - temp, - &subkey)) != ERROR_SUCCESS) -#endif // ACE_HAS_WINCE - { - // try creating it - if (!create || (errnum = ACE_TEXT_RegCreateKeyEx (result, - temp, - 0, - 0, - 0, - KEY_ALL_ACCESS, - 0, - &subkey, -#if defined (__MINGW32__) - (PDWORD) 0 -#else - 0 -#endif /* __MINGW32__ */ - )) !=ERROR_SUCCESS) - { - errno = errnum; - // error - ::RegCloseKey (result); - return 0; - } - } - // release our open key handle - ::RegCloseKey (result); - result = subkey; - } - - return result; -} - -#endif /* WIN_32 */ - -/////////////////////////////////////////////////////////////// - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void) - : type_ (ACE_Configuration::INVALID), - length_ (0) -{ - this->data_.ptr_ = 0; -} - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (ACE_TCHAR* string) - : type_ (ACE_Configuration::STRING), - length_ (0) -{ - this->data_.ptr_ = string; -} - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (u_int integer) - : type_ (ACE_Configuration::INTEGER), - length_ (0) -{ - this->data_.int_ = integer; -} - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void* data, size_t length) - : type_ (ACE_Configuration::BINARY), - length_ (length) -{ - this->data_.ptr_ = data; -} - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs) - : type_ (rhs.type_), - data_ (rhs.data_), - length_ (rhs.length_) -{ -} - -ACE_Configuration_Value_IntId::~ACE_Configuration_Value_IntId (void) -{ -} - -ACE_Configuration_Value_IntId& ACE_Configuration_Value_IntId::operator= (const ACE_Configuration_Value_IntId& rhs) -{ - if (this != &rhs) - { - type_ = rhs.type_; - data_ = rhs.data_; - length_ = rhs.length_; - } - return *this; -} - -void -ACE_Configuration_Value_IntId::free (ACE_Allocator *alloc) -{ - if (this->type_ == ACE_Configuration::STRING - || this->type_ == ACE_Configuration::BINARY) - alloc->free (data_.ptr_); - // Do nothing in other cases... -} - -ACE_Configuration_ExtId::ACE_Configuration_ExtId (void) - : name_ (0) -{ -} - -ACE_Configuration_ExtId::ACE_Configuration_ExtId (const ACE_TCHAR* name) - : name_ (name) -{ -} - -ACE_Configuration_ExtId::ACE_Configuration_ExtId (const ACE_Configuration_ExtId& rhs) - : name_ (rhs.name_) -{ -} - -ACE_Configuration_ExtId::~ACE_Configuration_ExtId (void) -{ -} - -ACE_Configuration_ExtId& ACE_Configuration_ExtId::operator= (const ACE_Configuration_ExtId& rhs) -{ - if (this != &rhs) - name_ = rhs.name_; - - return *this; -} - -bool -ACE_Configuration_ExtId::operator== (const ACE_Configuration_ExtId& rhs) const -{ - return (ACE_OS::strcasecmp (name_, rhs.name_) == 0); -} - -bool -ACE_Configuration_ExtId::operator!= (const ACE_Configuration_ExtId& rhs) const -{ - return (ACE_OS::strcasecmp (name_, rhs.name_) != 0); -} - -u_long -ACE_Configuration_ExtId::hash (void) const -{ - ACE_TString temp (name_, 0, 0); - return temp.hash (); -} - -const ACE_TCHAR* -ACE_Configuration_ExtId::name (void) -{ - return name_; -} - -void -ACE_Configuration_ExtId::free (ACE_Allocator *alloc) -{ - alloc->free ((void *) (name_)); -} - -/////////////////////////////////////////////////////////////////////// - -ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (void) - : value_hash_map_ (0), - section_hash_map_ (0) -{ -} - -ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map, SUBSECTION_MAP* section_hash_map) - : value_hash_map_ (value_hash_map), - section_hash_map_ (section_hash_map) -{ -} - -ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId& rhs) - : value_hash_map_ (rhs.value_hash_map_), - section_hash_map_ (rhs.section_hash_map_) -{ - -} - -ACE_Configuration_Section_IntId::~ACE_Configuration_Section_IntId () -{ -} - -ACE_Configuration_Section_IntId& -ACE_Configuration_Section_IntId::operator= (const ACE_Configuration_Section_IntId& rhs) -{ - if (this != &rhs) - { - value_hash_map_ = rhs.value_hash_map_; - section_hash_map_ = rhs.section_hash_map_; - } - return *this; -} - -void -ACE_Configuration_Section_IntId::free (ACE_Allocator *alloc) -{ - alloc->free ((void *) (value_hash_map_)); - alloc->free ((void *) (section_hash_map_)); -} - -ACE_Configuration_Section_Key_Heap::ACE_Configuration_Section_Key_Heap (const ACE_TCHAR* path) - : path_ (0), - value_iter_ (0), - section_iter_ (0) -{ - path_ = ACE_OS::strdup (path); -} - -ACE_Configuration_Section_Key_Heap::~ACE_Configuration_Section_Key_Heap () -{ - delete value_iter_; - delete section_iter_; - ACE_OS::free (path_); -} - -////////////////////////////////////////////////////////////////////////////// - -ACE_Configuration_Heap::ACE_Configuration_Heap (void) - : allocator_ (0), - index_ (0), - default_map_size_ (0) -{ - ACE_Configuration_Section_Key_Heap *temp = 0; - - ACE_NEW (temp, ACE_Configuration_Section_Key_Heap (ACE_LIB_TEXT (""))); - root_ = ACE_Configuration_Section_Key (temp); -} - -ACE_Configuration_Heap::~ACE_Configuration_Heap (void) -{ - if (allocator_) - allocator_->sync (); - - delete allocator_; -} - -int -ACE_Configuration_Heap::open (size_t default_map_size) -{ - default_map_size_ = default_map_size; - // Create the allocator with the appropriate options. - // The name used for the lock is the same as one used - // for the file. - ACE_NEW_RETURN (this->allocator_, - HEAP_ALLOCATOR (), - -1); - return create_index (); -} - - -int -ACE_Configuration_Heap::open (const ACE_TCHAR* file_name, - void* base_address, - size_t default_map_size) -{ - default_map_size_ = default_map_size; - - // Make sure that the file name is of the legal length. - if (ACE_OS::strlen (file_name) >= MAXNAMELEN + MAXPATHLEN) - { - errno = ENAMETOOLONG; - return -1; - } - - ACE_MMAP_Memory_Pool::OPTIONS options (base_address); - - // Create the allocator with the appropriate options. The name used - // for the lock is the same as one used for the file. - ACE_NEW_RETURN (this->allocator_, - PERSISTENT_ALLOCATOR (file_name, - file_name, - &options), - -1); - -#if !defined (ACE_LACKS_ACCESS) - // Now check if the backing store has been created successfully. - if (ACE_OS::access (file_name, F_OK) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("create_index\n")), - -1); -#endif /* ACE_LACKS_ACCESS */ - - return create_index (); -} - -int -ACE_Configuration_Heap::create_index (void) -{ - void *section_index = 0; - - // This is the easy case since if we find hash table in the - // memory-mapped file we know it's already initialized. - if (this->allocator_->find (ACE_CONFIG_SECTION_INDEX, section_index) == 0) - this->index_ = (SECTION_MAP *) section_index; - - // Create a new (because we've just created a new - // memory-mapped file). - else - { - size_t index_size = sizeof (SECTION_MAP); - section_index = this->allocator_->malloc (index_size); - - if (section_index == 0 - || create_index_helper (section_index) == -1 - || this->allocator_->bind (ACE_CONFIG_SECTION_INDEX, - section_index) == -1) - { - // Attempt to clean up. - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("create_index failed\n"))); - this->allocator_->remove (); - return -1; - } - // Add the root section - return new_section (ACE_LIB_TEXT (""), root_); - } - return 0; -} - -int -ACE_Configuration_Heap::create_index_helper (void *buffer) -{ - ACE_ASSERT (this->allocator_); - this->index_ = new (buffer) SECTION_MAP (this->allocator_); - return 0; -} - -int -ACE_Configuration_Heap::load_key (const ACE_Configuration_Section_Key& key, - ACE_TString& name) -{ - ACE_ASSERT (this->allocator_); - ACE_Configuration_Section_Key_Heap* pKey = - dynamic_cast (get_internal_key (key)); - - if (!pKey) - { - return -1; - } - - ACE_TString temp (pKey->path_, 0, 0); - name.assign_nocopy (temp); - return 0; -} - - -int -ACE_Configuration_Heap::add_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - ACE_Configuration_Section_Key& result) -{ - ACE_ASSERT (this->allocator_); - ACE_TString section; - if (load_key (base, section)) - return -1; - - // Find the base section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; - - // See if this section already exists - ACE_Configuration_ExtId SubSectionExtId (sub_section); - int ignored = 0; - - if (!IntId.section_hash_map_->find (SubSectionExtId, ignored, allocator_)) - { - // already exists! - errno = EEXIST; - return -1; - } - - // Create the new section name - // only prepend a separater if were not at the root - if (section.length ()) - section += ACE_LIB_TEXT ("\\"); - - section += sub_section; - - // Add it to the base section - ACE_TCHAR* pers_name = (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (sub_section) + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_name, sub_section); - ACE_Configuration_ExtId SSExtId (pers_name); - if (IntId.section_hash_map_->bind (SSExtId, ignored, allocator_)) - { - allocator_->free (pers_name); - return -1; - } - return (new_section (section, result)); -} - -int -ACE_Configuration_Heap::new_section (const ACE_TString& section, - ACE_Configuration_Section_Key& result) -{ - ACE_ASSERT (this->allocator_); - // Create a new section and add it to the global list - - // Allocate memory for items to be stored in the table. - size_t section_len = section.length () + 1; - ACE_TCHAR *ptr = (ACE_TCHAR*) this->allocator_->malloc (section_len * sizeof (ACE_TCHAR)); - - int return_value = -1; - - if (ptr == 0) - return -1; - else - { - // Populate memory with data. - ACE_OS::strcpy (ptr, section.fast_rep ()); - - void *value_hash_map = 0; - size_t map_size = sizeof (VALUE_MAP); - value_hash_map = this->allocator_->malloc (map_size); - - // If allocation failed ... - if (value_hash_map == 0) - return -1; - - // Initialize allocated hash map through placement new. - if (value_open_helper (default_map_size_, value_hash_map ) == -1) - { - this->allocator_->free (value_hash_map ); - return -1; - } - - // create the section map - void* section_hash_map = 0; - map_size = sizeof (SUBSECTION_MAP); - section_hash_map = this->allocator_->malloc (map_size); - - // If allocation failed - if (section_hash_map == 0) - return -1; - - // initialize allocated hash map through placement new - if (section_open_helper (default_map_size_, section_hash_map) == -1) - { - this->allocator_->free (value_hash_map ); - this->allocator_->free (section_hash_map); - return -1; - } - - ACE_Configuration_ExtId name (ptr); - ACE_Configuration_Section_IntId entry ((VALUE_MAP*) value_hash_map, - (SUBSECTION_MAP*) section_hash_map); - - // Do a normal bind. This will fail if there's already an - // entry with the same name. - return_value = this->index_->bind (name, entry, this->allocator_); - - if (return_value == 1) - { - // Entry already existed so bind failed. Free our dynamically - // allocated memory. - this->allocator_->free ((void *) ptr); - return return_value; - } - - if (return_value == -1) - // Free our dynamically allocated memory. - this->allocator_->free ((void *) ptr); - else - // If bind () succeed, it will automatically sync - // up the map manager entry. However, we must sync up our - // name/value memory. - this->allocator_->sync (ptr, section_len); - - } - - // set the result - ACE_Configuration_Section_Key_Heap *temp; - ACE_NEW_RETURN (temp, - ACE_Configuration_Section_Key_Heap (ptr), - -1); - result = ACE_Configuration_Section_Key (temp); - return return_value; -} - -int -ACE_Configuration_Heap::value_open_helper (size_t hash_table_size, - void *buffer) -{ - ACE_ASSERT (this->allocator_); - new (buffer) VALUE_MAP (hash_table_size, this->allocator_); - return 0; -} - -int -ACE_Configuration_Heap::section_open_helper (size_t hash_table_size, - void *buffer) -{ - ACE_ASSERT (this->allocator_); - new (buffer) SUBSECTION_MAP (hash_table_size, this->allocator_); - return 0; -} - -int -ACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, - ACE_Configuration_Section_Key& result) -{ - ACE_ASSERT (this->allocator_); - if (validate_name (sub_section, 1)) // 1 == allow_path - return -1; - - result = base; - - for (const ACE_TCHAR* separator; - (separator = ACE_OS::strchr (sub_section, ACE_LIB_TEXT ('\\'))) != 0; - ) - { - ACE_TString simple_section (sub_section, separator - sub_section); - int ret_val = - open_simple_section (result, simple_section.c_str (), create, result); - if (ret_val) - return ret_val; - sub_section = separator + 1; - } - - return open_simple_section (result, sub_section, create, result); -} - -int -ACE_Configuration_Heap::open_simple_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, - ACE_Configuration_Section_Key& result) -{ - ACE_TString section (0, 0, 0); - - if (load_key (base, section)) - { - return -1; - } - - // Only add the \\ if were not at the root - if (section.length ()) - { - section += ACE_LIB_TEXT ("\\"); - } - - section += sub_section; - - // resolve the section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - - if (index_->find (ExtId, IntId, allocator_)) - { - if (!create) - { - errno = ENOENT; - return -1; - } - - return add_section (base, sub_section, result); - } - - ACE_Configuration_Section_Key_Heap *temp; - ACE_NEW_RETURN (temp, - ACE_Configuration_Section_Key_Heap (section.fast_rep ()), - -1); - result = ACE_Configuration_Section_Key (temp); - return 0; -} - -int -ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* sub_section, - int recursive) -{ - ACE_ASSERT (this->allocator_); - if (validate_name (sub_section)) - return -1; - - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this key - ACE_Configuration_ExtId ParentExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId ParentIntId; - if (index_->find (ParentExtId, ParentIntId, allocator_)) - return -1;// no parent key - - // Find this subkey - if (section.length ()) - section += ACE_LIB_TEXT ("\\"); - - section += sub_section; - ACE_Configuration_ExtId SectionExtId (section.fast_rep ()); - SECTION_HASH::ENTRY* section_entry; - SECTION_HASH* hashmap = index_; - if (hashmap->find (SectionExtId, section_entry)) - return -1; - - if (recursive) - { - ACE_Configuration_Section_Key section; - if (open_section (key, sub_section, 0, section)) - return -1; - - int index = 0; - ACE_TString name; - while (!enumerate_sections (section, index, name)) - { - if (remove_section (section, name.fast_rep (), 1)) - return -1; - - ++index; - } - } - - // Now make sure we dont have any subkeys - if (section_entry->int_id_.section_hash_map_->current_size ()) - { - errno = ENOTEMPTY; - return -1; - } - - // Now remove subkey from parent key - ACE_Configuration_ExtId SubSExtId (sub_section); - SUBSECTION_HASH::ENTRY* subsection_entry; - if (((SUBSECTION_HASH*)ParentIntId.section_hash_map_)-> - find (SubSExtId, subsection_entry)) - return -1; - - if (ParentIntId.section_hash_map_->unbind (SubSExtId, allocator_)) - return -1; - - subsection_entry->ext_id_.free (allocator_); - - // Remember the pointers so we can free them after we unbind - ACE_Configuration_ExtId ExtIdToFree (section_entry->ext_id_); - ACE_Configuration_Section_IntId IntIdToFree (section_entry->int_id_); - - // iterate over all values and free memory - VALUE_HASH* value_hash_map = section_entry->int_id_.value_hash_map_; - VALUE_HASH::ITERATOR value_iter = value_hash_map->begin (); - while (!value_iter.done ()) - { - VALUE_HASH::ENTRY* value_entry = 0; - if (!value_iter.next (value_entry)) - return 1; - - value_entry->ext_id_.free (allocator_); - value_entry->int_id_.free (allocator_); - - value_iter.advance (); - } - - // remove it - if (index_->unbind (SectionExtId, allocator_)) - return -1; - - value_hash_map->close (); - section_entry->int_id_.section_hash_map_->close (allocator_); - - // Free the memory - ExtIdToFree.free (allocator_); - IntIdToFree.free (allocator_); - - return 0; -} - -int -ACE_Configuration_Heap::enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type) -{ - ACE_ASSERT (this->allocator_); - ACE_Configuration_Section_Key_Heap* pKey = - dynamic_cast (get_internal_key (key)); - if (!pKey) - return -1; - - name = pKey->path_; - - // resolve the section - ACE_Configuration_ExtId ExtId (pKey->path_); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; - - // Handle iterator resets - if (index == 0) - { - ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex>* hash_map = IntId.value_hash_map_; - delete pKey->value_iter_; - - ACE_NEW_RETURN (pKey->value_iter_, - VALUE_HASH::ITERATOR (hash_map->begin ()), - -1); - } - - // Get the next entry - ACE_Hash_Map_Entry* entry = 0; - - if (!pKey->value_iter_->next (entry)) - return 1; - - // Return the value of the iterator and advance it - name = entry->ext_id_.name_; - type = entry->int_id_.type_; - pKey->value_iter_->advance (); - - return 0; -} - -int -ACE_Configuration_Heap::enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name) -{ - ACE_ASSERT (this->allocator_); - // cast to a heap section key - ACE_Configuration_Section_Key_Heap* pKey = - dynamic_cast (get_internal_key (key)); - if (!pKey) - return -1; // not a heap key! - - // resolve the section - ACE_Configuration_ExtId ExtId (pKey->path_); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // unknown section - - // Handle iterator resets - if (index == 0) - { - if (pKey->section_iter_) - delete pKey->section_iter_; - - ACE_NEW_RETURN (pKey->section_iter_, - SUBSECTION_HASH::ITERATOR (IntId.section_hash_map_->begin ()), - -1); - } - - // Get the next entry - ACE_Hash_Map_Entry* entry = 0; - if (!pKey->section_iter_->next (entry)) - return 1; - - // Return the value of the iterator and advance it - pKey->section_iter_->advance (); - name = entry->ext_id_.name_; - - return 0; -} - -int -ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - ACE_TString section; - if (load_key (key, section)) - return -1; - - ACE_Configuration_ExtId section_ext (section.fast_rep ()); - ACE_Configuration_Section_IntId section_int; - if (index_->find (section_ext, section_int, allocator_)) - return -1; - - // Get the entry for this item (if it exists) - VALUE_HASH::ENTRY* entry; - ACE_Configuration_ExtId item_name (t_name); - if (section_int.value_hash_map_->VALUE_HASH::find (item_name, entry) == 0) - { - // found item, replace it - // Free the old value - entry->int_id_.free (allocator_); - // Allocate the new value in this heap - ACE_TCHAR* pers_value = - (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_value, value.fast_rep ()); - ACE_Configuration_Value_IntId new_value_int (pers_value); - entry->int_id_ = new_value_int; - } - else - { - // it doesn't exist, bind it - ACE_TCHAR* pers_name = - (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (t_name) + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_name, t_name); - ACE_TCHAR* pers_value = - (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_value, value.fast_rep ()); - ACE_Configuration_ExtId item_name (pers_name); - ACE_Configuration_Value_IntId item_value (pers_value); - if (section_int.value_hash_map_->bind (item_name, item_value, allocator_)) - { - allocator_->free (pers_value); - allocator_->free (pers_name); - return -1; - } - return 0; - } - - return 0; -} - -int -ACE_Configuration_Heap::set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId section_ext (section.fast_rep ()); - ACE_Configuration_Section_IntId section_int; - if (index_->find (section_ext, section_int, allocator_)) - return -1; // section does not exist - - // Get the entry for this item (if it exists) - VALUE_HASH::ENTRY* entry; - ACE_Configuration_ExtId item_name (t_name); - if (section_int.value_hash_map_->VALUE_HASH::find (item_name, entry) == 0) - { - // found item, replace it - ACE_Configuration_Value_IntId new_value_int (value); - entry->int_id_ = new_value_int; - } - else - { - // it doesn't exist, bind it - ACE_TCHAR* pers_name = - (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (t_name) + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_name, t_name); - ACE_Configuration_ExtId item_name (pers_name); - ACE_Configuration_Value_IntId item_value (value); - if (section_int.value_hash_map_->bind (item_name, item_value, allocator_)) - { - allocator_->free (pers_name); - return -1; - } - return 0; - } - - return 0; -} - -int -ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId section_ext (section.fast_rep ()); - ACE_Configuration_Section_IntId section_int; - if (index_->find (section_ext, section_int, allocator_)) - return -1; // section does not exist - - // Get the entry for this item (if it exists) - VALUE_HASH::ENTRY* entry; - ACE_Configuration_ExtId item_name (t_name); - if (section_int.value_hash_map_->VALUE_HASH::find (item_name, entry) == 0) - { - // found item, replace it - // Free the old value - entry->int_id_.free (allocator_); - // Allocate the new value in this heap - ACE_TCHAR* pers_value = (ACE_TCHAR *) allocator_->malloc (length); - ACE_OS::memcpy (pers_value, data, length); - ACE_Configuration_Value_IntId new_value_int (pers_value, length); - entry->int_id_ = new_value_int; - } - else - { - // it doesn't exist, bind it - ACE_TCHAR* pers_name = - (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (t_name) + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_name, t_name); - ACE_TCHAR* pers_value = (ACE_TCHAR *) allocator_->malloc (length); - ACE_OS::memcpy (pers_value, data, length); - ACE_Configuration_ExtId item_name (pers_name); - ACE_Configuration_Value_IntId item_value (pers_value, length); - if (section_int.value_hash_map_->bind (item_name, item_value, allocator_)) - { - allocator_->free (pers_value); - allocator_->free (pers_name); - return -1; - } - return 0; - } - - return 0; -} - -int -ACE_Configuration_Heap::get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // section does not exist - - // See if it exists first - ACE_Configuration_ExtId VExtId (t_name); - ACE_Configuration_Value_IntId VIntId; - if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_)) - return -1; // unknown value - - // Check type - if (VIntId.type_ != ACE_Configuration::STRING) - { - errno = ENOENT; - return -1; - } - - // everythings ok, return the data - value = static_cast (VIntId.data_.ptr_); - return 0; -} - -int -ACE_Configuration_Heap::get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value) -{ - ACE_ASSERT (this->allocator_); - - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section (0, 0, 0); - - if (this->load_key (key, section) != 0) - { - return -1; - } - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - - if (index_->find (ExtId, IntId, allocator_) != 0) - { - return -1; // section does not exist - } - - - // See if it exists first - ACE_Configuration_ExtId VExtId (t_name); - ACE_Configuration_Value_IntId VIntId; - - if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_) != 0) - { - return -1; // unknown value - } - - // Check type - if (VIntId.type_ != ACE_Configuration::INTEGER) - { - errno = ENOENT; - return -1; - } - - // Everythings ok, return the data - value = VIntId.data_.int_; - return 0; -} - -int -ACE_Configuration_Heap::get_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - void*& data, - size_t& length) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // section does not exist - - ACE_Configuration_ExtId VExtId (t_name); - ACE_Configuration_Value_IntId VIntId; - // See if it exists first - if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_)) - return -1; // unknown value - - // Check type - if (VIntId.type_ != ACE_Configuration::BINARY) - { - errno = ENOENT; - return -1; - } - - // Make a copy - ACE_NEW_RETURN (data, char[VIntId.length_], -1); - ACE_OS::memcpy (data, VIntId.data_.ptr_, VIntId.length_); - length = VIntId.length_; - return 0; -} - -int -ACE_Configuration_Heap::find_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type_out) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // section does not exist - - // Find it - ACE_Configuration_ExtId ValueExtId (t_name); - VALUE_HASH::ENTRY* value_entry; - if (((VALUE_HASH *) IntId.value_hash_map_)->find (ValueExtId, value_entry)) - return -1; // value does not exist - - type_out = value_entry->int_id_.type_; - return 0; -} - -int -ACE_Configuration_Heap::remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // section does not exist - - // Find it - ACE_Configuration_ExtId ValueExtId (t_name); - VALUE_HASH::ENTRY* value_entry; - if (((VALUE_HASH *) IntId.value_hash_map_)->find (ValueExtId, value_entry)) - return -1; - - // free it - value_entry->ext_id_.free (allocator_); - value_entry->int_id_.free (allocator_); - - // Unbind it - if (IntId.value_hash_map_->unbind (ValueExtId, allocator_)) - return -1; - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Configuration.h b/ace/Configuration.h deleted file mode 100644 index b1ca0f6a9d9..00000000000 --- a/ace/Configuration.h +++ /dev/null @@ -1,892 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Configuration.h - * - * $Id$ - * - * @author Chris Hafey - * - * The ACE configuration API provides a portable abstraction for - * program configuration similar to the Microsoft Windows registry. - * The API supports a tree based hierarchy of configuration sections. Each - * section contains other sections or values. Values may contain string, - * unsigned integer and binary data. - * - * @note These classes are not thread safe, if multiple threads use these - * classes, you are responsible for serializing access. - * - * For examples of using this class, see: - * -# The test code in ACE_wrappers/test - * -# wxConfigViewer, a Windows like Registry Editor for ACE_Configuration - * -# TAO's IFR, it makes extensive use of ACE_Configuration - * - * @todo Templatize this class with an ACE_LOCK to provide thread safety - * - */ -//============================================================================= - -#ifndef ACE_CONFIGURATION_H -#define ACE_CONFIGURATION_H -#include /**/ "ace/pre.h" - -#include "ace/SStringfwd.h" -#include "ace/Hash_Map_With_Allocator_T.h" -#include "ace/Malloc_T.h" -#include "ace/MMAP_Memory_Pool.h" -#include "ace/Local_Memory_Pool.h" -#include "ace/Synch_Traits.h" - - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// configurable parameters - -#if !defined (ACE_CONFIG_SECTION_INDEX) -# define ACE_CONFIG_SECTION_INDEX "Config_Section_Index" -#endif /* ! ACE_CONFIG_SECTION_INDEX */ - -#if !defined (ACE_DEFAULT_CONFIG_SECTION_SIZE) -#define ACE_DEFAULT_CONFIG_SECTION_SIZE 16 -#endif /* ACE_DEFAULT_CONFIG_SECTION_SIZE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Section_Key_Internal - * - * @internal - * - * @brief A base class for internal handles to section keys for - * configuration implementations - * - * Implementations subclass this base class to represent a - * section key. - * - */ -class ACE_Export ACE_Section_Key_Internal -{ -public: - /// Virtual destructor, make sure descendants are virtual! - virtual ~ACE_Section_Key_Internal (void); - - /// Increment reference count - virtual int add_ref (void); - - /// Decrement reference count. Will delete this if count gets to 0 - virtual int dec_ref (void); -protected: - ACE_Section_Key_Internal (void); - ACE_Section_Key_Internal (const ACE_Section_Key_Internal& rhs); - ACE_Section_Key_Internal& operator= (ACE_Section_Key_Internal& rhs); - - u_int ref_count_; -}; - -/** - * @class ACE_Configuration_Section_Key - * - * @brief Reference counted wrapper for ACE_Section_Key_Internal. - * - * Reference counted wrapper class for the abstract internal - * section key. A user gets one of these to represent a section - * in the configuration database. - */ -class ACE_Export ACE_Configuration_Section_Key -{ - friend class ACE_Configuration; -public: - /// Default constructor. - ACE_Configuration_Section_Key (void); - - /// Constructor that initializes to a pointer to a concrete internal key. - /** - * @param key The section key to reference. Calls add_ref() with @a key. - */ - explicit ACE_Configuration_Section_Key (ACE_Section_Key_Internal *key); - - /// Copy constructor, increments the reference count on the key. - ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key &rhs); - - /// Destructor, decrements reference count on the referenced key. - ~ACE_Configuration_Section_Key (void); - - /// Assignment operator, increments reference count for this object - /// and decrements it on @a rhs. - ACE_Configuration_Section_Key & - operator= (const ACE_Configuration_Section_Key &rhs); -private: - ACE_Section_Key_Internal *key_; -}; - -/** - * @class ACE_Configuration - * - * @internal - * - * @brief Base class for configuration databases - * - * This class provides an interface for configuration databases. A concrete - * class is required that implements the interface. - * - * @sa ACE_Configuration_Heap - * @sa ACE_Configuration_Win32Registry - */ -class ACE_Export ACE_Configuration -{ -public: - /// Enumeration for the various types of values we can store. - enum VALUETYPE - { - STRING, - INTEGER, - BINARY, - INVALID - }; - - /// Destructor - virtual ~ACE_Configuration (void); - - /// Obtain a reference to the root section of this configuration. - /* - * @return Reference to the configuration's root section. Note that - * it is a const reference. - */ - virtual const ACE_Configuration_Section_Key& root_section (void) const; - - /** - * Opens a named section in an existing section. - * - * @param base Existing section in which to open the named section. - * @param sub_section Name of the section to open. - * @param create If zero, the named section must exist. If non-zero, - * the named section will be created if it does not exist. - * @param result Reference; receives the section key for the new - * section. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int open_section (const ACE_Configuration_Section_Key &base, - const ACE_TCHAR *sub_section, - int create, - ACE_Configuration_Section_Key& result) = 0; - - /// Removes a named section. - /** - * @param key Section key to remove the named section from. - * @param sub_section Name of the section to remove. - * @param recursive If non zero, any subkeys below @a sub_section are - * removed as well. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int remove_section (const ACE_Configuration_Section_Key &key, - const ACE_TCHAR *sub_section, - int recursive) = 0; - - /** - * Enumerates through the values in a section. - * - * @param key Section key to iterate through. - * @param index Iteration position. Must be zero on the first call to - * iterate through @a key. Increment @a index by one on each - * successive call to this method. - * @param name Receives the value's name. - * @param type Receives the value's data type. - * - * @note You may not delete or add values while enumerating. If the - * section is modified during enumeration, results are undefined; - * you must restart the enumeration from index 0. - * - * @retval 0 for success, @a name and @a type are valid. - * @retval 1 there are no more values in the section. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type) = 0; - - /** - * Enumerates through the subsections in a section. - * - * @param key Section key to iterate through. - * @param index Iteration position. Must be zero on the first call to - * iterate through @a key. Increment @a index by one on each - * successive call to this method. - * @param name Receives the subsection's name. - * - * @note You may not modify the @a key section while enumerating. If the - * section is modified during enumeration, results are undefined; - * you must restart the enumeration from index 0. - * - * @retval 0 for success, @a name has a valid name. - * @retval 1 there are no more subsections in the section. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, ACE_TString& name) = 0; - - /// Sets a string-typed value. - /** - * @param key Configuration section to set the value in. - * @param name Name of the configuration value to set. If a value with - * the specified name exists, it is replaced. - * @param value The string to set the configuration value to. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value) = 0; - - /// Sets a integer-typed value. - /** - * @param key Configuration section to set the value in. - * @param name Name of the configuration value to set. If a value with - * the specified name exists, it is replaced. - * @param value The integer to set the configuration value to. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value) = 0; - - /// Sets a binary-typed value. - /** - * @param key Configuration section to set the value in. - * @param name Name of the configuration value to set. If a value with - * the specified name exists, it is replaced. - * @param data Pointer to the binary data for the value. - * @param length Number of bytes for the new value. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length) = 0; - - /// Gets a string-typed value. - /** - * @param key Configuration section to get the value from. - * @param name Name of the configuration value to get. - * @param value Receives the configuration value if it exists and - * has type STRING. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value) = 0; - - /// Gets an integer-typed value. - /** - * @param key Configuration section to get the value from. - * @param name Name of the configuration value to get. - * @param value Receives the configuration value if it exists and - * has type INTEGER. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value) = 0; - - /// Gets a binary-typed value. - /** - * @param key Configuration section to get the value from. - * @param name Name of the configuration value to get. - * @param data Receives a pointer to memory holding the binary data - * for the value. This method allocates the memory pointed - * to using operator new[]. The caller is responsible for - * freeing the memory using operator delete[]. - * @param length Receives the number of bytes in the value. - * - * @retval 0 for success; caller is responsible for freeing the - * returned memory. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int get_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - void*& data, - size_t& length) = 0; - - /** - * Retrieves the type of a named configuration value. - * - * @param key Configuration section to look up the name in. - * @param name Name of the configuration value to get the type of. - * @param type Receives the data type of the named value, if it exists. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int find_value(const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type) = 0; - - /// Removes a named value. - /** - * @param key Configuration section to remove the named value from. - * @param name Name of the configuration value to remove. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name) = 0; - - /** - * Expands to from . If create is true, - * the subsections are created. Returns 0 on success, non zero on - * error The path consists of sections separated by the backslash - * '\' or forward slash '/'. - * Returns 0 on success, -1 if is valid. must be < 255 characters - * and not contain the path separator '\', brackets [] or = (maybe - * just restrict to alphanumeric?) returns non zero if name is not - * valid. The path separator is allowed, except for the first character, - * if is true. - */ - int validate_name (const ACE_TCHAR* name, int allow_path = 0); - - /** - * Test to see if is valid. The default value for a key can be - * unnamed, which means either is == 0 or == '\0` is - * valid. Otherwise, it calls validate_name() to test for the - * same rules that apply to keys. - */ - int validate_value_name (const ACE_TCHAR* name); - - // Not used - ACE_Configuration (const ACE_Configuration& rhs); - ACE_Configuration& operator= (const ACE_Configuration& rhs); - - - ACE_Configuration_Section_Key root_; -}; - -#if defined (ACE_WIN32) - -/** - * @class ACE_Section_Key_Win32 - * - * @brief The Win32 registry implementation of an internal section key. - * - * Holds the HKEY for a section (registry key). - */ -class ACE_Export ACE_Section_Key_Win32 : public ACE_Section_Key_Internal -{ -public: - /// Constructor based on an HKEY - ACE_Section_Key_Win32 (HKEY hKey); - - HKEY hKey_; - -protected: - /// Destructor - invokes - virtual ~ACE_Section_Key_Win32 (void); - - // Not used - ACE_Section_Key_Win32 (const ACE_Section_Key_Win32& rhs); - ACE_Section_Key_Win32& operator= (const ACE_Section_Key_Win32& rhs); -}; - -/** - * @class ACE_Configuration_Win32Registry - * - * @brief The win32 registry implementation of a configuration database - * - * The win32 implementation basically makes calls through to the - * registry functions. The API is very similar so very little - * work must be done - */ -class ACE_Export ACE_Configuration_Win32Registry : public ACE_Configuration -{ -public: - - /** - * Constructor for registry configuration database. hKey is the - * base registry key to attach to. This class takes ownership of - * hKey, it will invoke on it upon destruction. - */ - explicit ACE_Configuration_Win32Registry (HKEY hKey); - - /// Destructor - virtual ~ACE_Configuration_Win32Registry (void); - - virtual int open_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, - ACE_Configuration_Section_Key& result); - - virtual int remove_section (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* sub_section, - int recursive); - - virtual int enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type); - - virtual int enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name); - - virtual int set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value); - - virtual int set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value); - - virtual int set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length); - - virtual int get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value); - - virtual int get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value); - - virtual int get_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - void*& data, - size_t& length); - - virtual int find_value(const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type); - - /// Removes the the value @a name from @a key. returns non zero on error - virtual int remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name); - - /** - * This method traverses through . It is useful when - * you want the HKEY for a specific registry key, especially when - * initializing this implementation. Caller is responsible for - * closeing this key when it is no longer used. If create is 1 - * (default) the keys are create if they don't already exist. - * Returns 0 on error - */ - static HKEY resolve_key (HKEY hKey, - const ACE_TCHAR* path, - int create = 1); - virtual bool operator== (const ACE_Configuration_Win32Registry &rhs) const; - virtual bool operator!= (const ACE_Configuration_Win32Registry &rhs) const; - -protected: - - /// Gets the HKEY for a configuration section - int load_key (const ACE_Configuration_Section_Key& key, HKEY& hKey); - - // Not used - ACE_Configuration_Win32Registry (void); - ACE_Configuration_Win32Registry (const ACE_Configuration_Win32Registry& rhs); - ACE_Configuration_Win32Registry& operator= (const ACE_Configuration_Win32Registry& rhs); -}; -#endif /* ACE_WIN32 */ - -// ACE_Allocator version - -typedef ACE_Allocator_Adapter > - PERSISTENT_ALLOCATOR; -typedef ACE_Allocator_Adapter > - HEAP_ALLOCATOR; - -/** - * @class ACE_Configuration_ExtId - * - * @brief External ID for the section and value hash - * - * Contains a pointer to the section or value name. - */ -class ACE_Export ACE_Configuration_ExtId -{ -public: - /// Defeault ctor - ACE_Configuration_ExtId (void); - - /// Named constructor - explicit ACE_Configuration_ExtId (const ACE_TCHAR* name); - - /// Copy ctor - ACE_Configuration_ExtId (const ACE_Configuration_ExtId& rhs); - - /// destructor - ~ACE_Configuration_ExtId (void); - - /// Assignment operator - ACE_Configuration_ExtId& operator= (const ACE_Configuration_ExtId& rhs); - - /// Equality comparison operator (must match name_). - bool operator== (const ACE_Configuration_ExtId &rhs) const; - - /// Inequality comparison operator. - bool operator!= (const ACE_Configuration_ExtId &rhs) const; - - /// Frees the name of the value. needed since we don't know the - /// allocator name_ was created in - void free (ACE_Allocator *alloc); - - /// function is required in order for this class to be usable by - /// ACE_Hash_Map_Manager. - u_long hash (void) const; - - // = Data members. - - const ACE_TCHAR * name_; - - // Accessors - const ACE_TCHAR *name (void); -}; - -typedef ACE_Hash_Map_With_Allocator - SUBSECTION_MAP; -typedef ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex> - SUBSECTION_HASH; - -/// @deprecated Deprecated typedef. Use the SUBSECTION_HASH::ENTRY trait instead. -typedef SUBSECTION_HASH::ENTRY SUBSECTION_ENTRY; - -/** - * @class ACE_Configuration_Value_IntId - * - * @brief The section hash table internal value class - * - * This class is present as the internal portion of a section's - * value hash table It may store string, integer or binary data. - */ -class ACE_Export ACE_Configuration_Value_IntId -{ -public: - /// Default constructor - ACE_Configuration_Value_IntId (void); - - /// String constructor, takes ownership of string - explicit ACE_Configuration_Value_IntId (ACE_TCHAR* string); - - /// Integer constructor - explicit ACE_Configuration_Value_IntId (u_int integer); - - /// Binary constructor, takes ownership of data - ACE_Configuration_Value_IntId (void* data, size_t length); - - /// Copy ctor - ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs); - - /// Destructor - ~ACE_Configuration_Value_IntId (void); - - /// Assignment operator - ACE_Configuration_Value_IntId& operator= ( - const ACE_Configuration_Value_IntId& rhs); - - void free (ACE_Allocator *alloc); - - // = Data members. - - /** - * Points to the string value or binary data or IS the integer - * Length is only used when type_ == BINARY - */ - ACE_Configuration::VALUETYPE type_; - union { - void * ptr_; - u_int int_; - } data_; - size_t length_; -}; - -typedef ACE_Hash_Map_With_Allocator - VALUE_MAP; -typedef ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex> - VALUE_HASH; - -// Deprecated typedef. Use the VALUE_HASH::ENTRY trait instead. -typedef VALUE_HASH::ENTRY VALUE_ENTRY; - -/** - * @class ACE_Configuration_Section_IntId - * - * @brief The internal ID for a section hash table - * - * Contains a hash table containing value name/values - */ -class ACE_Export ACE_Configuration_Section_IntId -{ -public: - /// Default ctor - ACE_Configuration_Section_IntId (void); - - /// Named ctor - ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map, - SUBSECTION_MAP* section_hash_map); - - /// Copy ctor - ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId& rhs); - - /// Destructor - ~ACE_Configuration_Section_IntId (void); - - /// Assignment operator - ACE_Configuration_Section_IntId& operator= ( - const ACE_Configuration_Section_IntId& rhs); - - /// Frees the hash table and all its values - void free (ACE_Allocator *alloc); - - // = Data Members. - VALUE_MAP* value_hash_map_; - - SUBSECTION_MAP* section_hash_map_; -}; - -typedef ACE_Hash_Map_With_Allocator - SECTION_MAP; -typedef ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex> - SECTION_HASH; - -// Deprecated typedef. Use the SECTION_HASH::ENTRY trait instead. -typedef SECTION_HASH::ENTRY SECTION_ENTRY; - -/** - * @class ACE_Configuration_Section_Key_Heap - * - * @brief Internal section key class for heap based configuration - * database. - * - * Contains a value iterator and full path name of section. - */ -class ACE_Export ACE_Configuration_Section_Key_Heap - : public ACE_Section_Key_Internal -{ -public: - /// Constructor based on the full path of the section - ACE_Configuration_Section_Key_Heap (const ACE_TCHAR* path); - - /// The path itself - ACE_TCHAR* path_; - - /// The value iterator - VALUE_HASH::ITERATOR* value_iter_; - - /// The sub section iterator - SUBSECTION_HASH::ITERATOR* section_iter_; -protected: - /// Destructor - will delete the iterators - virtual ~ACE_Configuration_Section_Key_Heap (void); - - // Not used - ACE_Configuration_Section_Key_Heap (const ACE_Configuration_Section_Key_Heap& rhs); - ACE_Configuration_Section_Key_Heap& operator= (const ACE_Configuration_Section_Key_Heap& rhs); -}; - -/** - * @class ACE_Configuration_Heap - * - * @brief The concrete implementation of a allocator based - * configuration database - * - * This class uses ACE's Allocators to manage a memory - * representation of a configuraiton database. A persistent heap - * may be used to store configurations persistently - * - * @note Before using this class you must call one of the open methods. - * - * @todo - * - Need to investigate what happens if memory mapped file gets mapped to - * a location different than it was created with. - */ -class ACE_Export ACE_Configuration_Heap : public ACE_Configuration -{ -public: - - /// Default ctor - ACE_Configuration_Heap (void); - - /// Destructor - virtual ~ACE_Configuration_Heap (void); - - /// Opens a configuration based on a file name - int open (const ACE_TCHAR* file_name, - void* base_address = ACE_DEFAULT_BASE_ADDR, - size_t default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE); - - /// Opens a heap based configuration - int open (size_t default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE); - - virtual int open_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, ACE_Configuration_Section_Key& result); - - virtual int remove_section (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* sub_section, - int recursive); - - virtual int enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type); - - virtual int enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name); - - virtual int set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value); - - virtual int set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value); - - virtual int set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length); - - virtual int get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value); - - virtual int get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value); - - virtual int get_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - void* &data, - size_t &length); - - virtual int find_value(const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type); - - /// Removes the the value from . returns non zero on error - virtual int remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name); - -private: - /// may not contain path separators - int open_simple_section (const ACE_Configuration_Section_Key &base, - const ACE_TCHAR *sub_section, - int create, ACE_Configuration_Section_Key &result); - /// Adds a new section - int add_section (const ACE_Configuration_Section_Key &base, - const ACE_TCHAR *sub_section, - ACE_Configuration_Section_Key &result); - - /// Helper for the method. - int create_index (void); - - /// Helper for create_index() method: places hash table into an - /// allocated space. - int create_index_helper (void *buffer); - - int value_open_helper (size_t hash_table_size, void *buffer); - - int section_open_helper (size_t hash_table_size, void *buffer); - - int load_key (const ACE_Configuration_Section_Key& key, ACE_TString& name); - - int new_section (const ACE_TString& section, - ACE_Configuration_Section_Key& result); - - ACE_Configuration_Heap (const ACE_Configuration_Heap& rhs); - ACE_Configuration_Heap& operator= (const ACE_Configuration_Heap& rhs); - - ACE_Allocator *allocator_; - SECTION_MAP *index_; - size_t default_map_size_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIGURATION_H */ diff --git a/ace/Configuration_Import_Export.cpp b/ace/Configuration_Import_Export.cpp deleted file mode 100644 index d3599af834f..00000000000 --- a/ace/Configuration_Import_Export.cpp +++ /dev/null @@ -1,650 +0,0 @@ -// $Id$ - -#include "ace/Configuration_Import_Export.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_ctype.h" -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Config_ImpExp_Base::ACE_Config_ImpExp_Base (ACE_Configuration& config) - : config_ (config) -{ -} - -ACE_Config_ImpExp_Base::~ACE_Config_ImpExp_Base (void) -{ -} - -ACE_Registry_ImpExp::ACE_Registry_ImpExp (ACE_Configuration& config) - : ACE_Config_ImpExp_Base (config) -{ -} - -ACE_Registry_ImpExp::~ACE_Registry_ImpExp (void) -{ -} - -// Imports the configuration database from filename. -// No existing data is removed. -int -ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename) -{ - if (0 == filename) - { - errno = EINVAL; - return -1; - } - FILE* in = ACE_OS::fopen (filename, ACE_LIB_TEXT ("r")); - if (!in) - return -1; - - u_int buffer_size = 4096; - u_int read_pos = 0; - ACE_TCHAR *buffer; - ACE_NEW_RETURN (buffer, ACE_TCHAR[buffer_size], -1); - ACE_Configuration_Section_Key section; - ACE_TCHAR *end = 0; - - while (ACE_OS::fgets (buffer+read_pos, buffer_size - read_pos, in)) - { - // Check if we got all the line. - end = ACE_OS::strrchr (buffer + read_pos, - ACE_LIB_TEXT ('\n')); // look for end of line - if (!end) // we havn't reach the end of the line yet - { - // allocate a new buffer - double size the previous one - ACE_TCHAR *temp_buffer; - ACE_NEW_RETURN (temp_buffer, ACE_TCHAR[buffer_size * 2], -1); - - // copy the beginnning of the line - ACE_OS::memcpy (temp_buffer, buffer, buffer_size); - read_pos = buffer_size - 1; - buffer_size *= 2; - delete [] buffer; - buffer = temp_buffer; - continue; - } - read_pos = 0; - - // Check for a comment - if (buffer[0] == ACE_LIB_TEXT (';') || buffer[0] == ACE_LIB_TEXT ('#')) - continue; - - if (buffer[0] == ACE_LIB_TEXT ('[')) - { - // We have a new section here, strip out the section name - end = ACE_OS::strrchr (buffer, ACE_LIB_TEXT (']')); - if (!end) - { - ACE_OS::fclose (in); - delete [] buffer; - return -3; - } - *end = 0; - - if (config_.expand_path (config_.root_section (), buffer + 1, section, 1)) - { - ACE_OS::fclose (in); - delete [] buffer; - return -3; - } - continue; - } // end if firs char is a [ - - if (buffer[0] == ACE_LIB_TEXT ('"')) - { - // we have a value - end = ACE_OS::strchr (buffer+1, '"'); - if (!end) // no closing quote, not a value so just skip it - continue; - - // null terminate the name - *end = 0; - ACE_TCHAR* name = buffer + 1; - end+=2; - // determine the type - if (*end == '\"') - { - // string type - // truncate trailing " - ++end; - ACE_TCHAR* trailing = ACE_OS::strrchr (end, '"'); - if (trailing) - *trailing = 0; - if (config_.set_string_value (section, name, end)) - { - ACE_OS::fclose (in); - delete [] buffer; - return -4; - } - } - else if (ACE_OS::strncmp (end, ACE_LIB_TEXT ("dword:"), 6) == 0) - { - // number type - ACE_TCHAR* endptr = 0; - unsigned long value = ACE_OS::strtoul (end + 6, &endptr, 16); - if (config_.set_integer_value (section, name, value)) - { - ACE_OS::fclose (in); - delete [] buffer; - return -4; - } - } - else if (ACE_OS::strncmp (end, ACE_LIB_TEXT ("hex:"), 4) == 0) - { - // binary type - size_t string_length = ACE_OS::strlen (end + 4); - // divide by 3 to get the actual buffer length - size_t length = string_length / 3; - size_t remaining = length; - u_char* data = 0; - ACE_NEW_RETURN (data, - u_char[length], - -1); - u_char* out = data; - ACE_TCHAR* inb = end + 4; - ACE_TCHAR* endptr = 0; - while (remaining) - { - u_char charin = (u_char) ACE_OS::strtoul (inb, &endptr, 16); - *out = charin; - ++out; - --remaining; - inb += 3; - } - if (config_.set_binary_value (section, name, data, length)) - { - ACE_OS::fclose (in); - delete [] data; - delete [] buffer; - return -4; - } - else - delete [] data; - } - else - { - // invalid type, ignore - continue; - } - }// end if first char is a " - else - { - // if the first character is not a ", [, ;, or # we may be - // processing a file in the old format. - // Try and process the line as such and if it fails, - // return an error - int rc = process_previous_line_format (buffer, section); - if (rc != 0) - { - ACE_OS::fclose (in); - delete [] buffer; - return rc; - } - } // end if maybe old format - } // end while fgets - - if (ferror (in)) - { - ACE_OS::fclose (in); - delete [] buffer; - return -1; - } - - ACE_OS::fclose (in); - delete [] buffer; - return 0; -} - -// This method exports the entire configuration database to . -// Once the file is opened this method calls 'export_section' passing -// the root section. -int -ACE_Registry_ImpExp::export_config (const ACE_TCHAR* filename) -{ - if (0 == filename) - { - errno = EINVAL; - return -1; - } - int result = -1; - - FILE* out = ACE_OS::fopen (filename, ACE_LIB_TEXT ("w")); - if (out) - { - result = this->export_section (config_.root_section (), - ACE_LIB_TEXT (""), - out); - ACE_OS::fclose (out); - } - return result; -} - -// Method provided by derived classes in order to write one section -// to the file specified. Called by export_config when exporting -// the entire configuration object. - -int -ACE_Registry_ImpExp::export_section (const ACE_Configuration_Section_Key& section, - const ACE_TString& path, - FILE* out) -{ - // don't export the root - if (path.length ()) - { - // Write out the section header - ACE_TString header = ACE_LIB_TEXT ("["); - header += path; - header += ACE_LIB_TEXT ("]"); - header += ACE_LIB_TEXT (" \n"); - if (ACE_OS::fputs (header.fast_rep (), out) < 0) - return -1; - // Write out each value - int index = 0; - ACE_TString name; - ACE_Configuration::VALUETYPE type; - ACE_TString line; - ACE_TCHAR int_value[32]; - ACE_TCHAR bin_value[3]; - void* binary_data; - size_t binary_length; - ACE_TString string_value; - while (!config_.enumerate_values (section, index, name, type)) - { - line = ACE_LIB_TEXT ("\"") + name + ACE_LIB_TEXT ("\"="); - switch (type) - { - case ACE_Configuration::INTEGER: - { - u_int value; - if (config_.get_integer_value (section, name.fast_rep (), value)) - return -2; - ACE_OS::sprintf (int_value, ACE_LIB_TEXT ("%08x"), value); - line += ACE_LIB_TEXT ("dword:"); - line += int_value; - break; - } - case ACE_Configuration::STRING: - { - if (config_.get_string_value (section, - name.fast_rep (), - string_value)) - return -2; - line += ACE_LIB_TEXT ("\""); - line += string_value + ACE_LIB_TEXT ("\""); - break; - } -#ifdef _WIN32 - case ACE_Configuration::INVALID: - break; // JDO added break. Otherwise INVALID is processed - // like BINARY. If that's correct, please remove the - // break and these comments -#endif - case ACE_Configuration::BINARY: - { - // not supported yet - maybe use BASE64 codeing? - if (config_.get_binary_value (section, - name.fast_rep (), - binary_data, - binary_length)) - return -2; - line += ACE_LIB_TEXT ("hex:"); - unsigned char* ptr = (unsigned char*)binary_data; - while (binary_length) - { - if (ptr != binary_data) - { - line += ACE_LIB_TEXT (","); - } - ACE_OS::sprintf (bin_value, ACE_LIB_TEXT ("%02x"), *ptr); - line += bin_value; - --binary_length; - ++ptr; - } - delete [] (char*) binary_data; - break; - } - default: - return -3; - } - line += ACE_LIB_TEXT ("\n"); - if (ACE_OS::fputs (line.fast_rep (), out) < 0) - return -4; - index++; - } - } - // Export all sub sections - int index = 0; - ACE_TString name; - ACE_Configuration_Section_Key sub_key; - ACE_TString sub_section; - while (!config_.enumerate_sections (section, index, name)) - { - ACE_TString sub_section (path); - if (path.length ()) - sub_section += ACE_LIB_TEXT ("\\"); - sub_section += name; - if (config_.open_section (section, name.fast_rep (), 0, sub_key)) - return -5; - if (export_section (sub_key, sub_section.fast_rep (), out)) - return -6; - index++; - } - return 0; -} - -// -// This method read the line format origionally used in ACE 5.1 -// -int -ACE_Registry_ImpExp::process_previous_line_format (ACE_TCHAR* buffer, - ACE_Configuration_Section_Key& section) -{ - // Chop any cr/lf at the end of the line. - ACE_TCHAR *endp = ACE_OS::strpbrk (buffer, ACE_LIB_TEXT ("\r\n")); - if (endp != 0) - *endp = '\0'; - - // assume this is a value, read in the value name - ACE_TCHAR* end = ACE_OS::strchr (buffer, '='); - if (end) // no =, not a value so just skip it - { - // null terminate the name - *end = 0; - end++; - // determine the type - if (*end == '\"') - { - // string type - if(config_.set_string_value (section, buffer, end + 1)) - return -4; - } - else if (*end == '#') - { - // number type - u_int value = ACE_OS::atoi (end + 1); - if (config_.set_integer_value (section, buffer, value)) - return -4; - } - } - return 0; -} // end read_previous_line_format - - -ACE_Ini_ImpExp::ACE_Ini_ImpExp (ACE_Configuration& config) - : ACE_Config_ImpExp_Base (config) -{ -} - -ACE_Ini_ImpExp::~ACE_Ini_ImpExp (void) -{ -} - -// Method to read file and populate object. -int -ACE_Ini_ImpExp::import_config (const ACE_TCHAR* filename) -{ - if (0 == filename) - { - errno = EINVAL; - return -1; - } - FILE* in = ACE_OS::fopen (filename, ACE_LIB_TEXT ("r")); - if (!in) - return -1; - - // @@ Make this a dynamic size! - ACE_TCHAR buffer[4096]; - ACE_Configuration_Section_Key section; - while (ACE_OS::fgets (buffer, sizeof buffer, in)) - { - ACE_TCHAR *line = this->squish (buffer); - // Check for a comment and blank line - if (line[0] == ACE_LIB_TEXT (';') || - line[0] == ACE_LIB_TEXT ('#') || - line[0] == '\0') - continue; - - if (line[0] == ACE_LIB_TEXT ('[')) - { - // We have a new section here, strip out the section name - ACE_TCHAR* end = ACE_OS::strrchr (line, ACE_LIB_TEXT (']')); - if (!end) - { - ACE_OS::fclose (in); - return -3; - } - *end = 0; - - if (config_.expand_path (config_.root_section (), - line + 1, - section, - 1)) - { - ACE_OS::fclose (in); - return -3; - } - - continue; - } - - // We have a line; name ends at equal sign. - ACE_TCHAR *end = ACE_OS::strchr (line, ACE_LIB_TEXT ('=')); - if (end == 0) // No '=' - { - ACE_OS::fclose (in); - return -3; - } - *end++ = '\0'; - ACE_TCHAR *name = this->squish (line); -#if 0 - if (ACE_OS::strlen (name) == 0) // No name; just an '=' - { - ACE_OS::fclose (in); - return -3; - } -#endif - // Now find the start of the value - ACE_TCHAR *value = this->squish (end); - size_t value_len = ACE_OS::strlen (value); - if (value_len > 0) - { - // ACE 5.2 (and maybe earlier) exported strings may be enclosed - // in quotes. If string is quote-delimited, strip the quotes. - // Newer exported files don't have quote delimiters. - if (value[0] == ACE_LIB_TEXT ('"') && - value[value_len - 1] == ACE_LIB_TEXT ('"')) - { - // Strip quotes off both ends. - value[value_len - 1] = '\0'; - value++; - } - } - - if (config_.set_string_value (section, name, value)) - { - ACE_OS::fclose (in); - return -4; - } - } // end while fgets - - if (ferror (in)) - { - ACE_OS::fclose (in); - return -1; - } - - ACE_OS::fclose (in); - return 0; -} - -// This method exports the entire configuration database to . -// Once the file is opened this method calls 'export_section' passing -// the root section. -int -ACE_Ini_ImpExp::export_config (const ACE_TCHAR* filename) -{ - if (0 == filename) - { - errno = EINVAL; - return -1; - } - int result = -1; - - FILE* out = ACE_OS::fopen (filename, ACE_LIB_TEXT ("w")); - if (out) - { - result = this->export_section (config_.root_section (), - ACE_LIB_TEXT (""), - out); - ACE_OS::fclose (out); - } - return result; -} - -// Method provided by derived classes in order to write one section to the -// file specified. Called by export_config when exporting the entire -// configuration objet - -int -ACE_Ini_ImpExp::export_section (const ACE_Configuration_Section_Key& section, - const ACE_TString& path, - FILE* out) -{ - // don't export the root - if (path.length ()) - { - // Write out the section header - ACE_TString header = ACE_LIB_TEXT ("["); - header += path; - header += ACE_LIB_TEXT ("]\n"); - if (ACE_OS::fputs (header.fast_rep (), out) < 0) - return -1; - // Write out each value - int index = 0; - ACE_TString name; - ACE_Configuration::VALUETYPE type; - ACE_TString line; - ACE_TCHAR int_value[32]; - ACE_TCHAR bin_value[3]; - void* binary_data; - size_t binary_length; - ACE_TString string_value; - while (!config_.enumerate_values (section, index, name, type)) - { - line = name + ACE_LIB_TEXT ("="); - switch (type) - { - case ACE_Configuration::INTEGER: - { - u_int value; - if (config_.get_integer_value (section, name.fast_rep (), value)) - return -2; - ACE_OS::sprintf (int_value, ACE_LIB_TEXT ("%08x"), value); - line += int_value; - break; - } - case ACE_Configuration::STRING: - { - if (config_.get_string_value (section, - name.fast_rep (), - string_value)) - return -2; - line += string_value; - break; - } -#ifdef _WIN32 - case ACE_Configuration::INVALID: - break; // JDO added break. Otherwise INVALID is processed - // like BINARY. If that's correct, please remove the - // break and these comments -#endif - case ACE_Configuration::BINARY: - { - // not supported yet - maybe use BASE64 codeing? - if (config_.get_binary_value (section, - name.fast_rep (), - binary_data, - binary_length)) - return -2; - line += ACE_LIB_TEXT ("\""); - unsigned char* ptr = (unsigned char*)binary_data; - while (binary_length) - { - if (ptr != binary_data) - { - line += ACE_LIB_TEXT (","); - } - ACE_OS::sprintf (bin_value, ACE_LIB_TEXT ("%02x"), *ptr); - line += bin_value; - --binary_length; - ++ptr; - } - line += ACE_LIB_TEXT ("\""); - delete [] (char *) binary_data; - break; - } - default: - return -3; - - }// end switch on type - - line += ACE_LIB_TEXT ("\n"); - if (ACE_OS::fputs (line.fast_rep (), out) < 0) - return -4; - index++; - }// end while enumerating values - } - // Export all sub sections - int index = 0; - ACE_TString name; - ACE_Configuration_Section_Key sub_key; - ACE_TString sub_section; - while (!config_.enumerate_sections (section, index, name)) - { - ACE_TString sub_section (path); - if (path.length ()) - sub_section += ACE_LIB_TEXT ("\\"); - sub_section += name; - if (config_.open_section (section, name.fast_rep (), 0, sub_key)) - return -5; - if (export_section (sub_key, sub_section.fast_rep (), out)) - return -6; - index++; - } - return 0; - -} - -// Method to squish leading and trailing whitespaces from a string. -// Whitespace is defined as: spaces (' '), tabs ('\t') or end-of-line -// (cr/lf). The terminating nul is moved up to expunge trailing -// whitespace and the returned pointer points at the first -// non-whitespace character in the string, which may be the nul -// terminator if the string is all whitespace. - -ACE_TCHAR * -ACE_Ini_ImpExp::squish (ACE_TCHAR *src) -{ - ACE_TCHAR *cp = 0; - - if (src == 0) - return 0; - - // Start at the end and work backwards over all whitespace. - for (cp = src + ACE_OS::strlen (src) - 1; - cp != src; - --cp) - if (!ACE_OS::ace_isspace (*cp)) - break; - cp[1] = '\0'; // Chop trailing whitespace - - // Now start at the beginning and move over all whitespace. - for (cp = src; ACE_OS::ace_isspace (*cp); ++cp) - continue; - - return cp; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Configuration_Import_Export.h b/ace/Configuration_Import_Export.h deleted file mode 100644 index 41dc401e0c7..00000000000 --- a/ace/Configuration_Import_Export.h +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Configuration_Import_Export.h - * - * $Id$ - * - * @author Jerry D. Odenwelder Jr. - * Chris Hafey - * - * Classes defined in this file provide the ability to import and export - * ACE Configuration objects to/from disk files. The base class - * ACE_Config_ImpExp_Base provides the common functionality and the derived - * classes implement the import/export functionality for the specific format. - * - * @todo - * - Add locking for thread safety. - * - Provide ability to read file in one format and write in another. - * - See todo's in each class - */ -//============================================================================= - -#ifndef ACE_CONFIGURATION_IMPORT_EXPORT_H -#define ACE_CONFIGURATION_IMPORT_EXPORT_H -#include /**/ "ace/pre.h" - -#include "ace/Configuration.h" -#include "ace/SString.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Config_ImpExp_Base - * - * @brief Base class for file import/export configuration. - * - * This class provides base functionality for configuration objects - * that are persisted in files. It takes an ACE_Configuration - * object that it populates with the data read. - * - */ -class ACE_Export ACE_Config_ImpExp_Base -{ -public: - /// Constructor taking the ACE_Configuration to import/export to - ACE_Config_ImpExp_Base (ACE_Configuration& config); - - /** - * Destructor - */ - virtual ~ACE_Config_ImpExp_Base (void); - - /** - * Imports the configuration database from @a filename. - * No existing data is removed. - */ - virtual int import_config (const ACE_TCHAR* filename) = 0; - - /** - * This method exports the entire configuration database to @a filename. - * Once the file is opened this method calls 'export_section' passing - * the root section. - */ - virtual int export_config (const ACE_TCHAR* filename) = 0; - -protected: - ACE_Configuration &config_; - -private: - ACE_Config_ImpExp_Base (const ACE_Config_ImpExp_Base&); - ACE_Config_ImpExp_Base& operator= (const ACE_Config_ImpExp_Base&); -}; - -/** - * @class ACE_Registry_ImpExp - * - * @brief Configuration object that imports/exports data to a file formatted - * using the Win32 Registry file export format. This format looks like - * [Section] - * "key"="String Data" - * "key"=dword: numeric data in hexidecimal format - * "key"=hex: binary data - * - * @todo - * - Add dynamic buffer when importing. currently it will not allow - * importing of values greater than a fixed ammount (4096 bytes) - * - */ -class ACE_Export ACE_Registry_ImpExp : public ACE_Config_ImpExp_Base -{ -public: - /// Construction - ACE_Registry_ImpExp (ACE_Configuration&); - - /// Destruction. - virtual ~ACE_Registry_ImpExp (void); - - /** - * Imports the configuration database from filename. - * No existing data is removed. - */ - virtual int import_config (const ACE_TCHAR* filename); - - /** - * This method exports the entire configuration database to @a filename. - * Once the file is opened this method calls export_section() passing - * the root section. - */ - virtual int export_config (const ACE_TCHAR* filename); - -private: - int export_section (const ACE_Configuration_Section_Key& section, - const ACE_TString& path, - FILE* out); - - int process_previous_line_format (ACE_TCHAR* buffer, - ACE_Configuration_Section_Key& section); - - ACE_Registry_ImpExp ( const ACE_Registry_ImpExp&); - ACE_Registry_ImpExp& operator= ( const ACE_Registry_ImpExp&); -}; - -/** - * @class ACE_Ini_ImpExp - * - * @brief Imports the configuration database from filename as strings. - * Allows non-typed values. (no #, dword: hex:, etc. prefixes) and - * skips whitespace (tabs and spaces) as in standard .ini and .conf - * files. Values (to right of equal sign) can be double quote - * delimited to embed tabs and spaces in the string. - * Caller must convert string to type. - * - * This method allows for lines in the .ini or .conf file like this: - * - * TimeToLive = 100 - * Delay = FALSE - * Flags = FF34 - * Heading = "ACE - Adaptive Communication Environment" - * - * (note leading whitespace (tabs) in examples below) - * - * SeekIndex = 14 - * TraceLevel = 6 # Can comment lines like this - * Justification = left_justified - * - * The caller can then retrieve the string with the regular - * function and convert the string to the - * desired data type. - * - * @todo - * - Strings with embedded newlines cause the import to fail - * - Strings with embedded quotes " cause the import to fail - * - Importing/exporting for values in the root section does not work - * - Add dynamic buffer when importing. currently it will not allow - * importing of values greater than a fixed ammount (4096 bytes) -*/ -class ACE_Export ACE_Ini_ImpExp : public ACE_Config_ImpExp_Base -{ -public: - /** - * Construction - */ - ACE_Ini_ImpExp (ACE_Configuration&); - - /** - * Destructor - */ - virtual ~ACE_Ini_ImpExp (void); - - /** - * Imports the configuration database from filename. - * No existing data is removed. - */ - virtual int import_config (const ACE_TCHAR* filename); - - /** - * This method exports the entire configuration database to @a filename. - * Once the file is opened this method calls export_section() passing - * the root section. - */ - virtual int export_config (const ACE_TCHAR* filename); - -private: - /** - * Method provided by derived classes in order to write one section - * to the file specified. Called by export_config() when exporting - * the entire configuration object. - */ - int export_section (const ACE_Configuration_Section_Key& section, - const ACE_TString& path, - FILE* out); - - /** - * Method to squish leading and trailing whitespaces in a string. - * Whitespace is defined as: spaces (' '), tabs ('\\t') or cr/lf. - * Returns a pointer to the first non-whitespace character in the - * buffer provided, or a pointer to the terminating null if the string - * is all whitespace. The terminating null is moved forward to the - * first character past the last non-whitespace. - */ - ACE_TCHAR *squish (ACE_TCHAR *src); - - ACE_Ini_ImpExp (const ACE_Ini_ImpExp&); - ACE_Ini_ImpExp& operator= (const ACE_Ini_ImpExp&); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIGURATION_IMPORT_EXPORT_H */ diff --git a/ace/Connection_Recycling_Strategy.cpp b/ace/Connection_Recycling_Strategy.cpp deleted file mode 100644 index c5bc6910d21..00000000000 --- a/ace/Connection_Recycling_Strategy.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "ace/Connection_Recycling_Strategy.h" - - -ACE_RCSID(ace, Connection_Recycling_Strategy, "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Connection_Recycling_Strategy::~ACE_Connection_Recycling_Strategy (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Connection_Recycling_Strategy.h b/ace/Connection_Recycling_Strategy.h deleted file mode 100644 index 0a8747a5b66..00000000000 --- a/ace/Connection_Recycling_Strategy.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Connection_Recycling_Strategy.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= -#ifndef ACE_CONNECTION_RECYCLING_STRATEGY_H -#define ACE_CONNECTION_RECYCLING_STRATEGY_H -#include /**/ "ace/pre.h" - -#include "ace/Recyclable.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Connection_Recycling_Strategy - * - * @brief Defines the interface for a connection recycler. - */ -class ACE_Export ACE_Connection_Recycling_Strategy -{ -public: - /// Virtual Destructor - virtual ~ACE_Connection_Recycling_Strategy (void); - - /// Remove from cache. - virtual int purge (const void *recycling_act) = 0; - - /// Add to cache. - virtual int cache (const void *recycling_act) = 0; - - virtual int recycle_state (const void *recycling_act, - ACE_Recyclable_State new_state) = 0; - - /// Get/Set recycle_state. - virtual ACE_Recyclable_State recycle_state (const void *recycling_act) const = 0; - - /// Mark as closed. - virtual int mark_as_closed (const void *recycling_act) = 0; - - /// Mark as closed.(non-locking version) - virtual int mark_as_closed_i (const void *recycling_act) = 0; - - /// Cleanup hint and reset <*act_holder> to zero if . - virtual int cleanup_hint (const void *recycling_act, - void **act_holder = 0) = 0; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /*ACE_CONNECTION_RECYCLING_STRATEGY*/ diff --git a/ace/Connector.cpp b/ace/Connector.cpp deleted file mode 100644 index f588b605462..00000000000 --- a/ace/Connector.cpp +++ /dev/null @@ -1,964 +0,0 @@ -// $Id$ - -#ifndef ACE_CONNECTOR_CPP -#define ACE_CONNECTOR_CPP - -#include "ace/Connector.h" -#include "ace/ACE.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" -#include "ace/os_include/os_fcntl.h" /* Has ACE_NONBLOCK */ - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Connector) - -template -ACE_NonBlocking_Connect_Handler::ACE_NonBlocking_Connect_Handler -(ACE_Connector_Base &connector, - SVC_HANDLER *sh, - long id) - : connector_ (connector) - , svc_handler_ (sh) - , timer_id_ (id) -{ - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::ACE_NonBlocking_Connect_Handler"); - - this->reference_counting_policy ().value - (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); -} - -template SVC_HANDLER * -ACE_NonBlocking_Connect_Handler::svc_handler (void) -{ - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::svc_handler"); - return this->svc_handler_; -} - -template long -ACE_NonBlocking_Connect_Handler::timer_id (void) -{ - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::timer_id"); - return this->timer_id_; -} - -template void -ACE_NonBlocking_Connect_Handler::timer_id (long id) -{ - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::timer_id"); - this->timer_id_ = id; -} - -template void -ACE_NonBlocking_Connect_Handler::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("svc_handler_ = %x"), this->svc_handler_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntimer_id_ = %d"), this->timer_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template bool -ACE_NonBlocking_Connect_Handler::close (SVC_HANDLER *&sh) -{ - // Make sure that we haven't already initialized the Svc_Handler. - if (!this->svc_handler_) - return false; - - { - // Exclusive access to the Reactor. - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - this->reactor ()->lock (), - 0); - - // Double check. - if (!this->svc_handler_) - return false; - - // Remember the Svc_Handler. - sh = this->svc_handler_; - ACE_HANDLE h = sh->get_handle (); - this->svc_handler_ = 0; - - // Remove this handle from the set of non-blocking handles - // in the Connector. - this->connector_.non_blocking_handles ().remove (h); - - // Cancel timer. - if (this->reactor ()->cancel_timer (this->timer_id (), - 0, - 0) == -1) - return false; - - // Remove from Reactor. - if (this->reactor ()->remove_handler ( - h, - ACE_Event_Handler::ALL_EVENTS_MASK) == -1) - return false; - } - - return true; -} - - -template int -ACE_NonBlocking_Connect_Handler::handle_timeout -(const ACE_Time_Value &tv, - const void *arg) -{ - // This method is called if a connection times out before completing. - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_timeout"); - - SVC_HANDLER *svc_handler = 0; - int retval = this->close (svc_handler) ? 0 : -1; - - // Forward to the SVC_HANDLER the that was passed in as a - // magic cookie during ACE_Connector::connect(). This gives the - // SVC_HANDLER an opportunity to take corrective action (e.g., wait - // a few milliseconds and try to reconnect again. - if (svc_handler != 0 && svc_handler->handle_timeout (tv, arg) == -1) - svc_handler->handle_close (svc_handler->get_handle (), - ACE_Event_Handler::TIMER_MASK); - - return retval; -} - - -template int -ACE_NonBlocking_Connect_Handler::handle_input (ACE_HANDLE) -{ - // Called when a failure occurs during asynchronous connection - // establishment. - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_input"); - - SVC_HANDLER *svc_handler = 0; - int retval = this->close (svc_handler) ? 0 : -1; - - // Close Svc_Handler. - if (svc_handler != 0) - svc_handler->close (0); - - return retval; -} - -template int -ACE_NonBlocking_Connect_Handler::handle_output (ACE_HANDLE handle) -{ - // Called when a connection is establishment asynchronous. - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_output"); - - // Grab the connector ref before smashing ourselves in close(). - ACE_Connector_Base &connector = this->connector_; - SVC_HANDLER *svc_handler = 0; - int retval = this->close (svc_handler) ? 0 : -1; - - if (svc_handler != 0) - connector.initialize_svc_handler (handle, svc_handler); - - return retval; -} - -template int -ACE_NonBlocking_Connect_Handler::handle_exception (ACE_HANDLE h) -{ - // On Win32, the except mask must also be set for asynchronous - // connects. - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_exception"); - return this->handle_output (h); -} - -template int -ACE_NonBlocking_Connect_Handler::resume_handler (void) -{ - return ACE_Event_Handler::ACE_EVENT_HANDLER_NOT_RESUMED; -} - -template void -ACE_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Connector::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nflags_ = %d"), this->flags_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Connector::make_svc_handler (SVC_HANDLER *&sh) -{ - ACE_TRACE ("ACE_Connector::make_svc_handler"); - - if (sh == 0) - ACE_NEW_RETURN (sh, - SVC_HANDLER, - -1); - - // Set the reactor of the newly created to the same - // reactor that this is using. - sh->reactor (this->reactor ()); - return 0; -} - -template int -ACE_Connector::activate_svc_handler (SVC_HANDLER *svc_handler) -{ - ACE_TRACE ("ACE_Connector::activate_svc_handler"); - // No errors initially - int error = 0; - - // See if we should enable non-blocking I/O on the 's - // peer. - if (ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK) != 0) - { - if (svc_handler->peer ().enable (ACE_NONBLOCK) == -1) - error = 1; - } - // Otherwise, make sure it's disabled by default. - else if (svc_handler->peer ().disable (ACE_NONBLOCK) == -1) - error = 1; - - // We are connected now, so try to open things up. - if (error || svc_handler->open ((void *) this) == -1) - { - // Make sure to close down the to avoid descriptor - // leaks. - svc_handler->close (0); - return -1; - } - else - return 0; -} - -template ACE_PEER_CONNECTOR & -ACE_Connector::connector (void) const -{ - return const_cast (this->connector_); -} - -template int -ACE_Connector::connect_svc_handler -(SVC_HANDLER *&svc_handler, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_Connector::connect_svc_handler"); - - return this->connector_.connect (svc_handler->peer (), - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Connector::connect_svc_handler -(SVC_HANDLER *&svc_handler, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_Connector::connect_svc_handler"); - - sh_copy = svc_handler; - return this->connector_.connect (svc_handler->peer (), - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Connector::open (ACE_Reactor *r, int flags) -{ - ACE_TRACE ("ACE_Connector::open"); - this->reactor (r); - this->flags_ = flags; - return 0; -} - -template -ACE_Connector::ACE_Connector (ACE_Reactor *r, - int flags) -{ - ACE_TRACE ("ACE_Connector::ACE_Connector"); - (void) this->open (r, flags); -} - -template int -ACE_Connector::connect -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - // Initiate connection to peer. - return this->connect_i (sh, - 0, - remote_addr, - synch_options, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Connector::connect -(SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - // Initiate connection to peer. - return this->connect_i (sh, - &sh_copy, - remote_addr, - synch_options, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Connector::connect_i -(SVC_HANDLER *&sh, - SVC_HANDLER **sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_Connector::connect_i"); - - // If the user hasn't supplied us with a we'll use the - // factory method to create one. Otherwise, things will remain as - // they are... - if (this->make_svc_handler (sh) == -1) - return -1; - - ACE_Time_Value *timeout = 0; - int use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR]; - - if (use_reactor) - timeout = const_cast (&ACE_Time_Value::zero); - else - timeout = const_cast (synch_options.time_value ()); - - int result; - if (sh_copy == 0) - result = this->connect_svc_handler (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); - else - result = this->connect_svc_handler (sh, - *sh_copy, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); - - // Activate immediately if we are connected. - if (result != -1) - return this->activate_svc_handler (sh); - - // Delegate to connection strategy. - if (use_reactor && ACE_OS::last_error () == EWOULDBLOCK) - { - // If the connection hasn't completed and we are using - // non-blocking semantics then register - // ACE_NonBlocking_Connect_Handler with the ACE_Reactor so that - // it will call us back when the connection is complete or we - // timeout, whichever comes first... - int result; - - if (sh_copy == 0) - result = this->nonblocking_connect (sh, synch_options); - else - result = this->nonblocking_connect (*sh_copy, synch_options); - - // If for some reason the call failed, then - // will be set to the new error. If the call succeeds, however, - // we need to make sure that remains set to - // . - if (result == 0) - errno = EWOULDBLOCK; - } - else - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - // Make sure to close down the service handler to avoid handle - // leaks. - if (sh_copy == 0) - { - if (sh) - sh->close (0); - } - else if (*sh_copy) - (*sh_copy)->close (0); - } - - return -1; -} - -template int -ACE_Connector::connect_n -(size_t n, - SVC_HANDLER *sh[], - ACE_PEER_CONNECTOR_ADDR remote_addrs[], - ACE_TCHAR *failed_svc_handlers, - const ACE_Synch_Options &synch_options) -{ - int result = 0; - - for (size_t i = 0; i < n; i++) - { - if (this->connect (sh[i], remote_addrs[i], synch_options) == -1 - && !(synch_options[ACE_Synch_Options::USE_REACTOR] - && errno == EWOULDBLOCK)) - { - result = -1; - if (failed_svc_handlers != 0) - // Mark this entry as having failed. - failed_svc_handlers[i] = 1; - } - else if (failed_svc_handlers != 0) - // Mark this entry as having succeeded. - failed_svc_handlers[i] = 0; - } - - return result; -} - -// Cancel a that was started asynchronously. -template int -ACE_Connector::cancel (SVC_HANDLER *sh) -{ - ACE_TRACE ("ACE_Connector::cancel"); - - ACE_Event_Handler *handler = - this->reactor ()->find_handler (sh->get_handle ()); - - if (handler == 0) - return -1; - - // find_handler() increments handler's refcount; ensure we decrement it. - ACE_Event_Handler_var safe_handler (handler); - - NBCH *nbch = - dynamic_cast (handler); - - if (nbch == 0) - return -1; - - SVC_HANDLER *tmp_sh = 0; - - if (nbch->close (tmp_sh) == false) - return -1; - - return 0; -} - -template int -ACE_Connector::nonblocking_connect -(SVC_HANDLER *sh, - const ACE_Synch_Options &synch_options) -{ - ACE_TRACE ("ACE_Connector::nonblocking_connect"); - - // Must have a valid Reactor for non-blocking connects to work. - if (this->reactor () == 0) - return -1; - - // Register the pending SVC_HANDLER so that it can be activated - // later on when the connection completes. - - ACE_HANDLE handle = sh->get_handle (); - long timer_id = -1; - ACE_Time_Value *tv = 0; - NBCH *nbch = 0; - - ACE_NEW_RETURN (nbch, - NBCH (*this, - sh, - -1), - -1); - - ACE_Event_Handler_var safe_nbch (nbch); - - // Exclusive access to the Reactor. - ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1); - - // Register handle with the reactor for connection events. - ACE_Reactor_Mask mask = ACE_Event_Handler::CONNECT_MASK; - if (this->reactor ()->register_handler (handle, - nbch, - mask) == -1) - goto reactor_registration_failure; - - // Add handle to non-blocking handle set. - this->non_blocking_handles ().insert (handle); - - // If we're starting connection under timer control then we need to - // schedule a timeout with the ACE_Reactor. - tv = const_cast (synch_options.time_value ()); - if (tv != 0) - { - timer_id = - this->reactor ()->schedule_timer (nbch, - synch_options.arg (), - *tv); - if (timer_id == -1) - goto timer_registration_failure; - - // Remember timer id. - nbch->timer_id (timer_id); - } - - return 0; - - // Undo previous actions using the ol' "goto label and fallthru" - // trick... - timer_registration_failure: - - // Remove from Reactor. - this->reactor ()->remove_handler (handle, mask); - - // Remove handle from the set of non-blocking handles. - this->non_blocking_handles ().remove (handle); - - /* FALLTHRU */ - - reactor_registration_failure: - // Close the svc_handler - - sh->close (0); - - return -1; -} - -template -ACE_Connector::~ACE_Connector (void) -{ - ACE_TRACE ("ACE_Connector::~ACE_Connector"); - - this->close (); -} - -template void -ACE_Connector::initialize_svc_handler -(ACE_HANDLE handle, - SVC_HANDLER *svc_handler) -{ - // Try to find out if the reactor uses event associations for the - // handles it waits on. If so we need to reset it. - int reset_new_handle = - this->reactor ()->uses_event_associations (); - - if (reset_new_handle) - this->connector_.reset_new_handle (handle); - - // Transfer ownership of the ACE_HANDLE to the SVC_HANDLER. - svc_handler->set_handle (handle); - - ACE_PEER_CONNECTOR_ADDR raddr; - - // Check to see if we're connected. - if (svc_handler->peer ().get_remote_addr (raddr) != -1) - this->activate_svc_handler (svc_handler); - else // Somethings gone wrong, so close down... - { -#if defined (ACE_WIN32) - // Win32 (at least prior to Windows 2000) has a timing problem. - // If you check to see if the connection has completed too fast, - // it will fail - so wait 35 milliseconds to let it catch up. - ACE_Time_Value tv (0, ACE_NON_BLOCKING_BUG_DELAY); - ACE_OS::sleep (tv); - if (svc_handler->peer ().get_remote_addr (raddr) != -1) - this->activate_svc_handler (svc_handler); - else // do the svc handler close below... -#endif /* ACE_WIN32 */ - svc_handler->close (0); - } -} - -template void -ACE_Connector::reactor (ACE_Reactor *reactor) -{ - this->reactor_ = reactor; -} - -template ACE_Reactor * -ACE_Connector::reactor (void) const -{ - return this->reactor_; -} - -template ACE_Unbounded_Set & -ACE_Connector::non_blocking_handles (void) -{ - return this->non_blocking_handles_; -} - -template int -ACE_Connector::close (void) -{ - // If there are no non-blocking handle pending, return immediately. - if (this->non_blocking_handles ().size () == 0) - return 0; - - // Exclusive access to the Reactor. - ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1); - - // Go through all the non-blocking handles. It is necessary to - // create a new iterator each time because we remove from the handle - // set when we cancel the Svc_Handler. - ACE_HANDLE *handle = 0; - while (1) - { - ACE_Unbounded_Set_Iterator - iterator (this->non_blocking_handles ()); - if (!iterator.next (handle)) - break; - - ACE_Event_Handler *handler = - this->reactor ()->find_handler (*handle); - if (handler == 0) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%t: Connector::close h %d, no handler\n"), - *handle)); - // Remove handle from the set of non-blocking handles. - this->non_blocking_handles ().remove (*handle); - continue; - } - - // find_handler() incremented handler's refcount; ensure it's decremented - ACE_Event_Handler_var safe_handler (handler); - NBCH *nbch = dynamic_cast (handler); - if (nbch == 0) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%t: Connector::close h %d handler %@ ") - ACE_LIB_TEXT ("not a legit handler\n"), - *handle, - handler)); - // Remove handle from the set of non-blocking handles. - this->non_blocking_handles ().remove (*handle); - continue; - } - SVC_HANDLER *svc_handler = nbch->svc_handler (); - - // Cancel the non-blocking connection. - this->cancel (svc_handler); - - // Close the associated Svc_Handler. - svc_handler->close (0); - } - - return 0; -} - -template int -ACE_Connector::fini (void) -{ - ACE_TRACE ("ACE_Connector::fini"); - - return this->close (); -} - -// Hook called by the explicit dynamic linking facility. - -template int -ACE_Connector::init (int, ACE_TCHAR *[]) -{ - ACE_TRACE ("ACE_Connector::init"); - return -1; -} - -template int -ACE_Connector::suspend (void) -{ - ACE_TRACE ("ACE_Connector::suspend"); - return -1; -} - -template int -ACE_Connector::resume (void) -{ - ACE_TRACE ("ACE_Connector::resume"); - return -1; -} - -template int -ACE_Connector::info (ACE_TCHAR **strp, size_t length) const -{ - ACE_TRACE ("ACE_Connector::info"); - ACE_TCHAR buf[BUFSIZ]; - - ACE_OS::sprintf (buf, - ACE_LIB_TEXT ("%s\t %s"), - ACE_LIB_TEXT ("ACE_Connector"), - ACE_LIB_TEXT ("# connector factory\n")); - - if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) - return -1; - else - ACE_OS::strsncpy (*strp, buf, length); - return static_cast (ACE_OS::strlen (buf)); -} - -template int -ACE_Strategy_Connector::open (ACE_Reactor *r, - int flags) -{ - ACE_TRACE ("ACE_Strategy_Connector::open"); - return this->open (r, 0, 0, 0, flags); -} - -template int -ACE_Strategy_Connector::open -(ACE_Reactor *r, - ACE_Creation_Strategy *cre_s, - ACE_Connect_Strategy *conn_s, - ACE_Concurrency_Strategy *con_s, - int flags) -{ - ACE_TRACE ("ACE_Strategy_Connector::open"); - - this->reactor (r); - - // @@ Not implemented yet. - // this->flags_ = flags; - ACE_UNUSED_ARG (flags); - - // Initialize the creation strategy. - - // First we decide if we need to clean up. - if (this->creation_strategy_ != 0 && - this->delete_creation_strategy_ != 0 && - cre_s != 0) - { - delete this->creation_strategy_; - this->creation_strategy_ = 0; - this->delete_creation_strategy_ = 0; - } - - if (cre_s != 0) - this->creation_strategy_ = cre_s; - else if (this->creation_strategy_ == 0) - { - ACE_NEW_RETURN (this->creation_strategy_, - CREATION_STRATEGY, - -1); - this->delete_creation_strategy_ = 1; - } - - - // Initialize the accept strategy. - - if (this->connect_strategy_ != 0 && - this->delete_connect_strategy_ != 0 && - conn_s != 0) - { - delete this->connect_strategy_; - this->connect_strategy_ = 0; - this->delete_connect_strategy_ = 0; - } - - if (conn_s != 0) - this->connect_strategy_ = conn_s; - else if (this->connect_strategy_ == 0) - { - ACE_NEW_RETURN (this->connect_strategy_, - CONNECT_STRATEGY, - -1); - this->delete_connect_strategy_ = 1; - } - - // Initialize the concurrency strategy. - - if (this->concurrency_strategy_ != 0 && - this->delete_concurrency_strategy_ != 0 && - con_s != 0) - { - delete this->concurrency_strategy_; - this->concurrency_strategy_ = 0; - this->delete_concurrency_strategy_ = 0; - } - - if (con_s != 0) - this->concurrency_strategy_ = con_s; - else if (this->concurrency_strategy_ == 0) - { - ACE_NEW_RETURN (this->concurrency_strategy_, - CONCURRENCY_STRATEGY, - -1); - this->delete_concurrency_strategy_ = 1; - } - - return 0; -} - -template -ACE_Strategy_Connector::ACE_Strategy_Connector -(ACE_Reactor *reactor, - ACE_Creation_Strategy *cre_s, - ACE_Connect_Strategy *conn_s, - ACE_Concurrency_Strategy *con_s, - int flags) - : creation_strategy_ (0), - delete_creation_strategy_ (0), - connect_strategy_ (0), - delete_connect_strategy_ (0), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (0) -{ - ACE_TRACE ("ACE_Connector::ACE_Strategy_Connector"); - - if (this->open (reactor, cre_s, conn_s, con_s, flags) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Strategy_Connector::ACE_Strategy_Connector"))); -} - -template -ACE_Strategy_Connector::~ACE_Strategy_Connector (void) -{ - ACE_TRACE ("ACE_Strategy_Connector::~ACE_Strategy_Connector"); - - // Close down - this->close (); -} - -template int -ACE_Strategy_Connector::close (void) -{ - if (this->delete_creation_strategy_) - delete this->creation_strategy_; - this->delete_creation_strategy_ = 0; - this->creation_strategy_ = 0; - - if (this->delete_connect_strategy_) - delete this->connect_strategy_; - this->delete_connect_strategy_ = 0; - this->connect_strategy_ = 0; - - if (this->delete_concurrency_strategy_) - delete this->concurrency_strategy_; - this->delete_concurrency_strategy_ = 0; - this->concurrency_strategy_ = 0; - - return SUPER::close (); -} - -template int -ACE_Strategy_Connector::make_svc_handler (SVC_HANDLER *&sh) -{ - return this->creation_strategy_->make_svc_handler (sh); -} - -template int -ACE_Strategy_Connector::connect_svc_handler -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - return this->connect_strategy_->connect_svc_handler (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Strategy_Connector::connect_svc_handler -(SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - return this->connect_strategy_->connect_svc_handler (sh, - sh_copy, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Strategy_Connector::activate_svc_handler (SVC_HANDLER *svc_handler) -{ - return this->concurrency_strategy_->activate_svc_handler (svc_handler, this); -} - -template ACE_Creation_Strategy * -ACE_Strategy_Connector::creation_strategy (void) const -{ - return this->creation_strategy_; -} - -template ACE_Connect_Strategy * -ACE_Strategy_Connector::connect_strategy (void) const -{ - return this->connect_strategy_; -} - -template ACE_Concurrency_Strategy * -ACE_Strategy_Connector::concurrency_strategy (void) const -{ - return this->concurrency_strategy_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CONNECTOR_C */ diff --git a/ace/Connector.h b/ace/Connector.h deleted file mode 100644 index 516fc8a775d..00000000000 --- a/ace/Connector.h +++ /dev/null @@ -1,573 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Connector.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_CONNECTOR_H -#define ACE_CONNECTOR_H - -#include /**/ "ace/pre.h" - -#include "ace/Service_Object.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Strategies_T.h" -#include "ace/Synch_Options.h" -#include "ace/Unbounded_Set.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Connector_Base - * - * @brief This base interface allows ACE_NonBlocking_Connect_Handler - * to only care about the SVC_HANDLER template parameter of the - * ACE_Connector. Otherwise, ACE_NonBlocking_Connect_Handler would - * have to be configured with all the template parameters that - * ACE_Connector is configured with. - */ -template -class ACE_Connector_Base -{ -public: - - virtual ~ACE_Connector_Base (void) {} - - /// Initialize the Svc_Handler. - virtual void initialize_svc_handler (ACE_HANDLE handle, - SVC_HANDLER *svc_handler) = 0; - - /// Return the handle set representing the non-blocking connects in - /// progress. - virtual ACE_Unbounded_Set &non_blocking_handles (void) = 0; -}; - -/** - * @class ACE_NonBlocking_Connect_Handler - * - * @brief Performs non-blocking connects on behalf of the Connector. - */ -template -class ACE_NonBlocking_Connect_Handler : public ACE_Event_Handler -{ -public: - - // Constructor. - ACE_NonBlocking_Connect_Handler (ACE_Connector_Base &connector, - SVC_HANDLER *, - long timer_id); - - /// Close up and return underlying SVC_HANDLER through @c sh. - /** - * If the return value is true the close was performed succesfully, - * implying that this object was removed from the reactor and thereby - * (by means of reference counting decremented to 0) deleted. - * If the return value is false, the close was not successful. - * The @c sh does not have any connection to the return - * value. The argument will return a valid svc_handler object if a - * valid one exists within the object. Returning a valid svc_handler - * pointer also invalidates the svc_handler contained in this - * object. - */ - bool close (SVC_HANDLER *&sh); - - /// Get SVC_HANDLER. - SVC_HANDLER *svc_handler (void); - - // = Get/set handle. - /// Get handle. - ACE_HANDLE handle (void); - - /// Set handle. - void handle (ACE_HANDLE); - - // = Set/get timer id. - /// Get timer id. - long timer_id (void); - - /// Set timer id. - void timer_id (long timer_id); - - /// Called by ACE_Reactor when asynchronous connections fail. - virtual int handle_input (ACE_HANDLE); - - /// Called by ACE_Reactor when asynchronous connections succeed. - virtual int handle_output (ACE_HANDLE); - - /// Called by ACE_Reactor when asynchronous connections suceeds (on - /// some platforms only). - virtual int handle_exception (ACE_HANDLE fd); - - /// This method is called if a connection times out before - /// completing. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg); - - /// Should Reactor resume us if we have been suspended before the - /// upcall? - virtual int resume_handler (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /// Connector base. - ACE_Connector_Base &connector_; - - /// Associated SVC_HANDLER. - SVC_HANDLER *svc_handler_; - - /// Associated timer id. - long timer_id_; -}; - -/** - * @class ACE_Connector - * - * @brief Generic factory for actively connecting clients and creating - * service handlers (SVC_HANDLERs). - * - * Implements the strategy for actively establishing connections with - * clients. An ACE_Connector is parameterized by concrete types that - * conform to the interfaces of PEER_CONNECTOR and SVC_HANDLER. The - * PEER_CONNECTOR is instantiated with a transport mechanism that - * actively establishes connections. The SVC_HANDLER is instantiated - * with a concrete type that performs the application-specific - * service. Both blocking and non-blocking connects are supported. - * Further, non-blocking connects support timeouts. - */ -template -class ACE_Connector : public ACE_Connector_Base, public ACE_Service_Object -{ -public: - - // Useful STL-style traits. - typedef ACE_TYPENAME SVC_HANDLER::addr_type addr_type; - typedef ACE_PEER_CONNECTOR connector_type; - typedef SVC_HANDLER handler_type; - typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - - // typedef ACE_TYPENAME ACE_PEER_CONNECTOR_ADDR PEER_ADDR; -#if defined (ACE_HAS_TYPENAME_KEYWORD) - typedef ACE_PEER_CONNECTOR_ADDR ACE_PEER_ADDR_TYPEDEF; -#endif /* ACE_HAS_TYPENAME_KEYWORD */ - - typedef ACE_TYPENAME _ACE_PEER_CONNECTOR::PEER_ADDR - ACE_TYPENAME_ACE_PEER_CONNECTOR_PEER_ADDR; - - /** - * Initialize a connector. @a flags indicates how 's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the when it is opened. - */ - ACE_Connector (ACE_Reactor *r = ACE_Reactor::instance (), - int flags = 0); - - /** - * Initialize a connector. @a flags indicates how 's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the when it is opened. - */ - virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), - int flags = 0); - - /// Shutdown a connector and release resources. - virtual ~ACE_Connector (void); - - // = Connection establishment methods. - - /** - * Initiate connection of to peer at - * using . If the caller wants to designate the - * selected they can (and can also insist that the - * be reused by passing a value == - * 1). @a flags and can be used to pass any flags that are - * needed to perform specific operations such as opening a file - * within connect with certain permissions. If the connection fails - * the hook on the will be called - * automatically to prevent resource leaks. - */ - virtual int connect (SVC_HANDLER *&svc_handler, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, - const ACE_PEER_CONNECTOR_ADDR &local_addr - = (ACE_TYPENAME_ACE_PEER_CONNECTOR_PEER_ADDR &) ACE_PEER_CONNECTOR_ADDR_ANY, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /** - * This is a variation on the previous method. On cached - * connectors the variable can be used as a hint - * for future lookups. Since this variable is modified in the - * context of the internal cache its use is thread-safe. But the - * actual svc_handler for the current connection is returned in the - * second parameter . If the connection fails the - * hook on the will be called automatically to - * prevent resource leaks. - */ - virtual int connect (SVC_HANDLER *&svc_handler_hint, - SVC_HANDLER *&svc_handler, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, - const ACE_PEER_CONNECTOR_ADDR &local_addr - = (ACE_TYPENAME_ACE_PEER_CONNECTOR_PEER_ADDR &) ACE_PEER_CONNECTOR_ADDR_ANY, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /** - * Initiate connection of to peers at - * using . Returns -1 if failure - * occurs and 0 otherwise. If is non-NULL, a - * 1 is placed in the corresponding index of - * for each that failed to connect, else a 0 is - * placed in that index. - */ - virtual int connect_n (size_t n, - SVC_HANDLER *svc_handlers[], - ACE_PEER_CONNECTOR_ADDR remote_addrs[], - ACE_TCHAR *failed_svc_handlers = 0, - const ACE_Synch_Options &synch_options = - ACE_Synch_Options::defaults); - - /** - * Cancel a that was started asynchronously. Note that - * this is the only case when the Connector does not actively close - * the . It is left up to the caller of to - * decide the fate of the . - */ - virtual int cancel (SVC_HANDLER *svc_handler); - - /// Close down the Connector. All pending non-blocking connects are - /// canceled and the corresponding svc_handler is closed. - virtual int close (void); - - /// Return the underlying PEER_CONNECTOR object. - virtual ACE_PEER_CONNECTOR &connector (void) const; - - /// Initialize Svc_Handler. - virtual void initialize_svc_handler (ACE_HANDLE handle, - SVC_HANDLER *svc_handler); - - /// Set Reactor. - virtual void reactor (ACE_Reactor *reactor); - - /// Get Reactor. - virtual ACE_Reactor *reactor (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Helpful typedefs. - typedef ACE_NonBlocking_Connect_Handler NBCH; - - // = The following two methods define the Connector's strategies for - // creating, connecting, and activating SVC_HANDLER's, respectively. - - /** - * Bridge method for creating a SVC_HANDLER. The default is to - * create a new SVC_HANDLER only if == 0, else is - * unchanged. However, subclasses can override this policy to - * perform SVC_HANDLER creation in any way that they like (such as - * creating subclass instances of SVC_HANDLER, using a singleton, - * dynamically linking the handler, etc.). Returns -1 if failure, - * else 0. - */ - virtual int make_svc_handler (SVC_HANDLER *&sh); - - /** - * Bridge method for connecting the to the - * . The default behavior delegates to the - * . - */ - virtual int connect_svc_handler (SVC_HANDLER *&svc_handler, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - virtual int connect_svc_handler (SVC_HANDLER *&svc_handler, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /** - * Bridge method for activating a with the appropriate - * concurrency strategy. The default behavior of this method is to - * activate the SVC_HANDLER by calling its method (which - * allows the SVC_HANDLER to define its own concurrency strategy). - * However, subclasses can override this strategy to do more - * sophisticated concurrency activations (such as creating the - * SVC_HANDLER as an "active object" via multi-threading or - * multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - /// Creates and registers ACE_NonBlocking_Connect_Handler. - int nonblocking_connect (SVC_HANDLER *, - const ACE_Synch_Options &); - - /// Implementation the methods. - virtual int connect_i (SVC_HANDLER *&svc_handler, - SVC_HANDLER **sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /// Return the handle set representing the non-blocking connects in - /// progress. - ACE_Unbounded_Set &non_blocking_handles (void); - - // = Dynamic linking hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int init (int argc, ACE_TCHAR *argv[]); - - /// Calls to shutdown the Connector gracefully. - virtual int fini (void); - - /// Default version returns address info in . - virtual int info (ACE_TCHAR **, size_t) const; - - // = Service management hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int suspend (void); - - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int resume (void); - -private: - /// This is the peer connector factory. - ACE_PEER_CONNECTOR connector_; - - /** - * Flags that indicate how 's should be initialized - * prior to being activated. Right now, the only flag that is - * processed is ACE_NONBLOCK, which enabled non-blocking I/O on - * the when it is opened. - */ - int flags_; - - /// Pointer to the Reactor. - ACE_Reactor *reactor_; - - /// Handle set representing the non-blocking connects in progress. - ACE_Unbounded_Set non_blocking_handles_; - -}; - -/** - * @class ACE_Strategy_Connector - * - * @brief Abstract factory for creating a service handler - * (SVC_HANDLER), connecting the SVC_HANDLER, and activating the - * SVC_HANDLER. - * - * Implements a flexible and extensible set of strategies for - * actively establishing connections with clients. There are - * three main strategies: (1) creating a SVC_HANDLER, (2) - * actively initiating a new connection from the client, - * and (3) activating the SVC_HANDLER with a - * particular concurrency mechanism after the connection is established. - */ -template -class ACE_Strategy_Connector - : public ACE_Connector -{ -public: - - // Useful STL-style traits. - typedef ACE_Creation_Strategy - creation_strategy_type; - typedef ACE_Connect_Strategy - connect_strategy_type; - typedef ACE_Concurrency_Strategy - concurrency_strategy_type; - typedef ACE_Connector - base_type; - - // = Define some useful (old style) traits. - typedef ACE_Creation_Strategy - CREATION_STRATEGY; - typedef ACE_Connect_Strategy - CONNECT_STRATEGY; - typedef ACE_Concurrency_Strategy - CONCURRENCY_STRATEGY; - typedef ACE_Connector - SUPER; - - /** - * Initialize a connector. @a flags indicates how 's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the when it is opened. - */ - ACE_Strategy_Connector (ACE_Reactor *r = ACE_Reactor::instance (), - ACE_Creation_Strategy * = 0, - ACE_Connect_Strategy * = 0, - ACE_Concurrency_Strategy * = 0, - int flags = 0); - - /** - * Initialize a connector. @a flags indicates how 's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the when it is opened. - * Default strategies would be created and used. - */ - virtual int open (ACE_Reactor *r, - int flags); - - /** - * Initialize a connector. @a flags indicates how 's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the when it is opened. - */ - virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), - ACE_Creation_Strategy * = 0, - ACE_Connect_Strategy * = 0, - ACE_Concurrency_Strategy * = 0, - int flags = 0); - - /// Shutdown a connector and release resources. - virtual ~ACE_Strategy_Connector (void); - - /// Close down the Connector - virtual int close (void); - - // = Strategies accessors - virtual ACE_Creation_Strategy *creation_strategy (void) const; - virtual ACE_Connect_Strategy *connect_strategy (void) const; - virtual ACE_Concurrency_Strategy *concurrency_strategy (void) const; - -protected: - // = The following three methods define the 's strategies - // for creating, connecting, and activating 's, - // respectively. - - /** - * Bridge method for creating a . The strategy for - * creating a are configured into the Connector via - * it's . The default is to create a new - * only if == 0, else is unchanged. - * However, subclasses can override this policy to perform - * creation in any way that they like (such as - * creating subclass instances of , using a singleton, - * dynamically linking the handler, etc.). Returns -1 if failure, - * else 0. - */ - virtual int make_svc_handler (SVC_HANDLER *&sh); - - /** - * Bridge method for connecting the new connection into the - * . The default behavior delegates to the - * in the . - */ - virtual int connect_svc_handler (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /** - * Bridge method for connecting the new connection into the - * . The default behavior delegates to the - * in the . - * is used to obtain a copy of the pointer, but that - * can be kept in the stack; the motivation is a bit too long to - * include here, but basically we want to modify safely, using - * the internal locks in the Connect_Strategy, while saving a TSS - * copy in , usually located in the stack. - */ - virtual int connect_svc_handler (SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /** - * Bridge method for activating a with the appropriate - * concurrency strategy. The default behavior of this method is to - * activate the by calling its method (which - * allows the to define its own concurrency strategy). - * However, subclasses can override this strategy to do more - * sophisticated concurrency activations (such as creating the - * as an "active object" via multi-threading or - * multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - // = Strategy objects. - - /// Creation strategy for an . - CREATION_STRATEGY *creation_strategy_; - - /// 1 if created the creation strategy and thus should - /// delete it, else 0. - int delete_creation_strategy_; - - /// Connect strategy for a . - CONNECT_STRATEGY *connect_strategy_; - - /// 1 if created the connect strategy and thus should - /// delete it, else 0. - int delete_connect_strategy_; - - /// Concurrency strategy for an . - CONCURRENCY_STRATEGY *concurrency_strategy_; - - /// 1 if created the concurrency strategy and thus should - /// delete it, else 0. - int delete_concurrency_strategy_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Connector.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Connector.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CONNECTOR_H */ diff --git a/ace/Containers.cpp b/ace/Containers.cpp deleted file mode 100644 index 2904225a3c9..00000000000 --- a/ace/Containers.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// $Id$ - -#include "ace/Containers.h" - -ACE_RCSID (ace, - Containers, - "$Id$") - -#if !defined (__ACE_INLINE__) -#include "ace/Containers.inl" -#endif /* __ACE_INLINE__ */ - diff --git a/ace/Containers.h b/ace/Containers.h deleted file mode 100644 index f8e4cda2d02..00000000000 --- a/ace/Containers.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Containers.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_CONTAINERS_H -#define ACE_CONTAINERS_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template class ACE_Double_Linked_List; -template class ACE_Double_Linked_List_Iterator_Base; -template class ACE_Double_Linked_List_Iterator; -template class ACE_Double_Linked_List_Reverse_Iterator; - -/** - * @class ACE_DLList_Node - * - * @brief Base implementation of element in a DL list. Needed for - * ACE_Double_Linked_List. - */ -class ACE_Export ACE_DLList_Node -{ -public: - friend class ACE_Double_Linked_List; - friend class ACE_Double_Linked_List_Iterator_Base; - friend class ACE_Double_Linked_List_Iterator; - friend class ACE_Double_Linked_List_Reverse_Iterator; - - ACE_DLList_Node (void *&i, - ACE_DLList_Node *n = 0, - ACE_DLList_Node *p = 0); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - void *item_; - - ACE_DLList_Node *next_; - ACE_DLList_Node *prev_; - -protected: - ACE_DLList_Node (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Containers.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Containers_T.h" - -#include /**/ "ace/post.h" - -#endif /* ACE_CONTAINERS_H */ diff --git a/ace/Containers.inl b/ace/Containers.inl deleted file mode 100644 index ebc0b96bf7e..00000000000 --- a/ace/Containers.inl +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_DLList_Node::ACE_DLList_Node (void) - : item_ (0), - next_ (0), - prev_ (0) -{ -} - -ACE_INLINE -ACE_DLList_Node::ACE_DLList_Node (void *&i, - ACE_DLList_Node *n, - ACE_DLList_Node *p) - : item_ (i), - next_ (n), - prev_ (p) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Containers_T.cpp b/ace/Containers_T.cpp deleted file mode 100644 index e5558650ad3..00000000000 --- a/ace/Containers_T.cpp +++ /dev/null @@ -1,1937 +0,0 @@ -// $Id$ - -#ifndef ACE_CONTAINERS_T_CPP -#define ACE_CONTAINERS_T_CPP - -#include "ace/Log_Msg.h" -#include "ace/Malloc_Base.h" -#include "ace/OS_Memory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Containers.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Containers_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Stack) - -template void -ACE_Bounded_Stack::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Bounded_Stack::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Bounded_Stack::ACE_Bounded_Stack (size_t size) - : size_ (size), - top_ (0) -{ - ACE_NEW (this->stack_, - T[size]); - ACE_TRACE ("ACE_Bounded_Stack::ACE_Bounded_Stack"); -} - -template -ACE_Bounded_Stack::ACE_Bounded_Stack (const ACE_Bounded_Stack &s) - : size_ (s.size_), - top_ (s.top_) -{ - ACE_NEW (this->stack_, - T[s.size_]); - - ACE_TRACE ("ACE_Bounded_Stack::ACE_Bounded_Stack"); - - for (size_t i = 0; i < this->top_; i++) - this->stack_[i] = s.stack_[i]; -} - -template void -ACE_Bounded_Stack::operator= (const ACE_Bounded_Stack &s) -{ - ACE_TRACE ("ACE_Bounded_Stack::operator="); - - if (&s != this) - { - if (this->size_ < s.size_) - { - delete [] this->stack_; - ACE_NEW (this->stack_, - T[s.size_]); - this->size_ = s.size_; - } - this->top_ = s.top_; - - for (size_t i = 0; i < this->top_; i++) - this->stack_[i] = s.stack_[i]; - } -} - -template -ACE_Bounded_Stack::~ACE_Bounded_Stack (void) -{ - ACE_TRACE ("ACE_Bounded_Stack::~ACE_Bounded_Stack"); - delete [] this->stack_; -} - -// ---------------------------------------- - -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Stack) - -template void -ACE_Fixed_Stack::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Fixed_Stack::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Stack::ACE_Fixed_Stack (void) - : size_ (ACE_SIZE), - top_ (0) -{ - ACE_TRACE ("ACE_Fixed_Stack::ACE_Fixed_Stack"); -} - -template -ACE_Fixed_Stack::ACE_Fixed_Stack (const ACE_Fixed_Stack &s) - : size_ (s.size_), - top_ (s.top_) -{ - ACE_TRACE ("ACE_Fixed_Stack::ACE_Fixed_Stack"); - for (size_t i = 0; i < this->top_; i++) - this->stack_[i] = s.stack_[i]; -} - -template void -ACE_Fixed_Stack::operator= (const ACE_Fixed_Stack &s) -{ - ACE_TRACE ("ACE_Fixed_Stack::operator="); - - if (&s != this) - { - this->top_ = s.top_; - - for (size_t i = 0; i < this->top_; i++) - this->stack_[i] = s.stack_[i]; - } -} - -template -ACE_Fixed_Stack::~ACE_Fixed_Stack (void) -{ - ACE_TRACE ("ACE_Fixed_Stack::~ACE_Fixed_Stack"); -} - -//---------------------------------------- - -ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Stack) - -template void -ACE_Unbounded_Stack::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Unbounded_Stack::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Unbounded_Stack::ACE_Unbounded_Stack (ACE_Allocator *alloc) - : head_ (0), - cur_size_ (0), - allocator_ (alloc) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::ACE_Unbounded_Stack"); - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node); - this->head_->next_ = this->head_; -} - -template void -ACE_Unbounded_Stack::delete_all_nodes (void) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::delete_all_nodes"); - - while (this->is_empty () == 0) - { - ACE_Node *temp = this->head_->next_; - this->head_->next_ = temp->next_; - ACE_DES_FREE_TEMPLATE (temp, this->allocator_->free, - ACE_Node, ); - } - - this->cur_size_ = 0; - - ACE_ASSERT (this->head_ == this->head_->next_ - && this->is_empty ()); -} - -template void -ACE_Unbounded_Stack::copy_all_nodes (const ACE_Unbounded_Stack &s) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::copy_all_nodes"); - - ACE_ASSERT (this->head_ == this->head_->next_); - - ACE_Node *temp = this->head_; - - for (ACE_Node *s_temp = s.head_->next_; - s_temp != s.head_; - s_temp = s_temp->next_) - { - ACE_Node *nptr = temp->next_; - ACE_NEW_MALLOC (temp->next_, - (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node (s_temp->item_, nptr)); - temp = temp->next_; - } - this->cur_size_ = s.cur_size_; -} - -template -ACE_Unbounded_Stack::ACE_Unbounded_Stack (const ACE_Unbounded_Stack &s) - : head_ (0), - cur_size_ (0), - allocator_ (s.allocator_) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node); - this->head_->next_ = this->head_; - - // ACE_TRACE ("ACE_Unbounded_Stack::ACE_Unbounded_Stack"); - this->copy_all_nodes (s); -} - -template void -ACE_Unbounded_Stack::operator= (const ACE_Unbounded_Stack &s) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::operator="); - - if (this != &s) - { - this->delete_all_nodes (); - this->copy_all_nodes (s); - } -} - -template -ACE_Unbounded_Stack::~ACE_Unbounded_Stack (void) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::~ACE_Unbounded_Stack"); - - this->delete_all_nodes (); - ACE_DES_FREE_TEMPLATE (head_, - this->allocator_->free, - ACE_Node, - ); -} - -template int -ACE_Unbounded_Stack::push (const T &new_item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::push"); - - ACE_Node *temp = 0; - - ACE_NEW_MALLOC_RETURN (temp, - static_cast *> (this->allocator_->malloc (sizeof (ACE_Node))), - ACE_Node (new_item, this->head_->next_), - -1); - this->head_->next_ = temp; - this->cur_size_++; - return 0; -} - -template int -ACE_Unbounded_Stack::pop (T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::pop"); - - if (this->is_empty ()) - return -1; - else - { - ACE_Node *temp = this->head_->next_; - item = temp->item_; - this->head_->next_ = temp->next_; - - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_Node, - ); - this->cur_size_--; - return 0; - } -} - -template int -ACE_Unbounded_Stack::find (const T &item) const -{ - // ACE_TRACE ("ACE_Unbounded_Stack::find"); - // Set into the dummy node. - this->head_->item_ = item; - - ACE_Node *temp = this->head_->next_; - - // Keep looping until we find the item. - while (!(temp->item_ == item)) - temp = temp->next_; - - // If we found the dummy node then it's not really there, otherwise, - // it is there. - return temp == this->head_ ? -1 : 0; -} - -template int -ACE_Unbounded_Stack::insert (const T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::insert"); - - if (this->find (item) == 0) - return 1; - else - return this->push (item); -} - -template int -ACE_Unbounded_Stack::remove (const T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::remove"); - - // Insert the item to be founded into the dummy node. - this->head_->item_ = item; - - ACE_Node *curr = this->head_; - - while (!(curr->next_->item_ == item)) - curr = curr->next_; - - if (curr->next_ == this->head_) - return -1; // Item was not found. - else - { - ACE_Node *temp = curr->next_; - // Skip over the node that we're deleting. - curr->next_ = temp->next_; - this->cur_size_--; - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_Node, - ); - return 0; - } -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List_Iterator_Base) - -template -ACE_Double_Linked_List_Iterator_Base::ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List &dll) - : current_ (0), dllist_ (&dll) -{ - // Do nothing -} - -template -ACE_Double_Linked_List_Iterator_Base::ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List_Iterator_Base &iter) - : current_ (iter.current_), - dllist_ (iter.dllist_) -{ - // Do nothing -} - - -template T * -ACE_Double_Linked_List_Iterator_Base::next (void) const -{ - return this->not_done (); -} - -template int -ACE_Double_Linked_List_Iterator_Base::next (T *&ptr) const -{ - ptr = this->not_done (); - return ptr ? 1 : 0; -} - - -template int -ACE_Double_Linked_List_Iterator_Base::done (void) const -{ - return this->not_done () ? 0 : 1; -} - -template T & -ACE_Double_Linked_List_Iterator_Base::operator* (void) const -{ - return *(this->not_done ()); -} - -// @@ Is this a valid retasking? Make sure to check with Purify and -// whatnot that we're not leaking memory or doing any other screwing things. -template void -ACE_Double_Linked_List_Iterator_Base::reset (ACE_Double_Linked_List &dll) -{ - current_ = 0; - dllist_ = &dll; -} - - template int -ACE_Double_Linked_List_Iterator_Base::go_head (void) -{ - this->current_ = static_cast (dllist_->head_->next_); - return this->current_ ? 1 : 0; -} - -template int -ACE_Double_Linked_List_Iterator_Base::go_tail (void) -{ - this->current_ = static_cast (dllist_->head_->prev_); - return this->current_ ? 1 : 0; -} - -template T * -ACE_Double_Linked_List_Iterator_Base::not_done (void) const -{ - if (this->current_ != this->dllist_->head_) - return this->current_; - else - return 0; -} - -template T * -ACE_Double_Linked_List_Iterator_Base::do_advance (void) -{ - if (this->not_done ()) - { - this->current_ = static_cast (this->current_->next_); - return this->not_done (); - } - else - return 0; -} - -template T * -ACE_Double_Linked_List_Iterator_Base::do_retreat (void) -{ - if (this->not_done ()) - { - this->current_ = static_cast (this->current_->prev_); - return this->not_done (); - } - else - return 0; -} - -template void -ACE_Double_Linked_List_Iterator_Base::dump_i (void) const -{ - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("current_ = %x"), this->current_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List_Iterator) - -template -ACE_Double_Linked_List_Iterator::ACE_Double_Linked_List_Iterator (const ACE_Double_Linked_List &dll) - : ACE_Double_Linked_List_Iterator_Base (dll) -{ - this->current_ = static_cast (dll.head_->next_); - // Advance current_ out of the null area and onto the first item in - // the list -} - -template void -ACE_Double_Linked_List_Iterator::reset (ACE_Double_Linked_List &dll) -{ - this->ACE_Double_Linked_List_Iterator_Base ::reset (dll); - this->current_ = static_cast (dll.head_->next_); - // Advance current_ out of the null area and onto the first item in - // the list -} - -template int -ACE_Double_Linked_List_Iterator::first (void) -{ - return this->go_head (); -} - -template int -ACE_Double_Linked_List_Iterator::advance (void) -{ - return this->do_advance () ? 1 : 0; -} - -template T* -ACE_Double_Linked_List_Iterator::advance_and_remove (int dont_remove) -{ - T* item = 0; - if (dont_remove) - this->do_advance (); - else - { - item = this->next (); - this->do_advance (); - // It seems dangerous to remove nodes in an iterator, but so it goes... - ACE_Double_Linked_List *dllist = - const_cast *> (this->dllist_); - dllist->remove (item); - } - return item; -} - -template void -ACE_Double_Linked_List_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -// Prefix advance. - -template -ACE_Double_Linked_List_Iterator & -ACE_Double_Linked_List_Iterator::operator++ (void) -{ - this->do_advance (); - return *this; -} - - -// Postfix advance. - -template -ACE_Double_Linked_List_Iterator -ACE_Double_Linked_List_Iterator::operator++ (int) -{ - ACE_Double_Linked_List_Iterator retv (*this); - this->do_advance (); - return retv; -} - - -// Prefix reverse. - -template -ACE_Double_Linked_List_Iterator & -ACE_Double_Linked_List_Iterator::operator-- (void) -{ - this->do_retreat (); - return *this; -} - - -// Postfix reverse. - -template -ACE_Double_Linked_List_Iterator -ACE_Double_Linked_List_Iterator::operator-- (int) -{ - ACE_Double_Linked_List_Iterator retv (*this); - this->do_retreat (); - return retv; -} - - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List_Reverse_Iterator) - - template -ACE_Double_Linked_List_Reverse_Iterator::ACE_Double_Linked_List_Reverse_Iterator (ACE_Double_Linked_List &dll) - : ACE_Double_Linked_List_Iterator_Base (dll) -{ - this->current_ = static_cast (dll.head_->prev_); - // Advance current_ out of the null area and onto the last item in - // the list -} - -template void -ACE_Double_Linked_List_Reverse_Iterator::reset (ACE_Double_Linked_List &dll) -{ - this->ACE_Double_Linked_List_Iterator_Base ::reset (dll); - this->current_ = static_cast (dll.head_->prev_); - // Advance current_ out of the null area and onto the last item in - // the list -} - -template int -ACE_Double_Linked_List_Reverse_Iterator::first (void) -{ - return this->go_tail (); -} - -template int -ACE_Double_Linked_List_Reverse_Iterator::advance (void) -{ - return this->do_retreat () ? 1 : 0; -} - -template T* -ACE_Double_Linked_List_Reverse_Iterator::advance_and_remove (int dont_remove) -{ - T* item = 0; - if (dont_remove) - this->do_retreat (); - else - { - item = this->next (); - this->do_retreat (); - // It seems dangerous to remove nodes in an iterator, but so it goes... - ACE_Double_Linked_List *dllist = - const_cast *> (this->dllist_); - dllist->remove (item); - } - return item; -} - -template void -ACE_Double_Linked_List_Reverse_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -// Prefix advance. - -template -ACE_Double_Linked_List_Reverse_Iterator & -ACE_Double_Linked_List_Reverse_Iterator::operator++ (void) -{ - this->do_retreat (); - return *this; -} - - -// Postfix advance. - -template -ACE_Double_Linked_List_Reverse_Iterator -ACE_Double_Linked_List_Reverse_Iterator::operator++ (int) -{ - ACE_Double_Linked_List_Reverse_Iterator retv (*this); - this->do_retreat (); - return retv; -} - - -// Prefix reverse. - -template -ACE_Double_Linked_List_Reverse_Iterator & -ACE_Double_Linked_List_Reverse_Iterator::operator-- (void) -{ - this->do_advance (); - return *this; -} - - -// Postfix reverse. - -template -ACE_Double_Linked_List_Reverse_Iterator -ACE_Double_Linked_List_Reverse_Iterator::operator-- (int) -{ - ACE_Double_Linked_List_Reverse_Iterator retv (*this); - this->do_advance (); - return retv; -} - - -ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List) - - template -ACE_Double_Linked_List:: ACE_Double_Linked_List (ACE_Allocator *alloc) - : size_ (0), allocator_ (alloc) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (T *) this->allocator_->malloc (sizeof (T)), - T); - this->init_head (); -} - -template -ACE_Double_Linked_List::ACE_Double_Linked_List (const ACE_Double_Linked_List &cx) - : allocator_ (cx.allocator_) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (T *) this->allocator_->malloc (sizeof (T)), - T); - this->init_head (); - this->copy_nodes (cx); - this->size_ = cx.size_; -} - -template void -ACE_Double_Linked_List::operator= (const ACE_Double_Linked_List &cx) -{ - if (this != &cx) - { - this->delete_nodes (); - this->copy_nodes (cx); - } -} - -template -ACE_Double_Linked_List::~ACE_Double_Linked_List (void) -{ - this->delete_nodes (); - - ACE_DES_FREE (head_, - this->allocator_->free, - T); - - this->head_ = 0; -} - -template int -ACE_Double_Linked_List::is_empty (void) const -{ - return this->size () ? 0 : 1; -} - -template int -ACE_Double_Linked_List::is_full (void) const -{ - return 0; // We have no bound. -} - -template T * -ACE_Double_Linked_List::insert_tail (T *new_item) -{ - // Insert it before , i.e., at tail. - this->insert_element (new_item, 1); - return new_item; -} - -template T * -ACE_Double_Linked_List::insert_head (T *new_item) -{ - this->insert_element (new_item); // Insert it after , i.e., at head. - return new_item; -} - -template T * -ACE_Double_Linked_List::delete_head (void) -{ - T *temp; - - if (this->is_empty ()) - return 0; - - temp = static_cast (this->head_->next_); - // Detach it from the list. - this->remove_element (temp); - return temp; -} - -template T * -ACE_Double_Linked_List::delete_tail (void) -{ - T *temp; - - if (this->is_empty ()) - return 0; - - temp = static_cast (this->head_->prev_); - // Detach it from the list. - this->remove_element (temp); - return temp; -} - -template void -ACE_Double_Linked_List::reset (void) -{ - this->delete_nodes (); -} - -template int -ACE_Double_Linked_List::get (T *&item, size_t slot) -{ - ACE_Double_Linked_List_Iterator iter (*this); - - for (size_t i = 0; - i < slot && !iter.done (); - i++) - iter.advance (); - - item = iter.next (); - return item ? 0 : -1; -} - -template size_t -ACE_Double_Linked_List::size (void) const -{ - return this->size_; -} - -template void -ACE_Double_Linked_List::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // Dump the state of an object. -#endif /* ACE_HAS_DUMP */ -} - -#if 0 -template T * -ACE_Double_Linked_List::find (const T &item) -{ - for (ACE_Double_Linked_List_Iterator iter (*this); - !iter.done (); - iter.advance ()) - { - T *temp = iter.next (); - - if (*temp == item) - return temp; - } - - return 0; -} - -template int -ACE_Double_Linked_List::remove (const T &item) -{ - T *temp = this->find (item); - - if (temp != 0) - return this->remove (temp); - else - return -1; -} -#endif /* 0 */ - -template int -ACE_Double_Linked_List::remove (T *n) -{ - return this->remove_element (n); -} - -template void -ACE_Double_Linked_List::delete_nodes (void) -{ - while (! this->is_empty ()) - { - T * temp = static_cast (this->head_->next_); - this->remove_element (temp); - ACE_DES_FREE (temp, - this->allocator_->free, - T); - } -} - -template void -ACE_Double_Linked_List::copy_nodes (const ACE_Double_Linked_List &c) -{ - for (ACE_Double_Linked_List_Iterator iter (c); - !iter.done (); - iter.advance ()) - { - T* temp = 0; - ACE_NEW_MALLOC (temp, - (T *)this->allocator_->malloc (sizeof (T)), - T (*iter.next ())); - this->insert_tail (temp); - } -} - -template void -ACE_Double_Linked_List::init_head (void) -{ - this->head_->next_ = this->head_; - this->head_->prev_ = this->head_; -} - -template int -ACE_Double_Linked_List::insert_element (T *new_item, - int before, - T *old_item) -{ - if (old_item == 0) - old_item = this->head_; - - if (before) - old_item = static_cast (old_item->prev_); - - new_item->next_ = old_item->next_; - new_item->next_->prev_ = new_item; - new_item->prev_ = old_item; - old_item->next_ = new_item; - this->size_++; - return 0; // Well, what will cause errors here? -} - -template int -ACE_Double_Linked_List::remove_element (T *item) -{ - // Notice that you have to ensure that item is an element of this - // list. We can't do much checking here. - - if (item == this->head_ || item->next_ == 0 - || item->prev_ == 0 || this->size () == 0) // Can't remove head - return -1; - - item->prev_->next_ = item->next_; - item->next_->prev_ = item->prev_; - item->next_ = item->prev_ = 0; // reset pointers to prevent double removal. - this->size_--; - return 0; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set) - -template size_t -ACE_Fixed_Set::size (void) const -{ - ACE_TRACE ("ACE_Fixed_Set::size"); - return this->cur_size_; -} - -template void -ACE_Fixed_Set::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Fixed_Set::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Set::~ACE_Fixed_Set (void) -{ - ACE_TRACE ("ACE_Fixed_Set::~ACE_Fixed_Set"); - this->cur_size_ = 0; -} - -template -ACE_Fixed_Set::ACE_Fixed_Set (const ACE_Fixed_Set &fs) - : cur_size_ (fs.cur_size_) -{ - ACE_TRACE ("ACE_Fixed_Set::ACE_Fixed_Set"); - - for (size_t i = 0, j = 0; i < fs.max_size_ && j < this->cur_size_; ++i) - if (fs.search_structure_[i].is_free_ == 0) - this->search_structure_[j++] = fs.search_structure_[i]; -} - -template void -ACE_Fixed_Set::operator= (const ACE_Fixed_Set &fs) -{ - ACE_TRACE ("ACE_Fixed_Set::operator="); - - if (this != &fs) - { - this->cur_size_ = fs.cur_size_; - - for (size_t i = 0, j = 0; i < fs.max_size_ && j < this->cur_size_; ++i) - if (fs.search_structure_[i].is_free_ == 0) - this->search_structure_[j++] = fs.search_structure_[i]; - } -} - -template -ACE_Fixed_Set::ACE_Fixed_Set (void) - : cur_size_ (0), - max_size_ (ACE_SIZE) -{ - ACE_TRACE ("ACE_Fixed_Set::ACE_Fixed_Set"); - for (size_t i = 0; i < this->max_size_; i++) - this->search_structure_[i].is_free_ = 1; -} - -template int -ACE_Fixed_Set::find (const T &item) const -{ - ACE_TRACE ("ACE_Fixed_Set::find"); - - for (size_t i = 0, j = 0; i < this->max_size_ && j < this->cur_size_; ++i) - if (this->search_structure_[i].is_free_ == 0) - { - if (this->search_structure_[i].item_ == item) - return 0; - ++j; - } - - return -1; -} - -template int -ACE_Fixed_Set::insert (const T &item) -{ - ACE_TRACE ("ACE_Fixed_Set::insert"); - ssize_t first_free = -1; // Keep track of first free slot. - size_t i; - - for (i = 0; - i < this->max_size_ && first_free == -1; - ++i) - - // First, make sure we don't allow duplicates. - - if (this->search_structure_[i].is_free_ == 0) - { - if (this->search_structure_[i].item_ == item) - return 1; - } - else - first_free = i; - - // If we found a free spot let's reuse it. - - if (first_free > -1) - { - this->search_structure_[first_free].item_ = item; - this->search_structure_[first_free].is_free_ = 0; - this->cur_size_++; - return 0; - } - else /* No more room! */ - { - errno = ENOMEM; - return -1; - } -} - -template int -ACE_Fixed_Set::remove (const T &item) -{ - ACE_TRACE ("ACE_Fixed_Set::remove"); - - for (size_t i = 0, j = 0; - i < this->max_size_ && j < this->cur_size_; - ++i) - if (this->search_structure_[i].is_free_ == 0) - { - if (this->search_structure_[i].item_ == item) - { - // Mark this entry as being free. - this->search_structure_[i].is_free_ = 1; - - --this->cur_size_; - return 0; - } - else - ++j; - } - - return -1; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set_Iterator_Base) - -template void -ACE_Fixed_Set_Iterator_Base::dump_i (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::dump_i"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Set_Iterator_Base::ACE_Fixed_Set_Iterator_Base (ACE_Fixed_Set &s) - : s_ (s), - next_ (-1), - iterated_items_ (0) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::ACE_Fixed_Set_Iterator_Base"); - this->advance (); -} - -template int -ACE_Fixed_Set_Iterator_Base::advance (void) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::advance"); - - if (this->iterated_items_ < this->s_.cur_size_) - { - for (++this->next_; - static_cast (this->next_) < this->s_.max_size_; - ++this->next_) - if (this->s_.search_structure_[this->next_].is_free_ == 0) - { - ++this->iterated_items_; - return 1; - } - } - else - ++this->next_; - - return 0; -} - -template int -ACE_Fixed_Set_Iterator_Base::first (void) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::first"); - - next_ = -1; - iterated_items_ = 0; - return this->advance (); -} - -template int -ACE_Fixed_Set_Iterator_Base::done (void) const -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::done"); - - return ! (this->iterated_items_ < this->s_.cur_size_); -} - -template int -ACE_Fixed_Set_Iterator_Base::next_i (T *&item) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::next_i"); - - if (static_cast (this->next_) < this->s_.max_size_) - do - { - if (this->s_.search_structure_[this->next_].is_free_ == 0) - { - item = &this->s_.search_structure_[this->next_].item_; - this->advance (); - return 1; - } - } - while (this->advance () == 1); - - return 0; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set_Iterator) - -template void -ACE_Fixed_Set_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Set_Iterator::ACE_Fixed_Set_Iterator (ACE_Fixed_Set &s) - : ACE_Fixed_Set_Iterator_Base (s) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator::ACE_Fixed_Set_Iterator"); -} - -template int -ACE_Fixed_Set_Iterator::next (T *&item) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator::next"); - return this->next_i (item); -} - -template int -ACE_Fixed_Set_Iterator::remove (T *&item) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator::remove"); - - if (this->s_.search_structure_[this->next_].is_free_ == 0) - { - item = &this->s_.search_structure_[this->next_].item_; - this->s_.remove (*item); - --(this->iterated_items_); - return 1; - } - - return 0; -} - -template T& -ACE_Fixed_Set_Iterator::operator* (void) -{ - T *retv = 0; - - if (this->s_.search_structure_[this->next_].is_free_ == 0) - retv = &this->s_.search_structure_[this->next_].item_; - - ACE_ASSERT (retv != 0); - - return *retv; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set_Const_Iterator) - -template void -ACE_Fixed_Set_Const_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Set_Const_Iterator::ACE_Fixed_Set_Const_Iterator (const ACE_Fixed_Set &s) - : ACE_Fixed_Set_Iterator_Base (s) -{ - ACE_TRACE ("ACE_Fixed_Set_Const_Iterator::ACE_Fixed_Set_Const_Iterator"); -} - -template int -ACE_Fixed_Set_Const_Iterator::next (const T *&item) -{ - ACE_TRACE ("ACE_Fixed_Set_Const_Iterator::next"); - - return this->next_i (item); -} - -template const T& -ACE_Fixed_Set_Const_Iterator::operator* (void) const -{ - const T *retv = 0; - - if (this->s_.search_structure_[this->next_].is_free_ == 0) - retv = &this->s_.search_structure_[this->next_].item_; - - ACE_ASSERT (retv != 0); - - return *retv; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Set) - -template void -ACE_Bounded_Set::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Bounded_Set::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Bounded_Set::~ACE_Bounded_Set (void) -{ - ACE_TRACE ("ACE_Bounded_Set::~ACE_Bounded_Set"); - delete [] this->search_structure_; -} - -template -ACE_Bounded_Set::ACE_Bounded_Set (void) - : cur_size_ (0), - max_size_ (static_cast (ACE_Bounded_Set::DEFAULT_SIZE)) -{ - ACE_TRACE ("ACE_Bounded_Set::ACE_Bounded_Set"); - - ACE_NEW (this->search_structure_, - ACE_TYPENAME ACE_Bounded_Set::Search_Structure[this->max_size_]); - - for (size_t i = 0; i < this->max_size_; ++i) - this->search_structure_[i].is_free_ = 1; -} - -template size_t -ACE_Bounded_Set::size (void) const -{ - ACE_TRACE ("ACE_Bounded_Set::size"); - return this->cur_size_; -} - -template -ACE_Bounded_Set::ACE_Bounded_Set (const ACE_Bounded_Set &bs) - : cur_size_ (bs.cur_size_), - max_size_ (bs.max_size_) -{ - ACE_TRACE ("ACE_Bounded_Set::ACE_Bounded_Set"); - - ACE_NEW (this->search_structure_, - ACE_TYPENAME ACE_Bounded_Set::Search_Structure[this->max_size_]); - - for (size_t i = 0; i < this->cur_size_; i++) - this->search_structure_[i] = bs.search_structure_[i]; -} - -template void -ACE_Bounded_Set::operator= (const ACE_Bounded_Set &bs) -{ - ACE_TRACE ("ACE_Bounded_Set::operator="); - - if (this != &bs) - { - if (this->max_size_ < bs.cur_size_) - { - delete [] this->search_structure_; - ACE_NEW (this->search_structure_, - ACE_TYPENAME ACE_Bounded_Set::Search_Structure[bs.cur_size_]); - this->max_size_ = bs.cur_size_; - } - - this->cur_size_ = bs.cur_size_; - - for (size_t i = 0; i < this->cur_size_; i++) - this->search_structure_[i] = bs.search_structure_[i]; - } -} - -template -ACE_Bounded_Set::ACE_Bounded_Set (size_t size) - : cur_size_ (0), - max_size_ (size) -{ - ACE_TRACE ("ACE_Bounded_Set::ACE_Bounded_Set"); - ACE_NEW (this->search_structure_, - ACE_TYPENAME ACE_Bounded_Set::Search_Structure[size]); - - for (size_t i = 0; i < this->max_size_; i++) - this->search_structure_[i].is_free_ = 1; -} - -template int -ACE_Bounded_Set::find (const T &item) const -{ - ACE_TRACE ("ACE_Bounded_Set::find"); - - for (size_t i = 0; i < this->cur_size_; i++) - if (this->search_structure_[i].item_ == item - && this->search_structure_[i].is_free_ == 0) - return 0; - - return -1; -} - -template int -ACE_Bounded_Set::insert (const T &item) -{ - ACE_TRACE ("ACE_Bounded_Set::insert"); - int first_free = -1; // Keep track of first free slot. - size_t i; - - for (i = 0; i < this->cur_size_; i++) - // First, make sure we don't allow duplicates. - - if (this->search_structure_[i].item_ == item - && this->search_structure_[i].is_free_ == 0) - return 1; - else if (this->search_structure_[i].is_free_ && first_free == -1) - first_free = static_cast (i); - - if (first_free > -1) // If we found a free spot let's reuse it. - { - this->search_structure_[first_free].item_ = item; - this->search_structure_[first_free].is_free_ = 0; - return 0; - } - else if (i < this->max_size_) // Insert at the end of the active portion. - { - this->search_structure_[i].item_ = item; - this->search_structure_[i].is_free_ = 0; - this->cur_size_++; - return 0; - } - else /* No more room! */ - { - errno = ENOMEM; - return -1; - } -} - -template int -ACE_Bounded_Set::remove (const T &item) -{ - ACE_TRACE ("ACE_Bounded_Set::remove"); - for (size_t i = 0; i < this->cur_size_; i++) - if (this->search_structure_[i].item_ == item) - { - // Mark this entry as being free. - this->search_structure_[i].is_free_ = 1; - - // If we just unbound the highest entry, then we need to - // figure out where the next highest active entry is. - if (i + 1 == this->cur_size_) - { - while (i > 0 && this->search_structure_[--i].is_free_) - continue; - - if (i == 0 && this->search_structure_[i].is_free_) - this->cur_size_ = 0; - else - this->cur_size_ = i + 1; - } - return 0; - } - - return -1; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Set_Iterator) - - template void -ACE_Bounded_Set_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Bounded_Set_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Bounded_Set_Iterator::ACE_Bounded_Set_Iterator (ACE_Bounded_Set &s) - : s_ (s), - next_ (-1) -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::ACE_Bounded_Set_Iterator"); - this->advance (); -} - -template int -ACE_Bounded_Set_Iterator::advance (void) -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::advance"); - - for (++this->next_; - static_cast (this->next_) < this->s_.cur_size_ - && this->s_.search_structure_[this->next_].is_free_; - ++this->next_) - continue; - - return static_cast (this->next_) < this->s_.cur_size_; -} - -template int -ACE_Bounded_Set_Iterator::first (void) -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::first"); - - next_ = -1; - return this->advance (); -} - -template int -ACE_Bounded_Set_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::done"); - - return static_cast (this->next_) >= - this->s_.cur_size_; -} - -template int -ACE_Bounded_Set_Iterator::next (T *&item) -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::next"); - if (static_cast (this->next_) < this->s_.cur_size_) - { - item = &this->s_.search_structure_[this->next_].item_; - return 1; - } - else - return 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_DNode) - - template -ACE_DNode::ACE_DNode (const T &i, ACE_DNode *n, ACE_DNode *p) - : next_ (n), prev_ (p), item_ (i) -{ -} - -# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) -template -ACE_DNode::~ACE_DNode (void) -{ -} -# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ - -// **************************************************************** - -template void -ACE_Unbounded_Stack_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Unbounded_Stack_Iterator::ACE_Unbounded_Stack_Iterator (ACE_Unbounded_Stack &q) - : current_ (q.head_->next_), - stack_ (q) -{ - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::ACE_Unbounded_Stack_Iterator"); -} - -template int -ACE_Unbounded_Stack_Iterator::advance (void) -{ - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::advance"); - this->current_ = this->current_->next_; - return this->current_ != this->stack_.head_; -} - -template int -ACE_Unbounded_Stack_Iterator::first (void) -{ - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::first"); - this->current_ = this->stack_.head_->next_; - return this->current_ != this->stack_.head_; -} - -template int -ACE_Unbounded_Stack_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Unbounded_Stack_Iterator::done"); - - return this->current_ == this->stack_.head_; -} - -template int -ACE_Unbounded_Stack_Iterator::next (T *&item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::next"); - if (this->current_ == this->stack_.head_) - return 0; - else - { - item = &this->current_->item_; - return 1; - } -} - - -ACE_ALLOC_HOOK_DEFINE(ACE_Ordered_MultiSet) - - - template -ACE_Ordered_MultiSet::ACE_Ordered_MultiSet (ACE_Allocator *alloc) - : head_ (0) - , tail_ (0) - , cur_size_ (0) - , allocator_ (alloc) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::ACE_Ordered_MultiSet"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); -} - -template -ACE_Ordered_MultiSet::ACE_Ordered_MultiSet (const ACE_Ordered_MultiSet &us) - : head_ (0) - , tail_ (0) - , cur_size_ (0) - , allocator_ (us.allocator_) -{ - ACE_TRACE ("ACE_Ordered_MultiSet::ACE_Ordered_MultiSet"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - this->copy_nodes (us); -} - -template -ACE_Ordered_MultiSet::~ACE_Ordered_MultiSet (void) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::~ACE_Ordered_MultiSet"); - - this->delete_nodes (); -} - - -template void -ACE_Ordered_MultiSet::operator= (const ACE_Ordered_MultiSet &us) -{ - ACE_TRACE ("ACE_Ordered_MultiSet::operator="); - - if (this != &us) - { - this->delete_nodes (); - this->copy_nodes (us); - } -} - - -template int -ACE_Ordered_MultiSet::insert (const T &item) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::insert"); - - return this->insert_from (item, this->head_, 0); -} - -template int -ACE_Ordered_MultiSet::insert (const T &new_item, - ITERATOR &iter) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::insert using iterator"); - - return this->insert_from (new_item, iter.current_, &iter.current_); -} - -template int -ACE_Ordered_MultiSet::remove (const T &item) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::remove"); - - ACE_DNode *node = 0; - - int result = locate (item, 0, node); - - // if we found the node, remove from list and free it - if (node && (result == 0)) - { - if (node->prev_) - node->prev_->next_ = node->next_; - else - head_ = node->next_; - - if (node->next_) - node->next_->prev_ = node->prev_; - else - tail_ = node->prev_; - - this->cur_size_--; - - ACE_DES_FREE_TEMPLATE (node, - this->allocator_->free, - ACE_DNode, - ); - return 0; - } - - return -1; -} - -template int -ACE_Ordered_MultiSet::find (const T &item, - ITERATOR &iter) const -{ - // search an occurance of item, using iterator's current position as a hint - ACE_DNode *node = iter.current_; - int result = locate (item, node, node); - - // if we found the node, update the iterator and indicate success - if (node && (result == 0)) - { - iter.current_ = node; - return 0; - } - - return -1; -} - - - -template void -ACE_Ordered_MultiSet::reset (void) -{ - ACE_TRACE ("reset"); - - this->delete_nodes (); -} - -template void -ACE_Ordered_MultiSet::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Ordered_MultiSet::dump"); - // - // ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nhead_ = %u"), this->head_)); - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nhead_->next_ = %u"), this->head_->next_)); - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncur_size_ = %d\n"), this->cur_size_)); - // - // T *item = 0; - // size_t count = 1; - // - // for (ACE_Ordered_MultiSet_Iterator iter (*(ACE_Ordered_MultiSet *) this); - // iter.next (item) != 0; - // iter.advance ()) - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("count = %d\n"), count++)); - // - // ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Ordered_MultiSet::insert_from (const T &item, ACE_DNode *position, - ACE_DNode **new_position) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::insert_from"); - - // create a new node - ACE_DNode *temp; - ACE_NEW_MALLOC_RETURN (temp, - static_cast*> (this->allocator_->malloc (sizeof (ACE_DNode))), - ACE_DNode (item), - -1); - // obtain approximate location of the node - int result = locate (item, position, position); - - // if there are nodes in the multiset - if (position) - { - switch (result) - { - // insert after the approximate position - case -1: - - // if there is a following node - if (position->next_) - { - // link up with the following node - position->next_->prev_ = temp; - temp->next_ = position->next_; - } - else - // appending to the end of the set - tail_ = temp; - - // link up with the preceeding node - temp->prev_ = position; - position->next_ = temp; - - break; - - // insert before the position - case 0: - case 1: - - // if there is a preceeding node - if (position->prev_) - { - // link up with the preceeding node - position->prev_->next_ = temp; - temp->prev_ = position->prev_; - } - else - // prepending to the start of the set - head_ = temp; - - // link up with the preceeding node - temp->next_ = position; - position->prev_ = temp; - - break; - - default: - return -1; - } - } - else - { - // point the head and tail to the new node. - this->head_ = temp; - this->tail_ = temp; - } - - this->cur_size_++; - if (new_position) - *new_position = temp; - - return 0; -} - -template int -ACE_Ordered_MultiSet::locate (const T &item, ACE_DNode *start_position, - ACE_DNode *&new_position) const -{ - if (! start_position) - start_position = this->head_; - - // If starting before the item, move forward until at or just before - // item. - while (start_position && start_position->item_ < item && - start_position->next_) - start_position = start_position->next_; - - // If starting after the item, move back until at or just after item - while (start_position && item < start_position->item_ && - start_position->prev_) - start_position = start_position->prev_; - - // Save the (approximate) location in the passed pointer. - new_position = start_position; - - // Show the location is after (1), before (-1) , or at (0) the item - if (!new_position) - return 1; - else if (item < new_position->item_) - return 1; - else if (new_position->item_ < item) - return -1; - else - return 0; -} - -// Looks for first occurance of in the ordered set, using the -// passed starting position as a hint: if there is such an instance, -// it updates the new_position pointer to point to one such node and -// returns 0; if there is no such node, then if there is a node before -// where the item would have been, it updates the new_position pointer -// to point to this node and returns -1; if there is no such node, -// then if there is a node after where the item would have been, it -// updates the new_position pointer to point to this node (or 0 if -// there is no such node) and returns 1; - -template void -ACE_Ordered_MultiSet::copy_nodes (const ACE_Ordered_MultiSet &us) -{ - ACE_DNode *insertion_point = this->head_; - - for (ACE_DNode *curr = us.head_; - curr != 0; - curr = curr->next_) - this->insert_from (curr->item_, insertion_point, &insertion_point); -} - -template void -ACE_Ordered_MultiSet::delete_nodes (void) -{ - // iterate through list, deleting nodes - for (ACE_DNode *curr = this->head_; - curr != 0; - ) - { - ACE_DNode *temp = curr; - curr = curr->next_; - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_DNode, - ); - } - - this->head_ = 0; - this->tail_ = 0; - this->cur_size_ = 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Ordered_MultiSet_Iterator) - -template -ACE_Ordered_MultiSet_Iterator::ACE_Ordered_MultiSet_Iterator (ACE_Ordered_MultiSet &s) - : current_ (s.head_), - set_ (s) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::ACE_Ordered_MultiSet_Iterator"); -} - -template int -ACE_Ordered_MultiSet_Iterator::next (T *&item) const -{ - // ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::next"); - if (this->current_) - { - item = &this->current_->item_; - return 1; - } - - return 0; -} - -template T& -ACE_Ordered_MultiSet_Iterator::operator* (void) -{ - //ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::operator*"); - T *retv = 0; - - int result = this->next (retv); - ACE_ASSERT (result != 0); - ACE_UNUSED_ARG (result); - - return *retv; -} - -ACE_ALLOC_HOOK_DEFINE (ACE_DLList_Node) - -template T * -ACE_DLList::insert_tail (T *new_item) -{ - ACE_DLList_Node *temp1, *temp2; - ACE_NEW_MALLOC_RETURN (temp1, - static_cast (this->allocator_->malloc (sizeof (ACE_DLList_Node))), - ACE_DLList_Node ((void *&)new_item), - 0); - temp2 = ACE_DLList_Base::insert_tail (temp1); - return (T *) (temp2 ? temp2->item_ : 0); -} - -template T * -ACE_DLList::insert_head (T *new_item) -{ - ACE_DLList_Node *temp1; - ACE_NEW_MALLOC_RETURN (temp1, - (ACE_DLList_Node *) this->allocator_->malloc (sizeof (ACE_DLList_Node)), - ACE_DLList_Node ((void *&)new_item), 0); - ACE_DLList_Node *temp2 = - ACE_DLList_Base::insert_head (temp1); - return (T *) (temp2 ? temp2->item_ : 0); -} - -template T * -ACE_DLList::delete_head (void) -{ - ACE_DLList_Node *temp1 = ACE_DLList_Base::delete_head (); - T *temp2 = (T *) (temp1 ? temp1->item_ : 0); - ACE_DES_FREE (temp1, - this->allocator_->free, - ACE_DLList_Node); - - return temp2; -} - -template T * -ACE_DLList::delete_tail (void) -{ - ACE_DLList_Node *temp1 = ACE_DLList_Base::delete_tail (); - T *temp2 = (T *) (temp1 ? temp1->item_ : 0); - ACE_DES_FREE (temp1, - this->allocator_->free, - ACE_DLList_Node); - return temp2; -} - -// **************************************************************** - -// Compare this array with for equality. - -template bool -ACE_Array::operator== (const ACE_Array &s) const -{ - if (this == &s) - return true; - else if (this->size () != s.size ()) - return false; - - const size_t len = s.size (); - for (size_t slot = 0; slot < len; ++slot) - if ((*this)[slot] != s[slot]) - return false; - - return true; -} - -// **************************************************************** - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CONTAINERS_T_CPP */ diff --git a/ace/Containers_T.h b/ace/Containers_T.h deleted file mode 100644 index e34a0bf781e..00000000000 --- a/ace/Containers_T.h +++ /dev/null @@ -1,2026 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Containers_T.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_CONTAINERS_T_H -#define ACE_CONTAINERS_T_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Need by ACE_DLList_Node. -#include "ace/Containers.h" - -// Shared with "ace/Unbounded_Set.h" -#include "ace/Node.h" - -// Backwards compatibility, please include "ace/Array_Base.h" directly. -#include "ace/Array_Base.h" - -// Backwards compatibility, please include "ace/Unbounded_Set.h" directly. -#include "ace/Unbounded_Set.h" - -// Backwards compatibility, please include "ace/Unbounded_Queue.h" directly. -#include "ace/Unbounded_Queue.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Allocator; - - -/** - * @class ACE_Bounded_Stack - * - * @brief Implement a generic LIFO abstract data type. - * - * This implementation of a Stack uses a bounded array - * that is allocated dynamically. The Stack interface - * provides the standard constant time push, pop, and top - * operations. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Dynamic array - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * N/A - * - Insert/replace speed - * N/A - * - Iterator still valid after change to container? - * N/A - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * - */ -template -class ACE_Bounded_Stack -{ -public: - // = Initialization, assignment, and termination methods. - - /// Initialize a new empty stack with the provided size.. - /** - * Initialize and allocate space for a new Bounded_Stack with the provided - * size. - */ - ACE_Bounded_Stack (size_t size); - - /// Initialize the stack to be a copy of the stack provided. - /** - * Initialize the stack to be an exact copy of the Bounded_Stack provided - * as a parameter. - */ - ACE_Bounded_Stack (const ACE_Bounded_Stack &s); - - /// Assignment operator - /** - * Perform a deep copy operation using the Bounded_Stack parameter. If the - * capacity of the lhs isn't sufficient for the rhs, then the underlying data - * structure will be reallocated to accomadate the larger number of elements. - */ - void operator= (const ACE_Bounded_Stack &s); - - /// Perform actions needed when stack goes out of scope. - /** - * Deallocate the memory used by the Bounded_Stack. - */ - ~ACE_Bounded_Stack (void); - - // = Classic Stack operations. - - ///Add an element to the top of the stack. - /** - * Place a new item on top of the stack. Returns -1 if the stack - * is already full, 0 if the stack is not already full, and -1 if - * failure occurs. - */ - int push (const T &new_item); - - ///Remove an item from the top of stack. - /** - * Remove and return the top stack item. Returns -1 if the stack is - * already empty, 0 if the stack is not already empty, and -1 if - * failure occurs. - */ - int pop (T &item); - - ///Examine the contents of the top of stack. - /** - * Return top stack item without removing it. Returns -1 if the - * stack is already empty, 0 if the stack is not already empty, and - * -1 if failure occurs. - */ - int top (T &item) const; - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Performs constant time check to determine if the stack is empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Performs constant time check to determine if the stack is at capacity. - */ - int is_full (void) const; - - /// The number of items in the stack. - /** - * Return the number of items currently in the stack. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Size of the dynamically allocated data. - size_t size_; - - /// Keeps track of the current top of stack. - size_t top_; - - /// Holds the stack's contents. - T *stack_; -}; - -//---------------------------------------- - - -/** - * @class ACE_Fixed_Stack - * - * @brief Implement a generic LIFO abstract data type. - * - * This implementation of a Stack uses a fixed array - * with the size fixed at instantiation time. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Fixed array - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * N/A - * - Insert/replace speed - * N/A - * - Iterator still valid after change to container? - * N/A - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * - */ -template -class ACE_Fixed_Stack -{ -public: - // = Initialization, assignment, and termination methods. - /// Initialize a new stack so that it is empty. - /** - * Initialize an empty stack. - */ - ACE_Fixed_Stack (void); - - /// The copy constructor (performs initialization). - /** - * Initialize the stack and copy the provided stack into the current stack. - */ - ACE_Fixed_Stack (const ACE_Fixed_Stack &s); - - /// Assignment operator (performs assignment). - /** - * Perform a deep copy of the provided stack. - */ - void operator= (const ACE_Fixed_Stack &s); - - /// Perform actions needed when stack goes out of scope. - /** - * Destroy the stack. - */ - ~ACE_Fixed_Stack (void); - - // = Classic Stack operations. - - ///Constant time placement of element on top of stack. - /** - * Place a new item on top of the stack. Returns -1 if the stack - * is already full, 0 if the stack is not already full, and -1 if - * failure occurs. - */ - int push (const T &new_item); - - ///Constant time removal of top of stack. - /** - * Remove and return the top stack item. Returns -1 if the stack is - * already empty, 0 if the stack is not already empty, and -1 if - * failure occurs. - */ - int pop (T &item); - - ///Constant time examination of top of stack. - /** - * Return top stack item without removing it. Returns -1 if the - * stack is already empty, 0 if the stack is not already empty, and - * -1 if failure occurs. - */ - int top (T &item) const; - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Performs constant time check to see if stack is empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Performs constant time check to see if stack is full. - */ - int is_full (void) const; - - /// The number of items in the stack. - /** - * Constant time access to the current size of the stack. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Size of the allocated data. - size_t size_; - - /// Keeps track of the current top of stack. - size_t top_; - - /// Holds the stack's contents. - T stack_[ACE_SIZE]; -}; - -//---------------------------------------- - -template class ACE_Ordered_MultiSet; -template class ACE_Ordered_MultiSet_Iterator; - -/** - * @class ACE_DNode - * - * @brief Implementation element in a bilinked list. - */ -template -class ACE_DNode -{ - friend class ACE_Ordered_MultiSet; - friend class ACE_Ordered_MultiSet_Iterator; - -public: - -# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) - /// This isn't necessary, but it keeps some compilers happy. - ~ACE_DNode (void); -# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ - -private: - - // = Initialization methods - ACE_DNode (const T &i, ACE_DNode *n = 0, ACE_DNode *p = 0); - - /// Pointer to next element in the list of {ACE_DNode}s. - ACE_DNode *next_; - - /// Pointer to previous element in the list of {ACE_DNode}s. - ACE_DNode *prev_; - - /// Current value of the item in this node. - T item_; -}; - - - -/** - * @class ACE_Unbounded_Stack - * - * @brief Implement a generic LIFO abstract data type. - * - * This implementation of an unbounded Stack uses a linked list. - * If you use the {insert} or {remove} methods you should keep - * in mind that duplicate entries aren't allowed. In general, - * therefore, you should avoid the use of these methods since - * they aren't really part of the ADT stack. The stack is implemented - * as a doubly linked list. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Double linked list - * - Duplicates allowed? - * No - * - Random access allowed? - * No - * - Search speed - * Linear - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * Yes - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * - */ -template -class ACE_Unbounded_Stack -{ -public: - friend class ACE_Unbounded_Stack_Iterator; - - // Trait definition. - typedef ACE_Unbounded_Stack_Iterator ITERATOR; - - // = Initialization, assignment, and termination methods. - /// Initialize a new stack so that it is empty. Use user defined - /// allocation strategy if specified. - /** - * Initialize an empty stack using the user specified allocation strategy - * if provided. - */ - ACE_Unbounded_Stack (ACE_Allocator *the_allocator = 0); - - /// The copy constructor (performs initialization). - /** - * Initialize this stack to be an exact copy of {s}. - */ - ACE_Unbounded_Stack (const ACE_Unbounded_Stack &s); - - /// Assignment operator (performs assignment). - /** - * Perform a deep copy of the rhs into the lhs. - */ - void operator= (const ACE_Unbounded_Stack &s); - - /// Perform actions needed when stack goes out of scope. - /** - * Destroy the underlying list for the stack. - */ - ~ACE_Unbounded_Stack (void); - - // = Classic Stack operations. - - - ///Push an element onto the top of stack. - /** - * Place a new item on top of the stack. Returns -1 if the stack - * is already full, 0 if the stack is not already full, and -1 if - * failure occurs. - */ - int push (const T &new_item); - - ///Pop the top element of the stack. - /** - * Remove and return the top stack item. Returns -1 if the stack is - * already empty, 0 if the stack is not already empty, and -1 if - * failure occurs. - */ - int pop (T &item); - - ///Examine the top of the stack. - /** - * Return top stack item without removing it. Returns -1 if the - * stack is already empty, 0 if the stack is not already empty, and - * -1 if failure occurs. - */ - int top (T &item) const; - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Constant time check to see if the stack is empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Always resturns 0 since the stack is unbounded. - */ - int is_full (void) const; - - // = Auxiliary methods (not strictly part of the Stack ADT). - - ///Linear Insert of an item. - /** - * Insert {new_item} into the Stack at the head (but doesn't allow - * duplicates). Returns -1 if failures occur, 1 if item is already - * present (i.e., no duplicates are allowed), else 0. - */ - int insert (const T &new_item); - - /// Remove @a item from the Stack. Returns 0 if it removes the item, - /// -1 if it can't find the item, and -1 if a failure occurs. - /** - * Linear remove operation. - */ - int remove (const T &item); - - /// Finds if @a item occurs the set. Returns 0 if finds, else -1. - /** - * Linear find operation. - */ - int find (const T &item) const; - - /// The number of items in the stack. - /** - * Constant time access to the current stack size. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Delete all the nodes in the stack. - void delete_all_nodes (void); - - /// Copy all nodes from {s} to {this}. - void copy_all_nodes (const ACE_Unbounded_Stack &s); - - /// Head of the linked list of Nodes. - ACE_Node *head_; - - /// Current size of the stack. - size_t cur_size_; - - /// Allocation strategy of the stack. - ACE_Allocator *allocator_; -}; - -/** - * @class ACE_Unbounded_Stack_Iterator - * - * @brief Implement an iterator over an unbounded Stack. - */ -template -class ACE_Unbounded_Stack_Iterator -{ -public: - // = Initialization method. - /// Move to the first element in the {stack}. - ACE_Unbounded_Stack_Iterator (ACE_Unbounded_Stack &stack); - - // = Iteration methods. - - /// Pass back the @a next_item that hasn't been seen in the Stack. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the Stack. Returns 0 when all the - /// items in the Stack have been seen, else 1. - int advance (void); - - /// Move to the first element in the Stack. Returns 0 if the - /// Stack is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Pointer to the current node in the iteration. - ACE_Node *current_; - - /// Pointer to the Stack we're iterating over. - ACE_Unbounded_Stack &stack_; -}; - -template -class ACE_Double_Linked_List; - -/** - * @class ACE_Double_Linked_List_Iterator_Base - * - * @brief Implements a common base class for iterators for a double - * linked list ADT - */ -template -class ACE_Double_Linked_List_Iterator_Base -{ -public: - // = Iteration methods. - - /// Passes back the {entry} under the iterator. Returns 0 if the - /// iteration has completed, otherwise 1 - int next (T *&) const; - - /** - * @deprecated Return the address of next (current) unvisited item in - * the list. 0 if there is no more element available. - */ - T *next (void) const; - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// STL-like iterator dereference operator: returns a reference - /// to the node underneath the iterator. - T & operator* (void) const ; - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. @@ Here be dragons. Comments? - */ - void reset (ACE_Double_Linked_List &); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Initialization methods. - - /// Constructor - ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List &); - - /// Copy constructor. - ACE_Double_Linked_List_Iterator_Base (const - ACE_Double_Linked_List_Iterator_Base - &iter); - - // = Iteration methods. - /** - * Move to the first element of the list. Returns 0 if the list is - * empty, else 1. - * @note the head of the ACE_DLList is actually a null entry, so the - * first element is actually the 2n'd entry - */ - int go_head (void); - - /// Move to the last element of the list. Returns 0 if the list is - /// empty, else 1. - int go_tail (void); - - /** - * Check if we reach the end of the list. Can also be used to get - * the *current* element in the list. Return the address of the - * current item if there are still elements left , 0 if we run out - * of element. - */ - T *not_done (void) const ; - - /// Advance to the next element in the list. Return the address of the - /// next element if there are more, 0 otherwise. - T *do_advance (void); - - /// Retreat to the previous element in the list. Return the address - /// of the previous element if there are more, 0 otherwise. - T *do_retreat (void); - - /// Dump the state of an object. - void dump_i (void) const; - - /// Remember where we are. - T *current_; - - const ACE_Double_Linked_List *dllist_; -}; - -/** - * @class ACE_Double_Linked_List_Iterator - * - * @brief Implements an iterator for a double linked list ADT - * - * Iterate thru the double-linked list. This class provides - * an interface that let users access the internal element - * addresses directly. Notice {class T} must declare - * ACE_Double_Linked_List<T>, - * ACE_Double_Linked_List_Iterator_Base <T> and - * ACE_Double_Linked_List_Iterator as friend classes and class T - * should also have data members T* next_ and T* prev_. - */ -template -class ACE_Double_Linked_List_Iterator : public ACE_Double_Linked_List_Iterator_Base -{ -public: - // = Initialization method. - ACE_Double_Linked_List_Iterator (const ACE_Double_Linked_List &); - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. - * @@ Here be dragons. Comments? - */ - void reset (ACE_Double_Linked_List &); - - /// Move to the first element in the list. Returns 0 if the - /// list is empty, else 1. - int first (void); - - /// Move forward by one element in the list. Returns 0 when all the - /// items in the list have been seen, else 1. - int advance (void); - - /** - * Advance the iterator while removing the original item from the - * list. Return a pointer points to the original (removed) item. - * If {dont_remove} equals 0, this function behaves like {advance} - * but return 0 (NULL) instead. - */ - T* advance_and_remove (int dont_remove); - - // = STL-style iteration methods - - /// Prefix advance. - ACE_Double_Linked_List_Iterator & operator++ (void); - - /// Postfix advance. - ACE_Double_Linked_List_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Double_Linked_List_Iterator & operator-- (void); - - /// Postfix reverse. - ACE_Double_Linked_List_Iterator operator-- (int); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Double_Linked_List_Reverse_Iterator - * - * @brief Implements a reverse iterator for a double linked list ADT - * - * Iterate backwards over the double-linked list. This class - * provide an interface that let users access the internal - * element addresses directly, which seems to break the - * encapsulation. Notice {class T} must declare - * ACE_Double_Linked_List<T>, - * ACE_Double_Linked_List_Iterator_Base <T> and - * ACE_Double_Linked_List_Iterator as friend classes and class T - * should also have data members T* next_ and T* prev_. - */ -template -class ACE_Double_Linked_List_Reverse_Iterator : public ACE_Double_Linked_List_Iterator_Base -{ -public: - // = Initialization method. - ACE_Double_Linked_List_Reverse_Iterator (ACE_Double_Linked_List &); - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. - * @@ Here be dragons. Comments? - */ - void reset (ACE_Double_Linked_List &); - - /// Move to the first element in the list. Returns 0 if the - /// list is empty, else 1. - int first (void); - - /// Move forward by one element in the list. Returns 0 when all the - /// items in the list have been seen, else 1. - int advance (void); - - /** - * Advance the iterator while removing the original item from the - * list. Return a pointer points to the original (removed) item. - * If {dont_remove} equals 0, this function behaves like {advance} - * but return 0 (NULL) instead. - */ - T* advance_and_remove (int dont_remove); - - // = STL-style iteration methods - - /// Prefix advance. - ACE_Double_Linked_List_Reverse_Iterator & operator++ (void); - - /// Postfix advance. - ACE_Double_Linked_List_Reverse_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Double_Linked_List_Reverse_Iterator & operator-- (void); - - /// Postfix reverse. - ACE_Double_Linked_List_Reverse_Iterator operator-- (int); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - - -/** - * @class ACE_Double_Linked_List - * - * @brief A double-linked list implementation. - * - * This implementation of an unbounded double-linked list uses a - * circular linked list with a dummy node. It is pretty much - * like the {ACE_Unbounded_Queue} except that it allows removing - * of a specific element from a specific location. - * Notice that this class is an implementation of a very simple - * data structure. This is *NOT* a container class. You can use the - * class to implement other contains classes but it is *NOT* a - * general purpose container class. - * The parameter class *MUST* have members T* prev and T* next - * and users of this class are responsible to follow the general - * rules of using double-linked lists to maintaining the list - * integrity. - * If you need a double linked container class, use the DLList - * class which is a container but delegates to the Double_Linked_List - * class. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Double Linked List - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * N/A - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * - */ -template -class ACE_Double_Linked_List -{ -public: - friend class ACE_Double_Linked_List_Iterator_Base; - friend class ACE_Double_Linked_List_Iterator; - friend class ACE_Double_Linked_List_Reverse_Iterator; - - // Trait definition. - typedef ACE_Double_Linked_List_Iterator ITERATOR; - typedef ACE_Double_Linked_List_Reverse_Iterator REVERSE_ITERATOR; - - // = Initialization and termination methods. - /// construction. Use user specified allocation strategy - /// if specified. - /** - * Initialize an empy list using the allocation strategy specified by the user. - * If none is specified, then use default allocation strategy. - */ - ACE_Double_Linked_List (ACE_Allocator *the_allocator = 0); - - /// Copy constructor. - /** - * Create a double linked list that is a copy of the provided - * parameter. - */ - ACE_Double_Linked_List (const ACE_Double_Linked_List &); - - /// Assignment operator. - /** - * Perform a deep copy of the provided list by first deleting the nodes of the - * lhs and then copying the nodes of the rhs. - */ - void operator= (const ACE_Double_Linked_List &); - - /// Destructor. - /** - * Clean up the memory allocated for the nodes of the list. - */ - ~ACE_Double_Linked_List (void); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, 0 otherwise. - /** - * Performs constant time check to determine if the list is empty. - */ - int is_empty (void) const; - - /// The list is unbounded, so this always returns 0. - /** - * Since the list is unbounded, the method simply returns 0. - */ - int is_full (void) const; - - // = Classic queue operations. - - /// Adds to the tail of the list. Returns the new item - /// that was inserted. - /** - * Provides constant time insertion at the end of the list structure. - */ - T *insert_tail (T *new_item); - - /// Adds to the head of the list.Returns the new item that - /// was inserted. - /** - * Provides constant time insertion at the head of the list. - */ - T *insert_head (T *new_item); - - /// Removes the head of the list and returns a pointer to that item. - /** - * Removes and returns the first {item} in the list. Returns - * internal node's address on success, 0 if the queue was empty. - * This method will *not* free the internal node. - */ - T* delete_head (void); - - /// Removes the tail of the list and returns a pointer to that item. - /** - * Removes and returns the last {item} in the list. Returns - * internal nodes's address on success, 0 if the queue was - * empty. This method will *not* free the internal node. - */ - T *delete_tail (void); - - // = Additional utility methods. - - ///Empty the list. - /** - * Reset the {ACE_Double_Linked_List} to be empty. - * Notice that since no one is interested in the items within, - * This operation will delete all items. - */ - void reset (void); - - /// Get the {slot}th element in the set. Returns -1 if the element - /// isn't in the range {0..{size} - 1}, else 0. - /** - * Iterates through the list to the desired index and assigns the provides pointer - * with the address of the node occupying that index. - */ - int get (T *&item, size_t slot = 0); - - /// The number of items in the queue. - /** - * Constant time call to return the current size of the list. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Use DNode address directly. - /** - * Constant time removal of an item from the list using it's address. - */ - int remove (T *n); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Delete all the nodes in the list. - /** - * Removes and deallocates memory for all of the list nodes. - */ - void delete_nodes (void); - - /// Copy nodes from {rhs} into this list. - /** - * Copy the elements of the provided list by allocated new nodes and assigning - * them with the proper data. - */ - void copy_nodes (const ACE_Double_Linked_List &rhs); - - /// Setup header pointer. Called after we create the head node in ctor. - /** - * Initialize the head pointer so that the list has a dummy node. - */ - void init_head (void); - - ///Constant time insert a new item into the list structure. - /** - * Insert a @a new_item into the list. It will be added before - * or after @a old_item. Default is to insert the new item *after* - * {head_}. Return 0 if succeed, -1 if error occured. - */ - int insert_element (T *new_item, - int before = 0, - T *old_item = 0); - - ///Constant time delete an item from the list structure. - /** - * Remove @a item from the list. Return 0 if succeed, -1 otherwise. - * Notice that this function checks if item is {head_} and either its - * {next_} or {prev_} is NULL. The function resets item's {next_} and - * {prev_} to 0 to prevent clobbering the double-linked list if a user - * tries to remove the same node again. - */ - int remove_element (T *item); - - /// Head of the circular double-linked list. - T *head_; - - /// Size of this list. - size_t size_; - - /// Allocation Strategy of the queue. - ACE_Allocator *allocator_; -}; - - -template class ACE_DLList; -template class ACE_DLList_Iterator; -template class ACE_DLList_Reverse_Iterator; - -typedef ACE_Double_Linked_List ACE_DLList_Base; - -//typedef ACE_Double_Linked_List_Iterator -// ACE_DLList_Iterator_Base; -//typedef ACE_Double_Linked_List_Reverse_Iterator -// ACE_DLList_Reverse_Iterator_Base; -//@@ These two typedefs (inherited from James Hu's original design) -// have been removed because Sun CC 4.2 had problems with it. I guess -// having the DLList_Iterators inheriting from a class which is -// actually a typedef leads to problems. #define'ing rather than -// typedef'ing worked, but as per Carlos's reccomendation, I'm just -// replacing all references to the base classes with their actual -// type. Matt Braun (6/15/99) - -/** - * @class ACE_DLList - * - * @brief A double-linked list container class. - * - * This implementation uses ACE_Double_Linked_List to perform - * the logic behind this container class. It delegates all of its - * calls to ACE_Double_Linked_List. - */ -template -class ACE_DLList : public ACE_DLList_Base -{ - friend class ACE_DLList_Node; - friend class ACE_Double_Linked_List_Iterator; - friend class ACE_DLList_Iterator; - friend class ACE_DLList_Reverse_Iterator; - -public: - - /// Delegates to ACE_Double_Linked_List. - void operator= (const ACE_DLList &l); - - // = Classic queue operations. - - /// Delegates to ACE_Double_Linked_List. - T *insert_tail (T *new_item); - - /// Delegates to ACE_Double_Linked_List. - T *insert_head (T *new_item); - - /// Delegates to ACE_Double_Linked_List. - T *delete_head (void); - - /// Delegates to ACE_Double_Linked_List. - T *delete_tail (void); - - // = Additional utility methods. - - /** - * Delegates to {ACE_Double_Linked_List}, but where - * {ACE_Double_Linked_List} returns the node as the item, this get - * returns the contents of the node in item. - */ - int get (T *&item, size_t slot = 0); - - /// Delegates to ACE_Double_Linked_List. - void dump (void) const; - - /// Delegates to ACE_Double_Linked_List. - int remove (ACE_DLList_Node *n); - - // = Initialization and termination methods. - - /// Delegates to ACE_Double_Linked_List. - ACE_DLList (ACE_Allocator *the_allocator = 0); - - /// Delegates to ACE_Double_Linked_List. - ACE_DLList (const ACE_DLList &l); - - /// Deletes the list starting from the head. - ~ACE_DLList (void); -}; - -/** - * @class ACE_DLList_Iterator - * - * @brief A double-linked list container class iterator. - * - * This implementation uses ACE_Double_Linked_List_Iterator to - * perform the logic behind this container class. It delegates - * all of its calls to ACE_Double_Linked_List_Iterator. - */ -template -class ACE_DLList_Iterator : public ACE_Double_Linked_List_Iterator -{ - - friend class ACE_DLList; - friend class ACE_DLList_Node; - -public: - - // = Initialization method. - ACE_DLList_Iterator (ACE_DLList &l); - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. - * @@ Here be dragons. Comments? - */ - void reset (ACE_DLList &l); - - // = Iteration methods. - /// Move forward by one element in the list. Returns 0 when all the - /// items in the list have been seen, else 1. - int advance (void); - - /// Pass back the {next_item} that hasn't been seen in the list. - /// Returns 0 when all items have been seen, else 1. - int next (T *&); - - /** - * @deprecated Delegates to ACE_Double_Linked_List_Iterator, except that - * whereas the Double_Linked_List version of next returns the node, this next - * returns the contents of the node - */ - T *next (void) const; - - /** - * Removes the current item (i.e., {next}) from the list. - * Note that DLList iterators do not support {advance_and_remove} - * directly (defined in its base class) and you will need to - * release the element returned by it. - */ - int remove (void); - - /// Delegates to ACE_Double_Linked_List_Iterator. - void dump (void) const; - -private: - ACE_DLList *list_; -}; - -/** - * @class ACE_DLList_Reverse_Iterator - * - * @brief A double-linked list container class iterator. - * - * This implementation uses ACE_Double_Linked_List_Iterator to - * perform the logic behind this container class. It delegates - * all of its calls to ACE_Double_Linked_List_Iterator. - */ -template -class ACE_DLList_Reverse_Iterator : public ACE_Double_Linked_List_Reverse_Iterator -{ - - friend class ACE_DLList; - friend class ACE_DLList_Node; - -public: - - // = Initialization method. - ACE_DLList_Reverse_Iterator (ACE_DLList &l); - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. - * @@ Here be dragons. Comments? - */ - void reset (ACE_DLList &l); - - // = Iteration methods. - /// Move forward by one element in the list. Returns 0 when all the - /// items in the list have been seen, else 1. - int advance (void); - - /// Pass back the {next_item} that hasn't been seen in the list. - /// Returns 0 when all items have been seen, else 1. - int next (T *&); - - /// @deprecated Delegates to ACE_Double_Linked_List_Iterator. - T *next (void) const; - - /// Removes the current item (i.e., {next}) from the list. - /// Note that DLList iterators do not support {advance_and_remove} - /// directly (defined in its base class) and you will need to - /// release the element returned by it. - int remove (void); - - /// Delegates to ACE_Double_Linked_List_Iterator. - void dump (void) const; - -private: - ACE_DLList *list_; -}; - -// Forward declaration. -template -class ACE_Fixed_Set; - -/** - * @class ACE_Fixed_Set_Iterator_Base - * - * @brief Implements a common base class for iterators for a unordered set. - */ -template -class ACE_Fixed_Set_Iterator_Base -{ -public: - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Move to the first element in the set. Returns 0 if the - /// set is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Initialization method. - ACE_Fixed_Set_Iterator_Base (ACE_Fixed_Set &s); - - /// Set we are iterating over. - ACE_Fixed_Set &s_; - - /// How far we've advanced over the set. - ssize_t next_; - - /// The number of non free items that the iterator had pointed at. - size_t iterated_items_; - - /// Dump the state of an object. - void dump_i (void) const; - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next_i (T *&next_item); -}; - -/** - * @class ACE_Fixed_Set_Iterator - * - * @brief Iterates through an unordered set. - * - * This implementation of an unordered set uses a fixed array. - * Allows deletions while iteration is occurring. - */ -template -class ACE_Fixed_Set_Iterator : public ACE_Fixed_Set_Iterator_Base -{ -public: - // = Initialization method. - ACE_Fixed_Set_Iterator (ACE_Fixed_Set &s); - - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Dump the state of an object. - void dump (void) const; - - /// Remove the item where the itearetor is located at. - /// Returns 1 if it removes a item, else 0. - /// Pass back the removed {item}. - int remove (T *&item); - - /// STL-like iterator dereference operator: returns a reference - /// to the node underneath the iterator. - T & operator* (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Fixed_Set_Const_Iterator - * - * @brief Iterates through a const unordered set. - * - * This implementation of an unordered set uses a fixed array. - */ -template -class ACE_Fixed_Set_Const_Iterator : public ACE_Fixed_Set_Iterator_Base -{ -public: - // = Initialization method. - ACE_Fixed_Set_Const_Iterator (const ACE_Fixed_Set &s); - - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (const T *&next_item); - - /// Dump the state of an object. - void dump (void) const; - - /// STL-like iterator dereference operator: returns a reference - /// to the node underneath the iterator. - const T & operator* (void) const ; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Fixed_Set - * - * @brief Implement a simple unordered set of {T} with maximum {ACE_SIZE}. - * - * This implementation of an unordered set uses a fixed array. - * It does not allow duplicate members. The set provides linear insertion/deletion - * operations. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Fixed array - * - Duplicates allowed? - * No - * - Random access allowed? - * No - * - Search speed - * Linear - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * - */ -template -class ACE_Fixed_Set -{ -public: - friend class ACE_Fixed_Set_Iterator_Base; - friend class ACE_Fixed_Set_Iterator; - friend class ACE_Fixed_Set_Const_Iterator; - - // Trait definitions. - typedef ACE_Fixed_Set_Iterator ITERATOR; - typedef ACE_Fixed_Set_Const_Iterator CONST_ITERATOR; - - // = Initialization and termination methods. - /// Default Constructor. - /** - * Creates an empy set - */ - ACE_Fixed_Set (void); - - /// Copy constructor. - /** - * Initializes a set to be a copy of the set parameter. - */ - ACE_Fixed_Set (const ACE_Fixed_Set &); - - /// Assignment operator. - /** - * Deep copy of one set to another. - */ - void operator= (const ACE_Fixed_Set &); - - /// Destructor. - /** - * Destroys a set. - */ - ~ACE_Fixed_Set (void); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Performs constant time check to determine if a set is empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Performs a constant time check to see if the set is full. - */ - int is_full (void) const; - - // = Classic unordered set operations. - - ///Linear time insertion of an item unique to the set. - /** - * Insert @a new_item into the set (doesn't allow duplicates). - * Returns -1 if failures occur, 1 if item is already present, else - * 0. - */ - int insert (const T &new_item); - - ///Linear time removal operation of an item. - /** - * Remove first occurrence of {item} from the set. Returns 0 if - * it removes the item, -1 if it can't find the item, and -1 if a - * failure occurs. Removal doesn't reclaim memory for the @a item. - */ - int remove (const T &item); - - /// Finds if @a item occurs in the set. Returns 0 if finds, else -1. - /** - * Performs a linear find operation for the specified @a item. - */ - int find (const T &item) const; - - /// Size of the set. - /** - * Returns the current size of the set. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Holds the contents of the set. - struct - { - /// Item in the set. - T item_; - - /// Keeps track of whether this item is in use or not. - int is_free_; - } search_structure_[ACE_SIZE]; - - /// Current size of the set. - size_t cur_size_; - - /// Maximum size of the set. - size_t max_size_; -}; - -// Forward declaration. -template -class ACE_Bounded_Set; - -/** - * @class ACE_Bounded_Set_Iterator - * - * @brief Iterates through an unordered set. - * - * This implementation of an unordered set uses a Bounded array. - * Allows deletions while iteration is occurring. - */ -template -class ACE_Bounded_Set_Iterator -{ -public: - // = Initialization method. - ACE_Bounded_Set_Iterator (ACE_Bounded_Set &s); - - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Move to the first element in the set. Returns 0 if the - /// set is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Set we are iterating over. - ACE_Bounded_Set &s_; - - /// How far we've advanced over the set. - ssize_t next_; -}; - - -/** - * @class ACE_Bounded_Set - * - * @brief Implement a simple unordered set of {T} with maximum - * set at creation time. - * - * This implementation of an unordered set uses a Bounded array. - * This implementation does not allow duplicates. It provides - * linear insert/remove/find operations. Insertion/removal does not - * invalidate iterators, but caution should be taken to ensure - * expected behavior. Once initialized, the object has a maximum size - * which can only be increased by the assignment of another larger Bounded_Set. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Bounded array which can grow via assignment - * - Duplicates allowed? - * No - * - Random access allowed? - * No - * - Search speed - * Linear - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * - */ -template -class ACE_Bounded_Set -{ -public: - friend class ACE_Bounded_Set_Iterator; - - // Trait definition. - typedef ACE_Bounded_Set_Iterator ITERATOR; - - enum - { - DEFAULT_SIZE = 10 - }; - - // = Initialization and termination methods. - /// Construct a Bounded_Set using the default size. - /** - * The default constructor initializes the Bounded_Set to a maximum size - * specified by the DEFAULT_SIZE. - */ - ACE_Bounded_Set (void); - - /// Construct a Bounded_Set with the provided sizeB. - /** - * Initialize the Bounded_Set to have a maximum size equal to the size - * parameter specified. - */ - ACE_Bounded_Set (size_t size); - - /// Construct a Bounded_Set that is a copy of the provides Bounded_Set. - /** - * Initialize the Bounded_Set to be a copy of the Bounded_Set parameter. - */ - ACE_Bounded_Set (const ACE_Bounded_Set &); - - /// Assignment operator. - /** - * The assignment will make a deep copy of the Bounded_Set provided. If the - * rhs has more elements than the capacity of the lhs, then the lhs will be - * deleted and reallocated to accomadate the larger number of elements. - */ - void operator= (const ACE_Bounded_Set &); - - /// Destructor - /** - * Clean up the underlying dynamically allocated memory that is used by - * the Bounded_Set. - */ - ~ACE_Bounded_Set (void); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * A constant time check is performed to determine if the Bounded_Set is - * empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Performs a constant time check to determine if the Bounded_Set is at - * capacity. - */ - int is_full (void) const; - - // = Classic unordered set operations. - - ///Inserts a new element unique to the set. - /** - * Insert @a new_item into the set (doesn't allow duplicates) in linear - * time. - * Returns -1 if failures occur, 1 if item is already present, else - * 0. - */ - int insert (const T &new_item); - - ///Finds the specified element and removes it from the set. - /** - * Remove first occurrence of @a item from the set. Returns 0 if it - * removes the item, -1 if it can't find the item, and -1 if a - * failure occurs. The linear remove operation does not reclaim the - * memory associated with the removed item. - */ - int remove (const T &item); - - /// Finds if @a item occurs in the set. Returns 0 if finds, else -1. - /** - * find preforms a linear search for {item} and returns 0 on successful - * find and -1 otherwise. - */ - int find (const T &item) const; - - /// Size of the set. - /** - * Returns a size_t representing the current size of the set. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - struct Search_Structure - { - /// Item in the set. - T item_; - - /// Keeps track of whether this item is in use or not. - int is_free_; - }; - - /// Holds the contents of the set. - Search_Structure *search_structure_; - - /// Current size of the set. - size_t cur_size_; - - /// Maximum size of the set. - size_t max_size_; -}; - -/** - * @class ACE_Ordered_MultiSet_Iterator - * - * @brief Implement a bidirectional iterator over an ordered multiset. - * This class template requires that < operator semantics be - * defined for the parameterized type {T}, but does not impose - * any restriction on how that ordering operator is implemented. - */ -template -class ACE_Ordered_MultiSet_Iterator -{ -public: - friend class ACE_Ordered_MultiSet; - - // = Initialization method. - ACE_Ordered_MultiSet_Iterator (ACE_Ordered_MultiSet &s); - - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the ordered multiset. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item) const; - - /// Repositions the iterator at the first item in the ordered multiset - /// Returns 0 if the list is empty else 1. - int first (void); - - /// Repositions the iterator at the last item in the ordered multiset - /// Returns 0 if the list is empty else 1. - int last (void); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Move backward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int retreat (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Returns a reference to the internal element {this} is pointing to. - T& operator* (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /// Pointer to the current node in the iteration. - ACE_DNode *current_; - - /// Pointer to the set we're iterating over. - ACE_Ordered_MultiSet &set_; -}; - - -/** - * @class ACE_Ordered_MultiSet - * - * @brief Implement a simple ordered multiset of {T} of unbounded size - * that allows duplicates. This class template requires that < - * operator semantics be defined for the parameterized type {T}, but - * does not impose any restriction on how that ordering operator is - * implemented. The set is implemented as a linked list. - * - * - * Requirements and Performance Characteristics - * - Internal Structure - * Double linked list - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * Linear - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * Yes - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * -# operator< - * - * - */ -template -class ACE_Ordered_MultiSet -{ -public: - friend class ACE_Ordered_MultiSet_Iterator; - - // Trait definition. - typedef ACE_Ordered_MultiSet_Iterator ITERATOR; - - // = Initialization and termination methods. - /// Constructor. Use user specified allocation strategy - /// if specified. - /** - * Initialize the set using the allocation strategy specified. If none, use the - * default strategy. - */ - ACE_Ordered_MultiSet (ACE_Allocator *the_allocator = 0); - - /// Copy constructor. - /** - * Initialize the set to be a copy of the provided set. - */ - ACE_Ordered_MultiSet (const ACE_Ordered_MultiSet &); - - /// Destructor. - /** - * Delete the nodes of the set. - */ - ~ACE_Ordered_MultiSet (void); - - /// Assignment operator. - /** - * Delete the nodes in lhs, and copy the nodes from the rhs. - */ - void operator= (const ACE_Ordered_MultiSet &); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Constant time check to determine if the set is empty. - */ - int is_empty (void) const; - - /// Size of the set. - /** - * Constant time check to determine the size of the set. - */ - size_t size (void) const; - - // = Classic unordered set operations. - - /// Insert @a new_item into the ordered multiset. - /// Returns -1 if failures occur, else 0. - /** - * Linear time, order preserving insert into the set beginning at the head. - */ - int insert (const T &new_item); - - ///Linear time insert beginning at the point specified by the provided iterator. - /** - * Insert @a new_item into the ordered multiset, starting its search at - * the node pointed to by the iterator, and if insertion was successful, - * updates the iterator to point to the newly inserted node. - * Returns -1 if failures occur, else 0. - */ - int insert (const T &new_item, ITERATOR &iter); - - /// Remove first occurrence of @a item from the set. Returns 0 if - /// it removes the item, -1 if it can't find the item. - /** - * Linear time search operation which removes the item from the set if found . - */ - int remove (const T &item); - - ///Linear find operation. - /** - * Finds first occurrence of @a item in the multiset, using the iterator's - * current position as a hint to improve performance. If find succeeds, - * it positions the iterator at that node and returns 0, or if it cannot - * locate the node, it leaves the iterator alone and just returns -1. - */ - int find (const T &item, ITERATOR &iter) const; - - /// Reset the ACE_Ordered_MultiSet to be empty. - /** - * Delete the nodes inside the set. - */ - void reset (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /** - * Insert @a item, starting its search at the position given, - * and if successful updates the passed pointer to point to - * the newly inserted item's node. - */ - int insert_from (const T &item, ACE_DNode *start_position, - ACE_DNode **new_position); - - /** - * Looks for first occurance of @a item in the ordered set, using the - * passed starting position as a hint: if there is such an instance, it - * updates the new_position pointer to point to this node and returns 0; - * if there is no such node, then if there is a node before where the - * item would have been, it updates the new_position pointer to point - * to this node and returns -1; if there is no such node, then if there - * is a node after where the item would have been, it updates the - * new_position pointer to point to this node (or 0 if there is no such - * node) and returns 1; - */ - int locate (const T &item, ACE_DNode *start_position, - ACE_DNode *&new_position) const; - - /// Delete all the nodes in the Set. - void delete_nodes (void); - - /// Copy nodes into this set. - void copy_nodes (const ACE_Ordered_MultiSet &); - - /// Head of the bilinked list of Nodes. - ACE_DNode *head_; - - /// Head of the bilinked list of Nodes. - ACE_DNode *tail_; - - /// Current size of the set. - size_t cur_size_; - - /// Allocation strategy of the set. - ACE_Allocator *allocator_; -}; - -// **************************************************************** - -/** - * @class ACE_Array - * - * @brief A dynamic array class. - * - * This class extends ACE_Array_Base, adding comparison operators. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Dynamic array - * - Duplicates allowed? - * Yes - * - Random access allowed? - * Yes - * - Search speed - * N/A - * - Insert/replace speed - * O(1) - * - Iterator still valid after change to container? - * - In general, yes. - * - If array size is changed during iteration, no. - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator!= - * - * @sa ACE_Array_Base. This class inherits its operations and requirements. - */ -template -class ACE_Array : public ACE_Array_Base -{ -public: - // Define a "trait" - typedef T TYPE; - - typedef ACE_Array_Iterator ITERATOR; - - // = Exceptions. - - // = Initialization and termination methods. - - /// Dynamically create an uninitialized array. - /** - * Initialize an empty array of the specified size using the provided - * allocation strategy. - */ - ACE_Array (size_t size = 0, - ACE_Allocator* alloc = 0); - - /// Dynamically initialize the entire array to the {default_value}. - /** - * Initialize an array the given size placing the default_value in each index. - */ - ACE_Array (size_t size, - const T &default_value, - ACE_Allocator* alloc = 0); - - ///Copy constructor. - /** - * The copy constructor performs initialization by making an exact - * copy of the contents of parameter {s}, i.e., *this == s will - * return true. - */ - ACE_Array (const ACE_Array &s); - - ///Assignment operator - /** - * Assignment operator performs an assignment by making an exact - * copy of the contents of parameter {s}, i.e., *this == s will - * return true. Note that if the {max_size_} of {array_} is >= than - * {s.max_size_} we can copy it without reallocating. However, if - * {max_size_} is < {s.max_size_} we must delete the {array_}, - * reallocate a new {array_}, and then copy the contents of {s}. - */ - void operator= (const ACE_Array &s); - - // = Compare operators - - ///Equality comparison operator. - /** - * Compare this array with {s} for equality. Two arrays are equal - * if their {size}'s are equal and all the elements from 0 .. {size} - * are equal. - */ - bool operator== (const ACE_Array &s) const; - - ///Inequality comparison operator. - /** - * Compare this array with {s} for inequality such that {*this} != - * {s} is always the complement of the boolean return value of - * {*this} == {s}. - */ - bool operator!= (const ACE_Array &s) const; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Containers_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Containers_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Containers_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CONTAINERS_T_H */ diff --git a/ace/Containers_T.inl b/ace/Containers_T.inl deleted file mode 100644 index 425d6e167e8..00000000000 --- a/ace/Containers_T.inl +++ /dev/null @@ -1,479 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Bounded_Stack::is_empty (void) const -{ - ACE_TRACE ("ACE_Bounded_Stack::is_empty"); - return this->top_ == 0; -} - -template ACE_INLINE int -ACE_Bounded_Stack::is_full (void) const -{ - ACE_TRACE ("ACE_Bounded_Stack::is_full"); - return this->top_ >= this->size_; -} - -template ACE_INLINE int -ACE_Bounded_Stack::push (const T &new_item) -{ - ACE_TRACE ("ACE_Bounded_Stack::push"); - if (this->is_full () == 0) - { - this->stack_[this->top_++] = new_item; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Bounded_Stack::pop (T &item) -{ - ACE_TRACE ("ACE_Bounded_Stack::pop"); - if (this->is_empty () == 0) - { - item = this->stack_[--this->top_]; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Bounded_Stack::top (T &item) const -{ - ACE_TRACE ("ACE_Bounded_Stack::top"); - if (this->is_empty () == 0) - { - item = this->stack_[this->top_ - 1]; - return 0; - } - else - return -1; -} - -template ACE_INLINE size_t -ACE_Bounded_Stack::size (void) const -{ - return this->size_; -} - -//---------------------------------------- - -template ACE_INLINE int -ACE_Fixed_Stack::is_empty (void) const -{ - ACE_TRACE ("ACE_Fixed_Stack::is_empty"); - return this->top_ == 0; -} - -template ACE_INLINE int -ACE_Fixed_Stack::is_full (void) const -{ - ACE_TRACE ("ACE_Fixed_Stack::is_full"); - return this->top_ >= this->size_; -} - -template ACE_INLINE int -ACE_Fixed_Stack::push (const T &new_item) -{ - ACE_TRACE ("ACE_Fixed_Stack::push"); - if (this->is_full () == 0) - { - this->stack_[this->top_++] = new_item; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Fixed_Stack::pop (T &item) -{ - ACE_TRACE ("ACE_Fixed_Stack::pop"); - if (this->is_empty () == 0) - { - item = this->stack_[--this->top_]; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Fixed_Stack::top (T &item) const -{ - ACE_TRACE ("ACE_Fixed_Stack::top"); - if (this->is_empty () == 0) - { - item = this->stack_[this->top_ - 1]; - return 0; - } - else - return -1; -} - -template ACE_INLINE size_t -ACE_Fixed_Stack::size (void) const -{ - return this->size_; -} - -template ACE_INLINE int -ACE_Unbounded_Stack::is_empty (void) const -{ - // ACE_TRACE ("ACE_Unbounded_Stack::is_empty"); - return this->head_ == this->head_->next_; -} - -template ACE_INLINE int -ACE_Unbounded_Stack::top (T &item) const -{ - ACE_TRACE ("ACE_Unbounded_Stack::top"); - if (this->is_empty () == 0) - { - item = this->head_->next_->item_; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Unbounded_Stack::is_full (void) const -{ - ACE_TRACE ("ACE_Unbounded_Stack::is_full"); - return 0; // ??? -} - -template ACE_INLINE size_t -ACE_Unbounded_Stack::size (void) const -{ - return this->cur_size_; -} - -// --- - - -// --- - -template ACE_INLINE int -ACE_Fixed_Set::is_empty (void) const -{ - ACE_TRACE ("ACE_Fixed_Set::is_empty"); - return this->cur_size_ == 0; -} - -template ACE_INLINE int -ACE_Fixed_Set::is_full (void) const -{ - ACE_TRACE ("ACE_Fixed_Set::is_full"); - return this->cur_size_ == this->max_size_; -} - -// --- - -template ACE_INLINE int -ACE_Bounded_Set::is_empty (void) const -{ - ACE_TRACE ("ACE_Bounded_Set::is_empty"); - return this->cur_size_ == 0; -} - -template ACE_INLINE int -ACE_Bounded_Set::is_full (void) const -{ - ACE_TRACE ("ACE_Bounded_Set::is_full"); - return this->cur_size_ == this->max_size_; -} - -// -- - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::first (void) -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::first"); - current_ = set_.head_; - - return (current_ ? 1 : 0); -} - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::last (void) -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::last"); - current_ = set_.tail_; - - return (current_ ? 1 : 0); -} - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::advance (void) -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::advance"); - - current_ = current_ ? current_->next_ : 0; - - return (current_ ? 1 : 0); -} - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::retreat (void) -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::retreat"); - - current_ = current_ ? current_->prev_ : 0; - - return (current_ ? 1 : 0); -} - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::done"); - - return (current_ ? 0 : 1); -} - -template ACE_INLINE void -ACE_Ordered_MultiSet_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - - - -// -- - -template ACE_INLINE int -ACE_Ordered_MultiSet::is_empty (void) const -{ - ACE_TRACE ("ACE_Ordered_MultiSet::is_empty"); - return this->cur_size_ > 0 ? 0 : 1; -} - -template ACE_INLINE size_t -ACE_Ordered_MultiSet::size (void) const -{ -// ACE_TRACE ("ACE_Ordered_MultiSet::size"); - return this->cur_size_; -} - -// **************************************************************** - -template ACE_INLINE -ACE_Array::ACE_Array (size_t size, - ACE_Allocator *alloc) - : ACE_Array_Base (size, alloc) -{ -} - -template ACE_INLINE -ACE_Array::ACE_Array (size_t size, - const T &default_value, - ACE_Allocator *alloc) - : ACE_Array_Base (size, default_value, alloc) -{ -} - -// The copy constructor (performs initialization). - -template ACE_INLINE -ACE_Array::ACE_Array (const ACE_Array &s) - : ACE_Array_Base (s) -{ -} - -// Assignment operator (performs assignment). - -template ACE_INLINE void -ACE_Array::operator= (const ACE_Array &s) -{ - // Check for "self-assignment". - - if (this != &s) - this->ACE_Array_Base::operator= (s); -} - -// Compare this array with for inequality. - -template ACE_INLINE bool -ACE_Array::operator!= (const ACE_Array &s) const -{ - return !(*this == s); -} - -// **************************************************************** - - -// **************************************************************** - -template ACE_INLINE void -ACE_DLList::operator= (const ACE_DLList &l) -{ - *(ACE_DLList_Base *) this = l; -} - -template ACE_INLINE int -ACE_DLList::get (T *&item, size_t index) -{ - ACE_DLList_Node *node; - int result = ACE_DLList_Base::get (node, index); - if (result != -1) - item = (T *) node->item_; - return result; -} - -template ACE_INLINE void -ACE_DLList::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DLList_Base::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE int -ACE_DLList::remove (ACE_DLList_Node *n) -{ - int result = ACE_DLList_Base::remove (n); - ACE_DES_FREE (n, - this->allocator_->free, - ACE_DLList_Node); - return result; -} - -template ACE_INLINE -ACE_DLList::ACE_DLList (ACE_Allocator *alloc) - : ACE_DLList_Base (alloc) -{ -} - -template ACE_INLINE -ACE_DLList::ACE_DLList (const ACE_DLList &l) - : ACE_DLList_Base ((ACE_DLList &) l) -{ -} - -template ACE_INLINE -ACE_DLList::~ACE_DLList (void) -{ - while (this->delete_head ()) ; -} - -template ACE_INLINE int -ACE_DLList_Iterator::remove (void) -{ - ACE_DLList_Node *temp = this->ACE_Double_Linked_List_Iterator ::next (); - this->ACE_Double_Linked_List_Iterator ::advance (); - return list_->remove (temp); -} - -template ACE_INLINE -ACE_DLList_Iterator::ACE_DLList_Iterator (ACE_DLList &l) - : ACE_Double_Linked_List_Iterator ((ACE_DLList_Base &)l), - list_ (&l) -{ -} - -template ACE_INLINE void -ACE_DLList_Iterator::reset (ACE_DLList &l) -{ - list_ = &l; - this->ACE_Double_Linked_List_Iterator ::reset ((ACE_DLList_Base &)l); -} - -template ACE_INLINE int -ACE_DLList_Iterator::next (T *&ptr) -{ - ACE_DLList_Node *temp = - ACE_Double_Linked_List_Iterator ::next (); - if (temp) - ptr = (T *) temp->item_; - return temp ? 1 : 0; -} - -template ACE_INLINE T * -ACE_DLList_Iterator::next (void) const -{ - ACE_DLList_Node *temp = ACE_Double_Linked_List_Iterator ::next (); - return (T *) (temp ? temp->item_ : 0); -} - -template ACE_INLINE int -ACE_DLList_Iterator::advance (void) -{ - return this->ACE_Double_Linked_List_Iterator ::advance (); -} - -template ACE_INLINE void -ACE_DLList_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_Double_Linked_List_Iterator ::dump (); -#endif /* ACE_HAS_DUMP */ -} - - -template ACE_INLINE int -ACE_DLList_Reverse_Iterator::remove (void) -{ - ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator ::next (); - this->ACE_Double_Linked_List_Reverse_Iterator ::advance (); - return list_->remove (temp); -} - -template ACE_INLINE -ACE_DLList_Reverse_Iterator::ACE_DLList_Reverse_Iterator (ACE_DLList &l) - : ACE_Double_Linked_List_Reverse_Iterator ((ACE_DLList_Base &)l), - list_ (&l) -{ -} - -template ACE_INLINE void -ACE_DLList_Reverse_Iterator::reset (ACE_DLList &l) -{ - list_ = &l; - this->ACE_Double_Linked_List_Reverse_Iterator ::reset ((ACE_DLList_Base &)l); -} - -template ACE_INLINE int -ACE_DLList_Reverse_Iterator::advance (void) -{ - return ACE_Double_Linked_List_Reverse_Iterator ::advance (); -} - -template ACE_INLINE int -ACE_DLList_Reverse_Iterator::next (T *&ptr) -{ - ACE_DLList_Node *temp = - ACE_Double_Linked_List_Reverse_Iterator ::next (); - if (temp == 0) - return 0; - ptr = (T *) temp->item_; - return 1; -} - -template ACE_INLINE T * -ACE_DLList_Reverse_Iterator::next (void) const -{ - ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator ::next (); - return (T *) (temp ? temp->item_ : 0); -} - - -template ACE_INLINE void -ACE_DLList_Reverse_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_Double_Linked_List_Reverse_Iterator ::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Copy_Disabled.cpp b/ace/Copy_Disabled.cpp deleted file mode 100644 index d2fb124a182..00000000000 --- a/ace/Copy_Disabled.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @file Copy_Disabled.cpp - * - * $Id$ - * - * @author Carlos O'Ryan - */ - -#include "ace/Copy_Disabled.h" - - -ACE_RCSID (ace, - Copy_Disabled, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Copy_Disabled::ACE_Copy_Disabled (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Copy_Disabled.h b/ace/Copy_Disabled.h deleted file mode 100644 index 512b96c9dcf..00000000000 --- a/ace/Copy_Disabled.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- - -//=========================================================================== -/** - * @file Copy_Disabled.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ -//=========================================================================== - -#ifndef ACE_COPY_DISABLED_H -#define ACE_COPY_DISABLED_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Copy_Disabled - * - * @brief Helper class to disable copy construction and assignment - * - * Classes used to control OS and other resources are not "canonical", - * i.e. they have their copy constructor and assignment operators - * disabled. - * This is often done by making the copy constructor and assignment - * operators private, effectively disallowing copying by clients of - * the class (including derived classes). If the copy constructor and - * assingment operators are left unimplemented then the class itself - * cannot make any copies of its instances, because it would result in - * link errors. - * - * To use this class simply use private inheritance: - * - * class Foo : private ACE_Copy_Disabled - * { - * // code here - * }; - * - */ -class ACE_Export ACE_Copy_Disabled -{ -public: - - /// Default constructor - ACE_Copy_Disabled (void); - -private: - ACE_Copy_Disabled (const ACE_Copy_Disabled &); - ACE_Copy_Disabled &operator= (const ACE_Copy_Disabled &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_COPY_DISABLED_H */ diff --git a/ace/Countdown_Time.cpp b/ace/Countdown_Time.cpp deleted file mode 100644 index fb03f0465e0..00000000000 --- a/ace/Countdown_Time.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "ace/Countdown_Time.h" -#include "ace/OS_NS_sys_time.h" - -ACE_RCSID (ace, - Countdown_Time, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Countdown_Time::ACE_Countdown_Time (ACE_Time_Value *max_wait_time) - : max_wait_time_ (max_wait_time), - stopped_ (0) -{ - this->start (); -} - -ACE_Countdown_Time::~ACE_Countdown_Time (void) -{ - this->stop (); -} - -int -ACE_Countdown_Time::start (void) -{ - if (this->max_wait_time_ != 0) - { - this->start_time_ = ACE_OS::gettimeofday (); - this->stopped_ = 0; - } - return 0; -} - -int -ACE_Countdown_Time::stopped (void) const -{ - return stopped_; -} - -int -ACE_Countdown_Time::stop (void) -{ - if (this->max_wait_time_ != 0 && this->stopped_ == 0) - { - ACE_Time_Value elapsed_time = - ACE_OS::gettimeofday () - this->start_time_; - - if (*this->max_wait_time_ > elapsed_time) - *this->max_wait_time_ -= elapsed_time; - else - { - // Used all of timeout. - *this->max_wait_time_ = ACE_Time_Value::zero; - // errno = ETIME; - } - this->stopped_ = 1; - } - return 0; -} - -int -ACE_Countdown_Time::update (void) -{ - return this->stop () == 0 && this->start (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Countdown_Time.h b/ace/Countdown_Time.h deleted file mode 100644 index 248e2d19951..00000000000 --- a/ace/Countdown_Time.h +++ /dev/null @@ -1,80 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Countdown_Time.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_COUNTDOWN_TIME_H -#define ACE_COUNTDOWN_TIME_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Time_Value.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Countdown_Time - * - * @brief Keeps track of the amount of elapsed time. - * - * This class has a side-effect on the -- every - * time the method is called the is - * updated. - */ -class ACE_Export ACE_Countdown_Time -{ -public: - // = Initialization and termination methods. - /// Cache the and call . - ACE_Countdown_Time (ACE_Time_Value *max_wait_time); - - /// Call . - ~ACE_Countdown_Time (void); - - /// Cache the current time and enter a start state. - int start (void); - - /// Subtract the elapsed time from max_wait_time_ and enter a stopped - /// state. - int stop (void); - - /// Calls stop and then start. max_wait_time_ is modified by the - /// call to stop. - int update (void); - - /// Returns 1 if we've already been stopped, else 0. - int stopped (void) const; - -private: - /// Maximum time we were willing to wait. - ACE_Time_Value *max_wait_time_; - - /// Beginning of the start time. - ACE_Time_Value start_time_; - - /// Keeps track of whether we've already been stopped. - int stopped_; - - // Prevent copying - ACE_Countdown_Time (const ACE_Countdown_Time &); - ACE_Countdown_Time &operator= (const ACE_Countdown_Time &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_COUNTDOWN_TIME_H */ diff --git a/ace/DEV.cpp b/ace/DEV.cpp deleted file mode 100644 index 1ae27fc558e..00000000000 --- a/ace/DEV.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// $Id$ - -#include "ace/DEV.h" - -#include "ace/OS_NS_unistd.h" - -#if !defined (__ACE_INLINE__) -#include "ace/DEV.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, DEV, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_DEV) - -void -ACE_DEV::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_DEV::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// This is the do-nothing constructor. - -ACE_DEV::ACE_DEV (void) -{ - ACE_TRACE ("ACE_DEV::ACE_DEV"); -} - -// Close the device - -int -ACE_DEV::close (void) -{ - ACE_TRACE ("ACE_DEV::close"); - int result = ACE_OS::close (this->get_handle ()); - this->set_handle (ACE_INVALID_HANDLE); - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV.h b/ace/DEV.h deleted file mode 100644 index 8b0c585ddf7..00000000000 --- a/ace/DEV.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file DEV.h - * - * $Id$ - * - * @author Gerhard Lenzer - */ -//============================================================================= - - -#ifndef ACE_DEV_H -#define ACE_DEV_H -#include /**/ "ace/pre.h" - -#include "ace/IO_SAP.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/DEV_Addr.h" - -// The following is necessary since many C++ compilers don't support -// typedef'd types inside of classes used as formal template -// arguments... ;-(. Luckily, using the C++ preprocessor I can hide -// most of this nastiness! - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) -#define ACE_DEV_CONNECTOR ACE_DEV_Connector -#define ACE_DEV_STREAM ACE_DEV_IO -#else /* TEMPLATES are broken (must be a cfront-based compiler...) */ -#define ACE_DEV_CONNECTOR ACE_DEV_Connector, ACE_DEV_Addr -#define ACE_DEV_STREAM ACE_DEV_IO, ACE_DEV_Addr -#endif /* ACE_TEMPLATE_TYPEDEFS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_DEV - * - * @brief Defines the member functions for the base class of the - * ACE_DEV abstraction. - */ -class ACE_Export ACE_DEV : public ACE_IO_SAP -{ -public: - /// Close down the DEVICE - int close (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /** - * Disable signal @a signum - * This is here to prevent Win32 from - * disabling SPIPE using socket calls - */ - int disable (int signum) const ; - -protected: - /// Ensure that this class is an abstract base class - ACE_DEV (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/DEV.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DEV_H */ diff --git a/ace/DEV.inl b/ace/DEV.inl deleted file mode 100644 index e00f4fc705e..00000000000 --- a/ace/DEV.inl +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_DEV::disable (int signum) const -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (signum) ; - return 0 ; -#else /* ACE_WIN32 */ - return ACE_IO_SAP::disable (signum) ; -#endif /* ACE_WIN32 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_Addr.cpp b/ace/DEV_Addr.cpp deleted file mode 100644 index f7e5503b1eb..00000000000 --- a/ace/DEV_Addr.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// $Id$ - -#include "ace/DEV_Addr.h" -#if !defined (__ACE_INLINE__) -#include "ace/DEV_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID (ace, - DEV_Addr, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Addr) - -// Transform the current address into string format. - -int -ACE_DEV_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const -{ - ACE_TRACE ("ACE_DEV_Addr::addr_to_string"); - - ACE_OS::strsncpy (s, this->devname_, len); - return 0; -} - -// Return a pointer to the address. - -void * -ACE_DEV_Addr::get_addr (void) const -{ - ACE_TRACE ("ACE_DEV_Addr::get_addr"); - - return (void *) &this->devname_; -} - -void -ACE_DEV_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_DEV_Addr::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("devname_ = %s"), this->devname_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Do nothing constructor. - -ACE_DEV_Addr::ACE_DEV_Addr (void) - : ACE_Addr (AF_DEV, sizeof this->devname_) -{ - ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); - - (void) ACE_OS::memset ((void *) &this->devname_, - 0, sizeof this->devname_); -} - -int -ACE_DEV_Addr::set (const ACE_DEV_Addr &sa) -{ - this->base_set (sa.get_type (), sa.get_size ()); - - if (sa.get_type () == AF_ANY) - (void) ACE_OS::memset ((void *) &this->devname_, - 0, - sizeof this->devname_); - else - (void) ACE_OS::strsncpy (this->devname_, - sa.devname_, - ACE_DEV_Addr::DEVNAME_LENGTH); - return 0; -} - -// Copy constructor. - -ACE_DEV_Addr::ACE_DEV_Addr (const ACE_DEV_Addr &sa) - : ACE_Addr (AF_DEV, sizeof this->devname_) -{ - ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); - - this->set (sa); -} - -ACE_DEV_Addr::ACE_DEV_Addr (const ACE_TCHAR *devname) - : ACE_Addr (AF_DEV, sizeof this->devname_) -{ - ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); - - this->set (devname); -} - -ACE_DEV_Addr & -ACE_DEV_Addr::operator= (const ACE_DEV_Addr &sa) -{ - ACE_TRACE ("ACE_DEV_Addr::operator="); - - if (this != &sa) - this->set (sa); - - return *this; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_Addr.h b/ace/DEV_Addr.h deleted file mode 100644 index 0646260c8f9..00000000000 --- a/ace/DEV_Addr.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file DEV_Addr.h - * - * $Id$ - * - * @author Gerhard Lenzer and Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_DEV_ADDR_H -#define ACE_DEV_ADDR_H - -#include /**/ "ace/pre.h" - -#include "ace/Addr.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_dirent.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_DEV_Addr - * - * @brief Defines device address family address format. - */ -class ACE_Export ACE_DEV_Addr : public ACE_Addr -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_DEV_Addr (void); - - /// Copy constructor. - ACE_DEV_Addr (const ACE_DEV_Addr &sa); - - /// Acts like a copy constructor. - int set (const ACE_DEV_Addr &sa); - - /// Create a ACE_DEV_Addr from a device name. - explicit ACE_DEV_Addr (const ACE_TCHAR *devname); - - /// Create a ACE_Addr from a ACE_DEV pathname. - void set (const ACE_TCHAR *devname); - - /// Assignment operator. - ACE_DEV_Addr &operator= (const ACE_DEV_Addr &); - - /// Return a pointer to the address. - virtual void *get_addr (void) const; - - /// Transform the current address into string format. - virtual int addr_to_string (ACE_TCHAR *addr, size_t) const; - - /// Compare two addresses for equality. - bool operator == (const ACE_DEV_Addr &SAP) const; - - /// Compare two addresses for inequality. - bool operator != (const ACE_DEV_Addr &SAP) const; - - /// Return the path name used for the rendezvous point. - const ACE_TCHAR *get_path_name (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - enum { DEVNAME_LENGTH = MAXPATHLEN + 1 }; - /// Name of the device. - ACE_TCHAR devname_[DEVNAME_LENGTH]; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/DEV_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_DEV_ADDR_H */ diff --git a/ace/DEV_Addr.inl b/ace/DEV_Addr.inl deleted file mode 100644 index 820b961d1d0..00000000000 --- a/ace/DEV_Addr.inl +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_string.h" -#include "ace/Global_Macros.h" -#include "ace/os_include/sys/os_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_DEV_Addr::set (const ACE_TCHAR *devname) -{ - ACE_TRACE ("ACE_DEV_Addr::set"); - - this->ACE_Addr::base_set - (AF_DEV, static_cast (ACE_OS::strlen (devname))); - ACE_OS::strsncpy (this->devname_, devname, ACE_DEV_Addr::DEVNAME_LENGTH); -} - -// Compare two addresses for equality. - -ACE_INLINE bool -ACE_DEV_Addr::operator == (const ACE_DEV_Addr &sap) const -{ - ACE_TRACE ("ACE_DEV_Addr::operator =="); - - return ACE_OS::strcmp (this->devname_, sap.devname_) == 0; -} - -// Compare two addresses for inequality. - -ACE_INLINE bool -ACE_DEV_Addr::operator != (const ACE_DEV_Addr &sap) const -{ - ACE_TRACE ("ACE_DEV_Addr::operator !="); - - return !((*this) == sap); // This is lazy, of course... ;-). -} - -// Return the path name used for the rendezvous point. - -ACE_INLINE const ACE_TCHAR * -ACE_DEV_Addr::get_path_name (void) const -{ - ACE_TRACE ("ACE_DEV_Addr::get_path_name"); - - return this->devname_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_Connector.cpp b/ace/DEV_Connector.cpp deleted file mode 100644 index a1fef807057..00000000000 --- a/ace/DEV_Connector.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// $Id$ - -#include "ace/DEV_Connector.h" - -#include "ace/Handle_Ops.h" - -#if !defined (__ACE_INLINE__) -#include "ace/DEV_Connector.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_RCSID (ace, - DEV_Connector, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Connector) - -void -ACE_DEV_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_DEV_Connector::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_DEV_Connector::ACE_DEV_Connector (void) -{ - ACE_TRACE ("ACE_DEV_Connector::ACE_DEV_Connector"); -} - -int -ACE_DEV_Connector::connect (ACE_DEV_IO &new_io, - const ACE_DEV_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &, - int, - int flags, - int perms) -{ - ACE_TRACE ("ACE_DEV_Connector::connect"); - - ACE_HANDLE handle = ACE::handle_timed_open (timeout, - remote_sap.get_path_name (), - flags, perms); - new_io.set_handle (handle); - new_io.addr_ = remote_sap; // class copy. - return handle == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_Connector.h b/ace/DEV_Connector.h deleted file mode 100644 index 2d57f836b24..00000000000 --- a/ace/DEV_Connector.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file DEV_Connector.h - * - * $Id$ - * - * @author Gerhard Lenzer and Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DEV_CONNECTOR_H -#define ACE_DEV_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/DEV_IO.h" -#include "ace/Log_Msg.h" -#include "ace/os_include/os_fcntl.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_DEV_Connector - * - * @brief Defines an active connection factory for the ACE_DEV wrappers. - */ -class ACE_Export ACE_DEV_Connector -{ -public: - /// Default constructor. - ACE_DEV_Connector (void); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made . The - * is the value of local address to bind to. If it's - * the default value of then the user is letting - * the OS do the binding. If == 1 then the - * is reused, even if it hasn't been cleanedup yet. - * The and arguments are passed down to the - * method. - */ - ACE_DEV_Connector (ACE_DEV_IO &new_io, - const ACE_DEV_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made . The - * is the value of local address to bind to. If it's - * the default value of then the user is letting - * the OS do the binding. If == 1 then the - * is reused, even if it hasn't been cleanedup yet. - * The and arguments are passed down to the - * method. - */ - int connect (ACE_DEV_IO &new_io, - const ACE_DEV_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Meta-type info - typedef ACE_DEV_Addr PEER_ADDR; - typedef ACE_DEV_IO PEER_STREAM; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/DEV_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DEV_CONNECTOR_H */ diff --git a/ace/DEV_Connector.inl b/ace/DEV_Connector.inl deleted file mode 100644 index 13ceeba1d75..00000000000 --- a/ace/DEV_Connector.inl +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Creates a Local ACE_DEV. - -ACE_INLINE -ACE_DEV_Connector::ACE_DEV_Connector (ACE_DEV_IO &new_io, - const ACE_DEV_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_DEV_Connector::ACE_DEV_Connector"); - if (this->connect (new_io, remote_sap, timeout, local_sap, - reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("address %s, %p\n"), - remote_sap.get_path_name (), ACE_LIB_TEXT ("ACE_DEV_IO"))); -} - -ACE_INLINE int -ACE_DEV_Connector::reset_new_handle (ACE_HANDLE handle) -{ - ACE_UNUSED_ARG (handle); - // Nothing to do here since the handle is not a socket - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_IO.cpp b/ace/DEV_IO.cpp deleted file mode 100644 index f5367d1d5cd..00000000000 --- a/ace/DEV_IO.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// $Id$ - -#include "ace/DEV_IO.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/DEV_IO.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, DEV_IO, "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_DEV_IO) - -// Return the local endpoint address. - -int -ACE_DEV_IO::get_local_addr (ACE_DEV_Addr &addr) const -{ - ACE_TRACE ("ACE_DEV_IO::get_local_addr"); - - addr = this->addr_; - return 0; -} - -// Return the address of the remotely connected peer (if there is -// one). - -int -ACE_DEV_IO::get_remote_addr (ACE_DEV_Addr &addr) const -{ - ACE_TRACE ("ACE_DEV_IO::get_remote_addr"); - addr = this->addr_; - return 0; -} - -void -ACE_DEV_IO::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_DEV_IO::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->addr_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Simple-minded do nothing constructor. - -ACE_DEV_IO::ACE_DEV_IO (void) -{ - ACE_TRACE ("ACE_DEV_IO::ACE_DEV_IO"); -} - -// Send N char *ptrs and int lengths. Note that the char *'s precede -// the ints (basically, an varargs version of writev). The count N is -// the *total* number of trailing arguments, *not* a couple of the -// number of tuple pairs! - -ssize_t -ACE_DEV_IO::send (size_t n, ...) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - va_list argp; - int total_tuples = static_cast (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::writev (this->get_handle (), iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -// This is basically an interface to ACE_OS::readv, that doesn't use the -// struct iovec explicitly. The ... can be passed as an arbitrary -// number of (char *ptr, int len) tuples. However, the count N is the -// *total* number of trailing arguments, *not* a couple of the number -// of tuple pairs! - -ssize_t -ACE_DEV_IO::recv (size_t n, ...) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - va_list argp; - int total_tuples = static_cast (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::readv (this->get_handle (), iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_IO.h b/ace/DEV_IO.h deleted file mode 100644 index fd2a0e2c5b8..00000000000 --- a/ace/DEV_IO.h +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file DEV_IO.h - * - * $Id$ - * - * @author Gerhard Lenzer - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DEV_IO_H -#define ACE_DEV_IO_H -#include /**/ "ace/pre.h" - -#include "ace/DEV.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_STREAM_PIPES) -# include "ace/OS_NS_stropts.h" -#endif /* ACE_HAS_STREAM_PIPES */ - -#include "ace/os_include/os_stdio.h" -#include "ace/os_include/sys/os_uio.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_DEV_IO - * - * @brief Read/Write operations on Devices. - */ -class ACE_Export ACE_DEV_IO : public ACE_DEV -{ -public: - friend class ACE_DEV_Connector; - - /// Default constructor. - ACE_DEV_IO (void); - - // = Various send operations. - /// send upto bytes in . - ssize_t send (const void *buf, size_t n) const; - - /// Recv upto bytes in . - ssize_t recv (void *buf, size_t n) const; - - /// Send n bytes, keep trying until n are sent. - ssize_t send_n (const void *buf, - size_t n) const; - - /** - * @name I/O operations - * - * Notes on common parameters: - * - * is the buffer to write from or receive into. - * - * is the number of bytes to transfer. - * - * The parameter in the following methods indicates how - * long to blocking trying to transfer data. If == 0, - * then the call behaves as a normal send/recv call, i.e., for - * blocking sockets, the call will block until action is possible; - * for non-blocking sockets, EWOULDBLOCK will be returned if no - * action is immediately possible. - * - * If != 0, the call will wait until the relative time - * specified in * elapses. - * - * The "_n()" I/O methods keep looping until all the data has been - * transferred. These methods also work for sockets in non-blocking - * mode i.e., they keep looping on EWOULDBLOCK. is used - * to make sure we keep making progress, i.e., the same timeout - * value is used for every I/O operation in the loop and the timeout - * is not counted down. - * - * The return values for the "*_n()" methods match the return values - * from the non "_n()" methods and are specified as follows: - * - * - On complete transfer, the number of bytes transferred is returned. - * - On timeout, -1 is returned, errno == ETIME. - * - On error, -1 is returned, errno is set to appropriate error. - * - On EOF, 0 is returned, errno is irrelevant. - * - * On partial transfers, i.e., if any data is transferred before - * timeout/error/EOF, will contain the number of - * bytes transferred. - */ - ssize_t recv_n (void *buf, - size_t n, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - -#if defined (ACE_HAS_STREAM_PIPES) - /// Recv bytes via STREAM pipes using "band" mode. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *band, - int *flags) const; - - /// Send bytes via STREAM pipes using "band" mode. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int band, - int flags) const; - - /// Recv @a cntl and @a data via STREAM pipes. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *flags) const; - - /// Send and via STREAM pipes. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int flags = 0) const; -#endif /* ACE_HAS_STREAM_PIPES */ - - /// Send iovecs via <::writev>. - ssize_t send (const iovec iov[], size_t n) const; - - /// Recv iovecs via <::readv>. - ssize_t recv (iovec iov[], size_t n) const; - - /** - * Send N char *ptrs and int lengths. Note that the char *'s - * precede the ints (basically, an varargs version of writev). The - * count N is the *total* number of trailing arguments, *not* a - * couple of the number of tuple pairs! - */ - ssize_t send (size_t n, ...) const; - - /** - * This is an interface to ::readv, that doesn't use the struct - * iovec explicitly. The ... can be passed as an arbitrary number - * of (char *ptr, int len) tuples. However, the count N is the - * *total* number of trailing arguments, *not* a couple of the - * number of tuple pairs! - */ - ssize_t recv (size_t n, ...) const; - - /// Send bytes via Win32 WriteFile using overlapped I/O. - ssize_t send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const; - - /// Recv bytes via Win32 ReadFile using overlapped I/O. - ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const; - - /// Dump the state of an object. - void dump (void) const; - - // = The following two methods are no-ops to keep the - // happy. - /// Return the local endpoint address. - int get_local_addr (ACE_DEV_Addr &) const; - - /// Return the address of the remotely connected peer (if there is - /// one). - int get_remote_addr (ACE_DEV_Addr &) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Meta-type info - typedef ACE_DEV_Addr PEER_ADDR; - -private: - /// Address of device we are connected to. - ACE_DEV_Addr addr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/DEV_IO.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DEV_IO_H */ diff --git a/ace/DEV_IO.inl b/ace/DEV_IO.inl deleted file mode 100644 index cb9392e2bf3..00000000000 --- a/ace/DEV_IO.inl +++ /dev/null @@ -1,126 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_sys_uio.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_Memory.h" - -#include "ace/ACE.h" - -// Send exactly N bytes from BUF to this device. Keeping trying until -// this many bytes are sent. - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_DEV_IO::send_n (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::send_n"); - return ACE::write_n (this->get_handle (), buf, n); -} - -// Receive exactly N bytes from this file into BUF. Keep trying until -// this many bytes are received. - -ACE_INLINE ssize_t -ACE_DEV_IO::recv_n (void *buf, - size_t n, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_DEV_IO::recv_n"); -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (timeout); - - return ACE::read_n (this->get_handle (), - buf, - n, - bytes_transferred); -#else - return ACE::recv_n (this->get_handle (), - buf, - n, - timeout, - bytes_transferred); -#endif /*ACE_WIN32*/ -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::write (this->get_handle (), (const char *) buf, n); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::recv (void *buf, size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::read (this->get_handle (), (char *) buf, n); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const iovec iov[], size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::writev (this->get_handle (), iov, static_cast (n)); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::recv (iovec iov[], size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::readv (this->get_handle (), iov, static_cast (n)); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::write (this->get_handle (), - (const char *) buf, n, - overlapped); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::recv (void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::read (this->get_handle (), (char *) buf, n, - overlapped); -} - -#if defined (ACE_HAS_STREAM_PIPES) -ACE_INLINE ssize_t -ACE_DEV_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DLL.cpp b/ace/DLL.cpp deleted file mode 100644 index 2d034635ac2..00000000000 --- a/ace/DLL.cpp +++ /dev/null @@ -1,271 +0,0 @@ -// $Id$ - -#include "ace/DLL.h" - -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/DLL_Manager.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_dlfcn.h" -#include "ace/OS_NS_Thread.h" - -ACE_RCSID(ace, DLL, "$Id$") - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Default constructor. Also, by default, the object will be closed -// before it is destroyed. - -ACE_DLL::ACE_DLL (int close_handle_on_destruction) - : open_mode_ (0), - dll_name_ (0), - close_handle_on_destruction_ (close_handle_on_destruction), - dll_handle_ (0), - error_ (0) -{ - ACE_TRACE ("ACE_DLL::ACE_DLL (int)"); -} - -ACE_DLL::ACE_DLL (const ACE_DLL &rhs) - : open_mode_ (0), - dll_name_ (0), - close_handle_on_destruction_ (0), - dll_handle_ (0), - error_ (0) -{ - ACE_TRACE ("ACE_DLL::ACE_DLL (const ACE_DLL &)"); - - if (rhs.dll_name_ - // This will automatically up the refcount. - && this->open (rhs.dll_name_, - rhs.open_mode_, - rhs.close_handle_on_destruction_) != 0 - && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL::copy_ctor: error: %s\n"), - this->error ())); -} - -// Assignment operator - -const ACE_DLL & -ACE_DLL::operator= (const ACE_DLL &rhs) -{ - ACE_TRACE ("ACE_DLL::operator= (const ACE_DLL &)"); - - open_mode_ = 0; - dll_name_ = 0; - close_handle_on_destruction_=0; - dll_handle_=0; - error_=0; - - if (rhs.dll_name_ - // This will automatically up the refcount and initialize *this - && this->open (rhs.dll_name_, - rhs.open_mode_, - rhs.close_handle_on_destruction_) != 0 - && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL::operator=: error: %s\n"), - this->error ())); - - return *this; -} - - -// If the library name and the opening mode are specified than on -// object creation the library is implicitly opened. - -ACE_DLL::ACE_DLL (const ACE_TCHAR *dll_name, - int open_mode, - int close_handle_on_destruction) - : open_mode_ (open_mode), - dll_name_ (0), - close_handle_on_destruction_ (close_handle_on_destruction), - dll_handle_ (0), - error_ (0) -{ - ACE_TRACE ("ACE_DLL::ACE_DLL"); - - if (this->open (dll_name, this->open_mode_, close_handle_on_destruction) != 0 - && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL::open: error calling open: %s\n"), - this->error ())); -} - -// The library is closed before the class gets destroyed depending on -// the close_handle_on_destruction value specified which is stored in -// close_handle_on_destruction_. - -ACE_DLL::~ACE_DLL (void) -{ - ACE_TRACE ("ACE_DLL::~ACE_DLL"); - - this->close (); - - // Normally delete()d in ACE_DLL::close(). However, that may not - // occur if full ACE_DLL initialization is interrupted due to errors - // (e.g. attempting to open a DSO/DLL that does not exist). Make - // sure this->dll_name_ is deallocated. - delete [] this->dll_name_; -} - -// This method opens the library based on the mode specified using the -// ACE_SHLIB_HANDLE which is obtained on making the ACE_OS::dlopen call. -// The default mode is: -// RTLD_LAZY Only references to data symbols are relocate when the -// object is first loaded. -// The other modes include: -// RTLD_NOW All necessary relocations are performed when the -// object is first loaded. -// RTLD_GLOBAL The object symbols are made available for the -// relocation processing of any other object. - -int -ACE_DLL::open (const ACE_TCHAR *dll_filename, - int open_mode, - int close_handle_on_destruction) -{ - ACE_TRACE ("ACE_DLL::open"); - - return open_i (dll_filename, open_mode, close_handle_on_destruction); -} - -int -ACE_DLL::open_i (const ACE_TCHAR *dll_filename, - int open_mode, - int close_handle_on_destruction, - ACE_SHLIB_HANDLE handle) -{ - ACE_TRACE ("ACE_DLL::open_i"); - - this->error_ = 0; - - if (!dll_filename) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL::open_i: dll_name is %s\n"), - this->dll_name_ == 0 ? ACE_LIB_TEXT ("(null)") - : this->dll_name_)); - return -1; - } - - if (this->dll_handle_) - { - // If we have a good handle and its the same name, just return. - if (ACE_OS::strcmp (this->dll_name_, dll_filename) == 0) - return 0; - else - this->close (); - } - - if (!this->dll_name_) - this->dll_name_ = ACE::strnew (dll_filename); - - this->open_mode_ = open_mode; - this->close_handle_on_destruction_ = close_handle_on_destruction; - - this->dll_handle_ = ACE_DLL_Manager::instance()->open_dll (this->dll_name_, - this->open_mode_, - handle); - - if (!this->dll_handle_) - this->error_ = 1; - - return this->error_ ? -1 : 0; -} - -// The symbol refernce of the name specified is obtained. - -void * -ACE_DLL::symbol (const ACE_TCHAR *sym_name, int ignore_errors) -{ - ACE_TRACE ("ACE_DLL::symbol"); - - this->error_ = 0; - - void *sym = 0; - if (this->dll_handle_) - sym = this->dll_handle_->symbol (sym_name, ignore_errors); - - if (!sym) - this->error_ = 1; - - return sym; -} - -// The library is closed using the ACE_SHLIB_HANDLE object, i.e., the -// shared object is now disassociated form the current process. - -int -ACE_DLL::close (void) -{ - ACE_TRACE ("ACE_DLL::close"); - - int retval = 0; - - if (this->dll_handle_ - && this->close_handle_on_destruction_ - && this->dll_name_ - && (retval = ACE_DLL_Manager::instance ()->close_dll (this->dll_name_)) != 0) - this->error_ = 1; - - // Even if close_dll() failed, go ahead and cleanup. - this->dll_handle_ = 0; - delete [] this->dll_name_; - this->dll_name_ = 0; - this->close_handle_on_destruction_ = 0; - - return retval; -} - -// This method is used return the last error of a library operation. - -ACE_TCHAR * -ACE_DLL::error (void) const -{ - ACE_TRACE ("ACE_DLL::error"); - if (this->error_) - return - const_cast (ACE_LIB_TEXT ("Error: check log for details.")); - - return 0; -} - -// Return the handle to the user either temporarily or forever, thus -// orphaning it. If 0 means the user wants the handle forever and if 1 -// means the user temporarily wants to take the handle. - -ACE_SHLIB_HANDLE -ACE_DLL::get_handle (int become_owner) const -{ - ACE_TRACE ("ACE_DLL::get_handle"); - - ACE_SHLIB_HANDLE handle = ACE_SHLIB_INVALID_HANDLE; - - if (this->dll_handle_) - handle = this->dll_handle_->get_handle (become_owner); - - return handle; -} - -// Set the handle for the DLL. By default, the object will be closed -// before it is destroyed. - -int -ACE_DLL::set_handle (ACE_SHLIB_HANDLE handle, - int close_handle_on_destruction) -{ - ACE_TRACE ("ACE_DLL::set_handle"); - - // Create a unique name. Note that this name is only quaranteed - // to be unique for the life of this object. - ACE_TCHAR temp[ACE_UNIQUE_NAME_LEN]; - ACE_OS::unique_name (this, temp, ACE_UNIQUE_NAME_LEN); - - return this->open_i (temp, 1, close_handle_on_destruction, handle); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DLL.h b/ace/DLL.h deleted file mode 100644 index c985a4e4411..00000000000 --- a/ace/DLL.h +++ /dev/null @@ -1,196 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file DLL.h - * - * $Id$ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef ACE_DLL_H -#define ACE_DLL_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" -#include "ace/os_include/os_dlfcn.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_DLL_Handle; - -/** - * @class ACE_DLL - * - * @brief Provides an abstract interface for handling various DLL - * operations. - * - * This class is a wrapper over the various methods for utilizing - * a dynamically linked library (DLL), which is called a shared - * library on some platforms. Operations @c open(), @c close(), and - * @c symbol() have been implemented to help opening/closing and - * extracting symbol information from a DLL, respectively. - */ -class ACE_Export ACE_DLL -{ -public: - // = Initialization and termination methods. - - /** - * Default constructor. By default, the close() operation on the - * object will be invoked before it is destroyed. - * @param close_handle_on_destruction Indicates whether or not the - * close() method will be called to close an open DLL when this - * object is destroyed. By default, close() will be called. - * Set this parameter to 0 for situations where the DLL's lifetime - * is controlled in a scope other than that of this ACE_DLL object. - * For example, termination by ACE_DLL_Manager via ACE::fini(). - */ - explicit ACE_DLL (int close_handle_on_destruction = 1); - - /// Allow assignment - const ACE_DLL& operator= (const ACE_DLL &rhs); - - - /** - * This constructor performs the actions of open() during construction. - * @param dll_name The name or path of the DLL to load. - * @param open_mode Flags to alter the actions taken when loading the DLL. - * The possible values are: - * @li @c RTLD_LAZY (this the default): loads identifier symbols but - * not the symbols for functions, which are loaded dynamically - * on-demand. - * @li @c RTLD_NOW: performs all necessary relocations when - * @a dll_name is first loaded - * @li RTLD_GLOBAL: makes symbols available for relocation - * processing of any other DLLs. - * @param close_handle_on_destruction Indicates whether or not the - * close() method will be called to close an open DLL when this - * object is destroyed. By default, close() will be called. - * Set this parameter to 0 for situations where the DLL's lifetime - * is controlled in a scope other than that of this ACE_DLL object. - * For example, termination by ACE_DLL_Manager via ACE::fini(). - */ - explicit ACE_DLL (const ACE_TCHAR *dll_name, - int open_mode = ACE_DEFAULT_SHLIB_MODE, - int close_handle_on_destruction = 1); - - /// Copy constructor. - ACE_DLL (const ACE_DLL &); - - /** - * This method opens and dynamically links a specified DLL. - * @param dll_name The filename or path of the DLL to load. - * If a filename is given to @c open(), the @c ACE::ldfind() is used - * to locate DLLs via the following algorithms: (1) DLL filename - * expansion: @c ACE::ldfind() determines the name of the DLL by - * adding the appropriate prefix and suffix, e.g., it adds the @c lib - * prefix and @c .so suffix for Solaris and the @c .dll suffix for - * Windows and (2) DLL search path: @c ACE::ldfind() will also search - * for the designated DLL using the platform's DLL search path - * environment variable, e.g., it searches for DLLs using @c - * LD_LIBRARY_PATH on many UNIX systems and @c PATH on Windows. - * @param open_mode Flags to alter the actions taken when loading the DLL. - * The possible values are: - * @li @c RTLD_LAZY (this the default): loads identifier symbols but - * not the symbols for functions, which are loaded dynamically - * on-demand. - * @li @c RTLD_NOW: performs all necessary relocations when - * @a dll_name is first loaded - * @li RTLD_GLOBAL: makes symbols available for relocation - * processing of any other DLLs. - * @param close_handle_on_destruction Indicates whether or not the - * close() method will be called to close an open DLL when this - * object is destroyed. By default, close() will be called. - * Set this parameter to 0 for situations where the DLL's lifetime - * is controlled in a scope other than that of this ACE_DLL object. - * For example, termination by ACE_DLL_Manager via ACE::fini(). - * @retval -1 On failure - * @retval 0 On success. - */ - int open (const ACE_TCHAR *dll_name, - int open_mode = ACE_DEFAULT_SHLIB_MODE, - int close_handle_on_destruction = 1); - - /// Call to close the DLL object. - int close (void); - - /** - * Called when the DLL object is destroyed -- invokes close() if the - * @a close_handle_on_destruction flag was set to non-zero in the - * constructor or open() method. - */ - ~ACE_DLL (void); - - /** - * Look up a named symbol in the DLL. DLL must be successfully opened - * before calling symbol(). - * @param symbol_name The symbol name to look up. - * @param ignore_errors If set to 1, allows you to probe a dll without - * generating error messages in the log. Handy for determining - * the capabilities of a library. - * @return Returns the value of @a symbol_name if it is a valid symbol - * in the DLL. Otherwise, returns 0. - */ - void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0); - - /// Returns a pointer to a string explaining that an error occured. You - /// will need to consult the error log for the actual error string - /// returned by the OS. - ACE_TCHAR *error (void) const; - - /** - * Return the handle to the caller. If @a become_owner is non-0 then - * caller assumes ownership of the handle and the ACE_DLL object - * won't call close() when it goes out of scope, even if - * is set. - */ - ACE_SHLIB_HANDLE get_handle (int become_owner = 0) const; - - /// Set the handle for the DLL object. By default, the close() - //operation on / the object will be invoked before it is destroyed. - int set_handle (ACE_SHLIB_HANDLE handle, - int close_handle_on_destruction = 1); - -private: - - int open_i (const ACE_TCHAR *dll_name, - int open_mode = ACE_DEFAULT_SHLIB_MODE, - int close_handle_on_destruction = 1, - ACE_SHLIB_HANDLE handle = 0); - - - //private: -public: - - /// Open mode. - int open_mode_; - - /// Keep track of the name of the loaded dll, so it can be used - /// to remove framework components, singletons that live in the dll, - /// prior to unloading the dll in the close() method. - ACE_TCHAR *dll_name_; - - /// This flag keeps track of whether we should close the handle - /// automatically when the object is destroyed. - int close_handle_on_destruction_; - - ACE_DLL_Handle *dll_handle_; - - /// Flag to record if the last operation had an error. - int error_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_DLL_H */ diff --git a/ace/DLL_Manager.cpp b/ace/DLL_Manager.cpp deleted file mode 100644 index b796c4b6e55..00000000000 --- a/ace/DLL_Manager.cpp +++ /dev/null @@ -1,756 +0,0 @@ -// $Id$ - -#include "ace/DLL_Manager.h" - -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/Framework_Component.h" - -#include "ace/Lib_Find.h" -#include "ace/Object_Manager.h" -#include "ace/SString.h" -#include "ace/Recursive_Thread_Mutex.h" -#include "ace/Guard_T.h" -#include "ace/OS_NS_dlfcn.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID (ace, - DLL_Manager, - "DLL_Manager.cpp,v 4.23 2003/11/05 23:30:46 shuston Exp") - -/******************************************************************/ - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -sig_atomic_t ACE_DLL_Handle::open_called_ = 0; - -ACE_DLL_Handle::ACE_DLL_Handle (void) - : refcount_ (0), - dll_name_ (0), - handle_ (ACE_SHLIB_INVALID_HANDLE) -{ - ACE_TRACE ("ACE_DLL_Handle::ACE_DLL_Handle"); -} - -ACE_DLL_Handle::~ACE_DLL_Handle (void) -{ - ACE_TRACE ("ACE_DLL_Handle::~ACE_DLL_Handle"); - this->close (1); - delete[] this->dll_name_; -} - -const ACE_TCHAR * -ACE_DLL_Handle::dll_name (void) const -{ - ACE_TRACE ("ACE_DLL_Handle::dll_name"); - return this->dll_name_; -} - -int -ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, - int open_mode, - ACE_SHLIB_HANDLE handle) -{ - ACE_TRACE ("ACE_DLL_Handle::open"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - if (this->dll_name_) - { - // Once dll_name_ has been set, it can't be changed.. - if (ACE_OS::strcmp (this->dll_name_, dll_name) != 0) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("(%P|%t) DLL_Handle::open: error, ") - ACE_LIB_TEXT ("tried to reopen %s with name %s\n"), - this->dll_name_, - dll_name)); - - return -1; - } - } - else - this->dll_name_ = ACE::strnew (dll_name); - - if (!this->open_called_) - this->open_called_ = 1; - - // If it hasn't been loaded yet, go ahead and do that now. - if (this->handle_ == ACE_SHLIB_INVALID_HANDLE) - { - if (handle) - this->handle_ = handle; - else - { - /* - ** Get the set of names to try loading. We need to do this to - ** properly support the ability for a user to specify a simple, - ** unadorned name (for example, "ACE") that will work across - ** platforms. We apply platform specifics to get a name that will - ** work (e.g. libACE, ACEd.dll, ACE.dll, etc.) We rely on the - ** underlying dlopen() implementation to "Do The Right Thing" in - ** terms of using relative paths, LD_LIBRARY_PATH, system security - ** rules, etc. except when ACE_MUST_HELP_DLOPEN_SEARCH_PATH is set. - ** If it is set, then ACE::ldfind() scans the configured path - ** looking for a match on the name and prefix/suffix applications. - ** NOTE: having ACE scan for a file and then pass a fully-qualified - ** pathname to dlopen() is a potential security hole; therefore, - ** do not use ACE_MUST_HELP_DLOPEN_SEARCH_PATH unless necessary - ** and only after considering the risks. - */ - ACE_Array dll_names; - dll_names.max_size (10); // Decent guess to avoid realloc later - -#if defined (ACE_MUST_HELP_DLOPEN_SEARCH_PATH) - // Find out where the library is - ACE_TCHAR dll_pathname[MAXPATHLEN + 1]; - - // Transform the pathname into the appropriate dynamic link library - // by searching the ACE_LD_SEARCH_PATH. - ACE::ldfind (dll_name, - dll_pathname, - (sizeof dll_pathname / sizeof (ACE_TCHAR))); - ACE_TString dll_str (dll_pathname); - dll_names.size (1); - dll_names.set (dll_str, 0); -#else - this->get_dll_names (dll_name, dll_names); -#endif - - ACE_Array_Iterator name_iter (dll_names); - ACE_TString *name = 0; - while (name_iter.next (name)) - { - // The ACE_SHLIB_HANDLE object is obtained. - this->handle_ = ACE_OS::dlopen (name->c_str (), - open_mode); - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::open ") - ACE_LIB_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"), - name->c_str (), - open_mode, - ((this->handle_ != ACE_SHLIB_INVALID_HANDLE) - ? ACE_LIB_TEXT ("succeeded") - : ACE_LIB_TEXT ("failed")), - this->error()->c_str())); - } - - if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) // Good one? - break; - - // If errno is ENOENT we just skip over this one, - // anything else - like an undefined symbol, for - // instance must be flagged here or the next error will - // mask it. - // @TODO: If we've found our DLL _and_ it's - // broken, should we continue at all? - if ((errno != 0) && (errno != ENOENT) && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::open ") - ACE_LIB_TEXT ("(\'%s\') failed, errno=") - ACE_LIB_TEXT ("%d: %s\n"), - name->c_str (), - errno, - this->error ()->c_str ())); - -#if defined (AIX) - // AIX often puts the shared library file (most often named - // shr.o) inside an archive library. If this is an archive - // library name, then try appending [shr.o] and retry. - if (ACE_TString::npos != name->strstr (ACE_LIB_TEXT (".a"))) - { - ACE_TCHAR aix_pathname[MAXPATHLEN + 1]; - ACE_OS::strncpy (aix_pathname, - name->c_str (), - name->length ()); - aix_pathname[name->length ()] = '\0'; - ACE_OS::strcat (aix_pathname, ACE_LIB_TEXT ("(shr.o)")); - open_mode |= RTLD_MEMBER; - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::open ") - ACE_LIB_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"), - aix_pathname, - open_mode, - ACE_LIB_TEXT ((this->handle_ != ACE_SHLIB_INVALID_HANDLE) - ? "succeeded" - : "failed"), - this->error()->c_str())); - } - - this->handle_ = ACE_OS::dlopen (aix_pathname, open_mode); - if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) - break; - - // If errno is ENOENT we just skip over this one, anything - // else - like an undefined symbol, for instance - // must be flagged here or the next error will mask it. - // - // @TODO: If we've found our DLL _and_ it's broken, - // should we continue at all? - if (ACE::debug () && (errno != 0) && (errno != ENOENT)) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::open ") - ACE_LIB_TEXT ("(\'%s\') failed, errno=") - ACE_LIB_TEXT ("%d: %s\n"), - name->c_str (), - errno, - this->error ()->c_str ())); - - } -#endif /* AIX */ - - name_iter.advance (); - } - - if (this->handle_ == ACE_SHLIB_INVALID_HANDLE) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::open (\"%s\"): ") - ACE_LIB_TEXT ("Invalid handle error: %s\n"), - this->dll_name_, - this->error ()->c_str ())); - - return -1; - } - } - } - - ++this->refcount_; - return 0; -} - -int -ACE_DLL_Handle::close (int unload) -{ - ACE_TRACE ("ACE_DLL_Handle::close"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - int retval = 0; - - // Since we don't actually unload the dll as soon as the refcount - // reaches zero, we need to make sure we don't decrement it below - // zero. - if (this->refcount_ > 0) - --this->refcount_; - else - this->refcount_ = 0; - - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::close: ") - ACE_LIB_TEXT ("closing %s (%d), refcount is down to %d\n"), - this->dll_name_, - this->handle_, - this->refcount_)); - - if (this->refcount_ == 0 && - this->handle_ != ACE_SHLIB_INVALID_HANDLE && - unload == 1) - { - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::close: ") - ACE_LIB_TEXT ("Unloading %s (%d)\n"), - this->dll_name_, - this->handle_)); - - // First remove any associated Framework Components. - ACE_Framework_Repository * frPtr= ACE_Framework_Repository::instance (); - - if (frPtr) - { - frPtr->remove_dll_components (this->dll_name_); - } - - retval = ACE_OS::dlclose (this->handle_); - this->handle_ = ACE_SHLIB_INVALID_HANDLE; - } - - if (retval != 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::close: ") - ACE_LIB_TEXT ("failed with: \"%s\".\n"), - this->error ()->c_str ())); - - return retval; -} - -sig_atomic_t -ACE_DLL_Handle::refcount (void) const -{ - return this->refcount_; -} - -void * -ACE_DLL_Handle::symbol (const ACE_TCHAR *sym_name, int ignore_errors) -{ - ACE_TRACE ("ACE_DLL_Handle::symbol"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - ACE_Auto_Array_Ptr auto_name (ACE::ldname (sym_name)); - // handle_ can be invalid especially when ACE_DLL_Handle resigned ownership - // BTW. Handle lifecycle management is a little crazy in ACE - if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) - { -#if defined (ACE_OPENVMS) - void *sym = ACE::ldsymbol (this->handle_, auto_name.get ()); -#else - void *sym = ACE_OS::dlsym (this->handle_, auto_name.get ()); -#endif - - // Linux says that the symbol could be null and that it isn't an - // error. So you should check the error message also, but since - // null symbols won't do us much good anyway, let's still report - // an error. - if (!sym && ignore_errors != 1) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::symbol (\"%s\") ") - ACE_LIB_TEXT (" failed with \"%s\".\n"), - auto_name.get (), - this->error ()->c_str ())); - - return 0; - } - return sym; - } - return 0; -} - -ACE_SHLIB_HANDLE -ACE_DLL_Handle::get_handle (int become_owner) -{ - ACE_TRACE ("ACE_DLL_Handle::get_handle"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - ACE_SHLIB_HANDLE handle = ACE_SHLIB_INVALID_HANDLE; - - if (this->refcount_ == 0 && become_owner != 0) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE (%P|%t) DLL_Handle::get_handle: ") - ACE_LIB_TEXT ("cannot become owner, refcount == 0.\n"))); - - return ACE_SHLIB_INVALID_HANDLE; - } - - handle = this->handle_; - - if (become_owner != 0) - { - if (--this->refcount_ == 0) - this->handle_ = ACE_SHLIB_INVALID_HANDLE; - } - - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ACE (%P|%t) ACE_DLL_Handle::get_handle: ") - ACE_LIB_TEXT ("post call: handle %s, refcount %d\n"), - this->handle_ == ACE_SHLIB_INVALID_HANDLE ? - ACE_LIB_TEXT ("invalid") : ACE_LIB_TEXT ("valid"), - this->refcount_)); - - return handle; -} - -// This method is used return the last error of a library operation. - -auto_ptr -ACE_DLL_Handle::error (void) -{ - ACE_TRACE ("ACE_DLL_Handle::error"); - const ACE_TCHAR *error = ACE_OS::dlerror (); - auto_ptr str - (new ACE_TString (error ? error : ACE_LIB_TEXT ("no error"))); - return str; -} - -void -ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, - ACE_Array &try_names) -{ - // Build the array of DLL names to try on this platform by applying the - // proper prefixes and/or suffixes to the specified dll_name. - ACE_TString base (dll_name); - ACE_TString base_dir, base_file, base_suffix; - - // 1. Separate the dll_name into the dir part and the file part. We - // only decorate the file part to determine the names to try loading. - ACE_TString::size_type pos = base.rfind (ACE_DIRECTORY_SEPARATOR_CHAR); - if (pos != ACE_TString::npos) - { - base_dir = base.substr (0, pos + 1); - base_file = base.substr (pos + 1); - } - else - base_file = base; - - // 2. Locate the file suffix, if there is one. Move the '.' and the - // suffix to base_suffix. - if ((pos = base_file.rfind (ACE_LIB_TEXT ('.'))) != ACE_TString::npos) - { - base_suffix = base_file.substr (pos); - base_file = base_file.substr (0, pos); - } - - // 3. Build the combinations to try for this platform. - // Try these combinations: - // - name with decorator and platform's suffix appended (if not supplied) - // - name with platform's suffix appended (if not supplied) - // - name with platform's dll prefix (if it has one) and suffix - // - name with platform's dll prefix, decorator, and suffix. - // - name as originally given - // We first try to find the file using the decorator so that when a - // filename with and without decorator is used, we get the file with - // the same decorator as the ACE dll has and then as last resort - // the one without. For example with msvc, the debug build has a "d" - // decorator, but the release build has none and we really want to get - // the debug version of the library in a debug application instead - // of the release one. - // So we need room for 5 entries in try_names. - try_names.size (0); - if ((try_names.max_size () - try_names.size ()) < 5) - try_names.max_size (try_names.max_size () + 5); -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - ACE_TString decorator (ACE_LD_DECORATOR_STR); -#endif - ACE_TString suffix (ACE_DLL_SUFFIX); - ACE_TString prefix (ACE_DLL_PREFIX); - - for (size_t i = 0; i < 5 && try_names.size () < try_names.max_size (); ++i) - { - ACE_TString try_this; - size_t j = try_names.size (); - switch (i) - { - case 0: // Name + decorator + suffix - case 1: // Name + suffix - case 2: // Prefix + name + decorator + suffix - case 3: // Prefix + name + suffix - if ( - base_suffix.length () > 0 -#if !(defined(ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)) - || (i == 1 || i == 3) // No decorator desired; skip -#endif - ) - break; - try_this = base_dir; - if (i > 1) - try_this += prefix; - try_this += base_file; - if (base_suffix.length () > 0) - try_this += base_suffix; - else - { -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - try_this += decorator; -#endif - try_this += suffix; - } - break; - case 4: - try_this = dll_name; - break; - } - - if (try_this.length ()) - { - try_names.size (j + 1); - try_names.set (try_this, j); - } - } - return; -} - -/******************************************************************/ - -// Pointer to the Singleton instance. -ACE_DLL_Manager *ACE_DLL_Manager::instance_ = 0; - - -ACE_DLL_Manager * -ACE_DLL_Manager::instance (int size) -{ - ACE_TRACE ("ACE_DLL_Manager::instance"); - - if (ACE_DLL_Manager::instance_ == 0) - { - // Perform Double-Checked Locking Optimization. - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance (), 0)); - if (ACE_DLL_Manager::instance_ == 0) - { - ACE_NEW_RETURN (ACE_DLL_Manager::instance_, - ACE_DLL_Manager (size), - 0); - } - } - - return ACE_DLL_Manager::instance_; -} - -void -ACE_DLL_Manager::close_singleton (void) -{ - ACE_TRACE ("ACE_DLL_Manager::close_singleton"); - - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance ())); - - delete ACE_DLL_Manager::instance_; - ACE_DLL_Manager::instance_ = 0; -} - -ACE_DLL_Manager::ACE_DLL_Manager (int size) - : handle_vector_ (0), - current_size_ (0), - total_size_ (0), - unload_policy_ (ACE_DLL_UNLOAD_POLICY_PER_DLL) -{ - ACE_TRACE ("ACE_DLL_Manager::ACE_DLL_Manager"); - - if (this->open (size) != 0 && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Manager ctor failed to allocate ") - ACE_LIB_TEXT ("handle_vector_.\n"))); -} - -ACE_DLL_Manager::~ACE_DLL_Manager (void) -{ - ACE_TRACE ("ACE_DLL_Manager::~ACE_DLL_Manager"); - - if (this->close () != 0 && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Manager dtor failed to close ") - ACE_LIB_TEXT ("properly.\n"))); -} - -ACE_DLL_Handle * -ACE_DLL_Manager::open_dll (const ACE_TCHAR *dll_name, - int open_mode, - ACE_SHLIB_HANDLE handle) -{ - ACE_TRACE ("ACE_DLL_Manager::open_dll"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - ACE_DLL_Handle *temp_handle = 0; - ACE_DLL_Handle *dll_handle = this->find_dll (dll_name); - if (!dll_handle) - { - if (this->current_size_ < this->total_size_) - { - ACE_NEW_RETURN (temp_handle, - ACE_DLL_Handle, - 0); - - dll_handle = temp_handle; - } - } - - if (dll_handle) - { - if (dll_handle->open (dll_name, open_mode, handle) != 0) - { - // Error while openind dll. Free temp handle - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Manager::open_dll: Could not ") - ACE_LIB_TEXT ("open dll %s.\n"), - dll_name)); - - delete temp_handle; - return 0; - } - - // Add the handle to the vector only if the dll is successfully - // opened. - if (temp_handle != NULL) - { - this->handle_vector_[this->current_size_] = dll_handle; - this->current_size_++; - } - } - - return dll_handle; -} - -int -ACE_DLL_Manager::close_dll (const ACE_TCHAR *dll_name) -{ - ACE_TRACE ("ACE_DLL_Manager::close_dll"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - ACE_DLL_Handle *handle = this->find_dll (dll_name); - if (handle) - { - return this->unload_dll (handle, 0); - } - - return -1; -} - -u_long -ACE_DLL_Manager::unload_policy (void) const -{ - ACE_TRACE ("ACE_DLL_Manager::unload_policy"); - return this->unload_policy_; -} - -void -ACE_DLL_Manager::unload_policy (u_long unload_policy) -{ - ACE_TRACE ("ACE_DLL_Manager::unload_policy"); - ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); - - u_long old_policy = this->unload_policy_; - this->unload_policy_ = unload_policy; - - // If going from LAZY to EAGER or from PER_DLL to PER_PROCESS|EAGER, - // call close(1) on all the ACE_DLL_Handle objects with refcount == 0 - // which will force those that are still loaded to be unloaded. - if (this->handle_vector_) - if (( ACE_BIT_ENABLED (old_policy, ACE_DLL_UNLOAD_POLICY_LAZY) && - ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_LAZY) ) || - ( ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_LAZY) && - ACE_BIT_ENABLED (old_policy, ACE_DLL_UNLOAD_POLICY_PER_DLL) && - ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_PER_DLL) )) - { - for (int i = this->current_size_ - 1; i >= 0; i--) - { - if (this->handle_vector_[i] && - this->handle_vector_[i]->refcount () == 0) - this->handle_vector_[i]->close (1); - } - } -} - -int -ACE_DLL_Manager::open (int size) -{ - ACE_TRACE ("ACE_DLL_Manager::open"); - - ACE_DLL_Handle **temp = 0; - - ACE_NEW_RETURN (temp, - ACE_DLL_Handle *[size], - -1); - - this->handle_vector_ = temp; - this->total_size_ = size; - return 0; -} - -int -ACE_DLL_Manager::close (void) -{ - ACE_TRACE ("ACE_DLL_Manager::close"); - - int force_close = 1; - - if (this->handle_vector_ != 0) - { - // Delete components in reverse order. - for (int i = this->current_size_ - 1; i >= 0; i--) - { - if (this->handle_vector_[i]) - { - ACE_DLL_Handle *s = - const_cast (this->handle_vector_[i]); - this->handle_vector_[i] = 0; - this->unload_dll (s, force_close); - delete s; - } - } - - delete [] this->handle_vector_; - this->handle_vector_ = 0; - this->current_size_ = 0; - } - return 0; -} - -ACE_DLL_Handle * -ACE_DLL_Manager::find_dll (const ACE_TCHAR *dll_name) const -{ - ACE_TRACE ("ACE_DLL_Manager::find_dll"); - - int i; - for (i = 0; i < this->current_size_; i++) - if (this->handle_vector_[i] && - ACE_OS::strcmp (this->handle_vector_[i]->dll_name (), dll_name) == 0) - { - return this->handle_vector_[i]; - } - - return 0; -} - -int -ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload) -{ - ACE_TRACE ("ACE_DLL_Manager::unload_dll"); - - if (dll_handle) - { - int unload = force_unload; - if (unload == 0) - { - // apply strategy - if (ACE_BIT_DISABLED (this->unload_policy_, - ACE_DLL_UNLOAD_POLICY_PER_DLL)) - { - unload = ACE_BIT_DISABLED (this->unload_policy_, - ACE_DLL_UNLOAD_POLICY_LAZY); - } - else - { - // Declare the type of the symbol: - typedef int (*dll_unload_policy)(void); - dll_unload_policy the_policy = 0; - void *unload_policy_ptr = - dll_handle->symbol (ACE_LIB_TEXT ("_get_dll_unload_policy"), 1); - ptrdiff_t temp_p = - reinterpret_cast (unload_policy_ptr); - the_policy = - reinterpret_cast (temp_p); - if (the_policy != 0) - unload = ACE_BIT_DISABLED (the_policy (), - ACE_DLL_UNLOAD_POLICY_LAZY); - else - unload = ACE_BIT_DISABLED (this->unload_policy_, - ACE_DLL_UNLOAD_POLICY_LAZY); - } - } - - if (dll_handle->close (unload) != 0) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Manager::unload error.\n"))); - - return -1; - } - } - else - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL_Manager::unload_dll called with ") - ACE_LIB_TEXT ("null pointer.\n"))); - - return -1; - } - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DLL_Manager.h b/ace/DLL_Manager.h deleted file mode 100644 index a19dd531d4c..00000000000 --- a/ace/DLL_Manager.h +++ /dev/null @@ -1,271 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file DLL_Manager.h - * - * $Id$ - * - * @author Don Hinton - */ -//============================================================================= - - -#ifndef ACE_DLL_MANAGER_H -#define ACE_DLL_MANAGER_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Auto_Ptr.h" -#include "ace/Containers_T.h" -#include "ace/SStringfwd.h" -#include "ace/os_include/os_dlfcn.h" - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -# include "ace/Thread_Mutex.h" -#endif /* ACE_MT_SAFE */ - -#define ACE_DEFAULT_DLL_MANAGER_SIZE 1024 - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_DLL_Handle - * - * @brief Provides an abstract interface for handling various DLL - * operations. - * - * This class is an wrapper over the various methods for utilizing - * a dynamically linked library (DLL), which is called a shared - * library on some platforms. It is refcounted and managed by - * ACE_DLL_Manager, so there will only be a single instance of this - * class for each dll loaded, no matter how many instances of ACE_DLL - * an application has open. Operations , , and - * have been implemented to help opening/closing and - * extracting symbol information from a DLL, respectively. - * - * Most of this class came from the original ACE_DLL class. - * ACE_DLL is now just an interface that passed all it's calls - * either directly or via ACE_DLL_Manager to this class for - * execution. - * - */ -class ACE_Export ACE_DLL_Handle -{ -public: - - /// Default construtor. - ACE_DLL_Handle (void); - - /// Destructor. - ~ACE_DLL_Handle (void); - - /// Returns the name of the shared library (without prefixes or suffixes). - const ACE_TCHAR *dll_name () const; - - /** - * This method opens and dynamically links @a dll_name. The default - * mode is , which loads identifier symbols but not the - * symbols for functions, which are loaded dynamically on-demand. - * Other supported modes include: , which performs all - * necessary relocations when @a dll_name is first loaded and - * , which makes symbols available for relocation - * processing of any other DLLs. Returns -1 on failure and 0 on - * success. - */ - int open (const ACE_TCHAR *dll_name, - int open_mode, - ACE_SHLIB_HANDLE handle); - - /// Call to close the DLL object. If unload = 0, it only decrements - /// the refcount, but if unload = 1, then it will actually unload - /// the library when the refcount == 0; - int close (int unload = 0); - - /// Return the current refcount. - sig_atomic_t refcount (void) const; - - /// If @a symbol_name is in the symbol table of the DLL a pointer to - /// the @a symbol_name is returned. Otherwise, returns 0. Set the - /// ignore_errors flag to supress logging errors if symbol_name isn't - /// found. This is nice if you just want to probe a dll to see what's - /// available, since missing functions in that case aren't really errors. - void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0); - - /** - * Return the handle to the caller. If @a become_owner is non-0 then - * caller assumes ownership of the handle so we decrement the retcount. - */ - ACE_SHLIB_HANDLE get_handle (int become_owner = 0); - -private: - - /// Returns a pointer to a string explaining why or - /// failed. This is used internal to print out the error to the log, - /// but since this object is shared, we can't store or return the error - /// to the caller. - auto_ptr error (void); - - // Builds array of DLL names to try to dlopen, based on platform - // and configured DLL prefixes/suffixes. - // Returns the array of names to try in try_names. - void get_dll_names (const ACE_TCHAR *dll_name, - ACE_Array &try_names); - - // Disallow copying and assignment since we don't handle them. - ACE_DLL_Handle (const ACE_DLL_Handle &); - void operator= (const ACE_DLL_Handle &); - -private: - - // Keep track of how many ACE_DLL objects have a reference to this - // dll. - sig_atomic_t refcount_; - - /// Name of the shared library. - ACE_TCHAR *dll_name_; - - /// Handle to the actual library loaded by the OS. - ACE_SHLIB_HANDLE handle_; - - /// Keeps track of whether or not open() has ever been called. This - /// helps get around problem on Linux, and perhaps other OS's, that - /// seg-fault if dlerror() is called before the ld library has been - /// initialized by a call to dlopen(). - static sig_atomic_t open_called_; - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - /// Synchronization variable for the MT_SAFE Repository - ACE_Thread_Mutex lock_; -#endif /* ACE_MT_SAFE */ -}; - -class ACE_Framework_Repository; - -/** - * @class ACE_DLL_Manager - * - * @brief This class is a singleton and serves as a factory and - * repository for instances of ACE_DLL_Handle. - * - * This class is a singleton whose lifetime is managed by the - * ACE_Framework_Repository. Although it is normally meant to be - * used directly only by ACE_DLL, applications can call the unload_policy() - * methods in order get/set the the dll unload policy. Unload policies include - * per_process/per-dll and eager/lazy. Dlls can export set their own policy - * by using the ACE_DLL_UNLOAD_POLICY macro found in config-all.h. If a dll - * choses to set an unload policy, it will be used when the per-dll policy - * (the default) is in effect. If the per-dll policy is in effect and a dll - * has not chosen to set a policy, the current per-process policy will be - * used. - * - * The following policy macros are provided in config-all.h: - * - * ACE_DLL_UNLOAD_POLICY_PER_PROCESS - Per-process policy that unloads dlls - * eagerly. - * - * ACE_DLL_UNLOAD_POLICY_PER_DLL - Apply policy on a per-dll basis. If the - * dll doesn't use one of the macros below, the current per-process policy - * will be used. - * - * ACE_DLL_UNLOAD_POLICY_LAZY - Don't unload dll when refcount reaches - * zero, i.e., wait for either an explicit unload request or program exit. - * - * ACE_DLL_UNLOAD_POLICY_DEFAULT - Default policy allows dlls to control - * their own destinies, but will unload those that don't make a choice eagerly. - * - */ -class ACE_Export ACE_DLL_Manager -{ -public: - friend class ACE_Framework_Repository; - friend class ACE_Object_Manager; - - enum - { - DEFAULT_SIZE = ACE_DEFAULT_DLL_MANAGER_SIZE - }; - - /// Return a unique instance - static ACE_DLL_Manager *instance (int size = ACE_DLL_Manager::DEFAULT_SIZE); - - /// Factory for ACE_DLL_Handle objects. If one already exits, - /// its refcount is incremented. - ACE_DLL_Handle *open_dll (const ACE_TCHAR *dll_name, - int openmode, - ACE_SHLIB_HANDLE handle); - - /// Close the underlying dll. Decrements the refcount. - int close_dll (const ACE_TCHAR *dll_name); - - /// Returns the current per-process UNLOAD_POLICY. - u_long unload_policy (void) const; - - /// Set the per-process UNLOAD_POLICY. If the policy is changed from - /// LAZY to EAGER, then it will also unload any dlls with zero - /// refcounts. - void unload_policy (u_long unload_policy); - -protected: - - /// Default constructor. - ACE_DLL_Manager (int size = ACE_DLL_Manager::DEFAULT_SIZE); - - /// Destructor. - ~ACE_DLL_Manager (void); - - // Allocate handle_vector_. - int open (int size); - - // Close all open dlls and deallocate memory. - int close (void); - - // Find dll in handle_vector_. - ACE_DLL_Handle *find_dll (const ACE_TCHAR *dll_name) const; - - // Applies strategy for unloading dll. - int unload_dll (ACE_DLL_Handle *dll_handle, int force_unload = 0); - -private: - - /// Close the singleton instance. - static void close_singleton (void); - - // Disallow copying and assignment since we don't handle these. - ACE_DLL_Manager (const ACE_DLL_Manager &); - void operator= (const ACE_DLL_Manager &); - -private: - - /// Vector containing all loaded handle objects. - ACE_DLL_Handle **handle_vector_; - - /// Current number of handles. - int current_size_; - - /// Maximum number of handles. - int total_size_; - - /// Unload strategy. - u_long unload_policy_; - - /// Pointer to a process-wide . - static ACE_DLL_Manager *instance_; - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - /// Synchronization variable for the MT_SAFE Repository - ACE_Thread_Mutex lock_; -#endif /* ACE_MT_SAFE */ - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_DLL_MANAGER_H */ diff --git a/ace/Date_Time.cpp b/ace/Date_Time.cpp deleted file mode 100644 index 85abf562c47..00000000000 --- a/ace/Date_Time.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// Date_Time.cpp -// $Id$ - -#include "ace/Date_Time.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Date_Time.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, Date_Time, "$Id$") diff --git a/ace/Date_Time.h b/ace/Date_Time.h deleted file mode 100644 index 7efd047cafd..00000000000 --- a/ace/Date_Time.h +++ /dev/null @@ -1,125 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Date_Time.h - * - * $Id$ - * - * @author Tim Harrison (harrison@cs.wustl.edu) (and he's darn proud of this ;-)) - * - */ -//========================================================================== - -#ifndef ACE_DATE_TIME_H -#define ACE_DATE_TIME_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_Date_Time - * - * @brief System independent representation of date and time. - */ -class ACE_Export ACE_Date_Time -{ -public: - /// Constructor initializes current time/date info. - ACE_Date_Time (void); - - /// Constructor initializes with the given ACE_Time_Value - explicit ACE_Date_Time (const ACE_Time_Value& timevalue); - - /// Constructor with init values, no check for validy - /// Set/get portions of ACE_Date_Time, no check for validity. - ACE_Date_Time (long day, - long month = 0, - long year = 0, - long hour = 0, - long minute = 0, - long second = 0, - long microsec = 0, - long wday = 0); - - /// Update to the current time/date. - void update (void); - - /// Update to the given ACE_Time_Value - void update (const ACE_Time_Value& timevalue); - - /// Get day. - long day (void) const; - - /// Set day. - void day (long day); - - /// Get month. - long month (void) const; - - /// Set month. - void month (long month); - - /// Get year. - long year (void) const; - - /// Set year. - void year (long year); - - /// Get hour. - long hour (void) const; - - /// Set hour. - void hour (long hour); - - /// Get minute. - long minute (void) const; - - /// Set minute. - void minute (long minute); - - /// Get second. - long second (void) const; - - /// Set second. - void second (long second); - - /// Get microsec. - long microsec (void) const; - - /// Set microsec. - void microsec (long microsec); - - /// Get weekday. - long weekday (void) const; - - /// Set weekday. - void weekday (long wday); - -private: - long day_; - long month_; - long year_; - long hour_; - long minute_; - long second_; - long microsec_; - long wday_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Date_Time.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DATE_TIME_H */ diff --git a/ace/Date_Time.inl b/ace/Date_Time.inl deleted file mode 100644 index dfb0d239bc3..00000000000 --- a/ace/Date_Time.inl +++ /dev/null @@ -1,219 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Global_Macros.h" -#include "ace/Time_Value.h" -#include "ace/OS_NS_sys_time.h" -#include "ace/OS_NS_time.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_Date_Time::update (const ACE_Time_Value& timevalue) -{ -#if defined (ACE_HAS_WINCE) - // CE doesn't do localtime(). - FILETIME file_time = timevalue; - FILETIME local_file_time; - SYSTEMTIME sys_time; - ::FileTimeToLocalFileTime (&file_time, &local_file_time); - ::FileTimeToSystemTime (&local_file_time, &sys_time); - this->day_ = sys_time.wDay; - this->month_ = sys_time.wMonth; - this->year_ = sys_time.wYear; - this->hour_ = sys_time.wHour; - this->minute_ = sys_time.wMinute; - this->second_ = sys_time.wSecond; - this->microsec_ = sys_time.wMilliseconds * 1000; - this->wday_ = sys_time.wDayOfWeek; -#else - time_t time = timevalue.sec (); - struct tm tm_time; - ACE_OS::localtime_r (&time, &tm_time); - this->day_ = tm_time.tm_mday; - this->month_ = tm_time.tm_mon + 1; // localtime's months are 0-11 - this->year_ = tm_time.tm_year + 1900; // localtime reports years since 1900 - this->hour_ = tm_time.tm_hour; - this->minute_ = tm_time.tm_min; - this->second_ = tm_time.tm_sec; - this->microsec_ = timevalue.usec (); - this->wday_ = tm_time.tm_wday; -#endif /* ACE_HAS_WINCE */ -} - -ACE_INLINE void -ACE_Date_Time::update (void) -{ - ACE_TRACE ("ACE_Date_Time::update"); - - update(ACE_OS::gettimeofday ()); -} - -ACE_INLINE -ACE_Date_Time::ACE_Date_Time (void) -{ - ACE_TRACE ("ACE_Date_Time::ACE_Date_Time"); - this->update (); -} - -ACE_INLINE -ACE_Date_Time::ACE_Date_Time (const ACE_Time_Value& timevalue) -{ - ACE_TRACE ("ACE_Date_Time::ACE_Date_Time: timevalue"); - this->update (timevalue); -} - -// Constructor with init values, no check for validy -ACE_INLINE -ACE_Date_Time::ACE_Date_Time (long day, - long month, - long year, - long hour, - long minute, - long second, - long microsec, - long wday) - : day_ (day), - month_ (month), - year_ (year), - hour_ (hour), - minute_ (minute), - second_ (second), - microsec_ (microsec), - wday_ (wday) -{ - ACE_TRACE ("ACE_Date_Time::ACE_Date_Time"); -} - -// set/get portions of ACE_Date_Time, no check for validy - -// get day -ACE_INLINE long -ACE_Date_Time::day (void) const -{ - ACE_TRACE ("ACE_Date_Time::day"); - return day_; -} - -// set day -ACE_INLINE void -ACE_Date_Time::day (long day) -{ - ACE_TRACE ("ACE_Date_Time::day"); - day_ = day; -} - -// get month -ACE_INLINE long -ACE_Date_Time::month (void) const -{ - ACE_TRACE ("ACE_Date_Time::month"); - return month_; -} - -// set month -ACE_INLINE void -ACE_Date_Time::month (long month) -{ - ACE_TRACE ("ACE_Date_Time::month"); - month_ = month; -} - -// get year -ACE_INLINE long -ACE_Date_Time::year (void) const -{ - ACE_TRACE ("ACE_Date_Time::year"); - return year_; -} - -// set year -ACE_INLINE void -ACE_Date_Time::year (long year) -{ - ACE_TRACE ("ACE_Date_Time::year"); - year_ = year; -} - -// get hour -ACE_INLINE long -ACE_Date_Time::hour (void) const -{ - ACE_TRACE ("ACE_Date_Time::hour"); - return hour_; -} - -// set hour -ACE_INLINE void -ACE_Date_Time::hour (long hour) -{ - ACE_TRACE ("ACE_Date_Time::hour"); - hour_ = hour; -} - -// get minute -ACE_INLINE long -ACE_Date_Time::minute (void) const -{ - ACE_TRACE ("ACE_Date_Time::minute"); - return minute_; -} - -// set minute -ACE_INLINE void -ACE_Date_Time::minute (long minute) -{ - ACE_TRACE ("ACE_Date_Time::minute"); - minute_ = minute; -} - -// get second -ACE_INLINE long -ACE_Date_Time::second (void) const -{ - ACE_TRACE ("ACE_Date_Time::second"); - return second_; -} - -// set second -ACE_INLINE void -ACE_Date_Time::second (long second) -{ - ACE_TRACE ("ACE_Date_Time::second"); - second_ = second; -} - -// get microsec -ACE_INLINE long -ACE_Date_Time::microsec (void) const -{ - ACE_TRACE ("ACE_Date_Time::microsec"); - return microsec_; -} - -// set microsec -ACE_INLINE void -ACE_Date_Time::microsec (long microsec) -{ - ACE_TRACE ("ACE_Date_Time::microsec"); - microsec_ = microsec; -} - -// get wday -ACE_INLINE long -ACE_Date_Time::weekday (void) const -{ - ACE_TRACE ("ACE_Date_Time::weekday"); - return wday_; -} - -// set wday -ACE_INLINE void -ACE_Date_Time::weekday (long wday) -{ - ACE_TRACE ("ACE_Date_Time::weekday"); - wday_ = wday; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Default_Constants.h b/ace/Default_Constants.h deleted file mode 100644 index aa4712e9a50..00000000000 --- a/ace/Default_Constants.h +++ /dev/null @@ -1,576 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Default_Constants.h - * - * $Id$ - * - * @author Douglas C. Schmidt - * @author Jesper S. M|ller - * @author and a cast of thousands... - * - * This one is split from the famous OS.h - */ -//============================================================================= - -#ifndef ACE_DEFAULT_CONSTANTS_H -#define ACE_DEFAULT_CONSTANTS_H -#include /**/ "ace/pre.h" - -// Included just keep compilers that see #pragma dierctive first -// happy. -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Define the default constants for ACE. Many of these are used for -// the ACE tests and applications. You can change these values by -// defining the macros in your config.h file. -# if !defined (ACE_DEFAULT_CLOSE_ALL_HANDLES) -# define ACE_DEFAULT_CLOSE_ALL_HANDLES 1 -# endif /* ACE_DEFAULT_CLOSE_ALL_HANDLES */ - -// The maximum length for a fully qualified Internet name. -# if !defined(ACE_MAX_FULLY_QUALIFIED_NAME_LEN) -# define ACE_MAX_FULLY_QUALIFIED_NAME_LEN 256 -# endif /* ACE_MAX_FULLY_QUALIFIED_NAME_LEN */ - -#if !defined (ACE_DEFAULT_PAGEFILE_POOL_BASE) -#define ACE_DEFAULT_PAGEFILE_POOL_BASE (void *) 0 -#endif /* ACE_DEFAULT_PAGEFILE_POOL_BASE */ - -#if !defined (ACE_DEFAULT_PAGEFILE_POOL_SIZE) -#define ACE_DEFAULT_PAGEFILE_POOL_SIZE (size_t) 0x01000000 -#endif /* ACE_DEFAULT_PAGEFILE_POOL_SIZE */ - -#if !defined (ACE_DEFAULT_PAGEFILE_POOL_CHUNK) -#define ACE_DEFAULT_PAGEFILE_POOL_CHUNK (size_t) 0x00010000 -#endif /* ACE_DEFAULT_PAGEFILE_POOL_CHUNK */ - -#if !defined (ACE_DEFAULT_PAGEFILE_POOL_NAME) -#define ACE_DEFAULT_PAGEFILE_POOL_NAME ACE_LIB_TEXT ("Default_ACE_Pagefile_Memory_Pool") -#endif /* ACE_DEFAULT_PAGEFILE_POOL_NAME */ - -#if !defined (ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY) -#define ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY 0 -#endif /* ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY */ - -#if !defined (ACE_DEFAULT_SERVICE_REPOSITORY_SIZE) -#define ACE_DEFAULT_SERVICE_REPOSITORY_SIZE 1024 -#endif /* ACE_DEFAULT_SERVICE_REPOSITORY_SIZE */ - -#if !defined (ACE_REACTOR_NOTIFICATION_ARRAY_SIZE) -#define ACE_REACTOR_NOTIFICATION_ARRAY_SIZE 1024 -#endif /* ACE_REACTOR_NOTIFICATION_ARRAY_SIZE */ - -# if !defined (ACE_DEFAULT_TIMEOUT) -# define ACE_DEFAULT_TIMEOUT 5 -# endif /* ACE_DEFAULT_TIMEOUT */ - -# if !defined (ACE_DEFAULT_BACKLOG) -# define ACE_DEFAULT_BACKLOG 5 -# endif /* ACE_DEFAULT_BACKLOG */ - -# if !defined (ACE_DEFAULT_ASYNCH_BACKLOG) -# define ACE_DEFAULT_ASYNCH_BACKLOG 5 -# endif /* ACE_DEFAULT_ASYNCH_BACKLOG */ - -# if !defined (ACE_DEFAULT_THREADS) -# define ACE_DEFAULT_THREADS 1 -# endif /* ACE_DEFAULT_THREADS */ - -// The following 3 defines are used in the IP multicast and broadcast tests. -# if !defined (ACE_DEFAULT_BROADCAST_PORT) -# define ACE_DEFAULT_BROADCAST_PORT 20000 -# endif /* ACE_DEFAULT_BROADCAST_PORT */ - -# if !defined (ACE_DEFAULT_MULTICAST_PORT) -# define ACE_DEFAULT_MULTICAST_PORT 20001 -# endif /* ACE_DEFAULT_MULTICAST_PORT */ - -# if !defined (ACE_DEFAULT_MULTICAST_ADDR) -// This address MUST be within the range for host group addresses: -// 224.0.0.0 to 239.255.255.255. -# define ACE_DEFAULT_MULTICAST_ADDR "224.9.9.2" -# endif /* ACE_DEFAULT_MULTICAST_ADDR */ - -# if defined (ACE_HAS_IPV6) -# if !defined (ACE_DEFAULT_MULTICASTV6_ADDR) -// This address should be within the range for site-local addresses: -// ff05::0/16 . -# define ACE_DEFAULT_MULTICASTV6_ADDR "ff05:0::ff01:1" -# endif /* ACE_DEFAULT_MULTICASTV6_ADDR */ -# endif - -// Default port number for HTTP. -# if !defined (ACE_DEFAULT_HTTP_SERVER_PORT) -# define ACE_DEFAULT_HTTP_SERVER_PORT 80 -# endif /* ACE_DEFAULT_HTTP_SERVER_PORT */ - -// Used in many IPC_SAP tests -# if !defined (ACE_DEFAULT_SERVER_PORT) -# define ACE_DEFAULT_SERVER_PORT 20002 -# endif /* ACE_DEFAULT_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_HTTP_PORT) -# define ACE_DEFAULT_HTTP_PORT 80 -# endif /* ACE_DEFAULT_HTTP_PORT */ - -# if !defined (ACE_DEFAULT_MAX_SOCKET_BUFSIZ) -# define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65536 -# endif /* ACE_DEFAULT_MAX_SOCKET_BUFSIZ */ - -# if !defined (ACE_DEFAULT_SERVER_PORT_STR) -# define ACE_DEFAULT_SERVER_PORT_STR ACE_LIB_TEXT("20002") -# endif /* ACE_DEFAULT_SERVER_PORT_STR */ - -// Used for the Service_Directory test -# if !defined (ACE_DEFAULT_SERVICE_PORT) -# define ACE_DEFAULT_SERVICE_PORT 20003 -# endif /* ACE_DEFAULT_SERVICE_PORT */ - -// Used for the ACE_Thread_Spawn test -# if !defined (ACE_DEFAULT_THR_PORT ) -# define ACE_DEFAULT_THR_PORT 20004 -# endif /* ACE_DEFAULT_THR_PORT */ - -// Used for tests -# if !defined (ACE_DEFAULT_LOCAL_PORT) -# define ACE_DEFAULT_LOCAL_PORT 20005 -# endif /* ACE_DEFAULT_LOCAL_PORT */ - -// Used for Connector tests -# if !defined (ACE_DEFAULT_LOCAL_PORT_STR) -# define ACE_DEFAULT_LOCAL_PORT_STR "20005" -# endif /* ACE_DEFAULT_LOCAL_PORT_STR */ - -// Used for the name server. -# if !defined (ACE_DEFAULT_NAME_SERVER_PORT) -# define ACE_DEFAULT_NAME_SERVER_PORT 20006 -# endif /* ACE_DEFAULT_NAME_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_NAME_SERVER_PORT_STR) -# define ACE_DEFAULT_NAME_SERVER_PORT_STR "20006" -# endif /* ACE_DEFAULT_NAME_SERVER_PORT_STR */ - -// Used for the token server. -# if !defined (ACE_DEFAULT_TOKEN_SERVER_PORT) -# define ACE_DEFAULT_TOKEN_SERVER_PORT 20007 -# endif /* ACE_DEFAULT_TOKEN_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_TOKEN_SERVER_PORT_STR) -# define ACE_DEFAULT_TOKEN_SERVER_PORT_STR "20007" -# endif /* ACE_DEFAULT_TOKEN_SERVER_PORT_STR */ - -// Used for the logging server. -# if !defined (ACE_DEFAULT_LOGGING_SERVER_PORT) -# define ACE_DEFAULT_LOGGING_SERVER_PORT 20008 -# endif /* ACE_DEFAULT_LOGGING_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_LOGGING_SERVER_PORT_STR) -# define ACE_DEFAULT_LOGGING_SERVER_PORT_STR "20008" -# endif /* ACE_DEFAULT_LOGGING_SERVER_PORT_STR */ - -// Used for the logging server. -# if !defined (ACE_DEFAULT_THR_LOGGING_SERVER_PORT) -# define ACE_DEFAULT_THR_LOGGING_SERVER_PORT 20008 -# endif /* ACE_DEFAULT_THR_LOGGING_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR) -# define ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR "20008" -# endif /* ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR */ - -// Used for the time server. -# if !defined (ACE_DEFAULT_TIME_SERVER_PORT) -# define ACE_DEFAULT_TIME_SERVER_PORT 20009 -# endif /* ACE_DEFAULT_TIME_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_TIME_SERVER_PORT_STR) -# define ACE_DEFAULT_TIME_SERVER_PORT_STR "20009" -# endif /* ACE_DEFAULT_TIME_SERVER_PORT_STR */ - -# if !defined (ACE_DEFAULT_TIME_SERVER_STR) -# define ACE_DEFAULT_TIME_SERVER_STR "ACE_TS_TIME" -# endif /* ACE_DEFAULT_TIME_SERVER_STR */ - -// Used by the FIFO tests and the Client_Logging_Handler netsvc. -# if !defined (ACE_DEFAULT_RENDEZVOUS) -# if defined (ACE_HAS_STREAM_PIPES) -# define ACE_DEFAULT_RENDEZVOUS ACE_LIB_TEXT("/tmp/fifo.ace") -# else -# define ACE_DEFAULT_RENDEZVOUS ACE_LIB_TEXT("localhost:20010") -# endif /* ACE_HAS_STREAM_PIPES */ -# endif /* ACE_DEFAULT_RENDEZVOUS */ - -// Used for the UNIX syslog logging interface to ACE_Log_Msg. -# ifndef ACE_DEFAULT_SYSLOG_FACILITY -# define ACE_DEFAULT_SYSLOG_FACILITY LOG_USER -# endif /* ACE_DEFAULT_SYSLOG_FACILITY */ - -# if !defined (ACE_DEFAULT_LOGGER_KEY) - -# if defined (ACE_HAS_STREAM_PIPES) -# define ACE_DEFAULT_LOGGER_KEY ACE_LIB_TEXT ("/tmp/server_daemon") -# else -# define ACE_DEFAULT_LOGGER_KEY ACE_LIB_TEXT ("localhost:20012") -# endif /* ACE_HAS_STREAM_PIPES */ -# endif /* ACE_DEFAULT_LOGGER_KEY */ - -// The way to specify the local host for loopback IP. This is usually -// "localhost" but it may need changing on some platforms. -# if !defined (ACE_LOCALHOST) -# define ACE_LOCALHOST ACE_LIB_TEXT ("localhost") -# endif - -// This specification for an IPv6 localhost should work on all platforms -// supporting IPv6 -# if defined (ACE_HAS_IPV6) -# if !defined (ACE_IPV6_LOCALHOST) -# define ACE_IPV6_LOCALHOST ACE_LIB_TEXT ("::1") -# endif /* ACE_IPV6_LOCALHOST*/ -#endif /* ACE_HAS_IPV6 */ - -// This specification for an IPv6 ANY address should work on all platforms -// supporting IPv6 -# if defined (ACE_HAS_IPV6) -# if !defined (ACE_IPV6_ANY) -# define ACE_IPV6_ANY ACE_LIB_TEXT ("::") -# endif /* ACE_IPV6_ANY*/ -#endif /* ACE_HAS_IPV6 */ - -# if !defined (ACE_DEFAULT_SERVER_HOST) -# if defined (ACE_HAS_IPV6) -# define ACE_DEFAULT_SERVER_HOST ACE_IPV6_LOCALHOST -# else /*ACE_HAS_IPV6*/ -# define ACE_DEFAULT_SERVER_HOST ACE_LOCALHOST -# endif /*ACE_HAS_IPV6*/ -# endif /* ACE_DEFAULT_SERVER_HOST */ - -// Default shared memory key -# if !defined (ACE_DEFAULT_SHM_KEY) -# define ACE_DEFAULT_SHM_KEY 1234 -# endif /* ACE_DEFAULT_SHM_KEY */ - -// Default address for shared memory mapped files and SYSV shared memory -// (defaults to 64 M). -# if !defined (ACE_DEFAULT_BASE_ADDR) -# define ACE_DEFAULT_BASE_ADDR ((char *) (64 * 1024 * 1024)) -# endif /* ACE_DEFAULT_BASE_ADDR */ - -// Default segment size used by SYSV shared memory (128 K) -# if !defined (ACE_DEFAULT_SEGMENT_SIZE) -# define ACE_DEFAULT_SEGMENT_SIZE 1024 * 128 -# endif /* ACE_DEFAULT_SEGMENT_SIZE */ - -// Maximum number of SYSV shared memory segments -// (does anyone know how to figure out the right values?!) -# if !defined (ACE_DEFAULT_MAX_SEGMENTS) -# define ACE_DEFAULT_MAX_SEGMENTS 6 -# endif /* ACE_DEFAULT_MAX_SEGMENTS */ - -// Name of the map that's stored in shared memory. -# if !defined (ACE_NAME_SERVER_MAP) -# define ACE_NAME_SERVER_MAP "Name Server Map" -# endif /* ACE_NAME_SERVER_MAP */ - -// Default file permissions. -# if !defined (ACE_DEFAULT_FILE_PERMS) -# if defined (ACE_WIN32) -# if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 == 1) -# define ACE_DEFAULT_FILE_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE | \ - FILE_SHARE_DELETE) -# else -# define ACE_DEFAULT_FILE_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE) -# endif /* ACE_HAS_WINNT4 */ -# elif defined (ACE_VXWORKS) -# define ACE_DEFAULT_FILE_PERMS (S_IRUSR | S_IWUSR| S_IRGRP| S_IROTH) -# else -# define ACE_DEFAULT_FILE_PERMS 0644 -# endif /* ACE_WIN32 */ -# endif /* ACE_DEFAULT_FILE_PERMS */ - -// Default directory permissions. -# if !defined (ACE_DEFAULT_DIR_PERMS) -# define ACE_DEFAULT_DIR_PERMS 0755 -# endif /* ACE_DEFAULT_DIR_PERMS */ - -# if !defined (ACE_DEFAULT_TIMEPROBE_TABLE_SIZE) -# define ACE_DEFAULT_TIMEPROBE_TABLE_SIZE 8 * 1024 -# endif /* ACE_DEFAULT_TIMEPROBE_TABLE_SIZE */ - -// Default size of the ACE Map_Manager. -# if !defined (ACE_DEFAULT_MAP_SIZE) -# define ACE_DEFAULT_MAP_SIZE 1024 -# endif /* ACE_DEFAULT_MAP_SIZE */ - -// Defaults for ACE Timer Wheel -# if !defined (ACE_DEFAULT_TIMER_WHEEL_SIZE) -# define ACE_DEFAULT_TIMER_WHEEL_SIZE 1024 -# endif /* ACE_DEFAULT_TIMER_WHEEL_SIZE */ - -# if !defined (ACE_DEFAULT_TIMER_WHEEL_RESOLUTION) -# define ACE_DEFAULT_TIMER_WHEEL_RESOLUTION 100 -# endif /* ACE_DEFAULT_TIMER_WHEEL_RESOLUTION */ - -// Default size for ACE Timer Hash table -# if !defined (ACE_DEFAULT_TIMER_HASH_TABLE_SIZE) -# define ACE_DEFAULT_TIMER_HASH_TABLE_SIZE 1024 -# endif /* ACE_DEFAULT_TIMER_HASH_TABLE_SIZE */ - -// Defaults for the ACE Free List -# if !defined (ACE_DEFAULT_FREE_LIST_PREALLOC) -# define ACE_DEFAULT_FREE_LIST_PREALLOC 0 -# endif /* ACE_DEFAULT_FREE_LIST_PREALLOC */ - -# if !defined (ACE_DEFAULT_FREE_LIST_LWM) -# define ACE_DEFAULT_FREE_LIST_LWM 0 -# endif /* ACE_DEFAULT_FREE_LIST_LWM */ - -# if !defined (ACE_DEFAULT_FREE_LIST_HWM) -# define ACE_DEFAULT_FREE_LIST_HWM 25000 -# endif /* ACE_DEFAULT_FREE_LIST_HWM */ - -# if !defined (ACE_DEFAULT_FREE_LIST_INC) -# define ACE_DEFAULT_FREE_LIST_INC 100 -# endif /* ACE_DEFAULT_FREE_LIST_INC */ - -# if !defined (ACE_UNIQUE_NAME_LEN) -# define ACE_UNIQUE_NAME_LEN 100 -# endif /* ACE_UNIQUE_NAME_LEN */ - -# if !defined (ACE_MAX_DGRAM_SIZE) - // This is just a guess. 8k is the normal limit on - // most machines because that's what NFS expects. -# define ACE_MAX_DGRAM_SIZE 8192 -# endif /* ACE_MAX_DGRAM_SIZE */ - -# if !defined (ACE_DEFAULT_ARGV_BUFSIZ) -# define ACE_DEFAULT_ARGV_BUFSIZ 1024 * 4 -# endif /* ACE_DEFAULT_ARGV_BUFSIZ */ - -// A free list which create more elements when there aren't enough -// elements. -# define ACE_FREE_LIST_WITH_POOL 1 - -// A simple free list which doen't allocate/deallocate elements. -# define ACE_PURE_FREE_LIST 2 - -# if defined (ACE_WIN32) - -// This is necessary to work around bugs with Win32 non-blocking -// connects... -# if !defined (ACE_NON_BLOCKING_BUG_DELAY) -# define ACE_NON_BLOCKING_BUG_DELAY 35000 -# endif /* ACE_NON_BLOCKING_BUG_DELAY */ -# endif /*ACE_WIN32*/ - -// Max size of an ACE Log Record data buffer. This can be reset in -// the config.h file if you'd like to increase or decrease the size. -# if !defined (ACE_MAXLOGMSGLEN) -# define ACE_MAXLOGMSGLEN 4 * 1024 -# endif /* ACE_MAXLOGMSGLEN */ - -// Max size of an ACE Token. -# define ACE_MAXTOKENNAMELEN 40 - -// Max size of an ACE Token client ID. -# define ACE_MAXCLIENTIDLEN MAXHOSTNAMELEN + 20 - -/// Max udp packet size -#if !defined (ACE_MAX_UDP_PACKET_SIZE) -#define ACE_MAX_UDP_PACKET_SIZE 65536 -#endif - -/** - * @name Default values to control CDR classes memory allocation strategies - */ -//@{ - -/// Control the initial size of all CDR buffers, application -/// developers may want to optimize this value to fit their request -/// size -#if !defined (ACE_DEFAULT_CDR_BUFSIZE) -# define ACE_DEFAULT_CDR_BUFSIZE 512 -#endif /* ACE_DEFAULT_CDR_BUFSIZE */ - -#if (ACE_DEFAULT_CDR_BUFSIZE == 0) -# error: ACE_DEFAULT_CDR_BUFSIZE should be bigger then 0 -#endif - -/// Stop exponential growth of CDR buffers to avoid overallocation -#if !defined (ACE_DEFAULT_CDR_EXP_GROWTH_MAX) -# define ACE_DEFAULT_CDR_EXP_GROWTH_MAX 65536 -#endif /* ACE_DEFAULT_CDR_EXP_GROWTH_MAX */ - -/// Control CDR buffer growth after maximum exponential growth is -/// reached -#if !defined (ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK) -# define ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK 65536 -#endif /* ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK */ -//@} - -/// Control the zero-copy optimizations for octet sequences -/** - * Large octet sequences can be sent without any copies by chaining - * them in the list of message blocks that represent a single CDR - * stream. However, if the octet sequence is too small the zero copy - * optimizations actually hurt performance. Octet sequences smaller - * than this value will be copied. - */ -#if !defined (ACE_DEFAULT_CDR_MEMCPY_TRADEOFF) -#define ACE_DEFAULT_CDR_MEMCPY_TRADEOFF 256 -#endif /* ACE_DEFAULT_CDR_MEMCPY_TRADEOFF */ - -#if defined (ACE_WIN32) - // Define the pathname separator characters for Win32 (ugh). -# define ACE_DIRECTORY_SEPARATOR_STR_A "\\" -# define ACE_DIRECTORY_SEPARATOR_CHAR_A '\\' -#else - // Define the pathname separator characters for UNIX. -# define ACE_DIRECTORY_SEPARATOR_STR_A "/" -# define ACE_DIRECTORY_SEPARATOR_CHAR_A '/' -#endif /* ACE_WIN32 */ - -// Define the Wide character and normal versions of some of the string macros -#if defined (ACE_HAS_WCHAR) -# define ACE_DIRECTORY_SEPARATOR_STR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_STR_A) -# define ACE_DIRECTORY_SEPARATOR_CHAR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_CHAR_A) -#endif /* ACE_HAS_WCHAR */ - -#define ACE_DIRECTORY_SEPARATOR_STR ACE_LIB_TEXT (ACE_DIRECTORY_SEPARATOR_STR_A) -#define ACE_DIRECTORY_SEPARATOR_CHAR ACE_LIB_TEXT (ACE_DIRECTORY_SEPARATOR_CHAR_A) - -#if !defined (ACE_DEFAULT_THREAD_PRIORITY) -# define ACE_DEFAULT_THREAD_PRIORITY (-0x7fffffffL - 1L) -#endif /* ACE_DEFAULT_THREAD_PRIORITY */ - -#if !defined (ACE_MAX_DEFAULT_PORT) -# define ACE_MAX_DEFAULT_PORT 65535 -#endif /* ACE_MAX_DEFAULT_PORT */ - -// Default number of ACE_Event_Handlers supported by -// ACE_Timer_Heap. -# if !defined (ACE_DEFAULT_TIMERS) -# define ACE_DEFAULT_TIMERS _POSIX_TIMER_MAX -# endif /* ACE_DEFAULT_TIMERS */ - -#if defined (ACE_WIN32) -# define ACE_PLATFORM_A "Win32" -# define ACE_PLATFORM_EXE_SUFFIX_A ".exe" -#elif defined (ACE_VXWORKS) -# define ACE_PLATFORM_A "VxWorks" -# if defined (__RTP__) -# define ACE_PLATFORM_EXE_SUFFIX_A ".vxe" -# else -# define ACE_PLATFORM_EXE_SUFFIX_A ".out" -# endif -#else /* !ACE_WIN32 && !ACE_VXWORKS */ -# define ACE_PLATFORM_A "UNIX" -# define ACE_PLATFORM_EXE_SUFFIX_A "" -#endif /* ACE_WIN32 */ - -// Define the Wide character and normal versions of some of the string macros -#if defined (ACE_HAS_WCHAR) -# define ACE_PLATFORM_W ACE_TEXT_WIDE(ACE_PLATFORM_A) -# define ACE_PLATFORM_EXE_SUFFIX_W ACE_TEXT_WIDE(ACE_PLATFORM_EXE_SUFFIX_A) -#endif /* ACE_HAS_WCHAR */ - -#define ACE_PLATFORM ACE_LIB_TEXT (ACE_PLATFORM_A) -#define ACE_PLATFORM_EXE_SUFFIX ACE_LIB_TEXT (ACE_PLATFORM_EXE_SUFFIX_A) - -#if defined (ACE_WIN32) -# define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("PATH") -# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_LIB_TEXT (";") -# define ACE_DLL_SUFFIX ACE_LIB_TEXT (".dll") -# if defined (__MINGW32__) -# define ACE_DLL_PREFIX ACE_LIB_TEXT ("lib") -# else /* __MINGW32__ */ -# define ACE_DLL_PREFIX ACE_LIB_TEXT ("") -# endif /* __MINGW32__ */ -#else /* !ACE_WIN32 */ -# if !defined (ACE_LD_SEARCH_PATH) -# define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("LD_LIBRARY_PATH") -# endif /* ACE_LD_SEARCH_PATH */ -# if !defined (ACE_LD_SEARCH_PATH_SEPARATOR_STR) -# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_LIB_TEXT (":") -# endif /* ACE_LD_SEARCH_PATH_SEPARATOR_STR */ -#endif /* ACE_WIN32 */ - -#if !defined (ACE_DLL_SUFFIX) -# define ACE_DLL_SUFFIX ACE_LIB_TEXT (".so") -#endif /* ACE_DLL_SUFFIX */ - -#if !defined (ACE_DLL_PREFIX) -# define ACE_DLL_PREFIX ACE_LIB_TEXT ("lib") -#endif /* ACE_DLL_PREFIX */ - -#if defined (ACE_WIN32) -// Used for dynamic linking -# if !defined (ACE_DEFAULT_SVC_CONF) -# if (ACE_USES_CLASSIC_SVC_CONF == 1) -# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf") -# else -# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf.xml") -# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ -# endif /* ACE_DEFAULT_SVC_CONF */ -#endif /* ACE_WIN32 */ - - // Used for dynamic linking. -#if !defined (ACE_DEFAULT_SVC_CONF) -# if (ACE_USES_CLASSIC_SVC_CONF == 1) -# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf") -# else -# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf.xml") -# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ -#endif /* ACE_DEFAULT_SVC_CONF */ - -#if !defined (ACE_LOGGER_KEY) -# define ACE_LOGGER_KEY ACE_LIB_TEXT ("/tmp/server_daemon") -#endif /* ACE_LOGGER_KEY */ - -// Theses defines are used by the ACE Name Server. -#if !defined (ACE_DEFAULT_LOCALNAME_A) -# define ACE_DEFAULT_LOCALNAME_A "localnames" -#endif /* ACE_DEFAULT_LOCALNAME_A */ -#if !defined (ACE_DEFAULT_GLOBALNAME_A) -# define ACE_DEFAULT_GLOBALNAME_A "globalnames" -#endif /* ACE_DEFAULT_GLOBALNAME_A */ - -// ACE_DEFAULT_NAMESPACE_DIR is for legacy mode apps. A better -// way of doing this is something like ACE_Lib_Find::get_temp_dir, since -// this directory may not exist -#if defined (ACE_LEGACY_MODE) -# if defined (ACE_WIN32) -# define ACE_DEFAULT_NAMESPACE_DIR_A "C:\\temp" -# else /* ACE_WIN32 */ -# define ACE_DEFAULT_NAMESPACE_DIR_A "/tmp" -# endif /* ACE_WIN32 */ -# if defined (ACE_HAS_WCHAR) -# define ACE_DEFAULT_NAMESPACE_DIR_W ACE_TEXT_WIDE(ACE_DEFAULT_NAMESPACE_DIR_A) -# endif /* ACE_HAS_WCHAR */ -# define ACE_DEFAULT_NAMESPACE_DIR ACE_LIB_TEXT(ACE_DEFAULT_NAMESPACE_DIR_A) -#endif /* ACE_LEGACY_MODE */ - -#if defined (ACE_HAS_WCHAR) -# define ACE_DEFAULT_LOCALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_LOCALNAME_A) -# define ACE_DEFAULT_GLOBALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_GLOBALNAME_A) -#endif /* ACE_HAS_WCHAR */ - -#define ACE_DEFAULT_LOCALNAME ACE_LIB_TEXT (ACE_DEFAULT_LOCALNAME_A) -#define ACE_DEFAULT_GLOBALNAME ACE_LIB_TEXT (ACE_DEFAULT_GLOBALNAME_A) - -# if defined (ACE_WIN32) - // The "null" device on Win32. -# define ACE_DEV_NULL "nul" -# define ACE_SYSCALL_FAILED 0xFFFFFFFF -# else /* !ACE_WIN32 */ - // The "null" device on UNIX. -# define ACE_DEV_NULL "/dev/null" -# define ACE_SYSCALL_FAILED -1 -# endif /* ACE_WIN32 */ - -#include /**/ "ace/post.h" -#endif /*ACE_DEFAULT_CONSTANTS_H*/ diff --git a/ace/Dev_Poll_Reactor.cpp b/ace/Dev_Poll_Reactor.cpp deleted file mode 100644 index d676a3c5df7..00000000000 --- a/ace/Dev_Poll_Reactor.cpp +++ /dev/null @@ -1,2652 +0,0 @@ -// $Id$ - -#include "ace/OS_NS_errno.h" -#include "ace/Dev_Poll_Reactor.h" -#include "ace/Signal.h" -#include "ace/Sig_Handler.h" - -ACE_RCSID (ace, - Dev_Poll_Reactor, - "$Id$") - -#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) - -# include "ace/OS_NS_unistd.h" -# include "ace/OS_NS_fcntl.h" -# include "ace/OS_NS_stropts.h" - -# if defined (ACE_HAS_EVENT_POLL) && defined (linux) -# include /**/ -# elif defined (ACE_HAS_DEV_POLL) -# if defined (linux) -# include /**/ -# elif defined (HPUX_VERS) && HPUX_VERS < 1123 -# include /**/ -# else -# include /**/ -# endif /* linux */ -# endif /* ACE_HAS_DEV_POLL */ - -#if !defined (__ACE_INLINE__) -# include "ace/Dev_Poll_Reactor.inl" -#endif /* __ACE_INLINE__ */ - - -#include "ace/Handle_Set.h" -#include "ace/Reactor.h" -#include "ace/Timer_Heap.h" -#include "ace/Timer_Queue.h" -#include "ace/ACE.h" -#include "ace/Reverse_Lock_T.h" -#include "ace/Recursive_Thread_Mutex.h" -#include "ace/Null_Mutex.h" -#include "ace/os_include/os_poll.h" -#include "ace/OS_NS_sys_mman.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Dev_Poll_Reactor_Notify::ACE_Dev_Poll_Reactor_Notify (void) - : dp_reactor_ (0) - , notification_pipe_ () - , max_notify_iterations_ (-1) -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - , alloc_queue_ () - , notify_queue_ () - , free_queue_ () - , notify_queue_lock_ () -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -{ -} - -int -ACE_Dev_Poll_Reactor_Notify::open (ACE_Reactor_Impl *r, - ACE_Timer_Queue * /* timer_queue */, - int disable_notify_pipe) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::open"); - - if (disable_notify_pipe == 0) - { - this->dp_reactor_ = dynamic_cast (r); - - if (this->dp_reactor_ == 0) - { - errno = EINVAL; - return -1; - } - - if (this->notification_pipe_.open () == -1) - return -1; - -#if defined (F_SETFD) - // close-on-exec - ACE_OS::fcntl (this->notification_pipe_.read_handle (), F_SETFD, 1); - ACE_OS::fcntl (this->notification_pipe_.write_handle (), F_SETFD, 1); -#endif /* F_SETFD */ - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - ACE_Notification_Buffer *temp; - - ACE_NEW_RETURN (temp, - ACE_Notification_Buffer[ACE_REACTOR_NOTIFICATION_ARRAY_SIZE], - -1); - - if (this->alloc_queue_.enqueue_head (temp) == -1) - return -1; - - for (size_t i = 0; i < ACE_REACTOR_NOTIFICATION_ARRAY_SIZE; ++i) - if (free_queue_.enqueue_head (temp + i) == -1) - return -1; - - if (ACE::set_flags (this->notification_pipe_.write_handle (), - ACE_NONBLOCK) == -1) - return -1; -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - // Set the read handle into non-blocking mode since we need to - // perform a "speculative" read when determining if their are - // notifications to dispatch. - if (ACE::set_flags (this->notification_pipe_.read_handle (), - ACE_NONBLOCK) == -1) - return -1; - } - - return 0; -} - -int -ACE_Dev_Poll_Reactor_Notify::close (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::close"); - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - // Free up the dynamically allocated resources. - ACE_Notification_Buffer **b; - - for (ACE_Unbounded_Queue_Iterator alloc_iter (this->alloc_queue_); - alloc_iter.next (b) != 0; - alloc_iter.advance ()) - { - delete [] *b; - *b = 0; - } - - this->alloc_queue_.reset (); - this->notify_queue_.reset (); - this->free_queue_.reset (); -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - return this->notification_pipe_.close (); -} - -int -ACE_Dev_Poll_Reactor_Notify::notify (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::notify"); - - // Just consider this method a "no-op" if there's no - // ACE_Dev_Poll_Reactor configured. - if (this->dp_reactor_ == 0) - return 0; - - ACE_Notification_Buffer buffer (eh, mask); - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1); - - // Locate a free buffer in the queue. Enlarge the queue if needed. - ACE_Notification_Buffer *temp = 0; - - if (free_queue_.dequeue_head (temp) == -1) - { - // Grow the queue of available buffers. - ACE_Notification_Buffer *temp1; - - ACE_NEW_RETURN (temp1, - ACE_Notification_Buffer[ACE_REACTOR_NOTIFICATION_ARRAY_SIZE], - -1); - - if (this->alloc_queue_.enqueue_head (temp1) == -1) - return -1; - - // Start at 1 and enqueue only - // (ACE_REACTOR_NOTIFICATION_ARRAY_SIZE - 1) elements since - // the first one will be used right now. - for (size_t i = 1; - i < ACE_REACTOR_NOTIFICATION_ARRAY_SIZE; - ++i) - this->free_queue_.enqueue_head (temp1 + i); - - temp = temp1; - } - - ACE_ASSERT (temp != 0); - *temp = buffer; - - ACE_Dev_Poll_Handler_Guard eh_guard (eh); - - if (notify_queue_.enqueue_tail (temp) == -1) - return -1; - - // Now pop the pipe to force the callback for dispatching when ready. If - // the send fails due to a full pipe, don't fail - assume the already-sent - // pipe bytes will cause the entire notification queue to be processed. - ssize_t n = ACE::send (this->notification_pipe_.write_handle (), - (char *) &buffer, - 1, // Only need one byte to pop the pipe - timeout); - if (n == -1 && (errno != ETIME && errno != EAGAIN)) - return -1; - - // Since the notify is queued (and maybe already delivered by now) - // we can simply release the guard. The dispatch of this notification - // will decrement the reference count. - eh_guard.release (); - - return 0; -#else - - ACE_Dev_Poll_Handler_Guard eh_guard (eh); - - ssize_t n = ACE::send (this->notification_pipe_.write_handle (), - (char *) &buffer, - sizeof buffer, - timeout); - if (n == -1) - return -1; - - eh_guard.release (); - - return 0; -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -} - -int -ACE_Dev_Poll_Reactor_Notify::dispatch_notifications ( - int & /* number_of_active_handles */, - ACE_Handle_Set & /* rd_mask */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dispatch_notifications"); - - // This method is unimplemented in the ACE_Dev_Poll_Reactor. - // Instead, the notification handler is invoked as part of the IO - // event set. Doing so alters the some documented semantics that - // state that the notifications are handled before IO events. - // Enforcing such semantics does not appear to be beneficial, and - // also serves to slow down event dispatching particularly with this - // ACE_Dev_Poll_Reactor. - -#if 0 - ACE_HANDLE read_handle = - this->notification_pipe_.read_handle (); - - // Note that we do not check if the handle has received any events. - // Instead a non-blocking "speculative" read is performed. If the - // read returns with errno == EWOULDBLOCK then no notifications are - // dispatched. See ACE_Dev_Poll_Reactor_Notify::read_notify_pipe() - // for details. - if (read_handle != ACE_INVALID_HANDLE) - { - --number_of_active_handles; - - return this->handle_input (read_handle); - } - else - return 0; -#else - ACE_NOTSUP_RETURN (-1); -#endif /* 0 */ -} - -int -ACE_Dev_Poll_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle, - ACE_Notification_Buffer &buffer) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::read_notify_pipe"); - - // This is a (non-blocking) "speculative" read, i.e., we attempt to - // read even if no event was polled on the read handle. A - // speculative read is necessary since notifications must be - // dispatched before IO events. We can avoid the speculative read - // by "walking" the array of pollfd structures returned from - // `/dev/poll' or `/dev/epoll' but that is potentially much more - // expensive than simply checking for an EWOULDBLOCK. - size_t to_read; - char *read_p; - bool have_one = false; - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - // For the queued case, we'll try to read one byte (since that's what - // the notify() tried to put in) but we don't need it - notifications can - // be queued even if the pipe fills, so there may be more notifications - // queued than there are bytes in the pipe. - char b; - read_p = &b; - to_read = 1; - ACE_Notification_Buffer *temp; - - // New scope to release the guard before trying the recv(). - { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1); - - if (notify_queue_.is_empty ()) - return 0; - else if (notify_queue_.dequeue_head (temp) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("read_notify_pipe: dequeue_head")), - -1); - buffer = *temp; - have_one = true; - if (free_queue_.enqueue_head (temp) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("read_notify_pipe: enqueue_head"))); - } - -#else - to_read = sizeof buffer; - read_p = (char *)&buffer; -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - ssize_t n = ACE::recv (handle, read_p, to_read); - - if (n > 0) - { - // Check to see if we've got a short read. - if (static_cast(n) != to_read) - { - size_t remainder = to_read - n; - - // If so, try to recover by reading the remainder. If this - // doesn't work we're in big trouble since the input stream - // won't be aligned correctly. I'm not sure quite what to - // do at this point. It's probably best just to return -1. - if (ACE::recv (handle, &read_p[n], remainder) <= 0) - return -1; - } - - return 1; - } - - // Return -1 if things have gone seriously wrong. - if (n <= 0 && (errno != EWOULDBLOCK && errno != EAGAIN)) - return -1; - - return have_one ? 1 : 0; -} - - -int -ACE_Dev_Poll_Reactor_Notify::handle_input (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::handle_input"); - - // @@ We may end up dispatching this event handler twice: once when - // performing the speculative read on the notification pipe - // handle, and once more when dispatching the IO events. - - // Precondition: this->select_reactor_.token_.current_owner () == - // ACE_Thread::self (); - - int number_dispatched = 0; - int result = 0; - ACE_Notification_Buffer buffer; - - while ((result = this->read_notify_pipe (handle, buffer)) > 0) - { - // Dispatch the buffer - // NOTE: We count only if we made any dispatches ie. upcalls. - if (this->dispatch_notify (buffer) > 0) - ++number_dispatched; - - // Bail out if we've reached the . Note that - // by default is -1, so we'll loop until all - // the available notifications have been dispatched. - if (number_dispatched == this->max_notify_iterations_) - break; - } - - if (result == -1) - { - // Reassign number_dispatched to -1 if things have gone - // seriously wrong. - number_dispatched = -1; - } - - // Enqueue ourselves into the list of waiting threads. When we - // reacquire the token we'll be off and running again with ownership - // of the token. The postcondition of this call is that - // == . - //this->select_reactor_->renew (); - - return number_dispatched; -} - -ACE_HANDLE -ACE_Dev_Poll_Reactor_Notify::notify_handle (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::notify_handle"); - - return this->notification_pipe_.read_handle (); -} - -int -ACE_Dev_Poll_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer &) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::is_dispatchable"); - - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_Dev_Poll_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dispatch_notify"); - - // If eh == 0 then another thread is unblocking the - // ACE_Dev_Poll_Reactor to update the ACE_Dev_Poll_Reactor's - // internal structures. Otherwise, we need to dispatch the - // appropriate handle_* method on the ACE_Event_Handler - // pointer we've been passed. - if (buffer.eh_ != 0) - { - int result = 0; - - // Guard the handler's refcount. Recall that when the notify - // was queued, the refcount was incremented, so it need not be - // now. The guard insures that it is decremented properly. - ACE_Dev_Poll_Handler_Guard eh_guard (buffer.eh_, false); - - switch (buffer.mask_) - { - case ACE_Event_Handler::READ_MASK: - case ACE_Event_Handler::ACCEPT_MASK: - result = buffer.eh_->handle_input (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::WRITE_MASK: - result = buffer.eh_->handle_output (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::EXCEPT_MASK: - result = buffer.eh_->handle_exception (ACE_INVALID_HANDLE); - break; - default: - // Should we bail out if we get an invalid mask? - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("dispatch_notify invalid mask = %d\n"), - buffer.mask_)); - } - if (result == -1) - buffer.eh_->handle_close (ACE_INVALID_HANDLE, buffer.mask_); - } - - return 1; -} - -void -ACE_Dev_Poll_Reactor_Notify::max_notify_iterations (int iterations) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::max_notify_iterations"); - - // Must always be > 0 or < 0 to optimize the loop exit condition. - if (iterations == 0) - iterations = 1; - - this->max_notify_iterations_ = iterations; -} - -int -ACE_Dev_Poll_Reactor_Notify::max_notify_iterations (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::max_notify_iterations"); - - return this->max_notify_iterations_; -} - -int -ACE_Dev_Poll_Reactor_Notify::purge_pending_notifications ( - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::purge_pending_notifications"); - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1); - - if (this->notify_queue_.is_empty ()) - return 0; - - ACE_Notification_Buffer *temp; - ACE_Unbounded_Queue local_queue; - - size_t queue_size = this->notify_queue_.size (); - int number_purged = 0; - size_t i; - for (i = 0; i < queue_size; ++i) - { - if (-1 == this->notify_queue_.dequeue_head (temp)) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("dequeue_head")), - -1); - - // If this is not a Reactor notify (it is for a particular - // handler), and it matches the specified handler (or purging - // all), and applying the mask would totally eliminate the - // notification, then release it and count the number purged. - if ((0 != temp->eh_) && - (0 == eh || eh == temp->eh_) && - ACE_BIT_DISABLED (temp->mask_, ~mask)) // The existing - // notification mask - // is left with - // nothing when - // applying the mask. - { - if (this->free_queue_.enqueue_head (temp) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("enqueue_head")), - -1); - ++number_purged; - } - else - { - // To preserve it, move it to the local_queue. - // But first, if this is not a Reactor notify (it is for a - // particular handler), and it matches the specified handler - // (or purging all), then apply the mask. - if ((0 != temp->eh_) && - (0 == eh || eh == temp->eh_)) - ACE_CLR_BITS(temp->mask_, mask); - if (-1 == local_queue.enqueue_head (temp)) - return -1; - } - } - - if (this->notify_queue_.size ()) - { - // Should be empty! - ACE_ASSERT (0); - return -1; - } - - // Now put it back in the notify queue. - queue_size = local_queue.size (); - for (i = 0; i < queue_size; ++i) - { - if (-1 == local_queue.dequeue_head (temp)) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("dequeue_head")), - -1); - - if (-1 == this->notify_queue_.enqueue_head (temp)) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("enqueue_head")), - -1); - } - - return number_purged; - -#else /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */ - ACE_UNUSED_ARG (eh); - ACE_UNUSED_ARG (mask); - ACE_NOTSUP_RETURN (-1); -#endif /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */ -} - -void -ACE_Dev_Poll_Reactor_Notify::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("dp_reactor_ = %@"), - this->dp_reactor_)); - this->notification_pipe_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// ----------------------------------------------------------------- - -ACE_Dev_Poll_Reactor_Handler_Repository:: -ACE_Dev_Poll_Reactor_Handler_Repository (void) - : max_size_ (0), - handlers_ (0) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::ACE_Dev_Poll_Reactor_Handler_Repository"); -} - -int -ACE_Dev_Poll_Reactor_Handler_Repository::invalid_handle ( - ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::invalid_handle"); - - if (handle < 0 || handle >= this->max_size_) - { - errno = EINVAL; - return 1; - } - else - return 0; -} - -int -ACE_Dev_Poll_Reactor_Handler_Repository::handle_in_range ( - ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::handle_in_range"); - - if (handle >= 0 && handle < this->max_size_) - return 1; - else - { - errno = EINVAL; - return 0; - } -} - -int -ACE_Dev_Poll_Reactor_Handler_Repository::open (size_t size) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::open"); - - this->max_size_ = size; - - // Try to allocate the memory. - ACE_NEW_RETURN (this->handlers_, - ACE_Dev_Poll_Event_Tuple[size], - -1); - - // Try to increase the number of handles if is greater than - // the current limit. - return ACE::set_handle_limit (size); -} - -int -ACE_Dev_Poll_Reactor_Handler_Repository::unbind_all (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::unbind_all"); - - // Unbind all of the event handlers. - for (int handle = 0; - handle < this->max_size_; - ++handle) - this->unbind (handle); - - return 0; -} - -int -ACE_Dev_Poll_Reactor_Handler_Repository::close (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::close"); - - if (this->handlers_ != 0) - { - this->unbind_all (); - - delete [] this->handlers_; - this->handlers_ = 0; - } - - return 0; -} - -ACE_Event_Handler * -ACE_Dev_Poll_Reactor_Handler_Repository::find (ACE_HANDLE handle, - size_t *index_p) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::find"); - - ACE_Event_Handler *eh = 0; - - // Only bother to search for the if it's in range. - if (this->handle_in_range (handle)) - { - eh = this->handlers_[handle].event_handler; - if (eh != 0) - { - if (index_p != 0) - *index_p = handle; - } - else - errno = ENOENT; - } - - return eh; -} - -int -ACE_Dev_Poll_Reactor_Handler_Repository::bind ( - ACE_HANDLE handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::bind"); - - if (handle == ACE_INVALID_HANDLE) - handle = event_handler->get_handle (); - - if (this->invalid_handle (handle)) - return -1; - - this->handlers_[handle].event_handler = event_handler; - this->handlers_[handle].mask = mask; - event_handler->add_reference (); - - return 0; -} - -int -ACE_Dev_Poll_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, - bool decr_refcnt) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::unbind"); - - if (this->find (handle) == 0) - return -1; - - if (decr_refcnt) - this->handlers_[handle].event_handler->remove_reference (); - this->handlers_[handle].event_handler = 0; - this->handlers_[handle].mask = ACE_Event_Handler::NULL_MASK; - this->handlers_[handle].suspended = 0; - - return 0; -} - -// ----------------------------------------------------------------- - -ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify, - int mask_signals, - int s_queue) - : initialized_ (false) - , poll_fd_ (ACE_INVALID_HANDLE) - , size_ (0) - // , ready_set_ () -#if defined (ACE_HAS_EVENT_POLL) - , events_ (0) - , start_pevents_ (0) - , end_pevents_ (0) -#else - , dp_fds_ (0) - , start_pfds_ (0) - , end_pfds_ (0) -#endif /* ACE_HAS_EVENT_POLL */ - , deactivated_ (0) - , token_ (*this, s_queue) - , lock_adapter_ (token_) - , timer_queue_ (0) - , delete_timer_queue_ (0) - , signal_handler_ (0) - , delete_signal_handler_ (0) - , notify_handler_ (0) - , delete_notify_handler_ (0) - , mask_signals_ (mask_signals) - , restart_ (0) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor"); - - if (this->open (ACE::max_handles (), - 0, - sh, - tq, - disable_notify_pipe, - notify) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Dev_Poll_Reactor::open ") - ACE_LIB_TEXT ("failed inside ") - ACE_LIB_TEXT ("ACE_Dev_Poll_Reactor::CTOR"))); -} - -ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (size_t size, - int rs, - ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify, - int mask_signals, - int s_queue) - : initialized_ (false) - , poll_fd_ (ACE_INVALID_HANDLE) - , size_ (0) - // , ready_set_ () -#if defined (ACE_HAS_EVENT_POLL) - , events_ (0) - , start_pevents_ (0) - , end_pevents_ (0) -#else - , dp_fds_ (0) - , start_pfds_ (0) - , end_pfds_ (0) -#endif /* ACE_HAS_EVENT_POLL */ - , deactivated_ (0) - , token_ (*this, s_queue) - , lock_adapter_ (token_) - , timer_queue_ (0) - , delete_timer_queue_ (0) - , signal_handler_ (0) - , delete_signal_handler_ (0) - , notify_handler_ (0) - , delete_notify_handler_ (0) - , mask_signals_ (mask_signals) - , restart_ (0) -{ - if (this->open (size, - rs, - sh, - tq, - disable_notify_pipe, - notify) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Dev_Poll_Reactor::open ") - ACE_LIB_TEXT ("failed inside ACE_Dev_Poll_Reactor::CTOR"))); -} - -ACE_Dev_Poll_Reactor::~ACE_Dev_Poll_Reactor (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::~ACE_Dev_Poll_Reactor"); - - (void) this->close (); -} - -int -ACE_Dev_Poll_Reactor::open (size_t size, - int restart, - ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::open"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - // Can't initialize ourselves more than once. - if (this->initialized_) - return -1; - - this->restart_ = restart; - this->signal_handler_ = sh; - this->timer_queue_ = tq; - this->notify_handler_ = notify; - - int result = 0; - - // Allows the signal handler to be overridden. - if (this->signal_handler_ == 0) - { - ACE_NEW_RETURN (this->signal_handler_, - ACE_Sig_Handler, - -1); - - if (this->signal_handler_ == 0) - result = -1; - else - this->delete_signal_handler_ = 1; - } - - // Allows the timer queue to be overridden. - if (result != -1 && this->timer_queue_ == 0) - { - ACE_NEW_RETURN (this->timer_queue_, - ACE_Timer_Heap, - -1); - - if (this->timer_queue_ == 0) - result = -1; - else - this->delete_timer_queue_ = 1; - } - - // Allows the Notify_Handler to be overridden. - if (result != -1 && this->notify_handler_ == 0) - { - ACE_NEW_RETURN (this->notify_handler_, - ACE_Dev_Poll_Reactor_Notify, - -1); - - if (this->notify_handler_ == 0) - result = -1; - else - this->delete_notify_handler_ = 1; - } - -#if defined (ACE_HAS_EVENT_POLL) - - // Allocating event table: - ACE_NEW_RETURN (this->events_, epoll_event[size], -1); - - // Initializing epoll: - this->poll_fd_ = ::epoll_create (size); - if (this->poll_fd_ == -1) - result = -1; - -#else - - // Allocate the array before opening the device to avoid a potential - // resource leak if allocation fails. - ACE_NEW_RETURN (this->dp_fds_, - pollfd[size], - -1); - - // Open the `/dev/poll' character device. - this->poll_fd_ = ACE_OS::open ("/dev/poll", O_RDWR); - if (this->poll_fd_ == ACE_INVALID_HANDLE) - result = -1; - -#endif /* ACE_HAS_EVENT_POLL */ - - if (result != -1 && this->handler_rep_.open (size) == -1) - result = -1; - - // Registration of the notification handler must be done after the - // /dev/poll device has been fully initialized. - else if (this->notify_handler_->open (this, - 0, - disable_notify_pipe) == -1 - || (disable_notify_pipe == 0 - && this->register_handler_i ( - this->notify_handler_->notify_handle (), - this->notify_handler_, - ACE_Event_Handler::READ_MASK) == -1)) - result = -1; - - this->size_ = size; - - if (result != -1) - // We're all set to go. - this->initialized_ = true; - else - // This will close down all the allocated resources properly. - (void) this->close (); - - return result; -} - -int -ACE_Dev_Poll_Reactor::current_info (ACE_HANDLE, size_t & /* size */) -{ - ACE_NOTSUP_RETURN (-1); -} - - -int -ACE_Dev_Poll_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler) -{ - if (this->delete_signal_handler_ && this->signal_handler_) - delete this->signal_handler_; - - this->signal_handler_ = signal_handler; - this->delete_signal_handler_ = 0; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::timer_queue (ACE_Timer_Queue *tq) -{ - if (this->delete_timer_queue_ && this->timer_queue_) - delete this->timer_queue_; - - this->timer_queue_ = tq; - this->delete_timer_queue_ = 0; - - return 0; - -} - -ACE_Timer_Queue * -ACE_Dev_Poll_Reactor::timer_queue (void) const -{ - return this->timer_queue_; -} - -int -ACE_Dev_Poll_Reactor::close (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::close"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - int result = 0; - - if (this->poll_fd_ != ACE_INVALID_HANDLE) - { - result = ACE_OS::close (this->poll_fd_); - } - -#if defined (ACE_HAS_EVENT_POLL) - - delete [] this->events_; - this->events_ = 0; - -#else - - delete [] this->dp_fds_; - this->dp_fds_ = 0; - -#endif /* ACE_HAS_EVENT_POLL */ - - if (this->delete_signal_handler_) - { - delete this->signal_handler_; - this->signal_handler_ = 0; - this->delete_signal_handler_ = 0; - } - - (void) this->handler_rep_.close (); - - if (this->delete_timer_queue_) - { - delete this->timer_queue_; - this->timer_queue_ = 0; - this->delete_timer_queue_ = 0; - } - - if (this->notify_handler_ != 0) - this->notify_handler_->close (); - - if (this->delete_notify_handler_) - { - delete this->notify_handler_; - this->notify_handler_ = 0; - this->delete_notify_handler_ = 0; - } - - this->poll_fd_ = ACE_INVALID_HANDLE; - -#if defined (ACE_HAS_EVENT_POLL) - this->start_pevents_ = 0; - this->end_pevents_ = 0; -#else - this->start_pfds_ = 0; - this->end_pfds_ = 0; -#endif /* ACE_HAS_EVENT_POLL */ - - this->initialized_ = false; - - return result; -} - -int -ACE_Dev_Poll_Reactor::work_pending (const ACE_Time_Value & max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::work_pending"); - - // Stash the current time - // - // The destructor of this object will automatically compute how much - // time elapsed since this method was called. - ACE_Time_Value mwt (max_wait_time); - ACE_MT (ACE_Countdown_Time countdown (&mwt)); - - Token_Guard guard (this->token_); - int result = guard.acquire_quietly (&mwt); - - // If the guard is NOT the owner just return the retval - if (!guard.is_owner ()) - return result; - - // Update the countdown to reflect time waiting for the mutex. - ACE_MT (countdown.update ()); - - return this->work_pending_i (&mwt); -} - -int -ACE_Dev_Poll_Reactor::work_pending_i (ACE_Time_Value * max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::work_pending_i"); - - if (this->deactivated_) - return 0; - -#if defined (ACE_HAS_EVENT_POLL) - if (this->start_pevents_ != this->end_pevents_) -#else - if (this->start_pfds_ != this->end_pfds_) -#endif /* ACE_HAS_EVENT_POLL */ - return 1; // We still have work_pending(). Do not poll for - // additional events. - - ACE_Time_Value timer_buf (0); - ACE_Time_Value *this_timeout = 0; - - this_timeout = this->timer_queue_->calculate_timeout (max_wait_time, - &timer_buf); - - // Check if we have timers to fire. - const int timers_pending = - ((this_timeout != 0 && max_wait_time == 0) - || (this_timeout != 0 && max_wait_time != 0 - && *this_timeout != *max_wait_time) ? 1 : 0); - - const long timeout = - (this_timeout == 0 - ? -1 /* Infinity */ - : static_cast (this_timeout->msec ())); - -#if defined (ACE_HAS_EVENT_POLL) - - // Wait for events. - const int nfds = ::epoll_wait (this->poll_fd_, - this->events_, - this->size_, - static_cast (timeout)); - - if (nfds > 0) - { - this->start_pevents_ = this->events_; - this->end_pevents_ = this->start_pevents_ + nfds; - } - -#else - - struct dvpoll dvp; - - dvp.dp_fds = this->dp_fds_; - dvp.dp_nfds = this->size_; - dvp.dp_timeout = timeout; // Milliseconds - - // Poll for events - const int nfds = ACE_OS::ioctl (this->poll_fd_, DP_POLL, &dvp); - - // Retrieve the results from the pollfd array. - this->start_pfds_ = dvp.dp_fds; - - // If nfds == 0 then end_pfds_ == start_pfds_ meaning that there is - // no work pending. If nfds > 0 then there is work pending. - // Otherwise an error occurred. - if (nfds > -1) - this->end_pfds_ = this->start_pfds_ + nfds; -#endif /* ACE_HAS_EVENT_POLL */ - - // If timers are pending, override any timeout from the poll. - return (nfds == 0 && timers_pending != 0 ? 1 : nfds); -} - - -int -ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events"); - - // Stash the current time - // - // The destructor of this object will automatically compute how much - // time elapsed since this method was called. - ACE_MT (ACE_Countdown_Time countdown (max_wait_time)); - - Token_Guard guard (this->token_); - int result = guard.acquire_quietly (max_wait_time); - - // If the guard is NOT the owner just return the retval - if (!guard.is_owner ()) - return result; - - if (this->deactivated_) - return -1; - - // Update the countdown to reflect time waiting for the mutex. - ACE_MT (countdown.update ()); - - return this->handle_events_i (max_wait_time, guard); -} - -int -ACE_Dev_Poll_Reactor::handle_events_i (ACE_Time_Value *max_wait_time, - Token_Guard &guard) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events_i"); - - int result = 0; - // int active_handle_count = 0; - - // Poll for events - // - // If the underlying ioctl() call was interrupted via the interrupt - // signal (i.e. returned -1 with errno == EINTR) then the loop will - // be restarted if so desired. - do - { - result = this->work_pending_i (max_wait_time); - if (result == -1) - ACE_ERROR((LM_ERROR, "%t: %p\n", "work_pending_i")); - } - while (result == -1 && this->restart_ != 0 && errno == EINTR); - - if (result == 0 || (result == -1 && errno == ETIME)) - return 0; - else if (result == -1) - { - if (errno != EINTR) - return -1; - - // Bail out -- we got here since the poll was interrupted. - // If it was due to a signal registered through our ACE_Sig_Handler, - // then it was dispatched, so we count it in the number of events - // handled rather than cause an error return. - if (ACE_Sig_Handler::sig_pending () != 0) - { - ACE_Sig_Handler::sig_pending (0); - return 1; - } - return -1; - } - - // Dispatch an event. - return this->dispatch (guard); -} - -// Dispatch an event. On entry, the token is held by the caller. If an -// event is found to dispatch, the token is released before dispatching it. -int -ACE_Dev_Poll_Reactor::dispatch (Token_Guard &guard) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::dispatch"); - - // Perform the Template Method for dispatching the first located event. - // We dispatch only one to effectively dispatch events concurrently. - // As soon as an event is located, the token is released, allowing the - // next waiter to begin getting an event while we dispatch one here. - int result = 0; - - // Handle timers early since they may have higher latency - // constraints than I/O handlers. Ideally, the order of - // dispatching should be a strategy... - if ((result = this->dispatch_timer_handler (guard)) != 0) - return result; - - // Check to see if there are no more I/O handles left to - // dispatch AFTER we've handled the timers. - - // Finally, dispatch the I/O handlers. - result = this->dispatch_io_event (guard); - - return result; -} - -int -ACE_Dev_Poll_Reactor::dispatch_timer_handler (Token_Guard &guard) -{ - if (this->timer_queue_->is_empty()) - return 0; // Empty timer queue so cannot have any expired timers. - - // Get the current time - ACE_Time_Value cur_time (this->timer_queue_->gettimeofday () + - this->timer_queue_->timer_skew ()); - - // Look for a node in the timer queue whose timer <= the present - // time. - ACE_Timer_Node_Dispatch_Info info; - if (this->timer_queue_->dispatch_info (cur_time, info)) - { - const void *upcall_act = 0; - - // Preinvoke (handles refcount if needed, etc.) - this->timer_queue_->preinvoke (info, cur_time, upcall_act); - - // Release the token before expiration upcall. - guard.release_token (); - - // call the functor - this->timer_queue_->upcall (info, cur_time); - - // Postinvoke (undo refcount if needed, etc.) - this->timer_queue_->postinvoke (info, cur_time, upcall_act); - - // We have dispatched a timer - return 1; - } - - return 0; -} - -#if 0 -int -ACE_Dev_Poll_Reactor::dispatch_notification_handlers ( - ACE_Select_Reactor_Handle_Set &dispatch_set, - int &number_of_active_handles, - int &number_of_handlers_dispatched) -{ - // Check to see if the ACE_HANDLE associated with the - // Dev_Poll_Reactor's notify hook is enabled. If so, it means that - // one or more other threads are trying to update the - // ACE_Dev_Poll_Reactor's internal tables or the notify pipe is - // enabled. We'll handle all these threads and notifications, and - // then break out to continue the event loop. - - const int n = - this->notify_handler_->dispatch_notifications (number_of_active_handles, - dispatch_set.rd_mask_); - - if (n == -1) - return -1; - else - number_of_handlers_dispatched += n; - - return /* this->state_changed_ ? -1 : */ 0; -} -#endif /* 0 */ - -int -ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) -{ - - // Define bits to check for while dispatching. -#if defined (ACE_HAS_EVENT_POLL) - const __uint32_t out_event = EPOLLOUT; - const __uint32_t exc_event = EPOLLPRI; - const __uint32_t in_event = EPOLLIN; - const __uint32_t err_event = EPOLLHUP | EPOLLERR; -#else - const short out_event = POLLOUT; - const short exc_event = POLLPRI; - const short in_event = POLLIN; - const short err_event = 0; // No known bits for this -#endif /* ACE_HAS_EVENT_POLL */ - - // Since the underlying event demultiplexing mechansim (`/dev/poll' - // or '/dev/epoll') is stateful, and since only one result buffer is - // used, all pending events (i.e. those retrieved from a previous - // poll) must be dispatched before any additional event can be - // polled. As such, the Dev_Poll_Reactor keeps track of the - // progress of events that have been dispatched. - - // Dispatch the events. - // - // Select the first available handle with event(s) pending. Check for - // event type in defined order of dispatch: output, exception, input. - // When an event is located, clear its bit in the dispatch set. If there - // are no more events for the handle, also increment the pfds pointer - // to move to the next handle ready. - // - // Notice that pfds only contains file descriptors that have - // received events. -#if defined (ACE_HAS_EVENT_POLL) - struct epoll_event *& pfds = this->start_pevents_; - if (pfds < this->end_pevents_) -#else - struct pollfd *& pfds = this->start_pfds_; - if (pfds < this->end_pfds_) -#endif /* ACE_HAS_EVENT_POLL */ - { -#if defined (ACE_HAS_EVENT_POLL) - const ACE_HANDLE handle = pfds->data.fd; - __uint32_t &revents = pfds->events; -#else - const ACE_HANDLE handle = pfds->fd; - short &revents = pfds->revents; -#endif /* ACE_HAS_EVENT_POLL */ - - // Figure out what to do first in order to make it easier to manage - // the bit twiddling and possible pfds increment before releasing - // the token for dispatch. - // Note that if there's an error (such as the handle was closed - // without being removed from the event set) the EPOLLHUP and/or - // EPOLLERR bits will be set in revents. - bool disp_out = false; - bool disp_exc = false; - bool disp_in = false; - if (ACE_BIT_ENABLED (revents, out_event)) - { - disp_out = true; - ACE_CLR_BITS (revents, out_event); - } - else if (ACE_BIT_ENABLED (revents, exc_event)) - { - disp_exc = true; - ACE_CLR_BITS (revents, exc_event); - } - else if (ACE_BIT_ENABLED (revents, in_event)) - { - disp_in = true; - ACE_CLR_BITS (revents, in_event); - } - else if (ACE_BIT_ENABLED (revents, err_event)) - { - this->remove_handler_i (handle, ACE_Event_Handler::ALL_EVENTS_MASK); - ++pfds; - return 1; - } - else - { - ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) dispatch_io h %d unknown events 0x%x\n"), handle, revents)); - // ACE_ASSERT (0); - } - - // Increment the pointer to the next element before we - // release the token. Otherwise event handlers end up being - // dispatched multiple times for the same poll. - if (revents == 0) - ++pfds; - - /* When using sys_epoll, we can attach arbitrary user - data to the descriptor, so it can be delivered when - activity is detected. Perhaps we should store event - handler together with descriptor, instead of looking - it up in a repository ? Could it boost performance ? - */ - ACE_Event_Handler *eh = this->handler_rep_.find (handle); - - if (eh) - { - // Modify the reference count in an exception-safe way. - // Note that eh could be the notify handler. It's not strictly - // necessary to manage its refcount, but since we don't enable - // the counting policy, it won't do much. Management of the - // notified handlers themselves is done in the notify handler. - ACE_Dev_Poll_Handler_Guard eh_guard (eh); - - // Release the reactor token before upcall. - guard.release_token (); - - // Dispatch the detected event - if (disp_out) - { - const int status = - this->upcall (eh, &ACE_Event_Handler::handle_output, handle); - - if (status < 0) - // Note that the token is reacquired in remove_handler(). - this->remove_handler (handle, ACE_Event_Handler::WRITE_MASK); - return 1; - } - - if (disp_exc) - { - const int status = - this->upcall (eh, &ACE_Event_Handler::handle_exception, handle); - - if (status < 0) - // Note that the token is reacquired in remove_handler(). - this->remove_handler (handle, ACE_Event_Handler::EXCEPT_MASK); - return 1; - } - - if (disp_in) - { - const int status = - this->upcall (eh, &ACE_Event_Handler::handle_input, handle); - - if (status < 0) - // Note that the token is reacquired in remove_handler(). - this->remove_handler (handle, ACE_Event_Handler::READ_MASK); - return 1; - } - } // The reactor token is reacquired upon leaving this scope. - } - - return 0; -} - -int -ACE_Dev_Poll_Reactor::alertable_handle_events (ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::alertable_handle_events"); - - return this->handle_events (max_wait_time); -} - -int -ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value &max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events"); - - return this->handle_events (&max_wait_time); -} - -int -ACE_Dev_Poll_Reactor::alertable_handle_events (ACE_Time_Value &max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::alertable_handle_events"); - - return this->handle_events (max_wait_time); -} - -int -ACE_Dev_Poll_Reactor::deactivated (void) -{ - return this->deactivated_; -} - -void -ACE_Dev_Poll_Reactor::deactivate (int do_stop) -{ - this->deactivated_ = do_stop; - this->wakeup_all_threads (); -} - -int -ACE_Dev_Poll_Reactor::register_handler (ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->register_handler_i (handler->get_handle (), - handler, - mask); -} - -int -ACE_Dev_Poll_Reactor::register_handler (ACE_HANDLE handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->register_handler_i (handle, - event_handler, - mask); -} - -int -ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler_i"); - - if (handle == ACE_INVALID_HANDLE - || mask == ACE_Event_Handler::NULL_MASK) - { - errno = EINVAL; - return -1; - } - - if (this->handler_rep_.find (handle) == 0) - { - // Handler not present in the repository. Bind it. - if (this->handler_rep_.bind (handle, event_handler, mask) != 0) - return -1; - -#if defined (ACE_HAS_EVENT_POLL) - - struct epoll_event epev; - ACE_OS::memset (&epev, 0, sizeof (epev)); - static const int op = EPOLL_CTL_ADD; - - epev.events = this->reactor_mask_to_poll_event (mask); - epev.data.fd = handle; - - if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "epoll_ctl")); - (void) this->handler_rep_.unbind (handle); - return -1; - } - -#endif /* ACE_HAS_EVENT_POLL */ - } - else - { - // Handler is already present in the repository, so register it - // again, possibly for different event. Add new mask to the - // current one. - if (this->mask_ops_i (handle, mask, ACE_Reactor::ADD_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "mask_ops_i"), -1); - } - -#ifndef ACE_HAS_EVENT_POLL - - struct pollfd pfd; - - pfd.fd = handle; - pfd.events = this->reactor_mask_to_poll_event (mask); - pfd.revents = 0; - - // Add file descriptor to the "interest set." - if (ACE_OS::write (this->poll_fd_, &pfd, sizeof (pfd)) != sizeof (pfd)) - { - (void) this->handler_rep_.unbind (handle); - return -1; - } -#endif /*ACE_HAS_EVENT_POLL*/ - - // Note the fact that we've changed the state of the wait_set_, - // which is used by the dispatching loop to determine whether it can - // keep going or if it needs to reconsult select(). - // this->state_changed_ = 1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::register_handler ( - ACE_HANDLE /* event_handle */, - ACE_HANDLE /* io_handle */, - ACE_Event_Handler * /* event_handler */, - ACE_Reactor_Mask /* mask */) -{ - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_Dev_Poll_Reactor::register_handler (const ACE_Handle_Set &handle_set, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - ACE_Handle_Set_Iterator handle_iter (handle_set); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - // @@ It might be more efficient to construct a pollfd array and - // pass it to the write() call in register_handler_i() only once, - // instead of calling write() (a system call) once for each file - // descriptor. - - for (ACE_HANDLE h = handle_iter (); - h != ACE_INVALID_HANDLE; - h = handle_iter ()) - if (this->register_handler_i (h, event_handler, mask) == -1) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp, - ACE_Event_Handler **old_sh, - ACE_Sig_Action *old_disp) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - return this->signal_handler_->register_handler (signum, - new_sh, - new_disp, - old_sh, - old_disp); -} - -int -ACE_Dev_Poll_Reactor::register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - int result = 0; - -#if (ACE_NSIG > 0) - - for (int s = 1; s < ACE_NSIG; ++s) - if ((sigset.is_member (s) == 1) - && this->signal_handler_->register_handler (s, - new_sh, - new_disp) == -1) - result = -1; - -#else /* ACE_NSIG <= 0 */ - - ACE_UNUSED_ARG (sigset); - ACE_UNUSED_ARG (new_sh); - ACE_UNUSED_ARG (new_disp); - -#endif /* ACE_NSIG <= 0 */ - - return result; -} - -int -ACE_Dev_Poll_Reactor::remove_handler (ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->remove_handler_i (handler->get_handle (), mask); -} - -int -ACE_Dev_Poll_Reactor::remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->remove_handler_i (handle, mask); -} - -int -ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler_i"); - - ACE_Event_Handler *eh = this->handler_rep_.find (handle); - - if (eh == 0 || - this->mask_ops_i (handle, mask, ACE_Reactor::CLR_MASK) == -1) - return -1; - - // Check for ref counting now - handle_close() may delete eh. - int requires_reference_counting = - eh->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (ACE_BIT_DISABLED (mask, ACE_Event_Handler::DONT_CALL)) - (void) eh->handle_close (handle, mask); - - // If there are no longer any outstanding events on the given handle - // then remove it from the handler repository. - if (this->handler_rep_.mask (handle) == ACE_Event_Handler::NULL_MASK) - this->handler_rep_.unbind (handle, requires_reference_counting); - - // Note the fact that we've changed the state of the wait_set, - // i.e. the "interest set," which is used by the dispatching loop to - // determine whether it can keep going or if it needs to reconsult - // /dev/poll or /dev/epoll. - // this->state_changed_ = 1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - ACE_Handle_Set_Iterator handle_iter (handle_set); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - // @@ It might be more efficient to construct a pollfd array and - // pass it to the write() call in register_handler_i() only once, - // instead of calling write() (a system call) once for each file - // descriptor. - - for (ACE_HANDLE h = handle_iter (); - h != ACE_INVALID_HANDLE; - h = handle_iter ()) - if (this->remove_handler_i (h, mask) == -1) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp, - int sigkey) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - return this->signal_handler_->remove_handler (signum, - new_disp, - old_disp, - sigkey); -} - -int -ACE_Dev_Poll_Reactor::remove_handler (const ACE_Sig_Set &sigset) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - int result = 0; - -#if (ACE_NSIG > 0) - - for (int s = 1; s < ACE_NSIG; ++s) - if ((sigset.is_member (s) == 1) - && this->signal_handler_->remove_handler (s) == -1) - result = -1; - -#else /* ACE_NSIG <= 0 */ - - ACE_UNUSED_ARG (sigset); - -#endif /* ACE_NSIG <= 0 */ - - return result; -} - -int -ACE_Dev_Poll_Reactor::suspend_handler (ACE_Event_Handler *event_handler) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler"); - - if (event_handler == 0) - { - errno = EINVAL; - return -1; - } - - ACE_HANDLE handle = event_handler->get_handle (); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->suspend_handler_i (handle); -} - -int -ACE_Dev_Poll_Reactor::suspend_handler (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->suspend_handler_i (handle); -} - -int -ACE_Dev_Poll_Reactor::suspend_handler (const ACE_Handle_Set &handles) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler"); - - ACE_Handle_Set_Iterator handle_iter (handles); - ACE_HANDLE h; - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->suspend_handler_i (h) == -1) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::suspend_handlers (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handlers"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - const size_t len = this->handler_rep_.size (); - - for (size_t i = 0; i < len; ++i) - if (this->handler_rep_.suspended (i) == 0 - && this->suspend_handler_i (i) != 0) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::suspend_handler_i (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler_i"); - - if (this->handler_rep_.find (handle) == 0) - return -1; - - if (this->handler_rep_.suspended (handle)) - return 0; // Already suspended. @@ Should this be an error? - - // Remove the handle from the "interest set." - // - // Note that the associated event handler is still in the handler - // repository, but no events will be polled on the given handle thus - // no event will be dispatched to the event handler. - -#if defined (ACE_HAS_EVENT_POLL) - - struct epoll_event epev; - ACE_OS::memset (&epev, 0, sizeof (epev)); - static const int op = EPOLL_CTL_DEL; - - epev.events = 0; - epev.data.fd = handle; - - if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) - return -1; - -#else - - struct pollfd pfd[1]; - - pfd[0].fd = handle; - pfd[0].events = POLLREMOVE; - pfd[0].revents = 0; - - if (ACE_OS::write (this->poll_fd_, pfd, sizeof (pfd)) != sizeof (pfd)) - return -1; - -#endif /* ACE_HAS_EVENT_POLL */ - - this->handler_rep_.suspend (handle); - - return 0; -} - -int -ACE_Dev_Poll_Reactor::resume_handler (ACE_Event_Handler *event_handler) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler"); - - if (event_handler == 0) - { - errno = EINVAL; - return -1; - } - - ACE_HANDLE handle = event_handler->get_handle (); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->resume_handler_i (handle); -} - -int -ACE_Dev_Poll_Reactor::resume_handler (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->resume_handler_i (handle); -} - -int -ACE_Dev_Poll_Reactor::resume_handler (const ACE_Handle_Set &handles) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler"); - - ACE_Handle_Set_Iterator handle_iter (handles); - ACE_HANDLE h; - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->resume_handler_i (h) == -1) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::resume_handlers (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handlers"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - const size_t len = this->handler_rep_.size (); - - for (size_t i = 0; i < len; ++i) - if (this->handler_rep_.suspended (i) - && this->resume_handler_i (i) != 0) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::resume_handler_i (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler_i"); - - if (this->handler_rep_.find (handle) == 0 - && this->handler_rep_.suspended (handle) == 0) - return -1; - - ACE_Reactor_Mask mask = this->handler_rep_.mask (handle); - - if (mask == ACE_Event_Handler::NULL_MASK) - return -1; - - // Place the handle back in to the "interest set." - // - // Events for the given handle will once again be polled. - -#if defined (ACE_HAS_EVENT_POLL) - - struct epoll_event epev; - ACE_OS::memset (&epev, 0, sizeof (epev)); - static const int op = EPOLL_CTL_ADD; - - epev.events = this->reactor_mask_to_poll_event (mask); - epev.data.fd = handle; - - if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) - return -1; - -#else - - struct pollfd pfd[1]; - - pfd[0].fd = handle; - pfd[0].events = this->reactor_mask_to_poll_event (mask); - pfd[0].revents = 0; - - if (ACE_OS::write (this->poll_fd_, pfd, sizeof (pfd)) != sizeof (pfd)) - return -1; - -#endif /* ACE_HAS_EVENT_POLL */ - - this->handler_rep_.resume (handle); - - return 0; -} - -int -ACE_Dev_Poll_Reactor::resumable_handler (void) -{ - // @@ Is this correct? - - return 0; -} - -int -ACE_Dev_Poll_Reactor::uses_event_associations (void) -{ - // Since the Dev_Poll_Reactor does not do any event associations, - // this method always return zero. - return 0; -} - -long -ACE_Dev_Poll_Reactor::schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_timer"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - if (0 != this->timer_queue_) - return this->timer_queue_->schedule - (event_handler, - arg, - this->timer_queue_->gettimeofday () + delay, - interval); - - errno = ESHUTDOWN; - return -1; -} - -int -ACE_Dev_Poll_Reactor::reset_timer_interval (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::reset_timer_interval"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - if (0 != this->timer_queue_) - return this->timer_queue_->reset_interval (timer_id, interval); - - errno = ESHUTDOWN; - return -1; -} - -int -ACE_Dev_Poll_Reactor::cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return (this->timer_queue_ == 0 - ? 0 - : this->timer_queue_->cancel (event_handler, - dont_call_handle_close)); -} - -int -ACE_Dev_Poll_Reactor::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return (this->timer_queue_ == 0 - ? 0 - : this->timer_queue_->cancel (timer_id, - arg, - dont_call_handle_close)); -} - -int -ACE_Dev_Poll_Reactor::schedule_wakeup (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_wakeup"); - - return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK); -} - -int -ACE_Dev_Poll_Reactor::schedule_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_wakeup"); - - return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK); -} - -int -ACE_Dev_Poll_Reactor::cancel_wakeup (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_wakeup"); - - return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK); -} - -int -ACE_Dev_Poll_Reactor::cancel_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_wakeup"); - - return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK); -} - -int -ACE_Dev_Poll_Reactor::notify (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::notify"); - - ssize_t n = 0; - - // Pass over both the Event_Handler *and* the mask to allow the - // caller to dictate which Event_Handler method the receiver - // invokes. Note that this call can timeout. - - n = this->notify_handler_->notify (eh, mask, timeout); - - return n == -1 ? -1 : 0; -} - -void -ACE_Dev_Poll_Reactor::max_notify_iterations (int iterations) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::max_notify_iterations"); - - ACE_MT (ACE_GUARD (ACE_Dev_Poll_Reactor_Token, mon, this->token_)); - - this->notify_handler_->max_notify_iterations (iterations); -} - -int -ACE_Dev_Poll_Reactor::max_notify_iterations (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::max_notify_iterations"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->notify_handler_->max_notify_iterations (); -} - -int -ACE_Dev_Poll_Reactor::purge_pending_notifications (ACE_Event_Handler * eh, - ACE_Reactor_Mask mask) -{ - if (this->notify_handler_ == 0) - return 0; - - return this->notify_handler_->purge_pending_notifications (eh, mask); -} - -ACE_Event_Handler * -ACE_Dev_Poll_Reactor::find_handler (ACE_HANDLE handle) -{ - ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, 0)); - - ACE_Event_Handler *event_handler = this->handler_rep_.find (handle); - if (event_handler) - event_handler->add_reference (); - return event_handler; -} - -int -ACE_Dev_Poll_Reactor::handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handler"); - - ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - ACE_Event_Handler *h = this->handler_rep_.find (handle); - - if (h != 0 - && ACE_BIT_CMP_MASK (this->handler_rep_.mask (handle), - mask, // Compare all bits in the mask - mask)) - { - if (event_handler != 0) - *event_handler = h; - - return 0; - } - - return -1; -} - -int -ACE_Dev_Poll_Reactor::handler (int signum, - ACE_Event_Handler **eh) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handler"); - - ACE_Event_Handler *handler = this->signal_handler_->handler (signum); - - if (handler == 0) - return -1; - else if (eh != 0) - *eh = handler; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::initialized (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::initialized"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->initialized_; -} - -size_t -ACE_Dev_Poll_Reactor::size (void) const -{ - return this->size_; -} - -ACE_Lock & -ACE_Dev_Poll_Reactor::lock (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::lock"); - - return this->lock_adapter_; -} - -void -ACE_Dev_Poll_Reactor::wakeup_all_threads (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::wakeup_all_threads"); - - // Send a notification, but don't block if there's no one to receive - // it. - this->notify (0, - ACE_Event_Handler::NULL_MASK, - (ACE_Time_Value *) &ACE_Time_Value::zero); -} - -int -ACE_Dev_Poll_Reactor::owner (ACE_thread_t /* new_owner */, - ACE_thread_t * /* old_owner */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::owner"); - - // There is no need to set the owner of the event loop. Multiple - // threads may invoke the event loop simulataneously. - - return 0; -} - -int -ACE_Dev_Poll_Reactor::owner (ACE_thread_t * /* owner */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::owner"); - - // There is no need to set the owner of the event loop. Multiple - // threads may invoke the event loop simulataneously. - - return 0; -} - -int -ACE_Dev_Poll_Reactor::restart (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::restart"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->restart_; -} - -int -ACE_Dev_Poll_Reactor::restart (int r) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::restart"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - int current_value = this->restart_; - this->restart_ = r; - return current_value; -} - -void -ACE_Dev_Poll_Reactor::requeue_position (int) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::requeue_position"); -} - -int -ACE_Dev_Poll_Reactor::requeue_position (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::requeue_position"); - - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_Dev_Poll_Reactor::mask_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->mask_ops_i (event_handler->get_handle (), mask, ops); -} - -int -ACE_Dev_Poll_Reactor::mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->mask_ops_i (handle, mask, ops); -} - -int -ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops_i"); - - if (this->handler_rep_.handle_in_range (handle) == 0) - return -1; - - // Block out all signals until method returns. - ACE_Sig_Guard sb; - - const ACE_Reactor_Mask old_mask = this->handler_rep_.mask (handle); - ACE_Reactor_Mask new_mask = old_mask; - - // Perform GET, CLR, SET, and ADD operations on the interest/wait - // set and the suspend set (if necessary). - // - // GET = 1, Retrieve current value - // SET = 2, Set value of bits to new mask (changes the entire mask) - // ADD = 3, Bitwise "or" the value into the mask (only changes - // enabled bits) - // CLR = 4 Bitwise "and" the negation of the value out of the mask - // (only changes enabled bits) - // - // Returns the original mask. - - switch (ops) - { - case ACE_Reactor::GET_MASK: - // The work for this operation is done in all cases at the - // begining of the function. - return old_mask; - - case ACE_Reactor::CLR_MASK: - ACE_CLR_BITS (new_mask, mask); - break; - - case ACE_Reactor::SET_MASK: - new_mask = mask; - break; - - case ACE_Reactor::ADD_MASK: - ACE_SET_BITS (new_mask, mask); - break; - - default: - return -1; - } - - /// Reset the mask for the given handle. - this->handler_rep_.mask (handle, new_mask); - - if (this->handler_rep_.suspended (handle) == 0) - { - // Only attempt to alter events for the handle from the - // "interest set" if it hasn't been suspended. - - const short events = this->reactor_mask_to_poll_event (new_mask); - -#if defined (sun) - // Apparently events cannot be updated on-the-fly on Solaris so - // remove the existing events, and then add the new ones. - struct pollfd pfd[2]; - - pfd[0].fd = handle; - pfd[0].events = POLLREMOVE; - pfd[0].revents = 0; - pfd[1].fd = (events == POLLREMOVE ? ACE_INVALID_HANDLE : handle); - pfd[1].events = events; - pfd[1].revents = 0; - - // Change the events associated with the given file descriptor. - if (ACE_OS::write (this->poll_fd_, - pfd, - sizeof (pfd)) != sizeof (pfd)) - return -1; -#elif defined (ACE_HAS_EVENT_POLL) - - struct epoll_event epev; - ACE_OS::memset (&epev, 0, sizeof (epev)); - int op; - - // ACE_Event_Handler::NULL_MASK ??? - if (new_mask == 0) - { - op = EPOLL_CTL_DEL; - epev.events = 0; - } - else - { - op = EPOLL_CTL_MOD; - epev.events = events; - } - - epev.data.fd = handle; - - if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) - { - // If a handle is closed, epoll removes it from the poll set - // automatically - we may not know about it yet. If that's the - // case, a mod operation will fail with ENOENT. Retry it as - // an add. - if (op == EPOLL_CTL_MOD && errno == ENOENT && - ::epoll_ctl (this->poll_fd_, EPOLL_CTL_ADD, handle, &epev) == -1) - return -1; - } - -#else - pollfd pfd[1]; - - pfd[0].fd = handle; - pfd[0].events = events; - pfd[0].revents = 0; - - // Change the events associated with the given file descriptor. - if (ACE_OS::write (this->poll_fd_, - pfd, - sizeof (pfd)) != sizeof (pfd)) - return -1; -#endif /*ACE_HAS_EVENT_POLL */ - } - - return old_mask; -} - -int -ACE_Dev_Poll_Reactor::ready_ops (ACE_Event_Handler * /* event_handler */, - ACE_Reactor_Mask /* mask */, - int /* ops */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::ready_ops"); - - // Since the Dev_Poll_Reactor uses the poll result buffer, the - // ready_set cannot be directly manipulated outside of the event - // loop. - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_Dev_Poll_Reactor::ready_ops (ACE_HANDLE /* handle */, - ACE_Reactor_Mask /* mask */, - int /* ops */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::ready_ops"); - - // Since the Dev_Poll_Reactor uses the poll result buffer, the - // ready_set cannot be directly manipulated outside of the event - // loop. - ACE_NOTSUP_RETURN (-1); -} - -void -ACE_Dev_Poll_Reactor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dev_Poll_Reactor::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("restart_ = %d\n"), this->restart_)); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("initialized_ = %d"), - this->initialized_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("poll_fd_ = %d"), this->poll_fd_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("size_ = %u"), this->size_)); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("deactivated_ = %d"), - this->deactivated_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -short -ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event (ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event"); - - if (mask == ACE_Event_Handler::NULL_MASK) - // No event. Remove from interest set. -#if defined (ACE_HAS_EVENT_POLL) - return EPOLL_CTL_DEL; -#else - return POLLREMOVE; -#endif /* ACE_HAS_EVENT_POLL */ - - short events = 0; - - // READ, ACCEPT, and CONNECT flag will place the handle in the - // read set. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) - { -#if defined (ACE_HAS_EVENT_POLL) - ACE_SET_BITS (events, EPOLLIN); -#else - ACE_SET_BITS (events, POLLIN); -#endif /*ACE_HAS_EVENT_POLL*/ - } - - // WRITE and CONNECT flag will place the handle in the write set. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) - { -#if defined (ACE_HAS_EVENT_POLL) - ACE_SET_BITS (events, EPOLLOUT); -#else - ACE_SET_BITS (events, POLLOUT); -#endif /*ACE_HAS_EVENT_POLL*/ - } - - // EXCEPT flag will place the handle in the except set. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) - { -#if defined (ACE_HAS_EVENT_POLL) - ACE_SET_BITS (events, EPOLLPRI); -#else - ACE_SET_BITS (events, POLLPRI); -#endif /*ACE_HAS_EVENT_POLL*/ - } - - return events; -} - -namespace { - void polite_sleep_hook (void *) { } -} - -int -ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly (ACE_Time_Value *max_wait) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly"); - - // Acquire the token but don't ping any waiters; just queue up politely. - int result = 0; - if (max_wait) - { - ACE_Time_Value tv = ACE_OS::gettimeofday (); - tv += *max_wait; - - ACE_MT (result = this->token_.acquire_read (&polite_sleep_hook, - 0, - &tv)); - } - else - { - ACE_MT (result = this->token_.acquire_read (&polite_sleep_hook)); - } - - // Check for timeouts and errors. - if (result == -1) - { - if (errno == ETIME) - return 0; - else - { - ACE_ERROR ((LM_ERROR, "%t: %p\n", "token acquire_read")); - return -1; - } - } - - // We got the token and so let us mark ourselves as owner - this->owner_ = 1; - - return result; -} - -int -ACE_Dev_Poll_Reactor::Token_Guard::acquire (ACE_Time_Value *max_wait) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Token_Guard::acquire"); - - // Try to grab the token. If someone if already there, don't wake - // them up, just queue up in the thread pool. - int result = 0; - if (max_wait) - { - ACE_Time_Value tv = ACE_OS::gettimeofday (); - tv += *max_wait; - - ACE_MT (result = this->token_.acquire (0, 0, &tv)); - } - else - { - ACE_MT (result = this->token_.acquire ()); - } - - // Check for timeouts and errors. - if (result == -1) - { - if (errno == ETIME) - return 0; - else - return -1; - } - - // We got the token and so let us mark ourseleves as owner - this->owner_ = 1; - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ diff --git a/ace/Dev_Poll_Reactor.h b/ace/Dev_Poll_Reactor.h deleted file mode 100644 index 78b0949b7d3..00000000000 --- a/ace/Dev_Poll_Reactor.h +++ /dev/null @@ -1,1281 +0,0 @@ -// -*- C++ -*- - -// ========================================================================= -/** - * @file Dev_Poll_Reactor.h - * - * $Id$ - * - * @em Experimental @c /dev/poll (or Linux @c sys_epoll) based - * Reactor implementation. - * - * @author Ossama Othman - */ -// ========================================================================= - - -#ifndef ACE_DEV_POLL_REACTOR_H -#define ACE_DEV_POLL_REACTOR_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_EVENT_POLL) -// The sys_epoll interface was introduced in Linux kernel 2.5.45. -// Don't support backported versions since they appear to be buggy. -// The obsolete ioctl()-based interface is no longer supported. -#if 0 -// linux/version.h may not be accurate. It's not for Fedora Core 2... -# include /**/ -# if LINUX_VERSION_CODE < KERNEL_VERSION (2,5,45) -# undef ACE_HAS_EVENT_POLL -# error Disabling Linux epoll support. Kernel used in C library is too old. -# error Linux kernel 2.5.45 or better is required. -# endif /* LINUX_VERSION_CODE < KERNEL_VERSION (2,5,45) */ -#endif /* ACE_HAS_EVENT_POLL */ -#endif - -#if defined (ACE_HAS_EVENT_POLL) && defined (ACE_HAS_DEV_POLL) -# error ACE_HAS_EVENT_POLL and ACE_HAS_DEV_POLL are mutually exclusive. -#endif /* ACE_HAS_EVENT_POLL && defined ACE_HAS_DEV_POLL */ - - -#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) - -#include "ace/Pipe.h" -#include "ace/Lock_Adapter_T.h" -#include "ace/Reactor_Impl.h" -#include "ace/Reactor_Token_T.h" -#include "ace/Token.h" - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) -# include "ace/Unbounded_Queue.h" -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - -#if defined (ACE_HAS_DEV_POLL) -struct pollfd; -#elif defined (ACE_HAS_EVENT_POLL) -struct epoll_event; -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations -class ACE_Sig_Handler; -class ACE_Dev_Poll_Reactor; - -/** - * @class ACE_Dev_Poll_Event_Tuple - * - * @brief Class that associates specific event mask with a given event - * handler. - * - * This class merely provides a means to associate an event mask - * with an event handler. Such an association is needed since it is - * not possible to retrieve the event mask from the "interest set" - * stored in the `/dev/poll' or `/dev/epoll' driver. Without this - * external association, it would not be possible keep track of the - * event mask for a given event handler when suspending it or resuming - * it. - * - * @note An ACE_Handle_Set is not used since the number of handles may - * exceed its capacity (ACE_DEFAULT_SELECT_REACTOR_SIZE). - */ -class ACE_Dev_Poll_Event_Tuple -{ -public: - - /// Constructor. - ACE_Dev_Poll_Event_Tuple (void); - -public: - - /// The event handler. - ACE_Event_Handler *event_handler; - - /// The event mask for the above event handler. - ACE_Reactor_Mask mask; - - /// Flag that states whether or not the event handler is suspended. - char suspended; -}; - -// --------------------------------------------------------------------- - -#if 0 -/** - * @class ACE_Dev_Poll_Ready_Set - * - * @brief Class that contains the list of "ready" file descriptors. - * - * This class points to an array of pollfd structures corresponding to - * "ready" file descriptors, such as those corresponding to event - * handlers that request an additional callback after being initially - * dispatched (i.e. return a value greater than zero). - * @par - * The idea is to store the "ready" set in an existing area of memory - * that already contains pollfd instances. Doing so is safe since the - * "ready" set is dispatched before polling for additional events, - * thus avoiding being potentially overwritten during the event poll. - * @par - * When the "ready" set is dispatched, all that needs to be done is to - * iterate over the contents of the array. There is no need to "walk" - * the array in search of ready file descriptors since the array by - * design only contains ready file descriptors. As such, this - * implementation of a ready set is much more efficient in the - * presence of a large number of file descriptors in terms of both - * time and space than the one used in the Select_Reactor, for - * example. - */ -class ACE_Dev_Poll_Ready_Set -{ -public: - - /// Constructor. - ACE_Dev_Poll_Ready_Set (void); - -public: - - /// The array containing the pollfd structures corresponding to the - /// "ready" file descriptors. - struct pollfd *pfds; - - /// The number of "ready" file descriptors in the above array. - int nfds; - -}; -#endif /* 0 */ - -// --------------------------------------------------------------------- - -/** - * @class ACE_Dev_Poll_Reactor_Notify - * - * @brief Event handler used for unblocking the ACE_Dev_Poll_Reactor - * from its event loop. - * - * This event handler is used internally by the ACE_Dev_Poll_Reactor - * as a means to allow a thread other then the one running the event - * loop to unblock the event loop. - */ -class ACE_Dev_Poll_Reactor_Notify : public ACE_Reactor_Notify -{ -public: - - /// Constructor - ACE_Dev_Poll_Reactor_Notify (void); - - /** - * @name Initialization and Termination Methods - * - * Methods called when initializing and terminating this event - * handler. - */ - virtual int open (ACE_Reactor_Impl *, - ACE_Timer_Queue *timer_queue = 0, - int disable_notify = 0); - virtual int close (void); - - /** - * Called by a thread when it wants to unblock the Reactor_Impl. - * This wakes up the Reactor_Impl if currently blocked. Pass over - * both the Event_Handler and the mask to allow the caller to - * dictate which Event_Handler method the Reactor_Impl will - * invoke. The ACE_Time_Value indicates how long to block - * trying to notify the Reactor_Impl. If timeout == 0, the - * caller will block until action is possible, else will wait until - * the relative time specified in *timeout elapses). - */ - virtual int notify (ACE_Event_Handler *eh = 0, - ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value *timeout = 0); - - /// Unimplemented method required by pure virtual method in abstract - /// base class. - /** - * This method's interface is not very compatibile with this - * Reactor's design. It's not clear why this method is pure virtual - * either. - */ - virtual int dispatch_notifications (int &number_of_active_handles, - ACE_Handle_Set &rd_mask); - - /// Returns the ACE_HANDLE of the notify pipe on which the reactor - /// is listening for notifications so that other threads can unblock - /// the Reactor_Impl. - virtual ACE_HANDLE notify_handle (void); - - /// Verify whether the buffer has dispatchable info or not. - virtual int is_dispatchable (ACE_Notification_Buffer &buffer); - - /// Handle one notify call represented in @a buffer. This could be - /// because of a thread trying to unblock the Reactor_Impl. - virtual int dispatch_notify (ACE_Notification_Buffer &buffer); - - /// Read one notify call on the handle into @a buffer. - /// This could be because of a thread trying to unblock the Reactor_Impl. - virtual int read_notify_pipe (ACE_HANDLE handle, - ACE_Notification_Buffer &buffer); - - /// Called back by the ACE_Dev_Poll_Reactor when a thread wants to - /// unblock us. - virtual int handle_input (ACE_HANDLE handle); - - /** - * Set the maximum number of times that the handle_input method - * will iterate and dispatch the ACE_Event_Handlers that are - * passed in via the notify queue before breaking out of the event - * loop. By default, this is set to -1, which means "iterate until - * the queue is empty." Setting this to a value like "1 or 2" will - * increase "fairness" (and thus prevent starvation) at the expense - * of slightly higher dispatching overhead. - */ - virtual void max_notify_iterations (int); - - /** - * Get the maximum number of times that the handle_input method - * will iterate and dispatch the ACE_Event_Handlers that are - * passed in via the notify queue before breaking out of its event - * loop. - */ - virtual int max_notify_iterations (void); - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. Returns the number of notifications - * purged. Returns -1 on error. - */ - virtual int purge_pending_notifications ( - ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Dump the state of an object. - virtual void dump (void) const; - -protected: - - /** - * Keep a back pointer to the ACE_Dev_Poll_Reactor. If this value - * if NULL then the ACE_Dev_Poll_Reactor has been initialized with - * disable_notify_pipe. - */ - ACE_Dev_Poll_Reactor *dp_reactor_; - - /** - * Contains the ACE_HANDLE the ACE_Dev_Poll_Reactor is listening - * on, as well as the ACE_HANDLE that threads wanting the attention - * of the ACE_Dev_Poll_Reactor will write to. - */ - ACE_Pipe notification_pipe_; - - /** - * Keeps track of the maximum number of times that the - * ACE_Dev_Poll_Reactor_Notify::handle_input method will iterate and - * dispatch the ACE_Event_Handlers that are passed in via the - * notify pipe before breaking out of its recv loop. By default, - * this is set to -1, which means "iterate until the pipe is empty." - */ - int max_notify_iterations_; - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - /** - * @name Reactor Notification Attributes - * - * This configuration queues up notifications in separate buffers - * that are in user-space, rather than stored in a pipe in the OS - * kernel. The kernel-level notifications are used only to trigger - * the Reactor to check its notification queue. This enables many - * more notifications to be stored than would otherwise be the - * case. - */ - //@{ - - /// ACE_Notification_Buffers are allocated in chunks. Each time a chunk is - /// allocated, the chunk is added to alloc_queue_ so it can be freed later. - /// Each individual ACE_Notification_Buffer is added to the free_queue_ - /// when it's free. Those in use for queued notifications are placed on the - /// notify_queue_. - ACE_Unbounded_Queue alloc_queue_; - ACE_Unbounded_Queue notify_queue_; - ACE_Unbounded_Queue free_queue_; - - /// Synchronization for handling of queues. - ACE_SYNCH_MUTEX notify_queue_lock_; - - //@} -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - -}; - -// --------------------------------------------------------------------- - -/** - * @class ACE_Dev_Poll_Reactor_Handler_Repository - * - * @internal - - * @brief Used to map ACE_HANDLEs onto the appropriate - * ACE_Event_Handler *. - * - * - * This class is simply a container that maps a handle to its - * corresponding event handler. It is not meant for use outside of - * the Dev_Poll_Reactor. - */ -class ACE_Dev_Poll_Reactor_Handler_Repository -{ -public: - - /// Constructor. - ACE_Dev_Poll_Reactor_Handler_Repository (void); - - /// Initialize a repository of the appropriate . - int open (size_t size); - - /// Close down the repository. - int close (void); - - /** - * @name Repository Manipulation Operations - * - * Methods used to search and modify the handler repository. - */ - //@{ - - /** - * Return the @c ACE_Event_Handler associated with @c ACE_HANDLE. If - * @a index_p is non-zero, then return the index location of the - * handle, if found. - */ - ACE_Event_Handler *find (ACE_HANDLE handle, size_t *index_p = 0); - - /// Set the event mask for event handler associated with the given - /// handle. - void mask (ACE_HANDLE handle, ACE_Reactor_Mask mask); - - /// Retrieve the event mask for the event handler associated with - /// the given handle. - ACE_Reactor_Mask mask (ACE_HANDLE handle); - - /// Mark the event handler associated with the given handle as - /// "suspended." - void suspend (ACE_HANDLE handle); - - /// Mark the event handler associated with the given handle as - /// "resumed." - void resume (ACE_HANDLE handle); - - /// Is the event handler for the given handle suspended? - int suspended (ACE_HANDLE handle) const; - - /// Bind the ACE_Event_Handler to the @c ACE_HANDLE with the - /// appropriate ACE_Reactor_Mask settings. - int bind (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask); - - /// Remove the binding for @c ACE_HANDLE; optionally decrement the associated - /// handler's reference count. - int unbind (ACE_HANDLE handle, bool decr_refcnt = true); - - /// Remove all the (@c ACE_HANDLE, @c ACE_Event_Handler) tuples. - int unbind_all (void); - - /** - * @name Sanity Checking - * - * Methods used to prevent "out-of-range" errors when indexing the - * underlying handler array. - */ - //@{ - - // Check the @a handle to make sure it's a valid @c ACE_HANDLE that - // within the range of legal handles (i.e., greater than or equal to - // zero and less than @c max_size_). - int invalid_handle (ACE_HANDLE handle) const; - - // Check the handle to make sure it's a valid @c ACE_HANDLE that is - // within the range of currently registered handles (i.e., greater - // than or equal to zero and less than @c max_handlep1_). - int handle_in_range (ACE_HANDLE handle) const; - - //@} - - /// Returns the current table size. - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /// Maximum number of handles. - int max_size_; - - /// The underlying array of event handlers. - /** - * The array of event handlers is directly indexed directly using - * an @c ACE_HANDLE value. This is Unix-specific. - */ - ACE_Dev_Poll_Event_Tuple *handlers_; - -}; - -// --------------------------------------------------------------------- - -/** - * @class ACE_Dev_Poll_Reactor - * - * @brief A `/dev/poll' or `/dev/epoll' based Reactor implemenatation. - * - * @attention This reactor is @em experimental. - * - * The ACE_Dev_Poll_Reactor uses the `/dev/poll' or '/dev/epoll' - * character devices to demultiplex events on a given set of file - * descriptors. Unlike @c select(), `/dev/poll' and `/dev/epoll' have - * no hard-coded limit on the number of file descriptors that may be - * handled at any given time. As such, the ACE_Dev_Poll_Reactor can - * generally handle a much larger number of file descriptors than - * @c select() -based reactors. Furthermore, since `/dev/poll' and - * `/dev/epoll' both return a set of file descriptors that are active, - * there is no need to "walk" the set of file descriptors to determine - * which ones are active, such as what is done with the @c select() and - * @c poll() system calls. All returned file descriptors are active. - * This makes event dispatching very efficient. - * - * @note In general, this reactor may only be used to demultiplex - * events on sockets. Demultiplexing events on pipes, for - * example may not work. This is due to a limitation in the - * underlying `/dev/poll' device driver. - * - * @note It is only possible to achieve millisecond timeout - * resolutions with the @c ACE_Dev_Poll_Reactor. However, the - * timeout resolution for timers is independent of the reactors - * timeout resolution. As such, it may be possible to achieve - * sub-millisecond timeout resolutions for timers but that is - * entirely platform dependent. - */ - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -typedef ACE_Token ACE_DEV_POLL_TOKEN; -#else -typedef ACE_Noop_Token ACE_DEV_POLL_TOKEN; -#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ -typedef ACE_Reactor_Token_T ACE_Dev_Poll_Reactor_Token; - -class ACE_Export ACE_Dev_Poll_Reactor : public ACE_Reactor_Impl -{ -public: - - /// Initialize @c ACE_Dev_Poll_Reactor with the default size. - /** - * The default size for the @c ACE_Dev_Poll_Reactor is the maximum - * number of open file descriptors for the process. - */ - ACE_Dev_Poll_Reactor (ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify *notify = 0, - int mask_signals = 1, - int s_queue = ACE_DEV_POLL_TOKEN::FIFO); - - /// Initialize ACE_Dev_Poll_Reactor with size @a size. - /** - * @note On Unix platforms, the @a size parameter should be as large - * as the maximum number of file descriptors allowed for a - * given process. This is necessary since a file descriptor - * is used to directly index the array of event handlers - * maintained by the Reactor's handler repository. Direct - * indexing is used for efficiency reasons. If the size - * parameter is less than the process maximum, the process - * maximum will be decreased in order to prevent potential - * access violations. - */ - ACE_Dev_Poll_Reactor (size_t size, - int restart = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify *notify = 0, - int mask_signals = 1, - int s_queue = ACE_DEV_POLL_TOKEN::FIFO); - - /// Close down and release all resources. - virtual ~ACE_Dev_Poll_Reactor (void); - - /// Initialization. - virtual int open (size_t size, - int restart = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify * = 0); - - /** - * @param handle allows the reactor to check if the caller is - * valid. - * - * @return 0 if the size of the current message has been put in - * size. -1 if not. - */ - virtual int current_info (ACE_HANDLE handle, size_t & /* size */); - - /// Use a user specified signal handler instead. - virtual int set_sig_handler (ACE_Sig_Handler *signal_handler); - - /// Set a user-specified timer queue. - virtual int timer_queue (ACE_Timer_Queue *tq); - - /// Get the timer queue - /// @return The current @c ACE_Timer_Queue. - virtual ACE_Timer_Queue *timer_queue (void) const; - - /// Close down and release all resources. - virtual int close (void); - - // = Event loop drivers. - /** - * Returns non-zero if there are I/O events "ready" for dispatching, - * but does not actually dispatch the event handlers. By default, - * don't block while checking this, i.e., "poll". - * - * @note It is only possible to achieve millisecond timeout - * resolutions with the @c ACE_Dev_Poll_Reactor. - */ - virtual int work_pending ( - const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); - - /** - * This event loop driver blocks for up to @a max_wait_time before - * returning. It will return earlier if events occur. Note that - * @a max_wait_time can be 0, in which case this method blocks - * indefinitely until events occur. - * @par - * @a max_wait_time is decremented to reflect how much time this - * call took. For instance, if a time value of 3 seconds is passed - * to @c handle_events() and an event occurs after 2 seconds, - * @a max_wait_time will equal 1 second. This can be used if an - * application wishes to handle events for some fixed amount of - * time. - * @par - * The only difference between @c alertable_handle_events() and - * handle_events() is that in the alertable case, the event loop - * will return when the system queues an I/O completion routine or - * an Asynchronous Procedure Call. - * - * @return The total number of @c ACE_Event_Handlers that were - * dispatched, 0 if the @a max_wait_time elapsed without - * dispatching any handlers, or -1 if an error occurs. - - * @note It is only possible to achieve millisecond timeout - * resolutions with the @c ACE_Dev_Poll_Reactor. - */ - virtual int handle_events (ACE_Time_Value *max_wait_time = 0); - virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0); - - /** - * This method is just like the one above, except the - * @a max_wait_time value is a reference and can therefore never be - * @c NULL. - * - * @note It is only possible to achieve millisecond timeout - * resolutions with the @c ACE_Dev_Poll_Reactor. - */ - virtual int handle_events (ACE_Time_Value &max_wait_time); - virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); - - // = Event handling control. - - /** - * @return The status of Reactor. If this function returns 0, the - * reactor is actively handling events. If it returns - * non-zero, @c handle_events() and - * @c handle_alertable_events() return -1 immediately. - */ - virtual int deactivated (void); - - /** - * Control whether the Reactor will handle any more incoming events - * or not. If @a do_stop == 1, the Reactor will be disabled. By - * default, a reactor is in active state and can be - * deactivated/reactived as desired. - */ - virtual void deactivate (int do_stop); - - // = Register and remove Handlers. - - /// Register @a event_handler with @a mask. The I/O handle will - /// always come from get_handle on the event_handler. - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /// Register @a event_handler with @a mask. The I/O handle is - /// provided through the @a io_handle parameter. - virtual int register_handler (ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Register an @a event_handler that will be notified when - * @a event_handle is signaled. @a mask specifies the network - * events that the @a event_handler is interested in. - */ - virtual int register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /// Register @a event_handler> with all the @a handles> in the @c - /// Handle_Set. - virtual int register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Register @a new_sh to handle the signal @a signum using the - * @a new_disp. Returns the @a old_sh that was previously - * registered (if any), along with the @a old_disp of the signal - * handler. - */ - virtual int register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0, - ACE_Event_Handler **old_sh = 0, - ACE_Sig_Action *old_disp = 0); - - /// Registers to handle a set of signals using the - /// . - virtual int register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0); - - /// Removes @a event_handler. - /** - * @note The I/O handle will be obtained using @c get_handle() - * method of @a event_handler . If @a mask == - * @c ACE_Event_Handler::DONT_CALL then the @c handle_close() - * method of the @a event_handler is not invoked. - */ - virtual int remove_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Removes . If == - * then the method of the associated - * is not invoked. - */ - virtual int remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - /** - * Removes all handles in . If == - * then the method of - * the associated s is not invoked. - */ - virtual int remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask mask); - - /** - * Remove the ACE_Event_Handler currently associated with . - * Install the new disposition (if given) and return the previous - * disposition (if desired by the caller). Returns 0 on success and - * -1 if is invalid. - */ - virtual int remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp = 0, - int sigkey = -1); - - /// Calls for every signal in . - virtual int remove_handler (const ACE_Sig_Set &sigset); - - // = Suspend and resume Handlers. - - /// Suspend event_handler temporarily. Use - /// ACE_Event_Handler::get_handle() to get the handle. - virtual int suspend_handler (ACE_Event_Handler *event_handler); - - /// Suspend handle temporarily. - virtual int suspend_handler (ACE_HANDLE handle); - - /// Suspend all handles in handle set temporarily. - virtual int suspend_handler (const ACE_Handle_Set &handles); - - /// Suspend all handles temporarily. - virtual int suspend_handlers (void); - - /// Resume event_handler. Use ACE_Event_Handler::get_handle() to - /// get the handle. - virtual int resume_handler (ACE_Event_Handler *event_handler); - - /// Resume handle. - virtual int resume_handler (ACE_HANDLE handle); - - /// Resume all handles in handle set. - virtual int resume_handler (const ACE_Handle_Set &handles); - - /// Resume all handles. - virtual int resume_handlers (void); - - /// Does the reactor allow the application to resume the handle on - /// its own, i.e., can it pass on the control of handle resumption to - /// the application. - virtual int resumable_handler (void); - - /// Return 1 if we any event associations were made by the reactor - /// for the handles that it waits on, 0 otherwise. - virtual int uses_event_associations (void); - - // = Timer management. - - /** - * Schedule an ACE_Event_Handler that will expire after an amount - * of time. The return value of this method, a timer_id value, - * uniquely identifies the event_handler in the ACE_Reactor's - * internal list of timers. - * This timer_id value can be used to cancel the timer - * with the cancel_timer() call. - * - * @see cancel_timer() - * @see reset_timer_interval() - * - * @param event_handler event handler to schedule on reactor - * @param arg argument passed to the handle_timeout() method of - * event_handler. - * @param delay time interval after which the timer will expire. - * @param interval time interval for which the timer will be - * automatically rescheduled. - * @return -1 on failure, a timer_id value on success - */ - virtual long schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - - /** - * Resets the interval of the timer represented by to - * , which is specified in relative time to the current - * . If is equal to - * , the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_timer_interval (long timer_id, - const ACE_Time_Value &interval); - - /// Cancel all Event_Handlers that match the address of - /// . Returns number of handlers cancelled. - virtual int cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close = 1); - - /** - * Cancel the single event handler that matches the @a timer_id value - * (which was returned from the schedule method). If @a arg is - * non-NULL then it will be set to point to the ``magic cookie'' - * argument passed in when the event handler was registered. This - * makes it possible to free up the memory and avoid memory leaks. - * Returns 1 if cancellation succeeded and 0 if the @a timer_id - * wasn't found. - */ - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1); - - // = High-level event handler scheduling operations - - /// Add to the 's entry. - /// must already have been registered. - virtual int schedule_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_added); - - /// Add to the 's entry. - /// associated with must already have been registered. - virtual int schedule_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_added); - - /// Clear from the 's entry. - virtual int cancel_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_cleared); - - /// Clear from the 's entry. - virtual int cancel_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_cleared); - - // = Notification methods. - - /** - * Notify of event. The - * indicates how long to blocking trying to notify. If == - * 0, the caller will block until action is possible, else will wait - * until the relative time specified in elapses). - */ - virtual int notify (ACE_Event_Handler *event_handler = 0, - ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value * = 0); - - /** - * Set the maximum number of times that ACE_Reactor_Impl will - * iterate and dispatch the that are passed in - * via the notify queue before breaking out of its - * loop. By default, this is set to - * -1, which means "iterate until the queue is empty." Setting this - * to a value like "1 or 2" will increase "fairness" (and thus - * prevent starvation) at the expense of slightly higher dispatching - * overhead. - */ - virtual void max_notify_iterations (int); - - /** - * Get the maximum number of times that the ACE_Reactor_Impl will - * iterate and dispatch the that are passed in - * via the notify queue before breaking out of its - * loop. - */ - virtual int max_notify_iterations (void); - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. Returns the number of notifications - * purged. Returns -1 on error. - */ - virtual int purge_pending_notifications (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /** - * Return the Event_Handler associated with . Return 0 if - * is not registered. - */ - virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle); - - /** - * Check to see if is associated with a valid Event_Handler - * bound to . Return the associated with this - * if != 0. - */ - virtual int handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler = 0); - - /** - * Check to see if is associated with a valid Event_Handler - * bound to a signal. Return the associated with - * this if != 0. - */ - virtual int handler (int signum, - ACE_Event_Handler ** = 0); - - /// Returns true if Reactor has been successfully initialized, else - /// false. - virtual int initialized (void); - - /// Returns the current size of the Reactor's internal descriptor - /// table. - virtual size_t size (void) const; - - /// Returns a reference to the Reactor's internal lock. - virtual ACE_Lock &lock (void); - - /// Wake up all threads waiting in the event loop. - virtual void wakeup_all_threads (void); - - /// Transfers ownership of Reactor_Impl to the new_owner. - /** - * @note There is no need to set the owner of the event loop for the - * ACE_Dev_Poll_Reactor. Multiple threads may invoke the - * event loop simulataneously. As such, this method is a - * no-op. - */ - virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0); - - /// Return the ID of the "owner" thread. - /** - * @note There is no need to set the owner of the event loop for the - * ACE_Dev_Poll_Reactor. Multiple threads may invoke the - * event loop simulataneously. As such, this method is a - * no-op. - */ - virtual int owner (ACE_thread_t *owner); - - /// Get the existing restart value. - virtual int restart (void); - - /// Set a new value for restart and return the original value. - /** - * @param r If zero, then the event loop will not be automatically - * restarted if the underlying poll is interrupted via the - * INTR (interrupt) signal. - * - * @return Returns the previous "restart" value. - */ - virtual int restart (int r); - - /// Set position of the owner thread. - /** - * @note This is currently a no-op. - */ - virtual void requeue_position (int); - - /// Get position of the owner thread. - /** - * @note This is currently a no-op. - */ - virtual int requeue_position (void); - - /** - * @name Low-level wait_set mask manipulation methods - * - * Low-level methods to manipulate the event/reactor mask associated - * with a handle and event handler when polling for events. - * @par - * The "interest set," i.e. the wait set, can be directly - * manipulated with these methods. - */ - //@{ - - /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the - /// event_handler and mask. - /** - * @return Old mask on success, -1 on error. - */ - virtual int mask_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops); - - /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the handle - /// and mask. - /** - * @return Old mask on success, -1 on error. - */ - virtual int mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops); - - //@} - - /** - * @name Low-level ready_set mask manipulation methods - * - * These methods are unimplemented. - */ - //@{ - - /// GET/SET/ADD/CLR the ready "bit" bound with the event_handler - /// and mask. - virtual int ready_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops); - - /// GET/SET/ADD/CLR the ready "bit" bound with the handle and mask. - virtual int ready_ops (ACE_HANDLE handle, - ACE_Reactor_Mask, - int ops); - - //@} - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - class Token_Guard; - - /// Non-locking version of wait_pending(). - /** - * Returns non-zero if there are I/O events "ready" for dispatching, - * but does not actually dispatch the event handlers. By default, - * don't block while checking this, i.e., "poll". - * - * @note It is only possible to achieve millisecond timeout - * resolutions with the ACE_Dev_Poll_Reactor. - */ - int work_pending_i (ACE_Time_Value *max_wait_time); - - /// Poll for events and return the number of event handlers that - /// were dispatched. - /** - * This is a helper method called by all handle_events() methods. - */ - int handle_events_i (ACE_Time_Value *max_wait_time, Token_Guard &guard); - - /// Perform the upcall with the given event handler method. - int upcall (ACE_Event_Handler *event_handler, - int (ACE_Event_Handler::*callback)(ACE_HANDLE), - ACE_HANDLE handle); - - /** - * Dispatch ACE_Event_Handlers for time events, I/O events, and - * signal events. Returns the total number of ACE_Event_Handlers - * that were dispatched or -1 if something goes wrong. - */ - int dispatch (Token_Guard &guard); - - /// Dispatch a single timer, if ready. - /// Returns: 0 if no timers ready (token still held), - /// 1 if a timer was expired (token released), - /// -1 on error (token still held). - int dispatch_timer_handler (Token_Guard &guard); - - /// Dispatch an IO event to the corresponding event handler. Returns - /// Returns: 0 if no events ready (token still held), - /// 1 if an event was expired (token released), - /// -1 on error (token still held). - int dispatch_io_event (Token_Guard &guard); - - /// Register the given event handler with the reactor. - int register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /// Remove the event handler associated with the given handle and - /// event mask from the "interest set." - int remove_handler_i (ACE_HANDLE handle, ACE_Reactor_Mask mask); - - /// Temporarily remove the given handle from the "interest set." - int suspend_handler_i (ACE_HANDLE handle); - - /// Place the given handle that was temporarily removed from the - /// "interest set," i.e that was suspended, back in to the interest - /// set. The given handle will once again be polled for events. - int resume_handler_i (ACE_HANDLE handle); - - /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the handle - /// and mask. This internal helper method acquires no lock. - /** - * @return Old mask on success, -1 on error. - */ - int mask_ops_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops); - - /// Convert a reactor mask to its corresponding poll() event mask. - short reactor_mask_to_poll_event (ACE_Reactor_Mask mask); - -protected: - - /// Has the reactor been initialized. - bool initialized_; - - /// The file descriptor associated with the open `/dev/poll' or - /// `/dev/epoll' device. - /** - * All interactions with the `/dev/poll' or `/dev/epoll' device are - * done through this file descriptor. - */ - ACE_HANDLE poll_fd_; - - /// The maximum number of file descriptors over which demultiplexing - /// will occur. - size_t size_; - - /// Track HANDLES we are interested in for various events that must - /// be dispatched *without* polling. - /// ACE_Dev_Poll_Ready_Set ready_set_; - -#if defined (ACE_HAS_EVENT_POLL) - /// Table of event structures to be filled by epoll_wait: - struct epoll_event *events_; - - /// Pointer to the next epoll_event array element that contains the next - /// event to be dispatched. - struct epoll_event *start_pevents_; - - /// The last element in the event array plus one. - /** - * The loop that dispatches IO events stops when this->start_pevents_ == - * this->end_pevents_. - */ - struct epoll_event *end_pevents_; - -#else - /// The pollfd array that `/dev/poll' will feed its results to. - struct pollfd *dp_fds_; - - - /// Pointer to the next pollfd array element that contains the next - /// event to be dispatched. - struct pollfd *start_pfds_; - - /// The last element in the pollfd array plus one. - /** - * The loop that dispatches IO events stops when this->start_pfds == - * this->end_pfds_. - */ - struct pollfd *end_pfds_; -#endif /* ACE_HAS_EVENT_POLL */ - - /// This flag is used to keep track of whether we are actively handling - /// events or not. - sig_atomic_t deactivated_; - - /// Lock used for synchronization of reactor state. - ACE_Dev_Poll_Reactor_Token token_; - - /// Adapter used to return internal lock to outside world. - ACE_Lock_Adapter lock_adapter_; - - /// The repository that contains all registered event handlers. - ACE_Dev_Poll_Reactor_Handler_Repository handler_rep_; - - /// Defined as a pointer to allow overriding by derived classes... - ACE_Timer_Queue *timer_queue_; - - /// Keeps track of whether we should delete the timer queue (if we - /// didn't create it, then we don't delete it). - int delete_timer_queue_; - - /// Handle signals without requiring global/static variables. - ACE_Sig_Handler *signal_handler_; - - /// Keeps track of whether we should delete the signal handler (if we - /// didn't create it, then we don't delete it). - int delete_signal_handler_; - - /// Callback object that unblocks the if it's - /// sleeping. - ACE_Reactor_Notify *notify_handler_; - - /// Keeps track of whether we need to delete the notify handler (if - /// we didn't create it, then we don't delete it). - int delete_notify_handler_; - - /// Flag that determines if signals are masked during event - /// dispatching. - /** - * If 0 then the Reactor will not mask the signals during the event - * dispatching. This is useful for applications that do not - * register any signal handlers and want to reduce the overhead - * introduce by the kernel level locks required to change the mask. - */ - int mask_signals_; - - /// Restart the handle_events event loop method automatically when - /// polling function in use (ioctl() in this case) is interrupted - /// via an EINTR signal. - int restart_; - -protected: - - /** - * @class Token_Guard - * - * @brief A helper class that helps grabbing, releasing and waiting - * on tokens for a thread that needs access to the reactor's token. - */ - class Token_Guard - { - public: - - /// Constructor that will grab the token for us - Token_Guard (ACE_Dev_Poll_Reactor_Token &token); - - /// Destructor. This will release the token if it hasn't been - /// released till this point - ~Token_Guard (void); - - /// Release the token .. - void release_token (void); - - /// Returns whether the thread that created this object owns the - /// token or not. - int is_owner (void); - - /// A helper method that acquires the token 1) at a low priority, and - /// 2) wait quietly for the token, not waking another thread. This - /// is appropriate for cases where a thread wants to wait for and - /// dispatch an event, not causing an existing waiter to relinquish the - /// token, and also queueing up behind other threads waiting to modify - /// event records. - int acquire_quietly (ACE_Time_Value *max_wait = 0); - - /// A helper method that acquires the token at a high priority, and - /// does wake the current token holder. - int acquire (ACE_Time_Value *max_wait = 0); - - private: - - Token_Guard (void); - - private: - - /// The Reactor token. - ACE_Dev_Poll_Reactor_Token &token_; - - /// Flag that indicate whether the thread that created this object - /// owns the token or not. A value of 0 indicates that this class - /// hasn't got the token (and hence the thread) and a value of 1 - /// vice-versa. - int owner_; - - }; - -}; - - -/** - * @class ACE_Dev_Poll_Handler_Guard - * - * @brief Class used to make event handler reference count - * manipulation exception-safe. - * - * This class makes the reference count manipulation that occurs - * during an upcall exception-safe. Prior to dispatching the event - * handler, the reference count is increased. Once the upcall for the - * given event handler is complete, its reference count will be decreased. - */ -class ACE_Dev_Poll_Handler_Guard -{ -public: - - /// Constructor - /** - * The constructor checks to see if @a eh is a reference-counted handler and - * remember that for later. If @a eh is reference counted, its reference - * count is incremented unless @a do_incr is false. - * @a do_incr should be false if the reference count was incremented - * independently of this guard, for example, on a notify handler since - * the reference count is incremented when the notify is queued. - */ - ACE_Dev_Poll_Handler_Guard (ACE_Event_Handler *eh, bool do_incr = true); - - /// Destructor - /** - * The destructor decrements the reference count on the event - * handler corresponding to the given handle. - */ - ~ACE_Dev_Poll_Handler_Guard (void); - - /// Release the event handler from this guard; when the destructor is - /// called, the handler's reference count will not be decremented. - void release (void); - -private: - - /// The event handler being managed. - ACE_Event_Handler *eh_; - - /// true if eh_ is a reference-counted handler. - bool refcounted_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/Dev_Poll_Reactor.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ - -#include /**/ "ace/post.h" - -#endif /* ACE_DEV_POLL_REACTOR_H */ diff --git a/ace/Dev_Poll_Reactor.inl b/ace/Dev_Poll_Reactor.inl deleted file mode 100644 index b7034e07333..00000000000 --- a/ace/Dev_Poll_Reactor.inl +++ /dev/null @@ -1,228 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Dev_Poll_Event_Tuple::ACE_Dev_Poll_Event_Tuple (void) - : event_handler (0), - mask (ACE_Event_Handler::NULL_MASK), - suspended (0) -{ -} - -// --------------------------------------------------------------------- - -#if 0 -ACE_INLINE -ACE_Dev_Poll_Ready_Set::ACE_Dev_Poll_Ready_Set (void) - : pfds (0), - nfds (0) -{ -} -#endif /* 0 */ - -// --------------------------------------------------------------------- - -ACE_INLINE void -ACE_Dev_Poll_Reactor_Handler_Repository::mask (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::mask"); - - // Only bother to search for the handle if it's in range. - if (this->handle_in_range (handle)) - this->handlers_[handle].mask = mask; -} - -ACE_INLINE ACE_Reactor_Mask -ACE_Dev_Poll_Reactor_Handler_Repository::mask (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::mask"); - - ACE_Reactor_Mask mask = ACE_Event_Handler::NULL_MASK; - - // Only bother to search for the handle if it's in range. - if (this->handle_in_range (handle)) - mask = this->handlers_[handle].mask; - - if (mask == ACE_Event_Handler::NULL_MASK) - errno = ENOENT; - - return mask; -} - -ACE_INLINE void -ACE_Dev_Poll_Reactor_Handler_Repository::suspend (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::suspend"); - - // Only bother to search for the handle if it's in range. - if (this->handle_in_range (handle)) - this->handlers_[handle].suspended = 1; -} - -ACE_INLINE void -ACE_Dev_Poll_Reactor_Handler_Repository::resume (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::resume"); - - // Only bother to search for the handle if it's in range. - if (this->handle_in_range (handle)) - this->handlers_[handle].suspended = 0; -} - -ACE_INLINE int -ACE_Dev_Poll_Reactor_Handler_Repository::suspended (ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::suspended"); - - if (this->handle_in_range (handle)) - return this->handlers_[handle].suspended; - - return -1; -} - -ACE_INLINE size_t -ACE_Dev_Poll_Reactor_Handler_Repository::size (void) const -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::size"); - - return this->max_size_; -} - -// ----------------------------------------------------------------- - -ACE_INLINE -ACE_Dev_Poll_Handler_Guard::ACE_Dev_Poll_Handler_Guard - (ACE_Event_Handler *eh, - bool do_incr) - : eh_ (eh), - refcounted_ (false) -{ - if (eh == 0) - return; - - this->refcounted_ = - eh->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (do_incr && this->refcounted_) - eh->add_reference (); - - /** - * The below comments were here when I replaced the old refcount - * scheme was replaced. They may still need addressing. -Steve Huston - */ - - /** - * @todo Suspend the handler so that other threads will not cause - * an event that is already in an upcall from being dispatched - * again. - * - * @note The naive approach would be to simply call - * suspend_handler_i() on the reactor. However, that would - * cause a system call (write()) to occur. Obviously this - * can potentially have an adverse affect on performance. - * Ideally, the handler would only be marked as "suspended" in - * the handler repository. If an event arrives for a - * suspended handler that event can be "queued" in a - * "handle readiness queue." "Queued" is quoted since a real - * queue need not be used since duplicate events can be - * coalesced, thus avoiding unbounded queue growth. Event - * coalescing is already done by Linux's event poll driver - * (/dev/epoll) so Solaris' poll driver (/dev/poll) is the - * main concern here. The largest the queue can be is the - * same size as the number of handlers stored in the handler - * repository. - */ -} - -ACE_INLINE -ACE_Dev_Poll_Handler_Guard::~ACE_Dev_Poll_Handler_Guard (void) -{ - if (this->refcounted_ && this->eh_ != 0) - this->eh_->remove_reference (); - - /** - * The below comments were here when I replaced the old refcount - * scheme was replaced. They may still need addressing. -Steve Huston - */ - /** - * @todo Resume the handler so that other threads will be allowed to - * dispatch the handler. - */ -} - -ACE_INLINE void -ACE_Dev_Poll_Handler_Guard::release (void) -{ - this->eh_ = 0; -} - -// --------------------------------------------------------------------- - -ACE_INLINE int -ACE_Dev_Poll_Reactor::upcall (ACE_Event_Handler *event_handler, - int (ACE_Event_Handler::*callback)(ACE_HANDLE), - ACE_HANDLE handle) -{ - // If the handler returns positive value (requesting a reactor - // callback) just call back as many times as the handler requests - // it. Other threads are off handling other things. - int status = 0; - - do - { - status = (event_handler->*callback) (handle); - } - while (status > 0); - - return status; -} - - -/************************************************************************/ -// Methods for ACE_Dev_Poll_Reactor::Token_Guard -/************************************************************************/ - -ACE_INLINE -ACE_Dev_Poll_Reactor::Token_Guard::Token_Guard (ACE_Dev_Poll_Reactor_Token &token) - - : token_ (token), - owner_ (0) -{ -} - -ACE_INLINE -ACE_Dev_Poll_Reactor::Token_Guard::~Token_Guard (void) -{ - if (this->owner_ == 1) - { - ACE_MT (this->token_.release ()); - this->owner_ = 0; - } -} - -ACE_INLINE void -ACE_Dev_Poll_Reactor::Token_Guard::release_token (void) -{ - if (this->owner_) - { - ACE_MT (this->token_.release ()); - - // We are not the owner anymore.. - this->owner_ = 0; - } -} - -ACE_INLINE int -ACE_Dev_Poll_Reactor::Token_Guard::is_owner (void) -{ - return this->owner_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dirent.cpp b/ace/Dirent.cpp deleted file mode 100644 index 50aab1ac5f3..00000000000 --- a/ace/Dirent.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// $Id$ - -#include "ace/Dirent.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Dirent.inl" -#endif /* __ACE_INLINE__ */ diff --git a/ace/Dirent.h b/ace/Dirent.h deleted file mode 100644 index c31f8cc20cb..00000000000 --- a/ace/Dirent.h +++ /dev/null @@ -1,122 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dirent.h - * - * $Id$ - * - * Define a portable C++ interface to ACE_OS_Dirent directory-entry - * manipulation. - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DIRENT_H -#define ACE_DIRENT_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_dirent.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dirent - * - * @brief Define a portable C++ directory-entry iterator based on the POSIX API. - */ -class ACE_Export ACE_Dirent -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_Dirent (void); - - /// Constructor calls - explicit ACE_Dirent (const ACE_TCHAR *dirname); - - /// Opens the directory named by filename and associates a directory - /// stream with it. - int open (const ACE_TCHAR *filename); - - /// Destructor calls . - ~ACE_Dirent (void); - - /// Closes the directory stream and frees the structure. - void close (void); - - // = Iterator methods. - /** - * Returns a pointer to a structure representing the directory entry - * at the current position in the directory stream to which dirp - * refers, and positions the directory stream at the next entry, - * except on read-only filesystems. It returns a NULL pointer upon - * reaching the end of the directory stream, or upon detecting an - * invalid location in the directory. shall not return - * directory entries containing empty names. It is unspecified - * whether entries are returned for dot or dot-dot. The pointer - * returned by points to data that may be overwritten by - * another call to on the same directory stream. This - * data shall not be overwritten by another call to on a - * different directory stream. may buffer several - * directory entries per actual read operation; marks for - * update the st_atime field of the directory each time the - * directory is actually read. - */ - ACE_DIRENT *read (void); - - /** - * Has the equivalent functionality as except that an - * and buffer must be supplied by the caller to - * store the result. - */ - int read (struct ACE_DIRENT *entry, - struct ACE_DIRENT **result); - - // = Manipulators. - /// Returns the current location associated with the directory - /// stream. - long tell (void); - - /** - * Sets the position of the next operation on the - * directory stream. The new position reverts to the position - * associated with the directory stream at the time the - * operation that provides loc was performed. Values returned by - * are good only for the lifetime of the pointer from - * which they are derived. If the directory is closed and then - * reopened, the value may be invalidated due to - * undetected directory compaction. It is safe to use a previous - * value immediately after a call to and before - * any calls to readdir. - */ - void seek (long loc); - - /** - * Resets the position of the directory stream to the beginning of - * the directory. It also causes the directory stream to refer to - * the current state of the corresponding directory, as a call to - * would. - */ - void rewind (void); - -private: - /// Pointer to the directory stream. - ACE_DIR *dirp_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Dirent.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DIRENT_H */ diff --git a/ace/Dirent.inl b/ace/Dirent.inl deleted file mode 100644 index 0a8f0b9e6e4..00000000000 --- a/ace/Dirent.inl +++ /dev/null @@ -1,99 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Dirent::open (const ACE_TCHAR *dirname) -{ - // If the directory stream is already open, close it to prevent - // possible resource leaks. - - if (this->dirp_ != 0) - { - ACE_OS::closedir (this->dirp_); - this->dirp_ = 0; - } - - this->dirp_ = ACE_OS::opendir (dirname); - - if (this->dirp_ == 0) - return -1; - else - return 0; -} - -ACE_INLINE -ACE_Dirent::ACE_Dirent (void) - : dirp_ (0) -{ -} - -ACE_INLINE -ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname) - : dirp_ (0) -{ - if (this->open (dirname) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Dirent::ACE_Dirent"))); -} - -ACE_INLINE -ACE_Dirent::~ACE_Dirent (void) -{ - if (this->dirp_ != 0) - ACE_OS::closedir (this->dirp_); -} - -ACE_INLINE ACE_DIRENT * -ACE_Dirent::read (void) -{ - return this->dirp_ ? ACE_OS::readdir (this->dirp_) : 0; -} - -ACE_INLINE int -ACE_Dirent::read (struct ACE_DIRENT *entry, - struct ACE_DIRENT **result) -{ - return this->dirp_ - ? ACE_OS::readdir_r (this->dirp_, entry, result) - : 0; -} - -ACE_INLINE void -ACE_Dirent::close (void) -{ - if (this->dirp_ != 0) - { - ACE_OS::closedir (this->dirp_); - - // Prevent double closure - this->dirp_ = 0; - } -} - -ACE_INLINE void -ACE_Dirent::rewind (void) -{ - if (this->dirp_) - ACE_OS::rewinddir (this->dirp_); -} - -ACE_INLINE void -ACE_Dirent::seek (long loc) -{ - if (this->dirp_) - ACE_OS::seekdir (this->dirp_, loc); -} - -ACE_INLINE long -ACE_Dirent::tell (void) -{ - return this->dirp_ ? ACE_OS::telldir (this->dirp_) : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dirent_Selector.cpp b/ace/Dirent_Selector.cpp deleted file mode 100644 index 288fc6deacf..00000000000 --- a/ace/Dirent_Selector.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// $Id$ - -#include "ace/Dirent_Selector.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Dirent_Selector.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/OS_NS_dirent.h" -#include "ace/OS_NS_stdlib.h" - -ACE_RCSID (ace, - Dirent_Selector, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Construction/Destruction - -ACE_Dirent_Selector::ACE_Dirent_Selector (void) - : namelist_ (0), - n_ (0) -{ -} - -ACE_Dirent_Selector::~ACE_Dirent_Selector (void) -{ - // Free up any allocated resources. - this->close(); -} - -int -ACE_Dirent_Selector::open (const ACE_TCHAR *dir, - ACE_SCANDIR_SELECTOR sel, - ACE_SCANDIR_COMPARATOR cmp) -{ - n_ = ACE_OS::scandir (dir, &this->namelist_, sel, cmp); - return n_; -} - -int -ACE_Dirent_Selector::close (void) -{ - for (--n_; n_ >= 0; --n_) - { -#if defined (ACE_LACKS_STRUCT_DIR) - // Only the lacking-struct-dir emulation allocates this. Native - // scandir includes d_name in the dirent struct itself. - ACE_OS::free (this->namelist_[n_]->d_name); -#endif - ACE_OS::free (this->namelist_[n_]); - } - - ACE_OS::free (this->namelist_); - this->namelist_ = 0; - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dirent_Selector.h b/ace/Dirent_Selector.h deleted file mode 100644 index 1f4fda60f0b..00000000000 --- a/ace/Dirent_Selector.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dirent_Selector.h - * - * $Id$ - * - * Define a portable C++ interface to the method. - * - * @author Rich Newman - */ -//============================================================================= - -#ifndef ACE_DIRENT_SELECTOR_H -#define ACE_DIRENT_SELECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_dirent.h" /* Need ACE_SCANDIR_SELECTOR, COMPARATOR */ -#include "ace/os_include/os_dirent.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dirent_Selector - * - * @brief Define a portable C++ directory-entry iterator based on the - * POSIX scandir API. - */ -class ACE_Export ACE_Dirent_Selector -{ -public: - /// Constructor - ACE_Dirent_Selector (void); - - /// Destructor. - virtual ~ACE_Dirent_Selector (void); - - /// Return the length of the list of matching directory entries. - int length (void) const; - - /// Return the entry at @a index. - ACE_DIRENT *operator[] (const int index) const; - - /// Free up resources. - int close (void); - - /// Open the directory @a dir and populate the current list of names with - /// directory entries that match the @a selector and @a comparator. - int open (const ACE_TCHAR *dir, - ACE_SCANDIR_SELECTOR selector = 0, - ACE_SCANDIR_COMPARATOR comparator = 0); - -protected: - /// Ptr to the namelist array. - ACE_DIRENT **namelist_; - - /// Number of entries in the array. - int n_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Dirent_Selector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DIRENT_SELECTOR_H */ diff --git a/ace/Dirent_Selector.inl b/ace/Dirent_Selector.inl deleted file mode 100644 index 7c42f46b9be..00000000000 --- a/ace/Dirent_Selector.inl +++ /dev/null @@ -1,19 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Dirent_Selector::length (void) const -{ - return n_; -} - -ACE_INLINE ACE_DIRENT * -ACE_Dirent_Selector::operator[] (const int n) const -{ - return this->namelist_[n]; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dump.cpp b/ace/Dump.cpp deleted file mode 100644 index b601496f3b6..00000000000 --- a/ace/Dump.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// $Id$ - -#include "ace/Dump.h" -#include "ace/Guard_T.h" -#include "ace/Thread_Mutex.h" -#include "ace/Object_Manager.h" -#include "ace/Log_Msg.h" - -ACE_RCSID(ace, Dump, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Implementations (very simple for now...) - -ACE_Dumpable::~ACE_Dumpable (void) -{ - ACE_TRACE ("ACE_Dumpable::~ACE_Dumpable"); -} - -ACE_Dumpable::ACE_Dumpable (const void *this_ptr) - : this_ (this_ptr) -{ - ACE_TRACE ("ACE_Dumpable::ACE_Dumpable"); -} - -ACE_Dumpable_Ptr::ACE_Dumpable_Ptr (const ACE_Dumpable *dumper) - : dumper_ (dumper) -{ - ACE_TRACE ("ACE_Dumpable_Ptr::ACE_Dumpable_Ptr"); -} - -const ACE_Dumpable * -ACE_Dumpable_Ptr::operator->() const -{ - ACE_TRACE ("ACE_Dumpable_Ptr::operator->"); - return this->dumper_; -} - -void -ACE_Dumpable_Ptr::operator= (const ACE_Dumpable *dumper) const -{ - ACE_TRACE ("ACE_Dumpable_Ptr::operator="); - if (this->dumper_ != dumper) - { - delete const_cast (this->dumper_); - (const_cast (this))->dumper_ = dumper; - } -} - -ACE_ODB::ACE_ODB (void) - // Let the Tuple default constructor initialize object_table_ - : current_size_ (0) -{ - ACE_TRACE ("ACE_ODB::ACE_ODB"); -} - -ACE_ODB * -ACE_ODB::instance (void) -{ - ACE_TRACE ("ACE_ODB::instance"); - - if (ACE_ODB::instance_ == 0) - { - ACE_MT (ACE_Thread_Mutex *lock = - ACE_Managed_Object::get_preallocated_object - (ACE_Object_Manager::ACE_DUMP_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0)); - - if (ACE_ODB::instance_ == 0) - ACE_NEW_RETURN (ACE_ODB::instance_, - ACE_ODB, - 0); - } - - return ACE_ODB::instance_; -} - -void -ACE_ODB::dump_objects (void) -{ - ACE_TRACE ("ACE_ODB::dump_objects"); - for (int i = 0; i < this->current_size_; i++) - { - if (this->object_table_[i].this_ != 0) - // Dump the state of the object. - this->object_table_[i].dumper_->dump (); - } -} - -// This method registers a new . It detects -// duplicates and simply overwrites them. - -void -ACE_ODB::register_object (const ACE_Dumpable *dumper) -{ - ACE_TRACE ("ACE_ODB::register_object"); - int i; - int slot = 0; - - for (i = 0; i < this->current_size_; i++) - { - if (this->object_table_[i].this_ == 0) - slot = i; - else if (this->object_table_[i].this_ == dumper->this_) - { - slot = i; - break; - } - } - - if (i == this->current_size_) - { - slot = this->current_size_++; - ACE_ASSERT (this->current_size_ < ACE_ODB::MAX_TABLE_SIZE); - } - this->object_table_[slot].this_ = dumper->this_; - this->object_table_[slot].dumper_ = dumper; -} - -void -ACE_ODB::remove_object (const void *this_ptr) -{ - ACE_TRACE ("ACE_ODB::remove_object"); - int i; - - for (i = 0; i < this->current_size_; i++) - { - if (this->object_table_[i].this_ == this_ptr) - break; - } - - if (i < this->current_size_) - { - this->object_table_[i].this_ = 0; - this->object_table_[i].dumper_ = 0; - } -} - -ACE_ODB *ACE_ODB::instance_ = 0; - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dump.h b/ace/Dump.h deleted file mode 100644 index 7c792f0db66..00000000000 --- a/ace/Dump.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Dump.h - * - * $Id$ - * - * - * A prototype mechanism that allow all ACE objects to be registered - * with a central in-memory "database" that can dump the state of all - * live ACE objects (e.g., from within a debugger). - * - * The macros which allow easy registration and removal of objects to be - * dumped (ACE_REGISTER_OBJECT and ACE_REMOVE_OBJECT) are turned into - * no-ops by compiling with the ACE_NDEBUG macro defined. This allows - * usage to be removed in "release mode" builds without changing code. - * - * There are several interesting aspects to this design: - * - * 1. It uses the External Polymorphism pattern to avoid having to - * derive all ACE classes from a common base class that has virtual - * methods (this is crucial to avoid unnecessary overhead). In - * addition, there is no additional space added to ACE objects - * (this is crucial to maintain binary layout compatibility). - * - * 2. This mechanism can be conditionally compiled in order to - * completely disable this feature entirely. Moreover, by - * using macros there are relatively few changes to ACE code. - * - * 3. This mechanism copes with single-inheritance hierarchies of - * dumpable classes. In such cases we typically want only one - * dump, corresponding to the most derived instance. Thanks to - * Christian Millour (chris@etca.fr) for illustrating how to do - * this. Note, however, that this scheme doesn't generalize to - * work with multiple-inheritance or virtual base classes. - * - * Future work includes: - * - * 1. Using a dynamic object table rather than a static table - * - * 2. Adding support to allow particular classes of objects to - * be selectively dumped. - * - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_DUMP_H -#define ACE_DUMP_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dumpable - * - * @brief Base class that defines a uniform interface for all object - * dumping. - */ -class ACE_Export ACE_Dumpable -{ -public: - friend class ACE_ODB; - friend class ACE_Dumpable_Ptr; - - /// Constructor. - ACE_Dumpable (const void *); - - /// This pure virtual method must be filled in by a subclass. - virtual void dump (void) const = 0; - -protected: - virtual ~ACE_Dumpable (void); - -private: - /// Pointer to the object that is being stored. - const void *this_; -}; - -/** - * @class ACE_Dumpable_Ptr - * - * @brief A smart pointer stored in the in-memory object database - * ACE_ODB. The pointee (if any) is deleted when reassigned. - */ -class ACE_Export ACE_Dumpable_Ptr -{ -public: - ACE_Dumpable_Ptr (const ACE_Dumpable *dumper = 0); - const ACE_Dumpable *operator->() const; - void operator= (const ACE_Dumpable *dumper) const; - -private: - /// "Real" pointer to the underlying abstract base class - /// pointer that does the real work. - const ACE_Dumpable *dumper_; -}; - -/** - * @class ACE_ODB - * - * @brief This is the object database (ODB) that keeps track of all - * live ACE objects. - */ -class ACE_Export ACE_ODB -{ -public: - /// @todo This is clearly inadequate and should be dynamic... - enum {MAX_TABLE_SIZE = 100000}; - - /// Iterates through the entire set of registered objects and - /// dumps their state. - void dump_objects (void); - - /// Add the tuple to the list of registered ACE objects. - void register_object (const ACE_Dumpable *dumper); - - /// Use to locate and remove the associated from the - /// list of registered ACE objects. - void remove_object (const void *this_); - - /// Interface to the Singleton instance of the object database. - static ACE_ODB *instance (void); - -private: - ACE_ODB (void); // Ensure we have a Singleton... - - struct Tuple - { - /// Pointer to the object that is registered. - const void *this_; - - /// Smart pointer to the ACE_Dumpable object associated with this_. - /// This uses an ACE_Dumpable_Ptr, instead of a bare pointer, to - /// cope with hierarchies of dumpable classes. In such cases we - /// typically want only one dump, corresponding to the most derived - /// instance. To achieve this, the handle registered for the - /// subobject corresponding to the base class is destroyed (hence - /// on destruction of the subobject its handle won't exist anymore - /// and we'll have to check for that). - const ACE_Dumpable_Ptr dumper_; - - Tuple (void) : dumper_(0) {} - }; - - /// Singleton instance of this class. - static ACE_ODB *instance_; - - /// The current implementation is very simple-minded and will be - /// changed to be dynamic. - Tuple object_table_[ACE_ODB::MAX_TABLE_SIZE]; - - /// Current size of . - int current_size_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Include the templates classes at this point. -#include "ace/Dump_T.h" - -#include /**/ "ace/post.h" -#endif /* ACE_DUMP_H */ diff --git a/ace/Dump_T.cpp b/ace/Dump_T.cpp deleted file mode 100644 index 3c789497eee..00000000000 --- a/ace/Dump_T.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Dump_T.cpp -// -// $Id$ - -#ifndef ACE_DUMP_T_CPP -#define ACE_DUMP_T_CPP - -#include "ace/Dump_T.h" -#include "ace/Global_Macros.h" -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Dumpable_Adapter::~ACE_Dumpable_Adapter (void) -{ - ACE_TRACE ("ACE_Dumpable_Adapter::~ACE_Dumpable_Adapter"); -} - -template -ACE_Dumpable_Adapter::ACE_Dumpable_Adapter (const Concrete *t) - : ACE_Dumpable ((const void *) t), this_ (t) -{ - ACE_TRACE ("ACE_Dumpable_Adapter::ACE_Dumpable_Adapter"); -} - -template Concrete * -ACE_Dumpable_Adapter::operator->() const -{ - return (Concrete *) this->this_; -} - -template void -ACE_Dumpable_Adapter::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dumpable_Adapter::dump"); - this->this_->dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_DUMP_T_CPP */ diff --git a/ace/Dump_T.h b/ace/Dump_T.h deleted file mode 100644 index 561569765a4..00000000000 --- a/ace/Dump_T.h +++ /dev/null @@ -1,82 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dump_T.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_DUMP_T_H -#define ACE_DUMP_T_H -#include /**/ "ace/pre.h" - -#include "ace/Dump.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dumpable_Adapter - * - * @brief This class inherits the interface of the abstract ACE_Dumpable - * class and is instantiated with the implementation of the - * concrete component class . - * - * This design is similar to the Adapter and Decorator patterns - * from the ``Gang of Four'' book. Note that - * need not inherit from a common class since ACE_Dumpable - * provides the uniform virtual interface! - */ -template -class ACE_Dumpable_Adapter : public ACE_Dumpable -{ -public: - // = Initialization and termination methods. - ACE_Dumpable_Adapter (const Concrete *t); - ~ACE_Dumpable_Adapter (void); - - /// Concrete dump method (simply delegates to the method of - /// ). - virtual void dump (void) const; - - /// Delegate to methods in the Concrete class. - Concrete *operator->() const; - -private: - /// Pointer to of . - const Concrete *this_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Some useful macros for conditionally compiling this feature... -#if defined (ACE_NDEBUG) -#define ACE_REGISTER_OBJECT(CLASS) -#define ACE_REMOVE_OBJECT -#else -#define ACE_REGISTER_OBJECT(CLASS) \ - ACE_ODB::instance ()->register_object \ - (new ACE_Dumpable_Adapter (this)); -#define ACE_REMOVE_OBJECT \ - ACE_ODB::instance ()->remove_object \ - ((void *) this); -#endif /* ACE_NDEBUG */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Dump_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Dump_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_DUMP_T_H */ diff --git a/ace/Dynamic.cpp b/ace/Dynamic.cpp deleted file mode 100644 index adeae242579..00000000000 --- a/ace/Dynamic.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// $Id$ - -#include "ace/Dynamic.h" -#include "ace/Singleton.h" -#include "ace/TSS_T.h" -#include "ace/Synch_Traits.h" -#include "ace/Null_Mutex.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Dynamic.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, Dynamic, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Dynamic::ACE_Dynamic (void) - : is_dynamic_ (false) -{ - ACE_TRACE ("ACE_Dynamic::ACE_Dynamic"); -} - -/* static */ ACE_Dynamic * -ACE_Dynamic::instance (void) -{ - return ACE_TSS_Singleton::instance (); -} - -#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) -template ACE_TSS_Singleton * - ACE_TSS_Singleton::singleton_; -#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic.h b/ace/Dynamic.h deleted file mode 100644 index 3c9f9aced43..00000000000 --- a/ace/Dynamic.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Dynamic.h - * - * $Id$ - * - * @author Doug Schmidt - * @author Irfan Pyarali. - */ -//========================================================================== - -#ifndef ACE_DYNAMIC_H -#define ACE_DYNAMIC_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dynamic - * - * @brief Checks to see if an object was dynamically allocated. - * - * This class holds the pointer in a thread-safe manner between - * the call to operator new and the call to the constructor. - */ -class ACE_Export ACE_Dynamic -{ -public: - // = Initialization and termination method. - /// Constructor. - ACE_Dynamic (void); - - /// Destructor. - ~ACE_Dynamic (void); - - /** - * Sets a flag that indicates that the object was dynamically - * created. This method is usually called in operator new and then - * checked and reset in the constructor. - */ - void set (void); - - /// @c true if we were allocated dynamically, else @c false. - bool is_dynamic (void); - - /// Resets state flag. - void reset (void); - - static ACE_Dynamic *instance (void); - -private: - /** - * Flag that indicates that the object was dynamically created. This - * method is usually called in operator new and then checked and - * reset in the constructor. - */ - bool is_dynamic_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Dynamic.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DYNAMIC_H */ diff --git a/ace/Dynamic.inl b/ace/Dynamic.inl deleted file mode 100644 index 3f506bc51f4..00000000000 --- a/ace/Dynamic.inl +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Dynamic::~ACE_Dynamic (void) -{ - // ACE_TRACE ("ACE_Dynamic::~ACE_Dynamic"); -} - -ACE_INLINE void -ACE_Dynamic::set (void) -{ - // ACE_TRACE ("ACE_Dynamic::set"); - this->is_dynamic_ = true; -} - -ACE_INLINE bool -ACE_Dynamic::is_dynamic (void) -{ - // ACE_TRACE ("ACE_Dynamic::is_dynamic"); - return this->is_dynamic_; -} - -ACE_INLINE void -ACE_Dynamic::reset (void) -{ - // ACE_TRACE ("ACE_Dynamic::reset"); - this->is_dynamic_ = false; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic_Service.cpp b/ace/Dynamic_Service.cpp deleted file mode 100644 index 3c968ba7b9e..00000000000 --- a/ace/Dynamic_Service.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ - -#ifndef ACE_DYNAMIC_SERVICE_CPP -#define ACE_DYNAMIC_SERVICE_CPP - -#include "ace/Dynamic_Service.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Service_Object.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Dynamic_Service.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - - -template TYPE * -ACE_Dynamic_Service::instance (const ACE_TCHAR *name) -{ - ACE_Service_Object * svc_obj = - static_cast - (ACE_Dynamic_Service_Base::instance (name,false)); - return dynamic_cast (svc_obj); -} - -template TYPE * -ACE_Dynamic_Service::instance (const ACE_TCHAR *name, - bool no_global) -{ - ACE_Service_Object * svc_obj = - static_cast - (ACE_Dynamic_Service_Base::instance (name,no_global)); - return dynamic_cast (svc_obj); -} - -template TYPE * -ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* conf, - const ACE_TCHAR *name) -{ - ACE_Service_Object * svc_obj = - static_cast - (ACE_Dynamic_Service_Base::instance (conf, name,false)); - return dynamic_cast (svc_obj); -} - -template TYPE * -ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* conf, - const ACE_TCHAR *name, - bool no_global) -{ - ACE_Service_Object * svc_obj = - static_cast - (ACE_Dynamic_Service_Base::instance (conf, name,no_global)); - return dynamic_cast (svc_obj); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_DYNAMIC_SERVICE_CPP */ diff --git a/ace/Dynamic_Service.h b/ace/Dynamic_Service.h deleted file mode 100644 index 877bf677396..00000000000 --- a/ace/Dynamic_Service.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dynamic_Service.h - * - * $Id$ - * - * @author Prashant Jain - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DYNAMIC_SERVICE_H -#define ACE_DYNAMIC_SERVICE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" -#include "ace/Global_Macros.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Dynamic_Service_Base.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Service_Object; - -/** - * @class ACE_Dynamic_Service - * - * @brief Provides a general interface to retrieve arbitrary objects - * from the ACE service repository. - * - * Uses "name" for lookup in the ACE service repository. Obtains - * the object and returns it as the appropriate type. - */ -template -class ACE_Dynamic_Service : public ACE_Dynamic_Service_Base -{ -public: - /// Return instance using @a name to search the Service_Repository. - static TYPE* instance (const ACE_TCHAR *name); - static TYPE* instance (const ACE_TCHAR *name, bool no_global); - - static TYPE* instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name); - static TYPE* instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name, bool no_global); - -#if defined (ACE_USES_WCHAR) - - /// Return instance using @a name to search the Service_Repository. - static TYPE* instance (const ACE_ANTI_TCHAR *name); - - static TYPE* instance (const ACE_ANTI_TCHAR *name, bool no_global); - - static TYPE* instance (const ACE_Service_Gestalt* repo, - const ACE_ANTI_TCHAR *name); - static TYPE* instance (const ACE_Service_Gestalt* repo, - const ACE_ANTI_TCHAR *name, bool no_global); -#endif // ACE_USES_WCHAR - -private: - ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service ()) - ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service (const ACE_Dynamic_Service&)) - ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service& operator= (const ACE_Dynamic_Service&)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Dynamic_Service.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -# include "ace/Dynamic_Service.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -# pragma implementation ("Dynamic_Service.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_DYNAMIC_SERVICE_H */ diff --git a/ace/Dynamic_Service.inl b/ace/Dynamic_Service.inl deleted file mode 100644 index 48978c595ed..00000000000 --- a/ace/Dynamic_Service.inl +++ /dev/null @@ -1,40 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_USES_WCHAR) - -template ACE_INLINE TYPE * -ACE_Dynamic_Service::instance (const ACE_ANTI_TCHAR *name) -{ - return instance (ACE_TEXT_CHAR_TO_TCHAR (name),false); -} - -template ACE_INLINE TYPE * -ACE_Dynamic_Service::instance (const ACE_ANTI_TCHAR *name, - bool no_global) -{ - return instance (ACE_TEXT_CHAR_TO_TCHAR (name),no_global); -} - -template ACE_INLINE TYPE * -ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* repo, - const ACE_ANTI_TCHAR *name) -{ - return instance (repo, ACE_TEXT_CHAR_TO_TCHAR (name),false); -} - -template ACE_INLINE TYPE * -ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* repo, - const ACE_ANTI_TCHAR *name, - bool no_global) -{ - return instance (repo, ACE_TEXT_CHAR_TO_TCHAR (name),no_global); -} - - -#endif // ACE_USES_WCHAR - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic_Service_Base.cpp b/ace/Dynamic_Service_Base.cpp deleted file mode 100644 index 35b963ca64d..00000000000 --- a/ace/Dynamic_Service_Base.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include "ace/Dynamic_Service_Base.h" -#include "ace/ACE.h" -#include "ace/Service_Config.h" -#include "ace/Service_Repository.h" -#include "ace/Service_Types.h" -#include "ace/Log_Msg.h" - - -ACE_RCSID (ace, - Dynamic_Service_Base, - "$Id$") - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL - - -void -ACE_Dynamic_Service_Base::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dynamic_Service_Base::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Get the instance using for the current global -// service configuration repository. - -void * -ACE_Dynamic_Service_Base::instance (const ACE_TCHAR *name, bool no_global) -{ - ACE_TRACE ("ACE_Dynamic_Service_Base::instance"); - return instance (ACE_Service_Config::current (), name, no_global); -} - - -void * -ACE_Dynamic_Service_Base::instance (const ACE_TCHAR *name) -{ - ACE_TRACE ("ACE_Dynamic_Service_Base::instance"); - return instance (ACE_Service_Config::current (), name, false); -} - - -// Find a service registration - -const ACE_Service_Type * -ACE_Dynamic_Service_Base::find_i (const ACE_Service_Gestalt* &repo, - const ACE_TCHAR *name, - bool no_global) -{ - ACE_TRACE ("ACE_Dynamic_Service_Base::find_i"); - const ACE_Service_Type *svc_rec = 0; - - ACE_Service_Gestalt* global = ACE_Service_Config::global (); - - for ( ; (repo->find (name, &svc_rec) == -1) && !no_global; repo = global) - { - // Check the static repo, too if different - if (repo == global) - break; - } - - return svc_rec; -} - - -// Get the instance using for specific configuration repository. - -void * -ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name, - bool no_global) -{ - ACE_TRACE ("ACE_Dynamic_Service_Base::instance"); - - void *obj = 0; - const ACE_Service_Type_Impl *type = 0; - - const ACE_Service_Gestalt* repo_found = repo; - - const ACE_Service_Type *svc_rec = find_i (repo_found, name, no_global); - if (svc_rec != 0) - { - type = svc_rec->type (); - if (type != 0) - obj = type->object (); - } - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%P|%t) DSB::instance, repo=%@, name=%s, ") - ACE_LIB_TEXT ("type=%@ => %@"), - repo->repo_, name, type, obj)); - - if (repo->repo_ != repo_found->repo_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" [in repo=%@]\n"), - repo_found->repo_)); - else - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - - } - - return obj; -} - - -// Get the instance using for specific configuration repository. - -void * -ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name) -{ - return instance(repo,name,false); -} - - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic_Service_Base.h b/ace/Dynamic_Service_Base.h deleted file mode 100644 index 7713d3f7e08..00000000000 --- a/ace/Dynamic_Service_Base.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Dynamic_Service_Base.h - * - * $Id$ - * - * @author Prashant Jain - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DYNAMIC_SERVICE_BASE_H -#define ACE_DYNAMIC_SERVICE_BASE_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Service_Gestalt; -class ACE_Service_Type; - -/** - * @class ACE_Dynamic_Service_Base - * - * @brief Base class for all ACE_Dynamic_Service instantiations. - * - * Factors out common code shared by all ACE_Dynamic_Service - * instantiations, this avoid code bloat. - */ -class ACE_Export ACE_Dynamic_Service_Base -{ - -public: - /// Dump the current static of the object - void dump (void) const; - -protected: - /// Return instance using @a name to search the (default) Service_Repository. - static void* instance (const ACE_TCHAR *name); - /// Perform the default repo search, but optionally skip searching the global repo. - static void* instance (const ACE_TCHAR *name, bool no_global); - - /// Return instance using @a name to search the specific @a repo instance. - static void* instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name); - - static void* instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name, - bool no_global); - - /// No need to create, or assign instances of this class - ACE_Dynamic_Service_Base (void); - ~ACE_Dynamic_Service_Base (void); - const ACE_Dynamic_Service_Base& operator= (const ACE_Dynamic_Service_Base&); - -private: - /// Implement the service search policy, i.e. "look for the service first - /// locally and then globally" - static const ACE_Service_Type *find_i (const ACE_Service_Gestalt* &repo, - const ACE_TCHAR *name, - bool no_global); - - /// The dependency declaration class needs access to the service search - /// policy, implemented by find_i() - friend class ACE_Dynamic_Service_Dependency; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_DYNAMIC_SERVICE_BASE_H */ diff --git a/ace/Dynamic_Service_Dependency.cpp b/ace/Dynamic_Service_Dependency.cpp deleted file mode 100644 index f2a9b45d61c..00000000000 --- a/ace/Dynamic_Service_Dependency.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "ace/ACE.h" -#include "ace/DLL_Manager.h" -#include "ace/Dynamic_Service_Dependency.h" -#include "ace/Service_Config.h" -#include "ace/Log_Msg.h" - -ACE_RCSID (ace, - Dynamic_Service_Dependency, - "$Id$") - - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL - - -ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal) -{ - this->init (ACE_Service_Config::current (), principal); -} - -ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg, - const ACE_TCHAR *principal) -{ - this->init (cfg, principal); -} - - -ACE_Dynamic_Service_Dependency::~ACE_Dynamic_Service_Dependency (void) -{ - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) DSD, this=%@ - destroying\n"), - this)); -} - -void -ACE_Dynamic_Service_Dependency::init (const ACE_Service_Gestalt *cfg, - const ACE_TCHAR *principal) -{ - const ACE_Service_Type* st = - ACE_Dynamic_Service_Base::find_i (cfg, principal,false); - if (ACE::debug ()) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) DSD, this=%@ - creating dependency on "), this)); - st->dump (); - } - this->tracker_ = st->dll (); -} - - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic_Service_Dependency.h b/ace/Dynamic_Service_Dependency.h deleted file mode 100644 index 3eb4e0df7c7..00000000000 --- a/ace/Dynamic_Service_Dependency.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dynamic_Service_Dependency.h - * - * $Id$ - * - * @author Iliyan Jeliazkov - */ -//============================================================================= - -#ifndef ACE_DYNAMIC_SERVICE_DEPENDENCY_H -#define ACE_DYNAMIC_SERVICE_DEPENDENCY_H - -#include /**/ "ace/pre.h" - - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Dynamic_Service_Base.h" -#include "ace/Service_Object.h" -#include "ace/DLL.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dynamic_Service_Dependency - * - * @brief Provides a way to declare dependency on specific service, - * thus helping to avoid order of initialization issues with instances - * of an objects whose implementation code resides in dynamically loaded - * services. - * - * It is disastrous to have dynamically loadable services create and give away - * ownership of objects and then ending up being unloaded before all those - * instances have been deleted. Normally the code for such objects classes - * resides within the TEXT segment of the DLL, which implements the service. - * If a service gets removed, its DLL may be unmapped from memory and then - * any attempt to invoke a method on the said objects will cause SEGV. - * - * Such instances must contain a member of ACE_Dynamic_Service_Dependency - * initialized with the service they depend on. - * ACE_Dynamic_Service_Dependency's constructor and destructor are - * "magical" - they work by maintaining the underlying dynamic service's - * DLL reference count. - */ -class ACE_Export ACE_Dynamic_Service_Dependency -{ -public: - ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg, - const ACE_TCHAR *principal); - ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal); - ~ACE_Dynamic_Service_Dependency (void); - -private: - void init (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal); - -private: - ACE_DLL tracker_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - - -#include /**/ "ace/post.h" - -#endif /* ACE_DYNAMIC_SERVICE_DEPENDENCY_H */ diff --git a/ace/Encoding_Converter.cpp b/ace/Encoding_Converter.cpp deleted file mode 100644 index 60e561ea534..00000000000 --- a/ace/Encoding_Converter.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// $Id$ -#include "ace/Encoding_Converter.h" - -#if defined (ACE_USES_WCHAR) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Encoding_Converter::~ACE_Encoding_Converter (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ diff --git a/ace/Encoding_Converter.h b/ace/Encoding_Converter.h deleted file mode 100644 index 72cce176244..00000000000 --- a/ace/Encoding_Converter.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -//========================================================================= -/** - * @file Encoding_Converter.h - * - * $Id$ - * - * This class is the base class for all encoding converters that convert - * to and from UTF-8. - * - * @author Chad Elliott - */ -//========================================================================= - -#ifndef ACE_ENCODING_CONVERTER_H -#define ACE_ENCODING_CONVERTER_H - -#include /**/ "ace/pre.h" - -#include "ace/Basic_Types.h" - -#if defined (ACE_USES_WCHAR) -#include "ace/ACE_export.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** The base class for all ACE UTF Encoding Converters. - * This class provides a generic interface that is used to implement - * various UTF encoding conversion classes. - */ -class ACE_Export ACE_Encoding_Converter -{ -public: - /// This enum describes the various states that can be returned - /// from the to_utf8() and from_utf8() methods which depends on - /// both the source buffer and the size of the target buffer. - enum Result {CONVERSION_OK, - SOURCE_EXHAUSTED, - TARGET_EXHAUSTED, - SOURCE_ILLEGAL - }; - - /// This destructor is here (and virtual) because we have virtual - /// functions. - virtual ~ACE_Encoding_Converter (void); - - /// Convert the source (which can be in any encoding) to UTF-8 and - /// store it in the provided target buffer. - virtual Result to_utf8 (const void* source, - size_t source_size, - ACE_Byte* target, - size_t target_size, - bool strict = true) = 0; - - /// Convert the UTF-8 source into an alternate encoding and store it - /// in the provided target buffer. - virtual Result from_utf8 (const ACE_Byte* source, - size_t source_size, - void* target, - size_t target_size, - bool strict = true) = 0; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ENCODING_CONVERTER_H */ diff --git a/ace/Encoding_Converter_Factory.cpp b/ace/Encoding_Converter_Factory.cpp deleted file mode 100644 index d0c99599870..00000000000 --- a/ace/Encoding_Converter_Factory.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// $Id$ -#include "ace/Encoding_Converter_Factory.h" - -#if defined (ACE_USES_WCHAR) -#include "ace/UTF32_Encoding_Converter.h" -#include "ace/UTF16_Encoding_Converter.h" -#include "ace/UTF8_Encoding_Converter.h" -#include "ace/OS_Memory.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Encoding_Converter* -ACE_Encoding_Converter_Factory::create ( - const ACE_Byte* source, - size_t source_size, - ACE_Encoding_Converter_Factory::Encoding_Hint hint) -{ -#if defined (ACE_BIG_ENDIAN) - bool convert_for_bigendian = true; -#else - bool convert_for_bigendian = false; -#endif /* ACE_BIG_ENDIAN */ - ACE_Encoding_Converter* converter = 0; - - switch (hint) - { - case ACE_UTF_32BE: - ACE_NEW_RETURN (converter, - ACE_UTF32_Encoding_Converter (!convert_for_bigendian), - 0); - break; - case ACE_UTF_32LE: - ACE_NEW_RETURN (converter, - ACE_UTF32_Encoding_Converter (convert_for_bigendian), - 0); - break; - case ACE_UTF_16BE: - ACE_NEW_RETURN (converter, - ACE_UTF16_Encoding_Converter (!convert_for_bigendian), - 0); - break; - case ACE_UTF_16LE: - ACE_NEW_RETURN (converter, - ACE_UTF16_Encoding_Converter (convert_for_bigendian), - 0); - break; - case ACE_UTF_8: - ACE_NEW_RETURN (converter, - ACE_UTF8_Encoding_Converter, - 0); - break; - default: - // First check for ASCII since much of ASCII text will appear to - // convert from UTF-16 to UTF-8. - converter = ACE_UTF8_Encoding_Converter::encoded (source, source_size); - if (converter != 0) - return converter; - - // Check for UTF-32 - converter = ACE_UTF32_Encoding_Converter::encoded (source, source_size); - if (converter != 0) - return converter; - - // Check for UTF-16 - converter = ACE_UTF16_Encoding_Converter::encoded (source, source_size); - if (converter != 0) - return converter; - } - - return converter; -} - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ diff --git a/ace/Encoding_Converter_Factory.h b/ace/Encoding_Converter_Factory.h deleted file mode 100644 index c4505ec8300..00000000000 --- a/ace/Encoding_Converter_Factory.h +++ /dev/null @@ -1,54 +0,0 @@ -// -*- C++ -*- - -//========================================================================= -/** - * @file Encoding_Converter_Factory.h - * - * $Id$ - * - * This class can be used to create encoding converters of various types. - * - * @author Chad Elliott - */ -//========================================================================= - -#ifndef ACE_ENCODING_CONVERTER_FACTORY_H -#define ACE_ENCODING_CONVERTER_FACTORY_H - -#include /**/ "ace/pre.h" - -#include "ace/Basic_Types.h" - -#if defined (ACE_USES_WCHAR) -#include "ace/ACE_export.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Encoding_Converter; - -/** Create an encoding converter based on the source or hint. - * This class allows users to avoid knowing any concrete converter types. - */ -class ACE_Export ACE_Encoding_Converter_Factory -{ -public: - /// This enum is used to tell what type of converter to create. - enum Encoding_Hint { ACE_UTF_32BE, ACE_UTF_32LE, - ACE_UTF_16BE, ACE_UTF_16LE, - ACE_UTF_8, ACE_NONE - }; - - /// Create an encoding converter based on the source. If a hint is - /// given, it just creates the specified type of converter without looking - /// at the source. - static ACE_Encoding_Converter* create (const ACE_Byte* source, - size_t source_size, - Encoding_Hint hint = ACE_NONE); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ENCODING_CONVERTER_FACTORY_H */ diff --git a/ace/Env_Value_T.cpp b/ace/Env_Value_T.cpp deleted file mode 100644 index 788bf125fc5..00000000000 --- a/ace/Env_Value_T.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// $Id$ - -#ifndef ACE_ENV_VALUE_T_CPP -#define ACE_ENV_VALUE_T_CPP - -#include "ace/Env_Value_T.h" - -#if ! defined (__ACE_INLINE__) -#include "ace/Env_Value_T.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_ENV_VALUE_T_CPP */ diff --git a/ace/Env_Value_T.h b/ace/Env_Value_T.h deleted file mode 100644 index 0a01705dfbb..00000000000 --- a/ace/Env_Value_T.h +++ /dev/null @@ -1,166 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Env_Value_T.h - * - * $Id$ - * - * Template to encapsulate getting a value from an environment variable - * and using a supplied default value if not in the environment. - * - * - * @author Chris Cleeland (derived from work by Carlos O'Ryan) - */ -//============================================================================= - -#ifndef ACE_ENV_VALUE_T_H -#define ACE_ENV_VALUE_T_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" -#include "ace/Global_Macros.h" -#include "ace/OS_NS_stdlib.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Env_Value - * - * @brief Environment Variable Value - * - * Reads a variable from the user environment, providing a default - * value. - */ -template -class ACE_Env_Value -{ -public: - /** - * Default constructor which isn't bound to a specific environment - * variable name or a default value. Before being useful it must - * 'd. - */ - ACE_Env_Value (void); - - /// Constructor that calls . - ACE_Env_Value (const ACE_TCHAR *varname, - const T &vardefault); - - /// Destroy the value. - ~ACE_Env_Value (void); - - /// Returns the value as type T. - operator T (void); - - /// The constructor, read @a varname from the environment, using - /// @a defval as its value if it is not defined. - void open (const ACE_TCHAR *varname, const T &defval); - - /// Returns the name of the variable being tracked. - const ACE_TCHAR *varname (void) const; - -private: - /// Disallow copying and assignment. - ACE_UNIMPLEMENTED_FUNC (ACE_Env_Value(const ACE_Env_Value &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Env_Value operator=(const ACE_Env_Value &)) - - void fetch_value (void); - - const ACE_TCHAR *varname_; - T value_; -}; - -/// Function to convert a string @a s into type @c T. -template void ACE_Convert (const ACE_TCHAR *s, T &t); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Env_Value_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Env_Value_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, ACE_TCHAR *&v) -{ - v = (ACE_TCHAR *) s; -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, const ACE_TCHAR *&v) -{ - v = (const ACE_TCHAR *) s; -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, short &si) -{ - si = static_cast (ACE_OS::strtol (s, 0, 10)); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, u_short &us) -{ - us = static_cast (ACE_OS::strtol (s, 0, 10)); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, u_int &i) -{ - i = static_cast (ACE_OS::strtol (s, 0, 10)); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, long &l) -{ - l = ACE_OS::strtol (s, 0, 10); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, int &i) -{ - i = static_cast (ACE_OS::strtol (s, 0, 10)); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, u_long &ul) -{ - ul = ACE_OS::strtoul (s, 0, 10); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, double &d) -{ - d = ACE_OS::strtod (s, 0); -} - -// Default calls a CTOR on type T of the form 'T::T(const char*)', but -// users can feel free to create their own specialized conversion -// functions if necessary, as shown above. Note that for 'char*' the -// default is used because a simple cast will be performed and no -// conversion will be necessary. -template inline void -ACE_Convert (const ACE_TCHAR *s, T &t) -{ - t = T (s); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Env_Value_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_ENV_VALUE_T_H */ diff --git a/ace/Env_Value_T.inl b/ace/Env_Value_T.inl deleted file mode 100644 index 63fe8df1f29..00000000000 --- a/ace/Env_Value_T.inl +++ /dev/null @@ -1,60 +0,0 @@ -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Env_Value::operator T (void) -{ - return value_; -} - -template ACE_INLINE -ACE_Env_Value::ACE_Env_Value (void) - : varname_ (0) -{ -} - -template ACE_INLINE -ACE_Env_Value::ACE_Env_Value (const ACE_TCHAR *varname, - const T &defval) - : varname_ (varname), - value_(defval) -{ - this->fetch_value (); -} - -template ACE_INLINE void -ACE_Env_Value::open (const ACE_TCHAR *varname, - const T &defval) -{ - this->varname_ = varname; - this->value_ = defval; - this->fetch_value (); -} - -template ACE_INLINE void -ACE_Env_Value::fetch_value (void) -{ -#if defined (ACE_WIN32) - const ACE_TCHAR *env = ACE_OS::getenv (this->varname_); - if (env != 0) - ACE_Convert (env, value_); -#else - char *nenv = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (this->varname_)); - if (nenv != 0) - ACE_Convert (ACE_TEXT_CHAR_TO_TCHAR (nenv), this->value_); -#endif -} - -template ACE_INLINE const ACE_TCHAR* -ACE_Env_Value::varname (void) const -{ - return this->varname_; -} - -template ACE_INLINE -ACE_Env_Value::~ACE_Env_Value (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event.cpp b/ace/Event.cpp deleted file mode 100644 index bc21465d27a..00000000000 --- a/ace/Event.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// $Id$ - -#include "ace/Event.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Event.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" - -ACE_RCSID(ace, Event, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Event::ACE_Event (int manual_reset, - int initial_state, - int type, - const ACE_TCHAR *name, - void *arg) - : removed_ (0) -{ - if (ACE_OS::event_init (&this->handle_, - manual_reset, - initial_state, - type, - name, - arg) != 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Event::ACE_Event"))); -} - -ACE_Event::~ACE_Event (void) -{ - this->remove (); -} - -int -ACE_Event::remove (void) -{ - int result = 0; - if (this->removed_ == 0) - { - this->removed_ = 1; - result = ACE_OS::event_destroy (&this->handle_); - } - return result; -} - -int -ACE_Event::wait (void) -{ - return ACE_OS::event_wait (&this->handle_); -} - -int -ACE_Event::wait (const ACE_Time_Value *abstime, int use_absolute_time) -{ - return ACE_OS::event_timedwait (&this->handle_, - const_cast (abstime), - use_absolute_time); -} - -int -ACE_Event::signal (void) -{ - return ACE_OS::event_signal (&this->handle_); -} - -int -ACE_Event::pulse (void) -{ - return ACE_OS::event_pulse (&this->handle_); -} - -int -ACE_Event::reset (void) -{ - return ACE_OS::event_reset (&this->handle_); -} - -void -ACE_Event::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event.h b/ace/Event.h deleted file mode 100644 index c4457a7dd9c..00000000000 --- a/ace/Event.h +++ /dev/null @@ -1,142 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Event.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_EVENT_H -#define ACE_EVENT_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_Thread.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Event - * - * @brief A wrapper around the Win32 event locking mechanism. - * - * Portable implementation of an Event mechanism, which is native to - * Win32, but must be emulated on UNIX. All platforms support - * process-scope locking support. However, only Win32 platforms - * support global naming and system-scope locking support. - */ -class ACE_Export ACE_Event -{ -public: - /// Constructor that creates event. - ACE_Event (int manual_reset = 0, - int initial_state = 0, - int type = USYNC_THREAD, - const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Implicitly destroy the event variable. - ~ACE_Event (void); - - /** - * Explicitly destroy the event variable. Note that only one thread - * should call this method since it doesn't protect against race - * conditions. - */ - int remove (void); - - /// Underlying handle to event. - ACE_event_t handle (void) const; - - /** - * Set the underlying handle to event. Note that this method assumes - * ownership of the and will close it down in . If - * you want the to stay open when is called make - * sure to call on the before closing it. You are - * responsible for the closing the existing before - * overwriting it. - */ - void handle (ACE_event_t new_handle); - - /** - * if MANUAL reset - * sleep till the event becomes signaled - * event remains signaled after wait() completes. - * else AUTO reset - * sleep till the event becomes signaled - * event resets wait() completes. - */ - int wait (void); - - /// Same as wait() above, but this one can be timed - /// @a abstime is absolute time-of-day if if @a use_absolute_time - /// is non-0, else it is relative time. - int wait (const ACE_Time_Value *abstime, - int use_absolute_time = 1); - - /** - * if MANUAL reset - * wake up all waiting threads - * set to signaled state - * else AUTO reset - * if no thread is waiting, set to signaled state - * if thread(s) are waiting, wake up one waiting thread and - * reset event - */ - int signal (void); - - /** - * if MANUAL reset - * wakeup all waiting threads and - * reset event - * else AUTO reset - * wakeup one waiting thread (if present) and - * reset event - */ - int pulse (void); - - /// Set to nonsignaled state. - int reset (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// The underlying handle. - ACE_event_t handle_; - - /// Keeps track of whether has been called yet to avoid - /// multiple calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure - /// that you don't have multiple threads simultaneously calling - /// on the same object, which is a bad idea anyway... - int removed_; - -private: - // = Prevent copying. - ACE_Event (const ACE_Event& event); - const ACE_Event &operator= (const ACE_Event &rhs); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Event.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_EVENT_H */ diff --git a/ace/Event.inl b/ace/Event.inl deleted file mode 100644 index 188d7c202cf..00000000000 --- a/ace/Event.inl +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_event_t -ACE_Event::handle (void) const -{ - return this->handle_; -} - -ACE_INLINE void -ACE_Event::handle (ACE_event_t new_handle) -{ - this->handle_ = new_handle; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event_Handler.cpp b/ace/Event_Handler.cpp deleted file mode 100644 index f8331f3f5fb..00000000000 --- a/ace/Event_Handler.cpp +++ /dev/null @@ -1,409 +0,0 @@ -// Event_Handler.cpp -// $Id$ - -#include "ace/Event_Handler.h" -#include "ace/OS_Errno.h" -#include "ace/Reactor.h" -#include "ace/Thread_Manager.h" -/* Need to see if ACE_HAS_BUILTIN_ATOMIC_OP defined */ -#include "ace/Atomic_Op.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Event_Handler.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, Event_Handler, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Implement conceptually abstract virtual functions in the base class -// so derived classes don't have to implement unused ones. - -ACE_Event_Handler::ACE_Event_Handler (ACE_Reactor *r, - int p) - : reference_count_ (1), - priority_ (p), - reactor_ (r), - reference_counting_policy_ (Reference_Counting_Policy::DISABLED) -{ - // ACE_TRACE ("ACE_Event_Handler::ACE_Event_Handler"); -} - -ACE_Event_Handler::~ACE_Event_Handler (void) -{ - // ACE_TRACE ("ACE_Event_Handler::~ACE_Event_Handler"); - if (this->reactor_ != 0) - { - ACE_Errno_Guard guard (errno); // purge may get ENOTSUP - this->reactor_->purge_pending_notifications (this); - } -} - -// Gets the file descriptor associated with this I/O device. - -ACE_HANDLE -ACE_Event_Handler::get_handle (void) const -{ - ACE_TRACE ("ACE_Event_Handler::get_handle"); - return ACE_INVALID_HANDLE; -} - -// Sets the file descriptor associated with this I/O device. - -void -ACE_Event_Handler::set_handle (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::set_handle"); -} - -// Gets the priority of this handler. - -int -ACE_Event_Handler::priority (void) const -{ - ACE_TRACE ("ACE_Event_Handler::priority"); - return this->priority_; -} - -// Sets the priority - -void -ACE_Event_Handler::priority (int priority) -{ - ACE_TRACE ("ACE_Event_Handler::priority"); - this->priority_ = priority; -} - -// Called when the object is about to be removed from the Dispatcher -// tables. - -int -ACE_Event_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) -{ - ACE_TRACE ("ACE_Event_Handler::handle_close"); - return -1; -} - -// Called when input becomes available on fd. - -int -ACE_Event_Handler::handle_input (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_input"); - return -1; -} - -// Called when output is possible on fd. - -int -ACE_Event_Handler::handle_output (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_output"); - return -1; -} - -// Called when urgent data is available on fd. - -int -ACE_Event_Handler::handle_exception (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_exception"); - return -1; -} - -// Called when timer expires, TV stores the current time. - -int -ACE_Event_Handler::handle_timeout (const ACE_Time_Value &, const void *) -{ - ACE_TRACE ("ACE_Event_Handler::handle_timeout"); - return -1; -} - -// Called when a monitored Process exits - -int -ACE_Event_Handler::handle_exit (ACE_Process *) -{ - ACE_TRACE ("ACE_Event_Handler::handle_exit"); - return -1; -} - -// Called when a registered signal occurs. - -int -ACE_Event_Handler::handle_signal (int, siginfo_t *, ucontext_t *) -{ - ACE_TRACE ("ACE_Event_Handler::handle_signal"); - return -1; -} - -int -ACE_Event_Handler::resume_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler::resume_handler"); - - // Return a default value and allow the reactor to take care of - // resuming the handler - return ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER; -} - - -int -ACE_Event_Handler::handle_qos (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_qos"); - return -1; -} - -int -ACE_Event_Handler::handle_group_qos (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_group_qos"); - return -1; -} - -void -ACE_Event_Handler::reactor (ACE_Reactor *reactor) -{ - ACE_TRACE ("ACE_Event_Handler::reactor"); - this->reactor_ = reactor; -} - -ACE_Reactor * -ACE_Event_Handler::reactor (void) const -{ - ACE_TRACE ("ACE_Event_Handler::reactor"); - return this->reactor_; -} - -ACE_Reactor_Timer_Interface * -ACE_Event_Handler::reactor_timer_interface (void) const -{ - ACE_TRACE ("ACE_Event_Handler::reactor_timer_interface"); - return this->reactor_; -} - -ACE_Event_Handler::Reference_Count -ACE_Event_Handler::add_reference (void) -{ - int reference_counting_required = - this->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (reference_counting_required) - return ++this->reference_count_; - else - return 1; -} - -ACE_Event_Handler::Reference_Count -ACE_Event_Handler::remove_reference (void) -{ - int reference_counting_required = - this->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (reference_counting_required) - { - Reference_Count result = - --this->reference_count_; - - if (result == 0) - delete this; - - return result; - } - else - { - return 1; - } -} - -ACE_Event_Handler::Policy::~Policy (void) -{ -} - -ACE_Event_Handler::Reference_Counting_Policy::Reference_Counting_Policy (Reference_Counting_Policy::Value value) - : value_ (value) -{ -} - -ACE_Event_Handler::Reference_Counting_Policy::Value -ACE_Event_Handler::Reference_Counting_Policy::value (void) const -{ - return this->value_; -} - -void -ACE_Event_Handler::Reference_Counting_Policy::value (ACE_Event_Handler::Reference_Counting_Policy::Value value) -{ - this->value_ = value; -} - -ACE_Event_Handler::Reference_Counting_Policy & -ACE_Event_Handler::reference_counting_policy (void) -{ - return this->reference_counting_policy_; -} - -//#if !defined (ACE_HAS_WINCE) - -ACE_THR_FUNC_RETURN -ACE_Event_Handler::read_adapter (void *args) -{ - ACE_Event_Handler *this_ptr = static_cast (args); - ACE_Reactor *r = this_ptr->reactor (); - - while (this_ptr->handle_input (ACE_STDIN) != -1) - continue; - - this_ptr->handle_close (ACE_STDIN, ACE_Event_Handler::READ_MASK); - // It's possible for handle_close() to "delete this" so we need to - // cache the reactor pointer and use it here. - r->notify (); - - return 0; -} - -int -ACE_Event_Handler::register_stdin_handler (ACE_Event_Handler *eh, - ACE_Reactor *reactor, - ACE_Thread_Manager *thr_mgr, - int flags) -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (reactor); - - eh->reactor (reactor); - return thr_mgr->spawn (&read_adapter, static_cast (eh), flags); -#else - // Keep compilers happy. - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (thr_mgr); - return reactor->register_handler (ACE_STDIN, - eh, - ACE_Event_Handler::READ_MASK); -#endif /* ACE_WIN32 */ -} - -int -ACE_Event_Handler::remove_stdin_handler (ACE_Reactor *reactor, - ACE_Thread_Manager *thr_mgr) -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (reactor); - ACE_UNUSED_ARG (thr_mgr); - - // What should we do here? - ACE_NOTSUP_RETURN (-1); -#else - // Keep compilers happy. - ACE_UNUSED_ARG (thr_mgr); - return reactor->remove_handler (ACE_STDIN, - ACE_Event_Handler::READ_MASK); -#endif /* ACE_WIN32 */ -} - -//#endif /* ACE_HAS_WINCE */ - -ACE_Event_Handler_var::ACE_Event_Handler_var (void) - : ptr_ (0) -{ -} - -ACE_Event_Handler_var::ACE_Event_Handler_var (ACE_Event_Handler *p) - : ptr_ (p) -{ -} - -ACE_Event_Handler_var::ACE_Event_Handler_var (const ACE_Event_Handler_var &b) - : ptr_ (b.ptr_) -{ - if (this->ptr_ != 0) - { - this->ptr_->add_reference (); - } -} - -ACE_Event_Handler_var::~ACE_Event_Handler_var (void) -{ - if (this->ptr_ != 0) - { - this->ptr_->remove_reference (); - } -} - -ACE_Event_Handler_var & -ACE_Event_Handler_var::operator= (ACE_Event_Handler *p) -{ - if (this->ptr_ == p) - return *this; - - if (this->ptr_ != 0) - this->ptr_->remove_reference (); - - this->ptr_ = p; - - return *this; -} - -ACE_Event_Handler_var & -ACE_Event_Handler_var::operator= (const ACE_Event_Handler_var &b) -{ - if (this->ptr_ != b.ptr_) - { - if (this->ptr_ != 0) - { - this->ptr_->remove_reference (); - } - - if ((this->ptr_ = b.ptr_) != 0) - { - this->ptr_->add_reference (); - } - } - - return *this; -} - -ACE_Event_Handler * -ACE_Event_Handler_var::operator->() const -{ - return this->ptr_; -} - -ACE_Event_Handler * -ACE_Event_Handler_var::handler (void) const -{ - return this->ptr_; -} - -ACE_Event_Handler * -ACE_Event_Handler_var::release (void) -{ - ACE_Event_Handler *old = this->ptr_; - this->ptr_ = 0; - return old; -} - -void -ACE_Event_Handler_var::reset (ACE_Event_Handler *p) -{ - *this = p; -} - -ACE_Notification_Buffer::ACE_Notification_Buffer (void) -{ - ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer"); -} - -ACE_Notification_Buffer::ACE_Notification_Buffer (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) - : eh_ (eh), - mask_ (mask) -{ - ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event_Handler.h b/ace/Event_Handler.h deleted file mode 100644 index b6b066cb379..00000000000 --- a/ace/Event_Handler.h +++ /dev/null @@ -1,390 +0,0 @@ -/* -*- C++ -*- */ - -//========================================================================== -/** - * @file Event_Handler.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_EVENT_HANDLER_H -#define ACE_EVENT_HANDLER_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_signal.h" -#include "ace/Atomic_Op.h" -#include "ace/Synch_Traits.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -class ACE_Message_Block; -class ACE_Reactor; -class ACE_Reactor_Timer_Interface; -class ACE_Thread_Manager; -class ACE_Process; - -typedef unsigned long ACE_Reactor_Mask; - -/** - * @class ACE_Event_Handler - * - * @brief Provides an abstract interface for handling various types of - * I/O, timer, and signal events. - * - * Subclasses read/write input/output on an I/O descriptor, - * handle an exception raised on an I/O descriptor, handle a - * timer's expiration, or handle a signal. - */ -class ACE_Export ACE_Event_Handler -{ -public: - enum - { - LO_PRIORITY = 0, - HI_PRIORITY = 10, - NULL_MASK = 0, -#if defined (ACE_USE_POLL) - READ_MASK = POLLIN, - WRITE_MASK = POLLOUT, - EXCEPT_MASK = POLLPRI, -#else /* USE SELECT */ - READ_MASK = (1 << 0), - WRITE_MASK = (1 << 1), - EXCEPT_MASK = (1 << 2), -#endif /* ACE_USE_POLL */ - ACCEPT_MASK = (1 << 3), - CONNECT_MASK = (1 << 4), - TIMER_MASK = (1 << 5), - QOS_MASK = (1 << 6), - GROUP_QOS_MASK = (1 << 7), - SIGNAL_MASK = (1 << 8), - ALL_EVENTS_MASK = READ_MASK | - WRITE_MASK | - EXCEPT_MASK | - ACCEPT_MASK | - CONNECT_MASK | - TIMER_MASK | - QOS_MASK | - GROUP_QOS_MASK | - SIGNAL_MASK, - RWE_MASK = READ_MASK | - WRITE_MASK | - EXCEPT_MASK, - DONT_CALL = (1 << 9) - }; - - /// Destructor is virtual to enable proper cleanup. - virtual ~ACE_Event_Handler (void); - - /// Get the I/O handle. - virtual ACE_HANDLE get_handle (void) const; - - /// Set the I/O handle. - virtual void set_handle (ACE_HANDLE); - - // = Get/set priority - - // Priorities run from MIN_PRIORITY (which is the "lowest priority") - // to MAX_PRIORITY (which is the "highest priority"). - /// Get the priority of the Event_Handler. - virtual int priority (void) const; - - /// Set the priority of the Event_Handler. - virtual void priority (int priority); - - /// Called when input events occur (e.g., connection or data). - virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); - - /// Called when output events are possible (e.g., when flow control - /// abates or non-blocking connection completes). - virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE); - - /// Called when an exceptional events occur (e.g., SIGURG). - virtual int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE); - - /** - * Called when timer expires. represents the current - * time that the was selected for timeout - * dispatching and is the asynchronous completion token that - * was passed in when was invoked. - */ - virtual int handle_timeout (const ACE_Time_Value ¤t_time, - const void *act = 0); - - /// Called when a process exits. - virtual int handle_exit (ACE_Process *); - - /// Called when a method returns -1 or when the - /// method is called on an ACE_Reactor. The - /// indicates which event has triggered the - /// method callback on a particular . - virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - - /// Called when object is signaled by OS (either via UNIX signals or - /// when a Win32 object becomes signaled). - virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - - enum - { - /// The handler is not resumed at all. Could lead to deadlock.. - ACE_EVENT_HANDLER_NOT_RESUMED = -1, - /// The reactor takes responsibility of resuming the handler and - /// is the default - ACE_REACTOR_RESUMES_HANDLER = 0, - /// The application takes responsibility of resuming the handler - ACE_APPLICATION_RESUMES_HANDLER - }; - /** - * Called to figure out whether the handler needs to resumed by the - * reactor or the application can take care of it. The default - * value of 0 would be returned which would allow the reactor to - * take care of resumption of the handler. The application can - * return a value more than zero and decide to resume the handler - * themseleves. - * - * @note This method is only useful for the ACE_TP_Reactor. Sad - * that we have to have this method in a class that is supposed to - * be used across different components in ACE. - */ - virtual int resume_handler (void); - - virtual int handle_qos (ACE_HANDLE = ACE_INVALID_HANDLE); - virtual int handle_group_qos (ACE_HANDLE = ACE_INVALID_HANDLE); - - // = Accessors to set/get the various event demultiplexors. - /// Set the event demultiplexors. - virtual void reactor (ACE_Reactor *reactor); - - /// Get the event demultiplexors. - virtual ACE_Reactor *reactor (void) const; - - /// Get only the reactor's timer related interface. - virtual ACE_Reactor_Timer_Interface *reactor_timer_interface (void) const; - - //#if !defined (ACE_HAS_WINCE) - /** - * Used to read from non-socket ACE_HANDLEs in our own thread to - * work around Win32 limitations that don't allow us to 'able on - * Win32. - */ - static int register_stdin_handler (ACE_Event_Handler *eh, - ACE_Reactor *reactor, - ACE_Thread_Manager *thr_mgr, - int flags = THR_DETACHED); - - /// Performs the inverse of the method. - static int remove_stdin_handler (ACE_Reactor *reactor, - ACE_Thread_Manager *thr_mgr); - //#endif /* ACE_HAS_WINCE */ - - /// Reference count type. - typedef long Reference_Count; - - /// Increment reference count on the handler. - /** - * This method is called when the handler is registered with the - * Reactor and when the Reactor makes an upcall on the handler. - * Reference count is 1 when the handler is created. - * - * @return Current reference count. - */ - virtual Reference_Count add_reference (void); - - /// Decrement reference count on the handler. - /** - * This method is called when the handler is removed from the - * Reactor and when an upcall made on the handler by the Reactor - * completes. Handler is deleted when the reference count reaches - * 0. - * - * @return Current reference count. - */ - virtual Reference_Count remove_reference (void); - - /** - * @class Policy - * - * @brief Base class for all handler policies. - */ - class ACE_Export Policy - { - - public: - - /// Virtual destructor. - virtual ~Policy (void); - }; - - /** - * @class Reference_Counting_Policy - * - * @brief This policy dictates the reference counting requirements - * for the handler. - * - * This policy allows applications to configure whether it wants the - * Reactor to call add_reference() and remove_reference() during - * registrations, removals, and upcalls. - * - * Default: DISABLED. - */ - class ACE_Export Reference_Counting_Policy : public Policy - { - /// This policy can only be created by the handler. - friend class ACE_Event_Handler; - - public: - - enum Value - { - /// Perform reference counting. - ENABLED, - /// Don't perform reference counting. - DISABLED - }; - - /// Current Reference_Counting_Policy. - Value value (void) const; - - /// Update Reference_Counting_Policy. - void value (Value value); - - private: - - /// Private constructor. - Reference_Counting_Policy (Value value); - - /// The value of the policy. - Value value_; - }; - - /// Current Reference_Counting_Policy. - Reference_Counting_Policy &reference_counting_policy (void); - -protected: - /// Force ACE_Event_Handler to be an abstract base class. - ACE_Event_Handler (ACE_Reactor * = 0, - int priority = ACE_Event_Handler::LO_PRIORITY); - - /// Typedef for implementation of reference counting. - typedef ACE_Atomic_Op Atomic_Reference_Count; - - /// Reference count. - Atomic_Reference_Count reference_count_; - -private: - - /// Priority of this Event_Handler. - int priority_; - - /// Pointer to the various event demultiplexors. - ACE_Reactor *reactor_; - - /// Reference counting requirements. - Reference_Counting_Policy reference_counting_policy_; -}; - -/** - * @class ACE_Event_Handler_var - * - * @brief Auto pointer like class for Event Handlers. - * - * Used to manage lifecycle of handlers. This class calls - * ACE_Event_Handler::remove_reference() in its destructor. - */ -class ACE_Export ACE_Event_Handler_var -{ - -public: - - /// Default constructor. - ACE_Event_Handler_var (void); - - /// Construct with a handler. - ACE_Event_Handler_var (ACE_Event_Handler *p); - - /// Copy constructor. - ACE_Event_Handler_var (const ACE_Event_Handler_var &b); - - /// Destructor. - ~ACE_Event_Handler_var (void); - - /// Assignment to a handler. - ACE_Event_Handler_var &operator= (ACE_Event_Handler *p); - - /// Assignment to a ACE_Event_Handler_var. - ACE_Event_Handler_var &operator= (const ACE_Event_Handler_var &b); - - /// Overloaded "->". - ACE_Event_Handler *operator-> () const; - - /// Access the handler. - ACE_Event_Handler *handler (void) const; - - /// Release the handler. - ACE_Event_Handler *release (void); - - /// Reset the handler. - void reset (ACE_Event_Handler *p = 0); - -private: - - /// Handler. - ACE_Event_Handler *ptr_; -}; - -/** - * @class ACE_Notification_Buffer - * - * @brief Simple wrapper for passing s and - * s between threads. - */ -class ACE_Export ACE_Notification_Buffer -{ -public: - ACE_Notification_Buffer (void); - - ACE_Notification_Buffer (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /// Default dtor. - ~ACE_Notification_Buffer (void); - - /// Pointer to the Event_Handler that will be dispatched - /// by the main event loop. - ACE_Event_Handler *eh_; - - /// Mask that indicates which method to call. - ACE_Reactor_Mask mask_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Event_Handler.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_EVENT_HANDLER_H */ diff --git a/ace/Event_Handler.inl b/ace/Event_Handler.inl deleted file mode 100644 index 75f2cd12aa5..00000000000 --- a/ace/Event_Handler.inl +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Notification_Buffer::~ACE_Notification_Buffer (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event_Handler_T.cpp b/ace/Event_Handler_T.cpp deleted file mode 100644 index 51a03f62310..00000000000 --- a/ace/Event_Handler_T.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// Event_Handler_T.cpp -// -// $Id$ - -#ifndef ACE_EVENT_HANDLER_T_CPP -#define ACE_EVENT_HANDLER_T_CPP - -#include "ace/Event_Handler_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) - -#if !defined (__ACE_INLINE__) -#include "ace/Event_Handler_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Event_Handler_T) - -template void -ACE_Event_Handler_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Event_Handler_T::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Event_Handler_T::~ACE_Event_Handler_T (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::~ACE_Event_Handler_T"); - if (this->delete_handler_) - delete this->op_handler_; -} - -template -ACE_Event_Handler_T::ACE_Event_Handler_T (T *op_handler, int delete_handler, - GET_HANDLE get_handle, - IO_HANDLER input_h, - CL_HANDLER close_h, - SIG_HANDLER sig_h, - TO_HANDLER timeout_h, - IO_HANDLER output_h, - SET_HANDLE set_handle, - IO_HANDLER except_h) - : op_handler_ (op_handler), - input_handler_ (input_h), - output_handler_ (output_h), - except_handler_ (except_h), - to_handler_ (timeout_h), - cl_handler_ (close_h), - sig_handler_ (sig_h), - delete_handler_ (delete_handler), - set_handle_ (set_handle), - get_handle_ (get_handle) -{ - ACE_TRACE ("ACE_Event_Handler_T::ACE_Event_Handler_T"); -} - -template ACE_HANDLE -ACE_Event_Handler_T::get_handle (void) const -{ - ACE_TRACE ("ACE_Event_Handler_T::get_handle"); - return this->get_handle_ == 0 ? ACE_INVALID_HANDLE : (this->op_handler_->*get_handle_) (); -} - -template void -ACE_Event_Handler_T::set_handle (ACE_HANDLE h) -{ - ACE_TRACE ("ACE_Event_Handler_T::set_handle"); - if (this->set_handle_ != 0) - (this->op_handler_->*set_handle_) (h); -} - -template int -ACE_Event_Handler_T::handle_input (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_input"); - return this->input_handler_ == 0 ? 0 : (this->op_handler_->*input_handler_) (fd); -} - -template int -ACE_Event_Handler_T::handle_output (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_output"); - return this->output_handler_ == 0 ? 0 : (this->op_handler_->*output_handler_) (fd); -} - -template int -ACE_Event_Handler_T::handle_exception (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_exception"); - return this->except_handler_ == 0 ? 0 : (this->op_handler_->*except_handler_) (fd); -} - -template int -ACE_Event_Handler_T::handle_timeout (const ACE_Time_Value &tv, const void *arg) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_timeout"); - return this->to_handler_ == 0 ? 0 : (this->op_handler_->*to_handler_) (tv, arg); -} - -template int -ACE_Event_Handler_T::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask close_mask) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_close"); - return this->cl_handler_ == 0 ? 0 : (this->op_handler_->*cl_handler_) (fd, close_mask); -} - -template int -ACE_Event_Handler_T::handle_signal (int signum, siginfo_t *s, ucontext_t *u) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_signal"); - return this->sig_handler_ == 0 ? 0 : (this->op_handler_->*sig_handler_) (signum, s, u); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ - -#endif /* ACE_EVENT_HANDLER_T_CPP */ diff --git a/ace/Event_Handler_T.h b/ace/Event_Handler_T.h deleted file mode 100644 index 71c97bcf4a8..00000000000 --- a/ace/Event_Handler_T.h +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Event_Handler_T.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_EVENT_HANDLER_T_H -#define ACE_EVENT_HANDLER_T_H -#include /**/ "ace/pre.h" - -#include "ace/Event_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Event_Handler_T - * - * @brief Enable a class that doesn't inherit from the - * ACE_Event_Handler to be incorporated into the ACE_Reactor - * framework. Thanks to Greg Lavender (g.lavender@isode.com) - * for sharing this idea. - * - * It is sometimes the case that an application has a hierarchy - * of operation dispatcher classes that have their own - * inheritance hierarchy but also would like to integrate with - * the ACE_Reactor. Rather than adopt a "mixin" approach, it is - * often cleaner to define a template as a subclass of - * ACE_Event_Handler and paramterize it with an operation - * dispatcher type. - * When constructing an instantiation of the ACE_Event_Handler_T - * object, a set of pointers to member functions must be - * provided so that when one of the handle_* methods is called - * by the ACE_Reactor, the appropriate method is called on the - * underlying operations object. This is done since in some - * cases it is useful to map any event that happens to the same - * method on an object. - * The ACE_Event_Handler_T template is instantiated by an - * operations object and registered with the ACE_Reactor, and it - * then calls the appropriate op_handler. So, it's basically - * just another level of indirection in event dispatching. The - * coupling betweent the ultimate handler of the event and the - * ACE_Event_Handler class is relaxed a bit by have this - * intermediate object of type around. The - * client object can then dynamically change the bindings for - * the various handlers so that during the life of one of the - * operation objects, it can change how it wants events to be - * handled. It just instantiates a new instance of the template - * with different bindings and reregisters this new object with - * the ACE_Reactor. - */ -template -class ACE_Event_Handler_T : public ACE_Event_Handler -{ -public: - // = Typedefs to simplify pointer-to-member-function registration. - - // Get/set the underlying handle. - typedef ACE_HANDLE (T::*GET_HANDLE) (void) const; - typedef void (T::*SET_HANDLE) (ACE_HANDLE); - - /// Handle I/O events. - typedef int (T::*IO_HANDLER) (ACE_HANDLE); - - /// Handle timeout events. - typedef int (T::*TO_HANDLER) (const ACE_Time_Value &, const void *); - - /// Handle close events. - typedef int (T::*CL_HANDLER) (ACE_HANDLE, ACE_Reactor_Mask); - - /// = Initialization and termination methods. - typedef int (T::*SIG_HANDLER) (int, siginfo_t*, ucontext_t*); - - /// Initialize the op_handler. - ACE_Event_Handler_T (T *op_handler, - int delete_handler, - GET_HANDLE get_handle = 0, - IO_HANDLER input = 0, - CL_HANDLER close = 0, - SIG_HANDLER sig = 0, - TO_HANDLER timeout = 0, - IO_HANDLER output = 0, - SET_HANDLE set_handle = 0, - IO_HANDLER except = 0); - - /// Close down and delete the - ~ACE_Event_Handler_T (void); - - // = Override all the ACE_Event_Handler methods. - - // These methods all delegate down to the operations handler. - virtual ACE_HANDLE get_handle (void) const; - virtual void set_handle (ACE_HANDLE); - virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); - virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE); - virtual int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE); - virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg = 0); - virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask close_mask); - virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - - // = Get/set the operations handler. - T *op_handler (void); - void op_handler (T *); - - // = Get/set the target pointer-to-method used for dispatching. - - GET_HANDLE handle_get (void); - void handle_get (GET_HANDLE); - - SET_HANDLE handle_set (void); - void handle_set (SET_HANDLE); - - IO_HANDLER input_handler (void); - void input_handler (IO_HANDLER); - - IO_HANDLER output_handler (void); - void output_handler (IO_HANDLER); - - IO_HANDLER except_handler (void); - void except_handler (IO_HANDLER); - - TO_HANDLER to_handler (void); - void to_handler (TO_HANDLER); - - CL_HANDLER cl_handler (void); - void cl_handler (CL_HANDLER); - - SIG_HANDLER sig_handler (void); - void sig_handler (SIG_HANDLER); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Pointer to the object that handles all the delegated operations. - T *op_handler_; - - // = Handle input, output, and exception events. - IO_HANDLER input_handler_; - IO_HANDLER output_handler_; - IO_HANDLER except_handler_; - - /// Handle timeout events. - TO_HANDLER to_handler_; - - /// Handle close events. - CL_HANDLER cl_handler_; - - /// Handle signal events. - SIG_HANDLER sig_handler_; - - /// Keeps track of whether we need to delete the handler in the - /// destructor. - int delete_handler_; - - // = Get/set underlying handle. - SET_HANDLE set_handle_; - GET_HANDLE get_handle_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Event_Handler_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Event_Handler_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Event_Handler_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ -#include /**/ "ace/post.h" -#endif /* ACE_EVENT_HANDLER_H */ diff --git a/ace/Event_Handler_T.inl b/ace/Event_Handler_T.inl deleted file mode 100644 index 5d2e31ab81e..00000000000 --- a/ace/Event_Handler_T.inl +++ /dev/null @@ -1,135 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE void -ACE_Event_Handler_T::op_handler (T *op) -{ - ACE_TRACE ("ACE_Event_Handler_T::op_handler"); - this->op_handler_ = op; -} - -template ACE_INLINE T * -ACE_Event_Handler_T::op_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::op_handler"); - return this->op_handler_; -} - -template ACE_INLINE ACE_TYPENAME ACE_Event_Handler_T::GET_HANDLE -ACE_Event_Handler_T::handle_get (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_get"); - return this->get_handle_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::handle_get (ACE_TYPENAME ACE_Event_Handler_T::GET_HANDLE h) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_get"); - this->get_handle_ = h; -} - -template ACE_INLINE ACE_TYPENAME ACE_Event_Handler_T::SET_HANDLE -ACE_Event_Handler_T::handle_set (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_set"); - return this->set_handle_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::handle_set (ACE_TYPENAME ACE_Event_Handler_T::SET_HANDLE h) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_set"); - this->set_handle_ = h; -} - -template ACE_INLINE ACE_TYPENAME ACE_Event_Handler_T::IO_HANDLER -ACE_Event_Handler_T::input_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::input_handler"); - return this->input_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::input_handler (ACE_TYPENAME ACE_Event_Handler_T::IO_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::input_handler"); - this->input_handler_ = h; -} - -template ACE_INLINE ACE_TYPENAME ACE_Event_Handler_T::IO_HANDLER -ACE_Event_Handler_T::output_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::output_handler"); - return this->output_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::output_handler (ACE_TYPENAME ACE_Event_Handler_T::IO_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::output_handler"); - this->output_handler_ = h; -} - -template ACE_INLINE ACE_TYPENAME ACE_Event_Handler_T::IO_HANDLER -ACE_Event_Handler_T::except_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::except_handler"); - return this->except_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::except_handler (ACE_TYPENAME ACE_Event_Handler_T::IO_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::except_handler"); - this->except_handler_ = h; -} - -template ACE_INLINE ACE_TYPENAME ACE_Event_Handler_T::TO_HANDLER -ACE_Event_Handler_T::to_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::to_handler"); - return this->to_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::to_handler (ACE_TYPENAME ACE_Event_Handler_T::TO_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::to_handler"); - this->to_handler_ = h; -} - -template ACE_INLINE ACE_TYPENAME ACE_Event_Handler_T::CL_HANDLER -ACE_Event_Handler_T::cl_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::cl_handler"); - return this->cl_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::cl_handler (ACE_TYPENAME ACE_Event_Handler_T::CL_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::cl_handler"); - this->cl_handler_ = h; -} - -template ACE_INLINE ACE_TYPENAME ACE_Event_Handler_T::SIG_HANDLER -ACE_Event_Handler_T::sig_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::sig_handler"); - return this->sig_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::sig_handler (ACE_TYPENAME ACE_Event_Handler_T::SIG_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::sig_handler"); - this->sig_handler_ = h; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Exception_Macros.h b/ace/Exception_Macros.h deleted file mode 100644 index 6cd6777ca5d..00000000000 --- a/ace/Exception_Macros.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- - -// ============================================================================ -/** - * @file Exception_Macros.h - * - * $Id$ - * - * Writing code that is portable between platforms with or without - * native C++ exceptions is hard. The following macros offer some - * help on this task. - * - * @author Nanbor Wang - * @author Aniruddha Gokhale - * @author Carlos O'Ryan - * @author Krishnakumar B , et al. - */ -// ============================================================================ - -// Macros for handling exceptions. - -#ifndef ACE_EXCEPTION_MACROS_H -#define ACE_EXCEPTION_MACROS_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -# if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -# endif /* ACE_LACKS_PRAGMA_ONCE */ - -// By default, if the compiler supports native exception handling, assume -// CORBA also support native exception handling. But it can be disabled by -// defining ACE_CORBA_HAS_EXCEPTIONS=0. If the compiler does not support -// exceptions handling, make sure native exception handling is disabled. -#if defined (ACE_HAS_EXCEPTIONS) -# if defined (ACE_CORBA_HAS_EXCEPTIONS) -# if (ACE_CORBA_HAS_EXCEPTIONS == 0) -# undef ACE_USES_NATIVE_EXCEPTIONS -# else /* ACE_CORBA_HAS_EXCEPTIONS != 0 */ -# define ACE_USES_NATIVE_EXCEPTIONS -# endif /* ACE_CORBA_HAS_EXCEPTIONS == 0 */ -# else -# define ACE_USES_NATIVE_EXCEPTIONS -# define ACE_CORBA_HAS_EXCEPTIONS -# endif /* ACE_CORBA_HAS_EXCEPTIONS */ -#else /* ! ACE_HAS_EXCEPTIONS */ -# undef ACE_CORBA_HAS_EXCEPTIONS -# undef ACE_USES_NATIVE_EXCEPTIONS -#endif /* ACE_HAS_EXCEPTIONS */ - -#include /**/ "ace/post.h" - -#endif /* ACE_EXCEPTION_MACROS_H */ diff --git a/ace/FIFO.cpp b/ace/FIFO.cpp deleted file mode 100644 index cff340b6d57..00000000000 --- a/ace/FIFO.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// $Id$ - -#include "ace/FIFO.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_sys_stat.h" -#include "ace/OS_NS_fcntl.h" - -ACE_RCSID(ace, FIFO, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO) - -void -ACE_FIFO::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("rendezvous_ = %s"), this->rendezvous_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_FIFO::open (const ACE_TCHAR *r, int flags, mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO::open"); - ACE_OS::strsncpy (this->rendezvous_, r, MAXPATHLEN); - - if ((flags & O_CREAT) != 0 - && ACE_OS::mkfifo (this->rendezvous_, perms) == -1 - && !(errno == EEXIST)) - return -1; - - this->set_handle (ACE_OS::open (this->rendezvous_, flags, 0, sa)); - return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_FIFO::ACE_FIFO (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO::ACE_FIFO"); - if (this->open (fifo_name, flags, perms, sa) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO"))); -} - -ACE_FIFO::ACE_FIFO (void) -{ -// ACE_TRACE ("ACE_FIFO::ACE_FIFO"); -} - -int -ACE_FIFO::close (void) -{ - ACE_TRACE ("ACE_FIFO::close"); - int result = 0; - - if (this->get_handle () != ACE_INVALID_HANDLE) - { - result = ACE_OS::close (this->get_handle ()); - this->set_handle (ACE_INVALID_HANDLE); - } - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO.h b/ace/FIFO.h deleted file mode 100644 index 066e3e98035..00000000000 --- a/ace/FIFO.h +++ /dev/null @@ -1,85 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file FIFO.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//========================================================================== - - -#ifndef ACE_FIFO_H -#define ACE_FIFO_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/IPC_SAP.h" -#include "ace/os_include/os_limits.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FIFO - * - * @brief Abstract base class for UNIX FIFOs - * - * UNIX FIFOs are also known Named Pipes, which are totally - * unrelated to Win32 Named Pipes. If you want to use a local - * IPC mechanism that will be portable to both UNIX and Win32, - * take a look at the classes. - */ -class ACE_Export ACE_FIFO : public ACE_IPC_SAP -{ -public: - /// Open up the named pipe on the in accordance with the - /// flags. - int open (const ACE_TCHAR *rendezvous, int flags, mode_t perms, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Close down the ACE_FIFO without removing the rendezvous point. - int close (void); - - /// Close down the ACE_FIFO and remove the rendezvous point from the - /// file system. - int remove (void); - - /// Return the local address of this endpoint. - int get_local_addr (const ACE_TCHAR *&rendezvous) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Make these protected to ensure that the class is "abstract." - /// Default constructor. - ACE_FIFO (void); - - /// Open up the named pipe on the in accordance with the - /// flags. - ACE_FIFO (const ACE_TCHAR *rendezvous, int flags, mode_t perms, - LPSECURITY_ATTRIBUTES sa = 0); - -private: - /// Rendezvous point in the file system. - ACE_TCHAR rendezvous_[MAXPATHLEN + 1]; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FIFO_H */ diff --git a/ace/FIFO.inl b/ace/FIFO.inl deleted file mode 100644 index 149ed11318b..00000000000 --- a/ace/FIFO.inl +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_FIFO::get_local_addr (const ACE_TCHAR *&r) const -{ - ACE_TRACE ("ACE_FIFO::get_local_addr"); - r = this->rendezvous_; - return 0; -} - -ACE_INLINE int -ACE_FIFO::remove (void) -{ - ACE_TRACE ("ACE_FIFO::remove"); - int const result = this->close (); - return ACE_OS::unlink (this->rendezvous_) == -1 || result == -1 ? -1 : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Recv.cpp b/ace/FIFO_Recv.cpp deleted file mode 100644 index 50a39067bb0..00000000000 --- a/ace/FIFO_Recv.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// $Id$ - -#include "ace/FIFO_Recv.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_fcntl.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO_Recv.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, FIFO_Recv, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv) - -void -ACE_FIFO_Recv::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Recv::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_FIFO::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("aux_handle_ = %d"), this->aux_handle_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_FIFO_Recv::close (void) -{ - ACE_TRACE ("ACE_FIFO_Recv::close"); - int result = ACE_FIFO::close (); - - if (this->aux_handle_ != ACE_INVALID_HANDLE) - return ACE_OS::close (this->aux_handle_); - else - return result; -} - -// Note that persistent means "open fifo for writing, as well as -// reading." This ensures that the fifo never gets EOF, even if there -// aren't any writers at the moment! - -int -ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - int persistent, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Recv::open"); - - if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms, sa) == -1) - return -1; - else if (this->disable (ACE_NONBLOCK) == -1) - return -1; - else if (persistent - && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY, 0, sa)) == ACE_INVALID_HANDLE) - return -1; - else - return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_FIFO_Recv::ACE_FIFO_Recv (void) - : aux_handle_ (ACE_INVALID_HANDLE) -{ - ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); -} - -ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - int persistent, - LPSECURITY_ATTRIBUTES sa) - : aux_handle_ (ACE_INVALID_HANDLE) -{ - ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); - - if (this->ACE_FIFO_Recv::open (fifo_name, - flags, - perms, - persistent, - sa) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Recv"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Recv.h b/ace/FIFO_Recv.h deleted file mode 100644 index fc4ec2222f3..00000000000 --- a/ace/FIFO_Recv.h +++ /dev/null @@ -1,85 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file FIFO_Recv.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//========================================================================== - - -#ifndef ACE_FIFO_RECV_H -#define ACE_FIFO_RECV_H - -#include /**/ "ace/pre.h" - -#include "ace/FIFO.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_fcntl.h" -#include "ace/Default_Constants.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FIFO_Recv - * - * @brief Receiver side of the bytestream C++ wrapper for UNIX - * FIFOs. - */ -class ACE_Export ACE_FIFO_Recv : public ACE_FIFO -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FIFO_Recv (void); - - /// Open up a bytestream named pipe for reading. - ACE_FIFO_Recv (const ACE_TCHAR *rendezvous, - int flags = O_CREAT | O_RDONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - int persistent = 1, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Open up a bytestream named pipe for reading. - int open (const ACE_TCHAR *rendezvous, - int flags = O_CREAT | O_RDONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - int persistent = 1, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Close down the named pipe. - int close (void); - - /// Recv of up to bytes. - ssize_t recv (void *buf, size_t len); - - /// Recv of exactly bytes (block until done). - ssize_t recv_n (void *buf, size_t len); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Auxiliary handle that is used to implement persistent FIFOs. - ACE_HANDLE aux_handle_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO_Recv.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_FIFO_RECV_H */ diff --git a/ace/FIFO_Recv.inl b/ace/FIFO_Recv.inl deleted file mode 100644 index b5cf96cb56d..00000000000 --- a/ace/FIFO_Recv.inl +++ /dev/null @@ -1,24 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/ACE.h" -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FIFO_Recv::recv (void *buf, size_t len) -{ - ACE_TRACE ("ACE_FIFO_Recv::recv"); - return ACE_OS::read (this->get_handle (), (char *) buf, len); -} - -ACE_INLINE ssize_t -ACE_FIFO_Recv::recv_n (void *buf, size_t n) -{ - ACE_TRACE ("ACE_FIFO_Recv::recv_n"); - return ACE::recv_n (this->get_handle (), buf, n); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Recv_Msg.cpp b/ace/FIFO_Recv_Msg.cpp deleted file mode 100644 index 7aa5b1d6721..00000000000 --- a/ace/FIFO_Recv_Msg.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// $Id$ - -#include "ace/FIFO_Recv_Msg.h" - -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO_Recv_Msg.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, FIFO_Recv_Msg, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv_Msg) - -void -ACE_FIFO_Recv_Msg::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Recv_Msg::dump"); - ACE_FIFO_Recv::dump (); -#endif /* ACE_HAS_DUMP */ -} - -// Note that persistent means "open FIFO for writing, as well as -// reading." This ensures that the FIFO never gets EOF, even if there -// aren't any writers at the moment! - -int -ACE_FIFO_Recv_Msg::open (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - int persistent, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::open"); - - return ACE_FIFO_Recv::open (fifo_name, - flags, - perms, - persistent, - sa); -} - -ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (void) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); -} - -ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - int persistent, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); - - if (this->ACE_FIFO_Recv_Msg::open (fifo_name, - flags, - perms, - persistent, - sa) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Recv_Msg"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Recv_Msg.h b/ace/FIFO_Recv_Msg.h deleted file mode 100644 index b1c7afe3eb3..00000000000 --- a/ace/FIFO_Recv_Msg.h +++ /dev/null @@ -1,138 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file FIFO_Recv_Msg.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_FIFO_RECV_MSG_H -#define ACE_FIFO_RECV_MSG_H -#include /**/ "ace/pre.h" - -#include "ace/FIFO_Recv.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decls -class ACE_Str_Buf; - -/** - * @class ACE_FIFO_Recv_Msg - * - * @brief Receiver side for the record oriented C++ wrapper for UNIX FIFOs. - * - * This method works slightly differently on platforms with the - * @c ACE_HAS_STREAM_PIPES configuration setting than those without. - * With ACE_HAS_STREAM_PIPES, the @c getmsg() system function is used - * and it preserves message boundaries internally. Without - * @c ACE_HAS_STREAM_PIPES, the message boundaries are emulated by - * this class and ACE_FIFO_Send_Msg cooperating. The sending class - * first writes an integer number of bytes in the message, then the - * message. ACE_FIFO_Recv_Msg reads the count, then the data. - * The operational differences occur primarily when a message is larger - * than what a caller of this class requests. See recv() for details. - */ -class ACE_Export ACE_FIFO_Recv_Msg : public ACE_FIFO_Recv -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FIFO_Recv_Msg (void); - - /// Open up a record-oriented named pipe for reading. - ACE_FIFO_Recv_Msg (const ACE_TCHAR *rendezvous, - int flags = O_CREAT | O_RDONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - int persistent = 1, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Open up a record-oriented named pipe for reading. - int open (const ACE_TCHAR *rendezvous, - int flags = O_CREAT | O_RDONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - int persistent = 1, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Receive a message based on attributes in an ACE_Str_Buf. - /** - * @param msg Reference to an ACE_Str_Buf whose @c buf member points - * to the memory to receive the data and @c maxlen member - * contains the maximum number of bytes to receive. - * On return after successfully reading data, the - * @c len member contains the number of bytes received and - * placed in the buffer pointed to by @c msg.buf. - * - * @retval -1 Error; consult @c errno for specific error number. - * @return If the @c ACE_HAS_STREAM_PIPES configuration setting is - * defined, the return value is the number of bytes received - * in the message and will be the same as @c buf.len. - * The return value from the @c getmsg() system function - * is discarded. - * If @c ACE_HAS_STREAM_PIPES is not defined, the number - * of bytes in the message read from the FIFO is returned. - * If the message is larger than the maximum length - * requested in @c msg.maxlen, the return value reflects - * the entire message length, and the @c msg.len member - * reflects how many bytes were actually placed in the - * caller's buffer. Any part of the message longer than - * @c msg.maxlen is discarded. - */ - ssize_t recv (ACE_Str_Buf &msg); - - /// Receive a message based on buffer pointer and maximum size. - /** - * @param buf Pointer to the memory to receive the data. - * @param len The maximum number of bytes to receive. - * - * @retval -1 Error; consult @c errno for specific error number. - * @return The number of bytes received in the message. For messages - * that are larger than the requested maximum size, the - * behavior is different depending on the @c ACE_HAS_STREAM_PIPES - * configuration setting. With @c ACE_HAS_STREAM_PIPES, - * the return value will be the same as @arg len (this is - * also possible if the message is exactly the same length - * as @arg len, and the two cases are indistinguishable). - * Without @c ACE_HAS_STREAM_PIPES, the return value is - * the total length of the message, including bytes in - * excess of @arg len. The excess bytes are discarded. - */ - ssize_t recv (void *buf, size_t len); - -#if defined (ACE_HAS_STREAM_PIPES) - /// Recv and message via Stream pipes. - ssize_t recv (ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags); - - /// Recv and message via Stream pipes in "band" mode. - ssize_t recv (int *band, - ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags); -#endif /* ACE_HAS_STREAM_PIPES */ - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO_Recv_Msg.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FIFO_RECV_MSG_H */ diff --git a/ace/FIFO_Recv_Msg.inl b/ace/FIFO_Recv_Msg.inl deleted file mode 100644 index bab21a7e20e..00000000000 --- a/ace/FIFO_Recv_Msg.inl +++ /dev/null @@ -1,111 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Min_Max.h" -#include "ace/OS_NS_stropts.h" - -#if !defined (ACE_HAS_STREAM_PIPES) -#include "ace/OS_NS_unistd.h" -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); -#if defined (ACE_HAS_STREAM_PIPES) - int i = 0; - if (ACE_OS::getmsg (this->get_handle (), - (strbuf *) 0, - (strbuf *) &recv_msg, - &i) == -1) - return -1; - else - return recv_msg.len; -#else /* Do the ol' 2-read trick... */ - if (ACE_OS::read (this->get_handle (), - (char *) &recv_msg.len, - sizeof recv_msg.len) != sizeof recv_msg.len) - return -1; - else - { - size_t remaining = static_cast (recv_msg.len); - size_t requested = static_cast (recv_msg.maxlen); - ssize_t recv_len = ACE_OS::read (this->get_handle (), - (char *) recv_msg.buf, - ACE_MIN (remaining, requested)); - if (recv_len == -1) - return -1; - // Tell caller what's really in the buffer. - recv_msg.len = static_cast (recv_len); - - // If there are more bytes remaining in the message, read them and - // throw them away. Leaving them in the FIFO would make it difficult - // to find the start of the next message in the fifo. - // Since the ACE_HAS_STREAM_PIPES version of this method doesn't - // return getmsg()'s indication of "data remaining", don't worry about - // saving the indication here either to read the remainder later. - size_t total_msg_size = remaining; - remaining -= recv_len; - while (remaining > 0) - { - const size_t throw_away = 1024; - char dev_null[throw_away]; - recv_len = ACE_OS::read (this->get_handle (), - dev_null, - ACE_MIN (remaining, throw_away)); - if (recv_len == -1) - break; - remaining -= recv_len; - } - return total_msg_size; - } -#endif /* ACE_HAS_STREAM_PIPES */ -} - -ACE_INLINE ssize_t -ACE_FIFO_Recv_Msg::recv (void *buf, size_t max_len) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); - ACE_Str_Buf recv_msg ((char *) buf, 0, static_cast (max_len)); - - return this->recv (recv_msg); -} - -#if defined (ACE_HAS_STREAM_PIPES) -ACE_INLINE ssize_t -ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); - if (ACE_OS::getmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - flags) == -1) - return -1; - else - return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); -} - -ACE_INLINE ssize_t -ACE_FIFO_Recv_Msg::recv (int *band, - ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); - if (ACE_OS::getpmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - band, - flags) == -1) - return -1; - else - return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); -} -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Send.cpp b/ace/FIFO_Send.cpp deleted file mode 100644 index c29871430ed..00000000000 --- a/ace/FIFO_Send.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// $Id$ - -#include "ace/FIFO_Send.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO_Send.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, FIFO_Send, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send) - -void -ACE_FIFO_Send::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Send::dump"); - ACE_FIFO::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_FIFO_Send::ACE_FIFO_Send (void) -{ -// ACE_TRACE ("ACE_FIFO_Send::ACE_FIFO_Send"); -} - -int -ACE_FIFO_Send::open (const ACE_TCHAR *rendezvous_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Send::open"); - return ACE_FIFO::open (rendezvous_name, - flags | O_WRONLY, - perms, - sa); -} - -ACE_FIFO_Send::ACE_FIFO_Send (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Send::ACE_FIFO_Send"); - if (this->ACE_FIFO_Send::open (fifo_name, - flags, - perms, - sa) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_FIFO_Send::ACE_FIFO_Send"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Send.h b/ace/FIFO_Send.h deleted file mode 100644 index 45e02c87c38..00000000000 --- a/ace/FIFO_Send.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file FIFO_Send.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//========================================================================== - - -#ifndef ACE_FIFO_SEND_H -#define ACE_FIFO_SEND_H - -#include /**/ "ace/pre.h" - -#include "ace/FIFO.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_fcntl.h" -#include "ace/Default_Constants.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FIFO_Send - * - * @brief Sender side for the bytestream C++ wrapper for UNIX FIFOs - */ -class ACE_Export ACE_FIFO_Send : public ACE_FIFO -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FIFO_Send (void); - - /// Open up a bytestream named pipe for writing. - ACE_FIFO_Send (const ACE_TCHAR *rendezvous, - int flags = O_WRONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Open up a bytestream named pipe for writing. - int open (const ACE_TCHAR *rendezvous, - int flags = O_WRONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Send of up to bytes. - ssize_t send (const void *buf, size_t len); - - /// Send of exactly bytes (block until done). - ssize_t send_n (const void *buf, size_t len); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO_Send.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_FIFO_SEND_H */ diff --git a/ace/FIFO_Send.inl b/ace/FIFO_Send.inl deleted file mode 100644 index 12491058e2c..00000000000 --- a/ace/FIFO_Send.inl +++ /dev/null @@ -1,24 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/ACE.h" -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FIFO_Send::send (const void *buf, size_t len) -{ - ACE_TRACE ("ACE_FIFO_Send::send"); - return ACE_OS::write (this->get_handle (), (const char *) buf, len); -} - -ACE_INLINE ssize_t -ACE_FIFO_Send::send_n (const void *buf, size_t n) -{ - ACE_TRACE ("ACE_FIFO_Send::send_n"); - return ACE::send_n (this->get_handle (), buf, n); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Send_Msg.cpp b/ace/FIFO_Send_Msg.cpp deleted file mode 100644 index f39c5d865e9..00000000000 --- a/ace/FIFO_Send_Msg.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// $Id$ - -#include "ace/FIFO_Send_Msg.h" - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_uio.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO_Send_Msg.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, FIFO_Send_Msg, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg) - -void -ACE_FIFO_Send_Msg::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Send_Msg::dump"); - ACE_FIFO_Send::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ssize_t -ACE_FIFO_Send_Msg::send (const ACE_Str_Buf &send_msg) -{ - // ACE_TRACE ("ACE_FIFO_Send_Msg::send"); -#if defined (ACE_HAS_STREAM_PIPES) - if (ACE_OS::putmsg (this->get_handle (), - (strbuf *) 0, - (strbuf *) &send_msg, - 0) == -1) - return -1; - else - return send_msg.len; -#else - iovec iov[2]; - - iov[0].iov_base = (char *) &send_msg.len; - iov[0].iov_len = sizeof send_msg.len; - - iov[1].iov_base = (char *) send_msg.buf; - iov[1].iov_len = static_cast (send_msg.len); - - ssize_t sent = ACE_OS::writev (this->get_handle (), iov, 2); - if (sent > 0) - sent -= iov[0].iov_len; // Don't count the length we added. - return sent; -#endif /* ACE_HAS_STREAM_PIPES */ -} - -ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (void) -{ -// ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg"); -} - -int -ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::open"); - return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms, sa); -} - -ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg"); - if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Send_Msg"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Send_Msg.h b/ace/FIFO_Send_Msg.h deleted file mode 100644 index 8272ec6c819..00000000000 --- a/ace/FIFO_Send_Msg.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file FIFO_Send_Msg.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_FIFO_SEND_MSG_H -#define ACE_FIFO_SEND_MSG_H -#include /**/ "ace/pre.h" - -#include "ace/FIFO_Send.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_STREAM_PIPES) -# include "ace/OS_NS_stropts.h" -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward Decls -class ACE_Str_Buf; - -/** - * @class ACE_FIFO_Send_Msg - * - * @brief Sender side for the Record oriented C++ wrapper for UNIX - * FIFOs. - */ -class ACE_Export ACE_FIFO_Send_Msg : public ACE_FIFO_Send -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FIFO_Send_Msg (void); - - /// Open up a record-oriented named pipe for writing. - ACE_FIFO_Send_Msg (const ACE_TCHAR *rendezvous, - int flags = O_WRONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Open up a record-oriented named pipe for writing. - int open (const ACE_TCHAR *rendezvous, - int flags = O_WRONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Send of up to bytes. - ssize_t send (const ACE_Str_Buf &msg); - - /// Send of exactly bytes (block until done). - ssize_t send (const void *buf, size_t len); - -#if defined (ACE_HAS_STREAM_PIPES) - /// Send and message via Stream pipes. - ssize_t send (const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl = 0, - int flags = 0); - - /// Send and message via Stream pipes in "band" mode. - ssize_t send (int band, - const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl = 0, - int flags = MSG_BAND); -#endif /* ACE_HAS_STREAM_PIPES */ - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO_Send_Msg.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FIFO_SEND_MSG_H */ diff --git a/ace/FIFO_Send_Msg.inl b/ace/FIFO_Send_Msg.inl deleted file mode 100644 index 74392656597..00000000000 --- a/ace/FIFO_Send_Msg.inl +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_stropts.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FIFO_Send_Msg::send (const void *buf, size_t len) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::send"); - ACE_Str_Buf send_msg ((char *) buf, static_cast (len)); - - return this->send (send_msg); -} - -#if defined (ACE_HAS_STREAM_PIPES) -ACE_INLINE ssize_t -ACE_FIFO_Send_Msg::send (const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl, - int flags) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::send"); - if (ACE_OS::putmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - flags) == -1) - return-1; - else - return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); -} - -ACE_INLINE ssize_t -ACE_FIFO_Send_Msg::send (int band, - const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl, - int flags) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::send"); - - if (ACE_OS::putpmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - band, - flags) == -1) - return -1; - else - return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); -} -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE.cpp b/ace/FILE.cpp deleted file mode 100644 index 57aa52b839f..00000000000 --- a/ace/FILE.cpp +++ /dev/null @@ -1,151 +0,0 @@ -// FILE.cpp -// $Id$ - -/* Defines the member functions for the base class of the ACE_IO_SAP - ACE_FILE abstraction. */ - -#include "ace/FILE.h" - -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_stat.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FILE.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, FILE, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FILE) - -void -ACE_FILE::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FILE::dump"); - ACE_IO_SAP::dump (); -#endif /* ACE_HAS_DUMP */ -} - -// This is the do-nothing constructor. - -ACE_FILE::ACE_FILE (void) -{ - ACE_TRACE ("ACE_FILE::ACE_FILE"); -} - -// Close the file - -int -ACE_FILE::close (void) -{ - ACE_TRACE ("ACE_FILE::close"); - int result = 0; - - if (this->get_handle () != ACE_INVALID_HANDLE) - { - result = ACE_OS::close (this->get_handle ()); - this->set_handle (ACE_INVALID_HANDLE); - } - return result; -} - -int -ACE_FILE::get_info (ACE_FILE_Info *finfo) -{ - ACE_TRACE ("ACE_FILE::get_info"); - ACE_stat filestatus; - - int const result = ACE_OS::fstat (this->get_handle (), - &filestatus); - - if (result == 0) - { - finfo->mode_ = filestatus.st_mode; - finfo->nlink_ = filestatus.st_nlink; - finfo->size_ = filestatus.st_size; - } - - return result; -} - -int -ACE_FILE::get_info (ACE_FILE_Info &finfo) -{ - ACE_TRACE ("ACE_FILE::get_info"); - - return this->get_info (&finfo); -} - -int -ACE_FILE::truncate (off_t length) -{ - ACE_TRACE ("ACE_FILE::truncate"); - return ACE_OS::ftruncate (this->get_handle(), length); -} - -off_t -ACE_FILE::seek (off_t offset, int startpos) -{ - return ACE_OS::lseek (this->get_handle (), - offset, - startpos); -} - -off_t -ACE_FILE::tell (void) -{ - ACE_TRACE ("ACE_FILE::tell"); - return ACE_OS::lseek (this->get_handle (), 0, SEEK_CUR); -} - -// Return the local endpoint address. - -int -ACE_FILE::get_local_addr (ACE_Addr &addr) const -{ - ACE_TRACE ("ACE_FILE::get_local_addr"); - - // Perform the downcast since had better be an - // . - ACE_FILE_Addr *file_addr = - dynamic_cast (&addr); - - if (file_addr == 0) - return -1; - else - { - *file_addr = this->addr_; - return 0; - } -} - -// Return the same result as . - -int -ACE_FILE::get_remote_addr (ACE_Addr &addr) const -{ - ACE_TRACE ("ACE_FILE::get_remote_addr"); - - return this->get_local_addr (addr); -} - -int -ACE_FILE::remove (void) -{ - ACE_TRACE ("ACE_FILE::remove"); - - this->close (); - return ACE_OS::unlink (this->addr_.get_path_name ()); -} - -int -ACE_FILE::unlink (void) -{ - ACE_TRACE ("ACE_FILE::unlink"); - - return ACE_OS::unlink (this->addr_.get_path_name ()); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE.h b/ace/FILE.h deleted file mode 100644 index 619fd94ce38..00000000000 --- a/ace/FILE.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file FILE.h - * - * $Id$ - * - * @author Gerhard Lenzer - */ -//============================================================================= - -#ifndef ACE_FILE_H -#define ACE_FILE_H -#include /**/ "ace/pre.h" - -#include "ace/IO_SAP.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/FILE_Addr.h" - -// The following is necessary since many C++ compilers don't support -// typedef'd types inside of classes used as formal template -// arguments... ;-(. Luckily, using the C++ preprocessor I can hide -// most of this nastiness! - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) -#define ACE_FILE_CONNECTOR ACE_FILE_Connector -#define ACE_FILE_STREAM ACE_FILE_IO -#else /* TEMPLATES are broken (must be a cfront-based compiler...) */ -#define ACE_FILE_CONNECTOR ACE_FILE_Connector, ACE_FILE_Addr -#define ACE_FILE_STREAM ACE_FILE_IO, ACE_FILE_Addr -#endif /* ACE_TEMPLATE_TYPEDEFS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FILE_Info - * - * @brief Abstracts basic OS FILE information. - */ -class ACE_Export ACE_FILE_Info -{ -public: - /// Mode of file - mode_t mode_; - - /// No of links - nlink_t nlink_; - - /// Size of file - ACE_LOFF_T size_; -}; - -/** - * @class ACE_FILE - * - * @brief Defines the core methods of the ACE_FILE abstraction. - */ -class ACE_Export ACE_FILE : public ACE_IO_SAP -{ -public: - /// Close the ACE_FILE handle without removing the ACE_FILE from - /// the file system. - int close (void); - - /// Close and remove the ACE_FILE from the file system. - int remove (void); - - /// Remove the ACE_FILE from the file system without closing the - /// ACE_FILE handle. - int unlink (void); - - /// Get information on this ACE_FILE. - int get_info (ACE_FILE_Info *finfo); - - /// Get information on this . - int get_info (ACE_FILE_Info &finfo); - - /// Set filesize to length byte. - int truncate (off_t length); - - /** - * Sets the file pointer as follows: - * o If is , the pointer is set to - * bytes. - * - * o If is , the pointer is set to its - * current location plus . - * - * o If is , the pointer is set to the size - * of the file plus offset. - */ - off_t seek (off_t offset, - int whence = SEEK_CUR); - - /// Return an offset for the file handle. - off_t tell (void); - - /** - * Disable signal @a signum - * This is here to prevent Win32 from - * disabling SPIPE using socket calls - */ - int disable (int signum) const ; - - /// Return the local endpoint address in the referenced ACE_Addr. - /// Returns 0 if successful, else -1. - int get_local_addr (ACE_Addr &) const; - - /// Return the same thing as get_local_addr(). - int get_remote_addr (ACE_Addr &) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Ensure that this class is only created by the - /// ACE_FILE_Connector. - ACE_FILE (void); - - /// File we are "connected" with... - ACE_FILE_Addr addr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FILE.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_H */ diff --git a/ace/FILE.inl b/ace/FILE.inl deleted file mode 100644 index fdd65029d3a..00000000000 --- a/ace/FILE.inl +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_FILE::disable (int signum) const -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (signum) ; - return 0 ; -#else /* ACE_WIN32 */ - return ACE_IO_SAP::disable (signum) ; -#endif /* ACE_WIN32 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_Addr.cpp b/ace/FILE_Addr.cpp deleted file mode 100644 index 09d87c0d9b1..00000000000 --- a/ace/FILE_Addr.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// $Id$ - -#include "ace/FILE_Addr.h" -#include "ace/Lib_Find.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_stdlib.h" -#include "ace/OS_NS_string.h" -#include "ace/os_include/sys/os_socket.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FILE_Addr.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, FILE_Addr, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Addr) - -ACE_FILE_Addr::ACE_FILE_Addr (void) - : ACE_Addr (AF_FILE, sizeof this->filename_ / sizeof (ACE_TCHAR)) -{ - this->filename_[0] = '\0'; -} - -int -ACE_FILE_Addr::set (const ACE_FILE_Addr &sa) -{ - if (sa.get_type () == AF_ANY) - { -#if defined (ACE_DEFAULT_TEMP_FILE) - // Create a temporary file. - ACE_OS::strcpy (this->filename_, - ACE_DEFAULT_TEMP_FILE); -#else /* ACE_DEFAULT_TEMP_FILE */ - if (ACE::get_temp_dir (this->filename_, - MAXPATHLEN - 15) == -1) - // -15 for ace-file-XXXXXX - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Temporary path too long, ") - ACE_LIB_TEXT ("defaulting to current directory\n"))); - this->filename_[0] = 0; - } - - // Add the filename to the end - ACE_OS::strcat (this->filename_, ACE_LIB_TEXT ("ace-fileXXXXXX")); - -#endif /* ACE_DEFAULT_TEMP_FILE */ - - if (ACE_OS::mktemp (this->filename_) == 0) - return -1; - this->base_set (AF_FILE, - static_cast (ACE_OS::strlen (this->filename_) + 1)); - } - else - { - (void) ACE_OS::strsncpy (this->filename_, - sa.filename_, - sa.get_size ()); - - this->base_set (sa.get_type (), - sa.get_size ()); - } - return 0; -} - -// Copy constructor. - -ACE_FILE_Addr::ACE_FILE_Addr (const ACE_FILE_Addr &sa) - : ACE_Addr (AF_FILE, sizeof this->filename_) -{ - this->set (sa); -} - -int -ACE_FILE_Addr::set (const ACE_TCHAR *filename) -{ - this->ACE_Addr::base_set (AF_FILE, - static_cast (ACE_OS::strlen (filename) + 1)); - (void) ACE_OS::strsncpy (this->filename_, - filename, - sizeof this->filename_ / sizeof (ACE_TCHAR)); - return 0; -} - -ACE_FILE_Addr & -ACE_FILE_Addr::operator= (const ACE_FILE_Addr &sa) -{ - if (this != &sa) - this->set (sa); - return *this; -} - -// Create a ACE_Addr from a ACE_FILE pathname. - -ACE_FILE_Addr::ACE_FILE_Addr (const ACE_TCHAR *filename) -{ - this->set (filename); -} - -int -ACE_FILE_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const -{ - ACE_OS::strsncpy (s, this->filename_, len); - return 0; -} - -// Return the address. - -void * -ACE_FILE_Addr::get_addr (void) const -{ - return (void *) &this->filename_; -} - -void -ACE_FILE_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FILE_Addr::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("filename_ = %s"), this->filename_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_Addr.h b/ace/FILE_Addr.h deleted file mode 100644 index 815319a834b..00000000000 --- a/ace/FILE_Addr.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file FILE_Addr.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - - -#ifndef ACE_FILE_ADDR_H -#define ACE_FILE_ADDR_H -#include /**/ "ace/pre.h" - -#include "ace/Addr.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Flag_Manip.h" -#include "ace/os_include/os_dirent.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FILE_Addr - * - * @brief Defines the FILE address family address format. - */ -class ACE_Export ACE_FILE_Addr : public ACE_Addr -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FILE_Addr (void); - - /// Copy constructor. - ACE_FILE_Addr (const ACE_FILE_Addr &sa); - - /// Acts like a copy constructor. If == ACE_Addr::sap_any then - /// create a temporary filename using . - int set (const ACE_FILE_Addr &sa); - - /// Create a ACE_FILE_Addr from a pathname. - explicit ACE_FILE_Addr (const ACE_TCHAR *filename); - - /// Create a ACE_FILE_Addr from a pathname. - int set (const ACE_TCHAR *filename); - - /// Assignment operator. - ACE_FILE_Addr &operator= (const ACE_FILE_Addr &); - - /// Return a pointer to the address. - virtual void *get_addr (void) const; - - /// Transform the current address into string format. - virtual int addr_to_string (ACE_TCHAR *addr, size_t) const; - - /// Compare two addresses for equality. - bool operator == (const ACE_FILE_Addr &SAP) const; - - /// Compare two addresses for inequality. - bool operator != (const ACE_FILE_Addr &SAP) const; - - /// Return the path name used for the rendezvous point. - const ACE_TCHAR *get_path_name (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Name of the file. - ACE_TCHAR filename_[MAXPATHLEN + 1]; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FILE_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_ADDR_H */ diff --git a/ace/FILE_Addr.inl b/ace/FILE_Addr.inl deleted file mode 100644 index e03cd2ab156..00000000000 --- a/ace/FILE_Addr.inl +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - - -#include "ace/SString.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Compare two addresses for equality. - -ACE_INLINE bool -ACE_FILE_Addr::operator == (const ACE_FILE_Addr &sap) const -{ - return ACE_OS::strcmp (this->filename_, sap.filename_) == 0; -} - -// Compare two addresses for inequality. - -ACE_INLINE bool -ACE_FILE_Addr::operator != (const ACE_FILE_Addr &sap) const -{ - return !((*this) == sap); // This is lazy, of course... ;-) -} - -// Return the path name used for the rendezvous point. - -ACE_INLINE const ACE_TCHAR * -ACE_FILE_Addr::get_path_name (void) const -{ - return this->filename_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_Connector.cpp b/ace/FILE_Connector.cpp deleted file mode 100644 index 56c7a5000fc..00000000000 --- a/ace/FILE_Connector.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// FILE_Connector.cpp -// $Id$ - -#include "ace/FILE_Connector.h" -#include "ace/Handle_Ops.h" -#include "ace/OS_NS_stdlib.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FILE_Connector.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, FILE_Connector, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Connector) - -void -ACE_FILE_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FILE_Connector::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_FILE_Connector::ACE_FILE_Connector (void) -{ - ACE_TRACE ("ACE_FILE_Connector::ACE_FILE_Connector"); -} - -int -ACE_FILE_Connector::connect (ACE_FILE_IO &new_io, - const ACE_FILE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &, - int, - int flags, - int perms) -{ - ACE_TRACE ("ACE_FILE_Connector::connect"); - ACE_ASSERT (new_io.get_handle () == ACE_INVALID_HANDLE); - - ACE_HANDLE handle = ACE_INVALID_HANDLE; - - // Check to see if caller has requested that we create the filename. - if (reinterpret_cast ( - const_cast (remote_sap)) == ACE_Addr::sap_any) - { - // Create a new temporary file. - // Use ACE_OS::mkstemp() if it is available since it avoids a - // race condition, and subsequently a security hole due to that - // race condition (specifically, a denial-of-service attack). - // - // However, using mkstemp() prevents us from doing a timed open - // since it opens the file for us. Better to avoid the race - // condition. - char filename[] = "ace-file-XXXXXX"; - - handle = ACE_OS::mkstemp (filename); // mkstemp() replaces "XXXXXX" - - if (handle == ACE_INVALID_HANDLE - || new_io.addr_.set (ACE_TEXT_CHAR_TO_TCHAR (filename)) != 0) - return -1; - - new_io.set_handle (handle); - - return 0; - } - else - new_io.addr_ = remote_sap; // class copy. - - handle = ACE::handle_timed_open (timeout, - new_io.addr_.get_path_name (), - flags, - perms); - - new_io.set_handle (handle); - return handle == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_Connector.h b/ace/FILE_Connector.h deleted file mode 100644 index 038f97ee5a1..00000000000 --- a/ace/FILE_Connector.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file FILE_Connector.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - -#ifndef ACE_FILE_CONNECTOR_H -#define ACE_FILE_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/FILE_IO.h" -#include "ace/Log_Msg.h" -#include "ace/os_include/os_fcntl.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FILE_Connector - * - * @brief Defines an active connection factory for the ACE_FILE wrappers. - * - * Note that the O_APPEND flag is only partly supported on Win32. If - * you specify O_APPEND, then the file pointer will be positioned at - * the end of the file initially during open, but it is not - * re-positioned at the end prior to each write, as specified by - * POSIX. This is generally good enough for typical situations, but - * it is ``not quite right'' in its semantics. - */ -class ACE_Export ACE_FILE_Connector -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FILE_Connector (void); - - /** - * Actively ``connect'' and produce a object - * if things go well. The is the file that we are - * trying to create/open. If it's the default value of - * then the user is letting the OS create the - * filename (via ). The is the amount of - * time to wait to create/open the file. If it's 0 then we block - * indefinitely. If *timeout == {0, 0} then the file is created - * using non-blocking mode. In this case, if the create/open can't - * be done immediately the value of -1 is returned with . If *timeout > {0, 0} then this is the maximum amount of - * time to wait before timing out. If the time expires before the - * connection is made . The and - * parameters are ignored. The and - * arguments are passed down to the method. - */ - ACE_FILE_Connector (ACE_FILE_IO &new_io, - const ACE_FILE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR | O_CREAT, - int perms = ACE_DEFAULT_FILE_PERMS); - - /** - * Actively ``connect'' and produce a object - * if things go well. The is the file that we are - * trying to create/open. If it's the default value of - * then the user is letting the OS create the - * filename (via ). The is the amount of - * time to wait to create/open the file. If it's 0 then we block - * indefinitely. If *timeout == {0, 0} then the file is created - * using non-blocking mode. In this case, if the create/open can't - * be done immediately the value of -1 is returned with . If *timeout > {0, 0} then this is the maximum amount of - * time to wait before timing out. If the time expires before the - * connection is made . The and - * parameters are ignored. The and - * arguments are passed down to the method. - */ - int connect (ACE_FILE_IO &new_io, - const ACE_FILE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR | O_CREAT, - int perms = ACE_DEFAULT_FILE_PERMS); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Meta-type "trait" information. - typedef ACE_FILE_Addr PEER_ADDR; - typedef ACE_FILE_IO PEER_STREAM; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FILE_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_CONNECTOR_H */ diff --git a/ace/FILE_Connector.inl b/ace/FILE_Connector.inl deleted file mode 100644 index 7fbc9db5b33..00000000000 --- a/ace/FILE_Connector.inl +++ /dev/null @@ -1,36 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// Creates a Local ACE_FILE. - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_FILE_Connector::ACE_FILE_Connector (ACE_FILE_IO &new_io, - const ACE_FILE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_FILE_Connector::ACE_FILE_Connector"); - if (this->connect (new_io, remote_sap, timeout, local_sap, - reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("address %s, %p\n"), - remote_sap.get_path_name (), - ACE_LIB_TEXT ("ACE_FILE_IO"))); -} - -ACE_INLINE int -ACE_FILE_Connector::reset_new_handle (ACE_HANDLE handle) -{ - ACE_UNUSED_ARG (handle); - // Nothing to do here since the handle is not a socket - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_IO.cpp b/ace/FILE_IO.cpp deleted file mode 100644 index 689aedbb3bc..00000000000 --- a/ace/FILE_IO.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// $Id$ - -#include "ace/FILE_IO.h" - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_stat.h" -#include "ace/OS_Memory.h" -#include "ace/Truncate.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FILE_IO.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, FILE_IO, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FILE_IO) - -void -ACE_FILE_IO::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FILE_IO::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->addr_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Simple-minded do nothing constructor. - -ACE_FILE_IO::ACE_FILE_IO (void) -{ - ACE_TRACE ("ACE_FILE_IO::ACE_FILE_IO"); -} - -// Send N char *ptrs and int lengths. Note that the char *'s precede -// the ints (basically, an varargs version of writev). The count N is -// the *total* number of trailing arguments, *not* a couple of the -// number of tuple pairs! - -ssize_t -ACE_FILE_IO::send (size_t n, ...) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - va_list argp; - int total_tuples = ACE_Utils::Truncate (n / 2); - iovec *iovp = 0; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::writev (this->get_handle (), - iovp, - total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -// This is basically an interface to ACE_OS::readv, that doesn't use -// the struct iovec explicitly. The ... can be passed as an arbitrary -// number of (char *ptr, int len) tuples. However, the count N is the -// *total* number of trailing arguments, *not* a couple of the number -// of tuple pairs! - -ssize_t -ACE_FILE_IO::recv (size_t n, ...) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - va_list argp; - int total_tuples = ACE_Utils::Truncate (n / 2); - iovec *iovp = 0; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t const result = ACE_OS::readv (this->get_handle (), - iovp, - total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -// Allows a client to read from a file without having to provide a -// buffer to read. This method determines how much data is in the -// file, allocates a buffer of this size, reads in the data, and -// returns the number of bytes read. - -ssize_t -ACE_FILE_IO::recvv (iovec *io_vec) -{ - ACE_TRACE ("ACE_FILE_IO::recvv"); - - io_vec->iov_base = 0; - size_t const length = static_cast (ACE_OS::filesize (this->get_handle ())); - - if (length > 0) - { - ACE_NEW_RETURN (io_vec->iov_base, - char[length], - -1); - io_vec->iov_len = this->recv_n (io_vec->iov_base, - length); - return io_vec->iov_len; - } - else - return length; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_IO.h b/ace/FILE_IO.h deleted file mode 100644 index ada2266c618..00000000000 --- a/ace/FILE_IO.h +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file FILE_IO.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_FILE_IO_H -#define ACE_FILE_IO_H -#include /**/ "ace/pre.h" - -#include "ace/FILE.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/FILE_Addr.h" - -// Used in the FILE_IO.h file... -#include "ace/os_include/os_stdio.h" -#include "ace/os_include/sys/os_uio.h" - -#if defined (ACE_HAS_STREAM_PIPES) -# include "ace/OS_NS_stropts.h" -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl. -class ACE_Message_Block; -class ACE_Time_Value; - -/** - * @class ACE_FILE_IO - * - * @brief Read/Write operations on Files - */ -class ACE_Export ACE_FILE_IO : public ACE_FILE -{ -public: - friend class ACE_FILE_Connector; - - // = Initialization method. - /// Default constructor. - ACE_FILE_IO (void); - - /// send upto bytes in . - ssize_t send (const void *buf, size_t n) const; - - /// Recv upto bytes in . - ssize_t recv (void *buf, size_t n) const; - - /// Send n bytes, keep trying until n are sent. - ssize_t send_n (const void *buf, size_t n) const; - - /// Send all the s chained through their and - /// pointers. This call uses the underlying OS gather-write - /// operation to reduce the domain-crossing penalty. - ssize_t send_n (const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - /// Recv n bytes, keep trying until n are received. - ssize_t recv_n (void *buf, size_t n) const; - -#if defined (ACE_HAS_STREAM_PIPES) - /// Send bytes via STREAM pipes. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int flags = 0) const; - - /// Recv bytes via STREAM pipes. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *flags) const; - - /// Send bytes via STREAM pipes using "band" mode. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int band, - int flags) const; - - /// Recv bytes via STREAM pipes using "band" mode. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *band, - int *flags) const; - -#endif /* ACE_HAS_STREAM_PIPES */ - - /// Send iovecs via <::writev>. - ssize_t send (const iovec iov[], int n) const; - - /// Recv iovecs via <::readv>. - ssize_t recv (iovec iov[], int n) const; - - /** - * Send N char *ptrs and int lengths. Note that the char *'s - * precede the ints (basically, an varargs version of writev). The - * count N is the *total* number of trailing arguments, *not* a - * couple of the number of tuple pairs! - */ - ssize_t send (size_t n, ...) const; - - /** - * This is an interface to ::readv, that doesn't use the struct - * iovec explicitly. The ... can be passed as an arbitrary number - * of (char *ptr, int len) tuples. However, the count N is the - * *total* number of trailing arguments, *not* a couple of the - * number of tuple pairs! - */ - ssize_t recv (size_t n, ...) const; - - /// Send bytes via Win32 WriteFile using overlapped I/O. - ssize_t send (const void *buf, - size_t n, - ACE_OVERLAPPED *overlapped) const; - - /// Recv bytes via Win32 ReadFile using overlapped I/O. - ssize_t recv (void *buf, - size_t n, - ACE_OVERLAPPED *overlapped) const; - - /// Send an of size to the file. - ssize_t sendv (const iovec iov[], - int n) const; - - /** - * Allows a client to read from a file without having to provide a - * buffer to read. This method determines how much data is in the - * file, allocates a buffer of this size, reads in the data, and - * returns the number of bytes read. The caller is responsible for - * deleting the member in the field of using - * delete [] io_vec->iov_base. - */ - ssize_t recvv (iovec *io_vec); - - /// Send an of size to the file. Will block until all - /// bytes are sent or an error occurs. - ssize_t sendv_n (const iovec iov[], - int n) const; - - /// Receive an of size to the file. - ssize_t recvv_n (iovec iov[], - int n) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Meta-type info - typedef ACE_FILE_Addr PEER_ADDR; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FILE_IO.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_IO_H */ diff --git a/ace/FILE_IO.inl b/ace/FILE_IO.inl deleted file mode 100644 index 7db33a0c717..00000000000 --- a/ace/FILE_IO.inl +++ /dev/null @@ -1,152 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/ACE.h" -#include "ace/OS_NS_sys_uio.h" -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FILE_IO::sendv_n (const iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::sendv_n"); - return ACE::writev_n (this->get_handle (), - iov, - n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send_n (const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - ACE_TRACE ("ACE_FILE_IO::send_n"); - ACE_UNUSED_ARG (timeout); - return ACE::write_n (this->get_handle (), - message_block, - bytes_transferred); -} - -// Recv an n byte message from the file. - -ACE_INLINE ssize_t -ACE_FILE_IO::recvv_n (iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::recvv_n"); - // @@ Carlos, can you please update this to call the - // new ACE::recvv_n() method that you write? - return ACE_OS::readv (this->get_handle (), - iov, - n); -} - -// Send an of size to the file. - -ACE_INLINE ssize_t -ACE_FILE_IO::sendv (const iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::sendv"); - return ACE_OS::writev (this->get_handle (), iov, n); -} - -// Send exactly N bytes from BUF to this file. Keeping trying until -// this many bytes are sent. - -ACE_INLINE ssize_t -ACE_FILE_IO::send_n (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_FILE_IO::send_n"); - return ACE::write_n (this->get_handle (), buf, n); -} - -// Receive exactly N bytes from this file into BUF. Keep trying until -// this many bytes are received. - -ACE_INLINE ssize_t -ACE_FILE_IO::recv_n (void *buf, size_t n) const -{ - ACE_TRACE ("ACE_FILE_IO::recv_n"); - return ACE::read_n (this->get_handle (), buf, n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::write (this->get_handle (), buf, n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::recv (void *buf, size_t n) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::read (this->get_handle (), buf, n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::writev (this->get_handle (), iov, n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::recv (iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::readv (this->get_handle (), iov, n); -} - -#if defined (ACE_HAS_STREAM_PIPES) -ACE_INLINE ssize_t -ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::write (this->get_handle (), - buf, n, - overlapped); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::recv (void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::read (this->get_handle (), buf, n, - overlapped); -} - -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/File_Lock.cpp b/ace/File_Lock.cpp deleted file mode 100644 index 038e0224820..00000000000 --- a/ace/File_Lock.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ - -#include "ace/File_Lock.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/File_Lock.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, File_Lock, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_File_Lock) - -void -ACE_File_Lock::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_File_Lock::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h, - int unlink_in_destructor) - : removed_ (0), - unlink_in_destructor_ (unlink_in_destructor) -{ -// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); - if (ACE_OS::flock_init (&this->lock_) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_File_Lock::ACE_File_Lock"))); - this->set_handle (h); -} - -ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR *name, - int flags, - mode_t perms, - int unlink_in_destructor) - : unlink_in_destructor_ (unlink_in_destructor) -{ -// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); - - if (this->open (name, flags, perms) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p %s\n"), - ACE_LIB_TEXT ("ACE_File_Lock::ACE_File_Lock"), - name)); -} - -int -ACE_File_Lock::open (const ACE_TCHAR *name, - int flags, - mode_t perms) -{ -// ACE_TRACE ("ACE_File_Lock::open"); - this->removed_ = 0; - return ACE_OS::flock_init (&this->lock_, flags, name, perms); -} - -ACE_File_Lock::~ACE_File_Lock (void) -{ -// ACE_TRACE ("ACE_File_Lock::~ACE_File_Lock"); - this->remove (this->unlink_in_destructor_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/File_Lock.h b/ace/File_Lock.h deleted file mode 100644 index 686fee3e0df..00000000000 --- a/ace/File_Lock.h +++ /dev/null @@ -1,170 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file File_Lock.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_FILE_LOCK_H -#define ACE_FILE_LOCK_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_stdio.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_File_Lock - * - * @brief A wrapper around the UNIX file locking mechanism. - * - * Allows us to "adapt" the UNIX file locking mechanisms to work - * with all of our Guard stuff... - */ -class ACE_Export ACE_File_Lock -{ -public: - /** - * Set the of the File_Lock to . Note that this - * constructor assumes ownership of the and will close it - * down in . If you want the to stay open when - * is called make sure to call on the . - * If you don't want the file unlinked in the destructor pass a - * zero value for . - */ - ACE_File_Lock (ACE_HANDLE handle = ACE_INVALID_HANDLE, - int unlink_in_destructor = 1); - - /// Open the with and and set the result - /// to . If you don't want the file unlinked in the - /// destructor pass a zero value for . - ACE_File_Lock (const ACE_TCHAR *filename, - int flags, - mode_t mode = 0, - int unlink_in_destructor = 1); - - /// Open the with and and set the result to - /// . - int open (const ACE_TCHAR *filename, - int flags, - mode_t mode = 0); - - /// Remove a File lock by releasing it and closing down the . - ~ACE_File_Lock (void); - - /// Remove a File lock by releasing it and closing down the - /// . If is non-0 then we unlink the file. - int remove (int unlink_file = 1); - - /** - * Note, for interface uniformity with other synchronization - * wrappers we include the method. This is implemented as - * a write-lock to be on the safe-side... - */ - int acquire (short whence = 0, off_t start = 0, off_t len = 1); - - /** - * Note, for interface uniformity with other synchronization - * wrappers we include the method. This is implemented - * as a write-lock to be on the safe-side... Returns -1 on failure. - * If we "failed" because someone else already had the lock, - * is set to . - */ - int tryacquire (short whence = 0, off_t start = 0, off_t len = 1); - - /// Unlock a readers/writer lock. - int release (short whence = 0, off_t start = 0, off_t len = 1); - - /// Acquire a write lock, but block if any readers or a - /// writer hold the lock. - int acquire_write (short whence = 0, off_t start = 0, off_t len = 1); - - /** - * Conditionally acquire a write lock (i.e., won't block). Returns - * -1 on failure. If we "failed" because someone else already had - * the lock, is set to . - */ - int tryacquire_write (short whence = 0, off_t start = 0, off_t len = 1); - - /** - * Conditionally upgrade to a write lock (i.e., won't block). Returns - * -1 on failure. If we "failed" because someone else already had - * the lock, is set to . - */ - int tryacquire_write_upgrade (short whence = 0, - off_t start = 0, - off_t len = 1); - - /** - * Acquire a read lock, but block if a writer hold the lock. - * Returns -1 on failure. If we "failed" because someone else - * already had the lock, is set to . - */ - int acquire_read (short whence = 0, off_t start = 0, off_t len = 1); - - /** - * Conditionally acquire a read lock (i.e., won't block). Returns - * -1 on failure. If we "failed" because someone else already had - * the lock, is set to . - */ - int tryacquire_read (short whence = 0, off_t start = 0, off_t len = 1); - - /// Get underlying ACE_HANDLE for the file. - ACE_HANDLE get_handle (void) const; - - /** - * Set underlying ACE_HANDLE. Note that this method assumes - * ownership of the and will close it down in . If - * you want the to stay open when is called make - * sure to call on the before closing it. You are - * responsible for the closing the existing before - * overwriting it. - */ - void set_handle (ACE_HANDLE); - - /// Dump state of the object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Locking structure for OS record locks. - ACE_OS::ace_flock_t lock_; - - /// Keeps track of whether has been called yet to avoid - /// multiple calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure - /// that you don't have multiple threads simultaneously calling - /// on the same object, which is a bad idea anyway... - int removed_; - - /// Keeps track of whether to unlink the underlying file in the - /// destructor. - int unlink_in_destructor_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_File_Lock &); - ACE_File_Lock (const ACE_File_Lock &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/File_Lock.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_LOCK_H */ diff --git a/ace/File_Lock.inl b/ace/File_Lock.inl deleted file mode 100644 index be9c149b8d8..00000000000 --- a/ace/File_Lock.inl +++ /dev/null @@ -1,94 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_File_Lock::acquire_read (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::acquire_read"); - return ACE_OS::flock_rdlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire_read (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire_read"); - return ACE_OS::flock_tryrdlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire_write (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire_write"); - return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire_write_upgrade (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire_write_upgrade"); - return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire"); - return this->tryacquire_write (whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::acquire_write (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::acquire_write"); - return ACE_OS::flock_wrlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::acquire (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::acquire"); - return this->acquire_write (whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::release (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::release"); - return ACE_OS::flock_unlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::remove (int unlink_file) -{ -// ACE_TRACE ("ACE_File_Lock::remove"); - - int result = 0; - - if (this->removed_ == 0) - { - this->removed_ = 1; - result = ACE_OS::flock_destroy (&this->lock_, - unlink_file); - } - return result; -} - -ACE_INLINE ACE_HANDLE -ACE_File_Lock::get_handle (void) const -{ -// ACE_TRACE ("ACE_File_Lock::get_handle"); - return this->lock_.handle_; -} - -ACE_INLINE void -ACE_File_Lock::set_handle (ACE_HANDLE h) -{ -// ACE_TRACE ("ACE_File_Lock::set_handle"); - this->lock_.handle_ = h; - this->removed_ = 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Filecache.cpp b/ace/Filecache.cpp deleted file mode 100644 index b76a3255d16..00000000000 --- a/ace/Filecache.cpp +++ /dev/null @@ -1,751 +0,0 @@ -// $Id$ - -#include "ace/Filecache.h" -#include "ace/Object_Manager.h" -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/Guard_T.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_time.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_fcntl.h" - -ACE_RCSID (ace, - Filecache, - "$Id$") - -#if defined (ACE_WIN32) -// Specifies no sharing flags. -#define R_MASK ACE_DEFAULT_OPEN_PERMS -#define W_MASK 0 -#else -#define R_MASK S_IRUSR|S_IRGRP|S_IROTH -#define W_MASK S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR|S_IWGRP|S_IWOTH -#endif /* ACE_WIN32 */ - -#if defined (ACE_WIN32) -// See if you can get rid of some of these. -#define READ_FLAGS (FILE_FLAG_SEQUENTIAL_SCAN | \ - FILE_FLAG_OVERLAPPED | \ - O_RDONLY) -// static const int RCOPY_FLAGS = (FILE_FLAG_SEQUENTIAL_SCAN | -// O_RDONLY); -#define WRITE_FLAGS (FILE_FLAG_SEQUENTIAL_SCAN | \ - FILE_FLAG_OVERLAPPED | \ - O_RDWR | O_CREAT | O_TRUNC) -// static const int WCOPY_FLAGS = (FILE_FLAG_SEQUENTIAL_SCAN | -// O_RDWR | O_CREAT | O_TRUNC); -#else -#define READ_FLAGS O_RDONLY -// static const int RCOPY_FLAGS = O_RDONLY; -#define WRITE_FLAGS (O_RDWR | O_CREAT | O_TRUNC) -// static const int WCOPY_FLAGS = O_RDWR | O_CREAT | O_TRUNC; -#endif /* ACE_WIN32 */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// static data members -ACE_Filecache *ACE_Filecache::cvf_ = 0; - -void -ACE_Filecache_Handle::init (void) -{ - this->file_ = 0; - this->handle_ = ACE_INVALID_HANDLE; -} - -ACE_Filecache_Handle::ACE_Filecache_Handle (void) - : file_ (0), handle_ (0), mapit_ (0) -{ - this->init (); -} - -ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename, - ACE_Filecache_Flag mapit) - : file_ (0), handle_ (0), mapit_ (mapit) -{ - this->init (); - // Fetch the file from the Virtual_Filesystem let the - // Virtual_Filesystem do the work of cache coherency. - - // Filecache will also do the acquire, since it holds the lock at - // that time. - this->file_ = ACE_Filecache::instance ()->fetch (filename, mapit); -} - -ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename, - int size, - ACE_Filecache_Flag mapit) - : file_ (0), handle_ (0), mapit_ (mapit) -{ - this->init (); - - if (size == 0) - ACE_Filecache::instance ()->remove (filename); - else - { - // Since this is being opened for a write, simply create a new - // ACE_Filecache_Object now, and let the destructor add it into CVF - // later - - // Filecache will also do the acquire, since it holds the lock at - // that time. - this->file_ = ACE_Filecache::instance ()->create (filename, size); - } -} - -ACE_Filecache_Handle::~ACE_Filecache_Handle (void) -{ - if (this->handle_ != ACE_INVALID_HANDLE) - // this was dup ()'d - ACE_OS::close (this->handle_); - - ACE_Filecache::instance ()->finish (this->file_); -} - -void * -ACE_Filecache_Handle::address (void) const -{ - return this->file_ == 0 ? 0 : this->file_->address (); -} - -ACE_HANDLE -ACE_Filecache_Handle::handle (void) const -{ - if (this->handle_ == ACE_INVALID_HANDLE && this->file_ != 0) - { - ACE_Filecache_Handle *mutable_this = - const_cast (this); - mutable_this->handle_ = ACE_OS::dup (this->file_->handle ()); - } - return this->handle_; -} - -int -ACE_Filecache_Handle::error (void) const -{ - if (this->file_ == 0) - return -1; - else - return this->file_->error (); -} - -ACE_LOFF_T -ACE_Filecache_Handle::size (void) const -{ - if (this->file_ == 0) - return -1; - else - return this->file_->size (); -} - -// ------------------ -// ACE_Filecache_Hash -// ------------------ - -#define ACE_Filecache_Hash \ - ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> -#define ACE_Filecache_Hash_Entry \ - ACE_Hash_Map_Entry - -template <> -ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry ( - const ACE_TCHAR *const &ext_id, - ACE_Filecache_Object *const &int_id, - ACE_Filecache_Hash_Entry *next, - ACE_Filecache_Hash_Entry *prev) - : ext_id_ (ext_id - ? ACE_OS::strdup (ext_id) - : ACE_OS::strdup (ACE_LIB_TEXT (""))), - int_id_ (int_id), - next_ (next), - prev_ (prev) -{ -} - -template <> -ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry (ACE_Filecache_Hash_Entry *next, - ACE_Filecache_Hash_Entry *prev) - : ext_id_ (0), - next_ (next), - prev_ (prev) -{ -} - -template <> -ACE_Filecache_Hash_Entry::~ACE_Hash_Map_Entry (void) -{ - ACE_OS::free ((void *) ext_id_); -} - -// We need these template specializations since KEY is defined as a -// ACE_TCHAR*, which doesn't have a hash() or equal() method defined on it. - -template <> -unsigned long -ACE_Filecache_Hash::hash (const ACE_TCHAR *const &ext_id) -{ - return ACE::hash_pjw (ext_id); -} - -template <> -int -ACE_Filecache_Hash::equal (const ACE_TCHAR *const &id1, - const ACE_TCHAR *const &id2) -{ - return ACE_OS::strcmp (id1, id2) == 0; -} - -#undef ACE_Filecache_Hash -#undef ACE_Filecache_Hash_Entry - - -// ------------- -// ACE_Filecache -// ------------- - -ACE_Filecache * -ACE_Filecache::instance (void) -{ - // Double check locking pattern. - if (ACE_Filecache::cvf_ == 0) - { - ACE_SYNCH_RW_MUTEX &lock = - *ACE_Managed_Object::get_preallocated_object - (ACE_Object_Manager::ACE_FILECACHE_LOCK); - ACE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, ace_mon, lock, 0); - - // @@ James, please check each of the ACE_NEW_RETURN calls to - // make sure that it is safe to return if allocation fails. - if (ACE_Filecache::cvf_ == 0) - ACE_NEW_RETURN (ACE_Filecache::cvf_, - ACE_Filecache, - 0); - } - - return ACE_Filecache::cvf_; -} - -ACE_Filecache::ACE_Filecache (void) - : size_ (ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE), - hash_ (this->size_) -{ -} - -ACE_Filecache::~ACE_Filecache (void) -{ -} - -ACE_Filecache_Object * -ACE_Filecache::insert_i (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &filelock, - int mapit) -{ - ACE_Filecache_Object *handle = 0; - - if (this->hash_.find (filename, handle) == -1) - { - ACE_NEW_RETURN (handle, - ACE_Filecache_Object (filename, filelock, 0, mapit), - 0); - - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" (%t) CVF: creating %s\n"), filename)); - - if (this->hash_.bind (filename, handle) == -1) - { - delete handle; - handle = 0; - } - } - else - handle = 0; - - return handle; -} - -ACE_Filecache_Object * -ACE_Filecache::remove_i (const ACE_TCHAR *filename) -{ - ACE_Filecache_Object *handle = 0; - - // Disassociate file from the cache. - if (this->hash_.unbind (filename, handle) == 0) - { - handle->stale_ = 1; - - // Try a lock. If it succeds, we can delete it now. - // Otherwise, it will clean itself up later. - if (handle->lock_.tryacquire_write () == 0) - { - delete handle; - handle = 0; - } - } - else - handle = 0; - - return handle; -} - -ACE_Filecache_Object * -ACE_Filecache::update_i (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &filelock, - int mapit) -{ - ACE_Filecache_Object *handle = 0; - - handle = this->remove_i (filename); - handle = this->insert_i (filename, filelock, mapit); - - return handle; -} - -int -ACE_Filecache::find (const ACE_TCHAR *filename) -{ - return this->hash_.find (filename); -} - - -ACE_Filecache_Object * -ACE_Filecache::remove (const ACE_TCHAR *filename) -{ - ACE_Filecache_Object *handle = 0; - - u_long loc = ACE::hash_pjw (filename) % this->size_; - ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc]; - // ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc]; - - if (this->hash_.find (filename, handle) != -1) - { - ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, - ace_mon, - hashlock, - 0); - - return this->remove_i (filename); - } - - return 0; -} - - -ACE_Filecache_Object * -ACE_Filecache::fetch (const ACE_TCHAR *filename, int mapit) -{ - ACE_Filecache_Object *handle = 0; - - u_long loc = ACE::hash_pjw (filename) % this->size_; - ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc]; - ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc]; - - filelock.acquire_read (); - - if (this->hash_.find (filename, handle) == -1) - { - ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, - ace_mon, - hashlock, - 0); - - // Second check in the method call - handle = this->insert_i (filename, filelock, mapit); - - if (handle == 0) - filelock.release (); - } - else - { - if (handle->update ()) - { - { - // Double check locking pattern - ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, - ace_mon, - hashlock, - 0); - - // Second check in the method call - handle = this->update_i (filename, filelock, mapit); - - if (handle == 0) - filelock.release (); - } - } - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" (%t) CVF: found %s\n"), filename)); - } - - return handle; -} - -ACE_Filecache_Object * -ACE_Filecache::create (const ACE_TCHAR *filename, int size) -{ - ACE_Filecache_Object *handle = 0; - - u_long loc = ACE::hash_pjw (filename) % this->size_; - ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc]; - - ACE_NEW_RETURN (handle, - ACE_Filecache_Object (filename, size, filelock), - 0); - handle->acquire (); - - return handle; -} - -ACE_Filecache_Object * -ACE_Filecache::finish (ACE_Filecache_Object *&file) -{ - if (file == 0) - return file; - - u_long loc = ACE::hash_pjw (file->filename_) % this->size_; - ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc]; - - if (file != 0) - switch (file->action_) - { - case ACE_Filecache_Object::ACE_WRITING: - { - ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, - ace_mon, - hashlock, - 0); - - file->release (); - - this->remove_i (file->filename_); -#if 0 - int result = this->hash_.bind (file->filename (), file); - - if (result == 0) - file->acquire (); -#else - // Last one using a stale file is resposible for deleting it. - if (file->stale_) - { - // Try a lock. If it succeds, we can delete it now. - // Otherwise, it will clean itself up later. - if (file->lock_.tryacquire_write () == 0) - { - delete file; - file = 0; - } - } -#endif - } - - break; - default: - file->release (); - - // Last one using a stale file is resposible for deleting it. - if (file->stale_) - { - // Try a lock. If it succeds, we can delete it now. - // Otherwise, it will clean itself up later. - if (file->lock_.tryacquire_write () == 0) - { - delete file; - file = 0; - } - } - - break; - } - - return file; -} - -void -ACE_Filecache_Object::init (void) -{ - this->filename_[0] = '\0'; - this->handle_ = ACE_INVALID_HANDLE; - this->error_ = ACE_SUCCESS; - this->tempname_ = 0; - this->size_ = 0; - - ACE_OS::memset (&(this->stat_), 0, sizeof (this->stat_)); -} - -ACE_Filecache_Object::ACE_Filecache_Object (void) - : tempname_ (0), - mmap_ (), - handle_ (0), - // stat_ (), - size_ (0), - action_ (0), - error_ (0), - stale_ (0), - // sa_ (), - junklock_ (), - lock_ (junklock_) -{ - this->init (); -} - -ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &lock, - LPSECURITY_ATTRIBUTES sa, - int mapit) - : tempname_ (0), - mmap_ (), - handle_ (0), - // stat_ (), - size_ (0), - action_ (0), - error_ (0), - stale_ (0), - sa_ (sa), - junklock_ (), - lock_ (lock) -{ - this->init (); - - // ASSERT strlen(filename) < sizeof (this->filename_) - ACE_OS::strcpy (this->filename_, filename); - this->action_ = ACE_Filecache_Object::ACE_READING; - // place ourselves into the READING state - - // Can we access the file? - if (ACE_OS::access (this->filename_, R_OK) == -1) - { - this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED); - return; - } - - // Can we stat the file? - if (ACE_OS::stat (this->filename_, &this->stat_) == -1) - { - this->error_i (ACE_Filecache_Object::ACE_STAT_FAILED); - return; - } - - this->size_ = this->stat_.st_size; - this->tempname_ = this->filename_; - - // Can we open the file? - this->handle_ = ACE_OS::open (this->tempname_, - READ_FLAGS, R_MASK, this->sa_); - if (this->handle_ == ACE_INVALID_HANDLE) - { - this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, - ACE_LIB_TEXT ("ACE_Filecache_Object::ctor: open")); - return; - } - - if (mapit) - { - // Can we map the file? - if (this->mmap_.map (this->handle_, -1, - PROT_READ, ACE_MAP_PRIVATE, 0, 0, this->sa_) != 0) - { - this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, - ACE_LIB_TEXT ("ACE_Filecache_Object::ctor: map")); - ACE_OS::close (this->handle_); - this->handle_ = ACE_INVALID_HANDLE; - return; - } - } - - // Ok, finished! - this->action_ = ACE_Filecache_Object::ACE_READING; -} - -ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename, - off_t size, - ACE_SYNCH_RW_MUTEX &lock, - LPSECURITY_ATTRIBUTES sa) - : stale_ (0), - sa_ (sa), - lock_ (lock) -{ - this->init (); - - this->size_ = size; - ACE_OS::strcpy (this->filename_, filename); - this->action_ = ACE_Filecache_Object::ACE_WRITING; - - // Can we access the file? - if (ACE_OS::access (this->filename_, R_OK|W_OK) == -1 - // Does it exist? - && ACE_OS::access (this->filename_, F_OK) != -1) - { - // File exists, but we cannot access it. - this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED); - return; - } - - this->tempname_ = this->filename_; - - // Can we open the file? - this->handle_ = ACE_OS::open (this->tempname_, WRITE_FLAGS, W_MASK, this->sa_); - if (this->handle_ == ACE_INVALID_HANDLE) - { - this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, - ACE_LIB_TEXT ("ACE_Filecache_Object::acquire: open")); - return; - } - - // Can we write? - if (ACE_OS::pwrite (this->handle_, "", 1, this->size_ - 1) != 1) - { - this->error_i (ACE_Filecache_Object::ACE_WRITE_FAILED, - ACE_LIB_TEXT ("ACE_Filecache_Object::acquire: write")); - ACE_OS::close (this->handle_); - return; - } - - // Can we map? - if (this->mmap_.map (this->handle_, this->size_, PROT_RDWR, MAP_SHARED, - 0, 0, this->sa_) != 0) - { - this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, - ACE_LIB_TEXT ("ACE_Filecache_Object::acquire: map")); - ACE_OS::close (this->handle_); - } - - // Ok, done! -} - -ACE_Filecache_Object::~ACE_Filecache_Object (void) -{ - if (this->error_ == ACE_SUCCESS) - { - this->mmap_.unmap (); - ACE_OS::close (this->handle_); - this->handle_ = ACE_INVALID_HANDLE; - } -} - -int -ACE_Filecache_Object::acquire (void) -{ - return this->lock_.tryacquire_read (); -} - -int -ACE_Filecache_Object::release (void) -{ - if (this->action_ == ACE_WRITING) - { - // We are safe since only one thread has a writable Filecache_Object - -#if 0 - ACE_HANDLE original = ACE_OS::open (this->filename_, WRITE_FLAGS, W_MASK, - this->sa_); - if (original == ACE_INVALID_HANDLE) - this->error_ = ACE_Filecache_Object::ACE_OPEN_FAILED; - else if (ACE_OS::write (original, this->mmap_.addr (), - this->size_) == -1) - { - this->error_ = ACE_Filecache_Object::ACE_WRITE_FAILED; - ACE_OS::close (original); - ACE_OS::unlink (this->filename_); - } - else if (ACE_OS::stat (this->filename_, &this->stat_) == -1) - this->error_ = ACE_Filecache_Object::ACE_STAT_FAILED; -#endif - - this->mmap_.unmap (); - ACE_OS::close (this->handle_); - this->handle_ = ACE_INVALID_HANDLE; - -#if 0 - // Leave the file in an acquirable state. - this->handle_ = ACE_OS::open (this->tempname_, READ_FLAGS, R_MASK); - if (this->handle_ == ACE_INVALID_HANDLE) - { - this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, - "ACE_Filecache_Object::acquire: open"); - } - else if (this->mmap_.map (this->handle_, -1, - PROT_READ, - ACE_MAP_PRIVATE, - 0, - 0, - this->sa_) != 0) - { - this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, - "ACE_Filecache_Object::acquire: map"); - ACE_OS::close (this->handle_); - this->handle_ = ACE_INVALID_HANDLE; - } - - this->action_ = ACE_Filecache_Object::ACE_READING; -#endif - } - - return this->lock_.release (); -} - -int -ACE_Filecache_Object::error (void) const -{ - // The existence of the object means a read lock is being held. - return this->error_; -} - -int -ACE_Filecache_Object::error_i (int error_value, const ACE_TCHAR *s) -{ - s = s; - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p.\n"), s)); - this->error_ = error_value; - return error_value; -} - -const ACE_TCHAR * -ACE_Filecache_Object::filename (void) const -{ - // The existence of the object means a read lock is being held. - return this->filename_; -} - -ACE_LOFF_T -ACE_Filecache_Object::size (void) const -{ - // The existence of the object means a read lock is being held. - return this->size_; -} - -ACE_HANDLE -ACE_Filecache_Object::handle (void) const -{ - // The existence of the object means a read lock is being held. - return this->handle_; -} - -void * -ACE_Filecache_Object::address (void) const -{ - // The existence of the object means a read lock is being held. - return this->mmap_.addr (); -} - -int -ACE_Filecache_Object::update (void) const -{ - // The existence of the object means a read lock is being held. - int result; - ACE_stat statbuf; - - if (ACE_OS::stat (this->filename_, &statbuf) == -1) - result = 1; - else - // non-portable code may follow -#if defined (ACE_HAS_WINCE) - // Yup, non-portable... there's probably a way to safely implement - // difftime() on WinCE, but for now, this will have to do. It flags - // every file as having changed since cached. - result = 1; -#else - result = ACE_OS::difftime (this->stat_.st_mtime, statbuf.st_mtime) < 0; -#endif /* ACE_HAS_WINCE */ - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Filecache.h b/ace/Filecache.h deleted file mode 100644 index d0cfd0556cc..00000000000 --- a/ace/Filecache.h +++ /dev/null @@ -1,353 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Filecache.h - * - * $Id$ - * - * @author James Hu - */ -//============================================================================= - - -#ifndef ACE_FILECACHE_H -#define ACE_FILECACHE_H - -#include /**/ "ace/pre.h" - -#include "ace/Mem_Map.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Hash_Map_Manager_T.h" -#include "ace/Null_Mutex.h" -#include "ace/Synch_Traits.h" -#include "ace/RW_Thread_Mutex.h" -#include "ace/OS_NS_sys_stat.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -enum ACE_Filecache_Flag -{ - ACE_NOMAP = 0, - ACE_MAPIT = 1 -}; - -class ACE_Filecache_Object; - -/** - * @class ACE_Filecache_Handle - * - * @brief Abstraction over a real file. This is meant to be the entry - * point into the Cached Virtual Filesystem. - * - * This is a cached filesystem implementation based loosely on the - * implementation of JAWS_File. The interfaces will be nearly the - * same. The under-the-hood implementation should hopefully be a - * much faster thing. - * These will be given their own implementations later. For now, we - * borrow the implementation provided by JAWS. - * On creation, the cache is checked, and reference count is - * incremented. On destruction, reference count is decremented. If - * the reference count is 0, the file is removed from the cache. - * E.g. 1, - * { - * ACE_Filecache_Handle foo("foo.html"); - * this->peer ().send (foo.address (), foo.size ()); - * } - * E.g. 2, - * { - * ACE_Filecache_Handle foo("foo.html"); - * io->transmitfile (foo.handle (), this->peer ().handle ()); - * } - * E.g. 3, - * { - * ACE_Filecache_Handle foo("foo.html", content_length); - * this->peer ().recv (foo.address (), content_length); - * } - * TODO: - */ -class ACE_Export ACE_Filecache_Handle -{ - // (1) Get rid of the useless copying of files when reading. - // Although it does make sure the file you send isn't being changed, - // it doesn't make sure the file is in a sensible state before - // sending it. - // - // Alternative: if the file get's trashed while it is being shipped, - // let the client request the file again. The cache should have an - // updated copy by that point. - // - // (2) Use hashing for locating files. This means I need a hastable - // implementation with buckets. - // - // (3) Only lock when absolutely necessary. JAWS_Virtual_Filesystem was - // rather conservative, but for some reason it still ran into problems. - // Since this design should be simpler, problems should be easier to spot. - // -public: - - /// Query cache for file, and acquire it. Assumes the file is being - /// opened for reading. - ACE_Filecache_Handle (const ACE_TCHAR *filename, - ACE_Filecache_Flag mapit = ACE_MAPIT); - - /** - * Create new entry, and acquire it. Presence of SIZE assumes the - * file is being opened for writing. If SIZE is zero, assumes the - * file is to be removed from the cache. - */ - ACE_Filecache_Handle (const ACE_TCHAR *filename, - int size, - ACE_Filecache_Flag mapit = ACE_MAPIT); - - /// Closes any open handles, release acquired file. - ~ACE_Filecache_Handle (void); - - /// Base address of memory mapped file. - void *address (void) const; - - /// A handle (e.g., UNIX file descriptor, or NT file handle). - ACE_HANDLE handle (void) const; - - /// Any associated error in handle creation and acquisition. - int error (void) const; - - /// The size of the file. - ACE_LOFF_T size (void) const; - -protected: - /// Default do nothing constructor. Prevent it from being called. - ACE_Filecache_Handle (void); - - /// Common initializations for constructors. - void init (void); - -public: - /// These come from ACE_Filecache_Object, which is an internal class. - enum - { - ACE_SUCCESS = 0, - ACE_ACCESS_FAILED, - ACE_OPEN_FAILED, - ACE_COPY_FAILED, - ACE_STAT_FAILED, - ACE_MEMMAP_FAILED, - ACE_WRITE_FAILED - }; - -private: - /// A reference to the low level instance. - ACE_Filecache_Object *file_; - - /// A 'd version of the one from . - ACE_HANDLE handle_; - - int mapit_; -}; - -typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> - ACE_Filecache_Hash; - -typedef ACE_Hash_Map_Entry ACE_Filecache_Hash_Entry; - -/** - * @class ACE_Filecache - * - * @brief A hash table holding the information about entry point into - * the Cached Virtual Filesystem. On insertion, the reference - * count is incremented. On destruction, reference count is - * decremented. - */ -class ACE_Export ACE_Filecache -{ -public: - /// Singleton pattern. - static ACE_Filecache *instance (void); - - ~ACE_Filecache (void); - - /// Returns 0 if the file associated with ``filename'' is in the cache, - /// or -1 if not. - int find (const ACE_TCHAR *filename); - - /// Return the file associated with ``filename'' if it is in the cache, - /// or create if not. - ACE_Filecache_Object *fetch (const ACE_TCHAR *filename, int mapit = 1); - - /// Remove the file associated with ``filename'' from the cache. - ACE_Filecache_Object *remove (const ACE_TCHAR *filename); - - /// Create a new Filecache_Object, returns it. - ACE_Filecache_Object *create (const ACE_TCHAR *filename, int size); - - /// Release an acquired Filecache_Object, returns it again or NULL if it - /// was deleted. - ACE_Filecache_Object *finish (ACE_Filecache_Object *&new_file); - -protected: - ACE_Filecache_Object *insert_i (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &filelock, - int mapit); - ACE_Filecache_Object *remove_i (const ACE_TCHAR *filename); - ACE_Filecache_Object *update_i (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &filelock, - int mapit); - -public: - - enum - { - /// For this stupid implementation, use an array. Someday, use a - /// balanced search tree, or real hash table. - ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE = 512, - - /// This determines the highwater mark in megabytes for the cache. - /// This will be ignored for now. - ACE_DEFAULT_VIRTUAL_FILESYSTEM_CACHE_SIZE = 20 - }; - -protected: - /// Prevent it from being called. - ACE_Filecache (void); - -private: - int size_; - - /// The hash table - ACE_Filecache_Hash hash_; - - /// The reference to the instance - static ACE_Filecache *cvf_; - - // = Synchronization variables. - ACE_SYNCH_RW_MUTEX hash_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; - ACE_SYNCH_RW_MUTEX file_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; -}; - -/** - * @class ACE_Filecache_Object - * - * @brief Abstraction over a real file. This is what the Virtual - * Filesystem contains. This class is not intended for general - * consumption. Please consult a physician before attempting to - * use this class. - */ -class ACE_Export ACE_Filecache_Object -{ -public: - friend class ACE_Filecache; - - /// Creates a file for reading. - ACE_Filecache_Object (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &lock, - LPSECURITY_ATTRIBUTES sa = 0, - int mapit = 1); - - /// Creates a file for writing. - ACE_Filecache_Object (const ACE_TCHAR *filename, - off_t size, - ACE_SYNCH_RW_MUTEX &lock, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Only if reference count is zero should this be called. - ~ACE_Filecache_Object (void); - - /// Increment the reference_count_. - int acquire (void); - - /// Decrement the reference_count_. - int release (void); - - // = error_ accessors - int error (void) const; - int error (int error_value, - const ACE_TCHAR *s = ACE_LIB_TEXT ("ACE_Filecache_Object")); - - /// filename_ accessor - const ACE_TCHAR *filename (void) const; - - /// handle_ accessor. - ACE_HANDLE handle (void) const; - - /// Base memory address for memory mapped file. - void *address (void) const; - - /// size_ accessor. - ACE_LOFF_T size (void) const; - - /// True if file on disk is newer than cached file. - int update (void) const; - -protected: - /// Prevent from being called. - ACE_Filecache_Object (void); - - /// Common initialization code, - void init (void); - -private: - /// Internal error logging method, no locking. - int error_i (int error_value, - const ACE_TCHAR *s = ACE_LIB_TEXT ("ACE_Filecache_Object")); - -public: - - enum Creation_States - { - ACE_READING = 1, - ACE_WRITING = 2 - }; - - enum Error_Conditions - { - ACE_SUCCESS = 0, - ACE_ACCESS_FAILED, - ACE_OPEN_FAILED, - ACE_COPY_FAILED, - ACE_STAT_FAILED, - ACE_MEMMAP_FAILED, - ACE_WRITE_FAILED - }; - -private: - /// The temporary file name and the real file name. The real file is - /// copied into the temporary file for safety reasons. - ACE_TCHAR *tempname_; - ACE_TCHAR filename_[MAXPATHLEN + 1]; - - /// Holds the memory mapped version of the temporary file. - ACE_Mem_Map mmap_; - - /// The descriptor to the temporary file. - ACE_HANDLE handle_; - - /// Used to compare against the real file to test if an update is needed. - ACE_stat stat_; - ACE_LOFF_T size_; - - /// Status indicators. - int action_; - int error_; - - /// If set to 1, means the object is flagged for removal. - int stale_; - - /// Security attribute object. - LPSECURITY_ATTRIBUTES sa_; - - /// The default initializer - ACE_SYNCH_RW_MUTEX junklock_; - - /// Provides a bookkeeping mechanism for users of this object. - ACE_SYNCH_RW_MUTEX &lock_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_FILECACHE_H */ diff --git a/ace/FlReactor.cpp b/ace/FlReactor.cpp deleted file mode 100644 index f45ce67a994..00000000000 --- a/ace/FlReactor.cpp +++ /dev/null @@ -1,330 +0,0 @@ -// $Id$ - -#include "ace/FlReactor.h" - -ACE_RCSID(ace, FlReactor, "$Id$") - -#include /**/ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_FlReactor) - -// Must be called with lock held -ACE_FlReactor::ACE_FlReactor (size_t size, - int restart, - ACE_Sig_Handler *h) - : ACE_Select_Reactor (size, restart, h) -{ - // When the ACE_Select_Reactor is constructed it creates the notify - // pipe and registers it with the register_handler_i() method. The - // FlReactor overloads this method BUT because the - // register_handler_i occurs when constructing the base class - // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() - // is called not the FlReactor register_handler_i(). This means - // that the notify pipe is registered with the ACE_Select_Reactor - // event handling code not the FlReactor and so notfications don't - // work. To get around this we simply close and re-opened the - // notification handler in the constructor of the FlReactor. - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - this->notify_handler_->close (); - this->notify_handler_->open (this, 0); -#endif /* ACE_MT_SAFE */ -} - -ACE_FlReactor::~ACE_FlReactor (void) -{ -} - -// This is just the from ace/Reactor.cpp -// but we use the Fl functions to wait for an event, not , just use the Fl mechanism - // to wait for one or more events... - - // Wait for something to happen. - double t = 0; - if (max_wait_time != 0) - t = max_wait_time->sec () + max_wait_time->usec () / 1000000.0F; - - while (t > 0) { - t = Fl::wait (t); - } - - // Reset the width, in case it changed during the upcalls. - width = this->handler_rep_.max_handlep1 (); - - // Now actually read the result needed by the - // using . - */ - ACE_Handle_Set (const ACE_FD_SET_TYPE &mask); - - // = Methods for manipulating bitsets. - /// Initialize the bitmask to all 0s and reset the associated fields. - void reset (void); - - /** - * Checks whether is enabled. No range checking is - * performed so must be less than - * . - */ - int is_set (ACE_HANDLE handle) const; - - /// Enables the . No range checking is performed so - /// must be less than . - void set_bit (ACE_HANDLE handle); - - /// Disables the . No range checking is performed so - /// must be less than . - void clr_bit (ACE_HANDLE handle); - - /// Returns a count of the number of enabled bits. - int num_set (void) const; - - /// Returns the number of the large bit. - ACE_HANDLE max_set (void) const; - - /** - * Rescan the underlying up to handle to find the new - * (highest bit set) and (how many bits set) values. - * This is useful for evaluating the changes after the handle set has - * been manipulated in some way other than member functions; for example, - * after . - return ACE_OS::select(width, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero); -} - -// mbrudka: who needs wait_for_multiple_events? It seems it's cargo load now! -int -ACE_QtReactor::wait_for_multiple_events ( - ACE_Select_Reactor_Handle_Set &handle_set, - ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_QtReactor::wait_for_multiple_events"); - - int nfound = 0; - do - { - max_wait_time = this->timer_queue_->calculate_timeout (max_wait_time); - size_t width = this->handler_rep_.max_handlep1 (); - handle_set.rd_mask_ = this->wait_set_.rd_mask_; - handle_set.wr_mask_ = this->wait_set_.wr_mask_; - handle_set.ex_mask_ = this->wait_set_.ex_mask_; - - nfound = QtWaitForMultipleEvents (width, - handle_set, - max_wait_time); - - } while( nfound == -1 && this->handle_error () > 0 ); - - if (nfound > 0) - { -#if !defined (ACE_WIN32) - handle_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); - handle_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); - handle_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); -#endif /* ACE_WIN32 */ - } - - return nfound; - // Timed out or input available -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/QtReactor.h b/ace/QtReactor.h deleted file mode 100644 index c3ccb82f7f3..00000000000 --- a/ace/QtReactor.h +++ /dev/null @@ -1,222 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file QtReactor.h - * - * $Id$ - * - * @author Hamish Friedlander - * @author Balachandran Natarajan - */ -//============================================================================= - -#ifndef ACE_QTREACTOR_H -#define ACE_QTREACTOR_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_QtReactor_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Select_Reactor.h" -#include "ace/Map_Manager.h" - -// QT toolkit specific includes. -#include /**/ -#include /**/ -#include /**/ -#include /**/ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_QtReactor - * - * @brief An object-oriented event demultiplexor and event handler - * dispatcher that uses the Qt Library. This class declaration - * also uses the extension facilities provided by the Qt. So, - * readers of the class declaration should not be upset with - * the appearence of the Keywords like Q_OBJECT, private slots - * etc. They are specific to Qt which uses these as a call back - * methods implementation mechanism. - * - * \note Marek Brudka : ACE_QtReactor was - * quickly bugfixed to meet ACE 5.4.2 (6.0.0?) deadline. - * While it passes QtReactor_Test now, there is a great - * room for improvements as the implementation is rather inefficient - * and obfuscated - * To be more specific: - * - reset_timeout always creates and removes qtimer after each - * timeout event! Obviously, for fast triggering timers this may - * lead to excessive memory management. - * - create/destroy_notifiers_for_handle may also be reworked to - * establish more clean relations between handles and QSocketNotifiers. - * - read/write_exception_event disable now SocketNotifier for a while - * to clear pending events. The cost of this operation is high: two hash - * acces in ACE and at least two next ones in Qt. This makes QtReator slow, - * but how clear pending events another way ? - * - there is qapplication() mutator, which sets new qapplication for - * QtReactor. This mutator violates implicit assumption about the - * relations between QTimer and QSocketNotifiers and QApplication for - * this reactor, namely one may expect that after qapplication(), none - * of QtReactor artifacts is bound to old qapplication. That's not true - * now, as QTimer and QSocketNotifiers are not reparent to new - * QApplication. As a result, the sequence: - * QApplication *old_qapp = new QApplication(..); - * QtReactor qreactor( old_qapp); - * // .. register handlers, schedule_timers etc - * QApplication *new_qapp = new QApplication(..); - * qreactor.qpplication( new_qapp ); - * delete old_qapp; - * almost always leads to problems and memory violation, because - * QSocketNotifiers are released by old_qapp. Therefore QtReactor - * should not be reparent now by setting new qapplication. - * - the lifecycle of Qt objects in ACE contects is rather mysterious - * and should be made more explicit. - * - valgrind reports a small memory leak in QtReactor_Test, though as for now - * it is not clear if the leak is introduced by QtReactor, or rather incorrect - * memory management in QtReactor_Test. - */ -class ACE_QtReactor_Export ACE_QtReactor - : public QObject, - public ACE_Select_Reactor -{ - - Q_OBJECT - -public: - /** \brief Constructor follows @ACE_Select_Reactor - \param QApplication *qapp, qapplication which runs events loop - */ - ACE_QtReactor (QApplication *qapp = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify *notify = 0, - int mask_signals = 1, - int s_queue = ACE_SELECT_TOKEN::FIFO); - - /** \brief Constructor follows @ACE_Select_Reactor - \param QApplication *qapp, qapplication which runs events loop - */ - ACE_QtReactor (size_t size, - QApplication *qapp = 0, - int restart = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify *notify = 0, - int mask_signals = 1, - int s_queue = ACE_SELECT_TOKEN::FIFO); - - virtual ~ACE_QtReactor (void); - - void qapplication (QApplication *qapp); - - // = Timer operations. - virtual long schedule_timer (ACE_Event_Handler *handler, - const void *arg, - const ACE_Time_Value &delay_time, - const ACE_Time_Value &interval); - - virtual int cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close = 1); - - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1); - -protected: - - // = Register timers/handles with Qt - - /// Register a single . - virtual int register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask); - - /// Register a set of with Qt. - virtual int register_handler_i (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask); - - - /// Remove the associated with this . - virtual int remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - /// Remove a set of . - virtual int remove_handler_i (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask); - - /// Wait for events to occur. - virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, - ACE_Time_Value *max_wait_time); - - virtual int QtWaitForMultipleEvents (int width, - ACE_Select_Reactor_Handle_Set &wait_set, - ACE_Time_Value *max_wait_time); - - virtual int bit_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Select_Reactor_Handle_Set &handle_set, - int ops); - - int set_enable_flag_by_mask (int flag_value, ACE_HANDLE handle, ACE_Reactor_Mask mask); - void create_notifiers_for_handle (ACE_HANDLE handle); - void destroy_notifiers_for_handle (ACE_HANDLE handle); - - // Wait for Qt events to occur - - /// Some Qt stuff that we need to have - QApplication *qapp_ ; - - /// Typedef of a map. - typedef ACE_Map_Manager MAP; - - /// A notifier for a read - MAP read_notifier_; - - /// A write notifier - MAP write_notifier_; - - /// An exception notifier - MAP exception_notifier_; - - /// The timer class that would provide timer-sgnals & single-shot timers - QTimer *qtime_ ; - -private: - /// This method ensures there's an Qt timeout for the first timeout - /// in the Reactor's Timer_Queue. - void reset_timeout (void); - /// reopens notification pipe to create SocketNotifier for it - void reopen_notification_pipe(void); - /// Deny access since member-wise won't work... - ACE_QtReactor (const ACE_QtReactor &); - ACE_QtReactor &operator= (const ACE_QtReactor &); - -private slots: - - // These are all part of the communication mechanism adopted in Qt. - /// Dispatch a Read Event - void read_event (int FD); - - /// Dispatch a Write Event - void write_event (int FD); - - /// Dispatch an exception event - void exception_event (int FD); - - /// Dispach a timeout event - void timeout_event (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_QTREACTOR_H */ diff --git a/ace/RB_Tree.cpp b/ace/RB_Tree.cpp deleted file mode 100644 index a93b6967145..00000000000 --- a/ace/RB_Tree.cpp +++ /dev/null @@ -1,1201 +0,0 @@ -// $Id$ - -#ifndef ACE_RB_TREE_CPP -#define ACE_RB_TREE_CPP - -#include "ace/Global_Macros.h" -#include "ace/RB_Tree.h" -#include "ace/SString.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/RB_Tree.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Constructor. - -template -ACE_RB_Tree_Node::ACE_RB_Tree_Node (const EXT_ID &k, const INT_ID &t) - : k_ (k), - t_ (t), - color_ (RED), - parent_ (0), - left_ (0), - right_ (0) -{ - ACE_TRACE ("ACE_RB_Tree_Node::ACE_RB_Tree_Node (const EXT_ID &k, const INT_ID &t)"); -} - - -// Destructor. - -template -ACE_RB_Tree_Node::~ACE_RB_Tree_Node (void) -{ - ACE_TRACE ("ACE_RB_Tree_Node::~ACE_RB_Tree_Node"); -} - -// Constructor. - -template -ACE_RB_Tree::ACE_RB_Tree (ACE_Allocator *alloc) - : root_ (0), - current_size_ (0) -{ - ACE_TRACE ("ACE_RB_Tree::" - "ACE_RB_Tree (ACE_Allocator *alloc)"); - allocator_ = alloc; - if (this->open (alloc) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_RB_Tree::ACE_RB_Tree\n"))); -} - -// Copy constructor. - -template -ACE_RB_Tree::ACE_RB_Tree (const ACE_RB_Tree &rbt) - : root_ (0), - current_size_ (0) -{ - ACE_TRACE ("ACE_RB_Tree::" - "ACE_RB_Tree (const ACE_RB_Tree &rbt)"); - ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); - allocator_ = rbt.allocator_; - - // Make a deep copy of the passed tree. - ACE_RB_Tree_Iterator iter(rbt); - - for (iter.first (); - - iter.is_done () == 0; iter.next ()) - insert_i (*(iter.key ()), - *(iter.item ())); -} - -template -ACE_RB_Tree::ACE_RB_Tree ( - void *location, - ACE_Allocator *alloc -) -{ - if (location != this) - { - this->root_ = 0; - this->current_size_ = 0; - } - - this->allocator_ = alloc; -} -// Destructor. - -template -ACE_RB_Tree::~ACE_RB_Tree () -{ - ACE_TRACE ("ACE_RB_Tree::~ACE_RB_Tree"); - - // Use the locked public method, to be totally safe, as the class - // can be used with an allocator and placement new. - this->close (); -} - -// Assignment operator. - -template void -ACE_RB_Tree::operator = (const ACE_RB_Tree &rbt) -{ - ACE_TRACE ("ACE_RB_Tree::operator ="); - ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); - - if (this != &rbt) - { - // Clear out the existing tree. - close_i (); - - // Make a deep copy of the passed tree. - ACE_RB_Tree_Iterator iter(rbt); - - for (iter.first (); - iter.is_done () == 0; - iter.next ()) - insert_i (*(iter.key ()), - *(iter.item ())); - - // Use the same allocator as the rhs. - allocator_ = rbt.allocator_; - } -} -// Less than comparison function for keys, default functor -// implementation returns 1 if k1 < k2, 0 otherwise. - -template int -ACE_RB_Tree::lessthan (const EXT_ID &k1, const EXT_ID &k2) -{ - ACE_TRACE ("ACE_RB_Tree::lessthan"); - return this->compare_keys_ (k1, k2); -} - -// Method for right rotation of the tree about a given node. - -template void -ACE_RB_Tree::RB_rotate_right (ACE_RB_Tree_Node *x) -{ - ACE_TRACE ("ACE_RB_Tree::RB_rotate_right"); - - if (!x) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nerror: x is a null pointer in ") - ACE_LIB_TEXT ("ACE_RB_Tree::RB_rotate_right\n"))); - else if (! (x->left())) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nerror: x->left () is a null pointer in ") - ACE_LIB_TEXT ("ACE_RB_Tree::RB_rotate_right\n"))); - else - { - ACE_RB_Tree_Node * y; - y = x->left (); - x->left (y->right ()); - if (y->right ()) - y->right ()->parent (x); - y->parent (x->parent ()); - if (x->parent ()) - { - if (x == x->parent ()->right ()) - x->parent ()->right (y); - else - x->parent ()->left (y); - } - else - root_ = y; - y->right (x); - x->parent (y); - } -} - -// Method for left rotation of the tree about a given node. - -template void -ACE_RB_Tree::RB_rotate_left (ACE_RB_Tree_Node * x) -{ - ACE_TRACE ("ACE_RB_Tree::RB_rotate_left"); - - if (! x) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nerror: x is a null pointer in ") - ACE_LIB_TEXT ("ACE_RB_Tree::RB_rotate_left\n"))); - else if (! (x->right())) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nerror: x->right () is a null pointer ") - ACE_LIB_TEXT ("in ACE_RB_Tree::RB_rotate_left\n"))); - else - { - ACE_RB_Tree_Node * y; - y = x->right (); - x->right (y->left ()); - if (y->left ()) - y->left ()->parent (x); - y->parent (x->parent ()); - if (x->parent ()) - { - if (x == x->parent ()->left ()) - x->parent ()->left (y); - else - x->parent ()->right (y); - } - else - root_ = y; - y->left (x); - x->parent (y); - } -} - -// Method for restoring Red-Black properties after a specific deletion case. - -template void -ACE_RB_Tree:: -RB_delete_fixup (ACE_RB_Tree_Node *x, - ACE_RB_Tree_Node *parent) -{ - ACE_TRACE ("ACE_RB_Tree::RB_delete_fixup"); - - while (x != this->root_ - && (!x - || x->color () == ACE_RB_Tree_Node_Base::BLACK)) - { - if (x == parent->left ()) - { - ACE_RB_Tree_Node *w = parent->right (); - if (w && w->color () == ACE_RB_Tree_Node_Base::RED) - { - w->color (ACE_RB_Tree_Node_Base::BLACK); - parent->color (ACE_RB_Tree_Node_Base::RED); - RB_rotate_left (parent); - w = parent->right (); - } - // CLR pp. 263 says that nil nodes are implicitly colored BLACK - if (w - && (!w->left () - || w->left ()->color () == ACE_RB_Tree_Node_Base::BLACK) - && (!w->right () - || w->right ()->color () == ACE_RB_Tree_Node_Base::BLACK)) - { - w->color (ACE_RB_Tree_Node_Base::RED); - x = parent; - parent = x->parent (); - } - else - { - // CLR pp. 263 says that nil nodes are implicitly colored BLACK - if (w - && (!w->right () - || w->right ()->color () == ACE_RB_Tree_Node_Base::BLACK)) - { - if (w->left ()) - w->left ()->color (ACE_RB_Tree_Node_Base::BLACK); - w->color (ACE_RB_Tree_Node_Base::RED); - RB_rotate_right (w); - w = parent->right (); - } - if (w) - { - w->color (parent->color ()); - if (w->right ()) - w->right ()->color (ACE_RB_Tree_Node_Base::BLACK); - } - parent->color (ACE_RB_Tree_Node_Base::BLACK); - RB_rotate_left (parent); - x = root_; - } - } - else - { - ACE_RB_Tree_Node *w = parent->left (); - if (w && w->color () == ACE_RB_Tree_Node_Base::RED) - { - w->color (ACE_RB_Tree_Node_Base::BLACK); - parent->color (ACE_RB_Tree_Node_Base::RED); - RB_rotate_right (parent); - w = parent->left (); - } - // CLR pp. 263 says that nil nodes are implicitly colored BLACK - if (w - && (!w->left () - || w->left ()->color () == ACE_RB_Tree_Node_Base::BLACK) - && (!w->right () - || w->right ()->color () == ACE_RB_Tree_Node_Base::BLACK)) - { - w->color (ACE_RB_Tree_Node_Base::RED); - x = parent; - parent = x->parent (); - } - else - { - // CLR pp. 263 says that nil nodes are implicitly colored BLACK - if (w - && (!w->left () - || w->left ()->color () == ACE_RB_Tree_Node_Base::BLACK)) - { - w->color (ACE_RB_Tree_Node_Base::RED); - if (w->right ()) - w->right ()->color (ACE_RB_Tree_Node_Base::BLACK); - RB_rotate_left (w); - w = parent->left (); - } - if (w) - { - w->color (parent->color ()); - if (w->left ()) - w->left ()->color (ACE_RB_Tree_Node_Base::BLACK); - } - parent->color (ACE_RB_Tree_Node_Base::BLACK); - RB_rotate_right (parent); - x = root_; - } - } - } - - if (x) - x->color (ACE_RB_Tree_Node_Base::BLACK); -} - -// Return a pointer to a matching node if there is one, a pointer to -// the node under which to insert the item if the tree is not empty -// and there is no such match, or 0 if the tree is empty. - -template ACE_RB_Tree_Node * -ACE_RB_Tree::find_node (const EXT_ID &k, ACE_RB_Tree_Base::RB_SearchResult &result) -{ - ACE_TRACE ("ACE_RB_Tree::find_node"); - - // Start at the root. - ACE_RB_Tree_Node *current = root_; - - while (current) - { - // While there are more nodes to examine. - if (this->lessthan (current->key (), k)) - { - // If the search key is greater than the current node's key. - if (current->right ()) - // If the right subtree is not empty, search to the right. - current = current->right (); - else - { - // If the right subtree is empty, we're done searching, - // and are positioned to the left of the insertion point. - result = LEFT; - break; - } - } - else if (this->lessthan (k, current->key ())) - { - // Else if the search key is less than the current node's key. - if (current->left ()) - // If the left subtree is not empty, search to the left. - current = current->left (); - else - { - // If the left subtree is empty, we're done searching, - // and are positioned to the right of the insertion point. - result = RIGHT; - break; - } - } - else - { - // If the keys match exactly, we're done as well. - result = EXACT; - break; - } - } - - return current; -} - -// Rebalance the tree after insertion of a node. - -template void -ACE_RB_Tree::RB_rebalance (ACE_RB_Tree_Node * x) -{ - ACE_TRACE ("ACE_RB_Tree::RB_rebalance"); - - ACE_RB_Tree_Node *y = 0; - - while (x && - x->parent () - && x->parent ()->color () == ACE_RB_Tree_Node_Base::RED) - { - if (! x->parent ()->parent ()) - { - // If we got here, something is drastically wrong! - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nerror: parent's parent is null in ") - ACE_LIB_TEXT ("ACE_RB_Tree::RB_rebalance\n"))); - return; - } - - if (x->parent () == x->parent ()->parent ()->left ()) - { - y = x->parent ()->parent ()->right (); - if (y && y->color () == ACE_RB_Tree_Node_Base::RED) - { - // Handle case 1 (see CLR book, pp. 269). - x->parent ()->color (ACE_RB_Tree_Node_Base::BLACK); - y->color (ACE_RB_Tree_Node_Base::BLACK); - x->parent ()->parent ()->color (ACE_RB_Tree_Node_Base::RED); - x = x->parent ()->parent (); - } - else - { - if (x == x->parent ()->right ()) - { - // Transform case 2 into case 3 (see CLR book, pp. 269). - x = x->parent (); - RB_rotate_left (x); - } - - // Handle case 3 (see CLR book, pp. 269). - x->parent ()->color (ACE_RB_Tree_Node_Base::BLACK); - x->parent ()->parent ()->color (ACE_RB_Tree_Node_Base::RED); - RB_rotate_right (x->parent ()->parent ()); - } - } - else - { - y = x->parent ()->parent ()->left (); - if (y && y->color () == ACE_RB_Tree_Node_Base::RED) - { - // Handle case 1 (see CLR book, pp. 269). - x->parent ()->color (ACE_RB_Tree_Node_Base::BLACK); - y->color (ACE_RB_Tree_Node_Base::BLACK); - x->parent ()->parent ()->color (ACE_RB_Tree_Node_Base::RED); - x = x->parent ()->parent (); - } - else - { - if (x == x->parent ()->left ()) - { - // Transform case 2 into case 3 (see CLR book, pp. 269). - x = x->parent (); - RB_rotate_right (x); - } - - // Handle case 3 (see CLR book, pp. 269). - x->parent ()->color (ACE_RB_Tree_Node_Base::BLACK); - x->parent ()->parent ()->color (ACE_RB_Tree_Node_Base::RED); - RB_rotate_left (x->parent ()->parent ()); - } - } - } -} - -// Method to find the successor node of the given node in the tree. - -template ACE_RB_Tree_Node * -ACE_RB_Tree::RB_tree_successor (ACE_RB_Tree_Node *x) const -{ - ACE_TRACE ("ACE_RB_Tree::RB_tree_successor"); - - if (x == 0) - return 0; - - if (x->right ()) - return RB_tree_minimum (x->right ()); - - ACE_RB_Tree_Node *y = x->parent (); - while ((y) && (x == y->right ())) - { - x = y; - y = y->parent (); - } - - return y; -} - -// Method to find the predecessor node of the given node in the tree. - -template ACE_RB_Tree_Node * -ACE_RB_Tree::RB_tree_predecessor (ACE_RB_Tree_Node *x) const -{ - ACE_TRACE ("ACE_RB_Tree::RB_tree_predecessor"); - if (x == 0) - return 0; - - if (x->left ()) - return RB_tree_maximum (x->left ()); - - ACE_RB_Tree_Node *y = x->parent (); - - while ((y) && (x == y->left ())) - { - x = y; - y = y->parent (); - } - - return y; -} - -// Method to find the minimum node of the subtree rooted at the given node. - -template ACE_RB_Tree_Node * -ACE_RB_Tree::RB_tree_minimum (ACE_RB_Tree_Node *x) const -{ - ACE_TRACE ("ACE_RB_Tree::RB_tree_minimum"); - - while ((x) && (x->left ())) - x = x->left (); - - return x; -} - -// Method to find the maximum node of the subtree rooted at the given node. - -template ACE_RB_Tree_Node * -ACE_RB_Tree::RB_tree_maximum (ACE_RB_Tree_Node *x) const -{ - ACE_TRACE ("ACE_RB_Tree::RB_tree_maximum"); - - while ((x) && (x->right ())) - x = x->right (); - - return x; -} - -// Delete children (left and right) of the node. Must be called with -// lock held. -template -void ACE_RB_Tree::delete_children_i - (ACE_RB_Tree_Node *parent) -{ - if (parent) - { - this->delete_children_i (parent->left ()); - this->delete_children_i (parent->right ()); - ACE_DES_FREE_TEMPLATE2 - (parent->left (), - this->allocator_->free, - ACE_RB_Tree_Node, - EXT_ID, INT_ID); - ACE_DES_FREE_TEMPLATE2 - (parent->right (), - this->allocator_->free, - ACE_RB_Tree_Node, - EXT_ID, INT_ID); - parent->left (0); - parent->right (0); - } - return; -} - -// Close down an RB_Tree. this method should only be called with -// locks already held. - -template int -ACE_RB_Tree::close_i () -{ - ACE_TRACE ("ACE_RB_Tree::close_i"); - - this->delete_children_i (this->root_); - ACE_DES_FREE_TEMPLATE2 (this->root_, - this->allocator()->free, - ACE_RB_Tree_Node, - EXT_ID, INT_ID); - this->current_size_ = 0; - this->root_ = 0; - return 0; -} - -// Returns a pointer to the item corresponding to the given key, or 0 -// if it cannot find the key in the tree. This method should only be -// called with locks already held. - -template int -ACE_RB_Tree::find_i (const EXT_ID &k, - ACE_RB_Tree_Node* &entry, int find_exact) -{ - ACE_TRACE ("ACE_RB_Tree::find_i"); - - // Try to find a match. - RB_SearchResult result = LEFT; - ACE_RB_Tree_Node *current = find_node (k, result); - - if (current) - { - // Found a match - if (!find_exact || result == EXACT) - entry = current; // Assign the entry for any match. - return (result == EXACT ? 0 : -1); - } - else - // The node is not there. - return -1; -} - -// Inserts a *copy* of the key and the item into the tree: both the -// key type EXT_ID and the item type INT_ID must have well defined -// semantics for copy construction and < comparison. This method -// returns a pointer to the inserted item copy, or 0 if an error -// occurred. NOTE: if an identical key already exists in the tree, no -// new item is created, and the returned pointer addresses the -// existing item associated with the existing key. This method should -// only be called with locks already held. - -template INT_ID * -ACE_RB_Tree::insert_i (const EXT_ID &k, const INT_ID &t) -{ - ACE_TRACE ("ACE_RB_Tree::insert_i (const EXT_ID &k, const INT_ID &t)"); - - // Find the closest matching node, if there is one. - RB_SearchResult result = LEFT; - ACE_RB_Tree_Node *current = find_node (k, result); - if (current) - { - // If the keys match, just return a pointer to the node's item. - if (result == EXACT) - return ¤t->item (); - - // Otherwise if we're to the left of the insertion point, insert - // into the right subtree. - else if (result == LEFT) - { - if (current->right ()) - { - // If there is already a right subtree, complain. - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nright subtree already present in ") - ACE_LIB_TEXT ("ACE_RB_Tree::insert_i\n")), - 0); - } - else - { - // The right subtree is empty: insert new node there. - ACE_RB_Tree_Node *tmp = 0; - - ACE_NEW_MALLOC_RETURN - (tmp, - (reinterpret_cast*> - (this->allocator_->malloc (sizeof (*tmp)))), - (ACE_RB_Tree_Node) (k, t), - 0); - current->right (tmp); - - // If the node was successfully inserted, set its - // parent, rebalance the tree, color the root black, and - // return a pointer to the inserted item. - INT_ID *item = &(current->right ()->item ()); - current->right ()->parent (current); - RB_rebalance (current->right ()); - root_->color (ACE_RB_Tree_Node_Base::BLACK); - ++current_size_; - return item; - } - } - // Otherwise, we're to the right of the insertion point, so - // insert into the left subtree. - else // (result == RIGHT) - { - if (current->left ()) - // If there is already a left subtree, complain. - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nleft subtree already present in ") - ACE_LIB_TEXT ("ACE_RB_Tree::insert_i\n")), - 0); - else - { - // The left subtree is empty: insert new node there. - ACE_RB_Tree_Node *tmp = 0; - ACE_NEW_MALLOC_RETURN - (tmp, - (reinterpret_cast*> - (this->allocator_->malloc (sizeof (*tmp)))), - (ACE_RB_Tree_Node) (k, t), - 0); - current->left (tmp); - - // If the node was successfully inserted, set its - // parent, rebalance the tree, color the root black, and - // return a pointer to the inserted item. - INT_ID *item = ¤t->left ()->item (); - current->left ()->parent (current); - RB_rebalance (current->left ()); - root_->color (ACE_RB_Tree_Node_Base::BLACK); - ++current_size_; - return item; - } - } - } - else - { - // The tree is empty: insert at the root and color the root - // black. - ACE_NEW_MALLOC_RETURN - (this->root_, - (reinterpret_cast*> - (this->allocator_->malloc (sizeof (ACE_RB_Tree_Node)))), - (ACE_RB_Tree_Node) (k, t), - 0); - this->root_->color (ACE_RB_Tree_Node_Base::BLACK); - ++current_size_; - return &this->root_->item (); - } -} - -// Inserts a *copy* of the key and the item into the tree: both the -// key type EXT_ID and the item type INT_ID must have well defined -// semantics for copy construction. The default implementation also -// requires that the key type support well defined < semantics. This -// method passes back a pointer to the inserted (or existing) node, -// and the search status. If the node already exists, the method -// returns 1. If the node does not exist, and a new one is -// successfully created, and the method returns 0. If there was an -// error, the method returns -1. - -template int -ACE_RB_Tree::insert_i (const EXT_ID &k, - const INT_ID &t, - ACE_RB_Tree_Node *&entry) -{ - ACE_TRACE ("ACE_RB_Tree::insert_i (const EXT_ID &k, const INT_ID &t, " - "ACE_RB_Tree_Node *&entry)"); - - // Find the closest matching node, if there is one. - RB_SearchResult result = LEFT; - ACE_RB_Tree_Node *current = find_node (k, result); - if (current) - { - // If the keys match, just return a pointer to the node's item. - if (result == EXACT) - { - entry = current; - return 1; - } - // Otherwise if we're to the left of the insertion - // point, insert into the right subtree. - else if (result == LEFT) - { - if (current->right ()) - { - // If there is already a right subtree, complain. - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nright subtree already present in ") - ACE_LIB_TEXT ("ACE_RB_Tree::insert_i\n")), - -1); - } - else - { - // The right subtree is empty: insert new node there. - ACE_RB_Tree_Node *tmp = 0; - ACE_NEW_MALLOC_RETURN - (tmp, - (reinterpret_cast*> - (this->allocator_->malloc (sizeof (*tmp)))), - (ACE_RB_Tree_Node) (k, t), - -1); - current->right (tmp); - - // If the node was successfully inserted, set its parent, rebalance - // the tree, color the root black, and return a pointer to the - // inserted item. - entry = current->right (); - current->right ()->parent (current); - RB_rebalance (current->right ()); - this->root_->color (ACE_RB_Tree_Node_Base::BLACK); - ++this->current_size_; - return 0; - } - } - // Otherwise, we're to the right of the insertion point, so - // insert into the left subtree. - else // (result == RIGHT) - { - if (current->left ()) - // If there is already a left subtree, complain. - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nleft subtree already present in ") - ACE_LIB_TEXT ("ACE_RB_Tree::insert_i\n")), - -1); - else - { - // The left subtree is empty: insert new node there. - ACE_RB_Tree_Node *tmp = 0; - ACE_NEW_MALLOC_RETURN - (tmp, - (reinterpret_cast*> - (this->allocator_->malloc (sizeof (*tmp)))), - (ACE_RB_Tree_Node) (k, t), - -1); - current->left (tmp); - // If the node was successfully inserted, set its - // parent, rebalance the tree, color the root black, and - // return a pointer to the inserted item. - entry = current->left (); - current->left ()->parent (current); - RB_rebalance (current->left ()); - this->root_->color (ACE_RB_Tree_Node_Base::BLACK); - ++this->current_size_; - return 0; - } - } - } - else - { - // The tree is empty: insert at the root and color the root black. - ACE_NEW_MALLOC_RETURN - (this->root_, - (reinterpret_cast*> - (this->allocator_->malloc (sizeof (ACE_RB_Tree_Node)))), - (ACE_RB_Tree_Node) (k, t), - -1); - this->root_->color (ACE_RB_Tree_Node_Base::BLACK); - ++this->current_size_; - entry = this->root_; - return 0; - } -} - -// Removes the item associated with the given key from the tree and -// destroys it. Returns 1 if it found the item and successfully -// destroyed it, 0 if it did not find the item, or -1 if an error -// occurred. This method should only be called with locks already -// held. - -template int -ACE_RB_Tree::remove_i (const EXT_ID &k, INT_ID &i) -{ - ACE_TRACE ("ACE_RB_Tree::remove_i (const EXT_ID &k, INT_ID &i)"); - - // Find a matching node, if there is one. - ACE_RB_Tree_Node *z; - RB_SearchResult result = LEFT; - z = find_node (k, result); - - // If there is a matching node: remove and destroy it. - if (z && result == EXACT) - { - // Return the internal id stored in the deleted node. - i = z->item (); - return -1 == this->remove_i (z) ? -1 : 1; - } - - // No matching node was found: return 0. - return 0; -} - -/// Recursive function to dump the state of an object. -template void -ACE_RB_Tree:: -dump_i (ACE_RB_Tree_Node *node) const -{ -#if defined (ACE_HAS_DUMP) - if (node) - { - dump_node_i (*node); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ndown left\n"))); - this->dump_i (node->left ()); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nup left\n"))); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ndown right\n"))); - this->dump_i (node->right ()); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nup right\n"))); - } - else - { - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nNULL POINTER (BLACK)\n"))); - } -#else /* !ACE_HAS_DUMP */ - ACE_UNUSED_ARG (node); -#endif /* ACE_HAS_DUMP */ -} - -/// Function to dump node itself. Does not show parameterized node contents -/// in its basic form, but template specialization can be used to -/// provide definitions for various EXT_ID and INT_ID types. - -template void -ACE_RB_Tree:: -dump_node_i (ACE_RB_Tree_Node &node) const -{ -#if defined (ACE_HAS_DUMP) - const char * color_str = (node.color () == ACE_RB_Tree_Node_Base::RED) - ? "RED" : "BLACK"; - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" color=[%s]\n"), color_str)); -#else /* !ACE_HAS_DUMP */ - ACE_UNUSED_ARG (node); -#endif /* ACE_HAS_DUMP */ -} - -/// Tests the red-black invariant(s) throughout the whole tree. - -template int -ACE_RB_Tree::test_invariant (void) -{ - ACE_TRACE ("ACE_RB_Tree::test_invariant"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - // Recurse from the root, starting with the measured black height at - // 0, and the expected black height at -1, which will cause the - // count from first measured path to a leaf to be used as the - // expected one from that point onward (the key is to check - // consistency). - int expected_black_height = -1; - if (this->test_invariant_recurse (this->root_, expected_black_height, 0) == 0) - { - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("invariant holds\n"))); - return 0; - } - - return -1; -} - -/// Recursive function to test the red-black invariant(s) at all nodes in a subtree. - -template int -ACE_RB_Tree::test_invariant_recurse (ACE_RB_Tree_Node *x, - int & expected_black_height, - int measured_black_height) -{ - ACE_TRACE ("ACE_RB_Tree::test_invariant_recurse"); - - if (!x) - { - // Count each leaf (zero pointer) as a black node (per CLR algorithm description). - ++measured_black_height; - - if (expected_black_height == -1) - { - expected_black_height = measured_black_height; - } - else if (expected_black_height != measured_black_height) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("\nexpected_black_height = %d but ") - ACE_LIB_TEXT ("\nmeasured_black_height = %d in ") - ACE_LIB_TEXT ("ACE_RB_Tree::test_invariant_recurse\n"), - expected_black_height, measured_black_height), - -1); - } - - return 0; - } - - // Check the invariant that a red node cannot have a red child. - if (x->color () == ACE_RB_Tree_Node_Base::RED) - { - if (x->left () && x->left ()->color () == ACE_RB_Tree_Node_Base::RED) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nRED parent has RED left child in ") - ACE_LIB_TEXT ("ACE_RB_Tree::test_invariant_recurse\n")), - -1); - } - - if (x->right () && x->right ()->color () == ACE_RB_Tree_Node_Base::RED) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("\nRED parent has RED right child in ") - ACE_LIB_TEXT ("ACE_RB_Tree::test_invariant_recurse\n")), - -1); - } - } - else - { - // Count each black node traversed. - ++measured_black_height; - } - - return (test_invariant_recurse (x->left (), expected_black_height, measured_black_height) == 0) - ? test_invariant_recurse (x->right (), expected_black_height, measured_black_height) - : -1; -} - -template int -ACE_RB_Tree::remove_i (ACE_RB_Tree_Node *z) -{ - ACE_TRACE ("ACE_RB_Tree::remove_i (ACE_RB_Tree_Node *z)"); - - // Delete the node and reorganize the tree to satisfy the Red-Black - // properties. - - ACE_RB_Tree_Node *x; - ACE_RB_Tree_Node *y; - ACE_RB_Tree_Node *parent; - - if (z->left () && z->right ()) - y = RB_tree_successor (z); - else - y = z; - - if (y->left ()) - x = y->left (); - else - x = y->right (); - - parent = y->parent (); - if (x) - { - x->parent (parent); - } - - if (parent) - { - if (y == parent->left ()) - parent->left (x); - else - parent->right (x); - } - else - this->root_ = x; - - if (y != z) - { - // Copy the elements of y into z. - z->key () = y->key (); - z->item () = y->item (); - } - - // CLR pp. 263 says that nil nodes are implicitly colored BLACK - if (!y || y->color () == ACE_RB_Tree_Node_Base::BLACK) - RB_delete_fixup (x, parent); - - y->parent (0); - y->right (0); - y->left (0); - ACE_DES_FREE_TEMPLATE2 (y, - this->allocator_->free, - ACE_RB_Tree_Node, - EXT_ID, INT_ID); - --this->current_size_; - - return 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_RB_Tree_Iterator_Base) - -// Constructor. - -template -ACE_RB_Tree_Iterator_Base::ACE_RB_Tree_Iterator_Base (const ACE_RB_Tree &tree, int set_first) - : tree_ (&tree), node_ (0) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::ACE_RB_Tree_Iterator_Base (ACE_RB_Tree, int)"); - - // Position the iterator at the first (or last) node in the tree. - if (set_first) - node_ = tree_->RB_tree_minimum (tree_->root_); - else - node_ = tree_->RB_tree_maximum (tree_->root_); -} - -template -ACE_RB_Tree_Iterator_Base::ACE_RB_Tree_Iterator_Base (const ACE_RB_Tree &tree, ACE_RB_Tree_Node* entry) - : tree_ (&tree), node_ (0) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base(const ACE_RB_Tree &tree, ACE_RB_Tree_Node* entry)"); - node_ = entry; -} - -template -ACE_RB_Tree_Iterator_Base::ACE_RB_Tree_Iterator_Base (const EXT_ID& key,ACE_RB_Tree &tree) - : tree_ (&tree), node_ (0) -{ - ACE_TRACE("ACE_RB_Tree_Iterator_Base (ACE_RB_Tree &tree, const EXT_ID& key)"); - ACE_RB_Tree_Node* entry = 0; - tree.find_i(key, entry); - node_ = entry; -} - -// Copy constructor. - -template -ACE_RB_Tree_Iterator_Base::ACE_RB_Tree_Iterator_Base (const ACE_RB_Tree_Iterator_Base &iter) - : tree_ (iter.tree_), - node_ (iter.node_) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::ACE_RB_Tree_Iterator_Base (ACE_RB_Tree_Iterator_Base)"); -} - -// Assignment operator. - -template void -ACE_RB_Tree_Iterator_Base::operator= (const ACE_RB_Tree_Iterator_Base &iter) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::operator="); - if (this != &iter) - { - tree_ = iter.tree_; - node_ = iter.node_; - } -} - -// Destructor. - -template -ACE_RB_Tree_Iterator_Base::~ACE_RB_Tree_Iterator_Base () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::~ACE_RB_Tree_Iterator_Base"); -} - -// Dump the state of an object. - -template -void -ACE_RB_Tree_Iterator_Base::dump_i (void) const -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::dump_i"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nnode_ = %x\n"), this->node_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - - -ACE_ALLOC_HOOK_DEFINE(ACE_RB_Tree_Iterator) - -// Constructor. - -template -ACE_RB_Tree_Iterator::ACE_RB_Tree_Iterator (const ACE_RB_Tree &tree, - int set_first) - : ACE_RB_Tree_Iterator_Base (tree, set_first) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::ACE_RB_Tree_Iterator"); -} - -template -ACE_RB_Tree_Iterator::ACE_RB_Tree_Iterator (const ACE_RB_Tree &tree, - ACE_RB_Tree_Node* entry) - : ACE_RB_Tree_Iterator_Base (tree,entry) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::ACE_RB_Tree_Iterator"); -} - -template -ACE_RB_Tree_Iterator::ACE_RB_Tree_Iterator (const EXT_ID& key,ACE_RB_Tree &tree) - : ACE_RB_Tree_Iterator_Base(key,tree) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::ACE_RB_Tree_Iterator"); -} - -// Destructor. - -template -ACE_RB_Tree_Iterator::~ACE_RB_Tree_Iterator () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::~ACE_RB_Tree_Iterator"); -} - -ACE_ALLOC_HOOK_DEFINE(ACE_RB_Tree_Reverse_Iterator) - -// Constructor. - -template -ACE_RB_Tree_Reverse_Iterator::ACE_RB_Tree_Reverse_Iterator (const ACE_RB_Tree &tree, int set_last) - : ACE_RB_Tree_Iterator_Base (tree, set_last ? 0 : 1) -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::ACE_RB_Tree_Reverse_Iterator"); -} - -template -ACE_RB_Tree_Reverse_Iterator::ACE_RB_Tree_Reverse_Iterator (const ACE_RB_Tree &tree, ACE_RB_Tree_Node* entry) - : ACE_RB_Tree_Iterator_Base (tree,entry) -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::ACE_RB_Tree_Reverse_Iterator"); -} - -template -ACE_RB_Tree_Reverse_Iterator::ACE_RB_Tree_Reverse_Iterator (const EXT_ID& key,ACE_RB_Tree &tree) - : ACE_RB_Tree_Iterator_Base(key,tree) -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::ACE_RB_Tree_Reverse_Iterator"); -} - -// Destructor. - -template -ACE_RB_Tree_Reverse_Iterator::~ACE_RB_Tree_Reverse_Iterator () -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::~ACE_RB_Tree_Reverse_Iterator"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* !ACE_RB_TREE_CPP */ diff --git a/ace/RB_Tree.h b/ace/RB_Tree.h deleted file mode 100644 index 08706910d73..00000000000 --- a/ace/RB_Tree.h +++ /dev/null @@ -1,904 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file RB_Tree.h - * - * $Id$ - * - * @author Chris Gill - */ -//============================================================================= - - -#ifndef ACE_RB_TREE_H -#define ACE_RB_TREE_H -#include /**/ "ace/pre.h" - -#include "ace/Global_Macros.h" -#include "ace/Functor_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl. -template -class ACE_RB_Tree_Iterator_Base; - -// Forward decl. -template -class ACE_RB_Tree_Iterator; - -// Forward decl. -template -class ACE_RB_Tree_Reverse_Iterator; - -// Forward decl. -class ACE_Allocator; - -class ACE_RB_Tree_Node_Base -{ -public: - enum RB_Tree_Node_Color {RED, BLACK}; -}; - -/** - * @class ACE_RB_Tree_Node - * - * @brief Implements a node in a Red-Black Tree ADT. - */ -template -class ACE_RB_Tree_Node : public ACE_RB_Tree_Node_Base -{ -public: - // = Initialization and termination methods. - - /// Constructor. - ACE_RB_Tree_Node (const EXT_ID &k, const INT_ID &t); - - /// Destructor. - ~ACE_RB_Tree_Node (void); - - /// Key accessor. - EXT_ID &key (void); - - /// Item accessor. - INT_ID &item (void); - - /// Set color of the node. - void color (RB_Tree_Node_Color c); - - /// Get color of the node. - RB_Tree_Node_Color color (void); - - /// Accessor for node's parent pointer. - ACE_RB_Tree_Node *parent (void); - - /// Mutator for node's parent pointer. - void parent (ACE_RB_Tree_Node * p); - - /// Accessor for node's left child pointer. - ACE_RB_Tree_Node *left (void); - - /// Mutator for node's left child pointer. - void left (ACE_RB_Tree_Node *l); - - /// Accessor for node's right child pointer. - ACE_RB_Tree_Node *right (void); - - /// Mutator for node's right child pointer - void right (ACE_RB_Tree_Node * r); - -private: - - /// The key. - EXT_ID k_; - - /// The item. - INT_ID t_; - - /// Color of the node. - RB_Tree_Node_Color color_; - - /// Pointer to node's parent. - ACE_RB_Tree_Node *parent_; - - /// Pointer to node's left child. - ACE_RB_Tree_Node *left_; - - /// Pointer to node's right child. - ACE_RB_Tree_Node *right_; -}; - -class ACE_RB_Tree_Base -{ -public: - /// Search result enumeration. - enum RB_SearchResult {LEFT, EXACT, RIGHT}; - - /// Get the allocator; - /** - * @note This method is inlined here rather than in RB_Tree.inl - * since that file may be included multiple times when - * inlining is disabled and on platforms where - * @c ACE_TEMPLATES_REQUIRE_SOURCE is defined. In those - * platform/configuration combinations, multiple definitions - * of this method occured. Placing the definition inline in - * the header avoids such errors. - */ - ACE_Allocator * allocator (void) const { return this->allocator_; } - -protected: - // = Protected members. - - /// Pointer to a memory allocator. - ACE_Allocator *allocator_; -}; - -/** - * @class ACE_RB_Tree - * - * @brief Implements a Red-Black Tree ADT, according to T. H. Corman, - * C. E. Leiserson, and R. L. Rivest, "Introduction to Algorithms" - * 1990, MIT, chapter 14. - * - * A number of Changes have been made to this class template - * in order to conform to the ACE_Hash_Map_Manager_Ex - * interface. All previously supported public methods are - * still part of this class. However, these are marked as - * DEPRECATED and will be removed from this class in - * a future version of ACE. Please migrate your code - * to the appropriate public methods indicated in the - * method deprecation comments. - * This class uses an ACE_Allocator to allocate memory. The - * user can make this a persistent class by providing an - * ACE_Allocator with a persistable memory pool. - * - * Requirements and Performance Characteristics - * - Internal Structure: - * Binary tree - * - Duplicates allowed? - * No - * - Random access allowed? - * No - * - Search speed: - * Log(n) - * - Insert/replace speed: - * Log(n) - * - Iterator still valid after change to container? - * Yes, except if the iterated-over element is removed. - * - Frees memory for removed elements? - * Yes - * - Items inserted by: - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * -# operator< - */ -template -class ACE_RB_Tree : public ACE_RB_Tree_Base -{ - -public: - friend class ACE_RB_Tree_Iterator_Base; - friend class ACE_RB_Tree_Iterator; - friend class ACE_RB_Tree_Reverse_Iterator; - - typedef EXT_ID KEY; - typedef INT_ID VALUE; - typedef ACE_LOCK lock_type; - typedef ACE_RB_Tree_Node ENTRY; - - // = ACE-style iterator typedefs. - typedef ACE_RB_Tree_Iterator ITERATOR; - typedef ACE_RB_Tree_Reverse_Iterator REVERSE_ITERATOR; - - // = STL-style iterator typedefs. - typedef ACE_RB_Tree_Iterator iterator; - typedef ACE_RB_Tree_Reverse_Iterator reverse_iterator; - - // = Initialization and termination methods. - - /// Constructor. - ACE_RB_Tree (ACE_Allocator *alloc = 0); - - - /// Copy constructor. - ACE_RB_Tree (const ACE_RB_Tree &rbt); - - /// Initialize an RB Tree. - int open (ACE_Allocator *alloc = 0); - - /// Close down an RB_Tree and release dynamically allocated - /// resources. - int close (void); - - /// Destructor. - virtual ~ACE_RB_Tree (void); - - // = insertion, removal, and search methods. - - /** - * Associate @a ext_id with @a int_id. If @a ext_id is already in the - * tree then the is not changed. Returns 0 if a - * new entry is bound successfully, returns 1 if an attempt is made - * to bind an existing entry, and returns -1 if failures occur. - */ - int bind (const EXT_ID &item, - const INT_ID &int_id); - - /** - * Same as a normal bind, except the tree entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int bind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_RB_Tree_Node *&entry); - - - /** - * Associate @a ext_id with @a int_id if and only if @a ext_id is not - * in the tree. If @a ext_id is already in the tree then the @a int_id - * parameter is assigned the existing value in the tree. Returns 0 - * if a new entry is bound successfully, returns 1 if an attempt is - * made to bind an existing entry, and returns -1 if failures occur. - */ - int trybind (const EXT_ID &ext_id, - INT_ID &int_id); - - /** - * Same as a normal trybind, except the tree entry is also passed - * back to the caller. The entry in this case will either be the - * newly created entry, or the existing one. - */ - int trybind (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_RB_Tree_Node *&entry); - - /** - * Reassociate @a ext_id with @a int_id. If @a ext_id is not in the - * tree then behaves just like . Returns 0 if a new entry is - * bound successfully, returns 1 if an existing entry was rebound, - * and returns -1 if failures occur. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id); - - /** - * Same as a normal rebind, except the tree entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_RB_Tree_Node *&entry); - - /** - * Associate @a ext_id with @a int_id. If @a ext_id is not in the tree - * then behaves just like . Otherwise, store the old value of - * @a int_id into the "out" parameter and rebind the new parameters. - * Returns 0 if a new entry is bound successfully, returns 1 if an - * existing entry was rebound, and returns -1 if failures occur. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id); - - /** - * Same as a normal rebind, except the tree entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id, - ACE_RB_Tree_Node *&entry); - - /** - * Associate @a ext_id with @a int_id. If @a ext_id is not in the tree - * then behaves just like . Otherwise, store the old values - * of @a ext_id and @a int_id into the "out" parameters and rebind the - * new parameters. This is very useful if you need to have an - * atomic way of updating and you also need - * full control over memory allocation. Returns 0 if a new entry is - * bound successfully, returns 1 if an existing entry was rebound, - * and returns -1 if failures occur. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id); - - /** - * Same as a normal rebind, except the tree entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_RB_Tree_Node *&entry); - - /// Locate @a ext_id and pass out parameter via @a int_id. If found, - /// return 0, returns -1 if not found. - int find (const EXT_ID &ext_id, - INT_ID &int_id); - - /// Locate @a ext_id and pass out parameter via . If found, - /// return 0, returns -1 if not found. - int find (const EXT_ID &ext_id, - ACE_RB_Tree_Node *&entry); - - /** - * Unbind (remove) the @a ext_id from the tree. Don't return the - * @a int_id to the caller (this is useful for collections where the - * @c int_ids are *not* dynamically allocated...) - */ - int unbind (const EXT_ID &ext_id); - - /// Break any association of @a ext_id. Returns the value of @a int_id - /// in case the caller needs to deallocate memory. - int unbind (const EXT_ID &ext_id, - INT_ID &int_id); - - /** - * Remove entry from tree. This method should be used with *extreme* - * caution, and only for optimization purposes. The node being passed - * in had better have been allocated by the tree that is unbinding it. - */ - int unbind (ACE_RB_Tree_Node *entry); - - // = Public helper methods. - - /// Returns the current number of nodes in the tree. - size_t current_size (void) const; - - /// Assignment operator. - void operator= (const ACE_RB_Tree &rbt); - - /** - * Returns a reference to the underlying . This makes it - * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the ACE_Atomic_Op with an - * ACE_Recursive_Mutex or ACE_Process_Mutex, or if you need to - * guard the state of an iterator. - * @note The right name would be , but HP/C++ will choke on that! - */ - ACE_LOCK &mutex (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iterator factory functions. - - /// Return forward iterator positioned at first node in tree. - ACE_RB_Tree_Iterator begin (void); - - /// Return forward iterator positioned at last node in tree. - ACE_RB_Tree_Iterator end (void); - - /// Return reverse iterator positioned at last node in tree. - ACE_RB_Tree_Reverse_Iterator rbegin (void); - - /// Return reverse iterator positioned at first node in tree. - ACE_RB_Tree_Reverse_Iterator rend (void); - - /// Recursively tests the invariant red-black properties at each - /// node of the tree. Returns 0 if invariant holds, else -1. - /// This method is computationally expensive, and should only be - /// called for testing purposes, and not in code that depends on the - /// algorithmic complexity bounds provided by the other methods. - int test_invariant (void); - - // = DEPRECATED methods. - // Please migrate your code to use the new methods instead - - /** - * Returns a pointer to the item corresponding to the - * given key, or 0 if it cannot find the key in the tree. - * - * @deprecated signature will change to become - * int find (const EXT_ID &ext_id); which will return - * 0 if the @a ext_id is in the tree, otherwise -1. - */ - INT_ID* find (const EXT_ID &k); - - /** - * Inserts a *copy* of the key and the item into the tree: both the - * key type EXT_ID and the item type INT_ID must have well defined semantics - * for copy construction. The default implementation also requires that - * the key type support well defined < semantics. This method returns a - * pointer to the inserted item copy, or 0 if an error occurred. - * @note If an identical key already exists in the tree, no new item - * is created, and the returned pointer addresses the existing item - * associated with the existing key. - * @deprecated - */ - INT_ID* insert (const EXT_ID &k, const INT_ID &t); - - /** - * Removes the item associated with the given key from the tree and - * destroys it. Returns 1 if it found the item and successfully - * destroyed it, 0 if it did not find the item, or -1 if an error - * occurred. - * @deprecated - */ - int remove (const EXT_ID &k); - - /// @deprecated - /// Destroys all nodes and sets the root pointer null. - void clear (void); - -protected: - /// Reinitialize constructor. - /** - * This constructor is used to provide a valid vtable and allocator - * if the tree is reconstructed from shared memory. Constructor - * used by the derived class that has an allocator - */ - ACE_RB_Tree (void *location, - ACE_Allocator *alloc); - - // = Protected methods. These should only be called with locks held. - - /// Recursively tests the invariant red-black properties at each - /// node of the tree. Returns 0 if invariant holds, else -1. - int test_invariant_recurse (ACE_RB_Tree_Node * x, - int & expected_black_height, - int measured_black_height); - - /// Method for right rotation of the tree about a given node. - void RB_rotate_right (ACE_RB_Tree_Node * x); - - /// Method for left rotation of the tree about a given node. - void RB_rotate_left (ACE_RB_Tree_Node * x); - - /// Method for restoring Red-Black properties after deletion. - void RB_delete_fixup (ACE_RB_Tree_Node * x, - ACE_RB_Tree_Node * parent); - - /// Method to find the successor node of the given node in the tree. - ACE_RB_Tree_Node * - RB_tree_successor (ACE_RB_Tree_Node *x) const; - - /// Method to find the predecessor node of the given node in the - /// tree. - ACE_RB_Tree_Node * - RB_tree_predecessor (ACE_RB_Tree_Node *x) const; - - /// Method to find the minimum node of the subtree rooted at the - /// given node. - ACE_RB_Tree_Node * - RB_tree_minimum (ACE_RB_Tree_Node *x) const; - - /// Method to find the maximum node of the subtree rooted at the - /// given node. - ACE_RB_Tree_Node * - RB_tree_maximum (ACE_RB_Tree_Node *x) const; - - /** - * Returns a pointer to a matching node if there is one, a pointer - * to the node under which to insert the item if the tree is not - * empty and there is no such match, or 0 if the tree is empty. - * It stores the result of the search in the result argument: - * LEFT if the node is to the left of the node to be inserted, - * RIGHT if the node is to the right of the node to be inserted, - * or EXACT if an exactly matching node already exists. - */ - ACE_RB_Tree_Node *find_node (const EXT_ID &k, - ACE_RB_Tree_Base::RB_SearchResult &result); - - /// Rebalance the tree after insertion of a node. - void RB_rebalance (ACE_RB_Tree_Node * x); - - /// Delete children (left and right) of the node. Must be called with - /// lock held. - void delete_children_i (ACE_RB_Tree_Node *parent); - - /// Close down an RB_Tree. this method should - /// only be called with locks already held. - int close_i (void); - - /** - * Retrieves a pointer to the item corresponding to the - * given key. If find_exact==1, find the exact match node, - * otherwise just find a match node - * Returns 0 for success, or -1 if it cannot find the key in the tree. - */ - int find_i (const EXT_ID &ext_id, ACE_RB_Tree_Node* &entry, int find_exact = 1); - - /** - * Inserts a *copy* of the key and the item into the tree: both the - * key type EXT_ID and the item type INT_ID must have well defined semantics - * for copy construction. The default implementation also requires that - * the key type support well defined < semantics. This method returns a - * pointer to the inserted item copy, or 0 if an error occurred. - * @note If an identical key already exists in the tree, no new item - * is created, and the returned pointer addresses the existing item - * associated with the existing key. - */ - INT_ID* insert_i (const EXT_ID &k, const INT_ID &t); - - /** - * Inserts a *copy* of the key and the item into the tree: both the - * key type EXT_ID and the item type INT_ID must have well defined semantics - * for copy construction. The default implementation also requires that - * the key type support well defined < semantics. This method passes back - * a pointer to the inserted (or existing) node, and the search status. If - * the node already exists, the method returns 1. If the node does not - * exist, and a new one is successfully created, and the method returns 0. - * If there was an error, the method returns -1. - */ - int insert_i (const EXT_ID &k, const INT_ID &t, - ACE_RB_Tree_Node *&entry); - - /** - * Removes the item associated with the given key from the tree and - * destroys it. Returns 1 if it found the item and successfully - * destroyed it, 0 if it did not find the item, or -1 if an error - * occurred. Returns the stored internal id in the second argument. - */ - int remove_i (const EXT_ID &k, INT_ID &i); - - /// Removes the item associated with the given key from the tree and - /// destroys it. - int remove_i (ACE_RB_Tree_Node *z); - - /// Recursive function to dump the state of an object. - void dump_i (ACE_RB_Tree_Node *node) const; - - /// Function to dump node contents. Does nothing in its - /// basic form, but template specialization can be used to - /// provide definitions for various EXT_ID and INT_ID types. - void dump_node_i (ACE_RB_Tree_Node &node) const; - - /// Less than comparison function for keys, using comparison functor. - int lessthan (const EXT_ID &k1, const EXT_ID &k2); - -private: - - // = Private members. - - /// Synchronization variable for the MT_SAFE . - ACE_LOCK lock_; - - /// The root of the tree. - ACE_RB_Tree_Node *root_; - - /// Comparison functor for comparing nodes in the tree. - COMPARE_KEYS compare_keys_; - - /// The current number of nodes in the tree. - size_t current_size_; -}; - -/** - * @class ACE_RB_Tree_Iterator_Base - * - * @brief Implements a common base class for iterators for a Red-Black Tree ADT. - */ -template -class ACE_RB_Tree_Iterator_Base -{ - -public: - - /// Assignment operator: copies both the tree reference and the position in the tree. - void operator= (const ACE_RB_Tree_Iterator_Base &iter); - - // = Iteration methods. - - /// Returns 1 when the iteration has completed, otherwise 0. - int done (void) const; - - /// STL-like iterator dereference operator: returns a reference - /// to the node underneath the iterator. - ACE_RB_Tree_Node & operator* (void) const; - - /// STL-like iterator dereference operator: returns a pointer - /// to the node underneath the iterator. - ACE_RB_Tree_Node * operator-> (void) const; - - /// Returns a const reference to the tree over which we're iterating. - const ACE_RB_Tree &tree (void); - - /// Comparison operator: returns 1 if both iterators point to the same position, otherwise 0. - bool operator== (const ACE_RB_Tree_Iterator_Base &) const; - - /// Comparison operator: returns 1 if the iterators point to different positions, otherwise 0. - bool operator!= (const ACE_RB_Tree_Iterator_Base &) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - // = Initialization and termination methods. - - /// Create the singular iterator. No valid iterator can be equal to - /// it, it is illegal to dereference a singular iterator, etc. etc. - ACE_RB_Tree_Iterator_Base (void); - - /** - * Constructor. Takes an ACE_RB_Tree over which to iterate, and - * an integer indicating (if non-zero) to position the iterator - * at the first element in the tree (if this integer is 0, the - * iterator is positioned at the last element in the tree). - */ - ACE_RB_Tree_Iterator_Base (const ACE_RB_Tree &tree, - int set_first); - - /** - * Constructor. Takes an ACE_RB_Tree over which to iterate, and - * a pointer to a node in the tree. - */ - ACE_RB_Tree_Iterator_Base (const ACE_RB_Tree &tree, - ACE_RB_Tree_Node* entry); - - /** - * Constructor. Takes an ACE_RB_Tree over which to iterate, and a key. - * The key must come first to distinguish the case of EXT_ID == int. - */ - ACE_RB_Tree_Iterator_Base (const EXT_ID& key, - ACE_RB_Tree &tree); - - /// Copy constructor. - ACE_RB_Tree_Iterator_Base (const ACE_RB_Tree_Iterator_Base &iter); - - /// Destructor. - ~ACE_RB_Tree_Iterator_Base (void); - - // = Internal methods - - /// Move forward by one element in the tree. Returns 0 when - /// there are no more elements in the tree, otherwise 1. - int forward_i (void); - - /// Move back by one element in the tree. Returns 0 when - /// there are no more elements in the tree, otherwise 1. - int reverse_i (void); - - /// Dump the state of an object. - void dump_i (void) const; - - // = Protected members. - - /// Reference to the ACE_RB_Tree over which we're iterating. - const ACE_RB_Tree *tree_; - - /// Pointer to the node currently under the iterator. - ACE_RB_Tree_Node *node_; - -}; - -/** - * @class ACE_RB_Tree_Iterator - * - * @brief Implements an iterator for a Red-Black Tree ADT. - */ -template -class ACE_RB_Tree_Iterator : public ACE_RB_Tree_Iterator_Base -{ - -public: - - // = Initialization and termination methods. - /** - * Create the singular iterator. - * It is illegal to deference the iterator, no valid iterator is - * equal to a singular iterator, etc. etc. - */ - ACE_RB_Tree_Iterator (void); - - /** - * Constructor. Takes an ACE_RB_Tree over which to iterate, and - * an integer indicating (if non-zero) to position the iterator - * at the first element in the tree (if this integer is 0, the - * iterator is positioned at the last element in the tree). - */ - ACE_RB_Tree_Iterator (const ACE_RB_Tree &tree, - int set_first = 1); - /** - * Constructor. Takes an ACE_RB_Tree over which to iterate - * and a pointer to a node in the tree. - */ - ACE_RB_Tree_Iterator (const ACE_RB_Tree &tree, - ACE_RB_Tree_Node* entry); - - /** - * Constructor. Takes an ACE_RB_Tree over which to iterate, and a key; - * the key comes first in order to distinguish the case of EXT_ID == int. - */ - ACE_RB_Tree_Iterator (const EXT_ID &key, - ACE_RB_Tree &tree); - - /// Destructor. - ~ACE_RB_Tree_Iterator (void); - - // = ACE-style iteration methods. - - /// Move forward by one element in the tree. Returns - /// 0 when all elements have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL-style iteration methods. - - /// Prefix advance. - ACE_RB_Tree_Iterator & operator++ (void); - - /// Postfix advance. - ACE_RB_Tree_Iterator operator++ (int); - - /// Prefix reverse. - ACE_RB_Tree_Iterator & operator-- (void); - - /// Postfix reverse. - ACE_RB_Tree_Iterator operator-- (int); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /** - * Passes back the under the iterator. Returns 0 if - * the iteration has completed, otherwise 1. This method must - * be declared and defined in both the derived forward and - * reverse iterator classes rather than in the base iterator - * class because of a method signature resolution problem - * caused by the existence of the deprecated next (void) - * method in the derived forward iterator class. When that - * deprecated method is removed, this method should be removed - * from the derived classes and placed in the base class. - */ - int next (ACE_RB_Tree_Node *&next_entry) const; - - // = DEPRECATED methods. Please migrate your code to use the new methods instead - - /// @deprecated - /// Accessor for key of node under iterator (if any). - EXT_ID *key (void); - - /// @deprecated - /// Accessor for item of node under iterator (if any). - INT_ID *item (void); - - /// @deprecated - /// Move to the first item in the iteration (and in the tree). - int first (void); - - /// @deprecated - /// Move to the last item in the iteration (and in the tree). - int last (void); - - /// @deprecated - /// Move to the next item in the iteration (and in the tree). - int next (void); - - /// @deprecated - /// Move to the previous item in the iteration (and in the tree). - int previous (void); - - /** - * @deprecated: use the base class method instead. - * Returns 0 if the iterator is positioned over a valid ACE_RB_Tree - * node, returns 1 if not. - */ - int is_done (void); - -}; - -/** - * @class ACE_RB_Tree_Reverse_Iterator - * - * @brief Implements a reverse iterator for a Red-Black Tree ADT. - */ -template -class ACE_RB_Tree_Reverse_Iterator : public ACE_RB_Tree_Iterator_Base -{ - -public: - - // = Initialization and termination methods. - /** - * Create the singular iterator. - * It is illegal to deference the iterator, no valid iterator is - * equal to a singular iterator, etc. etc. - */ - ACE_RB_Tree_Reverse_Iterator (void); - - /** - * Constructor. Takes an ACE_RB_Tree over which to iterate, and - * an integer indicating (if non-zero) to position the iterator - * at the last element in the tree (if this integer is 0, the - * iterator is positioned at the first element in the tree). - */ - ACE_RB_Tree_Reverse_Iterator (const ACE_RB_Tree &tree, - int set_last = 1); - - /** - * Constructor. Takes an ACE_RB_Tree over which to iterate, and - * a point to a node in the tree. - */ - ACE_RB_Tree_Reverse_Iterator (const ACE_RB_Tree &tree, - ACE_RB_Tree_Node* entry); - - /** - * Constructor. Takes an ACE_RB_Tree over which to iterate, and a key; - * the key comes first in order to distinguish the case of EXT_ID == int. - */ - ACE_RB_Tree_Reverse_Iterator (const EXT_ID &key, - ACE_RB_Tree &tree); - - /// Destructor. - ~ACE_RB_Tree_Reverse_Iterator (void); - - // = ACE-style iteration methods. - - /// Move forward by one element in the tree. Returns - /// 0 when all elements have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL-style iteration methods. - - /// Prefix advance. - ACE_RB_Tree_Reverse_Iterator & operator++ (void); - - /// Postfix advance. - ACE_RB_Tree_Reverse_Iterator operator++ (int); - - /// Prefix reverse. - ACE_RB_Tree_Reverse_Iterator & operator-- (void); - - /// Postfix reverse. - ACE_RB_Tree_Reverse_Iterator operator-- (int); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /** - * Passes back the under the iterator. Returns 0 if - * the iteration has completed, otherwise 1. This method must - * be declared and defined in both the derived forward and - * reverse iterator classes rather than in the base iterator - * class because of a method signature resolution problem - * caused by the existence of the deprecated next (void) - * method in the derived forward iterator class. When that - * deprecated method is removed, this method should be removed - * from the derived classes and placed in the base class. - */ - int next (ACE_RB_Tree_Node *&next_entry) const; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/RB_Tree.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/RB_Tree.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("RB_Tree.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ! defined (ACE_RB_TREE_H) */ diff --git a/ace/RB_Tree.inl b/ace/RB_Tree.inl deleted file mode 100644 index 2e9b266ee92..00000000000 --- a/ace/RB_Tree.inl +++ /dev/null @@ -1,1169 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Guard_T.h" -#include "ace/Malloc_Base.h" -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -///////////////////////////////////////////////////// -// template class ACE_RB_Tree_Node // -///////////////////////////////////////////////////// - -// Key accessor. - -template -ACE_INLINE EXT_ID & -ACE_RB_Tree_Node::key () -{ - ACE_TRACE ("ACE_RB_Tree_Node::key"); - return k_; -} - - -// Item accessor. - -template -ACE_INLINE INT_ID & -ACE_RB_Tree_Node::item () -{ - ACE_TRACE ("ACE_RB_Tree_Node:item"); - return t_; -} - - -// Set color of the node. - -template -ACE_INLINE void -ACE_RB_Tree_Node::color (ACE_RB_Tree_Node_Base::RB_Tree_Node_Color c) -{ - ACE_TRACE ("ACE_RB_Tree_Node::color mutator"); - color_ = c; -} - - -// Get color of the node. - -template -ACE_INLINE ACE_RB_Tree_Node_Base::RB_Tree_Node_Color -ACE_RB_Tree_Node::color () -{ - ACE_TRACE ("ACE_RB_Tree_Node::color accessor"); - return color_; -} - - -// Accessor for node's parent pointer. - -template -ACE_INLINE ACE_RB_Tree_Node * -ACE_RB_Tree_Node::parent () -{ - ACE_TRACE ("ACE_RB_Tree_Node::parent accessor"); - return parent_; -} - - -// Mutator for node's parent pointer. - -template -ACE_INLINE void -ACE_RB_Tree_Node::parent (ACE_RB_Tree_Node * p) -{ - ACE_TRACE ("ACE_RB_Tree_Node::parent mutator"); - parent_ = p; -} - - - -// Accessor for node's left child pointer. - -template -ACE_INLINE ACE_RB_Tree_Node * -ACE_RB_Tree_Node::left () -{ - ACE_TRACE ("ACE_RB_Tree_Node::left accessor"); - return left_; -} - - -// Mutator for node's left child pointer. - -template -ACE_INLINE void -ACE_RB_Tree_Node::left (ACE_RB_Tree_Node * l) -{ - ACE_TRACE ("ACE_RB_Tree_Node::left mutator"); - left_ = l; -} - - -// Accessor for node's right child pointer. - -template -ACE_INLINE ACE_RB_Tree_Node * -ACE_RB_Tree_Node::right () -{ - ACE_TRACE ("ACE_RB_Tree_Node::right accessor"); - return right_; -} - - -// Mutator for node's right child pointer. - -template -ACE_INLINE void -ACE_RB_Tree_Node::right (ACE_RB_Tree_Node * r) -{ - ACE_TRACE ("ACE_RB_Tree_Node::right mutator"); - right_ = r; -} - - -//////////////////////////////////////////////////////////////////////// -// template class ACE_RB_Tree // -//////////////////////////////////////////////////////////////////////// - - -// Initialize an RB Tree. - -template -ACE_INLINE int -ACE_RB_Tree::open (ACE_Allocator *alloc) -{ - ACE_TRACE ("ACE_RB_Tree::open"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - // Calling this->close_i () ensures we release previously allocated - // memory before allocating new memory. - this->close_i (); - - // If we were passed an allocator use it, - // otherwise use the default instance. - - if (alloc == 0) - alloc = ACE_Allocator::instance (); - - this->allocator_ = alloc; - - return 0; -} - -// Close down an RB_Tree and release dynamically allocated -// resources. - -template -ACE_INLINE int -ACE_RB_Tree::close (void) -{ - ACE_TRACE ("ACE_RB_Tree::close"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->close_i (); -} - - -// Associate with . If is already in the -// tree then the is not changed. Returns 0 if a -// new entry is bound successfully, returns 1 if an attempt is made -// to bind an existing entry, and returns -1 if failures occur. - -template -ACE_INLINE int -ACE_RB_Tree::bind (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_TRACE ("ACE_RB_Tree::bind (const EXT_ID &item, const INT_ID &int_id)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - ACE_RB_Tree_Node *entry; - return this->insert_i (ext_id, int_id, entry); -} - - -// Same as a normal bind, except the tree entry is also passed back -// to the caller. The entry in this case will either be the newly -// created entry, or the existing one. - -template -ACE_INLINE int -ACE_RB_Tree::bind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_RB_Tree_Node *&entry) -{ - ACE_TRACE ("ACE_RB_Tree::bind (const EXT_ID &ext_id, const INT_ID &int_id, " - "ACE_RB_Tree_Node *&entry)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->insert_i (ext_id, int_id, entry); -} - - -// Associate with if and only if is not -// in the tree. If is already in the tree then the -// parameter is assigned the existing value in the tree. Returns 0 -// if a new entry is bound successfully, returns 1 if an attempt is -// made to bind an existing entry, and returns -1 if failures occur. - -template -ACE_INLINE int -ACE_RB_Tree::trybind (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_TRACE ("ACE_RB_Tree::trybind (const EXT_ID &ext_id, INT_ID &int_id)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - ACE_RB_Tree_Node *entry; - int result = this->insert_i (ext_id, int_id, entry); - - if (result == 1) - { - int_id = entry->item (); - } - - return result; -} - - -// Same as a normal trybind, except the tree entry is also passed -// back to the caller. The entry in this case will either be the -// newly created entry, or the existing one. - -template -ACE_INLINE int -ACE_RB_Tree::trybind (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_RB_Tree_Node *&entry) -{ - ACE_TRACE ("ACE_RB_Tree::trybind (const EXT_ID &ext_id, INT_ID &int_id, " - "ACE_RB_Tree_Node *&entry)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - int result = this->insert_i (ext_id, int_id, entry); - - if (result == 1) - { - int_id = entry->item (); - } - - - return result; -} - - -// Reassociate with . If is not in the -// tree then behaves just like . Returns 0 if a new entry is -// bound successfully, returns 1 if an existing entry was rebound, -// and returns -1 if failures occur. - -template -ACE_INLINE int -ACE_RB_Tree::rebind (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - ACE_RB_Tree_Node *entry; - int result = this->insert_i (ext_id, int_id, entry); - - if (result == 1) - { - entry->key () = ext_id; - entry->item () = int_id; - } - - return result; -} - - -// Same as a normal rebind, except the tree entry is also passed back -// to the caller. The entry in this case will either be the newly -// created entry, or the existing one. - -template -ACE_INLINE int -ACE_RB_Tree::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_RB_Tree_Node *&entry) -{ - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id, " - "ACE_RB_Tree_Node *&entry)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - int result = this->insert_i (ext_id, int_id, entry); - - if (result == 1) - { - entry->key () = ext_id; - entry->item () = int_id; - } - - return result; -} - - -// Associate with . If is not in the tree -// then behaves just like . Otherwise, store the old value of -// into the "out" parameter and rebind the new parameters. -// Returns 0 if a new entry is bound successfully, returns 1 if an -// existing entry was rebound, and returns -1 if failures occur. - -template -ACE_INLINE int -ACE_RB_Tree::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id) -{ - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, " - "const INT_ID &int_id, INT_ID &old_int_id)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - ACE_RB_Tree_Node *entry; - int result = this->insert_i (ext_id, int_id, entry); - - if (result == 1) - { - old_int_id = entry->item (); - entry->key () = ext_id; - entry->item () = int_id; - } - - return result; -} - - -// Same as a normal rebind, except the tree entry is also passed back -// to the caller. The entry in this case will either be the newly -// created entry, or the existing one. - -template -ACE_INLINE int -ACE_RB_Tree::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id, - ACE_RB_Tree_Node *&entry) -{ - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id," - "INT_ID &old_int_id, ACE_RB_Tree_Node *&entry)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - int result = this->insert_i (ext_id, int_id, entry); - - if (result == 1) - { - old_int_id = entry->item (); - entry->key () = ext_id; - entry->item () = int_id; - } - - return result; -} - - -// Associate with . If is not in the tree -// then behaves just like . Otherwise, store the old values -// of and into the "out" parameters and rebind the -// new parameters. This is very useful if you need to have an -// atomic way of updating and you also need -// full control over memory allocation. Returns 0 if a new entry is -// bound successfully, returns 1 if an existing entry was rebound, -// and returns -1 if failures occur. - -template -ACE_INLINE int -ACE_RB_Tree::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id) -{ - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id," - "EXT_ID &old_ext_id, INT_ID &old_int_id)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - ACE_RB_Tree_Node *entry; - int result = this->insert_i (ext_id, int_id, entry); - - if (result == 1) - { - old_ext_id = entry->key (); - old_int_id = entry->item (); - entry->key () = ext_id; - entry->item () = int_id; - } - - return result; -} - - -// Same as a normal rebind, except the tree entry is also passed back -// to the caller. The entry in this case will either be the newly -// created entry, or the existing one. - -template -ACE_INLINE int -ACE_RB_Tree::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_RB_Tree_Node *&entry) -{ - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id, " - "EXT_ID &old_ext_id, INT_ID &old_int_id, " - "ACE_RB_Tree_Node *&entry)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - int result = this->insert_i (ext_id, int_id, entry); - - if (result == 1) - { - old_ext_id = entry->key (); - old_int_id = entry->item (); - entry->key () = ext_id; - entry->item () = int_id; - } - - return result; -} - - -// Locate and pass out parameter via . If found, -// return 0, returns -1 if not found. - -template -ACE_INLINE int -ACE_RB_Tree::find (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_TRACE ("ACE_RB_Tree::find (const EXT_ID &ext_id, INT_ID &int_id)"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - ACE_RB_Tree_Node *entry = 0; - - int result = this->find_i (ext_id, entry); - if (result == 0) - { - int_id = entry->item (); - } - - return result; -} - -// Locate and pass out parameter via . If found, -// return 0, returns -1 if not found. - -template -ACE_INLINE int -ACE_RB_Tree::find (const EXT_ID &ext_id, - ACE_RB_Tree_Node *&entry) -{ - ACE_TRACE ("ACE_RB_Tree::find (const EXT_ID &ext_id, ACE_RB_Tree_Node *&entry)"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->find_i (ext_id, entry); -} - - -// Unbind (remove) the from the tree. Don't return the -// to the caller (this is useful for collections where the -// s are *not* dynamically allocated...). - -template -ACE_INLINE int -ACE_RB_Tree::unbind (const EXT_ID &ext_id) -{ - ACE_TRACE ("ACE_RB_Tree::unbind (const EXT_ID &ext_id)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - INT_ID int_id; - int result = this->remove_i (ext_id, int_id); - - // Remap the return codes from the internal method: this - // is maintained this way in support of deprecated methods, - // and will be cleaned up when these methods are removed. - switch (result) - { - case 1: - // If the node was found and deleted, return success. - return 0; - case 0: - // If nothing was found, set errno and break. - errno = ENOENT; - break; - case -1: - // If an error happened, just break. - break; - } - - // Return an error if we didn't already return success. - return -1; -} - - -// Break any association of . Returns the value of -// in case the caller needs to deallocate memory. - -template -ACE_INLINE int -ACE_RB_Tree::unbind (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_TRACE ("ACE_RB_Tree::unbind (const EXT_ID &ext_id, INT_ID &int_id)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - int result = this->remove_i (ext_id, int_id); - - // Remap the return codes from the internal method: this - // is maintained this way in support of deprecated methods, - // and will be cleaned up when these methods are removed. - switch (result) - { - case 1: - // If the node was found and deleted, return success. - return 0; - case 0: - // If nothing was found, set errno and break. - errno = ENOENT; - break; - case -1: - // If an error happened, just break. - break; - } - - // Return an error if we didn't already return success. - return -1; -} - - -// Remove entry from the tree. This method should be used with *extreme* -// caution, and only for optimization purposes. The node being passed -// in had better have been allocated by the tree that is unbinding it. -template -ACE_INLINE int -ACE_RB_Tree::unbind (ACE_RB_Tree_Node *entry) -{ - ACE_TRACE ("ACE_RB_Tree::unbind (ACE_RB_Tree_Node *entry)"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->remove_i (entry); -} - - -// Returns a reference to the underlying . This makes it -// possible to acquire the lock explicitly, which can be useful in -// some cases if you instantiate the with an -// or , or if you need to -// guard the state of an iterator. NOTE: the right name would be -// , but HP/C++ will choke on that! - -template -ACE_INLINE ACE_LOCK & -ACE_RB_Tree::mutex (void) -{ - ACE_TRACE ("ACE_RB_Tree::mutex"); - return this->lock_; -} - - -// Dump the state of an object. - -template -ACE_INLINE void -ACE_RB_Tree::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_RB_Tree::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncurrent_size_ = %d\n"), this->current_size_)); - this->allocator_->dump (); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nDumping nodes from root\n"))); - this->dump_i (this->root_); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - - -// Return forward iterator positioned at first node in tree. - -template -ACE_INLINE ACE_RB_Tree_Iterator -ACE_RB_Tree::begin (void) -{ - ACE_TRACE ("ACE_RB_Tree::begin"); - - return ACE_RB_Tree_Iterator (*this); -} - - -// Return forward iterator positioned at last node in tree. - -template -ACE_INLINE ACE_RB_Tree_Iterator -ACE_RB_Tree::end (void) -{ - ACE_TRACE ("ACE_RB_Tree::end"); - - return ACE_RB_Tree_Iterator (); -} - - -// Return reverse iterator positioned at last node in tree. - -template -ACE_INLINE ACE_RB_Tree_Reverse_Iterator -ACE_RB_Tree::rbegin (void) -{ - ACE_TRACE ("ACE_RB_Tree::rbegin"); - - return ACE_RB_Tree_Reverse_Iterator (*this); -} - - -// Return reverse iterator positioned at first node in tree. - -template -ACE_INLINE ACE_RB_Tree_Reverse_Iterator -ACE_RB_Tree::rend (void) -{ - ACE_TRACE ("ACE_RB_Tree::rend"); - - return ACE_RB_Tree_Reverse_Iterator (); -} - - -// Returns a pointer to the item corresponding to the given key, -// or 0 if it cannot find the key in the tree. DEPRECATED. - -template -ACE_INLINE INT_ID* -ACE_RB_Tree::find (const EXT_ID &k) -{ - ACE_TRACE ("ACE_RB_Tree::find (const EXT_ID &k)"); - - // The reinterpret cast is to ensure that when this deprecated - // method is removed, and is replaced (as planned) by a find method - // that takes the same argument signature but returns an int, that - // the compiler will cough if this return macro is not changed to - // just return an int (whose value will be -1). Please leave this - // as is. - ACE_READ_GUARD_RETURN (ACE_LOCK, - ace_mon, - this->lock_, - reinterpret_cast (0L)); - - ACE_RB_Tree_Node *entry = 0; - int result = this->find_i (k, entry); - return (result == 0) ? &(entry->item ()) : 0; -} - -// Inserts a *copy* of the key and the item into the tree: -// both the key type EXT_ID and the item type INT_ID must have well -// defined semantics for copy construction and < comparison. -// This method returns a pointer to the inserted item copy, -// or 0 if an error occurred. NOTE: if an identical key -// already exists in the tree, no new item is created, and -// the returned pointer addresses the existing item -// associated with the existing key. DEPRECATED. - -template -ACE_INLINE INT_ID* -ACE_RB_Tree::insert (const EXT_ID &k, const INT_ID &t) -{ - ACE_TRACE ("ACE_RB_Tree::insert"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, - ace_mon, - this->lock_, - reinterpret_cast (0L)); - - return this->insert_i (k, t); -} - - -// Removes the item associated with the given key from the -// tree and destroys it. Returns 1 if it found the item -// and successfully destroyed it, 0 if it did not find the -// item, or -1 if an error occurred. DEPRECATED. - -template -ACE_INLINE int -ACE_RB_Tree::remove (const EXT_ID &k) -{ - ACE_TRACE ("ACE_RB_Tree::remove"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - INT_ID i; - return this->remove_i (k, i); -} - - -// Destroys all nodes and sets the root pointer null. DEPRECATED - -template -ACE_INLINE void -ACE_RB_Tree::clear () -{ - ACE_TRACE ("ACE_RB_Tree::clear"); - ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); - - this->close_i (); -} - -// Returns the current number of nodes in the tree. - -template -ACE_INLINE size_t -ACE_RB_Tree::current_size () const -{ - ACE_TRACE ("ACE_RB_Tree::current_size"); - return current_size_; -} - - -/////////////////////////////////////////////////////////////////////// -// template class // -// ACE_RB_Tree_Iterator_Base // -/////////////////////////////////////////////////////////////////////// - -template -ACE_INLINE -ACE_RB_Tree_Iterator_Base::ACE_RB_Tree_Iterator_Base (void) - : tree_ (0), node_ (0) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::ACE_RB_Tree_Iterator_Base (void)"); -} - -// Returns 1 when the iteration has completed, otherwise 0. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator_Base::done (void) const -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::done"); - - return node_ ? 0 : 1; -} - - -// STL-like iterator dereference operator: returns a reference -// to the node underneath the iterator. - -template -ACE_INLINE ACE_RB_Tree_Node & -ACE_RB_Tree_Iterator_Base::operator* (void) const -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::operator*"); - return *(this->node_); -} - - -// STL-like iterator dereference operator: returns a reference -// to the node underneath the iterator. - -template -ACE_INLINE ACE_RB_Tree_Node * -ACE_RB_Tree_Iterator_Base::operator-> (void) const -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::operator->"); - return this->node_; -} - - -// Returns a reference to the tree over which we're iterating. - -template ACE_INLINE const ACE_RB_Tree & -ACE_RB_Tree_Iterator_Base::tree (void) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::tree"); - return *tree_; -} - - -// Comparison operator: returns 1 if both iterators point to the same position, otherwise 0. - -template -ACE_INLINE bool -ACE_RB_Tree_Iterator_Base::operator== - (const ACE_RB_Tree_Iterator_Base &rbt) const -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::operator=="); - return (this->node_ == rbt.node_) ? true : false; -} - - -// Comparison operator: returns 1 if the iterators point to different positions, otherwise 0. - -template -ACE_INLINE bool -ACE_RB_Tree_Iterator_Base::operator!= - (const ACE_RB_Tree_Iterator_Base &rbt) const -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::operator!="); - return (this->node_ == rbt.node_) ? false : true; -} - - -// Move forward by one element in the tree. Returns 0 when -// there are no more elements in the tree, otherwise 1. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator_Base::forward_i (void) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::forward_i"); - - if (node_) - { - node_ = tree_->RB_tree_successor (node_); - } - - return node_ ? 1 : 0; -} - - -// Move back by one element in the tree. Returns 0 when -// there are no more elements in the tree, otherwise 1. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator_Base::reverse_i (void) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator_Base::reverse_i"); - - if (node_) - { - node_ = tree_->RB_tree_predecessor (node_); - } - - return node_ ? 1 : 0; -} - - -////////////////////////////////////////////////////////////////// -// template class // -// ACE_RB_Tree_Iterator // -////////////////////////////////////////////////////////////////// - -template -ACE_INLINE -ACE_RB_Tree_Iterator::ACE_RB_Tree_Iterator (void) - : ACE_RB_Tree_Iterator_Base () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::ACE_RB_Tree_Iterator (void)"); -} - -// Move forward by one element in the tree. Returns -// 0 when all elements have been seen, else 1. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator::advance (void) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::advance"); - - return this->forward_i (); -} - - -// Dump the state of an object. - -template -ACE_INLINE void -ACE_RB_Tree_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_RB_Tree_Iterator::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - - -// Prefix advance. - -template -ACE_INLINE ACE_RB_Tree_Iterator & -ACE_RB_Tree_Iterator::operator++ (void) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator operator++ (void)"); - - this->forward_i (); - return *this; -} - - -// Postfix advance. - -template -ACE_INLINE ACE_RB_Tree_Iterator -ACE_RB_Tree_Iterator::operator++ (int) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator operator++ (int)"); - - ACE_RB_Tree_Iterator retv (*this); - ++*this; - return retv; -} - - -// Prefix reverse. - -template -ACE_INLINE ACE_RB_Tree_Iterator & -ACE_RB_Tree_Iterator::operator-- (void) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator operator-- (void)"); - - this->reverse_i (); - return *this; -} - - -// Postfix reverse. - -template -ACE_INLINE ACE_RB_Tree_Iterator -ACE_RB_Tree_Iterator::operator-- (int) -{ - ACE_TRACE ("ACE_RB_Tree_Iterator operator-- (int)"); - - ACE_RB_Tree_Iterator retv (*this); - --*this; - return retv; -} - - -// Passes back the under the iterator. Returns 0 if -// the iteration has completed, otherwise 1. This method must -// be declared and defined in both the derived forward and -// reverse iterator classes rather than in the base iterator -// class because of a method signature resolution problem -// caused by the existence of the deprecated next (void) -// method in the derived forward iterator class. When that -// deprecated method is removed, this method should be removed -// from the derived classes and placed in the base class. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator::next (ACE_RB_Tree_Node *&next_entry) const -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::next"); - - if (this->node_) - { - next_entry = this->node_; - return 1; - } - - return 0; -} - - -// Accessor for key of node under iterator (if any). DEPRECATED. - -template -ACE_INLINE EXT_ID * -ACE_RB_Tree_Iterator::key () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::key"); - return this->node_ ? (&(this->node_->key ())) : 0; -} - - -// Accessor for item of node under iterator (if any). DEPRECATED. - -template -ACE_INLINE INT_ID * -ACE_RB_Tree_Iterator::item () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::item"); - return this->node_ ? (&(this->node_->item ())) : 0; -} - - -// Move to the first item in the tree. DEPRECATED. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator::first () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::first"); - this->node_ = this->tree_->RB_tree_minimum (this->tree_->root_); - return this->node_ ? 1 : 0; -} - - -// Move to the last item in the tree. DEPRECATED. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator::last () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::last"); - this->node_ = this->tree_->RB_tree_maximum (this->tree_->root_); - return this->node_ ? 1 : 0; -} - - -// Moves to the next item in the tree, -// returns 1 if there is a next item, 0 otherwise. DEPRECATED. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator::next () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::next"); - this->node_ = this->tree_->RB_tree_successor (this->node_); - return this->node_ ? 1 : 0; -} - - -// Moves to the previous item in the tree, -// returns 1 if there is a previous item, 0 otherwise. DEPRECATED. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator::previous () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::previous"); - this->node_ = this->tree_->RB_tree_predecessor (this->node_); - return this->node_ ? 1 : 0; -} - - -// Returns 0 if the iterator is positioned over a valid ACE_RB_Tree -// node, returns 1 if not. DEPRECATED. - -template -ACE_INLINE int -ACE_RB_Tree_Iterator::is_done () -{ - ACE_TRACE ("ACE_RB_Tree_Iterator::is_done"); - return this->node_ ? 0 : 1; -} - - -////////////////////////////////////////////////////////////////////////// -// template class // -// ACE_RB_Tree_Reverse_Iterator // -////////////////////////////////////////////////////////////////////////// - - -template -ACE_INLINE -ACE_RB_Tree_Reverse_Iterator::ACE_RB_Tree_Reverse_Iterator (void) - : ACE_RB_Tree_Iterator_Base () -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::ACE_RB_Tree_Reverse_Iterator (void)"); -} - -// Move forward by one element in the tree. Returns -// 0 when all elements have been seen, else 1. - -template -ACE_INLINE int -ACE_RB_Tree_Reverse_Iterator::advance (void) -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::advance"); - - return this->reverse_i (); -} - - -// Dump the state of an object. - -template -ACE_INLINE void -ACE_RB_Tree_Reverse_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - - -// Prefix advance. - -template -ACE_INLINE ACE_RB_Tree_Reverse_Iterator & -ACE_RB_Tree_Reverse_Iterator::operator++ (void) -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::operator++ (void)"); - - this->reverse_i (); - return *this; -} - - -// Postfix advance. - -template -ACE_INLINE ACE_RB_Tree_Reverse_Iterator -ACE_RB_Tree_Reverse_Iterator::operator++ (int) -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::operator++ (int)"); - - ACE_RB_Tree_Reverse_Iterator retv (*this); - ++*this; - return retv; -} - - -// Prefix reverse. - -template -ACE_INLINE ACE_RB_Tree_Reverse_Iterator & -ACE_RB_Tree_Reverse_Iterator::operator-- (void) -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::operator-- (void)"); - - this->forward_i (); - return *this; -} - - -// Postfix reverse. - -template -ACE_INLINE ACE_RB_Tree_Reverse_Iterator -ACE_RB_Tree_Reverse_Iterator::operator-- (int) -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::operator-- (int)"); - - ACE_RB_Tree_Reverse_Iterator retv (*this); - --*this; - return retv; -} - - -// Passes back the under the iterator. Returns 0 if -// the iteration has completed, otherwise 1. This method must -// be declared and defined in both the derived forward and -// reverse iterator classes rather than in the base iterator -// class because of a method signature resolution problem -// caused by the existence of the deprecated next (void) -// method in the derived forward iterator class. When that -// deprecated method is removed, this method should be removed -// from the derived classes and placed in the base class. - -template -ACE_INLINE int -ACE_RB_Tree_Reverse_Iterator::next (ACE_RB_Tree_Node *&next_entry) const -{ - ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator::next"); - - if (this->node_) - { - next_entry = this->node_; - return 1; - } - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/README b/ace/README deleted file mode 100644 index e9c6d84f739..00000000000 --- a/ace/README +++ /dev/null @@ -1,1849 +0,0 @@ -// $Id$ - -ACE Portability Macros ----------------------- - -The following describes the meaning of the C++ compiler macros that -can be set in the config*.h file. When you port ACE to a new platform -and/or C++ compiler, make sure that you check to see which of these -need to be defined. It's helpful to check the various config*.h files -in this directory to see what's already been defined. If you need to -add new macros, please send them to me and I'll add them to this file. - -Eventually, most of this information should be auto-discovered via GNU -autoconf, which is currently available in the ACE distribution. - -Macro Description ------ ----------- - -ACE_HAS_DUMP Used to enable the dump() - method bodies. If not - defined, the bodies are ifdef - out in order to reduce - footprint. By default, it is - not defined. -ACE_CAST_CONST Used to work around broken - SunCC ANSI casts that require - an extra const. -ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES - Win32 only. Users want to use - a predefined security - attributes defined in - ACE_OS::default_win32_security_attributes - as the default security - object. -ACE_DISABLE_DEBUG_DLL_CHECK Define this if you don't want - debug version ACE search for - debug version DLLs first - before looking for the DLL - names specified. -ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER - Application will allocate its - own object manager. This - implicitly defines - ACE_HAS_NONSTATIC_OBJECT_MANAGER. - Usually used with MFC - applications. -ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO Platform does not initialize - sockaddr_in::sin_zero field in - calls to getpeername() and - getsockname(). As a result, - memcmp()-based equality - comparison can fail despite - the fact two sockaddr_in - instances refer to the same - addr characteristics. -ACE_MAIN Renames "main (int, char *[])", - for platforms such as g++/VxWorks - that don't allow "main". Requires - the use of - ACE_HAS_NONSTATIC_OBJECT_MANAGER. -ACE_MKDIR_LACKS_MODE This platform has a mkdir function with - a mode argument -ACE_MT_SAFE Compile using multi-thread libraries -ACE_NDEBUG Turns off debugging features -ACE_NEW_THROWS_EXCEPTIONS Compiler's 'new' throws exception on - failure (ANSI C++ behavior). -ACE_NLOGGING Turns off the LM_DEBUG and - LM_ERROR logging macros... -ACE_NTRACE Turns off the tracing feature when = 1. -ACE_HAS_TRACE Defined when ACE_NTRACE=0 to - help support tracing. Can - also be defined by users who - implement their own tracing - macros based on - ACE_TRACE_IMPL. Not defining - it helps reduce footprint by - not requiring applications to - link in Trace.o. -ACE_PAGE_SIZE Defines the page size of the - system (not used on Win32 or - with ACE_HAS_GETPAGESIZE). -ACE_REDEFINES_XTI_FUNCTIONS Platform redefines the t_... names (UnixWare) -ACE_SELECT_USES_INT Platform uses int for select() - rather than fd_set -ACE_TEMPLATES_REQUIRE_PRAGMA Compiler's template mechanism - must use a pragma This is used - for AIX's C++ compiler. -ACE_TEMPLATES_REQUIRE_SOURCE Compiler's template mechanim - must see source code (i.e., - .cpp files). This is used for - GNU G++. -ACE_TIMEPROBE_ASSERTS_FIXED_SIZE If enabled then ACE_Timeprobe_Ex<>::timeprobe() - will assert if the end of the - buffer is reached. If disabled, the - counter wraps around to start - at the beginning of the buffer. -ACE_TIMER_SKEW If a timed ::select () can return - early, then ACE_TIMER_SKEW is the - maximum adjustment, in microseconds, - that ACE_Timer_Queue uses to - compensate for the early return. -ACE_TLI_TCP_DEVICE Device the platform uses for TCP on - TLI. Only needed if not /dev/tcp. -ACE_USE_POLL The OS platform supports the - poll() event demultiplexor -ACE_USES_ASM_SYMBOL_IN_DLSYM Platform uses assembly symbols - instead of C symbols in - dlsym() -ACE_USES_STATIC_MFC When linking MFC as a static library is desired -ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB Platform has its standard c++ - library in the namespace std. -ACE_USES_EXPLICIT_STD_NAMESPACE Set this when ::fclose doesn't - work and you have to - explicitly specify the std - namespace. This is needed - with the Borland 6 and earlier - compilers. -ACE_USES_GPROF ACE calls getitimer before spawning - a new thread and setitimer - after spawning the thread in - order to overcome the problems - of gprof with multithreaded - applications. It uses the idea from - http://sam.zoy.org/writings/programming/gprof.html -ACE_USES_FIFO_SEM Directs ACE to use FIFO based semaphores on - platforms that support this (not having full - POSIX semaphore support, supporting mkfifo, select - and fcntl). -ACE_WSOCK_VERSION A parameter list indicating - the version of WinSock (e.g., - "1, 1" is version 1.1). -ACE_HAS_AIO_CALLS Platform supports POSIX aio* calls. - Corresponds to _POSIX_ASYNCHRONOUS_IO - constant in . -ACE_HAS_ALT_CUSERID Use ACE's alternate cuserid() - implementation since a system - cuserid() may not exist, or it - is not desirable to use it. - The implementation requires - ACE_LACKS_PWD_FUNCTIONS to be - undefined and that the - geteuid() system call exists. -ACE_HAS_DINKUM_STL Using the Dinkum STL library -ACE_DEFAULT_THREAD_KEYS Number of TSS keys, with - ACE_HAS_TSS_EMULATION _only_. - Defaults to 64. -ACE_DEFAULT_LD_SEARCH_PATH Specify the platform default search - paths. This macro should only be - defined on platforms that don't - support environment variables at all - (i.e., Windows CE.) -ACE_THREADS_DONT_INHERIT_LOG_MSG Specify this if you don't want - threads to inherit parent - thread's ACE_Log_Msg - properties. -ACE_THREAD_MANAGER_USES_SAFE_SPAWN Disable the "check before lock" feature - in ACE_Thread_Manager. Defining this - macro avoids a potential race condition - on platforms with aggressive read/write - reordering. -ACE_HAS_CPU_SET_T Platform delivers cpu_set_t. -ACE_HAS_PRIOCNTL OS has priocntl (2). -ACE_HAS_RECURSIVE_MUTEXES Mutexes are inherently recursive - (e.g., Win32) -ACE_HAS_NONRECURSIVE_MUTEXES In addition to recursive mutexes, - platform has non-recursive ones also. -ACE_HAS_RECV_TIMEDWAIT Platform has the MIT pthreads - APIs for -ACE_HAS_RECVFROM_TIMEDWAIT timed send/recv operations -ACE_HAS_RECVMSG_TIMEDWAIT -ACE_HAS_RLIMIT_RESOURCE_ENUM Platform has enum instead of - int for first argument to - ::{get,set}rlimit (). The - value of this macro is the - enum definition, e.g., enum - __rlimit_resource, for Linux - glibc 2.0. -ACE_HAS_RUSAGE_WHO_ENUM Platform has enum instead of - int for first argument to - ::getrusage (). The value of - this macro is the enum - definition, e.g., enum - __rusage_who, for Linux glibc - 2.0. -ACE_HAS_SCANDIR Platform has a native scandir() - function. Without any other scandir- - related settings, it's assumed that - the selector and comparator functions - accept const ACE_DIRENT pointers. -ACE_SCANDIR_CMP_USES_VOIDPTR The OS's scandir() comparator function - is int (*compare)(void*, void*). -ACE_SCANDIR_CMP_USES_CONST_VOIDPTR The OS's scandir() comparator function - is int (*compare)(const void*, - const void*). -ACE_SCANDIR_SEL_LACKS_CONST The OS's scandir() selector function - is int (*selector)(ACE_DIRENT*) -ACE_HAS_SEND_TIMEDWAIT -ACE_HAS_SENDTO_TIMEDWAIT -ACE_HAS_SENDMSG_TIMEDWAIT -ACE_HAS_STDARG_THR_DEST Platform has void (*)(...) - prototype for - pthread_key_create() - destructor (e.g., LynxOS). -ACE_HAS_SNPRINTF Platform offers snprintf(). -ACE_HAS_STL_MAP_CONFLICT Used when users want to - compile ACE with STL and STL - map class conflicts with - map struct. -ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS Platform/compiler supports - Win32 structural exceptions -ACE_HAS_READ_TIMEDWAIT -ACE_HAS_READV_TIMEDWAIT -ACE_HAS_WRITE_TIMEDWAIT -ACE_HAS_WRITEV_TIMEDWAIT -ACE_HAS_4_4BSD_SENDMSG_RECVMSG Platform has BSD 4.4 - sendmsg()/recvmsg() APIs. -ACE_HAS_P_READ_WRITE Platform has pread() and - pwrite() support -ACE_HAS_AIX_BROKEN_SOCKET_HEADER Platform, such as AIX4, needs - to wrap #include of - sys/socket.h with - #undef/#define of - __cplusplus. -ACE_HAS_AIX_HI_RES_TIMER Platform has AIX4 - ::read_real_time () -ACE_HAS_ALLOCA Compiler/platform supports - alloca() -ACE_HAS_ALLOCA_H Compiler/platform has - -ACE_HAS_ALPHA_TIMER CPU is an Alpha, with the rpcc - instruction to read the tick timer. - Limited to 32 bits, so not recommended. -ACE_HAS_AUTOMATIC_INIT_FINI Compiler/platform correctly - calls init()/fini() for shared - libraries -ACE_HAS_BIG_FD_SET Compiler/platform has typedef - u_long fdmask (e.g., Linux and - SCO). -ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR - Compiler handles explicit calling of - template destructor correctly. See - "ace/OS.h" for details. -ACE_HAS_BROKEN_ACCEPT_ADDR Platform can't correctly deal - with a NULL addr to accept() - (e.g, VxWorks). -ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS Compiler can't handle const char * - as rvalue in conditional operator. -ACE_HAS_BROKEN_CONVERSIONS Compiler can't handle calls - like foo->operator T *() -ACE_HAS_BROKEN_CTIME Compiler/platform uses macro - for ctime (e.g., MVS) -ACE_HAS_BROKEN_DGRAM_SENDV Platform sendv() does not work - properly with datagrams, - i.e. it fails when the iovec - size is IOV_MAX. -ACE_HAS_BROKEN_HPUX_TEMPLATES Earlier versions of HP/UX C++ - are damned... -ACE_HAS_BROKEN_MAP_FAILED Platform doesn't cast MAP_FAILED - to a void *. -ACE_HAS_BROKEN_MSG_H Platform headers don't support - prototypes -ACE_HAS_BROKEN_MMAP_H HP/UX does not wrap the - mmap(2) header files with - extern "C". -ACE_HAS_BROKEN_NESTED_TEMPLATES MSVC has trouble with defining - STL containers for nested - structs and classes -ACE_HAS_BROKEN_POSIX_TIME Platform defines struct - timespec in -ACE_HAS_BROKEN_RANDR OS/compiler's header files are - inconsistent with libC - definition of rand_r(). -ACE_HAS_BROKEN_T_ERROR Compiler/platform has the wrong - prototype for t_error(), i.e., - t_error(char *) rather than - t_error(const char *). -ACE_HAS_BSTRING Platform has - (which contains bzero() - prototype) -ACE_HAS_BYTESEX_H Platform has . -ACE_HAS_CANCEL_IO Platform supports the Win32 - CancelIO() function (WinNT 4.0 - and beyond). -ACE_HAS_CHARPTR_DL OS/platform uses char * for - dlopen/dlsym args, rather than - const char *. -ACE_HAS_CHARPTR_SOCKOPT OS/platform uses char * for - sockopt, rather than const - char * -ACE_HAS_CHARPTR_SPRINTF sprintf() returns char * - rather than int (e.g., SunOS - 4.x) -ACE_HAS_CLOCK_GETTIME Platform supports POSIX.1b - clock_gettime () at least for clock-id CLOCK_REALTIME -ACE_HAS_CLOCK_GETTIME_MONOTONIC Platform supports POSIX.1b - clock_gettime () with the clock-id CLOCK_MONOTONIC -ACE_HAS_CLOCK_SETTIME Platform supports POSIX.1b - clock_settime () -ACE_HAS_CONFLICTING_XTI_MACROS OS's XTI header file defines some - TCP-related macros that netinet/tcp.h - also defines, but they conflict - (only seen on HP-UX 11). -ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES Prototypes for both signal() - and struct sigaction are - consistent. -ACE_HAS_CPLUSPLUS_HEADERS Compiler/platform has - correctly prototyped header - files -ACE_HAS_DIRENT Compiler/platform has Dirent - iterator functions -ACE_HAS_DLFCN_H_BROKEN_EXTERN_C For platforms, e.g., RedHat - 4.2/Linux 2.0.30/Alpha, that - don't declare dl* functions as - extern "C" in dlfcn.h. -ACE_HAS_DLL Build ACE using the frigging - PC DLL nonsense... -ACE_HAS_EXCEPTIONS Compiler supports C++ - exception handling -ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS Compiler does not call - unexpected exception handler - if exception not listed in - exception specification is - thrown. In particular, the - exception specification is not - respected. -ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION Compiler's template - instantiation mechanism - supports the use of explicit - C++ specializations for all - used templates. This is also - used for GNU G++ if you don't - use the "repo" patches. -ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT When a base-class is a - specialization of a class template - then this class template must be - explicitly exported -ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION For the GCC compiler - on AIX, HPUX and VxWorks we have to - explicitly instantiate static template - members else we get multiple instances - of the same static. -ACE_HAS_GETPAGESIZE Platform supports - getpagesize() call (otherwise, - ACE_PAGE_SIZE must be defined, - except on Win32) -ACE_HAS_GETRUSAGE Platform supports the - getrusage() system call. -ACE_HAS_GETRUSAGE_PROTOTYPE Platform has a getrusage () - prototype in sys/resource.h - that differs from the one in - ace/OS.i. -ACE_HAS_GNU_CSTRING_H Denotes that GNU has cstring.h - as standard which redefines - memchr() -ACE_HAS_GPERF The GPERF utility is compiled - for this platform -ACE_HAS_GETIFADDRS This platform has ifaddrs.h and - the getifaddrs() function. This - is used in preference to - the SIOCGIFCONF ioctl call, since - it is much simpler and supports - IPv6 and non-IP interfaces better. -ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT Optimize - ACE_Handle_Set::count_bits for - select() operations (common - case) -ACE_HAS_LLSEEK Platform supports llseek. -ACE_HAS_HI_RES_TIMER Compiler/platform supports - SunOS high resolution timers -ACE_HAS_IDTYPE_T Compiler/platform supports - idtype_t. -ACE_HAS_INLINED_OSCALLS Inline all the static class OS - methods to remove call - overhead -ACE_HAS_IP_MULTICAST Platform supports IP multicast -ACE_HAS_IPV6 Platform supports IPv6. -ACE_USES_IPV4_IPV6_MIGRATION Enable IPv6 support in ACE on - platforms that don't have IPv6 - turned on by default. -ACE_HAS_IPV6_V6ONLY Platform supports the IPPROTO_IPV6 - level IPV6_V6ONLY socket option. -ACE_HAS_IRIX62_THREADS Platform supports the very odd - IRIX 6.2 threads... -ACE_HAS_NONSTATIC_OBJECT_MANAGER Causes the ACE_Object_Manager - instance to be created in main - (int, char *[]), instead of as - a static (global) instance. -ACE_HAS_THR_KEYDELETE Platform supports - thr_keydelete (e.g,. UNIXWARE) -ACE_HAS_THR_MINSTACK Platform calls thr_minstack() - rather than thr_min_stack() - (e.g., Tandem). -ACE_HAS_LIMITED_RUSAGE_T The rusage_t structure has - only two fields. -ACE_HAS_LIMITED_SELECT The select is unable to deal with - large file descriptors. -ACE_HAS_LINUX_NPTL Linux platform (with kernel >= 2.6.x) - with GLibc including new NPTL (Native - POSIX Thread Library). - This triggers extended POSIX checks - since the NPTL library is (almost) fully - POSIX compliant. -ACE_HAS_LOG_MSG_NT_EVENT_LOG Platform supports Windows NT event - log so we can create an - ACE_Log_Msg_Backend to log to it. -ACE_HAS_LONG_MAP_FAILED Platform defines MAP_FAILED as - a long constant. -ACE_HAS_MALLOC_STATS Enabled malloc statistics - collection. -ACE_HAS_MEMCHR Use native implementation of memchr. -ACE_HAS_MINIMAL_ACE_OS Disables some #includes in ace/OS.*. -ACE_HAS_MFC Platform supports Microsoft - Foundation Classes -ACE_HAS_MSG Platform supports recvmsg and - sendmsg -ACE_HAS_MT_SAFE_MKTIME Platform supports MT safe - mktime() call (do any of - them?) -ACE_HAS_MUTEX_TIMEOUTS Compiler supports timed mutex - acquisitions - (e.g. pthread_mutex_timedlock()). -ACE_HAS_NEW_NOTHROW Compiler offers new (nothrow). -ACE_HAS_NONCONST_CHDIR Platform uses non-const char * - in call to chdir -ACE_HAS_NONCONST_CLOCK_SETTIME Platform uses non-const - struct timespec * in call to - clock_settime -ACE_HAS_NONCONST_OPENDIR Platform uses non-const char * - in call to opendir -ACE_HAS_NONCONST_UNLINK Platform uses non-const char * - in call to unlink -ACE_HAS_NONCONST_GETBY Platform uses non-const char * - in calls to gethostbyaddr, - gethostbyname, getservbyname -ACE_HAS_NONCONST_MSGSND Platform has a non-const - parameter to msgsend() (e.g., - SCO). -ACE_HAS_NONCONST_READV Platform omits const qualifier from - iovec parameter in readv() prototype. -ACE_HAS_NONCONST_SELECT_TIMEVAL Platform's select() uses - non-const timeval* (only found - on Linux right now) -ACE_HAS_NONCONST_SENDMSG Platform omits const qualifier - from msghdr parameter in sendmsg() - prototype. -ACE_HAS_NONCONST_SETRLIMIT Platform omits const qualifier - from rlimit parameter in setrlimit() - prototype. -ACE_HAS_NONCONST_STAT Platform's stat function has non const - name argument -ACE_HAS_NONCONST_SWAB Platform's swab function has non - const src argument -ACE_HAS_NONCONST_WRITEV Platform omits const qualifier from - iovec parameter in writev() prototype. -ACE_HAS_OLD_MALLOC Compiler/platform uses old - malloc()/free() prototypes - (ugh) -ACE_HAS_ONLY_SCHED_FIFO Platform, e.g., HP NonStop OSS, - only supports SCHED_FIFO - POSIX scheduling policy. -ACE_HAS_ONLY_SCHED_OTHER Platform, e.g., Solaris 2.5, - only supports SCHED_OTHER - POSIX scheduling policy. -ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R Uses ctime_r & asctime_r with - only two parameters - vs. three. -ACE_HAS_OSF_TIMOD_H Platform supports the OSF TLI - timod STREAMS module -ACE_HAS_3_PARAM_WCSTOK Platform has 3-parameter version - of wcstok(), which was added in - 1994 in the ISO C standard Normative - Addendum 1. Other standards like XPG4 - define a 2 parameter wcstok(). -ACE_HAS_PENTIUM Platform is an Intel Pentium - microprocessor. -ACE_HAS_POLL Platform contains -ACE_HAS_POSITION_INDEPENDENT_POINTERS Platform supports - "position-independent" features - provided by ACE_Based_Pointer<>. -ACE_HAS_POSIX_MESSAGE_PASSING Platform supports POSIX message queues. - Corresponds to _POSIX_MESSAGE_PASSING - constant in . -ACE_HAS_POSIX_NONBLOCK Platform supports POSIX - O_NONBLOCK semantics -ACE_HAS_POSIX_REALTIME_SIGNALS Platform supports POSIX RT signals. - Corresponds to _POSIX_REALTIME_SIGNALS - constant in . -ACE_HAS_POSIX_SEM Platform supports POSIX - real-time semaphores (e.g., - VxWorks and Solaris). Corresponds - to _POSIX_SEMAPHORES constant - in -ACE_HAS_POSIX_SEM_TIMEOUT Platform supports timed wait operation - on POSIX realtime semaphores. -ACE_HAS_POSIX_TIME Platform supports the POSIX - struct timespec type -ACE_HAS_PROC_FS Platform supports the /proc - file system and defines tid_t - in -ACE_HAS_POWERPC_TIMER Platform supports PowerPC - time-base register. -ACE_HAS_PRUSAGE_T Platform supports the - prusage_t struct -ACE_HAS_PTHREADS Platform supports POSIX - Pthreads, of one form or - another. This macro says the - platform has a pthreads - variety - should also define - one of the below to say which - one. Also may need some - ACE_HAS_... thing for - extensions. -ACE_HAS_PTHREADS_DRAFT4 Platform's 'Pthreads' is .4a draft 4 -ACE_HAS_PTHREADS_DRAFT6 Platform's 'Pthreads' is .4a draft 6 -ACE_HAS_PTHREADS_DRAFT7 Platform's 'Pthreads' is .1c draft 7 -ACE_HAS_PTHREADS_STD Platform supports POSIX.1c-1995 threads - (This is the final standard - Pthreads). -ACE_HAS_PTHREADS_UNIX98_EXT Platform has the UNIX98 extensions to - Pthreads (rwlocks) -ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP Platform has - pthread_attr_setcreatesuspend_np(). -ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP Platform has pthread_condattr_setkind_np(). -ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP Platform has - pthread_mutexattr_setkind_np(). -ACE_HAS_PTHREAD_GETCONCURRENCY Platform has pthread_getconcurrency(). -ACE_HAS_PTHREAD_SETCONCURRENCY Platform has pthread_setconcurrency(). -ACE_HAS_PTHREAD_PROCESS_ENUM pthread.h declares an enum with - PTHREAD_PROCESS_PRIVATE and - PTHREAD_PROCESS_SHARED values. -ACE_HAS_PTHREAD_SETSTACK Platform has pthread_attr_setstack(). -ACE_HAS_PTHREAD_NP_H Platform has FreeBSD - declares non-portable (*_np) pthread - functions in this header. -ACE_HAS_PURIFY Purify'ing. Set by wrapper_macros.GNU. -ACE_HAS_QUANTIFY Quantify'ing. Set by wrapper_macros.GNU. -ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS Platform will recurse - infinitely on thread exits - from TSS cleanup routines - (e.g., AIX). -ACE_HAS_REENTRANT_FUNCTIONS Platform supports reentrant - functions (i.e., all the POSIX - *_r functions). -ACE_HAS_XPG4_MULTIBYTE_CHAR Platform has support for - multi-byte character support - compliant with the XPG4 - Worldwide Portability - Interface wide-character - classification. -ACE_HAS_REGEX Platform supports the POSIX - regular expression library -ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE For OpenBSD: The dlsym call - segfaults when passed an invalid - handle. Other platforms handle - this more gracefully. -ACE_HAS_SELECT_H Platform has special header for select(). -ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL For Win32: Use Select_Reactor - as default implementation of - Reactor instead of - WFMO_Reactor. -ACE_HAS_SEMUN Compiler/platform defines a - union semun for SysV shared - memory -ACE_HAS_SET_T_ERRNO Platform has a function to set - t_errno (e.g., Tandem). -ACE_HAS_SIGACTION_CONSTP2 Platform's sigaction() function takes - const sigaction* as 2nd parameter. -ACE_HAS_SIGINFO_T Platform supports SVR4 - extended signals -ACE_HAS_SIGSUSPEND Platform supports sigsuspend() -ACE_HAS_SIGISMEMBER_BUG Platform has bug with - sigismember() (HP/UX 11). -ACE_HAS_SIG_MACROS Platform/compiler has macros - for sig{empty,fill,add,del}set - (e.g., SCO and FreeBSD) -ACE_HAS_SIGNAL_OBJECT_AND_WAIT Platform supports the Win32 - SignalObjectAndWait() function - (WinNT 4.0 and beyond). -ACE_HAS_SIGWAIT Platform/compiler has the - sigwait(2) prototype -ACE_HAS_SIG_ATOMIC_T Compiler/platform defines the - sig_atomic_t typedef -ACE_HAS_SIG_C_FUNC Compiler requires extern "C" - functions for signals. -ACE_HAS_SIZET_SOCKET_LEN OS/compiler uses size_t * - rather than int * for socket - lengths -ACE_HAS_SOCKADDR_IN_SIN_LEN Platform has sin_len member in struct - sockaddr_in. -ACE_HAS_SOCKADDR_IN6_SIN_LEN Platform has sin6_len member in struct - sockaddr_in6. -ACE_HAS_SOCKADDR_MSG_NAME Platform requires (struct - sockaddr *) for msg_name field - of struct msghdr. -ACE_HAS_SOCKLEN_T Platform provides socklen_t - type, such as Linux with - glibc2. -ACE_HAS_SOCK_BUF_SIZE_MAX Platform limits the maximum socket - message size. -ACE_HAS_SPARCWORKS_401_SIGNALS Compiler has brain-damaged - SPARCwork SunOS 4.x signal - prototype... -ACE_HAS_SSIZE_T Compiler supports the ssize_t - typedef -ACE_HAS_STHREADS Platform supports Solaris - threads -ACE_HAS_STANDARD_CPP_LIBRARY Platform/compiler supports - Standard C++ Library -ACE_HAS_STRBUF_T Compiler/platform supports - struct strbuf -ACE_HAS_STRDUP_EMULATION Use ACE's strdup() emulation (even - if platform has a native strdup()). - This is useful if you need control - over what memory allocator is used. -ACE_HAS_WCSDUP_EMULATION Use ACE's wcsdup() emulation (even - if platform has a native wcsdup()). - This is useful if you need control - over what memory allocator is used. -ACE_HAS_STRNLEN Platform supports strnlen(3). -ACE_HAS_STREAMS Platform supports STREAMS -ACE_HAS_STREAM_PIPES Platform supports STREAM pipes -ACE_HAS_STRERROR Compiler/platform supports strerror () -ACE_HAS_STRICT Use the STRICT compilation mode on Win32. -ACE_HAS_STRING_CLASS Platform/Compiler supports a - String class (e.g., GNU or - Win32). -ACE_HAS_STRUCT_NETDB_DATA Compiler/platform has strange - hostent API for socket *_r() - calls -ACE_HAS_SUNOS4_SIGNAL_T Compiler has horrible SunOS - 4.x signal handlers... -ACE_HAS_SVR4_DYNAMIC_LINKING Compiler/platform supports - SVR4 dynamic linking semantics -ACE_HAS_SVR4_GETTIMEOFDAY Compiler/platform supports - SVR4 gettimeofday() prototype -ACE_HAS_SVR4_SIGNAL_T Compiler/platform supports - SVR4 signal typedef -ACE_HAS_SVR4_TLI Compiler/platform supports - SVR4 TLI; that is, TLI with extensions - like t_getname(). This is sometimes - used as a pseudonym for TLI on SunOS4. - This is a modifier to ACE_HAS_TLI and - isn't used if ACE_HAS_XTI is set. -ACE_HAS_SYSCALL_GETRUSAGE HP/UX has an undefined syscall - for GETRUSAGE... -ACE_HAS_SYSENT_H Platform provides - header -ACE_HAS_SYSINFO Platform supports system - configuration information -ACE_HAS_SYSV_IPC Platform supports System V IPC - (most versions of UNIX, but - not Win32) -ACE_HAS_SYS_ERRLIST Platform/compiler supports - _sys_errlist symbol -ACE_HAS_SYS_FILIO_H Platform provides - header -ACE_HAS_SYS_LOADAVG_H Compiler/platform contains the - file. -ACE_HAS_SYS_PSTAT_H Compiler/platform contains the - file. -ACE_HAS_SYS_SIGLIST Compiler/platform supports - _sys_siglist array -ACE_HAS_SYS_SOCKIO_H Compiler/platform provides the - sockio.h file -ACE_HAS_SYS_SYSCALL_H Compiler/platform contains the - file. -ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA Compiler's template - instantiation mechanism - supports the use of "#pragma - instantiate". Edison Design - Group compilers, e.g., SGI C++ - and Green Hills 1.8.8 and - later, support this. -ACE_HAS_TEMPLATE_SPECIALIZATION Compiler implements template - specialization -ACE_HAS_TEMPLATE_TYPEDEFS Compiler implements templates - that support typedefs inside - of classes used as formal - arguments to a template - class. -ACE_HAS_TERMIO Platform has terminal ioctl - flags like TCGETS and TCSETS and - termio struct. -ACE_HAS_TERMIOS Platform has POSIX terminal - interface and termios struct. -ACE_HAS_LAZY_MAP_MANAGER ACE supports lazy Map Managers - that allow deletion of entries - during active iteration. -ACE_HAS_THREADS Platform supports threads -ACE_HAS_THREAD_SAFE_ACCEPT Platform allows multiple - threads to call accept() on - the same port (e.g., WinNT). -ACE_HAS_THREAD_SELF Platform has thread_self() - rather than pthread_self() - (e.g., DCETHREADS and AIX) -ACE_HAS_THREAD_SPECIFIC_STORAGE Compiler/platform has - thread-specific storage -ACE_HAS_THR_C_DEST The pthread_keycreate() - routine *must* take extern C - functions. -ACE_HAS_THR_C_FUNC The pthread_create() routine - *must* take extern C - functions. -ACE_HAS_TIMEZONE Platform/compiler supports - global "timezone" variable. -ACE_HAS_TIMEZONE_GETTIMEOFDAY Platform/compiler supports - timezone * as second parameter - to gettimeofday() -ACE_HAS_TIMOD_H Platform supports TLI timod - STREAMS module -ACE_HAS_TIUSER_H Platform provides TLI tiuser.h - header file. -ACE_HAS_TLI Platform supports TLI. Also - see ACE_TLI_TCP_DEVICE. If the - platform supports XTI, set ACE_HAS_XTI - instead of this. -ACE_HAS_TLI_PROTOTYPES Platform provides TLI function - prototypes -ACE_HAS_TSS_EMULATION ACE provides TSS emulation. - See also - ACE_DEFAULT_THREAD_KEYS. -ACE_HAS_UALARM Platform supports ualarm() -ACE_HAS_UCONTEXT_T Platform supports ucontext_t - (which is used in the extended - signal API). -ACE_HAS_UNION_WAIT The wait() system call takes a - (union wait *) rather than int - * -ACE_HAS_UNIXWARE_SVR4_SIGNAL_T Has inconsistent SVR4 signal - stuff, but not the same as the - other platforms -ACE_HAS_VALGRIND Running with valgrind -ACE_HAS_VERBOSE_NOTSUP Prints out console message in - ACE_NOTSUP. Useful for - tracking down origin of - ACE_NOTSUP. -ACE_HAS_VERSIONED_NAMESPACE Wrap all library code within a - "versioned namespace" to - prevent symbol conflicts with - other versions of ACE shared - libraries in third party - libraries. Default namespace - name may be overridden by - defining preprocessor symbol - ACE_VERSIONED_NAMESPACE_NAME - to desired name. -ACE_LACKS_INTMAX_T Platform lacks the intmax_t type -ACE_LACKS_UINTMAX_T Platform lacks the uintmax_t type. -ACE_LACKS_INTPTR_T Platform lacks the intptr_t type -ACE_LACKS_UINTPTR_T Platform lacks the uintptr_t type. - -ACE_HAS_INT8_T Platform provides the int8_t type. -ACE_HAS_INT16_T Platform provides the int16_t type. -ACE_HAS_INT32_T Platform provides the int32_t type. -ACE_HAS_INT64_T Platform provides the int64_t type. -ACE_HAS_UINT8_T Platform provides the uint8_t type. -ACE_HAS_UINT16_T Platform provides the uint16_t type. -ACE_HAS_UINT32_T Platform provides the uint32_t type. -ACE_HAS_UINT64_T Platform provides the uint64_t type. - -ACE_INT8_TYPE Specific type to use for ACE_INT8. - If not defined, ACE will attempt to - determine the correct type. -ACE_INT16_TYPE Specific type to use for ACE_INT16. - If not defined, ACE will attempt to - determine the correct type. -ACE_INT32_TYPE Specific type to use for ACE_INT32. - If not defined, ACE will attempt to - determine the correct type. -ACE_INT64_TYPE Specific type to use for ACE_INT64. - If not defined, ACE will attempt to - determine the correct type. -ACE_UINT8_TYPE Specific type to use for ACE_UINT8. - If not defined, ACE will attempt to - determine the correct type. -ACE_UINT16_TYPE Specific type to use for ACE_UINT16. - If not defined, ACE will attempt to - determine the correct type. -ACE_UINT32_TYPE Specific type to use for ACE_UINT32. - If not defined, ACE will attempt to - determine the correct type. -ACE_UINT64_TYPE Specific type to use for ACE_UINT64. - If not defined, ACE will attempt to - determine the correct type. - -ACE_INT8_FORMAT_SPECIFIER String literal containing *printf - format specifier (including the '%') - to be used for ACE_INT8 values. If - not defined, ACE will attempt to - determine the correct setting. -ACE_INT16_FORMAT_SPECIFIER String literal containing *printf - format specifier (including the '%') - to be used for ACE_INT16 values. If - not defined, ACE will attempt to - determine the correct setting. -ACE_INT32_FORMAT_SPECIFIER String literal containing *printf - format specifier (including the '%') - to be used for ACE_INT32 values. If - not defined, ACE will attempt to - determine the correct setting. -ACE_INT64_FORMAT_SPECIFIER String literal containing *printf - format specifier (including the '%') - to be used for ACE_INT64 values. If - not defined, ACE will attempt to - determine the correct setting. -ACE_UINT8_FORMAT_SPECIFIER String literal containing *printf - format specifier (including the '%') - to be used for ACE_UINT8 values. If - not defined, ACE will attempt to - determine the correct setting. -ACE_UINT16_FORMAT_SPECIFIER String literal containing *printf - format specifier (including the '%') - to be used for ACE_UINT16 values. If - not defined, ACE will attempt to - determine the correct setting. -ACE_UINT32_FORMAT_SPECIFIER String literal containing *printf - format specifier (including the '%') - to be used for ACE_UINT32 values. If - not defined, ACE will attempt to - determine the correct setting. -ACE_UINT64_FORMAT_SPECIFIER String literal containing *printf - format specifier (including the '%') - to be used for ACE_UINT64 values. If - not defined, ACE will attempt to - determine the correct setting. - -ACE_HAS_VOIDPTR_GETTIMEOFDAY Platform/compiler supports - void * as second parameter - to gettimeofday -ACE_HAS_VOIDPTR_MMAP Platform requires void * for - mmap(). -ACE_HAS_VOIDPTR_SOCKOPT OS/compiler uses void * arg 4 - setsockopt() rather than const - char * -ACE_HAS_WCSNLEN Platform supports wcsnlen(3). -ACE_HAS_WIN32_TRYLOCK The Win32 platform support - TryEnterCriticalSection() - (WinNT 4.0 and beyond) -ACE_HAS_WINSOCK2 The Win32 platform supports - WinSock 2.0 -ACE_HAS_XLI Platform has the XLI version - of TLI -ACE_HAS_XTI Platform has XTI - (X/Open-standardized superset - of TLI). Implies ACE_HAS_TLI - but uses a different header - file. -ACE_INITIALIZE_MEMORY_BEFORE_USE Memory is explicitly initialized before - use. Useful when using a profiler like - purify or valgrind -ACE_HRTIME_T_IS_BASIC_TYPE ACE_hrtime_t is a basic type that - doesn't require ACE_U64_TO_U32 - conversion -ACE_LACKS_ACCESS Platform lacks access() (e.g., - VxWorks and Chorus) -ACE_LACKS_ACE_IOSTREAM Platform can not build - ace/IOStream{,_T}.cpp. This - does not necessarily mean that - the platform does not support - iostreams. -ACE_LACKS_AUTO_MMAP_REPLACEMENT No system support for replacing any - previous mappings. -ACE_LACKS_BSEARCH Compiler/platform lacks the - standard C library bsearch() - function -ACE_LACKS_CLEARERR Platform lacks the clearerr system - call. -ACE_LACKS_CLOSEDIR Platform lacks closedir and the closedir - emulation must be used -ACE_LACKS_OPENDIR Platform lacks opendir and the opendir - emulation must be used -ACE_LACKS_READDIR Platform lacks readdir and the readdir - emulation must be used -ACE_LACKS_CMSG_DATA_MACRO Platform has - ACE_HAS_4_4BSD_SENDMSG_RECVMSG but does - not define CMSG_DATA (cmsg) macro. -ACE_LACKS_CMSG_DATA_MEMBER Platform has - ACE_HAS_4_4BSD_SENDMSG_RECVMSG but its - cmsghdr structure does not contain - an 'unsigned char cmsg_data[0]' - member. (This may be - 'unsigned char __cmsg_data[0]' on some - platforms, in which case we need - another macro.) -ACE_LACKS_COND_TIMEDWAIT_RESET pthread_cond_timedwait does - *not* reset the time argument - when the lock is acquired. -ACE_LACKS_CONST_STRBUF_PTR Platform uses struct strbuf * - rather than const struct - strbuf * (e.g., HP/UX 10.x) -ACE_LACKS_CONST_TIMESPEC_PTR Platform forgot const in - cond_timewait (e.g., HP/UX). -ACE_LACKS_COND_T Platform lacks condition - variables (e.g., Win32 and - VxWorks) -ACE_LACKS_CONDATTR_PSHARED Platform has no implementation - of - pthread_condattr_setpshared(), - even though it supports - pthreads! -ACE_LACKS_DIFFTIME Platform lacks difftime() implementation -ACE_LACKS_DUP2 Platform lacks dup2(). -ACE_LACKS_FCNTL Platform lacks POSIX-style fcntl (). -ACE_LACKS_FSYNC Platform lacks fsync(). -ACE_LACKS_INLINE_FUNCTIONS Platform can't handle "inline" - keyword correctly. -ACE_LACKS_EXEC Platform lacks the exec() - family of system calls (e.g., - Win32, VxWorks, Chorus) -ACE_LACKS_FILELOCKS Platform lacks file locking - mechanism -ACE_LACKS_FLOATING_POINT Platform does not support - floating point operations - (e.g., certain Chorus hardware - platforms) -ACE_LACKS_FORK Platform lacks the fork() - system call (e.g., Win32, - VxWorks, Chorus) -ACE_LACKS_GETOPT_PROTOTYPE Platform lacks the getopt() - prototype (e.g., LynxOS) -ACE_LACKS_GETPGID Platform lacks getpgid() call - (e.g., Win32, Chorus, and - FreeBSD). -ACE_LACKS_GETSERVBYNAME Platforms lacks - getservbyname() (e.g., VxWorks - and Chorus). -ACE_LACKS_GETIPNODEBYADDR Platform lacks getipnodebyaddr(). -ACE_LACKS_GETIPNODEBYNAME Platform lacks getipnodebyname(). -ACE_LACKS_INET_ATON Platform lacks the inet_aton() - function. -ACE_LACKS_INET_ATON_PROTOTYPE Platform/compiler lacks the - inet_aton() prototype (e.g., - LynxOS) -ACE_LACKS_IOSTREAMS_TOTALLY Iostreams are not supported - adequately on the given platform. -ACE_LACKS_IOSTREAM_FX iostream header does not - declare ipfx (), opfx (), - etc. -ACE_LACKS_KEY_T Platform lacks key_t (e.g., - Chorus, VxWorks, Win32) -ACE_LACKS_LINEBUFFERED_STREAMBUF Platform lacks streambuf - "linebuffered ()". -ACE_LACKS_LONGLONG_T Compiler/platform does not - support the signed or unsigned long - long datatype. -ACE_LACKS_LSTAT Platform lacks the lstat() function. -ACE_LACKS_MADVISE Platform lacks madvise() - (e.g., Linux) -ACE_LACKS_MALLOC_H Platform lacks malloc.h -ACE_LACKS_MEMORY_H Platform lacks memory.h (e.g., - VxWorks and Chorus) -ACE_LACKS_MKFIFO Platform lacks mkfifo() e.g., - VxWorks, Chorus, pSoS, and WinNT. -ACE_LACKS_MKTEMP ACE has no mktemp() -ACE_LACKS_MKTEMP_PROTOTYPE Platform/compiler lacks the - mktemp() prototype (e.g., - LynxOS) -ACE_LACKS_MKSTEMP_PROTOTYPE Platform/compiler lacks the - mkstemp() prototype (e.g., - LynxOS) -ACE_LACKS_MMAP The platform doesn't have - mmap(2) (e.g., SCO UNIX). -ACE_LACKS_MODE_MASKS Platform/compiler doesn't have - open() mode masks. -ACE_LACKS_MPROTECT The platform doesn't have - mprotect(2) (e.g., EPLX real - time OS from CDC (based on - LYNX)) -ACE_LACKS_MSG_ACCRIGHTS Platform defines ACE_HAS_MSG, - but lacks msg_accrights{,len}. -ACE_LACKS_MSG_WFMO Platform lacks - MsgWaitForMultipleObjects - (only needs to be defined when - ACE_WIN32 is also defined). -ACE_LACKS_MSYNC Platform lacks msync() (e.g., - Linux) -ACE_LACKS_MUTEXATTR_PSHARED Platform lacks - pthread_mutexattr_setpshared(). -ACE_LACKS_NAMED_POSIX_SEM Platform lacks named POSIX - semaphores (e.g., Chorus) -ACE_LACKS_NETDB_REENTRANT_FUNCTIONS Platform does not support - reentrant netdb functions - (getprotobyname_r, - getprotobynumber_r, - gethostbyaddr_r, - gethostbyname_r, - getservbyname_r). -ACE_LACKS_NEW_H OS doesn't have, or we don't want to - use, new.h. -ACE_LACKS_NULL_PTHREAD_STATUS OS requires non-null status pointer - for ::pthread_join (). -ACE_LACKS_NUMERIC_LIMITS Platform lacks std::numeric_limits<>. -ACE_LACKS_PERFECT_MULTICAST_FILTERING Platform lacks IGMPv3 "perfect" filtering - of multicast dgrams at the socket level. - If == 1, ACE_SOCK_Dgram_Mcast will bind - the first joined multicast group to the - socket, and all future joins on that - socket will fail with an error. -ACE_LACKS_PRAGMA_ONCE Compiler complains about #pragma once -ACE_LACKS_PRI_T Platform lacks pri_t (e.g., - Tandem NonStop UNIX). -ACE_LACKS_PTHREAD_CANCEL Platform lacks - pthread_cancel(). -ACE_LACKS_PTHREAD_SIGMASK Platform lacks pthread_sigmask (). -ACE_LACKS_PTHREAD_THR_SIGSETMASK Platform lacks - pthread_thr_sigsetmask (e.g., - MVS, HP/UX, and OSF/1 3.2) -ACE_LACKS_PUTENV_PROTOTYPE Platform/compiler lacks the - putenv() prototype (e.g., - LynxOS) -ACE_LACKS_PWD_REENTRANT_FUNCTIONS Platform lacks getpwnam_r() - methods (e.g., SGI 6.2). -ACE_LACKS_SID Platform lacks setsid() -ACE_LACKS_QSORT Compiler/platform lacks the - standard C library qsort() - function -ACE_LACKS_RAND_REENTRANT_FUNCTIONS Platform lacks rand_r() -ACE_LACKS_READLINK Platform lacks the readlink() function. -ACE_LACKS_READV Platform doesn't define readv, - so use our own -ACE_LACKS_RENAME Platform lacks rename(). -ACE_LACKS_RLIMIT Platform/compiler lacks - {get,set}rlimit() function - (e.g., VxWorks, Chorus, and - SCO UNIX) -ACE_LACKS_RLIMIT_PROTOTYPE Platform/compiler lacks - {get,set}rlimit() prototypes - (e.g., Tandem) -ACE_LACKS_READDIR_R Platform uses ACE_HAS_DIRENT - but does not have readdir_r - (). -ACE_LACKS_REALPATH Platform/compiler lacks - realpath () function (e.g., - LynxOS) -ACE_LACKS_RECVMSG Platform lacks recvmsg() - (e.g., Linux) -ACE_LACKS_RWLOCK_T Platform lacks readers/writer - locks. -ACE_LACKS_RWLOCKATTR_PSHARED Platform lacks - pthread_rwlockattr_setpshared(). -ACE_LACKS_SBRK Platform lacks a working - sbrk() (e.g., Win32 and - VxWorks) -ACE_LACKS_SCANDIR_PROTOTYPE Platform/compiler lacks - scandir() prototype - (e.g., LynxOS) -ACE_LACKS_SEEKDIR Platform uses ACE_HAS_DIRENT - but does not have seekdir (). -ACE_LACKS_SEMBUF_T Platform lacks struct sembuf - (e.g., Win32 and VxWorks) -ACE_LACKS_SETDETACH Platform lacks - pthread_attr_setdetachstate() - (e.g., HP/UX 10.x) -ACE_LACKS_SETSCHED Platform lacks - pthread_attr_setsched() - (e.g. MVS) -ACE_LACKS_SIGACTION Platform lacks struct - sigaction (e.g., Win32 and - Chorus) -ACE_LACKS_SIGNED_CHAR Platform lacks "signed char" - type (broken!) -ACE_LACKS_SIGSET Platform lacks signal sets - (e.g., Chorus and Win32) -ACE_LACKS_STRPTIME Platform/compiler lacks the strptime() - function. -ACE_LACKS_STRCHR Platform/compiler lacks strchr() -ACE_LACKS_WCSCHR Platform/compiler lacks wcschr() -ACE_LACKS_STRDUP Platform/compiler lacks strdup() -ACE_LACKS_WCSDUP Platform/compiler lacks wcsdup() -ACE_LACKS_STRRCHR Platform/compiler lacks strrchr() -ACE_LACKS_WCSRCHR Platform/compiler lacks wcsrchr() -ACE_LACKS_SWAB Platform/compiler lacks - swab () function. -ACE_LACKS_SYS_MSG_H Platform lacks sys/msg.h - (e.g., Chorus and VxWorks) -ACE_LACKS_SYS_PARAM_H Platform lacks - (e.g., MVS) -ACE_LACKS_SENDMSG Platform lacks sendmsg() - (e.g., Linux) -ACE_LACKS_SI_ADDR Platform lacks the si_addr - field of siginfo_t (e.g., - VxWorks and HP/UX 10.x) -ACE_LACKS_SYMLINKS Platform lacks symbolic links -ACE_LACKS_SYSV_SHMEM Platform lacks System V shared - memory (e.g., Win32 and - VxWorks) -ACE_LACKS_SIGINFO_H Platform lacks the siginfo.h - include file (e.g., MVS) -ACE_LACKS_SOCKET_BUFSIZ Platform doesn't support - SO_SNDBUF/SO_RCVBUF -ACE_LACKS_SOCKETPAIR Platform lacks the - socketpair() call (e.g., SCO - UNIX) -ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES Compiler doesn't support - static data member templates -ACE_LACKS_STRCASECMP Compiler/platform lacks - strcasecmp() (e.g., DG/UX, - UNIXWARE, VXWORKS) -ACE_LACKS_STRCASECMP_PROTOTYPE Platform/compiler lacks the - strcasecmp() prototype (e.g., - LynxOS) -ACE_LACKS_STRNCASECMP_PROTOTYPE Platform/compiler lacks the - strncasecmp() prototype (e.g., - LynxOS) -ACE_LACKS_STRRECVFD Platform doesn't define struct - strrecvfd. -ACE_LACKS_SYSCALL Platform doesn't have - syscall() prototype -ACE_LACKS_T_ERRNO Header files lack t_errno for - TLI -ACE_LACKS_TCP_NODELAY OS does not support TCP_NODELAY. -ACE_LACKS_TELLDIR Platform uses ACE_HAS_DIRENT - but does not have telldir (). -ACE_LACKS_THREAD_STACK_SIZE Platform lacks - pthread_attr_setstacksize() - (e.g., Linux pthreads) -ACE_LACKS_TIMEDWAIT_PROTOTYPES MIT pthreads platform lacks - the timedwait prototypes -ACE_LACKS_TIMESPEC_T Platform does not define - timepec_t as a typedef for - struct timespec. -ACE_LACKS_TRUNCATE Platform doesn't have truncate() - (e.g., vxworks) -ACE_LACKS_U_LONGLONG_T Platform does not have - u_longlong_t typedef, and - "sun" is defined. -ACE_LACKS_UALARM_PROTOTYPE Platform/compiler lacks the - ualarm() prototype (e.g., - Solaris) -ACE_LACKS_CHAR_RIGHT_SHIFTS Compiler does not have any istream - operator>> for chars, u_chars, or - signed chars. -ACE_LACKS_CHAR_STAR_RIGHT_SHIFTS Compiler does not have - operator>> (istream &, u_char *) or - operator>> (istream &, signed char *) -ACE_LACKS_UCONTEXT_H Platform lacks the ucontext.h - file -ACE_LACKS_UMASK Platform lacks umask function -ACE_LACKS_UNBUFFERED_STREAMBUF Platform lacks streambuf - "unbuffered ()". -ACE_LACKS_UNISTD_H Platform lacks the unistd.h - file (e.g., VxWorks and Win32) -ACE_LACKS_UNIX_DOMAIN_SOCKETS ACE platform has no UNIX - domain sockets -ACE_LACKS_UNIX_SIGNALS Platform lacks full signal - support (e.g., Win32 and - Chorus). -ACE_LACKS_UNSIGNEDLONGLONG_T Compiler/platform does not - support the unsigned long - long datatype. -ACE_LACKS_UTSNAME_T Platform lacks struct utsname - (e.g., Win32 and VxWorks) -ACE_LACKS_UNAME Platform lacks uname calls -ACE_LACKS_WAIT The platform lacks wait -ACE_LACKS_WILDCARD_BIND The bind() call will not - select the port if it's 0. - -ACE_LACKS_WRITEV Platform doesn't define - writev, so use our own - -ACE_LEGACY_MODE When defined, it will enable - some code that is used to - provide some support for - backwards compatibility. - -ACE_NEEDS_DEV_IO_CONVERSION Necessary with some compilers - to pass ACE_TTY_IO as - parameter to DEV_Connector. -ACE_NEEDS_FUNC_DEFINITIONS Compiler requires a definition - for a "hidden" function, e.g., - a private, unimplemented copy - constructor or assignment - operator. The SGI C++ - compiler needs this, in - template classes, with - ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA. -ACE_NEEDS_HUGE_THREAD_STACKSIZE Required by platforms with - small default stacks. -ACE_NEEDS_LWP_PRIO_SET OS has LWPs, and when the - priority of a bound thread is - set, then the LWP priority - must be set also. -ACE_NEEDS_SCHED_H Platform needs to #include - - to get thread scheduling - defs. - -ACE_NO_WIN32_LEAN_AND_MEAN If this is set, then ACE does not - define WIN32_LEAN_AND_MEAN before - including . Needed for - code that uses non-lean Win32 - facilities such as COM. - -ACE_ONLY_LATEST_AND_GREATEST A macro that indicates that - the "latest and greatest" - features of ACE/TAO should be - turned on. It has been - replaced by ACE_LEGACY_MODE, - which has the opposite meaning - but serves the same purpose. - -ACE_WSTRING_HAS_USHORT_SUPPORT If a platform has wchar_t as a - separate type, then - ACE_WString doesn't have a - constructor that understands - an ACE_USHORT16 string. So - this macro enables - one. (mostly used my ACE Name - Space). - -ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK - Under QNX/RTP the objects preallocated - in ACE_OS_Object_Manager cannot be - destroyed after a fork() call. - Since these objects are only destroyed - at application shutdown we take the - simpler approach of not destroying - them at all. - Both QNX/RTP and LynxOS suffer from - this problem. - -ACE_LACKS_MEMBER_TEMPLATES Compiler does not support - member template feature. - -ACE_LACKS_DEPRECATED_MACROS When this define is set, macros which - are deprecated are not defined. Usefull - to check whether deprecated macros are - not used anymore. - -ACE_DONT_INIT_WINSOCK This definition defines whether or not - to explicitly initialize Winsock during - ACE::init() (i.e., whether WSAStartup() - is called). Some Win32 platforms have - dependent characteristics between - ACE initialization and - network initialization. - ----------------------------------------- - -The following macros determine the svc.conf file format ACE uses. - -Macro Description ------ ----------- -ACE_HAS_CLASSIC_SVC_CONF This macro forces ACE to use - the classic svc.conf format. - -ACE_HAS_XML_SVC_CONF This macro forces ACE to use the XML - svc.conf format. - -ACE_USES_CLASSIC_SVC_CONF This macro should be defined - as 0 or 1, depending on the - preferred svc.conf file - format. Defining this macro - to 0 means ACE will use XML - svc.conf file format. - Defining it to 1 will force - ACE to use the classic - svc.conf format. - ** This macro takes precedence - ** over previous two macros. - ----------------------------------------- -The following is a partial list of where some of these macros are used -in the code. This list was originally compiled by Jam Hamidi -(jh1@core01.osi.com). It is now hopelessly out of date. Hopefully, -someone will come along and update it.... - -ACE_HAS_ALLOCA: ---------------- - - Used in: - libsrc/IPC_SAP/SOCK_SAP/SOCK_Connect.C - for allocation of iovp -A - libsrc/IPC_SAP/SPIPE_SAP/SPIPE_Msg.C - for alocation of iovp - - In solaris: - alloca() allocates size bytes of space in the stack frame of - the caller, and returns a pointer to the allocated block. - This temporary space is automatically freed when the caller - returns. Note: if the allocated block is beyond the current - stack limit, the resulting behavior is undefined. - - In HPUX: - no equivalent. - - Notes: - in HPUX it has to do new and delete. Affects performance. - - -ACE_HAS_AUTOMATIC_INIT_FINI: ----------------------------- - - Used in: - libsrc/Service_Configurator/Service_Repository.i - libsrc/Service_Configurator/Parse_Node.i - include/Parse_Node.i - include/Service_Repository.i - - In solaris: - _init() initializes a loadable module. It is called before - any other routine in a loadable module. - _info() returns information about a loadable module. - _fini() should return the return value from mod_remove(9F). - This flag if set, doesn't do anything. If not set, forces - _init() and _fini() to be executed as is: - dlsym ((char *) handle, "_fini"). - - In HPUX: - don't set. - Maybe have to look into shl_load( ), shl_definesym( ), - shl_findsym( ), shl_gethandle( ), shl_getsymbols( ), - shl_unload( ), shl_get( )(3X) - explicit load of shared libraries - Means Service Configurator won't be available. - TBA. - - -ACE_HAS_CPLUSPLUS_HEADERS: --------------------------- - - Used In: - ace/OS.h - - HPUX: - set it. - - Notes: - If this is not defined, libc.h and osfcn.h get included. - Only needed for older compiler/OS platforms that don't - provide standard C++ header files in /usr/include. - -ACE_HAS_HI_RES_TIMER: ---------------------- - - Used In: - libsrc/Misc/High_Res_Timer.h - libsrc/Misc/High_Res_Timer.C - include/High_Res_Timer.h - - In Solaris, - C++ wrapper around gethrtime(), which returns a long long. - gethrtime() returns the current high-resolution real time. - Time is expressed as nanoseconds since some arbitrary time - in the past; it is not correlated in any way to the time of - day, and thus is not subject to resetting, drifting, etc. - - In HPUX - look into: getclock(), reltimer(), getitimer() - maybe even vtimes structure vm_utime, vm_stime ? - - Notes: - TBA - - -ACE_LACKS_T_ERRNO: -------------------- - - Used In: - ace/OS.h - - HPUX: - set it. - - Notes: - if set, adds: - extern int t_errno; - - -ACE_HAS_POSIX_NONBLOCK: ------------------------ - - Used in: - ace/OS.h - - HPUX: - set it. - - Notes: - if defined, sets ACE_NONBLOCK and O_NONBLOCK - O_NONBLOCK is used in libsrc/Misc/misc.C to do a - fcntl (fd, F_SETFL, opt) - ACE_NONBLOCK is used in libsrc/IPC_SAP/FIFO_SAP/FIFO_Recv.C in the - disable member function and options passed to the open function - in libsrc/IPC_SAP/FIFO_SAP/FIFO.C - - -ACE_HAS_PROC_FS: ----------------- - - Used in: - ace/OS.h - libsrc/Misc/Profile_Timer.i - - Notes: - if set, includes - the PIOCUSAGE define is used in Profile_Timer. - - Solaris: - procfs.h defines things for the prpsinfo structure (basically to - do a "ps" from inside a program). - - HPUX: - don't set: obviously a different mechanism. - Look into /usr/include/sys/proc.h. The structure is proc. The - pointer to the kernel's proc table may be obtained by - extern struct proc *proc, *procNPROC; - extern int nproc; - - -ACE_HAS_PRUSAGE_T: ------------------- - - Used in: - libsrc/Misc/Profile_Timer.h - libsrc/Misc/Profile_Timer.C - - Notes: - If defined, declares the Profile_Timer class that does start(), - stop() and basically gets real_time, user_time, system_time for - an interval. - This stuff is highly non-portable. - - HPUX: - don't set - - -ACE_HAS_SEMUN: --------------- - - Used in: - libsrc/Semaphores/Semaphore_Simple.h - - Notes: - if not defined, defines semun as: - union semun { - int val; /* value for SETVAL */ - struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ - ushort *array; /* array for GETALL & SETALL */ - }; - - HPUX: - don't set. - in /usr/include/sem.h: - /* The fourth argument to semctl() varies depending on the value of - its first argument. If desired, "union semun" can be declared - by the user, but this is not necessary since the individual - member can just be passed as the argument. */ - - -ACE_HAS_SIG_ATOMIC_T: ---------------------- - - Used in: - ace/OS.h - - Notes: - if not defined, does a: - typedef int sig_atomic_t; - This is used in the Reactor and service configurator. - - HPUX: - set it. - in /usr/include/sys/signal.h: - typedef unsigned int sig_atomic_t; - - -ACE_HAS_SSIZE_T: ----------------- - - Used in: - ace/OS.h - - Notes: - if not defined, does a - typedef int ssize_t; - used mostly in IPC_SAP. (don't confuse with size_t). - - HPUX: - set it. - in /usr/include/sys/types.h - - -ACE_HAS_STRBUF_T: ------------------ - - Used in: - include/Str_Buf.h - - Notes: - if not defined, declares the strbuf structure as: - struct strbuf - { - int maxlen; /* no. of bytes in buffer */ - int len; /* no. of bytes returned */ - void *buf; /* pointer to data */ - }; - - Solaris: - defined in /usr/include/sys/stropts.h - Sys V.4 Streams. - uses strbuf as parameter to putmsg, putpmsg: - int putmsg(int fildes, const struct strbuf *ctlptr, - const struct strbuf *dataptr, int flags); - - HPUX: - don't set. - no SYS V.4 streams. - - -ACE_HAS_STREAMS: ----------------- - - Used In: - ace/OS.h - libsrc/IPC_SAP/SOCK_SAP/LSOCK.C - - Notes: - if defined, includes - - HPUX: - don't set. - no SYS V.4 streams. - - -ACE_HAS_STREAM_PIPES: ---------------------- - - Used in: - libsrc/IPC_SAP/SPIPE_SAP/SPIPE_Msg.h - libsrc/IPC_SAP/SPIPE_SAP/SPIPE_Msg.C - libsrc/IPC_SAP/SPIPE_SAP/SPIPE_Listener.h - libsrc/IPC_SAP/SPIPE_SAP/SPIPE_Listener.C - libsrc/IPC_SAP/SPIPE_SAP/SPIPE.h - libsrc/IPC_SAP/SPIPE_SAP/SPIPE.C - libsrc/IPC_SAP/FIFO_SAP/FIFO_Send_Msg.h - libsrc/IPC_SAP/FIFO_SAP/FIFO_Send_Msg.C - libsrc/IPC_SAP/FIFO_SAP/FIFO_Send_Msg.i - libsrc/IPC_SAP/FIFO_SAP/FIFO_Recv_Msg.h - libsrc/IPC_SAP/FIFO_SAP/FIFO_Recv_Msg.C - libsrc/IPC_SAP/FIFO_SAP/FIFO_Recv_Msg.i - - Notes: - if not set, won't be able to use the SPIPE class (IPC_SAP) with - rendezvous handles. - - HPUX: - don't set. - No sysV.4 streams. - - -ACE_HAS_STRERROR: ------------------ - - Used in: - ace/OS.h - - Notes: - if not defined, does a: - #define strerror(err) sys_errlist[err] - - Solaris: - /usr/include/string.h - - HPUX: - set it. - in /usr/include/sys/errno.h and string.h - extern char *strerror (int); - - -ACE_HAS_SVR4_DYNAMIC_LINKING: ------------------------------ - - Used in: - ace/OS.h - tests/Service_Configurator/CCM_App.C - - Notes: - if defined, includes - with dlopen(), dlsym(), etc.. - - HPUX: - don't set. - has its own: - shl_findsym( ), shl_gethandle( ), shl_getsymbols( ), - shl_unload( ), shl_get( )(3X) - explicit load of shared libraries - - -ACE_HAS_SVR4_GETTIMEOFDAY: --------------------------- - - Used in: - ace/OS.h - libsrc/Reactor/Timer_Queue.i - - Notes: - has to do with gettimeofday (). - - Solaris: - gettimeofday (struct timeval *tp) - - HPUX: - don't set. - it has gettimeofday (struct timeval *tp, struct timezone *tzp); - most calls do a: - #if defined (ACE_HAS_SVR4_GETTIMEOFDAY) - ::gettimeofday (&cur_time); - #else - ::gettimeofday (&cur_time, 0); - #endif /* ACE_HAS_SVR4_GETTIMEOFDAY */ - - -ACE_HAS_POLL: ------------- - Used in: - ace/OS.h - - Notes: - #if defined (ACE_HAS_POLL) - #include /**/ - #endif /* ACE_HAS_POLL */ - -ACE_USE_POLL_IMPLEMENTATION: ------------------- - - Used in: - ace/OS.h - - Notes: - Use the poll() event demultiplexor rather than select(). - - HPUX: - set it. - - -ACE_HAS_SVR4_SIGNAL_T: ----------------------- - - Used in: - ace/OS.h - - Notes: - #if defined (ACE_HAS_SVR4_SIGNAL_T) - typedef void (*SignalHandler)(int); - typedef void (*SignalHandlerV)(void); - #elif defined (ACE_HAS_SIGNALHANDLERV_INT_ARG) - typedef void (*SignalHandler)(int); - typedef void (*SignalHandlerV)(int); - #else - #define SignalHandler SIG_PF - typedef void (*SignalHandlerV)(...); - #endif /* ACE_HAS_SVR4_SIGNAL_T */ - - HPUX: - set it. - - -ACE_HAS_SVR4_TLI: ------------------ - - Used in: - libsrc/IPC_SAP/TLI_SAP/TLI.C - libsrc/IPC_SAP/TLI_SAP/TLI.h - libsrc/IPC_SAP/TLI_SAP/TLI_Stream.C - - Notes: - TLI is the transport layer calls as in: t_bind(), t_open(), t_unbind(), - t_optmgmt(), ... in SunOS and Solaris. - - HPUX: - don't set. - Not supported. - - -ACE_HAS_SYS_FILIO_H: --------------------- - - Used in: - ace/OS.h - - Notes: - if not defined, includes . - didn't find any reference to anything in this file in the ACE code. - - Solaris: - filio.h defines FIOCLEX, FIOASYNC, ... as _IO('f', 1), .. - for FIOLFS,.. solaris has this to say: - /* - * ioctl's for Online: DiskSuite. - * WARNING - the support for these ioctls may be withdrawn - * in the future OS releases. - */ - - HPUX: - defines FIOASYNC and some other ones, - defines some like FIOCLEX. - some are never defined. - use #ifdef HP-UX to modify sysincludes.h - - -ACE_HAS_SYS_SIGLIST: --------------------- - - Used in: - ace/OS.h - libsrc/Log_Msg/Log_Msg.C - - Notes: - if not defined, does a: - extern const char **_sys_siglist; - - Solaris: - This is an array holding signal descriptions. - - HPUX: - don't set. - Some additional work is required. In libsrc/Log_Msg/Log_Msg.C, - sys_siglist is used regardless of ACE_HAS_SYS_SIGLIST. - have to add #ifdefs to remove them. - - -ACE_HAS_TEMPLATE_TYPEDEFS: --------------------------- - - Used in: - libsrc/ASX/*.[Chi] - - Notes: - cfront-based C++ compilers don't implement templates that support - classes with typedefs of other types as formal arguments. This - typedef uses the C++ preprocessor to work around this problem. - -ACE_HAS_THREADS: ----------------- - - Used in: - libsrc/Service_Configurator/Svc_Conf.y.C - libsrc/Service_Configurator/Thread_Spawn.i - libsrc/Threads/Synch.C - libsrc/Threads/Synch.i - libsrc/Threads/Thr_Manager.i - libsrc/ASX/STREAM.C - libsrc/ASX/Queue.C - libsrc/ASX/Module.C - libsrc/ASX/Stream_Modules.C - libsrc/ASX/Multiplexor.C - libsrc/ASX/Message_List.C - include/Message_List.h - include/Module.h - include/Multiplexor.h - include/Queue.h - include/STREAM.h - include/Stream_Modules.h - include/Service_Types.h - include/Thread_Spawn.h - include/Synch.h - include/Thr_Manager.h - - Notes: - We use Message_List.h even in a non-threaded environment. - our XOMessageList.h does this by #ifdefs around Threaded things. - - HPUX: - not until 10.0. - - -ACE_HAS_TIMOD_H: ----------------- - - Used in: - ace/OS.h - - Notes: - if defined, include - - Solaris: - timod is a STREAMS module for use with the Transport Inter- - face (TI) functions of the Network Services library. The - timod module converts a set of ioctl(2) calls into STREAMS - messages that may be consumed by a transport protocol pro- - vider that supports the Transport Interface. This allows a - user to initiate certain TI functions as atomic operations. - - HPUX: - don't set. - - -ACE_HAS_TIUSER_H: ------------------ - - Used in: - ace/OS.h - - Notes: - if set, includes - - Solaris: - in conjunction with t_bind, t_accept, etc.. transport layer. - - HPUX: - don't set. - - -ACE_USE_POLL_IMPLEMENTATION: ----------------------------- - - Used in: - libsrc/Reactor/Reactor.i - include/Event_Handler.h - ace/OS.h - include/Reactor.h - - Notes: - in the reactor, use poll instead of select. In general, - good thing to have set. - -ACE_USES_GPROF: ----------------------------- - Used in: - ace/Base_Thread_Adapter.h - ace/Base_Thread_Adapter.inl - ace/Base_Thread_Adapter.cpp - - Notes: - When using gprof mainly on Linux, #define ACE_USES_GPROF - will add calls to getitimer/setitimer in order to initialize profile - timer and overcome the problem of gprof with multithreaded applications. - -ACE_QTREACTOR_CLEAR_PENDING_EVENTS: ----------------------------- - Used in: - ace/QtReactor.cpp: - QtReactor by default does not clear qt events pending for - activated socket. Clearing costs much, at least 2 hash accesses - in ACE, and 2 another in Qt. It is also better to not clear - pending events as some side effects are unknown. However, - when events are not clear, then some user applications may be - confused by handle_input/output/exception called without any - data eg. in ACE_Acceptor::make_svc_handler. This swithc is - intended to quickly fix user application which does not - follow some reactor rules. - Linux: - It seems linux::qt does not queue pending events. Do not define - this switch. - Windows: - Windows::qt queues pending events. If user application has handle_* - methods which cannot be called without data, then turn on this switch - to quickly fix the bug. However, one should seriously fix the - application then. diff --git a/ace/RW_Mutex.cpp b/ace/RW_Mutex.cpp deleted file mode 100644 index 54a9b17047d..00000000000 --- a/ace/RW_Mutex.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file RW_Mutex.cpp - * - * $Id$ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/RW_Mutex.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/RW_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" - -ACE_RCSID(ace, RW_Mutex, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_RW_Mutex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_RW_Mutex::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_RW_Mutex::ACE_RW_Mutex (int type, const ACE_TCHAR *name, void *arg) - : removed_ (0) -{ -// ACE_TRACE ("ACE_RW_Mutex::ACE_RW_Mutex"); - if (ACE_OS::rwlock_init (&this->lock_, type, name, arg) != 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_RW_Mutex::ACE_RW_Mutex"))); -} - -ACE_RW_Mutex::~ACE_RW_Mutex (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::~ACE_RW_Mutex"); - this->remove (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/RW_Mutex.h b/ace/RW_Mutex.h deleted file mode 100644 index 1e920cf3a65..00000000000 --- a/ace/RW_Mutex.h +++ /dev/null @@ -1,141 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file RW_Mutex.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_RW_MUTEX_H -#define ACE_RW_MUTEX_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// ACE platform supports some form of threading. -#if defined (ACE_HAS_THREADS) - -#include "ace/OS_NS_Thread.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_RW_Mutex - * - * @brief Wrapper for readers/writer locks. - * - * These are most useful for applications that have many more - * parallel readers than writers... - */ -class ACE_Export ACE_RW_Mutex -{ -public: - /// Initialize a readers/writer lock. - ACE_RW_Mutex (int type = USYNC_THREAD, - const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Implicitly destroy a readers/writer lock - ~ACE_RW_Mutex (void); - - /** - * Explicitly destroy a readers/writer lock. Note that only one - * thread should call this method since it doesn't protect against - * race conditions. - */ - int remove (void); - - /// Acquire a read lock, but block if a writer hold the lock. - int acquire_read (void); - - /// Acquire a write lock, but block if any readers or a - /// writer hold the lock. - int acquire_write (void); - - /** - * Conditionally acquire a read lock (i.e., won't block). Returns - * -1 on failure. If we "failed" because someone else already had - * the lock, is set to . - */ - int tryacquire_read (void); - - /// Conditionally acquire a write lock (i.e., won't block). - int tryacquire_write (void); - - /** - * Conditionally upgrade a read lock to a write lock. This only - * works if there are no other readers present, in which case the - * method returns 0. Otherwise, the method returns -1 and sets - * to . Note that the caller of this method *must* - * already possess this lock as a read lock (but this condition is - * not checked by the current implementation). - */ - int tryacquire_write_upgrade (void); - - /** - * Note, for interface uniformity with other synchronization - * wrappers we include the method. This is implemented as - * a write-lock to safe... - */ - int acquire (void); - - /** - * Note, for interface uniformity with other synchronization - * wrappers we include the method. This is implemented - * as a write-lock to be safe... Returns -1 on failure. If we - * "failed" because someone else already had the lock, is - * set to . - */ - int tryacquire (void); - - /// Unlock a readers/writer lock. - int release (void); - - /// Return the underlying lock. - const ACE_rwlock_t &lock (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Readers/writer lock. - ACE_rwlock_t lock_; - - /// Keeps track of whether has been called yet to avoid - /// multiple calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure - /// that you don't have multiple threads simultaneously calling - /// on the same object, which is a bad idea anyway... - int removed_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_RW_Mutex &); - ACE_RW_Mutex (const ACE_RW_Mutex &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/RW_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" - -#endif /* ACE_RW_MUTEX_H */ diff --git a/ace/RW_Mutex.inl b/ace/RW_Mutex.inl deleted file mode 100644 index 47b95a3bb94..00000000000 --- a/ace/RW_Mutex.inl +++ /dev/null @@ -1,83 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE const ACE_rwlock_t & -ACE_RW_Mutex::lock (void) const -{ -// ACE_TRACE ("ACE_RW_Mutex::lock"); - return this->lock_; -} - -ACE_INLINE int -ACE_RW_Mutex::remove (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::remove"); - int result = 0; - if (this->removed_ == 0) - { - this->removed_ = 1; - result = ACE_OS::rwlock_destroy (&this->lock_); - } - return result; -} - -ACE_INLINE int -ACE_RW_Mutex::acquire_read (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::acquire_read"); - return ACE_OS::rw_rdlock (&this->lock_); -} - -ACE_INLINE int -ACE_RW_Mutex::acquire_write (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::acquire_write"); - return ACE_OS::rw_wrlock (&this->lock_); -} - -ACE_INLINE int -ACE_RW_Mutex::acquire (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::acquire"); - return ACE_OS::rw_wrlock (&this->lock_); -} - -ACE_INLINE int -ACE_RW_Mutex::tryacquire_read (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::tryacquire_read"); - return ACE_OS::rw_tryrdlock (&this->lock_); -} - -ACE_INLINE int -ACE_RW_Mutex::tryacquire_write (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::tryacquire_write"); - return ACE_OS::rw_trywrlock (&this->lock_); -} - -ACE_INLINE int -ACE_RW_Mutex::tryacquire_write_upgrade (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::tryacquire_write_upgrade"); - return ACE_OS::rw_trywrlock_upgrade (&this->lock_); -} - -ACE_INLINE int -ACE_RW_Mutex::tryacquire (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::tryacquire"); - return this->tryacquire_write (); -} - -ACE_INLINE int -ACE_RW_Mutex::release (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::release"); - return ACE_OS::rw_unlock (&this->lock_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/RW_Process_Mutex.cpp b/ace/RW_Process_Mutex.cpp deleted file mode 100644 index f16bf535182..00000000000 --- a/ace/RW_Process_Mutex.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// $Id$ - -#include "ace/RW_Process_Mutex.h" -#include "ace/Log_Msg.h" -#include "ace/ACE.h" - -ACE_RCSID(ace, RW_Process_Mutex, "$Id$") - -#if !defined (__ACE_INLINE__) -#include "ace/RW_Process_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Malloc_T.h" - -#if defined (ACE_WIN32) -#include "ace/OS_NS_fcntl.h" -#endif /* ACE_WIN32 */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_RW_Process_Mutex) - -const ACE_TCHAR * -ACE_RW_Process_Mutex::unique_name (void) -{ - ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN); - return this->name_; -} - -ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (const ACE_TCHAR *name, - int flags, - mode_t mode ) - : lock_ (name ? name : this->unique_name (), flags, mode) -{ -// ACE_TRACE ("ACE_RW_Process_Mutex::ACE_RW_Process_Mutex"); -} - -ACE_RW_Process_Mutex::~ACE_RW_Process_Mutex (void) -{ -// ACE_TRACE ("ACE_RW_Process_Mutex::~ACE_RW_Process_Mutex"); -} - -void -ACE_RW_Process_Mutex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_RW_Process_Mutex::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/RW_Process_Mutex.h b/ace/RW_Process_Mutex.h deleted file mode 100644 index a34b6f9f404..00000000000 --- a/ace/RW_Process_Mutex.h +++ /dev/null @@ -1,133 +0,0 @@ -// -*- C++ -*- -// -//============================================================================= -/** - * @file RW_Process_Mutex.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_RW_PROCESS_MUTEX_H -#define ACE_RW_PROCESS_MUTEX_H - -#include /**/ "ace/pre.h" - -#include "ace/File_Lock.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Default_Constants.h" -#include "ace/OS_NS_fcntl.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_RW_Process_Mutex - * - * @brief Wrapper for readers/writer locks that exist across processes. - * - * Note that because this class uses the - * as its implementation it only can be reliably - * used between separate processes, rather than threads in the - * same process. This isn't a limitation of ACE, it's simply - * the file lock semantics on UNIX and Win32. - * \todo For systems with pthread_rwlockattr_setpshared one - * may consider using them to make the mutex faster. - */ -class ACE_Export ACE_RW_Process_Mutex -{ -public: - /// Create a readers/writer , passing in the optional - /// , and \sa ACE_File_Lock. - /// If not specified, a name is generated and flags and mode are set - /// to default platform values. -#if defined (ACE_WIN32) - ACE_RW_Process_Mutex (const ACE_TCHAR *name = 0, - int flags = O_CREAT|O_RDWR, - mode_t mode = ACE_DEFAULT_OPEN_PERMS); -#else - ACE_RW_Process_Mutex (const ACE_TCHAR *name = 0, - int flags = O_CREAT|O_RDWR, - mode_t mode = S_IRUSR | S_IWUSR ); -#endif /* ACE_WIN32 */ - - ~ACE_RW_Process_Mutex (void); - - /** - * Explicitly destroy the mutex. Note that only one thread should - * call this method since it doesn't protect against race - * conditions. - */ - int remove (void); - - /// Acquire lock ownership (wait on queue if necessary). - int acquire (void); - - /** - * Conditionally acquire lock (i.e., don't wait on queue). Returns - * -1 on failure. If we "failed" because someone else already had - * the lock, is set to . - */ - int tryacquire (void); - - /// Release lock and unblock a thread at head of queue. - int release (void); - - /// Acquire lock ownership (wait on queue if necessary). - int acquire_read (void); - - /// Acquire lock ownership (wait on queue if necessary). - int acquire_write (void); - - /** - * Conditionally acquire a lock (i.e., won't block). Returns -1 on - * failure. If we "failed" because someone else already had the - * lock, is set to . - */ - int tryacquire_read (void); - - /** - * Conditionally acquire a lock (i.e., won't block). Returns -1 on - * failure. If we "failed" because someone else already had the - * lock, is set to . - */ - int tryacquire_write (void); - - /// Attempt to upgrade a read lock to a write lock. Returns 0 on - /// success, -1 on failure. - int tryacquire_write_upgrade (void); - - /// Return the underlying lock. - const ACE_File_Lock &lock (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// If the user does not provide a name we generate a unique name in - /// this buffer. - ACE_TCHAR name_[ACE_UNIQUE_NAME_LEN]; - - /// Create and return the unique name. - const ACE_TCHAR *unique_name (void); - - /// We need this to get the readers/writer semantics... - ACE_File_Lock lock_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/RW_Process_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_RW_PROCESS_MUTEX_H */ diff --git a/ace/RW_Process_Mutex.inl b/ace/RW_Process_Mutex.inl deleted file mode 100644 index e3bced0449c..00000000000 --- a/ace/RW_Process_Mutex.inl +++ /dev/null @@ -1,77 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Explicitly destroy the mutex. -ACE_INLINE int -ACE_RW_Process_Mutex::remove (void) -{ - return this->lock_.remove (); -} - -// Acquire lock ownership (wait on priority queue if necessary). -ACE_INLINE int -ACE_RW_Process_Mutex::acquire (void) -{ - return this->lock_.acquire (); -} - -// Conditionally acquire lock (i.e., don't wait on queue). -ACE_INLINE int -ACE_RW_Process_Mutex::tryacquire (void) -{ - return this->lock_.tryacquire (); -} - -// Release lock and unblock a thread at head of priority queue. -ACE_INLINE int -ACE_RW_Process_Mutex::release (void) -{ - return this->lock_.release (); -} - -// Acquire lock ownership (wait on priority queue if necessary). -ACE_INLINE int -ACE_RW_Process_Mutex::acquire_read (void) -{ - return this->lock_.acquire_read (); -} - -// Acquire lock ownership (wait on priority queue if necessary). -ACE_INLINE int -ACE_RW_Process_Mutex::acquire_write (void) -{ - return this->lock_.acquire_write (); -} - -// Conditionally acquire a lock (i.e., won't block). -ACE_INLINE int -ACE_RW_Process_Mutex::tryacquire_read (void) -{ - return this->lock_.tryacquire_read (); -} - -// Conditionally acquire a lock (i.e., won't block). -ACE_INLINE int -ACE_RW_Process_Mutex::tryacquire_write (void) -{ - return this->lock_.tryacquire_write (); -} - -// Conditionally upgrade a lock (i.e., won't block). -ACE_INLINE int -ACE_RW_Process_Mutex::tryacquire_write_upgrade (void) -{ - return this->lock_.tryacquire_write_upgrade (); -} - -ACE_INLINE const ACE_File_Lock & -ACE_RW_Process_Mutex::lock (void) const -{ -// ACE_TRACE ("ACE_RW_Process_Mutex::lock"); - return this->lock_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/RW_Thread_Mutex.cpp b/ace/RW_Thread_Mutex.cpp deleted file mode 100644 index bc1c9ecb44f..00000000000 --- a/ace/RW_Thread_Mutex.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file RW_Thread_Mutex.cpp - * - * $Id$ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/RW_Thread_Mutex.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/RW_Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Guard_T.h" - -ACE_RCSID(ace, RW_Thread_Mutex, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_RW_Thread_Mutex) - -ACE_RW_Thread_Mutex::ACE_RW_Thread_Mutex (const ACE_TCHAR *name, - void *arg) - : ACE_RW_Mutex (USYNC_THREAD, name, arg) -{ -// ACE_TRACE ("ACE_RW_Thread_Mutex::ACE_RW_Thread_Mutex"); -} - -void -ACE_RW_Thread_Mutex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_RW_Thread_Mutex::dump"); - ACE_RW_Mutex::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/RW_Thread_Mutex.h b/ace/RW_Thread_Mutex.h deleted file mode 100644 index 9f5f43f93c4..00000000000 --- a/ace/RW_Thread_Mutex.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file RW_Thread_Mutex.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_RW_THREAD_MUTEX_H -#define ACE_RW_THREAD_MUTEX_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_HAS_THREADS) -# include "ace/Null_Mutex.h" -#else /* ACE_HAS_THREADS */ -// ACE platform supports some form of threading. - -#include "ace/RW_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_RW_Thread_Mutex - * - * @brief Wrapper for readers/writer locks that exist within a process. - */ -class ACE_Export ACE_RW_Thread_Mutex : public ACE_RW_Mutex -{ -public: - ACE_RW_Thread_Mutex (const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Default dtor. - ~ACE_RW_Thread_Mutex (void); - - /** - * Conditionally upgrade a read lock to a write lock. This only - * works if there are no other readers present, in which case the - * method returns 0. Otherwise, the method returns -1 and sets - * to . Note that the caller of this method *must* - * already possess this lock as a read lock (but this condition is - * not checked by the current implementation). - */ - int tryacquire_write_upgrade (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/RW_Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_RW_THREAD_MUTEX_H */ diff --git a/ace/RW_Thread_Mutex.inl b/ace/RW_Thread_Mutex.inl deleted file mode 100644 index 9f4d315df4a..00000000000 --- a/ace/RW_Thread_Mutex.inl +++ /dev/null @@ -1,19 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_RW_Thread_Mutex::tryacquire_write_upgrade (void) -{ -// ACE_TRACE ("ACE_RW_Thread_Mutex::tryacquire_write_upgrade"); - return ACE_OS::rw_trywrlock_upgrade (&this->lock_); -} - -ACE_INLINE -ACE_RW_Thread_Mutex::~ACE_RW_Thread_Mutex (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp deleted file mode 100644 index 4921135bd3a..00000000000 --- a/ace/Reactor.cpp +++ /dev/null @@ -1,946 +0,0 @@ -// $Id$ - -#include "ace/Reactor.h" - -//#if !defined (ACE_HAS_WINCE) -# if !defined (ACE_LACKS_ACE_SVCCONF) -# include "ace/Service_Config.h" -# endif /* !ACE_LACKS_ACE_SVCCONF */ -//#endif /* ! ACE_HAS_WINCE */ - -/* - * Hook to specialize the includes directly with the concrete - * Reactor type, e.g., select, thread pool reactor - * known at compile time. This hook results in all the - * #defines being commented - * out and the concrete header file directly included. - */ -//@@ REACTOR_SPL_COMMENT_INCLUDE_START_HOOK -// Only include the headers needed to compile. -#if !defined (ACE_WIN32) \ - || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) \ - || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) \ - || defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL) \ - || defined (ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL) -# if defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL) -# include "ace/TP_Reactor.h" -# else -# if defined (ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL) -# include "ace/Dev_Poll_Reactor.h" -# else -# include "ace/Select_Reactor.h" -# endif /* ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL */ -# endif /* ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL */ -#else /* We are on Win32 and we have winsock and ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL is not defined */ -# if defined (ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL) -# include "ace/Msg_WFMO_Reactor.h" -# else -# include "ace/WFMO_Reactor.h" -# endif /* ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL */ -#endif /* !defined (ACE_WIN32) || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) */ - -/* - * End comment hook. - */ -//@@ REACTOR_SPL_COMMENT_INCLUDE_END_HOOK - -#include "ace/Static_Object_Lock.h" -#include "ace/Framework_Component.h" -#include "ace/Guard_T.h" -#include "ace/Recursive_Thread_Mutex.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Reactor.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_RCSID (ace, - Reactor, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Reactor) - -ACE_Reactor::ACE_Reactor (ACE_Reactor_Impl *impl, - int delete_implementation) - : implementation_ (0), - delete_implementation_ (delete_implementation) -{ - this->implementation (impl); - - if (this->implementation () == 0) - { -/* - * Hook to specialize the reactor implementation with the concrete - * Reactor implementation known at compile time. This hook will - * cause the conditionally defined code to be commented out and - * the concrete Reactor directly created. - */ -//@@ REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_START -#if !defined (ACE_WIN32) \ - || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) \ - || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) \ - || defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL) \ - || defined (ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL) -# if defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL) - ACE_NEW (impl, - ACE_TP_Reactor); -# else -# if defined (ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL) - ACE_NEW (impl, - ACE_Dev_Poll_Reactor); -# else - ACE_NEW (impl, - ACE_Select_Reactor); -# endif /* ACE_USE_DEV_POLL_REACTOR_FOR_REACTOR_IMPL */ -# endif /* ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL */ -#else /* We are on Win32 and we have winsock and ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL is not defined */ - #if defined (ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL) - ACE_NEW (impl, - ACE_Msg_WFMO_Reactor); - #else - ACE_NEW (impl, - ACE_WFMO_Reactor); - #endif /* ACE_USE_MSG_WFMO_REACTOR_FOR_REACTOR_IMPL */ -#endif /* !defined (ACE_WIN32) || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) */ - -/* - * End hook. - */ -//@@ REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END - - this->implementation (impl); - this->delete_implementation_ = 1; - } -} - -ACE_Reactor::~ACE_Reactor (void) -{ - this->implementation ()->close (); - if (this->delete_implementation_) - delete this->implementation (); -} - -// Process-wide ACE_Reactor. -ACE_Reactor *ACE_Reactor::reactor_ = 0; - -// Controls whether the Reactor is deleted when we shut down (we can -// only delete it safely if we created it!) -int ACE_Reactor::delete_reactor_ = 0; - -ACE_Reactor * -ACE_Reactor::instance (void) -{ - ACE_TRACE ("ACE_Reactor::instance"); - - if (ACE_Reactor::reactor_ == 0) - { - // Perform Double-Checked Locking Optimization. - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance (), 0)); - - if (ACE_Reactor::reactor_ == 0) - { - ACE_NEW_RETURN (ACE_Reactor::reactor_, - ACE_Reactor, - 0); - ACE_Reactor::delete_reactor_ = 1; - ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Reactor, ACE_Reactor::reactor_) - } - } - return ACE_Reactor::reactor_; -} - -ACE_Reactor * -ACE_Reactor::instance (ACE_Reactor *r, - int delete_reactor) -{ - ACE_TRACE ("ACE_Reactor::instance"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance (), 0)); - ACE_Reactor *t = ACE_Reactor::reactor_; - if (delete_reactor != 0) - ACE_Reactor::delete_reactor_ = 1; - else - // We can't safely delete it since we don't know who created it! - ACE_Reactor::delete_reactor_ = 0; - - ACE_Reactor::reactor_ = r; - - // We can't register the Reactor singleton as a framework component twice. - // Therefore we test to see if we had an existing reactor instance, which - // if so means it must have already been registered. - if (t == 0) - ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Reactor, ACE_Reactor::reactor_); - - return t; -} - -void -ACE_Reactor::close_singleton (void) -{ - ACE_TRACE ("ACE_Reactor::close_singleton"); - - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance ())); - - if (ACE_Reactor::delete_reactor_) - { - delete ACE_Reactor::reactor_; - ACE_Reactor::reactor_ = 0; - ACE_Reactor::delete_reactor_ = 0; - } -} - -const ACE_TCHAR * -ACE_Reactor::dll_name (void) -{ - return ACE_LIB_TEXT ("ACE"); -} - -const ACE_TCHAR * -ACE_Reactor::name (void) -{ - return ACE_LIB_TEXT ("ACE_Reactor"); -} - -int -ACE_Reactor::check_reconfiguration (ACE_Reactor *) -{ -#if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_SVCCONF) - if (ACE_Service_Config::reconfig_occurred ()) - { - ACE_Service_Config::reconfigure (); - return 1; - } -#endif /* ! ACE_HAS_WINCE || ! ACE_LACKS_ACE_SVCCONF */ - return 0; -} - -int -ACE_Reactor::run_reactor_event_loop (REACTOR_EVENT_HOOK eh) -{ - ACE_TRACE ("ACE_Reactor::run_reactor_event_loop"); - - if (this->reactor_event_loop_done ()) - return 0; - - while (1) - { - int result = this->implementation_->handle_events (); - - if (eh != 0 && (*eh)(this)) - continue; - else if (result == -1 && this->implementation_->deactivated ()) - return 0; - else if (result == -1) - return -1; - } - - ACE_NOTREACHED (return 0;) -} - -int -ACE_Reactor::run_alertable_reactor_event_loop (REACTOR_EVENT_HOOK eh) -{ - ACE_TRACE ("ACE_Reactor::run_alertable_reactor_event_loop"); - - if (this->reactor_event_loop_done ()) - return 0; - - while (1) - { - int result = this->implementation_->alertable_handle_events (); - - if (eh != 0 && (*eh)(this)) - continue; - else if (result == -1 && this->implementation_->deactivated ()) - return 0; - else if (result == -1) - return -1; - } - - ACE_NOTREACHED (return 0;) -} - -int -ACE_Reactor::run_reactor_event_loop (ACE_Time_Value &tv, - REACTOR_EVENT_HOOK eh) -{ - ACE_TRACE ("ACE_Reactor::run_reactor_event_loop"); - - if (this->reactor_event_loop_done ()) - return 0; - - while (1) - { - int result = this->implementation_->handle_events (tv); - - if (eh != 0 && (*eh) (this)) - continue; - else if (result == -1) - { - if (this->implementation_->deactivated ()) - result = 0; - return result; - } - else if (result == 0) - { - // The method timed out without dispatching - // anything. Because of rounding and conversion errors and - // such, it could be that the wait loop (WFMO, select, etc.) - // timed out, but the timer queue said it wasn't quite ready - // to expire a timer. In this case, the ACE_Time_Value we - // passed into handle_events won't have quite been reduced - // to 0, and we need to go around again. If we are all the - // way to 0, just return, as the entire time the caller - // wanted to wait has been used up. - if (tv.usec () > 0) - continue; - return 0; - } - // Else there were some events dispatched; go around again - } - - ACE_NOTREACHED (return 0;) -} - -int -ACE_Reactor::run_alertable_reactor_event_loop (ACE_Time_Value &tv, - REACTOR_EVENT_HOOK eh) -{ - ACE_TRACE ("ACE_Reactor::run_alertable_reactor_event_loop"); - - if (this->reactor_event_loop_done ()) - return 0; - - for (;;) - { - int result = this->implementation_->alertable_handle_events (tv); - - if (eh != 0 && (*eh)(this)) - continue; - else if (result == -1 && this->implementation_->deactivated ()) - return 0; - else if (result <= 0) - return result; - } -} - -int -ACE_Reactor::end_reactor_event_loop (void) -{ - ACE_TRACE ("ACE_Reactor::end_reactor_event_loop"); - - this->implementation_->deactivate (1); - - return 0; -} - -void -ACE_Reactor::reset_reactor_event_loop (void) -{ - ACE_TRACE ("ACE_Reactor::reset_reactor_event_loop"); - - this->implementation_->deactivate (0); -} - -int -ACE_Reactor::resumable_handler (void) -{ - return this->implementation ()->resumable_handler (); -} - -ACE_Reactor_Impl * -ACE_Reactor::implementation (void) const -{ - return this->implementation_; -} - -void -ACE_Reactor::implementation (ACE_Reactor_Impl *impl) -{ - this->implementation_ = impl; -} - -int -ACE_Reactor::current_info (ACE_HANDLE handle, - size_t &size) -{ - return this->implementation ()->current_info (handle, size); -} - -int -ACE_Reactor::open (size_t size, - int restart, - ACE_Sig_Handler *signal_handler, - ACE_Timer_Queue *timer_queue) -{ - return this->implementation ()->open (size, - restart, - signal_handler, - timer_queue); -} -int -ACE_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler) -{ - return this->implementation ()->set_sig_handler (signal_handler); -} - -int -ACE_Reactor::timer_queue (ACE_Timer_Queue *tq) -{ - return this->implementation ()->timer_queue (tq); -} - -ACE_Timer_Queue * -ACE_Reactor::timer_queue (void) const -{ - ACE_Reactor_Impl *impl = this->implementation_; - return impl->timer_queue (); -} - -int -ACE_Reactor::close (void) -{ - return this->implementation ()->close (); -} - -int -ACE_Reactor::work_pending (const ACE_Time_Value &max_wait_time) -{ - return this->implementation ()->work_pending (max_wait_time); -} - -int -ACE_Reactor::handle_events (ACE_Time_Value *max_wait_time) -{ - return this->implementation ()->handle_events (max_wait_time); -} - -int -ACE_Reactor::alertable_handle_events (ACE_Time_Value *max_wait_time) -{ - return this->implementation ()->alertable_handle_events (max_wait_time); -} - -int -ACE_Reactor::handle_events (ACE_Time_Value &max_wait_time) -{ - return this->implementation ()->handle_events (max_wait_time); -} - -int -ACE_Reactor::alertable_handle_events (ACE_Time_Value &max_wait_time) -{ - return this->implementation ()->alertable_handle_events (max_wait_time); -} - - -int -ACE_Reactor::register_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - // Remember the old reactor. - ACE_Reactor *old_reactor = event_handler->reactor (); - - // Assign *this* to the . - event_handler->reactor (this); - - int result = this->implementation ()->register_handler (event_handler, - mask); - if (result == -1) - // Reset the old reactor in case of failures. - event_handler->reactor (old_reactor); - - return result; -} - -int -ACE_Reactor::register_handler (ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - // Remember the old reactor. - ACE_Reactor *old_reactor = event_handler->reactor (); - - // Assign *this* to the . - event_handler->reactor (this); - - int result = this->implementation ()->register_handler (io_handle, - event_handler, - mask); - if (result == -1) - // Reset the old reactor in case of failures. - event_handler->reactor (old_reactor); - - return result; -} - -#if defined (ACE_WIN32) - -int -ACE_Reactor::register_handler (ACE_Event_Handler *event_handler, - ACE_HANDLE event_handle) -{ - // Remember the old reactor. - ACE_Reactor *old_reactor = event_handler->reactor (); - - // Assign *this* to the . - event_handler->reactor (this); - - int result = this->implementation ()->register_handler (event_handler, - event_handle); - if (result == -1) - // Reset the old reactor in case of failures. - event_handler->reactor (old_reactor); - - return result; -} - -#endif /* ACE_WIN32 */ - -int -ACE_Reactor::register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - // Remember the old reactor. - ACE_Reactor *old_reactor = event_handler->reactor (); - - // Assign *this* to the . - event_handler->reactor (this); - - int result = this->implementation ()->register_handler (event_handle, - io_handle, - event_handler, - mask); - if (result == -1) - // Reset the old reactor in case of failures. - event_handler->reactor (old_reactor); - - return result; -} - -int -ACE_Reactor::register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - // Remember the old reactor. - ACE_Reactor *old_reactor = event_handler->reactor (); - - // Assign *this* to the . - event_handler->reactor (this); - - int result = this->implementation ()->register_handler (handles, - event_handler, - mask); - if (result == -1) - // Reset the old reactor in case of failures. - event_handler->reactor (old_reactor); - - return result; -} - -int -ACE_Reactor::register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp, - ACE_Event_Handler **old_sh, - ACE_Sig_Action *old_disp) -{ - return this->implementation ()->register_handler (signum, - new_sh, - new_disp, - old_sh, - old_disp); -} - -int -ACE_Reactor::register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp) -{ - return this->implementation ()->register_handler (sigset, - new_sh, - new_disp); -} - -int -ACE_Reactor::remove_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - return this->implementation ()->remove_handler (event_handler, - mask); -} - -int -ACE_Reactor::remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - return this->implementation ()->remove_handler (handle, - mask); -} - -int -ACE_Reactor::remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask mask) -{ - return this->implementation ()->remove_handler (handle_set, - mask); -} - -int -ACE_Reactor::remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp, - int sigkey) -{ - return this->implementation ()->remove_handler (signum, - new_disp, - old_disp, - sigkey); -} - -int -ACE_Reactor::remove_handler (const ACE_Sig_Set &sigset) -{ - return this->implementation ()->remove_handler (sigset); -} - - -int -ACE_Reactor::suspend_handler (ACE_Event_Handler *event_handler) -{ - return this->implementation ()->suspend_handler (event_handler); -} - -int -ACE_Reactor::suspend_handler (ACE_HANDLE handle) -{ - return this->implementation ()->suspend_handler (handle); -} - -int -ACE_Reactor::suspend_handler (const ACE_Handle_Set &handles) -{ - return this->implementation ()->suspend_handler (handles); -} - -int -ACE_Reactor::suspend_handlers (void) -{ - return this->implementation ()->suspend_handlers (); -} - -int -ACE_Reactor::resume_handler (ACE_Event_Handler *event_handler) -{ - return this->implementation ()->resume_handler (event_handler); -} - -int -ACE_Reactor::resume_handler (ACE_HANDLE handle) -{ - return this->implementation ()->resume_handler (handle); -} - -int -ACE_Reactor::resume_handler (const ACE_Handle_Set &handles) -{ - return this->implementation ()->resume_handler (handles); -} - -int -ACE_Reactor::resume_handlers (void) -{ - return this->implementation ()->resume_handlers (); -} - - -int -ACE_Reactor::reset_timer_interval - (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Reactor::reset_timer_interval"); - - return this->implementation ()->reset_timer_interval - (timer_id, - interval); -} - -long -ACE_Reactor::schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delta, - const ACE_Time_Value &interval) -{ - // Remember the old reactor. - ACE_Reactor *old_reactor = event_handler->reactor (); - - // Assign *this* to the . - event_handler->reactor (this); - - long result = this->implementation ()->schedule_timer (event_handler, - arg, - delta, - interval); - if (result == -1) - // Reset the old reactor in case of failures. - event_handler->reactor (old_reactor); - - return result; -} - -int -ACE_Reactor::cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close) -{ - return this->implementation ()->cancel_timer (event_handler, - dont_call_handle_close); -} - -int -ACE_Reactor::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) -{ - return this->implementation ()->cancel_timer (timer_id, - arg, - dont_call_handle_close); -} - -int -ACE_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_added) -{ - // Remember the old reactor. - ACE_Reactor *old_reactor = event_handler->reactor (); - - // Assign *this* to the . - event_handler->reactor (this); - - int result = this->implementation ()->schedule_wakeup (event_handler, - masks_to_be_added); - if (result == -1) - // Reset the old reactor in case of failures. - event_handler->reactor (old_reactor); - - return result; -} - -int -ACE_Reactor::schedule_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_added) -{ - return implementation ()->schedule_wakeup (handle, - masks_to_be_added); -} - -int -ACE_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_cleared) -{ - return this->implementation ()->cancel_wakeup (event_handler, - masks_to_be_cleared); -} - -int -ACE_Reactor::cancel_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_cleared) -{ - return this->implementation ()->cancel_wakeup (handle, - masks_to_be_cleared); -} - - -int -ACE_Reactor::notify (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - ACE_Time_Value *tv) -{ - // First, try to remember this reactor in the event handler, in case - // the event handler goes away before the notification is delivered. - if (event_handler != 0 && event_handler->reactor () == 0) - event_handler->reactor (this); - return this->implementation ()->notify (event_handler, - mask, - tv); -} - -void -ACE_Reactor::max_notify_iterations (int iterations) -{ - this->implementation ()->max_notify_iterations (iterations); -} - -int -ACE_Reactor::max_notify_iterations (void) -{ - return this->implementation ()->max_notify_iterations (); -} - -int -ACE_Reactor::purge_pending_notifications (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - return this->implementation ()->purge_pending_notifications (eh, mask); -} - -ACE_Event_Handler * -ACE_Reactor::find_handler (ACE_HANDLE handle) -{ - return this->implementation ()->find_handler (handle); -} - -int -ACE_Reactor::handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler) -{ - return this->implementation ()->handler (handle, - mask, - event_handler); -} - -int -ACE_Reactor::handler (int signum, - ACE_Event_Handler **event_handler) -{ - return this->implementation ()->handler (signum, - event_handler); -} - -int -ACE_Reactor::initialized (void) -{ - return this->implementation ()->initialized (); -} - -ACE_Lock & -ACE_Reactor::lock (void) -{ - return this->implementation ()->lock (); -} - -void -ACE_Reactor::wakeup_all_threads (void) -{ - this->implementation ()->wakeup_all_threads (); -} - -int -ACE_Reactor::owner (ACE_thread_t new_owner, - ACE_thread_t *old_owner) -{ - return this->implementation ()->owner (new_owner, - old_owner); -} - -int -ACE_Reactor::owner (ACE_thread_t *owner) -{ - return this->implementation ()->owner (owner); -} - -int -ACE_Reactor::restart (void) -{ - return this->implementation ()->restart (); -} - -int -ACE_Reactor::restart (int r) -{ - return this->implementation ()->restart (r); -} - -void -ACE_Reactor::requeue_position (int position) -{ - this->implementation ()->requeue_position (position); -} - -int -ACE_Reactor::requeue_position (void) -{ - return this->implementation ()->requeue_position (); -} - - -int -ACE_Reactor::mask_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops) -{ - return this->implementation ()->mask_ops (event_handler, - mask, - ops); -} - -int -ACE_Reactor::mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) -{ - return this->implementation ()->mask_ops (handle, - mask, - ops); -} - -int -ACE_Reactor::ready_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops) -{ - return this->implementation ()->ready_ops (event_handler, - mask, - ops); -} - -int -ACE_Reactor::ready_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) -{ - return this->implementation ()->ready_ops (handle, - mask, - ops); -} - -int -ACE_Reactor::reactor_event_loop_done (void) -{ - ACE_TRACE ("ACE_Reactor::reactor_event_loop_done"); - return this->implementation_->deactivated (); -} - -size_t -ACE_Reactor::size (void) const -{ - return this->implementation ()->size (); -} - -int -ACE_Reactor::uses_event_associations (void) -{ - return this->implementation ()->uses_event_associations (); -} - -void -ACE_Reactor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Reactor::dump"); - - implementation_->dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor.h b/ace/Reactor.h deleted file mode 100644 index 1875482644e..00000000000 --- a/ace/Reactor.h +++ /dev/null @@ -1,870 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Reactor.h - * - * $Id$ - * - * @author Irfan Pyarali - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_REACTOR_H -#define ACE_REACTOR_H - -#include /**/ "ace/pre.h" - -// Timer Queue is a complicated template class. A simple forward -// declaration will not work. -#include "ace/Timer_Queuefwd.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Contains the timer related interface for the Reactor. -#include "ace/Reactor_Timer_Interface.h" - -// Event_Handler.h contains the definition of ACE_Reactor_Mask -#include "ace/Event_Handler.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Reactor_Impl; -class ACE_Handle_Set; -class ACE_Sig_Action; -class ACE_Sig_Handler; -class ACE_Sig_Set; - -/* - * Hook to specialize the Reactor implementation with the concrete - * Reactor type, for exmaple, select, thread pool reactor known - * at compile time. - */ -//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK - -/** - * @class ACE_Reactor - * - * @brief The responsibility of this class is to forward all methods to - * its delegation/implementation class, e.g., - * ACE_Select_Reactor or ACE_WFMO_Reactor. - */ -class ACE_Export ACE_Reactor : public ACE_Reactor_Timer_Interface -{ -public: - /// Operations on the "ready" mask and the "dispatch" mask. - enum - { - /// Retrieve current value of the the "ready" mask or the - /// "dispatch" mask. - GET_MASK = 1, - /// Set value of bits to new mask (changes the entire mask). - SET_MASK = 2, - /// Bitwise "or" the value into the mask (only changes enabled - /// bits). - ADD_MASK = 3, - /// Bitwise "and" the negation of the value out of the mask (only - /// changes enabled bits). - CLR_MASK = 4 - }; - - /** - * You can add a hook to various run_event methods and the hook will - * be called after handling every reactor event. If this function - * returns 0, will check for the return - * value of . If it is -1, the - * will return (pre-maturely.) - */ - typedef int (*REACTOR_EVENT_HOOK)(ACE_Reactor *); - - /// Get pointer to a process-wide ACE_Reactor. - static ACE_Reactor *instance (void); - - /** - * Set pointer to a process-wide ACE_Reactor and return existing - * pointer. If != 0 then we'll delete the Reactor - * at destruction time. - */ - static ACE_Reactor *instance (ACE_Reactor *, - int delete_reactor = 0); - - /// Delete the dynamically allocated Singleton - static void close_singleton (void); - - /// Name of the dll in which the dll lives. - static const ACE_TCHAR *dll_name (void); - - /// Name of the component--ACE_Reactor in this case. - static const ACE_TCHAR *name (void); - - // = Singleton reactor event loop management methods. - - // Note that these method ONLY work on the "Singleton Reactor," - // i.e., the one returned from . - /** - * Run the event loop until the - * - * method returns -1 or the method is invoked. - * Note that this method can only be used by the singleton - * . Thus, to run another reactor use - * . - * - * @deprecated Use ACE_Reactor::instance()->run_reactor_event_loop() instead - */ - static int run_event_loop (void); - static int run_alertable_event_loop (void); - - /** - * Run the event loop until the or - * methods returns -1, the - * method is invoked, or the - * expires. Note that this method can only be used by the singleton - * . Thus, to run another reactor use - * . - * - * @deprecated Use ACE_Reactor::instance()->run_reactor_event_loop() instead - */ - static int run_event_loop (ACE_Time_Value &tv); - static int run_alertable_event_loop (ACE_Time_Value &tv); - - /** - * Instruct the to terminate its event loop - * and notifies the so that it can wake up - * and close down gracefully. Note that this method can only be - * used by the singleton . Thus, to - * terminate another reactor, use - * . - * - * @deprecated Use ACE_Reactor::instance()->end_reactor_event_loop() instead - */ - static int end_event_loop (void); - - /** - * Report if the 's event loop is finished. - * Note that this method can only be used by the singleton - * . Thus, to check another reactor use - * . - * - * @deprecated Use ACE_Reactor::instance()->reactor_event_loop_done() instead - */ - static int event_loop_done (void); - - /** - * Resets the static so that the - * method can be restarted. Note that this method - * can only be used by the singleton . Thus, - * to reset another reactor use . - * - * @deprecated Use ACE_Reactor::instance()->reset_reactor_event_loop() - * instead - */ - static void reset_event_loop (void); - - /** - * The singleton reactor is used by the ACE_Service_Config. - * Therefore, we must check for the reconfiguration request and - * handle it after handling an event. - */ - static int check_reconfiguration (ACE_Reactor *); - - // = Reactor event loop management methods. - - // These methods work with an instance of a reactor. - /** - * Run the event loop until the - * - * method returns -1 or the method is invoked. - */ - virtual int run_reactor_event_loop (REACTOR_EVENT_HOOK = 0); - virtual int run_alertable_reactor_event_loop (REACTOR_EVENT_HOOK = 0); - - /** - * Run the event loop until the or - * methods returns -1, the - * method is invoked, or the - * expires. - */ - virtual int run_reactor_event_loop (ACE_Time_Value &tv, - REACTOR_EVENT_HOOK = 0); - virtual int run_alertable_reactor_event_loop (ACE_Time_Value &tv, - REACTOR_EVENT_HOOK = 0); - - /** - * Instruct the Reactor to terminate its event loop and notifies the - * Reactor so that it can wake up and deactivate - * itself. Deactivating the Reactor would allow the Reactor to be - * shutdown gracefully. Internally the Reactor calls deactivate () - * on the underlying implementation. - * Any queued notifications remain queued on return from this method. - * If the event loop is restarted in the future, the notifications - * will be dispatched then. If the reactor is closed or deleted without - * further dispatching, the notifications will be lost. - */ - virtual int end_reactor_event_loop (void); - - /// Indicate if the Reactor's event loop has been ended. - virtual int reactor_event_loop_done (void); - - /// Resets the static so that the - /// method can be restarted. - virtual void reset_reactor_event_loop (void); - - /** - * Create the Reactor using @a implementation. The flag - * @a delete_implementation tells the Reactor whether or not to - * delete the @a implementation on destruction. - */ - ACE_Reactor (ACE_Reactor_Impl *implementation = 0, - int delete_implementation = 0); - - /// Close down and release all resources. - /** - * Any notifications that remain queued on this reactor instance are - * lost. - */ - virtual ~ACE_Reactor (void); - - /** - * Initialize the ACE_Reactor to manage . - * If is non-0 then the ACE_Reactor's - * method will be restarted automatically when occurs. If - * or are non-0 they are used as the - * signal handler and timer queue, respectively. - */ - virtual int open (size_t max_number_of_handles, - int restart = 0, - ACE_Sig_Handler *signal_handler = 0, - ACE_Timer_Queue *timer_queue = 0); - - /// Use a user specified signal handler instead. - virtual int set_sig_handler (ACE_Sig_Handler *signal_handler); - - /// Set a user-specified timer queue. - virtual int timer_queue (ACE_Timer_Queue *tq); - - /// Return the current ACE_Timer_Queue. - virtual ACE_Timer_Queue *timer_queue (void) const; - - /// Close down and release all resources. - virtual int close (void); - - // = Event loop drivers. - - /** - * Returns non-zero if there are I/O events "ready" for dispatching, - * but does not actually dispatch the event handlers. By default, - * don't block while checking this, i.e., "poll". - */ - virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); - - /** - * This event loop driver blocks for up to before - * returning. It will return earlier if events occur. Note that - * can be 0, in which case this method blocks - * indefinitely until events occur. - * - * is decremented to reflect how much time this call - * took. For instance, if a time value of 3 seconds is passed to - * handle_events and an event occurs after 2 seconds, - * will equal 1 second. This can be used if an - * application wishes to handle events for some fixed amount of - * time. - * - * Returns the total number of timers and I/O ACE_Event_Handlers - * that were dispatched, 0 if the elapsed without - * dispatching any handlers, or -1 if an error occurs. - * - * The only difference between and - * is that in the alertable case, the eventloop will - * return when the system queues an I/O completion routine or an - * Asynchronous Procedure Call. - */ - virtual int handle_events (ACE_Time_Value *max_wait_time = 0); - virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0); - - /** - * This method is just like the one above, except the - * value is a reference and can therefore never be - * NULL. - * - * The only difference between and - * is that in the alertable case, the eventloop will - * return when the system queues an I/O completion routine or an - * Asynchronous Procedure Call. - */ - virtual int handle_events (ACE_Time_Value &max_wait_time); - virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); - - // = Register and remove handlers. - - /** - * Register handler for I/O events. - * - * A handler can be associated with multiple handles. A handle - * cannot be associated with multiple handlers. - * - * The handle will come from ACE_Event_Handler::get_handle(). - * - * Reactor will call ACE_Event_Handler::add_reference() for a new - * handler/handle pair. - * - * If this handler/handle pair has already been registered, any new - * masks specified will be added. In this case, - * ACE_Event_Handler::add_reference() will not be called. - * - * If the registered handler is currently suspended, it will remain - * suspended. When the handler is resumed, it will have the - * existing masks plus any masks added through this call. Handlers - * do not have partial suspensions. - */ - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Register handler for I/O events. - * - * Same as register_handler(ACE_Event_Handler*,ACE_Reactor_Mask), - * except handle is explicitly specified. - */ - virtual int register_handler (ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - -#if defined (ACE_WIN32) - - /** - * Register handler for OS events. - * - * Register an that will be notified when - * is signaled. - * - * Reactor will call ACE_Event_Handler::add_reference() for a new - * handler/handle pair. - * - * This interface is only available Win32 platforms because - * ACE_HANDLE is an int on non-Win32 platforms and compilers are not - * able to tell the difference between - * register_handler(ACE_Event_Handler*,ACE_Reactor_Mask) and - * register_handler(ACE_Event_Handler*,ACE_HANDLE). - */ - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_HANDLE event_handle = ACE_INVALID_HANDLE); - -#endif /* ACE_WIN32 */ - - /** - * Register handler for I/O events. - * - * Similar to - * register_handler(ACE_HANDLE,ACE_Event_Handler*,ACE_Reactor_Mask), - * except that the user gets to specify the event handle that will - * be used for this registration. This only applies to Reactors - * that use event handles for I/O registrations. - */ - virtual int register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Register handler for multiple I/O events. - * - * Shorthand for calling - * register_handler(ACE_HANDLE,ACE_Event_Handler*,ACE_Reactor_Mask), - * multiple times for the same and but - * different . - */ - virtual int register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks); - - /** - * Register handler for signals. - * - * Register @a new_sh to handle the signal @a signum using the - * @a new_disp. Returns the @a old_sh that was previously registered - * (if any), along with the @a old_disp of the signal handler. - * - * Reactor will call ACE_Event_Handler::add_reference() on @a new_sh - * and ACE_Event_Handler::remove_reference() on @a old_sh. - */ - virtual int register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0, - ACE_Event_Handler **old_sh = 0, - ACE_Sig_Action *old_disp = 0); - - /** - * Register handler for multiple signals. - * - * Shorthand for calling - * register_handler(int,ACE_Event_Handler*,ACE_Sig_Action*,ACE_Event_Handler**,ACE_Sig_Action*) - * multiple times for the same and but - * different . - */ - virtual int register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *event_handler, - ACE_Sig_Action *sig_action = 0); - - /** - * Remove from registration. - * - * For I/O handles, are removed from the Reactor. Unless - * includes , - * ACE_Event_Handler::handle_close() will be called with the - * that have been removed. If all masks have been removed, - * ACE_Event_Handler::remove_reference() will be called. - * - * For OS handles, the is removed from the Reactor. Unless - * includes , - * ACE_Event_Handler::handle_close() will be called with - * . - * ACE_Event_Handler::remove_reference() will also be called. - */ - virtual int remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask masks); - - /** - * Remove from registration. - * - * Same as remove_handler(ACE_HANDLE,ACE_Reactor_Mask), except - * comes from ACE_Event_Handler::get_handle(). - */ - virtual int remove_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks); - - /** - * Remove from multiple registrations. - * - * Shorthand for calling remove_handler(ACE_HANDLE,ACE_Reactor_Mask) - * multiple times for the same but different . - */ - virtual int remove_handler (const ACE_Handle_Set &handles, - ACE_Reactor_Mask masks); - - /** - * Remove signal handler registration. - * - * Remove the ACE_Event_Handler currently associated with @a signum. - * Install the new disposition (if given) and return the previous - * disposition (if desired by the caller). - * - * ACE_Event_Handler::handle_close() will be called with - * @c ACE_Event_Handler::SIGNAL_MASK. - * ACE_Event_Handler::remove_reference() will also be called. - */ - virtual int remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp = 0, - int sigkey = -1); - - /** - * Remove multiple signal handler registrations. - * - * Shorthand for calling - * remove_handler(int,ACE_Sig_Action*,ACE_Sig_Action*,int) multiple - * times for every signal in . - */ - virtual int remove_handler (const ACE_Sig_Set &sigset); - - // = Suspend and resume Handlers. - - /** - * Suspend @a handle temporarily. - */ - virtual int suspend_handler (ACE_HANDLE handle); - - /** - * Suspend @a event_handler temporarily. - * - * Handle is obtained from ACE_Event_Handler::get_handle(). - */ - virtual int suspend_handler (ACE_Event_Handler *event_handler); - - /** - * Suspend @a handles temporarily. - * - * Shorthand for calling suspend_handler(ACE_HANDLE) with multiple - * . - */ - virtual int suspend_handler (const ACE_Handle_Set &handles); - - /** - * Suspend all registered handles temporarily. - */ - virtual int suspend_handlers (void); - - /** - * Resume @a handle. - */ - virtual int resume_handler (ACE_HANDLE handle); - - /** - * Resume @a event_handler. - * - * Handle is obtained from ACE_Event_Handler::get_handle(). - */ - virtual int resume_handler (ACE_Event_Handler *event_handler); - - /** - * Resume . - * - * Shorthand for calling resume_handler(ACE_HANDLE) with multiple - * . - */ - virtual int resume_handler (const ACE_Handle_Set &handles); - - /** - * Resume all registered handles. - */ - virtual int resume_handlers (void); - - /// Does the reactor allow the application to resume the handle on - /// its own ie. can it pass on the control of handle resumption to - /// the application. A positive value indicates that the handlers - /// are application resumable. A value of 0 indicates otherwise. - virtual int resumable_handler (void); - - // = Timer management. - - /** - * Schedule a timer event. - * - * Schedule a timer event that will expire after an amount - * of time. The return value of this method, a timer_id value, - * uniquely identifies the in the ACE_Reactor's - * internal list of timers. This timer_id value can be used to - * cancel the timer with the cancel_timer() call. - * - * Reactor will call ACE_Event_Handler::add_reference() on the - * handler. After the timeout occurs and - * ACE_Event_Handler::handle_timeout() has completed, the handler - * will be implicitly removed from the Reactor and - * ACE_Event_Handler::remove_reference() will be called. - * - * @see cancel_timer() - * @see reset_timer_interval() - * - * @param event_handler Event handler to schedule on reactor - * @param arg Argument passed to the handle_timeout() method of - * event_handler - * @param delay Time interval after which the timer will expire - * @param interval Time interval after which the timer will be automatically - * rescheduled - * @return -1 on failure, a timer_id value on success - */ - virtual long schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = - ACE_Time_Value::zero); - - /** - * Reset recurring timer interval. - * - * Resets the interval of the timer represented by @a timer_id to - * @a interval, which is specified in relative time to the current - * . If is equal to - * , the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - * - * This change will not take effect until the next timeout. - */ - virtual int reset_timer_interval (long timer_id, - const ACE_Time_Value &interval); - - /** - * Cancel timer. - * - * Cancel timer associated with @a timer_id that was returned from - * the schedule_timer() method. If arg is non-NULL then it will be - * set to point to the ``magic cookie'' argument passed in when the - * handler was registered. This makes it possible to free up the - * memory and avoid memory leaks. Returns 1 if cancellation - * succeeded and 0 if the @a timer_id wasn't found. - * - * On successful cancellation, ACE_Event_Handler::handle_close() - * will be called with . - * ACE_Event_Handler::remove_reference() will also be called. - */ - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1); - - /** - * Cancel all timers associated with event handler. - * - * Shorthand for calling cancel_timer(long,const void **,int) - * multiple times for all timer associated with . - * - * ACE_Event_Handler::handle_close() will be called with - * only once irrespective of the - * number of timers associated with the event handler. - * ACE_Event_Handler::remove_reference() will also be called once - * for every timer associated with the event handler. - * - * Returns number of handlers cancelled. - */ - virtual int cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close = 1); - - // = High-level Event_Handler scheduling operations - - /// Add to the 's entry. - /// must already have been registered. - /// Note that this call does not cause the Reactor to re-examine - /// its set of handlers - the new masks will be noticed the next - /// time the Reactor waits for activity. If there is no other - /// activity expected, or you need immediate re-examination of the - /// wait masks, either call ACE_Reactor::notify after this call, or - /// use ACE_Reactor::register_handler instead. - virtual int schedule_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_added); - - /// Add @a masks_to_be_added to the @a handle's entry. - /// associated with @a handle must already have been registered. - /// Note that this call does not cause the Reactor to re-examine - /// its set of handlers - the new masks will be noticed the next - /// time the Reactor waits for activity. If there is no other - /// activity expected, or you need immediate re-examination of - /// the wait masks, either call ACE_Reactor::notify after this call, - /// or use ACE_Reactor::register_handler instead. - virtual int schedule_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_added); - - /// Clear from the 's entry. - /// Note that this call does not cause the Reactor to re-examine - /// its set of handlers - the new masks will be noticed the next - /// time the Reactor waits for activity. If there is no other - /// activity expected, or you need immediate re-examination of - /// the wait masks, either call ACE_Reactor::notify after this - /// call, or use ACE_Reactor::register_handler instead. - virtual int cancel_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_cleared); - - /// Clear from the 's entry. - /// Note that this call does not cause the Reactor to re-examine - /// its set of handlers - the new masks will be noticed the next - /// time the Reactor waits for activity. If there is no other - /// activity expected, or you need immediate re-examination of - /// the wait masks, either call ACE_Reactor::notify after this - /// call, or use ACE_Reactor::register_handler instead. - virtual int cancel_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_cleared); - - // = Notification methods. - - /** - * Dispatch user specified events. - * - * Handler will be dispatched irrespective of whether it is - * registered, not registered, or suspended in the Reactor. - * - * If user specified event is successfully queued, - * ACE_Event_Handler::add_reference() will be called. After the - * notify occurs and the upcall to the handler completes, the - * handler will be implicitly removed from the Reactor and - * ACE_Event_Handler::remove_reference() will be called. No other - * upcall reference counting is done. - * - * For I/O or OS events, the upcall is invoked with an - * ACE_INVALID_HANDLE. - * - * For timer events, the upcall is invoked with a null ACT. - * - * @param event_handler: IN - Handler on which the event will be - * dispatched. - * @param masks: IN - Events to be dispatched - multiple events can - * be OR'd together. - * @param timeout: INOUT - Relative time up to which to wait for - * user specified event to be queued. If tv is 0, wait - * indefinitely. When the call returns, tv has the time remaining - * after the call completes. - */ - virtual int notify (ACE_Event_Handler *event_handler = 0, - ACE_Reactor_Mask masks = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value *timeout = 0); - - /** - * Set the maximum number of times that ACE_Reactor will - * iterate and dispatch the that are passed in - * via the notify queue before breaking out of its - * loop. By default, this is set to - * -1, which means "iterate until the queue is empty." Setting this - * to a value like "1 or 2" will increase "fairness" (and thus - * prevent starvation) at the expense of slightly higher dispatching - * overhead. - */ - virtual void max_notify_iterations (int iterations); - - /** - * Get the maximum number of times that the ACE_Reactor will - * iterate and dispatch the ACE_Event_Handler's that are passed in - * via the notify queue before breaking out of its - * loop. - */ - virtual int max_notify_iterations (void); - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. If @a eh == 0, all notifications for - * all handlers are removed (but not any notifications posted just - * to wake up the reactor itself). Returns the number of - * notifications purged. Returns -1 on error. - * - * After the purging occurs, the handler will be implicitly removed - * from the Reactor and ACE_Event_Handler::remove_reference() will - * be called. - */ - virtual int purge_pending_notifications (ACE_Event_Handler *eh, - ACE_Reactor_Mask = - ACE_Event_Handler::ALL_EVENTS_MASK); - - // = Assorted helper methods. - - /** - * Return the Event_Handler associated with @a handle. Return 0 if - * @a handle is not registered. - * - * Reactor will call ACE_Event_Handler::add_reference() on the - * handler before returning it. - */ - virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle); - - /** - * Check to see if @a handle is associated with a valid Event_Handler - * bound to @a mask. Return the @c event_handler associated with this - * @a handler if @a event_handler != 0. - * - * Reactor will call ACE_Event_Handler::add_reference() on the - * handler before returning it if @a event_handler != 0. - */ - virtual int handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler = 0); - - /** - * Check to see if @a signum is associated with a valid Event_Handler - * bound to a signal. Return the associated with - * this if @a event_handler != 0. - */ - virtual int handler (int signum, - ACE_Event_Handler **event_handler = 0); - - /// Returns true if Reactor has been successfully initialized, else - /// false. - virtual int initialized (void); - - /// Returns the current size of the Reactor's internal descriptor - /// table. - virtual size_t size (void) const; - - /// Returns a reference to the Reactor's internal lock. - virtual ACE_Lock &lock (void); - - /// Wake up all threads in waiting in the event loop - virtual void wakeup_all_threads (void); - - /// Transfers ownership of Reactor to the @a new_owner. - virtual int owner (ACE_thread_t new_owner, - ACE_thread_t *old_owner = 0); - - /// Return the ID of the "owner" thread. - virtual int owner (ACE_thread_t *owner); - - /// Set position of the owner thread. - virtual void requeue_position (int position); - - /// Get position of the owner thread. - virtual int requeue_position (void); - - /// Get the existing restart value. - virtual int restart (void); - - /// Set a new value for restart and return the original value. - virtual int restart (int r); - - // = Low-level wait_set mask manipulation methods. - - /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the - /// @a event_handler and @a mask. - virtual int mask_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops); - - /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the @a handle - /// and @a mask. - virtual int mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops); - - // = Low-level ready_set mask manipulation methods. - /// GET/SET/ADD/CLR the ready "bit" bound with the - /// and . - virtual int ready_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops); - - /// GET/SET/ADD/CLR the ready "bit" bound with the and . - virtual int ready_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops); - - /// Get the implementation class - virtual ACE_Reactor_Impl *implementation (void) const; - - /** - * Returns 0, if the size of the current message has been put in - * returns -1, if not. ACE_HANDLE allows the reactor to - * check if the caller is valid. Used for CLASSIX Reactor - * implementation. - */ - virtual int current_info (ACE_HANDLE handle, - size_t &msg_size); - - /// Return 1 if we any event associations were made by the reactor - /// for the handles that it waits on, 0 otherwise. - virtual int uses_event_associations (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// Dump the state of the object. - void dump (void) const; - -protected: - /// Set the implementation class. - virtual void implementation (ACE_Reactor_Impl *implementation); - - /// Delegation/implementation class that all methods will be - /// forwarded to. - ACE_Reactor_Impl *implementation_; - - /// Flag used to indicate whether we are responsible for cleaning up - /// the implementation instance - int delete_implementation_; - - /// Pointer to a process-wide ACE_Reactor singleton. - static ACE_Reactor *reactor_; - - /// Must delete the singleton if non-0. - static int delete_reactor_; - - /// Deny access since member-wise won't work... - ACE_Reactor (const ACE_Reactor &); - ACE_Reactor &operator = (const ACE_Reactor &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - - -#if defined (__ACE_INLINE__) -#include "ace/Reactor.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_REACTOR_H */ diff --git a/ace/Reactor.inl b/ace/Reactor.inl deleted file mode 100644 index 9b1344465ba..00000000000 --- a/ace/Reactor.inl +++ /dev/null @@ -1,101 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// Run the event loop until the method -// returns -1 or the method is invoked. - -/* - * Hook to specialize the Reactor with the concrete implementation - * known at compile time. - */ -//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Reactor::run_event_loop (void) -{ - ACE_TRACE ("ACE_Reactor::run_event_loop"); - ACE_Reactor *r = ACE_Reactor::instance (); - - if (r == 0) - return -1; - - return r->run_reactor_event_loop (ACE_Reactor::check_reconfiguration); -} - -// Run the event loop until the -// method returns -1, the method -// is invoked, or the expires. - -ACE_INLINE int -ACE_Reactor::run_event_loop (ACE_Time_Value &tv) -{ - ACE_TRACE ("ACE_Reactor::run_event_loop"); - ACE_Reactor *r = ACE_Reactor::instance (); - - if (r == 0) - return -1; - - return r->run_reactor_event_loop - (tv, ACE_Reactor::check_reconfiguration); -} - -// Run the event loop until the method -// returns -1 or the method is invoked. - -ACE_INLINE int -ACE_Reactor::run_alertable_event_loop (void) -{ - ACE_TRACE ("ACE_Reactor::run_alertable_event_loop"); - ACE_Reactor *r = ACE_Reactor::instance (); - - if (r == 0) - return -1; - - return r->run_alertable_reactor_event_loop (ACE_Reactor::check_reconfiguration); -} - -// Run the event loop until the -// method returns -1, the method -// is invoked, or the expires. - -ACE_INLINE int -ACE_Reactor::run_alertable_event_loop (ACE_Time_Value &tv) -{ - ACE_TRACE ("ACE_Reactor::run_alertable_event_loop"); - ACE_Reactor *r = ACE_Reactor::instance (); - - if (r == 0) - return -1; - - return r->run_alertable_reactor_event_loop - (tv, ACE_Reactor::check_reconfiguration); -} - -ACE_INLINE void -ACE_Reactor::reset_event_loop (void) -{ - ACE_TRACE ("ACE_Reactor::reset_event_loop"); - - ACE_Reactor::instance ()->reset_reactor_event_loop (); -} - -ACE_INLINE int -ACE_Reactor::end_event_loop (void) -{ - ACE_TRACE ("ACE_Reactor::end_event_loop"); - ACE_Reactor::instance ()->end_reactor_event_loop (); - - return 0; -} - -ACE_INLINE int -ACE_Reactor::event_loop_done (void) -{ - ACE_TRACE ("ACE_Reactor::event_loop_done"); - return ACE_Reactor::instance ()->reactor_event_loop_done (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Impl.cpp b/ace/Reactor_Impl.cpp deleted file mode 100644 index 96411b8b0c6..00000000000 --- a/ace/Reactor_Impl.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -#include "ace/Reactor_Impl.h" - -ACE_RCSID (ace, - Reactor_Impl, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Reactor_Impl::~ACE_Reactor_Impl (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Impl.h b/ace/Reactor_Impl.h deleted file mode 100644 index 51cca18517e..00000000000 --- a/ace/Reactor_Impl.h +++ /dev/null @@ -1,569 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Reactor_Impl.h - * - * $Id$ - * - * @author Irfan Pyarali - */ -//============================================================================= - - -#ifndef ACE_REACTOR_IMPL_H -#define ACE_REACTOR_IMPL_H -#include /**/ "ace/pre.h" - -// Timer Queue is a complicated template class. A simple forward -// declaration will not work -#include "ace/Timer_Queuefwd.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Event_Handler.h contains the definition of ACE_Reactor_Mask -#include "ace/Event_Handler.h" -#include "ace/Countdown_Time.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decls -class ACE_Handle_Set; -class ACE_Reactor_Impl; -class ACE_Sig_Action; -class ACE_Sig_Handler; -class ACE_Sig_Set; - -/** - * @class ACE_Reactor_Notify - * - * @internal This class is for ACE internal use only. - * - * @brief Abstract class for unblocking an from its - * event loop. - */ -class ACE_Export ACE_Reactor_Notify : public ACE_Event_Handler -{ -public: - // = Initialization and termination methods. - virtual int open (ACE_Reactor_Impl *, - ACE_Timer_Queue *timer_queue = 0, - int disable_notify = 0) = 0; - virtual int close (void) = 0; - - /** - * Called by a thread when it wants to unblock the . - * This wakeups the if currently blocked. Pass over - * both the *and* the to allow the caller to - * dictate which method the will - * invoke. The indicates how long to blocking - * trying to notify the . If == 0, the - * caller will block until action is possible, else will wait until - * the relative time specified in * elapses). - */ - virtual int notify (ACE_Event_Handler *eh = 0, - ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value *timeout = 0) = 0; - - /// Handles pending threads (if any) that are waiting to unblock the - /// . - virtual int dispatch_notifications (int &number_of_active_handles, - ACE_Handle_Set &rd_mask) = 0; - - /// Returns the ACE_HANDLE of the notify pipe on which the reactor - /// is listening for notifications so that other threads can unblock - /// the - virtual ACE_HANDLE notify_handle (void) = 0; - - /// Verify whether the buffer has dispatchable info or not. - virtual int is_dispatchable (ACE_Notification_Buffer &buffer)= 0; - - /// Handle one of the notify call on the . This could be - /// because of a thread trying to unblock the - virtual int dispatch_notify (ACE_Notification_Buffer &buffer) = 0; - - /// Read one of the notify call on the into the - /// . This could be because of a thread trying to unblock - /// the - virtual int read_notify_pipe (ACE_HANDLE handle, - ACE_Notification_Buffer &buffer) = 0; - /** - * Set the maximum number of times that the method - * will iterate and dispatch the that are - * passed in via the notify queue before breaking out of the event - * loop. By default, this is set to -1, which means "iterate until - * the queue is empty." Setting this to a value like "1 or 2" will - * increase "fairness" (and thus prevent starvation) at the expense - * of slightly higher dispatching overhead. - */ - virtual void max_notify_iterations (int) = 0; - - /** - * Get the maximum number of times that the method - * will iterate and dispatch the that are - * passed in via the notify queue before breaking out of its event - * loop. - */ - virtual int max_notify_iterations (void) = 0; - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. Returns the number of notifications - * purged. Returns -1 on error. - */ - virtual int purge_pending_notifications (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) = 0; - - /// Dump the state of an object. - virtual void dump (void) const = 0; -}; - -/** - * @class ACE_Reactor_Impl - * - * @brief An abstract class for implementing the Reactor Pattern. - */ -class ACE_Export ACE_Reactor_Impl -{ -public: - /// Close down and release all resources. - virtual ~ACE_Reactor_Impl (void); - - /// Initialization. - virtual int open (size_t size, - int restart = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify * = 0) = 0; - - /** - * Returns 0, if the size of the current message has been put in - * Returns -1, if not. ACE_HANDLE allows the reactor to - * check if the caller is valid. - */ - virtual int current_info (ACE_HANDLE, size_t & /* size */) = 0; - - /// Use a user specified signal handler instead. - virtual int set_sig_handler (ACE_Sig_Handler *signal_handler) = 0; - - /// Set a user-specified timer queue. - virtual int timer_queue (ACE_Timer_Queue *tq) = 0; - - /// Return the current ACE_Timer_Queue. - virtual ACE_Timer_Queue *timer_queue (void) const = 0; - - /// Close down and release all resources. - virtual int close (void) = 0; - - // = Event loop drivers. - /** - * Returns non-zero if there are I/O events "ready" for dispatching, - * but does not actually dispatch the event handlers. By default, - * don't block while checking this, i.e., "poll". - */ - virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero) = 0; - - /** - * This event loop driver blocks for up to before - * returning. It will return earlier if events occur. Note that - * can be 0, in which case this method blocks - * indefinitely until events occur. - * - * is decremented to reflect how much time this call - * took. For instance, if a time value of 3 seconds is passed to - * handle_events and an event occurs after 2 seconds, - * will equal 1 second. This can be used if an - * application wishes to handle events for some fixed amount of - * time. - * - * Returns the total number of ACE_Event_Handlers that were - * dispatched, 0 if the elapsed without dispatching - * any handlers, or -1 if an error occurs. - * - * The only difference between and - * is that in the alertable case, the eventloop will - * return when the system queues an I/O completion routine or an - * Asynchronous Procedure Call. - */ - virtual int handle_events (ACE_Time_Value *max_wait_time = 0) = 0; - virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0) = 0; - - /** - * This method is just like the one above, except the - * value is a reference and can therefore never be - * NULL. - * - * The only difference between and - * is that in the alertable case, the eventloop will - * return when the system queues an I/O completion routine or an - * Asynchronous Procedure Call. - */ - virtual int handle_events (ACE_Time_Value &max_wait_time) = 0; - virtual int alertable_handle_events (ACE_Time_Value &max_wait_time) = 0; - - // = Event handling control. - - /** - * Return the status of Reactor. If this function returns 0, the reactor is - * actively handling events. If it returns non-zero, and - * return -1 immediately. - */ - virtual int deactivated (void) = 0; - - /** - * Control whether the Reactor will handle any more incoming events or not. - * If == 1, the Reactor will be disabled. By default, a reactor - * is in active state and can be deactivated/reactived as wish. - */ - virtual void deactivate (int do_stop) = 0; - - // = Register and remove Handlers. - - /// Register with . The I/O handle will always - /// come from on the . - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) = 0; - - /// Register with . The I/O handle is provided - /// through the parameter. - virtual int register_handler (ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) = 0; - -#if defined (ACE_WIN32) - - // Originally this interface was available for all platforms, but - // because ACE_HANDLE is an int on non-Win32 platforms, compilers - // are not able to tell the difference between - // register_handler(ACE_Event_Handler*,ACE_Reactor_Mask) and - // register_handler(ACE_Event_Handler*,ACE_HANDLE). Therefore, we - // have restricted this method to Win32 only. - - /** - * Register an that will be notified when - * is signaled. Since no event mask is passed - * through this interface, it is assumed that the - * being passed in is an event handle and not an I/O handle. - */ - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_HANDLE event_handle = ACE_INVALID_HANDLE) = 0; - -#endif /* ACE_WIN32 */ - - /** - * Register an that will be notified when - * is signaled. specifies the network events - * that the is interested in. - */ - virtual int register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) = 0; - - /// Register with all the in the . - virtual int register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) = 0; - - /** - * Register to handle the signal using the - * . Returns the that was previously registered - * (if any), along with the of the signal handler. - */ - virtual int register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0, - ACE_Event_Handler **old_sh = 0, - ACE_Sig_Action *old_disp = 0) = 0; - - /// Registers to handle a set of signals using the - /// . - virtual int register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0) = 0; - - /** - * Removes . Note that the I/O handle will be - * obtained using method of . If - * == then the - * method of the is not invoked. - */ - virtual int remove_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) = 0; - - /** - * Removes . If == - * then the method of the associated - * is not invoked. - */ - virtual int remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask) = 0; - - /** - * Removes all handles in . If == - * then the method of - * the associated s is not invoked. - */ - virtual int remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask mask) = 0; - - /** - * Remove the ACE_Event_Handler currently associated with . - * Install the new disposition (if given) and return the previous - * disposition (if desired by the caller). Returns 0 on success and - * -1 if is invalid. - */ - virtual int remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp = 0, - int sigkey = -1) = 0; - - /// Calls for every signal in . - virtual int remove_handler (const ACE_Sig_Set &sigset) = 0; - - // = Suspend and resume Handlers. - - /// Suspend temporarily. Use - /// to get the handle. - virtual int suspend_handler (ACE_Event_Handler *event_handler) = 0; - - /// Suspend temporarily. - virtual int suspend_handler (ACE_HANDLE handle) = 0; - - /// Suspend all in handle set temporarily. - virtual int suspend_handler (const ACE_Handle_Set &handles) = 0; - - /// Suspend all temporarily. - virtual int suspend_handlers (void) = 0; - - /// Resume . Use to - /// get the handle. - virtual int resume_handler (ACE_Event_Handler *event_handler) = 0; - - /// Resume . - virtual int resume_handler (ACE_HANDLE handle) = 0; - - /// Resume all in handle set. - virtual int resume_handler (const ACE_Handle_Set &handles) = 0; - - /// Resume all . - virtual int resume_handlers (void) = 0; - - /// Does the reactor allow the application to resume the handle on - /// its own ie. can it pass on the control of handle resumption to - /// the application - virtual int resumable_handler (void) = 0; - - /// Return 1 if we any event associations were made by the reactor - /// for the handles that it waits on, 0 otherwise. - virtual int uses_event_associations (void) = 0; - - // If we need to reset handles returned from accept/connect. - - // = Timer management. - - /** - * Schedule an ACE_Event_Handler that will expire after an amount - * of time. The return value of this method, a timer_id value, - * uniquely identifies the event_handler in the ACE_Reactor's - * internal list of timers. - * This timer_id value can be used to cancel the timer - * with the cancel_timer() call. - * - * @see cancel_timer() - * @see reset_timer_interval() - * - * @param event_handler event handler to schedule on reactor - * @param arg argument passed to the handle_timeout() method of event_handler - * @param delay time interval after which the timer will expire - * @param interval time interval after which the timer will be automatically rescheduled - * @return -1 on failure, a timer_id value on success - */ - virtual long schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0; - - /** - * Resets the interval of the timer represented by to - * , which is specified in relative time to the current - * . If is equal to - * , the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_timer_interval (long timer_id, - const ACE_Time_Value &interval) = 0; - - /// Cancel all Event_Handlers that match the address of - /// . Returns number of handlers cancelled. - virtual int cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close = 1) = 0; - - /** - * Cancel the single Event_Handler that matches the value - * (which was returned from the schedule method). If arg is - * non-NULL then it will be set to point to the ``magic cookie'' - * argument passed in when the Event_Handler was registered. This - * makes it possible to free up the memory and avoid memory leaks. - * Returns 1 if cancellation succeeded and 0 if the - * wasn't found. - */ - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1) = 0; - - // = High-level Event_Handler scheduling operations - - /// Add to the 's entry. - /// must already have been registered. - virtual int schedule_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_added) = 0; - - /// Add to the 's entry. - /// associated with must already have been registered. - virtual int schedule_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_added) = 0; - - /// Clear from the 's entry. - virtual int cancel_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_cleared) = 0; - - /// Clear from the 's entry. - virtual int cancel_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_cleared) = 0; - - // = Notification methods. - - /** - * Notify of event. The - * indicates how long to blocking trying to notify. If == - * 0, the caller will block until action is possible, else will wait - * until the relative time specified in elapses). - */ - virtual int notify (ACE_Event_Handler *event_handler = 0, - ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value * = 0) = 0; - - /** - * Set the maximum number of times that ACE_Reactor_Impl will - * iterate and dispatch the that are passed in - * via the notify queue before breaking out of its - * loop. By default, this is set to - * -1, which means "iterate until the queue is empty." Setting this - * to a value like "1 or 2" will increase "fairness" (and thus - * prevent starvation) at the expense of slightly higher dispatching - * overhead. - */ - virtual void max_notify_iterations (int) = 0; - - /** - * Get the maximum number of times that the ACE_Reactor_Impl will - * iterate and dispatch the that are passed in - * via the notify queue before breaking out of its - * loop. - */ - virtual int max_notify_iterations (void) = 0; - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. Returns the number of notifications - * purged. Returns -1 on error. - */ - virtual int purge_pending_notifications (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) = 0; - - /** - * Return the Event_Handler associated with . Return 0 if - * is not registered. - */ - virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle) = 0; - - /** - * Check to see if is associated with a valid Event_Handler - * bound to . Return the associated with this - * if != 0. - */ - virtual int handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler = 0) = 0; - - /** - * Check to see if is associated with a valid Event_Handler - * bound to a signal. Return the associated with - * this if != 0. - */ - virtual int handler (int signum, - ACE_Event_Handler ** = 0) = 0; - - /// Returns true if Reactor has been successfully initialized, else - /// false. - virtual int initialized (void) = 0; - - /// Returns the current size of the Reactor's internal descriptor - /// table. - virtual size_t size (void) const = 0; - - /// Returns a reference to the Reactor's internal lock. - virtual ACE_Lock &lock (void) = 0; - - /// Wake up all threads in waiting in the event loop - virtual void wakeup_all_threads (void) = 0; - - /// Transfers ownership of Reactor_Impl to the . - virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0) = 0; - - /// Return the ID of the "owner" thread. - virtual int owner (ACE_thread_t *owner) = 0; - - /// Get the existing restart value. - virtual int restart (void) = 0; - - /// Set a new value for restart and return the original value. - virtual int restart (int r) = 0; - - /// Set position of the owner thread. - virtual void requeue_position (int) = 0; - - /// Get position of the owner thread. - virtual int requeue_position (void) = 0; - - // = Low-level wait_set mask manipulation methods. - - /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the - /// and . - virtual int mask_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops) = 0; - - /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the - /// and . - virtual int mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) = 0; - - // = Low-level ready_set mask manipulation methods. - /// GET/SET/ADD/CLR the ready "bit" bound with the - /// and . - virtual int ready_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops) = 0; - - /// GET/SET/ADD/CLR the ready "bit" bound with the and . - virtual int ready_ops (ACE_HANDLE handle, - ACE_Reactor_Mask, - int ops) = 0; - - /// Dump the state of an object. - virtual void dump (void) const = 0; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_REACTOR_IMPL_H */ diff --git a/ace/Reactor_Notification_Strategy.cpp b/ace/Reactor_Notification_Strategy.cpp deleted file mode 100644 index a029e2c10c2..00000000000 --- a/ace/Reactor_Notification_Strategy.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "ace/Reactor_Notification_Strategy.h" -#include "ace/Reactor.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Reactor_Notification_Strategy.inl" -#endif /* __ACE_INLINE __ */ - -ACE_RCSID(ace, Reactor_Notification_Strategy, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Reactor_Notification_Strategy::ACE_Reactor_Notification_Strategy ( - ACE_Reactor *reactor, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) - : ACE_Notification_Strategy (eh, mask), - reactor_ (reactor) -{ -} - -ACE_Reactor_Notification_Strategy::~ACE_Reactor_Notification_Strategy (void) -{ -} - -int -ACE_Reactor_Notification_Strategy::notify (void) -{ - return this->reactor_->notify (this->eh_, this->mask_); -} - -int -ACE_Reactor_Notification_Strategy::notify (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - return this->reactor_->notify (eh, mask); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Notification_Strategy.h b/ace/Reactor_Notification_Strategy.h deleted file mode 100644 index 5d38f5609a6..00000000000 --- a/ace/Reactor_Notification_Strategy.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Reactor_Notification_Strategy.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= -#ifndef ACE_REACTOR_NOTIFICATION_STRATEGY_H -#define ACE_REACTOR_NOTIFICATION_STRATEGY_H - -#include /**/ "ace/pre.h" - -#include "ace/Notification_Strategy.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Reactor_Notification_Strategy - * - * @brief Used to notify an ACE_Reactor - * - * Integrates the ACE_Message_Queue notification into the - * method. - */ -class ACE_Export ACE_Reactor_Notification_Strategy : public ACE_Notification_Strategy -{ -public: - ACE_Reactor_Notification_Strategy (ACE_Reactor *reactor, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /// Default dtor. - virtual ~ACE_Reactor_Notification_Strategy (void); - - virtual int notify (void); - - virtual int notify (ACE_Event_Handler *, - ACE_Reactor_Mask mask); - - /// Get the reactor - ACE_Reactor *reactor (void); - - /// Set the reactor - void reactor (ACE_Reactor *r); - -protected: - /// The Reactor - ACE_Reactor *reactor_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Reactor_Notification_Strategy.inl" -#endif /* __ACE_INLINE __ */ - -#include /**/ "ace/post.h" - -#endif /*ACE_REACTOR_NOTIFICATION_STRATEGY_H */ diff --git a/ace/Reactor_Notification_Strategy.inl b/ace/Reactor_Notification_Strategy.inl deleted file mode 100644 index 328c2687a77..00000000000 --- a/ace/Reactor_Notification_Strategy.inl +++ /dev/null @@ -1,19 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_Reactor * -ACE_Reactor_Notification_Strategy::reactor (void) -{ - return this->reactor_; -} - -ACE_INLINE void -ACE_Reactor_Notification_Strategy::reactor (ACE_Reactor *r) -{ - this->reactor_ = r; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Timer_Interface.cpp b/ace/Reactor_Timer_Interface.cpp deleted file mode 100644 index 6c07f21ac86..00000000000 --- a/ace/Reactor_Timer_Interface.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -#include "ace/Reactor_Timer_Interface.h" - -ACE_RCSID (ace, - Reactor_Timer_Interface, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Reactor_Timer_Interface::~ACE_Reactor_Timer_Interface() -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Timer_Interface.h b/ace/Reactor_Timer_Interface.h deleted file mode 100644 index d370a128df2..00000000000 --- a/ace/Reactor_Timer_Interface.h +++ /dev/null @@ -1,60 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Reactor_Timer_Interface.h - * - * $Id$ - * - * @author Irfan Pyarali - */ -//============================================================================= - -#ifndef ACE_REACTOR_TIMER_INTERFACE_H -#define ACE_REACTOR_TIMER_INTERFACE_H - -#include /**/ "ace/pre.h" - -#include "ace/Time_Value.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Event_Handler; - -/** - * @class ACE_Reactor_Timer_Interface - * - * @brief Interface for timer related methods on the Reactor. - */ -class ACE_Export ACE_Reactor_Timer_Interface -{ -public: - - virtual ~ACE_Reactor_Timer_Interface (void); - - virtual long schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0; - - virtual int reset_timer_interval (long timer_id, - const ACE_Time_Value &interval) = 0; - - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1) = 0; - - virtual int cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close = 1) = 0; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_REACTOR_TIMER_INTERFACE_H */ diff --git a/ace/Reactor_Token_T.cpp b/ace/Reactor_Token_T.cpp deleted file mode 100644 index 358b0b14f65..00000000000 --- a/ace/Reactor_Token_T.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// $Id$ - -#include "ace/Log_Msg.h" -#include "ace/Reactor_Token_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template void -ACE_Reactor_Token_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Reactor_Token_T::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Reactor_Token_T::ACE_Reactor_Token_T - (ACE_Reactor_Impl &r, - int s_queue) - : reactor_ (&r) -{ - ACE_TRACE ("ACE_Reactor_Token_T::ACE_Reactor_Token"); - - this->queueing_strategy (s_queue); -} - -template -ACE_Reactor_Token_T::ACE_Reactor_Token_T (int s_queue) - : reactor_ (0) -{ - ACE_TRACE ("ACE_Reactor_Token_T::ACE_Reactor_Token"); - - this->queueing_strategy (s_queue); -} - -template -ACE_Reactor_Token_T::~ACE_Reactor_Token_T (void) -{ - ACE_TRACE ("ACE_Reactor_Token_T::~ACE_Reactor_Token_T"); -} - -template ACE_Reactor_Impl & -ACE_Reactor_Token_T::reactor (void) -{ - return *this->reactor_; -} - -template void -ACE_Reactor_Token_T::reactor (ACE_Reactor_Impl &reactor) -{ - this->reactor_ = &reactor; -} - -// Used to wakeup the reactor. - -template void -ACE_Reactor_Token_T::sleep_hook (void) -{ - ACE_TRACE ("ACE_Reactor_Token_T::sleep_hook"); - if (this->reactor_->notify () == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("sleep_hook failed"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Token_T.h b/ace/Reactor_Token_T.h deleted file mode 100644 index 945f05531df..00000000000 --- a/ace/Reactor_Token_T.h +++ /dev/null @@ -1,93 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Reactor_Token_T.h - * - * $Id$ - * - * @author Steve Huston - */ -//============================================================================= - - -#ifndef ACE_REACTOR_TOKEN_T_H -#define ACE_REACTOR_TOKEN_T_H -#include /**/ "ace/pre.h" - -#include "ace/Reactor_Impl.h" -#include "ace/Token.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Reactor_Token_T - * - * @internal For ACE internal use only. - * - * @brief Used as a synchronization mechanism to coordinate concurrent - * access to an ACE_Reactor_Impl object. - * - * This class is used to make access to a reactor's internals and - * demultiplexing mechanism thread-safe. By default, the thread that - * runs the handle_events() loop holds the token, even when it is blocked - * in the demultiplexer. Whenever another thread wants to access the - * reactor, such as via the register_handler(), remove_handler(), etc. - * methods, it must ask the token owner for temporary release of the token. - * To accomplish this, this class reimplements the ACE_Token::sleep_hook() - * method through which the owning thread can be notified to temporarily - * release the token if the current situation permits. - * - * The owner of the token is responsible for deciding which - * request for the token can be granted. By using the - * ACE_Token::renew() method, the thread that releases the token - * temporarily can specify to get the token back right after the - * other thread has completed using the token. Thus, there is a - * dedicated thread that owns the token by default. This - * thread grants other threads access to the token by ensuring - * that whenever somebody else has finished using the token the - * original owner reclaims the token again, i.e., the owner has the - * chance to schedule other threads. The thread that most likely needs - * the token most of the time is the thread running the dispatch loop. - */ -template -class ACE_Reactor_Token_T : public ACE_TOKEN_TYPE -{ -public: - ACE_Reactor_Token_T (ACE_Reactor_Impl &r, - int s_queue = ACE_TOKEN_TYPE::FIFO); - ACE_Reactor_Token_T (int s_queue = ACE_TOKEN_TYPE::FIFO); - virtual ~ACE_Reactor_Token_T (void); - - /// Called just before a token waiter goes to sleep. - /// @see ACE_Token::sleep_hook - virtual void sleep_hook (void); - - /// Get the reactor implementation - ACE_Reactor_Impl &reactor (void); - - /// Set the reactor implementation - void reactor (ACE_Reactor_Impl &); - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - ACE_Reactor_Impl *reactor_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Reactor_Token_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Reactor_Token_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_REACTOR_TOKEN_T_H */ diff --git a/ace/Read_Buffer.cpp b/ace/Read_Buffer.cpp deleted file mode 100644 index 9401048f148..00000000000 --- a/ace/Read_Buffer.cpp +++ /dev/null @@ -1,176 +0,0 @@ -// $Id$ - -#include "ace/Read_Buffer.h" - -#include "ace/config-all.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Read_Buffer.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/Malloc_Base.h" -#include "ace/Service_Config.h" -#include "ace/OS_NS_stdio.h" - -ACE_RCSID(ace, Read_Buffer, "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Read_Buffer::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Read_Buffer::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("size_ = %d"), this->size_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\noccurrences_ = %d"), this->occurrences_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nstream_ = %x"), this->stream_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nallocator_ = %x"), this->allocator_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Read_Buffer::ACE_Read_Buffer (FILE *fp, - int close_on_delete, - ACE_Allocator *alloc) - : stream_ (fp), - close_on_delete_ (close_on_delete), - allocator_ (alloc) -{ - ACE_TRACE ("ACE_Read_Buffer::ACE_Read_Buffer"); - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); -} - -#if !defined (ACE_HAS_WINCE) -ACE_Read_Buffer::ACE_Read_Buffer (ACE_HANDLE handle, - int close_on_delete, - ACE_Allocator *alloc) - : stream_ (ACE_OS::fdopen (handle, ACE_LIB_TEXT ("r"))), - close_on_delete_ (close_on_delete), - allocator_ (alloc) -{ - ACE_TRACE ("ACE_Read_Buffer::ACE_Read_Buffer"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); -} -#endif // ACE_HAS_WINCE - -ACE_Read_Buffer::~ACE_Read_Buffer (void) -{ - ACE_TRACE ("ACE_Read_Buffer::~ACE_Read_Buffer"); - - if (this->close_on_delete_) - ACE_OS::fclose (this->stream_); -} - -// Input: term the character to terminate on -// search the character to search for -// replace the character with which to replace search -// Output: a buffer containing the contents of stream -// Method: call the recursive helper function read_helper - -char * -ACE_Read_Buffer::read (int term, int search, int replace) -{ - ACE_TRACE ("ACE_Read_Buffer::read"); - this->occurrences_ = 0; - this->size_ = 0; - return this->rec_read (term, search, replace); -} - -// Input: term the termination character -// search the character to search for -// replace the character with which to replace search -// Purpose: read in a file to a buffer using only a single dynamic -// allocation. -// Method: read until the local buffer is full and then recurse. -// Must continue until the termination character is reached. -// Allocate the final buffer based on the number of local -// buffers read and as the recursive calls bottom out, -// copy them in reverse order into the allocated buffer. - -char * -ACE_Read_Buffer::rec_read (int term, int search, int replace) -{ - ACE_TRACE ("ACE_Read_Buffer::rec_read"); - // This is our temporary workspace. - char buf[BUFSIZ]; - - int c = EOF; - size_t slot = 0; - int done = 0; - - // Read in the file char by char - while (slot < BUFSIZ) - { - c = getc (this->stream_); - - // Don't insert EOF into the buffer... - if (c == EOF) - { - ungetc (c, this->stream_); - break; - } - else if (c == term) - done = 1; - - // Check for possible substitutions. - if (c == search) - { - this->occurrences_++; - - if (replace >= 0) - c = replace; - } - - buf[slot++] = (char) c; - - // Substitutions must be made before checking for termination. - if (done) - break; - } - - // Increment the number of bytes. - this->size_ += slot; - - // Don't bother going any farther if the total size is 0. - if (this->size_ == 0) - return 0; - - char *result; - - // Recurse, when the recursion bottoms out, allocate the result - // buffer. - if (done || c == EOF) - { - // Use the allocator to acquire the memory. The + 1 allows - // space for the null terminator. - result = (char *) this->allocator_->malloc (this->size_ + 1); - - if (result == 0) - { - errno = ENOMEM; - return 0; - } - result += this->size_; - - // Null terminate the buffer. - *result = '\0'; - } - else if ((result = this->rec_read (term, search, replace)) == 0) - return 0; - - // Copy buf into the appropriate location starting from end of - // buffer. Peter says this is confusing and that we should use - // memcpy() ;-) - for (size_t j = slot; j > 0; j--) - *--result = buf[j - 1]; - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Read_Buffer.h b/ace/Read_Buffer.h deleted file mode 100644 index 11176ef34df..00000000000 --- a/ace/Read_Buffer.h +++ /dev/null @@ -1,130 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Read_Buffer.h - * - * $Id$ - * - * @author Douglas C. Schmidt - * @author Seth Widoff - */ -//========================================================================== - -#ifndef ACE_READ_BUFFER_H -#define ACE_READ_BUFFER_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" -#include "ace/os_include/os_stdio.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Allocator; - -/** - * @class ACE_Read_Buffer - * - * @brief Efficiently reads an artibrarily large buffer from an input - * stream up to and including a termination character. Also - * performs search/replace on single occurrences a character in - * the buffer using the principles of Integrated Layer - * Processing. - * - * This implementation is optimized to do a single dynamic - * allocation and make only one copy of the data. It uses - * recursion and the run-time stack to accomplish this - * efficiently. - */ -class ACE_Export ACE_Read_Buffer -{ -public: - // = Initialization and termination methods. - /// Read from a FILE *. - ACE_Read_Buffer (FILE *fp, - int close_on_delete = 0, - ACE_Allocator * = 0); - -#if !defined (ACE_HAS_WINCE) - // Note that ACE_HANDLE = FILE under CE. - - /// Read from an open HANDLE. - ACE_Read_Buffer (ACE_HANDLE handle, - int close_on_delete = 0, - ACE_Allocator * = 0); -#endif // ACE_HAS_WINCE - - /// Closes the FILE *. - ~ACE_Read_Buffer (void); - - /** - * Returns a pointer dynamically allocated with - * to data from the input stream up to (and - * including) the . If is >= 0 then all - * occurrences of the value are substituted with the - * value. The last of the byte of data is a 0, so that - * can be used on it. The caller is responsible for - * freeing the pointer returned from this method using the - * . - */ - char *read (int terminator = EOF, - int search = '\n', - int replace = '\0'); - - /// Returns the number of characters replaced during a . - size_t replaced (void) const; - - /// Returns the size of the allocated buffer obtained during a - /// @c read, not including the null terminator. - size_t size (void) const; - - /// Returns a pointer to its allocator. - ACE_Allocator *alloc (void) const; - - /// Dump the state of the object. - void dump (void) const; - -private: - - // Disallow copying and assignment... - void operator= (const ACE_Read_Buffer &); - ACE_Read_Buffer (const ACE_Read_Buffer &); - -private: - /// Recursive helper method that does the work... - char *rec_read (int term, int search, int replace); - - /// The total number of characters in the buffer. - size_t size_; - - /// The total number of characters replaced. - size_t occurrences_; - - /// The stream we are reading from. - FILE *stream_; - - /// Keeps track of whether we should close the FILE in the - /// destructor. - int close_on_delete_; - - /// Pointer to the allocator. - ACE_Allocator *allocator_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/Read_Buffer.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_READ_BUFFER_H */ diff --git a/ace/Read_Buffer.inl b/ace/Read_Buffer.inl deleted file mode 100644 index 1517e9c17e3..00000000000 --- a/ace/Read_Buffer.inl +++ /dev/null @@ -1,32 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Accessor to the number of bytes in the buffer. - -ACE_INLINE size_t -ACE_Read_Buffer::size (void) const -{ - ACE_TRACE ("ACE_Read_Buffer::size"); - return this->size_; -} - -// The total number of characters replaced. - -ACE_INLINE size_t -ACE_Read_Buffer::replaced (void) const -{ - ACE_TRACE ("ACE_Read_Buffer::replaced"); - return this->occurrences_; -} - -ACE_INLINE ACE_Allocator * -ACE_Read_Buffer::alloc (void) const -{ - ACE_TRACE ("ACE_Read_Buffer::alloc"); - return this->allocator_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Recursive_Thread_Mutex.cpp b/ace/Recursive_Thread_Mutex.cpp deleted file mode 100644 index d2a041b6030..00000000000 --- a/ace/Recursive_Thread_Mutex.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/** - * @file Recursive_Thread_Mutex.cpp - * - * $Id$ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/Recursive_Thread_Mutex.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/Recursive_Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" - -ACE_RCSID(ace, Recursive_Thread_Mutex, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Recursive_Thread_Mutex) - -ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex (const ACE_TCHAR *name, - ACE_mutexattr_t *arg) - : removed_ (0) -{ - // ACE_TRACE ("ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex"); - if (ACE_OS::recursive_mutex_init (&this->lock_, - name, - arg) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("recursive_mutex_init"))); -} - -ACE_Recursive_Thread_Mutex::~ACE_Recursive_Thread_Mutex (void) -{ - // ACE_TRACE ("ACE_Recursive_Thread_Mutex::~ACE_Recursive_Thread_Mutex"); - this->remove (); -} - -int -ACE_Recursive_Thread_Mutex::remove (void) -{ -// ACE_TRACE ("ACE_Recursive_Thread_Mutex::remove"); - int result = 0; - if (this->removed_ == 0) - { - this->removed_ = 1; - result = ACE_OS::recursive_mutex_destroy (&this->lock_); - } - return result; -} - -// The counter part of the following two functions for Win32 are -// located in file Synch.i -ACE_thread_t -ACE_Recursive_Thread_Mutex::get_thread_id (void) -{ - // ACE_TRACE ("ACE_Recursive_Thread_Mutex::get_thread_id"); -#if defined (ACE_HAS_RECURSIVE_MUTEXES) - // @@ The structure CriticalSection in Win32 doesn't hold the thread - // handle of the thread that owns the lock. However it is still not - // clear at this point how to translate a thread handle to its - // corresponding thread id. - errno = ENOTSUP; - return ACE_OS::NULL_thread; -#else - ACE_thread_t owner_id; - ACE_OS::mutex_lock (&this->lock_.nesting_mutex_); - owner_id = this->lock_.owner_id_; - ACE_OS::mutex_unlock (&this->lock_.nesting_mutex_); - return owner_id; -#endif /* ACE_WIN32 */ -} - -int -ACE_Recursive_Thread_Mutex::get_nesting_level (void) -{ - // ACE_TRACE ("ACE_Recursive_Thread_Mutex::get_nesting_level"); -#if defined (ACE_HAS_WINCE) || defined (ACE_VXWORKS) - ACE_NOTSUP_RETURN (-1); -#elif defined (ACE_HAS_RECURSIVE_MUTEXES) - // Nothing inside of a CRITICAL_SECTION object should ever be - // accessed directly. It is documented to change at any time. -# if defined (ACE_WIN64) && !defined(_M_AMD64) - // Things are different on Windows XP 64-bit. However, as of Feb 2006 - // Windows XP 64-bit edition on Intel EM64T w/ VC8, LockCount is - // decremented at first acquire and then doesn't change. RecursionCount, - // however, works the same as Win32, below. - return this->lock_.LockCount + 1; -# elif defined (ACE_WIN32) - // This is really a Win32-ism... - return this->lock_.RecursionCount; -# else - ACE_NOTSUP_RETURN (-1); -# endif /* ACE_HAS_RECURSIVE_MUTEXES */ -#else - int nesting_level = 0; - ACE_OS::mutex_lock (&this->lock_.nesting_mutex_); - nesting_level = this->lock_.nesting_level_; - ACE_OS::mutex_unlock (&this->lock_.nesting_mutex_); - return nesting_level; -#endif /* !ACE_HAS_WINCE */ -} - -ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex (const ACE_Recursive_Thread_Mutex &) -{ -} - -void -ACE_Recursive_Thread_Mutex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Recursive_Thread_Mutex::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/Recursive_Thread_Mutex.h b/ace/Recursive_Thread_Mutex.h deleted file mode 100644 index dda44473c3f..00000000000 --- a/ace/Recursive_Thread_Mutex.h +++ /dev/null @@ -1,194 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Recursive_Thread_Mutex.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt and - * Abdullah Sowayan - */ -//========================================================================== - -#ifndef ACE_RECURSIVE_THREAD_MUTEX_H -#define ACE_RECURSIVE_THREAD_MUTEX_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_HAS_THREADS) -# include "ace/Null_Mutex.h" -#else /* ACE_HAS_THREADS */ -// ACE platform supports some form of threading. - -#include "ace/OS_NS_Thread.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Recursive_Thread_Mutex - * - * @brief Implement a C++ wrapper that allows nested acquisition and - * release of a mutex that occurs in the same thread. - */ -class ACE_Export ACE_Recursive_Thread_Mutex -{ -public: - /// Initialize a recursive mutex. - ACE_Recursive_Thread_Mutex (const ACE_TCHAR *name = 0, - ACE_mutexattr_t *arg = 0); - - /// Implicitly release a recursive mutex. - ~ACE_Recursive_Thread_Mutex (void); - - /** - * Implicitly release a recursive mutex. Note that only one thread - * should call this method since it doesn't protect against race - * conditions. - */ - int remove (void); - - /** - * Acquire a recursive mutex (will increment the nesting level and - * not deadmutex if the owner of the mutex calls this method more - * than once). - */ - int acquire (void); - - /** - * Block the thread until we acquire the mutex or until @a tv times - * out, in which case -1 is returned with == . Note - * that @a tv is assumed to be in "absolute" rather than "relative" - * time. The value of @a tv is updated upon return to show the - * actual (absolute) acquisition time. - */ - int acquire (ACE_Time_Value &tv); - - /** - * If == 0 the call directly. Otherwise, Block the - * thread until we acquire the mutex or until times out, in - * which case -1 is returned with == . Note that - * <*tv> is assumed to be in "absolute" rather than "relative" time. - * The value of <*tv> is updated upon return to show the actual - * (absolute) acquisition time. - */ - int acquire (ACE_Time_Value *tv); - - /** - * Conditionally acquire a recursive mutex (i.e., won't block). - * Returns -1 on failure. If we "failed" because someone else - * already had the lock, is set to . - */ - int tryacquire (void); - - /** - * Acquire mutex ownership. This calls and is only - * here to make the interface consistent - * with the other synchronization APIs. - */ - int acquire_read (void); - - /** - * Acquire mutex ownership. This calls and is only - * here to make the interface consistent - * with the other synchronization APIs. - */ - int acquire_write (void); - - /** - * Conditionally acquire mutex (i.e., won't block). This calls - * and is only here to make the - * interface consistent with the other - * synchronization APIs. Returns -1 on failure. If we "failed" - * because someone else already had the lock, is set to - * . - */ - int tryacquire_read (void); - - /** - * Conditionally acquire mutex (i.e., won't block). This calls - * and is only here to make the - * interface consistent with the other - * synchronization APIs. Returns -1 on failure. If we "failed" - * because someone else already had the lock, is set to - * . - */ - int tryacquire_write (void); - - /** - * This is only here to make the ACE_Recursive_Thread_Mutex - * interface consistent with the other synchronization APIs. - * Assumes the caller has already acquired the mutex using one of - * the above calls, and returns 0 (success) always. - */ - int tryacquire_write_upgrade (void); - - /** - * Releases a recursive mutex (will not release mutex until all the - * nesting level drops to 0, which means the mutex is no longer - * held). - */ - int release (void); - - /// Return the id of the thread that currently owns the mutex. - ACE_thread_t get_thread_id (void); - - /** - * Return the nesting level of the recursion. When a thread has - * acquired the mutex for the first time, the nesting level == 1. - * The nesting level is incremented every time the thread acquires - * the mutex recursively. Note that if the ACE_HAS_RECURSIVE_MUTEXES - * macro is enabled then this method may return -1 on platforms that - * do not expose the internal count. - */ - int get_nesting_level (void); - - /// Returns a reference to the recursive mutex; - ACE_recursive_thread_mutex_t &mutex (void); - - /// Returns a reference to the recursive mutex's internal mutex; - ACE_thread_mutex_t &get_nesting_mutex (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = This method should *not* be public (they hold no locks...) - void set_thread_id (ACE_thread_t t); - - /// Recursive mutex. - ACE_recursive_thread_mutex_t lock_; - - /// Keeps track of whether has been called yet to avoid - /// multiple calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure - /// that you don't have multiple threads simultaneously calling - /// on the same object, which is a bad idea anyway... - int removed_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Recursive_Thread_Mutex &); - ACE_Recursive_Thread_Mutex (const ACE_Recursive_Thread_Mutex &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Recursive_Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_RECURSIVE_THREAD_MUTEX_H */ diff --git a/ace/Recursive_Thread_Mutex.inl b/ace/Recursive_Thread_Mutex.inl deleted file mode 100644 index 0269de24d6b..00000000000 --- a/ace/Recursive_Thread_Mutex.inl +++ /dev/null @@ -1,95 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_recursive_thread_mutex_t & -ACE_Recursive_Thread_Mutex::mutex (void) -{ - return lock_; -} - -ACE_INLINE ACE_thread_mutex_t & -ACE_Recursive_Thread_Mutex::get_nesting_mutex (void) -{ -#if defined (ACE_HAS_RECURSIVE_MUTEXES) - return static_cast (lock_); -#else - return lock_.nesting_mutex_; -#endif /* ACE_HAS_RECURSIVE_MUTEXES */ -} - -ACE_INLINE void -ACE_Recursive_Thread_Mutex::set_thread_id (ACE_thread_t t) -{ -// ACE_TRACE ("ACE_Recursive_Thread_Mutex::set_thread_id"); -#if defined (ACE_HAS_RECURSIVE_MUTEXES) - ACE_UNUSED_ARG (t); -#else /* ! ACE_HAS_RECURSIVE_MUTEXES */ - this->lock_.owner_id_ = t; -#endif /* ! ACE_HAS_RECURSIVE_MUTEXES */ -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::acquire (void) -{ - return ACE_OS::recursive_mutex_lock (&this->lock_); -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::release (void) -{ - return ACE_OS::recursive_mutex_unlock (&this->lock_); -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::tryacquire (void) -{ - return ACE_OS::recursive_mutex_trylock (&this->lock_); -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::acquire (ACE_Time_Value &tv) -{ - return ACE_OS::recursive_mutex_lock (&this->lock_, tv); -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::acquire (ACE_Time_Value *tv) -{ - return ACE_OS::recursive_mutex_lock (&this->lock_, tv); -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::acquire_read (void) -{ - return this->acquire (); -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::acquire_write (void) -{ - return this->acquire (); -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::tryacquire_read (void) -{ - return this->tryacquire (); -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::tryacquire_write (void) -{ - return this->tryacquire (); -} - -ACE_INLINE int -ACE_Recursive_Thread_Mutex::tryacquire_write_upgrade (void) -{ - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - diff --git a/ace/Recyclable.cpp b/ace/Recyclable.cpp deleted file mode 100644 index 5da42cc8d15..00000000000 --- a/ace/Recyclable.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//$Id$ -#include "ace/Recyclable.h" - - -#if !defined (__ACE_INLINE__) -#include "ace/Recyclable.inl" -#endif /* __ACE_INLINE __ */ - -ACE_RCSID(ace, Recyclable, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Recyclable::ACE_Recyclable (ACE_Recyclable_State initial_state) - : recycle_state_ (initial_state) -{ -} - -ACE_Recyclable::~ACE_Recyclable (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Recyclable.h b/ace/Recyclable.h deleted file mode 100644 index 2c3d088cacd..00000000000 --- a/ace/Recyclable.h +++ /dev/null @@ -1,83 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Recyclable.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= -#ifndef ACE_RECYCLABLE_H -#define ACE_RECYCLABLE_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/// States of a recyclable object. -enum ACE_Recyclable_State -{ - /// Idle and can be purged. - ACE_RECYCLABLE_IDLE_AND_PURGABLE, - - /// Idle but cannot be purged. - ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE, - - /// Can be purged, but is not idle (mostly for debugging). - ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE, - - /// Busy (i.e., cannot be recycled or purged). - ACE_RECYCLABLE_BUSY, - - /// Closed. - ACE_RECYCLABLE_CLOSED, - - /// Unknown state. - ACE_RECYCLABLE_UNKNOWN -}; - -/** - * @class ACE_Recyclable - * - * @brief - * - * - */ -class ACE_Export ACE_Recyclable -{ -public: - /// Destructor. - virtual ~ACE_Recyclable (void); - - /// Get the recyclable bit - ACE_Recyclable_State recycle_state (void) const; - - /// Set the recyclable bit - void recycle_state (ACE_Recyclable_State new_state); - -protected: - - /// Constructor. - ACE_Recyclable (ACE_Recyclable_State initial_state); - -protected: - - /// Our state. - ACE_Recyclable_State recycle_state_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Recyclable.inl" -#endif /* __ACE_INLINE __ */ - -#include /**/ "ace/post.h" -#endif /*ACE_RECYCLABLE_STATE_H*/ diff --git a/ace/Recyclable.inl b/ace/Recyclable.inl deleted file mode 100644 index ef096ff62be..00000000000 --- a/ace/Recyclable.inl +++ /dev/null @@ -1,20 +0,0 @@ -// -*- C++ -*- -// -//$Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_Recyclable_State -ACE_Recyclable::recycle_state (void) const -{ - return this->recycle_state_; -} - -ACE_INLINE void -ACE_Recyclable::recycle_state (ACE_Recyclable_State new_state) -{ - if (this->recycle_state_ != ACE_RECYCLABLE_CLOSED) - this->recycle_state_ = new_state; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Refcountable.cpp b/ace/Refcountable.cpp deleted file mode 100644 index 902e4362f65..00000000000 --- a/ace/Refcountable.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// $Id$ - -#include "ace/Refcountable.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Refcountable.inl" -#endif /* __ACE_INLINE __ */ - - -ACE_RCSID (ace, - Refcountable, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Refcountable::~ACE_Refcountable (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Refcountable.h b/ace/Refcountable.h deleted file mode 100644 index 192243bd256..00000000000 --- a/ace/Refcountable.h +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Refcountable.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= -#ifndef ACE_REFCOUNTABLE_H -#define ACE_REFCOUNTABLE_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Refcountable - * - */ -class ACE_Export ACE_Refcountable -{ -public: - /// Destructor. - virtual ~ACE_Refcountable (void); - - // = Increment/Decrement refcount - int increment (void); - int decrement (void); - - /// Returns the current refcount. - int refcount (void) const; - -protected: - /// Protected constructor. - ACE_Refcountable (int refcount); - - /// Current refcount. - int refcount_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - - -#if defined (__ACE_INLINE__) -#include "ace/Refcountable.inl" -#endif /* __ACE_INLINE __ */ - -#include /**/ "ace/post.h" -#endif /*ACE_REFCOUNTABLE_H*/ diff --git a/ace/Refcountable.inl b/ace/Refcountable.inl deleted file mode 100644 index 993af65d452..00000000000 --- a/ace/Refcountable.inl +++ /dev/null @@ -1,31 +0,0 @@ -// -*- C++ -*- -// -//$Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Refcountable::ACE_Refcountable (int refcount) - : refcount_ (refcount) -{ -} - -ACE_INLINE int -ACE_Refcountable::increment (void) -{ - return ++this->refcount_; -} - -ACE_INLINE int -ACE_Refcountable::decrement (void) -{ - return --this->refcount_; -} - -ACE_INLINE int -ACE_Refcountable::refcount (void) const -{ - return this->refcount_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Refcounted_Auto_Ptr.cpp b/ace/Refcounted_Auto_Ptr.cpp deleted file mode 100644 index 7dd9d862b64..00000000000 --- a/ace/Refcounted_Auto_Ptr.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -#ifndef ACE_REFCOUNTED_AUTO_PTR_CPP -#define ACE_REFCOUNTED_AUTO_PTR_CPP - -#include "ace/Refcounted_Auto_Ptr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Refcounted_Auto_Ptr::~ACE_Refcounted_Auto_Ptr (void) -{ - AUTO_REFCOUNTED_PTR_REP::detach (rep_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* !ACE_REFCOUNTED_AUTO_PTR_CPP */ diff --git a/ace/Refcounted_Auto_Ptr.h b/ace/Refcounted_Auto_Ptr.h deleted file mode 100644 index 6367396b9a6..00000000000 --- a/ace/Refcounted_Auto_Ptr.h +++ /dev/null @@ -1,197 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Refcounted_Auto_Ptr.h - * - * $Id$ - * - * @author John Tucker - */ -//============================================================================= - -#ifndef ACE_REFCOUNTED_AUTO_PTR_H -#define ACE_REFCOUNTED_AUTO_PTR_H - -#include /**/ "ace/pre.h" - -#include "ace/Auto_Ptr.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl. -template class ACE_Refcounted_Auto_Ptr_Rep; -template class ACE_Refcounted_Auto_Ptr; - -/** - * @class ACE_Refcounted_Auto_Ptr - * - * @brief This class implements support for a reference counted auto_ptr. - * Assigning or copying instances of an ACE_Refcounted_Auto_Ptr - * will automatically increment the reference count. When the last - * instance that references a ACE_Refcounted_Auto_Ptr instance is - * destroyed or overwritten, it will invoke delete on its underlying - * pointer. - * - * The ACE_Refcounted_Auto_Ptr works by maintaining a reference to a - * separate representation object, ACE_Refcounted_Auto_Ptr_Rep. That - * separate representation object contains the reference count and - * the actual pointer value. - */ -template -class ACE_Refcounted_Auto_Ptr -{ -public: - - // = Initialization and termination methods. - - /// Constructor that initializes an ACE_Refcounted_Auto_Ptr to - /// the specified pointer value. - ACE_Refcounted_Auto_Ptr (X *p = 0); - - /// Copy constructor binds the new ACE_Refcounted_Auto_Ptr to the - /// representation object referenced by @a r. - /// An ACE_Refcounted_Auto_Ptr_Rep is created if necessary. - ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr &r); - - /// Destructor. Releases the reference to the underlying representation. - /// If the release of that reference causes its reference count to reach 0, - /// the representation object will also be destroyed. - virtual ~ACE_Refcounted_Auto_Ptr (void); - - /// Assignment operator that binds the current object and @a r to the same - /// ACE_Refcounted_Auto_Ptr_Rep. An ACE_Refcounted_Auto_Ptr_Rep - /// is created if necessary. - void operator = (const ACE_Refcounted_Auto_Ptr &r); - - /// Equality operator that returns @c true if both - /// ACE_Refcounted_Auto_Ptr objects point to the same underlying - /// representation. It does not compare the actual pointers. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ - bool operator == (const ACE_Refcounted_Auto_Ptr &r) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (const ACE_Refcounted_Auto_Ptr &r) const; - - /// Redirection operator - X *operator-> (void) const; - - /// Accessor method. - X &operator *() const; - - /// Releases the reference to the underlying representation object. - /// @retval The pointer value prior to releasing it. - X *release (void); - - /// Releases the current pointer value and then sets a new - /// pointer value specified by @a p. - void reset (X *p = 0); - - /// Get the pointer value. - X *get (void) const; - - /// Get the reference count value. - int count (void) const; - - /// Returns @c true if this object does not contain a valid pointer. - bool null (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// the ACE_Refcounted_Auto_Ptr_Rep - typedef ACE_Refcounted_Auto_Ptr_Rep AUTO_REFCOUNTED_PTR_REP; - - /// Protect operations on the . - AUTO_REFCOUNTED_PTR_REP *rep_; -}; - -/** - * @class ACE_Refcounted_Auto_Ptr_Rep - * - * @brief An ACE_Refcounted_Auto_Ptr_Rep object encapsulates a pointer - * to an object of type X. It uses a lock object of type ACE_LOCK to protect - * access to the reference count. - * - * @internal ACE_Refcounted_Auto_Ptr_Rep is used internally by the - * ACE_Refcounted_Auto_Ptr class and is only accessible through it. - */ -template -class ACE_Refcounted_Auto_Ptr_Rep -{ -private: - friend class ACE_Refcounted_Auto_Ptr; - - /// Get the pointer value. - X *get (void) const; - - /// Get the reference count value. - int count (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Encapsulate reference count and object lifetime of instances. - // These methods must go after the others to work around a bug with - // Borland's C++ Builder... - - /// Allocate a new ACE_Refcounted_Auto_Ptr_Rep instance, - /// returning NULL if it cannot be created. - static ACE_Refcounted_Auto_Ptr_Rep *internal_create (X *p); - - /// Create a ACE_Refcounted_Auto_Ptr_Rep and initialize - /// the reference count. - static ACE_Refcounted_Auto_Ptr_Rep *create (X *p); - - /// Increase the reference count on @a rep. - /// - /// @retval @a rep if success, 0 if there's an error obtaining the lock - /// on @a rep. - static ACE_Refcounted_Auto_Ptr_Rep *attach (ACE_Refcounted_Auto_Ptr_Rep *&rep); - - /// Decreases the reference count and and deletes rep if there are no - /// more references to rep. - /// - /// Precondition (rep != 0) - static void detach (ACE_Refcounted_Auto_Ptr_Rep *&rep); - - /// Pointer to the result. - ACE_Auto_Basic_Ptr ptr_; - - /// Reference count. - int ref_count_; - - // = Mutex variable to protect the . - - /// Synchronization variable for serializing access to ref_count_ - mutable ACE_LOCK lock_; - -private: - // = Constructor and destructor private. - ACE_Refcounted_Auto_Ptr_Rep (X *p = 0); - ~ACE_Refcounted_Auto_Ptr_Rep (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include "ace/Refcounted_Auto_Ptr.inl" - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Refcounted_Auto_Ptr.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Refcounted_Auto_Ptr.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_REFCOUNTED_AUTO_PTR_H */ diff --git a/ace/Refcounted_Auto_Ptr.inl b/ace/Refcounted_Auto_Ptr.inl deleted file mode 100644 index aa4e3914638..00000000000 --- a/ace/Refcounted_Auto_Ptr.inl +++ /dev/null @@ -1,191 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Guard_T.h" -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template inline int -ACE_Refcounted_Auto_Ptr_Rep::count (void) const -{ - ACE_READ_GUARD_RETURN (ACE_LOCK, guard, this->lock_, 0); - return this->ref_count_; -} - -template inline int -ACE_Refcounted_Auto_Ptr::count (void) const -{ - return this->rep_->count (); -} - -template inline bool -ACE_Refcounted_Auto_Ptr::null (void) const -{ - return (this->rep_ == 0 || this->rep_->get () == 0); -} - -template inline ACE_Refcounted_Auto_Ptr_Rep * -ACE_Refcounted_Auto_Ptr_Rep::internal_create (X *p) -{ - ACE_Refcounted_Auto_Ptr_Rep *temp = 0; - ACE_NEW_RETURN (temp, - (ACE_Refcounted_Auto_Ptr_Rep) (p), - 0); - return temp; -} - -template inline ACE_Refcounted_Auto_Ptr_Rep * -ACE_Refcounted_Auto_Ptr_Rep::create (X *p) -{ - // Yes set ref count to zero. - ACE_Refcounted_Auto_Ptr_Rep *temp = internal_create (p); -#if defined (ACE_NEW_THROWS_EXCEPTIONS) - if (temp == 0) - ACE_throw_bad_alloc; -#else - ACE_ASSERT (temp != 0); -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - return temp; -} - -template inline ACE_Refcounted_Auto_Ptr_Rep * -ACE_Refcounted_Auto_Ptr_Rep::attach (ACE_Refcounted_Auto_Ptr_Rep*& rep) -{ - if (rep == 0) - return 0; - - ACE_WRITE_GUARD_RETURN (ACE_LOCK, guard, rep->lock_, 0); - - ++rep->ref_count_; - - return rep; -} - -template inline void -ACE_Refcounted_Auto_Ptr_Rep::detach (ACE_Refcounted_Auto_Ptr_Rep*& rep) -{ - if (rep == 0) - return; - - ACE_Refcounted_Auto_Ptr_Rep *rep_del = 0; - { - ACE_WRITE_GUARD (ACE_LOCK, guard, rep->lock_); - - if (rep->ref_count_-- == 0) - // Since rep contains the lock held by the ACE_Guard, the guard - // needs to be released before freeing the memory holding the - // lock. So save the pointer to free, then release, then free. - rep_del = rep; - } // Release the lock - if (0 != rep_del) - delete rep; -} - -template inline -ACE_Refcounted_Auto_Ptr_Rep::ACE_Refcounted_Auto_Ptr_Rep (X *p) - : ptr_ (p), - ref_count_ (0) -{ -} - -template inline -ACE_Refcounted_Auto_Ptr_Rep::~ACE_Refcounted_Auto_Ptr_Rep (void) -{ -} - -template inline X * -ACE_Refcounted_Auto_Ptr_Rep::get (void) const -{ - return this->ptr_.get (); -} - -template inline -ACE_Refcounted_Auto_Ptr::ACE_Refcounted_Auto_Ptr (X *p) - : rep_ (AUTO_REFCOUNTED_PTR_REP::create (p)) -{ -} - -template inline -ACE_Refcounted_Auto_Ptr::ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr &r) - : rep_ (AUTO_REFCOUNTED_PTR_REP::attach (((ACE_Refcounted_Auto_Ptr &) r).rep_)) -{ -} - -template inline bool -ACE_Refcounted_Auto_Ptr::operator== (const ACE_Refcounted_Auto_Ptr &r) const -{ - return r.rep_ == this->rep_; -} - -template inline bool -ACE_Refcounted_Auto_Ptr::operator!= (const ACE_Refcounted_Auto_Ptr &r) const -{ - return r.rep_ != this->rep_; -} - -template inline X * -ACE_Refcounted_Auto_Ptr::operator-> (void) const -{ - return this->rep_->get(); -} - -template inline X & -ACE_Refcounted_Auto_Ptr::operator *() const -{ - return *this->rep_->get (); -} - -template inline X* -ACE_Refcounted_Auto_Ptr::get (void) const -{ - // We return the ACE_Future_rep. - return this->rep_->get (); -} - -template inline X * -ACE_Refcounted_Auto_Ptr::release (void) -{ - X *p = this->get (); - AUTO_REFCOUNTED_PTR_REP::detach (this->rep_); - this->rep_ = 0; - return p; -} - -template inline void -ACE_Refcounted_Auto_Ptr::reset (X *p) -{ - // Avoid deleting the underlying auto_ptr if assigning the same actual - // pointer value. - if (this->get () == p) - return; - - AUTO_REFCOUNTED_PTR_REP *old_rep = this->rep_; - if ((this->rep_ = AUTO_REFCOUNTED_PTR_REP::create (p)) != 0) - AUTO_REFCOUNTED_PTR_REP::detach (old_rep); - else - this->rep_ = old_rep; - return; -} - -template inline void -ACE_Refcounted_Auto_Ptr::operator = (const ACE_Refcounted_Auto_Ptr &rhs) -{ - // bind to the same as . - AUTO_REFCOUNTED_PTR_REP *old_rep = this->rep_; - if (rhs.rep_ != 0) - { - this->rep_ = AUTO_REFCOUNTED_PTR_REP::attach - (const_cast& > (rhs).rep_); - if (this->rep_ != 0) - AUTO_REFCOUNTED_PTR_REP::detach (old_rep); - } - else // Assign a 0 rep to this - { - AUTO_REFCOUNTED_PTR_REP::detach (old_rep); - this->rep_ = 0; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Registry.cpp b/ace/Registry.cpp deleted file mode 100644 index 2e6803ea8cd..00000000000 --- a/ace/Registry.cpp +++ /dev/null @@ -1,1139 +0,0 @@ -// $Id$ - -#include "ace/Registry.h" - -ACE_RCSID (ace, - Registry, - "$Id$") - -#if defined (ACE_WIN32) - -# include "ace/os_include/os_netdb.h" -# include "ace/OS_NS_unistd.h" - -// Funky macro to deal with strange error passing semantics -// of Win32 Reg*() functions -#define ACE_REGISTRY_CALL_RETURN(X) \ - do { \ - if (X != ERROR_SUCCESS) \ - { \ - errno = X; \ - return -1; \ - } \ - else \ - return 0; \ - } while (0) - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_TCHAR const ACE_Registry::STRING_SEPARATOR[] = ACE_LIB_TEXT ("\\"); - -bool -ACE_Registry::Name_Component::operator== (const Name_Component &rhs) const -{ - return - rhs.id_ == this->id_ && - rhs.kind_ == this->kind_; -} - -bool -ACE_Registry::Name_Component::operator!= (const Name_Component &rhs) const -{ - return !this->operator== (rhs); -} - -// Simple binding constructor -ACE_Registry::Binding::Binding () - : name_ (), - type_ (INVALID) -{ -} - - -// Binding constructor -// (Name version) -ACE_Registry::Binding::Binding (const Name &name, - Binding_Type type) - : name_ (ACE_Registry::make_string (name)), - type_ (type) -{ -} - - -// Binding constructor -// (String version) -ACE_Registry::Binding::Binding (const ACE_TString &name, - Binding_Type type) - : name_ (name), - type_ (type) -{ -} - - -bool -ACE_Registry::Binding::operator== (const Binding &rhs) const -{ - return - rhs.name_ == this->name_ && - rhs.type_ == this->type_; -} - -bool -ACE_Registry::Binding::operator!= (const Binding &rhs) const -{ - return !this->operator== (rhs); -} - -// Name accessor -// (Name version) -void -ACE_Registry::Binding::name (Name &name) -{ - name = ACE_Registry::make_name (this->name_); -} - - -// Name accessors -// (String version) -void -ACE_Registry::Binding::name (ACE_TString &name) -{ - name = this->name_; -} - - -// Name accessors -// (String version) -ACE_TString -ACE_Registry::Binding::name (void) -{ - return this->name_; -} - - -// Type accessor -ACE_Registry::Binding_Type -ACE_Registry::Binding::type (void) -{ - return this->type_; -} - - -// Simple object constructor -ACE_Registry::Object::Object (void *data, - u_long size, - u_long type) - : data_ (data), - size_ (size), - type_ (type) -{ -} - -// Object accessors and set methods -void -ACE_Registry::Object::data (void *data) -{ - this->data_ = data; -} - - -void * -ACE_Registry::Object::data (void) const -{ - return this->data_; -} - - -void -ACE_Registry::Object::size (u_long size) -{ - this->size_ = size; -} - - -u_long -ACE_Registry::Object::size (void) const -{ - return this->size_; -} - - -void -ACE_Registry::Object::type (u_long type) -{ - this->type_ = type; -} - - -u_long -ACE_Registry::Object::type (void) const -{ - return this->type_; -} - - -// Simple context constructor -ACE_Registry::Naming_Context::Naming_Context (void) - : key_ ((HKEY) 0), - parent_key_ ((HKEY) 0), - name_ () -{ -} - - -// Context constructor -ACE_Registry::Naming_Context::Naming_Context (const HKEY &key) - : key_ (key), - parent_key_ ((HKEY) 0), - name_ () -{ -} - - -ACE_Registry::Naming_Context::Naming_Context (const Naming_Context &rhs) - : key_ (rhs.key_), - parent_key_ (rhs.parent_key_), - name_ (rhs.name_) -{ - // This is incorrect. - // Rather than copying key, we should call ::DuplicateHandle() - // But since this is private (and not used), I don't care much -} - - -const ACE_Registry::Naming_Context & -ACE_Registry::Naming_Context::operator= (const Naming_Context &rhs) -{ - ACE_UNUSED_ARG(rhs); - - // Not implemented - return *this; -} - - -// Destructor -ACE_Registry::Naming_Context::~Naming_Context () -{ - this->close (); -} - - -// Insert with into context -// (Name version) -int -ACE_Registry::Naming_Context::bind_new (const Name &name, - const Object &object) -{ - return this->bind_new (ACE_Registry::make_string (name), object); -} - - -// Insert with into context -// (String version) -int -ACE_Registry::Naming_Context::bind_new (const ACE_TString &name, - const Object &object) -{ - // temporary object - Object temp; - long result = this->resolve (name, temp); - if (result == 0) - // resolve succeeded - result = -1; - else - // resolve failed - result = this->bind (name, object); - return result; -} - - -// Insert or update with into context -// (Name version) -int -ACE_Registry::Naming_Context::bind (const Name &name, - const Object &object) -{ - return this->bind (ACE_Registry::make_string (name), object); -} - - -// Insert or update with into context -// (String version) -int -ACE_Registry::Naming_Context::bind (const ACE_TString &name, - const Object &object) -{ - long result = ACE_TEXT_RegSetValueEx (this->key_, - name.c_str (), - 0, - object.type (), - (const BYTE *) object.data (), - object.size ()); - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Update with in context -// (Name version) -int -ACE_Registry::Naming_Context::rebind (const Name &name, - const Object &new_object) -{ - return this->rebind (ACE_Registry::make_string (name), new_object); -} - - -// Update with in context -// (String version) -int -ACE_Registry::Naming_Context::rebind (const ACE_TString &name, - const Object &new_object) -{ - Object old_object; - // find the old one first - long result = this->resolve (name, old_object); - if (result == 0) - // no need to delete first - result = this->bind (name, new_object); - return result; -} - - -// Find with in context -// (Name version) -int -ACE_Registry::Naming_Context::resolve (const Name &name, - Object &object) -{ - return this->resolve (ACE_Registry::make_string (name), object); -} - - -// Find with in context -// (String version) -int -ACE_Registry::Naming_Context::resolve (const ACE_TString &name, - Object &object) -{ - // Get object state - u_long type; - void *data = object.data (); - u_long size = object.size (); - - long result = ACE_TEXT_RegQueryValueEx (this->key_, - name.c_str (), - 0, - &type, - (BYTE *)data, - &size); - if (result == ERROR_SUCCESS) - { - // Reset object state - // No need to set object.data() - object.type (type); - object.size (size); - } - - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Remove object with in context -// (Name version) -int -ACE_Registry::Naming_Context::unbind (const Name &name) -{ - return this->unbind (ACE_Registry::make_string (name)); -} - - -// Remove object with in context -// (String version) -int -ACE_Registry::Naming_Context::unbind (const ACE_TString &name) -{ - long result = ACE_TEXT_RegDeleteValue (this->key_, - name.c_str ()); - - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Create new relative to context -// This method may not mean a lot in this implementation -int -ACE_Registry::Naming_Context::new_context (Naming_Context &naming_context) -{ - // Make sure that we reset the state and close keys - return naming_context.close (); -} - - -// Insert with relative to context -// (Name version) -int -ACE_Registry::Naming_Context::bind_new_context (const Name &name, - Naming_Context &naming_context, - u_long persistence, - u_long security_access, - LPSECURITY_ATTRIBUTES security_attributes) -{ - return this->bind_new_context (ACE_Registry::make_string (name), - naming_context, - persistence, - security_access, - security_attributes); -} - - -// Insert with relative to context -// (String version) -int -ACE_Registry::Naming_Context::bind_new_context (const ACE_TString &name, - Naming_Context &naming_context, - u_long persistence, - u_long security_access, - LPSECURITY_ATTRIBUTES security_attributes) -{ - u_long reason; - - long result = ACE_TEXT_RegCreateKeyEx (this->key_, - name.c_str (), - 0, - 0, - persistence, - security_access, - security_attributes, - &naming_context.key_, - &reason); - if (result == ERROR_SUCCESS) - // If create succeeds - { - if (reason == REG_CREATED_NEW_KEY) - // If new key: success - { - // Set the correct parent - naming_context.parent (this->key_); - // Set the correct name - naming_context.name (name); - } - else - // reason == REG_OPENED_EXISTING_KEY - // Failed to make new key - { - // reset result to failure - result = -1; - // Close the key first - ::RegCloseKey (naming_context.key_); - // Reset key - naming_context.key_ = (HKEY) 0; - } - } - - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Insert or update with relative to context -// (Name version) -int -ACE_Registry::Naming_Context::bind_context (const Name &name, - /* const */ Naming_Context &naming_context, - u_long persistence, - u_long security_access, - LPSECURITY_ATTRIBUTES security_attributes) -{ - return this->bind_context (ACE_Registry::make_string (name), - naming_context, - persistence, - security_access, - security_attributes); -} - - -// Insert or update with relative to context -// (String version) -int -ACE_Registry::Naming_Context::bind_context (const ACE_TString &name, - /* const */ Naming_Context &naming_context, - u_long persistence, - u_long security_access, - LPSECURITY_ATTRIBUTES security_attributes) -{ - u_long reason; - - long result = ACE_TEXT_RegCreateKeyEx (this->key_, - name.c_str (), - 0, - 0, - persistence, - security_access, - security_attributes, - &naming_context.key_, - &reason); - if (result == ERROR_SUCCESS) - { - // Set the correct parent - naming_context.parent (this->key_); - // Set the correct name - naming_context.name (name); - } - - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Rename to -// (Name version) -int -ACE_Registry::Naming_Context::rebind_context (const Name &name, - /* const */ Naming_Context &new_naming_context) -{ - return this->rebind_context (ACE_Registry::make_string (name), - new_naming_context); -} - - -// Rename to -// (String version) -int -ACE_Registry::Naming_Context::rebind_context (const ACE_TString &name, - /* const */ Naming_Context &new_naming_context) -{ - Naming_Context old_naming_context; - // find the old one first - long result = this->resolve_context (name, - old_naming_context); - if (result == 0) - { - // naming_context is found: delete entry - result = this->unbind_context (name); - if (result == 0) - { - // successful deletion; rebind - // beware of race conditions here - // (lets resolve this later) - result = this->bind_new_context (name, new_naming_context); - } - } - return result; -} - - -// Remove naming_context with from context -// (Name version) -int -ACE_Registry::Naming_Context::unbind_context (const Name &name) -{ - return this->unbind_context (ACE_Registry::make_string (name)); -} - - -// Remove naming_context with from context -// (String version) -int -ACE_Registry::Naming_Context::unbind_context (const ACE_TString &name) -{ - long result = ACE_TEXT_RegDeleteKey (this->key_, - name.c_str ()); - - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Find with in context -// (Name version) -int -ACE_Registry::Naming_Context::resolve_context (const Name &name, - Naming_Context &naming_context, - u_long security_access) -{ - return this->resolve_context (ACE_Registry::make_string (name), - naming_context, - security_access); -} - - -// Find with in context -// (String version) -int -ACE_Registry::Naming_Context::resolve_context (const ACE_TString &name, - Naming_Context &naming_context, - u_long security_access) -{ - long result = ACE_TEXT_RegOpenKeyEx (this->key_, - name.c_str (), - 0, - security_access, - &naming_context.key_); - if (result == ERROR_SUCCESS) - { - // set the correct parent - naming_context.parent (this->key_); - // set the correct name - naming_context.name (name); - } - - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Same as unbind_context() with as naming_context -int -ACE_Registry::Naming_Context::destroy (void) -{ - // hopefully the parent_key_ is still open - long result = ACE_TEXT_RegDeleteKey (this->parent_key_, - this->name_.c_str ()); - - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Sync content of context to disk -int -ACE_Registry::Naming_Context::flush (void) -{ - long result = ::RegFlushKey (this->key_); - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Close the handle of the context -int -ACE_Registry::Naming_Context::close (void) -{ - long result = this->key_ ? ::RegCloseKey (this->key_) : ERROR_SUCCESS; - ACE_REGISTRY_CALL_RETURN (result); -} - - -// Convert a to a -ACE_TString -ACE_Registry::make_string (const Name &const_name) -{ - ACE_TString string; - Name &name = const_cast (const_name); - - // Iterator through the components of name - for (Name::iterator iterator = name.begin (); - iterator != name.end (); - iterator++) - { - if (iterator != name.begin ()) - // If this is not the first component, we will add separators - string += STRING_SEPARATOR; - const Name_Component &component = *iterator; - // Add to string - string += component.id_; - } - - return string; -} - - -// Convert a to a -ACE_Registry::Name -ACE_Registry::make_name (const ACE_TString &string) -{ - ACE_TString::size_type new_position = 0; - ACE_TString::size_type last_position = 0; - Name name; - - // Rememeber: NPOS is -1 - while (new_position != ACE_TString::npos) - { - Name_Component component; - // Find the separator - new_position = string.find (STRING_SEPARATOR, new_position); - if (new_position != ACE_TString::npos) - // If we have not gone past the end - { - // Get the substring - component.id_ = string.substr (last_position, - new_position - last_position); - // Skip past the seperator - new_position += - ACE_OS::strlen (STRING_SEPARATOR); - } - else - { - // Get the last substring - component.id_ = string.substr (last_position); - } - // Update positions - last_position = new_position; - // Insert component into name - name.insert (component); - } - - return name; -} - - -// Set key -void -ACE_Registry::Naming_Context::key (HKEY key) -{ - this->key_ = key; -} - - -// Get key -HKEY -ACE_Registry::Naming_Context::key (void) -{ - return this->key_; -} - - -// Set parent -void -ACE_Registry::Naming_Context::parent (HKEY parent) -{ - this->parent_key_ = parent; -} - - -// Get parent -HKEY -ACE_Registry::Naming_Context::parent (void) -{ - return this->parent_key_; -} - - -// Set name -// (Name version) -void -ACE_Registry::Naming_Context::name (const Name &name) -{ - this->name_ = ACE_Registry::make_string (name); -} - - -// Get name -// (Name version) -void -ACE_Registry::Naming_Context::name (Name &name) -{ - name = ACE_Registry::make_name (this->name_); -} - - -// Set name -// (String version) -void -ACE_Registry::Naming_Context::name (const ACE_TString &name) -{ - this->name_ = name; -} - - -// Get name -// (String version) -ACE_TString -ACE_Registry::Naming_Context::name (void) -{ - return this->name_; -} - - -// Get name -// (String version) -void -ACE_Registry::Naming_Context::name (ACE_TString &name) -{ - name = this->name_; -} - - -// listing function: iterator creator -// This is useful when there are many objects and contexts -// in context and you only want to look at a few entries -// at a time -int -ACE_Registry::Naming_Context::list (u_long how_many, - Binding_List &list, - Binding_Iterator &iter) -{ - // Empty list - static const ACE_Registry::Binding_List empty_list; - // Make sure that the list is empty - list = empty_list; - - // Correctly initalize the iterator - iter.reset (); - - // Make sure that the iterator uses naming context - iter.naming_context (*this); - - // Start iterations from the objects - iter.current_enumeration (iter.object_iteration_); - - // Get the next values - long result = iter.next_n (how_many, - list); - return result; -} - - -// listing function: iterator creator -// This gives back a listing of all entries in context. -int -ACE_Registry::Naming_Context::list (Binding_List &list) -{ - // Empty list - static const ACE_Registry::Binding_List empty_list; - // Make sure that the list is empty - list = empty_list; - - // Create an iterator - ACE_Registry::Binding_Iterator iterator; - - // Make sure that the iterator uses naming context - iterator.naming_context (*this); - - // Start iterations from the objects - iterator.current_enumeration (iterator.object_iteration_); - - long result = 0; - while (1) - { - ACE_Registry::Binding binding; - result = iterator.next_one (binding); - if (result == 0) - list.insert (binding); - else - break; - } - return 0; -} - - -// Default constructor -ACE_Registry::Binding_Iterator::Binding_Iterator () - : object_iteration_ (*this), - context_iteration_ (*this), - iteration_complete_ (*this) -{ - this->reset (); -} - - -void -ACE_Registry::Binding_Iterator::reset () -{ - this->current_enumeration_ = &this->iteration_complete_; - this->iteration_complete_.reset (); - this->object_iteration_.reset (); - this->context_iteration_.reset (); -} - - -void -ACE_Registry::Binding_Iterator::Iteration_State::reset () -{ - this->index_ = 0; -} - - -ACE_Registry::Binding_Iterator::Iteration_State::Iteration_State (Binding_Iterator &iter) - : parent_ (&iter), - index_ (0) -{ -} - - -ACE_Registry::Binding_Iterator::Object_Iteration::Object_Iteration (Binding_Iterator &iter) - : Iteration_State (iter) -{ -} - - -ACE_Registry::Binding_Iterator::Context_Iteration::Context_Iteration (Binding_Iterator &iter) - : Iteration_State (iter) -{ -} - - -ACE_Registry::Binding_Iterator::Iteration_Complete::Iteration_Complete (Binding_Iterator &iter) - : Iteration_State (iter) -{ -} - - -// Next entry -int -ACE_Registry::Binding_Iterator::next_one (Binding &binding) -{ - u_long how_many = 1; - Binding_List list; - - // Get next n (where n is one) - long result = this->next_n (how_many, list); - - if (result == 0) - // Success - binding = (*list.begin ()); - - return result; -} - - -// Next entries -int -ACE_Registry::Binding_Iterator::next_n (u_long how_many, - Binding_List &list) -{ - // Empty list - static const ACE_Registry::Binding_List empty_list; - // Make sure that the list is empty - list = empty_list; - - return this->current_enumeration_->next_n (how_many, list); -} - - -// Destroy iterator -int -ACE_Registry::Binding_Iterator::destroy (void) -{ - this->reset (); - return 0; -} - - -// Set/Get naming_context -void -ACE_Registry::Binding_Iterator::naming_context (Naming_Context &naming_context) -{ - this->naming_context_ = &naming_context; -} - - -ACE_Registry::Naming_Context & -ACE_Registry::Binding_Iterator::naming_context (void) -{ - return *this->naming_context_; -} - - -// Set/Get current enumeration -void -ACE_Registry::Binding_Iterator::current_enumeration (Iteration_State ¤t_enumeration) -{ - this->current_enumeration_ = ¤t_enumeration; -} - - -ACE_Registry::Binding_Iterator::Iteration_State & -ACE_Registry::Binding_Iterator::current_enumeration (void) -{ - return *this->current_enumeration_; -} - - -int -ACE_Registry::Binding_Iterator::Object_Iteration::next_n (u_long how_many, - Binding_List &list) -{ - // Make a copy - u_long requested = how_many; - - // While there are more entries to be added to the list - while (how_many > 0) - { - ACE_TCHAR string [ACE_Registry::Naming_Context::MAX_OBJECT_NAME_SIZE]; - u_long size = sizeof string / sizeof (ACE_TCHAR); - long result = ACE_TEXT_RegEnumValue (this->parent_->naming_context ().key (), - this->index_, - string, - &size, - 0, - 0, - 0, - 0); - switch (result) - { - case ERROR_SUCCESS: - // Object found - { - // Readjust counters - this->index_++; - how_many--; - - // Add to list - // Create binding - Binding binding (string, OBJECT); - // Add to binding list - list.insert (binding); - } - // Continue to add to list - break; - - case ERROR_NO_MORE_ITEMS: - // Enumeration of objects complete - // Reset index - this->index_ = 0; - - // Current enumeration will become CONTEXTS - this->parent_->current_enumeration (this->parent_->context_iteration_); - result = this->parent_->current_enumeration ().next_n (how_many, - list); - // If we were able to add objects - if (requested != how_many) - return 0; - else - return result; - - default: - // Strange error - // Reset index - this->index_ = 0; - // Current enumeration will become COMPLETE - this->parent_->current_enumeration (this->parent_->iteration_complete_); - // strange error - return -1; - } - } - // If we reach here, all of pairs were added to the list - // Since more entries may be available - // current enumeration will remain OBJECTS - return 0; -} - - -int -ACE_Registry::Binding_Iterator::Context_Iteration::next_n (u_long how_many, - Binding_List &list) -{ - // Make a copy - u_long requested = how_many; - - // While there are more entries to be added to the list - while (how_many > 0) - { - ACE_TCHAR string [ACE_Registry::Naming_Context::MAX_CONTEXT_NAME_SIZE]; - u_long size = sizeof string / sizeof (ACE_TCHAR); - long result = ACE_TEXT_RegEnumKeyEx (this->parent_->naming_context (). key (), - this->index_, - string, - &size, - 0, - 0, - 0, - 0); - switch (result) - { - case ERROR_SUCCESS: - // Object found - { - // Readjust counters - this->index_++; - how_many--; - - // Add to list - // Create binding - Binding binding (string, CONTEXT); - // Add to binding list - list.insert (binding); - } - // Continue to add to list - break; - - case ERROR_NO_MORE_ITEMS: - // Enumeration of objects complete - - /* FALL THROUGH */ - - default: - // Strange error - - // Reset index - this->index_ = 0; - // Current enumeration will become CONTEXTS - this->parent_->current_enumeration (this->parent_->iteration_complete_); - - // If we were able to add contexts - if (requested != how_many) - return 0; - else - return -1; - } - } - // If we reach here, all of pairs were added to the list - // Since more entries may be available - // current enumeration will remain CONTEXTS - return 0; -} - - -int -ACE_Registry::Binding_Iterator::Iteration_Complete::next_n (u_long how_many, - Binding_List &list) -{ - ACE_UNUSED_ARG(list); - ACE_UNUSED_ARG(how_many); - - // No more values - return -1; -} - - -// Factory method to connect to predefined registries -// This method works for both remote and local machines -// However, for remote machines CLASSES_ROOT and CURRENT_USER -// types are not allowed -/* static */ -int -ACE_Predefined_Naming_Contexts::connect (ACE_Registry::Naming_Context &naming_context, - HKEY predefined, - const ACE_TCHAR *machine_name) -{ -#if defined (ACE_HAS_WINCE) - return -1; -#else - long result = -1; - - if (machine_name != 0 && ACE_OS::strcmp (ACE_LIB_TEXT ("localhost"), machine_name) == 0) - machine_name = 0; - - if (predefined == HKEY_LOCAL_MACHINE || predefined == HKEY_USERS) - result = - ACE_TEXT_RegConnectRegistry (const_cast (machine_name), - predefined, - &naming_context.key_); - if (predefined == HKEY_CURRENT_USER || predefined == HKEY_CLASSES_ROOT) - // Make sure that for these types, the machine is local - if (machine_name == 0 || - ACE_Predefined_Naming_Contexts::is_local_host (machine_name)) - { - naming_context.key_ = predefined; - result = 0; - } - else - result = -1; - - ACE_REGISTRY_CALL_RETURN (result); -#endif // ACE_HAS_WINCE -} - -// Check if is the local host -/* static */ -int -ACE_Predefined_Naming_Contexts::is_local_host (const ACE_TCHAR *machine_name) -{ - ACE_TCHAR local_host[MAXHOSTNAMELEN]; - int result = ACE_OS::hostname (local_host, sizeof local_host / sizeof (ACE_TCHAR)); - if (result == 0) - result = !ACE_OS::strcmp (local_host, machine_name); - else - result = 0; - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 */ diff --git a/ace/Registry.h b/ace/Registry.h deleted file mode 100644 index 5b06517655b..00000000000 --- a/ace/Registry.h +++ /dev/null @@ -1,563 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Registry.h - * - * $Id$ - * - * @author Irfan Pyarali (irfan@cs.wustl.edu) - */ -//============================================================================= - - -#ifndef ACE_REGISTRY_H -#define ACE_REGISTRY_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_WIN32) -// This only works on Win32 platforms - -#include "ace/Containers.h" -#include "ace/SString.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Registry - * - * @brief A Name Server implementation - * - * The registry interface is inspired by the interface - * specified in the CORBA Naming Service Specification. - * The implementation is done through Win32 functions. - * Other than providing an OO wrapper for the Win32 - * functions, ACE_Registry provides an abstraction for iteration - * over the elements of the Registry. - */ -class ACE_Export ACE_Registry -{ -public: - - /// International string - struct ACE_Export Name_Component - { - ACE_TString id_; - ACE_TString kind_; - - bool operator== (const Name_Component &rhs) const; - bool operator!= (const Name_Component &rhs) const; - // Comparison - }; - // The field is used, - // but the field is currently ignored - - /// A Name is an ordered collections of components (ids) - typedef ACE_Unbounded_Set Name; - - /// Separator for components in a name - static const ACE_TCHAR STRING_SEPARATOR[]; - - /// Convert a @a name to a @c string - static ACE_TString make_string (const Name &name); - - /// Convert a @a string to a @c name - static Name make_name (const ACE_TString &string); - - /// There are two types of bindings - enum Binding_Type {INVALID, OBJECT, CONTEXT}; - - struct ACE_Export Binding - { - /// Empty (default) constructor - Binding (void); - - /// Constructor - /// (Name version) - Binding (const Name &binding_name, - Binding_Type binding_type); - - /// Constructor - /// (String version) - Binding (const ACE_TString &binding_name, - Binding_Type binding_type); - - bool operator== (const Binding &rhs) const; - bool operator!= (const Binding &rhs) const; - // Comparison - - /// Name accessor - /// (Name version) - void name (Name &name); - - /// Set Name (String version) - void name (ACE_TString &name); - - /// Get Name (String version) - ACE_TString name (void); - - /// Type accessor - Binding_Type type (void); - - private: - /// A binding has a name - ACE_TString name_; - - /// .... and a type - Binding_Type type_; - }; - - /// A list of bindings - typedef ACE_Unbounded_Set Binding_List; - - // Forward declaration of iterator - class Binding_Iterator; - - /** - * @class Object - * - * @brief An object representation - * - * In CORBA, all objects inherit from (CORBA::Object). - * For the registry, this is used as a wrapper for an - * instance of a built-in data type. - * Think about an object as being similar to a file - * in a file system. - */ - class ACE_Export Object - { - public: - /// Default constructor - Object (void *data = 0, - u_long size = 0, - u_long type = REG_NONE); - - /// Set data - void data (void *data); - - /// Get data - void *data (void) const; - - /// Set size - void size (u_long size); - - /// Get size - u_long size (void) const; - - /// Set type - void type (u_long type); - - /// Get type - u_long type (void) const; - - private: - /// Pointer to data - void *data_; - - /// Size of the data - u_long size_; - - /// Type of data - u_long type_; - }; - - /** - * @class Naming_Context - * - * @brief An context representation - * - * Think about a context as being similar to a directory - * in a file system. - */ - class ACE_Export Naming_Context - { - public: - /// Friend factory - friend class ACE_Predefined_Naming_Contexts; - - enum { - /// Max sizes of names - /// (Not too sure about this value) - MAX_OBJECT_NAME_SIZE = BUFSIZ, - - /// Max size of context name - MAX_CONTEXT_NAME_SIZE = MAXPATHLEN + 1 - }; - - /// Empty constructor: keys will be NULL - Naming_Context (void); - - /// Constructor: key_ will be set to - Naming_Context (const HKEY &key); - - /// Destructor will call . - ~Naming_Context (void); - - // The following interfaces are for objects - - /** - * Insert @a object with @a name into @c this context. - * This will fail if @a name already exists - * (Name version) - */ - int bind_new (const Name &name, - const Object &object); - - /** - * Insert @a object with @a name into @c this context - * This will fail if @a name already exists - * (String version) - */ - int bind_new (const ACE_TString &name, - const Object &object); - - /** - * Insert or update @a object with @a name into @c this context - * This will not fail if @a name already exists - * (Name version) - */ - int bind (const Name &name, - const Object &object); - - /** - * Insert or update with into context - * This will not fail if already exists - * (String version) - */ - int bind (const ACE_TString &name, - const Object &object); - - /// Update with in context - /// (Name version) - int rebind (const Name &name, - const Object &object); - - /// Update with in context - int rebind (const ACE_TString &name, - const Object &object); - - /// Find with in context - /// (Name version) - int resolve (const Name &name, - Object &object); - - /// Find with in context - int resolve (const ACE_TString &name, - Object &object); - - /// Delete object with in context - /// (Name version) - int unbind (const Name &name); - - /// Delete object with in context - int unbind (const ACE_TString &name); - - - // The following interfaces are for Naming Context - - /// Create new @c naming_context - int new_context (Naming_Context &naming_context); - - /** - * Insert with relative to context - * This will fail if already exists - * (Name version) - */ - int bind_new_context (const Name &name, - Naming_Context &naming_context, - u_long persistence = REG_OPTION_NON_VOLATILE, - u_long security_access = KEY_ALL_ACCESS, - LPSECURITY_ATTRIBUTES security_attributes = 0); - - /// Insert with relative to context - /// This will fail if already exists - int bind_new_context (const ACE_TString &name, - Naming_Context &naming_context, - u_long persistence = REG_OPTION_NON_VOLATILE, - u_long security_access = KEY_ALL_ACCESS, - LPSECURITY_ATTRIBUTES security_attributes = 0); - - /** - * Insert or update with relative to context - * This will not fail if already exists - * (Name version) - */ - int bind_context (const Name &name, - /* const */ Naming_Context &naming_context, - u_long persistence = REG_OPTION_NON_VOLATILE, - u_long security_access = KEY_ALL_ACCESS, - LPSECURITY_ATTRIBUTES security_attributes = 0); - - /// Insert or update with relative to context - /// This will not fail if already exists - int bind_context (const ACE_TString &name, - /* const */ Naming_Context &naming_context, - u_long persistence = REG_OPTION_NON_VOLATILE, - u_long security_access = KEY_ALL_ACCESS, - LPSECURITY_ATTRIBUTES security_attributes = 0); - - /// Rename to - /// (Name version) - int rebind_context (const Name &name, - /* const */ Naming_Context &naming_context); - - /// Rename to - int rebind_context (const ACE_TString &name, - /* const */ Naming_Context &naming_context); - - /// Find with in context - /// (Name version) - int resolve_context (const Name &name, - Naming_Context &naming_context, - u_long security_access = KEY_ALL_ACCESS); - - /// Find with in context - int resolve_context (const ACE_TString &name, - Naming_Context &naming_context, - u_long security_access = KEY_ALL_ACCESS); - - /// Remove naming_context with from context - /// (Name version) - int unbind_context (const Name &name); - - /// Remove naming_context with from context - int unbind_context (const ACE_TString &name); - - /// Same as with as naming_context - int destroy (void); - - /** - * listing function: iterator creator - * This is useful when there are many objects and contexts - * in context and you only want to look at a few entries - * at a time - */ - int list (u_long how_many, - Binding_List &list, - Binding_Iterator &iterator); - - /// listing function: iterator creator - /// This gives back a listing of all entries in context. - int list (Binding_List &list); - - // Some other necessary functions which are - // not part of the CORBA interface - - /// Sync content of context to disk - int flush (void); - - /// Close the handle of the context - /// @note does not call - int close (void); - - // Accessors - - /// Get key - HKEY key (void); - - // void parent (HKEY parent); - /// Get parent - HKEY parent (void); - - /// Get name - /// (Name version) - void name (Name &name); - - /// Set name (String version) - void name (ACE_TString &name); - - /// Get name (String version) - ACE_TString name (void); - - protected: - /// Set key - void key (HKEY key); - - /// Set parent - void parent (HKEY parent); - - /// Set name - /// (Name version) - void name (const Name &name); - - /// Set name - /// (String version) - void name (const ACE_TString &name); - - private: - /// Disallow copy constructors - Naming_Context (const Naming_Context &rhs); - - /// Disallow assignment - const Naming_Context &operator= (const Naming_Context &rhs); - - /// Key for self - HKEY key_; - - /// Key for parent - HKEY parent_key_; - - /// Name of self - ACE_TString name_; - }; - - /** - * @class Binding_Iterator - * - * @brief An iterator - * - * Useful when iteratorating over a few entries at a time - */ - class ACE_Export Binding_Iterator - { - public: - /// Friend factory - friend class Naming_Context; - - /// Default constructor - Binding_Iterator (void); - - /// Next entry - int next_one (Binding &binding); - - /// Next entries - int next_n (u_long how_many, - Binding_List &list); - - /// Cleanup - int destroy (void); - - /// Reset the internal state of the iterator - void reset (void); - - /// Get naming_context that the iterator is iterating over - Naming_Context &naming_context (void); - - private: - - /// Set naming_context that the iterator is iterating over - void naming_context (Naming_Context& naming_context); - - /// Reference to context - Naming_Context *naming_context_; - - public: - // This should really be private - // But the compiler is broken - - /** - * @class Iteration_State - * - * Base class for state - */ - class ACE_Export Iteration_State - { - public: - /// Constructor - Iteration_State (Binding_Iterator &iterator); - - /// Next entries - virtual int next_n (u_long how_many, - Binding_List &list) = 0; - - /// Reset state - void reset (void); - - protected: - /// Pointer to parent iterator - Binding_Iterator *parent_; - - u_long index_; - }; - - private: - class ACE_Export Object_Iteration : public Iteration_State - { - public: - Object_Iteration (Binding_Iterator &iterator); - - /// Next entries - int next_n (u_long how_many, - Binding_List &list); - }; - - class ACE_Export Context_Iteration : public Iteration_State - { - public: - Context_Iteration (Binding_Iterator &iterator); - - /// Next @a how_many entries - int next_n (u_long how_many, - Binding_List &list); - }; - - class ACE_Export Iteration_Complete : public Iteration_State - { - public: - Iteration_Complete (Binding_Iterator &iterator); - - /// Next @a how_many entries - int next_n (u_long how_many, - Binding_List &list); - }; - - /// Friend states - friend class Iteration_State; - friend class Object_Iteration; - friend class Context_Iteration; - friend class Iteration_Complete; - - /// Instances of all states - Object_Iteration object_iteration_; - Context_Iteration context_iteration_; - Iteration_Complete iteration_complete_; - - /// Pointer to current state - Iteration_State *current_enumeration_; - - /// Set current_enumeration - void current_enumeration (Iteration_State& current_enumeration); - - /// Get current_enumeration - Iteration_State ¤t_enumeration (void); - }; -}; - -/** - * @class ACE_Predefined_Naming_Contexts - * - * @brief A factory for predefined registries, which exist by default - * on Win32 platforms - * - * This factory can connect to both local and remote - * predefined registries. - */ -class ACE_Export ACE_Predefined_Naming_Contexts -{ -public: - /** - * Factory method for connecting to predefined registries. This - * method works for both remote and local machines. However, for - * remote machines, HKEY_CLASSES_ROOT and HKEY_CURRENT_USER types - * are not allowed - */ - static int connect (ACE_Registry::Naming_Context &naming_context, - HKEY predefined = HKEY_LOCAL_MACHINE, - const ACE_TCHAR *machine_name = 0); - -private: - /// Check if @a machine_name is the local host - static int is_local_host (const ACE_TCHAR *machine_name); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 */ -#include /**/ "ace/post.h" -#endif /* ACE_REGISTRY_H */ diff --git a/ace/Registry_Name_Space.cpp b/ace/Registry_Name_Space.cpp deleted file mode 100644 index e382af8482e..00000000000 --- a/ace/Registry_Name_Space.cpp +++ /dev/null @@ -1,293 +0,0 @@ -// $Id$ - -#include "ace/Registry_Name_Space.h" - -ACE_RCSID(ace, Registry_Name_Space, "$Id$") - -#if (defined (ACE_WIN32) && defined (UNICODE)) -// This only works on Win32 platforms when UNICODE is turned on - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Registry_Name_Space::ACE_Registry_Name_Space (void) -{ -} - -ACE_Registry_Name_Space::ACE_Registry_Name_Space (ACE_Name_Options *name_options) -{ - if (this->open (name_options) != 0) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Registry_Name_Space::open"))); -} - - -ACE_Registry_Name_Space::~ACE_Registry_Name_Space (void) -{ -} - - -int -ACE_Registry_Name_Space::open (ACE_Name_Options *name_options) -{ - const ACE_TCHAR *host = name_options->nameserver_host (); - ACE_Registry::Naming_Context predefined; - - int result = ACE_Predefined_Naming_Contexts::connect (predefined, - HKEY_LOCAL_MACHINE, - host); - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Predefined_Naming_Context::connect")), - result); - else - { - // Directory - ACE_TString name = name_options->namespace_dir (); - // Separator - name += ACE_Registry::STRING_SEPARATOR; - // Filename - name += name_options->database (); - - // Create new context or bind to existing one - result = predefined.bind_context (name, - this->context_); - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Registry::Naming_Context::bind_context")), result); - } - return 0; -} - - -int -ACE_Registry_Name_Space::bind (const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type) -{ - ACE_UNUSED_ARG(type); - - // Pointer to data - const ACE_WSTRING_TYPE *data = value.fast_rep (); - - // Size - size_t size = value.length () * sizeof (ACE_WSTRING_TYPE); - - // Represent value as an ACE_Registry::Object - ACE_Registry::Object object ((void *) data, - static_cast (size), - REG_SZ); - // Add new / pair -#if defined ACE_USES_WCHAR - return this->context_.bind (name.fast_rep(), - object); -#else - return this->context_.bind (name.char_rep(), - object); -#endif /* ACE_HAS_WCHAR */ -} - - -int -ACE_Registry_Name_Space::rebind (const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type) -{ - ACE_UNUSED_ARG(type); - - // Pointer to data - const ACE_WSTRING_TYPE *data = value.fast_rep (); - - // Size - size_t size = value.length () * sizeof (ACE_WSTRING_TYPE); - - // Represent value as an ACE_Registry::Object - ACE_Registry::Object object ((void *) data, - static_cast (size), - REG_SZ); - // Add new / pair -#if defined (ACE_USES_WCHAR) - return this->context_.rebind (name.fast_rep (), - object); -#else - return this->context_.rebind (name.char_rep (), - object); -#endif /* ACE_USES_WCHAR */ -} - - -int -ACE_Registry_Name_Space::unbind (const ACE_NS_WString &name) -{ -#if defined (ACE_USES_WCHAR) - return this->context_.unbind (name.fast_rep ()); -#else - return this->context_.unbind (name.char_rep ()); -#endif /* ACE_USES_WCHAR */ -} - - -int -ACE_Registry_Name_Space::resolve (const ACE_NS_WString &name, - ACE_NS_WString &value, - char *&type) -{ - ACE_UNUSED_ARG(type); - - // This object will be used to query the size of the data. - // Note: The query_object.data will be null for this invocation. - ACE_Registry::Object query_object; - int result = -#if defined (ACE_USES_WCHAR) - this->context_.resolve (name.fast_rep (), query_object); -#else - this->context_.resolve (name.char_rep (), query_object); -#endif /* ACE_USES_WCHAR */ - if (result != 0) - return result; - - // Resize the value passed by the user - // Note: -1 is used because the size includes the null terminator - value.resize ((query_object.size () - 1) / sizeof (ACE_WSTRING_TYPE)); - - // Represent new space as an ACE_Registry::Object - ACE_Registry::Object object ((void *) value.fast_rep (), - query_object.size (), - REG_SZ); - -#if defined (ACE_USES_WCHAR) - result = this->context_.resolve (name.fast_rep (), object); -#else - result = this->context_.resolve (name.char_rep (), object); -#endif /* ACE_USES_WCHAR */ - if (object.size () != query_object.size ()) - return -1; - if (result != 0) - return result; - - return 0; -} - - -int -ACE_Registry_Name_Space:: list_names (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_BINDING_SET binding_set; - int result = this->list_name_entries (binding_set, - pattern); - if (result != 0) - return result; - - ACE_BINDING_ITERATOR iterator (binding_set); - - for (ACE_Name_Binding *entry = 0; - iterator.next (entry) !=0; - iterator.advance()) - { - set.insert (entry->name_); - } - return 0; -} - - -int -ACE_Registry_Name_Space::list_values (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_BINDING_SET binding_set; - int result = this->list_name_entries (binding_set, - pattern); - if (result != 0) - return result; - - ACE_BINDING_ITERATOR iterator (binding_set); - - for (ACE_Name_Binding *entry = 0; - iterator.next (entry) !=0; - iterator.advance()) - { - set.insert (entry->value_); - } - return 0; -} - - -int -ACE_Registry_Name_Space::list_types (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_UNUSED_ARG(set); - ACE_UNUSED_ARG(pattern); - - return 0; -} - - -int -ACE_Registry_Name_Space::list_name_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_UNUSED_ARG(pattern); - - ACE_Registry::Binding_List list; - int result = this->context_.list (list); - if (result != 0) - return result; - - // Iterator through all entries - for (ACE_Registry::Binding_List::iterator i = list.begin (); - i != list.end (); - i++) - { - // Yeeesss! STL rules! - ACE_Registry::Binding &binding = *i; - - if (binding.type () == ACE_Registry::OBJECT) - { - // Key - ACE_TString string = binding.name (); - ACE_NS_WString key (string.c_str ()); - - // Value - ACE_NS_WString value; - char *type = 0; - result = this->resolve (key, - value, - type); - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Registry::Naming_Context::resolve")), result); - - // Complete binding - ACE_Name_Binding binding (key, value, type); - set.insert (binding); - } - } - return 0; -} - - -int -ACE_Registry_Name_Space::list_value_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - return this->list_name_entries (set, pattern); -} - - -int -ACE_Registry_Name_Space::list_type_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - return this->list_name_entries (set, pattern); -} - - -void -ACE_Registry_Name_Space::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 && UNICODE */ diff --git a/ace/Registry_Name_Space.h b/ace/Registry_Name_Space.h deleted file mode 100644 index cfd16ddec7e..00000000000 --- a/ace/Registry_Name_Space.h +++ /dev/null @@ -1,140 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Registry_Name_Space.h - * - * $Id$ - * - * @author Irfan Pyarali (irfan@cs.wustl.edu) - */ -//============================================================================= - - -#ifndef ACE_REGISTRY_NAME_SPACE_H -#define ACE_REGISTRY_NAME_SPACE_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) && defined (UNICODE)) -// This only works on Win32 platforms when UNICODE is turned on - -#include "ace/Registry.h" -#include "ace/Naming_Context.h" -#include "ace/Name_Space.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Registry_Name_Space - * - * @brief Interface to a Name Server Database which is maintained by - * the Win32 Registry. Allows to add, change, remove and - * resolve NameBindings. - * - * Manages a Naming Service for a registry name space which - * includes bindings for all contexts. All strings are stored in - * wide character format. A Name Binding consists of a name - * (that's the key), a value string. There is no type string - * support in this Name Space. - */ -class ACE_Export ACE_Registry_Name_Space : public ACE_Name_Space -{ -public: - - /// Constructor - ACE_Registry_Name_Space (void); - - /// Contacts and opens the registry on the specified server - ACE_Registry_Name_Space (ACE_Name_Options *name_options); - - /// Destructor - ~ACE_Registry_Name_Space (void); - - /// Contacts and opens the registry on the specified server - int open (ACE_Name_Options *name_options); - - /// Bind a new name to a naming context (Wide character strings). - int bind (const ACE_NS_WString &name_in, - const ACE_NS_WString &value_in, - const char *type_in = ""); - - /** - * Overwrite the value or type of an existing name in a - * ACE_Name_Space or bind a new name to the context, if it didn't - * exist yet. (Wide charcter strings interface). - */ - int rebind (const ACE_NS_WString &name_in, - const ACE_NS_WString &value_in, - const char *type_in = ""); - - /// Delete a name from a ACE_Name_Space (Wide charcter strings - /// Interface). - int unbind (const ACE_NS_WString &name_in); - - /// Get value and type of a given name binding (Wide chars). The - /// caller is responsible for deleting both and ! - int resolve (const ACE_NS_WString &name_in, - ACE_NS_WString &value_out, - char *&type_out); - - /// Get a set of names matching a specified pattern (wchars). Matching - /// means the names must begin with the pattern string. - int list_names (ACE_WSTRING_SET &set_out, - const ACE_NS_WString &pattern_in); - - /// Get a set of values matching a specified pattern (wchars). Matching - /// means the values must begin with the pattern string. - int list_values (ACE_WSTRING_SET &set_out, - const ACE_NS_WString &pattern_in); - - /// Get a set of types matching a specified pattern (wchars). Matching - /// means the types must begin with the pattern string. - int list_types (ACE_WSTRING_SET &set_out, - const ACE_NS_WString &pattern_in); - - /** - * Get a set of names matching a specified pattern (wchars). Matching - * means the names must begin with the pattern string. Returns the - * complete binding associated each pattern match. - */ - int list_name_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - - /** - * Get a set of values matching a specified pattern (wchars). Matching - * means the values must begin with the pattern string. Returns the - * complete binding associated each pattern match. - */ - int list_value_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - - /** - * Get a set of types matching a specified pattern (wchars). Matching - * means the types must begin with the pattern string. Returns the - * complete binding associated each pattern match. - */ - int list_type_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - - /// Dump the state of the object - void dump (void) const; - -private: - - /// current context - ACE_Registry::Naming_Context context_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 && UNICODE */ - -#include /**/ "ace/post.h" - -#endif /* ACE_REGISTRY_NAME_SPACE_H */ diff --git a/ace/Remote_Name_Space.cpp b/ace/Remote_Name_Space.cpp deleted file mode 100644 index 2b55cf684a5..00000000000 --- a/ace/Remote_Name_Space.cpp +++ /dev/null @@ -1,380 +0,0 @@ -#include "ace/Remote_Name_Space.h" -#include "ace/Auto_Ptr.h" -#include "ace/Log_Msg.h" -#include "ace/SString.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID (ace, - Remote_Name_Space, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -int -ACE_Remote_Name_Space::open (const ACE_TCHAR *servername, u_short port) -{ - ACE_TRACE ("ACE_Remote_Name_Space::open"); - ACE_INET_Addr servaddr; - - // Initialize Addr - if (servaddr.set (port, servername) == -1) - return -1; - - // Connect to Name Server process. - if (this->ns_proxy_.open (servaddr) == -1) - return -1; - - return 0; -} - -ACE_Remote_Name_Space::ACE_Remote_Name_Space (void) -{ - ACE_TRACE ("ACE_Remote_Name_Space::ACE_Remote_Name_Space"); -} - -ACE_Remote_Name_Space::ACE_Remote_Name_Space (const ACE_TCHAR *hostname, - u_short port) -{ - ACE_TRACE ("ACE_Remote_Name_Space::ACE_Remote_Name_Space"); - if (this->open (hostname, port) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Remote_Name_Space::ACE_Remote_Name_Space"))); -} - -int -ACE_Remote_Name_Space::bind (const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type) -{ - ACE_TRACE ("ACE_Remote_Name_Space::bind"); - ACE_Auto_Basic_Array_Ptr name_urep (name.rep ()); - ACE_Auto_Basic_Array_Ptr value_urep (value.rep ()); - ACE_UINT32 name_len = - static_cast (name.length () * sizeof (ACE_WCHAR_T)); - ACE_UINT32 value_len = - static_cast (value.length () * sizeof (ACE_WCHAR_T)); - ACE_UINT32 type_len = - static_cast (ACE_OS::strlen (type)); - ACE_Name_Request request (ACE_Name_Request::BIND, - name_urep.get (), - name_len, - value_urep.get (), - value_len, - type, - type_len); - return this->ns_proxy_.request_reply (request); -} - -int -ACE_Remote_Name_Space::rebind (const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type) -{ - ACE_TRACE ("ACE_Remote_Name_Space::rebind"); - ACE_Auto_Basic_Array_Ptr name_urep (name.rep ()); - ACE_Auto_Basic_Array_Ptr value_urep (value.rep ()); - ACE_UINT32 name_len = - static_cast (name.length () * sizeof (ACE_WCHAR_T)); - ACE_UINT32 value_len = - static_cast (value.length () * sizeof (ACE_WCHAR_T)); - ACE_UINT32 type_len = - static_cast (ACE_OS::strlen (type)); - ACE_Name_Request request (ACE_Name_Request::REBIND, - name_urep.get (), - name_len, - value_urep.get (), - value_len, - type, - type_len); - return this->ns_proxy_.request_reply (request); -} - -int -ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name, - ACE_NS_WString &value, - char *&type) -{ - ACE_TRACE ("ACE_Remote_Name_Space::resolve"); - ACE_Auto_Basic_Array_Ptr name_urep (name.rep ()); - ACE_UINT32 name_len = - static_cast (name.length () * sizeof (ACE_WCHAR_T)); - ACE_Name_Request request (ACE_Name_Request::RESOLVE, - name_urep.get (), - name_len, - 0, 0, 0, 0); - - if (this->ns_proxy_.send_request (request) == -1) - return -1; - - ACE_Name_Request reply; - - if (this->ns_proxy_.recv_reply (reply) == -1) - return -1; - - ACE_NS_WString temp (reply.value (), reply.value_len () / sizeof (ACE_WCHAR_T)); - value = temp; - ACE_NEW_RETURN (type, - char[reply.type_len () + 1], - -1); - ACE_OS::strcpy (type, reply.type ()); - return 0; -} - -int -ACE_Remote_Name_Space::unbind (const ACE_NS_WString &name) -{ - ACE_TRACE ("ACE_Remote_Name_Space::unbind"); - ACE_Auto_Basic_Array_Ptr name_urep (name.rep ()); - ACE_UINT32 name_len = - static_cast (name.length () * sizeof (ACE_WCHAR_T)); - ACE_Name_Request request (ACE_Name_Request::UNBIND, - name_urep.get (), - name_len, - 0, 0, 0, 0); - return this->ns_proxy_.request_reply (request); -} - -int -ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Remote_Name_Space::list_names"); - ACE_Auto_Basic_Array_Ptr pattern_urep (pattern.rep ()); - ACE_UINT32 pattern_len = - static_cast (pattern.length () * sizeof (ACE_WCHAR_T)); - ACE_Name_Request request (ACE_Name_Request::LIST_NAMES, - pattern_urep.get (), - pattern_len, - 0, 0, 0, 0); - if (this->ns_proxy_.send_request (request) == -1) - return -1; - - ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0); - - while (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - if (this->ns_proxy_.recv_reply (reply) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Remote_Name_Space::list_names")), - -1); - if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - ACE_NS_WString name (reply.name (), - reply.name_len () / sizeof (ACE_WCHAR_T)); - set.insert (name); - } - } - return 0; -} - -int -ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Remote_Name_Space::list_values"); - ACE_Auto_Basic_Array_Ptr pattern_urep (pattern.rep ()); - ACE_UINT32 pattern_len = - static_cast (pattern.length () * sizeof (ACE_WCHAR_T)); - ACE_Name_Request request (ACE_Name_Request::LIST_VALUES, - pattern_urep.get (), - pattern_len, - 0, 0, 0, 0); - if (this->ns_proxy_.send_request (request) == -1) - return -1; - - ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0); - - while (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - if (this->ns_proxy_.recv_reply (reply) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Remote_Name_Space::list_values")), - -1); - if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - ACE_NS_WString value (reply.value (), - reply.value_len () / sizeof (ACE_WCHAR_T)); - set.insert (value); - } - } - - return 0; -} - -int -ACE_Remote_Name_Space::list_types (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Remote_Name_Space::list_types"); - ACE_Auto_Basic_Array_Ptr pattern_urep (pattern.rep ()); - ACE_UINT32 pattern_len = - static_cast (pattern.length () * sizeof (ACE_WCHAR_T)); - ACE_Name_Request request (ACE_Name_Request::LIST_TYPES, - pattern_urep.get (), - pattern_len, - 0, 0, 0, 0); - - if (this->ns_proxy_.send_request (request) == -1) - return -1; - - ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0); - - while (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - if (this->ns_proxy_.recv_reply (reply) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Remote_Name_Space::list_values")), - -1); - if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - ACE_NS_WString type (reply.type ()); - set.insert (type); - } - } - - return 0; -} - -int -ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Remote_Name_Space::list_name_entries"); - ACE_Auto_Basic_Array_Ptr pattern_urep (pattern.rep ()); - ACE_UINT32 pattern_len = - static_cast (pattern.length () * sizeof (ACE_WCHAR_T)); - ACE_Name_Request request (ACE_Name_Request::LIST_NAME_ENTRIES, - pattern_urep.get (), - pattern_len, - 0, 0, 0, 0); - - if (this->ns_proxy_.send_request (request) == -1) - return -1; - - ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0); - - while (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - if (this->ns_proxy_.recv_reply (reply) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Remote_Name_Space::list_names")), - -1); - if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - ACE_NS_WString name (reply.name (), - reply.name_len () / sizeof (ACE_WCHAR_T)); - ACE_NS_WString value (reply.value (), - reply.value_len () / sizeof (ACE_WCHAR_T)); - ACE_Name_Binding entry (name, - value, - reply.type ()); - if (set.insert (entry) == -1) - return -1; - } - } - return 0; -} - -int -ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Remote_Name_Space::list_value_entries"); - ACE_Auto_Basic_Array_Ptr pattern_urep (pattern.rep ()); - ACE_UINT32 pattern_len = - static_cast (pattern.length () * sizeof (ACE_WCHAR_T)); - ACE_Name_Request request (ACE_Name_Request::LIST_VALUE_ENTRIES, - pattern_urep.get (), - pattern_len, - 0, 0, 0, 0); - - if (this->ns_proxy_.send_request (request) == -1) - return -1; - - ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0); - - while (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - if (this->ns_proxy_.recv_reply (reply) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Remote_Name_Space::list_values")), - -1); - if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - ACE_NS_WString name (reply.name (), - reply.name_len () / sizeof (ACE_WCHAR_T)); - ACE_NS_WString value (reply.value (), - reply.value_len () / sizeof (ACE_WCHAR_T)); - ACE_Name_Binding entry (name, - value, - reply.type()); - if (set.insert (entry) == -1) - return -1; - } - } - return 0; -} - -int -ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Remote_Name_Space::list_type_entries"); - ACE_Auto_Basic_Array_Ptr pattern_urep (pattern.rep ()); - ACE_UINT32 pattern_len = - static_cast (pattern.length () * sizeof (ACE_WCHAR_T)); - ACE_Name_Request request (ACE_Name_Request::LIST_TYPE_ENTRIES, - pattern_urep.get (), - pattern_len, - 0, 0, 0, 0); - - if (this->ns_proxy_.send_request (request) == -1) - return -1; - - ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0); - - while (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - if (this->ns_proxy_.recv_reply (reply) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Remote_Name_Space::list_values")), - -1); - if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) - { - ACE_NS_WString name (reply.name (), - reply.name_len () / sizeof (ACE_WCHAR_T)); - ACE_NS_WString value (reply.value (), - reply.value_len () / sizeof (ACE_WCHAR_T)); - ACE_Name_Binding entry (name, - value, - reply.type ()); - if (set.insert (entry) == -1) - return -1; - } - } - return 0; -} - -ACE_Remote_Name_Space::~ACE_Remote_Name_Space (void) -{ - ACE_TRACE ("ACE_Remote_Name_Space::~ACE_Remote_Name_Space"); -} - -void -ACE_Remote_Name_Space::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Remote_Name_Space::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->ns_proxy_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Remote_Name_Space.h b/ace/Remote_Name_Space.h deleted file mode 100644 index a58ca4e83af..00000000000 --- a/ace/Remote_Name_Space.h +++ /dev/null @@ -1,147 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Remote_Name_Space.h - * - * $Id$ - * - * @author Prashant Jain - */ -//========================================================================== - - -#ifndef ACE_REMOTE_NAME_SPACE_H -#define ACE_REMOTE_NAME_SPACE_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Name_Proxy.h" -#include "ace/Name_Space.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_NS_WString; - -typedef ACE_Unbounded_Set ACE_WSTRING_SET; - -/** - * @class ACE_Remote_Name_Space - * - * @brief Maintaining accesses Remote Name Server Database. Allows to - * add NameBindings, change them, remove them and resolve - * NameBindings. - * - * Manages a Naming Service for a remote name space which - * includes bindings for net_local naming context. All strings - * are stored in wide character format. A Name Binding consists - * of a name (that's the key), a value string and an optional - * type string (no wide chars). - */ -class ACE_Export ACE_Remote_Name_Space : public ACE_Name_Space -{ -public: - // = Initialization and termination methods. - /// "Do-nothing" constructor. - ACE_Remote_Name_Space (void); - - /** - * Specifies the scope of this namespace, opens and memory-maps the - * associated file (if accessible) or contacts the dedicated name - * server process for NET_LOCAL namespace. - */ - ACE_Remote_Name_Space (const ACE_TCHAR *hostname, u_short port); - - /** - * Specifies the scope of this namespace, opens and memory-maps the - * associated file (if accessible) or contacts the dedicated name - * server process for NET_LOCAL namespace. - */ - int open (const ACE_TCHAR *servername, u_short port); - - /// destructor, do some cleanup :TBD: last dtor should "compress" - /// file - ~ACE_Remote_Name_Space (void); - - /// Bind a new name to a naming context (Wide character strings). - virtual int bind (const ACE_NS_WString &name_in, - const ACE_NS_WString &value_in, - const char *type_in = ""); - - /** - * Overwrite the value or type of an existing name in a - * ACE_Remote_Name_Space or bind a new name to the context, if it - * didn't exist yet. (Wide charcter strings interface). - */ - virtual int rebind (const ACE_NS_WString &name_in, - const ACE_NS_WString &value_in, - const char *type_in = ""); - - /// Delete a name from a ACE_Remote_Name_Space (Wide charcter strings - /// Interface). - virtual int unbind (const ACE_NS_WString &name_in); - - /// Get value and type of a given name binding (Wide chars). The - /// caller is responsible for deleting both and ! - virtual int resolve (const ACE_NS_WString &name_in, - ACE_NS_WString &value_out, - char *&type_out); - - /// Get a set of names matching a specified pattern (wchars). Matching - /// means the names must begin with the pattern string. - virtual int list_names (ACE_WSTRING_SET &set_out, - const ACE_NS_WString &pattern_in); - - /// Get a set of values matching a specified pattern (wchars). Matching - /// means the values must begin with the pattern string. - virtual int list_values (ACE_WSTRING_SET &set_out, - const ACE_NS_WString &pattern_in); - - /// Get a set of types matching a specified pattern (wchars). Matching - /// means the types must begin with the pattern string. - virtual int list_types (ACE_WSTRING_SET &set_out, - const ACE_NS_WString &pattern_in); - - /** - * Get a set of names matching a specified pattern (wchars). Matching - * means the names must begin with the pattern string. Returns the - * complete binding associated each pattern match. - */ - virtual int list_name_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - - /** - * Get a set of values matching a specified pattern (wchars). Matching - * means the values must begin with the pattern string. Returns the - * complete binding associated each pattern match. - */ - virtual int list_value_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - - /** - * Get a set of types matching a specified pattern (wchars). Matching - * means the types must begin with the pattern string. Returns the - * complete binding associated each pattern match. - */ - virtual int list_type_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - - /// Dump the state of the object. - virtual void dump (void) const; - -private: - /// Interface to Name server process for NET_LOCAL namespace. - ACE_Name_Proxy ns_proxy_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_REMOTE_NAME_SPACE_H */ diff --git a/ace/Remote_Tokens.cpp b/ace/Remote_Tokens.cpp deleted file mode 100644 index 1725993ae4c..00000000000 --- a/ace/Remote_Tokens.cpp +++ /dev/null @@ -1,527 +0,0 @@ -// $Id$ - -#include "ace/Remote_Tokens.h" - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#include "ace/Singleton.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Remote_Tokens.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_RCSID (ace, - Remote_Tokens, - "$Id$") - - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -#define ACE_TSS_CONNECTION_MUTEX ACE_Thread_Mutex -#else -#define ACE_TSS_CONNECTION_MUTEX ACE_Null_Mutex -#endif /* ACE_MT_SAFE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Make a typedef to simplify access to the Singleton below. -typedef ACE_Singleton ACE_Token_Connections; - -// Initialize the statics from ACE_TSS_Connection; -ACE_INET_Addr ACE_TSS_Connection::server_address_; - -// ************************************************************ - -void -ACE_TSS_Connection::set_server_address (const ACE_INET_Addr &server_address) -{ - ACE_TRACE ("ACE_TSS_Connection::set_server_address"); - server_address_ = server_address; -} - -// Necessary to make some compilers work... -ACE_TSS_Connection::ACE_TSS_Connection (void) -{ - ACE_TRACE ("ACE_TSS_Connection::ACE_TSS_Connection"); -} - -ACE_TSS_Connection::~ACE_TSS_Connection (void) -{ - ACE_TRACE ("ACE_TSS_Connection::~ACE_TSS_Connection"); -} - -ACE_SOCK_Stream * -ACE_TSS_Connection::get_connection (void) -{ - return ACE_TSS::operator-> (); -} - -ACE_SOCK_Stream * -ACE_TSS_Connection::make_TSS_TYPE (void) const -{ - ACE_TRACE ("ACE_TSS_Connection::make_TSS_TYPE"); - - ACE_SOCK_Connector connector; - ACE_SOCK_Stream *stream = 0; - - ACE_NEW_RETURN (stream, - ACE_SOCK_Stream, - 0); - - if (connector.connect (*stream, server_address_) == -1) - { - delete stream; - errno = ECONNREFUSED; - return 0; - } - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_TSS_Connection new connection\n"))); - return stream; -} - -ACE_TSS_Connection::operator ACE_SOCK_Stream *(void) -{ - return this->get_connection (); -} - -void -ACE_TSS_Connection::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_TSS_Connection::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_TSS_Connection::dump:\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("server_address_\n"))); - server_address_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("base:\n"))); - ACE_TSS::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Remote_Token_Proxy::ACE_Remote_Token_Proxy (void) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::ACE_Remote_Token_Proxy"); -} - -ACE_Remote_Token_Proxy::~ACE_Remote_Token_Proxy (void) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::~ACE_Remote_Token_Proxy"); -} - -int -ACE_Remote_Token_Proxy::open (const ACE_TCHAR *name, - int ignore_deadlock, - int debug) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::open"); - ignore_shadow_deadlock_ = ignore_deadlock; - return ACE_Token_Proxy::open (name, 0, debug); -} - -void -ACE_Remote_Token_Proxy::set_server_address (const ACE_INET_Addr &server_address) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::set_server_address"); - ACE_Token_Connections::instance ()->set_server_address (server_address); -} - -int -ACE_Remote_Token_Proxy::initiate_connection (void) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::initiate_connection"); - if (token_ == 0) - { - errno = ENOENT; - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("ACE_Remote_Token_Proxy not open.\n")), -1); - } - - ACE_SOCK_Stream *peer = ACE_Token_Connections::instance ()->get_connection (); - return peer == 0 ? 0 : 1; -} - -// Do the work of sending a request and getting a reply. - -int -ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request, - ACE_Synch_Options &) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::request_reply"); - void *buffer; - ssize_t length; - - if ((length = request.encode (buffer)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("encode failed")), -1); - - ACE_SOCK_Stream *peer = ACE_Token_Connections::instance ()->get_connection (); - - if (peer == 0) - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "BIG PROBLEMS with get_connection"), -1); - - // Transmit request via a blocking send. - - if (peer->send_n (buffer, length) != length) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("send_n failed")), -1); - else - { - ACE_Token_Reply reply; - - // Receive reply via blocking read. - - if (peer->recv (&reply, sizeof reply) != sizeof reply) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("recv failed")), -1); - - if (reply.decode () == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("decode failed")), -1); - - errno = int (reply.errnum ()); - if (errno != 0) - return -1; - else - return 0; - } -} - -int -ACE_Remote_Token_Proxy::acquire (int notify, - void (*sleep_hook)(void *), - ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::acquire"); - - // First grab the local shadow mutex. - if (ACE_Token_Proxy::acquire (notify, - sleep_hook, - ACE_Synch_Options::asynch) == -1) - { - // Acquire failed, deal with it... - switch (errno) - { - case EWOULDBLOCK : - // Whoah, we detected wouldblock via the shadow mutex! - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) shadow: acquire will block, owner is %s\n"), - this->token_->owner_id ())); - // No error, but would block, - break; - - case EDEADLK : - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) shadow: deadlock detected\n"))); - - if (ignore_shadow_deadlock_) - break; - else - { - errno = EDEADLK; - ACE_RETURN (-1); - } - - default : - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("(%t) %p shadow acquire failed\n"), - ACE_LIB_TEXT ("ACE_Remote_Token_Proxy")), - -1); - } - } - - ACE_Token_Request request (token_->type (), - this->type (), - ACE_Token_Request::ACQUIRE, - this->name (), - this->client_id (), - options); - - request.notify (notify); - - int result = this->request_reply (request, options); - - if (result == -1) - { - // Update the local shadow copy. - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("error on remote acquire, releasing shadow mutex.\n"))); - ACE_Token_Proxy::release (); - } - else - { - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) acquired %s remotely.\n"), this->name ())); - // Our shadow call may have failed. However, it's still a race - // to the remote server. If we beat the client which holds the - // local token, we need to fix things locally to reflect the - // actual ownership. All that should happen is that our waiter - // is moved to the front of the waiter list. - token_->make_owner (waiter_); - } - - return result; -} - -int -ACE_Remote_Token_Proxy::tryacquire (void (*sleep_hook)(void *)) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::tryacquire"); - - // If we can detect locally that the tryacquire will fail, there is - // no need to go remote. - if (ACE_Token_Proxy::tryacquire (sleep_hook) == -1) - { - if (debug_) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("shadow try acquire failed\n"))); - } - - return -1; - } - - ACE_Token_Request request (token_->type (), - this->type (), - ACE_Token_Request::TRY_ACQUIRE, - this->name (), - this->client_id (), - ACE_Synch_Options::synch); - - return this->request_reply (request, - ACE_Synch_Options::synch); -} - -int -ACE_Remote_Token_Proxy::renew (int requeue_position, - ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::renew"); - - if (ACE_Token_Proxy::renew (requeue_position, - ACE_Synch_Options::asynch) == -1) - { - // Check for error. - if (errno != EWOULDBLOCK) - return -1; - else if (debug_) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%t) shadow: renew would block. owner %s.\n"), - this->token_->owner_id ())); - } - - ACE_Token_Request request (token_->type (), - this->type (), - ACE_Token_Request::RENEW, - this->name (), - this->client_id (), - options); - - request.requeue_position (requeue_position); - - int result = this->request_reply (request, options); - - if (result == -1) - { - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - ACE_Token_Proxy::release (); - } - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p error on remote renew, releasing shadow mutex.\n"), - ACE_LIB_TEXT ("ACE_Remote_Token_Proxy")), -1); - } - else - { - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) renewed %s remotely.\n"), this->name ())); - // Make sure that the local shadow reflects our new ownership. - token_->make_owner (waiter_); - return result; - } -} - -int -ACE_Remote_Token_Proxy::release (ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::release"); - - ACE_Token_Request request (token_->type (), - this->type (), - ACE_Token_Request::RELEASE, - this->name (), - this->client_id (), - options); - - int result = this->request_reply (request, options); - if (result == 0) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) released %s remotely.\n"), this->name ())); - - // whether success or failure, we're going to release the shadow. - // If race conditions exist such that we are no longer the owner, - // this release will perform a remove. - if (ACE_Token_Proxy::release () == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("(%t) shadow: release failed\n"))); - - return result; -} - -int -ACE_Remote_Token_Proxy::remove (ACE_Synch_Options &) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::remove"); - return 0; -} - -void -ACE_Remote_Token_Proxy::token_acquired (ACE_TPQ_Entry *) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::token_acquired"); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) %s shadow token %s acquired\n"), - this->client_id (), - this->name ())); - // ACE_Token_Proxy::token_acquired (vp); -} - -const ACE_TCHAR* -ACE_Remote_Token_Proxy::owner_id (void) -{ - ACE_TRACE ("ACE_Remote_Token_Proxy::owner_id"); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("owner_id called\n"))); - // @@ special operation - return 0; -} - -void -ACE_Remote_Token_Proxy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Remote_Token_Proxy::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_Tokens::dump:\n") - ACE_LIB_TEXT (" ignore_shadow_deadlock_ = %d\n"), - ignore_shadow_deadlock_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("base:\n"))); - ACE_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Token_Proxy * -ACE_Remote_Mutex::clone (void) const -{ - ACE_Token_Proxy *temp; - ACE_NEW_RETURN (temp, - ACE_Remote_Mutex (this->name (), - ignore_deadlock_, - debug_), - 0); - return temp; -} - -ACE_Tokens * -ACE_Remote_Mutex::create_token (const ACE_TCHAR *name) -{ - ACE_Tokens *temp; - ACE_NEW_RETURN (temp, - ACE_Mutex_Token (name), - 0); - return temp; -} - -void -ACE_Remote_Mutex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Remote_Mutex::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_Remote_Mutex::dump:\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("base:\n"))); - ACE_Remote_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Tokens * -ACE_Remote_RLock::create_token (const ACE_TCHAR *name) -{ - ACE_Tokens *temp = 0; - ACE_NEW_RETURN (temp, - ACE_RW_Token (name), - 0); - return temp; -} - -int -ACE_Remote_RLock::type (void) const -{ - return ACE_RW_Token::READER; -} - -ACE_Token_Proxy * -ACE_Remote_RLock::clone (void) const -{ - ACE_Token_Proxy *temp = 0; - ACE_NEW_RETURN (temp, - ACE_Remote_RLock (this->name (), - ignore_deadlock_, - debug_), - 0); - return temp; -} - -void -ACE_Remote_RLock::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Remote_RLock::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_Remote_RLock::dump:\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("base:\n"))); - ACE_Remote_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - - -ACE_Tokens * -ACE_Remote_WLock::create_token (const ACE_TCHAR *name) -{ - ACE_Tokens *temp = 0; - ACE_NEW_RETURN (temp, - ACE_RW_Token (name), - 0); - return temp; -} - -int -ACE_Remote_WLock::type (void) const -{ - return ACE_RW_Token::WRITER; -} - -ACE_Token_Proxy * -ACE_Remote_WLock::clone (void) const -{ - ACE_Token_Proxy *temp = 0; - ACE_NEW_RETURN (temp, - ACE_Remote_WLock (this->name (), - ignore_deadlock_, - debug_), - 0); - return temp; -} - -void -ACE_Remote_WLock::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Remote_WLock::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_Remote_WLock::dump:\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("base:\n"))); - ACE_Remote_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Remote_Tokens.h b/ace/Remote_Tokens.h deleted file mode 100644 index ec39d3d26eb..00000000000 --- a/ace/Remote_Tokens.h +++ /dev/null @@ -1,322 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Remote_Tokens.h - * - * $Id$ - * - * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) - * @author Tim Harrison (harrison@cs.wustl.edu) - */ -//============================================================================= - -#ifndef ACE_REMOTE_MUTEX_H -#define ACE_REMOTE_MUTEX_H - -#include /**/ "ace/pre.h" - -#include "ace/INET_Addr.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SOCK_Connector.h" -#include "ace/SOCK_Stream.h" -#include "ace/Synch_Options.h" -#include "ace/Local_Tokens.h" -#include "ace/Token_Request_Reply.h" - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Remote_Token_Proxy - * - * @brief Proxy for acquiring, renewing, and releasing a distributed - * synchronization token. - * - * The Remote_Token_Proxy class implements the mechanisms for - * distributed token operations. It is similar to the - * ACE_Token_Proxy. - * = BUGS - * Distributed sleep_hooks have not been implemented. - * is not implemented. - */ -class ACE_Export ACE_Remote_Token_Proxy : public ACE_Token_Proxy -{ -public: - /// Null construction. - ACE_Remote_Token_Proxy (void); - - /// Death. - virtual ~ACE_Remote_Token_Proxy (void); - - /** - * Same as Token_Proxy. is the string uniquely identifying - * the token. can be 1 to disable deadlock - * notifications. prints debug messages. - */ - int open (const ACE_TCHAR *name, - int ignore_deadlock = 0, - int debug = 0); - - - /** - * Open a connection with the token server. This only need be used - * when the user wishes to explicitly open a connection to check if - * the server exists. Connections are stored in the - * ACE_Token_Connections singleton as thread-specific data. That - * is, every thread has only one connection that is used for all - * remote tokens. - */ - int initiate_connection (void); - - /** - * Acquire the distributed token. If notify is specified and the - * token is already held, the owner is notified. options contains - * the timeout value for the acquire call. The timer is kept at the - * token server. Asynchronous operations are not supported. - * Returns 0 on success, -1 on failure with == problem. - */ - virtual int acquire (int notify = 0, - void (*sleep_hook)(void *) = 0, - ACE_Synch_Options &options = - ACE_Synch_Options::synch); - - /** - * Try to acquire the distributed token. If the token is already - * held, the call returns without queueing the caller as a waiter. - * Returns 0 on success (the token was acquired), and -1 with - * EWOULDBLOCK if the token was already held. - */ - virtual int tryacquire (void (*sleep_hook)(void *) = 0); - - /** - * Renew the token by offering to release it if there are any other - * waiters, otherwise get the token back immediately. This renew - * has the same semantics as ACE_Local_Mutex release. It is - * semantically equivalent to followed by , but - * it is faster. options contains the timeout value used if renew - * blocks. As with acquire, the timer is maintained at the token - * server. If there are waiters and requeue_position == -1, the - * caller is queued at the rear of the waiter list. Otherwise, - * requeue_position specifies the number of waiters to "let by" - * before reacquiring the token (effectively, the position in the - * waiter list.) - */ - virtual int renew (int requeue_position = 0, - ACE_Synch_Options &options = - ACE_Synch_Options::synch); - - /** - * Release the distributed token. Similar to ACE_Local_Mutex, if the - * caller is not the owner, it is removed from the waiter list (if - * applicable.) Returns 0 on success, -1 on failure with == - * problem. - */ - virtual int release (ACE_Synch_Options &options = - ACE_Synch_Options::synch); - - /// Become interface compliant for ACE_Guard<>. This has no - /// functionality. - virtual int remove (ACE_Synch_Options &options = - ACE_Synch_Options::synch); - - /// Override the default to do nothing. - virtual void token_acquired (ACE_TPQ_Entry *); - - /// The client id of the current token holder - virtual const ACE_TCHAR* owner_id (void); - - /** - * Sets the server address for all instances of ACE_Remote_Token_Proxy - * If this isn't called, the environment variable TOKEN_SERVER is - * checked for the server address. If that is not specified, all - * ACE_Remote_** operations will fail. - */ - static void set_server_address (const ACE_INET_Addr &server_address); - - /// Dump the state of the class. - void dump (void) const; - -protected: - - /// If shadows report deadlock, go remote anyway - int ignore_shadow_deadlock_; - - /// Perform the request and wait for the reply. - int request_reply (ACE_Token_Request &request, - ACE_Synch_Options &options); -}; - -/** - * @class ACE_Remote_Mutex - * - * @brief Proxy for acquiring, renewing, and releasing a distributed - * mutex. - * - * This is the remote equivalent to ACE_Local_Mutex. The - * Remote_Mutex class offers methods for acquiring, renewing, and - * releasing a distributed synchronization mutex. Similar to - * ACE_Local_Mutex, ACE_Remote_Token_Proxy offers recursive - * acquisition, FIFO waiter ordering, and deadlock detection. It - * depends on the Token Server for its distributed synchronization - * semantics. - */ -class ACE_Export ACE_Remote_Mutex : public ACE_Remote_Token_Proxy -{ -public: - /// Null creation. Remote_Token_Proxy::open must be called. - ACE_Remote_Mutex (void); - - /// Calls Remote_Token_Proxy::open for you. - ACE_Remote_Mutex (const ACE_TCHAR *token_name, - int ignore_deadlock = 0, - int debug = 0); - - /// Dump the state of the class. - void dump (void) const; - - /// Return deep copy. - virtual ACE_Token_Proxy *clone (void) const; - -protected: - /// Make the correct type of ACE_Tokens. - /// This is called by the ACE_Token_Manager. - virtual ACE_Tokens *create_token (const ACE_TCHAR *name); -}; - -/** - * @class ACE_Remote_RLock - * - * @brief Proxy for acquiring, renewing, and releasing a distributed - * readers lock. - * - * This is the remote equivalent to ACE_Local_RLock. Multiple - * readers can hold the lock simultaneously when no writers have - * the lock. Alternatively, when a writer holds the lock, no other - * participants (readers or writers) may hold the lock. - * ACE_Remote_RLock depends on the ACE Token Server for its - * distributed synchronization semantics. - */ -class ACE_Export ACE_Remote_RLock : public ACE_Remote_Token_Proxy -{ -public: - ACE_Remote_RLock (void); - - ACE_Remote_RLock (const ACE_TCHAR *token_name, - int ignore_deadlock = 0, - int debug = 0); - - ACE_Remote_RLock (const ACE_Remote_RLock &mutex); - - /// Dump the state of the class. - void dump (void) const; - - /// Returns ACE_RW_Token::RLOCK; - virtual int type (void) const; - - /// Return deep copy. - virtual ACE_Token_Proxy *clone (void) const; - -protected: - /// Make the correct type of ACE_Tokens. This is called by the Token - /// Manager. - virtual ACE_Tokens *create_token (const ACE_TCHAR *name); -}; - -/** - * @class ACE_Remote_WLock - * - * @brief Proxy for acquiring, renewing, and releasing a distributed - * writers lock. - * - * Shields applications from details of interacting with the - * ACE_Token_Server. The token_name_ is just the string that the - * Token Server uses to identify the token. The client_id_ (also - * used by the Token Server,) identifies the owner of the token and - * is used for deadlock detection. - */ -class ACE_Export ACE_Remote_WLock : public ACE_Remote_Token_Proxy -{ -public: - ACE_Remote_WLock (void); - - ACE_Remote_WLock (const ACE_TCHAR *token_name, - int ignore_deadlock = 0, - int debug = 0); - - ACE_Remote_WLock (const ACE_Remote_WLock &mutex); - - /// Dump the state of the class. - void dump (void) const; - - /// Returns ACE_RW_Token::WLOCK; - virtual int type (void) const; - - /// Return deep copy. - virtual ACE_Token_Proxy *clone (void) const; - -protected: - /// Make the correct type of ACE_Tokens. This is called by the Token - /// Manager. - virtual ACE_Tokens *create_token (const ACE_TCHAR *name); -}; - -/** - * @class ACE_TSS_Connection - * - * @brief Class for providing a connection per thread. - * - * ACE_TSS_Connection provides a single access point for all - * threads to access thread-specific connections. This prevents - * resource-sharing problems such as thread serialization. - */ -class ACE_Export ACE_TSS_Connection : public ACE_TSS -{ -public: - // Necessary to make some compilers work... - ACE_TSS_Connection (void); - ~ACE_TSS_Connection (void); - - /// Retrieve the thread's connection - ACE_SOCK_Stream *get_connection (void); - - /// Factory Method that creates a new SOCK Stream. - virtual ACE_SOCK_Stream *make_TSS_TYPE (void) const; - - /// Inheritence and operator overloading don't mix. Redefine this - /// from ACE_TSS so that we can use it. - operator ACE_SOCK_Stream *(void); - - /// Set the server address. - static void set_server_address (const ACE_INET_Addr &server_address); - - /// Dump the state of the class. - void dump (void) const; - -protected: - /// The address of the Token Server used by all instances of - /// Token_Proxy. - static ACE_INET_Addr server_address_; - -private: - /// Private: should not be used - ACE_TSS_Connection (const ACE_TSS_Connection &); - void operator= (const ACE_TSS_Connection &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ - -#if defined (__ACE_INLINE__) -#include "ace/Remote_Tokens.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_REMOTE_TOKEN_H */ diff --git a/ace/Remote_Tokens.inl b/ace/Remote_Tokens.inl deleted file mode 100644 index 50487075225..00000000000 --- a/ace/Remote_Tokens.inl +++ /dev/null @@ -1,48 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Remote_Mutex::ACE_Remote_Mutex (void) -{ - ACE_TRACE ("ACE_Remote_Mutex::ACE_Remote_Mutex"); -} - -ACE_INLINE -ACE_Remote_Mutex::ACE_Remote_Mutex (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) -{ - ACE_TRACE ("ACE_Remote_Mutex::ACE_Remote_Mutex"); - this->open (token_name, ignore_deadlock, debug); -} - -// ************************************************************ - -ACE_INLINE -ACE_Remote_RLock::ACE_Remote_RLock (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) -{ - ACE_TRACE ("ACE_Remote_RLock::ACE_Remote_RLock"); - this->open (token_name, ignore_deadlock, debug); -} - -// ************************************************************ - -ACE_INLINE -ACE_Remote_WLock::ACE_Remote_WLock (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) -{ - ACE_TRACE ("ACE_Remote_WLock::ACE_Remote_WLock"); - this->open (token_name, ignore_deadlock, debug); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Reverse_Lock_T.cpp b/ace/Reverse_Lock_T.cpp deleted file mode 100644 index 348c81da62a..00000000000 --- a/ace/Reverse_Lock_T.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// $Id$ - -#ifndef ACE_REVERSE_LOCK_T_CPP -#define ACE_REVERSE_LOCK_T_CPP - -#include "ace/Reverse_Lock_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Reverse_Lock_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Reverse_Lock::~ACE_Reverse_Lock (void) -{ -} - -// Explicitly destroy the lock. -template int -ACE_Reverse_Lock::remove (void) -{ - return this->lock_.remove (); -} - -// Release the lock. -template int -ACE_Reverse_Lock::acquire (void) -{ - return this->lock_.release (); -} - -// Release the lock. -template int -ACE_Reverse_Lock::tryacquire (void) -{ - ACE_NOTSUP_RETURN (-1); -} - -// Acquire the lock. -template int -ACE_Reverse_Lock::release (void) -{ - if (this->acquire_method_ == ACE_Acquire_Method::ACE_READ) - return this->lock_.acquire_read (); - else if (this->acquire_method_ == ACE_Acquire_Method::ACE_WRITE) - return this->lock_.acquire_write (); - else - return this->lock_.acquire (); -} - -// Release the lock. -template int -ACE_Reverse_Lock::acquire_read (void) -{ - ACE_NOTSUP_RETURN (-1); -} - -// Release the lock. -template int -ACE_Reverse_Lock::acquire_write (void) -{ - ACE_NOTSUP_RETURN (-1); -} - -// Release the lock. -template int -ACE_Reverse_Lock::tryacquire_read (void) -{ - ACE_NOTSUP_RETURN (-1); -} - -// Release the lock. -template int -ACE_Reverse_Lock::tryacquire_write (void) -{ - ACE_NOTSUP_RETURN (-1); -} - -// Release the lock. -template int -ACE_Reverse_Lock::tryacquire_write_upgrade (void) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_REVERSE_LOCK_T_CPP */ diff --git a/ace/Reverse_Lock_T.h b/ace/Reverse_Lock_T.h deleted file mode 100644 index 5bd1d3a6b8f..00000000000 --- a/ace/Reverse_Lock_T.h +++ /dev/null @@ -1,149 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Reverse_Lock_T.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_REVERSE_LOCK_T_H -#define ACE_REVERSE_LOCK_T_H -#include /**/ "ace/pre.h" - -#include "ace/Lock.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @namespace ACE_Acquire_Method - * - * @brief An enum namespace. - * - * These enums should have been inside the reverse lock class, but - * some lame compilers cannot handle enums inside template classes. - * - * The METHOD_TYPE is used to indicate which acquire() method will be - * called on the real lock when the release() method is called on the - * reverse lock. REGULAR indicated the acquire() method, READ - * indicates the acquire_read() method, and WRITE indicates the - * acquire_write() method. Note that the try_*() methods are not - * represented here because we have to make sure that the release() - * method on the reverse lock acquires a lock on the real lock. - **/ -namespace ACE_Acquire_Method -{ - enum METHOD_TYPE - { - ACE_REGULAR, - ACE_READ, - ACE_WRITE - }; -} - -#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) - using namespace ACE_Acquire_Method; -#endif - -/** - * @class ACE_Reverse_Lock - * - * @brief A reverse (or anti) lock. - * - * This is an interesting adapter class that changes a lock into - * a reverse lock, i.e., on this class calls - * on the lock, and on this class calls on - * the lock. - * One motivation for this class is when we temporarily want to - * release a lock (which we have already acquired) but then - * reacquire it soon after. An alternative design would be to - * add a Anti_Guard or Reverse_Guard class which would - * on construction and destruction. However, there - * are *many* varieties of the Guard class and this design - * choice would lead to at least 6 new classes. One new - * ACE_Reverse_Lock class seemed more reasonable. - */ -template -class ACE_Reverse_Lock : public ACE_Lock -{ -public: - - typedef ACE_LOCKING_MECHANISM ACE_LOCK; - - // = Initialization/Finalization methods. - - /// Constructor. All locking requests will be forwarded to . -#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) - // Make LynxOS 3.x buggy compiler happy - ACE_Reverse_Lock (ACE_LOCKING_MECHANISM &lock, - METHOD_TYPE acquire_method = ACE_REGULAR); -#else - ACE_Reverse_Lock (ACE_LOCKING_MECHANISM &lock, - ACE_Acquire_Method::METHOD_TYPE acquire_method = ACE_Acquire_Method::ACE_REGULAR); -#endif - - /// Destructor. If was not passed in by the user, it will be - /// deleted. - virtual ~ACE_Reverse_Lock (void); - - // = Lock accessors. - /// Release the lock. - virtual int acquire (void); - - /// Release the lock. - virtual int tryacquire (void); - - /// Acquire the lock. - virtual int release (void); - - /// Release the lock. - virtual int acquire_read (void); - - /// Release the lock. - virtual int acquire_write (void); - - /// Release the lock. - virtual int tryacquire_read (void); - - /// Release the lock. - virtual int tryacquire_write (void); - - /// Release the lock. - virtual int tryacquire_write_upgrade (void); - - /// Explicitly destroy the lock. - virtual int remove (void); - -private: - /// The concrete locking mechanism that all the methods delegate to. - ACE_LOCKING_MECHANISM &lock_; - - /// This indicates what kind of acquire method will be called. - ACE_Acquire_Method::METHOD_TYPE acquire_method_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Reverse_Lock_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Reverse_Lock_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Reverse_Lock_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_REVERSE_LOCK_T_H */ diff --git a/ace/Reverse_Lock_T.inl b/ace/Reverse_Lock_T.inl deleted file mode 100644 index 0f8598ffd23..00000000000 --- a/ace/Reverse_Lock_T.inl +++ /dev/null @@ -1,19 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/config-all.h" -#include "ace/OS_NS_errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Reverse_Lock::ACE_Reverse_Lock ( - ACE_LOCKING_MECHANISM &lock, - ACE_Acquire_Method::METHOD_TYPE acquire_method) - : lock_ (lock), - acquire_method_ (acquire_method) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK.cpp b/ace/SOCK.cpp deleted file mode 100644 index f6618cdada4..00000000000 --- a/ace/SOCK.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// $Id$ - -#include "ace/SOCK.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SOCK, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK) - -void -ACE_SOCK::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_SOCK::ACE_SOCK (void) -{ - // ACE_TRACE ("ACE_SOCK::ACE_SOCK"); -} - -// Returns information about the remote peer endpoint (if there is -// one). - -int -ACE_SOCK::get_remote_addr (ACE_Addr &sa) const -{ - ACE_TRACE ("ACE_SOCK::get_remote_addr"); - - int len = sa.get_size (); - sockaddr *addr = reinterpret_cast (sa.get_addr ()); - - if (ACE_OS::getpeername (this->get_handle (), - addr, - &len) == -1) - return -1; - - sa.set_size (len); - sa.set_type (addr->sa_family); - return 0; -} - -int -ACE_SOCK::get_local_addr (ACE_Addr &sa) const -{ - ACE_TRACE ("ACE_SOCK::get_local_addr"); - - int len = sa.get_size (); - sockaddr *addr = reinterpret_cast (sa.get_addr ()); - - if (ACE_OS::getsockname (this->get_handle (), - addr, - &len) == -1) - return -1; - - sa.set_type (addr->sa_family); - sa.set_size (len); - return 0; -} - -// Close down a ACE_SOCK. - -int -ACE_SOCK::close (void) -{ - ACE_TRACE ("ACE_SOCK::close"); - int result = 0; - - if (this->get_handle () != ACE_INVALID_HANDLE) - { - result = ACE_OS::closesocket (this->get_handle ()); - this->set_handle (ACE_INVALID_HANDLE); - } - return result; -} - -int -ACE_SOCK::open (int type, - int protocol_family, - int protocol, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK::open"); - int one = 1; - - this->set_handle (ACE_OS::socket (protocol_family, - type, - protocol)); - - if (this->get_handle () == ACE_INVALID_HANDLE) - return -1; - else if (protocol_family != PF_UNIX - && reuse_addr - && this->set_option (SOL_SOCKET, - SO_REUSEADDR, - &one, - sizeof one) == -1) - { - this->close (); - return -1; - } - return 0; -} - -// General purpose constructor for performing server ACE_SOCK -// creation. - -ACE_SOCK::ACE_SOCK (int type, - int protocol_family, - int protocol, - int reuse_addr) -{ - // ACE_TRACE ("ACE_SOCK::ACE_SOCK"); - if (this->open (type, - protocol_family, - protocol, - reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK::ACE_SOCK"))); -} - -int -ACE_SOCK::open (int type, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK::open"); - - this->set_handle (ACE_OS::socket (protocol_family, - type, - protocol, - protocolinfo, - g, - flags)); - int one = 1; - - if (this->get_handle () == ACE_INVALID_HANDLE) - return -1; - else if (reuse_addr - && this->set_option (SOL_SOCKET, - SO_REUSEADDR, - &one, - sizeof one) == -1) - { - this->close (); - return -1; - } - else - return 0; -} - -ACE_SOCK::ACE_SOCK (int type, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr) -{ - // ACE_TRACE ("ACE_SOCK::ACE_SOCK"); - if (this->open (type, - protocol_family, - protocol, - protocolinfo, - g, - flags, - reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK::ACE_SOCK"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK.h b/ace/SOCK.h deleted file mode 100644 index 8348d0f35d8..00000000000 --- a/ace/SOCK.h +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file SOCK.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SOCK_H -#define ACE_SOCK_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Addr.h" -#include "ace/IPC_SAP.h" -#include "ace/OS_NS_stropts.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SOCK - * - * @brief An abstract class that forms the basis for more specific - * classes, such as and . - * Do not instantiate this class. - * - * This class provides functions that are common to all of the - * classes. provides the ability to get - * and set socket options, get the local and remote addresses, - * and open and close a socket handle. - */ -class ACE_Export ACE_SOCK : public ACE_IPC_SAP -{ -public: - - /// Wrapper around the system call. - int set_option (int level, - int option, - void *optval, - int optlen) const; - - /// Wrapper around the system call. - int get_option (int level, - int option, - void *optval, - int *optlen) const; - - /** - * Close the socket. - * This method also sets the object's handle value to ACE_INVALID_HANDLE. - * - * @return The result of closing the socket; 0 if the handle value - * was already ACE_INVALID_HANDLE. - */ - int close (void); - - /// Return the local endpoint address in the referenced . - /// Returns 0 if successful, else -1. - int get_local_addr (ACE_Addr &) const; - - /** - * Return the address of the remotely connected peer (if there is - * one), in the referenced . Returns 0 if successful, else - * -1. - */ - int get_remote_addr (ACE_Addr &) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// Wrapper around the BSD-style system call (no QoS). - int open (int type, - int protocol_family, - int protocol, - int reuse_addr); - - /// Wrapper around the QoS-enabled function. - int open (int type, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr); - -protected: - - /// Constructor with arguments to call the BSD-style system - /// call (no QoS). - ACE_SOCK (int type, - int protocol_family, - int protocol = 0, - int reuse_addr = 0); - - /// Constructor with arguments to call the QoS-enabled - /// function. - ACE_SOCK (int type, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr); - - /// Default constructor is protected to prevent instances of this class - /// from being defined. - ACE_SOCK (void); - - /// Protected destructor. - /** - * Not a virtual destructor. Protected destructor to prevent - * operator delete() from being called through a base class ACE_SOCK - * pointer/reference. - */ - ~ACE_SOCK (void); - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SOCK_H */ diff --git a/ace/SOCK.inl b/ace/SOCK.inl deleted file mode 100644 index c57fa36dfec..00000000000 --- a/ace/SOCK.inl +++ /dev/null @@ -1,39 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SOCK::~ACE_SOCK (void) -{ - // ACE_TRACE ("ACE_SOCK::~ACE_SOCK"); -} - -ACE_INLINE int -ACE_SOCK::set_option (int level, - int option, - void *optval, - int optlen) const -{ - ACE_TRACE ("ACE_SOCK::set_option"); - return ACE_OS::setsockopt (this->get_handle (), level, - option, (char *) optval, optlen); -} - -// Provides access to the ACE_OS::getsockopt system call. - -ACE_INLINE int -ACE_SOCK::get_option (int level, - int option, - void *optval, - int *optlen) const -{ - ACE_TRACE ("ACE_SOCK::get_option"); - return ACE_OS::getsockopt (this->get_handle (), level, - option, (char *) optval, optlen); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Acceptor.cpp b/ace/SOCK_Acceptor.cpp deleted file mode 100644 index ba7d435850a..00000000000 --- a/ace/SOCK_Acceptor.cpp +++ /dev/null @@ -1,406 +0,0 @@ -// $Id$ - -#include "ace/SOCK_Acceptor.h" - -#include "ace/Log_Msg.h" -#include "ace/OS_Errno.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_sys_socket.h" -#include "ace/os_include/os_fcntl.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - -#if !defined (ACE_HAS_WINCE) -#include "ace/OS_QoS.h" -#endif // ACE_HAS_WINCE - -ACE_RCSID(ace, SOCK_Acceptor, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Acceptor) - -// Do nothing routine for constructor. - -ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (void) -{ - ACE_TRACE ("ACE_SOCK_Acceptor::ACE_SOCK_Acceptor"); -} - -// Performs the timed accept operation. - -int -ACE_SOCK_Acceptor::shared_accept_start (ACE_Time_Value *timeout, - int restart, - int &in_blocking_mode) const -{ - ACE_TRACE ("ACE_SOCK_Acceptor::shared_accept_start"); - - ACE_HANDLE handle = this->get_handle (); - - // Handle the case where we're doing a timed . - if (timeout != 0) - { - if (ACE::handle_timed_accept (handle, - timeout, - restart) == -1) - return -1; - else - { - in_blocking_mode = ACE_BIT_DISABLED (ACE::get_flags (handle), - ACE_NONBLOCK); - // Set the handle into non-blocking mode if it's not already - // in it. - if (in_blocking_mode - && ACE::set_flags (handle, - ACE_NONBLOCK) == -1) - return -1; - } - } - - return 0; -} - -int -ACE_SOCK_Acceptor::shared_accept_finish (ACE_SOCK_Stream new_stream, - int in_blocking_mode, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SOCK_Acceptor::shared_accept_finish ()"); - - ACE_HANDLE new_handle = new_stream.get_handle (); - - // Check to see if we were originally in blocking mode, and if so, - // set the 's handle and handle to be in blocking - // mode. - if (in_blocking_mode) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - - // Only disable ACE_NONBLOCK if we weren't in non-blocking mode - // originally. - ACE::clr_flags (this->get_handle (), - ACE_NONBLOCK); - ACE::clr_flags (new_handle, - ACE_NONBLOCK); - } - -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - if (reset_new_handle) - // Reset the event association inherited by the new handle. - ::WSAEventSelect ((SOCKET) new_handle, 0, 0); -#else - ACE_UNUSED_ARG (reset_new_handle); -#endif /* ACE_WIN32 */ - - return new_handle == ACE_INVALID_HANDLE ? -1 : 0; -} - -// General purpose routine for accepting new connections. - -int -ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SOCK_Acceptor::accept"); - - int in_blocking_mode = 0; - if (this->shared_accept_start (timeout, - restart, - in_blocking_mode) == -1) - return -1; - else - { - // On Win32 the third parameter to must be a NULL - // pointer if we want to ignore the client's address. - int *len_ptr = 0; - sockaddr *addr = 0; - int len = 0; - - if (remote_addr != 0) - { - len = remote_addr->get_size (); - len_ptr = &len; - addr = (sockaddr *) remote_addr->get_addr (); - } - - do - new_stream.set_handle (ACE_OS::accept (this->get_handle (), - addr, - len_ptr)); - while (new_stream.get_handle () == ACE_INVALID_HANDLE - && restart != 0 - && errno == EINTR - && timeout == 0); - - // Reset the size of the addr, so the proper UNIX/IPv4/IPv6 family - // is known. - if (new_stream.get_handle () != ACE_INVALID_HANDLE - && remote_addr != 0) - { - remote_addr->set_size (len); - if (addr) - remote_addr->set_type (addr->sa_family); - } - } - - return this->shared_accept_finish (new_stream, - in_blocking_mode, - reset_new_handle); -} - -#if !defined (ACE_HAS_WINCE) -int -ACE_SOCK_Acceptor::accept (ACE_SOCK_Stream &new_stream, - ACE_Accept_QoS_Params qos_params, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SOCK_Acceptor::accept"); - - int in_blocking_mode = 0; - if (this->shared_accept_start (timeout, - restart, - in_blocking_mode) == -1) - return -1; - else - { - // On Win32 the third parameter to must be a NULL - // pointer if we want to ignore the client's address. - int *len_ptr = 0; - int len = 0; - sockaddr *addr = 0; - - if (remote_addr != 0) - { - len = remote_addr->get_size (); - len_ptr = &len; - addr = (sockaddr *) remote_addr->get_addr (); - } - - do - new_stream.set_handle (ACE_OS::accept (this->get_handle (), - addr, - len_ptr, - qos_params)); - while (new_stream.get_handle () == ACE_INVALID_HANDLE - && restart != 0 - && errno == EINTR - && timeout == 0); - - // Reset the size of the addr, which is only necessary for UNIX - // domain sockets. - if (new_stream.get_handle () != ACE_INVALID_HANDLE - && remote_addr != 0) - remote_addr->set_size (len); - } - - return this->shared_accept_finish (new_stream, - in_blocking_mode, - reset_new_handle); -} -#endif // ACE_HAS_WINCE - -void -ACE_SOCK_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_Acceptor::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap, - int protocol_family, - int backlog) -{ - ACE_TRACE ("ACE_SOCK_Acceptor::shared_open"); - int error = 0; - -#if defined (ACE_HAS_IPV6) - if (protocol_family == PF_INET6) - { - sockaddr_in6 local_inet6_addr; - ACE_OS::memset (reinterpret_cast (&local_inet6_addr), - 0, - sizeof local_inet6_addr); - - if (local_sap == ACE_Addr::sap_any) - { - local_inet6_addr.sin6_family = AF_INET6; - local_inet6_addr.sin6_port = 0; - local_inet6_addr.sin6_addr = in6addr_any; - } - else - local_inet6_addr = *reinterpret_cast (local_sap.get_addr ()); - - // We probably don't need a bind_port written here. - // There are currently no supported OS's that define - // ACE_LACKS_WILDCARD_BIND. - if (ACE_OS::bind (this->get_handle (), - reinterpret_cast (&local_inet6_addr), - sizeof local_inet6_addr) == -1) - error = 1; - } - else -#endif - if (protocol_family == PF_INET) - { - sockaddr_in local_inet_addr; - ACE_OS::memset (reinterpret_cast (&local_inet_addr), - 0, - sizeof local_inet_addr); - - if (local_sap == ACE_Addr::sap_any) - { - local_inet_addr.sin_port = 0; - } - else - local_inet_addr = *reinterpret_cast (local_sap.get_addr ()); - if (local_inet_addr.sin_port == 0) - { - if (ACE::bind_port (this->get_handle (), - ACE_NTOHL (ACE_UINT32 (local_inet_addr.sin_addr.s_addr))) == -1) - error = 1; - } - else if (ACE_OS::bind (this->get_handle (), - reinterpret_cast (&local_inet_addr), - sizeof local_inet_addr) == -1) - error = 1; - } - else if (ACE_OS::bind (this->get_handle (), - (sockaddr *) local_sap.get_addr (), - local_sap.get_size ()) == -1) - error = 1; - - if (error != 0 - || ACE_OS::listen (this->get_handle (), - backlog) == -1) - { - ACE_Errno_Guard g (errno); // Preserve across close() below. - error = 1; - this->close (); - } - - return error ? -1 : 0; -} - -int -ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_Acceptor::open"); - - if (protocol_family == PF_UNSPEC) - protocol_family = local_sap.get_type (); - - if (ACE_SOCK::open (SOCK_STREAM, - protocol_family, - protocol, - protocolinfo, - g, - flags, - reuse_addr) == -1) - return -1; - else - return this->shared_open (local_sap, - protocol_family, - backlog); -} - -ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_Acceptor::ACE_SOCK_Acceptor"); - if (this->open (local_sap, - protocolinfo, - g, - flags, - reuse_addr, - protocol_family, - backlog, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_Acceptor"))); -} - -// General purpose routine for performing server ACE_SOCK creation. - -int -ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_Acceptor::open"); - - if (local_sap != ACE_Addr::sap_any) - protocol_family = local_sap.get_type (); - else if (protocol_family == PF_UNSPEC) - { -#if defined (ACE_HAS_IPV6) - protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET; -#else - protocol_family = PF_INET; -#endif /* ACE_HAS_IPV6 */ - } - - if (ACE_SOCK::open (SOCK_STREAM, - protocol_family, - protocol, - reuse_addr) == -1) - return -1; - else - return this->shared_open (local_sap, - protocol_family, - backlog); -} - -// General purpose routine for performing server ACE_SOCK creation. - -ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_Acceptor::ACE_SOCK_Acceptor"); - if (this->open (local_sap, - reuse_addr, - protocol_family, - backlog, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_Acceptor"))); -} - -int -ACE_SOCK_Acceptor::close (void) -{ - return ACE_SOCK::close (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Acceptor.h b/ace/SOCK_Acceptor.h deleted file mode 100644 index 4341698c7c9..00000000000 --- a/ace/SOCK_Acceptor.h +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file SOCK_Acceptor.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SOCK_ACCEPTOR_H -#define ACE_SOCK_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include "ace/SOCK_Stream.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; -class ACE_Accept_QoS_Params; - -/** - * @class ACE_SOCK_Acceptor - * - * @brief Defines a factory that creates new s passively. - * - * The ACE_SOCK_Acceptor has its own "passive-mode" socket. - * This serves as a factory to create so-called "data-mode" - * sockets, which are what the ACE_SOCK_Stream encapsulates. - * Therefore, by inheriting from ACE_SOCK, ACE_SOCK_Acceptor - * gets its very own socket. - */ -class ACE_Export ACE_SOCK_Acceptor : public ACE_SOCK -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_SOCK_Acceptor (void); - - /** - * Initialize a passive-mode BSD-style acceptor socket (no QoS). - * @a local_sap is the address that we're going to listen for - * connections on. If @a reuse_addr is 1 then we'll use the - * @c SO_REUSEADDR to reuse this address. - */ - ACE_SOCK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0 - /// on success and -1 on failure. - ACE_SOCK_Acceptor (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /** - * Initialize a passive-mode BSD-style acceptor socket (no QoS). - * is the address that we're going to listen for - * connections on. If is 1 then we'll use the - * to reuse this address. Returns 0 on success and - * -1 on failure. - */ - int open (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0 - /// on success and -1 on failure. - int open (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /// Close the socket. Returns 0 on success and -1 on failure. - int close (void); - - /// Default dtor. - ~ACE_SOCK_Acceptor (void); - - // = Passive connection methods. - /** - * Accept a new connection. A of 0 - * means block forever, a of {0, 0} means poll. - * == 1 means "restart if interrupted," i.e., if errno == EINTR. - * Note that inherits the "blocking mode" of - * , i.e., if acceptor factory is in - * non-blocking mode, the will be in non-blocking mode - * and vice versa. - */ - int accept (ACE_SOCK_Stream &new_stream, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0) const; - -#if !defined (ACE_HAS_WINCE) - /** - * Accept a new connection using the QoS - * information in . A of 0 means block - * forever, a of {0, 0} means poll. == 1 means - * "restart if interrupted," i.e., if errno == EINTR. Note that - * inherits the "blocking mode" of - * , i.e., if acceptor factory is in - * non-blocking mode, the will be in non-blocking mode - * and vice versa. - */ - int accept (ACE_SOCK_Stream &new_stream, - ACE_Accept_QoS_Params qos_params, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0) const; -#endif // ACE_HAS_WINCE - - // = Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_SOCK_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Perform operations that must occur before is - /// called. - int shared_accept_start (ACE_Time_Value *timeout, - int restart, - int &in_blocking_mode) const; - - /// Perform operations that must occur after is - /// called. - int shared_accept_finish (ACE_SOCK_Stream new_stream, - int in_blocking_mode, - int reset_new_handle) const; - - /** - * This method factors out the common code and is called by - * both the QoS-enabled method and the BSD-style - * method. - */ - int shared_open (const ACE_Addr &local_sap, - int protocol_family, - int backlog); - -private: - /// Do not allow this function to percolate up to this interface... - int get_remote_addr (ACE_Addr &) const; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SOCK_ACCEPTOR_H */ diff --git a/ace/SOCK_Acceptor.inl b/ace/SOCK_Acceptor.inl deleted file mode 100644 index a4456ed3ab6..00000000000 --- a/ace/SOCK_Acceptor.inl +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SOCK_Acceptor::~ACE_SOCK_Acceptor (void) -{ - ACE_TRACE ("ACE_SOCK_Acceptor::~ACE_SOCK_Acceptor"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_CODgram.cpp b/ace/SOCK_CODgram.cpp deleted file mode 100644 index 8bacd9d1220..00000000000 --- a/ace/SOCK_CODgram.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// $Id$ - -#include "ace/SOCK_CODgram.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_socket.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_CODgram.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SOCK_CODgram, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_CODgram) - -void -ACE_SOCK_CODgram::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_CODgram::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Here's the general-purpose constructor. - -ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote, const ACE_Addr &local, - int protocol_family, int protocol, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_CODgram::ACE_SOCK_CODgram"); - if (this->open (remote, local, - protocol_family, protocol, reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_SOCK_CODgram"))); -} - -/* This is the general-purpose open routine. Note that it performs - a different set of functions depending on the LOCAL and REMOTE - addresses passed to it. Here's the basic logic: - - 1. remote == ACE_Addr::sap_any && local == ACE_Addr::sap_any - if protocol_family == PF_INET then - bind the local address to a randomly generated port number... - - 2. remote == ACE_Addr::sap_any && local != ACE_Addr::sap_any - we are just binding the local address - (used primarily by servers) - - 3. remote != ACE_Addr::sap_any && local == ACE_Addr::sap_any - we are connecting to the remote address - (used primarily by clients) - - 4. remote != ACE_Addr::sap_any && local != ACE_Addr::sap_any - we are binding to the local address - and connecting to the remote address -*/ - -int -ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local, - int protocol_family, int protocol, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_CODgram::open"); - if (ACE_SOCK::open (SOCK_DGRAM, protocol_family, - protocol, reuse_addr) == -1) - return -1; - else - { - int error = 0; - - if (local == ACE_Addr::sap_any && remote == ACE_Addr::sap_any) - { - // Assign an arbitrary port number from the transient range!! - - if (protocol_family == PF_INET - && ACE::bind_port (this->get_handle ()) == -1) - error = 1; - } - // We are binding just the local address. - else if (local != ACE_Addr::sap_any && remote == ACE_Addr::sap_any) - { - if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), - local.get_size ()) == -1) - error = 1; - } - // We are connecting to the remote address. - else if (local == ACE_Addr::sap_any && remote != ACE_Addr::sap_any) - { - if (ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), - remote.get_size ()) == -1) - error = 1; - } - // We are binding to the local address and connecting to the - // remote addresses. - else - { - if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), - local.get_size ()) == -1 - || ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), - remote.get_size ()) == -1) - error = 1; - } - if (error) - { - this->close (); - this->set_handle (ACE_INVALID_HANDLE); - } - return error ? -1 : 0; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_CODgram.h b/ace/SOCK_CODgram.h deleted file mode 100644 index 007f7352c97..00000000000 --- a/ace/SOCK_CODgram.h +++ /dev/null @@ -1,78 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SOCK_CODgram.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_SOCK_CODGRAM_H -#define ACE_SOCK_CODGRAM_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SOCK_IO.h" -#include "ace/Addr.h" -#include "ace/INET_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SOCK_CODgram - * - * @brief Defines the member functions for the ACE_SOCK connected - * datagram abstraction. - */ -class ACE_Export ACE_SOCK_CODgram : public ACE_SOCK_IO -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_SOCK_CODgram (void); - - ACE_SOCK_CODgram (const ACE_Addr &remote_sap, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int protocol_family = ACE_PROTOCOL_FAMILY_INET, - int protocol = 0, - int reuse_addr = 0); - - /// Default dtor. - ~ACE_SOCK_CODgram (void); - - // Initiate a connected dgram. - - /// Initiate a connected dgram. - int open (const ACE_Addr &remote_sap, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int protocol_family = ACE_PROTOCOL_FAMILY_INET, - int protocol = 0, - int reuse_addr = 0); - - // = Meta-type info. - typedef ACE_INET_Addr PEER_ADDR; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_CODgram.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SOCK_CODGRAM_H */ diff --git a/ace/SOCK_CODgram.inl b/ace/SOCK_CODgram.inl deleted file mode 100644 index de7b0570973..00000000000 --- a/ace/SOCK_CODgram.inl +++ /dev/null @@ -1,19 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SOCK_CODgram::ACE_SOCK_CODgram (void) -{ - ACE_TRACE ("ACE_SOCK_CODgram::ACE_SOCK_CODgram"); -} - -ACE_INLINE -ACE_SOCK_CODgram::~ACE_SOCK_CODgram (void) -{ - ACE_TRACE ("ACE_SOCK_CODgram::~ACE_SOCK_CODgram"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Connector.cpp b/ace/SOCK_Connector.cpp deleted file mode 100644 index dbbe3cb539c..00000000000 --- a/ace/SOCK_Connector.cpp +++ /dev/null @@ -1,330 +0,0 @@ -// $Id$ - -#include "ace/SOCK_Connector.h" -#include "ace/INET_Addr.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_socket.h" -#include "ace/os_include/os_fcntl.h" - -#if !defined (ACE_HAS_WINCE) -#include "ace/OS_QoS.h" -#endif // ACE_HAS_WINCE - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_Connector.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SOCK_Connector, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Connector) - -void -ACE_SOCK_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_Connector::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_SOCK_Connector::shared_open (ACE_SOCK_Stream &new_stream, - int protocol_family, - int protocol, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_Connector::shared_open"); - - // Only open a new socket if we don't already have a valid handle. - if (new_stream.get_handle () == ACE_INVALID_HANDLE - && new_stream.open (SOCK_STREAM, - protocol_family, - protocol, - reuse_addr) == -1) - return -1; - else - return 0; -} - -int -ACE_SOCK_Connector::shared_open (ACE_SOCK_Stream &new_stream, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_Connector::shared_open"); - - // Only open a new socket if we don't already have a valid handle. - if (new_stream.get_handle () == ACE_INVALID_HANDLE - && new_stream.open (SOCK_STREAM, - protocol_family, - protocol, - protocolinfo, - g, - flags, - reuse_addr) == -1) - return -1; - else - return 0; -} - -int -ACE_SOCK_Connector::shared_connect_start (ACE_SOCK_Stream &new_stream, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap) -{ - ACE_TRACE ("ACE_SOCK_Connector::shared_connect_start"); - - if (local_sap != ACE_Addr::sap_any) - { - sockaddr *laddr = reinterpret_cast (local_sap.get_addr ()); - int size = local_sap.get_size (); - - if (ACE_OS::bind (new_stream.get_handle (), - laddr, - size) == -1) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - new_stream.close (); - return -1; - } - } - - // Enable non-blocking, if required. - if (timeout != 0 - && new_stream.enable (ACE_NONBLOCK) == -1) - return -1; - else - return 0; -} - -int -ACE_SOCK_Connector::shared_connect_finish (ACE_SOCK_Stream &new_stream, - const ACE_Time_Value *timeout, - int result) -{ - ACE_TRACE ("ACE_SOCK_Connector::shared_connect_finish"); - // Save/restore errno. - ACE_Errno_Guard error (errno); - - if (result == -1 && timeout != 0) - { - // Check whether the connection is in progress. - if (error == EINPROGRESS || error == EWOULDBLOCK) - { - // This expression checks if we were polling. - if (timeout->sec () == 0 - && timeout->usec () == 0) - error = EWOULDBLOCK; - // Wait synchronously using timeout. - else if (this->complete (new_stream, - 0, - timeout) == -1) - error = errno; - else - return 0; - } - } - - // EISCONN is treated specially since this routine may be used to - // check if we are already connected. - if (result != -1 || error == EISCONN) - // Start out with non-blocking disabled on the . - new_stream.disable (ACE_NONBLOCK); - else if (!(error == EWOULDBLOCK || error == ETIMEDOUT)) - new_stream.close (); - - return result; -} - -// Actively connect and produce a new ACE_SOCK_Stream if things go well... - -int -ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int /* flags */, - int /* perms */, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_Connector::connect"); - - if (this->shared_open (new_stream, - remote_sap.get_type (), - protocol, - reuse_addr) == -1) - return -1; - else if (this->shared_connect_start (new_stream, - timeout, - local_sap) == -1) - return -1; - - int result = ACE_OS::connect (new_stream.get_handle (), - reinterpret_cast (remote_sap.get_addr ()), - remote_sap.get_size ()); - - return this->shared_connect_finish (new_stream, - timeout, - result); -} - -#if !defined (ACE_HAS_WINCE) -int -ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - ACE_Protocol_Info * protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int /* perms */) -{ - ACE_TRACE ("ACE_SOCK_Connector::connect"); - - if (this->shared_open (new_stream, - remote_sap.get_type (), - 0, - protocolinfo, - g, - flags, - reuse_addr) == -1) - return -1; - else if (this->shared_connect_start (new_stream, - timeout, - local_sap) == -1) - return -1; - - int result = ACE_OS::connect (new_stream.get_handle (), - reinterpret_cast (remote_sap.get_addr ()), - remote_sap.get_size (), - qos_params); - - return this->shared_connect_finish (new_stream, - timeout, - result); -} -#endif // ACE_HAS_WINCE - -// Try to complete a non-blocking connection. - -int -ACE_SOCK_Connector::complete (ACE_SOCK_Stream &new_stream, - ACE_Addr *remote_sap, - const ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_SOCK_Connector::complete"); - ACE_HANDLE h = ACE::handle_timed_complete (new_stream.get_handle (), - tv); - // We failed to get connected. - if (h == ACE_INVALID_HANDLE) - { -#if defined (ACE_WIN32) - // Win32 has a timing problem - if you check to see if the - // connection has completed too fast, it will fail - so wait - // microseconds to let it catch up - // then retry to see if it's a real failure. - ACE_Time_Value time (0, ACE_NON_BLOCKING_BUG_DELAY); - ACE_OS::sleep (time); - h = ACE::handle_timed_complete (new_stream.get_handle (), - tv); - if (h == ACE_INVALID_HANDLE) - { -#endif /* ACE_WIN32 */ - // Save/restore errno. - ACE_Errno_Guard error (errno); - new_stream.close (); - return -1; -#if defined (ACE_WIN32) - } -#endif /* ACE_WIN32 */ - } - - if (remote_sap != 0) - { - int len = remote_sap->get_size (); - sockaddr *addr = reinterpret_cast (remote_sap->get_addr ()); - if (ACE_OS::getpeername (h, - addr, - &len) == -1) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - new_stream.close (); - return -1; - } - } - - // Start out with non-blocking disabled on the . - new_stream.disable (ACE_NONBLOCK); - return 0; -} - -ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector"); - - if (this->connect (new_stream, - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms, - protocol) == -1 - && timeout != 0 - && !(errno == EWOULDBLOCK || errno == ETIME || errno == ETIMEDOUT)) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_Connector::ACE_SOCK_Connector"))); -} - -#if !defined (ACE_HAS_WINCE) -ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int perms) -{ - ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector"); - - if (this->connect (new_stream, - remote_sap, - qos_params, - timeout, - local_sap, - protocolinfo, - g, - flags, - reuse_addr, - perms) == -1 - && timeout != 0 - && !(errno == EWOULDBLOCK || errno == ETIME || errno == ETIMEDOUT)) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_Connector::ACE_SOCK_Connector"))); -} -#endif // ACE_HAS_WINCE - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Connector.h b/ace/SOCK_Connector.h deleted file mode 100644 index a829634f6fc..00000000000 --- a/ace/SOCK_Connector.h +++ /dev/null @@ -1,329 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SOCK_Connector.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - -#ifndef ACE_SOCK_CONNECTOR_H -#define ACE_SOCK_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/SOCK_Stream.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_QoS_Params; -class ACE_Time_Value; - -/** - * @class ACE_SOCK_Connector - * - * @brief Defines a factory that actively connects to a remote IP - * address and TCP port, creating a new @c ACE_SOCK_Stream object. - * - * The @c ACE_SOCK_Connector doesn't have a socket of its own, - * i.e., it simply "borrows" the one from the @c ACE_SOCK_Stream - * that's being connected. The reason for this is that the - * underlying socket API doesn't use a factory socket to connect - * data mode sockets. Therefore, there's no need to inherit - * @c ACE_SOCK_Connector from @c ACE_SOCK. A nice side-effect of - * this is that @c ACE_SOCK_Connector objects do not store state so - * they can be used reentrantly in multithreaded programs. - */ -class ACE_Export ACE_SOCK_Connector -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_SOCK_Connector (void); - - /** - * Actively connect to a peer, producing a connected @c ACE_SOCK_Stream - * object if the connection succeeds. - * - * @param new_stream The @c ACE_SOCK_Stream object that will be connected - * to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * @param protocol (optional) If value is 0, default SOCK_STREAM - * protocol is selected by kernel (typically TCP). - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0, - int protocol = 0); - -#if !defined (ACE_HAS_WINCE) - /** - * Actively connect to a peer, producing a connected @c ACE_SOCK_Stream - * object if the connection succeeds. - * - * @param new_stream The @c ACE_SOCK_Stream object that will be connected - * to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param qos_params Contains QoS parameters that are passed to the - * IntServ (RSVP) and DiffServ protocols. - * @see ACE_QoS_Params. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - ACE_Protocol_Info *protocolinfo = 0, - ACE_SOCK_GROUP g = 0, - u_long flags = 0, - int reuse_addr = 0, - int perms = 0); -#endif // ACE_HAS_WINCE - - /** - * Actively connect to a peer, producing a connected @c ACE_SOCK_Stream - * object if the connection succeeds. - * - * @param new_stream The @c ACE_SOCK_Stream object that will be connected - * to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * @param protocol (optional) If value is 0, default SOCK_STREAM - * protocol is selected by kernel (typically TCP). - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - int connect (ACE_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0, - int protocol = 0); - -#if !defined (ACE_HAS_WINCE) - /** - * Actively connect to a peer, producing a connected @c ACE_SOCK_Stream - * object if the connection succeeds. - * - * @param new_stream The @c ACE_SOCK_Stream object that will be connected - * to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param qos_params Contains QoS parameters that are passed to the - * IntServ (RSVP) and DiffServ protocols. - * @see ACE_QoS_Params. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - int connect (ACE_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - ACE_Protocol_Info *protocolinfo = 0, - ACE_SOCK_GROUP g = 0, - u_long flags = 0, - int reuse_addr = 0, - int perms = 0); -#endif // ACE_HAS_WINCE - - /// Default dtor. - ~ACE_SOCK_Connector (void); - - // = Completion routine. - /** - * Try to complete a nonblocking connection that was begun by a - * previous call to connect with a {0, 0} ACE_Time_Value timeout. - * @see connect(). - * - * @param new_stream The @c ACE_SOCK_Stream object that will be connected - * to the peer. - * @param remote_sap If non-0, it points to the @c ACE_INET_Addr object - * that will contain the address of the connected peer. - * @param timeout Same values and return value possibilites as for - * connect(). @see connect(). - */ - int complete (ACE_SOCK_Stream &new_stream, - ACE_Addr *remote_sap = 0, - const ACE_Time_Value *timeout = 0); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - // = Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_SOCK_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Perform operations that ensure the socket is opened using - /// BSD-style semantics (no QoS). - int shared_open (ACE_SOCK_Stream &new_stream, - int protocol_family, - int protocol, - int reuse_addr); - - /// Perform operations that ensure the socket is opened using - /// QoS-enabled semantics. - int shared_open (ACE_SOCK_Stream &new_stream, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr); - - /// Perform operations that must be called before . - int shared_connect_start (ACE_SOCK_Stream &new_stream, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap); - - /// Perform operations that must be called after . - int shared_connect_finish (ACE_SOCK_Stream &new_stream, - const ACE_Time_Value *timeout, - int result); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SOCK_CONNECTOR_H */ diff --git a/ace/SOCK_Connector.inl b/ace/SOCK_Connector.inl deleted file mode 100644 index bdbf5cd19f6..00000000000 --- a/ace/SOCK_Connector.inl +++ /dev/null @@ -1,38 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// This constructor is used by a client when it wants to connect to -// the specified REMOTE_SAP address using a blocking open. - -ACE_INLINE -ACE_SOCK_Connector::~ACE_SOCK_Connector (void) -{ - ACE_TRACE ("ACE_SOCK_Connector::~ACE_SOCK_Connector"); -} - -// Do-nothing constructor... - -ACE_INLINE -ACE_SOCK_Connector::ACE_SOCK_Connector (void) -{ - ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector"); -} - -ACE_INLINE int -ACE_SOCK_Connector::reset_new_handle (ACE_HANDLE handle) -{ -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - // Reset the event association - return ::WSAEventSelect ((SOCKET) handle, - 0, - 0); -#else /* !defined ACE_HAS_WINSOCK2 */ - ACE_UNUSED_ARG (handle); - return 0; -#endif /* ACE_WIN32 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp deleted file mode 100644 index dc0c925fe02..00000000000 --- a/ace/SOCK_Dgram.cpp +++ /dev/null @@ -1,736 +0,0 @@ -#include "ace/SOCK_Dgram.h" - -#include "ace/Handle_Set.h" -#include "ace/Log_Msg.h" -#include "ace/INET_Addr.h" -#include "ace/ACE.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_sys_select.h" -#include "ace/OS_NS_ctype.h" -#include "ace/os_include/net/os_if.h" - -#if !defined (__ACE_INLINE__) -# include "ace/SOCK_Dgram.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_HAS_IPV6) && defined (ACE_WIN32) -#include /**/ -#endif - -ACE_RCSID (ace, - SOCK_Dgram, - "$Id$") - -// This is a workaround for platforms with non-standard -// definitions of the ip_mreq structure -#if ! defined (IMR_MULTIADDR) -#define IMR_MULTIADDR imr_multiaddr -#endif /* ! defined (IMR_MULTIADDR) */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_SOCK_Dgram) - -void -ACE_SOCK_Dgram::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_Dgram::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Allows a client to read from a socket without having to provide a -// buffer to read. This method determines how much data is in the -// socket, allocates a buffer of this size, reads in the data, and -// returns the number of bytes read. - -ssize_t -ACE_SOCK_Dgram::recv (iovec *io_vec, - ACE_Addr &addr, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::recv"); -#if defined (FIONREAD) - ACE_Handle_Set handle_set; - handle_set.reset (); - handle_set.set_bit (this->get_handle ()); - - // Check the status of the current socket to make sure there's data - // to recv (or time out). - int select_width; -# if defined (ACE_WIN32) - // This arg is ignored on Windows and causes pointer truncation - // warnings on 64-bit compiles. - select_width = 0; -# else - select_width = int (this->get_handle ()) + 1; -# endif /* ACE_WIN32 */ - switch (ACE_OS::select (select_width, - handle_set, - 0, 0, - timeout)) - { - case -1: - return -1; - /* NOTREACHED */ - case 0: - errno = ETIME; - return -1; - /* NOTREACHED */ - default: - // Goes fine, fallthrough to get data - break; - } - - sockaddr *saddr = (sockaddr *) addr.get_addr (); - int addr_len = addr.get_size (); - int inlen; - - if (ACE_OS::ioctl (this->get_handle (), - FIONREAD, - &inlen) == -1) - return -1; - else if (inlen > 0) - { - ACE_NEW_RETURN (io_vec->iov_base, - char[inlen], - -1); - io_vec->iov_len = ACE_OS::recvfrom (this->get_handle (), - (char *) io_vec->iov_base, - inlen, - flags, - (sockaddr *) saddr, - &addr_len); - addr.set_size (addr_len); - return io_vec->iov_len; - } - else - return 0; -#else - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (addr); - ACE_UNUSED_ARG (io_vec); - ACE_UNUSED_ARG (timeout); - ACE_NOTSUP_RETURN (-1); -#endif /* FIONREAD */ -} - -// Here's the shared open function. Note that if we are using the -// PF_INET protocol family and the address of LOCAL == the address of -// the special variable SAP_ANY then we are going to arbitrarily bind -// to a portnumber. - -int -ACE_SOCK_Dgram::shared_open (const ACE_Addr &local, - int protocol_family) -{ - ACE_TRACE ("ACE_SOCK_Dgram::shared_open"); - int error = 0; - - if (local == ACE_Addr::sap_any) - { - if (protocol_family == PF_INET -#if defined (ACE_HAS_IPV6) - || protocol_family == PF_INET6 -#endif /* ACE_HAS_IPV6 */ - ) - { - if (ACE::bind_port (this->get_handle (), - INADDR_ANY, - protocol_family) == -1) - error = 1; - } - } - else if (ACE_OS::bind (this->get_handle (), - reinterpret_cast (local.get_addr ()), - local.get_size ()) == -1) - error = 1; - - if (error != 0) - this->close (); - - return error ? -1 : 0; -} - -int -ACE_SOCK_Dgram::open (const ACE_Addr &local, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr) -{ - if (ACE_SOCK::open (SOCK_DGRAM, - protocol_family, - protocol, - protocolinfo, - g, - flags, - reuse_addr) == -1) - return -1; - else if (this->shared_open (local, - protocol_family) == -1) - return -1; - else - return 0; -} - -// Here's the general-purpose open routine. - -int -ACE_SOCK_Dgram::open (const ACE_Addr &local, - int protocol_family, - int protocol, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_Dgram::open"); - - if (local != ACE_Addr::sap_any) - protocol_family = local.get_type (); - else if (protocol_family == PF_UNSPEC) - { -#if defined (ACE_HAS_IPV6) - protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET; -#else - protocol_family = PF_INET; -#endif /* ACE_HAS_IPV6 */ - } - - if (ACE_SOCK::open (SOCK_DGRAM, - protocol_family, - protocol, - reuse_addr) == -1) - return -1; - else - return this->shared_open (local, - protocol_family); -} - -// Here's the general-purpose constructor used by a connectionless -// datagram ``server''... - -ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local, - int protocol_family, - int protocol, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram"); - - if (this->open (local, - protocol_family, - protocol, - reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_Dgram"))); -} - -ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram"); - if (this->open (local, - protocol_family, - protocol, - protocolinfo, - g, - flags, - reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_Dgram"))); -} - -#if defined (ACE_HAS_MSG) -// Send an iovec of size N to ADDR as a datagram (connectionless -// version). - -ssize_t -ACE_SOCK_Dgram::send (const iovec iov[], - int n, - const ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::send"); - msghdr send_msg; - - send_msg.msg_iov = (iovec *) iov; - send_msg.msg_iovlen = n; -#if defined (ACE_HAS_SOCKADDR_MSG_NAME) - send_msg.msg_name = (struct sockaddr *) addr.get_addr (); -#else - send_msg.msg_name = (char *) addr.get_addr (); -#endif /* ACE_HAS_SOCKADDR_MSG_NAME */ - send_msg.msg_namelen = addr.get_size (); - -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - send_msg.msg_control = 0; - send_msg.msg_controllen = 0; - send_msg.msg_flags = 0; -#else - send_msg.msg_accrights = 0; - send_msg.msg_accrightslen = 0; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - - return ACE_OS::sendmsg (this->get_handle (), - &send_msg, - flags); -} - -// Recv an iovec of size N to ADDR as a datagram (connectionless -// version). - -ssize_t -ACE_SOCK_Dgram::recv (iovec iov[], - int n, - ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::recv"); - msghdr recv_msg; - - recv_msg.msg_iov = (iovec *) iov; - recv_msg.msg_iovlen = n; -#if defined (ACE_HAS_SOCKADDR_MSG_NAME) - recv_msg.msg_name = (struct sockaddr *) addr.get_addr (); -#else - recv_msg.msg_name = (char *) addr.get_addr (); -#endif /* ACE_HAS_SOCKADDR_MSG_NAME */ - recv_msg.msg_namelen = addr.get_size (); - -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - recv_msg.msg_control = 0 ; - recv_msg.msg_controllen = 0 ; -#else - recv_msg.msg_accrights = 0; - recv_msg.msg_accrightslen = 0; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - - ssize_t status = ACE_OS::recvmsg (this->get_handle (), - &recv_msg, - flags); - addr.set_size (recv_msg.msg_namelen); - addr.set_type (((sockaddr_in *) addr.get_addr())->sin_family); - return status; -} - -#else /* ACE_HAS_MSG */ - -// Send an iovec of size N to ADDR as a datagram (connectionless -// version). - -ssize_t -ACE_SOCK_Dgram::send (const iovec iov[], - int n, - const ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::send"); - - size_t length = 0; - int i; - - // Determine the total length of all the buffers in . - for (i = 0; i < n; i++) -#if ! (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0530)) - // The iov_len is unsigned in Borland. If we go ahead and try the - // if, it will emit a warning. - if (iov[i].iov_len < 0) - return -1; - else -#endif - length += iov[i].iov_len; - - char *buf; - -#if defined (ACE_HAS_ALLOCA) - buf = alloca (length); -#else - ACE_NEW_RETURN (buf, - char[length], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - char *ptr = buf; - - for (i = 0; i < n; i++) - { - ACE_OS::memcpy (ptr, iov[i].iov_base, iov[i].iov_len); - ptr += iov[i].iov_len; - } - - ssize_t result = ACE_SOCK_Dgram::send (buf, length, addr, flags); -#if !defined (ACE_HAS_ALLOCA) - delete [] buf; -#endif /* !defined (ACE_HAS_ALLOCA) */ - return result; -} - -// Recv an iovec of size N to ADDR as a datagram (connectionless -// version). - -ssize_t -ACE_SOCK_Dgram::recv (iovec iov[], - int n, - ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::recv"); - - ssize_t length = 0; - int i; - - for (i = 0; i < n; i++) -#if ! (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0530)) - // The iov_len is unsigned in Borland. If we go ahead and try the - // if, it will emit a warning. - if (iov[i].iov_len < 0) - return -1; - else -#endif - length += iov[i].iov_len; - - char *buf; - -#if defined (ACE_HAS_ALLOCA) - buf = alloca (length); -#else - ACE_NEW_RETURN (buf, - char[length], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - length = ACE_SOCK_Dgram::recv (buf, length, addr, flags); - - if (length != -1) - { - char *ptr = buf; - int copyn = length; - - for (i = 0; - i < n && copyn > 0; - i++) - { - ACE_OS::memcpy (iov[i].iov_base, ptr, - // iov_len is int on some platforms, size_t on others - copyn > (int) iov[i].iov_len - ? (size_t) iov[i].iov_len - : (size_t) copyn); - ptr += iov[i].iov_len; - copyn -= iov[i].iov_len; - } - } - -#if !defined (ACE_HAS_ALLOCA) - delete [] buf; -#endif /* !defined (ACE_HAS_ALLOCA) */ - return length; -} - -#endif /* ACE_HAS_MSG */ - -ssize_t -ACE_SOCK_Dgram::recv (void *buf, - size_t n, - ACE_Addr &addr, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_Handle_Set handle_set; - handle_set.reset (); - handle_set.set_bit (this->get_handle ()); - - // Check the status of the current socket. - int select_width; -#if defined (ACE_WIN32) - // This arg is ignored on Windows and causes pointer truncation - // warnings on 64-bit compiles. - select_width = 0; -#else - select_width = int (this->get_handle ()) + 1; -#endif /* ACE_WIN32 */ - switch (ACE_OS::select (select_width, - handle_set, - 0, - 0, - timeout)) - { - case -1: - return -1; - /* NOTREACHED */ - case 0: - errno = ETIME; - return -1; - /* NOTREACHED */ - default: - // Goes fine, call to get data - return this->recv (buf, n, addr, flags); - } -} - -ssize_t -ACE_SOCK_Dgram::send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_Handle_Set handle_set; - handle_set.reset (); - handle_set.set_bit (this->get_handle ()); - - // Check the status of the current socket. - int select_width; -#if defined (ACE_WIN32) - // This arg is ignored on Windows and causes pointer truncation - // warnings on 64-bit compiles. - select_width = 0; -#else - select_width = int (this->get_handle ()) + 1; -#endif /* ACE_WIN32 */ - switch (ACE_OS::select (select_width, - 0, - handle_set, - 0, - timeout)) - { - case -1: - return -1; - /* NOTREACHED */ - case 0: - errno = ETIME; - return -1; - /* NOTREACHED */ - default: - // Goes fine, call to transmit the data. - return this->send (buf, n, addr, flags); - } -} - -int -ACE_SOCK_Dgram::set_nic (const ACE_TCHAR *net_if, - int addr_family) -{ -#if defined (IP_MULTICAST_IF) && (IP_MULTICAST_IF != 0) -# if defined (ACE_HAS_IPV6) - bool ipv6_mif_set = false; - if (addr_family == AF_INET6 || addr_family == AF_UNSPEC) - { - ACE_INET_Addr addr; - addr.set (static_cast (0), ACE_IPV6_ANY); - ipv6_mreq send_mreq; - if (this->make_multicast_ifaddr6 (&send_mreq, - addr, - net_if) == -1) - return -1; - - // Only let this attempt to set unknown interface when INET6 is - // specifically requested. Otherwise we will just try INET. - if (send_mreq.ipv6mr_interface != 0 || addr_family == AF_INET6) - { - if (this->ACE_SOCK::set_option - (IPPROTO_IPV6, IPV6_MULTICAST_IF, - &(send_mreq.ipv6mr_interface), - sizeof send_mreq.ipv6mr_interface) == -1) - return -1; - } - ipv6_mif_set = send_mreq.ipv6mr_interface != 0; - } - -# if defined (ACE_WIN32) - // For Win32 net_if is distintly different between INET6 and INET - // so it is always either an INET6 if or an INET if. - if (!ipv6_mif_set && (addr_family == AF_INET || addr_family == AF_UNSPEC)) -# else - if (addr_family == AF_INET || addr_family == AF_UNSPEC) -# endif - { - ACE_INET_Addr addr (static_cast (0)); - ip_mreq send_mreq; - if (this->make_multicast_ifaddr (&send_mreq, - addr, - net_if) == -1) - { - if (!ipv6_mif_set) - return -1; - } - else if (this->ACE_SOCK::set_option (IPPROTO_IP, - IP_MULTICAST_IF, - &(send_mreq.imr_interface), - sizeof send_mreq.imr_interface) == -1) - { - if (!ipv6_mif_set) - return -1; - } - } -# else /* ACE_HAS_IPV6 */ - ACE_UNUSED_ARG (addr_family); - ACE_INET_Addr addr (static_cast (0)); - ip_mreq send_mreq; - if (this->make_multicast_ifaddr (&send_mreq, - addr, - net_if) == -1) - return -1; - if (this->ACE_SOCK::set_option (IPPROTO_IP, - IP_MULTICAST_IF, - &(send_mreq.imr_interface), - sizeof send_mreq.imr_interface) == -1) - return -1; -# endif /* !ACE_HAS_IPV6 */ -#else /* IP_MULTICAST_IF */ - // Send interface option not supported - ignore it. - // (We may have been invoked by ::subscribe, so we have to allow - // a non-null interface parameter in this function.) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Send interface specification not ") - ACE_LIB_TEXT ("supported - IGNORED.\n"))); -#endif /* !IP_MULTICAST_IF */ - - return 0; -} - -int -ACE_SOCK_Dgram::make_multicast_ifaddr (ip_mreq *ret_mreq, - const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::make_multicast_ifaddr"); - ip_mreq lmreq; // Scratch copy. - if (net_if != 0) - { -#if defined (ACE_WIN32) || defined(__INTERIX) - // This port number is not necessary, just convenient - ACE_INET_Addr interface_addr; - if (interface_addr.set (mcast_addr.get_port_number (), net_if) == -1) - return -1; - lmreq.imr_interface.s_addr = - ACE_HTONL (interface_addr.get_ip_address ()); -#else - ifreq if_address; - - ACE_OS::strcpy (if_address.ifr_name, ACE_TEXT_ALWAYS_CHAR (net_if)); - - if (ACE_OS::ioctl (this->get_handle (), - SIOCGIFADDR, - &if_address) == -1) - return -1; - - sockaddr_in *socket_address; - socket_address = reinterpret_cast (&if_address.ifr_addr); - lmreq.imr_interface.s_addr = socket_address->sin_addr.s_addr; -#endif /* ACE_WIN32 || __INTERIX */ - } - else - lmreq.imr_interface.s_addr = INADDR_ANY; - - lmreq.IMR_MULTIADDR.s_addr = ACE_HTONL (mcast_addr.get_ip_address ()); - - // Set return info, if requested. - if (ret_mreq) - *ret_mreq = lmreq; - - return 0; -} - -#if defined (ACE_HAS_IPV6) -// XXX: This will not work on any operating systems that do not support -// if_nametoindex or that is not Win32 >= Windows XP/Server 2003 -int -ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq, - const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::make_multicast_ifaddr6"); - ipv6_mreq lmreq; // Scratch copy. - - ACE_OS::memset (&lmreq, - 0, - sizeof (lmreq)); - -#if defined(__linux__) - if (net_if != 0) - { - lmreq.ipv6mr_interface = ACE_OS::if_nametoindex (ACE_TEXT_ALWAYS_CHAR(net_if)); - } - else -#elif defined (ACE_WIN32) - if (net_if != 0) - { - int if_ix = 0; - bool num_if = - ACE_OS::ace_isdigit (net_if[0]) && - (if_ix = ACE_OS::atoi (net_if)) > 0; - - IP_ADAPTER_ADDRESSES tmp_addrs; - // Initial call to determine actual memory size needed - DWORD dwRetVal; - ULONG bufLen = 0; - if ((dwRetVal = ::GetAdaptersAddresses (AF_INET6, - 0, - NULL, - &tmp_addrs, - &bufLen)) != ERROR_BUFFER_OVERFLOW) - return -1; // With output bufferlength 0 this can't be right. - - // Get required output buffer and retrieve info for real. - PIP_ADAPTER_ADDRESSES pAddrs; - char *buf; - ACE_NEW_RETURN (buf, - char[bufLen], - -1); - pAddrs = reinterpret_cast (buf); - if ((dwRetVal = ::GetAdaptersAddresses (AF_INET6, - 0, - NULL, - pAddrs, - &bufLen)) != NO_ERROR) - { - delete[] buf; // clean up - return -1; - } - - lmreq.ipv6mr_interface = 0; // initialize - while (pAddrs) - { - if ((num_if && pAddrs->Ipv6IfIndex == static_cast(if_ix)) - || (!num_if && - (ACE_OS::strcmp (ACE_TEXT_ALWAYS_CHAR (net_if), - pAddrs->AdapterName) == 0 - || ACE_OS::strcmp (ACE_TEXT_ALWAYS_CHAR (net_if), - ACE_Wide_To_Ascii (pAddrs->FriendlyName).char_rep()) == 0))) - { - lmreq.ipv6mr_interface = pAddrs->Ipv6IfIndex; - break; - } - - pAddrs = pAddrs->Next; - } - - delete[] buf; // clean up - } - else -#endif /* ACE_WIN32 */ - lmreq.ipv6mr_interface = 0; - - // now set the multicast address - ACE_OS::memcpy (&lmreq.ipv6mr_multiaddr, - &((sockaddr_in6 *) mcast_addr.get_addr ())->sin6_addr, - sizeof (in6_addr)); - - // Set return info, if requested. - if (ret_mreq) - *ret_mreq = lmreq; - - return 0; -} -#endif /* __linux__ && ACE_HAS_IPV6 */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram.h b/ace/SOCK_Dgram.h deleted file mode 100644 index c78b731db40..00000000000 --- a/ace/SOCK_Dgram.h +++ /dev/null @@ -1,239 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SOCK_Dgram.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SOCK_DGRAM_H -#define ACE_SOCK_DGRAM_H -#include /**/ "ace/pre.h" - -#include "ace/SOCK.h" -#include "ace/INET_Addr.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_SOCK_Dgram - * - * @brief Defines the member functions for the ACE_SOCK datagram - * abstraction. - */ -class ACE_Export ACE_SOCK_Dgram : public ACE_SOCK -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_SOCK_Dgram (void); - - /// This is a BSD-style method (i.e., no QoS) for initiating a socket - /// dgram that will accept datagrams at the address. - ACE_SOCK_Dgram (const ACE_Addr &local, - int protocol_family = ACE_PROTOCOL_FAMILY_INET, - int protocol = 0, - int reuse_addr = 0); - - /** - * This is a QoS-enabed method for initiating a socket dgram that - * will accept datagrams at the address. The - * are passed to . - */ - ACE_SOCK_Dgram (const ACE_Addr &local, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g = 0, - u_long flags = 0, - int reuse_addr = 0); - - /// This is a BSD-style method (i.e., no QoS) for initiating a socket - /// dgram that will accept datagrams at the address. - int open (const ACE_Addr &local, - int protocol_family = ACE_PROTOCOL_FAMILY_INET, - int protocol = 0, - int reuse_addr = 0); - - /** - * This is a QoS-enabed method for initiating a socket dgram that - * will accept datagrams at the address. The - * are passed to . - */ - int open (const ACE_Addr &local, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g = 0, - u_long flags = 0, - int reuse_addr = 0); - - /// Default dtor. - ~ACE_SOCK_Dgram (void); - - // = Data transfer routines. - /// Send an byte to the datagram socket (uses ). - ssize_t send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags = 0) const; - - /// Receive an byte from the datagram socket (uses - /// ). - ssize_t recv (void *buf, - size_t n, - ACE_Addr &addr, - int flags = 0) const; - - /** - * Allows a client to read from a socket without having to provide a - * buffer to read. This method determines how much data is in the - * socket, allocates a buffer of this size, reads in the data, and - * returns the number of bytes read. The caller is responsible for - * deleting the member in the field of using the - * ``delete []'' syntax. - */ - ssize_t recv (iovec *io_vec, - ACE_Addr &addr, - int flags = 0, - const ACE_Time_Value *timeout = 0) const; - - /// Send an of size to the datagram socket (uses - /// ). - ssize_t send (const iovec iov[], - int n, - const ACE_Addr &addr, - int flags = 0) const; - - /// Recv an of size to the datagram socket (uses - /// ). - ssize_t recv (iovec iov[], - int n, - ACE_Addr &addr, - int flags = 0) const; - - /** - * Wait up to amount of time to receive a datagram into - * . The indicates how long to blocking - * trying to receive. If == 0, the caller will block - * until action is possible, else will wait until the relative time - * specified in * elapses). If times out a -1 is - * returned with . If it succeeds the number of - * bytes received is returned. - */ - ssize_t recv (void *buf, - size_t n, - ACE_Addr &addr, - int flags, - const ACE_Time_Value *timeout) const; - - /** - * Wait up to amount of time to send a datagram to - * . The indicates how long to blocking - * trying to receive. If == 0, the caller will block - * until action is possible, else will wait until the relative time - * specified in * elapses). If times out a -1 is - * returned with . If it succeeds the number of - * bytes sent is returned. - */ - ssize_t send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags, - const ACE_Time_Value *timeout) const; - - /// Send worth of to using overlapped - /// I/O (uses ). Returns 0 on success. - ssize_t send (const iovec buffers[], - int buffer_count, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr &addr, - ACE_OVERLAPPED *overlapped, - ACE_OVERLAPPED_COMPLETION_FUNC func) const; - - /// Recv worth of from using - /// overlapped I/O (uses ). Returns 0 on success. - ssize_t recv (iovec buffers[], - int buffer_count, - size_t &number_of_bytes_recvd, - int &flags, - ACE_Addr &addr, - ACE_OVERLAPPED *overlapped, - ACE_OVERLAPPED_COMPLETION_FUNC func) const; - - /// Send an byte to the datagram socket (uses ). - ssize_t send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags, - ACE_OVERLAPPED *overlapped, - ACE_OVERLAPPED_COMPLETION_FUNC func) const; - - /// Receive an byte from the datagram socket (uses - /// ). - ssize_t recv (void *buf, - size_t n, - ACE_Addr &addr, - int flags, - ACE_OVERLAPPED *overlapped, - ACE_OVERLAPPED_COMPLETION_FUNC func) const; - - // = Meta-type info. - typedef ACE_INET_Addr PEER_ADDR; - - /// Dump the state of an object. - void dump (void) const; - - /// Set NIC to use as multicast interface. - int set_nic (const ACE_TCHAR *net_if, - int addr_family = AF_UNSPEC); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Open is shared by this and by . - int shared_open (const ACE_Addr &local, - int protocol_family); - - /// Create a multicast addr/if pair, in format useful for system calls. - /// If mreq param is NULL, just verify the passed addr/interface specs. - int make_multicast_ifaddr (ip_mreq *mreq, // Put result here, if != NULL. - const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if); - -#if defined (ACE_HAS_IPV6) - /// Create a multicast addr/if pair, in format useful for system calls. - /// If mreq param is NULL, just verify the passed addr/interface specs. - int make_multicast_ifaddr6 (ipv6_mreq *mreq, // Put result here, if != NULL. - const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if); - -#endif /* ACE_HAS_IPV6 */ - -private: - /// Do not allow this function to percolate up to this interface... - int get_remote_addr (ACE_Addr &) const; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_Dgram.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SOCK_DGRAM_H */ diff --git a/ace/SOCK_Dgram.inl b/ace/SOCK_Dgram.inl deleted file mode 100644 index 55343b13668..00000000000 --- a/ace/SOCK_Dgram.inl +++ /dev/null @@ -1,167 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// SOCK_Dgram.i - -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Here's the simple-minded constructor. - -ACE_INLINE -ACE_SOCK_Dgram::ACE_SOCK_Dgram (void) -{ - ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram"); -} - -ACE_INLINE -ACE_SOCK_Dgram::~ACE_SOCK_Dgram (void) -{ - ACE_TRACE ("ACE_SOCK_Dgram::~ACE_SOCK_Dgram"); -} - -// an N byte datagram to (connectionless version). - -ACE_INLINE ssize_t -ACE_SOCK_Dgram::send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::send"); - sockaddr *saddr = (sockaddr *) addr.get_addr (); - int len = addr.get_size (); - return ACE_OS::sendto (this->get_handle (), - (const char *) buf, - n, - flags, - (struct sockaddr *) saddr, - len); -} - -// an n byte datagram (connectionless version). - -ACE_INLINE ssize_t -ACE_SOCK_Dgram::recv (void *buf, - size_t n, - ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::recv"); - sockaddr *saddr = (sockaddr *) addr.get_addr (); - int addr_len = addr.get_size (); - - ssize_t status = ACE_OS::recvfrom (this->get_handle (), - (char *) buf, - n, - flags, - (sockaddr *) saddr, - &addr_len); - addr.set_size (addr_len); - addr.set_type (reinterpret_cast (saddr)->sin_family); - return status; -} - -ACE_INLINE ssize_t -ACE_SOCK_Dgram::send (const iovec buffers[], - int buffer_count, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr &addr, - ACE_OVERLAPPED *overlapped, - ACE_OVERLAPPED_COMPLETION_FUNC func) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::send"); - sockaddr *saddr = (sockaddr *) addr.get_addr (); - int len = addr.get_size (); - return ACE_OS::sendto (this->get_handle (), - buffers, - buffer_count, - number_of_bytes_sent, - flags, - (const sockaddr *) saddr, - len, - overlapped, - func); -} - -ACE_INLINE ssize_t -ACE_SOCK_Dgram::recv (iovec buffers[], - int buffer_count, - size_t &number_of_bytes_recvd, - int &flags, - ACE_Addr &addr, - ACE_OVERLAPPED *overlapped, - ACE_OVERLAPPED_COMPLETION_FUNC func) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::recv"); - sockaddr *saddr = (sockaddr *) addr.get_addr (); - int addr_len = addr.get_size (); - - ssize_t status = ACE_OS::recvfrom (this->get_handle (), - buffers, - buffer_count, - number_of_bytes_recvd, - flags, - (sockaddr *) saddr, - &addr_len, - overlapped, - func); - addr.set_size (addr_len); - addr.set_type (reinterpret_cast (saddr)->sin_family); - return status; -} - -// an N byte datagram to (connectionless version). - -ACE_INLINE ssize_t -ACE_SOCK_Dgram::send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags, - ACE_OVERLAPPED *overlapped, - ACE_OVERLAPPED_COMPLETION_FUNC func) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::send"); - - iovec buffer[1]; - buffer[0].iov_len = static_cast (n); // Betting on < 4G - buffer[0].iov_base = (char *) buf; - size_t number_of_bytes_sent = 0; - return this->send (buffer, - 1, - number_of_bytes_sent, - flags, - addr, - overlapped, - func); -} - -// an n byte datagram (connectionless version). - -ACE_INLINE ssize_t -ACE_SOCK_Dgram::recv (void *buf, - size_t n, - ACE_Addr &addr, - int flags, - ACE_OVERLAPPED *overlapped, - ACE_OVERLAPPED_COMPLETION_FUNC func) const -{ - ACE_TRACE ("ACE_SOCK_Dgram::recv"); - - iovec buffer[1]; - buffer[0].iov_len = static_cast (n); // Betting on < 4G - buffer[0].iov_base = (char *) buf; - size_t number_of_bytes_recvd = 0; - return this->recv (buffer, - 1, - number_of_bytes_recvd, - flags, - addr, - overlapped, - func); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram_Bcast.cpp b/ace/SOCK_Dgram_Bcast.cpp deleted file mode 100644 index 2bca65d6538..00000000000 --- a/ace/SOCK_Dgram_Bcast.cpp +++ /dev/null @@ -1,380 +0,0 @@ -// $Id$ - -#include "ace/SOCK_Dgram_Bcast.h" - -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/OS_NS_string.h" -#include "ace/os_include/net/os_if.h" -#include "ace/OS_NS_netdb.h" -#include "ace/OS_Memory.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_Dgram_Bcast.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SOCK_Dgram_Bcast, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Dgram_Bcast) - -ACE_Bcast_Node::ACE_Bcast_Node (ACE_INET_Addr &addr, - ACE_Bcast_Node *next) - : bcast_addr_ (addr), - next_ (next) -{ - ACE_TRACE ("ACE_Bcast_Node::ACE_Bcast_Node"); -} - -void -ACE_SOCK_Dgram_Bcast::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Close up and release resources. - -int -ACE_SOCK_Dgram_Bcast::close (void) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::close"); - - ACE_Bcast_Node *temp = this->if_list_; - this->if_list_ = 0; - - // Release the dynamically allocated memory. - - while (temp != 0) - { - ACE_Bcast_Node *hold = temp->next_; - delete temp; - temp = hold; - } - - // Shut down the descriptor. - return ACE_SOCK::close (); -} - -// Here's the simple-minded constructor. - -ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast (void) - : if_list_ (0) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast"); -} - -// Here's the general-purpose constructor used by a connectionless -// datagram ``server''... - -ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast (const ACE_Addr &local, - int protocol_family, - int protocol, - int reuse_addr, - const ACE_TCHAR *host_name) - : ACE_SOCK_Dgram (local, protocol_family, protocol, reuse_addr), - if_list_ (0) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast"); - - if (this->mk_broadcast (host_name) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_Dgram_Bcast"))); -} - -// Here's the general-purpose open routine. - -int -ACE_SOCK_Dgram_Bcast::open (const ACE_Addr &local, - int protocol_family, - int protocol, - int reuse_addr, - const ACE_TCHAR *host_name) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::open"); - - if (this->ACE_SOCK_Dgram::open (local, protocol_family, - protocol, reuse_addr) == -1) - return -1; - - return this->mk_broadcast (host_name); -} - -// Make broadcast available for Datagram socket. - -int -ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::mk_broadcast"); - - int one = 1; - - if (ACE_OS::setsockopt (this->get_handle (), - SOL_SOCKET, - SO_BROADCAST, - (char *) &one, - sizeof one) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: setsockopt failed"), - -1); - -#if !defined (ACE_WIN32) && !defined(__INTERIX) - ACE_HANDLE s = this->get_handle (); - - char buf[BUFSIZ]; - struct ifconf ifc; - - ifc.ifc_len = sizeof buf; - ifc.ifc_buf = buf; - - // Get interface structure and initialize the addresses using UNIX - // techniques. - if (ACE_OS::ioctl (s, - SIOCGIFCONF, - (char *) &ifc) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: ioctl (get interface configuration)"), - ACE_INVALID_HANDLE); - - struct ifreq *ifr = ifc.ifc_req; - - struct sockaddr_in host_addr; - - // Get host ip address - if (host_name) - { - hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_ALWAYS_CHAR (host_name)); - - if (hp == 0) - return -1; - else -#if defined(_UNICOS) - { - ACE_UINT64 haddr; // a place to put the address - char * haddrp = (char *) &haddr; // convert to char pointer - ACE_OS::memcpy(haddrp,(char *) hp->h_addr,hp->h_length); - host_addr.sin_addr.s_addr = haddr; - } -#else /* ! _UNICOS */ - ACE_OS::memcpy ((char *) &host_addr.sin_addr.s_addr, - (char *) hp->h_addr, - hp->h_length); -#endif /* ! _UNICOS */ - } - - -#if !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_VXWORKS) && !defined(__APPLE__) - for (int n = ifc.ifc_len / sizeof (struct ifreq) ; n > 0; - n--, ifr++) -#else - /* - There are addresses longer than sizeof (struct sockaddr) eg. IPv6 - or QNX::links. In this case address does not fit into struct ifreq. - The code below could be applied everywhere, but not every system - provides sockaddr.sa_len field. - */ - for (int nbytes = ifc.ifc_len; nbytes >= (int) sizeof (struct ifreq) && - ((ifr->ifr_addr.sa_len > sizeof (struct sockaddr)) ? - (nbytes >= (int) sizeof (ifr->ifr_name) + ifr->ifr_addr.sa_len) : 1); - ((ifr->ifr_addr.sa_len > sizeof (struct sockaddr)) ? - (nbytes -= sizeof (ifr->ifr_name) + ifr->ifr_addr.sa_len, - ifr = (struct ifreq *) - ((caddr_t) &ifr->ifr_addr + ifr->ifr_addr.sa_len)) : - (nbytes -= sizeof (struct ifreq), ifr++))) -#endif /* !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_VXWORKS) && !defined(__APPLE__) */ - { -#if defined (__QNX__) || defined (ACE_VXWORKS) - // Silently skip link interfaces - if (ifr->ifr_addr.sa_family == AF_LINK) - continue; -#endif /* __QNX__ */ - // Compare host ip address with interface ip address. - if (host_name) - { - struct sockaddr_in if_addr; - - ACE_OS::memcpy (&if_addr, - &ifr->ifr_addr, - sizeof if_addr); - - if (host_addr.sin_addr.s_addr != if_addr.sin_addr.s_addr) - continue; - } - - if (ifr->ifr_addr.sa_family != AF_INET) - { - // Note that some systems seem to generate 0 (AF_UNDEF) for - // the sa_family, even when there are no errors! Thus, we - // only print an error if this is not the case, or if we're - // in "debugging" mode. - if (ifr->ifr_addr.sa_family != 0 - || ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - "warning %p: sa_family: %d\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: Not AF_INET", - ifr->ifr_addr.sa_family)); - continue; - } - - struct ifreq flags = *ifr; - struct ifreq if_req = *ifr; - - if (ACE_OS::ioctl (s, - SIOCGIFFLAGS, - (char *) &flags) == -1) - { - ACE_ERROR ((LM_ERROR, "%p [%s]\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: ioctl (get interface flags)", - flags.ifr_name)); - continue; - } - - if (ACE_BIT_ENABLED (flags.ifr_flags, - IFF_UP) == 0) - { - ACE_ERROR ((LM_ERROR, "%p [%s]\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: Network interface is not up", - flags.ifr_name)); - continue; - } - - if (ACE_BIT_ENABLED (flags.ifr_flags, - IFF_LOOPBACK)) - continue; - - if (ACE_BIT_ENABLED (flags.ifr_flags, - IFF_BROADCAST)) - { - if (ACE_OS::ioctl (s, - SIOCGIFBRDADDR, - (char *) &if_req) == -1) - ACE_ERROR ((LM_ERROR, "%p [%s]\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: ioctl (get broadaddr)", - flags.ifr_name)); - else - { - ACE_INET_Addr addr (reinterpret_cast - (&if_req.ifr_broadaddr), - sizeof if_req.ifr_broadaddr); - ACE_NEW_RETURN (this->if_list_, - ACE_Bcast_Node (addr, - this->if_list_), - -1); - } - } - else - { - if (host_name != 0) - ACE_ERROR ((LM_ERROR, "%p [%s]\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: Broadcast is not enable for this interface.", - flags.ifr_name)); - } - } -#else - ACE_UNUSED_ARG (host_name); - - ACE_INET_Addr addr (u_short (0), - ACE_UINT32 (INADDR_BROADCAST)); - ACE_NEW_RETURN (this->if_list_, - ACE_Bcast_Node (addr, - this->if_list_), - -1); -#endif /* !ACE_WIN32 && !__INTERIX */ - if (this->if_list_ == 0) - { - errno = ENXIO; - return -1; - } - else - return 0; -} - -// Broadcast the datagram to every interface. Returns the average -// number of bytes sent. - -ssize_t -ACE_SOCK_Dgram_Bcast::send (const void *buf, - size_t n, - u_short port_number, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::send"); - ssize_t iterations = 0; - ssize_t total_bytes = 0; - - if (this->if_list_ == 0) - return -1; - - for (ACE_Bcast_Node *temp = this->if_list_; - temp != 0; - temp = temp->next_) - { - temp->bcast_addr_.set_port_number (port_number); - - ssize_t bytes_sent = ACE_SOCK_Dgram::send (buf, - n, - temp->bcast_addr_, - flags); - - if (bytes_sent == -1) - return -1; - else - total_bytes += bytes_sent; - - iterations++; - } - - return iterations == 0 ? 0 : total_bytes / iterations; -} - -#if defined (ACE_HAS_MSG) -// Broadcast datagram to every interfaces. - -ssize_t -ACE_SOCK_Dgram_Bcast::send (const iovec iov[], - int n, - u_short port_number, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::send"); - - if (this->if_list_ == 0) - return -1; - - // Send the message to every interface. - - for (ACE_Bcast_Node *temp = this->if_list_; - temp != 0; - temp = temp->next_) - { - temp->bcast_addr_.set_port_number (port_number); - - if (ACE_SOCK_Dgram::send (iov, - n, - temp->bcast_addr_, - flags) == -1) - return -1; - } - - return 0; -} - -// Broadcast an iovec of size N to ADDR as a datagram (note that addr -// must be preassigned to the broadcast address of the subnet...). - -ssize_t -ACE_SOCK_Dgram_Bcast::send (const iovec iov[], - int n, - const ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::send"); - - return ACE_SOCK_Dgram::send (iov, n, addr, flags); -} -#endif /* ACE_HAS_MSG */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram_Bcast.h b/ace/SOCK_Dgram_Bcast.h deleted file mode 100644 index de0c80cb9e9..00000000000 --- a/ace/SOCK_Dgram_Bcast.h +++ /dev/null @@ -1,140 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SOCK_Dgram_Bcast.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_SOCK_DGRAM_BCAST_H -#define ACE_SOCK_DGRAM_BCAST_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SOCK_Dgram.h" -#include "ace/INET_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Bcast_Node - * - * @brief Linked list of broadcast interfaces. - */ -class ACE_Export ACE_Bcast_Node -{ -public: - /// Default constructor. - ACE_Bcast_Node (ACE_INET_Addr &, - ACE_Bcast_Node *); - - /// Destructor. - ~ACE_Bcast_Node (void); - - /// Broadcast address for the interface. - ACE_INET_Addr bcast_addr_; - - /// Pointer to the next interface in the chain. - ACE_Bcast_Node *next_; -}; - -/** - * @class ACE_SOCK_Dgram_Bcast - * - * @brief Defines the member functions for the ACE_SOCK datagram - * abstraction. - */ -class ACE_Export ACE_SOCK_Dgram_Bcast : public ACE_SOCK_Dgram -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_SOCK_Dgram_Bcast (void); - - ACE_SOCK_Dgram_Bcast (const ACE_Addr &local, - int protocol_family = PF_INET, - int protocol = 0, - int reuse_addr = 0, - const ACE_TCHAR *host_name = 0); - - /// Default dtor. - ~ACE_SOCK_Dgram_Bcast (void); - - // Initiate a connectionless datagram broadcast endpoint. - - /// Initiate a connectionless datagram broadcast endpoint. - int open (const ACE_Addr &local, - int protocol_family = PF_INET, - int protocol = 0, - int reuse_addr = 0, - const ACE_TCHAR *host_name = 0); - - /// Close up and release dynamically allocated resources. - int close (void); - - /// Broadcast the datagram to every interface. Returns the average - /// number of bytes sent. - ssize_t send (const void *buf, - size_t n, - u_short portnum, - int flags = 0) const; - - /// Broadcast the datagrams to every interface. Returns the - /// average number of bytes sent. - ssize_t send (const iovec iov[], - int n, - u_short portnum, - int flags = 0) const; - - /// Broadcast an N byte datagram to ADDR (note that addr must be - /// preassigned to the broadcast address of the subnet...). - ssize_t send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags = 0) const; - - /** - * Broadcast an @a iovec of size @a n to @a addr as a datagram (note - * that addr must be preassigned to the broadcast address of the - * subnet...) - */ - ssize_t send (const iovec iov[], - int n, - const ACE_Addr &addr, - int flags = 0) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Make broadcast available for Datagram socket. - int mk_broadcast (const ACE_TCHAR *host_name); - - /// Points to the head of the list of broadcast interfaces. - ACE_Bcast_Node *if_list_; - - /// Do not allow this function to percolate up to this interface... - int get_remote_addr (ACE_Addr &) const; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_Dgram_Bcast.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SOCK_DGRAM_BCAST_H */ diff --git a/ace/SOCK_Dgram_Bcast.inl b/ace/SOCK_Dgram_Bcast.inl deleted file mode 100644 index 00bb342be5e..00000000000 --- a/ace/SOCK_Dgram_Bcast.inl +++ /dev/null @@ -1,37 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Bcast_Node::~ACE_Bcast_Node (void) -{ -} - -ACE_INLINE -ACE_SOCK_Dgram_Bcast::~ACE_SOCK_Dgram_Bcast (void) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::~ACE_SOCK_Dgram_Bcast"); -} - -// Broadcast an N byte datagram to ADDR (note that addr must be -// preassigned to the broadcast address of the subnet...) - -ACE_INLINE ssize_t -ACE_SOCK_Dgram_Bcast::send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram_Bcast::send"); - - sockaddr *saddr = (sockaddr *) addr.get_addr (); - int len = addr.get_size (); - return ACE_OS::sendto (this->get_handle (), (const char *) buf, n, flags, - (struct sockaddr *) saddr, len); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp deleted file mode 100644 index 5f325a7e519..00000000000 --- a/ace/SOCK_Dgram_Mcast.cpp +++ /dev/null @@ -1,993 +0,0 @@ -// $Id$ - -#include "ace/SOCK_Dgram_Mcast.h" - -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_errno.h" -#include "ace/os_include/net/os_if.h" -#include "ace/os_include/arpa/os_inet.h" - -#if defined (__linux__) && defined (ACE_HAS_IPV6) -#include "ace/OS_NS_sys_socket.h" -#endif - -#if defined (ACE_HAS_IPV6) && defined (ACE_WIN32) -#include /**/ -#endif - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_Dgram_Mcast.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - SOCK_Dgram_Mcast, - "$Id$") - -#include "ace/Log_Msg.h" - -// This is a workaround for platforms with non-standard -// definitions of the ip_mreq structure -#if ! defined (IMR_MULTIADDR) -#define IMR_MULTIADDR imr_multiaddr -#endif /* ! defined (IMR_MULTIADDR) */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Helper (inline) functions. -class ACE_SDM_helpers -{ -public: - // Convert ACE_INET_Addr to string, using local formatting rules. - - static void addr_to_string (const ACE_INET_Addr &ip_addr, - ACE_TCHAR *ret_string, // results here. - size_t len, - int clip_portnum) // clip port# info? - { - if (ip_addr.addr_to_string (ret_string, len, 1) == -1) - ACE_OS::strcpy (ret_string, ACE_LIB_TEXT ("")); - else - { - ACE_TCHAR *pc = ACE_OS::strrchr (ret_string, ACE_LIB_TEXT (':')); - if (clip_portnum && pc) - *pc = ACE_LIB_TEXT ('\0'); // clip port# info. - } - } - // op== for ip_mreq structs. - static int is_equal (const ip_mreq &m1, const ip_mreq &m2) - { - return m1.IMR_MULTIADDR.s_addr == m2.IMR_MULTIADDR.s_addr - && m1.imr_interface.s_addr == m2.imr_interface.s_addr; - } -}; - -ACE_ALLOC_HOOK_DEFINE (ACE_SOCK_Dgram_Mcast) - -void -ACE_SOCK_Dgram_Mcast::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - -# if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) - ACE_TCHAR addr_string[MAXNAMELEN + 1]; - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\nOptions: bindaddr=%s, nulliface=%s\n"), - ACE_BIT_ENABLED (this->opts_, OPT_BINDADDR_YES) ? - ACE_LIB_TEXT ("") : ACE_LIB_TEXT (""), - ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL) ? - ACE_LIB_TEXT ("") : ACE_LIB_TEXT (""))); - - // Show default send addr, port#, and interface. - ACE_SDM_helpers::addr_to_string (this->send_addr_, addr_string, - sizeof addr_string, 0); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Send addr=%s iface=%s\n"), - addr_string, - this->send_net_if_ ? this->send_net_if_ - : ACE_LIB_TEXT (""))); - - // Show list of subscribed addresses. - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("Subscription list:\n"))); - - ACE_MT (ACE_GUARD (ACE_SDM_LOCK, guard, this->subscription_list_lock_)); - subscription_list_iter_t iter (this->subscription_list_); - for ( ; !iter.done (); iter.advance ()) - { - ACE_TCHAR iface_string[MAXNAMELEN + 1]; - ip_mreq *pm = iter.next (); - - // Get subscribed address (w/out port# info - not relevant). - ACE_INET_Addr ip_addr (static_cast (0), - ACE_NTOHL (pm->IMR_MULTIADDR.s_addr)); - ACE_SDM_helpers::addr_to_string (ip_addr, addr_string, - sizeof addr_string, 1); - - // Get interface address/specification. - ACE_INET_Addr if_addr (static_cast (0), - ACE_NTOHL (pm->imr_interface.s_addr)); - ACE_SDM_helpers::addr_to_string (if_addr, iface_string, - sizeof iface_string, 1); - if (ACE_OS::strcmp (iface_string, ACE_LIB_TEXT ("0.0.0.0")) == 0) - // Receives on system default iface. (Note that null_iface_opt_ - // option processing has already occurred.) - ACE_OS::strcpy (iface_string, ACE_LIB_TEXT ("")); - - // Dump info. - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\taddr=%s iface=%s\n"), - addr_string, - iface_string)); - } -# endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Constructor. -ACE_SOCK_Dgram_Mcast::ACE_SOCK_Dgram_Mcast - (ACE_SOCK_Dgram_Mcast::options opts) - : opts_ (opts), - send_net_if_ (0) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::ACE_SOCK_Dgram_Mcast"); -} - -// Destructor. -ACE_SOCK_Dgram_Mcast::~ACE_SOCK_Dgram_Mcast (void) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::~ACE_SOCK_Dgram_Mcast"); - - // Free memory and optionally unsubscribe from currently subscribed group(s). - delete [] this->send_net_if_; - this->clear_subs_list (); -} - -int -ACE_SOCK_Dgram_Mcast::open (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::open"); - - // Only perform the initialization if we haven't been opened - // earlier. - // No sanity check? We should probably flag an error if the user - // makes multiple calls to open(). - if (this->get_handle () != ACE_INVALID_HANDLE) - return 0; - - // Invoke lower-layer ::open. - if (ACE_SOCK::open (SOCK_DGRAM, - mcast_addr.get_type (), - 0, // always use 0 - reuse_addr) == -1) - return -1; - - return this->open_i (mcast_addr, net_if, reuse_addr); -} - -int -ACE_SOCK_Dgram_Mcast::open_i (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::open_i"); - // ACE_SOCK::open calls this if reuse_addr is set, so we only need to - // process port reuse option. - if (reuse_addr) - { -#if defined (SO_REUSEPORT) - int one = 1; - if (this->ACE_SOCK::set_option (SOL_SOCKET, - SO_REUSEPORT, - &one, - sizeof one) == -1) - return -1; -#endif /* SO_REUSEPORT */ - } - - // Create an address/port# to bind the socket to. Use mcast_addr to - // initialize bind_addy to pick up the correct protocol family. If - // OPT_BINDADDR_YES is set, then we're done. Else use mcast_addr's - // port number and use the "any" address. - ACE_INET_Addr bind_addy (mcast_addr); - if (ACE_BIT_DISABLED (this->opts_, OPT_BINDADDR_YES)) - { -#if defined (ACE_HAS_IPV6) - if (mcast_addr.get_type () == PF_INET6) - { - if (bind_addy.set (mcast_addr.get_port_number (), "::", - 1, AF_INET6) == -1) - return -1; - } - else - // Bind to "any" address and explicit port#. - if (bind_addy.set (mcast_addr.get_port_number ()) == -1) - return -1; -#else - // Bind to "any" address and explicit port#. - if (bind_addy.set (mcast_addr.get_port_number ()) == -1) - return -1; -#endif /* ACE_HAS_IPV6 */ - } - - // Bind to the address (which may be INADDR_ANY) and port# (which may be 0) - if (ACE_SOCK_Dgram::shared_open (bind_addy, bind_addy.get_type ()) == -1) - return -1; - - // Cache the actual bound address (which may be INADDR_ANY) - // and the actual bound port# (which will be a valid, non-zero port#). - ACE_INET_Addr bound_addy; - if (this->get_local_addr (bound_addy) == -1) - { - // (Unexpected failure - should be bound to something) - if (bound_addy.set (bind_addy) == -1) - { - // (Shouldn't happen - bind_addy is a valid addy; punt.) - return -1; - } - } - - this->send_addr_ = mcast_addr; - this->send_addr_.set_port_number (bound_addy.get_port_number ()); - if (net_if) - { - if (this->set_nic (net_if, mcast_addr.get_type ())) - return -1; - - this->send_net_if_ = new ACE_TCHAR[ACE_OS::strlen (net_if) + 1]; - ACE_OS::strcpy (this->send_net_if_, net_if); - } - - return 0; -} - -int -ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::subscribe_ifs"); - - if (ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL) - && net_if == 0) - { -#if defined (ACE_HAS_IPV6) - if (mcast_addr.get_type () == AF_INET6) - { - size_t nr_subscribed = 0; -# if defined(__linux__) - struct if_nameindex *intf; - - intf = ACE_OS::if_nameindex (); - - if (intf == 0) - return -1; - - int index = 0; - while (intf[index].if_index != 0 || intf[index].if_name != 0) - { - if (this->join (mcast_addr, reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0) - ++nr_subscribed; - - ++index; - } - - ACE_OS::if_freenameindex (intf); - -# elif defined (ACE_WIN32) - - IP_ADAPTER_ADDRESSES tmp_addrs; - // Initial call to determine actual memory size needed - DWORD dwRetVal; - ULONG bufLen = 0; - if ((dwRetVal = ::GetAdaptersAddresses (AF_INET6, - 0, - NULL, - &tmp_addrs, - &bufLen)) != ERROR_BUFFER_OVERFLOW) - return -1; // With output bufferlength 0 this can't be right. - - // Get required output buffer and retrieve info for real. - PIP_ADAPTER_ADDRESSES pAddrs; - char *buf; - ACE_NEW_RETURN (buf, - char[bufLen], - -1); - pAddrs = reinterpret_cast (buf); - if ((dwRetVal = ::GetAdaptersAddresses (AF_INET6, - 0, - NULL, - pAddrs, - &bufLen)) != NO_ERROR) - { - delete[] buf; // clean up - return -1; - } - - while (pAddrs) - { - if (this->join (mcast_addr, reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0) - ++nr_subscribed; - - pAddrs = pAddrs->Next; - } - - delete[] buf; // clean up - -# endif /* ACE_WIN32 */ - - if (nr_subscribed == 0) - { - errno = ENODEV; - return -1; - } - - return 1; - } - else - { - // Subscribe on all local multicast-capable network interfaces, by - // doing recursive calls with specific interfaces. - - ACE_INET_Addr *if_addrs = 0; - size_t if_cnt; - - if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) - return -1; - - size_t nr_subscribed = 0; - - if (if_cnt < 2) - { - if (this->subscribe (mcast_addr, - reuse_addr, - ACE_LIB_TEXT ("0.0.0.0")) == 0) - ++nr_subscribed; - } - else - { - // Iterate through all the interfaces, figure out which ones - // offer multicast service, and subscribe to them. - while (if_cnt > 0) - { - --if_cnt; - - // Convert to 0-based for indexing, next loop check. - if (if_addrs[if_cnt].get_type () != AF_INET || if_addrs[if_cnt].is_loopback ()) - continue; - if (this->subscribe (mcast_addr, - reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr ())) == 0) - ++nr_subscribed; - } - } - - delete [] if_addrs; - - if (nr_subscribed == 0) - { - errno = ENODEV; - return -1; - } - - // 1 indicates a "short-circuit" return. This handles the - // recursive behavior of checking all the interfaces. - return 1; - - } -#else - // Subscribe on all local multicast-capable network interfaces, by - // doing recursive calls with specific interfaces. - - ACE_INET_Addr *if_addrs = 0; - size_t if_cnt; - - if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) - return -1; - - size_t nr_subscribed = 0; - - if (if_cnt < 2) - { - if (this->subscribe (mcast_addr, - reuse_addr, - ACE_LIB_TEXT ("0.0.0.0")) == 0) - ++nr_subscribed; - } - else - { - // Iterate through all the interfaces, figure out which ones - // offer multicast service, and subscribe to them. - while (if_cnt > 0) - { - --if_cnt; - - // Convert to 0-based for indexing, next loop check. - if (if_addrs[if_cnt].is_loopback ()) - continue; - if (this->subscribe (mcast_addr, - reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr ())) == 0) - ++nr_subscribed; - } - } - - delete [] if_addrs; - - if (nr_subscribed == 0) - { - errno = ENODEV; - return -1; - } - - // 1 indicates a "short-circuit" return. This handles the - // recursive behavior of checking all the interfaces. - return 1; -#endif /* ACE_HAS_IPV6 */ - } - -#if defined (ACE_HAS_IPV6) - if (mcast_addr.get_type () == AF_INET6) - { - if (this->make_multicast_ifaddr6 (0, mcast_addr, net_if) == -1) - return -1; - } - else - { - // Validate passed multicast addr and iface specifications. - if (this->make_multicast_ifaddr (0, - mcast_addr, - net_if) == -1) - return -1; - } -#else - // Validate passed multicast addr and iface specifications. - if (this->make_multicast_ifaddr (0, - mcast_addr, - net_if) == -1) - return -1; -#endif /* ACE_HAS_IPV6 */ - - return 0; - -} - -// Subscribe and add address/iface to subscription list if successful. -int -ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr, - int reuse_addr, - const ACE_TCHAR *net_if, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::subscribe"); - - ACE_UNUSED_ARG (protocol_family); - ACE_UNUSED_ARG (protocol); - - return this->join (mcast_addr,reuse_addr, net_if); -} - -int -ACE_SOCK_Dgram_Mcast::join (const ACE_INET_Addr &mcast_addr, - int reuse_addr, - const ACE_TCHAR *net_if) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::join"); - ACE_INET_Addr subscribe_addr = mcast_addr; - - // If port# is 0, insert bound port# if it is set. (To satisfy lower-level - // port# validation.) - u_short def_port_number = this->send_addr_.get_port_number (); - if (subscribe_addr.get_port_number () == 0 - && def_port_number != 0) - { - subscribe_addr.set_port_number (def_port_number); - } - - // Check for port# different than bound port#. - u_short sub_port_number = mcast_addr.get_port_number (); - if (sub_port_number != 0 - && def_port_number != 0 - && sub_port_number != def_port_number) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Subscribed port# (%u) different than bound ") - ACE_LIB_TEXT ("port# (%u).\n"), - (u_int) sub_port_number, - (u_int) def_port_number)); - errno = ENXIO; - return -1; - } - - // If bind_addr_opt_ is enabled, check for address different than - // bound address. - ACE_INET_Addr tmp_addr (this->send_addr_); - tmp_addr.set_port_number (mcast_addr.get_port_number ()); // force equal port numbers - if (ACE_BIT_ENABLED (this->opts_, OPT_BINDADDR_YES) - && !this->send_addr_.is_any () - && this->send_addr_ != mcast_addr) - { - ACE_TCHAR sub_addr_string[MAXNAMELEN + 1]; - ACE_TCHAR bound_addr_string[MAXNAMELEN + 1]; - ACE_SDM_helpers::addr_to_string (mcast_addr, sub_addr_string, - sizeof sub_addr_string, 1); - ACE_SDM_helpers::addr_to_string (this->send_addr_, bound_addr_string, - sizeof bound_addr_string, 1); - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Subscribed address (%s) different than ") - ACE_LIB_TEXT ("bound address (%s).\n"), - sub_addr_string, - bound_addr_string)); - errno = ENXIO; - return -1; - } - - // Attempt subscription. - int result = this->subscribe_i (subscribe_addr, reuse_addr, net_if); - -#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) - if (result == 0) - { - // Add this addr/iface info to the list of subscriptions. - // (Assumes this is unique addr/iface combo - most systems don't allow - // re-sub to same addr/iface.) - ip_mreq *pmreq = new ip_mreq; - // (should not fail) - if (this->make_multicast_ifaddr (pmreq, subscribe_addr, net_if) != -1) - { - ACE_MT (ACE_GUARD_RETURN (ACE_SDM_LOCK, guard, - this->subscription_list_lock_, -1)); - this->subscription_list_.insert_tail (pmreq); - return 0; - } - // this still isn't really right. If ACE_GUARD_RETURN fails, we leak. - // Need to add one of Chris' fancy ace auto pointers (bound?). - delete pmreq; - } -#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ - - return result >= 0 ? 0 : result; -} - -// Attempt subscribe and return status. -int -ACE_SOCK_Dgram_Mcast::subscribe_i (const ACE_INET_Addr &mcast_addr, - int reuse_addr, - const ACE_TCHAR *net_if) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::subscribe_i"); - ip_mreq mreq; -#if defined (ACE_HAS_IPV6) - ipv6_mreq mreq6; -#endif /* __linux__ && ACE_HAS_IPV6 */ - - // Open the socket IFF this is the first ::subscribe and ::open - // was not explicitly invoked. - if (this->open (mcast_addr, - net_if, - reuse_addr) == -1) - return -1; - - // Only do this if net_if == 0, i.e., INADDR_ANY - if (net_if == 0) - { - int result = this->subscribe_ifs (mcast_addr, - net_if, - reuse_addr); - // Check for error or "short-circuit" return. - if (result != 0) - return result; - } - -#if defined (ACE_HAS_IPV6) - if (mcast_addr.get_type () == AF_INET6) - { - if (this->make_multicast_ifaddr6 (&mreq6, mcast_addr, net_if) == -1) - return -1; - // Tell IP stack to pass messages sent to this group. - else if (this->ACE_SOCK::set_option (IPPROTO_IPV6, - IPV6_JOIN_GROUP, - &mreq6, - sizeof mreq6) == -1) - return -1; - } - else - { - // Create multicast addr/if struct. - if (this->make_multicast_ifaddr (&mreq, mcast_addr, net_if) == -1) - return -1; - // Tell IP stack to pass messages sent to this group. - else if (this->ACE_SOCK::set_option (IPPROTO_IP, - IP_ADD_MEMBERSHIP, - &mreq, - sizeof mreq) == -1) - return -1; - - } -#else - if (this->make_multicast_ifaddr (&mreq, mcast_addr, net_if) == -1) - return -1; - // Tell IP stack to pass messages sent to this group. - // Note, this is not IPv6 compliant. - else if (this->ACE_SOCK::set_option (IPPROTO_IP, - IP_ADD_MEMBERSHIP, - &mreq, - sizeof mreq) == -1) - return -1; - -#endif /* ACE_HAS_IPV6 */ - - return 0; -} - -int -ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::unsubscribe_ifs"); - - - if (ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL) - && net_if == 0) - { -#if defined (ACE_HAS_IPV6) - if (mcast_addr.get_type () == AF_INET6) - { - size_t nr_unsubscribed = 0; -# if defined(__linux__) - - struct if_nameindex *intf; - - intf = ACE_OS::if_nameindex (); - - if (intf == 0) - return -1; - - int index = 0; - while (intf[index].if_index != 0 || intf[index].if_name != 0) - { - if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0) - ++nr_unsubscribed; - - ++index; - } - - ACE_OS::if_freenameindex (intf); - -# elif defined (ACE_WIN32) - - IP_ADAPTER_ADDRESSES tmp_addrs; - // Initial call to determine actual memory size needed - DWORD dwRetVal; - ULONG bufLen = 0; - if ((dwRetVal = ::GetAdaptersAddresses (AF_INET6, - 0, - NULL, - &tmp_addrs, - &bufLen)) != ERROR_BUFFER_OVERFLOW) - return -1; // With output bufferlength 0 this can't be right. - - // Get required output buffer and retrieve info for real. - PIP_ADAPTER_ADDRESSES pAddrs; - char *buf; - ACE_NEW_RETURN (buf, - char[bufLen], - -1); - pAddrs = reinterpret_cast (buf); - if ((dwRetVal = ::GetAdaptersAddresses (AF_INET6, - 0, - NULL, - pAddrs, - &bufLen)) != NO_ERROR) - { - delete[] buf; // clean up - return -1; - } - - while (pAddrs) - { - if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0) - ++nr_unsubscribed; - - pAddrs = pAddrs->Next; - } - - delete[] buf; // clean up - -# endif /* ACE_WIN32 */ - - if (nr_unsubscribed == 0) - { - errno = ENODEV; - return -1; - } - - return 1; - - - } - else - { - // Unsubscribe on all local multicast-capable network interfaces, by - // doing recursive calls with specific interfaces. - - ACE_INET_Addr *if_addrs = 0; - size_t if_cnt; - - // NOTE - doesn't always get all of the - // interfaces. In particular, it may not get a PPP interface. This - // is a limitation of the way works with - // old versions of MSVC. The reliable way of getting the interface - // list is available only with MSVC 5 and newer. - if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) - return -1; - - size_t nr_unsubscribed = 0; - - if (if_cnt < 2) - { - if (this->leave (mcast_addr, - ACE_LIB_TEXT ("0.0.0.0")) == 0) - ++nr_unsubscribed; - } - else - { - while (if_cnt > 0) - { - --if_cnt; - // Convert to 0-based for indexing, next loop check - if (if_addrs[if_cnt].get_type () != AF_INET || if_addrs[if_cnt].is_loopback ()) - continue; - if (this->leave (mcast_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr ())) == 0) - ++nr_unsubscribed; - } - } - - delete [] if_addrs; - - if (nr_unsubscribed == 0) - { - errno = ENODEV; - return -1; - } - - return 1; - - } -#else /* ACE_HAS_IPV6 */ - // Unsubscribe on all local multicast-capable network interfaces, by - // doing recursive calls with specific interfaces. - - ACE_INET_Addr *if_addrs = 0; - size_t if_cnt; - - // NOTE - doesn't always get all of the - // interfaces. In particular, it may not get a PPP interface. This - // is a limitation of the way works with - // old versions of MSVC. The reliable way of getting the interface list - // is available only with MSVC 5 and newer. - if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) - return -1; - - size_t nr_unsubscribed = 0; - - if (if_cnt < 2) - { - if (this->leave (mcast_addr, - ACE_LIB_TEXT ("0.0.0.0")) == 0) - ++nr_unsubscribed; - } - else - { - while (if_cnt > 0) - { - --if_cnt; - // Convert to 0-based for indexing, next loop check - if (if_addrs[if_cnt].is_loopback ()) - continue; - if (this->leave (mcast_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr ())) == 0) - ++nr_unsubscribed; - } - } - - delete [] if_addrs; - - if (nr_unsubscribed == 0) - { - errno = ENODEV; - return -1; - } - - return 1; -#endif /* !ACE_HAS_IPV6 */ - } - - return 0; -} - - -// Unsubscribe, and remove address from subscription list. -// Note: If there are duplicate entries, only finds the first in the list (this -// is a defined restriction - most environments don't allow duplicates to be -// created.) -int -ACE_SOCK_Dgram_Mcast::unsubscribe (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::unsubscribe"); - - ACE_UNUSED_ARG (protocol_family); - ACE_UNUSED_ARG (protocol); - - return this->leave (mcast_addr, net_if); -} - -int -ACE_SOCK_Dgram_Mcast::leave (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::leave"); - // Unsubscribe. - int result = this->unsubscribe_i (mcast_addr, - net_if); - -#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) - // (Unconditionally) Remove this addr/if from subscription list. - // (Addr/if is removed even if unsubscribe failed) - ip_mreq tgt_mreq; - if (this->make_multicast_ifaddr (&tgt_mreq, - mcast_addr, - net_if) != -1) - { - ACE_MT (ACE_GUARD_RETURN (ACE_SDM_LOCK, guard, - this->subscription_list_lock_, -1)); - subscription_list_iter_t iter (this->subscription_list_); - for (; !iter.done (); iter.advance ()) - { - ip_mreq *pm = iter.next (); - if (ACE_SDM_helpers::is_equal (*pm, tgt_mreq)) - { - iter.remove (); - delete pm; - break; - } - } - } -#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ - - return result >= 0 ? 0 : result; -} - -// Attempt unsubscribe and return status. -int -ACE_SOCK_Dgram_Mcast::unsubscribe_i (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::unsubscribe_i"); - - int result = this->unsubscribe_ifs (mcast_addr, - net_if); - - // Check for error or "short-circuit" return. - if (result != 0) - return result; - -#if defined (ACE_HAS_IPV6) - if (mcast_addr.get_type () == AF_INET6) - { - // Validate addr/if specifications and create addr/if struct. - ipv6_mreq mreq; - if (this->make_multicast_ifaddr6 (&mreq, mcast_addr, net_if) == -1) - { - return -1; - } - // Tell network device driver to stop reading datagrams with the - // . - else if (ACE_SOCK::set_option (IPPROTO_IPV6, - IPV6_LEAVE_GROUP, - &mreq, - sizeof mreq) == -1) - { - return -1; - } - - } - else // IPv4 - { - // Validate addr/if specifications and create addr/if struct. - ip_mreq mreq; - if (this->make_multicast_ifaddr (&mreq, mcast_addr, net_if) == -1) - { - return -1; - } - // Tell network device driver to stop reading datagrams with the - // . - else if (ACE_SOCK::set_option (IPPROTO_IP, - IP_DROP_MEMBERSHIP, - &mreq, - sizeof mreq) == -1) - { - return -1; - } - - } -#else - // Validate addr/if specifications and create addr/if struct. - ip_mreq mreq; - if (this->make_multicast_ifaddr (&mreq, mcast_addr, net_if) == -1) - { - return -1; - } - // Tell network device driver to stop reading datagrams with the - // . - // Note, this is not IPv6 friendly... - else if (ACE_SOCK::set_option (IPPROTO_IP, - IP_DROP_MEMBERSHIP, - &mreq, - sizeof mreq) == -1) - { - return -1; - } -#endif /* ACE_HAS_IPV6 */ - - return 0; -} - -int -ACE_SOCK_Dgram_Mcast::unsubscribe (void) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::unsubscribe"); - - // Can't implement this reliably without keeping an expensive list, - // and can't close the socket since the caller may want to continue - // using the socket to send() or join() new groups. Even if we - // wanted to be clever and reopen the socket, we'd need to know what - // options had been set, and reset them--and we have no way of doing - // that either. :-( - // Should this return -1? - ACE_ERROR_RETURN ((LM_INFO, - ACE_LIB_TEXT ("ACE_SOCK_Dgram_Mcast::unsubscribe (void) ") - ACE_LIB_TEXT ("has been deprecated. You must either ") - ACE_LIB_TEXT ("close to socket to unsubscribe to all ") - ACE_LIB_TEXT ("or unsubscribe to each individually.\n")), - 0); -} - -int -ACE_SOCK_Dgram_Mcast::clear_subs_list (void) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::clear_subs_list"); - int result = 0; - -#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) - ACE_MT (ACE_GUARD_RETURN (ACE_SDM_LOCK, guard, - this->subscription_list_lock_, -1)); - subscription_list_iter_t iter (this->subscription_list_); - for (; !iter.done (); /*Hack: Do _not_ ::advance after remove*/) - { - ip_mreq *pm = iter.next (); - iter.remove (); - delete pm; - } -#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram_Mcast.h b/ace/SOCK_Dgram_Mcast.h deleted file mode 100644 index 1c4437a9226..00000000000 --- a/ace/SOCK_Dgram_Mcast.h +++ /dev/null @@ -1,417 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SOCK_Dgram_Mcast.h - * - * $Id$ - * - * @author Irfan Pyrali - * @author Tim Harrison - * @author Douglas C. Schmidt - * @author Bill Fulton - * @author Don Hinton - */ -//============================================================================= - -#ifndef ACE_SOCK_DGRAM_MCAST_H -#define ACE_SOCK_DGRAM_MCAST_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SOCK_Dgram.h" -#include "ace/INET_Addr.h" - -#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) -# include "ace/Containers_T.h" -# include "ace/Synch_Traits.h" -# include "ace/Thread_Mutex.h" -# if !defined (ACE_SDM_LOCK) -# define ACE_SDM_LOCK ACE_SYNCH_MUTEX -# endif /* ACE_SDM_LOCK */ -#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SOCK_Dgram_Mcast - * - * @brief Defines the ACE socket wrapper for UDP/IP multicast. - * - * Supports multiple simultaneous subscriptions, unsubscription from one or - * all subscriptions, and independent send/recv address and interface - * specifications. Template parameters and/or ctor arguments determine - * per-instance optional functionality. - * - * Note that multicast semantics and implementation details are _very_ - * environment-specific; this class is just a wrapper around the underlying - * implementation and does not try to normalize the concept of multicast - * communications. - * - * Usage Notes: - * - Send and Recv addresses and network interfaces, but not port#, are - * independent. While this instance is open, 1 send interface (and a default - * send address) is in effect and 0, 1, or multiple recv addresses/interfaces - * are in effect. - * - The first / invocation defines the network interface - * and default address used for all sends by this instance, defines the - * port# and optionally the multicast address bound to the underlying - * socket, and defines the (one) port# that is used for all subscribes - * (subsequent subscribes must pass the same port# or '0'). - * - The default loopback state is not explicitly set; the environment will - * determine the default state. Note that some environments (e.g. some Win32) - * do not allow the default to be changed, and that the semantics of - * loopback control are environment dependent (e.g. sender vs receiver - * control). - * - In general, due to multicast design and implementation quirks/bugs, it is - * difficult to tell which address a received message was sent to or which - * interface it was received on (even if only one subscription is active). - * However; there are filtering options that can be applied, to narrow it - * down considerably. - * - * Interface specification notes (for and ): - * - If net_if == 0, the null_iface_opt option determines whether only the - * system "default" interface or all interfaces is affected. Specifying - * "all" interfaces is supported only for environments for which - * is properly implemented. - * - Multiple subscriptions for the same address but different interfaces is - * normally supported, but re-subscription to an address/interface that is - * already subscribed is normally not allowed. - * - The interface specification syntax is environment-specific. - * UNIX systems will normally use device specifications such as "le0" or - * "elxl1", while other systems will use the IP address of the interface. - * Some platforms, such as pSoS, support only cardinal numbers as network - * interface specifications; for these platforms, just give these numbers in - * alphanumeric form and will convert them into numbers via - * . - */ -class ACE_Export ACE_SOCK_Dgram_Mcast : public ACE_SOCK_Dgram -{ -public: - - /** - * @brief Option parameters. - * - * These control per-instance optional functionality. They are set via - * optional constructor arguments. - * @note Certain option values are not valid for all environments (see - * comments in source file for environment-specific restrictions). Default - * values are always valid values for the compilation environment. - */ - enum options - { - // Define whether a specific (multicast) address (in addition to the port#) - // is bound to the socket. - // Notes: - // - Effect of doing this is stack/environment dependent, but in most - // environments can be used to filter out unwanted unicast, broadcast, and - // (other) multicast messages sent to the same port#. - // - Some IP stacks (e.g. some Win32) do not support binding multicast - // addresses. Using this option will always cause an error. - // - It's not strictly possible for user code to do this level of filtering - // w/out the bind; some environments support ways to determine which address - // a message was sent _to_, but this class interface does not support access - // to that info. - // - The address (and port#) passed to (or the first , if - // is not explicitly invoked) is the one that is bound. - // - /// Disable address bind. (Bind only port.) - // Note that this might seem odd, but we need a way to distinquish between - // default behavior, which might or might not be to bind, and explicitely - // choosing to bind or not to bind--which "is the question." ;-) - OPT_BINDADDR_NO = 0, - /// Enable address bind. (Bind port and address.) - OPT_BINDADDR_YES = 1, - /// Default value for BINDADDR option. (Environment-dependent.) -#if defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING) \ - && (ACE_LACKS_PERFECT_MULTICAST_FILTERING == 1) - // Platforms that don't support perfect filtering. Note that perfect - // filtering only really applies to multicast traffic, not unicast - // or broadcast. - DEFOPT_BINDADDR = OPT_BINDADDR_YES, -# else - // At least some Win32 OS's can not bind mcast addr, so disable it. - // General-purpose default behavior is 'disabled', since effect is - // environment-specific and side-effects might be surprising. - DEFOPT_BINDADDR = OPT_BINDADDR_NO, -#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING = 1) */ - // - /// Define the interpretation of 'NULL' as a recv interface specification. - // If the interface part of a multicast address specification is NULL, it - // will be interpreted to mean either "the default interface" or "all - // interfaces", depending on the setting of this option. - // Notes: - // - The 'nulliface_all' option can not be used in environments which do - // not fully support the method - // (e.g. non-Windows). - // If it is, using NULL for iface will _always_ fail. - // - The default behavior in most IP stacks is to use the 'default' interface, - // where 'default' has rather ad-hoc semantics. - // - This applies only to receives, not sends (which always use only one - // interface; NULL means use the "system default" interface). - // Supported values: - /// If (net_if==NULL), use default interface. - // Note that this might seem odd, but we need a way to distinquish between - // default behavior, which might or might not be to bind, and explicitely - // choosing to bind or not to bind--which "is the question." ;-) - OPT_NULLIFACE_ONE = 0, - /// If (net_if==NULL), use all mcast interfaces. - OPT_NULLIFACE_ALL = 2, - /// Default value for NULLIFACE option. (Environment-dependent.) -#ifdef ACE_WIN32 - // This is the (ad-hoc) legacy behavior for Win32/WinSock. - // Notice: Older version of WinSock/MSVC may not get all multicast-capable - // interfaces (e.g. PPP interfaces). - DEFOPT_NULLIFACE = OPT_NULLIFACE_ALL, -#else - // General-purpose default behavior (as per legacy behavior). - DEFOPT_NULLIFACE = OPT_NULLIFACE_ONE, -#endif /* ACE_WIN32 */ - /// All default options. - DEFOPTS = DEFOPT_BINDADDR | DEFOPT_NULLIFACE - }; - - // = Initialization routines. - - /// Ctor - Create an unitialized instance and define per-instance optional - /// functionality. - /** - * You must invoke or , to create/bind a socket and define - * operational parameters, before performing any I/O with this instance. - */ - ACE_SOCK_Dgram_Mcast (options opts = DEFOPTS); - - /// Dtor - Release all resources and implicitly or explicitly unsubscribe - /// from all currently subscribed groups. - /** - * The OPT_DTORUNSUB_YES_ option defines whether an explicit is - * done by the destructor. If not, most systems will automatically - * unsubscribe upon the close of the socket. - */ - ~ACE_SOCK_Dgram_Mcast (void); - - /// Explicitly open/bind the socket and define the network interface - /// and default multicast address used for sending messages. - /** - * This method is optional; if not explicitly invoked, it is invoked by - * the first , using the subscribed address/port# and network - * interface paramters. - * The parameter defines the default send address/port# and - * also the port# and, if the OPT_BINDADDR_YES option is used, - * the multicast address that is bound to this socket. - * If the parameter != 0, it defines the network interface - * used for all sends by this instance, otherwise the system "default" - * interface is used. (The parameter is ignored if this - * feature is not supported by the envriornment.) - * The port# in may be 0, in which case a system-assigned - * (ephemeral) port# is used for sending and receiving. - * If != 0, the SO_REUSEADDR option and, if it is supported, - * the SO_REUSEPORT option are enabled. - * - * Returns: -1 if the call fails. Failure can occur due to problems with - * the address, port#, and/or interface parameters or during system open() - * or socket option processing. - */ - int open (const ACE_INET_Addr &mcast_addr, // Bound & sendto address. - const ACE_TCHAR *net_if = 0, // Net interface for sends. - int reuse_addr = 1); // Reuse addr/port sock opt. - - // = Multicast group subscribe/unsubscribe routines. - - /// Join a multicast group on a given interface (or all interfaces, if - /// supported). - /** - * The given group is joined on the specified interface. If option - * OPT_NULLIFACE_ALL is used and is = 0, the group is joined on - * all multicast capable interfaces (IFF supported). Multiple subscriptions - * to various address and interface combinations are supported and tracked. - * If this is the first invocation of , and was not - * previously invoked, will be invoked using for binding - * the socket and as the interface for . - * - * Returns: -1 if the call fails. Failure can occur due to problems with - * the address, port#, and/or interface parameters or during the subscription - * attempt. Once bind() has been invoked (by the first or - * ), returns errno of ENXIO if the port# is not 0 and does not - * match the bound port#, or if OPT_BINDADDR_YES option is used - * and the address does not match the bound address. Returns errno of - * ENODEV if the addr/port#/interface parameters appeared valid, but no - * subscription(s) succeeded. An error is unconditionally returned if - * option OPT_NULLIFACE_ALL is used, is NULL, and - * is not implemented in this - * environment. - * - * Note that the optional parameter does not apply to - * subscriptions; it is only used if is implicitly invoked (see above). - * - * @deprecated This method has been deprecated, please use join() instead. - * In addition, the following parameters have also been deprecated: - * and have no effect. - */ - int subscribe (const ACE_INET_Addr &mcast_addr, - int reuse_addr = 1, // (see above) - const ACE_TCHAR *net_if = 0, - int protocol_family = PF_INET, - int protocol = 0); - - // join() replaces subscribe() and uses the mcast_addr to determine - // protocol_family, and protocol which we always pass as 0 anyway. - int join (const ACE_INET_Addr &mcast_addr, - int reuse_addr = 1, // (see above) - const ACE_TCHAR *net_if = 0); - - - /// Leave a multicast group on a given interface (or all interfaces, if - /// supported). - /** - * The specified group/interface combination is unsubscribed. If option - * OPT_NULLIFACE_ALL is used and is = 0, the group is unsubscribed - * from all interfaces (IFF supported). - * - * Returns: -1 if the unsubscribe failed. Most environments will return -1 - * if there was no active subscription for this address/interface combination. - * An error is unconditionally returned if option OPT_NULLIFACE_ALL is used, - * is = 0, and is not - * implemented in this environment (_even if_ the specifies a - * non- NULL ). - * - * @deprecated This method has been deprecated. Please use leave() instead. - * In addition, and have no effect. - */ - int unsubscribe (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if = 0, - int protocol_family = PF_INET, - int protocol = 0); - - // leave() replaces unsubscribe() and uses mcast_addr to determine - // protocol_family, and protocol which we always pass as 0 anyway. - int leave (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if = 0); - - /// Unsubscribe all current subscriptions. - /** - * Unsubscribe all active group/interface subscriptions (if any). - * - * Returns -1 if any unsubscribe failed, 0 if there are no errors or no - * current subscriptions. - * - * @deprecated This method has been deprecated. Since a list of groups is - * not maintained (except when ACE_SOCK_DGRAM_MCAST_DUMPABLE is defined), - * it isn't possible to unsubscribe to all the groups without closing - * the socket. Therefore, if applications wish to unsubscribe to all - * groups without closing the socket, they much keep track of the - * subscriptions and call the above unsubscribe () for each. - */ - int unsubscribe (void); - - // = Data transfer routines. - - /// Send bytes in , using the multicast address and network interface - /// defined by the first or . - ssize_t send (const void *buf, - size_t n, - int flags = 0) const; - - /// Send , using the multicast address and network interface - /// defined by the first or . - ssize_t send (const iovec iov[], - int n, - int flags = 0) const; - - // = Options. - - /// Set a socket option. - /** - * Set an IP option that takes a char as input, such as IP_MULTICAST_LOOP - * or IP_MULTICAST_TTL. This is just a more concise, nice interface to a - * subset of possible ACE_SOCK::set_option calls, but only works for - * IPPROTO_IP or IPPROTO_IPV6 level options. - * - * Returns 0 on success, -1 on failure. - * - * @deprecated This method has been deprecated since it cannot be used - * easily with with IPv6 options. Use ACE_SOCK::set_option instead. - */ - int set_option (int option, - char optval); - - /// Dump the state of an object. - /** - * Logs the setting of all options, the bound address, the send address and - * interface, and the list of current subscriptions. - */ - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /// Subscribe to a multicast address on one or more network interface(s). - /// (No QoS support.) - int subscribe_ifs (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if, - int reuse_addr); - - /// Do subscription processing w/out updating the subscription list. - // (Layered method for processing). - int subscribe_i (const ACE_INET_Addr &mcast_addr, - int reuse_addr = 1, - const ACE_TCHAR *net_if = 0); - - /// Unsubscribe from a multicast address on one or more network interface(s). - int unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if = 0); - - /// Do unsubscription processing w/out udpating subscription list. - // (Layered method for processing). - int unsubscribe_i (const ACE_INET_Addr &mcast_addr, - const ACE_TCHAR *net_if = 0); - -protected: - - /// Contains common open functionality so that inheriting classes can - /// reuse it. - int open_i (const ACE_INET_Addr &mcast_addr, // Bound & sendto address. - const ACE_TCHAR *net_if = 0, // Net interface for sends. - int reuse_addr = 1); - - /// Empty the dynamic subscription list. - int clear_subs_list (void); - -private: - - /// Per-instance options.. - int opts_; - - /// Multicast address to which local methods send datagrams. - ACE_INET_Addr send_addr_; - /// Network interface to which all methods send multicast datagrams. - ACE_TCHAR *send_net_if_; - -#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) - typedef ACE_DLList subscription_list_t; - typedef ACE_DLList_Iterator subscription_list_iter_t; - /// List of currently subscribed addr/iface pairs (and assc. types). - mutable subscription_list_t subscription_list_; - /// Lock used to protect subscription list. - mutable ACE_SDM_LOCK subscription_list_lock_; - // (Lock type does not need to support recursive locking.) -#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_Dgram_Mcast.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SOCK_DGRAM_MCAST_H */ diff --git a/ace/SOCK_Dgram_Mcast.inl b/ace/SOCK_Dgram_Mcast.inl deleted file mode 100644 index bf3574cfd54..00000000000 --- a/ace/SOCK_Dgram_Mcast.inl +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_SOCK_Dgram_Mcast::set_option (int option, - char optval) -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::set_option"); - - if (this->get_handle () == ACE_INVALID_HANDLE) - return -1; - - int level = IPPROTO_IP; -#if defined (IPPROTO_IPV6) && ! defined (INTEGRITY) - if (this->send_addr_.get_type () == PF_INET6) - level = IPPROTO_IPV6; -#endif /* IPPROTO_IPV6 */ - - return this->ACE_SOCK::set_option (level, - option, - &optval, - sizeof (optval)); -} - -ACE_INLINE ssize_t -ACE_SOCK_Dgram_Mcast::send (const void *buf, - size_t n, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::send"); - return this->ACE_SOCK_Dgram::send (buf, - n, - this->send_addr_, - flags); -} - -ACE_INLINE ssize_t -ACE_SOCK_Dgram_Mcast::send (const iovec iov[], - int n, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Dgram_Mcast::send"); - return this->ACE_SOCK_Dgram::send (iov, - n, - this->send_addr_, - flags); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_IO.cpp b/ace/SOCK_IO.cpp deleted file mode 100644 index b3a1d5de90b..00000000000 --- a/ace/SOCK_IO.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// $Id$ - -#include "ace/SOCK_IO.h" - -#include "ace/Handle_Set.h" -#include "ace/OS_NS_sys_select.h" -#include "ace/OS_NS_sys_socket.h" -#include "ace/OS_Memory.h" -#include "ace/Truncate.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_IO.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SOCK_IO, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_IO) - -void -ACE_SOCK_IO::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_IO::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Allows a client to read from a socket without having to provide -// a buffer to read. This method determines how much data is in the -// socket, allocates a buffer of this size, reads in the data, and -// returns the number of bytes read. - -ssize_t -ACE_SOCK_IO::recvv (iovec *io_vec, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::recvv"); -#if defined (FIONREAD) - ACE_Handle_Set handle_set; - handle_set.reset (); - handle_set.set_bit (this->get_handle ()); - - io_vec->iov_base = 0; - - // Check the status of the current socket. - int select_width; -# if defined (ACE_WIN32) - // This arg is ignored on Windows and causes pointer truncation - // warnings on 64-bit compiles. - select_width = 0; -# else - select_width = int (this->get_handle ()) + 1; -# endif /* ACE_WIN32 */ - switch (ACE_OS::select (select_width, - handle_set, - 0, 0, - timeout)) - { - case -1: - return -1; - /* NOTREACHED */ - case 0: - errno = ETIME; - return -1; - /* NOTREACHED */ - default: - // Goes fine, fallthrough to get data - break; - } - - int inlen = 0; - - if (ACE_OS::ioctl (this->get_handle (), - FIONREAD, - &inlen) == -1) - return -1; - else if (inlen > 0) - { - ACE_NEW_RETURN (io_vec->iov_base, - char[inlen], - -1); - // It's ok to blindly cast this value since 'inlen' is an int and, thus, - // we can't get more than that back. Besides, if the recv() fails, we - // don't want that value cast to unsigned and returned. - ssize_t recv_len = this->recv (io_vec->iov_base, inlen); - if (recv_len > 0) - // u_long is the Windows type; size_t is everyone else's. A u_long - // should go into a size_t anywhere without an issue. - io_vec->iov_len = static_cast (recv_len); - return recv_len; - } - else - return 0; -#else - ACE_UNUSED_ARG (io_vec); - ACE_UNUSED_ARG (timeout); - ACE_NOTSUP_RETURN (-1); -#endif /* FIONREAD */ -} - -// Send N char *ptrs and int lengths. Note that the char *'s precede -// the ints (basically, an varargs version of writev). The count N is -// the *total* number of trailing arguments, *not* a couple of the -// number of tuple pairs! - -ssize_t -ACE_SOCK_IO::send (size_t n, ...) const -{ - ACE_TRACE ("ACE_SOCK_IO::send"); - - va_list argp; - int total_tuples = ACE_Utils::Truncate (n / 2); - iovec *iovp = 0; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::sendv (this->get_handle (), - iovp, - total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -// This is basically an interface to ACE_OS::readv, that doesn't use -// the struct iovec_Base explicitly. The ... can be passed as an arbitrary -// number of (char *ptr, int len) tuples. However, the count N is the -// *total* number of trailing arguments, *not* a couple of the number -// of tuple pairs! - -ssize_t -ACE_SOCK_IO::recv (size_t n, ...) const -{ - ACE_TRACE ("ACE_SOCK_IO::recv"); - - va_list argp; - int total_tuples = ACE_Utils::Truncate (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::recvv (this->get_handle (), - iovp, - total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_IO.h b/ace/SOCK_IO.h deleted file mode 100644 index 746a414f6a2..00000000000 --- a/ace/SOCK_IO.h +++ /dev/null @@ -1,163 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file SOCK_IO.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_SOCK_IO_H -#define ACE_SOCK_IO_H - -#include /**/ "ace/pre.h" - -#include "ace/SOCK.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/ACE.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SOCK_IO - * - * @brief Defines the methods for the ACE socket wrapper I/O routines - * (e.g., send/recv). - * - * - * If == 0, then the call behaves as a normal - * send/recv call, i.e., for blocking sockets, the call will - * block until action is possible; for non-blocking sockets, - * EWOULDBLOCK will be returned if no action is immediately - * possible. - * If != 0, the call will wait until the relative time - * specified in * elapses. - * Errors are reported by -1 and 0 return values. If the - * operation times out, -1 is returned with . - * If it succeeds the number of bytes transferred is returned. - * Methods with the extra argument will always result in - * getting called. Methods without the extra - * argument will result in getting called on Win32 - * platforms, and getting called on non-Win32 platforms. - */ -class ACE_Export ACE_SOCK_IO : public ACE_SOCK -{ -public: - // = Initialization and termination methods. - - /// Constructor. - ACE_SOCK_IO (void); - - /// Destructor. - ~ACE_SOCK_IO (void); - - /// Recv an byte buffer from the connected socket. - ssize_t recv (void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout = 0) const; - - /// Recv an byte buffer from the connected socket. - ssize_t recv (void *buf, - size_t n, - const ACE_Time_Value *timeout = 0) const; - - /// Recv an of size from the connected socket. - /** - * @note The value of @a n will be silently reduced to the maximum - * value an @c int can hold if needed. This is due to the underlying - * system calls on many OSes limiting the number of @c iovec structures - * that can be passed in one call. - */ - ssize_t recvv (iovec iov[], - size_t n, - const ACE_Time_Value *timeout = 0) const; - - /// @deprecated Same as above. Deprecated. - ssize_t recv (iovec iov[], - size_t n, - const ACE_Time_Value *timeout = 0) const; - - /** - * Allows a client to read from a socket without having to provide a - * buffer to read. This method determines how much data is in the - * socket, allocates a buffer of this size, reads in the data, and - * returns the number of bytes read. The caller is responsible for - * deleting the member in the field of using - * delete [] io_vec->iov_base. - */ - ssize_t recvv (iovec *io_vec, - const ACE_Time_Value *timeout = 0) const; - - /// Same as above. Deprecated. - ssize_t recv (iovec *io_vec, - const ACE_Time_Value *timeout = 0) const; - - /// Recv varargs messages to the connected socket. - ssize_t recv (size_t n, - ...) const; - - /// Recv bytes via Win32 using overlapped I/O. - ssize_t recv (void *buf, - size_t n, - ACE_OVERLAPPED *overlapped) const; - - /// Send an byte buffer to the connected socket. - ssize_t send (const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout = 0) const; - - /// Send an byte buffer to the connected socket. - ssize_t send (const void *buf, - size_t n, - const ACE_Time_Value *timeout = 0) const; - - /// Send an of size to the connected socket. - /** - * @note The value of @a n will be silently reduced to the maximum - * value an @c int can hold if needed. This is due to the underlying - * system calls on many OSes limiting the number of @c iovec structures - * that can be passed in one call. - */ - ssize_t sendv (const iovec iov[], - size_t n, - const ACE_Time_Value *timeout = 0) const; - - /// Same as above. Deprecated. - ssize_t send (const iovec iov[], - size_t n, - const ACE_Time_Value *timeout = 0) const; - - /// Send varargs messages to the connected socket. - ssize_t send (size_t n, - ...) const; - - /// Send bytes via Win32 using overlapped I/O. - ssize_t send (const void *buf, - size_t n, - ACE_OVERLAPPED *overlapped) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_IO.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SOCK_IO_H */ diff --git a/ace/SOCK_IO.inl b/ace/SOCK_IO.inl deleted file mode 100644 index f1aec4af3b8..00000000000 --- a/ace/SOCK_IO.inl +++ /dev/null @@ -1,155 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_unistd.h" -#include "ace/Truncate.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Send an n byte message to the connected socket. - -ACE_INLINE -ACE_SOCK_IO::ACE_SOCK_IO (void) -{ - // ACE_TRACE ("ACE_SOCK_IO::ACE_SOCK_IO"); -} - -ACE_INLINE -ACE_SOCK_IO::~ACE_SOCK_IO (void) -{ - // ACE_TRACE ("ACE_SOCK_IO::~ACE_SOCK_IO"); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::recv (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::recv"); - return ACE::recv (this->get_handle (), - buf, - len, - flags, - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::recv (void *buf, - size_t len, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::recv"); - return ACE::recv (this->get_handle (), - buf, - len, - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::recvv (iovec iov[], - size_t n, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::recvv"); - return ACE::recvv (this->get_handle (), - iov, - ACE_Utils::Truncate (n), - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::recv (iovec iov[], - size_t n, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::recv"); - return this->recvv (iov, - n, - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::recv (iovec *io_vec, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::recv"); - return this->recvv (io_vec, - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::recv (void *buf, - size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_SOCK_IO::recv"); - return ACE_OS::read (this->get_handle (), - (char *) buf, - n, - overlapped); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::send (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::send"); - return ACE::send (this->get_handle (), - buf, - len, - flags, - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::send (const void *buf, - size_t len, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::send"); - return ACE::send (this->get_handle (), - buf, - len, - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::sendv (const iovec iov[], - size_t n, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::sendv"); - return ACE::sendv (this->get_handle (), - iov, - ACE_Utils::Truncate (n), - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::send (const iovec iov[], - size_t n, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_IO::send"); - return this->sendv (iov, - n, - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_IO::send (const void *buf, - size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_SOCK_IO::send"); - return ACE_OS::write (this->get_handle (), - buf, - n, - overlapped); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Netlink.cpp b/ace/SOCK_Netlink.cpp deleted file mode 100644 index dc23139c19c..00000000000 --- a/ace/SOCK_Netlink.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// $Id$ - -#include /* */ "ace/SOCK_Netlink.h" - -#ifdef ACE_HAS_NETLINK - -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_unistd.h" -#include "ace/SOCK_Netlink.h" -#include "ace/OS_NS_sys_socket.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_Netlink.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_SOCK_Netlink) - -int ACE_SOCK_Netlink::open (ACE_Netlink_Addr &local, - int protocol_family, - int protocol) //! protocol of your choosing -{ - ACE_TRACE ("ACE_SOCK_Netlink::open"); - - if ( ACE_SOCK::open (SOCK_RAW, - protocol_family, //! RAW or DGRAM valid - protocol,0) < 0 ) { - ACE_TRACE ("ACE_SOCK_Netlink::open failed to open"); - return -1; - } - - if (ACE_OS::bind(this->get_handle(), - (sockaddr*)local.get_addr(), - local.get_addr_size()) == -1 ) { - ACE_TRACE ("ACE_SOCK_Netlink::open failed to bind socket"); - return -1; - } - return 0; -} - - -ACE_SOCK_Netlink::ACE_SOCK_Netlink (ACE_Netlink_Addr &local, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_Netlink::ACE_SOCK_Netlink"); - - if (this->open (local, - protocol_family, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_Netlink"))); -} - -ssize_t -ACE_SOCK_Netlink::send (const iovec iov[], - int n, - const ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Netlink::send"); - msghdr send_msg; - - send_msg.msg_iov = (iovec *) iov; - send_msg.msg_iovlen = n; - send_msg.msg_name = (char *) addr.get_addr (); - send_msg.msg_namelen = addr.get_size (); - send_msg.msg_control = 0; - send_msg.msg_controllen = 0; - send_msg.msg_flags = 0; - - return ACE_OS::sendmsg (this->get_handle (), - &send_msg, - flags); -} - -ssize_t -ACE_SOCK_Netlink::recv (iovec iov[], - int n, - ACE_Addr &addr, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Netlink::recv"); - msghdr recv_msg; - - recv_msg.msg_iov = (iovec *) iov; - recv_msg.msg_iovlen = n; - recv_msg.msg_name = (char *) addr.get_addr (); - recv_msg.msg_namelen = addr.get_size (); - recv_msg.msg_control = 0; - recv_msg.msg_controllen = 0; - recv_msg.msg_flags = 0; - - ssize_t status = ACE_OS::recvmsg (this->get_handle (), - &recv_msg, - flags); - - if (recv_msg.msg_flags & MSG_TRUNC) - return -1; - - addr.set_size (recv_msg.msg_namelen); - addr.set_type (((sockaddr_in *) addr.get_addr())->sin_family); - - return status; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_NETLINK */ diff --git a/ace/SOCK_Netlink.h b/ace/SOCK_Netlink.h deleted file mode 100644 index 019e680d726..00000000000 --- a/ace/SOCK_Netlink.h +++ /dev/null @@ -1,106 +0,0 @@ -// $Id$ -//============================================================================= -/** - * @file SOCK_Netlink.h - * - * $Id$ - * - * @author Robert Iakobashvilli - * @author Raz Ben Yehuda - */ -//============================================================================= - -#ifndef ACE_SOCK_NETLINK_H -#define ACE_SOCK_NETLINK_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) - #pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#ifdef ACE_HAS_NETLINK - -#include "ace/SOCK.h" -#include "ace/Netlink_Addr.h" -#include "ace/Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SOCK_Netlink - * - * @brief Defines the member functions for the ACE_SOCK Netlink - * abstraction. - - * Netlink sockets are used in Linux as a communication facilty of kernel to user - * and user to kernel. - * This code was created so one could use ACE reactor - * as a gateway to a linux kernel. - * - */ -class ACE_Export ACE_SOCK_Netlink : public ACE_SOCK { -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_SOCK_Netlink(void); - ~ACE_SOCK_Netlink(void); - ACE_SOCK_Netlink (ACE_Netlink_Addr &local, - int protocol_family, - int protocol); - /** - * opens a RAW socket over an ACE_SOCK and binds it - * - **/ - int open (ACE_Netlink_Addr &local, - int protocol_family, - int protocol); - - /** - * receives abuffer with the size n - */ - ssize_t recv (void *buf, - size_t n, - int flags) const; - /** - * send a buffer of size n bytes - * - */ - ssize_t send (void *buf, - size_t n, - int flags) const; - - /** - * Recieves an iovec of size @a n to the netlink socket - */ - ssize_t recv (iovec iov[], - int n, - ACE_Addr &addr, - int flags = 0) const; - - /** - * Sends an iovec of size @a n to the netlink socket - */ - ssize_t send (const iovec iov[], - int n, - const ACE_Addr &addr, - int flags = 0) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_Netlink.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_NETLINK */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SOCK_NETLINK_H */ - diff --git a/ace/SOCK_Netlink.inl b/ace/SOCK_Netlink.inl deleted file mode 100644 index bf97d6f2dc5..00000000000 --- a/ace/SOCK_Netlink.inl +++ /dev/null @@ -1,37 +0,0 @@ -// $Id$ - -#ifdef ACE_HAS_NETLINK - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SOCK_Netlink::ACE_SOCK_Netlink (void) -{ - ACE_TRACE ("ACE_SOCK_Netlink::ACE_SOCK_Netlink"); -} - -ACE_INLINE -ACE_SOCK_Netlink::~ACE_SOCK_Netlink (void) -{ - ACE_TRACE ("ACE_SOCK_Netlink::~ACE_SOCK_Netlink"); -} - -ACE_INLINE ssize_t ACE_SOCK_Netlink::recv ( void *buf, - size_t n, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Netlink::recv"); - return ACE_OS::recv (this->get_handle (),(char *) buf,n,flags); -} - -ACE_INLINE ssize_t ACE_SOCK_Netlink::send (void *buf, - size_t n, - int flags) const -{ - ACE_TRACE ("ACE_SOCK_Netlink::send"); - return ACE_OS::send (this->get_handle (),(char *) buf,n,flags); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_NETLINK */ diff --git a/ace/SOCK_SEQPACK_Acceptor.cpp b/ace/SOCK_SEQPACK_Acceptor.cpp deleted file mode 100644 index 69d832c41d0..00000000000 --- a/ace/SOCK_SEQPACK_Acceptor.cpp +++ /dev/null @@ -1,596 +0,0 @@ -// $Id$ - -#include "ace/SOCK_SEQPACK_Acceptor.h" - -#include "ace/Auto_Ptr.h" -#include "ace/Log_Msg.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_sys_socket.h" -#include "ace/os_include/os_fcntl.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_SEQPACK_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SOCK_SEQPACK_Acceptor, "SOCK_SEQPACK_Acceptor.cpp,v 4.30 2002/03/08 23:18:09 spark Exp") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_SEQPACK_Acceptor) - -// Do nothing routine for constructor. - -ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (void) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor"); -} - -// Performs the timed accept operation. - -int -ACE_SOCK_SEQPACK_Acceptor::shared_accept_start (ACE_Time_Value *timeout, - int restart, - int &in_blocking_mode) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::shared_accept_start"); - - ACE_HANDLE handle = this->get_handle (); - - // Handle the case where we're doing a timed . - if (timeout != 0) - { - if (ACE::handle_timed_accept (handle, - timeout, - restart) == -1) - return -1; - else - { - in_blocking_mode = ACE_BIT_DISABLED (ACE::get_flags (handle), - ACE_NONBLOCK); - // Set the handle into non-blocking mode if it's not already - // in it. - if (in_blocking_mode - && ACE::set_flags (handle, - ACE_NONBLOCK) == -1) - return -1; - } - } - - return 0; -} - -int -ACE_SOCK_SEQPACK_Acceptor::shared_accept_finish (ACE_SOCK_SEQPACK_Association new_association, - int in_blocking_mode, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::shared_accept_finish ()"); - - ACE_HANDLE new_handle = new_association.get_handle (); - - // Check to see if we were originally in blocking mode, and if so, - // set the 's handle and handle to be in blocking - // mode. - if (in_blocking_mode) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - - // Only disable ACE_NONBLOCK if we weren't in non-blocking mode - // originally. - ACE::clr_flags (this->get_handle (), - ACE_NONBLOCK); - ACE::clr_flags (new_handle, - ACE_NONBLOCK); - } - -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - if (reset_new_handle) - // Reset the event association inherited by the new handle. - ::WSAEventSelect ((SOCKET) new_handle, 0, 0); -#else - ACE_UNUSED_ARG (reset_new_handle); -#endif /* ACE_WIN32 */ - - return new_handle == ACE_INVALID_HANDLE ? -1 : 0; -} - -// General purpose routine for accepting new connections. - -int -ACE_SOCK_SEQPACK_Acceptor::accept (ACE_SOCK_SEQPACK_Association &new_association, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::accept"); - - int in_blocking_mode = 0; - if (this->shared_accept_start (timeout, - restart, - in_blocking_mode) == -1) - return -1; - else - { - // On Win32 the third parameter to must be a NULL - // pointer if we want to ignore the client's address. - int *len_ptr = 0; - sockaddr *addr = 0; - int len = 0; - - if (remote_addr != 0) - { - len = remote_addr->get_size (); - len_ptr = &len; - addr = (sockaddr *) remote_addr->get_addr (); - } - - do - new_association.set_handle (ACE_OS::accept (this->get_handle (), - addr, - len_ptr)); - while (new_association.get_handle () == ACE_INVALID_HANDLE - && restart != 0 - && errno == EINTR - && timeout == 0); - - // Reset the size of the addr, so the proper UNIX/IPv4/IPv6 family - // is known. - if (new_association.get_handle () != ACE_INVALID_HANDLE - && remote_addr != 0) - { - remote_addr->set_size (len); - remote_addr->set_type (addr->sa_family); - } - } - - return this->shared_accept_finish (new_association, - in_blocking_mode, - reset_new_handle); -} - -void -ACE_SOCK_SEQPACK_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Addr &local_sap, - int protocol_family, - int backlog) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::shared_open"); - int error = 0; - -#if defined (ACE_HAS_IPV6) - ACE_ASSERT (protocol_family == PF_INET || protocol_family == PF_INET6); - - if (protocol_family == PF_INET6) - { - sockaddr_in6 local_inet6_addr; - ACE_OS::memset (reinterpret_cast (&local_inet6_addr), - 0, - sizeof local_inet6_addr); - - if (local_sap == ACE_Addr::sap_any) - { - local_inet6_addr.sin6_family = AF_INET6; - local_inet6_addr.sin6_port = 0; - local_inet6_addr.sin6_addr = in6addr_any; - } - else - local_inet6_addr = *reinterpret_cast (local_sap.get_addr ()); - - // We probably don't need a bind_port written here. - // There are currently no supported OS's that define - // ACE_LACKS_WILDCARD_BIND. - if (ACE_OS::bind (this->get_handle (), - reinterpret_cast (&local_inet6_addr), - sizeof local_inet6_addr) == -1) - error = 1; - } - else -#endif - if (protocol_family == PF_INET) - { - sockaddr_in local_inet_addr; - ACE_OS::memset (reinterpret_cast (&local_inet_addr), - 0, - sizeof local_inet_addr); - - if (local_sap == ACE_Addr::sap_any) - { - local_inet_addr.sin_port = 0; - } - else - local_inet_addr = *reinterpret_cast (local_sap.get_addr ()); - if (local_inet_addr.sin_port == 0) - { - if (ACE::bind_port (this->get_handle ()) == -1) - error = 1; - } - else if (ACE_OS::bind (this->get_handle (), - reinterpret_cast (&local_inet_addr), - sizeof local_inet_addr) == -1) - error = 1; - } - else if (ACE_OS::bind (this->get_handle (), - (sockaddr *) local_sap.get_addr (), - local_sap.get_size ()) == -1) - error = 1; - - if (error != 0 - || ACE_OS::listen (this->get_handle (), - backlog) == -1) - { - error = 1; - this->close (); - } - - return error ? -1 : 0; -} - -// Multihomed version of same. - -int -ACE_SOCK_SEQPACK_Acceptor::shared_open (const ACE_Multihomed_INET_Addr &local_sap, - int protocol_family, - int backlog) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::shared_open"); - int error = 0; - - // TODO: Add multi-address support to IPV6 -#if defined (ACE_HAS_IPV6) - ACE_ASSERT (protocol_family == PF_INET || protocol_family == PF_INET6); - - if (protocol_family == PF_INET6) - { - sockaddr_in6 local_inet6_addr; - ACE_OS::memset (reinterpret_cast (&local_inet6_addr), - 0, - sizeof local_inet6_addr); - - if (local_sap.ACE_Addr::operator== (ACE_Addr::sap_any)) - { - local_inet6_addr.sin6_family = AF_INET6; - local_inet6_addr.sin6_port = 0; - local_inet6_addr.sin6_addr = in6addr_any; - } - else - local_inet6_addr = *reinterpret_cast (local_sap.get_addr ()); - - // We probably don't need a bind_port written here. - // There are currently no supported OS's that define - // ACE_LACKS_WILDCARD_BIND. - if (ACE_OS::bind (this->get_handle (), - reinterpret_cast (&local_inet6_addr), - sizeof local_inet6_addr) == -1) - error = 1; - } - else -#endif - if (protocol_family == PF_INET) - { - sockaddr_in local_inet_addr; - ACE_OS::memset (reinterpret_cast (&local_inet_addr), - 0, - sizeof local_inet_addr); - - if (local_sap.ACE_Addr::operator== (ACE_Addr::sap_any)) - { - local_inet_addr.sin_port = 0; - } - else - local_inet_addr = *reinterpret_cast (local_sap.get_addr ()); - -// A port number of 0 means that the user is requesting that the -// operating system choose an arbitrary, unused port. Since some -// operating systems don't provide this service, ACE provides an -// emulation layer. Therefore, the "ACE way" to bind an arbitrary, -// unused port is to call ACE:bind_port, which either -// -// (1) Calls ACE_OS::bind with port 0, if the operating system -// directly supports the automated selection, or -// -// (2) Performs more complicated logic to emulate this feature if -// it's missing from the OS. -// -// The emulation logic in choice (2) is compiled if and only if -// ACE_LACKS_WILDCARD_BIND is defined at compile time. -// -// Along these lines, the following block of code seems like it would -// be sufficient to support the wildcard bind operation: -// -// if (local_inet_addr.sin_port == 0) -// { -// if (ACE::bind_port (this->get_handle (), -// ACE_NTOHL (ACE_UINT32 (local_inet_addr.sin_addr.s_addr))) == -1) -// error = 1; -// -// } -// else -// -// Unfortunately, this code is insufficient because it does not -// address the possibility of secondary addresses. -// -// However, rather than writing the correct code now, I'm putting it -// off, because this class, ACE_SOCK_SEQPACK_Acceptor, is currently -// only used with SCTP, and ACE currently supports SCTP only through -// the OpenSS7 and LKSCTP implmentations, which are available only on -// Linux. Linux has native support for the wildcard bind, so the -// following code works regardless of whether or not the port is 0. - - { - // The total number of addresses is the number of secondary - // addresses plus one. - size_t num_addresses = local_sap.get_num_secondary_addresses() + 1; - - // Create an array of sockaddr_in to hold the underlying - // representations of the primary and secondary - // addresses. - sockaddr_in* local_inet_addrs = 0; - ACE_NEW_NORETURN (local_inet_addrs, - sockaddr_in[num_addresses]); - - if (!local_inet_addrs) - error = 1; - else - { - // Populate the array by invoking the get_addresses method - // on the Multihomed_INET_Addr - local_sap.get_addresses(local_inet_addrs, - num_addresses); - -#if defined (ACE_HAS_LKSCTP) - - sockaddr_in *local_sockaddr = 0; - - // bind the primary first - if (ACE_OS::bind (this->get_handle (), - reinterpret_cast (&(local_inet_addrs[0])), - sizeof(sockaddr)) == -1) - { - error = 1; - } - - // do we need to bind multiple addresses? - if (num_addresses > 1) - { - ACE_NEW_NORETURN(local_sockaddr, - sockaddr_in[num_addresses - 1]); - - // all of the secondary addresses need the local port set - for (size_t i = 1; i < num_addresses; i++) - { - local_inet_addrs[i].sin_port = local_inet_addrs[0].sin_port; - } - - // copy only the sockaddrs that we need to bindx - for (size_t i = 0; i < num_addresses - 1; i++) - { - ACE_OS::memcpy(&(local_sockaddr[i]), - &(local_inet_addrs[i + 1]), - sizeof(sockaddr_in)); - } - - // now call bindx - if (!error && sctp_bindx(this->get_handle (), - reinterpret_cast (local_sockaddr), - num_addresses - 1, - SCTP_BINDX_ADD_ADDR)) - { - error = 1; - } - - delete [] local_sockaddr; - } -#else - // Call bind - size_t name_len = (sizeof local_inet_addr) * num_addresses; - if (ACE_OS::bind (this->get_handle (), - reinterpret_cast (local_inet_addrs), - static_cast (name_len)) == -1) - error = 1; -#endif /* ACE_HAS_LKSCTP */ - } - - delete [] local_inet_addrs; - } - } - else if (ACE_OS::bind (this->get_handle (), - (sockaddr *) local_sap.get_addr (), - local_sap.get_size ()) == -1) - error = 1; - - if (error != 0 - || ACE_OS::listen (this->get_handle (), - backlog) == -1) - { - error = 1; - this->close (); - } - - return error ? -1 : 0; -} - -int -ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::open"); - - if (protocol_family == PF_UNSPEC) - protocol_family = local_sap.get_type (); - -#if defined (ACE_HAS_LKSCTP) - if (ACE_SOCK::open (SOCK_STREAM, -#else - if (ACE_SOCK::open (SOCK_SEQPACKET, -#endif - protocol_family, - protocol, - protocolinfo, - g, - flags, - reuse_addr) == -1) - return -1; - else - return this->shared_open (local_sap, - protocol_family, - backlog); -} - -ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor"); - if (this->open (local_sap, - protocolinfo, - g, - flags, - reuse_addr, - protocol_family, - backlog, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_SEQPACK_Acceptor"))); -} - -// General purpose routine for performing server ACE_SOCK creation. - -int -ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::open"); - - if (local_sap != ACE_Addr::sap_any) - protocol_family = local_sap.get_type (); - else if (protocol_family == PF_UNSPEC) - { -#if defined (ACE_HAS_IPV6) - protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET; -#else - protocol_family = PF_INET; -#endif /* ACE_HAS_IPV6 */ - } - -#if defined (ACE_HAS_LKSCTP) - if (ACE_SOCK::open (SOCK_STREAM, -#else - if (ACE_SOCK::open (SOCK_SEQPACKET, -#endif - protocol_family, - protocol, - reuse_addr) == -1) - return -1; - else - return this->shared_open (local_sap, - protocol_family, - backlog); -} - -// Multihomed version of same. - -int -ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Multihomed_INET_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::open"); - - if (local_sap.ACE_Addr::operator!= (ACE_Addr::sap_any)) - protocol_family = local_sap.get_type (); - else if (protocol_family == PF_UNSPEC) - { -#if defined (ACE_HAS_IPV6) - protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET; -#else - protocol_family = PF_INET; -#endif /* ACE_HAS_IPV6 */ - } - -#if defined (ACE_HAS_LKSCTP) - if (ACE_SOCK::open (SOCK_STREAM, -#else - if (ACE_SOCK::open (SOCK_SEQPACKET, -#endif - protocol_family, - protocol, - reuse_addr) == -1) - return -1; - else - return this->shared_open (local_sap, - protocol_family, - backlog); -} - -// General purpose routine for performing server ACE_SOCK creation. - -ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor"); - if (this->open (local_sap, - reuse_addr, - protocol_family, - backlog, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_SEQPACK_Acceptor"))); -} - -// Multihomed version of same. - -ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor (const ACE_Multihomed_INET_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::ACE_SOCK_SEQPACK_Acceptor"); - if (this->open (local_sap, - reuse_addr, - protocol_family, - backlog, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_SEQPACK_Acceptor"))); -} - -int -ACE_SOCK_SEQPACK_Acceptor::close (void) -{ - return ACE_SOCK::close (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Acceptor.h b/ace/SOCK_SEQPACK_Acceptor.h deleted file mode 100644 index 10d626e03d8..00000000000 --- a/ace/SOCK_SEQPACK_Acceptor.h +++ /dev/null @@ -1,190 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SOCK_SEQPACK_Acceptor.h - * - * $Id$ - * @author Patrick J. Lardieri - * @author Gaurav Naik, Lockheed Martin ATL - * @author based on SOCK_STREAM_Acceptor - * by Douglas C. Schmidt - * - */ -//============================================================================= - -#ifndef ACE_SOCK_SEQ_ACCEPTOR_H -#define ACE_SOCK_SEQ_ACCEPTOR_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SOCK_SEQPACK_Association.h" -#include "ace/Multihomed_INET_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_SOCK_SEQPACK_Acceptor - * - * @brief Defines a factory that creates new s passively. - * - * The has its own "passive-mode" socket. - * This serves as a factory to create so-called "data-mode" - * sockets, which are what the encapsulates. - * Therefore, by inheriting from , - * gets its very own socket. - */ -class ACE_Export ACE_SOCK_SEQPACK_Acceptor : public ACE_SOCK -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_SOCK_SEQPACK_Acceptor (void); - - /** - * Initialize a passive-mode BSD-style acceptor socket (no QoS). - * is the address that we're going to listen for - * connections on. If is 1 then we'll use the - * to reuse this address. - */ - ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 132); - - /// Multihomed version of same - - ACE_SOCK_SEQPACK_Acceptor (const ACE_Multihomed_INET_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 132); - - /// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0 - /// on success and -1 on failure. - ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 132); - - - /** - * Initialize a passive-mode BSD-style acceptor socket (no QoS). - * is the address that we're going to listen for - * connections on. If is 1 then we'll use the - * to reuse this address. Returns 0 on success and - * -1 on failure. - */ - int open (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 132); - - /// Multihomed version of same - - int open (const ACE_Multihomed_INET_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 132); - - - /// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0 - /// on success and -1 on failure. - int open (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 132); - - /// Close the socket. Returns 0 on success and -1 on failure. - int close (void); - - /// Default dtor. - ~ACE_SOCK_SEQPACK_Acceptor (void); - - // = Passive connection methods. - /** - * Accept a new connection. A of 0 - * means block forever, a of {0, 0} means poll. - * == 1 means "restart if interrupted," i.e., if errno == EINTR. - * Note that inherits the "blocking mode" of - * , i.e., if acceptor factory is in - * non-blocking mode, the will be in non-blocking mode - * and vice versa. - */ - int accept (ACE_SOCK_SEQPACK_Association &new_association, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0) const; - - // = Meta-type info - typedef ACE_Multihomed_INET_Addr PEER_ADDR; - typedef ACE_SOCK_SEQPACK_Association PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Perform operations that must occur before is - /// called. - int shared_accept_start (ACE_Time_Value *timeout, - int restart, - int &in_blocking_mode) const; - - /// Perform operations that must occur after is - /// called. - int shared_accept_finish (ACE_SOCK_SEQPACK_Association new_association, - int in_blocking_mode, - int reset_new_handle) const; - - /** - * This method factors out the common code and is called by - * both the QoS-enabled method and the BSD-style - * method. - */ - int shared_open (const ACE_Addr &local_sap, - int protocol_family, - int backlog); - - /// Multihomed version of same. - - int shared_open (const ACE_Multihomed_INET_Addr &local_sap, - int protocol_family, - int backlog); - -private: - /// Do not allow this function to percolate up to this interface... - int get_remote_addr (ACE_Addr &) const; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_SEQPACK_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SOCK_SEQ_ACCEPTOR_H */ diff --git a/ace/SOCK_SEQPACK_Acceptor.inl b/ace/SOCK_SEQPACK_Acceptor.inl deleted file mode 100644 index 0a0b591d75f..00000000000 --- a/ace/SOCK_SEQPACK_Acceptor.inl +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SOCK_SEQPACK_Acceptor::~ACE_SOCK_SEQPACK_Acceptor (void) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::~ACE_SOCK_SEQPACK_Acceptor"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Association.cpp b/ace/SOCK_SEQPACK_Association.cpp deleted file mode 100644 index 9a17e0ddb33..00000000000 --- a/ace/SOCK_SEQPACK_Association.cpp +++ /dev/null @@ -1,339 +0,0 @@ -// $Id$ - -#include "ace/SOCK_SEQPACK_Association.h" - -#include "ace/Auto_Ptr.h" -#include "ace/Log_Msg.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_SEQPACK_Association.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SOCK_SEQPACK_Association, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_SEQPACK_Association) - -void -ACE_SOCK_SEQPACK_Association::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_SOCK_SEQPACK_Association::close (void) -{ -#if defined (ACE_WIN32) - // We need the following call to make things work correctly on - // Win32, which requires use to do a before doing the - // close in order to avoid losing data. Note that we don't need to - // do this on UNIX since it doesn't have this "feature". Moreover, - // this will cause subtle problems on UNIX due to the way that - // fork() works. - this->close_writer (); -#endif /* ACE_WIN32 */ - // Close down the socket. - return ACE_SOCK::close (); -} - -// Developed according to the API discussed in 7.1.4 of -// draft-ietf-tsvwg-sctpsocket-09.txt to abruptly free a transport -// transport association's resources. -int -ACE_SOCK_SEQPACK_Association::abort (void) -{ - // - // setsockopt() SO_LINGER configures socket to reap immediately. - // Normal close then aborts the association. - // - linger slinger; - - slinger.l_onoff = 1; - slinger.l_linger = 0; - - if (-1 == ACE_OS::setsockopt (this->get_handle (), - SOL_SOCKET, - SO_LINGER, - reinterpret_cast (&slinger), - sizeof (linger))) - { - return -1; - } - - return this->close (); -} - -int -ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &size) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::get_local_addrs"); - -#if defined (ACE_HAS_LKSCTP) - /* - The size of ACE_INET_Addr must be large enough to hold the number of - local addresses on the machine. If the array is too small, the function - will only return the number of addresses that will fit. If the array is - too large, the 'size' parameter will be modified to indicate the number - of addrs. - - We will call sctp_getladdrs() which accepts 3 parameters - 1. a socket fd - 2. a sctp association_id which will be ignored since we are using - tcp sockets - 3. a pointer to sockaddr - - lksctp/draft will allocate memory and we are responsible for freeing - it by calling sctp_freeladdrs(). - */ - - sockaddr_in *si = 0; - sockaddr *laddrs = 0; - int err = 0; - size_t len = 0; - - err = sctp_getladdrs(this->get_handle(), 0, &laddrs); - if (err > 0) - { - len = err; - // check to see if we have more addresses than we have - // space in our ACE_INET_Addr array - if (len > size) - { - // since our array is too small, we will only copy the first - // few that fit - len = size; - } - - for (size_t i = 0; i < len; i++) - { - // first we cast the sockaddr to sockaddr_in - // since we only support ipv4 at this time. - si = (sockaddr_in *) (&(laddrs[i])); - - // now we fillup the ace_inet_addr array - addrs[i].set_addr(si, sizeof(sockaddr_in)); - addrs[i].set_type(si->sin_family); - addrs[i].set_size(sizeof(sockaddr_in)); - } - } - else /* err < 0 */ - { - // sctp_getladdrs will return -1 on error - return -1; - } - - // indicate the num of addrs returned to the calling function - size = len; - - // make sure we free the struct using the system function - sctp_freeladdrs(laddrs); - -#else - - /* - We will be calling ACE_OS::getsockname, which accepts (and - potentially modifies) two reference parameters: - - 1. a sockaddr_in* that points to a buffer - 2. an int* that points to the size of this buffer - - The OpenSS7 implementation of SCTP copies an array of ipv4 - sockaddr_in into the buffer. Then, if the size of the buffer is - greater than the size used, the size parameter is reduced - accordingly. - - */ - - // The array of sockaddr_in will be stored in an ACE_Auto_Array_Ptr, - // which causes dynamically-allocated memory to be released as soon - // as the ACE_Auto_Array_Ptr goes out of scope. - ACE_Auto_Array_Ptr addr_structs; - - // Allocate memory for this array. Return -1 if the memory cannot - // be allocated. (This activity requires a temporary variable---a - // bare sockaddr_in* --- because ACE_NEW_RETURN cannot act directory on - // an ACE_Auto_Array_Ptr.) - { - sockaddr_in *addr_structs_bootstrap = 0; - ACE_NEW_RETURN (addr_structs_bootstrap, sockaddr_in[size], -1); - addr_structs.reset(addr_structs_bootstrap); - } - - // Physical size of this array is its logical size multiplied by - // the physical size of one of its elements. - size_t physical_size = size * sizeof(sockaddr_in); - - /* Clear the array */ - ACE_OS::memset(addr_structs.get(), - 0, - physical_size); - - /* - ** Populate the array with real values from the getsockname system - ** call. addr_structs is modified, and name_size is modified to contain - ** the number of bytes written to addr_structs. - ** Use name_size to get the data types right across the call. - */ - int name_size = static_cast (physical_size); - if (ACE_OS::getsockname (this->get_handle (), - reinterpret_cast (addr_structs.get()), - &name_size) == -1) - return -1; - - /* Calculate the NEW physical size of the array */ - name_size /= sizeof (sockaddr_in); - size = static_cast (name_size); - - /* Copy each sockaddr_in to the address structure of an ACE_Addr from - the passed-in array */ - const int addrlen (static_cast (sizeof (sockaddr_in))); - for (int i = 0; i < name_size; ++i) - { - addrs[i].set_addr (&(addr_structs[i]), addrlen); - addrs[i].set_type (addr_structs[i].sin_family); - addrs[i].set_size (addrlen); - } -#endif /* ACE_HAS_LKSCTP */ - return 0; -} - - -int -ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &size) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::get_remote_addrs"); -#if defined (ACE_HAS_LKSCTP) - /* - The size of ACE_INET_Addr must be large enough to hold the number of - remotes addresses in the association. If the array is too small, the - function will only return the number of addresses that will fit. If the - array is too large, the 'size' parameter will be modified to indicate - the number of addrs. - - We will call sctp_getpaddrs() which accepts 3 parameters - 1. a socket fd - 2. a sctp association_id which will be ignored since we are using - tcp sockets - 3. a pointer to a sockaddr - - lksctp/draft will allocate memory and we are responsible for freeing - it by calling sctp_freepaddrs(). - */ - - sockaddr_in *si = 0; - sockaddr *paddrs = 0; - int err = 0; - size_t len = 0; - - err = sctp_getpaddrs(this->get_handle(), 0, &paddrs); - if (err > 0) - { - len = err; - // check to see if we have more addresses than we have - // space in our ACE_INET_Addr array - if (len > size) - { - // since our array is too small, we will only copy the first - // few that fit - len = size; - } - - for (size_t i = 0; i < len; i++) - { - // first we cast the sockaddr to sockaddr_in - // since we only support ipv4 at this time. - si = (sockaddr_in *) (&(paddrs[i])); - - // now we fillup the ace_inet_addr array - addrs[i].set_addr(si, sizeof(sockaddr_in)); - addrs[i].set_type(si->sin_family); - addrs[i].set_size(sizeof(sockaddr_in)); - } - } - else /* err < 0 */ - { - // sctp_getpaddrs will return -1 on error - return -1; - } - - // indicate the num of addrs returned to the calling function - size = len; - - // make sure we free the struct using the system function - sctp_freepaddrs(paddrs); - -#else - - /* - We will be calling ACE_OS::getpeername, which accepts (and - potentially modifies) two reference parameters: - - 1. a sockaddr_in* that points to a buffer - 2. an int* that points to the size of this buffer - - The OpenSS7 implementation of SCTP copies an array of ipv4 - sockaddr_in into the buffer. Then, if the size of the buffer is - greater than the size used, the size parameter is reduced - accordingly. - - */ - - // The array of sockaddr_in will be stored in an ACE_Auto_Array_Ptr, - // which causes dynamically-allocated memory to be released as soon - // as the ACE_Auto_Array_Ptr goes out of scope. - ACE_Auto_Array_Ptr addr_structs; - - // Allocate memory for this array. Return -1 if the memory cannot - // be allocated. (This activity requires a temporary variable---a - // bare sockaddr_in* --- because ACE_NEW_RETURN cannot act directory on - // an ACE_Auto_Array_Ptr.) - { - sockaddr_in *addr_structs_bootstrap = 0; - ACE_NEW_RETURN (addr_structs_bootstrap, sockaddr_in[size], -1); - addr_structs.reset(addr_structs_bootstrap); - } - - // Physical size of this array is its logical size multiplied by - // the physical size of one of its elements. - size_t physical_size = size * sizeof(sockaddr_in); - - /* Clear the array */ - ACE_OS::memset(addr_structs.get(), - 0, - physical_size); - - /* - ** Populate the array with real values from the getpeername system - ** call. addr_structs is modified, and name_size is modified to contain - ** the number of bytes written to addr_structs. - ** Use name_size to get the data types right across the call. - */ - int name_size = static_cast (physical_size); - if (ACE_OS::getpeername (this->get_handle (), - reinterpret_cast (addr_structs.get()), - &name_size) == -1) - return -1; - - /* Calculate the NEW physical size of the array */ - name_size /= sizeof (sockaddr_in); - size = static_cast (name_size); - - /* Copy each sockaddr_in to the address structure of an ACE_Addr from - the passed-in array */ - const int addrlen (static_cast (sizeof (sockaddr_in))); - for (int i = 0; i < name_size; ++i) - { - addrs[i].set_addr (&(addr_structs[i]), addrlen); - addrs[i].set_type (addr_structs[i].sin_family); - addrs[i].set_size (addrlen); - } -#endif /* ACE_HAS_LKSCTP */ - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Association.h b/ace/SOCK_SEQPACK_Association.h deleted file mode 100644 index cbab0e8efb8..00000000000 --- a/ace/SOCK_SEQPACK_Association.h +++ /dev/null @@ -1,202 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * - * @file SOCK_SEQPACK_Association.h - * - * $Id$ - * - * @author Patrick J. Lardieri - * @author Gaurav Naik, Lockheed Martin ATL - * @author based on SOCK_Stream - * by Douglas C. Schmidt - * - */ -//============================================================================= - -#ifndef ACE_SOCK_SEQPACK_ASSOCIATION_H -#define ACE_SOCK_SEQPACK_ASSOCIATION_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SOCK_IO.h" -#include "ace/Multihomed_INET_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -class ACE_Message_Block; - -/** - * @class ACE_SOCK_SEQPACK_Association - * - * @brief Defines the methods in the abstraction. - * - * This adds additional wrapper methods atop the - * class. - * - * is the buffer to write from or receive into. - * is the number of bytes to transfer. - * The parameter in the following methods indicates how - * long to blocking trying to transfer data. If == 0, - * then the call behaves as a normal send/recv call, i.e., for - * blocking sockets, the call will block until action is possible; - * for non-blocking sockets, EWOULDBLOCK will be returned if no - * action is immediately possible. - * If != 0, the call will wait for data to arrive no longer - * than the relative time specified in *. - * The "_n()" I/O methods keep looping until all the data has been - * transferred. These methods also work for sockets in non-blocking - * mode i.e., they keep looping on EWOULDBLOCK. is used - * to make sure we keep making progress, i.e., the same timeout - * value is used for every I/O operation in the loop and the timeout - * is not counted down. - * The return values for the "*_n()" methods match the return values - * from the non "_n()" methods and are specified as follows: - * - On complete transfer, the number of bytes transferred is returned. - * - On timeout, -1 is returned, errno == ETIME. - * - On error, -1 is returned, errno is set to appropriate error. - * - On EOF, 0 is returned, errno is irrelevant. - * - * On partial transfers, i.e., if any data is transferred before - * timeout/error/EOF, will contain the number of - * bytes transferred. - * Methods with parameter are I/O vector variants of the I/O - * operations. - * Methods with the extra argument will always result in - * getting called. Methods without the extra argument - * will result in getting called on Win32 platforms, and - * getting called on non-Win32 platforms. - */ -class ACE_Export ACE_SOCK_SEQPACK_Association : public ACE_SOCK_IO -{ -public: - // Initialization and termination methods. - /// Constructor. - ACE_SOCK_SEQPACK_Association (void); - - /// Constructor (sets the underlying ACE_HANDLE with ). - ACE_SOCK_SEQPACK_Association (ACE_HANDLE h); - - /// Destructor. - ~ACE_SOCK_SEQPACK_Association (void); - - /** - * Return local endpoint addresses in the referenced array of - * ACE_INET_Addr, which should have the specified . If the - * number of local endpoint addresses is less than , then - * will be set to this number. If successful, the method - * returns 0, otherwise returns -1. - */ - int get_local_addrs (ACE_INET_Addr *addrs, size_t &size) const; - - /** - * Return remote endpoint addresses in the referenced array of - * ACE_INET_Addr, which should have the specified . If the - * number of remote endpoint addresses is less than , then - * will be set to this number. If successful, the method - * returns 0, otherwise returns -1. - */ - int get_remote_addrs (ACE_INET_Addr *addrs, size_t &size) const; - - // = I/O functions. - - /// Try to recv exactly bytes into from the connected socket. - ssize_t recv_n (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Try to recv exactly bytes into from the connected socket. - ssize_t recv_n (void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Receive an of size from the connected socket. - ssize_t recvv_n (iovec iov[], - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Try to send exactly bytes from to the connection socket. - ssize_t send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Try to send exactly bytes from to the connected socket. - ssize_t send_n (const void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Send all the s chained through their and - /// pointers. This call uses the underlying OS gather-write - /// operation to reduce the domain-crossing penalty. - ssize_t send_n (const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Send an of size to the connected socket. - ssize_t sendv_n (const iovec iov[], - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - // = Send/receive ``urgent'' data (see TCP specs...). - ssize_t send_urg (const void *ptr, - size_t len = sizeof (char), - const ACE_Time_Value *timeout = 0) const; - - ssize_t recv_urg (void *ptr, - size_t len = sizeof (char), - const ACE_Time_Value *timeout = 0) const; - - // = Selectively close endpoints. - /// Close down the reader. - int close_reader (void); - - /// Close down the writer. - int close_writer (void); - - /** - * Close down the socket (we need this to make things work correctly - * on Win32, which requires use to do a before doing - * the close to avoid losing data). */ - int close (void); - - /** - * Abort the association according to RFC 2960 9.1 through the API - * in draft-ietf-tsvwg-sctpsocket-09 7.1.4. - */ - int abort (void); - - // = Meta-type info - typedef ACE_Multihomed_INET_Addr PEER_ADDR; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_SEQPACK_Association.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SOCK_SEQPACK_ASSOCIATION_H */ diff --git a/ace/SOCK_SEQPACK_Association.inl b/ace/SOCK_SEQPACK_Association.inl deleted file mode 100644 index a156a946257..00000000000 --- a/ace/SOCK_SEQPACK_Association.inl +++ /dev/null @@ -1,177 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/SOCK_SEQPACK_Association.h" -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association (void) -{ - // ACE_TRACE ("ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association"); -} - -ACE_INLINE -ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association (ACE_HANDLE h) -{ - // ACE_TRACE ("ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association"); - this->set_handle (h); -} - -ACE_INLINE -ACE_SOCK_SEQPACK_Association::~ACE_SOCK_SEQPACK_Association (void) -{ - // ACE_TRACE ("ACE_SOCK_SEQPACK_Association::~ACE_SOCK_SEQPACK_Association"); -} - -ACE_INLINE int -ACE_SOCK_SEQPACK_Association::close_reader (void) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::close_reader"); - if (this->get_handle () != ACE_INVALID_HANDLE) - return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_READ); - else - return 0; -} - -// Shut down just the writing end of a ACE_SOCK. - -ACE_INLINE int -ACE_SOCK_SEQPACK_Association::close_writer (void) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::close_writer"); - if (this->get_handle () != ACE_INVALID_HANDLE) - return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_WRITE); - else - return 0; -} - -ACE_INLINE ssize_t -ACE_SOCK_SEQPACK_Association::recv_n (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::recv_n"); - return ACE::recv_n (this->get_handle (), - buf, - len, - flags, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_SEQPACK_Association::recv_n (void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::recv_n"); - return ACE::recv_n (this->get_handle (), - buf, - len, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_SEQPACK_Association::recvv_n (iovec iov[], - int n, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::recvv_n"); - return ACE::recvv_n (this->get_handle (), - iov, - n, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_SEQPACK_Association::send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::send_n"); - return ACE::send_n (this->get_handle (), - buf, - len, - flags, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_SEQPACK_Association::send_n (const void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::send_n"); - return ACE::send_n (this->get_handle (), - buf, - len, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_SEQPACK_Association::sendv_n (const iovec iov[], - int n, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::sendv_n"); - return ACE::sendv_n (this->get_handle (), - iov, - n, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_SEQPACK_Association::send_n (const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::send_n"); - return ACE::send_n (this->get_handle (), - message_block, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_SEQPACK_Association::send_urg (const void *ptr, - size_t len, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::send_urg"); - return ACE::send (this->get_handle (), - ptr, - len, - MSG_OOB, - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_SEQPACK_Association::recv_urg (void *ptr, - size_t len, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::recv_urg"); - return ACE::recv (this->get_handle (), - ptr, - len, - MSG_OOB, - timeout); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Connector.cpp b/ace/SOCK_SEQPACK_Connector.cpp deleted file mode 100644 index 128beb23f22..00000000000 --- a/ace/SOCK_SEQPACK_Connector.cpp +++ /dev/null @@ -1,443 +0,0 @@ -// $Id$ - -#include "ace/SOCK_SEQPACK_Connector.h" - -#include "ace/INET_Addr.h" -#include "ace/Log_Msg.h" -#include "ace/Time_Value.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_sys_socket.h" -#include "ace/os_include/os_fcntl.h" - -#if defined (ACE_WIN32) -#include "ace/OS_NS_unistd.h" -#endif /* ACE_WIN32 */ - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_SEQPACK_Connector.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SOCK_SEQPACK_Connector, "SOCK_SEQPACK_Connector.cpp,v 4.35 2002/03/08 23:18:09 spark Exp") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_SEQPACK_Connector) - -void -ACE_SOCK_SEQPACK_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_SOCK_SEQPACK_Connector::shared_open (ACE_SOCK_SEQPACK_Association &new_association, - int protocol_family, - int protocol, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_open"); - - - - // Only open a new socket if we don't already have a valid handle. - if (new_association.get_handle () == ACE_INVALID_HANDLE && -#if defined (ACE_HAS_LKSCTP) - new_association.open (SOCK_STREAM, -#else - new_association.open (SOCK_SEQPACKET, -#endif /* ACE_HAS_LKSCTP */ - protocol_family, - protocol, - reuse_addr) == -1) - return -1; - else - return 0; -} - -int -ACE_SOCK_SEQPACK_Connector::shared_open (ACE_SOCK_SEQPACK_Association &new_association, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_open"); - - // Only open a new socket if we don't already have a valid handle. - if (new_association.get_handle () == ACE_INVALID_HANDLE && -#if defined (ACE_HAS_LKSCTP) - new_association.open (SOCK_STREAM, -#else - new_association.open (SOCK_SEQPACKET, -#endif /* ACE_HAS_LKSCTP */ - protocol_family, - protocol, - protocolinfo, - g, - flags, - reuse_addr) == -1) - return -1; - else - return 0; -} - -int -ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_connect_start"); - - if (local_sap != ACE_Addr::sap_any) - { - sockaddr *laddr = reinterpret_cast (local_sap.get_addr ()); - int size = local_sap.get_size (); - - if (ACE_OS::bind (new_association.get_handle (), - laddr, - size) == -1) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - new_association.close (); - return -1; - } - } - - // Enable non-blocking, if required. - if (timeout != 0 - && new_association.enable (ACE_NONBLOCK) == -1) - return -1; - else - return 0; -} - -// Multihomed version of same -int -ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Time_Value *timeout, - const ACE_Multihomed_INET_Addr &local_sap) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_connect_start"); - - if (local_sap.ACE_Addr::operator!= (ACE_Addr::sap_any)) - { - // The total number of addresses is the number of secondary - // addresses plus one. - size_t num_addresses = local_sap.get_num_secondary_addresses() + 1; - - // Create an array of sockaddr_in to hold the underlying - // representations of the primary and secondary - // addresses. - sockaddr_in* local_inet_addrs = 0; - ACE_NEW_NORETURN (local_inet_addrs, sockaddr_in[num_addresses]); - if (!local_inet_addrs) - return -1; - - // Populate the array by invoking the get_addresses method on - // the Multihomed_INET_Addr - local_sap.get_addresses(local_inet_addrs, num_addresses); - -#if defined (ACE_HAS_LKSCTP) - sockaddr_in *local_sockaddr = 0; - sockaddr_in portst; - int sn = sizeof(sockaddr); - - // bind to the primary addr first - if (ACE_OS::bind(new_association.get_handle (), - reinterpret_cast (&(local_inet_addrs[0])), - sizeof(sockaddr))) - { - ACE_Errno_Guard error (errno); - new_association.close (); - return -1; - } - - // do we need to bind multiple addrs - if (num_addresses > 1) - { - // allocate enough memory to hold the number of secondary addrs - ACE_NEW_NORETURN(local_sockaddr, - sockaddr_in[num_addresses - 1]); - - // get sockaddr_in for the local handle - if (ACE_OS::getsockname(new_association.get_handle (), - reinterpret_cast (&portst), - &sn)) - { - ACE_Errno_Guard error (errno); - new_association.close (); - return -1; - } - - // set the local port # assigned by the os to every secondary addr - for (size_t i = 1; i < num_addresses; i++) - { - local_inet_addrs[i].sin_port = portst.sin_port; - } - - // copy all of the secondary addrs into a sockaddr structure - for (size_t i = 0; i < num_addresses - 1; i++) - { - ACE_OS::memcpy(&(local_sockaddr[i]), - &(local_inet_addrs[i + 1]), - sizeof(sockaddr_in)); - } - - // bind other ifaces - if (sctp_bindx(new_association.get_handle(), - reinterpret_cast (local_sockaddr), - num_addresses - 1, - SCTP_BINDX_ADD_ADDR)) - { - ACE_Errno_Guard error (errno); - new_association.close (); - return -1; - } - - delete [] local_sockaddr; - } -#else - - // Call bind - size_t name_len = (sizeof (sockaddr_in)) * num_addresses; - if (ACE_OS::bind (new_association.get_handle (), - reinterpret_cast (local_inet_addrs), - static_cast (name_len)) == -1) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - new_association.close (); - return -1; - } -#endif /* ACE_HAS_LKSCTP */ - - delete [] local_inet_addrs; - } - - // Enable non-blocking, if required. - if (timeout != 0 - && new_association.enable (ACE_NONBLOCK) == -1) - return -1; - else - return 0; -} - -int -ACE_SOCK_SEQPACK_Connector::shared_connect_finish (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Time_Value *timeout, - int result) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::shared_connect_finish"); - // Save/restore errno. - ACE_Errno_Guard error (errno); - - if (result == -1 && timeout != 0) - { - // Check whether the connection is in progress. - if (error == EINPROGRESS || error == EWOULDBLOCK) - { - // This expression checks if we were polling. - if (timeout->sec () == 0 - && timeout->usec () == 0) - error = EWOULDBLOCK; - // Wait synchronously using timeout. - else if (this->complete (new_association, - 0, - timeout) == -1) - error = errno; - else - return 0; - } - } - - // EISCONN is treated specially since this routine may be used to - // check if we are already connected. - if (result != -1 || error == EISCONN) - // Start out with non-blocking disabled on the . - new_association.disable (ACE_NONBLOCK); - else if (!(error == EWOULDBLOCK || error == ETIMEDOUT)) - new_association.close (); - - return result; -} - -// Actively connect and produce a new ACE_SOCK_SEQPACK_Association if things go well... - - -int -ACE_SOCK_SEQPACK_Connector::connect (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int /* flags */, - int /* perms */, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::connect"); - - if (this->shared_open (new_association, - remote_sap.get_type (), - protocol, - reuse_addr) == -1) - return -1; - else if (this->shared_connect_start (new_association, - timeout, - local_sap) == -1) - return -1; - - int result = ACE_OS::connect (new_association.get_handle (), - reinterpret_cast (remote_sap.get_addr ()), - remote_sap.get_size ()); - - return this->shared_connect_finish (new_association, - timeout, - result); -} - -// Multihomed version of same -int -ACE_SOCK_SEQPACK_Connector::connect (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Multihomed_INET_Addr &local_sap, - int reuse_addr, - int /* flags */, - int /* perms */, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::connect"); - - if (this->shared_open (new_association, - remote_sap.get_type (), - protocol, - reuse_addr) == -1) - return -1; - else if (this->shared_connect_start (new_association, - timeout, - local_sap) == -1) - return -1; - - int result = ACE_OS::connect (new_association.get_handle (), - reinterpret_cast (remote_sap.get_addr ()), - remote_sap.get_size ()); - - return this->shared_connect_finish (new_association, - timeout, - result); -} - -// Try to complete a non-blocking connection. - -int -ACE_SOCK_SEQPACK_Connector::complete (ACE_SOCK_SEQPACK_Association &new_association, - ACE_Addr *remote_sap, - const ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::complete"); - ACE_HANDLE h = ACE::handle_timed_complete (new_association.get_handle (), - tv); - // We failed to get connected. - if (h == ACE_INVALID_HANDLE) - { -#if defined (ACE_WIN32) - // Win32 has a timing problem - if you check to see if the - // connection has completed too fast, it will fail - so wait - // microseconds to let it catch up - // then retry to see if it's a real failure. - ACE_Time_Value time (0, ACE_NON_BLOCKING_BUG_DELAY); - ACE_OS::sleep (time); - h = ACE::handle_timed_complete (new_association.get_handle (), - tv); - if (h == ACE_INVALID_HANDLE) - { -#endif /* ACE_WIN32 */ - // Save/restore errno. - ACE_Errno_Guard error (errno); - new_association.close (); - return -1; -#if defined (ACE_WIN32) - } -#endif /* ACE_WIN32 */ - } - - if (remote_sap != 0) - { - int len = remote_sap->get_size (); - sockaddr *addr = reinterpret_cast (remote_sap->get_addr ()); - if (ACE_OS::getpeername (h, - addr, - &len) == -1) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - new_association.close (); - return -1; - } - } - - // Start out with non-blocking disabled on the . - new_association.disable (ACE_NONBLOCK); - return 0; -} - -ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector"); - - if (this->connect (new_association, - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms, - protocol) == -1 - && timeout != 0 - && !(errno == EWOULDBLOCK || errno == ETIME || errno == ETIMEDOUT)) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector"))); -} - -// Multihomed version of same -ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Multihomed_INET_Addr &local_sap, - int reuse_addr, - int flags, - int perms, - int protocol) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector"); - - if (this->connect (new_association, - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms, - protocol) == -1 - && timeout != 0 - && !(errno == EWOULDBLOCK || errno == ETIME || errno == ETIMEDOUT)) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Connector.h b/ace/SOCK_SEQPACK_Connector.h deleted file mode 100644 index 7a567c47ec0..00000000000 --- a/ace/SOCK_SEQPACK_Connector.h +++ /dev/null @@ -1,331 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SOCK_SEQPACK_Connector.h - * - * $Id$ - * - * @author Patrick J. Lardieri - * @author Gaurav Naik, Lockheed Martin ATL - * @author based on SOCK_STREAM_Connector - * by Douglas C. Schmidt - * - */ -//============================================================================= - -#ifndef ACE_SOCK_SEQPACK_CONNECTOR_H -#define ACE_SOCK_SEQPACK_CONNECTOR_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#include "ace/SOCK_SEQPACK_Association.h" -#include "ace/Multihomed_INET_Addr.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -class ACE_Time_Value; - -/** - * @class ACE_SOCK_SEQPACK_Connector - * - * @brief Defines a factory that actively connects to a remote IP - * address and TCP port, creating a new @c ACE_SOCK_SEQPACK_Association object. - * - * The @c ACE_SOCK_SEQPACK_Connector doesn't have a socket of its own, - * i.e., it simply "borrows" the one from the @c ACE_SOCK_SEQPACK_Association - * that's being connected. The reason for this is that the - * underlying socket API doesn't use a factory socket to connect - * data mode sockets. Therefore, there's no need to inherit - * @c ACE_SOCK_SEQPACK_Connector from @c ACE_SOCK. A nice side-effect of - * this is that @c ACE_SOCK_SEQPACK_Connector objects do not store state so - * they can be used reentrantly in multithreaded programs. - */ -class ACE_Export ACE_SOCK_SEQPACK_Connector -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_SOCK_SEQPACK_Connector (void); - - /** - * Actively connect to a peer, producing a connected @c ACE_SOCK_SEQPACK_Association - * object if the connection succeeds. - * - * @param new_association The @c ACE_SOCK_SEQPACK_Association object that will be connected - * to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * @param protocol (optional) If value is 0, default SOCK_STREAM - * protocol is selected by kernel (typically TCP). - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0, - int protocol = 132); - - /** - * Actively connect to a peer, producing a connected @c ACE_SOCK_SEQPACK_Association - * object if the connection succeeds. - * - * @param new_association The @c ACE_SOCK_SEQPACK_Association object that will be connected - * to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The set of local addresses for SCTP to - * bind to. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * @param protocol (optional) If value is 0, default SOCK_STREAM - * protocol is selected by kernel (typically TCP). - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Multihomed_INET_Addr &local_sap, - int reuse_addr = 0, - int flags = 0, - int perms = 0, - int protocol = 132); - - /** - * Actively connect to a peer, producing a connected @c ACE_SOCK_SEQPACK_Association - * object if the connection succeeds. - * - * @param new_association The @c ACE_SOCK_SEQPACK_Association object that will be connected - * to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * @param protocol (optional) If value is 0, default SOCK_STREAM - * protocol is selected by kernel (typically TCP). - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - int connect (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0, - int protocol = 132); - - /** - * Actively connect to a peer, producing a connected @c ACE_SOCK_SEQPACK_Association - * object if the connection succeeds. - * - * @param new_association The @c ACE_SOCK_SEQPACK_Association object that will be connected - * to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The set of local addresses for SCTP to - * bind to. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * @param protocol (optional) If value is 0, default SOCK_STREAM - * protocol is selected by kernel (typically TCP). - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - - int connect (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Multihomed_INET_Addr &local_sap, - int reuse_addr = 0, - int flags = 0, - int perms = 0, - int protocol = 132); - - /// Default dtor. - ~ACE_SOCK_SEQPACK_Connector (void); - - // = Completion routine. - /** - * Try to complete a nonblocking connection that was begun by a - * previous call to connect with a {0, 0} ACE_Time_Value timeout. - * @see connect(). - * - * @param new_association The @c ACE_SOCK_SEQPACK_Association object that will be connected - * to the peer. - * @param remote_sap If non-0, it points to the @c ACE_INET_Addr object - * that will contain the address of the connected peer. - * @param timeout Same values and return value possibilites as for - * connect(). @see connect(). - */ - int complete (ACE_SOCK_SEQPACK_Association &new_association, - ACE_Addr *remote_sap = 0, - const ACE_Time_Value *timeout = 0); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - // = Meta-type info - typedef ACE_Multihomed_INET_Addr PEER_ADDR; - typedef ACE_SOCK_SEQPACK_Association PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Perform operations that ensure the socket is opened using - /// BSD-style semantics (no QoS). - int shared_open (ACE_SOCK_SEQPACK_Association &new_association, - int protocol_family, - int protocol, - int reuse_addr); - - /// Perform operations that ensure the socket is opened using - /// QoS-enabled semantics. - int shared_open (ACE_SOCK_SEQPACK_Association &new_association, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr); - - /// Perform operations that must be called before . - int shared_connect_start (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap); - - int shared_connect_start (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Time_Value *timeout, - const ACE_Multihomed_INET_Addr &local_sap); - - /// Perform operations that must be called after . - int shared_connect_finish (ACE_SOCK_SEQPACK_Association &new_association, - const ACE_Time_Value *timeout, - int result); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_SEQPACK_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SOCK_SEQPACK_CONNECTOR_H */ diff --git a/ace/SOCK_SEQPACK_Connector.inl b/ace/SOCK_SEQPACK_Connector.inl deleted file mode 100644 index a89c41f4069..00000000000 --- a/ace/SOCK_SEQPACK_Connector.inl +++ /dev/null @@ -1,38 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// This constructor is used by a client when it wants to connect to -// the specified REMOTE_SAP address using a blocking open. - -ACE_INLINE -ACE_SOCK_SEQPACK_Connector::~ACE_SOCK_SEQPACK_Connector (void) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::~ACE_SOCK_SEQPACK_Connector"); -} - -// Do-nothing constructor... - -ACE_INLINE -ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (void) -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector"); -} - -ACE_INLINE int -ACE_SOCK_SEQPACK_Connector::reset_new_handle (ACE_HANDLE handle) -{ -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - // Reset the event association - return ::WSAEventSelect ((SOCKET) handle, - NULL, - 0); -#else /* !defined ACE_HAS_WINSOCK2 */ - ACE_UNUSED_ARG (handle); - return 0; -#endif /* ACE_WIN32 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Stream.cpp b/ace/SOCK_Stream.cpp deleted file mode 100644 index 6b4946fd939..00000000000 --- a/ace/SOCK_Stream.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// $Id$ - -#include "ace/SOCK_Stream.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SOCK_Stream.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SOCK_Stream, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Stream) - -void -ACE_SOCK_Stream::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SOCK_Stream::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_SOCK_Stream::close (void) -{ -#if defined (ACE_WIN32) - // We need the following call to make things work correctly on - // Win32, which requires us to do a close_writer() before doing the - // close() in order to avoid losing data. Note that we don't need - // to do this on UNIX since it doesn't have this "feature". - // Moreover, this will cause subtle problems on UNIX due to the way - // that fork() works. - (void) this->close_writer (); - #endif /* ACE_WIN32 */ - - // Close down the socket. - return ACE_SOCK::close (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Stream.h b/ace/SOCK_Stream.h deleted file mode 100644 index 9537162a4d3..00000000000 --- a/ace/SOCK_Stream.h +++ /dev/null @@ -1,187 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SOCK_Stream.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SOCK_STREAM_H -#define ACE_SOCK_STREAM_H -#include /**/ "ace/pre.h" - -#include "ace/SOCK_IO.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/INET_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -class ACE_Message_Block; - -/** - * @class ACE_SOCK_Stream - * - * @brief Defines the methods in the ACE_SOCK_Stream abstraction. - * - * This adds additional wrapper methods atop the ACE_SOCK_IO - * class. - * - * is the buffer to write from or receive into. - * is the number of bytes to transfer. - * The parameter in the following methods indicates how - * long to blocking trying to transfer data. If == 0, - * then the call behaves as a normal send/recv call, i.e., for - * blocking sockets, the call will block until action is possible; - * for non-blocking sockets, EWOULDBLOCK will be returned if no - * action is immediately possible. - * If != 0, the call will wait for data to arrive no longer - * than the relative time specified in *. - * The "_n()" I/O methods keep looping until all the data has been - * transferred. These methods also work for sockets in non-blocking - * mode i.e., they keep looping on EWOULDBLOCK. is used - * to make sure we keep making progress, i.e., the same timeout - * value is used for every I/O operation in the loop and the timeout - * is not counted down. - * The return values for the "*_n()" methods match the return values - * from the non "_n()" methods and are specified as follows: - * - On complete transfer, the number of bytes transferred is returned. - * - On timeout, -1 is returned, errno == ETIME. - * - On error, -1 is returned, errno is set to appropriate error. - * - On EOF, 0 is returned, errno is irrelevant. - * - * On partial transfers, i.e., if any data is transferred before - * timeout/error/EOF, will contain the number of - * bytes transferred. - * Methods with parameter are I/O vector variants of the I/O - * operations. - * Methods with the extra argument will always result in - * getting called. Methods without the extra argument - * will result in getting called on Win32 platforms, and - * getting called on non-Win32 platforms. - */ -class ACE_Export ACE_SOCK_Stream : public ACE_SOCK_IO -{ -public: - // Initialization and termination methods. - /// Constructor. - ACE_SOCK_Stream (void); - - /// Constructor (sets the underlying ACE_HANDLE with @a h). - ACE_SOCK_Stream (ACE_HANDLE h); - - /// Destructor. - ~ACE_SOCK_Stream (void); - - /** @name Counted send/receive methods - * - * The counted send/receive methods attempt to send a specified number of - * bytes even if they must block and retry the operation in order to - * transfer the entire amount. The time spent blocking for the entire - * transfer can be limited by a specified ACE_Time_Value object which is - * a relative time (i.e., a fixed amount of time, not an absolute time - * of day). These methods return the count of transferred bytes, or -1 - * if an error occurs or the operation times out. In error or timeout - * situations it's possible that some data was transferred before the error - * or timeout. The @c bytes_transferred parameter is used to obtain the - * count of bytes transferred before the error or timeout occurred. If the - * total specified number of bytes is transferred without error, the - * method return value should equal the value of @c bytes_transferred. - */ - //@{ - /// Try to recv exactly @a len bytes into @a buf from the connected socket. - ssize_t recv_n (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Try to recv exactly @a len bytes into @a buf from the connected socket. - ssize_t recv_n (void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Receive an @c iovec of size @a iovcnt from the connected socket. - ssize_t recvv_n (iovec iov[], - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Try to send exactly @a len bytes from @a buf>to the connection socket. - ssize_t send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Try to send exactly @a len bytes from @a buf to the connected socket. - ssize_t send_n (const void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Send all the @c message_block's chained through their @c next and - /// @c cont pointers. This call uses the underlying OS gather-write - /// operation to reduce the domain-crossing penalty. - ssize_t send_n (const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Send an @c iovec of size @a iovcnt to the connected socket. - ssize_t sendv_n (const iovec iov[], - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - //@} - - // = Send/receive ``urgent'' data (see TCP specs...). - ssize_t send_urg (const void *ptr, - size_t len = sizeof (char), - const ACE_Time_Value *timeout = 0) const; - - ssize_t recv_urg (void *ptr, - size_t len = sizeof (char), - const ACE_Time_Value *timeout = 0) const; - - // = Selectively close endpoints. - /// Close down the reader. - int close_reader (void); - - /// Close down the writer. - int close_writer (void); - - /** - * Close down the socket (we need this to make things work correctly - * on Win32, which requires use to do a close_writer() before doing - * the close to avoid losing data). - */ - int close (void); - - // = Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SOCK_Stream.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SOCK_STREAM_H */ diff --git a/ace/SOCK_Stream.inl b/ace/SOCK_Stream.inl deleted file mode 100644 index ed5e8b231b8..00000000000 --- a/ace/SOCK_Stream.inl +++ /dev/null @@ -1,177 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/SOCK_Stream.h" -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SOCK_Stream::ACE_SOCK_Stream (void) -{ - // ACE_TRACE ("ACE_SOCK_Stream::ACE_SOCK_Stream"); -} - -ACE_INLINE -ACE_SOCK_Stream::ACE_SOCK_Stream (ACE_HANDLE h) -{ - // ACE_TRACE ("ACE_SOCK_Stream::ACE_SOCK_Stream"); - this->set_handle (h); -} - -ACE_INLINE -ACE_SOCK_Stream::~ACE_SOCK_Stream (void) -{ - // ACE_TRACE ("ACE_SOCK_Stream::~ACE_SOCK_Stream"); -} - -ACE_INLINE int -ACE_SOCK_Stream::close_reader (void) -{ - ACE_TRACE ("ACE_SOCK_Stream::close_reader"); - if (this->get_handle () != ACE_INVALID_HANDLE) - return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_READ); - else - return 0; -} - -// Shut down just the writing end of a ACE_SOCK. - -ACE_INLINE int -ACE_SOCK_Stream::close_writer (void) -{ - ACE_TRACE ("ACE_SOCK_Stream::close_writer"); - if (this->get_handle () != ACE_INVALID_HANDLE) - return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_WRITE); - else - return 0; -} - -ACE_INLINE ssize_t -ACE_SOCK_Stream::recv_n (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_Stream::recv_n"); - return ACE::recv_n (this->get_handle (), - buf, - len, - flags, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_Stream::recv_n (void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_Stream::recv_n"); - return ACE::recv_n (this->get_handle (), - buf, - len, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_Stream::recvv_n (iovec iov[], - int n, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_Stream::recvv_n"); - return ACE::recvv_n (this->get_handle (), - iov, - n, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_Stream::send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_Stream::send_n"); - return ACE::send_n (this->get_handle (), - buf, - len, - flags, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_Stream::send_n (const void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_Stream::send_n"); - return ACE::send_n (this->get_handle (), - buf, - len, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_Stream::sendv_n (const iovec iov[], - int n, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_Stream::sendv_n"); - return ACE::sendv_n (this->get_handle (), - iov, - n, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_Stream::send_n (const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_SOCK_Stream::send_n"); - return ACE::send_n (this->get_handle (), - message_block, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE_SOCK_Stream::send_urg (const void *ptr, - size_t len, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_Stream::send_urg"); - return ACE::send (this->get_handle (), - ptr, - len, - MSG_OOB, - timeout); -} - -ACE_INLINE ssize_t -ACE_SOCK_Stream::recv_urg (void *ptr, - size_t len, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SOCK_Stream::recv_urg"); - return ACE::recv (this->get_handle (), - ptr, - len, - MSG_OOB, - timeout); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE.cpp b/ace/SPIPE.cpp deleted file mode 100644 index b6b1300b26d..00000000000 --- a/ace/SPIPE.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// $Id$ - -#include "ace/SPIPE.h" - -#include "ace/OS_NS_unistd.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SPIPE.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SPIPE, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE) - -// This is the do-nothing constructor. - -ACE_SPIPE::ACE_SPIPE (void) -{ - // ACE_TRACE ("ACE_SPIPE::ACE_SPIPE"); -} - -void -ACE_SPIPE::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SPIPE::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Close down a ACE_SPIPE. - -int -ACE_SPIPE::get_local_addr (ACE_SPIPE_Addr &local_sap) const -{ - ACE_TRACE ("ACE_SPIPE::get_local_addr"); - local_sap = this->local_addr_; - return 0; -} - -// Close down the STREAM pipe without removing the rendezvous point. - -int -ACE_SPIPE::close (void) -{ - ACE_TRACE ("ACE_SPIPE::close"); - int result = 0; - - if (this->get_handle () != ACE_INVALID_HANDLE) - { - result = ACE_OS::close (this->get_handle ()); -#if defined (ACE_HAS_STREAM_PIPES) - result = (ACE_OS::close (duplex_pipe_handle_) || result); -#endif /* ACE_HAS_STREAM_PIPES */ - this->set_handle (ACE_INVALID_HANDLE); - } - return result; -} - -// Close down the STREAM pipe and remove the rendezvous point from the -// file system. - -int -ACE_SPIPE::remove (void) -{ - ACE_TRACE ("ACE_SPIPE::remove"); - int result = this->close (); - return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1 || result == -1 ? -1 : 0; -} - -#if defined (ACE_HAS_STREAM_PIPES) -/// Temporary store of duplex pipe handle. -void -ACE_SPIPE::set_duplex_handle (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_SPIPE::set_duplex_handle"); - this->duplex_pipe_handle_ = handle; -} -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE.h b/ace/SPIPE.h deleted file mode 100644 index 99bc370b84d..00000000000 --- a/ace/SPIPE.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file SPIPE.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_SPIPE_H -#define ACE_SPIPE_H -#include /**/ "ace/pre.h" - -#include "ace/IPC_SAP.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SPIPE_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SPIPE - * - * @brief Defines the member functions for the base class of the - * ACE_SPIPE abstraction. - * - * ACE_SPIPE was designed as a wrapper facade for STREAM pipes. On - * Windows, however, ACE_SPIPE is a wrapper for Named Pipes. Therefore, - * on Windows, it is better to use the ACE_Proactor or blocking operations - * in lieu of using the ACE_Reactor. - * - * @sa ACE_SPIPE_Acceptor for additional notes on use with ACE_Reactor - * on Windows. - * - * @warning Windows: Works only on Windows NT 4 and higher. - * @warning Works on non-Windows platforms only when @c ACE_HAS_STREAM_PIPES - * is defined. - */ -class ACE_Export ACE_SPIPE : public ACE_IPC_SAP -{ -public: - /// Close down the SPIPE without removing the rendezvous point. - /** - * Closes the underlying pipe handle and sets this object's handle value - * to @c ACE_INVALID_HANDLE. - * @return 0 for success; -1 for failure. If a failure occurs, further - * error information is available from ACE_OS::last_error(). - */ - int close (void); - - /// Close down the SPIPE and remove the rendezvous point from - /// the file system. - /** - * @return 0 for success; -1 for failure. If a failure occurs, further - * error information is available from ACE_OS::last_error(). - */ - int remove (void); - - /// Return the local address of this endpoint. - /** - * Returns the local address of the SPIPE's endpoint in @arg addr. - * @return 0 for success; -1 for failure. If a failure occurs, further - * error information is available from ACE_OS::last_error(). - */ - int get_local_addr (ACE_SPIPE_Addr &) const; - - /** - * Disable signal @arg signum. - * @note This reimplements the inherited method from - * ACE_IPC_SAP. Since the signal actions do not make any sense on - * Windows, this method intercepts the call and NOPs it. On non-Windows, - * it is passed through to ACE_IPC_SAP::disable(). - */ - int disable (int signum) const ; - - /// Dump the state of an object. - void dump (void) const; - -#if defined (ACE_HAS_STREAM_PIPES) - /// Temporary store of duplex pipe handle. - void set_duplex_handle (ACE_HANDLE handle); -#endif /* ACE_HAS_STREAM_PIPES */ - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: -#if defined (ACE_HAS_STREAM_PIPES) - /// Duplex to the pipe I/O handle. - /// Stored here for latter cleaning. - ACE_HANDLE duplex_pipe_handle_; -#endif /* ACE_HAS_STREAM_PIPES */ - -protected: - /// Ensure that this class is an abstract base class - ACE_SPIPE (void); - - /// Our local address. - ACE_SPIPE_Addr local_addr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SPIPE.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SPIPE_H */ diff --git a/ace/SPIPE.inl b/ace/SPIPE.inl deleted file mode 100644 index 45814117a51..00000000000 --- a/ace/SPIPE.inl +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_SPIPE::disable (int signum) const -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (signum) ; - return 0 ; -#else /* ACE_WIN32 */ - return ACE_IPC_SAP::disable (signum) ; -#endif /* ACE_WIN32 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Acceptor.cpp b/ace/SPIPE_Acceptor.cpp deleted file mode 100644 index 960adfc786c..00000000000 --- a/ace/SPIPE_Acceptor.cpp +++ /dev/null @@ -1,337 +0,0 @@ -// $Id$ - -#include "ace/SPIPE_Acceptor.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_stat.h" -#include "ace/OS_NS_sys_time.h" - -#if defined (ACE_HAS_STREAM_PIPES) -# include "ace/OS_NS_unistd.h" -#endif // ACE_HAS_STREAM_PIPES - -ACE_RCSID(ace, SPIPE_Acceptor, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor (void) -#if (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - : sa_ (0), pipe_handle_ (ACE_INVALID_HANDLE) -#endif /* ACE_WIN32 */ -{ - ACE_TRACE ("ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor"); -} - -int -ACE_SPIPE_Acceptor::remove (void) -{ - ACE_TRACE ("ACE_SPIPE_Acceptor::remove"); -#if defined (ACE_HAS_STREAM_PIPES) - int result = this->close (); - - // Remove the underlying file. - return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1 - || result == -1 ? -1 : 0; -#else - this->close (); - return 0; -#endif -} - -ACE_ALLOC_HOOK_DEFINE (ACE_SPIPE_Acceptor) - -void -ACE_SPIPE_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SPIPE_Acceptor::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// General purpose routine for performing server ACE_SPIPE creation. - -int -ACE_SPIPE_Acceptor::open (const ACE_SPIPE_Addr &local_sap, - int reuse_addr, - int perms, - LPSECURITY_ATTRIBUTES sa, - int pipe_mode) -{ - ACE_TRACE ("ACE_SPIPE_Acceptor::open"); - ACE_UNUSED_ARG (reuse_addr); - - this->local_addr_ = local_sap; - this->set_handle (ACE_INVALID_HANDLE); -#if (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - this->sa_ = sa; - this->pipe_mode_ = pipe_mode; -#else - ACE_UNUSED_ARG (sa); - ACE_UNUSED_ARG (pipe_mode); -#endif /* ACE_WIN32 */ - - return this->create_new_instance (perms); -} - -int -ACE_SPIPE_Acceptor::create_new_instance (int perms) -{ -#if defined (ACE_HAS_STREAM_PIPES) - ACE_HANDLE spipe[2]; - char module[] = "connld"; - - ACE_HANDLE handle = ACE_OS::creat (this->local_addr_.get_path_name (), - perms); - if (handle == ACE_INVALID_HANDLE) - return -1; - else if (ACE_OS::close (handle) == -1) - return -1; - else if (ACE_OS::pipe (spipe) == -1) - return -1; - else if (ACE_OS::ioctl (spipe[0], - I_PUSH, - module) == -1) - return -1; - else if (-1 == ACE_OS::fattach - (spipe[0], - ACE_TEXT_ALWAYS_CHAR (this->local_addr_.get_path_name ()))) - return -1; - - this->set_duplex_handle (spipe[0]); - this->set_handle (spipe[1]); - return 0; - -#elif (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - // Create a new instance of the Named Pipe (WIN32). A new instance - // of the named pipe must be created for every client process. If - // an instance of the named pipe that is already connected to a - // client process is reused with a new client process, - // ::ConnectNamedPipe () would fail. - - ACE_UNUSED_ARG (perms); - ACE_TRACE ("ACE_SPIPE_Acceptor::create_new_instance"); - int status; - - // Create a new instance of the named pipe - this->pipe_handle_ = -#if defined (ACE_USES_WCHAR) - ::CreateNamedPipeW ( -#else /* ACE_USES_WCHAR */ - ::CreateNamedPipeA ( -#endif /* ACE_USES_WCHAR */ - this->local_addr_.get_path_name (), - PIPE_ACCESS_DUPLEX - | FILE_FLAG_OVERLAPPED, - pipe_mode_, - PIPE_UNLIMITED_INSTANCES, - 1024 * 10, - 1024 * 10, - ACE_DEFAULT_TIMEOUT, - this->sa_); - - if (this->pipe_handle_ == ACE_INVALID_HANDLE) - return -1; - else - { - // Start the Connect (analogous to listen () for a socket). - // Completion is noted by the event being signalled. If a - // client connects before this call, the error status will be - // ERROR_PIPE_CONNECTED. If the client also disconnects before - // this call, the error status will be ERROR_NO_DATA. In both - // cases, that fact is remembered via already_connected_ and - // noted when the user calls accept(). Else the error status - // should be ERROR_IO_PENDING and the OS will signal the event - // when it's done. - this->already_connected_ = 0; - this->set_handle (this->event_.handle ()); - this->overlapped_.hEvent = this->event_.handle (); - this->event_.reset (); - - BOOL result = ::ConnectNamedPipe (this->pipe_handle_, - &this->overlapped_); - ACE_UNUSED_ARG (result); - // ConnectNamePipe is suppose to always - // "fail" when passed in overlapped i/o - ACE_ASSERT (!result); - - status = ::GetLastError (); - switch (status) - { - case ERROR_IO_PENDING: - break; - case ERROR_PIPE_CONNECTED: - case ERROR_NO_DATA: - this->already_connected_ = 1; - // Set the associated event as signaled so any reactors or - // proactors waiting for this will respond. - this->event_.signal (); - break; - default: - ACE_ASSERT (FALSE); // An undocumented error was returned. - this->close (); // Sets handle to ACE_INVALID_HANDLE. - break; - } - } - return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; -#else - ACE_UNUSED_ARG (perms); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_STREAM_PIPES */ -} - -int -ACE_SPIPE_Acceptor::close (void) -{ - ACE_TRACE ("ACE_SPIPE_Acceptor::close"); - -#if (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - - // Check to see if we have a valid pipe; if not, nothing to do. - if (this->pipe_handle_ == ACE_INVALID_HANDLE) - return -1; - - // Substitute the pipe handle back in so it's closed properly in the - // ACE_OS wrapper. But leave the pipe_handle_ value so we can clean up the - // hanging overlapped operation afterwards. - this->set_handle (this->pipe_handle_); - -#endif /* ACE_WIN32 */ - - // This behavior is shared by UNIX and Win32... - int result = this->ACE_SPIPE::close (); - this->set_handle (ACE_INVALID_HANDLE); - -#if defined (ACE_HAS_STREAM_PIPES) - ACE_OS::fdetach (ACE_TEXT_ALWAYS_CHAR (this->local_addr_.get_path_name ())); -#elif (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - - // open () started the Connect in asynchronous mode, and accept() restarts - // the ConnectNamedPipe in overlapped mode. To avoid leaving a hanging - // overlapped operation that'll write into members of this object, - // wait for the event in the OVERLAPPED structure to be signalled. - if (this->already_connected_ == 0) - { - if (this->event_.wait () != -1) - { - // Should be here with the ConnectNamedPipe operation complete. - // Steal the already_connected_ flag to record the results. - DWORD unused; - ::GetOverlappedResult (this->pipe_handle_, - &this->overlapped_, - &unused, - FALSE); - } - this->pipe_handle_ = ACE_INVALID_HANDLE; - this->already_connected_ = 0; - } -#endif /* ACE_HAS_STREAM_PIPES */ - - return result; -} - -ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor (const ACE_SPIPE_Addr &local_sap, - int reuse_addr, - int perms, - LPSECURITY_ATTRIBUTES sa, - int pipe_mode) -{ - ACE_TRACE ("ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor"); - - if (this->open (local_sap, reuse_addr, perms, sa, pipe_mode) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SPIPE_Acceptor"))); -} - -// General purpose routine for accepting new connections. - -int -ACE_SPIPE_Acceptor::accept (ACE_SPIPE_Stream &new_io, - ACE_SPIPE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) -{ - ACE_TRACE ("ACE_SPIPE_Acceptor::accept"); - ACE_UNUSED_ARG (reset_new_handle); - -#if defined (ACE_HAS_STREAM_PIPES) - strrecvfd r_handle; - - // Note that if THIS->MILLI_SECOND_DELAY == -1 we block on - // ACE_OS::ioctl (). Otherwise, we will wait for the desired number - // of milli seconds using ACE_OS::poll. - - if (timeout != 0 && - ACE::handle_timed_accept (this->get_handle (), - timeout, - restart) == -1) - return -1; - else if (ACE_OS::ioctl (this->get_handle (), - I_RECVFD, - &r_handle) == -1) - return -1; - - new_io.set_handle (r_handle.fd); - new_io.local_addr_ = this->local_addr_; - new_io.remote_addr_.set_size (sizeof r_handle.gid + sizeof r_handle.uid); - new_io.remote_addr_.group_id (r_handle.gid); - new_io.remote_addr_.user_id (r_handle.uid); - - // This is for compatibility with ACE_SOCK_Acceptor and - // ACE_TLI_Acceptor. - if (remote_addr != 0) - *remote_addr = new_io.remote_addr_; - - return 0; -#elif (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - ACE_UNUSED_ARG (restart); - ACE_UNUSED_ARG (remote_addr); - - // Check to see if we have a valid pipe - if (this->pipe_handle_ == ACE_INVALID_HANDLE) - return -1; - - // open () started the Connect in asynchronous mode. Wait for the event - // in the OVERLAPPED structure to be signalled, then grab the status. - if (this->already_connected_ == 0) - { - if (timeout != 0) - { - ACE_Time_Value abstime (ACE_OS::gettimeofday () + *timeout); - if (this->event_.wait (&abstime) == -1) - return -1; - } - else - if (this->event_.wait () == -1) - return -1; - - // Should be here with the ConnectNamedPipe operation complete. - // Steal the already_connected_ flag to record the results. - DWORD unused; - this->already_connected_ = ::GetOverlappedResult (this->pipe_handle_, - &this->overlapped_, - &unused, - FALSE); - } - - if (this->already_connected_) - { - new_io.set_handle (this->pipe_handle_); - this->pipe_handle_ = ACE_INVALID_HANDLE; - new_io.local_addr_ = this->local_addr_; - - // Create a new instance of the pipe for the next connection. - this->create_new_instance (); - return 0; - } - return -1; -#else - ACE_UNUSED_ARG (restart); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (remote_addr); - ACE_UNUSED_ARG (new_io); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_STREAM_PIPES */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Acceptor.h b/ace/SPIPE_Acceptor.h deleted file mode 100644 index 6e0bb7ed8aa..00000000000 --- a/ace/SPIPE_Acceptor.h +++ /dev/null @@ -1,168 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SPIPE_Acceptor.h - * - * $Id$ - * - * @author Douglas C. Schmidt - * @author Prashant Jain - */ -//============================================================================= - - -#ifndef ACE_SPIPE_ACCEPTOR_H -#define ACE_SPIPE_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include "ace/SPIPE_Stream.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) -#include "ace/Manual_Event.h" -#endif /* ACE_WIN32 */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SPIPE_Acceptor - * - * @brief A factory class that produces ACE_SPIPE_Stream objects. - * - * ACE_SPIPE_Acceptor is a factory class that accepts SPIPE connections. - * Each accepted connection produces an ACE_SPIPE_Stream object. - * - * @warning Windows: Works only on Windows NT 4 and higher. To use this - * class with the ACE_Reactor framework, note that the handle to - * demultiplex on is an event handle and should be registered with the - * ACE_Reactor::register_handler (ACE_Event_Handler *, ACE_HANDLE) method. - * - * @warning Works on non-Windows platforms only when @c ACE_HAS_STREAM_PIPES - * is defined. - * - */ -class ACE_Export ACE_SPIPE_Acceptor : public ACE_SPIPE -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_SPIPE_Acceptor (void); - - /// Initiate a passive-mode STREAM pipe listener. - /** - * @param local_sap The name of the pipe instance to open and listen on. - * @param reuse_addr Optional, and ignored. Needed for API compatibility - * with other acceptor classes. - * @param perms Optional, the protection mask to create the pipe - * with. Ignored on Windows. - * @param sa Optional, ignored on non-Windows. The - * SECURITY_ATTRIBUTES to create the named pipe - * instances with. This pointer is remembered and - * reused on each new named pipe instance, so only - * pass a value that remains valid as long as this - * object does. - * @param pipe_mode Optional, ignored on non-Windows. The NT pipe - * mode used when creating the pipe. - */ - ACE_SPIPE_Acceptor (const ACE_SPIPE_Addr &local_sap, - int reuse_addr = 1, - int perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0, - int pipe_mode = PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE); - - /// Initiate a passive-mode STREAM pipe listener. - /** - * @param local_sap The name of the pipe instance to open and listen on. - * @param reuse_addr Optional, and ignored. Needed for API compatibility - * with other acceptor classes. - * @param perms Optional, the protection mask to create the pipe - * with. Ignored on Windows. - * @param sa Optional, ignored on non-Windows. The - * SECURITY_ATTRIBUTES to create the named pipe - * instances with. This pointer is remembered and - * reused on each new named pipe instance, so only - * pass a value that remains valid as long as this - * object does. - * @param pipe_mode Optional, ignored on non-Windows. The NT pipe - * mode used when creating the pipe. - * - * @retval 0 for success. - * @retval -1 for failure. - */ - int open (const ACE_SPIPE_Addr &local_sap, - int reuse_addr = 1, - int perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0, - int pipe_mode = PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE); - - /// Close down the passive-mode STREAM pipe listener. - int close (void); - - /// Remove the underlying mounted pipe from the file system. - int remove (void); - - // = Passive connection acceptance method. - /** - * Accept a new data transfer connection. - * - * @param ipc_sap_spipe The ACE_SPIPE_Stream to initialize with the - * newly-accepted pipe. - * @param remote_addr Optional, accepts the address of the peer. - * @param timeout 0 means block forever, {0, 0} means poll. - * @param restart 1 means "restart if interrupted." - * - * @retval 0 for success. - * @retval -1 for failure. - */ - int accept (ACE_SPIPE_Stream &ipc_sap_spipe, - ACE_SPIPE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0); - - // = Meta-type info - typedef ACE_SPIPE_Addr PEER_ADDR; - typedef ACE_SPIPE_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Create a new instance of an SPIPE. - int create_new_instance (int perms = 0); - -#if (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - // On Windows, the SECURITY_ATTRIBUTES specified for the initial accept - // operation is reused on all subsequent pipe instances as well. - LPSECURITY_ATTRIBUTES sa_; - - // On Windows, the pipe mode to create the pipe in. This can be in - // either a bytestream-oriented mode or a message-oriented mode. - DWORD pipe_mode_; - - // On Windows, the handle maintained in the ACE_IPC_SAP class is the - // event handle from event_. The pipe handle is useless for telling - // when a pipe connect is done/ready, and it changes on each pipe - // acceptance, quite unlike other acceptor-type classes in ACE. - // This allows the get_handle()-obtained handle to be used for - // registering with the reactor (albeit for signal, not input) - // to tell when a pipe accept is done. - ACE_OVERLAPPED overlapped_; - ACE_Manual_Event event_; - ACE_HANDLE pipe_handle_; - int already_connected_; -#endif /* ACE_WIN32 */ - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_SPIPE_ACCEPTOR_H */ diff --git a/ace/SPIPE_Addr.cpp b/ace/SPIPE_Addr.cpp deleted file mode 100644 index b4ec63e4fc3..00000000000 --- a/ace/SPIPE_Addr.cpp +++ /dev/null @@ -1,167 +0,0 @@ -// $Id$ - -#include "ace/SPIPE_Addr.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_unistd.h" -#include "ace/os_include/sys/os_socket.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SPIPE_Addr.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SPIPE_Addr, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE_Addr) - -void -ACE_SPIPE_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -#endif /* ACE_HAS_DUMP */ -} - -// Set a pointer to the address. -void -ACE_SPIPE_Addr::set_addr (void *addr, int len) -{ - ACE_TRACE ("ACE_SPIPE_Addr::set_addr"); - - this->ACE_Addr::base_set (AF_SPIPE, len); - ACE_OS::memcpy ((void *) &this->SPIPE_addr_, - (void *) addr, - len); -} - -// Return the address. - -void * -ACE_SPIPE_Addr::get_addr (void) const -{ - return (void *) &this->SPIPE_addr_; -} - - -// Do nothing constructor. - -ACE_SPIPE_Addr::ACE_SPIPE_Addr (void) - : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_) -{ - (void) ACE_OS::memset ((void *) &this->SPIPE_addr_, - 0, - sizeof this->SPIPE_addr_); -} - -int -ACE_SPIPE_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const -{ - ACE_OS::strsncpy (s, - this->SPIPE_addr_.rendezvous_, - len); - return 0; -} - -// Transform the string into the current addressing format. - -int -ACE_SPIPE_Addr::string_to_addr (const ACE_TCHAR *addr) -{ - return this->set (addr); -} - -int -ACE_SPIPE_Addr::set (const ACE_SPIPE_Addr &sa) -{ - this->base_set (sa.get_type (), sa.get_size ()); - - if (sa.get_type () == AF_ANY) - (void) ACE_OS::memset ((void *) &this->SPIPE_addr_, - 0, - sizeof this->SPIPE_addr_); - else - (void) ACE_OS::memcpy ((void *) &this->SPIPE_addr_, (void *) - &sa.SPIPE_addr_, - sa.get_size ()); - return 0; -} - -// Copy constructor. - -ACE_SPIPE_Addr::ACE_SPIPE_Addr (const ACE_SPIPE_Addr &sa) - : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_) -{ - this->set (sa); -} - -int -ACE_SPIPE_Addr::set (const ACE_TCHAR *addr, - gid_t gid, - uid_t uid) -{ - int len = sizeof (this->SPIPE_addr_.uid_); - len += sizeof (this->SPIPE_addr_.gid_); - -#if defined (ACE_WIN32) - const ACE_TCHAR *colonp = ACE_OS::strchr (addr, ':'); - ACE_TCHAR temp[BUFSIZ]; - - if (colonp == 0) // Assume it's a local name. - { - ACE_OS::strcpy (temp, ACE_LIB_TEXT ( "\\\\.\\pipe\\")); - ACE_OS::strcat (temp, addr); - } - else - { - - if (ACE_OS::strncmp (addr, - ACE_LIB_TEXT ("localhost"), - ACE_OS::strlen ("localhost")) == 0) - // change "localhost" to "." - ACE_OS::strcpy (temp, ACE_LIB_TEXT ("\\\\.")); - else - { - ACE_OS::strcpy (temp, ACE_LIB_TEXT ("\\\\")); - - ACE_TCHAR *t; - - // We need to allocate a duplicate so that we can write a - // NUL character into it. - ACE_ALLOCATOR_RETURN (t, ACE_OS::strdup (addr), -1); - - t[colonp - addr] = ACE_LIB_TEXT ('\0'); - ACE_OS::strcat (temp, t); - - ACE_OS::free (t); - } - - ACE_OS::strcat (temp, ACE_LIB_TEXT ("\\pipe\\")); - ACE_OS::strcat (temp, colonp + 1); - } - len += static_cast (ACE_OS::strlen (temp)); - this->ACE_Addr::base_set (AF_SPIPE, len); - - ACE_OS::strcpy (this->SPIPE_addr_.rendezvous_, temp); -#else - this->ACE_Addr::base_set (AF_SPIPE, - ACE_OS::strlen (addr) + 1 + len); - ACE_OS::strsncpy (this->SPIPE_addr_.rendezvous_, - addr, - sizeof this->SPIPE_addr_.rendezvous_); -#endif /* ACE_WIN32 */ - this->SPIPE_addr_.gid_ = gid == 0 ? ACE_OS::getgid () : gid; - this->SPIPE_addr_.uid_ = uid == 0 ? ACE_OS::getuid () : uid; - return 0; -} - -// Create a ACE_Addr from a ACE_SPIPE pathname. - -ACE_SPIPE_Addr::ACE_SPIPE_Addr (const ACE_TCHAR *addr, - gid_t gid, - uid_t uid) - : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_) -{ - this->set (addr, gid, uid); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Addr.h b/ace/SPIPE_Addr.h deleted file mode 100644 index 74c9351b173..00000000000 --- a/ace/SPIPE_Addr.h +++ /dev/null @@ -1,122 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file SPIPE_Addr.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_SPIPE_ADDR_H -#define ACE_SPIPE_ADDR_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Addr.h" -#include "ace/os_include/sys/os_types.h" -#include "ace/os_include/os_dirent.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SPIPE_Addr - * - * @brief Defines the SVR4 STREAM pipe address family address format. - */ -class ACE_Export ACE_SPIPE_Addr : public ACE_Addr -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_SPIPE_Addr (void); - - /// Copy constructor. - ACE_SPIPE_Addr (const ACE_SPIPE_Addr &sa); - - /// Create a ACE_SPIPE_Addr from a rendezvous point in the file - /// system. - ACE_SPIPE_Addr (const ACE_TCHAR *rendezvous_point, gid_t = 0, uid_t = 0); - - /// Acts like a copy constructor... - int set (const ACE_SPIPE_Addr &sa); - - /// Create a ACE_SPIPE_Addr from a rendezvous point in the file - /// system. - int set (const ACE_TCHAR *rendezvous_point, gid_t = 0, uid_t = 0); - - /// Return a pointer to the address. - virtual void *get_addr (void) const; - - /// Set a pointer to the underlying network address. - virtual void set_addr (void *addr, int len); - - /// Transform the current address into string format. - virtual int addr_to_string (ACE_TCHAR *addr, size_t) const; - - /// Transform the string into the current addressing format. - virtual int string_to_addr (const ACE_TCHAR *addr); - - // = Equality/inequality tests - /// Check for equality. - bool operator == (const ACE_SPIPE_Addr &SAP) const; - - /// Check for inequality - bool operator != (const ACE_SPIPE_Addr &SAP) const; - - // = SPIPE-specific address operations - /// Pathname of rendezvous point in file system. - const ACE_TCHAR *get_path_name (void) const; - - /// Get user id. - uid_t user_id (void) const; - - /// Set user id. - void user_id (uid_t uid); - - /// Set group ids. - void group_id (gid_t gid); - - /// Get group ids. - gid_t group_id (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Contains security attributes. - struct SPIPE_Addr - { - /// Group id. - gid_t gid_; - - /// User id. - uid_t uid_; - - /// Pathname in the file system. - ACE_TCHAR rendezvous_[MAXPATHLEN + 1]; - - } SPIPE_addr_; - // Contents of an SPIPE address. -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SPIPE_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SPIPE_ADDR_H */ diff --git a/ace/SPIPE_Addr.inl b/ace/SPIPE_Addr.inl deleted file mode 100644 index ea4c71ef682..00000000000 --- a/ace/SPIPE_Addr.inl +++ /dev/null @@ -1,59 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - - -#include "ace/SString.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Compare two addresses for equality. - -ACE_INLINE bool -ACE_SPIPE_Addr::operator == (const ACE_SPIPE_Addr &sap) const -{ - return ACE_OS::strcmp (this->SPIPE_addr_.rendezvous_, - sap.SPIPE_addr_.rendezvous_ ) == 0; -} - -// Compare two addresses for inequality. - -ACE_INLINE bool -ACE_SPIPE_Addr::operator != (const ACE_SPIPE_Addr &sap) const -{ - return !((*this) == sap); // This is lazy, of course... ;-) -} - -// Return the path name used for the rendezvous point. - -ACE_INLINE const ACE_TCHAR * -ACE_SPIPE_Addr::get_path_name (void) const -{ - return this->SPIPE_addr_.rendezvous_; -} - -ACE_INLINE uid_t -ACE_SPIPE_Addr::user_id (void) const -{ - return this->SPIPE_addr_.uid_; -} - -ACE_INLINE void -ACE_SPIPE_Addr::user_id (uid_t uid) -{ - this->SPIPE_addr_.uid_ = uid; -} - -ACE_INLINE gid_t -ACE_SPIPE_Addr::group_id (void) const -{ - return this->SPIPE_addr_.gid_; -} - -ACE_INLINE void -ACE_SPIPE_Addr::group_id (gid_t gid) -{ - this->SPIPE_addr_.gid_ = gid; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Connector.cpp b/ace/SPIPE_Connector.cpp deleted file mode 100644 index e21388e7bae..00000000000 --- a/ace/SPIPE_Connector.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// $Id$ - -#include "ace/SPIPE_Connector.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_time.h" -#include "ace/OS_NS_fcntl.h" -#include "ace/OS_NS_unistd.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SPIPE_Connector.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SPIPE_Connector, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE_Connector) - -// Creates a Local ACE_SPIPE. - -ACE_SPIPE_Connector::ACE_SPIPE_Connector (ACE_SPIPE_Stream &new_io, - const ACE_SPIPE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr & local_sap, - int reuse_addr, - int flags, - int perms, - LPSECURITY_ATTRIBUTES sa, - int pipe_mode) -{ - ACE_TRACE ("ACE_SPIPE_Connector::ACE_SPIPE_Connector"); - if (this->connect (new_io, remote_sap, timeout, local_sap, - reuse_addr, flags, perms, sa, pipe_mode) == -1 - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("address %s, %p\n"), - remote_sap.get_path_name (), ACE_LIB_TEXT ("ACE_SPIPE_Connector"))); -} - -void -ACE_SPIPE_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SPIPE_Connector::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_SPIPE_Connector::ACE_SPIPE_Connector (void) -{ - ACE_TRACE ("ACE_SPIPE_Connector::ACE_SPIPE_Connector"); -} - -int -ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io, - const ACE_SPIPE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr & /* local_sap */, - int /* reuse_addr */, - int flags, - int perms, - LPSECURITY_ATTRIBUTES sa, - int pipe_mode) -{ - ACE_TRACE ("ACE_SPIPE_Connector::connect"); - // Make darn sure that the O_CREAT flag is not set! - ACE_CLR_BITS (flags, O_CREAT); - - ACE_HANDLE handle; - - ACE_UNUSED_ARG (pipe_mode); -#if defined (ACE_WIN32) && \ - !defined (ACE_HAS_PHARLAP) && !defined (ACE_HAS_WINCE) - // We need to allow for more than one attempt to connect, - // calculate the absolute time at which we give up. - ACE_Time_Value absolute_time; - if (timeout != 0) - absolute_time = ACE_OS::gettimeofday () + *timeout; - - // Loop until success or failure. - for (;;) - { - handle = ACE_OS::open (remote_sap.get_path_name(), flags, perms, sa); - if (handle != ACE_INVALID_HANDLE) - // Success! - break; - - // Check if we have a busy pipe condition. - if (::GetLastError() != ERROR_PIPE_BUSY) - // Nope, this is a failure condition. - break; - - // This will hold the time out value used in the ::WaitNamedPipe - // call. - DWORD time_out_value; - - // Check if we are to block until we connect. - if (timeout == 0) - // Wait for as long as it takes. - time_out_value = NMPWAIT_WAIT_FOREVER; - else - { - // Calculate the amount of time left to wait. - ACE_Time_Value relative_time (absolute_time - ACE_OS::gettimeofday ()); - // Check if we have run out of time. - if (relative_time <= ACE_Time_Value::zero) - { - // Mimick the errno value returned by - // ACE::handle_timed_open. - if (*timeout == ACE_Time_Value::zero) - errno = EWOULDBLOCK; - else - errno = ETIMEDOUT; - // Exit the connect loop with the failure. - break; - } - // Get the amount of time remaining for ::WaitNamedPipe. - time_out_value = relative_time.msec (); - - } - - // Wait for the named pipe to become available. - ACE_TEXT_WaitNamedPipe (remote_sap.get_path_name (), - time_out_value); - - // Regardless of the return value, we'll do one more attempt to - // connect to see if it is now available and to return - // consistent error values. - } - - // Set named pipe mode if we have a valid handle. - if (handle != ACE_INVALID_HANDLE) - { - // Check if we are changing the pipe mode from the default. - if (pipe_mode != (PIPE_READMODE_BYTE | PIPE_WAIT)) - { - DWORD dword_pipe_mode = pipe_mode; - if (!::SetNamedPipeHandleState (handle, - &dword_pipe_mode, - 0, - 0)) - { - // We were not able to put the pipe into the requested - // mode. - ACE_OS::close (handle); - handle = ACE_INVALID_HANDLE; - } - } - } -#else /* ACE_WIN32 && !ACE_HAS_PHARLAP */ - handle = ACE::handle_timed_open (timeout, - remote_sap.get_path_name (), - flags, perms, sa); -#endif /* !ACE_WIN32 || ACE_HAS_PHARLAP || ACE_HAS_WINCE */ - - new_io.set_handle (handle); - new_io.remote_addr_ = remote_sap; // class copy. - - return handle == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Connector.h b/ace/SPIPE_Connector.h deleted file mode 100644 index f9fc2455ecc..00000000000 --- a/ace/SPIPE_Connector.h +++ /dev/null @@ -1,118 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SPIPE_Connector.h - * - * $Id$ - * - * @author Doug Schmidt - * @author Prashant Jain - */ -//============================================================================= - -#ifndef ACE_SPIPE_CONNECTOR_H -#define ACE_SPIPE_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/SPIPE_Stream.h" -#include "ace/os_include/os_fcntl.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SPIPE_Connector - * - * @brief Defines an active connection factory for . - * On Windows this is mapped to Named Pipes, whereas on UNIX it is - * mapped to STREAM pipes. - */ -class ACE_Export ACE_SPIPE_Connector -{ -public: - // = Initialization method. - /// Default constructor. - ACE_SPIPE_Connector (void); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made . The - * is the value of local address to bind to. If it's - * the default value of then the user is letting - * the OS do the binding. If == 1 then the - * is reused, even if it hasn't been cleanedup yet. - * The and arguments are passed down to the - * method. The argument is only used in NT and is used to - * establish the NT pipe mode. - */ - ACE_SPIPE_Connector (ACE_SPIPE_Stream &new_io, - const ACE_SPIPE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0, - LPSECURITY_ATTRIBUTES sa = 0, - int pipe_mode = PIPE_READMODE_MESSAGE | PIPE_WAIT); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made . The - * is the value of local address to bind to. If it's - * the default value of then the user is letting - * the OS do the binding. If == 1 then the - * is reused, even if it hasn't been cleanedup yet. - * The and arguments are passed down to the - * method. The argument is only used in NT and is used to - * establish the NT pipe mode. - */ - int connect (ACE_SPIPE_Stream &new_io, - const ACE_SPIPE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0, - LPSECURITY_ATTRIBUTES sa = 0, - int pipe_mode = PIPE_READMODE_MESSAGE | PIPE_WAIT); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - // = Meta-type info - typedef ACE_SPIPE_Addr PEER_ADDR; - typedef ACE_SPIPE_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SPIPE_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SPIPE_CONNECTOR_H */ diff --git a/ace/SPIPE_Connector.inl b/ace/SPIPE_Connector.inl deleted file mode 100644 index bbec9b8f468..00000000000 --- a/ace/SPIPE_Connector.inl +++ /dev/null @@ -1,15 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_SPIPE_Connector::reset_new_handle (ACE_HANDLE handle) -{ - ACE_UNUSED_ARG (handle); - // Nothing to do here since the handle is not a socket - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Stream.cpp b/ace/SPIPE_Stream.cpp deleted file mode 100644 index fcc695d6271..00000000000 --- a/ace/SPIPE_Stream.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// $Id$ - -#include "ace/SPIPE_Stream.h" -#include "ace/OS_Memory.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SPIPE_Stream.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SPIPE_Stream, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE_Stream) - -void -ACE_SPIPE_Stream::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SPIPE_Stream::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Simple-minded do nothing constructor. - -ACE_SPIPE_Stream::ACE_SPIPE_Stream (void) -{ - // ACE_TRACE ("ACE_SPIPE_Stream::ACE_SPIPE_Stream"); -} - -// Send N char *ptrs and int lengths. Note that the char *'s precede -// the ints (basically, an varargs version of writev). The count N is -// the *total* number of trailing arguments, *not* a couple of the -// number of tuple pairs! - -ssize_t -ACE_SPIPE_Stream::send (size_t n, ...) const -{ - // ACE_TRACE ("ACE_SPIPE_Stream::send"); - va_list argp; - int total_tuples = static_cast (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::writev (this->get_handle (), iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -// This is basically an interface to ACE_OS::readv, that doesn't use -// the struct iovec explicitly. The ... can be passed as an arbitrary -// number of (char *ptr, int len) tuples. However, the count N is the -// *total* number of trailing arguments, *not* a couple of the number -// of tuple pairs! - -ssize_t -ACE_SPIPE_Stream::recv (size_t n, ...) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recv"); - va_list argp; - int total_tuples = static_cast (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::readv (this->get_handle (), iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Stream.h b/ace/SPIPE_Stream.h deleted file mode 100644 index 9a94216ae40..00000000000 --- a/ace/SPIPE_Stream.h +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file SPIPE_Stream.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SPIPE_STREAM_H -#define ACE_SPIPE_STREAM_H -#include /**/ "ace/pre.h" - -#include "ace/SPIPE.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SPIPE_Addr.h" -#include "ace/ACE.h" -#include "ace/OS_NS_stropts.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SPIPE_Stream - * - * @brief Defines the methods in the abstraction. - * - * is the buffer to write from or receive into. - * is the number of bytes to transfer. - * - * The "_n()" I/O methods keep looping until all the data has been - * transferred. These methods also work for sockets in non-blocking - * mode i.e., they keep looping on EWOULDBLOCK. - * - * The return values for the "*_n()" methods match the return values - * from the non "_n()" methods and are specified as follows: - * - The number of bytes transferred is returned. - * - On error, -1 is returned, errno is set to appropriate error. - * - On EOF, 0 is returned, errno is irrelevant. - * - * Methods with parameter are I/O vector variants of the I/O - * operations. - * - * The and operations use "message" semantics rather - * than "bytestream" semantics. - */ -class ACE_Export ACE_SPIPE_Stream : public ACE_SPIPE -{ -public: - friend class ACE_SPIPE_Acceptor; - friend class ACE_SPIPE_Connector; - - // = Initialization method. - /// Default constructor. - ACE_SPIPE_Stream (void); - - /// Obtain the address of whom we are connected with. - int get_remote_addr (ACE_SPIPE_Addr &remote_sap) const; - - /// Send an open FD to another process. - int send_handle (ACE_HANDLE handle) const; - - /// Recv an open FD from another process. - int recv_handle (ACE_HANDLE &handle) const; - - /// Recv an open FD from another process. - int recv_handle (strrecvfd &recvfd) const; - - /// Send bytes, keep trying until are sent. - ssize_t send_n (const void *buf, size_t len) const; - - /// Recv bytes, keep trying until are received. - ssize_t recv_n (void *buf, size_t len) const; - - /// Send bytes via STREAM pipes using "band" mode. - ssize_t send (const void *buf, size_t len) const; - - /// Recv bytes via STREAM pipes using "band" mode. - ssize_t recv (void *buf, size_t len) const; - - /// Send and via STREAM pipes. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int flags = 0) const; - - /// Recv and via STREAM pipes. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *flags) const; - - /// Send bytes via STREAM pipes using "band" mode. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int band, - int flags) const; - - /// Recv bytes via STREAM pipes using "band" mode. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *band, - int *flags) const; - - /// Send iovecs via the OS "gather-write" operation. - ssize_t send (const iovec iov[], int len) const; - - /// Recv iovecs via the OS "scatter-read" operation. - ssize_t recv (iovec iov[], int len) const; - - /** - * Send N char *ptrs and int lengths. Note that the char *'s - * precede the ints (basically, an varargs version of writev). The - * count N is the *total* number of trailing arguments, *not* a - * couple of the number of tuple pairs! - */ - ssize_t send (size_t len, ...) const; - - /** - * This is an interface to ::readv, that doesn't use the struct - * iovec explicitly. The ... can be passed as an arbitrary number - * of (char *ptr, int len) tuples. However, the count N is the - * *total* number of trailing arguments, *not* a couple of the - * number of tuple pairs! - */ - ssize_t recv (size_t len, ...) const; - - /// Send bytes via Win32 using overlapped I/O. - ssize_t send (const void *buf, size_t len, ACE_OVERLAPPED *overlapped) const; - - /// Recv bytes via Win32 using overlapped I/O. - ssize_t recv (void *buf, size_t len, ACE_OVERLAPPED *overlapped) const; - - /// Send an of size to the stream. - ssize_t sendv (const iovec iov[], - int len) const; - - /// Send an of size to the stream. Will block until all - /// bytes are sent or an error occurs. - ssize_t sendv_n (const iovec iov[], - int len) const; - - /// Receive an of size to the stream. - ssize_t recvv_n (iovec iov[], - int len) const; - - // = Meta-type info - typedef ACE_SPIPE_Addr PEER_ADDR; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - ACE_SPIPE_Addr remote_addr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SPIPE_Stream.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SPIPE_STREAM_H */ diff --git a/ace/SPIPE_Stream.inl b/ace/SPIPE_Stream.inl deleted file mode 100644 index dbc3725782c..00000000000 --- a/ace/SPIPE_Stream.inl +++ /dev/null @@ -1,277 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_sys_uio.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_unistd.h" -#if defined (ACE_WIN32) -#include "ace/OS_NS_sys_socket.h" -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Create an ACE_SPIPE_Stream. - -ACE_INLINE int -ACE_SPIPE_Stream::get_remote_addr (ACE_SPIPE_Addr &remote_sap) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::get_remote_addr"); - remote_sap = this->remote_addr_; - return 0; -} - -// Send exactly N bytes from BUF to this socket. Keeping trying until -// this many bytes are sent. - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::send_n (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::send_n"); - return ACE::write_n (this->get_handle (), buf, n); -} - -// Receive exactly N bytes from this socket into BUF. Keep trying -// until this many bytes are received. - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::recv_n (void *buf, size_t n) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recv_n"); - return ACE::read_n (this->get_handle (), buf, n); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::send (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::send"); - return ACE_OS::write (this->get_handle (), (const char *) buf, n); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::recv (void *buf, size_t n) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recv"); - return ACE_OS::read (this->get_handle (), (char *) buf, n); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::send"); - return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recv"); - return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::send"); - return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recv"); - return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::send (const iovec iov[], int n) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::send"); - return ACE_OS::writev (this->get_handle (), iov, n); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::recv (iovec iov[], int n) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recv"); - return ACE_OS::readv (this->get_handle (), iov, n); -} - -// This routine sends an open file descriptor to this socket. - -ACE_INLINE int -ACE_SPIPE_Stream::send_handle (ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::send_handle"); -#if defined (ACE_HAS_STREAM_PIPES) - return ACE_OS::ioctl (this->get_handle (), I_SENDFD, (void *) handle); -#elif defined (ACE_WIN32) && \ - (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) && \ - !defined (ACE_HAS_WINCE) /* CE4 has WS2 but not WSADuplicateSocket */ - DWORD procID; - WSAPROTOCOL_INFO protInfo; - ssize_t res; - res = this->recv(&procID, sizeof(procID)); - if (res != sizeof(procID)) - { - if(res != -1) - errno = ENXIO; - return -1; - } - if (::WSADuplicateSocket ((SOCKET)handle, procID, &protInfo) == -1) - { - ACE_OS::set_errno_to_wsa_last_error(); - return -1; - } - res = this->send(&protInfo, sizeof(protInfo)); - if (res != sizeof(protInfo)) - { - if(res != -1) - errno = ENXIO; - return -1; - } - // This is just for synchronization, we will ignore the data - res = this->recv(&procID, sizeof(procID)); - if (res != sizeof(procID)) - { - if(res != -1) - errno = ENXIO; - return -1; - } - return 0; -#else - handle = handle; - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_STREAM_PIPES */ -} - -// This file receives an open file descriptor from this socket. - -ACE_INLINE int -ACE_SPIPE_Stream::recv_handle (ACE_HANDLE &handle) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recv_handle"); -#if defined (ACE_HAS_STREAM_PIPES) - strrecvfd recvfd; - - if (ACE_OS::ioctl (this->get_handle (), I_RECVFD, (void *) &recvfd) == -1) - return -1; - else - { - handle = recvfd.fd; - return 0; - } -#elif defined (ACE_WIN32) && \ - (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) - pid_t procID = ACE_OS::getpid(); - WSAPROTOCOL_INFO protInfo; - ssize_t res; - res = this->send(&procID, sizeof(procID)); - if (res != sizeof(procID)) - { - if(res != -1) - errno = ENXIO; - return -1; - } - res = this->recv(&protInfo, sizeof(protInfo)); - if (res != sizeof(protInfo)) - { - if(res != -1) - errno = ENXIO; - return -1; - } - handle = ACE_OS::socket (FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, - &protInfo, 0, 0); - if (handle == ACE_INVALID_HANDLE) - { - return -1; - } - // Since it does not matter what the data is, just send something to - // synchronize the end of the exchange - res = this->send(&procID, sizeof(procID)); - if (res != sizeof(procID)) - { - if(res != -1) - errno = ENXIO; - return -1; - } - return 0; -#else - handle = handle; - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_STREAM_PIPES */ -} - -// This file receives an open file descriptor from this socket and -// also passes back the information about the address... - -ACE_INLINE int -ACE_SPIPE_Stream::recv_handle (strrecvfd &recvfd) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recv_handle"); -#if defined (ACE_HAS_STREAM_PIPES) - return ACE_OS::ioctl (this->get_handle (), I_RECVFD, (void *) &recvfd); -#else - ACE_UNUSED_ARG (recvfd); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_STREAM_PIPES */ -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::send (const void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::send"); - return ACE_OS::write (this->get_handle (), - (const char *) buf, n, - overlapped); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::recv (void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recv"); - return ACE_OS::read (this->get_handle (), - (char *) buf, n, - overlapped); -} - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::sendv_n (const iovec iov[], - int n) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::sendv_n"); - return ACE::writev_n (this->get_handle (), - iov, - n); -} - -// Recv an n byte message from the Stream. - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::recvv_n (iovec iov[], - int n) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::recvv_n"); - // @@ Carlos, can you please update this to call the - // new ACE::recvv_n() method that you write? - return ACE_OS::readv (this->get_handle (), - iov, - n); -} - -// Send an of size to the Stream. - -ACE_INLINE ssize_t -ACE_SPIPE_Stream::sendv (const iovec iov[], - int n) const -{ - ACE_TRACE ("ACE_SPIPE_Stream::sendv"); - return ACE_OS::writev (this->get_handle (), - iov, - n); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - diff --git a/ace/SSL/ACE_SSL.pc.in b/ace/SSL/ACE_SSL.pc.in deleted file mode 100644 index 51c04a18ff1..00000000000 --- a/ace/SSL/ACE_SSL.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ACE_SSL -Description: ACE SSL Library -Requires: ACE -Version: @VERSION@ -Libs: -L${libdir} @ACE_TLS_LDFLAGS@ -lACE_SSL @ACE_TLS_LIBS@ -Cflags: -I${includedir} @ACE_TLS_CPPFLAGS@ diff --git a/ace/SSL/Makefile.am b/ace/SSL/Makefile.am deleted file mode 100644 index a3d9bf94fd8..00000000000 --- a/ace/SSL/Makefile.am +++ /dev/null @@ -1,83 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id$ -## -## This file was generated by MPC. Any changes made directly to -## this file will be lost the next time it is generated. -## -## MPC Command: -## /acebuilds/ACE_wrappers-repository/bin/mwc.pl -include /acebuilds/MPC/config -include /acebuilds/MPC/templates -feature_file /acebuilds/ACE_wrappers-repository/local.features -noreldefs -type automake -exclude build,Kokyu - -includedir = @includedir@/ace/SSL -pkgconfigdir = @libdir@/pkgconfig - -ACE_BUILDDIR = $(top_builddir) -ACE_ROOT = $(top_srcdir) - - -## Makefile.SSL.am - -if BUILD_SSL - -lib_LTLIBRARIES = libACE_SSL.la - -libACE_SSL_la_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - @ACE_TLS_CPPFLAGS@ \ - -DACE_SSL_BUILD_DLL - -libACE_SSL_la_SOURCES = \ - SSL_Asynch_BIO.cpp \ - SSL_Asynch_Stream.cpp \ - SSL_Context.cpp \ - SSL_SOCK.cpp \ - SSL_SOCK_Acceptor.cpp \ - SSL_SOCK_Connector.cpp \ - SSL_SOCK_Stream.cpp - -libACE_SSL_la_LDFLAGS = \ - -release @ACE_VERSION_NAME@ @ACE_TLS_LDFLAGS@ - -libACE_SSL_la_LIBADD = \ - $(ACE_BUILDDIR)/ace/libACE.la \ - @ACE_TLS_LIBS@ - -nobase_include_HEADERS = \ - SSL_Asynch_BIO.h \ - SSL_Asynch_Stream.h \ - SSL_Context.h \ - SSL_Context.inl \ - SSL_Export.h \ - SSL_SOCK.h \ - SSL_SOCK.i \ - SSL_SOCK_Acceptor.h \ - SSL_SOCK_Acceptor.i \ - SSL_SOCK_Connector.h \ - SSL_SOCK_Connector.i \ - SSL_SOCK_Stream.h \ - SSL_SOCK_Stream.i \ - sslconf.h - -pkgconfig_DATA = \ - ACE_SSL.pc - -CLEANFILES = \ - ACE_SSL.pc - -ACE_SSL.pc: ${top_builddir}/config.status ${srcdir}/ACE_SSL.pc.in - ${top_builddir}/config.status --file "$@":${srcdir}/ACE_SSL.pc.in - -endif BUILD_SSL - -EXTRA_DIST = \ - ACE_SSL.pc.in - - -## Clean up template repositories, etc. -clean-local: - -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* - -rm -f gcctemp.c gcctemp so_locations *.ics - -rm -rf cxx_repository ptrepository ti_files - -rm -rf templateregistry ir.out - -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/ace/SSL/SSL_Asynch_BIO.cpp b/ace/SSL/SSL_Asynch_BIO.cpp deleted file mode 100644 index 9e27ab1348f..00000000000 --- a/ace/SSL/SSL_Asynch_BIO.cpp +++ /dev/null @@ -1,252 +0,0 @@ -// -*- C++ -*- - -#include "SSL_Asynch_BIO.h" - -#if OPENSSL_VERSION_NUMBER > 0x0090581fL && ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - -#include "SSL_Asynch_Stream.h" -#include "ace/OS_NS_string.h" - - -ACE_RCSID (ACE_SSL, - SSL_Asynch_BIO, - "$Id$") - - -#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) -# define ACE_ASYNCH_BIO_WRITE_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_write) -# define ACE_ASYNCH_BIO_READ_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_read) -# define ACE_ASYNCH_BIO_PUTS_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_puts) -# define ACE_ASYNCH_BIO_CTRL_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_ctrl) -# define ACE_ASYNCH_BIO_NEW_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_new) -# define ACE_ASYNCH_BIO_FREE_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_free) -#else -# define ACE_ASYNCH_BIO_WRITE_NAME ACE_Asynch_BIO_write -# define ACE_ASYNCH_BIO_READ_NAME ACE_Asynch_BIO_read -# define ACE_ASYNCH_BIO_PUTS_NAME ACE_Asynch_BIO_puts -# define ACE_ASYNCH_BIO_CTRL_NAME ACE_Asynch_BIO_ctrl -# define ACE_ASYNCH_BIO_NEW_NAME ACE_Asynch_BIO_new -# define ACE_ASYNCH_BIO_FREE_NAME ACE_Asynch_BIO_free -#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ - -/** - * @name OpenSSL BIO Helper Methods for use with ACE's Asynchronous - * SSL I/O support. - */ -//@{ -extern "C" -{ - int ACE_ASYNCH_BIO_WRITE_NAME (BIO *pBIO, const char *buf, int len); - int ACE_ASYNCH_BIO_READ_NAME (BIO *pBIO, char *buf, int len); - int ACE_ASYNCH_BIO_PUTS_NAME (BIO *pBIO, const char *str); - long ACE_ASYNCH_BIO_CTRL_NAME (BIO *pBIO, int cmd, long arg1, void *arg2); - int ACE_ASYNCH_BIO_NEW_NAME (BIO *pBIO); - int ACE_ASYNCH_BIO_FREE_NAME (BIO *pBIO); -} -//@} - -#define BIO_TYPE_ACE ( 21 | BIO_TYPE_SOURCE_SINK ) - -static BIO_METHOD methods_ACE = - { - BIO_TYPE_ACE, // BIO_TYPE_PROXY_SERVER, - "ACE_Asynch_BIO", - ACE_ASYNCH_BIO_WRITE_NAME, - ACE_ASYNCH_BIO_READ_NAME, - ACE_ASYNCH_BIO_PUTS_NAME, - NULL, /* ACE_ASYNCH_BIO_GETS_NAME, */ - ACE_ASYNCH_BIO_CTRL_NAME, - ACE_ASYNCH_BIO_NEW_NAME, - ACE_ASYNCH_BIO_FREE_NAME, - NULL - }; - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -BIO * -ACE_SSL_make_BIO (void * ssl_asynch_stream) -{ - BIO * const pBIO = BIO_new (&methods_ACE); - - if (pBIO) - BIO_ctrl (pBIO, - BIO_C_SET_FILE_PTR, - 0, - ssl_asynch_stream); - - return pBIO; -} - -/** - * @struct @c ACE_SSL_Asynch_Stream_Accessor - * - * @brief Privileged @c ACE_SSL_Asynch_Stream accessor. - * - * This structure is a @c friend to the @c ACE_SSL_Asynch_Stream - * class so that it can gain access to the protected - * ssl_bio_{read,write}() methods in that class. It is full declared - * in this implementation file to hide its interface from users to - * prevent potential abuse of the friend relationship between it and - * the @c ACE_SSL_Asynch_Stream class. - */ -struct ACE_SSL_Asynch_Stream_Accessor -{ - static int read (ACE_SSL_Asynch_Stream * stream, - char * buf, - size_t len, - int & errval) - { - return stream->ssl_bio_read (buf, len, errval); - } - - static int write (ACE_SSL_Asynch_Stream * stream, - const char * buf, - size_t len, - int & errval) - { - return stream->ssl_bio_write (buf, len, errval); - } -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -int -ACE_ASYNCH_BIO_NEW_NAME (BIO * pBIO) -{ - pBIO->init = 0; // not initialized - pBIO->num = 0; // still zero ( we can use it ) - pBIO->ptr = 0; // will be pointer to ACE_SSL_Asynch_Stream - pBIO->flags = 0; // - - return 1; -} - -int -ACE_ASYNCH_BIO_FREE_NAME (BIO * pBIO) -{ - if (pBIO && pBIO->shutdown) - { - pBIO->ptr = 0; - pBIO->init = 0; - pBIO->num = 0; - pBIO->flags = 0; - - return 1; - } - - return 0; -} - -int -ACE_ASYNCH_BIO_READ_NAME (BIO * pBIO, char * buf, int len) -{ - BIO_clear_retry_flags (pBIO); - - ACE_SSL_Asynch_Stream * const p_stream = - static_cast (pBIO->ptr); - - if (pBIO->init == 0 || p_stream == 0 || buf == 0 || len <= 0) - return -1; - - BIO_clear_retry_flags (pBIO); - - int errval = 0; - - int retval = - ACE_SSL_Asynch_Stream_Accessor::read (p_stream, - buf, - len, - errval); - - if (retval >= 0) - return retval; - - if (errval == EINPROGRESS) - BIO_set_retry_read (pBIO); - - return -1; -} - -int -ACE_ASYNCH_BIO_WRITE_NAME (BIO * pBIO, const char * buf, int len) -{ - BIO_clear_retry_flags (pBIO); - - ACE_SSL_Asynch_Stream * p_stream = - static_cast (pBIO->ptr); - - if (pBIO->init == 0 || p_stream == 0 || buf == 0 || len <= 0) - return -1; - - BIO_clear_retry_flags (pBIO); - - int errval = 0; - - int retval = - ACE_SSL_Asynch_Stream_Accessor::write (p_stream, - buf, - len, - errval); - - if (retval >= 0) - return retval; - - if (errval == EINPROGRESS) - BIO_set_retry_write (pBIO); - - return -1; -} - -long -ACE_ASYNCH_BIO_CTRL_NAME (BIO * pBIO, int cmd, long num, void *ptr) -{ - long ret = 1; - - switch (cmd) - { - case BIO_C_SET_FILE_PTR: - pBIO->shutdown = static_cast (num); - pBIO->ptr = ptr; - pBIO->init = 1; - break; - - case BIO_CTRL_INFO: - ret = 0; - break; - - case BIO_CTRL_GET_CLOSE: - ret = pBIO->shutdown; - break; - - case BIO_CTRL_SET_CLOSE: - pBIO->shutdown = static_cast (num); - break; - - case BIO_CTRL_PENDING: - case BIO_CTRL_WPENDING: - ret = 0; - break; - - case BIO_CTRL_DUP: - case BIO_CTRL_FLUSH: - ret = 1; - break; - - default: - ret = 0; - break; - } - - return ret; -} - -int -ACE_ASYNCH_BIO_PUTS_NAME (BIO *pBIO, const char *str) -{ - size_t const n = ACE_OS::strlen (str); - - return ACE_ASYNCH_BIO_WRITE_NAME (pBIO, str, n); -} - -#endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL && (ACE_WIN32 || - ACE_HAS_AIO_CALLS) */ diff --git a/ace/SSL/SSL_Asynch_BIO.h b/ace/SSL/SSL_Asynch_BIO.h deleted file mode 100644 index 22c6202754b..00000000000 --- a/ace/SSL/SSL_Asynch_BIO.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_Asynch_BIO.h - * - * $Id$ - * - * @author Alexander Libman - * @author Ossama Othman - * - */ -//============================================================================= - -#ifndef ACE_SSL_ASYNCH_BIO_H -#define ACE_SSL_ASYNCH_BIO_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// This must be included before any include on LynxOS -#include "ace/os_include/os_stdio.h" - -#include - -#if OPENSSL_VERSION_NUMBER > 0x0090581fL && ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -extern BIO * ACE_SSL_make_BIO (void * ssl_asynch_stream); -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL (ACE_WIN32 || - ACE_HAS_AIO_CALLS) */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_ASYNCH_BIO_H */ diff --git a/ace/SSL/SSL_Asynch_Stream.cpp b/ace/SSL/SSL_Asynch_Stream.cpp deleted file mode 100644 index ce7e9ff05ad..00000000000 --- a/ace/SSL/SSL_Asynch_Stream.cpp +++ /dev/null @@ -1,1038 +0,0 @@ -#include "SSL_Asynch_Stream.h" - -ACE_RCSID (ACE_SSL, - SSL_Asynch_Stream, - "$Id$") - -// This only works on platforms with Asynchronous IO support. -#if OPENSSL_VERSION_NUMBER > 0x0090581fL && ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - -#if defined (ACE_WIN32) -# include "ace/WIN32_Proactor.h" -#else -# include "ace/POSIX_Proactor.h" -#endif /* ACE_WIN32 */ - -#include "ace/OS_NS_string.h" -#include "ace/Proactor.h" - -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_SSL_Asynch_Write_Stream_Result::ACE_SSL_Asynch_Write_Stream_Result - (ACE_Handler & handler, - ACE_HANDLE handle, - ACE_Message_Block & message_block, - size_t bytes_to_write, - const void * act, - ACE_HANDLE event, - int priority, - int signal_number - ) - : AWS_RESULT (handler.proxy (), - handle, - message_block, - bytes_to_write, - act, - event, - priority, - signal_number - ) -{ -} - -ACE_SSL_Asynch_Read_Stream_Result::ACE_SSL_Asynch_Read_Stream_Result - (ACE_Handler & handler, - ACE_HANDLE handle, - ACE_Message_Block & message_block, - size_t bytes_to_read, - const void * act, - ACE_HANDLE event, - int priority, - int signal_number - ) - : ARS_RESULT (handler.proxy (), - handle, - message_block, - bytes_to_read, - act, - event, - priority, - signal_number - ) -{ -} - -ACE_SSL_Asynch_Result::ACE_SSL_Asynch_Result (ACE_Handler & handler) - : A_RESULT (handler.proxy (), - 0, // act, - ACE_INVALID_HANDLE, - 0, // Offset - 0, // OffsetHigh - 0, // Priority - ACE_SIGRTMIN //signal_number - ) -{ -} - -void -ACE_SSL_Asynch_Result::complete (size_t /* bytes_transferred */, - int /* success */, - const void * /* completion_key */, - u_long /* error */) -{ - this->handler_proxy_->handler ()->handle_wakeup (); -} - -// ************************************************************ -// ACE_SSL_Asynch_Stream Constructor / Destructor -// ************************************************************ -ACE_SSL_Asynch_Stream::ACE_SSL_Asynch_Stream ( - ACE_SSL_Asynch_Stream::Stream_Type s_type, - ACE_SSL_Context * context) - : type_ (s_type), - handle_ (ACE_INVALID_HANDLE), - proactor_ (0), - ext_handler_ (0), - ext_read_result_ (0), - ext_write_result_(0), - flags_ (0), - ssl_ (0), - bio_ (0), - bio_istream_ (), - bio_inp_msg_ (), - bio_inp_errno_(0), - bio_inp_flag_ (0), - bio_ostream_ (), - bio_out_msg_ (), - bio_out_errno_(0), - bio_out_flag_ (0), - mutex_ () -{ - ACE_TRACE ("ACE_SSL_Asynch_Stream::ACE_SSL_Asynch_Stream"); - // was honestly copied from ACE_SSL_SOCK_Stream :) - - ACE_SSL_Context * ctx = - (context == 0 ? ACE_SSL_Context::instance () : context); - - this->ssl_ = ::SSL_new (ctx->context ()); - - if (this->ssl_ == 0) - ACE_ERROR - ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"), - ACE_TEXT ("- cannot allocate new SSL structure") - )); - -} - -ACE_SSL_Asynch_Stream::~ACE_SSL_Asynch_Stream (void) -{ - ACE_TRACE ("ACE_SSL_Asynch_Stream::~ACE_SSL_Asynch_Stream"); - - - // It is safe to delete stream if all notifications are received, - // i.e., state is SF_DELETE_ENABLE or if proactor event loop is - // done. - if (this->flags_ & SF_STREAM_OPEN) // open - if ((this->flags_ & SF_DELETE_ENABLE) == 0) // but .. - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("ACE_SSL_Asynch_Stream::DTOR-") - ACE_TEXT("possible access violation ") - ACE_TEXT("if proactor still handles events\n"))); - - ::SSL_free (this->ssl_); - - // Was honestly copied from ACE_SSL_SOCK_Stream :) - - // @@ Question: should we reference count the Context object or - // leave that to the application developer? We do not reference - // count reactors (for example) and following some simple rules - // seems to work fine! -} - -// ************************************************************ -// close () -// returns : -// 0 - Stream is in the state SF_DELETE_ENABLE, -// so it is safe to delete stream -// -1 - Stream has pending AIO requests, -// close should be repeated later one more -// ************************************************************ - -int -ACE_SSL_Asynch_Stream::close (void) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1)); - - if ((flags_ & SF_STREAM_OPEN) == 0) // not open - flags_ |= SF_DELETE_ENABLE; - - if (flags_ & SF_DELETE_ENABLE) - return 0; - - flags_ |= SF_REQ_SHUTDOWN; - - this->do_SSL_state_machine (); - - return -1; -} - -// ************************************************************ -// Asynch_Operation interface -// cancel -// ************************************************************ -int -ACE_SSL_Asynch_Stream::cancel (void) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1)); - - if ((flags_ & SF_STREAM_OPEN) == 0) // not open - return 1; // AIO_ALLDONE - - // attempt to cancel internal, i.e. user's read/write - int rc_r_int = bio_istream_.cancel(); - int rc_w_int = bio_ostream_.cancel(); - - // attempt to cancel external, i.e. bio_ssl read/write - int rc_r_ext = notify_read (0, ERR_CANCELED); - int rc_w_ext = notify_write (0, ERR_CANCELED); - - if (rc_r_int < 0 || rc_w_int < 0 - && rc_r_ext < 0 || rc_w_ext < 0) - return -1; // at least one error - - if (rc_r_int == 1 && rc_w_int == 1 - && rc_r_ext == 1 && rc_w_ext == 1) - return 1; // AIO_ALLDONE - - if (rc_r_int == 2 || rc_w_int == 2 - && rc_r_ext == 2 || rc_w_ext == 2) - return 2; // AIO_NOT_CANCELED , at least one not canceled - - return 0; // AIO_CANCELED, at least will be one notification -} - -// ************************************************************ -// Asynch_Operation interface -// open -// ************************************************************ -int -ACE_SSL_Asynch_Stream::open (ACE_Handler & handler, - ACE_HANDLE handle, - const void * completion_key, - ACE_Proactor * proactor) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1)); - - if (this->flags_ & SF_STREAM_OPEN) - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"), - ACE_TEXT ("- already opened")), - -1); - - if (this->ssl_ == 0) - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"), - ACE_TEXT ("- SSL structure is absent")), - -1); - - if (handle == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"), - ACE_TEXT ("- invalid handle")), - -1); - - - // Get a proactor for/from the user. - this->proactor_ = this->get_proactor (proactor, handler); - this->ext_handler_ = & handler; - this->handle_ = handle; - - // Open internal input stream - if (this->bio_istream_.open (*this, // real callbacks to this - handle, - completion_key, - this->proactor_) != 0) - return -1; - - // Open internal output stream - if (this->bio_ostream_.open (*this, // real callbacks to this - handle, - completion_key, - this->proactor_) != 0) - return -1; - - this->bio_ = ACE_SSL_make_BIO (this); - - if (this->bio_ == 0) - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"), - ACE_TEXT ("- cannot allocate new BIO structure")), - -1); - - ::SSL_set_bio (this->ssl_ , this->bio_ , this->bio_); - - switch (this->type_) - { - case ST_CLIENT: - ::SSL_set_connect_state (this->ssl_); - break; - - case ST_SERVER: - ::SSL_set_accept_state (this->ssl_); - break; - - default: - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"), - ACE_TEXT ("- invalid stream type")), - -1); - } - - this->flags_ |= SF_STREAM_OPEN; - - this->do_SSL_state_machine (); - - return 0; -} - - -// ************************************************************ -// Asynch_Operation interface -// read -// ************************************************************ -int -ACE_SSL_Asynch_Stream::read (ACE_Message_Block & message_block, - size_t bytes_to_read, - const void * act, - int priority, - int signal_number) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1)); - - if ((this->flags_ & SF_STREAM_OPEN) == 0) // not open - return -1; - - if (this->flags_ & SF_REQ_SHUTDOWN) - return -1; - - // only one read operation is allowed now - // later it will be possible to make a queue - - if (this->ext_read_result_ != 0) - return -1; - - // create result for future notification - ACE_NEW_RETURN (this->ext_read_result_, - ACE_SSL_Asynch_Read_Stream_Result ( - *this->ext_handler_, - this->handle_, - message_block, - bytes_to_read, - act, - this->proactor_->get_handle(), - priority, - signal_number), - -1); - - this->do_SSL_state_machine (); // ignore return code - - return 0; -} - -// ************************************************************ -// Asynch_Operation interface -// write -// ************************************************************ -int -ACE_SSL_Asynch_Stream::write (ACE_Message_Block & message_block, - size_t bytes_to_write, - const void * act, - int priority, - int signal_number) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, -1)); - - if ((this->flags_ & SF_STREAM_OPEN) == 0) // not open - return -1; - - if (this->flags_ & SF_REQ_SHUTDOWN) - return -1; - - // only one read operation is allowed now - // later it will be possible to make a queue - - if (this->ext_write_result_ != 0) - return -1; - - // create result for future notification - ACE_NEW_RETURN (this->ext_write_result_, - ACE_SSL_Asynch_Write_Stream_Result ( - *this->ext_handler_, - this->handle_, - message_block, - bytes_to_write, - act, - this->proactor_->get_handle(), - priority, - signal_number), - -1); - - this->do_SSL_state_machine (); - - return 0; -} - -// ************************************************************ -// Main SSL engine -// ************************************************************ -int -ACE_SSL_Asynch_Stream::do_SSL_state_machine (void) -{ - // this protected member should be called - // with locked mutex_ - - int retval = this->do_SSL_handshake (); - - if (retval == 0) // handshake in progress ? - return 0; - - if (retval < 0) - this->flags_ |= SF_REQ_SHUTDOWN; - - this->do_SSL_read (); // execute user read request - this->do_SSL_write (); // execute user write request - - if ((this->flags_ & SF_REQ_SHUTDOWN) == 0) // Do we have any errors - return 0; - - this->do_SSL_shutdown (); - - this->notify_close (); - - return 0; -} - -// ************************************************************ -// do_SSL_shutdown -// return code: -// 1 SSL shutdown is finished already, success -// 0 SSL shutdown in progress -// -1 failure -// ************************************************************ -int -ACE_SSL_Asynch_Stream::do_SSL_shutdown (void) -{ - if (this->flags_ & SF_SHUTDOWN_DONE) // already done - return 1; - - this->flags_ |= SF_REQ_SHUTDOWN; - - // if we have any uncompleted user requests - // than cancel its - this->notify_read (0, ERR_CANCELED); - this->notify_write (0, ERR_CANCELED); - - int retval = ::SSL_shutdown (this->ssl_); - - int status = ::SSL_get_error (this->ssl_, retval); - - switch (status) - { - case SSL_ERROR_NONE: - case SSL_ERROR_ZERO_RETURN: - case SSL_ERROR_SYSCALL: - retval = 1; - break; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - case SSL_ERROR_WANT_CONNECT: - // case SSL_ERROR_WANT_ACCEPT: - case SSL_ERROR_WANT_X509_LOOKUP: - return 0; - - default: - this->print_error (status, - ACE_TEXT ("Shutdown error")); - retval = -1; - break; - } - - this->flags_ |= SF_SHUTDOWN_DONE; - - return retval; -} - -// ************************************************************ -// Do SSL handshake if necessary -// return code: -// 1 SSL handshake is finished already, success -// 0 SSL handshake in progress -// -1 failure -// ************************************************************ -int -ACE_SSL_Asynch_Stream::do_SSL_handshake (void) -{ - if (SSL_is_init_finished (this->ssl_)) - return 1; - - if (this->flags_ & SF_REQ_SHUTDOWN) - return -1; - - int retval = -1; - - switch (this->type_) - { - case ST_CLIENT: - retval = ::SSL_connect (this->ssl_); - break; - - case ST_SERVER: - retval = ::SSL_accept (this->ssl_); - break; - - default: - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"), - ACE_TEXT ("- invalid stream type")), - -1); - } - - int status = ::SSL_get_error (this->ssl_, retval); - - switch (status) - { - case SSL_ERROR_NONE: - break; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - case SSL_ERROR_WANT_CONNECT: - //case SSL_ERROR_WANT_ACCEPT: - case SSL_ERROR_WANT_X509_LOOKUP: - return 0; - - case SSL_ERROR_ZERO_RETURN: - case SSL_ERROR_SYSCALL: - default: - this->print_error (status, - ACE_TEXT ("Handshake error")); - return -1; - } - - return 1; -} - -// ************************************************************ -// Perform SSL_read call if necessary and notify user -// ************************************************************ -int -ACE_SSL_Asynch_Stream::do_SSL_read (void) -{ - if (this->ext_read_result_ == 0) // nothing to do - return 0; - - if (this->flags_ & SF_REQ_SHUTDOWN) - { - this->notify_read (0, ERR_CANCELED); - return -1; - } - - ACE_Message_Block & mb = this->ext_read_result_->message_block (); - size_t bytes_req = this->ext_read_result_->bytes_to_read (); - - const int bytes_trn = ::SSL_read (this->ssl_, - mb.wr_ptr (), - bytes_req); - - int status = ::SSL_get_error (this->ssl_, bytes_trn); - - switch (status) - { - case SSL_ERROR_NONE: - this->notify_read (bytes_trn, 0); - return 1; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - return 0; - - case SSL_ERROR_ZERO_RETURN: - this->notify_read (0, 0); - return 1; - - case SSL_ERROR_SYSCALL: - if (bytes_trn == 0) - { - this->notify_read (0, 0); - return 1; - } - // If not an EOF, then fall through to "default" case. - - default: - break; - } - - this->notify_read (0, EFAULT); - this->print_error (status, - ACE_TEXT ("SSL_read error")); - - return -1; -} - -// ************************************************************ -// Perform SSL_write call if necessary and notify user -// ************************************************************ -int -ACE_SSL_Asynch_Stream::do_SSL_write (void) -{ - if (this->ext_write_result_ == 0) // nothing to do - return 0; - - if (this->flags_ & SF_REQ_SHUTDOWN) - { - this->notify_write (0, ERR_CANCELED); - return -1; - } - - ACE_Message_Block & mb = this->ext_write_result_->message_block (); - size_t bytes_req = this->ext_write_result_->bytes_to_write (); - - const int bytes_trn = ::SSL_write (this->ssl_, - mb.rd_ptr (), - bytes_req); - - int status = ::SSL_get_error (this->ssl_, bytes_trn); - - switch (status) - { - case SSL_ERROR_NONE: - this->notify_write (bytes_trn, 0); - return 1; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - return 0; - - case SSL_ERROR_ZERO_RETURN: - this->notify_write (bytes_trn, 0); - return 1; - - case SSL_ERROR_SYSCALL: - default: - break; - } - - this->notify_write(0, EFAULT); - this->print_error (status, - ACE_TEXT ("SSL_write error")); - - return -1; -} - -// ************************************************************ -// notify external user handler that -// it is now to safe destroy stream -// Return code looks like cancel() return code -// 0 - notified NOTIFIED -// 1 - nothing to notify ALLDONE -// 2 - unable to notify NOT NOTIFIED -// ************************************************************ -int -ACE_SSL_Asynch_Stream::notify_close (void) -{ - if (this->flags_ & SF_CLOSE_NTF_SENT) // already sent - return 1; - - if ((this->flags_ & SF_SHUTDOWN_DONE) == 0) // only after shutdown - return 2; // too early , we will do later - - if (this->pending_BIO_count () != 0) // wait for all internal IO - return 2; // too early , we will do later - - // create result for future notification - ACE_SSL_Asynch_Result * close_result = 0; - - ACE_NEW_RETURN (close_result, - ACE_SSL_Asynch_Result (*this), - 2); - //@@ Not exception safe! - - int retval = - close_result->post_completion (this->proactor_->implementation ()); - - if (retval == 0) - { - this->flags_ |= SF_CLOSE_NTF_SENT; - return 0; - } - - delete close_result; - return 2; -} - -// ************************************************************ -// notify external user handler about user write completion -// Return code looks like cancel() return code -// 0 - notified NOTIFIED/CANCELED -// 1 - nothing to notify ALLDONE -// 2 - unable to notify NOT NOTIFIED/CANCELED -// ************************************************************ - -int -ACE_SSL_Asynch_Stream::notify_read (int bytes_transferred, - int error) -{ - if (ext_read_result_ == 0) //nothing to notify - return 1; - - this->ext_read_result_->set_bytes_transferred (bytes_transferred); - this->ext_read_result_->set_error (error); - - int retval = - this->ext_read_result_->post_completion (proactor_->implementation ()); - - if (retval == 0) - { - this->ext_read_result_ = 0; - return 0; // success - } - - return 2; // unable to notify -} - -// ************************************************************ -// notify external user handler about user write completion -// Return code looks like cancel() return code -// 0 - notified NOTIFIED/CANCELED -// 1 - nothing to notify ALLDONE -// 2 - unable to notify NOT NOTIFIED/CANCELED -// ************************************************************ - -int -ACE_SSL_Asynch_Stream::notify_write (int bytes_transferred, - int error) -{ - if (this->ext_write_result_ == 0) //nothing to notify - return 1; - - this->ext_write_result_->set_bytes_transferred (bytes_transferred); - this->ext_write_result_->set_error (error); - - int retval = - this->ext_write_result_->post_completion ( - this->proactor_->implementation ()); - - if (retval == 0) - { - this->ext_write_result_ = 0; - return 0; // success - } - - return 2; // unable to notify -} - -// ************************************************************ -// Print SSL errors -// ************************************************************ -void -ACE_SSL_Asynch_Stream::print_error (int err_ssl, - const ACE_TCHAR * pText) -{ - ACE_DEBUG ((LM_DEBUG, - "SSL-error:%d %s\n" , - err_ssl, - pText)); - -#if OPENSSL_VERSION_NUMBER >= 0x0090601fL - // OpenSSL < 0.9.6a doesn't have ERR_error_string_n() function. - unsigned long lerr = 0; - char buf[1024]; - - while ((lerr = ERR_get_error()) != 0) - { - ERR_error_string_n (lerr, buf, sizeof buf); - - ACE_DEBUG ((LM_DEBUG, "%s\n", buf)); - } -#endif /* OPENSSL_VERSION_NUMBER */ -} - -// ************************************************************ -// BIO helper functions -// SSL library will ask BIO to do raw I/O -// BIO will call us to do this -// ************************************************************ -int -ACE_SSL_Asynch_Stream::ssl_bio_read (char * buf, - size_t len, - int & errval) -{ - // We do not have to acquire mutex - // as we called already with locked mutex - // from do_SSL_state_machine() - - errval = 0; - - size_t cur_len = this->bio_inp_msg_.length (); - - if (cur_len > 0) // there are more data buffered - { - const char * rd_ptr = this->bio_inp_msg_.rd_ptr (); - - if (cur_len > len) - cur_len = len; - - ACE_OS::memcpy (buf, rd_ptr, cur_len); - - this->bio_inp_msg_.rd_ptr (cur_len); // go ahead - - return cur_len; - } - - if (this->bio_inp_errno_ != 0) // if was error - it is permanent ! - { - errval = this->bio_inp_errno_; - return -1; - } - - if (this->bio_inp_flag_ & BF_EOS) // End of stream - return 0; - - errval = EINPROGRESS; // SSL will try later - - if (this->bio_inp_flag_ & BF_AIO) // we are busy - return -1; - - if (this->bio_inp_msg_.size (len) != 0) - { - ACE_ERROR - ((LM_ERROR, - ACE_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"), - ACE_TEXT ("error in ACE_Message_Block::size() ") - )); - - errval = EINVAL; - return -1; - } - - char * base = this->bio_inp_msg_.base (); - - this->bio_inp_msg_.rd_ptr (base); - this->bio_inp_msg_.wr_ptr (base); - - if (this->bio_istream_.read ( - bio_inp_msg_, // message block - len, // priority - 0, // act - 0, // priority - ACE_SIGRTMIN // default signal - ) == -1) - { - ACE_ERROR - ((LM_ERROR, - ACE_TEXT ("%N:%l (%P|%t) ACE_SSL_Asynch_Stream %p\n"), - ACE_TEXT ("attempt read failed") - )); - - errval = EINVAL; // may be leave EINPROGRESS ?? - return -1; // to try later - } - - this->bio_inp_flag_ |= BF_AIO; // AIO is active - - return -1; -} - - -int -ACE_SSL_Asynch_Stream::ssl_bio_write (const char * buf, - size_t len, - int & errval) -{ - // We do not have to acquire mutex - // as we called already with locked mutex - // from do_SSL_state_machine - - errval = 0; - - if (this->bio_out_flag_ & BF_AIO) // sorry, we are busy - { - errval = EINPROGRESS; // try later - return -1; - } - - if (this->bio_out_errno_ != 0) // no recovery - { - errval = this->bio_out_errno_; - return -1; - } - - if (this->bio_out_msg_.size (len) != 0) - { - ACE_ERROR - ((LM_ERROR, - ACE_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"), - ACE_TEXT ("error in ACE_Message_Block::size() ") - )); - - errval = EINVAL; - return -1; - } - - char * base = this->bio_out_msg_.base (); - - this->bio_out_msg_.rd_ptr (base); - this->bio_out_msg_.wr_ptr (base); - - if (this->bio_out_msg_.copy (buf, len) == -1) - { - ACE_ERROR - ((LM_ERROR, - ACE_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"), - ACE_TEXT ("error in ACE_Message_Block::copy() ") - )); - - errval = EINVAL; - return -1; - } - - - if (this->bio_ostream_.write ( - this->bio_out_msg_, // message block - len, // priority - 0, // act - 0, // priority - ACE_SIGRTMIN // default signal - ) == -1) - { - ACE_ERROR - ((LM_ERROR, - ACE_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"), - ACE_TEXT ("attempt write failed") - )); - - errval = EINVAL; // may be leave EINPROGRESS ?? - return -1; // to try later - } - - this->bio_out_flag_ |= BF_AIO; // AIO is active - errval = 0; // Ok, go ahead - - return len; -} - -// ************************************************************ -// Internal IO handlers -// virtual from ACE_Service_Handler -// ************************************************************ -void -ACE_SSL_Asynch_Stream::handle_write_stream ( - const ACE_Asynch_Write_Stream::Result &result) -{ - ACE_MT (ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_)); - - this->bio_out_flag_ &= ~BF_AIO; - - ACE_Message_Block & mb = result.message_block (); - - size_t bytes_req = result.bytes_to_write (); - size_t bytes_trn = result.bytes_transferred (); - u_long errval = result.error (); - size_t len = bytes_req - bytes_trn; - - if (errval != 0) // error ? - this->bio_out_errno_ = errval; // save error code - else if (len > 0) // TCP/IP overloaded ? - { // continue, rd_ptr at right place - if (this->bio_ostream_.write ( - mb, // message block - len, // priority - 0, // act - 0, // priority - ACE_SIGRTMIN // default signal - ) == 0) - { - this->bio_out_flag_ |= BF_AIO; - return; - } - - ACE_ERROR - ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"), - ACE_TEXT ("attempt write failed") - )); - - this->bio_out_errno_ = EINVAL; - } - - this->do_SSL_state_machine (); - - return; -} - -void -ACE_SSL_Asynch_Stream::handle_read_stream ( - const ACE_Asynch_Read_Stream::Result &result) -{ - ACE_MT (ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_)); - - this->bio_inp_flag_ &= ~BF_AIO; - - size_t bytes_trn = result.bytes_transferred (); - u_long errval = result.error (); - - if (errval != 0) // error ? - this->bio_inp_errno_ = errval; // save error code - else if (bytes_trn == 0) // end of stream ? - this->bio_inp_flag_ |= BF_EOS; // set flag EOS - - this->do_SSL_state_machine (); - - return; -} - -void -ACE_SSL_Asynch_Stream::handle_wakeup (void) -{ - ACE_Handler * user_handler = 0; - - { - ACE_MT (ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_)); - - this->flags_ |= SF_DELETE_ENABLE; - - user_handler = this->ext_handler_; - } - - if (user_handler != 0) - user_handler->handle_wakeup(); -} - -int -ACE_SSL_Asynch_Stream::pending_BIO_count (void) -{ - int ret = 0; - - if (this->bio_inp_flag_ & BF_AIO) - ++ret; - - if (this->bio_out_flag_ & BF_AIO) - ++ret; - - return ret; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL && (ACE_WIN32 || - ACE_HAS_AIO_CALLS) */ diff --git a/ace/SSL/SSL_Asynch_Stream.h b/ace/SSL/SSL_Asynch_Stream.h deleted file mode 100644 index 671cca46c24..00000000000 --- a/ace/SSL/SSL_Asynch_Stream.h +++ /dev/null @@ -1,425 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_Asynch_Stream.h - * - * $Id$ - * - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_SSL_ASYNCH_STREAM_H -#define ACE_SSL_ASYNCH_STREAM_H - -#include /**/ "ace/pre.h" -#include "SSL_Context.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if OPENSSL_VERSION_NUMBER > 0x0090581fL && ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - -#include "SSL_Asynch_BIO.h" - -#include "ace/Asynch_IO_Impl.h" -#include "ace/Message_Block.h" -#include "ace/Synch_Traits.h" -#include "ace/Thread_Mutex.h" - -/* - * This facility doesn't follow the normal ACE asynch I/O support classes' - * interface/implementation arrangement. It's not needed because rather than - * branching off to platform-specific APIs, all platforms use the OpenSSL - * API. Thus, you can think of this class as the implementation class (for - * OpenSSL) and there's no separate interface class. - * Also, since both read and write operations are defined in one I/O - * factory, there's no single Result class defined as there is for - * ACE_Asynch_Read_Stream, et al. There are separate result classes defined - * for read and write operations. - */ - -#if defined (ACE_WIN32) -# include "ace/WIN32_Asynch_IO.h" -typedef ACE_WIN32_Asynch_Result A_RESULT; -typedef ACE_WIN32_Asynch_Read_Stream_Result ARS_RESULT; -typedef ACE_WIN32_Asynch_Write_Stream_Result AWS_RESULT; - -# define ERR_CANCELED ERROR_OPERATION_ABORTED - -#else -# include "ace/POSIX_Asynch_IO.h" -typedef ACE_POSIX_Asynch_Result A_RESULT; -typedef ACE_POSIX_Asynch_Read_Stream_Result ARS_RESULT; -typedef ACE_POSIX_Asynch_Write_Stream_Result AWS_RESULT; - -# define ERR_CANCELED ECANCELED - -#endif /* ACE_WIN32 */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_SSL_Asynch_Stream; // Forward decl for use in result class def. - -/** - * @class ACE_SSL_Asynch_Read_Stream_Result - * - * Result class that communicates result of read operations initiated on - * an ACE_SSL_Asynch_Stream object. - */ -class ACE_SSL_Asynch_Read_Stream_Result : public ARS_RESULT -{ - /// Factory class will have special permissions. - friend class ACE_SSL_Asynch_Stream; - -protected: - ACE_SSL_Asynch_Read_Stream_Result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number); -}; - -/** - * @class ACE_SSL_Asynch_Write_Stream_Result - * - * Result class that communicates result of write operations initiated on - * an ACE_SSL_Asynch_Stream object. - */ -class ACE_SSL_Asynch_Write_Stream_Result : public AWS_RESULT -{ - /// Factory class will have special permissions. - friend class ACE_SSL_Asynch_Stream; - -protected: - ACE_SSL_Asynch_Write_Stream_Result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number); -}; - - -/** - * @class ACE_SSL_Asynch_Result - * - * Result class that is used internally for socket close notifications. - */ -class ACE_SSL_Asynch_Result : public A_RESULT -{ -public: - ACE_SSL_Asynch_Result (ACE_Handler &handler); - - void complete (size_t bytes_transferred, - int success, - const void * completion_key, - u_long error); -}; - - -// Only provide forward declarations to prevent possible abuse of the -// friend declarations in ACE_SSL_Asynch_Stream. -struct ACE_SSL_Asynch_Stream_Accessor; - -/** - * @class ACE_SSL_Asynch_Stream - * - * @brief This class is a factory for initiating asynchronous reads - * and writes on an SSL stream. - * - * Once open() is called, multiple asynchronous read and write operations - * can be started using this class. The handler object (derived from - * ACE_Handler) specified in open() will receive completion events for the - * operations initiated via this class. - */ -class ACE_SSL_Export ACE_SSL_Asynch_Stream - : public ACE_Asynch_Operation, - public ACE_Handler -{ -public: - - // Use a class/struct to work around scoping - // problems for extern "C" free functions with some compilers. For - // example, some can't handle - // - // friend ::some_extern_c_free_function (...) - // - // Note that we could use a straight C++ (i.e. not extern "C") free - // function, but using a class or struct allows us to hide the - // interface from the user, which prevents abuse of this friend - // relationship. - friend struct ACE_SSL_Asynch_Stream_Accessor; - - enum Stream_Type - { - ST_CLIENT = 0x0001, - ST_SERVER = 0x0002 - }; - - /// Constructor. - /** - * @arg context Pointer to an ACE_SSL_Context instance containing - * the OpenSSL information to be associated with this - * ACE_SSL_Asynch_Stream. The needed SSL data will be - * copied before return. Therefore, this object can be - * reused, modified, or deleted upon return. If a 0 pointer - * is passed, the ACE_SSL_Context::instance() method will - * be called to get access to a singleton. - */ - ACE_SSL_Asynch_Stream (Stream_Type s_type = ST_SERVER, - ACE_SSL_Context * context = 0); - - /// Destructor - virtual ~ACE_SSL_Asynch_Stream (void); - - int cancel (void); - - int close (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. - * - * @arg handler The ACE_Handler that will be called to handle completions - * for operations initiated using this factory. - * @arg handle The handle that future read/write operations will use. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * Initiates an asynchronous read. If the operation is successfully - * initiated, the handle_read_stream() method will be called on the - * ACE_Handler object passed to open() when the operation completes. - * Data is read into the specified ACE_Message_Block beginning at its - * write pointer; the block's write pointer is updated to reflect any - * added data when the operation completes. - * - * @arg message_block The specified ACE_Message_Block will receive any - * data that is read. Data will be read into the - * block beginning at the block's write pointer. - * @arg num_bytes_to_read The maximum number of bytes to read. The actual - * amount read may be less. - * @arg act ACT which is passed to the completion handler in - * the result object. - * @arg priority Specifies the operation priority. This has an - * affect on POSIX only. Works like @i nice in Unix. - * Negative values are not allowed. 0 means priority - * of the operation same as the process priority. - * 1 means priority of the operation is one less than - * process, and so forth. This parameter has no - * affect on Win32. - * @arg signal_number The POSIX4 real-time signal number to be used - * for the operation. signal_number ranges from - * ACE_SIGRTMIN to ACE_SIGRTMAX. This argument is - * unused on non-POSIX4 systems. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int read (ACE_Message_Block &message_block, - size_t num_bytes_to_read, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /** - * Initiates an asynchronous write. If the operation is successfully - * initiated, the handle_write_stream() method will be called on the - * ACE_Handler object passed to open() when the operation completes. - * Data is taken from the specified ACE_Message_Block beginning at its - * read pointer; the block's read pointer is updated to reflect any - * data successfully sent when the operation completes. - * - * @arg message_block The specified ACE_Message_Block is the source of - * data that is written. Data will be taken from the - * block beginning at the block's read pointer. - * @arg bytes_to_write The maximum number of bytes to write. The actual - * amount written may be less. - * @arg act ACT which is passed to the completion handler in - * the result object. - * @arg priority Specifies the operation priority. This has an - * affect on POSIX only. Works like @i nice in Unix. - * Negative values are not allowed. 0 means priority - * of the operation same as the process priority. - * 1 means priority of the operation is one less than - * process, and so forth. This parameter has no - * affect on Win32. - * @arg signal_number The POSIX4 real-time signal number to be used - * for the operation. signal_number ranges from - * ACE_SIGRTMIN to ACE_SIGRTMAX. This argument is - * unused on non-POSIX4 systems. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -protected: - /// Virtual from ACE_Asynch_Operation. Since this class is essentially an - /// implementation class, simply return 0. - virtual ACE_Asynch_Operation_Impl *implementation (void) const { return 0; } - - /// virtual from ACE_Handler - - /// This method is called when BIO write request is completed. It - /// processes the IO completion and calls do_SSL_state_machine(). - virtual void handle_write_stream - (const ACE_Asynch_Write_Stream::Result &result); - - /// This method is called when BIO read request is completed. It - /// processes the IO completion and calls do_SSL_state_machine(). - virtual void handle_read_stream - (const ACE_Asynch_Read_Stream::Result &result); - - /// This method is called when all SSL sessions are closed and no - /// more pending AIOs exist. It also calls users handle_wakeup(). - virtual void handle_wakeup (void); - - /** - * @name SSL State Machine - */ - //@{ - int do_SSL_state_machine (void); - int do_SSL_handshake (void); - int do_SSL_read (void); - int do_SSL_write(void); - int do_SSL_shutdown(void); - //@} - - void print_error (int err_ssl, - const ACE_TCHAR *pText); - - int pending_BIO_count (void); - - /// This method is called to notify user handler when user's read in - /// done. - int notify_read (int bytes_transferred, int error); - - /// This method is called to notify user handler when user's write - /// in done. - int notify_write (int bytes_transferred, int error); - - /// This method is called to notify ourself that SSL session is - /// shutdown and that there is no more I/O activity now and in the - /// future. - int notify_close(void); - - /** - * @name BIO Helpers - */ - //@{ - int ssl_bio_read (char * buf, size_t len, int & errval); - int ssl_bio_write (const char * buf, size_t len, int & errval); - //@} - -private: - - // Preventing copying through construction or assignment. - ACE_SSL_Asynch_Stream (ACE_SSL_Asynch_Stream const &); - ACE_SSL_Asynch_Stream & operator= (ACE_SSL_Asynch_Stream const &); - -protected: - - /// Stream Type ST_CLIENT/ST_SERVER - Stream_Type type_; - - /// The real file/socket handle - ACE_HANDLE handle_; - - /// The proactor - ACE_Proactor * proactor_; - - /// External,i.e user handler - ACE_Handler * ext_handler_; - - /// External, i.e. read result faked for user - ACE_SSL_Asynch_Read_Stream_Result * ext_read_result_ ; - - /// External, i.e. write result faked for user - ACE_SSL_Asynch_Write_Stream_Result * ext_write_result_ ; - - /// Stream state/flags - enum Stream_Flag - { - /// istream_ open OK - SF_STREAM_OPEN = 0x0001, - /// request to SSL shutdown - SF_REQ_SHUTDOWN = 0x0002, - /// SSL shutdown finished - SF_SHUTDOWN_DONE = 0x0004, - /// Close notification sent - SF_CLOSE_NTF_SENT = 0x0008, - /// Stream can be safely destroyed - SF_DELETE_ENABLE = 0x0010 - }; - - int flags_; - - /// The SSL session. - SSL * ssl_; - - /// The BIO implementation - BIO * bio_; - - /// The real streams which work under the ssl connection. - /// BIO performs I/O via this streams - enum BIO_Flag // internal IO flags - { - /// End of stream - BF_EOS = 0x01, - /// Real AIO in progress - BF_AIO = 0x02 - }; - - /** - * @name Internal stream, buffer and info for BIO read - */ - //@{ - ACE_Asynch_Read_Stream bio_istream_; - ACE_Message_Block bio_inp_msg_; - int bio_inp_errno_; - int bio_inp_flag_; - //@} - - /** - * @name Internal stream, buffer and info for BIO write - */ - //@{ - ACE_Asynch_Write_Stream bio_ostream_; - ACE_Message_Block bio_out_msg_; - int bio_out_errno_; - int bio_out_flag_; - //@} - - /// Mutex to protect work - ACE_SYNCH_MUTEX mutex_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL && (ACE_WIN32 || - ACE_HAS_AIO_CALLS) */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_ASYNCH_STREAM_H */ diff --git a/ace/SSL/SSL_Context.cpp b/ace/SSL/SSL_Context.cpp deleted file mode 100644 index 18dd760e110..00000000000 --- a/ace/SSL/SSL_Context.cpp +++ /dev/null @@ -1,612 +0,0 @@ -#include "SSL_Context.h" - -#include "sslconf.h" - -#if !defined(__ACE_INLINE__) -#include "SSL_Context.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Guard_T.h" -#include "ace/Object_Manager.h" -#include "ace/Log_Msg.h" -#include "ace/Singleton.h" -#include "ace/Synch_Traits.h" -#include "ace/ACE.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_string.h" - -#ifdef ACE_HAS_THREADS -# include "ace/Thread_Mutex.h" -# include "ace/OS_NS_Thread.h" -#endif /* ACE_HAS_THREADS */ - -#include -#include -#include -#include - -ACE_RCSID (ACE_SSL, - SSL_Context, - "$Id$") - - -namespace -{ - /// Reference count of the number of times the ACE_SSL_Context was - /// initialized. - int ssl_library_init_count = 0; - - // @@ This should also be done with a singleton, otherwise it is not - // thread safe and/or portable to some weird platforms... - -#ifdef ACE_HAS_THREADS - /// Array of mutexes used internally by OpenSSL when the SSL - /// application is multithreaded. - ACE_SSL_Context::lock_type * ssl_locks = 0; - - // @@ This should also be managed by a singleton. -#endif -} - -#ifdef ACE_HAS_THREADS - -# if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) -# define ACE_SSL_LOCKING_CALLBACK_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_SSL_locking_callback) -# define ACE_SSL_THREAD_ID_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_SSL_thread_id) -# else -# define ACE_SSL_LOCKING_CALLBACK_NAME ACE_SSL_locking_callback -# define ACE_SSL_THREAD_ID_NAME ACE_SSL_thread_id -# endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ - - - -extern "C" -{ - void - ACE_SSL_LOCKING_CALLBACK_NAME (int mode, - int type, - const char * /* file */, - int /* line */) - { - // #ifdef undef - // fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", - // CRYPTO_thread_id(), - // (mode&CRYPTO_LOCK)?"l":"u", - // (type&CRYPTO_READ)?"r":"w",file,line); - // #endif - // /* - // if (CRYPTO_LOCK_SSL_CERT == type) - // fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", - // CRYPTO_thread_id(), - // mode,file,line); - // */ - if (mode & CRYPTO_LOCK) - (void) ssl_locks[type].acquire (); - else - (void) ssl_locks[type].release (); - } - - // ------------------------------- - - // Return the current thread ID. OpenSSL uses this on platforms - // that need it. - unsigned long - ACE_SSL_THREAD_ID_NAME (void) - { - return (unsigned long) ACE_VERSIONED_NAMESPACE_NAME::ACE_OS::thr_self (); - } -} -#endif /* ACE_HAS_THREADS */ - - -// **************************************************************** - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#ifdef ACE_HAS_THREADS -ACE_SSL_Context::lock_type * ACE_SSL_Context::locks_ = 0; -#endif /* ACE_HAS_THREADS */ - -ACE_SSL_Context::ACE_SSL_Context (void) - : context_ (0), - mode_ (-1), - default_verify_mode_ (SSL_VERIFY_NONE), - have_ca_ (0) -{ - ACE_SSL_Context::ssl_library_init (); -} - -ACE_SSL_Context::~ACE_SSL_Context (void) -{ - if (this->context_) - { - ::SSL_CTX_free (this->context_); - this->context_ = 0; - } - - ACE_SSL_Context::ssl_library_fini (); -} - -ACE_SSL_Context * -ACE_SSL_Context::instance (void) -{ - return ACE_Singleton::instance (); -} - -void -ACE_SSL_Context::ssl_library_init (void) -{ - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, - ace_ssl_mon, - *ACE_Static_Object_Lock::instance ())); - - if (ssl_library_init_count == 0) - { - // Initialize the locking callbacks before initializing anything - // else. -#ifdef ACE_HAS_THREADS - int const num_locks = ::CRYPTO_num_locks (); - - this->locks_ = new lock_type[num_locks]; - ssl_locks = this->locks_; - -# if !defined (WIN32) - // This call isn't necessary on some platforms. See the CRYPTO - // library's threads(3) man page for details. - ::CRYPTO_set_id_callback (ACE_SSL_THREAD_ID_NAME); -# endif /* !WIN32 */ - ::CRYPTO_set_locking_callback (ACE_SSL_LOCKING_CALLBACK_NAME); -#endif /* ACE_HAS_THREADS */ - - ::SSLeay_add_ssl_algorithms (); - ::SSL_load_error_strings (); - - // Seed the random number generator. Note that the random - // number generator can be seeded more than once to "stir" its - // state. - -#ifdef WIN32 - // Seed the random number generator by sampling the screen. - ::RAND_screen (); -#endif /* WIN32 */ - -#if OPENSSL_VERSION_NUMBER >= 0x00905100L - // OpenSSL < 0.9.5 doesn't have EGD support. - - const char *egd_socket_file = - ACE_OS::getenv (ACE_SSL_EGD_FILE_ENV); - - if (egd_socket_file != 0) - (void) this->egd_file (egd_socket_file); -#endif /* OPENSSL_VERSION_NUMBER */ - - const char *rand_file = - ACE_OS::getenv (ACE_SSL_RAND_FILE_ENV); - - if (rand_file != 0) - (void) this->seed_file (rand_file); - - // Initialize the mutexes that will be used by the SSL and - // crypto library. - - } - - ++ssl_library_init_count; -} - -void -ACE_SSL_Context::ssl_library_fini (void) -{ - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, - ace_ssl_mon, - *ACE_Static_Object_Lock::instance ())); - - --ssl_library_init_count; - if (ssl_library_init_count == 0) - { - ::ERR_free_strings (); - ::EVP_cleanup (); - - // Clean up the locking callbacks after everything else has been - // cleaned up. -#ifdef ACE_HAS_THREADS - ::CRYPTO_set_locking_callback (0); - ssl_locks = 0; - - delete [] this->locks_; - this->locks_ = 0; - -#endif /* ACE_HAS_THREADS */ - } -} - -int -ACE_SSL_Context::set_mode (int mode) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, - ace_ssl_mon, - *ACE_Static_Object_Lock::instance (), - -1)); - - if (this->context_ != 0) - return -1; - - SSL_METHOD *method = 0; - - switch (mode) - { - case ACE_SSL_Context::SSLv2_client: - method = ::SSLv2_client_method (); - break; - case ACE_SSL_Context::SSLv2_server: - method = ::SSLv2_server_method (); - break; - case ACE_SSL_Context::SSLv2: - method = ::SSLv2_method (); - break; - case ACE_SSL_Context::SSLv3_client: - method = ::SSLv3_client_method (); - break; - case ACE_SSL_Context::SSLv3_server: - method = ::SSLv3_server_method (); - break; - case ACE_SSL_Context::SSLv3: - method = ::SSLv3_method (); - break; - case ACE_SSL_Context::SSLv23_client: - method = ::SSLv23_client_method (); - break; - case ACE_SSL_Context::SSLv23_server: - method = ::SSLv23_server_method (); - break; - case ACE_SSL_Context::SSLv23: - method = ::SSLv23_method (); - break; - case ACE_SSL_Context::TLSv1_client: - method = ::TLSv1_client_method (); - break; - case ACE_SSL_Context::TLSv1_server: - method = ::TLSv1_server_method (); - break; - case ACE_SSL_Context::TLSv1: - method = ::TLSv1_method (); - break; - default: - method = ::SSLv3_method (); - break; - } - - this->context_ = ::SSL_CTX_new (method); - if (this->context_ == 0) - return -1; - - this->mode_ = mode; - - // Load the trusted certificate authority (default) certificate - // locations. But do not return -1 on error, doing so confuses CTX - // allocation (severe error) with the less important loading of CA - // certificate location error. If it is important for your - // application then call ACE_SSL_Context::have_trusted_ca(), - // immediately following this call to set_mode(). - (void) this->load_trusted_ca (); - - return 0; -} - -int -ACE_SSL_Context::load_trusted_ca (const char* ca_file, - const char* ca_dir, - bool use_env_defaults) -{ - this->check_context (); - - if (ca_file == 0 && use_env_defaults) - { - // Use the default environment settings. - ca_file = ACE_OS::getenv (ACE_SSL_CERT_FILE_ENV); - if (ca_file == 0) - ca_file = ACE_DEFAULT_SSL_CERT_FILE; - } - - if (ca_dir == 0 && use_env_defaults) - { - // Use the default environment settings. - ca_dir = ACE_OS::getenv (ACE_SSL_CERT_DIR_ENV); - if (ca_dir == 0) - ca_dir = ACE_DEFAULT_SSL_CERT_DIR; - } - - // NOTE: SSL_CTX_load_verify_locations() returns 0 on error. - if (::SSL_CTX_load_verify_locations (this->context_, - ca_file, - ca_dir) <= 0) - { - if (ACE::debug ()) - ACE_SSL_Context::report_error (); - return -1; - } - - ++this->have_ca_; - - // For TLS/SSL servers scan all certificates in ca_file and ca_dir and - // list them as acceptable CAs when requesting a client certificate. - if (mode_ == SSLv23 - || mode_ == SSLv23_server - || mode_ == TLSv1 - || mode_ == TLSv1_server - || mode_ == SSLv3 - || mode_ == SSLv3_server - || mode_ == SSLv2 - || mode_ == SSLv2_server) - { - // Note: The STACK_OF(X509_NAME) pointer is a copy of the pointer in - // the CTX; any changes to it by way of these function calls will - // change the CTX directly. - STACK_OF (X509_NAME) * cert_names; - cert_names = ::SSL_CTX_get_client_CA_list (this->context_); - bool error = false; - - // Add CAs from both the file and dir, if specified. There should - // already be a STACK_OF(X509_NAME) in the CTX, but if not, we create - // one. - if (ca_file) - { - if (cert_names == 0) - { - if ((cert_names = ::SSL_load_client_CA_file (ca_file)) != 0) - ::SSL_CTX_set_client_CA_list (this->context_, cert_names); - else - error = true; - } - else - { - // Add new certificate names to the list. - error = (0 == ::SSL_add_file_cert_subjects_to_stack (cert_names, - ca_file)); - } - - if (error) - { - if (ACE::debug ()) - ACE_SSL_Context::report_error (); - return -1; - } - } - - // SSL_add_dir_cert_subjects_to_stack is defined at 0.9.8a (but not - // on OpenVMS or Mac Classic); it may be available earlier. Change - // this comparison if so. -#if defined (OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x0090801fL) -# if !defined (OPENSSL_SYS_VMS) && !defined (OPENSSL_SYS_MACINTOSH_CLASSIC) - - if (ca_dir != 0) - { - if (cert_names == 0) - { - if ((cert_names = sk_X509_NAME_new_null ()) == 0) - { - if (ACE::debug ()) - ACE_SSL_Context::report_error (); - return -1; - } - ::SSL_CTX_set_client_CA_list (this->context_, cert_names); - } - if (0 == ::SSL_add_dir_cert_subjects_to_stack (cert_names, ca_dir)) - { - if (ACE::debug ()) - ACE_SSL_Context::report_error (); - return -1; - } - } -# endif /* !OPENSSL_SYS_VMS && !OPENSSL_SYS_MACINTOSH_CLASSIC */ -#endif /* OPENSSL_VERSION_NUMBER >= 0.9.8a release */ - - } - - return 0; -} - - -int -ACE_SSL_Context::private_key (const char *file_name, - int type) -{ - if (this->private_key_.type () != -1) - return 0; - - this->check_context (); - - this->private_key_ = ACE_SSL_Data_File (file_name, type); - - if (::SSL_CTX_use_PrivateKey_file (this->context_, - this->private_key_.file_name (), - this->private_key_.type ()) <= 0) - { - this->private_key_ = ACE_SSL_Data_File (); - return -1; - } - else - return this->verify_private_key (); -} - -int -ACE_SSL_Context::verify_private_key (void) -{ - this->check_context (); - - return (::SSL_CTX_check_private_key (this->context_) <= 0 ? -1 : 0); -} - -int -ACE_SSL_Context::certificate (const char *file_name, - int type) -{ - if (this->certificate_.type () != -1) - return 0; - - this->certificate_ = ACE_SSL_Data_File (file_name, type); - - this->check_context (); - - if (::SSL_CTX_use_certificate_file (this->context_, - this->certificate_.file_name (), - this->certificate_.type ()) <= 0) - { - this->certificate_ = ACE_SSL_Data_File (); - return -1; - } - else - return 0; -} - -void -ACE_SSL_Context::set_verify_peer (int strict, int once, int depth) -{ - this->check_context (); - - // Setup the peer verififcation mode. - - int verify_mode = SSL_VERIFY_PEER; - if (once) - verify_mode |= SSL_VERIFY_CLIENT_ONCE; - if (strict) - verify_mode |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT; - - // set the default verify mode - this->default_verify_mode (verify_mode); - - // Set the max certificate depth but later let the verify_callback - // catch the depth error by adding one to the required depth. - if (depth > 0) - ::SSL_CTX_set_verify_depth (this->context_, depth + 1); -} - - -int -ACE_SSL_Context::random_seed (const char * seed) -{ - ::RAND_seed (seed, ACE_OS::strlen (seed)); - -#if OPENSSL_VERSION_NUMBER >= 0x00905100L - // RAND_status() returns 1 if the PRNG has enough entropy. - return (::RAND_status () == 1 ? 0 : -1); -#else - return 0; // Ugly, but OpenSSL <= 0.9.4 doesn't have RAND_status(). -#endif /* OPENSSL_VERSION_NUMBER >= 0x00905100L */ -} - -int -ACE_SSL_Context::egd_file (const char * socket_file) -{ -#if OPENSSL_VERSION_NUMBER < 0x00905100L - // OpenSSL < 0.9.5 doesn't have EGD support. - ACE_UNUSED_ARG (socket_file); - ACE_NOTSUP_RETURN (-1); -#else - // RAND_egd() returns the amount of entropy used to seed the random - // number generator. The actual value should be greater than 16, - // i.e. 128 bits. - if (::RAND_egd (socket_file) > 0) - return 0; - else - return -1; -#endif /* OPENSSL_VERSION_NUMBER >= 0x00905100L */ -} - -int -ACE_SSL_Context::seed_file (const char * seed_file, long bytes) -{ - // RAND_load_file() returns the number of bytes used to seed the - // random number generator. If the file reads ok, check RAND_status to - // see if it got enough entropy. - if (::RAND_load_file (seed_file, bytes) > 0) -#if OPENSSL_VERSION_NUMBER >= 0x00905100L - // RAND_status() returns 1 if the PRNG has enough entropy. - return (::RAND_status () == 1 ? 0 : -1); -#else - return 0; // Ugly, but OpenSSL <= 0.9.4 doesn't have RAND_status(). -#endif /* OPENSSL_VERSION_NUMBER >= 0x00905100L */ - else - return -1; -} - -void -ACE_SSL_Context::report_error (unsigned long error_code) -{ - if (error_code == 0) - return; - - char error_string[256]; - - (void) ::ERR_error_string (error_code, error_string); - - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_SSL (%P|%t) error code: %u - %C\n"), - error_code, - error_string)); -} - -void -ACE_SSL_Context::report_error (void) -{ - unsigned long error = ::ERR_get_error (); - ACE_SSL_Context::report_error (error); - ACE_OS::last_error (error); -} - -int -ACE_SSL_Context::dh_params (const char *file_name, - int type) -{ - if (this->dh_params_.type () != -1) - return 0; - - // For now we only support PEM encodings - if (type != SSL_FILETYPE_PEM) - return -1; - - this->dh_params_ = ACE_SSL_Data_File (file_name, type); - - this->check_context (); - - { - // Swiped from Rescorla's examples and the OpenSSL s_server.c app - DH * ret=0; - BIO * bio = 0; - - if ((bio = ::BIO_new_file (this->dh_params_.file_name (), "r")) == NULL) - { - this->dh_params_ = ACE_SSL_Data_File (); - return -1; - } - - ret = PEM_read_bio_DHparams (bio, NULL, NULL, NULL); - BIO_free (bio); - - if (ret == 0) - { - this->dh_params_ = ACE_SSL_Data_File (); - return -1; - } - - if (::SSL_CTX_set_tmp_dh (this->context_, ret) < 0) - { - this->dh_params_ = ACE_SSL_Data_File (); - return -1; - } - DH_free (ret); - } - - return 0; -} - -// **************************************************************** - -#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) - -template ACE_Singleton * - ACE_Singleton::singleton_; - -#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_Context.h b/ace/SSL/SSL_Context.h deleted file mode 100644 index 338fc679dd1..00000000000 --- a/ace/SSL/SSL_Context.h +++ /dev/null @@ -1,387 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_Context.h - * - * $Id$ - * - * @author Carlos O'Ryan - * @author Ossama Othman - */ -//============================================================================= - - -#ifndef ACE_SSL_CONTEXT_H -#define ACE_SSL_CONTEXT_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SString.h" - -#ifdef ACE_HAS_THREADS -# include "ace/Synch_Traits.h" -#endif /* ACE_HAS_THREADS */ - -#include - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_SSL_Export ACE_SSL_Data_File -{ -public: - - /// Default constructor - ACE_SSL_Data_File (void); - - /// Contructor from a file name and the file type. - ACE_SSL_Data_File (const char *file_name, - int type = SSL_FILETYPE_PEM); - - /// The file name - const char *file_name (void) const; - - /// The type - int type (void) const; - -private: - - /// The file name - ACE_CString file_name_; - - /// The type, used by the SSL library to parse the file contents. - int type_; -}; - -// **************************************************************** - - -/** - * @class ACE_SSL_Context - * - * @brief A wrapper for the OpenSSL SSL_CTX related functions. - * - * This class provides a wrapper for the SSL_CTX data structure. - * Since most applications have a single SSL_CTX structure, this class - * can be used as a singleton. - */ -class ACE_SSL_Export ACE_SSL_Context -{ -public: - -#ifdef ACE_HAS_THREADS - typedef ACE_SYNCH_MUTEX lock_type; -#endif /* ACE_HAS_THREADS */ - - enum { - INVALID_METHOD = -1, - SSLv2_client = 1, - SSLv2_server, - SSLv2, - SSLv3_client, - SSLv3_server, - SSLv3, - SSLv23_client, - SSLv23_server, - SSLv23, - TLSv1_client, - TLSv1_server, - TLSv1 - }; - - /// Constructor - ACE_SSL_Context (void); - - /// Destructor - ~ACE_SSL_Context (void); - - /// The Singleton context, the SSL components use the singleton if - /// nothing else is available. - static ACE_SSL_Context *instance (void); - - /** - * Set the CTX mode. The mode can be set only once, afterwards the - * function has no effect and returns -1. - * Once the mode is set the underlying SSL_CTX is initialized and - * the class can be used. - * If the mode is not set, then the class automatically initializes - * itself to the default mode. - */ - int set_mode (int mode = ACE_SSL_Context::SSLv23); - - int get_mode (void) const; - - /// Get the SSL context - SSL_CTX *context (void); - - /// Get the file name and file format used for the private key - int private_key_type (void) const; - const char *private_key_file_name (void) const; - - /// Set the private key file. - /** - * @note This method should only be called after a certificate has - * been set since key verification is performed against the - * certificate, among other things. - */ - int private_key (const char *file_name, - int type = SSL_FILETYPE_PEM); - - /// Verify that the private key is valid. - /** - * @note This method should only be called after a certificate has - * been set since key verification is performed against the - * certificate, among other things. - */ - int verify_private_key (void); - - /// Get the file name and file format used for the certificate file - int certificate_type (void) const; - const char *certificate_file_name (void) const; - - /// Set the certificate file. - int certificate (const char *file_name, - int type = SSL_FILETYPE_PEM); - - - /** - * Load the location of the trusted certification authority - * certificates. Note that CA certificates are stored in PEM format - * as a sequence of certificates in @a ca_file or as a set of - * individual certificates in @a ca_dir (or both). - * - * Note this method is called by set_mode() to load the default - * environment settings for @a ca_file and @a ca_dir, if any. This - * allows for automatic service configuration (and backward - * compatibility with previous versions). - * - * Note that the underlying SSL function will add valid file and - * directory names to the load location lists maintained as part of - * the SSL_CTX table. It therefore doesn't make sense to keep a - * copy of the file and path name of the most recently added - * @a ca_file or @a ca_path. - * - * @param[in] ca_file CA file pathname. Passed to - * @c SSL_CTX_load_verify_locations() if not - * 0. If 0, behavior depends on the value of - * @a use_env_defaults. - * @param[in] ca_dir CA directory pathname. Passed to - * @c SSL_CTX_load_verify_locations() if not - * 0. If 0, behavior depends on the value of - * @a use_env_defaults. - * @param[in] use_env_defaults If false, the specified @a ca_file argument - * is passed to - * @c SSL_CTX_load_verify_locations(), - * regardless of its value. - * If true (the default), additional defaults - * can be applied to either @a ca_file, - * @a ca_dir, or both. The following - * additional defaults are applied when the - * @a ca_file argument is 0: - * - The @c SSL_CERT_FILE environment variable - * will be queried for a file name to use as - * the @a ca_file argument. The environment - * variable name to query can be changed by - * supplying a @c ACE_SSL_CERT_FILE_ENV - * configuration item when building ACE. - * - If there is no @c SSL_CERT_FILE in the - * current environment, the file specified - * by the @c ACE_DEFAULT_SSL_CERT_FILE ACE - * configuration item will be used. The - * default value is "cert.pem" on Windows - * and "/etc/ssl/cert.pem" on all other - * platforms. - * The following additional defaults are - * applied when the @a ca_dir argument is 0: - * - The @c SSL_CERT_DIR environment variable - * will be queried for a file name to use as - * the @a ca_dir argument. The environment - * variable name to query can be changed by - * supplying a @c ACE_SSL_CERT_DIR_ENV - * configuration item when building ACE. - * - If there is no @c SSL_CERT_DIR in the - * current environment, the directory - * specified by the @c - * ACE_DEFAULT_SSL_CERT_DIR ACE - * configuration item will be used. The - * default value is "certs" on Windows - * and "/etc/ssl/certs" on all other - * platforms. - * - * @return 0 for success or -1 on error. - * - * @see OpenSSL manual SSL_CTX_load_verify_locations(3) for a - * detailed description of the CA file and directory requirements - * and processing. - */ - int load_trusted_ca (const char* ca_file = 0, - const char* ca_dir = 0, - bool use_env_defaults = true); - - /** - * Test whether any CA locations have been successfully loaded and - * return the number of successful attempts. - * - * @retval >0 The number of successful CA load attempts. - * @retval 0 If all CA load attempts have failed. - */ - int have_trusted_ca (void) const; - - - /** - * @todo Complete this documentation where elipses(...) are used - * - * @doc Use this method when certificate chain verification is - * required. The default server behaviour is SSL_VERIFY_NONE - * i.e. client certicates are requested for verified. This method - * can be used to configure server to request client certificates - * and perform the certificate verification. If is set - * true the client connection is rejected when certificate - * verification fails. Otherwise the session is accepted with a - * warning, which is the default behaviour. If is set true - * (default), certificates are requested only once per session. - * The last parameter can be used to set the verification - * depth. - * - * Note for verification to work correctly there should be a valid - * CA name list set using load_trusted_ca(). - * - * @see OpenSSL documentation of SSL_CTX_set_verify(3) for details of - * the verification process. - * - * @see OpenSSL documentation ... set_verify_depth(3) ... - * - * Note that this method overrides the use of the - * default_verify_mode() method. - */ - void set_verify_peer (int strict = 0, - int once = 1, - int depth = 0); - - - /// TODO: a implementation that will lookup the CTX table for the list - /// of files and paths etc. - /// Query the location of trusted certification authority - /// certificates. - // const char* ca_file_name(void) const; - // const char* ca_dir_name(void) const; - - - - /** - * Set and query the default verify mode for this context, it is - * inherited by all the ACE_SSL objects created using the context. - * It can be overriden on a per-ACE_SSL object. - */ - void default_verify_mode (int mode); - int default_verify_mode (void) const; - - /** - * @name OpenSSL Random Number Generator Seed Related Methods - * - * These are methods that can be used to seed OpenSSL's - * pseudo-random number generator. These methods can be called more - * than once. - */ - //@{ - /// Seed the underlying random number generator. This value should - /// have at least 128 bits of entropy. - static int random_seed (const char * seed); - - /// Set the Entropy Gathering Daemon (EGD) UNIX domain socket file to - /// read random seed values from. - static int egd_file (const char * socket_file); - - /** - * Set the file that contains the random seed value state, and the - * amount of bytes to read. "-1" bytes causes the entire file to be - * read. - */ - static int seed_file (const char * seed_file, long bytes = -1); - //@} - - /// Print SSL error corresponding to the given error code. - static void report_error (unsigned long error_code); - - /// Print the last SSL error for the current thread. - static void report_error (void); - - /** - * @name Diffie-Hellman (DH) Parameters - * - * When using DSS-based certificates, Diffie-Hellman keys need to be - * exchanged. These must be provided in the form of DH key - * generation parameters loaded in, or as fixed keys hardcoded into - * the code itself. ACE_SSL supports loaded parameters. - * - */ - //@{ - /** - * Load Diffie-Hellman parameters from file_name. The specified file can be - * a standalone file containing only DH parameters (e.g., as created - * by openssl dhparam), or it can be a certificate which has - * a PEM-encoded set of DH params concatenated on to i. - */ - int dh_params (const char *file_name, int type = SSL_FILETYPE_PEM); - const char *dh_params_file_name () const; - int dh_params_file_type () const; - //@} - -private: - - /// Verify if the context has been initialized or not. - void check_context (void); - - /// @@ More to document - void ssl_library_init (); - void ssl_library_fini (); - - // = Prevent assignment and copy initialization. - //@{ - ACE_SSL_Context (const ACE_SSL_Context &); - ACE_SSL_Context & operator= (const ACE_SSL_Context &); - //@} - -private: - - /// The SSL_CTX structure - SSL_CTX *context_; - - /// Cache the mode so we can answer fast - int mode_; - - /// The private key, certificate, and Diffie-Hellman paramters files - ACE_SSL_Data_File private_key_; - ACE_SSL_Data_File certificate_; - ACE_SSL_Data_File dh_params_; - - /// The default verify mode. - int default_verify_mode_; - - /// count of successful CA load attempts - int have_ca_; - -#ifdef ACE_HAS_THREADS - /// Array of mutexes used internally by OpenSSL when the SSL - /// application is multithreaded. - static lock_type * locks_; -#endif /* ACE_HAS_THREADS */ - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "SSL_Context.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_CONTEXT_H */ diff --git a/ace/SSL/SSL_Context.inl b/ace/SSL/SSL_Context.inl deleted file mode 100644 index 295a0fab8b2..00000000000 --- a/ace/SSL/SSL_Context.inl +++ /dev/null @@ -1,112 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SSL_Data_File::ACE_SSL_Data_File (void) - : type_ (-1) -{ -} - -ACE_INLINE -ACE_SSL_Data_File::ACE_SSL_Data_File (const char *file_name, - int type) - : file_name_ (file_name), - type_ (type) -{ -} - -ACE_INLINE const char * -ACE_SSL_Data_File::file_name (void) const -{ - return this->file_name_.c_str (); -} - -ACE_INLINE int -ACE_SSL_Data_File::type (void) const -{ - return this->type_; -} - -// **************************************************************** - -ACE_INLINE void -ACE_SSL_Context::check_context (void) -{ - if (this->context_ == 0) - { - this->set_mode (); - ::SSL_CTX_set_verify (this->context_, this->default_verify_mode (), 0); - } -} - -ACE_INLINE SSL_CTX * -ACE_SSL_Context::context (void) -{ - this->check_context (); - return this->context_; -} - -ACE_INLINE int -ACE_SSL_Context::private_key_type (void) const -{ - return this->private_key_.type (); -} - -ACE_INLINE const char* -ACE_SSL_Context::private_key_file_name (void) const -{ - return this->private_key_.file_name (); -} - -ACE_INLINE int -ACE_SSL_Context::certificate_type (void) const -{ - return this->certificate_.type (); -} - -ACE_INLINE const char* -ACE_SSL_Context::certificate_file_name (void) const -{ - return this->certificate_.file_name (); -} - -ACE_INLINE int -ACE_SSL_Context::dh_params_file_type (void) const -{ - return this->dh_params_.type (); -} - -ACE_INLINE const char* -ACE_SSL_Context::dh_params_file_name (void) const -{ - return this->dh_params_.file_name (); -} - -ACE_INLINE void -ACE_SSL_Context::default_verify_mode (int mode) -{ - this->default_verify_mode_ = mode; -} - -ACE_INLINE int -ACE_SSL_Context::default_verify_mode (void) const -{ - return this->default_verify_mode_; -} - -ACE_INLINE int -ACE_SSL_Context::get_mode (void) const -{ - return this->mode_; -} - -ACE_INLINE int -ACE_SSL_Context::have_trusted_ca (void) const -{ - return this->have_ca_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_Export.h b/ace/SSL/SSL_Export.h deleted file mode 100644 index ec478095d18..00000000000 --- a/ace/SSL/SSL_Export.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by -// generate_export_file.pl -// ------------------------------ -#if !defined (ACE_SSL_EXPORT_H) -#define ACE_SSL_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_SSL_HAS_DLL) -# define ACE_SSL_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_SSL_HAS_DLL */ - -#if !defined (ACE_SSL_HAS_DLL) -#define ACE_SSL_HAS_DLL 1 -#endif /* ! ACE_SSL_HAS_DLL */ - -#if defined (ACE_SSL_HAS_DLL) -# if (ACE_SSL_HAS_DLL == 1) -# if defined (ACE_SSL_BUILD_DLL) -# define ACE_SSL_Export ACE_Proper_Export_Flag -# define ACE_SSL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_SSL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else -# define ACE_SSL_Export ACE_Proper_Import_Flag -# define ACE_SSL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_SSL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_SSL_BUILD_DLL */ -# else -# define ACE_SSL_Export -# define ACE_SSL_SINGLETON_DECLARATION(T) -# define ACE_SSL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ! ACE_SSL_HAS_DLL == 1 */ -#else -# define ACE_SSL_Export -# define ACE_SSL_SINGLETON_DECLARATION(T) -# define ACE_SSL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_SSL_HAS_DLL */ - -#endif /* ACE_SSL_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/SSL/SSL_SOCK.cpp b/ace/SSL/SSL_SOCK.cpp deleted file mode 100644 index c6f1af15388..00000000000 --- a/ace/SSL/SSL_SOCK.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ - -#include "SSL_SOCK.h" - -#if !defined (__ACE_INLINE__) -#include "SSL_SOCK.i" -#endif /* __ACE_INLINE__ */ - -#include "ace/OS_NS_errno.h" -#include "ace/os_include/os_signal.h" - -ACE_RCSID (ACE_SSL, - SSL_SOCK, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_SSL_SOCK::ACE_SSL_SOCK (void) -{ - ACE_TRACE ("ACE_SSL_SOCK::ACE_SSL_SOCK"); -} - -ACE_SSL_SOCK::~ACE_SSL_SOCK (void) -{ - ACE_TRACE ("ACE_SSL_SOCK::~ACE_SSL_SOCK"); -} - -int -ACE_SSL_SOCK::enable (int value) const -{ - ACE_TRACE ("ACE_SSL_SOCK::enable"); - - switch (value) - { -#ifdef SIGURG - case SIGURG: - case ACE_SIGURG: -#endif /* SIGURG */ - case SIGIO: - case ACE_SIGIO: - case ACE_CLOEXEC: - ACE_NOTSUP_RETURN (-1); - case ACE_NONBLOCK: - return ACE_IPC_SAP::enable (value); - default: - return -1; - } -} - -int -ACE_SSL_SOCK::disable (int value) const -{ - ACE_TRACE("ACE_SSL_SOCK::disable"); - switch (value) - { -#ifdef SIGURG - case SIGURG: - case ACE_SIGURG: -#endif /* SIGURG */ - case SIGIO: - case ACE_SIGIO: - case ACE_CLOEXEC: - ACE_NOTSUP_RETURN (-1); - case ACE_NONBLOCK: - return ACE_IPC_SAP::disable (value); - default: - return -1; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK.h b/ace/SSL/SSL_SOCK.h deleted file mode 100644 index 0a86a1f5c9f..00000000000 --- a/ace/SSL/SSL_SOCK.h +++ /dev/null @@ -1,103 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_SOCK.h - * - * $Id$ - * - * @author Ossama Othman - */ -//============================================================================= - - -#ifndef ACE_SSL_SOCK_H -#define ACE_SSL_SOCK_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SOCK.h" - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) -# define ACE_SSL_SOCK_ACCEPTOR ACE_SSL_SOCK_Acceptor -# define ACE_SSL_SOCK_CONNECTOR ACE_SSL_SOCK_Connector -# define ACE_SSL_SOCK_STREAM ACE_SSL_SOCK_Stream -#else -# define ACE_SSL_SOCK_ACCEPTOR ACE_SSL_SOCK_Acceptor, ACE_INET_Addr -# define ACE_SSL_SOCK_CONNECTOR ACE_SSL_SOCK_Connector, ACE_INET_Addr -# define ACE_SSL_SOCK_STREAM ACE_SSL_SOCK_Stream, ACE_INET_Addr -#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SSL_SOCK - * - * @brief An abstract class that forms the basis for more specific - * classes, such as "ACE_SSL_SOCK_Acceptor" and - * "ACE_SSL_SOCK_Stream". Do not instantiate this class. - * - * This class provides functions that are common to all of the - * ACE_SSL_SOCK_* classes. ACE_SSL_SOCK provides the ability - * to get and set socket options, get the local and remote - * addresses, and close the socket. - */ -class ACE_SSL_Export ACE_SSL_SOCK : public ACE_SOCK -{ -public: - - /** - * Override ACE_SOCK base class implementations with these SSL - * specific ones. - */ - //@{ - int set_option (int level, - int option, - void *optval, - int optlen) const; - int get_option (int level, - int option, - void *optval, - int *optlen) const; - int enable (int value) const; - int disable (int value) const; - void set_handle (ACE_HANDLE); - ACE_HANDLE get_handle (void) const; - int control (int cmd, void *arg) const; - //@} - -protected: - - /// Default constructor is private to prevent instances of this class - /// from being defined. - ACE_SSL_SOCK (void); - - /// Destructor - /** - * Not a virtual destructor. Protected destructor to prevent - * operator delete() from being called through a base class - * ACE_SSL_SOCK pointer/reference. - */ - ~ACE_SSL_SOCK (void); - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "SSL_SOCK.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_SOCK_H */ - - - - diff --git a/ace/SSL/SSL_SOCK.i b/ace/SSL/SSL_SOCK.i deleted file mode 100644 index 1a39d5214dc..00000000000 --- a/ace/SSL/SSL_SOCK.i +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_SSL_SOCK::set_handle (ACE_HANDLE fd) -{ - this->ACE_SOCK::set_handle (fd); -} - -ACE_INLINE ACE_HANDLE -ACE_SSL_SOCK::get_handle (void) const -{ - // return this->ssl_ ? (ACE_HANDLE) ::SSL_get_fd (this->ssl_) : ACE_INVALID_HANDLE; - return this->ACE_SOCK::get_handle (); -} - - -ACE_INLINE int -ACE_SSL_SOCK::control (int cmd, void *arg) const -{ - return ACE_OS::ioctl (this->get_handle (), cmd, arg); -} - -ACE_INLINE int -ACE_SSL_SOCK::set_option (int level, - int option, - void *optval, - int optlen) const -{ -// switch (option) -// { -// case SO_SNDBUF: -// return ::BIO_set_write_buffer_size (this->io_bio_, *((int *) optval)); -// case SO_RCVCBUF: -// return ::BIO_set_read_buffer_size (this->io_bio_, *((int *) optval)); -// default: - return ACE_OS::setsockopt (this->get_handle (), - level, - option, (char *) optval, - optlen); -// } -} - -// Provides access to the ACE_OS::getsockopt system call. - -ACE_INLINE int -ACE_SSL_SOCK::get_option (int level, - int option, - void *optval, - int *optlen) const -{ -// switch (option) -// { -// case SO_SNDBUF: -// return ::BIO_get_write_buffer_size (this->io_bio_, *((int *) optval)); -// case SO_RCVCBUF: -// return ::BIO_get_read_buffer_size (this->io_bio_, *((int *) optval)); -// default: - return ACE_OS::getsockopt (this->get_handle (), - level, - option, (char *) optval, - optlen); -// } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Acceptor.cpp b/ace/SSL/SSL_SOCK_Acceptor.cpp deleted file mode 100644 index 61c91e999e4..00000000000 --- a/ace/SSL/SSL_SOCK_Acceptor.cpp +++ /dev/null @@ -1,249 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - - -#include "SSL_SOCK_Acceptor.h" - -#include "ace/Handle_Set.h" -#include "ace/OS_Errno.h" -#include "ace/OS_NS_errno.h" -#include "ace/Log_Msg.h" -#include "ace/Time_Value.h" -#include "ace/Countdown_Time.h" - -#if !defined (__ACE_INLINE__) -#include "SSL_SOCK_Acceptor.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ACE_SSL, - SSL_SOCK_Acceptor, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Acceptor) - -ACE_SSL_SOCK_Acceptor::~ACE_SSL_SOCK_Acceptor (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::~ACE_SSL_SOCK_Acceptor"); -} - - -int -ACE_SSL_SOCK_Acceptor::ssl_accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Time_Value *timeout) const -{ - SSL *ssl = new_stream.ssl (); - - if (SSL_is_init_finished (ssl)) - return 0; - - if (!SSL_in_accept_init (ssl)) - ::SSL_set_accept_state (ssl); - - ACE_HANDLE handle = new_stream.get_handle (); - - // We're going to call SSL_accept, optionally doing ACE::select and - // retrying the SSL_accept, until the SSL handshake is done or - // it fails. - // To get the timeout affect, set the socket to nonblocking mode - // before beginning if there is a timeout specified. If the timeout - // is 0 (wait as long as it takes) then don't worry about the blocking - // status; we'll block in SSL_accept if the socket is blocking, and - // block in ACE::select if not. - int reset_blocking_mode = 0; - if (timeout != 0) - { - reset_blocking_mode = ACE_BIT_DISABLED (ACE::get_flags (handle), - ACE_NONBLOCK); - // Set the handle into non-blocking mode if it's not already - // in it. - if (reset_blocking_mode - && ACE::set_flags (handle, - ACE_NONBLOCK) == -1) - return -1; - } - - // Take into account the time between each select() call below. - ACE_Countdown_Time countdown (timeout); - - int status; - do - { - // These handle sets are used to set up for whatever SSL_accept - // says it wants next. They're reset on each pass around the loop. - ACE_Handle_Set rd_handle; - ACE_Handle_Set wr_handle; - - status = ::SSL_accept (ssl); - switch (::SSL_get_error (ssl, status)) - { - case SSL_ERROR_NONE: - status = 0; // To tell caller about success - break; // Done - - case SSL_ERROR_WANT_WRITE: - wr_handle.set_bit (handle); - status = 1; // Wait for more activity - break; - - case SSL_ERROR_WANT_READ: - rd_handle.set_bit (handle); - status = 1; // Wait for more activity - break; - - case SSL_ERROR_ZERO_RETURN: - // The peer has notified us that it is shutting down via - // the SSL "close_notify" message so we need to - // shutdown, too. - status = -1; - break; - - case SSL_ERROR_SYSCALL: - // On some platforms (e.g. MS Windows) OpenSSL does not - // store the last error in errno so explicitly do so. - // - // Explicitly check for EWOULDBLOCK since it doesn't get - // converted to an SSL_ERROR_WANT_{READ,WRITE} on some - // platforms. If SSL_accept failed outright, though, don't - // bother checking more. This can happen if the socket gets - // closed during the handshake. - if (ACE_OS::set_errno_to_last_error () == EWOULDBLOCK && - status == -1) - { - // Although the SSL_ERROR_WANT_READ/WRITE isn't getting - // set correctly, the read/write state should be valid. - // Use that to decide what to do. - status = 1; // Wait for more activity - if (SSL_want_write (ssl)) - wr_handle.set_bit (handle); - else if (SSL_want_read (ssl)) - rd_handle.set_bit (handle); - else - status = -1; // Doesn't want anything - bail out - } - else - status = -1; - break; - - default: - ACE_SSL_Context::report_error (); - status = -1; - break; - } - - if (status == 1) - { - // Must have at least one handle to wait for at this point. - ACE_ASSERT (rd_handle.num_set() == 1 || wr_handle.num_set () == 1); - status = ACE::select (int (handle) + 1, - &rd_handle, - &wr_handle, - 0, - timeout); - - (void) countdown.update (); - - // 0 is timeout, so we're done. - // -1 is error, so we're done. - // Could be both handles set (same handle in both masks) so - // set to 1. - if (status >= 1) - status = 1; - else // Timeout or failure - status = -1; - } - - } while (status == 1 && !SSL_is_init_finished (ssl)); - - if (reset_blocking_mode) - { - ACE_Errno_Guard eguard (errno); - ACE::clr_flags (handle, ACE_NONBLOCK); - } - - return (status == -1 ? -1 : 0); - -} - -// General purpose routine for accepting new connections. -// Since our underlying acceptor is of the plain old ACE_SOCK_Acceptor -// variety, get the basic socket setup done with it, then take care of -// the SSL handshake if the socket is accepted. -int -ACE_SSL_SOCK_Acceptor::accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::accept"); - - // Take into account the time to complete the basic TCP handshake - // and the SSL handshake. - ACE_Countdown_Time countdown (timeout); - - ACE_SOCK_Stream temp_stream; - if (-1 == this->acceptor_.accept (temp_stream, - remote_addr, - timeout, - restart, - reset_new_handle)) - return -1; - - (void) countdown.update (); - - new_stream.set_handle (temp_stream.get_handle ()); - temp_stream.set_handle (ACE_INVALID_HANDLE); - - if (this->ssl_accept (new_stream, timeout) == -1) - { - new_stream.close (); - new_stream.set_handle (ACE_INVALID_HANDLE); - return -1; - } - - return 0; - -} - -int -ACE_SSL_SOCK_Acceptor::accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Accept_QoS_Params qos_params, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::accept"); - - // Take into account the time to complete the basic TCP handshake - // and the SSL handshake. - ACE_Countdown_Time countdown (timeout); - - ACE_SOCK_Stream temp_stream; - if (-1 == this->acceptor_.accept (temp_stream, - qos_params, - remote_addr, - timeout, - restart, - reset_new_handle)) - return -1; - - (void) countdown.update (); - - new_stream.set_handle (temp_stream.get_handle ()); - temp_stream.set_handle (ACE_INVALID_HANDLE); - - if (this->ssl_accept (new_stream, timeout) == -1) - { - new_stream.close (); - new_stream.set_handle (ACE_INVALID_HANDLE); - return -1; - } - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Acceptor.h b/ace/SSL/SSL_SOCK_Acceptor.h deleted file mode 100644 index 0428365a753..00000000000 --- a/ace/SSL/SSL_SOCK_Acceptor.h +++ /dev/null @@ -1,198 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_SOCK_Acceptor.h - * - * $Id$ - * - * @author John Heitmann - * @author Chris Zimman - * @author Ossama Othman - */ -//============================================================================= - - -#ifndef ACE_SSL_SOCK_ACCEPTOR_H -#define ACE_SSL_SOCK_ACCEPTOR_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "SSL_SOCK_Stream.h" - -#include "ace/SOCK_Acceptor.h" -#include "ace/OS_QoS.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SSL_SOCK_Acceptor - * - * @brief Defines a factory that creates new @c ACE_SSL_SOCK_Stream - * objects passively. - * - * The ACE_SSL_SOCK_Acceptor has its own @c ACE_SOCK_Acceptor - * which handles the basic socket acceptance. This class is a - * wrapper which adds the SSL acceptance handshake handling. - * Since SSL is record oriented, some additional steps must be taken - * after the basic socket acceptance to complete the SSL handshake that - * takes place at session establishment. - * - * @note The user must currently ensure that only one thread services - * a given SSL session at any given time since some underlying - * SSL implementations, such as OpenSSL, are not entirely - * thread-safe or reentrant. - */ -class ACE_SSL_Export ACE_SSL_SOCK_Acceptor : public ACE_SSL_SOCK -{ -public: - - /// Default constructor. - ACE_SSL_SOCK_Acceptor (void); - - /// Default destructor. - ~ACE_SSL_SOCK_Acceptor (void); - - /** - * Initiate a passive mode SSL/BSD-style acceptor socket. - * @param local_sap The address that we're going to listen for - * connections on. If this is @c ACE_Addr::sap_any, - * this socket listens on an the "any" IP address - * and selects an unused port. To find out what port - * was selected, call this object's - * @c ACE_SOCK::get_local_addr(ACE_Addr&) method - * upon return. - */ - ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /** - * Initiate a passive-mode QoS-enabled acceptor socket. - * @param local_sap The address that we're going to listen for - * connections on. If this is @c ACE_Addr::sap_any, - * this socket listens on an the "any" IP address - * and selects an unused port. To find out what port - * was selected, call this object's - * @c ACE_SOCK::get_local_addr(ACE_Addr&) method - * upon return. - */ - ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /** - * Initiate a passive mode SSL/BSD-style acceptor socket. - * @param local_sap The address that we're going to listen for - * connections on. If this is @c ACE_Addr::sap_any, - * this socket listens on an the "any" IP address - * and selects an unused port. To find out what port - * was selected, call this object's - * @c ACE_SOCK::get_local_addr(ACE_Addr&) method - * upon return. - * - * @return 0 if success; -1 for failure (errno contains error code). - */ - int open (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /// Close the listening socket. - int close (void); - - /** - * @name Passive Connection "accept" Methods - * - * These are the canonical methods exposed by the Acceptor pattern. - */ - //@{ - /** - * Accept a new ACE_SSL_SOCK_Stream connection. On successful return, - * the socket has been accepted and the SSL handshake has been completed. - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will receive - * the new SSL socket. - * @param remote_addr Pointer to an @c ACE_INET_Addr object that will - * receive the address of the peer that connected. - * @param timeout The maximum time to wait for the combined socket - * acceptance and handshake completion. 0 means - * block forever, a timeout of {0, 0} means poll. - * @param restart 1 means "restart if interrupted," that is, - * if errno == EINTR. - * - * @return 0 if success; -1 for failure (errno contains error code). - */ - int accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0) const; - - /** - * Accept a new ACE_SSL_SOCK_Stream connection using the RVSP QoS - * information in qos_params. - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will receive - * the new SSL socket. - * @param remote_addr Pointer to an @c ACE_INET_Addr object that will - * receive the address of the peer that connected. - * @param timeout The maximum time to wait for the combined socket - * acceptance and handshake completion. 0 means - * block forever, a timeout of {0, 0} means poll. - * @param restart 1 means "restart if interrupted," that is, - * if errno == EINTR. - * - * @return 0 if success; -1 for failure (errno contains error code). - */ - int accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Accept_QoS_Params qos_params, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0) const; - //@} - - /// Meta-type info - //@{ - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_SSL_SOCK_Stream PEER_STREAM; - //@} - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - /// Complete SSL passive connection establishment. - int ssl_accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Time_Value *timeout) const; - -private: - - /// The BSD-socket workhorse - ACE_SOCK_Acceptor acceptor_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "SSL_SOCK_Acceptor.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_SOCK_ACCEPTOR_H */ diff --git a/ace/SSL/SSL_SOCK_Acceptor.i b/ace/SSL/SSL_SOCK_Acceptor.i deleted file mode 100644 index 7fd8cb04095..00000000000 --- a/ace/SSL/SSL_SOCK_Acceptor.i +++ /dev/null @@ -1,85 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor (void) - : acceptor_ () -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor"); -} - -ACE_INLINE -ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) - : acceptor_ (local_sap, - reuse_addr, - protocol_family, - backlog, - protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor"); - - this->set_handle (this->acceptor_.get_handle ()); -} - -ACE_INLINE -ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) - : acceptor_ (local_sap, - protocolinfo, - g, - flags, - reuse_addr, - protocol_family, - backlog, - protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor"); - - this->set_handle (this->acceptor_.get_handle ()); -} - -ACE_INLINE int -ACE_SSL_SOCK_Acceptor::open (const ACE_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::open"); - if (this->acceptor_.open (local_sap, - reuse_addr, - protocol_family, - backlog, - protocol) != 0) - return -1; - else - this->set_handle (this->acceptor_.get_handle ()); - - return 0; -} - -ACE_INLINE int -ACE_SSL_SOCK_Acceptor::close (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::close ()"); - - int result = this->acceptor_.close (); - this->set_handle (ACE_INVALID_HANDLE); - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Connector.cpp b/ace/SSL/SSL_SOCK_Connector.cpp deleted file mode 100644 index 41e00ff6f4a..00000000000 --- a/ace/SSL/SSL_SOCK_Connector.cpp +++ /dev/null @@ -1,411 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "SSL_SOCK_Connector.h" - -#include "ace/OS_NS_errno.h" -#include "ace/Handle_Set.h" -#include "ace/INET_Addr.h" -#include "ace/Log_Msg.h" -#include "ace/Countdown_Time.h" - -#include - -#if !defined (__ACE_INLINE__) -#include "SSL_SOCK_Connector.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ACE_SSL, - SSL_SOCK_Connector, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Connector) - -ACE_SSL_SOCK_Connector::~ACE_SSL_SOCK_Connector (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::~ACE_SSL_SOCK_Connector"); -} - -int -ACE_SSL_SOCK_Connector::ssl_connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Time_Value *timeout) -{ - SSL *ssl = new_stream.ssl (); - - if (SSL_is_init_finished (ssl)) - return 0; - - // Check if a connection is already pending for the given SSL - // structure. - if (!SSL_in_connect_init (ssl)) - ::SSL_set_connect_state (ssl); - - ACE_HANDLE handle = new_stream.get_handle (); - - // We're going to call SSL_connect, optionally doing ACE::select and - // retrying the SSL_connect, until the SSL handshake is done or - // it fails. - // To get the timeout affect, set the socket to nonblocking mode - // before beginning if there is a timeout specified. If the timeout - // is 0 (wait as long as it takes) then don't worry about the blocking - // status; we'll block in SSL_connect if the socket is blocking, and - // block in ACE::select if not. - int reset_blocking_mode = 0; - if (timeout != 0) - { - reset_blocking_mode = ACE_BIT_DISABLED (ACE::get_flags (handle), - ACE_NONBLOCK); - // Set the handle into non-blocking mode if it's not already - // in it. - if (reset_blocking_mode - && ACE::set_flags (handle, - ACE_NONBLOCK) == -1) - return -1; - } - - ACE_Time_Value t; - if (timeout != 0) - t = *timeout; // Need a non-const copy. - - // Take into account the time between each select() call below. - ACE_Countdown_Time countdown ((timeout == 0 ? 0 : &t)); - - int status; - do - { - // These handle sets are used to set up for whatever SSL_connect - // says it wants next. They're reset on each pass around the loop. - ACE_Handle_Set rd_handle; - ACE_Handle_Set wr_handle; - - status = ::SSL_connect (ssl); - switch (::SSL_get_error (ssl, status)) - { - case SSL_ERROR_NONE: - // Start out with non-blocking disabled on the SSL stream. - new_stream.disable (ACE_NONBLOCK); - status = 0; // To tell caller about success - break; // Done - - case SSL_ERROR_WANT_WRITE: - wr_handle.set_bit (handle); - status = 1; // Wait for more activity - break; - - case SSL_ERROR_WANT_READ: - rd_handle.set_bit (handle); - status = 1; // Wait for more activity - break; - - case SSL_ERROR_ZERO_RETURN: - // The peer has notified us that it is shutting down via - // the SSL "close_notify" message so we need to - // shutdown, too. - status = -1; - break; - - case SSL_ERROR_SYSCALL: - // On some platforms (e.g. MS Windows) OpenSSL does not - // store the last error in errno so explicitly do so. - // - // Explicitly check for EWOULDBLOCK since it doesn't get - // converted to an SSL_ERROR_WANT_{READ,WRITE} on some - // platforms. If SSL_connect failed outright, though, don't - // bother checking more. This can happen if the socket gets - // closed during the handshake. - if (ACE_OS::set_errno_to_last_error () == EWOULDBLOCK && - status == -1) - { - // Although the SSL_ERROR_WANT_READ/WRITE isn't getting - // set correctly, the read/write state should be valid. - // Use that to decide what to do. - status = 1; // Wait for more activity - if (SSL_want_write (ssl)) - wr_handle.set_bit (handle); - else if (SSL_want_read (ssl)) - rd_handle.set_bit (handle); - else - status = -1; // Doesn't want anything - bail out - } - else - status = -1; - break; - - default: - ACE_SSL_Context::report_error (); - status = -1; - break; - } - - if (status == 1) - { - // Must have at least one handle to wait for at this point. - ACE_ASSERT (rd_handle.num_set () == 1 || wr_handle.num_set () == 1); - - // Block indefinitely if timeout pointer is zero. - status = ACE::select (int (handle) + 1, - &rd_handle, - &wr_handle, - 0, - (timeout == 0 ? 0 : &t)); - - (void) countdown.update (); - - // 0 is timeout, so we're done. - // -1 is error, so we're done. - // Could be both handles set (same handle in both masks) so set to 1. - if (status >= 1) - status = 1; - else // Timeout or socket failure - status = -1; - } - - } while (status == 1 && !SSL_is_init_finished (ssl)); - - if (reset_blocking_mode) - { - ACE_Errno_Guard eguard (errno); - ACE::clr_flags (handle, ACE_NONBLOCK); - } - - return (status == -1 ? -1 : 0); - -} - -int -ACE_SSL_SOCK_Connector::connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::connect"); - - // Take into account the time to complete the basic TCP handshake - // and the SSL handshake. - ACE_Time_Value time_copy; - ACE_Countdown_Time countdown (&time_copy); - if (timeout != 0) - { - time_copy += *timeout; - countdown.start (); - } - - int result = - this->connector_.connect (new_stream.peer (), - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms); - - int error = 0; - if (result == -1) - error = errno; // Save us some TSS accesses. - - // Obtain the handle from the underlying SOCK_Stream and set it in - // the SSL_SOCK_Stream. Note that the case where a connection is in - // progress is also handled. In that case, the handle must also be - // set in the SSL_SOCK_Stream so that the correct handle is returned - // when performing non-blocking connect()s. - if (new_stream.get_handle () == ACE_INVALID_HANDLE - && (result == 0 - || (result == -1 && (error == EWOULDBLOCK - || error == EINPROGRESS)))) - new_stream.set_handle (new_stream.peer ().get_handle ()); - - if (result == -1) - return result; - - // If using a timeout, update the countdown timer to reflect the time - // spent on the connect itself, then pass the remaining time to - // ssl_connect to bound the time on the handshake. - if (timeout != 0) - { - countdown.update (); - timeout = &time_copy; - } - - result = this->ssl_connect (new_stream, timeout); - - if (result == -1) - new_stream.close (); - - return result; -} - -int -ACE_SSL_SOCK_Connector::connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int perms) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::connect"); - - // Take into account the time to complete the basic TCP handshake - // and the SSL handshake. - ACE_Time_Value time_copy; - ACE_Countdown_Time countdown (&time_copy); - if (timeout != 0) - { - time_copy += *timeout; - countdown.start (); - } - - int result = this->connector_.connect (new_stream.peer (), - remote_sap, - qos_params, - timeout, - local_sap, - protocolinfo, - g, - flags, - reuse_addr, - perms); - - int error = 0; - if (result == -1) - error = errno; // Save us some TSS accesses. - - // Obtain the handle from the underlying SOCK_Stream and set it in - // the SSL_SOCK_Stream. Note that the case where a connection is in - // progress is also handled. In that case, the handle must also be - // set in the SSL_SOCK_Stream so that the correct handle is returned - // when performing non-blocking connect()s. - if (new_stream.get_handle () == ACE_INVALID_HANDLE - && (result == 0 - || (result == -1 && (error == EWOULDBLOCK - || error == EINPROGRESS)))) - new_stream.set_handle (new_stream.peer ().get_handle ()); - - if (result == -1) - return result; - - // If using a timeout, update the countdown timer to reflect the time - // spent on the connect itself, then pass the remaining time to - // ssl_connect to bound the time on the handshake. - if (timeout != 0) - { - countdown.update (); - timeout = &time_copy; - } - - result = this->ssl_connect (new_stream, timeout); - - if (result == -1) - new_stream.close (); - - return result; -} - -// Try to complete a non-blocking connection. - -int -ACE_SSL_SOCK_Connector::complete (ACE_SSL_SOCK_Stream &new_stream, - ACE_Addr *remote_sap, - const ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::complete"); - - // Take into account the time to complete the basic TCP handshake - // and the SSL handshake. - ACE_Time_Value time_copy; - ACE_Countdown_Time countdown (&time_copy); - if (tv != 0) - { - time_copy += *tv; - countdown.start (); - } - - // Only attempt to complete the TCP connection if it that hasn't - // already been done. - ACE_INET_Addr raddr; - if (new_stream.peer ().get_remote_addr (raddr) != 0 - && this->connector_.complete (new_stream.peer (), - remote_sap, - tv) == -1) - return -1; - - // The handle in the SSL_SOCK_Stream should have already been set in - // the connect() method. - - // If using a timeout, update the countdown timer to reflect the time - // spent on the connect itself, then pass the remaining time to - // ssl_connect to bound the time on the handshake. - if (tv != 0) - { - countdown.update (); - tv = &time_copy; - } - - if (this->ssl_connect (new_stream, tv) == -1) - { - new_stream.close (); - return -1; - } - - return 0; - -} - - -ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector ( - ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) - : connector_ () -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector"); - this->connect (new_stream, - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms); -} - -ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector ( - ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int perms) - : connector_ () -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector"); - - this->connect (new_stream, - remote_sap, - qos_params, - timeout, - local_sap, - protocolinfo, - g, - flags, - reuse_addr, - perms); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Connector.h b/ace/SSL/SSL_SOCK_Connector.h deleted file mode 100644 index 702dbbf82ec..00000000000 --- a/ace/SSL/SSL_SOCK_Connector.h +++ /dev/null @@ -1,318 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_SOCK_Connector.h - * - * $Id$ - * - * @author Ossama Othman - * @author Carlos O'Ryan - * @author John Heitmann - * @author Chris Zimman - */ -//============================================================================= - - -#ifndef ACE_SSL_SOCK_CONNECTOR_H -#define ACE_SSL_SOCK_CONNECTOR_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "SSL_SOCK_Stream.h" - -#include "ace/SOCK_Connector.h" -#include "ace/OS_QoS.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SSL_SOCK_Connector - * - * @brief Defines a factory that creates new s - * actively. - * - * The ACE_SSL_SOCK_Connector doesn't have a socket of its own, - * i.e., it simply "borrows" the one from the ACE_SSL_SOCK_Stream - * that's being connected. The reason for this is that the - * underlying socket API doesn't use a "factory" socket to connect - * "data-mode" sockets. Therefore, there's no need to inherit - * ACE_SSL_SOCK_Connector from ACE_SSL_SOCK. - * - * Since SSL is record-oriented, some additional work is done after - * the plain socket is connected. - * - * @note The user must currently ensure that only one thread services - * a given SSL session at any given time since some underlying - * SSL implementations, such as OpenSSL, are not entirely - * thread-safe or reentrant. - */ -class ACE_SSL_Export ACE_SSL_SOCK_Connector -{ - -public: - - /// Default constructor. - ACE_SSL_SOCK_Connector (void); - - /** - * Actively connect to a peer, producing a connected @c ACE_SSL_SOCK_Stream - * object if the connection succeeds. This method performs both the - * initial socket connect and the SSL handshake. - * - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will be - * connected to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - ACE_SSL_SOCK_Connector (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0); - - /** - * Actively connect to a peer, producing a connected @c ACE_SSL_SOCK_Stream - * object if the connection succeeds. This method performs both the - * initial socket connect and the SSL handshake. - * - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will be - * connected to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param qos_params Contains QoS parameters that are passed to the - * IntServ (RSVP) and DiffServ protocols. - * @see ACE_QoS_Params. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - ACE_SSL_SOCK_Connector (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - ACE_Protocol_Info *protocolinfo = 0, - ACE_SOCK_GROUP g = 0, - u_long flags = 0, - int reuse_addr = 0, - int perms = 0); - - /// Default dtor. - ~ACE_SSL_SOCK_Connector (void); - - /** - * Actively connect to a peer, producing a connected @c ACE_SSL_SOCK_Stream - * object if the connection succeeds. This method performs both the - * initial socket connect and the SSL handshake. - * - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will be - * connected to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - int connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0); - - /** - * Actively connect to a peer, producing a connected @c ACE_SSL_SOCK_Stream - * object if the connection succeeds. This method performs both the - * initial socket connect and the SSL handshake. - * - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will be - * connected to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param qos_params Contains QoS parameters that are passed to the - * IntServ (RSVP) and DiffServ protocols. - * @see ACE_QoS_Params. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - int connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - ACE_Protocol_Info *protocolinfo = 0, - ACE_SOCK_GROUP g = 0, - u_long flags = 0, - int reuse_addr = 0, - int perms = 0); - - /** - * Try to complete a non-blocking connection. - * If connection completion is successful then contains - * the connected ACE_SSL_SOCK_Stream. If is non-NULL - * then it will contain the address of the connected peer. - */ - int complete (ACE_SSL_SOCK_Stream &new_stream, - ACE_Addr *remote_sap = 0, - const ACE_Time_Value *timeout = 0); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - /// Meta-type info - //@{ - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_SSL_SOCK_Stream PEER_STREAM; - //@} - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - /// Complete non-blocking SSL active connection. - int ssl_connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Time_Value *timeout); - -private: - - /// The class that does all of the non-secure socket connection. - /// It is default contructed, and subsequently used by connect(). - ACE_SOCK_Connector connector_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "SSL_SOCK_Connector.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_SOCK_CONNECTOR_H */ diff --git a/ace/SSL/SSL_SOCK_Connector.i b/ace/SSL/SSL_SOCK_Connector.i deleted file mode 100644 index 67b5ef01540..00000000000 --- a/ace/SSL/SSL_SOCK_Connector.i +++ /dev/null @@ -1,28 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector (void) - : connector_ () -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector"); -} - -ACE_INLINE int -ACE_SSL_SOCK_Connector::reset_new_handle (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::reset_new_handle"); - return this->connector_.reset_new_handle (handle); -} - -ACE_INLINE void -ACE_SSL_SOCK_Connector::dump (void) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::dump"); - this->connector_.dump (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Stream.cpp b/ace/SSL/SSL_SOCK_Stream.cpp deleted file mode 100644 index 096528e543b..00000000000 --- a/ace/SSL/SSL_SOCK_Stream.cpp +++ /dev/null @@ -1,586 +0,0 @@ -// $Id$ - -#include "ace/Handle_Set.h" -#include "ace/Log_Msg.h" -#include "ace/Countdown_Time.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_sys_select.h" -#include "ace/OS_Memory.h" - -#include - -#include "SSL_SOCK_Stream.h" - -#if !defined (__ACE_INLINE__) -#include "SSL_SOCK_Stream.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ACE_SSL, - SSL_SOCK_Stream, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Stream) - -ACE_SSL_SOCK_Stream::ACE_SSL_SOCK_Stream (ACE_SSL_Context *context) - : ssl_ (0), - stream_ () -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::ACE_SSL_SOCK_Stream"); - - ACE_SSL_Context * ctx = - (context == 0 ? ACE_SSL_Context::instance () : context); - - this->ssl_ = ::SSL_new (ctx->context ()); - - if (this->ssl_ == 0) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) ACE_SSL_SOCK_Stream " - "- cannot allocate new SSL structure %p\n", - ACE_TEXT (""))); - } -} - -ACE_SSL_SOCK_Stream::~ACE_SSL_SOCK_Stream (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::~ACE_SSL_SOCK_Stream"); - - ::SSL_free (this->ssl_); - - // @@ Question: should we reference count the Context object or - // leave that to the application developer? We do not reference - // count reactors (for example) and following some simple rules - // seems to work fine! -} - -ssize_t -ACE_SSL_SOCK_Stream::sendv (const iovec iov[], - size_t n, - const ACE_Time_Value *max_wait_time) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::sendv"); - - // There is subtle problem in this method that occurs when using - // non-blocking IO. The semantics of a non-blocking scatter write - // (sendv()) are not possible to retain with the emulation in this - // method. - - ssize_t bytes_sent = 0; - - ACE_Time_Value t; - ACE_Time_Value *timeout = - const_cast (max_wait_time); - - if (max_wait_time != 0) - { - // Make a copy since ACE_Countdown_Time modifies the - // ACE_Time_Value. - t = *max_wait_time; - timeout = &t; - } - - // Take into account the time between each send. - ACE_Countdown_Time countdown (timeout); - - for (size_t i = 0; i < n; ++i) - { - const ssize_t result = this->send (iov[i].iov_base, - iov[i].iov_len, - timeout); - - if (result == -1) - { - // There is a subtle difference in behaviour depending on - // whether or not any data was sent. If no data was sent, - // then always return -1. Otherwise return bytes_sent. - // This gives the caller an opportunity to keep track of - if (bytes_sent > 0) - break; - else - return -1; - } - else - { - bytes_sent += result; - - // Do not continue on to the next loop iteration if the - // amount of data sent was less than the amount data given. - // This avoids a subtle problem where "holes" in the data - // stream would occur if partial sends of a given buffer in - // the iovec array occured. - if (static_cast (result) < iov[i].iov_len) - break; - } - - (void) countdown.update (); - } - - return bytes_sent; -} - -ssize_t -ACE_SSL_SOCK_Stream::recvv (iovec *io_vec, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recvv"); - - // From ACE_SOCK_IO::recvv(). -#if defined (FIONREAD) - ACE_Handle_Set handle_set; - handle_set.reset (); - handle_set.set_bit (this->get_handle ()); - - io_vec->iov_base = 0; - - // Check the status of the current socket. - switch (ACE_OS::select (int (this->get_handle ()) + 1, - handle_set, - 0, 0, - timeout)) - { - case -1: - return -1; - /* NOTREACHED */ - case 0: - errno = ETIME; - return -1; - /* NOTREACHED */ - default: - // Goes fine, fallthrough to get data - break; - } - - int inlen; - - if (ACE_OS::ioctl (this->get_handle (), - FIONREAD, - &inlen) == -1) - return -1; - else if (inlen > 0) - { - ACE_NEW_RETURN (io_vec->iov_base, - char[inlen], - -1); - io_vec->iov_len = this->recv (io_vec->iov_base, - inlen); - return io_vec->iov_len; - } - else - return 0; -#else - ACE_UNUSED_ARG (io_vec); - ACE_UNUSED_ARG (timeout); - ACE_NOTSUP_RETURN (-1); -#endif /* FIONREAD */ -} - -ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - - // If SSL has data in the buffer, i.e. SSL_pending() returns a - // non-zero value, then don't block on select(). - if (timeout == 0 || ::SSL_pending (this->ssl_)) - return this->send (buf, len, flags); - - int val = 0; - if (ACE::enter_send_timedwait (this->get_handle (), - timeout, - val) == -1) - return -1; - - ssize_t bytes_transferred = this->send (buf, len, flags); - - ACE::restore_non_blocking_mode (this->get_handle (), val); - - return bytes_transferred; -} - -ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - - return this->recv_i (buf, n, flags, timeout); -} - - -ssize_t -ACE_SSL_SOCK_Stream::send (size_t n, ...) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - - const size_t total_tuples = n / 2; - - va_list argp; - va_start (argp, n); - - ssize_t bytes_sent = 0; - - // NOTE: This method used to fill an IO vector (e.g. iovec) and then - // send it using a scatter write (sendv()). However, it is - // not possible to emulate a non-blocking scatter write over - // SSL. As such, there is no point in attempting to use - // scatter writes over SSL. - for (size_t i = 0; i < total_tuples; ++i) - { - const ssize_t data_len = va_arg (argp, ssize_t); - const ssize_t result = this->send (va_arg (argp, char *), - data_len); - - if (result == -1) - { - // There is a subtle difference in behaviour depending on - // whether or not any data was sent. If no data was sent, - // then always return -1. Otherwise return bytes_sent. - // This gives the caller an opportunity to keep track of - // which data was actually sent. - if (bytes_sent > 0) - break; - else - { - va_end (argp); - return -1; - } - } - else - { - bytes_sent += result; - - // Do not continue on to the next loop iteration if the - // amount of data sent was less than the amount of data - // given. This avoids a subtle problem where "holes" in the - // data stream would occur if partial sends of a given - // buffer in the varargs occured. - if (result < data_len) - break; - - } - } - - va_end (argp); - - return bytes_sent; -} - -ssize_t -ACE_SSL_SOCK_Stream::recv (size_t n, ...) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - - const size_t total_tuples = n / 2; - - va_list argp; - va_start (argp, n); - - ssize_t bytes_recv = 0; - - for (size_t i = 0; i < total_tuples; ++i) - { - const ssize_t data_len = va_arg (argp, ssize_t); - const ssize_t result = this->recv (va_arg (argp, char *), - data_len); - - if (result == -1) - { - // There is a subtle difference in behaviour depending on - // whether or not any data was received. If no data was - // received, then always return -1. Otherwise return - // bytes_received. This gives the caller an opportunity to - // keep track of which data was actually received. - if (bytes_recv > 0) - break; - else - { - va_end (argp); - return -1; - } - } - else - { - bytes_recv += result; - - // Do not continue on to the next loop iteration if the - // amount of data received was less than the amount of data - // desired. This avoids a subtle problem where "holes" in - // the data stream would occur if partial receives of a - // given buffer in the varargs occured. - if (result < data_len) - break; - - } - } - - va_end (argp); - - return bytes_recv; -} - -ssize_t -ACE_SSL_SOCK_Stream::send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bt) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send_n"); - - // No support for send flags in SSL. - if (flags != 0) - ACE_NOTSUP_RETURN (-1); - - /* This code mimics ACE::send_n */ - // Total number of bytes written. - size_t temp = 0; - size_t &bytes_transferred = ((bt == 0) ? temp : *bt); - - // Actual number of bytes written in each attempt - ssize_t n = 0; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - n = this->send ((const char*) buf + bytes_transferred, - len - bytes_transferred, - flags, - timeout); - - if (n < 0) - { - if (errno == EWOULDBLOCK) - { - // If blocked, try again. - n = 0; - continue; - } - else - return -1; - } - else if (n == 0) - break; - } - - return bytes_transferred; -} - -ssize_t -ACE_SSL_SOCK_Stream::recv_n (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bt) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv_n"); - - if (flags != 0) - { - if ((flags | MSG_PEEK) != MSG_PEEK) - ACE_NOTSUP_RETURN (-1); - } - - size_t temp = 0; - size_t &bytes_transferred = ((bt == 0) ? temp : *bt); - - ssize_t n = 0; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - n = this->recv ((char*) buf + bytes_transferred, - len - bytes_transferred, - flags, - timeout); - - if (n < 0) - { - if (errno == EWOULDBLOCK) - { - // If blocked, try again. - n = 0; - continue; - } - else - return -1; - } - else if (n == 0) - break; - } - - return bytes_transferred; -} - -ssize_t -ACE_SSL_SOCK_Stream::recv_n (void *buf, int len, int flags) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv_n"); - - if (flags != 0) - { - if ((flags | MSG_PEEK) != MSG_PEEK) - ACE_NOTSUP_RETURN (-1); - } - - ssize_t bytes_transferred = 0; - ssize_t n = 0; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - n = this->recv ((char*) buf + bytes_transferred, - len - bytes_transferred, - flags); - - if (n < 0) - { - if (errno == EWOULDBLOCK) - { - // If blocked, try again. - n = 0; - continue; - } - else - return -1; - } - else if (n == 0) - break; - } - - return bytes_transferred; -} - -ssize_t -ACE_SSL_SOCK_Stream::send_n (const void *buf, int len, int flags) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send_n"); - - // Send flags are unsupported in SSL - if (flags != 0) - ACE_NOTSUP_RETURN (-1); - - /* The following code mimics */ - size_t bytes_transferred = 0; - ssize_t n = 0; - - for (bytes_transferred = 0; - bytes_transferred < (size_t) len; - bytes_transferred += n) - { - n = this->send ((const char*) buf + bytes_transferred, - len - bytes_transferred, - flags); - - if (n < 0) - { - if (errno == EWOULDBLOCK) - { - // If blocked, try again. - n = 0; - continue; - } - else - return -1; - } - else if (n == 0) - break; - } - - return bytes_transferred; -} - -ssize_t -ACE_SSL_SOCK_Stream::sendv_n (const iovec iov[], size_t iovcnt) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::sendv_n"); - - ssize_t bytes_sent = 0; - - for (size_t i = 0; i < iovcnt; ++i) - { - ssize_t result = this->send_n (iov[i].iov_base, - iov[i].iov_len); - - - if (result == -1) - { - // There is a subtle difference in behaviour depending on - // whether or not any data was sent. If no data was sent, - // then always return -1. Otherwise return bytes_sent. - // This gives the caller an opportunity to keep track of - // which data was actually sent. - if (bytes_sent > 0) - break; - else - return -1; - } - else - bytes_sent += result; - } - - return bytes_sent; -} - -ssize_t -ACE_SSL_SOCK_Stream::recvv_n (iovec iov[], size_t iovcnt) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recvv_n"); - - ssize_t bytes_read = 0; - - for (size_t i = 0; i < iovcnt; ++i) - { - ssize_t result = this->recv_n (iov[i].iov_base, - iov[i].iov_len); - - if (result == -1) - { - // There is a subtle difference in behaviour depending on - // whether or not any data was read. If no data was read, - // then always return -1. Otherwise return bytes_read. - // This gives the caller an opportunity to keep track of - // which data was actually read. - if (bytes_read > 0) - break; - else - return -1; - } - else - bytes_read += result; - } - - return bytes_read; -} - -int -ACE_SSL_SOCK_Stream::get_remote_addr (ACE_Addr &addr) const -{ - // Some applications use get_remote_addr() as a way of determining - // whether or not a connection has been established. In SSL's case, - // the remote addr will be available once the TCP handshake has been - // complete. Despite that fact, the SSL connection may not have - // been completed. In such a case, a successful return from - // get_remote_addr() would be misleading. - - if (SSL_is_init_finished (this->ssl_)) - return this->ACE_SSL_SOCK::get_remote_addr (addr); - - if (this->get_handle () == ACE_INVALID_HANDLE) - errno = EBADF; - else - errno = ENOTCONN; - - return -1; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Stream.h b/ace/SSL/SSL_SOCK_Stream.h deleted file mode 100644 index a58d91e7c4b..00000000000 --- a/ace/SSL/SSL_SOCK_Stream.h +++ /dev/null @@ -1,321 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_SOCK_Stream.h - * - * $Id$ - * - * @author Ossama Othman - * @author Carlos O'Ryan - * @author John Heitmann - */ -//============================================================================= - - -#ifndef ACE_SSL_SOCK_STREAM_H -#define ACE_SSL_SOCK_STREAM_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// This must be included before any include on LynxOS -#include "ace/os_include/os_stdio.h" - -#include - -#include "SSL_SOCK.h" -#include "SSL_Context.h" - -#include "ace/SOCK_Stream.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SSL_SOCK_Stream - * - * @brief Defines methods in the ACE_SSL_SOCK_Stream abstraction. - * - * This class encapsulates the methods and functionality necessary to - * send and receive data over TLS/SSL. - * @par - * Since SSL is record-oriented, some additional steps must be taken - * to make the ACE_SSL_SOCK_Stream interact properly with the - * Reactor (if one is used) when performing non-blocking IO. In - * particular, if ::SSL_pending (ssl), where "ssl" is a pointer to the - * SSL data structure returned from ACE_SSL_SOCK_Stream::ssl(), - * returns a non-zero value then the event handler that calls the IO - * methods in this class should return a value greater than zero to - * force the Reactor to invoke the event handler before polling for - * additional events (e.g. blocking on select()). - * - * @note The user must currently ensure that only one thread services - * a given SSL session at any given time since underlying SSL - * implementations, such as OpenSSL, are not entirely - * thread-safe or reentrant. - */ -class ACE_SSL_Export ACE_SSL_SOCK_Stream : public ACE_SSL_SOCK -{ -public: - - /// Constructor - /** - * @param context Pointer to @c ACE_SSL_Context instance containing - * the OpenSSL @c SSL data structure to be associated - * with this @c ACE_SSL_SOCK_Stream. The @c SSL data - * structure will be copied to make it at least - * logically independent of the supplied @a context. - */ - ACE_SSL_SOCK_Stream (ACE_SSL_Context *context = - ACE_SSL_Context::instance ()); - - /// Destructor - ~ACE_SSL_SOCK_Stream (void); - - /// Send an n byte buffer to the ssl socket using the semantics of - /// send(3n). - /** - * ACE_SSL supports no flags for sending at this time. - */ - ssize_t send (const void *buf, - size_t n, - int flags) const; - - /// Recv an n byte buffer from the ssl socket using the semantics of - /// recv(3n). - /** - * ACE_SSL supports MSG_PEEK, but no other flags at this time. - */ - ssize_t recv (void *buf, - size_t n, - int flags) const; - - /// Send an n byte buffer to the ssl socket using the semantics of - /// write(2). - ssize_t send (const void *buf, - size_t n) const; - - /// Recv an n byte buffer from the ssl socket using the semantics of - /// read(2). - ssize_t recv (void *buf, - size_t n) const; - - /// Send an iovec of size n to the ssl socket. - /** - * Note that it is not possible to perform a "scattered" write with - * the underlying OpenSSL implementation. As such, the expected - * semantics are not fully reproduced with this implementation. - */ - ssize_t sendv (const iovec iov[], - size_t n, - const ACE_Time_Value *timeout = 0) const; - - /** - * Allows a client to read from a socket without having to provide a - * buffer to read. This method determines how much data is in the - * socket, allocates a buffer of this size, reads in the data, and - * returns the number of bytes read. The caller is responsible for - * deleting the member in the iov_base field of io_vec using - * delete [] io_vec->iov_base. - */ - ssize_t recvv (iovec *io_vec, - const ACE_Time_Value *timeout = 0) const; - - /** - * Wait to timeout amount of time to send up to n bytes into buf - * (uses the send() call). If send() times out -1 is returned with - * errno == ETIME. If it succeeds the number of bytes sent is - * returned. No flags are supported. - */ - ssize_t send (const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const; - - /** - * Wait up to timeout amount of time to receive up to n bytes into - * buf (uses the recv() call). If recv() times out -1 is returned - * with errno == ETIME. If it succeeds the number of bytes received - * is returned. MSG_PEEK is the only supported flag. - */ - ssize_t recv (void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const; - - /** - * Wait to to timeout amount of time to send up to n bytes into - * buf (uses the send() call). If send() times out - * a -1 is returned with errno == ETIME. If it succeeds the - * number of bytes sent is returned. - */ - ssize_t send (const void *buf, - size_t n, - const ACE_Time_Value *timeout) const; - - /** - * Wait up to timeout amount of time to receive up to n bytes - * into buf (uses the recv() call). If recv() times - * out a -1 is returned with @c errno == ETIME. If it succeeds the - * number of bytes received is returned. - */ - ssize_t recv (void *buf, - size_t n, - const ACE_Time_Value *timeout) const; - - /// Send n varargs messages to the connected ssl socket. - ssize_t send (size_t n, - ...) const; - - /// Recv n varargs messages to the connected ssl socket. - ssize_t recv (size_t n, - ...) const; - - /// Send n bytes, keep trying until n are sent. - ssize_t send_n (const void *buf, int n) const; - - /// Recv n bytes, keep trying until n are received. - ssize_t recv_n (void *buf, int n) const; - - /** - * @note In the following four methods, only MSG_PEEK is supported - * for recv_n(), and no flags are supported for send_n(). - */ - //@{ - /// Send n bytes, keep trying until n are sent. - ssize_t send_n (const void *buf, int n, int flags) const; - - /// Recv n bytes, keep trying until n are sent. - ssize_t recv_n (void *buf, int n, int flags) const; - - /** - * Try to send exactly len bytes into buf (uses the send() call). - * If send() blocks for longer than timeout the number of bytes - * actually sent is returned with errno == ETIME. If a timeout does - * not occur, send_n() return len (i.e., the number of bytes - * requested to be sent). - */ - ssize_t send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred = 0) const; - - /** - * Try to receive exactly len bytes into buf (uses the recv() call). - * The ACE_Time_Value indicates how long to blocking trying to - * receive. If timeout == 0, the caller will block until action is - * possible, else will wait until the relative time specified in - * timeout elapses). If recv() blocks for longer than timeout the - * number of bytes actually read is returned with errno == ETIME. - * If a timeout does not occur, recv_n return len (i.e., the number - * of bytes requested to be read). - */ - ssize_t recv_n (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred = 0) const; - //@} - - /** - * Send an iovec of size n to the connected socket. Will block - * until all bytes are sent or an error occurs. - */ - ssize_t sendv_n (const iovec iov[], - size_t n) const; - - /// Receive an iovec of size n to the connected socket. - ssize_t recvv_n (iovec iov[], - size_t n) const; - - - /** - * Selectively close endpoints. - */ - //@{ - /// Close down the reader. - int close_reader (void); - - /// Close down the writer. - int close_writer (void); - //@} - - ///Close down the socket. - int close (void); - - /// Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// Overridden set_handle() method. - /** - * Only an ACE_SSL_SOCK_Acceptor or ACE_SSL_SOCK_Connector should - * access this method since some state in the underlying "ssl_" data - * structure is set during SSL connection establishment. - */ - void set_handle (ACE_HANDLE fd); - - /// Return a pointer to the underlying SSL structure. - SSL *ssl (void) const; - - /** - * Return the address of the remotely connected peer (if there is - * one), in the referenced . Returns 0 if successful, else - * -1. - * - * @note If the TCP connection has been completed but the SSL - * connection has not been completed yet, -1 will be - * returned. - */ - int get_remote_addr (ACE_Addr &) const; - - /// Return the underlying ACE_SOCK_Stream which ACE_SSL runs atop of. - ACE_SOCK_Stream & peer (void); - -protected: - - /// Underlying send() helper method common to all public send() - /// methods. - ssize_t send_i (const void *buf, - size_t n, - int flags) const; - - /// Underlying send() helper method common to all public send() - /// methods. - ssize_t recv_i (void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const; - -private: - - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_SSL_SOCK_Stream &)) - ACE_UNIMPLEMENTED_FUNC (ACE_SSL_SOCK_Stream (const ACE_SSL_SOCK_Stream &)) - -protected: - - /// The SSL session. - SSL *ssl_; - - /// The stream which works under the ssl connection. - ACE_SOCK_Stream stream_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "SSL_SOCK_Stream.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_SOCK_STREAM_H */ diff --git a/ace/SSL/SSL_SOCK_Stream.i b/ace/SSL/SSL_SOCK_Stream.i deleted file mode 100644 index 352aca04b3e..00000000000 --- a/ace/SSL/SSL_SOCK_Stream.i +++ /dev/null @@ -1,323 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_SSL_SOCK_Stream::set_handle (ACE_HANDLE fd) -{ - if (this->ssl_ == 0 || fd == ACE_INVALID_HANDLE) - { - this->ACE_SSL_SOCK::set_handle (ACE_INVALID_HANDLE); - return; - } - else - { - (void) ::SSL_set_fd (this->ssl_, (int) fd); - this->ACE_SSL_SOCK::set_handle (fd); - this->stream_.set_handle (fd); - } -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::send_i (const void *buf, - size_t n, - int flags) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send_i"); - - // NOTE: Caller must provide thread-synchronization. - - // No send flags are supported in SSL. - if (flags != 0) - ACE_NOTSUP_RETURN (-1); - - const int bytes_sent = ::SSL_write (this->ssl_, - static_cast (buf), - n); - - switch (::SSL_get_error (this->ssl_, bytes_sent)) - { - case SSL_ERROR_NONE: - return bytes_sent; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - errno = EWOULDBLOCK; - - return -1; - - case SSL_ERROR_ZERO_RETURN: - // The peer has notified us that it is shutting down via the SSL - // "close_notify" message so we need to shutdown, too. - (void) ::SSL_shutdown (this->ssl_); - - return bytes_sent; - - case SSL_ERROR_SYSCALL: - if (bytes_sent == 0) - // An EOF occured but the SSL "close_notify" message was not - // sent. This is a protocol error, but we ignore it. - return 0; - - // If not an EOF, then fall through to "default" case. - - // On some platforms (e.g. MS Windows) OpenSSL does not store - // the last error in errno so explicitly do so. - ACE_OS::set_errno_to_last_error (); - - break; - - default: - // Reset errno to prevent previous values (e.g. EWOULDBLOCK) - // from being associated with fatal SSL errors. - errno = 0; - - ACE_SSL_Context::report_error (); - - break; - } - - return -1; -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t n, - int flags) const -{ - return this->send_i (buf, n, flags); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv_i (void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv_i"); - - // NOTE: Caller must provide thread-synchronization. - - int bytes_read = 0; - const ACE_HANDLE handle = this->get_handle (); - - // Value for current I/O mode (blocking/non-blocking) - int val = 0; - - if (timeout != 0) - ACE::record_and_set_non_blocking_mode (handle, - val); - - // Only block on select() with a timeout if no data in the - // internal OpenSSL buffer is pending read completion for - // the same reasons stated above, i.e. all data must be read - // before blocking on select(). - if (timeout != 0 - && !::SSL_pending (this->ssl_)) - { - if (ACE::enter_recv_timedwait (handle, - timeout, - val) == -1) - return -1; - } - - if (flags) - { - if (ACE_BIT_ENABLED (flags, MSG_PEEK)) - bytes_read = ::SSL_peek (this->ssl_, - static_cast (buf), - n); - else - ACE_NOTSUP_RETURN (-1); - } - else - { - bytes_read = ::SSL_read (this->ssl_, - static_cast (buf), - n); - } - - const int status = ::SSL_get_error (this->ssl_, bytes_read); - switch (status) - { - case SSL_ERROR_NONE: - if (timeout != 0) - ACE::restore_non_blocking_mode (handle, val); - - return bytes_read; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - errno = EWOULDBLOCK; - - return -1; - - case SSL_ERROR_ZERO_RETURN: - if (timeout != 0) - ACE::restore_non_blocking_mode (handle, val); - - // The peer has notified us that it is shutting down via the SSL - // "close_notify" message so we need to shutdown, too. - (void) ::SSL_shutdown (this->ssl_); - - return bytes_read; - - case SSL_ERROR_SYSCALL: - if (bytes_read == 0) - // An EOF occured but the SSL "close_notify" message was not - // sent. This is a protocol error, but we ignore it. - return 0; - - // If not an EOF, then fall through to "default" case. - - // On some platforms (e.g. MS Windows) OpenSSL does not store - // the last error in errno so explicitly do so. - ACE_OS::set_errno_to_last_error (); - - break; - - default: - // Reset errno to prevent previous values (e.g. EWOULDBLOCK) - // from being associated with a fatal SSL error. - errno = 0; - - ACE_SSL_Context::report_error (); - - break; - } - - return -1; -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n, - int flags) const -{ - return this->recv_i (buf, n, flags, 0); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t n) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - - return this->send_i (buf, n, 0); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - - return this->recv_i (buf, n, 0, 0); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t len, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - return this->send (buf, len, 0, timeout); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - return this->recv (buf, n, 0, timeout); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv_n (void *buf, int buf_size) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv_n"); - return this->recv_n (buf, buf_size, 0); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::send_n (const void *buf, int len) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send_n"); - return this->send_n (buf, len, 0); -} - -ACE_INLINE int -ACE_SSL_SOCK_Stream::close_reader (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::close_reader"); - return this->stream_.close_reader (); -} - -ACE_INLINE int -ACE_SSL_SOCK_Stream::close_writer (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::close_writer"); - return this->stream_.close_writer (); -} - -ACE_INLINE int -ACE_SSL_SOCK_Stream::close (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::close"); - - if (this->ssl_ == 0 || this->get_handle () == ACE_INVALID_HANDLE) - return 0; // SSL_SOCK_Stream was never opened. - - // SSL_shutdown() returns 1 on successful shutdown of the SSL - // connection, not 0. - const int status = ::SSL_shutdown (this->ssl_); - - switch (::SSL_get_error (this->ssl_, status)) - { - case SSL_ERROR_NONE: - case SSL_ERROR_SYSCALL: // Ignore this error condition. - - // Reset the SSL object to allow another connection to be made - // using this ACE_SSL_SOCK_Stream instance. This prevents the - // previous SSL session state from being associated with the new - // SSL session/connection. - (void) ::SSL_clear (this->ssl_); - this->set_handle (ACE_INVALID_HANDLE); - return this->stream_.close (); - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - errno = EWOULDBLOCK; - break; - - default: - ACE_SSL_Context::report_error (); - - ACE_Errno_Guard error (errno); // Save/restore errno - (void) this->stream_.close (); - - return -1; - } - - return -1; -} - -ACE_INLINE ACE_SOCK_Stream & -ACE_SSL_SOCK_Stream::peer (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::peer"); - return this->stream_; -} - -ACE_INLINE SSL * -ACE_SSL_SOCK_Stream::ssl (void) const -{ - return this->ssl_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/ssl.mpc b/ace/SSL/ssl.mpc deleted file mode 100644 index 5234547fc09..00000000000 --- a/ace/SSL/ssl.mpc +++ /dev/null @@ -1,12 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(SSL) : acelib, core, ace_openssl { - requires += ssl - sharedname = ACE_SSL - dynamicflags = ACE_SSL_BUILD_DLL - - pkgconfig_files { - ACE_SSL.pc.in - } -} diff --git a/ace/SSL/sslconf.h b/ace/SSL/sslconf.h deleted file mode 100644 index 0824ea05e1b..00000000000 --- a/ace/SSL/sslconf.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file sslconf.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ -//============================================================================= - - -#ifndef ACE_SSLCONF_H -#define ACE_SSLCONF_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_DEFAULT_SSL_CERT_FILE) -# ifdef WIN32 -# define ACE_DEFAULT_SSL_CERT_FILE "cert.pem" -# else -# define ACE_DEFAULT_SSL_CERT_FILE "/etc/ssl/cert.pem" -# endif /* WIN32 */ -#endif /* ACE_DEFAULT_SSL_CERT_FILE */ - -#if !defined (ACE_DEFAULT_SSL_CERT_DIR) -# ifdef WIN32 -# define ACE_DEFAULT_SSL_CERT_DIR "certs" -# else -# define ACE_DEFAULT_SSL_CERT_DIR "/etc/ssl/certs" -# endif /* WIN32 */ -#endif /* ACE_DEFAULT_SSL_CERT_DIR */ - -#if !defined (ACE_SSL_CERT_FILE_ENV) -#define ACE_SSL_CERT_FILE_ENV "SSL_CERT_FILE" -#endif /* ACE_SSL_CERT_FILE_ENV */ - -#if !defined (ACE_SSL_CERT_DIR_ENV) -#define ACE_SSL_CERT_DIR_ENV "SSL_CERT_DIR" -#endif /* ACE_SSL_CERT_DIR_ENV */ - -#if !defined (ACE_SSL_EGD_FILE_ENV) -#define ACE_SSL_EGD_FILE_ENV "SSL_EGD_FILE" -#endif /* ACE_SSL_EGD_FILE_ENV */ - -#if !defined (ACE_SSL_RAND_FILE_ENV) -#define ACE_SSL_RAND_FILE_ENV "SSL_RAND_FILE" -#endif /* ACE_SSL_RAND_FILE_ENV */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSLCONF_H */ diff --git a/ace/SString.cpp b/ace/SString.cpp deleted file mode 100644 index 4e7cdaf90c8..00000000000 --- a/ace/SString.cpp +++ /dev/null @@ -1,551 +0,0 @@ -// $Id$ - -#include "ace/Malloc_T.h" -#include "ace/OS_Memory.h" -#if !defined (ACE_HAS_WINCE) -//# include "ace/Service_Config.h" -#endif /* !ACE_HAS_WINCE */ -#include "ace/SString.h" -#include "ace/Auto_Ptr.h" -#include "ace/OS_NS_string.h" -#include "ace/Numeric_Limits.h" - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) -// FUZZ: disable check_for_streams_include -# include "ace/streams.h" -#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - -#if !defined (__ACE_INLINE__) -#include "ace/SString.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_RCSID (ace, - SString, - "SString.cpp,v 4.61 2001/03/04 00:55:30 brunsch Exp") - - -// ************************************************************ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) -ACE_OSTREAM_TYPE & -operator<< (ACE_OSTREAM_TYPE &os, const ACE_CString &cs) -{ - if (cs.fast_rep () != 0) - os << cs.fast_rep (); - return os; -} - -ACE_OSTREAM_TYPE & -operator<< (ACE_OSTREAM_TYPE &os, const ACE_WString &ws) -{ - // @@ Need to figure out how to print the "wide" string - // on platforms that don't support "wide" strings. -#if defined (ACE_HAS_WCHAR) - os << ACE_Wide_To_Ascii (ws.fast_rep ()).char_rep (); -#else - ACE_UNUSED_ARG (ws); - os << "(*non-printable string*)"; -#endif - return os; -} - -ACE_OSTREAM_TYPE & -operator<< (ACE_OSTREAM_TYPE &os, const ACE_SString &ss) -{ - if (ss.fast_rep () != 0) - os << ss.fast_rep (); - return os; -} -#endif /* !ACE_LACKS_IOSTREAM_TOTALLY */ - -// ***************************************************************** - -char * -ACE_NS_WString::char_rep (void) const -{ - ACE_TRACE ("ACE_NS_WString::char_rep"); - if (this->len_ == 0) - return 0; - else - { - char *t = 0; - - ACE_NEW_RETURN (t, - char[this->len_ + 1], - 0); - - for (size_type i = 0; i < this->len_; ++i) - // Note that this cast may lose data if wide chars are - // actually used! - t[i] = char (this->rep_[i]); - - t[this->len_] = '\0'; - return t; - } -} - -ACE_USHORT16 * -ACE_NS_WString::ushort_rep (void) const -{ - ACE_TRACE ("ACE_NS_WString::ushort_rep"); - if (this->len_ <= 0) - return 0; - else - { - ACE_USHORT16 *t = 0; - - ACE_NEW_RETURN (t, - ACE_USHORT16[this->len_ + 1], - 0); - - for (size_type i = 0; i < this->len_; ++i) - // Note that this cast may lose data if wide chars are - // actually used! - t[i] = (ACE_USHORT16)this->rep_[i]; - - t[this->len_] = 0; - return t; - } -} - -ACE_NS_WString::ACE_NS_WString (const char *s, - ACE_Allocator *alloc) - : ACE_WString (alloc) -{ - if (s == 0) - return; - - this->len_ = this->buf_len_ = ACE_OS::strlen (s); - - if (this->buf_len_ == 0) - return; - - ACE_ALLOCATOR (this->rep_, - (ACE_WSTRING_TYPE *) - this->allocator_->malloc ((this->buf_len_ + 1) * - sizeof (ACE_WSTRING_TYPE))); - this->release_ = 1; - for (size_type i = 0; i <= this->buf_len_; ++i) - this->rep_[i] = s[i]; -} - -#if defined (ACE_WSTRING_HAS_USHORT_SUPPORT) -ACE_NS_WString::ACE_NS_WString (const ACE_USHORT16 *s, - size_type len, - ACE_Allocator *alloc) - : ACE_WString (alloc) -{ - if (s == 0) - return; - - this->buf_len_ = len; - - if (this->buf_len_ == 0) - return; - - ACE_ALLOCATOR (this->rep_, - (ACE_WSTRING_TYPE *) - this->allocator_->malloc ((this->buf_len_) * - sizeof (ACE_WSTRING_TYPE))); - this->release_ = 1; - for (size_type i = 0; i < this->buf_len_; ++i) - this->rep_[i] = s[i]; -} -#endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */ - -// ***************************************************************** - -ACE_SString::size_type const ACE_SString::npos = - ACE_Numeric_Limits::max (); - -ACE_ALLOC_HOOK_DEFINE(ACE_SString) - -void -ACE_SString::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SString::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Copy constructor. - -ACE_SString::ACE_SString (const ACE_SString &s) - : allocator_ (s.allocator_), - len_ (s.len_) -{ - ACE_TRACE ("ACE_SString::ACE_SString"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - this->rep_ = (char *) this->allocator_->malloc (s.len_ + 1); - ACE_OS::memcpy ((void *) this->rep_, - (const void *) s.rep_, - this->len_); - this->rep_[this->len_] = '\0'; -} - -// Default constructor. - -ACE_SString::ACE_SString (ACE_Allocator *alloc) - : allocator_ (alloc), - len_ (0), - rep_ (0) - -{ - ACE_TRACE ("ACE_SString::ACE_SString"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - this->len_ = 0; - this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1); - this->rep_[this->len_] = '\0'; -} - -// Set the underlying pointer (does not copy memory). - -void -ACE_SString::rep (char *s) -{ - ACE_TRACE ("ACE_SString::rep"); - - this->rep_ = s; - - if (s == 0) - this->len_ = 0; - else - this->len_ = ACE_OS::strlen (s); -} - -// Constructor that actually copies memory. - -ACE_SString::ACE_SString (const char *s, - ACE_Allocator *alloc) - : allocator_ (alloc) -{ - ACE_TRACE ("ACE_SString::ACE_SString"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - if (s == 0) - { - this->len_ = 0; - this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1); - this->rep_[this->len_] = '\0'; - } - else - { - this->len_ = ACE_OS::strlen (s); - this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1); - ACE_OS::strcpy (this->rep_, s); - } -} - -ACE_SString::ACE_SString (char c, - ACE_Allocator *alloc) - : allocator_ (alloc) -{ - ACE_TRACE ("ACE_SString::ACE_SString"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - this->len_ = 1; - this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1); - this->rep_[0] = c; - this->rep_[this->len_] = '\0'; -} - -// Constructor that actually copies memory. - -ACE_SString::ACE_SString (const char *s, - size_type len, - ACE_Allocator *alloc) - : allocator_ (alloc) -{ - ACE_TRACE ("ACE_SString::ACE_SString"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - if (s == 0) - { - this->len_ = 0; - this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1); - this->rep_[this->len_] = '\0'; - } - else - { - this->len_ = len; - this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1); - ACE_OS::memcpy (this->rep_, s, len); - this->rep_[len] = '\0'; // Make sure to NUL terminate this! - } -} - -// Assignment operator (does copy memory). - -ACE_SString & -ACE_SString::operator= (const ACE_SString &s) -{ - ACE_TRACE ("ACE_SString::operator="); - // Check for identify. - - if (this != &s) - { - // Only reallocate if we don't have enough space... - if (this->len_ < s.len_) - { - this->allocator_->free (this->rep_); - this->rep_ = (char *) this->allocator_->malloc (s.len_ + 1); - } - this->len_ = s.len_; - ACE_OS::strcpy (this->rep_, s.rep_); - } - - return *this; -} - -// Return substring. -ACE_SString -ACE_SString::substring (size_type offset, - size_type length) const -{ - ACE_SString nill; - size_t count = length; - - // case 1. empty string - if (len_ == 0) - return nill; - - // case 2. start pos l - if (offset >= len_) - return nill; - - // get all remaining bytes - if (length == npos || count > (this->len_ - offset)) - count = len_ - offset; - - return ACE_SString (&rep_[offset], count, this->allocator_); -} - -// ************************************************************ - -ACE_Tokenizer::ACE_Tokenizer (ACE_TCHAR *buffer) - : buffer_ (buffer), - index_ (0), - preserves_index_ (0), - delimiter_index_ (0) -{ -} - -int -ACE_Tokenizer::delimiter (ACE_TCHAR d) -{ - if (delimiter_index_ == MAX_DELIMITERS) - return -1; - - delimiters_[delimiter_index_].delimiter_ = d; - delimiters_[delimiter_index_].replace_ = 0; - delimiter_index_++; - return 0; -} - -int -ACE_Tokenizer::delimiter_replace (ACE_TCHAR d, - ACE_TCHAR replacement) -{ - // Make it possible to replace delimiters on-the-fly, e.g., parse - // string until certain token count and then copy rest of the - // original string. - for (int i = 0; i < delimiter_index_; i++) - if (delimiters_[i].delimiter_ == d) - { - delimiters_[i].replacement_ = replacement; - delimiters_[i].replace_ = 1; - return 0; - } - - if (delimiter_index_ >= MAX_DELIMITERS) - return -1; - - delimiters_[delimiter_index_].delimiter_ = d; - delimiters_[delimiter_index_].replacement_ = replacement; - delimiters_[delimiter_index_].replace_ = 1; - delimiter_index_++; - return 0; -} - -int -ACE_Tokenizer::preserve_designators (ACE_TCHAR start, - ACE_TCHAR stop, - int strip) -{ - if (preserves_index_ == MAX_PRESERVES) - return -1; - - preserves_[preserves_index_].start_ = start; - preserves_[preserves_index_].stop_ = stop; - preserves_[preserves_index_].strip_ = strip; - preserves_index_++; - return 0; -} - -int -ACE_Tokenizer::is_delimiter (ACE_TCHAR d, - int &replace, - ACE_TCHAR &r) -{ - replace = 0; - - for (int x = 0; x < delimiter_index_; x++) - if (delimiters_[x].delimiter_ == d) - { - if (delimiters_[x].replace_) - { - r = delimiters_[x].replacement_; - replace = 1; - } - return 1; - } - - return 0; -} - -int -ACE_Tokenizer::is_preserve_designator (ACE_TCHAR start, - ACE_TCHAR &stop, - int &strip) -{ - for (int x = 0; x < preserves_index_; x++) - if (preserves_[x].start_ == start) - { - stop = preserves_[x].stop_; - strip = preserves_[x].strip_; - return 1; - } - - return 0; -} - -ACE_TCHAR * -ACE_Tokenizer::next (void) -{ - // Check if the previous pass was the last one in the buffer. - if (index_ == -1) - { - index_ = 0; - return 0; - } - - ACE_TCHAR replacement = 0; - int replace; - ACE_TCHAR *next_token; - - // Skip all leading delimiters. - for (;;) - { - // Check for end of string. - if (buffer_[index_] == '\0') - { - // If we hit EOS at the start, return 0. - index_ = 0; - return 0; - } - - if (this->is_delimiter (buffer_[index_], - replace, - replacement)) - index_++; - else - break; - } - - // When we reach this point, buffer_[index_] is a non-delimiter and - // not EOS - the start of our next_token. - next_token = buffer_ + index_; - - // A preserved region is it's own token. - ACE_TCHAR stop; - int strip; - if (this->is_preserve_designator (buffer_[index_], - stop, - strip)) - { - while (++index_) - { - if (buffer_[index_] == '\0') - { - index_ = -1; - goto EXIT_LABEL; - } - - if (buffer_[index_] == stop) - break; - } - - if (strip) - { - // Skip start preserve designator. - next_token += 1; - // Zap the stop preserve designator. - buffer_[index_] = '\0'; - // Increment to the next token. - index_++; - } - - goto EXIT_LABEL; - } - - // Step through finding the next delimiter or EOS. - for (;;) - { - // Advance pointer. - index_++; - - // Check for delimiter. - if (this->is_delimiter (buffer_[index_], - replace, - replacement)) - { - // Replace the delimiter. - if (replace != 0) - buffer_[index_] = replacement; - - // Move the pointer up and return. - index_++; - goto EXIT_LABEL; - } - - // A preserve designator signifies the end of this token. - if (this->is_preserve_designator (buffer_[index_], - stop, - strip)) - goto EXIT_LABEL; - - // Check for end of string. - if (buffer_[index_] == '\0') - { - index_ = -1; - goto EXIT_LABEL; - } - } - -EXIT_LABEL: - return next_token; -} - -// ************************************************************* - -#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) -template char ACE_String_Base::NULL_String_; -template ACE_WSTRING_TYPE ACE_String_Base::NULL_String_; -#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SString.h b/ace/SString.h deleted file mode 100644 index afe0091490c..00000000000 --- a/ace/SString.h +++ /dev/null @@ -1,499 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SString.h - * - * $Id$ - * - * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) - */ -//============================================================================= - -#ifndef ACE_SSTRING_H -#define ACE_SSTRING_H -#include /**/ "ace/pre.h" - -#include "ace/SStringfwd.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/String_Base.h" - -#if !defined (ACE_DEFAULT_GROWSIZE) -#define ACE_DEFAULT_GROWSIZE 32 -#endif /* ACE_DEFAULT_GROWSIZE */ - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) -#include "ace/iosfwd.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_CString &); -ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_WString &); -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT -template class ACE_Export ACE_String_Base; -template class ACE_Export ACE_String_Base; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ - -/** - * @class ACE_NS_WString - * - * @brief This class retain the backward compatibility for - * ACE_Naming_Context and related classes. The only addition to - * ACE_WString is a very naive "wchar" to "char" conversion - * function. - */ -class ACE_Export ACE_NS_WString : public ACE_WString -{ -public: - - using ACE_WString::size_type; - - /// Default constructor. - ACE_NS_WString (ACE_Allocator *alloc = 0); - - /// Constructor that copies @a s into dynamically allocated memory. - ACE_NS_WString (const char *s, - ACE_Allocator *alloc = 0); - - /// Constructor that copies @a s into dynamically allocated memory. - ACE_NS_WString (const ACE_WSTRING_TYPE *s, - ACE_Allocator *alloc = 0); - -#if defined (ACE_WSTRING_HAS_USHORT_SUPPORT) - /// Constructor that takes in a ushort16 string (mainly used by the - /// ACE Name_Space classes) - ACE_NS_WString (const ACE_USHORT16 *s, - size_type len, - ACE_Allocator *alloc = 0); -#endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */ - - /// Constructor that copies @a len ACE_WSTRING_TYPE's of @a s into dynamically - /// allocated memory (will NUL terminate the result). - ACE_NS_WString (const ACE_WSTRING_TYPE *s, - size_type len, - ACE_Allocator *alloc = 0); - - /// Constructor that dynamically allocates memory for @a len + 1 - /// ACE_WSTRING_TYPE characters. The newly created memory is set memset to 0. - ACE_NS_WString (size_type len, ACE_Allocator *alloc = 0); - - /// Copy constructor. - ACE_NS_WString (const ACE_NS_WString &s); - - /// Constructor that copies @a c into dynamically allocated memory. - ACE_NS_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc = 0); - - /// Transform into a copy of the ASCII character representation. - /// (caller must delete) - char *char_rep (void) const; - - /// Transform into a copy of a USHORT16 representation (caller must - /// delete). Note, behavior is undefined when sizeof (wchar_t) != 2. - ACE_USHORT16 *ushort_rep (void) const; -}; - -ACE_INLINE ACE_Export -ACE_NS_WString operator + (const ACE_NS_WString &, - const ACE_NS_WString &); - -// ----------------------------------------------------------------- - -/** - * @class ACE_SString - * - * @brief A very Simple String ACE_SString class. This is not a - * general-purpose string class, and you should probably consider - * using ACE_CString is you don't understand why this class - * exists... - * - * This class is optimized for efficiency, so it doesn't provide - * any internal locking. - * CAUTION: This class is only intended for use with applications - * that understand how it works. In particular, its destructor - * does not deallocate its memory when it is destroyed... We need - * this class since the ACE_Map_Manager requires an object that - * supports the operator == and operator !=. This class uses an - * ACE_Allocator to allocate memory. The user can make this a - * persistant class by providing an ACE_Allocator with a - * persistable memory pool. - */ -class ACE_Export ACE_SString -{ -public: - - typedef ACE_Allocator::size_type size_type; - - /// No position constant - static const size_type npos; - - /// Default constructor. - ACE_SString (ACE_Allocator *alloc = 0); - - /// Constructor that copies @a s into dynamically allocated memory. - ACE_SString (const char *s, ACE_Allocator *alloc = 0); - - /// Constructor that copies @a len chars of @s into dynamically - /// allocated memory (will NUL terminate the result). - ACE_SString (const char *s, size_type len, ACE_Allocator *alloc = 0); - - /// Copy constructor. - ACE_SString (const ACE_SString &); - - /// Constructor that copies @a c into dynamically allocated memory. - ACE_SString (char c, ACE_Allocator *alloc = 0); - - /// Default destructor. - ~ACE_SString (void); - - /// Return the character in the string (doesn't perform - /// bounds checking). - char operator [] (size_type slot) const; - - /// Return the character by reference in the string - /// (doesn't perform bounds checking). - char &operator [] (size_type slot); - - /// Assignment operator (does copy memory). - ACE_SString &operator = (const ACE_SString &); - - /** - * Return a substring given an offset and length, if length == npos - * use rest of str return empty substring if offset or offset/length - * are invalid - */ - ACE_SString substring (size_type offset, size_type length = npos) const; - - /// Same as substring - ACE_SString substr (size_type offset, size_type length = npos) const; - - /// Returns a hash value for this string. - u_long hash (void) const; - - /// Return the length of the string. - size_type length (void) const; - - /// Set the underlying pointer. Since this does not copy memory or - /// delete existing memory use with extreme caution!!! - void rep (char *s); - - /// Get the underlying pointer. - const char *rep (void) const; - - /// Get the underlying pointer. - const char *fast_rep (void) const; - - /// Same as STL String's and . - const char *c_str (void) const; - - /// Comparison operator that will match substrings. Returns the - /// slot of the first location that matches, else @c npos. - size_type strstr (const ACE_SString &s) const; - - /// Find starting at pos. Returns the slot of the first - /// location that matches (will be >= pos), else npos. - size_type find (const ACE_SString &str, size_type pos = 0) const; - - /// Find starting at pos. Returns the slot of the first - /// location that matches (will be >= pos), else npos. - size_type find (const char *s, size_type pos = 0) const; - - /// Find starting at pos. Returns the slot of the first - /// location that matches (will be >= pos), else npos. - size_type find (char c, size_type pos = 0) const; - - /// Find starting at pos (counting from the end). Returns the - /// slot of the first location that matches, else npos. - size_type rfind (char c, size_type pos = npos) const; - - /// Equality comparison operator (must match entire string). - bool operator == (const ACE_SString &s) const; - - /// Less than comparison operator. - bool operator < (const ACE_SString &s) const; - - /// Greater than comparison operator. - bool operator > (const ACE_SString &s) const; - - /// Inequality comparison operator. - bool operator != (const ACE_SString &s) const; - - /// Performs a -style comparison. - int compare (const ACE_SString &s) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Pointer to a memory allocator. - ACE_Allocator *allocator_; - - /// Length of the ACE_SString (not counting the trailing '\0'). - size_type len_; - - /// Pointer to data. - char *rep_; -}; - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) -ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_SString &); -#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - -// This allows one to use W or C String based on the Unicode -// setting -#if defined (ACE_USES_WCHAR) -typedef ACE_WString ACE_TString; -#else /* ACE_USES_WCHAR */ -typedef ACE_CString ACE_TString; -#endif /* ACE_USES_WCHAR */ - - -// ************************************************************ - -/** - * @class ACE_Tokenizer - * - * @brief Tokenizer - * - * Tokenizes a buffer. Allows application to set delimiters and - * preserve designators. Does not allow special characters, yet - * (e.g., printf ("\"like a quoted string\"")). - */ -class ACE_Export ACE_Tokenizer -{ -public: - /** - * \a buffer will be parsed. Notice that ACE_Tokenizer will modify - * \a buffer if you use delimiter_replace or - * preserve_designators to do character substitution. - * @note You should NOT pass a constant string or string literal - * to this constructor, since ACE_Tokenizer will try to modify - * the string. - * \sa preserve_designators - * \sa preserve_designators - */ - ACE_Tokenizer (ACE_TCHAR *buffer); - - /** - * \a d is a delimiter. - * \return Returns 0 on success, -1 if there is no memory left. - * - * Example: - * \verbatim - char buf[30]; - ACE_OS::strcpy(buf, "William/Joseph/Hagins"); - - ACE_Tokenizer tok (buf); - tok.delimiter ('/'); - for (char *p = tok.next (); p; p = tok.next ()) - cout << p << endl; - \endverbatim - * - * This will print out: - * \verbatim - William/Joseph/Hagins - Joseph/Hagins - Hagins \endverbatim - */ - int delimiter (ACE_TCHAR d); - - /** - * \a d is a delimiter and, when found, will be replaced by - * \a replacement. - * \return 0 on success, -1 if there is no memory left. - * - * Example: - * \verbatim - char buf[30]; - ACE_OS::strcpy(buf, "William/Joseph/Hagins"); - - ACE_Tokenizer tok (buf); - tok.delimiter_replace ('/', 0); - for (char *p = tok.next (); p; p = tok.next ()) - cout << p << endl; - \endverbatim - * - * This will print out: - * \verbatim - William - Joseph - Hagins \endverbatim - */ - int delimiter_replace (ACE_TCHAR d, ACE_TCHAR replacement); - - /** - * Extract string between a pair of designator characters. - * For instance, quotes, or '(' and ')'. - * \a start specifies the begin designator. - * \a stop specifies the end designator. - * \a strip If \a strip == 1, then the preserve - * designators will be stripped from the tokens returned by next. - * \return 0 on success, -1 if there is no memory left. - * - * Example with strip = 0: - * \verbatim - char buf[30]; - ACE_OS::strcpy(buf, "William(Joseph)Hagins"); - - ACE_Tokenizer tok (buf); - tok.preserve_designators ('(', ')', 0); - for (char *p = tok.next (); p; p = tok.next ()) - cout << p << endl; - \endverbatim - * - * This will print out: - * \verbatim - William(Joseph)Hagins - (Joseph)Hagins - )Hagins \endverbatim - * - * Example with strip = 1: - * \verbatim - char buf[30]; - ACE_OS::strcpy(buf, "William(Joseph)Hagins"); - - ACE_Tokenizer tok (buf); - tok.preserve_designators ('(', ')', 1); - for (char *p = tok.next (); p; p = tok.next ()) - cout << p << endl; - \endverbatim - * - * This will print out: - * \verbatim - William - Joseph - Hagins \endverbatim - */ - int preserve_designators (ACE_TCHAR start, ACE_TCHAR stop, int strip=1); - - /// Returns the next token. - ACE_TCHAR *next (void); - - enum { - MAX_DELIMITERS=16, - MAX_PRESERVES=16 - }; - -protected: - /// Returns 1 if is a delimiter, 0 otherwise. If should be - /// replaced with , is set to 1, otherwise 0. - int is_delimiter (ACE_TCHAR d, int &replace, ACE_TCHAR &r); - - /** - * If is a start preserve designator, returns 1 and sets - * to the stop designator. Returns 0 if is not a - * preserve designator. - */ - int is_preserve_designator (ACE_TCHAR start, ACE_TCHAR &stop, int &strip); - - ACE_TCHAR *buffer_; - int index_; - - /** - * @class Preserve_Entry - * - * @brief Preserve Entry - * - * Defines a set of characters that designate an area that - * should not be parsed, but should be treated as a complete - * token. For instance, in: (this is a preserve region), start - * would be a left paren -(- and stop would be a right paren - * -)-. The strip determines whether the designators should be - * removed from the token. - */ - class Preserve_Entry - { - public: - /** - * E.g., "(". - * E.g., ")". - * Whether the designators should be removed from the token. - */ - ACE_TCHAR start_; - ACE_TCHAR stop_; - int strip_; - }; - - /// The application can specify MAX_PRESERVES preserve designators. - Preserve_Entry preserves_[MAX_PRESERVES]; - - /// Pointer to the next free spot in preserves_. - int preserves_index_; - - /** - * @class Delimiter_Entry - * - * @brief Delimiter Entry - * - * Describes a delimiter for the tokenizer. - */ - class Delimiter_Entry - { - public: - /** - * Most commonly a space ' '. - * What occurrences of delimiter_ should be replaced with. - * Whether replacement_ should be used. This should be replaced - * with a technique that sets replacement_ = delimiter by - * default. I'll do that next iteration. - */ - ACE_TCHAR delimiter_; - ACE_TCHAR replacement_; - int replace_; - }; - - /// The tokenizer allows MAX_DELIMITERS number of delimiters. - Delimiter_Entry delimiters_[MAX_DELIMITERS]; - - /// Pointer to the next free space in delimiters_. - int delimiter_index_; -}; - -// **************************************************************** - -/** - * @class ACE_Auto_String_Free - * - * @brief Simple class to automatically de-allocate strings - * - * Keeps a pointer to a string and deallocates it (using - * ) on its destructor. - * If you need to delete using "delete[]" the - * ACE_Auto_Array_Ptr is your choice. - * The class plays the same role as auto_ptr<> - */ -class ACE_Export ACE_Auto_String_Free -{ -public: - explicit ACE_Auto_String_Free (char* p = 0); - ACE_Auto_String_Free (ACE_Auto_String_Free &rhs); - ACE_Auto_String_Free& operator= (ACE_Auto_String_Free &rhs); - ~ACE_Auto_String_Free (void); - - char* operator* () const; - char operator[] (size_t i) const; - char* get (void) const; - char* release (void); - void reset (char* p = 0); - -private: - char* p_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SString.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SSTRING_H */ diff --git a/ace/SString.inl b/ace/SString.inl deleted file mode 100644 index 8aae9df08a8..00000000000 --- a/ace/SString.inl +++ /dev/null @@ -1,299 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// Include ACE.h only if it hasn't already been included, e.g., if -// ACE_TEMPLATES_REQUIRE_SOURCE, ACE.h won't have been pulled in by -// String_Base.cpp. -#ifndef ACE_ACE_H -# include "ace/ACE.h" -#endif /* !ACE_ACE_H */ - -#include "ace/OS_NS_stdlib.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_NS_WString::ACE_NS_WString (ACE_Allocator *alloc) - : ACE_WString (alloc) -{ -} - -ACE_INLINE -ACE_NS_WString::ACE_NS_WString (const ACE_WSTRING_TYPE *s, - size_type len, - ACE_Allocator *alloc) - : ACE_WString (s, len, alloc) -{ -} - -ACE_INLINE -ACE_NS_WString::ACE_NS_WString (const ACE_WSTRING_TYPE *s, - ACE_Allocator *alloc) - : ACE_WString (s, alloc) -{ -} - -ACE_INLINE -ACE_NS_WString::ACE_NS_WString (size_type len, ACE_Allocator *alloc) - : ACE_WString (len, 0, alloc) -{ -} - -ACE_INLINE -ACE_NS_WString::ACE_NS_WString (const ACE_NS_WString &s) - : ACE_WString (s) -{ -} - -ACE_INLINE -ACE_NS_WString::ACE_NS_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc) - : ACE_WString (c, alloc) -{ -} - -ACE_INLINE ACE_NS_WString -operator+ (const ACE_NS_WString &s, const ACE_NS_WString &t) -{ - ACE_NS_WString temp (s); - temp += t; - return temp; -} - -// ------------------------------------------------------- - -ACE_INLINE -ACE_SString::~ACE_SString (void) -{ -} - -ACE_INLINE ACE_SString -ACE_SString::substr (size_type offset, - size_type length) const -{ - return this->substring (offset, length); -} - -// Return the character in the string. - -ACE_INLINE char -ACE_SString::operator[] (size_type slot) const -{ - ACE_TRACE ("ACE_SString::operator[]"); - return this->rep_[slot]; -} - -// Return the character in the string by reference. - -ACE_INLINE char & -ACE_SString::operator[] (size_type slot) -{ - ACE_TRACE ("ACE_SString::operator[]"); - return this->rep_[slot]; -} - -// Get the underlying pointer (does not make a copy, so beware!). - -ACE_INLINE const char * -ACE_SString::rep (void) const -{ - ACE_TRACE ("ACE_SString::rep"); - return this->rep_; -} - -// Get the underlying pointer (does not make a copy, so beware!). - -ACE_INLINE const char * -ACE_SString::fast_rep (void) const -{ - ACE_TRACE ("ACE_SString::fast_rep"); - return this->rep_; -} - -// Get the underlying pointer (does not make a copy, so beware!). - -ACE_INLINE const char * -ACE_SString::c_str (void) const -{ - ACE_TRACE ("ACE_SString::c_str"); - return this->rep_; -} - -// Comparison operator. - -ACE_INLINE bool -ACE_SString::operator== (const ACE_SString &s) const -{ - ACE_TRACE ("ACE_SString::operator=="); - return this->len_ == s.len_ - && ACE_OS::strcmp (this->rep_, s.rep_) == 0; -} - -// Less than comparison operator. - -ACE_INLINE bool -ACE_SString::operator < (const ACE_SString &s) const -{ - ACE_TRACE ("ACE_SString::operator <"); - - return (this->rep_ && s.rep_) - ? ACE_OS::strcmp (this->rep_, s.rep_) < 0 - : ((s.rep_) ? true : false); -} - -// Greater than comparison operator. - -ACE_INLINE bool -ACE_SString::operator > (const ACE_SString &s) const -{ - ACE_TRACE ("ACE_SString::operator >"); - - return (this->rep_ && s.rep_) - ? ACE_OS::strcmp (this->rep_, s.rep_) > 0 - : ((this->rep_) ? true : false ); -} - -// Comparison operator. - -ACE_INLINE bool -ACE_SString::operator!= (const ACE_SString &s) const -{ - ACE_TRACE ("ACE_SString::operator!="); - return !(*this == s); -} - -ACE_INLINE int -ACE_SString::compare (const ACE_SString &s) const -{ - ACE_TRACE ("ACE_SString::compare"); - return ACE_OS::strcmp (this->rep_, s.rep_); -} - -ACE_INLINE ACE_SString::size_type -ACE_SString::find (const char *s, size_type pos) const -{ - char *substr = this->rep_ + pos; - char *pointer = ACE_OS::strstr (substr, s); - if (pointer == 0) - return ACE_SString::npos; - else - return pointer - this->rep_; -} - -ACE_INLINE ACE_SString::size_type -ACE_SString::find (char c, size_type pos) const -{ - char *substr = this->rep_ + pos; - char *pointer = ACE_OS::strchr (substr, c); - if (pointer == 0) - return ACE_SString::npos; - else - return pointer - this->rep_; -} - -ACE_INLINE ACE_SString::size_type -ACE_SString::strstr (const ACE_SString &s) const -{ - ACE_TRACE ("ACE_SString::strstr"); - - return this->find (s.rep_); -} - -ACE_INLINE ACE_SString::size_type -ACE_SString::find (const ACE_SString &str, size_type pos) const -{ - return this->find (str.rep_, pos); -} - -ACE_INLINE ACE_SString::size_type -ACE_SString::rfind (char c, size_type pos) const -{ - if (pos == ACE_SString::npos) - pos = this->len_; - - // Do not change to prefix operator! Proper operation of this loop - // depends on postfix decrement behavior. - for (size_type i = pos; i-- != 0; ) - if (this->rep_[i] == c) - return i; - - return ACE_SString::npos; -} - -ACE_INLINE u_long -ACE_SString::hash (void) const -{ - return ACE::hash_pjw (this->rep_); -} - -ACE_INLINE ACE_SString::size_type -ACE_SString::length (void) const -{ - ACE_TRACE ("ACE_SString::length"); - return this->len_; -} - -ACE_INLINE -ACE_Auto_String_Free::ACE_Auto_String_Free (char* p) - : p_ (p) -{ -} - -ACE_INLINE -ACE_Auto_String_Free::ACE_Auto_String_Free (ACE_Auto_String_Free& rhs) - : p_ (rhs.p_) -{ - rhs.p_ = 0; -} - -ACE_INLINE void -ACE_Auto_String_Free::reset (char* p) -{ - ACE_OS::free (this->p_); - this->p_ = p; -} - -ACE_INLINE ACE_Auto_String_Free& -ACE_Auto_String_Free::operator= (ACE_Auto_String_Free& rhs) -{ - if (this != &rhs) - { - this->reset (rhs.p_); - rhs.p_ = 0; - } - return *this; -} - -ACE_INLINE -ACE_Auto_String_Free::~ACE_Auto_String_Free (void) -{ - this->reset (0); -} - -ACE_INLINE char* -ACE_Auto_String_Free::operator* (void) const -{ - return this->p_; -} - -ACE_INLINE char -ACE_Auto_String_Free::operator[] (size_t i) const -{ - return this->p_[i]; -} - -ACE_INLINE char* -ACE_Auto_String_Free::get (void) const -{ - return this->p_; -} - -ACE_INLINE char* -ACE_Auto_String_Free::release (void) -{ - char* p = this->p_; - this->p_ = 0; - return p; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SStringfwd.h b/ace/SStringfwd.h deleted file mode 100644 index 315553751ce..00000000000 --- a/ace/SStringfwd.h +++ /dev/null @@ -1,49 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SStringfwd.h - * - * $Id$ - * - * Forward declarations and typedefs of ACE string types. - * - * @author Douglas C. Schmidt - * @author Nanbor Wang - * @author Ossama Othman - */ -//============================================================================= - -#ifndef ACE_SSTRINGFWD_H -#define ACE_SSTRINGFWD_H - -#include /**/ "ace/pre.h" - -#include "ace/Basic_Types.h" /* ACE_WCHAR_T definition */ - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template class ACE_String_Base; // Forward declaration. - -typedef ACE_WCHAR_T ACE_WSTRING_TYPE; - -typedef ACE_String_Base ACE_CString; -typedef ACE_String_Base ACE_WString; - -// This allows one to use W or C String based on the Unicode -// setting -#if defined (ACE_USES_WCHAR) -typedef ACE_WString ACE_TString; -#else /* ACE_USES_WCHAR */ -typedef ACE_CString ACE_TString; -#endif /* ACE_USES_WCHAR */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_SSTRINGFWD_H */ diff --git a/ace/SUN_Proactor.cpp b/ace/SUN_Proactor.cpp deleted file mode 100644 index c522f18d64b..00000000000 --- a/ace/SUN_Proactor.cpp +++ /dev/null @@ -1,324 +0,0 @@ -// $Id$ - -#include "ace/SUN_Proactor.h" - -#if defined (ACE_HAS_AIO_CALLS) && defined (sun) - -#include "ace/Task_T.h" -#include "ace/Log_Msg.h" -#include "ace/Object_Manager.h" - - -ACE_RCSID (ace, - POSIX_CB_Proactor, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_SUN_Proactor::ACE_SUN_Proactor (size_t max_aio_operations) - : ACE_POSIX_AIOCB_Proactor (max_aio_operations, - ACE_POSIX_Proactor::PROACTOR_SUN), - condition_ (mutex_) -{ - // To provide correct virtual calls. - create_notify_manager (); - - // we should start pseudo-asynchronous accept task - // one per all future acceptors - - this->get_asynch_pseudo_task ().start (); -} - -// Destructor. -ACE_SUN_Proactor::~ACE_SUN_Proactor (void) -{ - this->close (); -} - -int -ACE_SUN_Proactor::handle_events (ACE_Time_Value &wait_time) -{ - // Decrement with the amount of time spent in the method - ACE_Countdown_Time countdown (&wait_time); - return this->handle_events_i (&wait_time); -} - -int -ACE_SUN_Proactor::handle_events (void) -{ - return this->handle_events_i (0); -} - -int ACE_SUN_Proactor::wait_for_start (ACE_Time_Value * abstime) -{ -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); - - if (this->num_started_aio_ != 0) // double check - return 0; - - return this->condition_.wait (abstime); - -#else - - return 0; // or -1 ??? - -#endif /* ACE_MT_SAFE */ -} - -int -ACE_SUN_Proactor::handle_events_i (ACE_Time_Value *delta) -{ - int retval = 0; - aio_result_t *result = 0; - - if (0 == delta) - { - if (this->num_started_aio_ == 0) - this->wait_for_start (0); - - result = aiowait (0); - } - else - { - if (this->num_started_aio_ == 0) - { - // Decrement delta with the amount of time spent waiting - ACE_Countdown_Time countdown (delta); - ACE_Time_Value tv (*delta); - tv += ACE_OS::gettimeofday (); - if (this->wait_for_start (&tv) == -1) - return -1; - } - struct timeval delta_tv = *delta; - result = aiowait (&delta_tv); - } - - if (result == 0) - { - // timeout, do nothing, - // we should process "post_completed" queue - } - else if (reinterpret_cast (result) == -1) - { - // Check errno for EINVAL,EAGAIN,EINTR ?? - switch (errno) - { - case EINTR : // aiowait() was interrupted by a signal. - case EINVAL: // there are no outstanding asynchronous I/O requests. - break; // we should process "post_completed" queue - - default: // EFAULT - ACE_ERROR_RETURN ((LM_ERROR, - "%N:%l:(%P | %t)::%p \nNumAIO=%d\n", - "ACE_SUN_Proactor::handle_events: aiowait failed", - num_started_aio_), - -1); - } - } - else - { - int error_status = 0; - size_t transfer_count = 0; - - ACE_POSIX_Asynch_Result *asynch_result = - find_completed_aio (result, - error_status, - transfer_count); - - if (asynch_result != 0) - { - // Call the application code. - this->application_specific_code (asynch_result, - transfer_count, - 0, // No completion key. - error_status); // Error - retval++; - } - } - - // process post_completed results - retval += this->process_result_queue (); - - return retval > 0 ? 1 : 0 ; - -} - -int -ACE_SUN_Proactor::get_result_status (ACE_POSIX_Asynch_Result* asynch_result, - int &error_status, - size_t &transfer_count) -{ - - // Get the error status of the aio_ operation. - error_status = asynch_result->aio_resultp.aio_errno; - ssize_t op_return = asynch_result->aio_resultp.aio_return; - - // ****** from Sun man pages ********************* - // Upon completion of the operation both aio_return and aio_errno - // are set to reflect the result of the operation. - // AIO_INPROGRESS is not a value used by the system - // so the client may detect a change in state - // by initializing aio_return to this value. - - if (error_status == EINPROGRESS || op_return == AIO_INPROGRESS) - return 0; // not completed - - if (op_return < 0) - transfer_count = 0; // zero bytes transferred - else - transfer_count = static_cast (op_return); - - return 1; // completed -} - -ACE_POSIX_Asynch_Result * -ACE_SUN_Proactor::find_completed_aio (aio_result_t *result, - int &error_status, - size_t &transfer_count) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, 0)); - - size_t ai; - error_status = -1; - transfer_count = 0; - - // we call find_completed_aio always with result != 0 - - for (ai = 0; ai < aiocb_list_max_size_; ai++) - if (aiocb_list_[ai] != 0 && //check for non zero - result == &aiocb_list_[ai]->aio_resultp) - break; - - if (ai >= aiocb_list_max_size_) // not found - return 0; // means somebody else uses aio directly!!! - - ACE_POSIX_Asynch_Result *asynch_result = result_list_[ai]; - - if (this->get_result_status (asynch_result, - error_status, - transfer_count) == 0) - { // should never be - ACE_ERROR ((LM_ERROR, - "%N:%l:(%P | %t)::%p\n", - "ACE_SUN_Proactor::find_completed_aio:" - "should never be !!!\n")); - return 0; - } - - aiocb_list_[ai] = 0; - result_list_[ai] = 0; - aiocb_list_cur_size_--; - - num_started_aio_--; - - start_deferred_aio (); - //make attempt to start deferred AIO - //It is safe as we are protected by mutex_ - - return asynch_result; -} - -// start_aio_i has new return codes -// 0 successful start -// 1 try later, OS queue overflow -// -1 invalid request and other errors - -int -ACE_SUN_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result) -{ - ACE_TRACE ("ACE_SUN_Proactor::start_aio_i"); - - int ret_val; - const ACE_TCHAR *ptype; - - // ****** from Sun man pages ********************* - // Upon completion of the operation both aio_return and aio_errno - // are set to reflect the result of the operation. - // AIO_INPROGRESS is not a value used by the system - // so the client may detect a change in state - // by initializing aio_return to this value. - result->aio_resultp.aio_return = AIO_INPROGRESS; - result->aio_resultp.aio_errno = EINPROGRESS; - - // Start IO - switch (result->aio_lio_opcode) - { - case LIO_READ : - ptype = ACE_LIB_TEXT ("read"); - ret_val = aioread (result->aio_fildes, - (char *) result->aio_buf, - result->aio_nbytes, - result->aio_offset, - SEEK_SET, - &result->aio_resultp); - break; - - case LIO_WRITE : - ptype = ACE_LIB_TEXT ("write"); - ret_val = aiowrite (result->aio_fildes, - (char *) result->aio_buf, - result->aio_nbytes, - result->aio_offset, - SEEK_SET, - &result->aio_resultp); - break; - - default: - ptype = ACE_LIB_TEXT ("?????"); - ret_val = -1; - break; - } - - if (ret_val == 0) - { - this->num_started_aio_++; - if (this->num_started_aio_ == 1) // wake up condition - this->condition_.broadcast (); - } - else // if (ret_val == -1) - { - if (errno == EAGAIN || errno == ENOMEM) // Defer - retry this later. - ret_val = 1; - else - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%N:%l:(%P | %t)::start_aio: aio%s %p\n"), - ptype, - ACE_LIB_TEXT ("queueing failed\n"))); - } - - return ret_val; -} - -int -ACE_SUN_Proactor::cancel_aiocb (ACE_POSIX_Asynch_Result *result) -{ - ACE_TRACE ("ACE_SUN_Proactor::cancel_aiocb"); - int rc = ::aiocancel (&result->aio_resultp); - if (rc == 0) // AIO_CANCELED - { - // after aiocancel Sun does not notify us - // so we should send notification - // to save POSIX behavoir. - // Also we should do this for deffered aio's - - result->set_error (ECANCELED); - result->set_bytes_transferred (0); - this->putq_result (result); - return 0; - } - - return 2; -} - -ACE_POSIX_Proactor::Proactor_Type -ACE_SUN_Proactor::get_impl_type (void) -{ - return PROACTOR_SUN; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_AIO_CALLS && sun */ diff --git a/ace/SUN_Proactor.h b/ace/SUN_Proactor.h deleted file mode 100644 index 9d104355578..00000000000 --- a/ace/SUN_Proactor.h +++ /dev/null @@ -1,126 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SUN_Proactor.h - * - * $Id$ - * - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_SUN_PROACTOR_H -#define ACE_SUN_PROACTOR_H - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_AIO_CALLS) && defined (sun) - -#include "ace/POSIX_Proactor.h" -#include /**/ // Sun native aio calls - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SUN_Proactor - * - * @brief Implementation of the fast and reliable Proactor - * for SunOS 5.6, 5.7, etc. - * - * This proactor, based on , - * works with Sun native interface for aio calls. - * POSIX_API Native SUN_API - * aio_read aioread - * aio_write aiowrite - * aio_suspend aiowait - * aio_error aio_result_t.errno - * aio_return aio_result_t.return - * On Solaris, the Sun native implementation is more - * reliable and efficient than POSIX implementation. - * There is a problem of lost RT signals with POSIX, if we start - * more than SIGQUEUEMAX asynchronous operations at the same - * time. - * The Sun it is not the standard POSX , instead, - * it has the following structure: - * typedef struct aiocb - * { - * int aio_fildes; File descriptor - * void *aio_buf; buffer location - * size_t aio_nbytes; length of transfer - * off_t aio_offset; file offset - * int aio_reqprio; request priority offset - * sigevent aio_sigevent; signal number and offset - * int aio_lio_opcode; listio operation - * aio_result_t aio_resultp; results - * int aio_state; state flag for List I/O - * int aio__pad[1]; extension padding - * }; - */ -class ACE_Export ACE_SUN_Proactor : public ACE_POSIX_AIOCB_Proactor -{ - -public: - virtual Proactor_Type get_impl_type (void); - - /// Destructor. - virtual ~ACE_SUN_Proactor (void); - - /// Constructor defines max number asynchronous operations that can - /// be started at the same time. - ACE_SUN_Proactor (size_t max_aio_operations = ACE_AIO_DEFAULT_SIZE); - -protected: - /** - * Dispatch a single set of events. If @a wait_time elapses before - * any events occur, return 0. Return 1 on success i.e., when a - * completion is dispatched, non-zero (-1) on errors and errno is - * set accordingly. - */ - virtual int handle_events (ACE_Time_Value &wait_time); - - /** - * Block indefinitely until at least one event is dispatched. - * Dispatch a single set of events. Return 1 on success i.e., when a - * completion is dispatched, non-zero (-1) on errors and errno is - * set accordingly. - */ - virtual int handle_events (void); - - /// Internal completion detection and dispatching. - int handle_events_i (ACE_Time_Value *delta); - - /// Initiate an aio operation. - virtual int start_aio_i (ACE_POSIX_Asynch_Result *result); - - /// Check AIO for completion, error and result status - /// Return: 1 - AIO completed , 0 - not completed yet - virtual int get_result_status (ACE_POSIX_Asynch_Result* asynch_result, - int &error_status, - size_t &transfer_count); - - /// Extract the results of aio. - ACE_POSIX_Asynch_Result *find_completed_aio (aio_result_t *result, - int &error_status, - size_t &transfer_count); - - /// From ACE_POSIX_AIOCB_Proactor. - /// Attempt to cancel running request - virtual int cancel_aiocb (ACE_POSIX_Asynch_Result *result); - - /// Specific Sun aiowait - int wait_for_start (ACE_Time_Value * abstime); - - /// Condition variable . - /// used to wait the first AIO start - ACE_SYNCH_CONDITION condition_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_AIO_CALLS && sun */ -#endif /* ACE_SUN_PROACTOR_H*/ diff --git a/ace/SV_Message.cpp b/ace/SV_Message.cpp deleted file mode 100644 index 15368235910..00000000000 --- a/ace/SV_Message.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// SV_Message.cpp -// $Id$ - -#include "ace/SV_Message.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SV_Message.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SV_Message, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SV_Message) - -void -ACE_SV_Message::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SV_Message::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Message.h b/ace/SV_Message.h deleted file mode 100644 index 04a9e20c12b..00000000000 --- a/ace/SV_Message.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file SV_Message.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//========================================================================== - - -#ifndef ACE_SV_MESSAGE_H -#define ACE_SV_MESSAGE_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SV_Message - * - * @brief Defines the header file for the C++ wrapper for message queues. - */ -class ACE_Export ACE_SV_Message -{ -public: - /// Constructor - ACE_SV_Message (long type = 0); - - /// Destructor - ~ACE_SV_Message (void); - - /// Get the message type. - long type (void) const; - - /// Set the message type. - void type (long); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Type of the message. - long type_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - - -#if defined (__ACE_INLINE__) -#include "ace/SV_Message.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SV_MESSAGE_H */ diff --git a/ace/SV_Message.inl b/ace/SV_Message.inl deleted file mode 100644 index 3f698bd5071..00000000000 --- a/ace/SV_Message.inl +++ /dev/null @@ -1,37 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Global_Macros.h" -#include "ace/config-all.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SV_Message::ACE_SV_Message (long t) - : type_ (t) -{ - ACE_TRACE ("ACE_SV_Message::ACE_SV_Message"); -} - -ACE_INLINE -ACE_SV_Message::~ACE_SV_Message (void) -{ - ACE_TRACE ("ACE_SV_Message::~ACE_SV_Message"); -} - -ACE_INLINE long -ACE_SV_Message::type (void) const -{ - ACE_TRACE ("ACE_SV_Message::type"); - return this->type_; -} - -ACE_INLINE void -ACE_SV_Message::type (long t) -{ - ACE_TRACE ("ACE_SV_Message::type"); - this->type_ = t; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Message_Queue.cpp b/ace/SV_Message_Queue.cpp deleted file mode 100644 index 1be06f0f8cc..00000000000 --- a/ace/SV_Message_Queue.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -#include "ace/SV_Message_Queue.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SV_Message_Queue.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SV_Message_Queue, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SV_Message_Queue) - -void -ACE_SV_Message_Queue::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SV_Message_Queue::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_SV_Message_Queue::ACE_SV_Message_Queue (void) -{ - ACE_TRACE ("ACE_SV_Message_Queue::ACE_SV_Message_Queue"); -} - -ACE_SV_Message_Queue::~ACE_SV_Message_Queue (void) -{ - ACE_TRACE ("ACE_SV_Message_Queue::~ACE_SV_Message_Queue"); -} - -ACE_SV_Message_Queue::ACE_SV_Message_Queue (key_t external_id, - int create, - int perms) -{ - ACE_TRACE ("ACE_SV_Message_Queue::ACE_SV_Message_Queue"); - if (this->open (external_id, create, perms) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SV_Message_Queue::ACE_SV_Message_Queue"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Message_Queue.h b/ace/SV_Message_Queue.h deleted file mode 100644 index 42fd8f08693..00000000000 --- a/ace/SV_Message_Queue.h +++ /dev/null @@ -1,105 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file SV_Message_Queue.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//=========================================================================== - -#ifndef ACE_SV_MESSAGE_QUEUE_H -#define ACE_SV_MESSAGE_QUEUE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SV_Message.h" -#include "ace/os_include/sys/os_stat.h" -#include "ace/os_include/sys/os_ipc.h" -#include "ace/Default_Constants.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SV_Message_Queue - * - * @brief Defines the header file for the C++ wrapper for System V IPC - * message queues. - */ -class ACE_Export ACE_SV_Message_Queue -{ -public: - // = Useful symbolic constants. - enum - { - ACE_CREATE = IPC_CREAT, - ACE_OPEN = 0, - ACE_NOWAIT = IPC_NOWAIT - }; - - // = Initialization and termination methods. - /// Open a message queue using the . - ACE_SV_Message_Queue (void); - ACE_SV_Message_Queue (key_t external_id, - int create = ACE_SV_Message_Queue::ACE_OPEN, - int perms = ACE_DEFAULT_FILE_PERMS); - int open (key_t external_id, - int create = ACE_SV_Message_Queue::ACE_OPEN, - int perms = ACE_DEFAULT_FILE_PERMS); - - ~ACE_SV_Message_Queue (void); - - /// Close down this instance of the message queue without removing it - /// from the system. - int close (void); - - /// Close down and remove the message queue from the system. - int remove (void); - - // = Message transfer methods. - ssize_t recv (ACE_SV_Message &mb, - int length, - long mtype = 0, - int mflags = 0); - - int send (const ACE_SV_Message &mb, - int length, - int mflags = 0); - - /// Access the underlying control operations. - int control (int option, void *arg = 0); - - /// Get the underly internal id. - int get_id (void) const; - - /// Set the underly internal id. - void set_id (int); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Returned from the underlying system call. - int internal_id_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SV_Message_Queue.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SV_MESSAGE_QUEUE_H */ diff --git a/ace/SV_Message_Queue.inl b/ace/SV_Message_Queue.inl deleted file mode 100644 index b84f6379901..00000000000 --- a/ace/SV_Message_Queue.inl +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Global_Macros.h" -#include "ace/OS_NS_sys_msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Open a message queue using the . - -ACE_INLINE int -ACE_SV_Message_Queue::open (key_t external_id, int create, int perms) -{ - ACE_TRACE ("ACE_SV_Message_Queue::open"); - return this->internal_id_ = ACE_OS::msgget (external_id, create | perms); -} - -// What does it mean to close a message queue?! - -ACE_INLINE int -ACE_SV_Message_Queue::close (void) -{ - ACE_TRACE ("ACE_SV_Message_Queue::close"); - this->internal_id_ = -1; - return 1; -} - -ACE_INLINE int -ACE_SV_Message_Queue::control (int option, void *arg) -{ - ACE_TRACE ("ACE_SV_Message_Queue::control"); - return ACE_OS::msgctl (this->internal_id_, option, - (struct msqid_ds *) arg); -} - -ACE_INLINE int -ACE_SV_Message_Queue::remove (void) -{ - ACE_TRACE ("ACE_SV_Message_Queue::remove"); - int result = this->control (IPC_RMID); - this->internal_id_ = -1; - return result; -} - -ACE_INLINE int -ACE_SV_Message_Queue::get_id (void) const -{ - ACE_TRACE ("ACE_SV_Message_Queue::get_id"); - return this->internal_id_; -} - -ACE_INLINE void -ACE_SV_Message_Queue::set_id (int id) -{ - ACE_TRACE ("ACE_SV_Message_Queue::set_id"); - this->internal_id_ = id; -} - -ACE_INLINE ssize_t -ACE_SV_Message_Queue::recv (ACE_SV_Message &mb, - int length, - long type, - int mflags) -{ - ACE_TRACE ("ACE_SV_Message_Queue::recv"); - return ACE_OS::msgrcv (this->internal_id_, (void *) &mb, - length, type, mflags); -} - -ACE_INLINE int -ACE_SV_Message_Queue::send (const ACE_SV_Message &mb, - int length, - int mflags) -{ - ACE_TRACE ("ACE_SV_Message_Queue::send"); - return ACE_OS::msgsnd (this->internal_id_, (void *) &mb, - length, mflags); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Semaphore_Complex.cpp b/ace/SV_Semaphore_Complex.cpp deleted file mode 100644 index ce3c0b07858..00000000000 --- a/ace/SV_Semaphore_Complex.cpp +++ /dev/null @@ -1,259 +0,0 @@ -// SV_Semaphore_Complex.cpp -// $Id$ - -#include "ace/SV_Semaphore_Complex.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_Thread.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SV_Semaphore_Complex.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SV_Semaphore_Complex, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SV_Semaphore_Complex) - -void -ACE_SV_Semaphore_Complex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SV_Semaphore_Complex::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// initial value of process -const int ACE_SV_Semaphore_Complex::BIGCOUNT_ = 10000; - -// Define the ACE_SV_Semaphore operation arrays for the semop() calls. -sembuf ACE_SV_Semaphore_Complex::op_lock_[2] = -{ - {0, 0, 0}, // Wait for [0] (lock) to equal 0 - {0, 1, SEM_UNDO}, // then increment [0] to 1 - this locks it. - // UNDO to release the lock if processes exit - // before explicitly unlocking. -}; - -sembuf ACE_SV_Semaphore_Complex::op_endcreate_[2] = -{ - {1, -1, SEM_UNDO}, // Decrement [1] (proc counter) with undo on - // exit, UNDO to adjust proc counter if - // process exits before explicitly calling close() - {0, -1, SEM_UNDO}, // the decrement [0] (lock) back to 0 -}; - -sembuf ACE_SV_Semaphore_Complex::op_open_[1] = -{ - {1, -1, SEM_UNDO}, // Decrement [1] (proc counter) with undo on - // exit. -}; - -sembuf ACE_SV_Semaphore_Complex::op_close_[3] = -{ - {0, 0, 0}, // Wait for [0] (lock) to equal 0 - {0, 1, SEM_UNDO}, // then increment [0] to 1 - this lock it - {1, 1, SEM_UNDO}, // then increment [1] (proc counter) -}; - -sembuf ACE_SV_Semaphore_Complex::op_unlock_[1] = -{ - {0, -1, SEM_UNDO}, // Decrement [0] (lock) back to 0 -}; - -// Open or create an array of SV_Semaphores. We return 0 if all is OK, else -1. - -int -ACE_SV_Semaphore_Complex::open (key_t k, - short create, - int initial_value, - u_short nsems, - mode_t perms) -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::open"); - if (k == IPC_PRIVATE) - return -1; - - this->key_ = k; - - // Must include a count for the 2 additional semaphores we use - // internally. - this->sem_number_ = nsems + 2; - - if (create == ACE_SV_Semaphore_Complex::ACE_CREATE) - { - int result; - - do - { - this->internal_id_ = ACE_OS::semget - (this->key_, - (u_short) 2 + nsems, - perms | ACE_SV_Semaphore_Complex::ACE_CREATE); - - if (this->internal_id_ == -1) - return -1; // permission problem or tables full - - // When the is created, we know - // that the value of all 3 members is 0. Get a lock on the - // by waiting for [0] to equal 0, - // then increment it. - - // There is a race condition here. There is the possibility - // that between the above and the below, - // another process can call out function which can - // remove the if that process is the last - // one using it. Therefor we handle the error condition of - // an invalid ID specifically below, and - // if it does happen, we just go back and create it again. - result = ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_lock_[0], - 2); - } - while (result == -1 && (errno == EINVAL || errno == EIDRM)); - - if (result == -1) - return -1; - - // Get the value of the process counter. If it equals 0, then no - // one has initialized the ACE_SV_Semaphore yet. - - int semval = ACE_SV_Semaphore_Simple::control (GETVAL, 0, 1); - - if (semval == -1) - return this->init (); - else if (semval == 0) - { - // We should initialize by doing a SETALL, but that would - // clear the adjust value that we set when we locked the - // ACE_SV_Semaphore above. Instead we do system calls to - // initialize [1], as well as all the nsems SV_Semaphores. - - if (ACE_SV_Semaphore_Simple::control (SETVAL, - ACE_SV_Semaphore_Complex::BIGCOUNT_, - 1) == -1) - return -1; - else - for (u_short i = 0; i < nsems; i++) - if (this->control (SETVAL, initial_value, i) == -1) - return -1; - } - - // Decrement the process counter and then release the lock. - return ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_endcreate_[0], - 2); - } - else - { - this->internal_id_ = ACE_OS::semget (this->key_, 2 + nsems, 0); - if (this->internal_id_ == -1) - return -1; // doesn't exist or tables full - - // Decrement the process counter. We don't need a lock to do this. - if (ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_open_[0], 1) < 0) - return this->init (); - return 0; - } -} - -int -ACE_SV_Semaphore_Complex::open (const char *name, - short flags, - int initial_value, - u_short nsems, - mode_t perms) -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::open"); - return this->open (ACE_SV_Semaphore_Simple::name_2_key (name), - flags, initial_value, nsems, perms); -} - -// Close a ACE_SV_Semaphore. Unlike the remove above, this function -// is for a process to call before it exits, when it is done with the -// ACE_SV_Semaphore. We "decrement" the counter of processes using -// the ACE_SV_Semaphore, and if this was the last one, we can remove -// the ACE_SV_Semaphore. - -int -ACE_SV_Semaphore_Complex::close (void) -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::close"); - int semval; - - if (this->key_ == (key_t) - 1 || this->internal_id_ == -1) - return -1; - - // The following semop() first gets a lock on the ACE_SV_Semaphore, - // then increments [1] - the process number. - - if (ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_close_[0], - 3) == -1) - return -1; - - // Now that we have a lock, read the value of the process counter to - // see if this is the last reference to the ACE_SV_Semaphore. There - // is a race condition here - see the comments in create (). - - if ((semval = ACE_SV_Semaphore_Simple::control (GETVAL, 0, 1)) == -1) - return -1; - - if (semval > ACE_SV_Semaphore_Complex::BIGCOUNT_) - return -1; - else if (semval == ACE_SV_Semaphore_Complex::BIGCOUNT_) - return this->remove (); - else - { - int result = ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_unlock_[0], 1); - this->init (); - return result; - } -} - -ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (key_t k, - short flags, - int initial_value, - u_short nsems, - mode_t perms) -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex"); - if (this->open (k, flags, initial_value, nsems, perms) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_SV_Semaphore_Complex"))); -} - -ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (const char *name, - short flags, - int initial_value, - u_short nsems, - mode_t perms) -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex"); - - key_t key; - - if (name == 0) - key = ACE_DEFAULT_SEM_KEY; - else - key = this->name_2_key (name); - - if (this->open (key, flags, initial_value, nsems, perms) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_SV_Semaphore_Complex"))); -} - -ACE_SV_Semaphore_Complex::~ACE_SV_Semaphore_Complex (void) -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::~ACE_SV_Semaphore_Complex"); - if (this->internal_id_ >= 0) - this->close (); -} - -ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (void) -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex"); - this->init (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Semaphore_Complex.h b/ace/SV_Semaphore_Complex.h deleted file mode 100644 index de48fc09359..00000000000 --- a/ace/SV_Semaphore_Complex.h +++ /dev/null @@ -1,159 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SV_Semaphore_Complex.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SV_SEMAPHORE_COMPLEX_H -#define ACE_SV_SEMAPHORE_COMPLEX_H -#include /**/ "ace/pre.h" - -#include "ace/SV_Semaphore_Simple.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SV_Semaphore_Complex - * - * @brief This is a more complex semaphore wrapper that handles race - * conditions for initialization correctly... - * - * This code is a port to C++, inspired by: W. Richard Stevens - * from his book: UNIX Network Programming (Prentice Hall, ISBN - * 0-13-949876-1 - 1990). We provide a simpler and easier to - * understand interface to the System V Semaphore system calls. - * We create and use a 2 + n-member set for the requested - * . The first member, [0], is a - * counter used to know when all processes have finished with - * the . The counter is initialized - * to a large number, decremented on every create or open and - * incremented on every close. This way we can use the "adjust" - * feature provided by System V so that any process that exit's - * without calling is accounted for. It doesn't help us - * if the last process does this (as we have no way of getting - * control to remove the ) but it - * will work if any process other than the last does an exit - * (intentional or unintentional). - * The second member, [1], of the semaphore is used as a lock - * variable to avoid any race conditions in the and - * functions. - * The members beyond [1] are actual semaphore values in the - * array of semaphores, which may be sized by the user in the - * constructor. - */ -class ACE_Export ACE_SV_Semaphore_Complex : private ACE_SV_Semaphore_Simple -{ -public: - enum - { - ACE_CREATE = IPC_CREAT, - ACE_OPEN = 0 - }; - - // = Initialization and termination methods. - ACE_SV_Semaphore_Complex (void); - ACE_SV_Semaphore_Complex (key_t key, - short create = ACE_SV_Semaphore_Complex::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); - ACE_SV_Semaphore_Complex (const char *name, - short create = ACE_SV_Semaphore_Complex::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); - ~ACE_SV_Semaphore_Complex (void); - - /// Open or create an array of SV_Semaphores. We return 0 if all is - /// OK, else -1. - int open (const char *name, - short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); - - /// Open or create an array of SV_Semaphores. We return 0 if all is - /// OK, else -1. - int open (key_t key, - short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); - - /** - * Close an ACE_SV_Semaphore. Unlike the method, this - * method is for a process to call before it exits, when it is done - * with the ACE_SV_Semaphore. We "decrement" the counter of - * processes using the ACE_SV_Semaphore, and if this was the last - * one, we can remove the ACE_SV_Semaphore. - */ - int close (void); - - // = Semaphore acquire and release methods. - - /// Acquire the semaphore. - int acquire (u_short n = 0, short flags = 0) const; - - /// Acquire a semaphore for reading. - int acquire_read (u_short n = 0, short flags = 0) const; - - /// Acquire a semaphore for writing - int acquire_write (u_short n = 0, short flags = 0) const; - - /// Try to acquire the semaphore. - int tryacquire (u_short n = 0, short flags = 0) const; - - /// Try to acquire the semaphore for reading. - int tryacquire_read (u_short n = 0, short flags = 0) const; - - /// Try to acquire the semaphore for writing. - int tryacquire_write (u_short n = 0, short flags = 0) const; - - /// Release the semaphore. - int release (u_short n = 0, short flags = 0) const; - - // = Semaphore operation methods. - int op (short val, u_short n = 0, short flags = 0) const; - int op (sembuf op_vec[], u_short n) const; - - // = Semaphore control methods. - int control (int cmd, semun arg, u_short n = 0) const; - int control (int cmd, int value = 0, u_short n = 0) const; - - // = Upgrade access control... - using ACE_SV_Semaphore_Simple::get_id; - using ACE_SV_Semaphore_Simple::remove; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - static const int BIGCOUNT_; - static sembuf op_lock_[2]; - static sembuf op_endcreate_[2]; - static sembuf op_open_[1]; - static sembuf op_close_[3]; - static sembuf op_unlock_[1]; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SV_Semaphore_Complex.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SV_SEMAPHORE_COMPLEX_H */ diff --git a/ace/SV_Semaphore_Complex.inl b/ace/SV_Semaphore_Complex.inl deleted file mode 100644 index 8b80748ebf5..00000000000 --- a/ace/SV_Semaphore_Complex.inl +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_SV_Semaphore_Complex::acquire (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::acquire"); - return ACE_SV_Semaphore_Simple::acquire ((u_short) n + 2, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::acquire_read (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::acquire_read"); - return this->acquire (n, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::acquire_write (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::acquire_write"); - return this->acquire (n, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::tryacquire (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::tryacquire"); - return ACE_SV_Semaphore_Simple::tryacquire ((u_short) n + 2, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::tryacquire_read (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::tryacquire_read"); - return this->tryacquire (n, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::tryacquire_write (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::tryacquire_write"); - return this->tryacquire (n, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::release (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::release"); - return ACE_SV_Semaphore_Simple::release ((u_short) n + 2, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::op (short val, u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::op"); - return ACE_SV_Semaphore_Simple::op (val, (u_short) n + 2, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::op (sembuf op_vec[], u_short n) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::op"); - return ACE_SV_Semaphore_Simple::op (op_vec, (u_short) n + 2); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::control (int cmd, semun arg, u_short n) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::control"); - return ACE_SV_Semaphore_Simple::control (cmd, arg, (u_short) n + 2); -} - -ACE_INLINE int -ACE_SV_Semaphore_Complex::control (int cmd, int value, u_short n) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Complex::control"); - return ACE_SV_Semaphore_Simple::control (cmd, value, (u_short) n + 2); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Semaphore_Simple.cpp b/ace/SV_Semaphore_Simple.cpp deleted file mode 100644 index 42fac9be0c7..00000000000 --- a/ace/SV_Semaphore_Simple.cpp +++ /dev/null @@ -1,237 +0,0 @@ -#include "ace/SV_Semaphore_Simple.h" -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/os_include/sys/os_sem.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SV_Semaphore_Simple.inl" -#endif /* !__ACE_INLINE__ */ - -ACE_RCSID (ace, - SV_Semaphore_Simple, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_SV_Semaphore_Simple) - -void -ACE_SV_Semaphore_Simple::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SV_Semaphore_Simple::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_SV_Semaphore_Simple::control (int cmd, - int value, - u_short semnum) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::control"); - if (this->internal_id_ == -1) - return -1; - else - { - semun semctl_arg; - - semctl_arg.val = value; - return ACE_OS::semctl (this->internal_id_, - semnum, - cmd, - semctl_arg); - } -} - -int -ACE_SV_Semaphore_Simple::init (key_t k, int i) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::init"); - this->key_ = k; - this->internal_id_ = i; - return 0; -} - -// General ACE_SV_Semaphore operation. Increment or decrement by a -// specific amount (positive or negative; amount can`t be zero). - -int -ACE_SV_Semaphore_Simple::op (short val, u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::op"); - sembuf op_op; - - op_op.sem_num = n; - op_op.sem_flg = flags; - - if (this->internal_id_ == -1) - return -1; - else if ((op_op.sem_op = val) == 0) - return -1; - else - return ACE_OS::semop (this->internal_id_, &op_op, 1); -} - -// Open or create one or more SV_Semaphores. We return 0 if all is -// OK, else -1. - -int -ACE_SV_Semaphore_Simple::open (key_t k, - short flags, - int initial_value, - u_short n, - mode_t perms) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::open"); - union semun ivalue; - - if (k == IPC_PRIVATE || k == static_cast (ACE_INVALID_SEM_KEY)) - return -1; - - ivalue.val = initial_value; - this->key_ = k; - this->sem_number_ = n; - - this->internal_id_ = ACE_OS::semget (this->key_, n, perms | flags); - - if (this->internal_id_ == -1) - return -1; - - if (ACE_BIT_ENABLED (flags, IPC_CREAT)) - for (int i = 0; i < n; i++) - if (ACE_OS::semctl (this->internal_id_, i, SETVAL, ivalue) == -1) - return -1; - - return 0; -} - -ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (key_t k, - short flags, - int initial_value, - u_short n, - mode_t perms) - : key_ (k) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple"); - if (this->open (k, flags, initial_value, n, perms) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_SV_Semaphore::ACE_SV_Semaphore"))); -} - -// Convert name to key. This function is used internally to create keys -// for the semaphores. -// -// The method for generating names is a 32 bit CRC, but still we -// measured close to collition ratio of nearly 0.1% for -// ACE::unique_name()-like strings. - -key_t -ACE_SV_Semaphore_Simple::name_2_key (const char *name) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::name_2_key"); - - if (name == 0) - { - errno = EINVAL; - return static_cast (ACE_INVALID_SEM_KEY); - } - - // Basically "hash" the values in the . This won't - // necessarily guarantee uniqueness of all keys. - // But (IMHO) CRC32 is good enough for most purposes (Carlos) -#if defined (ACE_WIN64) - // The cast below is legit... -# pragma warning(push) -# pragma warning(disable : 4312) -#endif /* ACE_WIN64 */ - return (key_t) ACE::crc32 (name); -#if defined (ACE_WIN64) -# pragma warning(pop) -#endif /* ACE_WIN64 */ -} - -// Open or create a ACE_SV_Semaphore. We return 1 if all is OK, else -// 0. - -int -ACE_SV_Semaphore_Simple::open (const char *name, - short flags, - int initial_value, - u_short n, - mode_t perms) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::open"); - - key_t key; - - if (name == 0) - key = ACE_DEFAULT_SEM_KEY; - else - key = this->name_2_key (name); - - return this->open (key, flags, initial_value, n, perms); -} - -ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const char *name, - short flags, - int initial_value, - u_short n, - mode_t perms) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple"); - if (this->open (name, - flags, - initial_value, - n, - perms) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple"))); -} - -#if defined (ACE_HAS_WCHAR) -ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name, - short flags, - int initial_value, - u_short nsems, - mode_t perms) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple(wchar_t)"); - if (this->open (ACE_Wide_To_Ascii (name).char_rep (), - flags, - initial_value, - nsems, - perms) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple"))); -} -#endif /* ACE_HAS_WCHAR */ - -ACE_SV_Semaphore_Simple::~ACE_SV_Semaphore_Simple (void) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::~ACE_SV_Semaphore_Simple"); - this->close (); -} - -ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (void) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple"); - this->init (); -} - -// Remove all SV_Semaphores associated with a particular key. This -// call is intended to be called from a server, for example, when it -// is being shut down, as we do an IPC_RMID on the ACE_SV_Semaphore, -// regardless of whether other processes may be using it or not. Most -// other processes should use close() below. - -int -ACE_SV_Semaphore_Simple::remove (void) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::remove"); - int result = this->control (IPC_RMID); - ((ACE_SV_Semaphore_Simple *) this)->init (); - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Semaphore_Simple.h b/ace/SV_Semaphore_Simple.h deleted file mode 100644 index cbfef320384..00000000000 --- a/ace/SV_Semaphore_Simple.h +++ /dev/null @@ -1,197 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file SV_Semaphore_Simple.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_SV_SEMAPHORE_SIMPLE_H -#define ACE_SV_SEMAPHORE_SIMPLE_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_stat.h" -#include "ace/os_include/sys/os_ipc.h" -#include "ace/os_include/sys/os_sem.h" -#include "ace/Default_Constants.h" - -#if defined (ACE_WIN32) - // Default semaphore key and mutex name -# if !defined (ACE_DEFAULT_SEM_KEY) -# define ACE_DEFAULT_SEM_KEY "ACE_SEM_KEY" -# endif /* ACE_DEFAULT_SEM_KEY */ -#else /* !defined (ACE_WIN32) */ - // Default semaphore key -# if !defined (ACE_DEFAULT_SEM_KEY) -# define ACE_DEFAULT_SEM_KEY 1234 -# endif /* ACE_DEFAULT_SEM_KEY */ -#endif /* ACE_WIN32 */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SV_Semaphore_Simple - * - * @brief This is a simple semaphore package that assumes there are - * no race conditions for initialization (i.e., the order of - * process startup must be well defined). - */ -class ACE_Export ACE_SV_Semaphore_Simple -{ -public: - enum - { - ACE_CREATE = IPC_CREAT, - ACE_EXCL = IPC_EXCL, - ACE_OPEN = 0 - }; - - // = Initialization and termination methods. - ACE_SV_Semaphore_Simple (void); - ACE_SV_Semaphore_Simple (key_t key, - short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); - ACE_SV_Semaphore_Simple (const char *name, - short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); -#if defined (ACE_HAS_WCHAR) - ACE_SV_Semaphore_Simple (const wchar_t *name, - short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); -#endif /* ACE_HAS_WCHAR */ - - ~ACE_SV_Semaphore_Simple (void); - - int open (const char *name, - short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); - -#if defined (ACE_HAS_WCHAR) - int open (const wchar_t *name, - short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); -#endif /* ACE_HAS_WCHAR */ - - /// Open or create one or more SV_Semaphores. We return 0 if all is - /// OK, else -1. - int open (key_t key, - short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, - int initial_value = 1, - u_short nsems = 1, - mode_t perms = ACE_DEFAULT_FILE_PERMS); - - /// Close a ACE_SV_Semaphore, marking it as invalid for subsequent - /// operations... - int close (void); - - /** - * Remove all SV_Semaphores associated with a particular key. This - * call is intended to be called from a server, for example, when it - * is being shut down, as we do an IPC_RMID on the ACE_SV_Semaphore, - * regardless of whether other processes may be using it or not. - * Most other processes should use below. - */ - int remove (void) const; - - // = Semaphore acquire and release methods. - /** - * Wait until a ACE_SV_Semaphore's value is greater than 0, the - * decrement it by 1 and return. Dijkstra's P operation, Tannenbaums - * DOWN operation. - */ - int acquire (u_short n = 0, short flags = 0) const; - - /// Acquire a semaphore for reading. - int acquire_read (u_short n = 0, short flags = 0) const; - - /// Acquire a semaphore for writing - int acquire_write (u_short n = 0, short flags = 0) const; - - /// Non-blocking version of . - int tryacquire (u_short n = 0, short flags = 0) const; - - /// Try to acquire the semaphore for reading. - int tryacquire_read (u_short n = 0, short flags = 0) const; - - /// Try to acquire the semaphore for writing. - int tryacquire_write (u_short n = 0, short flags = 0) const; - - /// Increment ACE_SV_Semaphore by one. Dijkstra's V operation, - /// Tannenbaums UP operation. - int release (u_short n = 0, short flags = 0) const; - - // = Semaphore operation methods. - /// General ACE_SV_Semaphore operation. Increment or decrement by a - /// specific amount (positive or negative; amount can`t be zero). - int op (short val, u_short semnum = 0, short flags = SEM_UNDO) const; - - /// General ACE_SV_Semaphore operation on an array of SV_Semaphores. - int op (sembuf op_vec[], u_short nsems) const; - - // = Semaphore control methods. - int control (int cmd, semun arg, u_short n = 0) const; - int control (int cmd, int value = 0, u_short n = 0) const; - - /// Get underlying internal id. - int get_id (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Semaphore key. - key_t key_; - - /// Internal ID to identify the semaphore group within this process. - int internal_id_; - - /// Number of semaphores we're creating. - int sem_number_; - - /** - * Convert name to key This function is used internally to create - * keys for the semaphores. A valid name contains letters and - * digits only and MUST start with a letter. - * - * The method for generating names is not very sophisticated, so - * caller should not pass strings which match each other for the first - * LUSED characters when he wants to get a different key. - */ - int init (key_t k = static_cast (ACE_INVALID_SEM_KEY), - int i = -1); - key_t name_2_key (const char *name); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SV_Semaphore_Simple.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* _SV_SEMAPHORE_SIMPLE_H */ diff --git a/ace/SV_Semaphore_Simple.inl b/ace/SV_Semaphore_Simple.inl deleted file mode 100644 index 5dde75ffff6..00000000000 --- a/ace/SV_Semaphore_Simple.inl +++ /dev/null @@ -1,128 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Global_Macros.h" -#include "ace/OS_NS_Thread.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_HAS_WCHAR) -// Semaphores don't offer wide-char names, so convert the name and forward -// to the narrow-char open(). -ACE_INLINE int -ACE_SV_Semaphore_Simple::open (const wchar_t *name, - short flags, - int initial_value, - u_short nsems, - mode_t perms) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::open (wchar_t)"); - return this->open (ACE_Wide_To_Ascii (name).char_rep (), - flags, - initial_value, - nsems, - perms); -} -#endif /* ACE_HAS_WCHAR */ - -ACE_INLINE int -ACE_SV_Semaphore_Simple::control (int cmd, - semun arg, - u_short n) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::control"); - return this->internal_id_ == -1 ? - -1 : ACE_OS::semctl (this->internal_id_, n, cmd, arg); -} - -// Close a ACE_SV_Semaphore, marking it as invalid for subsequent -// operations... - -ACE_INLINE int -ACE_SV_Semaphore_Simple::close (void) -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::close"); - return this->init (); -} - -// General ACE_SV_Semaphore operation on an array of SV_Semaphores. - -ACE_INLINE int -ACE_SV_Semaphore_Simple::op (sembuf op_vec[], u_short n) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::op"); - return this->internal_id_ == -1 - ? -1 : ACE_OS::semop (this->internal_id_, op_vec, n); -} - -// Wait until a ACE_SV_Semaphore's value is greater than 0, the -// decrement it by 1 and return. Dijkstra's P operation, Tannenbaums -// DOWN operation. - -ACE_INLINE int -ACE_SV_Semaphore_Simple::acquire (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire"); - return this->op (-1, n, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Simple::acquire_read (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire_read"); - return this->acquire (n, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Simple::acquire_write (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire_write"); - return this->acquire (n, flags); -} - -// Non-blocking version of acquire(). - -ACE_INLINE int -ACE_SV_Semaphore_Simple::tryacquire (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire"); - return this->op (-1, n, flags | IPC_NOWAIT); -} - -// Non-blocking version of acquire(). - -ACE_INLINE int -ACE_SV_Semaphore_Simple::tryacquire_read (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire_read"); - return this->tryacquire (n, flags); -} - -// Non-blocking version of acquire(). - -ACE_INLINE int -ACE_SV_Semaphore_Simple::tryacquire_write (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire_write"); - return this->tryacquire (n, flags); -} - -// Increment ACE_SV_Semaphore by one. Dijkstra's V operation, -// Tannenbaums UP operation. - -ACE_INLINE int -ACE_SV_Semaphore_Simple::release (u_short n, short flags) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::release"); - return this->op (1, n, flags); -} - -ACE_INLINE int -ACE_SV_Semaphore_Simple::get_id (void) const -{ - ACE_TRACE ("ACE_SV_Semaphore_Simple::get_id"); - return this->internal_id_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Shared_Memory.cpp b/ace/SV_Shared_Memory.cpp deleted file mode 100644 index ab56249cbe6..00000000000 --- a/ace/SV_Shared_Memory.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// $Id$ - -#include "ace/SV_Shared_Memory.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/SV_Shared_Memory.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, SV_Shared_Memory, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_SV_Shared_Memory) - -void -ACE_SV_Shared_Memory::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_SV_Shared_Memory::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Creates a shared memory segment of SIZE bytes and *does* attach to -// this segment. - -int -ACE_SV_Shared_Memory::open_and_attach (key_t external_id, - size_t sz, - int create, - int perms, - void *virtual_addr, - int flags) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::open_and_attach"); - if (this->open (external_id, sz, create, perms) == -1) - return -1; - else if (this->attach (virtual_addr, flags) == -1) - return -1; - else - return 0; -} - -// Constructor interface to this->open_and_attach () member function. - -ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (key_t external_id, - size_t sz, - int create, - int perms, - void *virtual_addr, - int flags) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); - if (this->open_and_attach (external_id, sz, create, - perms, virtual_addr, flags) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"))); -} - -// The "do nothing" constructor. - -ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (void) - : internal_id_ (0), - size_ (0), - segment_ptr_ (0) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); -} - -// Added this constructor to accept an internal id, the one generated -// when a server constructs with the key IPC_PRIVATE. The client can -// be passed ACE_SV_Shared_Memory::internal_id via a socket and call -// this construtor to attach the existing segment. This prevents -// having to hard-code a key in advance. Courtesy of Marvin Wolfthal -// (maw@fsg.com). - -ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (ACE_HANDLE int_id, - int flags) - : internal_id_ (int_id), - size_ (0) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); - if (this->attach (0, flags) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Shared_Memory.h b/ace/SV_Shared_Memory.h deleted file mode 100644 index 4f4da514c45..00000000000 --- a/ace/SV_Shared_Memory.h +++ /dev/null @@ -1,122 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file SV_Shared_Memory.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_SV_SHARED_MEMORY_H -#define ACE_SV_SHARED_MEMORY_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_stat.h" -#include "ace/os_include/sys/os_ipc.h" -#include "ace/Default_Constants.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SV_Shared_Memory - * - * @brief This is a wrapper for System V shared memory. - */ -class ACE_Export ACE_SV_Shared_Memory -{ -public: - enum - { - ACE_CREATE = IPC_CREAT, - ACE_OPEN = 0 - }; - - // = Initialization and termination methods. - ACE_SV_Shared_Memory (void); - ACE_SV_Shared_Memory (key_t external_id, - size_t size, - int create, - int perms = ACE_DEFAULT_FILE_PERMS, - void *virtual_addr = 0, - int flags = 0); - - ACE_SV_Shared_Memory (ACE_HANDLE internal_id, - int flags = 0); - - int open (key_t external_id, - size_t size, - int create = ACE_SV_Shared_Memory::ACE_OPEN, - int perms = ACE_DEFAULT_FILE_PERMS); - - int open_and_attach (key_t external_id, - size_t size, - int create = ACE_SV_Shared_Memory::ACE_OPEN, - int perms = ACE_DEFAULT_FILE_PERMS, - void *virtual_addr = 0, - int flags = 0); - - /// Attach this shared memory segment. - int attach (void *virtual_addr = 0, - int flags =0); - - /// Detach this shared memory segment. - int detach (void); - - /// Remove this shared memory segment. - int remove (void); - - /// Forward to underlying System V . - int control (int cmd, void *buf); - - // = Segment-related info. - void *get_segment_ptr (void) const; - size_t get_segment_size (void) const; - - /// Return the ID of the shared memory segment (i.e., an ACE_HANDLE). - ACE_HANDLE get_id (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - enum - { - /// Most restrictive alignment. - ALIGN_WORDB = 8 - }; - - /// Internal identifier. - ACE_HANDLE internal_id_; - - /// Size of the mapped segment. - size_t size_; - - /// Pointer to the beginning of the segment. - void *segment_ptr_; - - /// Round up to an appropriate page size. - size_t round_up (size_t len); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/SV_Shared_Memory.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SV_SHARED_MEMORY_H */ diff --git a/ace/SV_Shared_Memory.inl b/ace/SV_Shared_Memory.inl deleted file mode 100644 index 3aaa41414e0..00000000000 --- a/ace/SV_Shared_Memory.inl +++ /dev/null @@ -1,119 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_sys_shm.h" -#include "ace/Global_Macros.h" -#include "ace/OS_NS_errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE size_t -ACE_SV_Shared_Memory::round_up (size_t len) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::round_up"); - return (len + ACE_SV_Shared_Memory::ALIGN_WORDB - 1) & ~(ACE_SV_Shared_Memory::ALIGN_WORDB - 1); -} - -// Creates a shared memory segment of SIZE bytes. Does *not* attach -// this memory segment... - -ACE_INLINE int -ACE_SV_Shared_Memory::open (key_t external_id, size_t sz, int create, int perms) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::open"); -#if defined (ACE_WIN32) - ACE_UNUSED_ARG(perms); - ACE_UNUSED_ARG(create); - ACE_UNUSED_ARG(sz); - ACE_UNUSED_ARG(external_id); - ACE_NOTSUP_RETURN (-1); -#else - this->segment_ptr_ = 0; - this->size_ = sz; - - this->internal_id_ = ACE_OS::shmget (external_id, sz, create | perms); - - return this->internal_id_ == -1 ? -1 : 0; -#endif /* ACE_WIN32 */ -} - -// Attachs to the shared memory segment. - -ACE_INLINE int -ACE_SV_Shared_Memory::attach (void *virtual_addr, int flags) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::attach"); -#if defined (ACE_WIN32) - ACE_UNUSED_ARG(flags); - ACE_UNUSED_ARG(virtual_addr); - ACE_NOTSUP_RETURN (-1); -#else - this->segment_ptr_ = ACE_OS::shmat (this->internal_id_, virtual_addr, flags); - return this->segment_ptr_ == (void *) -1 ? -1 : 0; -#endif /* ACE_WIN32 */ -} - -// Interface to the underlying shared memory control function. - -ACE_INLINE int -ACE_SV_Shared_Memory::control (int cmd, void *buf) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::control"); -#if defined (ACE_WIN32) - ACE_UNUSED_ARG(cmd); - ACE_UNUSED_ARG(buf); - - ACE_NOTSUP_RETURN (-1); -#else - return ACE_OS::shmctl (this->internal_id_, cmd, (struct shmid_ds *) buf); -#endif /* ACE_WIN32 */ -} - -// The overall size of the segment. - -ACE_INLINE size_t -ACE_SV_Shared_Memory::get_segment_size (void) const -{ - ACE_TRACE ("ACE_SV_Shared_Memory::get_segment_size"); - return this->size_; -} - -// Removes the shared memory segment. - -ACE_INLINE int -ACE_SV_Shared_Memory::remove (void) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::remove"); -#if defined (ACE_WIN32) - ACE_NOTSUP_RETURN (-1); -#else - return ACE_OS::shmctl (this->internal_id_, IPC_RMID, 0); -#endif /* ACE_WIN32 */ -} - -// Detach the current binding between this->segment_ptr and the shared -// memory segment. - -ACE_INLINE int -ACE_SV_Shared_Memory::detach (void) -{ - ACE_TRACE ("ACE_SV_Shared_Memory::detach"); - return ACE_OS::shmdt (this->segment_ptr_); -} - -ACE_INLINE void * -ACE_SV_Shared_Memory::get_segment_ptr (void) const -{ - ACE_TRACE ("ACE_SV_Shared_Memory::get_segment_ptr"); - return this->segment_ptr_; -} - -ACE_INLINE ACE_HANDLE -ACE_SV_Shared_Memory::get_id (void) const -{ - ACE_TRACE ("ACE_SV_Shared_Memory::get_id"); - return this->internal_id_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sample_History.cpp b/ace/Sample_History.cpp deleted file mode 100644 index ffa138571d0..00000000000 --- a/ace/Sample_History.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// $Id$ - -#include "ace/Sample_History.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Sample_History.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Basic_Stats.h" -#include "ace/Log_Msg.h" -#include "ace/OS_Memory.h" - -ACE_RCSID(ace, Sample_History, "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Sample_History::ACE_Sample_History (size_t max_samples) - : max_samples_ (max_samples) - , sample_count_ (0) -{ - ACE_NEW(this->samples_, ACE_UINT64[this->max_samples_]); -} - -ACE_Sample_History::~ACE_Sample_History (void) -{ - delete[] this->samples_; -} - -size_t -ACE_Sample_History::max_samples (void) const -{ - return this->max_samples_; -} - -size_t -ACE_Sample_History::sample_count (void) const -{ - return this->sample_count_; -} - -void -ACE_Sample_History::dump_samples (const ACE_TCHAR *msg, - ACE_UINT32 scale_factor) const -{ -#ifndef ACE_NLOGGING - for (size_t i = 0; i != this->sample_count_; ++i) - { - const ACE_UINT64 x = this->samples_[i] / scale_factor; - const ACE_UINT32 val = ACE_CU64_TO_CU32 (x); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("%s: %d %u\n"), msg, i, val)); - } -#endif /* ACE_NLOGGING */ -} - -void -ACE_Sample_History::collect_basic_stats (ACE_Basic_Stats &stats) const -{ - for (size_t i = 0; i != this->sample_count_; ++i) - { - stats.sample (this->samples_[i]); - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sample_History.h b/ace/Sample_History.h deleted file mode 100644 index 0ab521dac66..00000000000 --- a/ace/Sample_History.h +++ /dev/null @@ -1,91 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Sample_History.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ -//============================================================================= - - -#ifndef ACE_SAMPLE_HISTORY_H -#define ACE_SAMPLE_HISTORY_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" -#include "ace/Basic_Types.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Basic_Stats; - -/// Save multiple samples in an array -/** - * Save multiple samples (usually latency numbers), into an array, and - * later print them in several formats. - */ -class ACE_Export ACE_Sample_History -{ -public: - /// Constructor - /** - * The number of samples is pre-allocated, and cannot changes once - * the class is initialized. - */ - ACE_Sample_History (size_t max_samples); - - /// Destructor - ~ACE_Sample_History (void); - - /// Record one sample. - /** - * Return 0 on success, -1 if the sample could not be stored - */ - int sample (ACE_UINT64 value); - - /// Returns the maximum number of samples - size_t max_samples (void) const; - - /// Returns the current number of samples - size_t sample_count (void) const; - - /// Dump all the samples - /** - * Prints out all the samples, using @a msg as a prefix for each - * message. - */ - void dump_samples (const ACE_TCHAR *msg, - ACE_UINT32 scale_factor) const; - - /// Collect the summary for all the samples - void collect_basic_stats (ACE_Basic_Stats &) const; - - /// Get a sample - ACE_UINT64 get_sample (size_t i) const; - -private: - /// The maximum number of samples - size_t max_samples_; - - /// The current number of samples - size_t sample_count_; - - /// The samples - ACE_UINT64 *samples_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Sample_History.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SAMPLE_HISTORY_H */ diff --git a/ace/Sample_History.inl b/ace/Sample_History.inl deleted file mode 100644 index 42eca62e69b..00000000000 --- a/ace/Sample_History.inl +++ /dev/null @@ -1,26 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Sample_History::sample (ACE_UINT64 value) -{ - if (this->sample_count_ >= this->max_samples_) - return -1; - - this->samples_[this->sample_count_++] = value; - return 0; -} - -ACE_INLINE ACE_UINT64 -ACE_Sample_History::get_sample (size_t i) const -{ - if (this->sample_count_ <= i) - return 0; - - return this->samples_[i]; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sbrk_Memory_Pool.cpp b/ace/Sbrk_Memory_Pool.cpp deleted file mode 100644 index eda87a42c63..00000000000 --- a/ace/Sbrk_Memory_Pool.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// $Id$ - -#include "ace/OS_NS_unistd.h" -#include "ace/Sbrk_Memory_Pool.h" -#include "ace/Log_Msg.h" - -ACE_RCSID(ace, Sbrk_Memory_Pool, "$Id$") - -#if !defined (ACE_LACKS_SBRK) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Sbrk_Memory_Pool) - -// Ask system for more local memory via sbrk(2). - -void * -ACE_Sbrk_Memory_Pool::acquire (size_t nbytes, - size_t &rounded_bytes) -{ - ACE_TRACE ("ACE_Sbrk_Memory_Pool::acquire"); - rounded_bytes = this->round_up (nbytes); - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%P|%t) acquiring more chunks, nbytes = %d, rounded_bytes = %d\n"), nbytes, rounded_bytes)); - void *cp = ACE_OS::sbrk (rounded_bytes); - - if (cp == MAP_FAILED) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) cp = %u\n", - cp), - 0); - else - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%P|%t) acquired more chunks, nbytes = %d, rounded_bytes = %d, new break = %u\n"), nbytes, rounded_bytes, cp)); - return cp; -} - -/* No-op for now... */ - -int -ACE_Sbrk_Memory_Pool::release (int) -{ - ACE_TRACE ("ACE_Sbrk_Memory_Pool::release"); - return 0; -} - -int -ACE_Sbrk_Memory_Pool::sync (ssize_t, int) -{ - ACE_TRACE ("ACE_Sbrk_Memory_Pool::sync"); - return 0; -} - -int -ACE_Sbrk_Memory_Pool::sync (void *, size_t, int) -{ - ACE_TRACE ("ACE_Sbrk_Memory_Pool::sync"); - return 0; -} - -int -ACE_Sbrk_Memory_Pool::protect (ssize_t, int) -{ - ACE_TRACE ("ACE_Sbrk_Memory_Pool::protect"); - return 0; -} - -int -ACE_Sbrk_Memory_Pool::protect (void *, size_t, int) -{ - ACE_TRACE ("ACE_Sbrk_Memory_Pool::protect"); - return 0; -} - -// Ask system for initial chunk of local memory. - -void * -ACE_Sbrk_Memory_Pool::init_acquire (size_t nbytes, - size_t &rounded_bytes, - int &first_time) -{ - ACE_TRACE ("ACE_Sbrk_Memory_Pool::init_acquire"); - // Note that we assume that when ACE_Sbrk_Memory_Pool is used, - // ACE_Malloc's constructor will only get called once. If this - // assumption doesn't hold, we are in deep trouble! - - first_time = 1; - return this->acquire (nbytes, rounded_bytes); -} - -void -ACE_Sbrk_Memory_Pool::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Sbrk_Memory_Pool::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Sbrk_Memory_Pool::ACE_Sbrk_Memory_Pool (const ACE_TCHAR *, - const OPTIONS *) -{ - ACE_TRACE ("ACE_Sbrk_Memory_Pool::ACE_Sbrk_Memory_Pool"); -} - -ACE_Sbrk_Memory_Pool::~ACE_Sbrk_Memory_Pool (void) -{ -} - -void * -ACE_Sbrk_Memory_Pool::base_addr (void) const -{ - return 0; -} - -// Round up the request to a multiple of the page size. - -size_t -ACE_Sbrk_Memory_Pool::round_up (size_t nbytes) -{ - ACE_TRACE ("ACE_Sbrk_Memory_Pool::round_up"); - return ACE::round_to_pagesize (nbytes); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* !ACE_LACKS_SBRK */ diff --git a/ace/Sbrk_Memory_Pool.h b/ace/Sbrk_Memory_Pool.h deleted file mode 100644 index 092099e9e34..00000000000 --- a/ace/Sbrk_Memory_Pool.h +++ /dev/null @@ -1,118 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Sbrk_Memory_Pool.h - * - * $Id$ - * - * @author Dougls C. Schmidt - * @author Prashant Jain - */ -//============================================================================= - -#ifndef ACE_SBRK_MEMORY_POOL_H -#define ACE_SBRK_MEMORY_POOL_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_SBRK) - -#include "ace/ACE.h" -#include "ace/os_include/sys/os_mman.h" - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Sbrk_Memory_Pool_Options - * - * @brief Helper class for Sbrk Memory Pool constructor options. - * - * This should be a nested class, but that breaks too many - * compilers. - */ -class ACE_Export ACE_Sbrk_Memory_Pool_Options -{ -}; - -/** - * @class ACE_Sbrk_Memory_Pool - * - * @brief Make a memory pool that is based on . - */ -class ACE_Export ACE_Sbrk_Memory_Pool -{ -public: - typedef ACE_Sbrk_Memory_Pool_Options OPTIONS; - - /// Initialize the pool. - ACE_Sbrk_Memory_Pool (const ACE_TCHAR *backing_store_name = 0, - const OPTIONS *options = 0); - - virtual ~ACE_Sbrk_Memory_Pool (void); - - // = Implementor operations. - /// Ask system for initial chunk of local memory. - virtual void *init_acquire (size_t nbytes, - size_t &rounded_bytes, - int &first_time); - - /// Acquire at least @a nbytes from the memory pool. @a rounded_bytes is - /// the actual number of bytes allocated. - virtual void *acquire (size_t nbytes, - size_t &rounded_bytes); - - /// Instruct the memory pool to release all of its resources. - virtual int release (int destroy = 1); - - /** - * Sync @a len bytes of the memory region to the backing store - * starting at @c this->base_addr_. If @a len == -1 then sync the - * whole region. - */ - virtual int sync (ssize_t len = -1, int flags = MS_SYNC); - - /// Sync @a len bytes of the memory region to the backing store - /// starting at @a addr. - virtual int sync (void *addr, size_t len, int flags = MS_SYNC); - - /** - * Change the protection of the pages of the mapped region to - * starting at @c this->base_addr_ up to @a len bytes. If @a len == -1 - * then change protection of all pages in the mapped region. - */ - virtual int protect (ssize_t len = -1, int prot = PROT_RDWR); - - /// Change the protection of the pages of the mapped region to @a prot - /// starting at @a addr up to @a len bytes. - virtual int protect (void *addr, size_t len, int prot = PROT_RDWR); - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Return the base address of this memory pool, 0 if base_addr - /// never changes. - virtual void *base_addr (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Implement the algorithm for rounding up the request to an - /// appropriate chunksize. - virtual size_t round_up (size_t nbytes); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* !ACE_LACKS_SBRK */ - -#include /**/ "ace/post.h" -#endif /* ACE_SBRK_MEMORY_POOL_H */ diff --git a/ace/Sched_Params.cpp b/ace/Sched_Params.cpp deleted file mode 100644 index 0f048b5b18d..00000000000 --- a/ace/Sched_Params.cpp +++ /dev/null @@ -1,330 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE -// -// = FILENAME -// Sched_Params.cpp -// -// = CREATION DATE -// 28 January 1997 -// -// = AUTHOR -// David Levine -// -// ============================================================================ - -#include "ace/Sched_Params.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Sched_Params.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_HAS_PRIOCNTL) && defined (ACE_HAS_STHREADS) -# include "ace/OS_NS_string.h" -# include /**/ -#endif /* ACE_HAS_PRIOCNTL && ACE_HAS_THREADS */ - -ACE_RCSID(ace, Sched_Params, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -int -ACE_Sched_Params::priority_min (const Policy policy, - const int scope) -{ -#if defined (ACE_HAS_PRIOCNTL) && defined (ACE_HAS_STHREADS) - ACE_UNUSED_ARG (scope); - - // Assume that ACE_SCHED_OTHER indicates TS class, and that other - // policies indicate RT class. - - // Call ACE_OS::priority_control only for processes (lightweight - // or otherwise). Calling ACE_OS::priority_control for thread - // priorities gives incorrect results. - if (scope == ACE_SCOPE_PROCESS || scope == ACE_SCOPE_LWP) - { - if (policy == ACE_SCHED_OTHER) - { - // Get the priority class ID and attributes. - pcinfo_t pcinfo; - // The following is just to avoid Purify warnings about unitialized - // memory reads. - ACE_OS::memset (&pcinfo, 0, sizeof pcinfo); - ACE_OS::strcpy (pcinfo.pc_clname, "TS"); - - if (ACE_OS::priority_control (P_ALL /* ignored */, - P_MYID /* ignored */, - PC_GETCID, - (char *) &pcinfo) == -1) - // Just hope that priority range wasn't configured from -1 - // .. 1 - return -1; - - // OK, now we've got the class ID in pcinfo.pc_cid. In - // addition, the maximum configured time-share priority is in - // ((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri. The minimum - // priority is just the negative of that. - - return -((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri; - } - else - return 0; - } - else - { - // Here we handle the case for ACE_SCOPE_THREAD. Calling - // ACE_OS::priority_control for thread scope gives incorrect - // results. - switch (policy) - { - case ACE_SCHED_FIFO: - return ACE_THR_PRI_FIFO_MIN; - case ACE_SCHED_RR: - return ACE_THR_PRI_RR_MIN; - case ACE_SCHED_OTHER: - default: - return ACE_THR_PRI_OTHER_MIN; - } - } -#elif defined(ACE_HAS_PTHREADS) && \ - (!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ - defined (ACE_HAS_PTHREAD_SCHEDPARAM)) - - switch (scope) - { - case ACE_SCOPE_THREAD: - switch (policy) - { - case ACE_SCHED_FIFO: - return ACE_THR_PRI_FIFO_MIN; - case ACE_SCHED_RR: - return ACE_THR_PRI_RR_MIN; - case ACE_SCHED_OTHER: - default: - return ACE_THR_PRI_OTHER_MIN; - } - - case ACE_SCOPE_PROCESS: - default: - switch (policy) - { - case ACE_SCHED_FIFO: - return ACE_PROC_PRI_FIFO_MIN; - case ACE_SCHED_RR: - return ACE_PROC_PRI_RR_MIN; - case ACE_SCHED_OTHER: - default: - return ACE_PROC_PRI_OTHER_MIN; - } - } - -#elif defined (ACE_HAS_WTHREADS) - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - return THREAD_PRIORITY_IDLE; -#elif defined (ACE_VXWORKS) - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - return 255; -#else - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_PRIOCNTL && defined (ACE_HAS_STHREADS) */ -} - -int -ACE_Sched_Params::priority_max (const Policy policy, - const int scope) -{ -#if defined (ACE_HAS_PRIOCNTL) && defined (ACE_HAS_STHREADS) - ACE_UNUSED_ARG (scope); - - // Call ACE_OS::priority_control only for processes (lightweight - // or otherwise). Calling ACE_OS::priority_control for thread - // priorities gives incorrect results. - if (scope == ACE_SCOPE_PROCESS || scope == ACE_SCOPE_LWP) - { - // Assume that ACE_SCHED_OTHER indicates TS class, and that other - // policies indicate RT class. - - // Get the priority class ID and attributes. - pcinfo_t pcinfo; - // The following is just to avoid Purify warnings about unitialized - // memory reads. - ACE_OS::memset (&pcinfo, 0, sizeof pcinfo); - ACE_OS::strcpy (pcinfo.pc_clname, - policy == ACE_SCHED_OTHER ? "TS" : "RT"); - - if (ACE_OS::priority_control (P_ALL /* ignored */, - P_MYID /* ignored */, - PC_GETCID, - (char *) &pcinfo) == -1) - return -1; - - // OK, now we've got the class ID in pcinfo.pc_cid. In addition, - // the maximum configured real-time priority is in ((rtinfo_t *) - // pcinfo.pc_clinfo)->rt_maxpri, or similarly for the TS class. - - return policy == ACE_SCHED_OTHER - ? ((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri - : ((rtinfo_t *) pcinfo.pc_clinfo)->rt_maxpri; - } - else - { - // Here we handle the case for ACE_SCOPE_THREAD. Calling - // ACE_OS::priority_control for thread scope gives incorrect - // results. - switch (policy) - { - case ACE_SCHED_FIFO: - return ACE_THR_PRI_FIFO_MAX; - case ACE_SCHED_RR: - return ACE_THR_PRI_RR_MAX; - case ACE_SCHED_OTHER: - default: - return ACE_THR_PRI_OTHER_MAX; - } - } -#elif defined(ACE_HAS_PTHREADS) && \ - (!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ - defined (ACE_HAS_PTHREAD_SCHEDPARAM)) - - switch (scope) - { - case ACE_SCOPE_THREAD: - switch (policy) - { - case ACE_SCHED_FIFO: - return ACE_THR_PRI_FIFO_MAX; - case ACE_SCHED_RR: - return ACE_THR_PRI_RR_MAX; - case ACE_SCHED_OTHER: - default: - return ACE_THR_PRI_OTHER_MAX; - } - - case ACE_SCOPE_PROCESS: - default: - switch (policy) - { - case ACE_SCHED_FIFO: - return ACE_PROC_PRI_FIFO_MAX; - case ACE_SCHED_RR: - return ACE_PROC_PRI_RR_MAX; - case ACE_SCHED_OTHER: - default: - return ACE_PROC_PRI_OTHER_MAX; - } - } - -#elif defined (ACE_HAS_WTHREADS) - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - return THREAD_PRIORITY_TIME_CRITICAL; -#elif defined (ACE_VXWORKS) - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - return 0; -#else - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_PRIOCNTL && defined (ACE_HAS_STHREADS) */ -} - -int -ACE_Sched_Params::next_priority (const Policy policy, - const int priority, - const int scope) -{ -#if defined (ACE_VXWORKS) - return priority > priority_max (policy, scope) - ? priority - 1 - : priority_max (policy, scope); -#elif defined (ACE_HAS_WTHREADS) - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - switch (priority) - { - case THREAD_PRIORITY_IDLE: - return THREAD_PRIORITY_LOWEST; - case THREAD_PRIORITY_LOWEST: - return THREAD_PRIORITY_BELOW_NORMAL; - case THREAD_PRIORITY_BELOW_NORMAL: - return THREAD_PRIORITY_NORMAL; - case THREAD_PRIORITY_NORMAL: - return THREAD_PRIORITY_ABOVE_NORMAL; - case THREAD_PRIORITY_ABOVE_NORMAL: - return THREAD_PRIORITY_HIGHEST; - case THREAD_PRIORITY_HIGHEST: - return THREAD_PRIORITY_TIME_CRITICAL; - case THREAD_PRIORITY_TIME_CRITICAL: - return THREAD_PRIORITY_TIME_CRITICAL; - default: - return priority; // unknown priority: should never get here - } -#elif defined(ACE_HAS_THREADS) && \ - (!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ - defined (ACE_HAS_PTHREAD_SCHEDPARAM)) - // including STHREADS, and PTHREADS - const int max = priority_max (policy, scope); - return priority < max ? priority + 1 : max; -#else - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - ACE_UNUSED_ARG (priority); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ -} - -int -ACE_Sched_Params::previous_priority (const Policy policy, - const int priority, - const int scope) -{ -#if defined (ACE_VXWORKS) - return priority < priority_min (policy, scope) - ? priority + 1 - : priority_min (policy, scope); -#elif defined (ACE_HAS_WTHREADS) - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - switch (priority) - { - case THREAD_PRIORITY_IDLE: - return THREAD_PRIORITY_IDLE; - case THREAD_PRIORITY_LOWEST: - return THREAD_PRIORITY_IDLE; - case THREAD_PRIORITY_BELOW_NORMAL: - return THREAD_PRIORITY_LOWEST; - case THREAD_PRIORITY_NORMAL: - return THREAD_PRIORITY_BELOW_NORMAL; - case THREAD_PRIORITY_ABOVE_NORMAL: - return THREAD_PRIORITY_NORMAL; - case THREAD_PRIORITY_HIGHEST: - return THREAD_PRIORITY_ABOVE_NORMAL; - case THREAD_PRIORITY_TIME_CRITICAL: - return THREAD_PRIORITY_HIGHEST; - default: - return priority; // unknown priority: should never get here - } -#elif defined(ACE_HAS_THREADS) && \ - (!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ - defined (ACE_HAS_PTHREAD_SCHEDPARAM)) - // including STHREADS and PTHREADS - const int min = priority_min (policy, scope); - - return priority > min ? priority - 1 : min; -#else - ACE_UNUSED_ARG (policy); - ACE_UNUSED_ARG (scope); - ACE_UNUSED_ARG (priority); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sched_Params.h b/ace/Sched_Params.h deleted file mode 100644 index 76603c8a21a..00000000000 --- a/ace/Sched_Params.h +++ /dev/null @@ -1,232 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Sched_Params.h - * - * $Id$ - * - * @author David Levine - * @author Carlos O'Ryan - */ -//============================================================================= - -#ifndef ACE_SCHED_PARAMS_H -#define ACE_SCHED_PARAMS_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Time_Value.h" -#include "ace/OS_NS_Thread.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Sched_Params - * - * @brief Container for scheduling-related parameters. - * - * ACE_Sched_Params are passed via to the - * OS to specify scheduling parameters. These parameters include - * scheduling policy, such as FIFO (ACE_SCHED_FIFO), round-robin - * (ACE_SCHED_RR), or an implementation-defined "OTHER" - * (ACE_SCHED_OTHER), to which many systems default; priority; - * and a time-slice quantum for round-robin scheduling. A - * "scope" parameter specifies whether the ACE_Sched_Params - * applies to the current process, current lightweight process - * (LWP) (on Solaris), or current thread. Please see the "NOTE" - * below about not all combinations of parameters being legal on - * a particular platform. - * For the case of thread priorities, it is intended that - * usually be called from
before - * any threads have been spawned. If spawned threads inherit - * their parent's priority (I think that's the default behavior - * for all of our platforms), then this sets the default base - * priority. Individual thread priorities can be adjusted as - * usual using or via the ACE_Thread - * interface. See the parameter descriptions in the private: - * section below. - * @note This class does not do any checking of parameters. It - * is just a container class. If it is constructed with values - * that are not supported on a platform, the call to - * will fail by returning -1 with EINVAL - * (available through ). - */ -class ACE_Export ACE_Sched_Params -{ - // NOTE: Solaris 2.5.x threads in the RT class must set the - // priority of their LWP. The only way to do that through ACE is - // for the RT thread itself to call with - // it's own priority. - - // OS Scheduling parameters are complicated and often confusing. - // Many thanks to Thilo Kielmann - // for his careful review of - // this class design, thoughtful comments, and assistance with - // implementation, especially for PTHREADS platforms. Please - // send any comments or corrections to the ACE developers. -public: - typedef int Policy; - - // = Initialization and termination methods. - /// Constructor. - ACE_Sched_Params (const Policy policy, - const ACE_Sched_Priority priority, - const int scope = ACE_SCOPE_THREAD, - const ACE_Time_Value &quantum = ACE_Time_Value::zero); - - /// Termination. - ~ACE_Sched_Params (void); - - // = Get/Set methods: - - // = Get/Set policy - Policy policy (void) const; - void policy (const Policy); - - // = Get/Set priority. - ACE_Sched_Priority priority (void) const; - void priority (const ACE_Sched_Priority); - - // = Get/Set scope. - int scope (void) const; - void scope(const int); - - // = Get/Set quantum. - const ACE_Time_Value &quantum (void) const; - void quantum (const ACE_Time_Value &); - - // = Accessors for OS-specific priorities. - // These return priority values for ACE_SCHED_OTHER if the Policy value - // is invalid. - static int priority_min (const Policy, - const int scope = ACE_SCOPE_THREAD); - static int priority_max (const Policy, - const int scope = ACE_SCOPE_THREAD); - - /** - * The next higher priority. "Higher" refers to scheduling priority, - * not to the priority value itself. (On some platforms, higher scheduling - * priority is indicated by a lower priority value.) If "priority" is - * already the highest priority (for the specified policy), then it is - * returned. - */ - static int next_priority (const Policy, - const int priority, - const int scope = ACE_SCOPE_THREAD); - - /** - * The previous, lower priority. "Lower" refers to scheduling priority, - * not to the priority value itself. (On some platforms, lower scheduling - * priority is indicated by a higher priority value.) If "priority" is - * already the lowest priority (for the specified policy), then it is - * returned. - */ - static int previous_priority (const Policy, - const int priority, - const int scope = ACE_SCOPE_THREAD); - -private: - /// Scheduling policy. - Policy policy_; - - /// Default : for setting the priority for the process, LWP, - /// or thread, as indicated by the scope_ parameter. - ACE_Sched_Priority priority_; - - /** - * must be one of the following: - * ACE_SCOPE_PROCESS: sets the scheduling policy for the - * process, and the process priority. On some platforms, - * such as Win32, the scheduling policy can _only_ be - * set at process scope. - * ACE_SCOPE_LWP: lightweight process scope, only used with - * Solaris threads. - * ACE_SCOPE_THREAD: sets the scheduling policy for the thread, - * if the OS supports it, such as with Posix threads, and the - * thread priority. - * NOTE: I don't think that these are the same as POSIX - * contention scope. POSIX users who are interested in, - * and understand, contention scope will have to set it - * by using system calls outside of ACE. - */ - int scope_; - - /** - * The is for time slicing. An ACE_Time_Value of 0 has - * special significance: it means time-slicing is disabled; with - * that, a thread that is running on a CPU will continue to run - * until it blocks or is preempted. Currently ignored if the OS - * doesn't directly support time slicing, such as on VxWorks, or - * setting the quantum (can that be done on Win32?). - */ - ACE_Time_Value quantum_; -}; - -/** - * @class ACE_Sched_Priority_Iterator - * - * @brief An iterator over the OS-defined scheduling priorities. - * - * The order of priorities (numeric value vs. importance) is OS - * dependant, it can be the case that the priorities are not even - * contigous. This class permits iteration over priorities using - * the iterator pattern. - */ -class ACE_Export ACE_Sched_Priority_Iterator -{ -public: - /// Initialize the iterator, the arguments define the scheduling - /// policy and scope for the priorities (see ACE_Sched_Param). - ACE_Sched_Priority_Iterator (const ACE_Sched_Params::Policy &policy, - int scope = ACE_SCOPE_THREAD); - - /// Default dtor. - ~ACE_Sched_Priority_Iterator (void); - - /// Check if there are more priorities. - int more (void) const; - - /// Return the current priority. - int priority (void) const; - - /// Move to the next priority. - /// The iteration is from lowest to highest importance. - void next (void); - - /// Accessor for the scheduling policy over which we are iterating. - const ACE_Sched_Params::Policy &policy (void) const; - - /// Accessor for the scheduling - int scope (void) const; - -private: - /// The Scheduling policy (FIFO, RR, etc.) and scheduling scope - /// (PROCESS, SYSTEM) we are iterating on. - ACE_Sched_Params::Policy policy_; - int scope_; - - /// The current priority. - int priority_; - - /** - * This is set to 1 when there are no more priorities. Cannot easily - * compare against the highest priority on platforms were priorities - * are non-contigous or descending. - */ - int done_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Sched_Params.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_SCHED_PARAMS_H */ diff --git a/ace/Sched_Params.inl b/ace/Sched_Params.inl deleted file mode 100644 index 2917acc691d..00000000000 --- a/ace/Sched_Params.inl +++ /dev/null @@ -1,141 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE -// -// = FILENAME -// Sched_Params.i -// -// = CREATION DATE -// 28 January 1997 -// -// = AUTHOR -// David Levine -// -// ============================================================================ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Sched_Params::ACE_Sched_Params ( - const Policy policy, - const ACE_Sched_Priority priority, - const int scope, - const ACE_Time_Value &quantum) - : policy_ (policy), - priority_ (priority), - scope_ (scope), - quantum_ (quantum) -{ -} - -ACE_INLINE ACE_Sched_Params::~ACE_Sched_Params (void) -{ -} - -ACE_INLINE ACE_Sched_Params::Policy -ACE_Sched_Params::policy (void) const -{ - return this->policy_; -} - -ACE_INLINE void -ACE_Sched_Params::policy (const ACE_Sched_Params::Policy policy) -{ - this->policy_ = policy; -} - -ACE_INLINE ACE_Sched_Priority -ACE_Sched_Params::priority (void) const -{ - return this->priority_; -} - -ACE_INLINE void -ACE_Sched_Params::priority (const ACE_Sched_Priority priority) -{ - this->priority_ = priority; -} - -ACE_INLINE int -ACE_Sched_Params::scope (void) const -{ - return this->scope_; -} - -ACE_INLINE void -ACE_Sched_Params::scope (const int scope) -{ - this->scope_ = scope; -} - -ACE_INLINE const ACE_Time_Value & -ACE_Sched_Params::quantum (void) const -{ - return this->quantum_; -} - -ACE_INLINE void -ACE_Sched_Params::quantum (const ACE_Time_Value &quant) -{ - this->quantum_ = quant; -} - -ACE_INLINE const ACE_Sched_Params::Policy & -ACE_Sched_Priority_Iterator::policy (void) const -{ - return this->policy_; -} - -ACE_INLINE int -ACE_Sched_Priority_Iterator::scope (void) const -{ - return this->scope_; -} - -ACE_INLINE -ACE_Sched_Priority_Iterator::ACE_Sched_Priority_Iterator (const ACE_Sched_Params::Policy &policy, - int scope) - : policy_ (policy), - scope_ (scope), - priority_ (0), - done_ (0) -{ - priority_ = ACE_Sched_Params::priority_min (this->policy (), this->scope ()); -} - -ACE_INLINE -ACE_Sched_Priority_Iterator::~ACE_Sched_Priority_Iterator (void) -{ -} - -ACE_INLINE int -ACE_Sched_Priority_Iterator::more (void) const -{ - return !this->done_; -} - -ACE_INLINE int -ACE_Sched_Priority_Iterator::priority (void) const -{ - return this->priority_; -} - -ACE_INLINE void -ACE_Sched_Priority_Iterator::next (void) -{ - if (this->done_) - return; - - int old_priority = this->priority_; - priority_ = ACE_Sched_Params::next_priority (this->policy (), - this->priority (), - this->scope ()); - this->done_ = old_priority == priority_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Select_Reactor.h b/ace/Select_Reactor.h deleted file mode 100644 index 8e7b1697ce3..00000000000 --- a/ace/Select_Reactor.h +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Select_Reactor.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SELECT_REACTOR_H -#define ACE_SELECT_REACTOR_H -#include /**/ "ace/pre.h" - -#include "ace/Select_Reactor_T.h" -#include "ace/Reactor_Token_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -//@@ TAO_REACTOR_SPL_COMMENT_HOOK_START -typedef ACE_Reactor_Token_T ACE_Select_Reactor_Token; - -typedef ACE_Select_Reactor_T ACE_Select_Reactor; -//@@ TAO_REACTOR_SPL_COMMENT_HOOK_END - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE == 0) -/** - * @class ACE_Guard< ACE_Reactor_Token_T > - * - * @brief Template specialization of ACE_Guard for the - * ACE_Null_Mutex. - * - * This specialization is useful since it helps to speedup - * performance of the "Null_Mutex" considerably. - */ -template<> -class ACE_Export ACE_Guard< ACE_Reactor_Token_T > -{ -public: - // = Initialization and termination methods. - ACE_Guard (ACE_Reactor_Token_T &) {} - ACE_Guard (ACE_Reactor_Token_T &, int) {} - ~ACE_Guard (void) {} - - int acquire (void) { return 0; } - int tryacquire (void) { return 0; } - int release (void) { return 0; } - int locked (void) { return 1; } - int remove (void) { return 0; } - void dump (void) const {} - -private: - // Disallow copying and assignment. - ACE_Guard (const ACE_Guard< ACE_Reactor_Token_T > &); - void operator= (const ACE_Guard< ACE_Reactor_Token_T > &); - -}; -#endif /* ACE_MT_SAFE && ACE_MT_SAFE == 0 */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_SELECT_REACTOR_H */ diff --git a/ace/Select_Reactor_Base.cpp b/ace/Select_Reactor_Base.cpp deleted file mode 100644 index 75f3efb2d19..00000000000 --- a/ace/Select_Reactor_Base.cpp +++ /dev/null @@ -1,1259 +0,0 @@ -// $Id$ - -#include "ace/Select_Reactor_Base.h" -#include "ace/Reactor.h" -#include "ace/Thread.h" -#include "ace/SOCK_Acceptor.h" -#include "ace/SOCK_Connector.h" -#include "ace/Timer_Queue.h" -#include "ace/Log_Msg.h" -#include "ace/Signal.h" -#include "ace/OS_NS_fcntl.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Select_Reactor_Base.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - Select_Reactor_Base, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_WIN32) -#define ACE_SELECT_REACTOR_HANDLE(H) (this->event_handlers_[(H)].handle_) -#define ACE_SELECT_REACTOR_EVENT_HANDLER(THIS,H) ((THIS)->event_handlers_[(H)].event_handler_) -#else -#define ACE_SELECT_REACTOR_HANDLE(H) (H) -#define ACE_SELECT_REACTOR_EVENT_HANDLER(THIS,H) ((THIS)->event_handlers_[(H)]) -#endif /* ACE_WIN32 */ - -// Performs sanity checking on the ACE_HANDLE. - -int -ACE_Select_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::invalid_handle"); -#if defined (ACE_WIN32) - // It's too expensive to perform more exhaustive validity checks on - // Win32 due to the way that they implement SOCKET HANDLEs. - if (handle == ACE_INVALID_HANDLE) -#else /* !ACE_WIN32 */ - if (handle < 0 || handle >= this->max_size_) -#endif /* ACE_WIN32 */ - { - errno = EINVAL; - return 1; - } - else - return 0; -} - -// Performs sanity checking on the ACE_HANDLE. - -int -ACE_Select_Reactor_Handler_Repository::handle_in_range (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::handle_in_range"); -#if defined (ACE_WIN32) - // It's too expensive to perform more exhaustive validity checks on - // Win32 due to the way that they implement SOCKET HANDLEs. - if (handle != ACE_INVALID_HANDLE) -#else /* !ACE_WIN32 */ - if (handle >= 0 && handle < this->max_handlep1_) -#endif /* ACE_WIN32 */ - return 1; - else - { - errno = EINVAL; - return 0; - } -} - -size_t -ACE_Select_Reactor_Handler_Repository::max_handlep1 (void) -{ - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::max_handlep1"); - - return this->max_handlep1_; -} - -int -ACE_Select_Reactor_Handler_Repository::open (size_t size) -{ - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::open"); - this->max_size_ = size; - this->max_handlep1_ = 0; - -#if defined (ACE_WIN32) - // Try to allocate the memory. - ACE_NEW_RETURN (this->event_handlers_, - ACE_Event_Tuple[size], - -1); - - // Initialize the ACE_Event_Handler * to { ACE_INVALID_HANDLE, 0 }. - for (size_t h = 0; h < size; ++h) - { - ACE_SELECT_REACTOR_HANDLE (h) = ACE_INVALID_HANDLE; - ACE_SELECT_REACTOR_EVENT_HANDLER (this, h) = 0; - } -#else - // Try to allocate the memory. - ACE_NEW_RETURN (this->event_handlers_, - ACE_Event_Handler *[size], - -1); - - // Initialize the ACE_Event_Handler * to NULL. - for (size_t h = 0; h < size; ++h) - ACE_SELECT_REACTOR_EVENT_HANDLER (this, h) = 0; -#endif /* ACE_WIN32 */ - - // Try to increase the number of handles if is greater than - // the current limit. - return ACE::set_handle_limit (static_cast (size), 1); -} - -// Initialize a repository of the appropriate . - -ACE_Select_Reactor_Handler_Repository::ACE_Select_Reactor_Handler_Repository (ACE_Select_Reactor_Impl &select_reactor) - : select_reactor_ (select_reactor), - max_size_ (0), - max_handlep1_ (0), - event_handlers_ (0) -{ - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::ACE_Select_Reactor_Handler_Repository"); -} - -int -ACE_Select_Reactor_Handler_Repository::unbind_all (void) -{ - // Unbind all of the s. - for (int slot = 0; - slot < this->max_handlep1_; - ++slot) - this->unbind (ACE_SELECT_REACTOR_HANDLE (slot), - ACE_Event_Handler::ALL_EVENTS_MASK); - - return 0; -} - -int -ACE_Select_Reactor_Handler_Repository::close (void) -{ - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::close"); - - if (this->event_handlers_ != 0) - { - this->unbind_all (); - - delete [] this->event_handlers_; - this->event_handlers_ = 0; - } - return 0; -} - -// Return the associated with the . - -ACE_Event_Handler * -ACE_Select_Reactor_Handler_Repository::find (ACE_HANDLE handle, - size_t *index_p) -{ - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::find"); - - ACE_Event_Handler *eh = 0; - ssize_t i; - - // Only bother to search for the if it's in range. - if (this->handle_in_range (handle)) - { -#if defined (ACE_WIN32) - i = 0; - - for (; i < this->max_handlep1_; ++i) - if (ACE_SELECT_REACTOR_HANDLE (i) == handle) - { - eh = ACE_SELECT_REACTOR_EVENT_HANDLER (this, i); - break; - } -#else - i = handle; - - eh = ACE_SELECT_REACTOR_EVENT_HANDLER (this, handle); -#endif /* ACE_WIN32 */ - } - else - // g++ can't figure out that won't be used below if the handle - // is out of range, so keep it happy by defining here . . . - i = 0; - - if (eh != 0) - { - if (index_p != 0) - *index_p = i; - } - else - errno = ENOENT; - - return eh; -} - -// Bind the to the . - -int -ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::bind"); - - if (handle == ACE_INVALID_HANDLE) - handle = event_handler->get_handle (); - - if (this->invalid_handle (handle)) - return -1; - - // Is this handle already in the Reactor? - int existing_handle = 0; - -#if defined (ACE_WIN32) - - ssize_t assigned_slot = -1; - - for (ssize_t i = 0; i < this->max_handlep1_; ++i) - { - // If handle is already registered. - if (ACE_SELECT_REACTOR_HANDLE (i) == handle) - { - // Cannot use a different handler for an existing handle. - if (ACE_SELECT_REACTOR_EVENT_HANDLER (this, i) != - event_handler) - return -1; - - // Remember location. - assigned_slot = i; - - // Remember that this handle is already registered in the - // Reactor. - existing_handle = 1; - - // We can stop looking now. - break; - } - else - // Here's the first free slot, so let's take it. - if (ACE_SELECT_REACTOR_HANDLE (i) == ACE_INVALID_HANDLE && - assigned_slot == -1) - { - assigned_slot = i; - } - } - - if (assigned_slot > -1) - // We found a spot. - { - ACE_SELECT_REACTOR_HANDLE (assigned_slot) = handle; - ACE_SELECT_REACTOR_EVENT_HANDLER (this, assigned_slot) = event_handler; - } - else if (this->max_handlep1_ < this->max_size_) - { - // Insert at the end of the active portion. - ACE_SELECT_REACTOR_HANDLE (this->max_handlep1_) = handle; - ACE_SELECT_REACTOR_EVENT_HANDLER (this, this->max_handlep1_) = event_handler; - ++this->max_handlep1_; - } - else - { - // No more room at the inn! - errno = ENOMEM; - return -1; - } - -#else - - // Check if this handle is already registered. - ACE_Event_Handler *current_handler = - ACE_SELECT_REACTOR_EVENT_HANDLER (this, handle); - - if (current_handler) - { - // Cannot use a different handler for an existing handle. - if (current_handler != event_handler) - return -1; - - // Remember that this handle is already registered in the - // Reactor. - existing_handle = 1; - } - - ACE_SELECT_REACTOR_EVENT_HANDLER (this, handle) = event_handler; - - if (this->max_handlep1_ < handle + 1) - this->max_handlep1_ = handle + 1; - -#endif /* ACE_WIN32 */ - - if (this->select_reactor_.is_suspended_i (handle)) - { - this->select_reactor_.bit_ops (handle, - mask, - this->select_reactor_.suspend_set_, - ACE_Reactor::ADD_MASK); - } - else - { - this->select_reactor_.bit_ops (handle, - mask, - this->select_reactor_.wait_set_, - ACE_Reactor::ADD_MASK); - - // Note the fact that we've changed the state of the , - // which is used by the dispatching loop to determine whether it can - // keep going or if it needs to reconsult select(). - // this->select_reactor_.state_changed_ = 1; - } - - // If new entry, call add_reference() if needed. - if (!existing_handle) - event_handler->add_reference (); - - return 0; -} - -// Remove the binding of . - -int -ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::unbind"); - - size_t slot = 0; - ACE_Event_Handler *event_handler = this->find (handle, &slot); - - if (event_handler == 0) - return -1; - - // Clear out the bits in the Select_Reactor's wait_set. - this->select_reactor_.bit_ops (handle, - mask, - this->select_reactor_.wait_set_, - ACE_Reactor::CLR_MASK); - - // And suspend_set. - this->select_reactor_.bit_ops (handle, - mask, - this->select_reactor_.suspend_set_, - ACE_Reactor::CLR_MASK); - - // Note the fact that we've changed the state of the , - // which is used by the dispatching loop to determine whether it can - // keep going or if it needs to reconsult select(). - // this->select_reactor_.state_changed_ = 1; - - // If there are no longer any outstanding events on this - // then we can totally shut down the Event_Handler. - - int has_any_wait_mask = - (this->select_reactor_.wait_set_.rd_mask_.is_set (handle) - || this->select_reactor_.wait_set_.wr_mask_.is_set (handle) - || this->select_reactor_.wait_set_.ex_mask_.is_set (handle)); - int has_any_suspend_mask = - (this->select_reactor_.suspend_set_.rd_mask_.is_set (handle) - || this->select_reactor_.suspend_set_.wr_mask_.is_set (handle) - || this->select_reactor_.suspend_set_.ex_mask_.is_set (handle)); - - int complete_removal = 0; - - if (!has_any_wait_mask && !has_any_suspend_mask) - { - // The handle has been completed removed. - complete_removal = 1; - - ACE_SELECT_REACTOR_EVENT_HANDLER (this, slot) = 0; - -#if defined (ACE_WIN32) - - ACE_SELECT_REACTOR_HANDLE (slot) = ACE_INVALID_HANDLE; - - if (this->max_handlep1_ == (int) slot + 1) - { - // We've deleted the last entry (i.e., i + 1 == the current - // size of the array), so we need to figure out the last - // valid place in the array that we should consider in - // subsequent searches. - - int i; - - for (i = this->max_handlep1_ - 1; - i >= 0 && ACE_SELECT_REACTOR_HANDLE (i) == ACE_INVALID_HANDLE; - --i) - continue; - - this->max_handlep1_ = i + 1; - } - -#else - - if (this->max_handlep1_ == handle + 1) - { - // We've deleted the last entry, so we need to figure out - // the last valid place in the array that is worth looking - // at. - ACE_HANDLE wait_rd_max = - this->select_reactor_.wait_set_.rd_mask_.max_set (); - ACE_HANDLE wait_wr_max = - this->select_reactor_.wait_set_.wr_mask_.max_set (); - ACE_HANDLE wait_ex_max = - this->select_reactor_.wait_set_.ex_mask_.max_set (); - - ACE_HANDLE suspend_rd_max = - this->select_reactor_.suspend_set_.rd_mask_.max_set (); - ACE_HANDLE suspend_wr_max = - this->select_reactor_.suspend_set_.wr_mask_.max_set (); - ACE_HANDLE suspend_ex_max = - this->select_reactor_.suspend_set_.ex_mask_.max_set (); - - // Compute the maximum of six values. - this->max_handlep1_ = wait_rd_max; - if (this->max_handlep1_ < wait_wr_max) - this->max_handlep1_ = wait_wr_max; - if (this->max_handlep1_ < wait_ex_max) - this->max_handlep1_ = wait_ex_max; - - if (this->max_handlep1_ < suspend_rd_max) - this->max_handlep1_ = suspend_rd_max; - if (this->max_handlep1_ < suspend_wr_max) - this->max_handlep1_ = suspend_wr_max; - if (this->max_handlep1_ < suspend_ex_max) - this->max_handlep1_ = suspend_ex_max; - - ++this->max_handlep1_; - } - -#endif /* ACE_WIN32 */ - - } - - int requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - // Close down the unless we've been instructed not - // to. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::DONT_CALL) == 0) - event_handler->handle_close (handle, mask); - - // Call remove_reference() if the removal is complete and reference - // counting is needed. - if (complete_removal && requires_reference_counting) - { - event_handler->remove_reference (); - } - - return 0; -} - -ACE_Select_Reactor_Handler_Repository_Iterator::ACE_Select_Reactor_Handler_Repository_Iterator - (const ACE_Select_Reactor_Handler_Repository *s) - : rep_ (s), - current_ (-1) -{ - this->advance (); -} - -// Pass back the that hasn't been seen in the Set. -// Returns 0 when all items have been seen, else 1. - -int -ACE_Select_Reactor_Handler_Repository_Iterator::next (ACE_Event_Handler *&next_item) -{ - int result = 1; - - if (this->current_ >= this->rep_->max_handlep1_) - result = 0; - else - next_item = ACE_SELECT_REACTOR_EVENT_HANDLER (this->rep_, - this->current_); - return result; -} - -int -ACE_Select_Reactor_Handler_Repository_Iterator::done (void) const -{ - return this->current_ >= this->rep_->max_handlep1_; -} - -// Move forward by one element in the set. - -int -ACE_Select_Reactor_Handler_Repository_Iterator::advance (void) -{ - if (this->current_ < this->rep_->max_handlep1_) - ++this->current_; - - while (this->current_ < this->rep_->max_handlep1_) - if (ACE_SELECT_REACTOR_EVENT_HANDLER (this->rep_, this->current_) != 0) - return 1; - else - ++this->current_; - - return this->current_ < this->rep_->max_handlep1_; -} - -// Dump the state of an object. - -void -ACE_Select_Reactor_Handler_Repository_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository_Iterator::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("rep_ = %u"), this->rep_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("current_ = %d"), this->current_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -void -ACE_Select_Reactor_Handler_Repository::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("max_handlep1_ = %d, max_size_ = %d\n"), - this->max_handlep1_, this->max_size_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("["))); - - ACE_Event_Handler *event_handler = 0; - - for (ACE_Select_Reactor_Handler_Repository_Iterator iter (this); - iter.next (event_handler) != 0; - iter.advance ()) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" (event_handler = %x, event_handler->handle_ = %d)\n"), - event_handler, event_handler->get_handle ())); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" ]\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Select_Reactor_Handler_Repository_Iterator) - -ACE_Select_Reactor_Notify::ACE_Select_Reactor_Notify (void) - : max_notify_iterations_ (-1) -{ -} - -ACE_Select_Reactor_Notify::~ACE_Select_Reactor_Notify (void) -{ -} - -void -ACE_Select_Reactor_Notify::max_notify_iterations (int iterations) -{ - // Must always be > 0 or < 0 to optimize the loop exit condition. - if (iterations == 0) - iterations = 1; - - this->max_notify_iterations_ = iterations; -} - -int -ACE_Select_Reactor_Notify::max_notify_iterations (void) -{ - return this->max_notify_iterations_; -} - -// purge_pending_notifications -// Removes all entries from the notify_queue_ and each one that -// matches is put on the free_queue_. The rest are saved on a -// local queue and copied back to the notify_queue_ at the end. -// Returns the number of entries removed. Returns -1 on error. -// ACE_NOTSUP_RETURN if ACE_HAS_REACTOR_NOTIFICATION_QUEUE is not defined. -int -ACE_Select_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask ) -{ - ACE_TRACE ("ACE_Select_Reactor_Notify::purge_pending_notifications"); - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1); - - if (this->notify_queue_.is_empty ()) - return 0; - - ACE_Notification_Buffer *temp = 0; - ACE_Unbounded_Queue local_queue; - - size_t queue_size = this->notify_queue_.size (); - int number_purged = 0; - size_t i; - for (i = 0; i < queue_size; ++i) - { - if (-1 == this->notify_queue_.dequeue_head (temp)) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("dequeue_head")), - -1); - - // If this is not a Reactor notify (it is for a particular handler), - // and it matches the specified handler (or purging all), - // and applying the mask would totally eliminate the notification, then - // release it and count the number purged. - if ((0 != temp->eh_) && - (0 == eh || eh == temp->eh_) && - ACE_BIT_DISABLED (temp->mask_, ~mask)) // the existing notificationmask - // is left with nothing when - // applying the mask - { - if (-1 == this->free_queue_.enqueue_head (temp)) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("enqueue_head")), - -1); - - ACE_Event_Handler *event_handler = temp->eh_; - event_handler->remove_reference (); - - ++number_purged; - } - else - { - // To preserve it, move it to the local_queue. - // But first, if this is not a Reactor notify (it is for a particularhandler), - // and it matches the specified handler (or purging all), then - // apply the mask - if ((0 != temp->eh_) && - (0 == eh || eh == temp->eh_)) - ACE_CLR_BITS(temp->mask_, mask); - if (-1 == local_queue.enqueue_head (temp)) - return -1; - } - } - - if (this->notify_queue_.size ()) - { // should be empty! - ACE_ASSERT (0); - return -1; - } - - // now put it back in the notify queue - queue_size = local_queue.size (); - for (i = 0; i < queue_size; ++i) - { - if (-1 == local_queue.dequeue_head (temp)) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("dequeue_head")), - -1); - - if (-1 == this->notify_queue_.enqueue_head (temp)) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("enqueue_head")), - -1); - } - - return number_purged; - -#else /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */ - ACE_UNUSED_ARG (eh); - ACE_UNUSED_ARG (mask); - ACE_NOTSUP_RETURN (-1); -#endif /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */ -} - -void -ACE_Select_Reactor_Notify::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Select_Reactor_Notify::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("select_reactor_ = %x"), this->select_reactor_)); - this->notification_pipe_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_Select_Reactor_Notify::open (ACE_Reactor_Impl *r, - ACE_Timer_Queue *, - int disable_notify_pipe) -{ - ACE_TRACE ("ACE_Select_Reactor_Notify::open"); - - if (disable_notify_pipe == 0) - { - this->select_reactor_ = - dynamic_cast (r); - - if (select_reactor_ == 0) - { - errno = EINVAL; - return -1; - } - - if (this->notification_pipe_.open () == -1) - return -1; -#if defined (F_SETFD) - ACE_OS::fcntl (this->notification_pipe_.read_handle (), F_SETFD, 1); - ACE_OS::fcntl (this->notification_pipe_.write_handle (), F_SETFD, 1); -#endif /* F_SETFD */ - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - ACE_Notification_Buffer *temp = 0; - - ACE_NEW_RETURN (temp, - ACE_Notification_Buffer[ACE_REACTOR_NOTIFICATION_ARRAY_SIZE], - -1); - - if (this->alloc_queue_.enqueue_head (temp) == -1) - { - delete [] temp; - return -1; - } - - for (size_t i = 0; i < ACE_REACTOR_NOTIFICATION_ARRAY_SIZE; ++i) - if (free_queue_.enqueue_head (temp + i) == -1) - return -1; - -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - // There seems to be a Win32 bug with this... Set this into - // non-blocking mode. - if (ACE::set_flags (this->notification_pipe_.read_handle (), - ACE_NONBLOCK) == -1) - return -1; - else - return this->select_reactor_->register_handler - (this->notification_pipe_.read_handle (), - this, - ACE_Event_Handler::READ_MASK); - } - else - { - this->select_reactor_ = 0; - return 0; - } -} - -int -ACE_Select_Reactor_Notify::close (void) -{ - ACE_TRACE ("ACE_Select_Reactor_Notify::close"); - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - // Free up the dynamically allocated resources. - ACE_Notification_Buffer **b = 0; - - for (ACE_Unbounded_Queue_Iterator alloc_iter (this->alloc_queue_); - alloc_iter.next (b) != 0; - alloc_iter.advance ()) - { - delete [] *b; - *b = 0; - } - - this->alloc_queue_.reset (); - this->notify_queue_.reset (); - this->free_queue_.reset (); -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - return this->notification_pipe_.close (); -} - -int -ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Select_Reactor_Notify::notify"); - - // Just consider this method a "no-op" if there's no - // configured. - if (this->select_reactor_ == 0) - return 0; - - ACE_Event_Handler_var safe_handler (event_handler); - - if (event_handler) - event_handler->add_reference (); - - ACE_Notification_Buffer buffer (event_handler, mask); - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - // Artificial scope to limit the duration of the mutex. - { - bool notification_required = false; - - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1); - - // No pending notifications. - if (this->notify_queue_.is_empty ()) - notification_required = true; - - ACE_Notification_Buffer *temp = 0; - - if (free_queue_.dequeue_head (temp) == -1) - { - // Grow the queue of available buffers. - ACE_Notification_Buffer *temp1 = 0; - - ACE_NEW_RETURN (temp1, - ACE_Notification_Buffer[ACE_REACTOR_NOTIFICATION_ARRAY_SIZE], - -1); - - if (this->alloc_queue_.enqueue_head (temp1) == -1) - { - delete [] temp1; - return -1; - } - - // Start at 1 and enqueue only - // (ACE_REACTOR_NOTIFICATION_ARRAY_SIZE - 1) elements since - // the first one will be used right now. - for (size_t i = 1; - i < ACE_REACTOR_NOTIFICATION_ARRAY_SIZE; - ++i) - this->free_queue_.enqueue_head (temp1 + i); - - temp = temp1; - } - - ACE_ASSERT (temp != 0); - *temp = buffer; - - if (notify_queue_.enqueue_tail (temp) == -1) - return -1; - - if (!notification_required) - { - // No failures. - safe_handler.release (); - - return 0; - } - } -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - ssize_t n = ACE::send (this->notification_pipe_.write_handle (), - (char *) &buffer, - sizeof buffer, - timeout); - if (n == -1) - return -1; - - // No failures. - safe_handler.release (); - - return 0; -} - -// Handles pending threads (if any) that are waiting to unblock the -// Select_Reactor. - -int -ACE_Select_Reactor_Notify::dispatch_notifications (int &number_of_active_handles, - ACE_Handle_Set &rd_mask) -{ - ACE_TRACE ("ACE_Select_Reactor_Notify::dispatch_notifications"); - - ACE_HANDLE read_handle = - this->notification_pipe_.read_handle (); - - if (read_handle != ACE_INVALID_HANDLE - && rd_mask.is_set (read_handle)) - { - --number_of_active_handles; - rd_mask.clr_bit (read_handle); - return this->handle_input (read_handle); - } - else - return 0; -} - - -ACE_HANDLE -ACE_Select_Reactor_Notify::notify_handle (void) -{ - ACE_TRACE ("ACE_Select_Reactor_Notify::notify_handle"); - - return this->notification_pipe_.read_handle (); -} - - -int -ACE_Select_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer &buffer) -{ -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - ACE_UNUSED_ARG(buffer); - return 1; -#else - // If eh == 0 then another thread is unblocking the - // to update the 's - // internal structures. Otherwise, we need to dispatch the - // appropriate handle_* method on the - // pointer we've been passed. - if (buffer.eh_ != 0) - return 1; - -#endif /*ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - // has no dispatchable buffer - return 0; -} - -int -ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) -{ - int result = 0; - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - // Dispatch one message from the notify queue, and put another in - // the pipe if one is available. Remember, the idea is to keep - // exactly one message in the pipe at a time. - { - // We acquire the lock in a block to make sure we're not - // holding the lock while delivering callbacks... - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1); - - ACE_Notification_Buffer *temp = 0; - - if (notify_queue_.is_empty ()) - return 0; - else if (notify_queue_.dequeue_head (temp) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("dequeue_head")), - -1); - buffer = *temp; - if (free_queue_.enqueue_head (temp) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("enqueue_head")), - -1); - - bool write_next_buffer = false; - ACE_Notification_Buffer ** next = 0; - - if(!this->notify_queue_.is_empty()) - { - // The queue is not empty, need to queue another message. - this->notify_queue_.get (next, 0); - write_next_buffer = true; - } - - if(write_next_buffer) - { - (void) ACE::send( - this->notification_pipe_.write_handle(), - (char *)*next, sizeof(ACE_Notification_Buffer)); - } - } - -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - // If eh == 0 then another thread is unblocking the - // to update the 's - // internal structures. Otherwise, we need to dispatch the - // appropriate handle_* method on the pointer - // we've been passed. - if (buffer.eh_ != 0) - { - ACE_Event_Handler *event_handler = - buffer.eh_; - - int requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - switch (buffer.mask_) - { - case ACE_Event_Handler::READ_MASK: - case ACE_Event_Handler::ACCEPT_MASK: - result = event_handler->handle_input (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::WRITE_MASK: - result = event_handler->handle_output (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::EXCEPT_MASK: - result = event_handler->handle_exception (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::QOS_MASK: - result = event_handler->handle_qos (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::GROUP_QOS_MASK: - result = event_handler->handle_group_qos (ACE_INVALID_HANDLE); - break; - default: - // Should we bail out if we get an invalid mask? - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("invalid mask = %d\n"), - buffer.mask_)); - } - - if (result == -1) - event_handler->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::EXCEPT_MASK); - - if (requires_reference_counting) - { - event_handler->remove_reference (); - } - } - - return 1; -} - -int -ACE_Select_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle, - ACE_Notification_Buffer &buffer) -{ - ACE_TRACE ("ACE_Select_Reactor_Notify::read_notify_pipe"); - - ssize_t n = ACE::recv (handle, (char *) &buffer, sizeof buffer); - - if (n > 0) - { - // Check to see if we've got a short read. - if (n != sizeof buffer) - { - ssize_t remainder = sizeof buffer - n; - - // If so, try to recover by reading the remainder. If this - // doesn't work we're in big trouble since the input stream - // won't be aligned correctly. I'm not sure quite what to - // do at this point. It's probably best just to return -1. - if (ACE::recv (handle, - ((char *) &buffer) + n, - remainder) != remainder) - return -1; - } - - - return 1; - } - - // Return -1 if things have gone seriously wrong. - if (n <= 0 && (errno != EWOULDBLOCK && errno != EAGAIN)) - return -1; - - return 0; -} - - -int -ACE_Select_Reactor_Notify::handle_input (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_Notify::handle_input"); - // Precondition: this->select_reactor_.token_.current_owner () == - // ACE_Thread::self (); - - int number_dispatched = 0; - int result = 0; - ACE_Notification_Buffer buffer; - - while ((result = this->read_notify_pipe (handle, buffer)) > 0) - { - // Dispatch the buffer - // NOTE: We count only if we made any dispatches ie. upcalls. - if (this->dispatch_notify (buffer) > 0) - ++number_dispatched; - - // Bail out if we've reached the . Note that - // by default is -1, so we'll loop until all - // the notifications in the pipe have been dispatched. - if (number_dispatched == this->max_notify_iterations_) - break; - } - - // Reassign number_dispatched to -1 if things have gone seriously - // wrong. - if (result < 0) - number_dispatched = -1; - - // Enqueue ourselves into the list of waiting threads. When we - // reacquire the token we'll be off and running again with ownership - // of the token. The postcondition of this call is that - // == . - this->select_reactor_->renew (); - return number_dispatched; -} - -// ------------------------------------------- - -int -ACE_Select_Reactor_Impl::purge_pending_notifications (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - if (this->notify_handler_ == 0) - return 0; - else - return this->notify_handler_->purge_pending_notifications (eh, mask); -} - - -// Perform GET, CLR, SET, and ADD operations on the Handle_Sets. -// -// GET = 1, Retrieve current value -// SET = 2, Set value of bits to new mask (changes the entire mask) -// ADD = 3, Bitwise "or" the value into the mask (only changes -// enabled bits) -// CLR = 4 Bitwise "and" the negation of the value out of the mask -// (only changes enabled bits) -// -// Returns the original mask. Must be called with locks held. -int -ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Select_Reactor_Handle_Set &handle_set, - int ops) -{ - ACE_TRACE ("ACE_Select_Reactor_Impl::bit_ops"); - if (this->handler_rep_.handle_in_range (handle) == 0) - return -1; - -#if !defined (ACE_WIN32) - ACE_Sig_Guard sb (0, - this->mask_signals_); // Block out all signals until method returns. -#endif /* ACE_WIN32 */ - - ACE_FDS_PTMF ptmf = &ACE_Handle_Set::set_bit; - u_long omask = ACE_Event_Handler::NULL_MASK; - - // Find the old reactor masks. This automatically does the work of - // the GET_MASK operation. - if (handle_set.rd_mask_.is_set (handle)) - ACE_SET_BITS (omask, ACE_Event_Handler::READ_MASK); - if (handle_set.wr_mask_.is_set (handle)) - ACE_SET_BITS (omask, ACE_Event_Handler::WRITE_MASK); - if (handle_set.ex_mask_.is_set (handle)) - ACE_SET_BITS (omask, ACE_Event_Handler::EXCEPT_MASK); - - switch (ops) - { - case ACE_Reactor::GET_MASK: - // The work for this operation is done in all cases at the - // begining of the function. - break; - case ACE_Reactor::CLR_MASK: - ptmf = &ACE_Handle_Set::clr_bit; - // State was changed. we need to reflect that change in the - // dispatch_mask I assume that only ACE_Reactor::CLR_MASK should - // be treated here which means we need to clear the handle|mask - // from the current dispatch handler - this->clear_dispatch_mask (handle, mask); - /* FALLTHRU */ - case ACE_Reactor::SET_MASK: - /* FALLTHRU */ - case ACE_Reactor::ADD_MASK: - - // The following code is rather subtle... Note that if we are - // doing a ACE_Reactor::SET_MASK then if the bit is not enabled - // in the mask we need to clear the bit from the ACE_Handle_Set. - // On the other hand, if we are doing a ACE_Reactor::CLR_MASK or - // a ACE_Reactor::ADD_MASK we just carry out the operations - // specified by the mask. - - // READ, ACCEPT, and CONNECT flag will place the handle in the - // read set. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) - { - (handle_set.rd_mask_.*ptmf) (handle); - } - else if (ops == ACE_Reactor::SET_MASK) - handle_set.rd_mask_.clr_bit (handle); - - // WRITE and CONNECT flag will place the handle in the write set - if (ACE_BIT_ENABLED (mask, - ACE_Event_Handler::WRITE_MASK) - || ACE_BIT_ENABLED (mask, - ACE_Event_Handler::CONNECT_MASK)) - { - (handle_set.wr_mask_.*ptmf) (handle); - } - else if (ops == ACE_Reactor::SET_MASK) - handle_set.wr_mask_.clr_bit (handle); - - // EXCEPT (and CONNECT on Win32) flag will place the handle in - // the except set. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK) -#if defined (ACE_WIN32) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK) -#endif /* ACE_WIN32 */ - ) - { - (handle_set.ex_mask_.*ptmf) (handle); - } - else if (ops == ACE_Reactor::SET_MASK) - handle_set.ex_mask_.clr_bit (handle); - break; - default: - return -1; - } - return omask; -} - -void -ACE_Select_Reactor_Impl::clear_dispatch_mask (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_Impl::clear_dispatch_mask"); - - // Use handle and mask in order to modify the sets - // (wait/suspend/ready/dispatch), that way, the dispatch_io_set loop - // will not be interrupt, and there will no reason to rescan the - // wait_set and re-calling select function, which is *very* - // expensive. It seems that wait/suspend/ready sets are getting - // updated in register/remove bind/unbind etc functions. The only - // thing need to be updated is the dispatch_set (also can be found - // in that file code as dispatch_mask). Because of that, we need - // that dispatch_set to be member of the ACE_Select_Reactor_impl in - // Select_Reactor_Base.h file That way we will have access to that - // member in that function. - - // We kind of invalidate the iterator in dispatch_io_set because its - // an array and index built from the original dispatch-set. Take a - // look at dispatch_io_set for more details. - - // We only need to clr_bit, because we are interested in clearing the - // handles that was removed, so no dispatching to these handles will - // occur. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) || - ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) - { - this->dispatch_set_.rd_mask_.clr_bit (handle); - } - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) - { - this->dispatch_set_.wr_mask_.clr_bit (handle); - } - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) - { - this->dispatch_set_.ex_mask_.clr_bit (handle); - } - - // That will make the dispatch_io_set iterator re-start and rescan - // the dispatch set. - this->state_changed_ = true; -} - - -int -ACE_Select_Reactor_Impl::resumable_handler (void) -{ - // The select reactor has no handlers that can be resumed by the - // application. So return 0; - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Select_Reactor_Base.h b/ace/Select_Reactor_Base.h deleted file mode 100644 index fdcd4eee991..00000000000 --- a/ace/Select_Reactor_Base.h +++ /dev/null @@ -1,581 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Select_Reactor_Base.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SELECT_REACTOR_BASE_H -#define ACE_SELECT_REACTOR_BASE_H - -#include /**/ "ace/pre.h" - -#include "ace/Timer_Queuefwd.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Event_Handler.h" -#include "ace/Handle_Set.h" -#include "ace/Pipe.h" -#include "ace/Reactor_Impl.h" - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) -# include "ace/Unbounded_Queue.h" -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Add useful typedefs to simplify the following code. -typedef void (ACE_Handle_Set::*ACE_FDS_PTMF) (ACE_HANDLE); -typedef int (ACE_Event_Handler::*ACE_EH_PTMF) (ACE_HANDLE); - -// Forward declaration. -class ACE_Select_Reactor_Impl; -class ACE_Sig_Handler; - -/* - * Hook to specialize the Select_Reactor_Base implementation - * with the concrete reactor, e.g., select or tp reactor - * specified at build/compilation time. - */ -//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK - -/** - * @class ACE_Select_Reactor_Handle_Set - * - * @brief Track handles we are interested for various events. - */ -class ACE_Export ACE_Select_Reactor_Handle_Set -{ -public: - /// Read events (e.g., input pending, accept pending). - ACE_Handle_Set rd_mask_; - - /// Write events (e.g., flow control abated, non-blocking connection - /// complete). - ACE_Handle_Set wr_mask_; - - /// Exception events (e.g., SIG_URG). - ACE_Handle_Set ex_mask_; -}; - -/** - * @class ACE_Event_Tuple - * - * @brief An ACE_Event_Handler and its associated ACE_HANDLE. - * - * One ACE_Event_Handler is registered for one or more - * ACE_HANDLE. At various points, this information must be - * stored explicitly. This class provides a lightweight - * mechanism to do so. - */ -class ACE_Export ACE_Event_Tuple -{ -public: - /// Default constructor. - ACE_Event_Tuple (void); - - /// Constructor. - ACE_Event_Tuple (ACE_Event_Handler *eh, - ACE_HANDLE h); - - /// Destructor. - ~ACE_Event_Tuple (void); - - /// Equality operator. - bool operator== (const ACE_Event_Tuple &rhs) const; - - /// Inequality operator. - bool operator!= (const ACE_Event_Tuple &rhs) const; - - /// Handle. - ACE_HANDLE handle_; - - /// ACE_Event_Handler associated with the ACE_HANDLE. - ACE_Event_Handler *event_handler_; -}; - -/** - * @class ACE_Select_Reactor_Notify - * - * @brief Unblock the ACE_Select_Reactor from its event loop. - * - * This implementation is necessary for cases where the - * ACE_Select_Reactor is run in a multi-threaded program. In - * this case, we need to be able to unblock @c select or @c poll - * when updates occur other than in the main - * ACE_Select_Reactor thread. To do this, we signal an - * auto-reset event the ACE_Select_Reactor is listening on. - * If an ACE_Event_Handler and ACE_Select_Reactor_Mask is - * passed to @c notify, the appropriate @c handle_* method is - * dispatched in the context of the ACE_Select_Reactor thread. - */ -class ACE_Export ACE_Select_Reactor_Notify : public ACE_Reactor_Notify -{ -public: - /// Constructor. - ACE_Select_Reactor_Notify (void); - - /// Destructor. - virtual ~ACE_Select_Reactor_Notify (void); - - // = Initialization and termination methods. - /// Initialize. - virtual int open (ACE_Reactor_Impl *, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0); - - /// Destroy. - virtual int close (void); - - /** - * Called by a thread when it wants to unblock the - * ACE_Select_Reactor. This wakeups the ACE_Select_Reactor if - * currently blocked in @c select/poll. Pass over both the - * @c Event_Handler *and* the @c mask to allow the caller to dictate - * which @c Event_Handler method the ACE_Select_Reactor will - * invoke. The ACE_Time_Value indicates how long to blocking - * trying to notify the ACE_Select_Reactor. If @a timeout == 0, - * the caller will block until action is possible, else will wait - * until the relative time specified in @c *timeout elapses). - */ - virtual int notify (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value * timeout = 0); - - /// Handles pending threads (if any) that are waiting to unblock the - /// ACE_Select_Reactor. - virtual int dispatch_notifications (int &number_of_active_handles, - ACE_Handle_Set &rd_mask); - - /// Returns the ACE_HANDLE of the notify pipe on which the reactor - /// is listening for notifications so that other threads can unblock - /// the Select_Reactor - virtual ACE_HANDLE notify_handle (void); - - /// Handle one of the notify call on the @c handle. This could be - /// because of a thread trying to unblock the - virtual int dispatch_notify (ACE_Notification_Buffer &buffer); - - /// Read one of the notify call on the @a handle into the - /// @a buffer. This could be because of a thread trying to unblock - /// the - virtual int read_notify_pipe (ACE_HANDLE handle, - ACE_Notification_Buffer &buffer); - - /// Verify whether the buffer has dispatchable info or not. - virtual int is_dispatchable (ACE_Notification_Buffer &buffer); - - /// Called back by the ACE_Select_Reactor when a thread wants to - /// unblock us. - virtual int handle_input (ACE_HANDLE handle); - - /** - * Set the maximum number of times that the - * method will iterate and - * dispatch the that are passed in via the - * notify pipe before breaking out of its loop. By default, - * this is set to -1, which means "iterate until the pipe is empty." - * Setting this to a value like "1 or 2" will increase "fairness" - * (and thus prevent starvation) at the expense of slightly higher - * dispatching overhead. - */ - virtual void max_notify_iterations (int); - - /** - * Get the maximum number of times that the - * method will iterate and - * dispatch the that are passed in via the - * notify pipe before breaking out of its loop. - */ - virtual int max_notify_iterations (void); - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. If @a eh == 0, all notifications for all - * handlers are removed (but not any notifications posted just to wake up - * the reactor itself). Returns the number of notifications purged. - * Returns -1 on error. - */ - virtual int purge_pending_notifications ( - ACE_Event_Handler *sh, - ACE_Reactor_Mask mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /** - * Keep a back pointer to the ACE_Select_Reactor. If this value - * if NULL then the ACE_Select_Reactor has been initialized with - * . - */ - ACE_Select_Reactor_Impl *select_reactor_; - - /** - * Contains the ACE_HANDLE the ACE_Select_Reactor is listening - * on, as well as the ACE_HANDLE that threads wanting the - * attention of the ACE_Select_Reactor will write to. - */ - ACE_Pipe notification_pipe_; - - /** - * Keeps track of the maximum number of times that the - * method will iterate and - * dispatch the that are passed in via the - * notify pipe before breaking out of its loop. By default, - * this is set to -1, which means "iterate until the pipe is empty." - */ - int max_notify_iterations_; - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - // = This configuration queues up notifications in separate buffers that - // are in user-space, rather than stored in a pipe in the OS - // kernel. The kernel-level notifications are used only to trigger - // the Reactor to check its notification queue. This enables many - // more notifications to be stored than would otherwise be the case. - - /// Keeps track of allocated arrays of type - /// . - ACE_Unbounded_Queue alloc_queue_; - - /// Keeps track of all pending notifications. - ACE_Unbounded_Queue notify_queue_; - - /// Keeps track of all free buffers. - ACE_Unbounded_Queue free_queue_; - - /// Synchronization for handling of queues. - ACE_SYNCH_MUTEX notify_queue_lock_; -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -}; - -/** - * @class ACE_Select_Reactor_Handler_Repository - * - * @brief Used to map ACE_HANDLEs onto the appropriate - * ACE_Event_Handler *. - * - * This class is necessary to shield differences between UNIX - * and Win32. In UNIX, ACE_HANDLE is an int, whereas in Win32 - * it's a void *. This class hides all these details from the - * bulk of the ACE_Select_Reactor code. All of these methods - * are called with the main token lock held. - */ -class ACE_Export ACE_Select_Reactor_Handler_Repository -{ -public: - friend class ACE_Select_Reactor_Handler_Repository_Iterator; - - // = Initialization and termination methods. - /// Default "do-nothing" constructor. - ACE_Select_Reactor_Handler_Repository (ACE_Select_Reactor_Impl &); - - /// Destructor. - ~ACE_Select_Reactor_Handler_Repository (void); - - /// Initialize a repository of the appropriate . - /** - * On Unix platforms, the size parameter should be as large as the - * maximum number of file descriptors allowed for a given process. - * This is necessary since a file descriptor is used to directly - * index the array of event handlers maintained by the Reactor's - * handler repository. Direct indexing is used for efficiency - * reasons. - */ - int open (size_t size); - - /// Close down the repository. - int close (void); - - // = Search structure operations. - - /** - * Return the associated with ACE_HANDLE. - * If is non-0, then return the index location of the - * , if found. - */ - ACE_Event_Handler *find (ACE_HANDLE handle, size_t *index_p = 0); - - /// Bind the ACE_Event_Handler * to the ACE_HANDLE with the - /// appropriate ACE_Reactor_Mask settings. - int bind (ACE_HANDLE, - ACE_Event_Handler *, - ACE_Reactor_Mask); - - /// Remove the binding of ACE_HANDLE in accordance with the @a mask. - int unbind (ACE_HANDLE, - ACE_Reactor_Mask mask); - - /// Remove all the tuples. - int unbind_all (void); - - // = Sanity checking. - - // Check the to make sure it's a valid ACE_HANDLE that - // within the range of legal handles (i.e., >= 0 && < max_size_). - int invalid_handle (ACE_HANDLE handle); - - // Check the to make sure it's a valid ACE_HANDLE that - // within the range of currently registered handles (i.e., >= 0 && < - // max_handlep1_). - int handle_in_range (ACE_HANDLE handle); - - // = Accessors. - /// Returns the current table size. - size_t size (void) const; - - /// Maximum ACE_HANDLE value, plus 1. - size_t max_handlep1 (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Reference to our . - ACE_Select_Reactor_Impl &select_reactor_; - - /// Maximum number of handles. - ssize_t max_size_; - - /// The highest currently active handle, plus 1 (ranges between 0 and - /// . - int max_handlep1_; - -#if defined (ACE_WIN32) - // = The mapping from to . - - /** - * The NT version implements this via a dynamically allocated - * array of . Since NT implements ACE_HANDLE - * as a void * we can't directly index into this array. Therefore, - * we just do a linear search (for now). Next, we'll modify - * things to use hashing or something faster... - */ - ACE_Event_Tuple *event_handlers_; -#else - /** - * The UNIX version implements this via a dynamically allocated - * array of that is indexed directly using - * the ACE_HANDLE value. - */ - ACE_Event_Handler **event_handlers_; -#endif /* ACE_WIN32 */ -}; - -/** - * @class ACE_Select_Reactor_Handler_Repository_Iterator - * - * @brief Iterate through the ACE_Select_Reactor_Handler_Repository. - */ -class ACE_Export ACE_Select_Reactor_Handler_Repository_Iterator -{ -public: - // = Initialization method. - ACE_Select_Reactor_Handler_Repository_Iterator (const ACE_Select_Reactor_Handler_Repository *s); - - /// dtor. - ~ACE_Select_Reactor_Handler_Repository_Iterator (void); - - // = Iteration methods. - - /// Pass back the that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (ACE_Event_Handler *&next_item); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Reference to the Handler_Repository we are iterating over. - const ACE_Select_Reactor_Handler_Repository *rep_; - - /// Pointer to the current iteration level. - ssize_t current_; -}; - -/** - * @class ACE_Select_Reactor_Impl - * - * @brief This class simply defines how Select_Reactor's basic interface - * functions should look like and provides a common base class for - * using various locking mechanism. - */ -class ACE_Export ACE_Select_Reactor_Impl : public ACE_Reactor_Impl -{ -public: - enum - { - /// Default size of the Select_Reactor's handle table. - DEFAULT_SIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE - }; - - /// Constructor. - ACE_Select_Reactor_Impl (bool mask_signals = true); - - friend class ACE_Select_Reactor_Notify; - friend class ACE_Select_Reactor_Handler_Repository; - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. Returns the number of notifications - * purged. Returns -1 on error. - */ - virtual int purge_pending_notifications (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Does the reactor allow the application to resume the handle on - /// its own ie. can it pass on the control of handle resumption to - /// the application. The select reactor has no handlers that can be - /// resumed by the application. So return 0; - virtual int resumable_handler (void); - - /* - * Hook to add concrete methods required to specialize the - * implementation with concrete methods required for the concrete - * reactor implementation, for example, select, tp reactors. - */ - //@@ REACTOR_SPL_PUBLIC_METHODS_ADD_HOOK - -protected: - /// Allow manipulation of the mask and mask. - virtual int bit_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Select_Reactor_Handle_Set &handle_set, - int ops); - - /// Enqueue ourselves into the list of waiting threads at the - /// appropriate point specified by . - virtual void renew (void) = 0; - - /// Check to see if the associated with @a handle is - /// suspended. Returns 0 if not, 1 if so. - virtual int is_suspended_i (ACE_HANDLE handle) = 0; - - /// When register/unregister occur, then we need to re-eval our - /// wait/suspend/dispatch set. - virtual void clear_dispatch_mask (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - /// Table that maps to 's. - ACE_Select_Reactor_Handler_Repository handler_rep_; - - /// Tracks handles that are ready for dispatch from . - ACE_Select_Reactor_Handle_Set wait_set_; - - /// Tracks handles that are currently suspended. - ACE_Select_Reactor_Handle_Set suspend_set_; - - /// Track HANDLES we are interested in for various events that must - /// be dispatched *without* going through is interrupted via . - int restart_; - - /** - * Position that the main ACE_Select_Reactor thread is requeued in - * the list of waiters during a callback. If this value == - * -1 we are requeued at the end of the list. Else if it's 0 then - * we are requeued at the front of the list. Else if it's > 1 then - * that indicates the number of waiters to skip over. - */ - int requeue_position_; - - /// The original thread that created this Select_Reactor. - ACE_thread_t owner_; - - /** - * True if state has changed during dispatching of - * , else false. This is used to determine - * whether we need to make another trip through the - * 's loop. - */ - bool state_changed_; - - /** - * If 0 then the Reactor will not mask the signals during the event - * dispatching. This is useful for applications that do not - * register any signal handlers and want to reduce the overhead - * introduce by the kernel level locks required to change the mask. - */ - bool mask_signals_; - - /// Controls/access whether the notify handler should renew the - /// Select_Reactor's token or not. - int supress_notify_renew (void); - void supress_notify_renew (int sr); - - -private: - - /// Determine whether we should renew Select_Reactor's token after handling - /// the notification message. - int supress_renew_; - - /// Deny access since member-wise won't work... - ACE_Select_Reactor_Impl (const ACE_Select_Reactor_Impl &); - ACE_Select_Reactor_Impl &operator = (const ACE_Select_Reactor_Impl &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Select_Reactor_Base.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SELECT_REACTOR_BASE_H */ diff --git a/ace/Select_Reactor_Base.inl b/ace/Select_Reactor_Base.inl deleted file mode 100644 index 83c561b8e8d..00000000000 --- a/ace/Select_Reactor_Base.inl +++ /dev/null @@ -1,87 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Reactor.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Event_Tuple::~ACE_Event_Tuple (void) -{ -} - -ACE_INLINE -ACE_Select_Reactor_Handler_Repository::~ACE_Select_Reactor_Handler_Repository (void) -{ -} - -ACE_INLINE -ACE_Select_Reactor_Handler_Repository_Iterator::~ACE_Select_Reactor_Handler_Repository_Iterator (void) -{ -} - -ACE_INLINE size_t -ACE_Select_Reactor_Handler_Repository::size (void) const -{ - return this->max_size_; -} - -ACE_INLINE -ACE_Event_Tuple::ACE_Event_Tuple (void) -: handle_ (ACE_INVALID_HANDLE), - event_handler_ (0) -{ -} - -ACE_INLINE -ACE_Event_Tuple::ACE_Event_Tuple (ACE_Event_Handler* eh, - ACE_HANDLE h) -: handle_ (h), - event_handler_ (eh) -{ -} - -ACE_INLINE bool -ACE_Event_Tuple::operator== (const ACE_Event_Tuple &rhs) const -{ - return this->handle_ == rhs.handle_; -} - -ACE_INLINE bool -ACE_Event_Tuple::operator!= (const ACE_Event_Tuple &rhs) const -{ - return !(*this == rhs); -} - -ACE_INLINE -ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl (bool ms) - : handler_rep_ (*this) - , timer_queue_ (0) - , signal_handler_ (0) - , notify_handler_ (0) - , delete_timer_queue_ (false) - , delete_signal_handler_ (false) - , delete_notify_handler_ (false) - , initialized_ (false) - , restart_ (0) - , requeue_position_ (-1) // Requeue at end of waiters by default. - , state_changed_ (0) - , mask_signals_ (ms) - , supress_renew_ (0) -{ -} - -ACE_INLINE int -ACE_Select_Reactor_Impl::supress_notify_renew (void) -{ - return this->supress_renew_; -} - -ACE_INLINE void -ACE_Select_Reactor_Impl::supress_notify_renew (int sr) -{ - this->supress_renew_ = sr; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Select_Reactor_T.cpp b/ace/Select_Reactor_T.cpp deleted file mode 100644 index 1dd2fc26b2a..00000000000 --- a/ace/Select_Reactor_T.cpp +++ /dev/null @@ -1,1600 +0,0 @@ -// $Id$ - -#ifndef ACE_SELECT_REACTOR_T_CPP -#define ACE_SELECT_REACTOR_T_CPP - -#include "ace/Select_Reactor_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/ACE.h" -#include "ace/Guard_T.h" -#include "ace/Log_Msg.h" -#include "ace/Signal.h" -#include "ace/Sig_Handler.h" -#include "ace/Thread.h" -#include "ace/Timer_Heap.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_sys_select.h" -#include "ace/OS_NS_sys_stat.h" - -// For timer_queue_ -#include "ace/Recursive_Thread_Mutex.h" - -/* - * ACE Reactor specialization hook. - */ -//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK - -#if !defined (__ACE_INLINE__) -#include "ace/Select_Reactor_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - Select_Reactor_T, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Select_Reactor_T) - -#if defined (ACE_WIN32) -#define ACE_SELECT_REACTOR_HANDLE(H) (this->event_handlers_[(H)].handle_) -#define ACE_SELECT_REACTOR_EVENT_HANDLER(THIS,H) ((THIS)->event_handlers_[(H)].event_handler_) -#else -#define ACE_SELECT_REACTOR_HANDLE(H) (H) -#define ACE_SELECT_REACTOR_EVENT_HANDLER(THIS,H) ((THIS)->event_handlers_[(H)]) -#endif /* ACE_WIN32 */ - - template int -ACE_Select_Reactor_T::any_ready - (ACE_Select_Reactor_Handle_Set &wait_set) -{ - ACE_TRACE ("ACE_Select_Reactor_T::any_ready"); - - if (this->mask_signals_) - { -#if !defined (ACE_WIN32) - // Make this call signal safe. - ACE_Sig_Guard sb; -#endif /* ACE_WIN32 */ - - return this->any_ready_i (wait_set); - } - return this->any_ready_i (wait_set); -} - - template int -ACE_Select_Reactor_T::any_ready_i - (ACE_Select_Reactor_Handle_Set &wait_set) -{ - ACE_TRACE ("ACE_Select_Reactor_T::any_ready_i"); - - int number_ready = this->ready_set_.rd_mask_.num_set () - + this->ready_set_.wr_mask_.num_set () - + this->ready_set_.ex_mask_.num_set (); - - // number_ready > 0 meaning there are handles in the ready_set - // &wait_set != &(this->ready_set_) means that we need to copy - // the handles from the ready_set to the wait set because the - // wait_set_ doesn't contain all the handles in the ready_set_ - if (number_ready > 0 && &wait_set != &(this->ready_set_)) - { - wait_set.rd_mask_ = this->ready_set_.rd_mask_; - wait_set.wr_mask_ = this->ready_set_.wr_mask_; - wait_set.ex_mask_ = this->ready_set_.ex_mask_; - - this->ready_set_.rd_mask_.reset (); - this->ready_set_.wr_mask_.reset (); - this->ready_set_.ex_mask_.reset (); - } - - return number_ready; -} - -template int -ACE_Select_Reactor_T::handler_i (int signum, - ACE_Event_Handler **eh) -{ - ACE_TRACE ("ACE_Select_Reactor_T::handler_i"); - ACE_Event_Handler *handler = this->signal_handler_->handler (signum); - - if (handler == 0) - return -1; - else if (eh != 0) - *eh = handler; - return 0; -} - -template int -ACE_Select_Reactor_T::initialized (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::initialized"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, 0)); - return this->initialized_; -} - -template int -ACE_Select_Reactor_T::owner (ACE_thread_t tid, - ACE_thread_t *o_id) -{ - ACE_TRACE ("ACE_Select_Reactor_T::owner"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - if (o_id) - *o_id = this->owner_; - - this->owner_ = tid; - - return 0; -} - -template int -ACE_Select_Reactor_T::owner (ACE_thread_t *t_id) -{ - ACE_TRACE ("ACE_Select_Reactor_T::owner"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - *t_id = this->owner_; - return 0; -} - -template int -ACE_Select_Reactor_T::restart (void) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->restart_; -} - -template int -ACE_Select_Reactor_T::restart (int r) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - int current_value = this->restart_; - this->restart_ = r; - return current_value; -} - -template void -ACE_Select_Reactor_T::requeue_position (int rp) -{ - ACE_TRACE ("ACE_Select_Reactor_T::requeue_position"); - ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_)); -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (rp); - // Must always requeue ourselves "next" on Win32. - this->requeue_position_ = 0; -#else - this->requeue_position_ = rp; -#endif /* ACE_WIN32 */ -} - -template int -ACE_Select_Reactor_T::requeue_position (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::requeue_position"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->requeue_position_; -} - -template void -ACE_Select_Reactor_T::max_notify_iterations (int iterations) -{ - ACE_TRACE ("ACE_Select_Reactor_T::max_notify_iterations"); - ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_)); - - this->notify_handler_->max_notify_iterations (iterations); -} - -template int -ACE_Select_Reactor_T::max_notify_iterations (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::max_notify_iterations"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->notify_handler_->max_notify_iterations (); -} - -// Enqueue ourselves into the list of waiting threads. -template void -ACE_Select_Reactor_T::renew (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::renew"); -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - if (this->supress_notify_renew () == 0) - this->token_.renew (this->requeue_position_); -#endif /* defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) */ -} - -template int -ACE_Select_Reactor_T::notify (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Select_Reactor_T::notify"); - - ssize_t n = 0; - - // Pass over both the Event_Handler *and* the mask to allow the - // caller to dictate which Event_Handler method the receiver - // invokes. Note that this call can timeout. - - n = this->notify_handler_->notify (eh, mask, timeout); - return n == -1 ? -1 : 0; -} - -template int -ACE_Select_Reactor_T::resume_handler (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_T::resume_handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->resume_i (handle); -} - -template int -ACE_Select_Reactor_T::suspend_handler (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->suspend_i (handle); -} - -template int -ACE_Select_Reactor_T::suspend_handlers (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::suspend_handlers"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - ACE_Event_Handler *eh = 0; - - for (ACE_Select_Reactor_Handler_Repository_Iterator iter (&this->handler_rep_); - iter.next (eh) != 0; - iter.advance ()) - this->suspend_i (eh->get_handle ()); - - return 0; -} - -template int -ACE_Select_Reactor_T::resume_handlers (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::resume_handlers"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - ACE_Event_Handler *eh = 0; - - for (ACE_Select_Reactor_Handler_Repository_Iterator iter (&this->handler_rep_); - iter.next (eh) != 0; - iter.advance ()) - this->resume_i (eh->get_handle ()); - - return 0; -} - -template int -ACE_Select_Reactor_T::register_handler - (ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->register_handler_i (handler->get_handle (), handler, mask); -} - -template int -ACE_Select_Reactor_T::register_handler - (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->register_handler_i (handle, handler, mask); -} - -template int -ACE_Select_Reactor_T::register_handler - (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->register_handler_i (handles, handler, mask); -} - -template ACE_Event_Handler * -ACE_Select_Reactor_T::find_handler - (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_T::find_handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, 0)); - return this->find_handler_i (handle); -} - -template int -ACE_Select_Reactor_T::handler - (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **handler) -{ - ACE_TRACE ("ACE_Select_Reactor_T::handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->handler_i (handle, mask, handler); -} - -template int -ACE_Select_Reactor_T::remove_handler - (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->remove_handler_i (handles, mask); -} - -template int -ACE_Select_Reactor_T::remove_handler - (ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->remove_handler_i (handler->get_handle (), mask); -} - -template int -ACE_Select_Reactor_T::remove_handler - (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->remove_handler_i (handle, mask); -} - -// Performs operations on the "ready" bits. - -template int -ACE_Select_Reactor_T::ready_ops - (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) -{ - ACE_TRACE ("ACE_Select_Reactor_T::ready_ops"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->bit_ops (handle, - mask, - this->ready_set_, - ops); -} - -template int -ACE_Select_Reactor_T::open - (size_t size, - int restart, - ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify) -{ - ACE_TRACE ("ACE_Select_Reactor_T::open"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - // Can't initialize ourselves more than once. - if (this->initialized_) - return -1; - - this->owner_ = ACE_Thread::self (); - this->restart_ = restart; - this->signal_handler_ = sh; - this->timer_queue_ = tq; - this->notify_handler_ = notify; - - int result = 0; - - // Allows the signal handler to be overridden. - if (this->signal_handler_ == 0) - { - ACE_NEW_RETURN (this->signal_handler_, - ACE_Sig_Handler, - -1); - - if (this->signal_handler_ == 0) - result = -1; - else - this->delete_signal_handler_ = 1; - } - - // Allows the timer queue to be overridden. - if (result != -1 && this->timer_queue_ == 0) - { - ACE_NEW_RETURN (this->timer_queue_, - ACE_Timer_Heap, - -1); - - if (this->timer_queue_ == 0) - result = -1; - else - this->delete_timer_queue_ = 1; - } - - // Allows the Notify_Handler to be overridden. - if (result != -1 && this->notify_handler_ == 0) - { - ACE_NEW_RETURN (this->notify_handler_, - ACE_Select_Reactor_Notify, - -1); - - if (this->notify_handler_ == 0) - result = -1; - else - this->delete_notify_handler_ = 1; - } - - if (result != -1 && this->handler_rep_.open (size) == -1) - result = -1; - else if (this->notify_handler_->open (this, - 0, - disable_notify_pipe) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("notification pipe open failed"))); - result = -1; - } - - if (result != -1) - // We're all set to go. - this->initialized_ = 1; - else - // This will close down all the allocated resources properly. - this->close (); - - return result; -} - -template int -ACE_Select_Reactor_T::set_sig_handler - (ACE_Sig_Handler *signal_handler) -{ - if (this->signal_handler_ != 0 && this->delete_signal_handler_ != 0) - delete this->signal_handler_; - this->signal_handler_ = signal_handler; - this->delete_signal_handler_ = 0; - return 0; -} - -template ACE_Timer_Queue * -ACE_Select_Reactor_T::timer_queue (void) const -{ - return this->timer_queue_; -} - -template int -ACE_Select_Reactor_T::timer_queue - (ACE_Timer_Queue *tq) -{ - if (this->timer_queue_ != 0 && this->delete_timer_queue_ != 0) - delete this->timer_queue_; - this->timer_queue_ = tq; - this->delete_timer_queue_ = 0; - return 0; -} - -template -ACE_Select_Reactor_T::ACE_Select_Reactor_T - (ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify, - int mask_signals, - int s_queue) - : ACE_Select_Reactor_Impl (mask_signals) - , token_ (*this, s_queue) - , lock_adapter_ (token_) - , deactivated_ (0) -{ - ACE_TRACE ("ACE_Select_Reactor_T::ACE_Select_Reactor_T"); - - // First try to open the Reactor with the hard-coded default. - if (this->open (ACE_Select_Reactor_T::DEFAULT_SIZE, - 0, - sh, - tq, - disable_notify_pipe, - notify) == -1) - { - // The hard-coded default Reactor size failed, so attempt to - // determine the size at run-time by checking the process file - // descriptor limit on platforms that support this feature. - - // There is no need to deallocate resources from previous open() - // call since the open() method deallocates any resources prior - // to exiting if an error was encountered. - - // Set the default reactor size to be the current limit on the - // number of file descriptors available to the process. This - // size is not necessarily the maximum limit. - if (this->open (ACE::max_handles (), - 0, - sh, - tq, - disable_notify_pipe, - notify) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Select_Reactor_T::open ") - ACE_LIB_TEXT ("failed inside ") - ACE_LIB_TEXT ("ACE_Select_Reactor_T::CTOR"))); - } -} - -// Initialize ACE_Select_Reactor_T. - -template -ACE_Select_Reactor_T::ACE_Select_Reactor_T - (size_t size, - int rs, - ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify, - int mask_signals, - int s_queue) - : ACE_Select_Reactor_Impl (mask_signals) - , token_ (*this, s_queue) - , lock_adapter_ (token_) - , deactivated_ (0) -{ - ACE_TRACE ("ACE_Select_Reactor_T::ACE_Select_Reactor_T"); - - if (this->open (size, - rs, - sh, - tq, - disable_notify_pipe, - notify) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Select_Reactor_T::open ") - ACE_LIB_TEXT ("failed inside ACE_Select_Reactor_T::CTOR"))); -} - -// Close down the ACE_Select_Reactor_T instance, detaching any -// remaining Event_Handers. This had better be called from the main -// event loop thread... - -template int -ACE_Select_Reactor_T::close (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::close"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - if (this->delete_signal_handler_) - { - delete this->signal_handler_; - this->signal_handler_ = 0; - this->delete_signal_handler_ = 0; - } - - this->handler_rep_.close (); - - if (this->delete_timer_queue_) - { - delete this->timer_queue_; - this->timer_queue_ = 0; - this->delete_timer_queue_ = 0; - } - - if (this->notify_handler_ != 0) - this->notify_handler_->close (); - - if (this->delete_notify_handler_) - { - delete this->notify_handler_; - this->notify_handler_ = 0; - this->delete_notify_handler_ = 0; - } - - this->initialized_ = 0; - - return 0; -} - -template int -ACE_Select_Reactor_T::current_info - (ACE_HANDLE, size_t &) -{ - return -1; -} - -template -ACE_Select_Reactor_T::~ACE_Select_Reactor_T (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::~ACE_Select_Reactor_T"); - this->close (); -} - -template int -ACE_Select_Reactor_T::remove_handler_i - (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::remove_handler_i"); - ACE_HANDLE h; - - ACE_Handle_Set_Iterator handle_iter (handles); - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->remove_handler_i (h, mask) == -1) - return -1; - - return 0; -} - -template int -ACE_Select_Reactor_T::register_handler_i - (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::register_handler_i"); - ACE_HANDLE h; - - ACE_Handle_Set_Iterator handle_iter (handles); - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->register_handler_i (h, handler, mask) == -1) - return -1; - - return 0; -} - -template int -ACE_Select_Reactor_T::register_handler - (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp) -{ - ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); - - int result = 0; - -#if (ACE_NSIG > 0) - for (int s = 1; s < ACE_NSIG; ++s) - if ((sigset.is_member (s) == 1) - && this->signal_handler_->register_handler (s, - new_sh, - new_disp) == -1) - result = -1; -#else /* ACE_NSIG <= 0 */ - ACE_UNUSED_ARG (sigset); - ACE_UNUSED_ARG (new_sh); - ACE_UNUSED_ARG (new_disp); -#endif /* ACE_NSIG <= 0 */ - return result; -} - -template int -ACE_Select_Reactor_T::remove_handler - (const ACE_Sig_Set &sigset) -{ - ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); - int result = 0; - -#if (ACE_NSIG > 0) - for (int s = 1; s < ACE_NSIG; ++s) - if ((sigset.is_member (s) == 1) - && this->signal_handler_->remove_handler (s) == -1) - result = -1; -#else /* ACE_NSIG <= 0 */ - ACE_UNUSED_ARG (sigset); -#endif /* ACE_NSIG <= 0 */ - - return result; -} - -template int -ACE_Select_Reactor_T::cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_Select_Reactor_T::cancel_timer"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - if (this->timer_queue_ != 0) - return this->timer_queue_->cancel (handler, dont_call_handle_close); - else - return 0; -} - -template int -ACE_Select_Reactor_T::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_Select_Reactor_T::cancel_timer"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - if (this->timer_queue_ != 0) - return this->timer_queue_->cancel (timer_id, - arg, - dont_call_handle_close); - else - return 0; -} - -template long -ACE_Select_Reactor_T::schedule_timer - (ACE_Event_Handler *handler, - const void *arg, - const ACE_Time_Value &delay_time, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Select_Reactor_T::schedule_timer"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - if (0 != this->timer_queue_) - return this->timer_queue_->schedule - (handler, - arg, - timer_queue_->gettimeofday () + delay_time, - interval); - - errno = ESHUTDOWN; - return -1; -} - -template int -ACE_Select_Reactor_T::reset_timer_interval - (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Select_Reactor_T::reset_timer_interval"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - if (0 != this->timer_queue_) - return this->timer_queue_->reset_interval (timer_id, interval); - - errno = ESHUTDOWN; - return -1; -} - -// Main event loop driver that blocks for before -// returning (will return earlier if I/O or signal events occur). - -template int -ACE_Select_Reactor_T::handle_events - (ACE_Time_Value &max_wait_time) -{ - ACE_TRACE ("ACE_Select_Reactor_T::handle_events"); - - return this->handle_events (&max_wait_time); -} - -template int -ACE_Select_Reactor_T::handle_error (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::handle_error"); -#if defined (linux) && defined (ERESTARTNOHAND) - if (errno == EINTR || errno == ERESTARTNOHAND) - return this->restart_; -#else - if (errno == EINTR) - return this->restart_; -#endif /* linux && ERESTARTNOHAND */ -#if defined (__MVS__) || defined (ACE_WIN32) || defined (ACE_VXWORKS) - // On MVS Open Edition and Win32, there can be a number of failure - // codes on a bad socket, so check_handles on anything other than - // EINTR. VxWorks doesn't even bother to always set errno on error - // in select (specifically, it doesn't return EBADF for bad FDs). - else - return this->check_handles (); -#else - else if (errno == EBADF) - return this->check_handles (); - else - return -1; -#endif /* __MVS__ || ACE_WIN32 */ -} - -template void -ACE_Select_Reactor_T::notify_handle - (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Handle_Set &ready_mask, - ACE_Event_Handler *event_handler, - ACE_EH_PTMF ptmf) -{ - ACE_TRACE ("ACE_Select_Reactor_T::notify_handle"); - // Check for removed handlers. - if (event_handler == 0) - return; - - int reference_counting_required = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - // Call add_reference() if needed. - if (reference_counting_required) - { - event_handler->add_reference (); - } - - int status = (event_handler->*ptmf) (handle); - - if (status < 0) - this->remove_handler_i (handle, mask); - else if (status > 0) - ready_mask.set_bit (handle); - - // Call remove_reference() if needed. - if (reference_counting_required) - { - event_handler->remove_reference (); - } -} - -// Perform GET, CLR, SET, and ADD operations on the select() -// Handle_Sets. -// -// GET = 1, Retrieve current value -// SET = 2, Set value of bits to new mask (changes the entire mask) -// ADD = 3, Bitwise "or" the value into the mask (only changes -// enabled bits) -// CLR = 4 Bitwise "and" the negation of the value out of the mask -// (only changes enabled bits) -// -// Returns the original mask. - -template int -ACE_Select_Reactor_T::mask_ops - (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) -{ - ACE_TRACE ("ACE_Select_Reactor_T::mask_ops"); - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - - // If the handle is not suspended, then set the ops on the - // , otherwise set the . - - if (this->is_suspended_i (handle)) - return this->bit_ops (handle, mask, - this->suspend_set_, - ops); - else - return this->bit_ops (handle, mask, - this->wait_set_, - ops); -} - -template ACE_Event_Handler * -ACE_Select_Reactor_T::find_handler_i - (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_T::find_handler_i"); - - ACE_Event_Handler *event_handler = - this->handler_rep_.find (handle); - - if (event_handler) - event_handler->add_reference (); - - return event_handler; -} - -// Must be called with locks held. - -template int -ACE_Select_Reactor_T::handler_i - (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **eh) -{ - ACE_TRACE ("ACE_Select_Reactor_T::handler_i"); - ACE_Event_Handler *event_handler = - this->handler_rep_.find (handle); - - if (event_handler == 0) - return -1; - else - { - if ((ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) - && this->wait_set_.rd_mask_.is_set (handle) == 0) - return -1; - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK) - && this->wait_set_.wr_mask_.is_set (handle) == 0) - return -1; - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK) - && this->wait_set_.ex_mask_.is_set (handle) == 0) - return -1; - } - - if (eh != 0) - { - *eh = event_handler; - event_handler->add_reference (); - } - - return 0; -} - -// Must be called with locks held - -template int -ACE_Select_Reactor_T::resume_i (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_T::resume_i"); - if (this->handler_rep_.find (handle) == 0) - return -1; - - if (this->suspend_set_.rd_mask_.is_set (handle)) - { - this->wait_set_.rd_mask_.set_bit (handle); - this->suspend_set_.rd_mask_.clr_bit (handle); - } - if (this->suspend_set_.wr_mask_.is_set (handle)) - { - this->wait_set_.wr_mask_.set_bit (handle); - this->suspend_set_.wr_mask_.clr_bit (handle); - } - if (this->suspend_set_.ex_mask_.is_set (handle)) - { - this->wait_set_.ex_mask_.set_bit (handle); - this->suspend_set_.ex_mask_.clr_bit (handle); - } - return 0; -} - -// Must be called with locks held - -template int -ACE_Select_Reactor_T::suspend_i (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_T::suspend_i"); - if (this->handler_rep_.find (handle) == 0) - return -1; - - if (this->wait_set_.rd_mask_.is_set (handle)) - { - this->suspend_set_.rd_mask_.set_bit (handle); - this->wait_set_.rd_mask_.clr_bit (handle); - } - if (this->wait_set_.wr_mask_.is_set (handle)) - { - this->suspend_set_.wr_mask_.set_bit (handle); - this->wait_set_.wr_mask_.clr_bit (handle); - } - if (this->wait_set_.ex_mask_.is_set (handle)) - { - this->suspend_set_.ex_mask_.set_bit (handle); - this->wait_set_.ex_mask_.clr_bit (handle); - } - - // Kobi: we need to remove that handle from the - // dispatch set as well. We use that function with all the relevant - // masks - rd/wr/ex - all the mask. it is completely suspended - this->clear_dispatch_mask (handle, ACE_Event_Handler::RWE_MASK); - return 0; -} - -// Must be called with locks held - -template int -ACE_Select_Reactor_T::is_suspended_i (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Select_Reactor_T::is_suspended_i"); - if (this->handler_rep_.find (handle) == 0) - return 0; - - return this->suspend_set_.rd_mask_.is_set (handle) || - this->suspend_set_.wr_mask_.is_set (handle) || - this->suspend_set_.ex_mask_.is_set (handle) ; - -} - -// Must be called with locks held - -template int -ACE_Select_Reactor_T::register_handler_i - (ACE_HANDLE handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::register_handler_i"); - - // Insert the tuple into the Handler - // Repository. - return this->handler_rep_.bind (handle, event_handler, mask); -} - -template int -ACE_Select_Reactor_T::remove_handler_i - (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Select_Reactor_T::remove_handler_i"); - - // Unbind this handle. - return this->handler_rep_.unbind (handle, mask); -} - -template int -ACE_Select_Reactor_T::work_pending - (const ACE_Time_Value &max_wait_time) -{ - ACE_TRACE ("ACE_Select_Reactor_T::work_pending"); - - ACE_Time_Value mwt (max_wait_time); - ACE_MT (ACE_Countdown_Time countdown (&mwt)); - - ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, - ace_mon, - this->token_, - -1)); - - if (this->deactivated_) - return 0; - - // Update the countdown to reflect time waiting for the mutex. - ACE_MT (countdown.update ()); - - ACE_Time_Value timer_buf (0); - ACE_Time_Value *this_timeout = - this->timer_queue_->calculate_timeout (&mwt, &timer_buf); - - // Check if we have timers to fire. - int timers_pending = - (this_timeout != 0 && *this_timeout != mwt ? 1 : 0); - - u_long width = (u_long) this->handler_rep_.max_handlep1 (); - - ACE_Select_Reactor_Handle_Set fd_set; - fd_set.rd_mask_ = this->wait_set_.rd_mask_; - fd_set.wr_mask_ = this->wait_set_.wr_mask_; - fd_set.ex_mask_ = this->wait_set_.ex_mask_; - - int nfds = ACE_OS::select (int (width), - fd_set.rd_mask_, - fd_set.wr_mask_, - fd_set.ex_mask_, - this_timeout); - - // If timers are pending, override any timeout from the select() - // call. - return (nfds == 0 && timers_pending != 0 ? 1 : nfds); -} - -// Must be called with lock held. - -template int -ACE_Select_Reactor_T::wait_for_multiple_events - (ACE_Select_Reactor_Handle_Set &dispatch_set, - ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_Select_Reactor_T::wait_for_multiple_events"); - u_long width = 0; - ACE_Time_Value timer_buf (0); - ACE_Time_Value *this_timeout; - - int number_of_active_handles = this->any_ready (dispatch_set); - - // If there are any bits enabled in the then we'll - // handle those first, otherwise we'll block in was interrupted. - if (ACE_Sig_Handler::sig_pending () != 0) - { - ACE_Sig_Handler::sig_pending (0); - - // If any HANDLES in the are activated as a - // result of signals they should be dispatched since - // they may be time critical... - active_handle_count = this->any_ready (dispatch_set); - - // Record the fact that the Reactor has dispatched a - // handle_signal() method. We need this to return the - // appropriate count below. - signal_occurred = 1; - } - else - return -1; - } - - // Handle timers early since they may have higher latency - // constraints than I/O handlers. Ideally, the order of - // dispatching should be a strategy... - else if (this->dispatch_timer_handlers (other_handlers_dispatched) == -1) - // State has changed or timer queue has failed, exit loop. - break; - - // Check to see if there are no more I/O handles left to - // dispatch AFTER we've handled the timers... - else if (active_handle_count == 0) - return io_handlers_dispatched - + other_handlers_dispatched - + signal_occurred; - - // Next dispatch the notification handlers (if there are any to - // dispatch). These are required to handle multi-threads that - // are trying to update the . - - else if (this->dispatch_notification_handlers - (dispatch_set, - active_handle_count, - other_handlers_dispatched) == -1) - // State has changed or a serious failure has occured, so exit - // loop. - break; - - // Finally, dispatch the I/O handlers. - else if (this->dispatch_io_handlers - (dispatch_set, - active_handle_count, - io_handlers_dispatched) == -1) - // State has changed, so exit loop. - break; - - // if state changed, we need to re-eval active_handle_count, - // so we will not end with an endless loop - if (this->state_changed_) - { - active_handle_count = this->dispatch_set_.rd_mask_.num_set () - + this->dispatch_set_.wr_mask_.num_set () - + this->dispatch_set_.ex_mask_.num_set (); - } - } - while (active_handle_count > 0); - - return io_handlers_dispatched + other_handlers_dispatched + signal_occurred; -} - -template int -ACE_Select_Reactor_T::release_token (void) -{ -#if defined (ACE_WIN32) - this->token_.release (); - return (int) EXCEPTION_CONTINUE_SEARCH; -#else - return 0; -#endif /* ACE_WIN32 */ -} - -template int -ACE_Select_Reactor_T::handle_events - (ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_Select_Reactor_T::handle_events"); - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - - // Stash the current time -- the destructor of this object will - // automatically compute how much time elapsed since this method was - // called. - ACE_Countdown_Time countdown (max_wait_time); - - ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1); - - if (ACE_OS::thr_equal (ACE_Thread::self (), - this->owner_) == 0 || this->deactivated_) - return -1; - - // Update the countdown to reflect time waiting for the mutex. - countdown.update (); -#else - if (this->deactivated_) - return -1; -#endif /* ACE_MT_SAFE */ - - return this->handle_events_i (max_wait_time); -} - -template int -ACE_Select_Reactor_T::handle_events_i - (ACE_Time_Value *max_wait_time) -{ - int result = -1; - - ACE_SEH_TRY - { - // We use the data member dispatch_set_ as the current dispatch - // set. - - // We need to start from a clean dispatch_set - this->dispatch_set_.rd_mask_.reset (); - this->dispatch_set_.wr_mask_.reset (); - this->dispatch_set_.ex_mask_.reset (); - - int number_of_active_handles = - this->wait_for_multiple_events (this->dispatch_set_, - max_wait_time); - - result = - this->dispatch (number_of_active_handles, - this->dispatch_set_); - } - ACE_SEH_EXCEPT (this->release_token ()) - { - // As it stands now, we catch and then rethrow all Win32 - // structured exceptions so that we can make sure to release the - // lock correctly. - } - - return result; -} - -template int -ACE_Select_Reactor_T::check_handles (void) -{ - ACE_TRACE ("ACE_Select_Reactor_T::check_handles"); - -#if defined (ACE_WIN32) || defined (__MVS__) || defined (ACE_VXWORKS) - ACE_Time_Value time_poll = ACE_Time_Value::zero; - ACE_Handle_Set rd_mask; -#endif /* ACE_WIN32 || MVS || ACE_VXWORKS */ - - int result = 0; - - /* - * It's easier to run through the handler repository iterator, but that - * misses handles that are registered on a handler that doesn't implement - * get_handle(). So, build a handle set that's the union of the three - * wait_sets (rd, wrt, ex) and run through that. Bad handles get cleared - * out of all sets. - */ - ACE_HANDLE h; - ACE_Handle_Set check_set (this->wait_set_.rd_mask_); - ACE_Handle_Set_Iterator wr_iter (this->wait_set_.wr_mask_); - while ((h = wr_iter ()) != ACE_INVALID_HANDLE) - check_set.set_bit (h); - ACE_Handle_Set_Iterator ex_iter (this->wait_set_.ex_mask_); - while ((h = ex_iter ()) != ACE_INVALID_HANDLE) - check_set.set_bit (h); - - ACE_Handle_Set_Iterator check_iter (check_set); - while ((h = check_iter ()) != ACE_INVALID_HANDLE) - { - -#if defined (ACE_WIN32) || defined (__MVS__) || defined (ACE_VXWORKS) - // Win32 needs to do the check this way because fstat won't work on - // a socket handle. MVS Open Edition needs to do it this way because, - // even though the docs say to check a handle with either select or - // fstat, the fstat method always says the handle is ok. - // pSOS needs to do it this way because file handles and socket handles - // are maintained by separate pieces of the system. VxWorks needs the select - // variant since fstat always returns an error on socket FDs. - rd_mask.set_bit (h); - - int select_width; -# if defined (ACE_WIN32) - // This arg is ignored on Windows and causes pointer truncation - // warnings on 64-bit compiles. - select_width = 0; -# else - select_width = int (h) + 1; -# endif /* ACE_WIN32 */ - - if (ACE_OS::select (select_width, - rd_mask, 0, 0, - &time_poll) < 0) - { - result = 1; - this->remove_handler_i (h, ACE_Event_Handler::ALL_EVENTS_MASK); - } - rd_mask.clr_bit (h); -#else /* !ACE_WIN32 && !MVS && !VXWORKS */ - struct stat temp; - - if (ACE_OS::fstat (h, &temp) == -1) - { - result = 1; - this->remove_handler_i (h, ACE_Event_Handler::ALL_EVENTS_MASK); - } -#endif /* ACE_WIN32 || MVS */ - } - - return result; -} - -template void -ACE_Select_Reactor_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Select_Reactor_T::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - this->timer_queue_->dump (); - this->handler_rep_.dump (); - this->signal_handler_->dump (); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("delete_signal_handler_ = %d\n"), - this->delete_signal_handler_)); - - ACE_HANDLE h; - - for (ACE_Handle_Set_Iterator handle_iter_wr (this->wait_set_.wr_mask_); - (h = handle_iter_wr ()) != ACE_INVALID_HANDLE; - ++handle_iter_wr) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("write_handle = %d\n"), h)); - - for (ACE_Handle_Set_Iterator handle_iter_rd (this->wait_set_.rd_mask_); - (h = handle_iter_rd ()) != ACE_INVALID_HANDLE; - ++handle_iter_rd) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("read_handle = %d\n"), h)); - - for (ACE_Handle_Set_Iterator handle_iter_ex (this->wait_set_.ex_mask_); - (h = handle_iter_ex ()) != ACE_INVALID_HANDLE; - ++handle_iter_ex) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("except_handle = %d\n"), h)); - - for (ACE_Handle_Set_Iterator handle_iter_wr_ready (this->ready_set_.wr_mask_); - (h = handle_iter_wr_ready ()) != ACE_INVALID_HANDLE; - ++handle_iter_wr_ready) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("write_handle_ready = %d\n"), h)); - - for (ACE_Handle_Set_Iterator handle_iter_rd_ready (this->ready_set_.rd_mask_); - (h = handle_iter_rd_ready ()) != ACE_INVALID_HANDLE; - ++handle_iter_rd_ready) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("read_handle_ready = %d\n"), h)); - - for (ACE_Handle_Set_Iterator handle_iter_ex_ready (this->ready_set_.ex_mask_); - (h = handle_iter_ex_ready ()) != ACE_INVALID_HANDLE; - ++handle_iter_ex_ready) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("except_handle_ready = %d\n"), h)); - - for (ACE_Handle_Set_Iterator handle_iter_su_ready (this->suspend_set_.wr_mask_); - (h = handle_iter_su_ready ()) != ACE_INVALID_HANDLE; - ++handle_iter_su_ready) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("write_handle_suspend = %d\n"), h)); - - for (ACE_Handle_Set_Iterator handle_iter_su_ready (this->suspend_set_.rd_mask_); - (h = handle_iter_su_ready ()) != ACE_INVALID_HANDLE; - ++handle_iter_su_ready) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("read_handle_suspend = %d\n"), h)); - - for (ACE_Handle_Set_Iterator handle_iter_su_ready (this->suspend_set_.ex_mask_); - (h = handle_iter_su_ready ()) != ACE_INVALID_HANDLE; - ++handle_iter_su_ready) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("except_handle_suspend = %d\n"), h)); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("restart_ = %d\n"), this->restart_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("requeue_position_ = %d\n"), this->requeue_position_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("initialized_ = %d\n"), this->initialized_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("owner_ = %d\n"), this->owner_)); - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - this->notify_handler_->dump (); - this->token_.dump (); -#endif /* ACE_MT_SAFE */ - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_SELECT_REACTOR_T_CPP */ diff --git a/ace/Select_Reactor_T.h b/ace/Select_Reactor_T.h deleted file mode 100644 index bb9cdceed61..00000000000 --- a/ace/Select_Reactor_T.h +++ /dev/null @@ -1,718 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Select_Reactor_T.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SELECT_REACTOR_T_H -#define ACE_SELECT_REACTOR_T_H -#include /**/ "ace/pre.h" - -#include "ace/Select_Reactor_Base.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Lock_Adapter_T.h" -#include "ace/Token.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/* - * Hook for specializing the reactor with the concrete - * type, for example, select, or thread pool. - */ -//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -typedef ACE_Token ACE_SELECT_TOKEN; -#else -typedef ACE_Noop_Token ACE_SELECT_TOKEN; -#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ - -/** - * @class ACE_Select_Reactor_T - * - * @brief An object oriented event demultiplexor and event handler - * dispatcher. - * - * The ACE_Select_Reactor is an object-oriented event - * demultiplexor and event handler dispatcher. The sources of - * events that the ACE_Select_Reactor waits for and dispatches - * includes I/O events, signals, and timer events. All public - * methods acquire the main ACE_Reactor_Token lock and - * call down to private or protected methods, which assume that - * the lock is held and so therefore don't (re)acquire the lock. - */ -template -class ACE_Select_Reactor_T : public ACE_Select_Reactor_Impl -{ -public: - - // = Initialization and termination methods. - - /// If is non-0 then the reactor will - /// not create a notification pipe, which will save two I/O handles - /// but will elide the feature. If is - /// 1 the reactor is "signal-safe" when dispatching handlers to - /// signal events, whereas if is 0 the reactor will - /// be more efficient, but not signal-safe (which may be perfectly - /// fine if your application doesn't use the reactor to handle signals). - ACE_Select_Reactor_T (ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify *notify = 0, - int mask_signals = 1, - int s_queue = ACE_SELECT_TOKEN::FIFO); - - /// Initialize @c ACE_Select_Reactor with size @arg size. - /// If @arg disable_notify_pipe is non-0 then the reactor will - /// not create a notification pipe, which will save two I/O handles - /// but will elide the notification feature. If @arg mask_signals is - /// 1 the reactor is "signal-safe" when dispatching handlers to - /// signal events, whereas if @arg mask_signals is 0 the reactor will - /// be more efficient, but not signal-safe (which may be perfectly - /// fine if your application doesn't use the reactor to handle signals). - /** - * @note On Unix platforms, the size parameter should be as large as - * the maximum number of file descriptors allowed for a given - * process. This is necessary since a file descriptor is used - * to directly index the array of event handlers maintained by - * the Reactor's handler repository. Direct indexing is used - * for efficiency reasons. - */ - ACE_Select_Reactor_T (size_t size, - int restart = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify *notify = 0, - int mask_signals = 1, - int s_queue = ACE_SELECT_TOKEN::FIFO); - - /** - * Initialize the @c ACE_Select_Reactor to manage - * @arg max_number_of_handles. If @arg restart is non-0 then the - * @c ACE_Reactor's @c handle_events method will be restarted - * automatically when @c EINTR occurs. If @arg signal_handler or - * @arg timer_queue are non-0 they are used as the signal handler and - * timer queue, respectively. If @arg disable_notify_pipe is non-0 the - * notification pipe is not created, thereby saving two I/O handles. - * - * @note On Unix platforms, the maximum_number_of_handles parameter - * should be as large as the maximum number of file - * descriptors allowed for a given process. This is necessary - * since a file descriptor is used to directly index the array - * of event handlers maintained by the Reactor's handler - * repository. Direct indexing is used for efficiency - * reasons. - */ - virtual int open (size_t max_number_of_handles = DEFAULT_SIZE, - int restart = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify * = 0); - - /// Returns -1 (not used in this implementation); - virtual int current_info (ACE_HANDLE, size_t & /* size */); - - /// Use a user specified signal handler instead. - virtual int set_sig_handler (ACE_Sig_Handler *signal_handler); - - /// Set a user-specified timer queue. - virtual int timer_queue (ACE_Timer_Queue *tq); - - /// Return the current ACE_Timer_Queue. - virtual ACE_Timer_Queue *timer_queue (void) const; - - /// Close down the select_reactor and release all of its resources. - virtual int close (void); - - /// Close down the select_reactor and release all of its resources. - virtual ~ACE_Select_Reactor_T (void); - - // = Event loop drivers. - - /** - * Returns non-zero if there are I/O events "ready" for dispatching, - * but does not actually dispatch the event handlers. By default, - * don't block while checking this, i.e., "poll". - */ - virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); - - /** - * This event loop driver that blocks for @a max_wait_time before - * returning. It will return earlier if timer events, I/O events, - * or signal events occur. Note that @a max_wait_time can be 0, in - * which case this method blocks indefinitely until events occur. - * - * @a max_wait_time is decremented to reflect how much time this call - * took. For instance, if a time value of 3 seconds is passed to - * handle_events and an event occurs after 2 seconds, - * @a max_wait_time will equal 1 second. This can be used if an - * application wishes to handle events for some fixed amount of - * time. - * - * Returns the total number of I/O and Timer ACE_Event_Handler's - * that were dispatched, 0 if the @a max_wait_time elapsed without - * dispatching any handlers, or -1 if something goes wrong. - * - * Current is identical to - * . - */ - virtual int handle_events (ACE_Time_Value *max_wait_time = 0); - virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0); - - /** - * This method is just like the one above, except the - * @a max_wait_time value is a reference and can therefore never be - * NULL. - * - * Current is identical to - * . - */ - virtual int handle_events (ACE_Time_Value &max_wait_time); - virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); - - // = Event handling control. - - /** - * Return the status of Reactor. If this function returns 0, the reactor is - * actively handling events. If it returns non-zero, and - * return -1 immediately. - */ - virtual int deactivated (void); - - /** - * Control whether the Reactor will handle any more incoming events or not. - * If == 1, the Reactor will be disabled. By default, a reactor - * is in active state and can be deactivated/reactived as wish. - */ - virtual void deactivate (int do_stop); - - // = Register and remove ACE_Event_Handlers. - /** - * Register a with a particular . Note that the - * will call to - * extract the underlying I/O handle. - */ - virtual int register_handler (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /** - * Register a @a eh with a particular @a mask. Note that since the - * @a handle is given the Select_Reactor will *not* call - * ACE_Event_Handler::get_handle() to extract the underlying I/O - * handle. - */ - virtual int register_handler (ACE_HANDLE handle, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - -#if defined (ACE_WIN32) - - // Originally this interface was available for all platforms, but - // because ACE_HANDLE is an int on non-Win32 platforms, compilers - // are not able to tell the difference between - // register_handler(ACE_Event_Handler*,ACE_Reactor_Mask) and - // register_handler(ACE_Event_Handler*,ACE_HANDLE). Therefore, we - // have restricted this method to Win32 only. - - /// Not implemented. - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_HANDLE event_handle = ACE_INVALID_HANDLE); - -#endif /* ACE_WIN32 */ - - /// Not implemented. - virtual int register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /// Register @a eh with all the @a handles in the . - virtual int register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /** - * Register to handle the signal using the - * . Returns the that was previously registered - * (if any), along with the of the signal handler. - */ - virtual int register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0, - ACE_Event_Handler **old_sh = 0, - ACE_Sig_Action *old_disp = 0); - - /// Registers to handle a set of signals using the - /// . - virtual int register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0); - - /** - * Removes the binding of from the Select_Reactor. If - * there are no more bindings for this then it is removed from - * the Select_Reactor. Note that the Select_Reactor will call - * to extract the underlying I/O - * handle. - */ - virtual int remove_handler (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /** - * Removes the bind of whose handle is - * from the Select_Reactor. If there are no more bindings - * for this then it is removed from the Select_Reactor. - */ - virtual int remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask); - - /** - * Removes all the bindings for handles in the - * bind of . If there are no more bindings for any - * of these handlers then they are removed from the Select_Reactor. - */ - virtual int remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask); - - /** - * Remove the ACE_Event_Handler currently associated with . - * is ignored in this implementation since there is only - * one instance of a signal handler. Install the new disposition - * (if given) and return the previous disposition (if desired by the - * caller). Returns 0 on success and -1 if is invalid. - */ - virtual int remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp = 0, - int sigkey = -1); - - /// Calls for every signal in . - virtual int remove_handler (const ACE_Sig_Set &sigset); - - // = Suspend and resume Handlers. - - /// Temporarily suspend the associated with . - virtual int suspend_handler (ACE_Event_Handler *eh); - - /// Temporarily suspend the associated with . - virtual int suspend_handler (ACE_HANDLE handle); - - /// Suspend all in handle set temporarily. - virtual int suspend_handler (const ACE_Handle_Set &handles); - - /// Suspend all the in the Select_Reactor. - virtual int suspend_handlers (void); - - /// Resume a temporarily suspend associated with - /// . - virtual int resume_handler (ACE_Event_Handler *eh); - - /// Resume a temporarily suspended associated with - /// . - virtual int resume_handler (ACE_HANDLE handle); - - /// Resume all in handle set. - virtual int resume_handler (const ACE_Handle_Set &handles); - - /// Resume all the in the Select_Reactor. - virtual int resume_handlers (void); - - /** - * Return 1 if we any event associations were made by the reactor - * for the handles that it waits on, 0 otherwise. Since the - * Select_Reactor does not do any event associations, this function - * always return 0. - */ - virtual int uses_event_associations (void); - - // = Timer management. - /** - * Schedule an ACE_Event_Handler that will expire after an amount - * of time. The return value of this method, a timer_id value, - * uniquely identifies the event_handler in the ACE_Reactor's - * internal list of timers. - * This timer_id value can be used to cancel the timer - * with the cancel_timer() call. - * - * @see cancel_timer() - * @see reset_timer_interval() - * - * @param event_handler Event handler to schedule on reactor - * @param arg Argument passed to the handle_timeout() method of event_handler - * @param delay Time interval after which the timer will expire - * @param interval Time interval after which the timer will be automatically - * rescheduled - * @return -1 on failure, a timer_id value on success - */ - virtual long schedule_timer (ACE_Event_Handler * event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - - /** - * Resets the interval of the timer represented by to - * , which is specified in relative time to the current - * . If is equal to - * , the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_timer_interval (long timer_id, - const ACE_Time_Value &interval); - - /** - * Cancel all that match the address of - * . If is 0 then the - * method of will be invoked. - * Returns number of handler's cancelled. - */ - virtual int cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close = 1); - - /** - * Cancel the single ACE_Event_Handler that matches the - * value (which was returned from the method). If arg is - * non-NULL then it will be set to point to the ``magic cookie'' - * argument passed in when the was registered. This - * makes it possible to free up the memory and avoid memory leaks. - * If is 0 then the method - * of will be invoked. Returns 1 if cancellation - * succeeded and 0 if the wasn't found. - */ - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1); - - // = High-level Event_Handler scheduling operations - - /// ADD the dispatch MASK "bit" bound with the and the . - virtual int schedule_wakeup (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /// ADD the dispatch MASK "bit" bound with the and the . - virtual int schedule_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - /// CLR the dispatch MASK "bit" bound with the and the . - virtual int cancel_wakeup (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /// CLR the dispatch MASK "bit" bound with the and the . - virtual int cancel_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - // = Notification methods. - /** - * Called by a thread when it wants to unblock the Select_Reactor. - * This wakeups the if currently blocked in - * indicates that a passive-mode - // socket handle is "ready" and when we call . During this - // interval, the client can shutdown the connection, in which case, - // the call can hang! - this->peer_acceptor_.enable (ACE_NONBLOCK); - return 0; -} - -template -ACE_Accept_Strategy::ACE_Accept_Strategy - (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - int reuse_addr, - ACE_Reactor *reactor) - : reactor_ (reactor) -{ - ACE_TRACE ("ACE_Accept_Strategy::ACE_Accept_Strategy"); - - if (this->open (local_addr, reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("open"))); -} - -template int -ACE_Accept_Strategy::accept_svc_handler - (SVC_HANDLER *svc_handler) -{ - ACE_TRACE ("ACE_Accept_Strategy::accept_svc_handler"); - - // Try to find out if the implementation of the reactor that we are - // using requires us to reset the event association for the newly - // created handle. This is because the newly created handle will - // inherit the properties of the listen handle, including its event - // associations. - int reset_new_handle = this->reactor_->uses_event_associations (); - - if (this->peer_acceptor_.accept (svc_handler->peer (), // stream - 0, // remote address - 0, // timeout - 1, // restart - reset_new_handle // reset new handler - ) == -1) - { - // Ensure that errno is preserved in case the svc_handler - // close() method resets it - ACE_Errno_Guard error(errno); - - // Close down handler to avoid memory leaks. - svc_handler->close (0); - - return -1; - } - else - return 0; -} - -template int -ACE_Connect_Strategy::connect_svc_handler -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_Connect_Strategy::connect_svc_handler"); - - return this->connector_.connect (sh->peer (), - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Connect_Strategy::connect_svc_handler -(SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_Connect_Strategy::connect_svc_handler"); - - int const result = - this->connector_.connect (sh->peer (), - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); - sh_copy = sh; - return result; -} - -template int -ACE_Process_Strategy::open (size_t n_processes, - ACE_Event_Handler *acceptor, - ACE_Reactor *reactor, - int avoid_zombies) -{ - ACE_TRACE ("ACE_Process_Strategy::open"); - this->n_processes_ = n_processes; - this->acceptor_ = acceptor; - this->reactor_ = reactor; - this->flags_ = avoid_zombies; - - return 0; -} - -template int -ACE_Process_Strategy::activate_svc_handler (SVC_HANDLER *svc_handler, - void *arg) -{ - ACE_TRACE ("ACE_Process_Strategy::activate_svc_handler"); - - // If is non-0 then we won't create zombies. - switch (ACE::fork (ACE_LIB_TEXT ("child"), this->flags_)) - { - case -1: - { - ACE_Errno_Guard error (errno); - svc_handler->destroy (); - } - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("fork")), - -1); - /* NOTREACHED */ - case 0: // In child process. - - // Close down the SOCK_Acceptor's handle since we don't need to - // keep it open. - if (this->acceptor_ != 0) - // Ignore the return value here... - (void) this->reactor_->remove_handler (this->acceptor_, - ACE_Event_Handler::ACCEPT_MASK); - - // Call up to our ancestor in the inheritance to do the - // SVC_HANDLER initialization. - return this->inherited::activate_svc_handler (svc_handler, arg); - /* NOTREACHED */ - default: // In parent process. - // We need to close down the here because it's - // running in the child. - svc_handler->destroy (); - return 0; - } -} - -template -ACE_Cached_Connect_Strategy::ACE_Cached_Connect_Strategy -(creation_strategy_type *cre_s, - ACE_Concurrency_Strategy *con_s, - ACE_Recycling_Strategy *rec_s, - MUTEX *lock, - int delete_lock) - : lock_ (lock), - delete_lock_ (delete_lock), - reverse_lock_ (0), - creation_strategy_ (0), - delete_creation_strategy_ (0), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (0), - recycling_strategy_ (0), - delete_recycling_strategy_ (0) -{ - // Create a new lock if necessary. - if (this->lock_ == 0) - { - ACE_NEW (this->lock_, - MUTEX); - - this->delete_lock_ = 1; - } - - ACE_NEW (this->reverse_lock_, - REVERSE_MUTEX (*this->lock_)); - - if (this->open (cre_s, - con_s, - rec_s) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Cached_Connect_Strategy::ACE_Cached_Connect_Strategy"))); -} - -template -ACE_Cached_Connect_Strategy::~ACE_Cached_Connect_Strategy (void) -{ - if (this->delete_lock_) - delete this->lock_; - - delete this->reverse_lock_; - - if (this->delete_creation_strategy_) - delete this->creation_strategy_; - this->delete_creation_strategy_ = 0; - this->creation_strategy_ = 0; - - if (this->delete_concurrency_strategy_) - delete this->concurrency_strategy_; - this->delete_concurrency_strategy_ = 0; - this->concurrency_strategy_ = 0; - - if (this->delete_recycling_strategy_) - delete this->recycling_strategy_; - this->delete_recycling_strategy_ = 0; - this->recycling_strategy_ = 0; - - // Close down all cached service handlers. - CONNECTION_MAP_ENTRY *entry = 0; - for (CONNECTION_MAP_ITERATOR iterator (connection_map_); - iterator.next (entry); - iterator.advance ()) - { - entry->int_id_->recycler (0, 0); - entry->int_id_->close (); - } -} - -template int -ACE_Cached_Connect_Strategy::open -(creation_strategy_type *cre_s, - ACE_Concurrency_Strategy *con_s, - ACE_Recycling_Strategy *rec_s) -{ - // Initialize the creation strategy. - - // First we decide if we need to clean up. - if (this->creation_strategy_ != 0 && - this->delete_creation_strategy_ != 0 && - cre_s != 0) - { - delete this->creation_strategy_; - this->creation_strategy_ = 0; - this->delete_creation_strategy_ = 0; - } - - if (cre_s != 0) - this->creation_strategy_ = cre_s; - else if (this->creation_strategy_ == 0) - { - ACE_NEW_RETURN (this->creation_strategy_, - CREATION_STRATEGY, -1); - this->delete_creation_strategy_ = 1; - } - - // Initialize the concurrency strategy. - - if (this->concurrency_strategy_ != 0 && - this->delete_concurrency_strategy_ != 0 && - con_s != 0) - { - delete this->concurrency_strategy_; - this->concurrency_strategy_ = 0; - this->delete_concurrency_strategy_ = 0; - } - - if (con_s != 0) - this->concurrency_strategy_ = con_s; - else if (this->concurrency_strategy_ == 0) - { - ACE_NEW_RETURN (this->concurrency_strategy_, - CONCURRENCY_STRATEGY, -1); - this->delete_concurrency_strategy_ = 1; - } - - // Initialize the recycling strategy. - - if (this->recycling_strategy_ != 0 && - this->delete_recycling_strategy_ != 0 && - rec_s != 0) - { - delete this->recycling_strategy_; - this->recycling_strategy_ = 0; - this->delete_recycling_strategy_ = 0; - } - - if (rec_s != 0) - this->recycling_strategy_ = rec_s; - else if (this->recycling_strategy_ == 0) - { - ACE_NEW_RETURN (this->recycling_strategy_, - RECYCLING_STRATEGY, -1); - this->delete_recycling_strategy_ = 1; - } - - return 0; -} - -template int -ACE_Cached_Connect_Strategy::make_svc_handler - (SVC_HANDLER *&sh) -{ - return this->creation_strategy_->make_svc_handler (sh); -} - -template int -ACE_Cached_Connect_Strategy::activate_svc_handler - (SVC_HANDLER *svc_handler) -{ - return this->concurrency_strategy_->activate_svc_handler (svc_handler); -} - -template int -ACE_Cached_Connect_Strategy::assign_recycler - (SVC_HANDLER *svc_handler, - ACE_Connection_Recycling_Strategy *recycler, - const void *recycling_act) -{ - return this->recycling_strategy_->assign_recycler (svc_handler, - recycler, - recycling_act); -} - -template int -ACE_Cached_Connect_Strategy::prepare_for_recycling - (SVC_HANDLER *svc_handler) -{ - return this->recycling_strategy_->prepare_for_recycling (svc_handler); -} - -template int -ACE_Cached_Connect_Strategy::check_hint_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - CONNECTION_MAP_ENTRY *&entry, - int &found) -{ - ACE_UNUSED_ARG (remote_addr); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (local_addr); - ACE_UNUSED_ARG (reuse_addr); - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (perms); - - found = 0; - - // Get the recycling act for the svc_handler - CONNECTION_MAP_ENTRY *possible_entry = (CONNECTION_MAP_ENTRY *) sh->recycling_act (); - - // Check to see if the hint svc_handler has been closed down - if (possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED) - { - // If close, decrement refcount - if (possible_entry->ext_id_.decrement () == 0) - { - // If refcount goes to zero, close down the svc_handler - possible_entry->int_id_->recycler (0, 0); - possible_entry->int_id_->close (); - this->purge_i (possible_entry); - } - - // Hint not successful - found = 0; - - // Reset hint - sh = 0; - } - - // If hint is not closed, see if it is connected to the correct - // address and is recyclable - else if ((possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || - possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) && - possible_entry->ext_id_.subject () == remote_addr) - { - // Hint successful - found = 1; - - // Tell the that it should prepare itself for - // being recycled. - this->prepare_for_recycling (sh); - } - else - { - // This hint will not be used. - possible_entry->ext_id_.decrement (); - - // Hint not successful - found = 0; - - // If is not connected to the correct address or is busy, - // we will not use it. - sh = 0; - } - - if (found) - entry = possible_entry; - - return 0; -} - -template int -ACE_Cached_Connect_Strategy::find_or_create_svc_handler_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - CONNECTION_MAP_ENTRY *&entry, - int &found) -{ - // Explicit type conversion - REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr); - - // Try to find the address in the cache. Only if we don't find it - // do we create a new and connect it with the server. - if (this->find (search_addr, entry) == -1) - { - // Set the flag - found = 0; - - // We need to use a temporary variable here since we are not - // allowed to change because other threads may use this - // when we let go of the lock during the OS level connect. - // - // Note that making a new svc_handler, connecting remotely, - // binding to the map, and assigning of the hint and recycler - // should be atomic to the outside world. - SVC_HANDLER *potential_handler = 0; - - // Create a new svc_handler - if (this->make_svc_handler (potential_handler) == -1) - return -1; - - // Actively establish the connection. This is a timed blocking - // connect. - if (this->new_connection (potential_handler, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms) == -1) - { - // If connect() failed because of timeouts, we have to - // reject the connection entirely. This is necessary since - // currently there is no way for the non-blocking connects - // to complete and for the to notify the cache - // of the completion of connect(). - if (errno == EWOULDBLOCK) - errno = ENOTSUP; - - // Close the svc handler. - potential_handler->close (0); - - return -1; - } - else - { - // Insert the new SVC_HANDLER instance into the cache. - if (this->connection_map_.bind (search_addr, - potential_handler, - entry) == -1) - { - // Close the svc handler. - potential_handler->close (0); - - return -1; - } - - // Everything succeeded as planned. Assign to . - sh = potential_handler; - - // Set the recycler and the recycling act - this->assign_recycler (sh, this, entry); - } - } - else - // We found a cached svc_handler. - { - // Set the flag - found = 1; - - // Get the cached - sh = entry->int_id_; - - // Tell the that it should prepare itself for - // being recycled. - this->prepare_for_recycling (sh); - } - - return 0; -} - -template int -ACE_Cached_Connect_Strategy::new_connection -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - // Yow, Reverse Guard! Let go of the lock for the duration of the - // actual connect. This will allow other threads to hack on the - // connection cache while this thread creates the new connection. - ACE_GUARD_RETURN (REVERSE_MUTEX, ace_mon, *this->reverse_lock_, -1); - - return this->CONNECT_STRATEGY::connect_svc_handler (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Cached_Connect_Strategy::connect_svc_handler -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - int found = 0; - - // This artificial scope is required since we need to let go of the - // lock *before* registering the newly created handler with the - // Reactor. - { - // Synchronization is required here as the setting of the - // recyclable state must be done atomically with the finding and - // binding of the service handler in the cache. - ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1); - - int result = this->connect_svc_handler_i (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms, - found); - if (result != 0) - return result; - - } - - // If it is a new connection, activate it. - // - // Note: This activation is outside the scope of the lock of the - // cached connector. This is necessary to avoid subtle deadlock - // conditions with this lock and the Reactor lock. - - if (!found) - { - if (this->activate_svc_handler (sh) == -1) - { - // If an error occurs while activating the handler, the - // method will close the handler. - // This in turn will remove this entry from the internal - // table. - - // Synchronization is required here as the setting of the - // handler to zero must be done atomically with the users of - // the cache. - ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1); - - // Reset handler. - sh = 0; - - return -1; - } - } - - return 0; -} - -template int -ACE_Cached_Connect_Strategy::connect_svc_handler -(SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - int found = 0; - - // This artificial scope is required since we need to let go of the - // lock *before* registering the newly created handler with the - // Reactor. - { - // Synchronization is required here as the setting of the - // recyclable state must be done atomically with the finding and - // binding of the service handler in the cache. - ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1); - - int result = this->connect_svc_handler_i (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms, - found); - sh_copy = sh; - - if (result != 0) - return result; - - } - - // If it is a new connection, activate it. - // - // Note: This activation is outside the scope of the lock of the - // cached connector. This is necessary to avoid subtle deadlock - // conditions with this lock and the Reactor lock. - - if (!found) - { - if (this->activate_svc_handler (sh_copy) == -1) - { - // If an error occurs while activating the handler, the - // method will close the handler. - // This in turn will remove this entry from the internal - // table. - - // Synchronization is required here as the setting of the - // handler to zero must be done atomically with the users of - // the cache. - ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1); - - // Reset handler. - sh = 0; - sh_copy = 0; - - return -1; - } - } - - return 0; -} - -template int -ACE_Cached_Connect_Strategy::connect_svc_handler_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - int& found) -{ - CONNECTION_MAP_ENTRY *entry = 0; - - // Check if the user passed a hint svc_handler - if (sh != 0) - { - int result = this->check_hint_i (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms, - entry, - found); - if (result != 0) - return result; - } - - // If not found - if (!found) - { - int result = this->find_or_create_svc_handler_i (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms, - entry, - found); - if (result != 0) - return result; - } - - // For all successful cases: mark the in the cache - // as being . Therefore recyclable is BUSY. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY); - - // And increment the refcount - entry->ext_id_.increment (); - - return 0; -} - -template int -ACE_Cached_Connect_Strategy::cache (const void *recycling_act) -{ - // Synchronization is required here as the setting of the recyclable - // state must be done atomically with respect to other threads that - // are querying the cache. - ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1); - - return this->cache_i (recycling_act); -} - -template int -ACE_Cached_Connect_Strategy::cache_i (const void *recycling_act) -{ - // The wonders and perils of ACT - CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act; - - // Mark the in the cache as not being . - // Therefore recyclable is IDLE. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_IDLE_AND_PURGABLE); - - return 0; -} - -template int -ACE_Cached_Connect_Strategy::recycle_state (const void *recycling_act, - ACE_Recyclable_State new_state) -{ - // Synchronization is required here as the setting of the recyclable - // state must be done atomically with respect to other threads that - // are querying the cache. - ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1); - - return this->recycle_state_i (recycling_act, - new_state); -} - -template int -ACE_Cached_Connect_Strategy::recycle_state_i (const void *recycling_act, - ACE_Recyclable_State new_state) -{ - // The wonders and perils of ACT - CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act; - - // Mark the in the cache as not being . - // Therefore recyclable is IDLE. - entry->ext_id_.recycle_state (new_state); - - return 0; -} - -template ACE_Recyclable_State -ACE_Cached_Connect_Strategy::recycle_state (const void *recycling_act) const -{ - // Const cast. - SELF *fake_this = const_cast (this); - - // Synchronization is required here. - ACE_GUARD_RETURN (MUTEX, ace_mon, *fake_this->lock_, ACE_RECYCLABLE_UNKNOWN); - - return this->recycle_state_i (recycling_act); -} - -template ACE_Recyclable_State -ACE_Cached_Connect_Strategy::recycle_state_i (const void *recycling_act) const -{ - // The wonders and perils of ACT - CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act; - - // Mark the in the cache as not being . - // Therefore recyclable is IDLE. - return entry->ext_id_.recycle_state (); -} - -template int -ACE_Cached_Connect_Strategy::purge (const void *recycling_act) -{ - // Excluded other threads from changing cache while we take this - // entry out. - ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1); - - return this->purge_i (recycling_act); -} - -template int -ACE_Cached_Connect_Strategy::purge_i (const void *recycling_act) -{ - // The wonders and perils of ACT - CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act; - - return this->connection_map_.unbind (entry); -} - -template int -ACE_Cached_Connect_Strategy::mark_as_closed (const void *recycling_act) -{ - // Excluded other threads from changing cache while we take this - // entry out. - ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1); - - return this->mark_as_closed_i (recycling_act); -} - -template int -ACE_Cached_Connect_Strategy::mark_as_closed_i (const void *recycling_act) -{ - // The wonders and perils of ACT - CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act; - - // Mark the in the cache as CLOSED. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_CLOSED); - - return 0; -} - -template int -ACE_Cached_Connect_Strategy::cleanup_hint (const void *recycling_act, - void **act_holder) -{ - // Excluded other threads from changing cache while we take this - // entry out. - ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1); - - return this->cleanup_hint_i (recycling_act, - act_holder); -} - -template int -ACE_Cached_Connect_Strategy::cleanup_hint_i (const void *recycling_act, - void **act_holder) -{ - // Reset the <*act_holder> in the confines and protection of the - // lock. - if (act_holder) - *act_holder = 0; - - // The wonders and perils of ACT - CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act; - - // Decrement the refcount on the . - int refcount = entry->ext_id_.decrement (); - - // If the svc_handler state is closed and the refcount == 0, call - // close() on svc_handler. - if (entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED && - refcount == 0) - { - entry->int_id_->recycler (0, 0); - entry->int_id_->close (); - this->purge_i (entry); - } - - return 0; -} - -template ACE_Creation_Strategy * -ACE_Cached_Connect_Strategy::creation_strategy (void) const -{ - return this->creation_strategy_; -} - -template ACE_Recycling_Strategy * -ACE_Cached_Connect_Strategy::recycling_strategy (void) const -{ - return this->recycling_strategy_; -} - -template ACE_Concurrency_Strategy * -ACE_Cached_Connect_Strategy::concurrency_strategy (void) const -{ - return this->concurrency_strategy_; -} - -template int -ACE_Cached_Connect_Strategy::find ( - REFCOUNTED_HASH_RECYCLABLE_ADDRESS &search_addr, - CONNECTION_MAP_ENTRY *&entry) -{ - typedef ACE_Hash_Map_Bucket_Iterator, - ACE_Equal_To, - ACE_Null_Mutex> - CONNECTION_MAP_BUCKET_ITERATOR; - - CONNECTION_MAP_BUCKET_ITERATOR iterator (this->connection_map_, - search_addr); - - CONNECTION_MAP_BUCKET_ITERATOR end (this->connection_map_, - search_addr, - 1); - - for (; - iterator != end; - ++iterator) - { - REFCOUNTED_HASH_RECYCLABLE_ADDRESS &addr = (*iterator).ext_id_; - - if (addr.recycle_state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE && - addr.recycle_state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) - continue; - - if (addr.subject () != search_addr.subject ()) - continue; - - entry = &(*iterator); - return 0; - } - - return -1; -} - -template void -ACE_DLL_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_DLL_Strategy::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Concurrency_Strategy::~ACE_Concurrency_Strategy (void) -{ - ACE_TRACE ("ACE_Concurrency_Strategy::~ACE_Concurrency_Strategy"); -} - - -template void -ACE_Concurrency_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Concurrency_Strategy::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Reactive_Strategy::~ACE_Reactive_Strategy (void) -{ - ACE_TRACE ("ACE_Reactive_Strategy::~ACE_Reactive_Strategy"); -} - - -template void -ACE_Reactive_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Reactive_Strategy::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Thread_Strategy::~ACE_Thread_Strategy (void) -{ - ACE_TRACE ("ACE_Thread_Strategy::~ACE_Thread_Strategy"); -} - -template void -ACE_Thread_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Thread_Strategy::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Accept_Strategy::~ACE_Accept_Strategy (void) -{ - ACE_TRACE ("ACE_Accept_Strategy::~ACE_Accept_Strategy"); - - // Close the underlying acceptor. - this->peer_acceptor_.close (); -} - -template ACE_HANDLE -ACE_Accept_Strategy::get_handle (void) const -{ - ACE_TRACE ("ACE_Accept_Strategy::get_handle"); - return this->peer_acceptor_.get_handle (); -} - -template ACE_PEER_ACCEPTOR & -ACE_Accept_Strategy::acceptor (void) const -{ - ACE_TRACE ("ACE_Accept_Strategy::acceptor"); - return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; -} - -template void -ACE_Accept_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Accept_Strategy::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Connect_Strategy::~ACE_Connect_Strategy (void) -{ - ACE_TRACE ("ACE_Connect_Strategy::~ACE_Connect_Strategy"); -} - -template ACE_PEER_CONNECTOR & -ACE_Connect_Strategy::connector (void) const -{ - ACE_TRACE ("ACE_Connect_Strategy::connector"); - return (ACE_PEER_CONNECTOR &) this->connector_; -} - -template void -ACE_Connect_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Connect_Strategy::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Process_Strategy::~ACE_Process_Strategy (void) -{ - ACE_TRACE ("ACE_Process_Strategy::~ACE_Process_Strategy"); -} - -template void -ACE_Process_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Process_Strategy::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Scheduling_Strategy::~ACE_Scheduling_Strategy (void) -{ - ACE_TRACE ("ACE_Scheduling_Strategy::~ACE_Scheduling_Strategy"); -} - -template int -ACE_Scheduling_Strategy::suspend (void) -{ - ACE_TRACE ("ACE_Scheduling_Strategy::suspend"); - return -1; -} - -template int -ACE_Scheduling_Strategy::resume (void) -{ - ACE_TRACE ("ACE_Scheduling_Strategy::resume"); - return -1; -} - -template void -ACE_Scheduling_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Scheduling_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Schedule_All_Reactive_Strategy::suspend (void) -{ - ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy::suspend"); - return this->reactor_->suspend_handlers (); -} - -template int -ACE_Schedule_All_Reactive_Strategy::resume (void) -{ - ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy::resume"); - return this->reactor_->resume_handlers (); -} - -template void -ACE_Schedule_All_Reactive_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy::dump"); - - ACE_Scheduling_Strategy::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Schedule_All_Threaded_Strategy::suspend (void) -{ - ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy::suspend"); - return this->thr_mgr_->suspend_all (); -} - -template int -ACE_Schedule_All_Threaded_Strategy::resume (void) -{ - ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy::resume"); - return this->thr_mgr_->resume_all (); -} - -template void -ACE_Schedule_All_Threaded_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy::dump"); - - ACE_Scheduling_Strategy::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Refcounted_Hash_Recyclable::~ACE_Refcounted_Hash_Recyclable (void) -{ -} - -template void -ACE_Singleton_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Singleton_Strategy::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Creation_Strategy::~ACE_Creation_Strategy (void) -{ - ACE_TRACE ("ACE_Creation_Strategy::~ACE_Creation_Strategy"); -} - -// Default behavior is to make a new SVC_HANDLER, passing in the -// Thread_Manager (if any). - -template int -ACE_Creation_Strategy::make_svc_handler (SVC_HANDLER *&sh) -{ - ACE_TRACE ("ACE_Creation_Strategy::make_svc_handler"); - - if (sh == 0) - ACE_NEW_RETURN (sh, SVC_HANDLER (this->thr_mgr_), -1); - sh->reactor (this->reactor_); - return 0; -} - -template void -ACE_Creation_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Creation_Strategy::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_NOOP_Creation_Strategy::make_svc_handler (SVC_HANDLER *&) -{ - ACE_TRACE ("ACE_NOOP_Creation_Strategy::make_svc_handler"); - return 0; -} - -template int -ACE_NOOP_Concurrency_Strategy::activate_svc_handler (SVC_HANDLER *, - void *) -{ - ACE_TRACE ("ACE_NOOP_Concurrency_Strategy::activate_svc_handler"); - return 0; -} - - -ACE_ALLOC_HOOK_DEFINE(ACE_Creation_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_Singleton_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_DLL_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_Concurrency_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_Connect_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_Process_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_Accept_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Strategy) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_STRATEGIES_T_CPP */ diff --git a/ace/Strategies_T.h b/ace/Strategies_T.h deleted file mode 100644 index b9e7e6b9139..00000000000 --- a/ace/Strategies_T.h +++ /dev/null @@ -1,1076 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Strategies_T.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_STRATEGIES_T_H -#define ACE_STRATEGIES_T_H - -#include /**/ "ace/pre.h" - -#include "ace/Hash_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Reactor.h" -#include "ace/Thread_Manager.h" -#include "ace/Connection_Recycling_Strategy.h" -#include "ace/Refcountable.h" -#include "ace/Hashable.h" -#include "ace/Recyclable.h" -#include "ace/Reverse_Lock_T.h" - -// Needed for broken linkers that can't grok long symbols. -#define ACE_Refcounted_Hash_Recyclable ARHR - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Service_Repository; - -/** - * @class ACE_Recycling_Strategy - * - * @brief Defines the interface (and default implementation) for - * specifying a recycling strategy for a SVC_HANDLER. - * - * Acts as a consular to the Svc_Handler, preparing it for the - * tough times ahead when the Svc_Handler will be recycled. - */ -template -class ACE_Recycling_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_TYPENAME SVC_HANDLER::addr_type addr_type; - typedef SVC_HANDLER handler_type; - typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - - /// Virtual Destructor - virtual ~ACE_Recycling_Strategy (void); - - /// Tell the Svc_Handler something about the recycler, so that it can - /// reach the recycler when necessary. - virtual int assign_recycler (SVC_HANDLER *svc_handler, - ACE_Connection_Recycling_Strategy *recycler, - const void *recycling_act); - - /// This allows us to prepare the svc_handler for recycling. - virtual int prepare_for_recycling (SVC_HANDLER *svc_handler); -}; - -/** - * @class ACE_Creation_Strategy - * - * @brief Defines the interface for specifying a creation strategy for - * a SVC_HANDLER. - * - * The default behavior is to make a new SVC_HANDLER. However, - * subclasses can override this strategy to perform SVC_HANDLER - * creation in any way that they like (such as creating subclass - * instances of SVC_HANDLER, using a singleton, dynamically - * linking the handler, etc.). - */ -template -class ACE_Creation_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_TYPENAME SVC_HANDLER::addr_type addr_type; - typedef SVC_HANDLER handler_type; - typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - - // = Initialization and termination methods. - - /// Default constructor. - ACE_Creation_Strategy (ACE_Thread_Manager * = 0, - ACE_Reactor * = ACE_Reactor::instance ()); - - /// An ACE_Thread_Manager is useful when creating active objects and - /// the ACE_Reactor is used to initialize the service handler's reactor. - int open (ACE_Thread_Manager * = 0, - ACE_Reactor * = ACE_Reactor::instance ()); - - virtual ~ACE_Creation_Strategy (void); - - // = Factory method. - /** - * Create a SVC_HANDLER with the appropriate creation strategy. The - * default behavior of this method is to make a new if - * == 0 (passing in the ), else is - * unchanged. Returns -1 on failure, else 0. - */ - virtual int make_svc_handler (SVC_HANDLER *&sh); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Pointer to a thread manager. - ACE_Thread_Manager *thr_mgr_; - - /// Pointer to an ACE_Reactor. - ACE_Reactor *reactor_; -}; - -/** - * @class ACE_Singleton_Strategy - * - * @brief Defines the interface for specifying a creation strategy for - * a that always returns the same (i.e., - * it's a Singleton). - * - * Note that this class takes over the ownership of the - * SVC_HANDLER passed into it as a parameter and it becomes - * responsible for deleting this object. - */ -template -class ACE_Singleton_Strategy : public ACE_Creation_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Creation_Strategy base_type; - - // = Initialization and termination methods. - ACE_Singleton_Strategy (SVC_HANDLER * = 0, - ACE_Thread_Manager * = 0); - int open (SVC_HANDLER *, - ACE_Thread_Manager * = 0); - virtual ~ACE_Singleton_Strategy (void); - - // = Factory method. - /// Create a Singleton SVC_HANDLER by always returning the same - /// SVC_HANDLER. Returns -1 on failure, else 0. - virtual int make_svc_handler (SVC_HANDLER *&); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Pointer to the Singleton svc_handler. - SVC_HANDLER *svc_handler_; - - /// Keep track of whether we need to delete the . - int delete_svc_handler_; -}; - -/** - * @class ACE_DLL_Strategy - * - * @brief Defines the interface for specifying a creation strategy for - * a SVC_HANDLER based on dynamic linking of the SVC_HANDLER. - */ -template -class ACE_DLL_Strategy : public ACE_Creation_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Creation_Strategy base_type; - - // = Intialization and termination methods. - - /// "Do-nothing" constructor. - ACE_DLL_Strategy (void); - - /// Initialize the DLL strategy based upon the service's DLL - /// information contained in the string. - ACE_DLL_Strategy (const ACE_TCHAR dll_name[], - const ACE_TCHAR factory_function[], - const ACE_TCHAR svc_name[], - ACE_Service_Repository *, - ACE_Thread_Manager * = 0); - - /// Initialize the DLL strategy based upon the service's DLL - /// information contained in the string. - int open (const ACE_TCHAR dll_name[], - const ACE_TCHAR factory_function[], - const ACE_TCHAR svc_name[], - ACE_Service_Repository *, - ACE_Thread_Manager * = 0); - - // = Factory method. - /// Create a SVC_HANDLER by dynamically linking it from a DLL. - /// Returns -1 on failure, else 0. - virtual int make_svc_handler (SVC_HANDLER *&); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - typedef ACE_Creation_Strategy inherited; - - /// Name of the DLL to dynamically link. - ACE_TCHAR dll_name_[MAXPATHLEN + 1]; - - /// Name of the factory function in the shared library to use to - /// obtain a pointer to the new SVC_HANDLER. - ACE_TCHAR factory_function_[MAXPATHLEN + 1]; - - /// Name of the service. - ACE_TCHAR svc_name_[MAXNAMELEN + 1]; - - /// Pointer to the . - ACE_Service_Repository *svc_rep_; -}; - -/** - * @class ACE_Concurrency_Strategy - * - * @brief Defines the interface for specifying a concurrency strategy - * for a SVC_HANDLER. - * - * Default behavior is to activate the SVC_HANDLER by calling - * its method (which allows the SVC_HANDLER to define its - * own concurrency strategy). However, subclasses can override - * this default strategy to do more sophisticated concurrency - * activations (such as creating the SVC_HANDLER as an active - * object via multi-threading or multi-processing). - */ -template -class ACE_Concurrency_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_TYPENAME SVC_HANDLER::addr_type addr_type; - typedef SVC_HANDLER handler_type; - typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - - /// Constructor - ACE_Concurrency_Strategy (int flags = 0); - - // = Factory method. - /** - * Activate the with an appropriate concurrency - * strategy. The default behavior of this method is to activate the - * SVC_HANDLER by calling its method (which allows the - * SVC_HANDLER to define its own concurrency strategy). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler, - void *arg = 0); - - virtual ~ACE_Concurrency_Strategy (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - /// Flags that are parsed to set options for the connected - /// . - int flags_; -}; - -/** - * @class ACE_Reactive_Strategy - * - * @brief Defines the interface for specifying a reactive concurrency - * strategy for a SVC_HANDLER, where all upcalls to @c handle_*() - * methods run in the reactor's thread of control. - * - * This class provides a strategy that registers the - * with a . - */ -template -class ACE_Reactive_Strategy : public ACE_Concurrency_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Concurrency_Strategy base_type; - - // = Intialization and termination methods. - /// "Do-nothing constructor" - ACE_Reactive_Strategy (int flags = 0); - - /// Initialize the strategy. - ACE_Reactive_Strategy (ACE_Reactor *reactor, - ACE_Reactor_Mask = ACE_Event_Handler::READ_MASK, - int flags = 0); - - /// Initialize the strategy. - virtual int open (ACE_Reactor *reactor, - ACE_Reactor_Mask = ACE_Event_Handler::READ_MASK, - int flags = 0); - - /// Destructor. - virtual ~ACE_Reactive_Strategy (void); - - // = Factory method. - /// Activate the by registering it with the - /// and then calling it's hook. - virtual int activate_svc_handler (SVC_HANDLER *svc_handler, - void *arg = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - typedef ACE_Concurrency_Strategy inherited; - - /// Pointer to the Reactor we'll use to register the . - ACE_Reactor *reactor_; - - /// The mask that we pass to the when we register the - /// . - ACE_Reactor_Mask mask_; -}; - -/** - * @class ACE_Thread_Strategy - * - * @brief Defines the interface for specifying a concurrency strategy - * for a based on multithreading. - * - * This class provides a strategy that manages the creation of threads - * to handle requests from clients concurrently via a - * thread-per-connection model. It behaves as a "thread factory", - * spawning threads "on-demand" to run the service specified by a - * user-supplied . - */ -template -class ACE_Thread_Strategy : public ACE_Concurrency_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Concurrency_Strategy base_type; - - // = Intialization and termination methods. - /// "Do-nothing constructor" - ACE_Thread_Strategy (int flags = 0); - - /// Initialize the strategy. - ACE_Thread_Strategy (ACE_Thread_Manager *tm, - long thr_flags, - int n_threads = 1, - int flags = 0); - - /// Initialize the strategy. - virtual int open (ACE_Thread_Manager *tm, - long thr_flags, - int n_threads = 1, - int flags = 0); - - virtual ~ACE_Thread_Strategy (void); - - // = Factory method. - /** - * Activate the with an appropriate concurrency - * strategy. This method activates the SVC_HANDLER by first calling - * its method and then calling its method to turn - * it into an active object. - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler, - void *arg = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - typedef ACE_Concurrency_Strategy inherited; - - /// Thread manager for this class (must be provided). - ACE_Thread_Manager *thr_mgr_; - - /// Flags to pass into the method. - long thr_flags_; - - /// Number of threads to spawn. - int n_threads_; -}; - -/** - * @class ACE_Process_Strategy - * - * @brief Defines the interface for specifying a concurrency strategy - * for a @c SVC_HANDLER based on multiprocessing. - * - * This class provides a strategy that manages the creation of - * processes to handle requests from clients concurrently using a - * process-per-connection model. It behaves as a "process factory", - * using @c ACE::fork() to fork threads "on-demand" to run the service - * specified by a user-supplied @c SVC_HANDLER in a separate process. - */ -template -class ACE_Process_Strategy : public ACE_Concurrency_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Concurrency_Strategy base_type; - - // = Intialization and termination methods. - - /// Initialize the strategy. If @a avoid_zombies is non-0 then set a - /// flag to ACE::fork() to avoid zombies. - ACE_Process_Strategy (size_t n_processes = 1, - ACE_Event_Handler *acceptor = 0, - ACE_Reactor * = 0, - int avoid_zombies = 0); - - /// Initialize the strategy. If @a avoid_zombies is non-0 then set a - /// flag to ACE::fork() to avoid zombies. - virtual int open (size_t n_processes = 1, - ACE_Event_Handler *acceptor = 0, - ACE_Reactor * = 0, - int avoid_zombies = 0); - - virtual ~ACE_Process_Strategy (void); - - // = Factory method. - /** - * Activate the @a svc_handler with an appropriate concurrency - * strategy. This method activates the SVC_HANDLER by first forking - * and then calling the @c open() method of the SVC_HANDLER in the - * child. - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler, - void *arg = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - typedef ACE_Concurrency_Strategy inherited; - - /// Number of processes to spawn. - size_t n_processes_; - - /** - * This is the @c Acceptor in the parent is listening on. We need to - * make sure that we remove it from the Reactor and close it down in - * the child. - */ - ACE_Event_Handler *acceptor_; - - /** - * This is the reactor the child is using in conjunction with the - * acceptor. We need to remove the acceptor from this reactor - * in the child. - */ - ACE_Reactor *reactor_; -}; - -/** - * @class ACE_Accept_Strategy - * - * @brief Defines the interface for specifying a passive connection - * acceptance strategy for a SVC_HANDLER. - * - * This class provides a strategy that manages passive - * connection acceptance of a client. - */ -template -class ACE_Accept_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_PEER_ACCEPTOR_ADDR addr_type; - typedef ACE_PEER_ACCEPTOR acceptor_type; - typedef SVC_HANDLER handler_type; - typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - - // = Initialization and termination methods. - /// Default constructor. - ACE_Accept_Strategy (ACE_Reactor *reactor = ACE_Reactor::instance ()); - - /// Initialize the @c peer_acceptor_ with @a local_addr. - ACE_Accept_Strategy (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - int restart = 0, - ACE_Reactor *reactor = ACE_Reactor::instance ()); - - /// Initialize the with @a local_addr, indicating - /// whether to @a reuse_addr if it's already in use. - virtual int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - int reuse_addr = 0); - - /// Return the underlying ACE_HANDLE of the . - virtual ACE_HANDLE get_handle (void) const; - - /// Return a reference to the . - virtual ACE_PEER_ACCEPTOR &acceptor (void) const; - - virtual ~ACE_Accept_Strategy (void); - - // = Factory method. - /// The default behavior delegates to the method of the - /// PEER_ACCEPTOR. - virtual int accept_svc_handler (SVC_HANDLER *); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Factory that establishes connections passively. - ACE_PEER_ACCEPTOR peer_acceptor_; - - /// Pointer to the reactor used by the Acceptor. - ACE_Reactor *reactor_; - - /// Needed to reopen the socket if fails. - int reuse_addr_; - - /// Needed to reopen the socket if fails. - ACE_PEER_ACCEPTOR_ADDR peer_acceptor_addr_; -}; - -/** - * @class ACE_Connect_Strategy - * - * @brief Defines the interface for specifying an active - * connection establishment strategy for a SVC_HANDLER. - * - * This class provides a strategy that manages active - * connection establishment to a server. - */ -template -class ACE_Connect_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_PEER_CONNECTOR_ADDR addr_type; - typedef ACE_PEER_CONNECTOR connector_type; - typedef SVC_HANDLER handler_type; - typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - - // = Initialization and termination methods. - /// Default constructor. - ACE_Connect_Strategy (void); - - /// Return a reference to the . - virtual ACE_PEER_CONNECTOR &connector (void) const; - - virtual ~ACE_Connect_Strategy (void); - - // = Factory method. - /// The default behavior delegates to the method of the - /// . - virtual int connect_svc_handler (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /** - * The default behavior delegates to the method of the - * . - * Please check the documentation in Connector.h for more details. - */ - virtual int connect_svc_handler (SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Factory that establishes connections actively. - ACE_PEER_CONNECTOR connector_; -}; - -/** - * @class ACE_Scheduling_Strategy - * - * @brief Defines the interface for specifying how to suspend and - * resume a service . - * - * This class provides a strategy that allows arbitrarily - * sophisticated service suspension and resumption. The default - * behavior is to do nothing... - */ -template -class ACE_Scheduling_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_TYPENAME SVC_HANDLER::addr_type addr_type; - typedef SVC_HANDLER handler_type; - typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - - // = Initialization and termination methods. - - /// Constructor - ACE_Scheduling_Strategy (SVC_HANDLER * = 0); - - /// Destructor - virtual ~ACE_Scheduling_Strategy (void); - - // = Scheduling methods - - /// Suspend hook. - virtual int suspend (void); - - /// Resume hook. - virtual int resume (void); - - /// Dump the state of the object. - virtual void dump (void) const; -}; - -/** - * @class ACE_Schedule_All_Reactive_Strategy - * - * @brief Defines the interface for specifying how to suspend and - * resume a single-threaded reactive service . - * - * This class provides a strategy that suspends and resumes all - * the Event_Handlers in a Reactor in one fell swoop. - */ -template -class ACE_Schedule_All_Reactive_Strategy - : public ACE_Scheduling_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Scheduling_Strategy base_type; - - // = Initialization and termination methods. - /// Constructor - ACE_Schedule_All_Reactive_Strategy (SVC_HANDLER * = 0); - - // = Scheduling methods - - /// Suspend hook. - virtual int suspend (void); - - /// Resume hook. - virtual int resume (void); - - /// Dump the state of the object. - virtual void dump (void) const; - -protected: - - /// Reactor - ACE_Reactor *reactor_; -}; - -/** - * @class ACE_Schedule_All_Threaded_Strategy - * - * @brief Defines the interface for specifying how to suspend and - * resume a multithreaded service . - * - * This class provides a strategy that suspends and resumes all - * the Event_Handlers controlled by a Thread_Manager in one fell swoop. - */ -template -class ACE_Schedule_All_Threaded_Strategy - : public ACE_Scheduling_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Scheduling_Strategy base_type; - - // = Initialization and termination methods. - /// Constructor - ACE_Schedule_All_Threaded_Strategy (SVC_HANDLER * = 0); - - // = Scheduling methods - - /// Suspend hook. - virtual int suspend (void); - - /// Resume hook. - virtual int resume (void); - - /// Dump the state of the object. - virtual void dump (void) const; - -protected: - - /// Thread Manager - ACE_Thread_Manager *thr_mgr_; -}; - -/** - * @class ACE_NOOP_Creation_Strategy - * - * @brief Implements a no-op creation strategy in order to defer - * decisions regarding creation to some later point in time, such - * as in connect or accept strategy. - * - * An example of the use of this is in the - * , which only returns a single - * connection for a given endpoint. - */ -template -class ACE_NOOP_Creation_Strategy : public ACE_Creation_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Creation_Strategy base_type; - - /// This is a no-op. - virtual int make_svc_handler (SVC_HANDLER *&); -}; - -/** - * @class ACE_NOOP_Concurrency_Strategy - * - * @brief Implements a no-op activation strategy in order to avoid - * calling open on a svc_handler multiple times. - * - * An example of the use of this is in the - * , which reuses svc_handlers. - * Therefore we don't want to call open on the recycled - * svc_handler more than once. - */ -template -class ACE_NOOP_Concurrency_Strategy - : public ACE_Concurrency_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Concurrency_Strategy base_type; - - // = Factory method. - /// This is a no-op. - virtual int activate_svc_handler (SVC_HANDLER *svc_handler, - void *arg = 0); -}; - -template -class ACE_Refcounted_Hash_Recyclable : public ACE_Refcountable, - public ACE_Hashable, - public ACE_Recyclable -{ -public: - /// Default constructor. - ACE_Refcounted_Hash_Recyclable (void); - - /// Constructor. - ACE_Refcounted_Hash_Recyclable (const T &t, - int refcount = 0, - ACE_Recyclable_State state = ACE_RECYCLABLE_UNKNOWN); - - /// Destructor - virtual ~ACE_Refcounted_Hash_Recyclable (void); - - /// Compares two instances. - bool operator== (const ACE_Refcounted_Hash_Recyclable &rhs) const; - bool operator!= (const ACE_Refcounted_Hash_Recyclable &rhs) const; - - T &subject (); - -protected: - /// Computes and returns hash value. - u_long hash_i (void) const; - - T t_; -}; - -/** - * @class ACE_Cached_Connect_Strategy - * - * @brief A connection strategy which caches connections to peers - * (represented by instances), thereby allowing - * subsequent re-use of unused, but available, connections. - * - * is intended to be used as a - * plug-in connection strategy for ACE_Strategy_Connector. - * It's added value is re-use of established connections. - */ -template -class ACE_Cached_Connect_Strategy - : public ACE_Connection_Recycling_Strategy, - public ACE_Connect_Strategy -{ -public: - - // Useful STL-style traits. - typedef ACE_Creation_Strategy - creation_strategy_type; - typedef ACE_Connect_Strategy - connect_strategy_type; - typedef ACE_Concurrency_Strategy - concurrency_strategy_type; - typedef ACE_Recycling_Strategy recycling_strategy_type; - - // = Define some useful (old style) traits. - typedef ACE_Creation_Strategy - CREATION_STRATEGY; - typedef ACE_Concurrency_Strategy - CONCURRENCY_STRATEGY; - typedef ACE_Recycling_Strategy - RECYCLING_STRATEGY; - - // = Super class - typedef ACE_Connect_Strategy - CONNECT_STRATEGY; - - - typedef ACE_Cached_Connect_Strategy SELF; - - /// Constructor - ACE_Cached_Connect_Strategy (ACE_Creation_Strategy *cre_s = 0, - ACE_Concurrency_Strategy *con_s = 0, - ACE_Recycling_Strategy *rec_s = 0, - MUTEX *mutex = 0, - int delete_mutex = 0); - - /// Destructor - virtual ~ACE_Cached_Connect_Strategy (void); - - /// This methods allow you to change the strategies used by the - /// cached connector. - virtual int open (ACE_Creation_Strategy *cre_s, - ACE_Concurrency_Strategy *con_s, - ACE_Recycling_Strategy *rec_s); - - /// Template method for making a new - virtual int make_svc_handler (SVC_HANDLER *&sh); - - /// Template method for activating a new - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - /// Template method for setting the recycler information of the - /// svc_handler. - virtual int assign_recycler (SVC_HANDLER *svc_handler, - ACE_Connection_Recycling_Strategy *recycler, - const void *recycling_act); - - /// Template method for preparing the svc_handler for recycling. - virtual int prepare_for_recycling (SVC_HANDLER *svc_handler); - - /** - * Checks to see if there is already a in the cache - * connected to the . If so, we return this pointer. - * Otherwise we establish the connection, put it into the cache, and - * return the pointer. <[NOTE]>: the <{reuse_addr}> - * argument does NOT control re-use of addresses in the cache. - * Rather, if the underlying protocol requires a "dead time" prior - * to re-use of its addresses (TCP is a classic example of this), - * <{and}> the protocol provides a means by which to defeat the dead - * time, setting this argument to non-zero will defeat the dead-time - * requirement. <{Dev. Note: We might want to consider enhancing - * the interface at some point so that this also controls re-use of - * the cache.}> - */ - virtual int connect_svc_handler (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - virtual int connect_svc_handler (SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /// Remove from cache. - virtual int purge (const void *recycling_act); - - /// Add to cache. - virtual int cache (const void *recycling_act); - - /// Get/Set . - virtual int recycle_state (const void *recycling_act, - ACE_Recyclable_State new_state); - virtual ACE_Recyclable_State recycle_state (const void *recycling_act) const; - - /// Mark as closed. - virtual int mark_as_closed (const void *recycling_act); - - /** - * Mark as closed (non-locking version). This method needs to be public - * as it is used in the cleanup of handlers where teh locked version causes - * a deadlock. - */ - virtual int mark_as_closed_i (const void *recycling_act); - - /// Cleanup hint and reset <*act_holder> to zero if . - virtual int cleanup_hint (const void *recycling_act, - void **act_holder = 0); - - // = Traits for managing the map - typedef ACE_Refcounted_Hash_Recyclable - REFCOUNTED_HASH_RECYCLABLE_ADDRESS; - typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> - CONNECTION_MAP; - - typedef ACE_TYPENAME CONNECTION_MAP::ITERATOR CONNECTION_MAP_ITERATOR; - typedef ACE_TYPENAME CONNECTION_MAP::ENTRY CONNECTION_MAP_ENTRY; - - typedef ACE_Reverse_Lock REVERSE_MUTEX; - - // = Strategy accessors - virtual ACE_Creation_Strategy *creation_strategy (void) const; - virtual ACE_Recycling_Strategy *recycling_strategy (void) const; - virtual ACE_Concurrency_Strategy *concurrency_strategy (void) const; - -protected: - - /// Creates a new connection. - virtual int new_connection (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /// Find an idle handle. - int find (REFCOUNTED_HASH_RECYCLABLE_ADDRESS &search_addr, - CONNECTION_MAP_ENTRY *&entry); - - /// Remove from cache (non-locking version). - virtual int purge_i (const void *recycling_act); - - /// Add to cache (non-locking version). - virtual int cache_i (const void *recycling_act); - - /// Set (non-locking version). - virtual int recycle_state_i (const void *recycling_act, - ACE_Recyclable_State new_state); - - /// Get (non-locking version). - virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const; - - /// Cleanup hint and reset <*act_holder> to zero if . - virtual int cleanup_hint_i (const void *recycling_act, - void **act_holder); - - // = Helpers - int check_hint_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - CONNECTION_MAP_ENTRY *&entry, - int &found); - - int find_or_create_svc_handler_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - CONNECTION_MAP_ENTRY *&entry, - int &found); - - virtual int connect_svc_handler_i ( - SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - int &found); - - /// Table that maintains the cache of connected s. - CONNECTION_MAP connection_map_; - - /// Mutual exclusion for this object. - MUTEX *lock_; - - /// Mutual exclusion for this object. - int delete_lock_; - - /// Reverse lock. - REVERSE_MUTEX *reverse_lock_; - - // = Strategy objects. - - /// Creation strategy for an . - CREATION_STRATEGY *creation_strategy_; - - /// 1 if created the creation strategy and thus should - /// delete it, else 0. - int delete_creation_strategy_; - - /// Concurrency strategy for an . - CONCURRENCY_STRATEGY *concurrency_strategy_; - - /// 1 if created the concurrency strategy and thus should - /// delete it, else 0. - int delete_concurrency_strategy_; - - /// Recycling strategy for an . - RECYCLING_STRATEGY *recycling_strategy_; - - /// 1 if created the recycling strategy and thus should - /// delete it, else 0. - int delete_recycling_strategy_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Strategies_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Strategies_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Strategies_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_STRATEGIES_T_H */ diff --git a/ace/Strategies_T.inl b/ace/Strategies_T.inl deleted file mode 100644 index a6a6d1dfd1a..00000000000 --- a/ace/Strategies_T.inl +++ /dev/null @@ -1,230 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Singleton_Strategy::ACE_Singleton_Strategy (SVC_HANDLER *sh, - ACE_Thread_Manager *tm) - : svc_handler_ (0), - delete_svc_handler_ (1) -{ - ACE_TRACE ("ACE_Singleton_Strategy::ACE_Singleton_Strategy"); - if (this->open (sh, tm) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Singleton_Strategy"))); -} - -template ACE_INLINE int -ACE_Creation_Strategy::open (ACE_Thread_Manager *thr_mgr, - ACE_Reactor *reactor) -{ - ACE_TRACE ("ACE_Creation_Strategy::open"); - this->thr_mgr_ = thr_mgr; - this->reactor_ = reactor; - return 0; -} - -template ACE_INLINE -ACE_Creation_Strategy::ACE_Creation_Strategy (ACE_Thread_Manager *thr_mgr, - ACE_Reactor *reactor) -{ - ACE_TRACE ("ACE_Creation_Strategy::ACE_Creation_Strategy"); - if (this->open (thr_mgr, reactor) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Creation_Strategy"))); -} - -template ACE_INLINE -ACE_DLL_Strategy::ACE_DLL_Strategy (const ACE_TCHAR dll_name[], - const ACE_TCHAR factory_function[], - const ACE_TCHAR svc_name[], - ACE_Service_Repository *svc_rep, - ACE_Thread_Manager *thr_mgr) -{ - ACE_TRACE ("ACE_DLL_Strategy::ACE_DLL_Strategy"); - if (this->open (dll_name, - factory_function, - svc_name, - svc_rep, - thr_mgr) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("open"))); -} - -template ACE_INLINE -ACE_DLL_Strategy::ACE_DLL_Strategy (void) -{ - ACE_TRACE ("ACE_DLL_Strategy::ACE_DLL_Strategy"); -} - -template ACE_INLINE -ACE_Concurrency_Strategy::ACE_Concurrency_Strategy (int flags) - : flags_ (flags) -{ - ACE_TRACE ("ACE_Concurrency_Strategy::ACE_Concurrency_Strategy"); -} - -template ACE_INLINE -ACE_Reactive_Strategy::ACE_Reactive_Strategy (ACE_Reactor *reactor, - ACE_Reactor_Mask mask, - int flags) -{ - ACE_TRACE ("ACE_Reactive_Strategy::ACE_Reactive_Strategy"); - - if (this->open (reactor, - mask, - flags) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Reactive_Strategy::ACE_Reactive_Strategy"))); -} - -template ACE_INLINE -ACE_Reactive_Strategy::ACE_Reactive_Strategy (int flags) - : ACE_Concurrency_Strategy (flags), - reactor_ (0), - mask_ (ACE_Event_Handler::NULL_MASK) -{ - ACE_TRACE ("ACE_Reactive_Strategy::ACE_Reactive_Strategy"); -} - -template ACE_INLINE -ACE_Thread_Strategy::ACE_Thread_Strategy (ACE_Thread_Manager *thr_mgr, - long thr_flags, - int n_threads, - int flags) -{ - ACE_TRACE ("ACE_Thread_Strategy::ACE_Thread_Strategy"); - - if (this->open (thr_mgr, - thr_flags, - n_threads, - flags) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Thread_Strategy::ACE_Thread_Strategy"))); -} - -template ACE_INLINE -ACE_Thread_Strategy::ACE_Thread_Strategy (int flags) - : ACE_Concurrency_Strategy (flags), - thr_mgr_ (0), - thr_flags_ (0), - n_threads_ (1) -{ - ACE_TRACE ("ACE_Thread_Strategy::ACE_Thread_Strategy"); -} - -template ACE_INLINE -ACE_Accept_Strategy::ACE_Accept_Strategy (ACE_Reactor *reactor) - : reactor_ (reactor) -{ - ACE_TRACE ("ACE_Accept_Strategy::ACE_Accept_Strategy"); -} - -template ACE_INLINE -ACE_Connect_Strategy::ACE_Connect_Strategy (void) -{ - ACE_TRACE ("ACE_Connect_Strategy::ACE_Connect_Strategy"); -} - -template ACE_INLINE -ACE_Process_Strategy::ACE_Process_Strategy (size_t n_processes, - ACE_Event_Handler *acceptor, - ACE_Reactor *reactor, - int avoid_zombies) -{ - ACE_TRACE ("ACE_Process_Strategy::ACE_Process_Strategy"); - if (this->open (n_processes, - acceptor, - reactor, - avoid_zombies) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Process_Strategy"))); -} - -template ACE_INLINE -ACE_Scheduling_Strategy::ACE_Scheduling_Strategy (SVC_HANDLER *) -{ - ACE_TRACE ("ACE_Scheduling_Strategy::ACE_Scheduling_Strategy"); -} - -template ACE_INLINE -ACE_Schedule_All_Reactive_Strategy::ACE_Schedule_All_Reactive_Strategy - (SVC_HANDLER *scheduler) - : ACE_Scheduling_Strategy (scheduler) -{ - ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy::ACE_Schedule_All_Reactive_Strategy"); - - if (scheduler == 0 || scheduler->reactor () == 0) - this->reactor_ = ACE_Reactor::instance (); - else - this->reactor_ = scheduler->reactor (); -} - -template ACE_INLINE -ACE_Schedule_All_Threaded_Strategy::ACE_Schedule_All_Threaded_Strategy - (SVC_HANDLER *scheduler) - : ACE_Scheduling_Strategy (scheduler) -{ - ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy::ACE_Schedule_All_Threaded_Strategy"); - - if (scheduler == 0 || scheduler->thr_mgr () == 0) - this->thr_mgr_ = ACE_Thread_Manager::instance (); - else - this->thr_mgr_ = scheduler->thr_mgr (); -} - -template ACE_INLINE -ACE_Refcounted_Hash_Recyclable::ACE_Refcounted_Hash_Recyclable (void) - : ACE_Refcountable (0), - ACE_Hashable (), - ACE_Recyclable (ACE_RECYCLABLE_UNKNOWN), - t_ () -{ -} - -template ACE_INLINE -ACE_Refcounted_Hash_Recyclable::ACE_Refcounted_Hash_Recyclable (const T &t, - int refcount, - ACE_Recyclable_State state) - : ACE_Refcountable (refcount), - ACE_Hashable (), - ACE_Recyclable (state), - t_ (t) -{ -} - -template ACE_INLINE u_long -ACE_Refcounted_Hash_Recyclable::hash_i (void) const -{ - return this->t_.hash (); -} - -template ACE_INLINE T & -ACE_Refcounted_Hash_Recyclable::subject (void) -{ - return this->t_; -} - -template ACE_INLINE bool -ACE_Refcounted_Hash_Recyclable::operator== (const ACE_Refcounted_Hash_Recyclable &rhs) const -{ - return - this->recycle_state () == rhs.recycle_state () - && this->t_ == rhs.t_; -} - -template ACE_INLINE bool -ACE_Refcounted_Hash_Recyclable::operator!= (const ACE_Refcounted_Hash_Recyclable &rhs) const -{ - return !this->operator== (rhs); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Stream.cpp b/ace/Stream.cpp deleted file mode 100644 index b44b04ddacc..00000000000 --- a/ace/Stream.cpp +++ /dev/null @@ -1,619 +0,0 @@ -// Stream.cpp -// $Id$ - -#ifndef ACE_STREAM_CPP -#define ACE_STREAM_CPP - -//#include "ace/Module.h" -#include "ace/Stream.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Stream_Modules.h" -#include "ace/OS_NS_string.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Stream.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Stream) - -// Give some idea of what the heck is going on in a stream! - -template void -ACE_Stream::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Stream::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("-------- module links --------\n"))); - - for (ACE_Module *mp = this->stream_head_; - ; - mp = mp->next ()) - { - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("module name = %s\n"), mp->name ())); - if (mp == this->stream_tail_) - break; - } - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("-------- writer links --------\n"))); - - ACE_Task *tp; - - for (tp = this->stream_head_->writer (); - ; - tp = tp->next ()) - { - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("writer queue name = %s\n"), tp->name ())); - tp->dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("-------\n"))); - if (tp == this->stream_tail_->writer () - || (this->linked_us_ - && tp == this->linked_us_->stream_head_->reader ())) - break; - } - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("-------- reader links --------\n"))); - for (tp = this->stream_tail_->reader (); ; tp = tp->next ()) - { - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("reader queue name = %s\n"), tp->name ())); - tp->dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("-------\n"))); - if (tp == this->stream_head_->reader () - || (this->linked_us_ - && tp == this->linked_us_->stream_head_->writer ())) - break; - } -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Stream::push (ACE_Module *new_top) -{ - ACE_TRACE ("ACE_Stream::push"); - if (this->push_module (new_top, - this->stream_head_->next (), - this->stream_head_) == -1) - return -1; - else - return 0; -} - -template int -ACE_Stream::put (ACE_Message_Block *mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Stream::put"); - return this->stream_head_->writer ()->put (mb, tv); -} - -template int -ACE_Stream::get (ACE_Message_Block *&mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Stream::get"); - return this->stream_head_->reader ()->getq (mb, tv); -} - -// Return the "top" ACE_Module in a ACE_Stream, skipping over the -// stream_head. - -template int -ACE_Stream::top (ACE_Module *&m) -{ - ACE_TRACE ("ACE_Stream::top"); - if (this->stream_head_->next () == this->stream_tail_) - return -1; - else - { - m = this->stream_head_->next (); - return 0; - } -} - -template int -ACE_Stream::insert (const ACE_TCHAR *prev_name, - ACE_Module *mod) -{ - ACE_TRACE ("ACE_Stream::insert"); - - for (ACE_Module *prev_mod = this->stream_head_; - prev_mod != 0; - prev_mod = prev_mod->next ()) - if (ACE_OS::strcmp (prev_mod->name (), prev_name) == 0) - { - ACE_Module *next_mod = prev_mod->next (); - - // We can't insert a module below . - if (next_mod == 0) - return -1; - - mod->link (next_mod); - prev_mod->link (mod); - - if (mod->reader ()->open (mod->arg ()) == -1) - return -1; - - if (mod->writer ()->open (mod->arg ()) == -1) - return -1; - - return 0; - } - - return -1; -} - -template int -ACE_Stream::replace (const ACE_TCHAR *replace_name, - ACE_Module *mod, - int flags) -{ - ACE_TRACE ("ACE_Stream::replace"); - ACE_Module *prev_mod = 0; - - for (ACE_Module *rep_mod = this->stream_head_; - rep_mod != 0; - rep_mod = rep_mod->next ()) - if (ACE_OS::strcmp (rep_mod->name (), replace_name) == 0) - { - ACE_Module *next_mod = rep_mod->next (); - - if (next_mod) - mod->link (next_mod); - else // In case the is . - { - mod->writer ()->next (0); - mod->next (0); - this->stream_tail_ = mod; - } - - if (prev_mod) - prev_mod->link (mod); - else // In case the is . - { - mod->reader ()->next (0); - this->stream_head_ = mod; - } - - if (mod->reader ()->open (mod->arg ()) == -1) - return -1; - - if (mod->writer ()->open (mod->arg ()) == -1) - return -1; - - if (flags != ACE_Module::M_DELETE_NONE) - { - rep_mod->close (flags); - delete rep_mod; - } - - return 0; - } - else - prev_mod = rep_mod; - - return -1; -} - -// Remove the "top" ACE_Module in a ACE_Stream, skipping over the -// stream_head. - -template int -ACE_Stream::pop (int flags) -{ - ACE_TRACE ("ACE_Stream::pop"); - if (this->stream_head_->next () == this->stream_tail_) - return -1; - else - { - // Skip over the ACE_Stream head. - ACE_Module *top_mod = this->stream_head_->next (); - ACE_Module *new_top = top_mod->next (); - - this->stream_head_->next (new_top); - - // Close the top ACE_Module. - - top_mod->close (flags); - - // Don't delete the Module unless the flags request this. - if (flags != ACE_Module::M_DELETE_NONE) - delete top_mod; - - this->stream_head_->writer ()->next (new_top->writer ()); - new_top->reader ()->next (this->stream_head_->reader ()); - return 0; - } -} - -// Remove a named ACE_Module from an arbitrary place in the -// ACE_Stream. - -template int -ACE_Stream::remove (const ACE_TCHAR *name, - int flags) -{ - ACE_TRACE ("ACE_Stream::remove"); - ACE_Module *prev = 0; - - for (ACE_Module *mod = this->stream_head_; - mod != 0; - mod = mod->next ()) - if (ACE_OS::strcmp (mod->name (), name) == 0) - { - if (prev == 0) // Deleting ACE_Stream Head - this->stream_head_->link (mod->next ()); - else - prev->link (mod->next ()); - - // Don't delete the Module unless the flags request this. - if (flags != ACE_Module::M_DELETE_NONE) - { - // Close down the module and release the memory. - mod->close (flags); - delete mod; - } - - return 0; - } - else - prev = mod; - - return -1; -} - -template ACE_Module * -ACE_Stream::find (const ACE_TCHAR *name) -{ - ACE_TRACE ("ACE_Stream::find"); - for (ACE_Module *mod = this->stream_head_; - mod != 0; - mod = mod->next ()) - if (ACE_OS::strcmp (mod->name (), name) == 0) - return mod; - - return 0; -} - -// Actually push a module onto the stack... - -template int -ACE_Stream::push_module (ACE_Module *new_top, - ACE_Module *current_top, - ACE_Module *head) -{ - ACE_TRACE ("ACE_Stream::push_module"); - ACE_Task *nt_reader = new_top->reader (); - ACE_Task *nt_writer = new_top->writer (); - ACE_Task *ct_reader = 0; - ACE_Task *ct_writer = 0; - - if (current_top) - { - ct_reader = current_top->reader (); - ct_writer = current_top->writer (); - ct_reader->next (nt_reader); - } - - nt_writer->next (ct_writer); - - if (head) - { - if (head != new_top) - head->link (new_top); - } - else - nt_reader->next (0); - - new_top->next (current_top); - - if (nt_reader->open (new_top->arg ()) == -1) - return -1; - - if (nt_writer->open (new_top->arg ()) == -1) - return -1; - return 0; -} - -template int -ACE_Stream::open (void *a, - ACE_Module *head, - ACE_Module *tail) -{ - ACE_TRACE ("ACE_Stream::open"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - - ACE_Task *h1 = 0, *h2 = 0; - ACE_Task *t1 = 0, *t2 = 0; - - if (head == 0) - { - ACE_NEW_RETURN (h1, - ACE_Stream_Head, - -1); - ACE_NEW_RETURN (h2, - ACE_Stream_Head, - -1); - ACE_NEW_RETURN (head, - ACE_Module (ACE_LIB_TEXT ("ACE_Stream_Head"), - h1, h2, - a, - M_DELETE), - -1); - } - - if (tail == 0) - { - ACE_NEW_RETURN (t1, - ACE_Stream_Tail, - -1); - ACE_NEW_RETURN (t2, - ACE_Stream_Tail, - -1); - ACE_NEW_RETURN (tail, - ACE_Module (ACE_LIB_TEXT ("ACE_Stream_Tail"), - t1, t2, - a, - M_DELETE), - -1); - } - - // Make sure *all* the allocation succeeded! - if (head == 0 && (h1 == 0 || h2 == 0) - || tail == 0 && (t1 == 0 || t2 == 0)) - { - delete h1; - delete h2; - delete t1; - delete t2; - delete head; - delete tail; - errno = ENOMEM; - return -1; - } - - this->stream_head_ = head; - this->stream_tail_ = tail; - - if (this->push_module (this->stream_tail_) == -1) - return -1; - else if (this->push_module (this->stream_head_, - this->stream_tail_, - this->stream_head_) == -1) - return -1; - - return 0; -} - -template int -ACE_Stream::close (int flags) -{ - ACE_TRACE ("ACE_Stream::close"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - - if (this->stream_head_ != 0 - && this->stream_tail_ != 0) - { - // Don't bother checking return value here. - this->unlink_i (); - - int result = 0; - - // Remove and cleanup all the intermediate modules. - - while (this->stream_head_->next () != this->stream_tail_) - if (this->pop (flags) == -1) - result = -1; - - // Clean up the head and tail of the stream. - if (this->stream_head_->close (flags) == -1) - result = -1; - if (this->stream_tail_->close (flags) == -1) - result = -1; - - // Cleanup the memory. - delete this->stream_head_; - delete this->stream_tail_; - - this->stream_head_ = 0; - this->stream_tail_ = 0; - - // Tell all threads waiting on the close that we are done. - this->final_close_.broadcast (); - return result; - } - return 0; -} - -template int -ACE_Stream::control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, - void *a) -{ - ACE_TRACE ("ACE_Stream::control"); - ACE_IO_Cntl_Msg ioc (cmd); - - ACE_Message_Block *db; - - // Try to create a data block that contains the user-supplied data. - ACE_NEW_RETURN (db, - ACE_Message_Block (sizeof (int), - ACE_Message_Block::MB_IOCTL, - 0, - (char *) a), - -1); - // Try to create a control block that contains the control - // field and a pointer to the data block in 's continuation - // field. - ACE_Message_Block *cb = 0; - - ACE_NEW_RETURN (cb, - ACE_Message_Block (sizeof ioc, - ACE_Message_Block::MB_IOCTL, - db, - (char *) &ioc), - -1); - // @@ Michael: The old semantic assumed that cb returns == 0 - // if no memory was available. We will now return immediately - // without release (errno is set to ENOMEM by the macro). - - // If we can't allocate then we need to delete db and return - // -1. - if (cb == 0) - { - db->release (); - errno = ENOMEM; - return -1; - } - - int result; - - if (this->stream_head_->writer ()->put (cb) == -1) - result = -1; - else if (this->stream_head_->reader ()->getq (cb) == -1) - result = -1; - else - result = ((ACE_IO_Cntl_Msg *) cb->rd_ptr ())->rval (); - - // This will also release db if it's reference count == 0. - cb->release (); - - return result; -} - -// Link two streams together at their bottom-most Modules (i.e., the -// one just above the Stream tail). Note that all of this is premised -// on the fact that the Stream head and Stream tail are non-NULL... -// This must be called with locks held. - -template int -ACE_Stream::link_i (ACE_Stream &us) -{ - ACE_TRACE ("ACE_Stream::link_i"); - this->linked_us_ = &us; - // Make sure the other side is also linked to us! - us.linked_us_ = this; - - ACE_Module *my_tail = this->stream_head_; - - if (my_tail == 0) - return -1; - - // Locate the module just above our Stream tail. - while (my_tail->next () != this->stream_tail_) - my_tail = my_tail->next (); - - ACE_Module *other_tail = us.stream_head_; - - if (other_tail == 0) - return -1; - - // Locate the module just above the other Stream's tail. - while (other_tail->next () != us.stream_tail_) - other_tail = other_tail->next (); - - // Reattach the pointers so that the two streams are linked! - my_tail->writer ()->next (other_tail->reader ()); - other_tail->writer ()->next (my_tail->reader ()); - return 0; -} - -template int -ACE_Stream::link (ACE_Stream &us) -{ - ACE_TRACE ("ACE_Stream::link"); - - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - - return this->link_i (us); -} - -// Must be called with locks held... - -template int -ACE_Stream::unlink_i (void) -{ - ACE_TRACE ("ACE_Stream::unlink_i"); - - // Only try to unlink if we are in fact still linked! - - if (this->linked_us_ != 0) - { - ACE_Module *my_tail = this->stream_head_; - - // Only relink if we still exist! - if (my_tail) - { - // Find the module that's just before our stream tail. - while (my_tail->next () != this->stream_tail_) - my_tail = my_tail->next (); - - // Restore the writer's next() link to our tail. - my_tail->writer ()->next (this->stream_tail_->writer ()); - } - - ACE_Module *other_tail = - this->linked_us_->stream_head_; - - // Only fiddle with the other side if it in fact still remains. - if (other_tail != 0) - { - while (other_tail->next () != this->linked_us_->stream_tail_) - other_tail = other_tail->next (); - - other_tail->writer ()->next (this->linked_us_->stream_tail_->writer ()); - - } - - // Make sure the other side is also aware that it's been unlinked! - this->linked_us_->linked_us_ = 0; - - this->linked_us_ = 0; - return 0; - } - else - return -1; -} - -template int -ACE_Stream::unlink (void) -{ - ACE_TRACE ("ACE_Stream::unlink"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - return this->unlink_i (); -} - -template -ACE_Stream::ACE_Stream (void * a, - ACE_Module *head, - ACE_Module *tail) - : linked_us_ (0), - final_close_ (this->lock_) -{ - ACE_TRACE ("ACE_Stream::ACE_Stream"); - if (this->open (a, head, tail) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_Stream::open (%s, %s)\n"), - head->name (), tail->name ())); -} - -template -ACE_Stream::~ACE_Stream (void) -{ - ACE_TRACE ("ACE_Stream::~ACE_Stream"); - - if (this->stream_head_ != 0) - this->close (); -} - -template -ACE_Stream_Iterator::ACE_Stream_Iterator (const ACE_Stream &sr) - : next_ (sr.stream_head_) -{ - ACE_TRACE ("ACE_Stream_Iterator::ACE_Stream_Iterator"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_STREAM_CPP */ diff --git a/ace/Stream.h b/ace/Stream.h deleted file mode 100644 index 1ab1cacf3ea..00000000000 --- a/ace/Stream.h +++ /dev/null @@ -1,241 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Stream.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_STREAM_H -#define ACE_STREAM_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/IO_Cntl_Msg.h" -#include "ace/Message_Block.h" -#include "ace/Module.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decls. -template class ACE_Stream_Iterator; -class ACE_Time_Value; - -/** - * @class ACE_Stream - * - * @brief This class is the primary abstraction for the ASX framework. - * It is moduled after System V Stream. - * - * A Stream consists of a stack of , each of which - * contains two . Even though the methods in this - * class are virtual, this class isn't really intended for - * subclassing unless you know what you are doing. In - * particular, the destructor calls , which - * won't be overridden properly unless you call it in a subclass - * destructor. - */ -template -class ACE_Stream -{ -public: - friend class ACE_Stream_Iterator; - - enum - { - /// Indicates that deletes the Tasks. Don't change this - /// value without updating the same enum in class ACE_Module... - M_DELETE = 3 - }; - - // = Initializatation and termination methods. - /** - * Create a Stream consisting of and as the Stream - * head and Stream tail, respectively. If these are 0 then the - * and are used, respectively. - * is the value past in to the methods of the tasks. - */ - ACE_Stream (void *arg = 0, - ACE_Module *head = 0, - ACE_Module *tail = 0); - - /** - * Create a Stream consisting of and as the Stream - * head and Stream tail, respectively. If these are 0 then the - * and are used, respectively. - * is the value past in to the methods of the tasks. - */ - virtual int open (void *arg, - ACE_Module *head = 0, - ACE_Module *tail = 0); - - /// Close down the stream and release all the resources. - virtual int close (int flags = M_DELETE); - - /// Close down the stream and release all the resources. - virtual ~ACE_Stream (void); - - // = ACE_Stream plumbing operations - - /// Add a new module right below the Stream head. The - /// hook methods of the in this - /// are invoked to initialize the tasks. - virtual int push (ACE_Module *mod); - - /// Remove the right below the Stream head and close it down. - // The hook methods of the in this - /// are invoked to cleanup the tasks. - virtual int pop (int flags = M_DELETE); - - /// Return the top module on the stream (right below the stream - /// head). - virtual int top (ACE_Module *&mod); - - /// Insert a new module below the named module . - virtual int insert (const ACE_TCHAR *prev_name, - ACE_Module *mod); - - /// Replace the named module with a new module . - virtual int replace (const ACE_TCHAR *replace_name, - ACE_Module *mod, - int flags = M_DELETE); - - /// Remove the named module from the stream. This bypasses the - /// strict LIFO ordering of and . - virtual int remove (const ACE_TCHAR *mod, - int flags = M_DELETE); - - /// Return current stream head. - virtual ACE_Module *head (void); - - /// Return current stream tail. - virtual ACE_Module *tail (void); - - /// Find a particular ACE_Module. - virtual ACE_Module *find (const ACE_TCHAR *mod); - - /// Create a pipe between two Streams. - virtual int link (ACE_Stream &); - - /// Remove a pipe formed between two Streams. - virtual int unlink (void); - - // = Blocking data transfer operations - /** - * Send the message down the stream, starting at the Module - * below the Stream head. Wait for upto amount of - * absolute time for the operation to complete (or block forever if - * == 0). - */ - virtual int put (ACE_Message_Block *mb, - ACE_Time_Value *timeout = 0); - - /** - * Read the message that is stored in the stream head. - * Wait for upto amount of absolute time for the operation - * to complete (or block forever if == 0). - */ - virtual int get (ACE_Message_Block *&mb, - ACE_Time_Value *timeout = 0); - - /// Send control message down the stream. - virtual int control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, - void *args); - - /// Synchronize with the final close of the stream. - virtual int wait (void); - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Actually perform the unlinking of two Streams (must be called - /// with locks held). - int unlink_i (void); - - /// Actually perform the linking of two Streams (must be called with - /// locks held). - int link_i (ACE_Stream &); - - /// Must a new module onto the Stream. - int push_module (ACE_Module *, - ACE_Module * = 0, - ACE_Module * = 0); - - /// Pointer to the head of the stream. - ACE_Module *stream_head_; - - /// Pointer to the tail of the stream. - ACE_Module *stream_tail_; - - /// Pointer to an adjoining linked stream. - ACE_Stream *linked_us_; - - // = Synchronization objects used for thread-safe streams. - /// Protect the stream against race conditions. - ACE_SYNCH_MUTEX_T lock_; - - /// Use to tell all threads waiting on the close that we are done. - ACE_SYNCH_CONDITION_T final_close_; -}; - -/** - * @class ACE_Stream_Iterator - * - * @brief Iterate through an . - */ -template -class ACE_Stream_Iterator -{ -public: - // = Initialization method. - ACE_Stream_Iterator (const ACE_Stream &sr); - - // = Iteration methods. - - /// Pass back the that hasn't been seen in the set. - /// Returns 0 when all items have been seen, else 1. - int next (const ACE_Module *&next_item); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - -private: - /// Next that we haven't yet seen. - ACE_Module *next_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Stream.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Stream.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Stream.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_STREAM_H */ diff --git a/ace/Stream.inl b/ace/Stream.inl deleted file mode 100644 index 24ff6840431..00000000000 --- a/ace/Stream.inl +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE ACE_Module * -ACE_Stream::head (void) -{ - ACE_TRACE ("ACE_Stream::head"); - return this->stream_head_; -} - -template ACE_INLINE ACE_Module * -ACE_Stream::tail (void) -{ - ACE_TRACE ("ACE_Stream::tail"); - return this->stream_tail_; -} - -template ACE_INLINE int -ACE_Stream::wait (void) -{ - ACE_TRACE ("ACE_Stream::wait"); - return this->final_close_.wait (); -} - -template ACE_INLINE int -ACE_Stream_Iterator::next (const ACE_Module *&mod) -{ - ACE_TRACE ("ACE_Stream_Iterator::next"); - mod = this->next_; - return this->next_ != 0; -} - -template ACE_INLINE int -ACE_Stream_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Stream_Iterator::done"); - return this->next_ == 0; -} - -template int -ACE_Stream_Iterator::advance (void) -{ - ACE_TRACE ("ACE_Stream_Iterator::advance"); - this->next_ = this->next_->next (); - return this->next_ != 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Stream_Modules.cpp b/ace/Stream_Modules.cpp deleted file mode 100644 index 69163951323..00000000000 --- a/ace/Stream_Modules.cpp +++ /dev/null @@ -1,380 +0,0 @@ -// $Id$ - -#ifndef ACE_STREAM_MODULES_CPP -#define ACE_STREAM_MODULES_CPP - -#include "ace/Stream_Modules.h" -#include "ace/OS_NS_string.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Stream_Head) - -template -ACE_Stream_Head::ACE_Stream_Head (void) -{ - ACE_TRACE ("ACE_Stream_Head::ACE_Stream_Head"); -} - -template -ACE_Stream_Head::~ACE_Stream_Head (void) -{ - ACE_TRACE ("ACE_Stream_Head::~ACE_Stream_Head"); -} - -template void -ACE_Stream_Head::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Stream_Head::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// ACE_Module that act as the head and tail of a Stream. - -template int -ACE_Stream_Head::open (void *) -{ - ACE_TRACE ("ACE_Stream_Head::open"); - return 0; -} - -template int -ACE_Stream_Head::close (u_long) -{ - ACE_TRACE ("ACE_Stream_Head::close"); - return 0; -} - -template int -ACE_Stream_Head::svc (void) -{ - ACE_TRACE ("ACE_Stream_Head::svc"); - return -1; -} - -template int -ACE_Stream_Head::control (ACE_Message_Block *mb) -{ - ACE_TRACE ("ACE_Stream_Head::control"); - ACE_IO_Cntl_Msg *ioc = (ACE_IO_Cntl_Msg *) mb->rd_ptr (); - ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd; - - switch (cmd = ioc->cmd ()) - { - case ACE_IO_Cntl_Msg::SET_LWM: - case ACE_IO_Cntl_Msg::SET_HWM: - this->water_marks (cmd, *(size_t *) mb->cont ()->rd_ptr ()); - ioc->rval (0); - break; - default: - return 0; - } - return ioc->rval (); -} - -// Performs canonical flushing at the ACE_Stream Head. - -template int -ACE_Stream_Head::canonical_flush (ACE_Message_Block *mb) -{ - ACE_TRACE ("ACE_Stream_Head::canonical_flush"); - char *cp = mb->rd_ptr (); - - if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHR)) - { - this->flush (ACE_Task_Flags::ACE_FLUSHALL); - ACE_CLR_BITS (*cp, ACE_Task_Flags::ACE_FLUSHR); - } - - if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHW)) - return this->reply (mb); - else - mb->release (); - return 0; -} - -template int -ACE_Stream_Head::put (ACE_Message_Block *mb, - ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Stream_Head::put"); - int res = 0; - - if (mb->msg_type () == ACE_Message_Block::MB_IOCTL - && (res = this->control (mb)) == -1) - return res; - - if (this->is_writer ()) - return this->put_next (mb, tv); - else // this->is_reader () - { - switch (mb->msg_type ()) - { - case ACE_Message_Block::MB_FLUSH: - return this->canonical_flush (mb); - default: - break; - } - - return this->putq (mb, tv); - } -} - -template int -ACE_Stream_Head::init (int, ACE_TCHAR *[]) -{ - ACE_TRACE ("ACE_Stream_Head::init"); - return 0; -} - -template int -ACE_Stream_Head::info (ACE_TCHAR **strp, size_t length) const -{ - ACE_TRACE ("ACE_Stream_Head::info"); - const ACE_TCHAR *name = this->name (); - - if (*strp == 0 && (*strp = ACE_OS::strdup (name)) == 0) - return -1; - else - ACE_OS::strsncpy (*strp, name, length); - return static_cast (ACE_OS::strlen (name)); -} - -template int -ACE_Stream_Head::fini (void) -{ - ACE_TRACE ("ACE_Stream_Head::fini"); - return 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Stream_Tail) - -template -ACE_Stream_Tail::ACE_Stream_Tail (void) -{ - ACE_TRACE ("ACE_Stream_Tail::ACE_Stream_Tail"); -} - -template -ACE_Stream_Tail::~ACE_Stream_Tail (void) -{ - ACE_TRACE ("ACE_Stream_Tail::~ACE_Stream_Tail"); -} - -template void -ACE_Stream_Tail::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Stream_Tail::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Stream_Tail::open (void *) -{ - ACE_TRACE ("ACE_Stream_Tail::open"); - return 0; -} - -template int -ACE_Stream_Tail::close (u_long) -{ - ACE_TRACE ("ACE_Stream_Tail::close"); - return 0; -} - -template int -ACE_Stream_Tail::svc (void) -{ - ACE_TRACE ("ACE_Stream_Tail::svc"); - return -1; -} - -template int -ACE_Stream_Tail::control (ACE_Message_Block *mb) -{ - ACE_TRACE ("ACE_Stream_Tail::control"); - ACE_IO_Cntl_Msg *ioc = (ACE_IO_Cntl_Msg *) mb->rd_ptr (); - ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd; - - switch (cmd = ioc->cmd ()) - { - case ACE_IO_Cntl_Msg::SET_LWM: - case ACE_IO_Cntl_Msg::SET_HWM: - { - size_t wm_size = *(size_t *) mb->cont ()->rd_ptr (); - - this->water_marks (cmd, wm_size); - this->sibling ()->water_marks (cmd, wm_size); - ioc->rval (0); - break; - } - default: - mb->msg_type (ACE_Message_Block::MB_IOCNAK); - } - return this->reply (mb); -} - -// Perform flush algorithm as though we were the driver. - -template int -ACE_Stream_Tail::canonical_flush (ACE_Message_Block *mb) -{ - ACE_TRACE ("ACE_Stream_Tail::canonical_flush"); - char *cp = mb->rd_ptr (); - - if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHW)) - { - this->flush (ACE_Task_Flags::ACE_FLUSHALL); - ACE_CLR_BITS (*cp, ACE_Task_Flags::ACE_FLUSHW); - } - - if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHR)) - { - this->sibling ()->flush (ACE_Task_Flags::ACE_FLUSHALL); - return this->reply (mb); - } - else - mb->release (); - - return 0; -} - -template int -ACE_Stream_Tail::put (ACE_Message_Block *mb, - ACE_Time_Value *) -{ - ACE_TRACE ("ACE_Stream_Tail::put"); - - if (this->is_writer ()) - { - switch (mb->msg_type ()) - { - case ACE_Message_Block::MB_IOCTL: - return this->control (mb); - /* NOTREACHED */ - default: - mb->release (); - return 0; - /* NOTREACHED */ - } - } - - return -1; -} - -template int -ACE_Stream_Tail::init (int, ACE_TCHAR *[]) -{ - ACE_TRACE ("ACE_Stream_Tail::init"); - return 0; -} - -template int -ACE_Stream_Tail::info (ACE_TCHAR **strp, size_t length) const -{ - ACE_TRACE ("ACE_Stream_Tail::info"); - const ACE_TCHAR *name = this->name (); - - if (*strp == 0 && (*strp = ACE_OS::strdup (name)) == 0) - return -1; - else - ACE_OS::strsncpy (*strp, name, length); - return static_cast (ACE_OS::strlen (name)); -} - -template int -ACE_Stream_Tail::fini (void) -{ - ACE_TRACE ("ACE_Stream_Tail::fini"); - return 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Thru_Task) - -template -ACE_Thru_Task::ACE_Thru_Task (void) -{ - ACE_TRACE ("ACE_Thru_Task::ACE_Thru_Task"); -} - -template -ACE_Thru_Task::~ACE_Thru_Task (void) -{ - ACE_TRACE ("ACE_Thru_Task::~ACE_Thru_Task"); -} - -template void -ACE_Thru_Task::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Thru_Task::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Thru_Task::open (void *) -{ - ACE_TRACE ("ACE_Thru_Task::open"); - return 0; -} - -template int -ACE_Thru_Task::close (u_long) -{ - ACE_TRACE ("ACE_Thru_Task::close"); - return 0; -} - -template int -ACE_Thru_Task::svc (void) -{ - ACE_TRACE ("ACE_Thru_Task::svc"); - return -1; -} - -template int -ACE_Thru_Task::put (ACE_Message_Block *msg, - ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Thru_Task::put"); - return this->put_next (msg, tv); -} - -template int -ACE_Thru_Task::init (int, ACE_TCHAR *[]) -{ - ACE_TRACE ("ACE_Thru_Task::init"); - return 0; -} - -template int -ACE_Thru_Task::info (ACE_TCHAR **strp, - size_t length) const -{ - ACE_TRACE ("ACE_Thru_Task::info"); - const ACE_TCHAR *name = this->name (); - - if (*strp == 0 && (*strp = ACE_OS::strdup (name)) == 0) - return -1; - else - ACE_OS::strsncpy (*strp, name, length); - return static_cast (ACE_OS::strlen (name)); -} - -template int -ACE_Thru_Task::fini (void) -{ - ACE_TRACE ("ACE_Thru_Task::fini"); - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_STREAM_MODULES_CPP */ diff --git a/ace/Stream_Modules.h b/ace/Stream_Modules.h deleted file mode 100644 index 10d396c95f5..00000000000 --- a/ace/Stream_Modules.h +++ /dev/null @@ -1,166 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Stream_Modules.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -// This needs to go outside of the #if !defined() block. Don't ask... -#include "ace/Task.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#ifndef ACE_STREAM_MODULES -#define ACE_STREAM_MODULES -#include /**/ "ace/pre.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Stream_Head - * - * @brief Standard task that acts as reader or writer at the head of - * an ACE_Stream. - * - * A ACE_Message_Block sent to this task (via its put() hook) triggers - * actions depending on the block type and whether the task is acting as - * a reader or a writer. If the block is of type ACE_Message_Block::MB_IOCTL, - * the block's is assumed to contain (beginning at its rd_ptr()) an - * ACE_IO_Cntl_Msg object and is processed accordingly. This is usually - * used to set the task's message queue high water and/or low water marks. - * - * When the block is not ACE_Message_Block::MB_IOCTL, processing depends on - * the ACE_Stream_Head's role in the module: - * - * - Reader: If the block is of type ACE_Message_Block::MB_FLUSH, the - * canonical_flush() method is called. - * (@see ACE_Stream::canonical_flush().) If the block is any other - * type, it is queued on this task's message queue. It would thus - * be available to caller's reading blocks from the containing - * stream. - * - Writer: The block is passed to the next module in the stream. - */ -template -class ACE_Stream_Head : public ACE_Task -{ -public: - /// Construction - ACE_Stream_Head (void); - - /// Destruction - ~ACE_Stream_Head (void); - - // = ACE_Task hooks - virtual int open (void *a = 0); - virtual int close (u_long flags = 0); - virtual int put (ACE_Message_Block *msg, ACE_Time_Value * = 0); - virtual int svc (void); - - // = Dynamic linking hooks - virtual int init (int argc, ACE_TCHAR *argv[]); - virtual int info (ACE_TCHAR **info_string, size_t length) const; - virtual int fini (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Performs canonical flushing at the ACE_Stream Head. - int control (ACE_Message_Block *); - int canonical_flush (ACE_Message_Block *); -}; - -/** - * @class ACE_Stream_Tail - * - * @brief Standard module that acts as the head of a stream. - */ -template -class ACE_Stream_Tail : public ACE_Task -{ -public: - /// Construction - ACE_Stream_Tail (void); - - /// Destruction - ~ACE_Stream_Tail (void); - - // = ACE_Task hooks - virtual int open (void *a = 0); - virtual int close (u_long flags = 0); - virtual int put (ACE_Message_Block *msg, ACE_Time_Value * = 0); - virtual int svc (void); - - // = Dynamic linking hooks - virtual int init (int argc, ACE_TCHAR *argv[]); - virtual int info (ACE_TCHAR **info_string, size_t length) const; - virtual int fini (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Performs canonical flushing at the ACE_Stream tail. - int control (ACE_Message_Block *); - int canonical_flush (ACE_Message_Block *); -}; - -/** - * @class ACE_Thru_Task - * - * @brief Standard module that acts as a "no op", simply passing on all - * data to its adjacent neighbor. - */ -template -class ACE_Thru_Task : public ACE_Task -{ -public: - /// Construction - ACE_Thru_Task (void); - - /// Destruction - ~ACE_Thru_Task (void); - - // = ACE_Task hooks - virtual int open (void *a = 0); - virtual int close (u_long flags = 0); - virtual int put (ACE_Message_Block *msg, ACE_Time_Value * = 0); - virtual int svc (void); - - // = Dynamic linking hooks - virtual int init (int argc, ACE_TCHAR *argv[]); - virtual int info (ACE_TCHAR **info_string, size_t length) const; - virtual int fini (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Stream_Modules.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Stream_Modules.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_STREAM_MODULES */ diff --git a/ace/String_Base.cpp b/ace/String_Base.cpp deleted file mode 100644 index 01de0963b72..00000000000 --- a/ace/String_Base.cpp +++ /dev/null @@ -1,553 +0,0 @@ -// $Id$ - -#ifndef ACE_STRING_BASE_CPP -#define ACE_STRING_BASE_CPP - -#include "ace/ACE.h" -#include "ace/Malloc_Base.h" -#include "ace/String_Base.h" -#include "ace/Auto_Ptr.h" -#include "ace/OS_NS_string.h" - -#include // For std::swap<> - -#if !defined (__ACE_INLINE__) -#include "ace/String_Base.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_String_Base) - -template -CHAR ACE_String_Base::NULL_String_ = 0; - -// Default constructor. - -template -ACE_String_Base::ACE_String_Base (ACE_Allocator *the_allocator) - : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), - len_ (0), - buf_len_ (0), - rep_ (&ACE_String_Base::NULL_String_), - release_ (0) -{ - ACE_TRACE ("ACE_String_Base::ACE_String_Base"); -} - -// Constructor that actually copies memory. - -template -ACE_String_Base::ACE_String_Base (const CHAR *s, - ACE_Allocator *the_allocator, - int release) - : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), - len_ (0), - buf_len_ (0), - rep_ (0), - release_ (0) -{ - ACE_TRACE ("ACE_String_Base::ACE_String_Base"); - this->set (s, release); -} - -template -ACE_String_Base::ACE_String_Base (CHAR c, - ACE_Allocator *the_allocator) - : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), - len_ (0), - buf_len_ (0), - rep_ (0), - release_ (0) -{ - ACE_TRACE ("ACE_String_Base::ACE_String_Base"); - - this->set (&c, 1, 1); -} - -// Constructor that actually copies memory. - -template -ACE_String_Base::ACE_String_Base ( - const CHAR *s, - typename ACE_String_Base::size_type len, - ACE_Allocator *the_allocator, - int release) - : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), - len_ (0), - buf_len_ (0), - rep_ (0), - release_ (0) -{ - ACE_TRACE ("ACE_String_Base::ACE_String_Base"); - - this->set (s, len, release); -} - -// Copy constructor. - -template -ACE_String_Base::ACE_String_Base (const ACE_String_Base &s) - : allocator_ (s.allocator_ ? s.allocator_ : ACE_Allocator::instance ()), - len_ (0), - buf_len_ (0), - rep_ (0), - release_ (0) -{ - ACE_TRACE ("ACE_String_Base::ACE_String_Base"); - - this->set (s.rep_, s.len_, 1); -} - -template -ACE_String_Base::ACE_String_Base ( - typename ACE_String_Base::size_type len, - CHAR c, - ACE_Allocator *the_allocator) - : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), - len_ (0), - buf_len_ (0), - rep_ (0), - release_ (0) -{ - ACE_TRACE ("ACE_String_Base::ACE_String_Base"); - - this->resize (len, c); -} - -template -ACE_String_Base::~ACE_String_Base (void) -{ - ACE_TRACE ("ACE_String_Base::~ACE_String_Base"); - - if (this->buf_len_ != 0 && this->release_ != 0) - this->allocator_->free (this->rep_); -} - -// this method might benefit from a little restructuring. -template void -ACE_String_Base::set (const CHAR *s, - typename ACE_String_Base::size_type len, - int release) -{ - // Case 1. Going from memory to more memory - size_type new_buf_len = len + 1; - if (s != 0 && len != 0 && release && this->buf_len_ < new_buf_len) - { - CHAR *temp; - ACE_ALLOCATOR (temp, - (CHAR *) this->allocator_->malloc (new_buf_len * sizeof (CHAR))); - - if (this->buf_len_ != 0 && this->release_ != 0) - this->allocator_->free (this->rep_); - - this->rep_ = temp; - this->buf_len_ = new_buf_len; - this->release_ = 1; - this->len_ = len; - ACE_OS::memcpy (this->rep_, s, len * sizeof (CHAR)); - this->rep_[len] = 0; - } - else // Case 2. No memory allocation is necessary. - { - // Free memory if necessary and figure out future ownership - if (release == 0 || s == 0 || len == 0) - { - if (this->buf_len_ != 0 && this->release_ != 0) - { - this->allocator_->free (this->rep_); - this->release_ = 0; - } - } - // Populate data. - if (s == 0 || len == 0) - { - this->buf_len_ = 0; - this->len_ = 0; - this->rep_ = &ACE_String_Base::NULL_String_; - this->release_ = 0; - } - else if (release == 0) // Note: No guarantee that rep_ is null terminated. - { - this->buf_len_ = len; - this->len_ = len; - this->rep_ = const_cast (s); - this->release_ = 0; - } - else - { - ACE_OS::memcpy (this->rep_, s, len * sizeof (CHAR)); - this->rep_[len] = 0; - this->len_ = len; - } - } -} - -// Return substring. -template ACE_String_Base -ACE_String_Base::substring ( - typename ACE_String_Base::size_type offset, - typename ACE_String_Base::size_type length) const -{ - ACE_String_Base nill; - size_type count = length; - - // case 1. empty string - if (this->len_ == 0) - return nill; - - // case 2. start pos past our end - if (offset >= this->len_) - return nill; - // No length == empty string. - else if (length == 0) - return nill; - // Get all remaining bytes. - else if (length == npos || count > (this->len_ - offset)) - count = this->len_ - offset; - - return ACE_String_Base (&this->rep_[offset], count, this->allocator_); -} - -template ACE_String_Base & -ACE_String_Base::append (const CHAR* s, - typename ACE_String_Base::size_type slen) -{ - ACE_TRACE ("ACE_String_Base::append(const CHAR*, size_type)"); - if (slen > 0 && slen != npos) - { - // case 1. No memory allocation needed. - if (this->buf_len_ >= this->len_ + slen + 1) - { - // Copy in data from new string. - ACE_OS::memcpy (this->rep_ + this->len_, s, slen * sizeof (CHAR)); - } - else // case 2. Memory reallocation is needed - { - const size_type new_buf_len = - ace_max(this->len_ + slen + 1, this->buf_len_ + this->buf_len_ / 2); - - CHAR *t = 0; - - ACE_ALLOCATOR_RETURN (t, - (CHAR *) this->allocator_->malloc (new_buf_len * sizeof (CHAR)), *this); - - // Copy memory from old string into new string. - ACE_OS::memcpy (t, this->rep_, this->len_ * sizeof (CHAR)); - - ACE_OS::memcpy (t + this->len_, s, slen * sizeof (CHAR)); - - if (this->buf_len_ != 0 && this->release_ != 0) - this->allocator_->free (this->rep_); - - this->release_ = 1; - this->rep_ = t; - this->buf_len_ = new_buf_len; - } - - this->len_ += slen; - this->rep_[this->len_] = 0; - } - - return *this; -} - -template u_long -ACE_String_Base::hash (void) const -{ - return - ACE::hash_pjw (reinterpret_cast ( - const_cast (this->rep_)), - this->len_ * sizeof (CHAR)); -} - -template void -ACE_String_Base::resize (typename ACE_String_Base::size_type len, - CHAR c) -{ - ACE_TRACE ("ACE_String_Base::resize"); - - // Only reallocate if we don't have enough space... - if (this->buf_len_ <= len) - { - if (this->buf_len_ != 0 && this->release_ != 0) - this->allocator_->free (this->rep_); - - this->rep_ = static_cast( - this->allocator_->malloc ((len + 1) * sizeof (CHAR))); - this->buf_len_ = len + 1; - this->release_ = 1; - } - this->len_ = 0; - ACE_OS::memset (this->rep_, c, this->buf_len_ * sizeof (CHAR)); -} - -template void -ACE_String_Base::clear (int release) -{ - // This can't use set(), because that would free memory if release=0 - if (release != 0) - { - if (this->buf_len_ != 0 && this->release_ != 0) - this->allocator_->free (this->rep_); - - this->rep_ = &ACE_String_Base::NULL_String_; - this->len_ = 0; - this->buf_len_ = 0; - this->release_ = 0; -} - else - { - this->fast_clear (); - } -} - -// Assignment operator (does copy memory). -template ACE_String_Base & -ACE_String_Base::operator= (const CHAR *s) -{ - ACE_TRACE ("ACE_String_Base::operator="); - if (s != 0) - this->set (s, 1); - return *this; -} - -// Assignment operator (does copy memory). -template ACE_String_Base & -ACE_String_Base::operator= (const ACE_String_Base &s) -{ - ACE_TRACE ("ACE_String_Base::operator="); - - // Check for self-assignment. - if (this != &s) - { - this->set (s.rep_, s.len_, 1); - } - - return *this; -} - -template void -ACE_String_Base::set (const CHAR *s, int release) -{ - size_t length = 0; - if (s != 0) - length = ACE_OS::strlen (s); - - this->set (s, length, release); -} - -template void -ACE_String_Base::fast_clear (void) -{ - this->len_ = 0; - if (this->release_ != 0) - { - // String retains the original buffer. - if (this->rep_ != &ACE_String_Base::NULL_String_) - this->rep_[0] = 0; - } - else - { - // External buffer: string relinquishes control of it. - this->buf_len_ = 0; - this->rep_ = &ACE_String_Base::NULL_String_; - } -} - -// Get a copy of the underlying representation. - -template CHAR * -ACE_String_Base::rep (void) const -{ - ACE_TRACE ("ACE_String_Base::rep"); - - CHAR *new_string; - ACE_NEW_RETURN (new_string, CHAR[this->len_ + 1], 0); - ACE_OS::strsncpy (new_string, this->rep_, this->len_+1); - - return new_string; -} - -template int -ACE_String_Base::compare (const ACE_String_Base &s) const -{ - ACE_TRACE ("ACE_String_Base::compare"); - - if (this->rep_ == s.rep_) - return 0; - - // Pick smaller of the two lengths and perform the comparison. - size_type smaller_length = ace_min (this->len_, s.len_); - - int result = ACE_OS::memcmp (this->rep_, - s.rep_, - smaller_length * sizeof (CHAR)); - - if (!result) - result = static_cast (this->len_ - s.len_); - return result; -} - -// Comparison operator. - -template bool -ACE_String_Base::operator== (const ACE_String_Base &s) const -{ - return this->len_ == s.len_ && - ACE_OS::memcmp (this->rep_, - s.rep_, - this->len_ * sizeof (CHAR)) == 0; -} - -template bool -ACE_String_Base::operator== (const CHAR *s) const -{ - size_t len = ACE_OS::strlen (s); - return this->len_ == len && - ACE_OS::memcmp (this->rep_, - s, - len * sizeof (CHAR)) == 0; -} - -template typename ACE_String_Base::size_type -ACE_String_Base::find ( - const CHAR *s, - typename ACE_String_Base::size_type pos) const -{ - CHAR *substr = this->rep_ + pos; - size_t len = ACE_OS::strlen (s); - CHAR *pointer = ACE_OS::strnstr (substr, s, len); - if (pointer == 0) - return ACE_String_Base::npos; - else - return pointer - this->rep_; -} - -template typename ACE_String_Base::size_type -ACE_String_Base::find ( - CHAR c, - typename ACE_String_Base::size_type pos) const -{ - CHAR *substr = this->rep_ + pos; - CHAR *pointer = ACE_OS::strnchr (substr, c, this->len_ - pos); - if (pointer == 0) - return ACE_String_Base::npos; - else - return pointer - this->rep_; -} - -template typename ACE_String_Base::size_type -ACE_String_Base::rfind ( - CHAR c, - typename ACE_String_Base::size_type pos) const -{ - if (pos == npos || pos > this->len_) - pos = this->len_; - - // Do not change to prefix operator! Proper operation of this loop - // depends on postfix decrement behavior. - for (size_type i = pos; i-- != 0; ) - if (this->rep_[i] == c) - return i; - - return ACE_String_Base::npos; -} - -template void -ACE_String_Base::swap (ACE_String_Base & str) -{ - std::swap (this->allocator_ , str.allocator_); - std::swap (this->len_ , str.len_); - std::swap (this->buf_len_ , str.buf_len_); - std::swap (this->rep_ , str.rep_); - std::swap (this->release_ , str.release_); -} - -// ---------------------------------------------- - -template ACE_String_Base -operator+ (const ACE_String_Base &s, const ACE_String_Base &t) -{ - ACE_String_Base temp (s.length () + t.length ()); - temp += s; - temp += t; - return temp; -} - -template ACE_String_Base -operator+ (const CHAR *s, const ACE_String_Base &t) -{ - size_t slen = 0; - if (s != 0) - slen = ACE_OS::strlen (s); - ACE_String_Base temp (slen + t.length ()); - if (slen > 0) - temp.append (s, slen); - temp += t; - return temp; -} - -template ACE_String_Base -operator+ (const ACE_String_Base &s, const CHAR *t) -{ - size_t tlen = 0; - if (t != 0) - tlen = ACE_OS::strlen (t); - ACE_String_Base temp (s.length () + tlen); - temp += s; - if (tlen > 0) - temp.append (t, tlen); - return temp; -} - -template ACE_String_Base -operator + (const ACE_String_Base &t, - const CHAR c) -{ - ACE_String_Base temp (t.length () + 1); - temp += t; - temp += c; - return temp; -} - -template ACE_String_Base -operator + (const CHAR c, - const ACE_String_Base &t) -{ - ACE_String_Base temp (t.length () + 1); - temp += c; - temp += t; - return temp; -} - -template -ACE_String_Base & -ACE_String_Base::operator+= (const CHAR* s) -{ - size_t slen = 0; - if (s != 0) - slen = ACE_OS::strlen (s); - return this->append (s, slen); -} - -template -ACE_String_Base & -ACE_String_Base::operator+= (const ACE_String_Base &s) -{ - ACE_TRACE ("ACE_String_Base::operator+=(const ACE_String_Base &)"); - return this->append (s.rep_, s.len_); -} - -template -ACE_String_Base & -ACE_String_Base::operator+= (const CHAR c) -{ - ACE_TRACE ("ACE_String_Base::operator+=(const CHAR)"); - const size_type slen = 1; - return this->append (&c, slen); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_STRING_BASE_CPP */ diff --git a/ace/String_Base.h b/ace/String_Base.h deleted file mode 100644 index a2d565a8420..00000000000 --- a/ace/String_Base.h +++ /dev/null @@ -1,599 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file String_Base.h - * - * $Id$ - * - * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) - * @author Nanbor Wang - */ -//============================================================================= - -#ifndef ACE_STRING_BASE_H -#define ACE_STRING_BASE_H - -#include /**/ "ace/pre.h" - -#include "ace/Global_Macros.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/String_Base_Const.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_String_Base - * - * @brief This class provides a wrapper facade for C strings. - * - * This class uses an ACE_Allocator to allocate memory. The - * user can make this a persistant class by providing an - * ACE_Allocator with a persistable memory pool. This class is - * optimized for efficiency, so it doesn't provide any internal - * locking. - * @note If an instance of this class is constructed from or - * assigned an empty string (with first element of '\0'), then it - * is not allocated new space. Instead, its internal - * representation is set equal to a global empty string. - * CAUTION: in cases when ACE_String_Base is constructed from a - * provided buffer with the release parameter set to 0, - * ACE_String_Base is not guaranteed to be '\0' terminated. - * - * \li Do not use a "@c -1" magic number to refer to the "no position" - * condition. This was never the right thing to do. The "@c npos" - * constant should be used in such cases. - * \li Do not assign or pass string positions to or from signed types. - * Use the "@c size_type" @c typedef found in all ACE string - * classes. This typedef is analogous to the "@c size_type" - * @c typedef found in the standard C++ string class as well as - * many STL class templates. If you find yourself casting you're - * probably doing something wrong. - */ -template -class ACE_String_Base : public ACE_String_Base_Const -{ -public: - - using ACE_String_Base_Const::size_type; - - /** - * Default constructor. - * - * @param the_allocator ACE_Allocator associated with string - * @return Default ACE_String_Base string. - */ - ACE_String_Base (ACE_Allocator *the_allocator = 0); - - /** - * Constructor that copies @a s into dynamically allocated memory. - * - * if release == 1 then a new buffer is allocated internally, and - * s is copied to the internal buffer. - * if release == 0 then the s buffer is used directly. If s == 0 - * then it will _not_ be used, and instead the internal buffer - * is set to NULL_String_. - * - * @param s Zero terminated input string - * @param the_allocator ACE_Allocator associated with string - * @param release Allocator responsible(1)/not reponsible(0) for - * freeing memory. - * @return ACE_String_Base containing const CHAR *s - */ - ACE_String_Base (const CHAR *s, - ACE_Allocator *the_allocator = 0, - int release = 1); - - /** - * Constructor that copies @a len CHARs of @a s into dynamically - * allocated memory (will zero terminate the result). - * - * if release == 1 then a new buffer is allocated internally. - * s is copied to the internal buffer. - * if release == 0 then the s buffer is used directly. If s == 0 - * then it will _not_ be used, and instead the internal buffer - * is set to NULL_String_. - * - * @param s Non-zero terminated input string - * @param len Length of non-zero terminated input string - * @param the_allocator ACE_Allocator associated with string - * @param release Allocator responsible(1)/not reponsible(0) for - * freeing memory. - * @return ACE_String_Base containing const CHAR *s - */ - ACE_String_Base (const CHAR *s, - size_type len, - ACE_Allocator *the_allocator = 0, - int release = 1); - - /** - * Copy constructor. - * - * @param s Input ACE_String_Base string to copy - * @return Copy of input string @a s - */ - ACE_String_Base (const ACE_String_Base < CHAR > &s); - - /** - * Constructor that copies @a c into dynamically allocated memory. - * - * @param c Single input character. - * @param the_allocator ACE_Allocator associated with string - * @return ACE_String_Base containing CHAR 'c' - */ - ACE_String_Base (CHAR c, ACE_Allocator *the_allocator = 0); - - /** - * Constructor that allocates a len long string. - * - * Warning : This constructor was incorrectly documented in the past. - * It simply calls resize(len, c). - * It is probably not advisable to use the second parameter. See - * resize() for more information. - * - * @param len Amount of space to reserve for the string. - * @param c The array is filled with c's - * @param the_allocator ACE_Allocator associated with string - * @return Empty ACE_String_Base with room for len CHARs - */ - ACE_String_Base (size_type len, - CHAR c = 0, - ACE_Allocator *the_allocator = 0); - - /** - * Deletes the memory... - */ - ~ACE_String_Base (void); - - /** - * Return the character in the string (doesn't perform - * bounds checking). - * - * @param slot Index of the desired character - * @return The character at index @a slot - */ - const CHAR & operator[] (size_type slot) const; - - /** - * Return the character by reference in the string - * (doesn't perform bounds checking). - * - * @param slot Index of the desired character - * @return The character at index @a slot - */ - CHAR & operator[] (size_type slot); - - /** - * Assignment operator (does copy memory). - * - * @param s Input null-terminated CHAR string to assign to this object. - * @return Return a copy of the this string. - */ - ACE_String_Base < CHAR > &operator = (const CHAR * s); - - /** - * Assignment operator (does copy memory). - * - * @param s Input ACE_String_Base string to assign to this object. - * @return Return a copy of the this string. - */ - ACE_String_Base < CHAR > &operator = (const ACE_String_Base < CHAR > &s); - - /** - * Assignment alternative method (does not copy memory). - * - * @param s Input ACE_String_Base string to assign to this object. - * @return Return this string. - */ - ACE_String_Base < CHAR > &assign_nocopy (const ACE_String_Base < CHAR > &s); - - /** - * Copy @a s into this @a ACE_String_Base. - * - * If release == 1 then a new buffer is allocated internally if the - * existing one is not big enough to hold s. If the existing - * buffer is big enough, then it will be used. This means that - * set(*, 1) can be illegal when the string is constructed with a - * const char*. (e.g. ACE_String_Base("test", 0, 0)). - * - * if release == 0 then the s buffer is used directly, and any - * existing buffer is destroyed. If s == 0 then it will _not_ be - * used, and instead the internal buffer is set to NULL_String_. - * - * @param s Null terminated input string - * @param release Allocator responsible(1)/not reponsible(0) for - * freeing memory. - */ - void set (const CHAR * s, int release = 1); - - /** - * Copy @a len bytes of @a s (will zero terminate the result). - * - * If release == 1 then a new buffer is allocated internally if the - * existing one is not big enough to hold s. If the existing - * buffer is big enough, then it will be used. This means that - * set(*, *, 1) is illegal when the string is constructed with a - * non-owned const char*. (e.g. ACE_String_Base("test", 0, 0)) - * - * If release == 0 then the s buffer is used directly, and any - * existing buffer is destroyed. If s == 0 then it will _not_ be - * used, and instead the internal buffer is set to NULL_String_. - * - * @param s Non-zero terminated input string - * @param len Length of input string 's' - * @param release Allocator responsible(1)/not reponsible(0) for - * freeing memory. - */ - void set (const CHAR * s, size_type len, int release); - - /** - * Clear this string. Memory is _not_ freed if is 0. - * - * Warning: This method was incorrectly documented in the past, but - * the current implementation has been changed to match the documented - * behavior. - * - * Warning: clear(0) behaves like fast_clear() below. - * - * @param release Memory is freed if 1 or not if 0. - */ - void clear (int release = 0); - - /** - * A more specialized version of clear(): "fast clear". fast_clear() - * resets the string to 0 length. If the string owns the buffer - * (@arg release_== 1): - * - the string buffer is not freed - * - the first character of the buffer is set to 0. - * - * If @arg release_ is 0 (this object does not own the buffer): - * - the buffer pointer is reset to the NULL_String_ and does not - * maintain a pointer to the caller-supplied buffer on return - * - the maximum string length is reset to 0. - * - * Warning : Calling clear(0) or fast_clear() can have unintended - * side-effects if the string was constructed (or set()) with an - * external buffer. The string will be disassociated with the buffer - * and the next append() or +=() will cause a new buffer to be - * allocated internally. - */ - void fast_clear (void); - - /** - * Return a substring given an offset and length. - * If length == @c npos use rest of str. Return empty substring if - * offset or offset/length are invalid. - * - * @param offset Index of first desired character of the substring. - * @param length How many characters to return starting at the offset. - * @return The string containing the desired substring - */ - ACE_String_Base < CHAR > substring (size_type offset, - size_type length = npos) const; - - /** - * Same as . - * - * @param offset Index of first desired character of the substring. - * @param length How many characters to return starting at the offset. - * @return The string containing the desired substring - */ - ACE_String_Base < CHAR > substr (size_type offset, - size_type length = npos) const; - - /** - * Concat operator (copies memory). - * - * @param s Input ACE_String_Base string to concatenate to this string. - * @return The combined string (input append to the end of the old). New - * string is zero terminated. - */ - ACE_String_Base < CHAR > &operator += (const ACE_String_Base < CHAR > &s); - - /** - * Concat operator (copies memory). - * - * @param s Input C string to concatenate to this string. - * @return The combined string (input append to the end of the old). New - * string is zero terminated. - */ - ACE_String_Base < CHAR >& operator += (const CHAR* s); - - /** - * Concat operator (copies memory). - * - * @param c Input CHAR to concatenate to this string. - * @return The combined string (input append to the end of the old). New - * string is zero terminated. - */ - ACE_String_Base < CHAR >& operator += (const CHAR c); - - /** - * Append function (copies memory). - * - * @param s Input CHAR array to concatenate to this string. - * @param slen The length of the array. - * @return The combined string (input append to the end of the old). New - * string is zero terminated. - */ - ACE_String_Base < CHAR >& append (const CHAR* s, size_type slen); - - /** - * Returns a hash value for this string. - * - * @return Hash value of string - */ - u_long hash (void) const; - - /** - * Return the length of the string. - * - * @return Length of stored string - */ - size_type length (void) const; - - /** - * Return @c true if the length of the string is zero, else @c false. - */ - bool is_empty (void) const; - - /** - * Return @c true if the length of the string is zero, else @c - * false. We recommend using @c is_empty() instead since it's more - * consistent with the ACE container naming conventions. - */ - bool empty (void) const; - - /** - * Get a copy of the underlying representation. - * - * This method allocates memory for a copy of the string and returns - * a pointer to the new area. The caller is responsible for freeing - * the memory when finished; use delete [] - * - * @return Pointer reference to the string data. Returned string is - * zero terminated. - */ - CHAR *rep (void) const; - - /** - * Get at the underlying representation directly! - * _Don't_ even think about casting the result to (char *) and modifying it, - * if it has length 0! - * - * @return Pointer reference to the stored string data. No guarantee is - * that the string is zero terminated. - * - */ - const CHAR *fast_rep (void) const; - - /** - * Same as STL String's and . - */ - const CHAR *c_str (void) const; - - /** - * Comparison operator that will match substrings. Returns the - * slot of the first location that matches, else @c npos. - * - * @param s Input ACE_String_Base string - * @return Integer index value of the first location of string @a s or - * @c npos (not found). - */ - size_type strstr (const ACE_String_Base &s) const; - - /** - * Find starting at pos. Returns the slot of the first - * location that matches (will be >= pos), else @c npos. - * - * @param str Input ACE_String_Base string to search for in stored string. - * @param pos Starting index position to start searching for string @a str. - * @return Index value of the first location of string @a str else - * @c npos. - */ - size_type find (const ACE_String_Base &str, size_type pos = 0) const; - - /** - * Find @a s starting at pos. Returns the slot of the first - * location that matches (will be >= pos), else @c npos. - * - * @param s non-zero input string to search for in stored string. - * @param pos Starting index position to start searching for string @a str. - * @return Index value of the first location of string @a str else - * @c npos. - */ - size_type find (const CHAR *s, size_type pos = 0) const; - - /** - * Find @a c starting at pos. Returns the slot of the first - * location that matches (will be >= pos), else @c npos. - * - * @param c Input character to search for in stored string. - * @param pos Starting index position to start searching for string @a str. - * @return Index value of the first location of string @a str else - * @c npos. - */ - size_type find (CHAR c, size_type pos = 0) const; - - /** - * Find @a c starting at pos (counting from the end). Returns the - * slot of the first location that matches, else @c npos. - * - * @param c Input character to search for in stored string. - * @param pos Starting index position to start searching for string @a str. - * @return Index value of the first location of string @a str else - * @c npos. - */ - size_type rfind (CHAR c, size_type pos = npos) const; - - /** - * Equality comparison operator (must match entire string). - * - * @param s Input ACE_String_Base string to compare against stored string. - * @return @c true if equal, @c false otherwise. - */ - bool operator == (const ACE_String_Base &s) const; - - /** - * Equality comparison operator (must match entire string). - * - * @param s Null terminated string to compare against stored string. - * @return @c true if equal, @c false otherwise. - */ - bool operator == (const CHAR *s) const; - - /** - * Less than comparison operator. - * - * @param s Input ACE_String_Base string to compare against stored string. - * @return @c true if less than, @c false otherwise. - */ - bool operator < (const ACE_String_Base &s) const; - - /** - * Greater than comparison operator. - * - * @param s Input ACE_String_Base string to compare against stored string. - * @return @c true if greater than, @c false otherwise. - */ - bool operator > (const ACE_String_Base &s) const; - - /** - * Inequality comparison operator. - * - * @param s Input ACE_String_Base string to compare against stored string. - * @return @c true if not equal, @c false otherwise. - */ - bool operator != (const ACE_String_Base &s) const; - - /** - * Inequality comparison operator. - * - * @param s Null terminated string to compare against stored string. - * @return @c true if not equal, @c false otherwise. - */ - bool operator != (const CHAR *s) const; - - /** - * Performs a strncmp comparison. - * - * @param s Input ACE_String_Base string to compare against stored string. - * @return Integer value of result (less than 0, 0, greater than 0) - * depending on how input string @a s is to the stored string. - */ - int compare (const ACE_String_Base &s) const; - - /** - * Dump the state of an object. - */ - void dump (void) const; - - /** - * This method is designed for high-performance. Please use with - * care ;-) - * - * Warning : This method was documented incorrectly in the past. - * The original intention was to change the length of the string to - * len, and to fill the whole thing with c CHARs. - * However, what was actually done was to set the length of the - * string to zero, and fill the buffer with c's. The buffer was - * also not null-terminated unless c happened to be zero. - * Rather than fix the method to work as documented, the code is - * left as is, but the second parameter should probably not be used. - * - * @param len The number of CHARs to reserve - * @param c The CHAR to use when filling the string. - */ - void resize (size_type len, CHAR c = 0); - - /// Swap the contents of this @c ACE_String_Base with @a str. - /** - * @note This is non-throwing operation. - */ - void swap (ACE_String_Base & str); - - /** - * Declare the dynamic allocation hooks. - */ - ACE_ALLOC_HOOK_DECLARE; - -protected: - /** - * Pointer to a memory allocator. - */ - ACE_Allocator *allocator_; - - /** - * Length of the ACE_String_Base data (not counting the trailing '\0'). - */ - size_type len_; - - /** - * Length of the ACE_String_Base data buffer. Keeping track of the - * length allows to avoid unnecessary dynamic allocations. - */ - size_type buf_len_; - - /** - * Pointer to data. - */ - CHAR *rep_; - - /** - * Flag that indicates if we own the memory - */ - int release_; - - /** - * Represents the "NULL" string to simplify the internal logic. - */ - static CHAR NULL_String_; -}; - -template < class CHAR > - ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &, - const ACE_String_Base < CHAR > &); -template < class CHAR > - ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &, - const CHAR *); -template < class CHAR > - ACE_String_Base < CHAR > operator + (const CHAR *, - const ACE_String_Base < CHAR > &); - -template < class CHAR > - ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &t, - const CHAR c); - -template < class CHAR > - ACE_String_Base < CHAR > operator + (const CHAR c, - const ACE_String_Base < CHAR > &t); - -template - bool operator == (const CHAR *s, - const ACE_String_Base &t); - -template - bool operator != (const CHAR *s, - const ACE_String_Base &t); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/String_Base.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/String_Base.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("String_Base.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_STRING_BASE_H */ diff --git a/ace/String_Base.inl b/ace/String_Base.inl deleted file mode 100644 index 45abd5eb83b..00000000000 --- a/ace/String_Base.inl +++ /dev/null @@ -1,152 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Malloc_Base.h" -#include "ace/Min_Max.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_Memory.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE void -ACE_String_Base::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_String_Base::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Assignment method (does not copy memory) -template ACE_INLINE ACE_String_Base & -ACE_String_Base::assign_nocopy (const ACE_String_Base &s) -{ - ACE_TRACE ("ACE_String_Base::assign_nocopy"); - this->set (s.rep_, s.len_, 0); - return *this; -} - -template ACE_INLINE typename ACE_String_Base::size_type -ACE_String_Base::length (void) const -{ - ACE_TRACE ("ACE_String_Base::length"); - return this->len_; -} - -template ACE_INLINE bool -ACE_String_Base::is_empty (void) const -{ - return this->len_ == 0; -} - -template ACE_INLINE bool -ACE_String_Base::empty (void) const -{ - return this->is_empty (); -} - -template ACE_INLINE ACE_String_Base -ACE_String_Base::substr ( - typename ACE_String_Base::size_type offset, - typename ACE_String_Base::size_type length) const -{ - ACE_TRACE ("ACE_String_Base::substr"); - return this->substring (offset, length); -} - -// Return the character in the string. - -template ACE_INLINE const CHAR & -ACE_String_Base::operator[] ( - typename ACE_String_Base::size_type slot) const -{ - ACE_TRACE ("ACE_String_Base::operator[]"); - return this->rep_[slot]; -} - -// Return the character in the string by reference. - -template ACE_INLINE CHAR & -ACE_String_Base::operator[] ( - typename ACE_String_Base::size_type slot) -{ - ACE_TRACE ("ACE_String_Base::operator[]"); - return this->rep_[slot]; -} - -template ACE_INLINE const CHAR * -ACE_String_Base::fast_rep (void) const -{ - return this->rep_; -} - -template ACE_INLINE const CHAR * -ACE_String_Base::c_str (void) const -{ - return this->rep_; -} - -// Less than comparison operator. - -template ACE_INLINE bool -ACE_String_Base::operator < (const ACE_String_Base &s) const -{ - ACE_TRACE ("ACE_String_Base::operator <"); - return compare (s) < 0; -} - -// Greater than comparison operator. - -template ACE_INLINE bool -ACE_String_Base::operator > (const ACE_String_Base &s) const -{ - ACE_TRACE ("ACE_String_Base::operator >"); - return compare (s) > 0; -} - - -// Comparison operator. - -template ACE_INLINE bool -ACE_String_Base::operator!= (const ACE_String_Base &s) const -{ - ACE_TRACE ("ACE_String_Base::operator!="); - return !(*this == s); -} - -template ACE_INLINE bool -ACE_String_Base::operator!= (const CHAR *s) const -{ - return !(*this == s); -} - -template ACE_INLINE typename ACE_String_Base::size_type -ACE_String_Base::find (const ACE_String_Base&str, - typename ACE_String_Base::size_type pos) const -{ - ACE_TRACE ("ACE_String_Base::find"); - return this->find (str.rep_, pos); -} - -template ACE_INLINE typename ACE_String_Base::size_type -ACE_String_Base::strstr (const ACE_String_Base &s) const -{ - ACE_TRACE ("ACE_String_Base::strstr"); - return this->find (s.rep_); -} - -template ACE_INLINE bool -operator== (const CHAR *s, - const ACE_String_Base &t) -{ - return t == s; -} - -template ACE_INLINE bool -operator!= (const CHAR *s, - const ACE_String_Base &t) -{ - return !(t == s); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/String_Base_Const.cpp b/ace/String_Base_Const.cpp deleted file mode 100644 index 77dff6db428..00000000000 --- a/ace/String_Base_Const.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -#include "ace/String_Base_Const.h" -#include "ace/Numeric_Limits.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_String_Base_Const::size_type const ACE_String_Base_Const::npos = - ACE_Numeric_Limits::max (); - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/String_Base_Const.h b/ace/String_Base_Const.h deleted file mode 100644 index 7968512005e..00000000000 --- a/ace/String_Base_Const.h +++ /dev/null @@ -1,49 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file String_Base_Const.h - * - * $Id$ - * - * @author Nanbor Wang - */ -//============================================================================= - -#ifndef ACE_STRING_BASE_CONST_H -#define ACE_STRING_BASE_CONST_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" -#include "ace/Malloc_Base.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_String_Base_Const - * - * @brief This class defines a constant for ACE_String_Base to - * circumvent a bug in SunCC 6.0. - */ -class ACE_Export ACE_String_Base_Const -{ -public: - - typedef ACE_Allocator::size_type size_type; - - /// Constant that denotes case where no such character position - /// exists. - static size_type const npos; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_STRING_BASE_CONST_H */ diff --git a/ace/Svc_Conf.h b/ace/Svc_Conf.h deleted file mode 100644 index 4a0794a9077..00000000000 --- a/ace/Svc_Conf.h +++ /dev/null @@ -1,107 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Svc_Conf.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_SVC_CONF_H -#define ACE_SVC_CONF_H - -#include /**/ "ace/pre.h" - -// Globally visible macros, type decls, and extern var decls for -// Service Configurator utility. - -#include "ace/Obstack.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Service_Config.h" -#include "ace/Parse_Node.h" - -#include "ace/Svc_Conf_Param.h" - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The following yylex() declarations require support for reentrant -// parser generation (e.g. from GNU Bison). -#if defined (DEBUGGING) -#if defined (ACE_YY_DECL) -#undef ACE_YY_DECL -#endif /* ACE_YY_DECL */ -#define ACE_YY_DECL extern "C" char *ace_yylex (ACE_YYSTYPE *ace_yylval, void *ACE_YYLEX_PARAM) -#else -#define ACE_YY_DECL extern "C" int ace_yylex (ACE_YYSTYPE *ace_yylval, void *ACE_YYLEX_PARAM) -#endif /* DEBUGGING */ - -// Forward declarations -class ACE_Location_Node; -class ACE_Parse_Node; -class ACE_Static_Node; -class ACE_Service_Type_Factory; - -// The following definition for the ACE_YYSTYPE must occur before -// ACE_YY_DECL is declared since ACE_YY_DECL expands to function -// prototypes that use ACE_YYSTYPE. -typedef union -{ - int type_; - ACE_Location_Node *location_node_; - ACE_Parse_Node *parse_node_; - ACE_Static_Node *static_node_; - ACE_Service_Type_Factory *svc_record_; - ACE_TCHAR *ident_; -} ACE_YYSTYPE; - -// Forward declaration -struct ace_yy_buffer_state; - -/// Performs the parsing -#ifdef ACE_YYPARSE_PARAM -int ace_yyparse (void *); -#else -int ace_yyparse (void); -#endif - -/// Performs the lexical analysis -ACE_YY_DECL; - -/// Name of input stream -extern FILE *ace_yyin; - -/// Error handling routine required by YACC or BISON -void ace_yyerror (int yyerrno, int yylineno, const char *); - -/// Holds the lexeme for the current token -extern ACE_TCHAR *ace_yytext; - -/// Holds the length of the lexeme for the current token -extern int ace_yyleng; - -#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ - -/// Factory that creates a new ACE_Service_Type_Impl. -extern ACE_Service_Type_Impl * -ace_create_service_type (const ACE_TCHAR *, - int, - void *, - unsigned int, - ACE_Service_Object_Exterminator = 0); - - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_SVC_CONF_H */ diff --git a/ace/Svc_Conf.y b/ace/Svc_Conf.y deleted file mode 100644 index a3b5b7f7080..00000000000 --- a/ace/Svc_Conf.y +++ /dev/null @@ -1,416 +0,0 @@ -%{ -// $Id$ - -#include "ace/Svc_Conf.h" - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) - -#include "ace/ARGV.h" -#include "ace/Module.h" -#include "ace/Stream.h" -#include "ace/Service_Types.h" -#include "ace/OS_NS_string.h" - - -#include "ace/ace_wchar.h" - -ACE_RCSID (ace, - Svc_Conf_y, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Prototypes. - -static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr, - const ACE_Service_Type *sv, - int & ace_yyerrno); - -static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr, - const ACE_TCHAR *svc_name, - int & ace_yyerrno); - -#define YYDEBUG_LEXER_TEXT (yytext[yyleng] = '\0', yytext) - -// Force the pretty debugging code to compile. -// #define YYDEBUG 1 - -ACE_END_VERSIONED_NAMESPACE_DECL - -%} - -%token ACE_DYNAMIC ACE_STATIC ACE_SUSPEND ACE_RESUME ACE_REMOVE ACE_USTREAM -%token ACE_MODULE_T ACE_STREAM_T ACE_SVC_OBJ_T ACE_ACTIVE ACE_INACTIVE -%token ACE_PATHNAME ACE_IDENT ACE_STRING - -%start svc_config_entries - -%type ACE_IDENT ACE_STRING ACE_PATHNAME pathname parameters_opt -%type type status -%type dynamic static suspend resume remove module_list stream -%type stream_modules module svc_config_entry -%type stream_ops -%type svc_location -%type svc_initializer - -// Generate a pure (reentrant) parser -- GNU Bison only -%pure_parser - -%% - -svc_config_entries - : svc_config_entries svc_config_entry - { - if ($2 != 0) - { - $2->apply (ACE_SVC_CONF_PARAM->config, ACE_SVC_CONF_PARAM->yyerrno); - delete $2; - } - ACE_SVC_CONF_PARAM->obstack.release (); - } - | svc_config_entries error - { - ACE_SVC_CONF_PARAM->obstack.release (); - } - | /* EMPTY */ - ; - -svc_config_entry - : dynamic - | static - | suspend - | resume - | remove - | stream - ; - -dynamic - : ACE_DYNAMIC svc_location parameters_opt - { - if ($2 != 0) - $$ = new ACE_Dynamic_Node ($2, $3); - else - $$ = 0; - } - ; - -static - : ACE_STATIC ACE_IDENT parameters_opt - { - $$ = new ACE_Static_Node ($2, $3); - } - ; - -suspend - : ACE_SUSPEND ACE_IDENT - { - $$ = new ACE_Suspend_Node ($2); - } - ; - -resume - : ACE_RESUME ACE_IDENT - { - $$ = new ACE_Resume_Node ($2); - } - ; - -remove - : ACE_REMOVE ACE_IDENT - { - $$ = new ACE_Remove_Node ($2); - } - ; - -stream - : ACE_USTREAM stream_ops stream_modules - { - $$ = new ACE_Stream_Node ($2, $3); - } - | ACE_USTREAM ACE_IDENT { $$ = new ACE_Static_Node ($2); } stream_modules - { - $$ = new ACE_Dummy_Node ($3, $4); - } - ; - -stream_ops - : dynamic - { - } - | static - { - } - ; - -stream_modules - : '{' - { - // Initialize left context... - $$ = $0; - } - module_list '}' - { - $$ = $3; - } - | /* EMPTY */ { $$ = 0; } - ; - -module_list - : module_list module - { - if ($2 != 0) - { - $2->link ($1); - $$ = $2; - } - } - | /* EMPTY */ { $$ = 0; } - ; - -module - : dynamic - { - ACE_Static_Node *svc_type = $1; - - if (svc_type != 0) - { - ACE_Static_Node *module = $-1; - - ACE_ARGV args (svc_type->parameters ()); - ACE_Module_Type *mt = ace_get_module (module->record (ACE_SVC_CONF_PARAM->config), - svc_type->record (ACE_SVC_CONF_PARAM->config), - ACE_SVC_CONF_PARAM->yyerrno); - ACE_Stream_Type *st = - dynamic_cast (const_cast (module->record (ACE_SVC_CONF_PARAM->config)->type ())); - - if (mt->init (args.argc (), args.argv ()) == -1 - || st->push (mt) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("dynamic initialization failed for Module %s\n"), - svc_type->name ())); - ACE_SVC_CONF_PARAM->yyerrno++; - } - } - } - | static - { - ACE_Static_Node *sn = $-1; - ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), - $1->name (), - ACE_SVC_CONF_PARAM->yyerrno); - - if (((ACE_Stream_Type *) sn->record (ACE_SVC_CONF_PARAM->config)->type ())->push (mt) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Problem with static\n"))); - ACE_SVC_CONF_PARAM->yyerrno++; - } - } - | suspend - { - ACE_Static_Node *sn = $-1; - ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), - sn->name (), - ACE_SVC_CONF_PARAM->yyerrno); - if (mt != 0) - mt->suspend (); - } - | resume - { - ACE_Static_Node *sn = $-1; - ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), - $1->name (), - ACE_SVC_CONF_PARAM->yyerrno); - if (mt != 0) - mt->resume (); - } - | remove - { - ACE_Static_Node *stream = $-1; - ACE_Static_Node *module = $1; - ACE_Module_Type *mt = ace_get_module (stream->record (ACE_SVC_CONF_PARAM->config), - module->name (), - ACE_SVC_CONF_PARAM->yyerrno); - - ACE_Stream_Type *st = - dynamic_cast (const_cast (stream->record (ACE_SVC_CONF_PARAM->config)->type ())); - if (mt != 0 && st->remove (mt) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("cannot remove Module_Type %s from STREAM_Type %s\n"), - module->name (), - stream->name ())); - ACE_SVC_CONF_PARAM->yyerrno++; - } - } - ; - -svc_location - : ACE_IDENT type svc_initializer status - { - $$ = new ACE_Service_Type_Factory ($1, $2, $3, $4); - } - ; - -status - : ACE_ACTIVE - { - $$ = 1; - } - | ACE_INACTIVE - { - $$ = 0; - } - | /* EMPTY */ - { - $$ = 1; - } - ; - -svc_initializer - : pathname ':' ACE_IDENT - { - $$ = new ACE_Object_Node ($1, $3); - } - | pathname ':' ACE_IDENT '(' ')' - { - $$ = new ACE_Function_Node ($1, $3); - } - | ':' ACE_IDENT '(' ')' - { - $$ = new ACE_Static_Function_Node ($2); - } - ; - -type - : ACE_MODULE_T '*' - { - $$ = ACE_MODULE_T; - } - | ACE_SVC_OBJ_T '*' - { - $$ = ACE_SVC_OBJ_T; - } - | ACE_STREAM_T '*' - { - $$ = ACE_STREAM_T; - } - ; - -parameters_opt - : ACE_STRING - | /* EMPTY */ { $$ = 0; } - ; - -pathname - : ACE_PATHNAME - | ACE_IDENT - | ACE_STRING - ; - -%% - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Prints the error string to standard output. Cleans up the error -// messages. - -void -yyerror (int yyerrno, int yylineno, const char *s) -{ -#if defined (ACE_NLOGGING) - ACE_UNUSED_ARG (yyerrno); - ACE_UNUSED_ARG (yylineno); - ACE_UNUSED_ARG (s); -#endif /* ACE_NLOGGING */ - - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("[error %d] on line %d: %s\n"), - yyerrno, - yylineno, - s)); -} - -// Note that SRC_REC represents left context, which is the STREAM * -// record. - -static ACE_Module_Type * -ace_get_module (const ACE_Service_Type *sr, - const ACE_TCHAR *svc_name, - int & yyerrno) -{ - const ACE_Service_Type_Impl *type = sr->type (); - ACE_Stream_Type *st = sr == 0 - ? 0 - : dynamic_cast (const_cast (type)); - ACE_Module_Type *mt = st == 0 ? 0 : st->find (svc_name); - - if (sr == 0 || st == 0 || mt == 0) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("cannot locate Module_Type %s in STREAM_Type %s\n"), - svc_name, - sr->name ())); - yyerrno++; - } - - return mt; -} - -static ACE_Module_Type * -ace_get_module (const ACE_Service_Type *sr, - const ACE_Service_Type *sv, - int & yyerrno) -{ - const ACE_Service_Type_Impl *type = sr->type (); - ACE_Stream_Type *st = sr == 0 ? 0 : (ACE_Stream_Type *) type; - - type = sv->type (); - ACE_Module_Type *mt = (ACE_Module_Type *) type; - const ACE_TCHAR *module_type_name = sr->name (); - - if (sr == 0 || st == 0 || mt == 0) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("cannot locate Module_Type %s or STREAM_Type %s\n"), - module_type_name, - sr->name ())); - yyerrno++; - } - - // Make sure that the Module has the same name as the - // Module_Type object from the svc.conf file. - ACE_Module *mp = (ACE_Module *) mt->object (); - - if (ACE_OS::strcmp (mp->name (), module_type_name) != 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"), - module_type_name, - mp->name ())); - mp->name (module_type_name); - } - - return mt; -} - -#if defined (DEBUGGING) -// Main driver program. - -int -main (int argc, char *argv[]) -{ - ACE_Svc_Conf_Param param (stdin); - - // Try to reopen any filename argument to use YYIN. - if (argc > 1 && (yyin = freopen (argv[1], "r", stdin)) == 0) - (void) ACE_OS::fprintf (stderr, ACE_LIB_TEXT ("usage: %s [file]\n"), argv[0]), ACE_OS::exit (1); - - return ::yyparse (¶m); -} -#endif /* DEBUGGING */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ diff --git a/ace/Svc_Conf_Lexer.cpp b/ace/Svc_Conf_Lexer.cpp deleted file mode 100644 index 86e27de9b48..00000000000 --- a/ace/Svc_Conf_Lexer.cpp +++ /dev/null @@ -1,657 +0,0 @@ -// $Id$ -#include "ace/Svc_Conf_Lexer.h" - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) - -#if defined (ACE_USES_WCHAR) -#include "ace/Encoding_Converter.h" -#include "ace/Encoding_Converter_Factory.h" -#endif /* ACE_USES_WCHAR */ - -#include "ace/Svc_Conf_Tokens.h" -#include "ace/Recursive_Thread_Mutex.h" -#include "ace/Static_Object_Lock.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_ctype.h" -#include "ace/OS_NS_string.h" -#include "ace/Guard_T.h" -#include "ace/Synch_Traits.h" -#include "ace/os_include/os_ctype.h" - -#if !defined (__GNUG__) -# include "ace/Auto_Ptr.h" -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#define ACE_YY_BUF_SIZE 4096 -#define ACE_MAX_BYTES_PER_CHAR 4 -#define ACE_YY_CONVERSION_SPACE ACE_YY_BUF_SIZE * ACE_MAX_BYTES_PER_CHAR - -#if defined (__GNUG__) -# define ACE_TEMPORARY_STRING(X,SIZE) \ - __extension__ char X[SIZE] -#else -# define ACE_TEMPORARY_STRING(X,SIZE) \ - char* X = 0; \ - char X ## buf[ACE_YY_BUF_SIZE]; \ - ACE_Auto_Ptr X ## bufp (0); \ - if (SIZE > ACE_YY_BUF_SIZE) { \ - X ## bufp.reset (new char[SIZE]); \ - X = X ## bufp.get (); \ - } \ - else { \ - X = X ## buf; \ - } -#endif /* __GNUG__ */ - -// These are states not covered by the tokens in Svc_Conf_Tokens.h -#define ACE_NO_STATE -1 -#define ACE_COMMENT 0 - -struct ace_yy_buffer_state -{ - ace_yy_buffer_state (void) - : input_ (), - index_ (0), - size_ (0), - start_ (0), - need_more_ (true), - eof_ (false), - state_ (ACE_NO_STATE), - string_start_ (0) -#if defined (ACE_USES_WCHAR) - , converter_ (0) -#endif /* ACE_USES_WCHAR */ - { - } - - ~ace_yy_buffer_state (void) - { -#if defined (ACE_USES_WCHAR) - delete converter_; -#endif /* ACE_USES_WCHAR */ - } - - // Input related - char input_[ACE_YY_CONVERSION_SPACE]; - size_t index_; - size_t size_; - size_t start_; - bool need_more_; - bool eof_; - - // Parsing related - int state_; - char string_start_; - -#if defined (ACE_USES_WCHAR) - // Code set conversion related - ACE_Encoding_Converter* converter_; -#endif /* ACE_USES_WCHAR */ -}; - -// ****************************************************************** -// Global functions -// ****************************************************************** - -int -ace_yylex (ACE_YYSTYPE *ace_yylval, void *ACE_YYLEX_PARAM) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, - ace_mon, - *ACE_Static_Object_Lock::instance (), - -1)); - - return ACE_Svc_Conf_Lexer::yylex (ace_yylval, ACE_SVC_CONF_PARAM); - -} - -void -ace_yy_delete_buffer (ace_yy_buffer_state *buffer) -{ - delete buffer; -} - -// ****************************************************************** -// Inline methods -// ****************************************************************** - -inline size_t -normalize (size_t length) -{ - return (length >= ACE_MAX_BYTES_PER_CHAR ? - (length / ACE_MAX_BYTES_PER_CHAR) * ACE_MAX_BYTES_PER_CHAR : - length); -} - -// ****************************************************************** -// Static class methods -// ****************************************************************** - -int -ACE_Svc_Conf_Lexer::yylex (ACE_YYSTYPE* ace_yylval, - ACE_Svc_Conf_Param* param) -{ -#if defined (ACE_USES_WCHAR) - bool look_for_bom = false; - ACE_Encoding_Converter_Factory::Encoding_Hint hint = - ACE_Encoding_Converter_Factory::ACE_NONE; -#endif /* ACE_USES_WCHAR */ - if (param->buffer == 0) - { -#if defined (ACE_USES_WCHAR) - look_for_bom = true; -#endif /* ACE_USES_WCHAR */ - ACE_NEW_RETURN (param->buffer, - ace_yy_buffer_state, - -1); - } - - int token = ACE_NO_STATE; - do { - if (param->buffer->need_more_) - { - size_t skip_bytes = 0; - param->buffer->need_more_ = false; - size_t amount = - input (param, - param->buffer->input_ + param->buffer->size_, - normalize (ACE_YY_BUF_SIZE - - param->buffer->size_)); - if (amount == 0) - { - param->buffer->eof_ = true; - skip_bytes = param->buffer->size_; - } - else - { -#if defined (ACE_USES_WCHAR) - if (look_for_bom) - { - size_t read_more = 0; - - look_for_bom = false; - hint = locate_bom (param->buffer->input_, amount, read_more); - - if (read_more != 0) - { - input (param, - param->buffer->input_ + amount, - read_more); - ACE_OS::memmove (param->buffer->input_, - param->buffer->input_ + read_more, - amount); - } - } -#endif /* ACE_USES_WCHAR */ - skip_bytes = param->buffer->size_; - param->buffer->size_ += amount; - } - -#if defined (ACE_USES_WCHAR) - if (!convert_to_utf8 (param, skip_bytes, hint)) - { - ace_yyerror (++param->yyerrno, - param->yylineno, - "Unable to convert input stream to UTF-8"); - return ACE_NO_STATE; - } -#endif /* ACE_USES_WCHAR */ - } - - token = scan (ace_yylval, param); - } while (token == ACE_NO_STATE && param->buffer->need_more_); - - return token; -} - -size_t -ACE_Svc_Conf_Lexer::input (ACE_Svc_Conf_Param* param, - char* buf, size_t max_size) -{ - size_t result = 0; - - switch (param->type) - { - case ACE_Svc_Conf_Param::SVC_CONF_FILE: - errno = 0; - while ((result = ACE_OS::fread (buf, 1, - max_size, param->source.file)) == 0 && - ferror (param->source.file)) - { - if (errno == EINTR) - { - errno = 0; -#if !defined (ACE_LACKS_CLEARERR) - ACE_OS::clearerr (param->source.file); -#endif /* !ACE_LACKS_CLEARERR */ - } - else - { - ACE_OS::fprintf (stderr, "ERROR: input in scanner failed\n"); - ACE_OS::exit (2); - } - } - break; - case ACE_Svc_Conf_Param::SVC_CONF_DIRECTIVE: - result = ACE_OS::strlen (param->source.directive + - param->buffer->start_) * sizeof (ACE_TCHAR); - if (result != 0) - { - // Make sure that the amount we are going to copy - // fits in the buffer - if (result > max_size) - { - result = max_size; - } - ACE_OS::memcpy (buf, - param->source.directive + param->buffer->start_, - result); - param->buffer->start_ += (result / sizeof (ACE_TCHAR)); - } - break; - default: - ace_yyerror (++param->yyerrno, - param->yylineno, - "Invalid Service Configurator type in " - "ACE_Svc_Conf_Lexer::input"); - } - - return result; -} - -int -ACE_Svc_Conf_Lexer::scan (ACE_YYSTYPE* ace_yylval, - ACE_Svc_Conf_Param* param) - -{ - ace_yy_buffer_state* buffer = param->buffer; - - // If we are not currently in any state, skip over whitespace - if (buffer->state_ == ACE_NO_STATE) - { - while (buffer->index_ < buffer->size_ && - isspace (buffer->input_[buffer->index_])) - { - // Make sure that we count all of the new lines - if (buffer->input_[buffer->index_] == '\n') - { - ++param->yylineno; - } - ++buffer->index_; - } - } - - size_t current; - size_t last = buffer->size_ + (buffer->eof_ ? 1 : 0); - for (current = buffer->index_; current < last; current++) - { - static const char* separators = " \t\r\n:*(){}"; - char c = (buffer->eof_ && current == buffer->size_ ? - '\n' : buffer->input_[current]); - switch (buffer->state_) - { - case ACE_COMMENT: - if (c == '\n') - { - buffer->state_ = ACE_NO_STATE; - buffer->index_ = current + 1; - ++param->yylineno; - } - break; - case ACE_STRING: - if (!(c >= ' ' && c <= '~')) - { - // The character at currrent is definitely not part of - // the string so we need to move current back one. - --current; - - // Get the starting point of our string (skipping the quote) - char* source = buffer->input_ + buffer->index_ + 1; - - // Now, we need to move back in the string until we find the - // same character that started the string - bool string_end_found = false; - for(ssize_t i = (current - 1) - buffer->index_; i >= 0; i--) - { - if (source[i] == buffer->string_start_) - { - current = buffer->index_ + i + 1; - string_end_found = true; - break; - } - } - - if (!string_end_found) - { - ace_yyerror (++param->yyerrno, - param->yylineno, - "Unable to find the end of the string"); - return ACE_NO_STATE; - } - - size_t amount = (current - buffer->index_) - 1; -#if defined (ACE_USES_WCHAR) - ACE_TCHAR target[ACE_YY_CONVERSION_SPACE] = ACE_TEXT (""); - size_t length = 0; - if (!convert_from_utf8 (buffer->converter_, - source, - amount, - target, - ACE_YY_CONVERSION_SPACE, - length)) - { - ace_yyerror (++param->yyerrno, - param->yylineno, - "Unable to convert string from UTF-8"); - return ACE_NO_STATE; - } - amount = length; -#else - char* target = source; -#endif /* ACE_USES_WCHAR */ - ace_yylval->ident_ = param->obstack.copy (target, amount); - buffer->state_ = ACE_NO_STATE; - buffer->index_ = current + 1; - return ACE_STRING; - } - break; - case ACE_NO_STATE: - if (c == '"' || c == '\'') - { - buffer->string_start_ = c; - buffer->state_ = ACE_STRING; - } - else if (c == '#') - { - buffer->state_ = ACE_COMMENT; - } - else if (ACE_OS::strchr (separators, c) != 0) - { - if (c == '\n') - { - ++param->yylineno; - } - - if (current == buffer->index_ + 1) - { - int lower = ACE_OS::ace_tolower ( - buffer->input_[current - 1]); - if (c == ':' && - (buffer->input_[current - 1] == '%' || - (lower >= 'a' && lower <= 'z'))) - { - // This is considered a path, so we need to - // skip over the ':' and go around the loop - // again - break; - } - } - - if (current == buffer->index_) - { - buffer->index_ = current + 1; - if (isspace (c)) - { - // This is an empty line. - // Let's look for something else. - break; - } - else - { - return c; - } - } - - // String from buffer->index_ to current (inclusive) - size_t size = (current - buffer->index_) + 1; - ACE_TEMPORARY_STRING (str, size); - ACE_OS::strncpy (str, buffer->input_ + buffer->index_, - size - 1); - str[size - 1] = '\0'; - - - if (ACE_OS::strcmp (str, "dynamic") == 0) - { - buffer->index_ = current; - return ACE_DYNAMIC; - } - else if (ACE_OS::strcmp (str, "static") == 0) - { - buffer->index_ = current; - return ACE_STATIC; - } - else if (ACE_OS::strcmp (str, "suspend") == 0) - { - buffer->index_ = current; - return ACE_SUSPEND; - } - else if (ACE_OS::strcmp (str, "resume") == 0) - { - buffer->index_ = current; - return ACE_RESUME; - } - else if (ACE_OS::strcmp (str, "remove") == 0) - { - buffer->index_ = current; - return ACE_REMOVE; - } - else if (ACE_OS::strcmp (str, "stream") == 0) - { - buffer->index_ = current; - return ACE_USTREAM; - } - else if (ACE_OS::strcmp (str, "Module") == 0) - { - buffer->index_ = current; - return ACE_MODULE_T; - } - else if (ACE_OS::strcmp (str, "Service_Object") == 0) - { - buffer->index_ = current; - return ACE_SVC_OBJ_T; - } - else if (ACE_OS::strcmp (str, "STREAM") == 0) - { - buffer->index_ = current; - return ACE_STREAM_T; - } - else if (ACE_OS::strcmp (str, "active") == 0) - { - buffer->index_ = current; - return ACE_ACTIVE; - } - else if (ACE_OS::strcmp (str, "inactive") == 0) - { - buffer->index_ = current; - return ACE_INACTIVE; - } - else - { - // Get the string and save it in ace_yylval - int token = ACE_IDENT; - size_t amount = size - 1; -#if defined (ACE_USES_WCHAR) - ACE_TCHAR target[ACE_YY_CONVERSION_SPACE] = ACE_TEXT (""); - size_t length = 0; - if (!convert_from_utf8 (buffer->converter_, - str, - amount, - target, - ACE_YY_CONVERSION_SPACE, - length)) - { - ace_yyerror (++param->yyerrno, - param->yylineno, - "Unable to convert " - "identifier from UTF-8"); - return ACE_NO_STATE; - } - amount = length; -#else - char* target = str; -#endif /* ACE_USES_WCHAR */ - ace_yylval->ident_ = param->obstack.copy (target, amount); - - // Determine the difference between pathname and ident - if (ACE_OS::ace_isdigit (ace_yylval->ident_[0])) - { - token = ACE_PATHNAME; - } - else - { - static const ACE_TCHAR* path_parts = - ACE_TEXT ("/\\:%.~-"); - for (const ACE_TCHAR* p = path_parts; *p != '\0'; p++) - { - if (ACE_OS::strchr (ace_yylval->ident_, *p) != 0) - { - token = ACE_PATHNAME; - break; - } - } - } - - buffer->state_ = ACE_NO_STATE; - buffer->index_ = current; - return token; - } - } - break; - default: - ace_yyerror (++param->yyerrno, - param->yylineno, - "Unexpected state in ACE_Svc_Conf_Lexer::scan"); - return ACE_NO_STATE; - } - } - - // We need more from the input source so, we will move the remainder of - // the buffer to the front and signal that we need more - if (!buffer->eof_) - { - buffer->need_more_ = true; - if (buffer->state_ == ACE_COMMENT) - { - buffer->index_ = 0; - buffer->size_ = 0; - } - else - { - buffer->size_ = current - buffer->index_; - if (buffer->size_ != 0 && buffer->index_ != 0) - ACE_OS::memmove (buffer->input_, - buffer->input_ + buffer->index_, buffer->size_); - buffer->index_ = 0; - buffer->state_ = ACE_NO_STATE; - } - } - return ACE_NO_STATE; -} - -#if defined (ACE_USES_WCHAR) - -bool -ACE_Svc_Conf_Lexer::convert_to_utf8 ( - ACE_Svc_Conf_Param* param, - size_t skip_bytes, - ACE_Encoding_Converter_Factory::Encoding_Hint hint) -{ - bool status = false; - if (param->buffer->converter_ == 0) - { - param->buffer->converter_ = - ACE_Encoding_Converter_Factory::create ( - reinterpret_cast (param->buffer->input_ + skip_bytes), - param->buffer->size_ - skip_bytes, - hint); - } - - if (param->buffer->converter_ != 0) - { - char target[ACE_YY_CONVERSION_SPACE] = ""; - if (param->buffer->converter_->to_utf8 ( - param->buffer->input_ + skip_bytes, - param->buffer->size_ - skip_bytes, - reinterpret_cast (target), - ACE_YY_CONVERSION_SPACE) == ACE_Encoding_Converter::CONVERSION_OK) - { - ACE_OS::strcpy (param->buffer->input_ + skip_bytes, target); - param->buffer->size_ = ACE_OS::strlen (target) + skip_bytes; - status = true; - } - } - - return status; -} - -bool -ACE_Svc_Conf_Lexer::convert_from_utf8 (ACE_Encoding_Converter* converter, - const char* source, - size_t source_size, - ACE_TCHAR* target, - size_t target_size, - size_t& length) -{ - if (converter != 0) - { - if (converter->from_utf8 ( - reinterpret_cast (source), - source_size, - target, - target_size) != ACE_Encoding_Converter::CONVERSION_OK) - { - return false; - } - } - else - { - ACE_OS::strncpy (target, ACE_TEXT_CHAR_TO_TCHAR (source), source_size); - target[source_size] = 0; - } - - length = ACE_OS::strlen (target); - return true; -} - -ACE_Encoding_Converter_Factory::Encoding_Hint -ACE_Svc_Conf_Lexer::locate_bom (char* source, - size_t source_size, - size_t& bytes_used) -{ - struct bom { - size_t length_; - const char* data_; - ACE_Encoding_Converter_Factory::Encoding_Hint hint_; - }; - static const bom boms[] = { - { 4, "\x00\x00\xfe\xff", ACE_Encoding_Converter_Factory::ACE_UTF_32BE }, - { 4, "\xff\xfe\x00\x00", ACE_Encoding_Converter_Factory::ACE_UTF_32LE }, - { 2, "\xfe\xff", ACE_Encoding_Converter_Factory::ACE_UTF_16BE }, - { 2, "\xff\xfe", ACE_Encoding_Converter_Factory::ACE_UTF_16LE }, - { 3, "\xef\xbb\xbf", ACE_Encoding_Converter_Factory::ACE_UTF_8 }, - }; - - for (size_t i = 0; i < sizeof (boms) / sizeof (bom); i++) - { - if (source_size >= boms[i].length_) - { - if (ACE_OS::memcmp (source, - boms[i].data_, boms[i].length_) == 0) - { - bytes_used = boms[i].length_; - return boms[i].hint_; - } - } - } - - // No BOM was found - bytes_used = 0; - return ACE_Encoding_Converter_Factory::ACE_NONE; -} - -#endif /* ACE_USES_WCHAR */ - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_CLASSIC_SVC_CONF = 1 */ diff --git a/ace/Svc_Conf_Lexer.h b/ace/Svc_Conf_Lexer.h deleted file mode 100644 index 387e7b7611f..00000000000 --- a/ace/Svc_Conf_Lexer.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -//========================================================================= -/** - * @file Svc_Conf_Lexer.h - * - * $Id$ - * - * This class is a hand-coded replacement for the lexer generated from - * Svc_Conf.l that correctly supports Unicode. - * - * @author Chad Elliott - */ -//========================================================================= - -#ifndef SVC_CONF_LEXER_H -#define SVC_CONF_LEXER_H - -#include /**/ "ace/pre.h" -#include "ace/Svc_Conf.h" - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) -#include "ace/Encoding_Converter_Factory.h" - -class ACE_Encoding_Converter; - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** This class lexes the classic ACE Service Configurator language. - * The entry point is similar to what flex would generate. However, it - * is a static method in this class (which is really just name space). - */ -class ACE_Svc_Conf_Lexer -{ -public: - /// This is similar to the C function, ace_yylex, which a bison - /// generated parser expects. It returns information in the ace_yylval - /// parameter and uses input stored in the param parameter. - static int yylex (ACE_YYSTYPE* ace_yylval, - ACE_Svc_Conf_Param* param); - -private: - static size_t input(ACE_Svc_Conf_Param* param, char* buf, size_t max_size); - - static int scan (ACE_YYSTYPE* ace_yylval, ACE_Svc_Conf_Param* param); - -#if defined (ACE_USES_WCHAR) - static bool convert_to_utf8 ( - ACE_Svc_Conf_Param* param, - size_t skip_bytes, - ACE_Encoding_Converter_Factory::Encoding_Hint hint); - static bool convert_from_utf8 (ACE_Encoding_Converter* converter, - const char* source, - size_t source_size, - ACE_TCHAR* target, - size_t target_size, - size_t& length); - static ACE_Encoding_Converter_Factory::Encoding_Hint - locate_bom (char* source, - size_t source_size, - size_t& bytes_used); -#endif /* ACE_USES_WCHAR */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_CLASSIC_SVC_CONF = 1 */ - -#include /**/ "ace/post.h" - -#endif /* SVC_CONF_LEXER_H */ diff --git a/ace/Svc_Conf_Param.h b/ace/Svc_Conf_Param.h deleted file mode 100644 index 898b3b5cd07..00000000000 --- a/ace/Svc_Conf_Param.h +++ /dev/null @@ -1,140 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Svc_Conf_Param.h - * - * $Id$ - * - * @author Iliyan Jeliazkov - */ -//============================================================================= - - -#ifndef ACE_SVC_CONF_PARAM_H -#define ACE_SVC_CONF_PARAM_H - -#include /**/ "ace/pre.h" - -// Globally visible macros, type decls, and extern var decls for -// Service Configurator utility. - -#include "ace/Obstack.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -struct ace_yy_buffer_state; -class ACE_Service_Gestalt; - -extern void ace_yy_delete_buffer (ace_yy_buffer_state *buffer); - -/** - * @class ACE_Svc_Conf_Param - * - * @brief An instance of this object will be passed down to the - * yyparse() and yylex() functions. - * - * This is intended for internal use within ACE service configuration - * framework only. - * - * This class retains the state for a given parse/scan. It primarily - * makes it possible to hold the static object lock in the scanner - * for as short a period of time as possible. The resulting finer - * grained locking prevents deadlocks from occuring when scanning a - * `svc.conf' file and activating an ACE_Task, for example, as a - * result of processing the directives in that file. - */ -class ACE_Svc_Conf_Param -{ -public: - - enum SVC_CONF_PARAM_TYPE - { - /// The lexer will scan a file containing one or more directives. - SVC_CONF_FILE, - - /// The lexer will scan a string containing a directive. - SVC_CONF_DIRECTIVE - }; - - /// Constructor - ACE_Svc_Conf_Param (ACE_Service_Gestalt* config, FILE *file) - : type (SVC_CONF_FILE), - yyerrno (0), - yylineno (1), - buffer (0), - obstack (), - config (config) - { - source.file = file; - } - - /// Constructor - ACE_Svc_Conf_Param (ACE_Service_Gestalt* config, const ACE_TCHAR *directive) - : type (SVC_CONF_DIRECTIVE), - yyerrno (0), - yylineno (1), - buffer (0), - obstack (), - config (config) - { - source.directive = directive; - } - - ~ACE_Svc_Conf_Param (void) - { - ace_yy_delete_buffer (this->buffer); - } - -public: - - union - { - /// FILE stream from which directives will be scanned and parsed. - FILE *file; - - /// String containing directive that will be scanned and parsed. - const ACE_TCHAR *directive; - - } source; - - /// Discriminant use to determine which union member to use. - SVC_CONF_PARAM_TYPE type; - - /// Keeps track of the number of errors encountered so far. - int yyerrno; - - /// Keeps track of the current line number for error-handling routine. - int yylineno; - - /// Lexer buffer that corresponds to the current Service - /// Configurator file/direct scan. - ace_yy_buffer_state *buffer; - - /// Obstack used for efficient memory allocation when - /// parsing/scanning a service configurator directive. - ACE_Obstack_T obstack; - - /// A reference to the configuration - ACE_Service_Gestalt *config; -}; - - -// Parameter that is passed down to the yyparse() function, and -// eventually to yylex(). -#define ACE_YYPARSE_PARAM ace_svc_conf_parameter - -#define ACE_YYLEX_PARAM ACE_YYPARSE_PARAM - -#define ACE_SVC_CONF_PARAM (static_cast (ACE_YYLEX_PARAM)) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_SVC_CONF_PARAM_H */ diff --git a/ace/Svc_Conf_Tokens.h b/ace/Svc_Conf_Tokens.h deleted file mode 100644 index 8c514a0a582..00000000000 --- a/ace/Svc_Conf_Tokens.h +++ /dev/null @@ -1,81 +0,0 @@ -// $Id$ -#ifndef BISON_SVC_CONF_TAB_H -# define BISON_SVC_CONF_TAB_H -# define ACE_YYSTYPE_IS_DECLARED 1 -/* A Bison parser, made by GNU Bison 2.0. */ - -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* Tokens. */ -#ifndef ACE_YYTOKENTYPE -# define ACE_YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum ace_yytokentype { - ACE_DYNAMIC = 258, - ACE_STATIC = 259, - ACE_SUSPEND = 260, - ACE_RESUME = 261, - ACE_REMOVE = 262, - ACE_USTREAM = 263, - ACE_MODULE_T = 264, - ACE_STREAM_T = 265, - ACE_SVC_OBJ_T = 266, - ACE_ACTIVE = 267, - ACE_INACTIVE = 268, - ACE_PATHNAME = 269, - ACE_IDENT = 270, - ACE_STRING = 271 - }; -#endif -#define ACE_DYNAMIC 258 -#define ACE_STATIC 259 -#define ACE_SUSPEND 260 -#define ACE_RESUME 261 -#define ACE_REMOVE 262 -#define ACE_USTREAM 263 -#define ACE_MODULE_T 264 -#define ACE_STREAM_T 265 -#define ACE_SVC_OBJ_T 266 -#define ACE_ACTIVE 267 -#define ACE_INACTIVE 268 -#define ACE_PATHNAME 269 -#define ACE_IDENT 270 -#define ACE_STRING 271 - - - - -#if ! defined (ACE_YYSTYPE) && ! defined (ACE_YYSTYPE_IS_DECLARED) -typedef int ACE_YYSTYPE; -# define ace_yystype ACE_YYSTYPE /* obsolescent; will be withdrawn */ -# define ACE_YYSTYPE_IS_DECLARED 1 -# define ACE_YYSTYPE_IS_TRIVIAL 1 -#endif - - - - - -#endif /* ifndef BISON_SVC_CONF_TAB_H */ diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp deleted file mode 100644 index 360cbecaed2..00000000000 --- a/ace/Svc_Conf_y.cpp +++ /dev/null @@ -1,1739 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.0. */ - -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ - -/* All symbols defined below should begin with ace_yy or ACE_YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define ACE_YYBISON 1 - -/* Skeleton name. */ -#define ACE_YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define ACE_YYPURE 1 - -/* Using locations. */ -#define ACE_YYLSP_NEEDED 0 - - - -/* Tokens. */ -#ifndef ACE_YYTOKENTYPE -# define ACE_YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum ace_yytokentype { - ACE_DYNAMIC = 258, - ACE_STATIC = 259, - ACE_SUSPEND = 260, - ACE_RESUME = 261, - ACE_REMOVE = 262, - ACE_USTREAM = 263, - ACE_MODULE_T = 264, - ACE_STREAM_T = 265, - ACE_SVC_OBJ_T = 266, - ACE_ACTIVE = 267, - ACE_INACTIVE = 268, - ACE_PATHNAME = 269, - ACE_IDENT = 270, - ACE_STRING = 271 - }; -#endif -#define ACE_DYNAMIC 258 -#define ACE_STATIC 259 -#define ACE_SUSPEND 260 -#define ACE_RESUME 261 -#define ACE_REMOVE 262 -#define ACE_USTREAM 263 -#define ACE_MODULE_T 264 -#define ACE_STREAM_T 265 -#define ACE_SVC_OBJ_T 266 -#define ACE_ACTIVE 267 -#define ACE_INACTIVE 268 -#define ACE_PATHNAME 269 -#define ACE_IDENT 270 -#define ACE_STRING 271 - - - - -/* Copy the first part of user declarations. */ - - -// $Id$ - -#include "ace/Svc_Conf.h" - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) - -#include "ace/ARGV.h" -#include "ace/Module.h" -#include "ace/Stream.h" -#include "ace/Service_Types.h" -#include "ace/OS_NS_string.h" - - -#include "ace/ace_wchar.h" - -ACE_RCSID (ace, - Svc_Conf_y, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Prototypes. - -static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr, - const ACE_Service_Type *sv, - int & ace_ace_yyerrno); - -static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr, - const ACE_TCHAR *svc_name, - int & ace_ace_yyerrno); - -#define ACE_YYDEBUG_LEXER_TEXT (ace_yytext[ace_yyleng] = '\0', ace_yytext) - -// Force the pretty debugging code to compile. -// #define ACE_YYDEBUG 1 - -ACE_END_VERSIONED_NAMESPACE_DECL - - -/* Enabling traces. */ -#ifndef ACE_YYDEBUG -# define ACE_YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef ACE_YYERROR_VERBOSE -# undef ACE_YYERROR_VERBOSE -# define ACE_YYERROR_VERBOSE 1 -#else -# define ACE_YYERROR_VERBOSE 0 -#endif - -#if ! defined (ACE_YYSTYPE) && ! defined (ACE_YYSTYPE_IS_DECLARED) -typedef int ACE_YYSTYPE; -# define ace_yystype ACE_YYSTYPE /* obsolescent; will be withdrawn */ -# define ACE_YYSTYPE_IS_DECLARED 1 -# define ACE_YYSTYPE_IS_TRIVIAL 1 -#endif - - - -/* Copy the second part of user declarations. */ - - -/* Line 213 of yacc.c. */ - - -#if ! defined (ace_yyoverflow) || ACE_YYERROR_VERBOSE - -# ifndef ACE_YYFREE -# define ACE_YYFREE free -# endif -# ifndef ACE_YYMALLOC -# define ACE_YYMALLOC malloc -# endif - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef ACE_YYSTACK_USE_ALLOCA -# if ACE_YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define ACE_YYSTACK_ALLOC __builtin_alloca -# else -# define ACE_YYSTACK_ALLOC alloca -# endif -# endif -# endif - -# ifdef ACE_YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define ACE_YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define ACE_YYSIZE_T size_t -# endif -# define ACE_YYSTACK_ALLOC ACE_YYMALLOC -# define ACE_YYSTACK_FREE ACE_YYFREE -# endif -#endif /* ! defined (ace_yyoverflow) || ACE_YYERROR_VERBOSE */ - - -#if (! defined (ace_yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (ACE_YYSTYPE_IS_TRIVIAL) && ACE_YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union ace_yyalloc -{ - short int ace_yyss; - ACE_YYSTYPE ace_yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define ACE_YYSTACK_GAP_MAXIMUM (sizeof (union ace_yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define ACE_YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (ACE_YYSTYPE)) \ - + ACE_YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef ACE_YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ -# define ACE_YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define ACE_YYCOPY(To, From, Count) \ - do \ - { \ - register ACE_YYSIZE_T ace_yyi; \ - for (ace_yyi = 0; ace_yyi < (Count); ace_yyi++) \ - (To)[ace_yyi] = (From)[ace_yyi]; \ - } \ - while (0) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables ACE_YYSIZE and ACE_YYSTACKSIZE give the old and new number of - elements in the stack, and ACE_YYPTR gives the new location of the - stack. Advance ACE_YYPTR to a properly aligned location for the next - stack. */ -# define ACE_YYSTACK_RELOCATE(Stack) \ - do \ - { \ - ACE_YYSIZE_T ace_yynewbytes; \ - ACE_YYCOPY (&ace_yyptr->Stack, Stack, ace_yysize); \ - Stack = &ace_yyptr->Stack; \ - ace_yynewbytes = ace_yystacksize * sizeof (*Stack) + ACE_YYSTACK_GAP_MAXIMUM; \ - ace_yyptr += ace_yynewbytes / sizeof (*ace_yyptr); \ - } \ - while (0) - -#endif - -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char ace_yysigned_char; -#else - typedef short int ace_yysigned_char; -#endif - -/* ACE_YYFINAL -- State number of the termination state. */ -#define ACE_YYFINAL 2 -/* ACE_YYLAST -- Last index in ACE_YYTABLE. */ -#define ACE_YYLAST 62 - -/* ACE_YYNTOKENS -- Number of terminals. */ -#define ACE_YYNTOKENS 23 -/* ACE_YYNNTS -- Number of nonterminals. */ -#define ACE_YYNNTS 21 -/* ACE_YYNRULES -- Number of rules. */ -#define ACE_YYNRULES 45 -/* ACE_YYNRULES -- Number of states. */ -#define ACE_YYNSTATES 66 - -/* ACE_YYTRANSLATE(ACE_YYLEX) -- Bison symbol number corresponding to ACE_YYLEX. */ -#define ACE_YYUNDEFTOK 2 -#define ACE_YYMAXUTOK 271 - -#define ACE_YYTRANSLATE(ACE_YYX) \ - ((unsigned int) (ACE_YYX) <= ACE_YYMAXUTOK ? ace_yytranslate[ACE_YYX] : ACE_YYUNDEFTOK) - -/* ACE_YYTRANSLATE[ACE_YYLEX] -- Bison symbol number corresponding to ACE_YYLEX. */ -static const unsigned char ace_yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 20, 21, 22, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 19, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 17, 2, 18, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16 -}; - -#if ACE_YYDEBUG -/* ACE_YYPRHS[ACE_YYN] -- Index of the first RHS symbol of rule number ACE_YYN in - ACE_YYRHS. */ -static const unsigned char ace_yyprhs[] = -{ - 0, 0, 3, 6, 9, 10, 12, 14, 16, 18, - 20, 22, 26, 30, 33, 36, 39, 43, 44, 49, - 51, 53, 54, 59, 60, 63, 64, 66, 68, 70, - 72, 74, 79, 81, 83, 84, 88, 94, 99, 102, - 105, 108, 110, 111, 113, 115 -}; - -/* ACE_YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const ace_yysigned_char ace_yyrhs[] = -{ - 24, 0, -1, 24, 25, -1, 24, 1, -1, -1, - 26, -1, 27, -1, 28, -1, 29, -1, 30, -1, - 31, -1, 3, 38, 42, -1, 4, 15, 42, -1, - 5, 15, -1, 6, 15, -1, 7, 15, -1, 8, - 33, 34, -1, -1, 8, 15, 32, 34, -1, 26, - -1, 27, -1, -1, 17, 35, 36, 18, -1, -1, - 36, 37, -1, -1, 26, -1, 27, -1, 28, -1, - 29, -1, 30, -1, 15, 41, 40, 39, -1, 12, - -1, 13, -1, -1, 43, 19, 15, -1, 43, 19, - 15, 20, 21, -1, 19, 15, 20, 21, -1, 9, - 22, -1, 11, 22, -1, 10, 22, -1, 16, -1, - -1, 14, -1, 15, -1, 16, -1 -}; - -/* ACE_YYRLINE[ACE_YYN] -- source line where rule number ACE_YYN was defined. */ -static const unsigned short int ace_yyrline[] = -{ - 0, 62, 62, 71, 75, 79, 80, 81, 82, 83, - 84, 88, 98, 105, 112, 119, 126, 130, 130, 137, - 140, 147, 146, 155, 159, 167, 171, 196, 210, 219, - 228, 250, 257, 261, 266, 272, 276, 280, 287, 291, - 295, 302, 303, 307, 308, 309 -}; -#endif - -#if ACE_YYDEBUG || ACE_YYERROR_VERBOSE -/* ACE_YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at ACE_YYNTOKENS, nonterminals. */ -static const char *const ace_yytname[] = -{ - "$end", "error", "$undefined", "ACE_DYNAMIC", "ACE_STATIC", - "ACE_SUSPEND", "ACE_RESUME", "ACE_REMOVE", "ACE_USTREAM", "ACE_MODULE_T", - "ACE_STREAM_T", "ACE_SVC_OBJ_T", "ACE_ACTIVE", "ACE_INACTIVE", - "ACE_PATHNAME", "ACE_IDENT", "ACE_STRING", "'{'", "'}'", "':'", "'('", - "')'", "'*'", "$accept", "svc_config_entries", "svc_config_entry", - "dynamic", "static", "suspend", "resume", "remove", "stream", "@1", - "stream_ops", "stream_modules", "@2", "module_list", "module", - "svc_location", "status", "svc_initializer", "type", "parameters_opt", - "pathname", 0 -}; -#endif - -# ifdef ACE_YYPRINT -/* ACE_YYTOKNUM[ACE_YYLEX-NUM] -- Internal token number corresponding to - token ACE_YYLEX-NUM. */ -static const unsigned short int ace_yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 123, 125, 58, - 40, 41, 42 -}; -# endif - -/* ACE_YYR1[ACE_YYN] -- Symbol number of symbol that rule ACE_YYN derives. */ -static const unsigned char ace_yyr1[] = -{ - 0, 23, 24, 24, 24, 25, 25, 25, 25, 25, - 25, 26, 27, 28, 29, 30, 31, 32, 31, 33, - 33, 35, 34, 34, 36, 36, 37, 37, 37, 37, - 37, 38, 39, 39, 39, 40, 40, 40, 41, 41, - 41, 42, 42, 43, 43, 43 -}; - -/* ACE_YYR2[ACE_YYN] -- Number of symbols composing right hand side of rule ACE_YYN. */ -static const unsigned char ace_yyr2[] = -{ - 0, 2, 2, 2, 0, 1, 1, 1, 1, 1, - 1, 3, 3, 2, 2, 2, 3, 0, 4, 1, - 1, 0, 4, 0, 2, 0, 1, 1, 1, 1, - 1, 4, 1, 1, 0, 3, 5, 4, 2, 2, - 2, 1, 0, 1, 1, 1 -}; - -/* ACE_YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when ACE_YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const unsigned char ace_yydefact[] = -{ - 4, 0, 1, 3, 0, 0, 0, 0, 0, 0, - 2, 5, 6, 7, 8, 9, 10, 0, 42, 42, - 13, 14, 15, 17, 19, 20, 23, 0, 0, 0, - 0, 41, 11, 12, 23, 21, 16, 38, 40, 39, - 43, 44, 45, 0, 34, 0, 18, 25, 0, 32, - 33, 31, 0, 0, 0, 35, 22, 26, 27, 28, - 29, 30, 24, 37, 0, 36 -}; - -/* ACE_YYDEFGOTO[NTERM-NUM]. */ -static const ace_yysigned_char ace_yydefgoto[] = -{ - -1, 1, 10, 11, 12, 13, 14, 15, 16, 34, - 26, 36, 47, 53, 62, 18, 51, 44, 30, 32, - 45 -}; - -/* ACE_YYPACT[STATE-NUM] -- Index in ACE_YYTABLE of the portion describing - STATE-NUM. */ -#define ACE_YYPACT_NINF -13 -static const ace_yysigned_char ace_yypact[] = -{ - -13, 20, -13, -13, 1, 3, 7, 14, 18, 4, - -13, -13, -13, -13, -13, -13, -13, 21, 19, 19, - -13, -13, -13, -13, -13, -13, -2, 12, 15, 16, - -5, -13, -13, -13, -2, -13, -13, -13, -13, -13, - -13, -13, -13, 24, 0, 17, -13, -13, 22, -13, - -13, -13, 25, -1, 26, 23, -13, -13, -13, -13, - -13, -13, -13, -13, 27, -13 -}; - -/* ACE_YYPGOTO[NTERM-NUM]. */ -static const ace_yysigned_char ace_yypgoto[] = -{ - -13, -13, -13, -9, -8, -12, -7, -4, -13, -13, - -13, 28, -13, -13, -13, -13, -13, -13, -13, 31, - -13 -}; - -/* ACE_YYTABLE[ACE_YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what ACE_YYDEFACT says. - If ACE_YYTABLE_NINF, syntax error. */ -#define ACE_YYTABLE_NINF -1 -static const unsigned char ace_yytable[] = -{ - 24, 25, 4, 5, 6, 7, 8, 4, 5, 40, - 41, 42, 49, 50, 43, 35, 17, 56, 19, 23, - 2, 3, 20, 4, 5, 6, 7, 8, 9, 21, - 27, 28, 29, 22, 37, 31, 52, 38, 39, 48, - 55, 59, 54, 64, 57, 58, 60, 63, 65, 61, - 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 46 -}; - -static const ace_yysigned_char ace_yycheck[] = -{ - 9, 9, 3, 4, 5, 6, 7, 3, 4, 14, - 15, 16, 12, 13, 19, 17, 15, 18, 15, 15, - 0, 1, 15, 3, 4, 5, 6, 7, 8, 15, - 9, 10, 11, 15, 22, 16, 19, 22, 22, 15, - 15, 53, 20, 20, 53, 53, 53, 21, 21, 53, - 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 34 -}; - -/* ACE_YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const unsigned char ace_yystos[] = -{ - 0, 24, 0, 1, 3, 4, 5, 6, 7, 8, - 25, 26, 27, 28, 29, 30, 31, 15, 38, 15, - 15, 15, 15, 15, 26, 27, 33, 9, 10, 11, - 41, 16, 42, 42, 32, 17, 34, 22, 22, 22, - 14, 15, 16, 19, 40, 43, 34, 35, 15, 12, - 13, 39, 19, 36, 20, 15, 18, 26, 27, 28, - 29, 30, 37, 21, 20, 21 -}; - -#if ! defined (ACE_YYSIZE_T) && defined (__SIZE_TYPE__) -# define ACE_YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (ACE_YYSIZE_T) && defined (size_t) -# define ACE_YYSIZE_T size_t -#endif -#if ! defined (ACE_YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define ACE_YYSIZE_T size_t -# endif -#endif -#if ! defined (ACE_YYSIZE_T) -# define ACE_YYSIZE_T unsigned int -#endif - -#define ace_yyerrok (ace_yyerrstatus = 0) -#define ace_yyclearin (ace_yychar = ACE_YYEMPTY) -#define ACE_YYEMPTY (-2) -#define ACE_YYEOF 0 - -#define ACE_YYACCEPT goto ace_yyacceptlab -#define ACE_YYABORT goto ace_yyabortlab -#define ACE_YYERROR goto ace_yyerrorlab - - -/* Like ACE_YYERROR except do call ace_yyerror. This remains here temporarily - to ease the transition to the new meaning of ACE_YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define ACE_YYFAIL goto ace_yyerrlab - -#define ACE_YYRECOVERING() (!!ace_yyerrstatus) - -#define ACE_YYBACKUP(Token, Value) \ -do \ - if (ace_yychar == ACE_YYEMPTY && ace_yylen == 1) \ - { \ - ace_yychar = (Token); \ - ace_yylval = (Value); \ - ace_yytoken = ACE_YYTRANSLATE (ace_yychar); \ - ACE_YYPOPSTACK; \ - goto ace_yybackup; \ - } \ - else \ - { \ - ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "syntax error: cannot back up");\ - ACE_YYERROR; \ - } \ -while (0) - - -#define ACE_YYTERROR 1 -#define ACE_YYERRCODE 256 - - -/* ACE_YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define ACE_YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef ACE_YYLLOC_DEFAULT -# define ACE_YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (N) \ - { \ - (Current).first_line = ACE_YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = ACE_YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = ACE_YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = ACE_YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - ACE_YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - ACE_YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (0) -#endif - - -/* ACE_YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef ACE_YY_LOCATION_PRINT -# if ACE_YYLTYPE_IS_TRIVIAL -# define ACE_YY_LOCATION_PRINT(File, Loc) \ - ACE_OS::fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define ACE_YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* ACE_YYLEX -- calling `ace_yylex' with the right arguments. */ - -#ifdef ACE_YYLEX_PARAM -# define ACE_YYLEX ace_yylex (&ace_yylval, ACE_YYLEX_PARAM) -#else -# define ACE_YYLEX ace_yylex (&ace_yylval) -#endif - -/* Enable debugging if requested. */ -#if ACE_YYDEBUG - -# ifndef ACE_YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define ACE_YYFPRINTF ACE_OS::fprintf -# endif - -# define ACE_YYDPRINTF(Args) \ -do { \ - if (ace_yydebug) \ - ACE_YYFPRINTF Args; \ -} while (0) - -# define ACE_YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (ace_yydebug) \ - { \ - ACE_YYFPRINTF (stderr, "%s ", Title); \ - ace_yysymprint (stderr, \ - Type, Value); \ - ACE_YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - -/*------------------------------------------------------------------. -| ace_yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -ace_yy_stack_print (short int *bottom, short int *top) -#else -static void -ace_yy_stack_print (bottom, top) - short int *bottom; - short int *top; -#endif -{ - ACE_YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) - ACE_YYFPRINTF (stderr, " %d", *bottom); - ACE_YYFPRINTF (stderr, "\n"); -} - -# define ACE_YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (ace_yydebug) \ - ace_yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the ACE_YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -ace_yy_reduce_print (int ace_yyrule) -#else -static void -ace_yy_reduce_print (ace_yyrule) - int ace_yyrule; -#endif -{ - int ace_yyi; - unsigned int ace_yylno = ace_yyrline[ace_yyrule]; - ACE_YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", - ace_yyrule - 1, ace_yylno); - /* Print the symbols being reduced, and their result. */ - for (ace_yyi = ace_yyprhs[ace_yyrule]; 0 <= ace_yyrhs[ace_yyi]; ace_yyi++) - ACE_YYFPRINTF (stderr, "%s ", ace_yytname [ace_yyrhs[ace_yyi]]); - ACE_YYFPRINTF (stderr, "-> %s\n", ace_yytname [ace_yyr1[ace_yyrule]]); -} - -# define ACE_YY_REDUCE_PRINT(Rule) \ -do { \ - if (ace_yydebug) \ - ace_yy_reduce_print (Rule); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int ace_yydebug; -#else /* !ACE_YYDEBUG */ -# define ACE_YYDPRINTF(Args) -# define ACE_YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define ACE_YY_STACK_PRINT(Bottom, Top) -# define ACE_YY_REDUCE_PRINT(Rule) -#endif /* !ACE_YYDEBUG */ - - -/* ACE_YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef ACE_YYINITDEPTH -# define ACE_YYINITDEPTH 200 -#endif - -/* ACE_YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - SIZE_MAX < ACE_YYSTACK_BYTES (ACE_YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef ACE_YYMAXDEPTH -# define ACE_YYMAXDEPTH 10000 -#endif - - - -#if ACE_YYERROR_VERBOSE - -# ifndef ace_yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) -# define ace_yystrlen strlen -# else -/* Return the length of ACE_YYSTR. */ -static ACE_YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) -ace_yystrlen (const char *ace_yystr) -# else -ace_yystrlen (ace_yystr) - const char *ace_yystr; -# endif -{ - register const char *ace_yys = ace_yystr; - - while (*ace_yys++ != '\0') - continue; - - return ace_yys - ace_yystr - 1; -} -# endif -# endif - -# ifndef ace_yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) -# define ace_yystpcpy stpcpy -# else -/* Copy ACE_YYSRC to ACE_YYDEST, returning the address of the terminating '\0' in - ACE_YYDEST. */ -static char * -# if defined (__STDC__) || defined (__cplusplus) -ace_yystpcpy (ACE_TCHAR *ace_yydest, const char *ace_yysrc) -# else -ace_yystpcpy (ace_yydest, ace_yysrc) - char *ace_yydest; - const char *ace_yysrc; -# endif -{ - register char *ace_yyd = ace_yydest; - register const char *ace_yys = ace_yysrc; - - while ((*ace_yyd++ = *ace_yys++) != '\0') - continue; - - return ace_yyd - 1; -} -# endif -# endif - -#endif /* !ACE_YYERROR_VERBOSE */ - - - -#if ACE_YYDEBUG -/*--------------------------------. -| Print this symbol on ACE_YYOUTPUT. | -`--------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -ace_yysymprint (FILE *ace_yyoutput, int ace_yytype, ACE_YYSTYPE *ace_yyvaluep) -#else -static void -ace_yysymprint (ace_yyoutput, ace_yytype, ace_yyvaluep) - FILE *ace_yyoutput; - int ace_yytype; - ACE_YYSTYPE *ace_yyvaluep; -#endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) ace_yyvaluep; - - if (ace_yytype < ACE_YYNTOKENS) - ACE_YYFPRINTF (ace_yyoutput, "token %s (", ace_yytname[ace_yytype]); - else - ACE_YYFPRINTF (ace_yyoutput, "nterm %s (", ace_yytname[ace_yytype]); - - -# ifdef ACE_YYPRINT - if (ace_yytype < ACE_YYNTOKENS) - ACE_YYPRINT (ace_yyoutput, ace_yytoknum[ace_yytype], *ace_yyvaluep); -# endif - switch (ace_yytype) - { - default: - break; - } - ACE_YYFPRINTF (ace_yyoutput, ")"); -} - -#endif /* ! ACE_YYDEBUG */ -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -ace_yydestruct (const char *ace_yymsg, int ace_yytype, ACE_YYSTYPE *ace_yyvaluep) -#else -static void -ace_yydestruct (ace_yymsg, ace_yytype, ace_yyvaluep) - const char *ace_yymsg; - int ace_yytype; - ACE_YYSTYPE *ace_yyvaluep; -#endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) ace_yyvaluep; - (void) ace_yytype; - - if (!ace_yymsg) - ace_yymsg = "Deleting"; - ACE_YY_SYMBOL_PRINT (ace_yymsg, ace_yytype, ace_yyvaluep, ace_yylocationp); -} - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef ACE_YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int ace_yyparse (void *ACE_YYPARSE_PARAM); -# else -int ace_yyparse (); -# endif -#else /* ! ACE_YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int ace_yyparse (void); -#else -int ace_yyparse (); -#endif -#endif /* ! ACE_YYPARSE_PARAM */ - - -/*----------. -| ace_yyparse. | -`----------*/ - -#ifdef ACE_YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int ace_yyparse (void *ACE_YYPARSE_PARAM) -# else -int ace_yyparse (ACE_YYPARSE_PARAM) - void *ACE_YYPARSE_PARAM; -# endif -#else /* ! ACE_YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int -ace_yyparse (void) -#else -int -ace_yyparse () - -#endif -#endif -{ - /* The look-ahead symbol. */ -int ace_yychar; - -/* The semantic value of the look-ahead symbol. */ -ACE_YYSTYPE ace_yylval; - -#if defined (ACE_YYSTYPE_IS_TRIVIAL) - ace_yylval = 0; -#else - ace_yylval.type_ = 0; -#endif /* ACE_YYSTYPE_IS_TRIVIAL */ - -/* Number of syntax errors so far. */ -int ace_yynerrs; - - register int ace_yystate; - register int ace_yyn; - int ace_yyresult; - /* Number of tokens to shift before error messages enabled. */ - int ace_yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int ace_yytoken = 0; - - /* Three stacks and their tools: - `ace_yyss': related to states, - `ace_yyvs': related to semantic values, - `ace_yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow ace_yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - short int ace_yyssa[ACE_YYINITDEPTH]; - short int *ace_yyss = ace_yyssa; - register short int *ace_yyssp; - - /* The semantic value stack. */ - ACE_YYSTYPE ace_yyvsa[ACE_YYINITDEPTH]; - ACE_YYSTYPE *ace_yyvs = ace_yyvsa; - register ACE_YYSTYPE *ace_yyvsp; - - - -#define ACE_YYPOPSTACK (ace_yyvsp--, ace_yyssp--) - - ACE_YYSIZE_T ace_yystacksize = ACE_YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - ACE_YYSTYPE ace_yyval; - - - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int ace_yylen; - - ACE_YYDPRINTF ((stderr, "Starting parse\n")); - - ace_yystate = 0; - ace_yyerrstatus = 0; - ace_yynerrs = 0; - ace_yychar = ACE_YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - ace_yyssp = ace_yyss; - ace_yyvsp = ace_yyvs; - - - ace_yyvsp[0] = ace_yylval; - - goto ace_yysetstate; - -/*------------------------------------------------------------. -| ace_yynewstate -- Push a new state, which is found in ace_yystate. | -`------------------------------------------------------------*/ - ace_yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ - ace_yyssp++; - - ace_yysetstate: - *ace_yyssp = ace_yystate; - - if (ace_yyss + ace_yystacksize - 1 <= ace_yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - ACE_YYSIZE_T ace_yysize = ace_yyssp - ace_yyss + 1; - -#ifdef ace_yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - ACE_YYSTYPE *ace_yyvs1 = ace_yyvs; - short int *ace_yyss1 = ace_yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if ace_yyoverflow is a macro. */ - ace_yyoverflow ("parser stack overflow", - &ace_yyss1, ace_yysize * sizeof (*ace_yyssp), - &ace_yyvs1, ace_yysize * sizeof (*ace_yyvsp), - - &ace_yystacksize); - - ace_yyss = ace_yyss1; - ace_yyvs = ace_yyvs1; - } -#else /* no ace_yyoverflow */ -# ifndef ACE_YYSTACK_RELOCATE - goto ace_yyoverflowlab; -# else - /* Extend the stack our own way. */ - if (ACE_YYMAXDEPTH <= ace_yystacksize) - goto ace_yyoverflowlab; - ace_yystacksize *= 2; - if (ACE_YYMAXDEPTH < ace_yystacksize) - ace_yystacksize = ACE_YYMAXDEPTH; - - { - short int *ace_yyss1 = ace_yyss; - union ace_yyalloc *ace_yyptr = - (union ace_yyalloc *) ACE_YYSTACK_ALLOC (ACE_YYSTACK_BYTES (ace_yystacksize)); - if (! ace_yyptr) - goto ace_yyoverflowlab; - ACE_YYSTACK_RELOCATE (ace_yyss); - ACE_YYSTACK_RELOCATE (ace_yyvs); - -# undef ACE_YYSTACK_RELOCATE - if (ace_yyss1 != ace_yyssa) - ACE_YYSTACK_FREE (ace_yyss1); - } -# endif -#endif /* no ace_yyoverflow */ - - ace_yyssp = ace_yyss + ace_yysize - 1; - ace_yyvsp = ace_yyvs + ace_yysize - 1; - - - ACE_YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) ace_yystacksize)); - - if (ace_yyss + ace_yystacksize - 1 <= ace_yyssp) - ACE_YYABORT; - } - - ACE_YYDPRINTF ((stderr, "Entering state %d\n", ace_yystate)); - - goto ace_yybackup; - -/*-----------. -| ace_yybackup. | -`-----------*/ -ace_yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ -/* ace_yyresume: */ - - /* First try to decide what to do without reference to look-ahead token. */ - - ace_yyn = ace_yypact[ace_yystate]; - if (ace_yyn == ACE_YYPACT_NINF) - goto ace_yydefault; - - /* Not known => get a look-ahead token if don't already have one. */ - - /* ACE_YYCHAR is either ACE_YYEMPTY or ACE_YYEOF or a valid look-ahead symbol. */ - if (ace_yychar == ACE_YYEMPTY) - { - ACE_YYDPRINTF ((stderr, "Reading a token: ")); - ace_yychar = ACE_YYLEX; - } - - if (ace_yychar <= ACE_YYEOF) - { - ace_yychar = ace_yytoken = ACE_YYEOF; - ACE_YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - ace_yytoken = ACE_YYTRANSLATE (ace_yychar); - ACE_YY_SYMBOL_PRINT ("Next token is", ace_yytoken, &ace_yylval, &ace_yylloc); - } - - /* If the proper action on seeing token ACE_YYTOKEN is to reduce or to - detect an error, take that action. */ - ace_yyn += ace_yytoken; - if (ace_yyn < 0 || ACE_YYLAST < ace_yyn || ace_yycheck[ace_yyn] != ace_yytoken) - goto ace_yydefault; - ace_yyn = ace_yytable[ace_yyn]; - if (ace_yyn <= 0) - { - if (ace_yyn == 0 || ace_yyn == ACE_YYTABLE_NINF) - goto ace_yyerrlab; - ace_yyn = -ace_yyn; - goto ace_yyreduce; - } - - if (ace_yyn == ACE_YYFINAL) - ACE_YYACCEPT; - - /* Shift the look-ahead token. */ - ACE_YY_SYMBOL_PRINT ("Shifting", ace_yytoken, &ace_yylval, &ace_yylloc); - - /* Discard the token being shifted unless it is eof. */ - if (ace_yychar != ACE_YYEOF) - ace_yychar = ACE_YYEMPTY; - - *++ace_yyvsp = ace_yylval; - - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (ace_yyerrstatus) - ace_yyerrstatus--; - - ace_yystate = ace_yyn; - goto ace_yynewstate; - - -/*-----------------------------------------------------------. -| ace_yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -ace_yydefault: - ace_yyn = ace_yydefact[ace_yystate]; - if (ace_yyn == 0) - goto ace_yyerrlab; - goto ace_yyreduce; - - -/*-----------------------------. -| ace_yyreduce -- Do a reduction. | -`-----------------------------*/ -ace_yyreduce: - /* ace_yyn is the number of a rule to reduce with. */ - ace_yylen = ace_yyr2[ace_yyn]; - - /* If ACE_YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets ACE_YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to ACE_YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that ACE_YYVAL may be used uninitialized. */ - ace_yyval = ace_yyvsp[1-ace_yylen]; - - - ACE_YY_REDUCE_PRINT (ace_yyn); - switch (ace_yyn) - { - case 2: - - { - if ((ace_yyvsp[0].parse_node_) != 0) - { - (ace_yyvsp[0].parse_node_)->apply (ACE_SVC_CONF_PARAM->config, ACE_SVC_CONF_PARAM->yyerrno); - delete (ace_yyvsp[0].parse_node_); - } - ACE_SVC_CONF_PARAM->obstack.release (); - ;} - break; - - case 3: - - { - ACE_SVC_CONF_PARAM->obstack.release (); - ;} - break; - - case 11: - - { - if ((ace_yyvsp[-1].svc_record_) != 0) - (ace_yyval.parse_node_) = new ACE_Dynamic_Node ((ace_yyvsp[-1].svc_record_), (ace_yyvsp[0].ident_)); - else - (ace_yyval.parse_node_) = 0; - ;} - break; - - case 12: - - { - (ace_yyval.parse_node_) = new ACE_Static_Node ((ace_yyvsp[-1].ident_), (ace_yyvsp[0].ident_)); - ;} - break; - - case 13: - - { - (ace_yyval.parse_node_) = new ACE_Suspend_Node ((ace_yyvsp[0].ident_)); - ;} - break; - - case 14: - - { - (ace_yyval.parse_node_) = new ACE_Resume_Node ((ace_yyvsp[0].ident_)); - ;} - break; - - case 15: - - { - (ace_yyval.parse_node_) = new ACE_Remove_Node ((ace_yyvsp[0].ident_)); - ;} - break; - - case 16: - - { - (ace_yyval.parse_node_) = new ACE_Stream_Node ((ace_yyvsp[-1].static_node_), (ace_yyvsp[0].parse_node_)); - ;} - break; - - case 17: - - { (ace_yyval.static_node_) = new ACE_Static_Node ((ace_yyvsp[0].ident_)); ;} - break; - - case 18: - - { - (ace_yyval.parse_node_) = new ACE_Dummy_Node ((ace_yyvsp[-1].static_node_), (ace_yyvsp[0].parse_node_)); - ;} - break; - - case 19: - - { - ;} - break; - - case 20: - - { - ;} - break; - - case 21: - - { - // Initialize left context... - (ace_yyval.static_node_) = (ace_yyvsp[-1].static_node_); - ;} - break; - - case 22: - - { - (ace_yyval.parse_node_) = (ace_yyvsp[-1].parse_node_); - ;} - break; - - case 23: - - { (ace_yyval.parse_node_) = 0; ;} - break; - - case 24: - - { - if ((ace_yyvsp[0].parse_node_) != 0) - { - (ace_yyvsp[0].parse_node_)->link ((ace_yyvsp[-1].parse_node_)); - (ace_yyval.parse_node_) = (ace_yyvsp[0].parse_node_); - } - ;} - break; - - case 25: - - { (ace_yyval.parse_node_) = 0; ;} - break; - - case 26: - - { - ACE_Static_Node *svc_type = (ace_yyvsp[0].static_node_); - - if (svc_type != 0) - { - ACE_Static_Node *module = (ace_yyvsp[-2].static_node_); - - ACE_ARGV args (svc_type->parameters ()); - ACE_Module_Type *mt = ace_get_module (module->record (ACE_SVC_CONF_PARAM->config), - svc_type->record (ACE_SVC_CONF_PARAM->config), - ACE_SVC_CONF_PARAM->yyerrno); - ACE_Stream_Type *st = - dynamic_cast (const_cast (module->record (ACE_SVC_CONF_PARAM->config)->type ())); - - if (mt->init (args.argc (), args.argv ()) == -1 - || st->push (mt) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("dynamic initialization failed for Module %s\n"), - svc_type->name ())); - ACE_SVC_CONF_PARAM->yyerrno++; - } - } - ;} - break; - - case 27: - - { - ACE_Static_Node *sn = (ace_yyvsp[-2].static_node_); - ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), - (ace_yyvsp[0].static_node_)->name (), - ACE_SVC_CONF_PARAM->yyerrno); - - if (((ACE_Stream_Type *) sn->record (ACE_SVC_CONF_PARAM->config)->type ())->push (mt) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Problem with static\n"))); - ACE_SVC_CONF_PARAM->yyerrno++; - } - ;} - break; - - case 28: - - { - ACE_Static_Node *sn = (ace_yyvsp[-2].static_node_); - ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), - sn->name (), - ACE_SVC_CONF_PARAM->yyerrno); - if (mt != 0) - mt->suspend (); - ;} - break; - - case 29: - - { - ACE_Static_Node *sn = (ace_yyvsp[-2].static_node_); - ACE_Module_Type *mt = ace_get_module (sn->record (ACE_SVC_CONF_PARAM->config), - (ace_yyvsp[0].static_node_)->name (), - ACE_SVC_CONF_PARAM->yyerrno); - if (mt != 0) - mt->resume (); - ;} - break; - - case 30: - - { - ACE_Static_Node *stream = (ace_yyvsp[-2].static_node_); - ACE_Static_Node *module = (ace_yyvsp[0].static_node_); - ACE_Module_Type *mt = ace_get_module (stream->record (ACE_SVC_CONF_PARAM->config), - module->name (), - ACE_SVC_CONF_PARAM->yyerrno); - - ACE_Stream_Type *st = - dynamic_cast (const_cast (stream->record (ACE_SVC_CONF_PARAM->config)->type ())); - if (mt != 0 && st->remove (mt) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("cannot remove Module_Type %s from STREAM_Type %s\n"), - module->name (), - stream->name ())); - ACE_SVC_CONF_PARAM->yyerrno++; - } - ;} - break; - - case 31: - - { - (ace_yyval.svc_record_) = new ACE_Service_Type_Factory ((ace_yyvsp[-3].ident_), (ace_yyvsp[-2].type_), (ace_yyvsp[-1].location_node_), (ace_yyvsp[0].type_)); - ;} - break; - - case 32: - - { - (ace_yyval.type_) = 1; - ;} - break; - - case 33: - - { - (ace_yyval.type_) = 0; - ;} - break; - - case 34: - - { - (ace_yyval.type_) = 1; - ;} - break; - - case 35: - - { - (ace_yyval.location_node_) = new ACE_Object_Node ((ace_yyvsp[-2].ident_), (ace_yyvsp[0].ident_)); - ;} - break; - - case 36: - - { - (ace_yyval.location_node_) = new ACE_Function_Node ((ace_yyvsp[-4].ident_), (ace_yyvsp[-2].ident_)); - ;} - break; - - case 37: - - { - (ace_yyval.location_node_) = new ACE_Static_Function_Node ((ace_yyvsp[-2].ident_)); - ;} - break; - - case 38: - - { - (ace_yyval.type_) = ACE_MODULE_T; - ;} - break; - - case 39: - - { - (ace_yyval.type_) = ACE_SVC_OBJ_T; - ;} - break; - - case 40: - - { - (ace_yyval.type_) = ACE_STREAM_T; - ;} - break; - - case 42: - - { (ace_yyval.ident_) = 0; ;} - break; - - - } - -/* Line 1037 of yacc.c. */ - - - ace_yyvsp -= ace_yylen; - ace_yyssp -= ace_yylen; - - - ACE_YY_STACK_PRINT (ace_yyss, ace_yyssp); - - *++ace_yyvsp = ace_yyval; - - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - ace_yyn = ace_yyr1[ace_yyn]; - - ace_yystate = ace_yypgoto[ace_yyn - ACE_YYNTOKENS] + *ace_yyssp; - if (0 <= ace_yystate && ace_yystate <= ACE_YYLAST && ace_yycheck[ace_yystate] == *ace_yyssp) - ace_yystate = ace_yytable[ace_yystate]; - else - ace_yystate = ace_yydefgoto[ace_yyn - ACE_YYNTOKENS]; - - goto ace_yynewstate; - - -/*------------------------------------. -| ace_yyerrlab -- here on detecting error | -`------------------------------------*/ -ace_yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!ace_yyerrstatus) - { - ++ace_yynerrs; -#if ACE_YYERROR_VERBOSE - ace_yyn = ace_yypact[ace_yystate]; - - if (ACE_YYPACT_NINF < ace_yyn && ace_yyn < ACE_YYLAST) - { - ACE_YYSIZE_T ace_yysize = 0; - int ace_yytype = ACE_YYTRANSLATE (ace_yychar); - const char* ace_yyprefix; - char *ace_yymsg; - int ace_yyx; - - /* Start ACE_YYX at -ACE_YYN if negative to avoid negative indexes in - ACE_YYCHECK. */ - int ace_yyxbegin = ace_yyn < 0 ? -ace_yyn : 0; - - /* Stay within bounds of both ace_yycheck and ace_yytname. */ - int ace_yychecklim = ACE_YYLAST - ace_yyn; - int ace_yyxend = ace_yychecklim < ACE_YYNTOKENS ? ace_yychecklim : ACE_YYNTOKENS; - int ace_yycount = 0; - - ace_yyprefix = ", expecting "; - for (ace_yyx = ace_yyxbegin; ace_yyx < ace_yyxend; ++ace_yyx) - if (ace_yycheck[ace_yyx + ace_yyn] == ace_yyx && ace_yyx != ACE_YYTERROR) - { - ace_yysize += ace_yystrlen (ace_yyprefix) + ace_yystrlen (ace_yytname [ace_yyx]); - ace_yycount += 1; - if (ace_yycount == 5) - { - ace_yysize = 0; - break; - } - } - ace_yysize += (sizeof ("syntax error, unexpected ") - + ace_yystrlen (ace_yytname[ace_yytype])); - ace_yymsg = (ACE_TCHAR *) ACE_YYSTACK_ALLOC (ace_yysize); - if (ace_yymsg != 0) - { - char *ace_yyp = ace_yystpcpy (ace_yymsg, "syntax error, unexpected "); - ace_yyp = ace_yystpcpy (ace_yyp, ace_yytname[ace_yytype]); - - if (ace_yycount < 5) - { - ace_yyprefix = ", expecting "; - for (ace_yyx = ace_yyxbegin; ace_yyx < ace_yyxend; ++ace_yyx) - if (ace_yycheck[ace_yyx + ace_yyn] == ace_yyx && ace_yyx != ACE_YYTERROR) - { - ace_yyp = ace_yystpcpy (ace_yyp, ace_yyprefix); - ace_yyp = ace_yystpcpy (ace_yyp, ace_yytname[ace_yyx]); - ace_yyprefix = " or "; - } - } - ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, ace_yymsg); - ACE_YYSTACK_FREE (ace_yymsg); - } - else - ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "syntax error; also virtual memory exhausted"); - } - else -#endif /* ACE_YYERROR_VERBOSE */ - ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "syntax error"); - } - - - - if (ace_yyerrstatus == 3) - { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (ace_yychar <= ACE_YYEOF) - { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ - if (ace_yychar == ACE_YYEOF) - for (;;) - { - - ACE_YYPOPSTACK; - if (ace_yyssp == ace_yyss) - ACE_YYABORT; - ace_yydestruct ("Error: popping", - ace_yystos[*ace_yyssp], ace_yyvsp); - } - } - else - { - ace_yydestruct ("Error: discarding", ace_yytoken, &ace_yylval); - ace_yychar = ACE_YYEMPTY; - } - } - - /* Else will try to reuse look-ahead token after shifting the error - token. */ - goto ace_yyerrlab1; - - -/*---------------------------------------------------. -| ace_yyerrorlab -- error raised explicitly by ACE_YYERROR. | -`---------------------------------------------------*/ -ace_yyerrorlab: - -#if defined (__GNUC__) || defined (ACE_WIN32) - /* Pacify GCC when the user code never invokes ACE_YYERROR and the label - ace_yyerrorlab therefore never appears in user code. */ - if (0) - goto ace_yyerrorlab; -#endif - -ace_yyvsp -= ace_yylen; - ace_yyssp -= ace_yylen; - ace_yystate = *ace_yyssp; - goto ace_yyerrlab1; - - -/*-------------------------------------------------------------. -| ace_yyerrlab1 -- common code for both syntax error and ACE_YYERROR. | -`-------------------------------------------------------------*/ -ace_yyerrlab1: - ace_yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - ace_yyn = ace_yypact[ace_yystate]; - if (ace_yyn != ACE_YYPACT_NINF) - { - ace_yyn += ACE_YYTERROR; - if (0 <= ace_yyn && ace_yyn <= ACE_YYLAST && ace_yycheck[ace_yyn] == ACE_YYTERROR) - { - ace_yyn = ace_yytable[ace_yyn]; - if (0 < ace_yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (ace_yyssp == ace_yyss) - ACE_YYABORT; - - - ace_yydestruct ("Error: popping", ace_yystos[ace_yystate], ace_yyvsp); - ACE_YYPOPSTACK; - ace_yystate = *ace_yyssp; - ACE_YY_STACK_PRINT (ace_yyss, ace_yyssp); - } - - if (ace_yyn == ACE_YYFINAL) - ACE_YYACCEPT; - - *++ace_yyvsp = ace_yylval; - - - /* Shift the error token. */ - ACE_YY_SYMBOL_PRINT ("Shifting", ace_yystos[ace_yyn], ace_yyvsp, ace_yylsp); - - ace_yystate = ace_yyn; - goto ace_yynewstate; - - -/*-------------------------------------. -| ace_yyacceptlab -- ACE_YYACCEPT comes here. | -`-------------------------------------*/ -ace_yyacceptlab: - ace_yyresult = 0; - goto ace_yyreturn; - -/*-----------------------------------. -| ace_yyabortlab -- ACE_YYABORT comes here. | -`-----------------------------------*/ -ace_yyabortlab: - ace_yydestruct ("Error: discarding lookahead", - ace_yytoken, &ace_yylval); - ace_yychar = ACE_YYEMPTY; - ace_yyresult = 1; - goto ace_yyreturn; - -#ifndef ace_yyoverflow -/*----------------------------------------------. -| ace_yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -ace_yyoverflowlab: - ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, "parser stack overflow"); - ace_yyresult = 2; - /* Fall through. */ -#endif - -ace_yyreturn: -#ifndef ace_yyoverflow - if (ace_yyss != ace_yyssa) - ACE_YYSTACK_FREE (ace_yyss); -#endif - return ace_yyresult; -} - -// Prints the error string to standard output. Cleans up the error -// messages. - -void -ace_yyerror (int ace_yyerrno, int ace_yylineno, const char *s) -{ -#if defined (ACE_NLOGGING) - ACE_UNUSED_ARG (ace_yyerrno); - ACE_UNUSED_ARG (ace_yylineno); - ACE_UNUSED_ARG (s); -#endif /* ACE_NLOGGING */ - - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("[error %d] on line %d: %s\n"), - ace_yyerrno, - ace_yylineno, - s)); -} - -// Note that SRC_REC represents left context, which is the STREAM * -// record. - -static ACE_Module_Type * -ace_get_module (const ACE_Service_Type *sr, - const ACE_TCHAR *svc_name, - int & ace_yyerrno) -{ - const ACE_Service_Type_Impl *type = sr->type (); - ACE_Stream_Type *st = sr == 0 - ? 0 - : dynamic_cast (const_cast (type)); - ACE_Module_Type *mt = st == 0 ? 0 : st->find (svc_name); - - if (sr == 0 || st == 0 || mt == 0) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("cannot locate Module_Type %s in STREAM_Type %s\n"), - svc_name, - sr->name ())); - ace_yyerrno++; - } - - return mt; -} - -static ACE_Module_Type * -ace_get_module (const ACE_Service_Type *sr, - const ACE_Service_Type *sv, - int & ace_yyerrno) -{ - const ACE_Service_Type_Impl *type = sr->type (); - ACE_Stream_Type *st = sr == 0 ? 0 : (ACE_Stream_Type *) type; - - type = sv->type (); - ACE_Module_Type *mt = (ACE_Module_Type *) type; - const ACE_TCHAR *module_type_name = sr->name (); - - if (sr == 0 || st == 0 || mt == 0) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("cannot locate Module_Type %s or STREAM_Type %s\n"), - module_type_name, - sr->name ())); - ace_yyerrno++; - } - - // Make sure that the Module has the same name as the - // Module_Type object from the svc.conf file. - ACE_Module *mp = (ACE_Module *) mt->object (); - - if (ACE_OS::strcmp (mp->name (), module_type_name) != 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"), - module_type_name, - mp->name ())); - mp->name (module_type_name); - } - - return mt; -} - -#if defined (DEBUGGING) -// Main driver program. - -int -main (int argc, char *argv[]) -{ - ACE_Svc_Conf_Param param (stdin); - - // Try to reopen any filename argument to use ACE_YYIN. - if (argc > 1 && (ace_yyin = freopen (argv[1], "r", stdin)) == 0) - (void) ACE_OS::ACE_OS::fprintf (stderr, ACE_LIB_TEXT ("usage: %s [file]\n"), argv[0]), ACE_OS::exit (1); - - return ::ace_yyparse (¶m); -} -#endif /* DEBUGGING */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp deleted file mode 100644 index bb8ce2bd077..00000000000 --- a/ace/Svc_Handler.cpp +++ /dev/null @@ -1,527 +0,0 @@ -// $Id$ - -#ifndef ACE_SVC_HANDLER_CPP -#define ACE_SVC_HANDLER_CPP - -#include "ace/Svc_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_sys_time.h" -#include "ace/Object_Manager.h" -#include "ace/Connection_Recycling_Strategy.h" - -#include "ace/Dynamic.h" - -#define PR_ST_1 ACE_PEER_STREAM_1 -#define PR_ST_2 ACE_PEER_STREAM_2 - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template void * -ACE_Svc_Handler::operator new (size_t, - void *p) -{ - ACE_TRACE ("ACE_Svc_Handler::operator new (NOOP, 2 parameters)"); - return p; -} - -#if !defined (ACE_LACKS_PLACEMENT_OPERATOR_DELETE) -template void -ACE_Svc_Handler::operator delete (void *, - void *) -{ - ACE_TRACE ("ACE_Svc_Handler::operator delete (NOOP, 2 parameters)"); - return; -} -#endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */ - -template void * -ACE_Svc_Handler::operator new (size_t n) -{ - ACE_TRACE ("ACE_Svc_Handler::operator new"); - - ACE_Dynamic *const dynamic_instance = ACE_Dynamic::instance (); - - if (dynamic_instance == 0) - { - // If this ACE_ASSERT fails, it may be due to running of out TSS - // keys. Try using ACE_HAS_TSS_EMULATION, or increasing - // ACE_DEFAULT_THREAD_KEYS if already using TSS emulation. - ACE_ASSERT (dynamic_instance != 0); - - ACE_throw_bad_alloc; - } - else - { - // Allocate the memory and store it (usually in thread-specific - // storage, depending on config flags). - dynamic_instance->set (); - - return ::new char[n]; - } -} - -#if defined (ACE_HAS_NEW_NOTHROW) -template void * -ACE_Svc_Handler::operator new (size_t n, - const ACE_nothrow_t&) throw() -{ - ACE_TRACE ("ACE_Svc_Handler::operator new(nothrow)"); - - ACE_Dynamic *const dynamic_instance = ACE_Dynamic::instance (); - - if (dynamic_instance == 0) - { - // If this ACE_ASSERT fails, it may be due to running of out TSS - // keys. Try using ACE_HAS_TSS_EMULATION, or increasing - // ACE_DEFAULT_THREAD_KEYS if already using TSS emulation. - ACE_ASSERT (dynamic_instance != 0); - - return 0; - } - else - { - // Allocate the memory and store it (usually in thread-specific - // storage, depending on config flags). - dynamic_instance->set (); - - return ::new(ACE_nothrow) char[n]; - } -} - -#if !defined (ACE_LACKS_PLACEMENT_OPERATOR_DELETE) -template void -ACE_Svc_Handler::operator delete (void *p, - const ACE_nothrow_t&) throw() -{ - ACE_TRACE - ("ACE_Svc_Handler::operator delete(nothrow)"); - ::delete [] static_cast (p); -} -#endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */ - -#endif /* ACE_HAS_NEW_NOTHROW */ - -template void -ACE_Svc_Handler::destroy (void) -{ - ACE_TRACE ("ACE_Svc_Handler::destroy"); - - // Only delete ourselves if we're not owned by a module and have - // been allocated dynamically. - if (this->mod_ == 0 && this->dynamic_ && this->closing_ == 0) - // Will call the destructor, which automatically calls . - // Note that if we are *not* allocated dynamically then the - // destructor will call automatically when it gets run - // during cleanup. - delete this; -} - -template void -ACE_Svc_Handler::operator delete (void *obj) -{ - ACE_TRACE ("ACE_Svc_Handler::operator delete"); - // You cannot delete a 'void*' (X3J16/95-0087 5.3.5.3), but we know - // the pointer was created using new char[] (see operator new code), - // so we use a cast: - ::delete [] static_cast (obj); -} - -// Default constructor. - -template -ACE_Svc_Handler::ACE_Svc_Handler (ACE_Thread_Manager *tm, - ACE_Message_Queue *mq, - ACE_Reactor *reactor) - : ACE_Task (tm, mq), - closing_ (0), - recycler_ (0), - recycling_act_ (0) -{ - ACE_TRACE ("ACE_Svc_Handler::ACE_Svc_Handler"); - - this->reactor (reactor); - - // This clever idiom transparently checks if we were allocated - // dynamically. This information is used by the method to - // decide if we need to delete ... The idiom is based on a - // paper by Michael van Rooyen (mrooyen@cellnet.co.uk) that appeared - // in the April '96 issue of the C++ Report. We've spruced it up to - // work correctly in multi-threaded programs by using our ACE_TSS - // class. - this->dynamic_ = ACE_Dynamic::instance ()->is_dynamic (); - - if (this->dynamic_ != 0) - // Make sure to reset the flag. - ACE_Dynamic::instance ()->reset (); -} - -// Default behavior for a ACE_Svc_Handler object is to be registered -// with the ACE_Reactor (thereby ensuring single threading). - -template int -ACE_Svc_Handler::open (void *) -{ - ACE_TRACE ("ACE_Svc_Handler::open"); -#if defined (ACE_DEBUGGING) - ACE_TCHAR buf[BUFSIZ]; - ACE_PEER_STREAM_ADDR client_addr; - - if (this->peer_.get_remote_addr (client_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("get_remote_addr")), - -1); - else if (client_addr.addr_to_string (buf, sizeof buf) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("can't obtain peer's address")), - -1); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("connected to %s on fd %d\n"), - buf, - this->peer_.get_handle ())); -#endif /* ACE_DEBUGGING */ - if (this->reactor () - && this->reactor ()->register_handler - (this, - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("unable to register client handler")), - -1); - return 0; -} - -// Perform termination activities. - -template void -ACE_Svc_Handler::shutdown (void) -{ - ACE_TRACE ("ACE_Svc_Handler::shutdown"); - - // Deregister this handler with the ACE_Reactor. - if (this->reactor ()) - { - ACE_Reactor_Mask mask = ACE_Event_Handler::ALL_EVENTS_MASK | - ACE_Event_Handler::DONT_CALL; - - // Make sure there are no timers. - this->reactor ()->cancel_timer (this); - - if (this->peer ().get_handle () != ACE_INVALID_HANDLE) - // Remove self from reactor. - this->reactor ()->remove_handler (this, mask); - } - - // Remove self from the recycler. - if (this->recycler ()) - this->recycler ()->purge (this->recycling_act_); - - this->peer ().close (); -} - -template void -ACE_Svc_Handler::cleanup_hint (void **act_holder) -{ - ACE_TRACE ("ACE_Svc_Handler::cleanup_hint"); - - // Remove as hint. - if (this->recycler ()) - this->recycler ()->cleanup_hint (this->recycling_act_, - act_holder); -} - -template void -ACE_Svc_Handler::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Svc_Handler::dump"); - - this->peer_.dump (); - ACE_DEBUG ((LM_DEBUG, - "dynamic_ = %d\n", - this->dynamic_)); - ACE_DEBUG ((LM_DEBUG, - "closing_ = %d\n", - this->closing_)); - ACE_DEBUG ((LM_DEBUG, - "recycler_ = %d\n", - this->recycler_)); - ACE_DEBUG ((LM_DEBUG, - "recycling_act_ = %d\n", - this->recycling_act_)); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_PEER_STREAM & -ACE_Svc_Handler::peer (void) const -{ - ACE_TRACE ("ACE_Svc_Handler::peer"); - return (ACE_PEER_STREAM &) this->peer_; -} - -// Extract the underlying I/O descriptor. - -template ACE_HANDLE -ACE_Svc_Handler::get_handle (void) const -{ - ACE_TRACE ("ACE_Svc_Handler::get_handle"); - return this->peer_.get_handle (); -} - -// Set the underlying I/O descriptor. - -template void -ACE_Svc_Handler::set_handle (ACE_HANDLE h) -{ - ACE_TRACE ("ACE_Svc_Handler::set_handle"); - this->peer_.set_handle (h); -} - -template -ACE_Svc_Handler::~ACE_Svc_Handler (void) -{ - ACE_TRACE ("ACE_Svc_Handler::~ACE_Svc_Handler"); - - if (this->closing_ == 0) - { - // We're closing down now, so make sure not to call ourselves - // recursively via other calls to handle_close() (e.g., from the - // Timer_Queue). - this->closing_ = 1; - - this->shutdown (); - } -} - -template int -ACE_Svc_Handler::handle_close (ACE_HANDLE, - ACE_Reactor_Mask) -{ - ACE_TRACE ("ACE_Svc_Handler::handle_close"); - - this->destroy (); - return 0; -} - -template int -ACE_Svc_Handler::handle_timeout (const ACE_Time_Value &, - const void *) -{ - ACE_TRACE ("ACE_Svc_Handler::handle_timeout"); - return this->handle_close (); -} - -template int -ACE_Svc_Handler::close (u_long) -{ - ACE_TRACE ("ACE_Svc_Handler::close"); - return this->handle_close (); -} - -template int -ACE_Svc_Handler::init (int argc, ACE_TCHAR *argv[]) -{ - ACE_TRACE ("ACE_Svc_Handler::init"); - ACE_UNUSED_ARG (argc); - ACE_UNUSED_ARG (argv); - return -1; -} - -template int -ACE_Svc_Handler::fini (void) -{ - ACE_TRACE ("ACE_Svc_Handler::fini"); - return -1; -} - -template int -ACE_Svc_Handler::info (ACE_TCHAR **, size_t) const -{ - ACE_TRACE ("ACE_Svc_Handler::info"); - return -1; -} - -template int -ACE_Svc_Handler::idle (u_long flags) -{ - if (this->recycler ()) - return this->recycler ()->cache (this->recycling_act_); - else - return this->close (flags); -} - -template int -ACE_Svc_Handler::recycle_state (ACE_Recyclable_State new_state) -{ - if (this->recycler ()) - return this->recycler ()->recycle_state (this->recycling_act_, - new_state); - - return 0; -} - -template ACE_Recyclable_State -ACE_Svc_Handler::recycle_state (void) const -{ - if (this->recycler ()) - return this->recycler ()->recycle_state (this->recycling_act_); - - return ACE_RECYCLABLE_UNKNOWN; -} - -template void -ACE_Svc_Handler::recycler (ACE_Connection_Recycling_Strategy *recycler, - const void *recycling_act) -{ - ACE_TRACE ("ACE_Svc_Handler::recycler"); - this->recycler_ = recycler; - this->recycling_act_ = recycling_act; -} - -template ACE_Connection_Recycling_Strategy * -ACE_Svc_Handler::recycler (void) const -{ - ACE_TRACE ("ACE_Svc_Handler::recycler"); - return this->recycler_; -} - -template const void * -ACE_Svc_Handler::recycling_act (void) const -{ - ACE_TRACE ("ACE_Svc_Handler::recycling_act"); - return this->recycling_act_; -} - -template int -ACE_Svc_Handler::recycle (void *) -{ - ACE_TRACE ("ACE_Svc_Handler::recycle"); - // By default, the object is ready and willing to be recycled. - return 0; -} - -template -ACE_Buffered_Svc_Handler::~ACE_Buffered_Svc_Handler (void) -{ - this->flush (); -} - -template -ACE_Buffered_Svc_Handler::ACE_Buffered_Svc_Handler (ACE_Thread_Manager *tm, - ACE_Message_Queue *mq, - ACE_Reactor *reactor, - size_t maximum_buffer_size, - ACE_Time_Value *timeout) - : ACE_Svc_Handler (tm, mq, reactor), - maximum_buffer_size_ (maximum_buffer_size), - current_buffer_size_ (0), - timeoutp_ (timeout) -{ - ACE_TRACE ("ACE_Buffered_Svc_Handler::ACE_Buffered_Svc_Handler"); - - if (this->timeoutp_ != 0) - { - this->interval_ = *timeout; - this->next_timeout_ = ACE_OS::gettimeofday () + this->interval_; - } -} - -template int -ACE_Buffered_Svc_Handler::put (ACE_Message_Block *mb, - ACE_Time_Value *tv) -{ - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->msg_queue ()->lock (), -1); - - // Enqueue onto the message queue. - if (this->putq (mb, tv) == -1) - return -1; - else - { - // Update the current number of bytes on the queue. - this->current_buffer_size_ += mb->total_size (); - - // Flush the buffer when the number of bytes exceeds the maximum - // buffer size or when the timeout period has elapsed. - if (this->current_buffer_size_ >= this->maximum_buffer_size_ - || (this->timeoutp_ != 0 - && this->next_timeout_ <= ACE_OS::gettimeofday ())) - return this->flush_i (); - else - return 0; - } -} - -// Flush the buffer. - -template int -ACE_Buffered_Svc_Handler::flush (void) -{ - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->msg_queue ()->lock (), -1); - - return this->flush_i (); -} - -template int -ACE_Buffered_Svc_Handler::flush_i (void) -{ - ACE_Message_Queue_Iterator iterator (*this->msg_queue ()); - ACE_Message_Block *mblk = 0; - ssize_t result = 0; - - // Get the first so that we can write everything - // out via the . - if (iterator.next (mblk) != 0) - result = this->peer ().send_n (mblk); - - // This method assumes the caller holds the queue's lock! - if (result != -1) - this->msg_queue ()->flush_i (); - - if (this->timeoutp_ != 0) - // Update the next timeout period by adding the interval. - this->next_timeout_ += this->interval_; - - this->current_buffer_size_ = 0; - - return result; -} - -template void -ACE_Buffered_Svc_Handler::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Buffered_Svc_Handler::dump"); - - ACE_Buffered_Svc_Handler::dump (); - ACE_DEBUG ((LM_DEBUG, - "maximum_buffer_size_ = %d\n", - this->maximum_buffer_size_)); - ACE_DEBUG ((LM_DEBUG, - "current_buffer_size_ = %d\n", - this->current_buffer_size_)); - if (this->timeoutp_ != 0) - ACE_DEBUG ((LM_DEBUG, - "next_timeout_.sec = %d, next_timeout_.usec = %d\n", - this->next_timeout_.sec (), - this->next_timeout_.usec ())); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Buffered_Svc_Handler::handle_timeout (const ACE_Time_Value &, - const void *) -{ - ACE_TRACE ("ACE_Buffered_Svc_Handler::handle_timeout"); - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#undef PR_ST_1 -#undef PR_ST_2 -#endif /* ACE_SVC_HANDLER_CPP */ diff --git a/ace/Svc_Handler.h b/ace/Svc_Handler.h deleted file mode 100644 index 76027b9e409..00000000000 --- a/ace/Svc_Handler.h +++ /dev/null @@ -1,340 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Svc_Handler.h - * - * $Id$ - * - * @author Douglas Schmidt - * @author Irfan Pyarali - */ -//============================================================================= - -#ifndef ACE_SVC_HANDLER_H -#define ACE_SVC_HANDLER_H - -#include /**/ "ace/pre.h" - -#include "ace/Synch_Options.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Task.h" -#include "ace/Recyclable.h" -#include "ace/Reactor.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decls. -class ACE_Connection_Recycling_Strategy; - -/** - * @class ACE_Svc_Handler - * - * @brief Defines the interface for a service that exchanges data with - * its connected peer. - * - * This class provides a well-defined interface that the - * Acceptor and Connector pattern factories use as their target. - * Typically, client applications will subclass ACE_Svc_Handler - * and do all the interesting work in the subclass. One thing - * that the ACE_Svc_Handler does contain is a PEER_STREAM - * endpoint that is initialized by an ACE_Acceptor or - * ACE_Connector when a connection is established successfully. - * This endpoint is used to exchange data between a - * ACE_Svc_Handler and the peer it is connected with. - */ -template -class ACE_Svc_Handler : public ACE_Task -{ -public: - - // Useful STL-style traits. - typedef ACE_PEER_STREAM_ADDR addr_type; - typedef ACE_PEER_STREAM stream_type; - - /** - * Constructor initializes the @a thr_mgr and @a mq by passing them - * down to the ACE_Task base class. The @a reactor is passed to - * the ACE_Event_Handler. - */ - ACE_Svc_Handler (ACE_Thread_Manager *thr_mgr = 0, - ACE_Message_Queue *mq = 0, - ACE_Reactor *reactor = ACE_Reactor::instance ()); - - /// Destructor. - virtual ~ACE_Svc_Handler (void); - - /// Activate the client handler. This is typically called by the - /// ACE_Acceptor or ACE_Connector. - virtual int open (void * = 0); - - /** - * Object termination hook -- application-specific cleanup code goes - * here. This function is called by the idle() function if the object - * does not have a ACE_Connection_Recycling_Strategy associated with it. - * Also, due to this class's derivation from ACE_Task, close() is - * also called when a thread activated with this object exits. See - * ACE_Task::close() for further details. The default action of this - * function is to call handle_close() with the default arguments. - */ - virtual int close (u_long flags = 0); - - /** - * Call this method if you want to recycling the @c Svc_Handler - * instead of closing it. If the object does not have a recycler, - * it will be closed. - */ - virtual int idle (u_long flags = 0); - - /** - * Call this method if you want to get/set the state of the - * @c Svc_Handler. If the object does not have a recycler, this call - * will have no effect (and the accessor will return - * ACE_RECYCLABLE_UNKNOWN). - */ - virtual ACE_Recyclable_State recycle_state (void) const; - virtual int recycle_state (ACE_Recyclable_State new_state); - - /** - * When the svc_handle is no longer needed around as a hint, call - * this method. In addition, reset @c *act_holder to zero if - * @a act_holder != 0. - */ - virtual void cleanup_hint (void **act_holder = 0); - - // = Dynamic linking hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int init (int argc, ACE_TCHAR *argv[]); - - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int fini (void); - - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int info (ACE_TCHAR **info_string, size_t length) const; - - // = Demultiplexing hooks. - - /** - * Perform termination activities on the SVC_HANDLER. The default - * behavior is to close down the (to avoid descriptor leaks) - * and to this object (to avoid memory leaks)! If you - * don't want this behavior make sure you override this method... - */ - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Default behavior when timeouts occur is to close down the - /// by calling . - virtual int handle_timeout (const ACE_Time_Value &time, - const void *); - - /// Get the underlying handle associated with the . - virtual ACE_HANDLE get_handle (void) const; - - /// Set the underlying handle associated with the . - virtual void set_handle (ACE_HANDLE); - - /// Returns the underlying PEER_STREAM. Used by - /// and factories - ACE_PEER_STREAM &peer (void) const; - - /// Overloaded new operator. This method unobtrusively records if a - /// is allocated dynamically, which allows it to clean - /// itself up correctly whether or not it's allocated statically or - /// dynamically. - void *operator new (size_t n); - -#if defined (ACE_HAS_NEW_NOTHROW) - /// Overloaded new operator, nothrow_t variant. Unobtrusively records if a - /// is allocated dynamically, which allows it to clean - /// itself up correctly whether or not it's allocated statically or - /// dynamically. - void *operator new (size_t n, const ACE_nothrow_t&) throw(); -#if !defined (ACE_LACKS_PLACEMENT_OPERATOR_DELETE) - void operator delete (void *p, const ACE_nothrow_t&) throw (); -#endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */ -#endif - - /// This operator permits "placement new" on a per-object basis. - void * operator new (size_t n, - void *p); - - /** - * Call this to free up dynamically allocated - * (otherwise you will get memory leaks). In general, you should - * call this method rather than since this method knows - * whether or not the object was allocated dynamically, and can act - * accordingly (i.e., deleting it if it was allocated dynamically). - */ - virtual void destroy (void); - - /** - * This really should be private so that users are forced to call - * . Unfortunately, the C++ standard doesn't allow there - * to be a public new and a private delete. It is a bad idea to - * call this method directly, so use instead, unless you - * know for sure that you've allocated the object dynamically. - */ - void operator delete (void *); - -#if !defined (ACE_LACKS_PLACEMENT_OPERATOR_DELETE) - /** - * This operator is necessary to complement the class-specific - * operator new above. Unfortunately, it's not portable to all C++ - * compilers... - */ - void operator delete (void *, void *); -#endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */ - - /// Close down the descriptor and unregister from the Reactor - void shutdown (void); - - /// Dump the state of an object. - void dump (void) const; - -public: - - // = The following methods are not suppose to be public. - - // Because friendship is *not* inherited in C++, these methods have - // to be public. - - // = Accessors to set/get the connection recycler. - - /// Set the recycler and the that is used during - /// purging and caching. - virtual void recycler (ACE_Connection_Recycling_Strategy *recycler, - const void *recycling_act); - - /// Get the recycler. - virtual ACE_Connection_Recycling_Strategy *recycler (void) const; - - /// Get the recycling act. - virtual const void *recycling_act (void) const; - - /** - * Upcall made by the recycler when it is about to recycle the - * connection. This gives the object a chance to prepare itself for - * recycling. Return 0 if the object is ready for recycling, -1 on - * failures. - */ - virtual int recycle (void * = 0); - -protected: - /// Maintain connection with client. - ACE_PEER_STREAM peer_; - - /// Have we been dynamically created? - int dynamic_; - - /// Keeps track of whether we are in the process of closing (required - /// to avoid circular calls to ). - int closing_; - - /// Pointer to the connection recycler. - ACE_Connection_Recycling_Strategy *recycler_; - - /// Asynchronous Completion Token (ACT) to be used to when talking to - /// the recycler. - const void *recycling_act_; -}; - -/** - * @class ACE_Buffered_Svc_Handler - * - * @brief Defines the interface for a service that exchanges data with - * its connected peer and supports buffering. - * - * The buffering feature makes it possible to queue up - * in an ACE_Message_Queue until (1) the - * queue is "full" or (2) a period of time elapses, at which - * point the queue is "flushed" via to the peer. - */ -template -class ACE_Buffered_Svc_Handler : public ACE_Svc_Handler -{ -public: - // = Initialization and termination methods. - /** - * Constructor initializes the and by passing them - * down to the base class. The is passed to - * the ACE_Event_Handler. The and - * are used to determine at what point to flush - * the . By default, there's no buffering at all. The - * value is interpreted to be in a unit that's - * relative to the current time returned by . - */ - ACE_Buffered_Svc_Handler (ACE_Thread_Manager *thr_mgr = 0, - ACE_Message_Queue *mq = 0, - ACE_Reactor *reactor = ACE_Reactor::instance (), - size_t max_buffer_size = 0, - ACE_Time_Value *relative_timeout = 0); - - /// Destructor, which calls . - virtual ~ACE_Buffered_Svc_Handler (void); - - /** - * Insert the ACE_Message_Block chain rooted at - * into the ACE_Message_Queue with the designated . The - * method will be called if this causes the number of - * bytes to exceed the maximum buffer size or if the timeout period - * has elapsed. - */ - virtual int put (ACE_Message_Block *message_block, - ACE_Time_Value *timeout = 0); - - /// Flush the ACE_Message_Queue, which writes all the queued - /// ACE_Message_Blocks to the . - virtual int flush (void); - - /// This method is not currently implemented -- this is where the - /// integration with the would occur. - virtual int handle_timeout (const ACE_Time_Value &time, - const void *); - - /// Dump the state of an object. - void dump (void) const; - -protected: - /// Implement the flush operation on the ACE_Message_Queue, which - /// writes all the queued ACE_Message_Blocks to the . - /// Assumes that the caller holds the lock. - virtual int flush_i (void); - - /// Maximum size the can be before we have to flush - /// the buffer. - size_t maximum_buffer_size_; - - /// Current size in bytes of the contents. - size_t current_buffer_size_; - - /// Timeout value used to control when the buffer is flushed. - ACE_Time_Value next_timeout_; - - /// Interval of the timeout. - ACE_Time_Value interval_; - - /// Timeout pointer. - ACE_Time_Value *timeoutp_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Svc_Handler.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Svc_Handler.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SVC_HANDLER_H */ diff --git a/ace/Swap.cpp b/ace/Swap.cpp deleted file mode 100644 index eb14789c3de..00000000000 --- a/ace/Swap.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @file Swap.cpp - * - * $Id$ - * - * @author Carlos O'Ryan - */ - -#ifndef ACE_SWAP_CPP -#define ACE_SWAP_CPP - -#include "ace/Swap.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Swap.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_SWAP_CPP */ diff --git a/ace/Swap.h b/ace/Swap.h deleted file mode 100644 index a5688095eae..00000000000 --- a/ace/Swap.h +++ /dev/null @@ -1,54 +0,0 @@ -// -*- C++ -*- - -/** - * @file Swap.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ - -#ifndef ACE_SWAP_H -#define ACE_SWAP_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Swap - * - * @brief Defines a function to swap two variables. - * - * @deprecated This template is deprecated, you can use std::swap without - * problems on all platforms. - * - */ -template class ACE_Swap -{ -public: - /// Swap two variables - static void swap (T &lhs, T &rhs); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Swap.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Swap.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Swap.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_FUNCTOR_H */ diff --git a/ace/Swap.inl b/ace/Swap.inl deleted file mode 100644 index 195f1559f69..00000000000 --- a/ace/Swap.inl +++ /dev/null @@ -1,21 +0,0 @@ -// -*- C++ -*- - -/** - * @file Swap.inl - * - * $Id$ - * - * @author Carlos O'Ryan - */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE void -ACE_Swap::swap (T &lhs, T& rhs) -{ - T tmp = lhs; - lhs = rhs; - rhs = tmp; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Synch.h b/ace/Synch.h deleted file mode 100644 index 2d452ca8ee3..00000000000 --- a/ace/Synch.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Synch.h - * - * $Id$ - * - * Wrapper Facades for various synchronization mechanisms. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_SYNCH_H -#define ACE_SYNCH_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (DO_NOT_INCLUDE_SYNCH_H) - -/* All the classes have been moved out into their own headers as part of - the compile-time and footprint reduction effort. */ - -#include "ace/Auto_Event.h" -#include "ace/Barrier.h" -#include "ace/Condition_Thread_Mutex.h" -#include "ace/Condition_Recursive_Thread_Mutex.h" -#include "ace/Event.h" -#include "ace/Lock.h" -#include "ace/Manual_Event.h" -#include "ace/Mutex.h" -#include "ace/Null_Barrier.h" -#include "ace/Null_Condition.h" -#include "ace/Null_Mutex.h" -#include "ace/Null_Semaphore.h" -#include "ace/RW_Mutex.h" -#include "ace/RW_Thread_Mutex.h" -#include "ace/Recursive_Thread_Mutex.h" -#include "ace/Semaphore.h" -#include "ace/Thread_Mutex.h" -#include "ace/Thread_Semaphore.h" -#include "ace/TSS_Adapter.h" - -// Include the templates here. -// FUZZ: disable check_for_synch_include -#include "ace/Synch_T.h" - -#if defined (ACE_LEGACY_MODE) -# include "ace/File_Lock.h" -# include "ace/Process_Semaphore.h" -# include "ace/Process_Mutex.h" -# include "ace/RW_Process_Mutex.h" -# include "ace/Test_and_Set.h" -#endif /* ACE_LEGACY_MODE */ - -#endif /* DO_NOT_INCLUDE_SYNCH_H */ - -#include /**/ "ace/post.h" -#endif /* ACE_SYNCH_H */ diff --git a/ace/Synch_Options.cpp b/ace/Synch_Options.cpp deleted file mode 100644 index 4f95720486c..00000000000 --- a/ace/Synch_Options.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "ace/Synch_Options.h" - -#include "ace/Global_Macros.h" -#include "ace/config-all.h" - -ACE_RCSID (ace, - Synch_Options, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_Synch_Options) - -void -ACE_Synch_Options::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Synch_Options::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// Static initialization. -// Note: these three objects require static construction and destruction. - -/* static */ -ACE_Synch_Options ACE_Synch_Options::defaults; - -/* static */ -ACE_Synch_Options ACE_Synch_Options::synch; - -/* static */ -ACE_Synch_Options ACE_Synch_Options::asynch (ACE_Synch_Options::USE_REACTOR); - -ACE_Synch_Options::ACE_Synch_Options (unsigned long options, - const ACE_Time_Value &timeout, - const void *arg) -{ - // ACE_TRACE ("ACE_Synch_Options::ACE_Synch_Options"); - this->set (options, timeout, arg); -} - -void -ACE_Synch_Options::set (unsigned long options, - const ACE_Time_Value &timeout, - const void *arg) -{ - // ACE_TRACE ("ACE_Synch_Options::set"); - this->options_ = options; - this->timeout_ = (ACE_Time_Value &) timeout; - - // Whoa, possible dependence on static initialization here. This - // function is called during initialization of the statics above. - // But, ACE_Time_Value::zero is a static object. Very fortunately, - // its bits have a value of 0. - if (this->timeout_ != ACE_Time_Value::zero) - ACE_SET_BITS (this->options_, ACE_Synch_Options::USE_TIMEOUT); - - this->arg_ = arg; -} - -int -ACE_Synch_Options::operator[] (unsigned long option) const -{ - ACE_TRACE ("ACE_Synch_Options::operator[]"); - return (this->options_ & option) != 0; -} - -void -ACE_Synch_Options::operator= (unsigned long option) -{ - ACE_TRACE ("ACE_Synch_Options::operator="); - this->options_ |= option; -} - -const ACE_Time_Value & -ACE_Synch_Options::timeout (void) const -{ - ACE_TRACE ("ACE_Synch_Options::timeout"); - return this->timeout_; -} - -void -ACE_Synch_Options::timeout (const ACE_Time_Value &tv) -{ - ACE_TRACE ("ACE_Synch_Options::timeout"); - this->timeout_ = tv; -} - -const ACE_Time_Value * -ACE_Synch_Options::time_value (void) const -{ - ACE_TRACE ("ACE_Synch_Options::time_value"); - return (*this)[USE_TIMEOUT] ? &this->timeout_ : 0; -} - -const void * -ACE_Synch_Options::arg (void) const -{ - ACE_TRACE ("ACE_Synch_Options::arg"); - return this->arg_; -} - -void -ACE_Synch_Options::arg (const void *a) -{ - ACE_TRACE ("ACE_Synch_Options::arg"); - this->arg_ = a; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Synch_Options.h b/ace/Synch_Options.h deleted file mode 100644 index 288e4acb329..00000000000 --- a/ace/Synch_Options.h +++ /dev/null @@ -1,154 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Synch_Options.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_SYNCH_OPTIONS_H -#define ACE_SYNCH_OPTIONS_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Time_Value.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Synch_Options - * - * @brief Contains the values of options used to determine the - * synchronous and asynchronous behavior. - * - * Values support the following behavior (TV == "timeout" - * and UR == "use ACE_Reactor"): - * - * - * | Parameters | Description - * | - * |TV | UR | - * |-----|----------|------------------------------- - * | | - * |NULL | yes | infinite timeout (using ACE_Reactor) - * | | - * |time | yes | try asynch transaction for - * | | the specified time (using ACE_Reactor) - * | | - * |0,0 | yes | poll; try, if EWOULDBLOCK, - * | | then return immediately - * | | (using ACE_Reactor) - * | | - * |NULL | no | block forever (don't use ACE_Reactor) - * | | - * |time | no | do a blocking transaction - * | | for the specified time - * | | (don't use ACE_Reactor) - * | | - * |0,0 | no | poll; but do not initiate a - * | | nonblocking transaction - * | | (don't use ACE_Reactor) - * - */ -class ACE_Export ACE_Synch_Options -{ -public: - /// Options flags for controlling synchronization. - /** - * Note that these flags can be bit-wise "or'd" together if both - * options are desired. - */ - enum - { - /// Use the Reactor. - USE_REACTOR = 01, - /// Interprete the Time_Value. - USE_TIMEOUT = 02 - }; - - // = Initialization methods. - /// Initialize the Synch_Options based on parameters. - ACE_Synch_Options (unsigned long options = 0, - const ACE_Time_Value &timeout = ACE_Time_Value::zero, - const void *arg = 0); - - /// Initialize the Synch_Options based on parameters. - void set (unsigned long options = 0, - const ACE_Time_Value &timeout = ACE_Time_Value::zero, - const void *arg = 0); - - /// Get method for determining which options are enabled. - int operator[] (unsigned long option) const; - - /// Set method for enabling certain options. - void operator= (unsigned long option); - - /// Returns the "magic cookie" argument. - const void *arg (void) const; - - /// Set the "magic cookie" argument. - void arg (const void *); - - /// Returns a reference to the ACE_Time_Value. This value only makes - /// sense if (*this)[USE_TIMEOUT] is true. - const ACE_Time_Value &timeout (void) const; - - /// Set the ACE_Time_Value. - void timeout (const ACE_Time_Value &tv); - - /** - * Returns the address of the timeout if - * (*this)[USE_TIMEOUT] is true, else 0. This should be used with - * care, e.g., the timeout pointer should not be stored in a manner - * that will lead to dangling pointers... - */ - const ACE_Time_Value *time_value (void) const; - - // = Static data members (singletons) - - /// This is the default setting for options, which will block - /// synchronously. - static ACE_Synch_Options defaults; - - /// This is the default synchronous setting. - static ACE_Synch_Options synch; - - /// This is the default asynchronous setting. - static ACE_Synch_Options asynch; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Keeps track of the enabled options. - unsigned long options_; - - /// Amount of time to wait for timeouts. - ACE_Time_Value timeout_; - - /** - * "Magic cookie" always passed in as an argument to the ACE_Reactor's - * method. Used to communicate values for - * asynchronous programming. - */ - const void *arg_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_SYNCH_OPTIONS_H */ diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp deleted file mode 100644 index 22ee08d4e0b..00000000000 --- a/ace/Synch_T.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -#ifndef ACE_SYNCH_T_CPP -#define ACE_SYNCH_T_CPP - -#include "ace/Thread.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// FUZZ: disable check_for_synch_include -#include "ace/Synch_T.h" -#include "ace/Log_Msg.h" - -#include "ace/Lock_Adapter_T.cpp" -#include "ace/Reverse_Lock_T.cpp" -#include "ace/Guard_T.cpp" -#include "ace/TSS_T.cpp" -#include "ace/Condition_T.cpp" - -#endif /* ACE_SYNCH_T_CPP */ diff --git a/ace/Synch_T.h b/ace/Synch_T.h deleted file mode 100644 index c853a3f3325..00000000000 --- a/ace/Synch_T.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Synch_T.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SYNCH_T_H -#define ACE_SYNCH_T_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// FUZZ: disable check_for_synch_include -#include "ace/Synch.h" - -#include "ace/Lock_Adapter_T.h" -#include "ace/Reverse_Lock_T.h" -#include "ace/Guard_T.h" -#include "ace/TSS_T.h" -#include "ace/Condition_T.h" -#include "ace/Synch_Traits.h" - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Synch_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Synch_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_SYNCH_T_H */ diff --git a/ace/Synch_Traits.h b/ace/Synch_Traits.h deleted file mode 100644 index 03e8b25362d..00000000000 --- a/ace/Synch_Traits.h +++ /dev/null @@ -1,152 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Synch_Traits.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_SYNCH_TRAITS_H -#define ACE_SYNCH_TRAITS_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" /* Need to know threads, template settings */ -#include "ace/Lock.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl -class ACE_Null_Mutex; -class ACE_Null_Condition; -class ACE_Null_Semaphore; -class ACE_Null_Mutex; -class ACE_Thread_Mutex; -class ACE_Process_Mutex; -class ACE_Recursive_Thread_Mutex; -class ACE_RW_Thread_Mutex; -class ACE_Condition_Thread_Mutex; -class ACE_Condition_Recursive_Thread_Mutex; -class ACE_Thread_Semaphore; - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) - -/** - * @class ACE_NULL_SYNCH - * - * @brief Implement a do nothing Synchronization wrapper that - * typedefs the @c ACE_Condition and @c ACE_Mutex to the - * @c Null* versions. - */ -class ACE_Export ACE_NULL_SYNCH -{ -public: - typedef ACE_Null_Mutex MUTEX; - typedef ACE_Null_Mutex NULL_MUTEX; - typedef ACE_Null_Mutex PROCESS_MUTEX; - typedef ACE_Null_Mutex RECURSIVE_MUTEX; - typedef ACE_Null_Mutex RW_MUTEX; - typedef ACE_Null_Condition CONDITION; - typedef ACE_Null_Condition RECURSIVE_CONDITION; - typedef ACE_Null_Semaphore SEMAPHORE; - typedef ACE_Null_Mutex NULL_SEMAPHORE; -}; - -#if defined (ACE_HAS_THREADS) - -class ACE_Process_Mutex; -class ACE_Condition_Recursive_Thread_Mutex; - -/** - * @class ACE_MT_SYNCH - * - * @brief Implement a default thread safe synchronization wrapper that - * typedefs the @c ACE_Condition and @c ACE_Mutex to the - * @c ACE_Condition and @c ACE_Mutex versions. - * - * @todo This should be a template, but SunC++ 4.0.1 complains about - * this. - */ -class ACE_Export ACE_MT_SYNCH -{ -public: - typedef ACE_Thread_Mutex MUTEX; - typedef ACE_Null_Mutex NULL_MUTEX; - typedef ACE_Process_Mutex PROCESS_MUTEX; - typedef ACE_Recursive_Thread_Mutex RECURSIVE_MUTEX; - typedef ACE_RW_Thread_Mutex RW_MUTEX; - typedef ACE_Condition_Thread_Mutex CONDITION; - typedef ACE_Condition_Recursive_Thread_Mutex RECURSIVE_CONDITION; - typedef ACE_Thread_Semaphore SEMAPHORE; - typedef ACE_Null_Semaphore NULL_SEMAPHORE; -}; - -#endif /* ACE_HAS_THREADS */ - -#define ACE_SYNCH_MUTEX ACE_SYNCH::MUTEX -#define ACE_SYNCH_NULL_MUTEX ACE_SYNCH::NULL_MUTEX -#define ACE_SYNCH_RECURSIVE_MUTEX ACE_SYNCH::RECURSIVE_MUTEX -#define ACE_SYNCH_RW_MUTEX ACE_SYNCH::RW_MUTEX -#define ACE_SYNCH_CONDITION ACE_SYNCH::CONDITION -#define ACE_SYNCH_RECURSIVE_CONDITION ACE_SYNCH::RECURSIVE_CONDITION -#define ACE_SYNCH_NULL_SEMAPHORE ACE_SYNCH::NULL_SEMAPHORE -#define ACE_SYNCH_SEMAPHORE ACE_SYNCH::SEMAPHORE - -#else /* !ACE_HAS_TEMPLATE_TYPEDEFS */ - -#if defined (ACE_HAS_OPTIMIZED_MESSAGE_QUEUE) -#define ACE_NULL_SYNCH ACE_Null_Mutex, ACE_Null_Condition, ACE_Null_Mutex -#define ACE_MT_SYNCH ACE_Thread_Mutex, ACE_Condition_Thread_Mutex, ACE_Thread_Semaphore -#else -#define ACE_NULL_SYNCH ACE_Null_Mutex, ACE_Null_Condition -#define ACE_MT_SYNCH ACE_Thread_Mutex, ACE_Condition_Thread_Mutex -#endif /* ACE_HAS_OPTIMIZED_MESSAGE_QUEUE */ - -#if defined (ACE_HAS_THREADS) - -#define ACE_SYNCH_MUTEX ACE_Thread_Mutex -#define ACE_SYNCH_NULL_MUTEX ACE_Null_Mutex -#define ACE_SYNCH_RECURSIVE_MUTEX ACE_Recursive_Thread_Mutex -#define ACE_SYNCH_RW_MUTEX ACE_RW_Thread_Mutex -#define ACE_SYNCH_CONDITION ACE_Condition_Thread_Mutex -#define ACE_SYNCH_RECURSIVE_CONDITION ACE_Condition_Recursive_Thread_Mutex -#define ACE_SYNCH_SEMAPHORE ACE_Thread_Semaphore -#define ACE_SYNCH_NULL_SEMAPHORE ACE_Null_Semaphore - -#else /* ACE_HAS_THREADS */ - -#define ACE_SYNCH_MUTEX ACE_Null_Mutex -#define ACE_SYNCH_NULL_MUTEX ACE_Null_Mutex -#define ACE_SYNCH_RECURSIVE_MUTEX ACE_Null_Mutex -#define ACE_SYNCH_RW_MUTEX ACE_Null_Mutex -#define ACE_SYNCH_CONDITION ACE_Null_Condition -#define ACE_SYNCH_RECURSIVE_CONDITION ACE_Null_Condition -#define ACE_SYNCH_SEMAPHORE ACE_Null_Semaphore -#define ACE_SYNCH_NULL_SEMAPHORE ACE_Null_Mutex - -#endif /* ACE_HAS_THREADS */ -#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ - -// These are available on *all* platforms -#define ACE_SYNCH_PROCESS_SEMAPHORE ACE_Process_Semaphore -#define ACE_SYNCH_PROCESS_MUTEX ACE_Process_Mutex - -#if defined (ACE_HAS_THREADS) -#define ACE_SYNCH ACE_MT_SYNCH -#else /* ACE_HAS_THREADS */ -#define ACE_SYNCH ACE_NULL_SYNCH -#endif /* ACE_HAS_THREADS */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_SYNCH_TRAITS_H */ diff --git a/ace/System_Time.cpp b/ace/System_Time.cpp deleted file mode 100644 index 9aa77c4ddf1..00000000000 --- a/ace/System_Time.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// $Id$ - -#include "ace/System_Time.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_time.h" -#include "ace/Time_Value.h" - -ACE_RCSID(ace, System_Time, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_System_Time::ACE_System_Time (const ACE_TCHAR *poolname) - : delta_time_ (0) -{ - ACE_TRACE ("ACE_System_Time::ACE_System_Time"); - - // Only create a new unique filename for the memory pool file - // if the user didn't supply one... - if (poolname == 0) - { -#if defined (ACE_DEFAULT_BACKING_STORE) - // Create a temporary file. - ACE_OS::strcpy (this->poolname_, - ACE_DEFAULT_BACKING_STORE); -#else /* ACE_DEFAULT_BACKING_STORE */ - if (ACE::get_temp_dir (this->poolname_, - MAXPATHLEN - 17) == -1) - // -17 for ace-malloc-XXXXXX - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Temporary path too long, ") - ACE_LIB_TEXT ("defaulting to current directory\n"))); - this->poolname_[0] = 0; - } - - // Add the filename to the end - ACE_OS::strcat (this->poolname_, ACE_LIB_TEXT ("ace-malloc-XXXXXX")); - -#endif /* ACE_DEFAULT_BACKING_STORE */ - } - else - ACE_OS::strsncpy (this->poolname_, - poolname, - (sizeof this->poolname_ / sizeof (ACE_TCHAR))); - - ACE_NEW (this->shmem_, - ALLOCATOR (this->poolname_)); -} - -ACE_System_Time::~ACE_System_Time (void) -{ - ACE_TRACE ("ACE_System_Time::~ACE_System_Time"); - delete this->shmem_; -} - -// Get the local system time. - -int -ACE_System_Time::get_local_system_time (ACE_UINT32 &time_out) -{ - ACE_TRACE ("ACE_System_Time::get_local_system_time"); - time_out = ACE_OS::time (0); - return 0; -} - -int -ACE_System_Time::get_local_system_time (ACE_Time_Value &time_out) -{ - ACE_TRACE ("ACE_System_Time::get_local_system_time"); - time_out.set (ACE_OS::time (0), 0); - return 0; -} - -// Get the system time of the central time server. - -int -ACE_System_Time::get_master_system_time (ACE_UINT32 &time_out) -{ - ACE_TRACE ("ACE_System_Time::get_master_system_time"); - - if (this->delta_time_ == 0) - { - // Try to find it - void * temp; - if (this->shmem_->find (ACE_DEFAULT_TIME_SERVER_STR, temp) == -1) - { - // No time entry in shared memory (meaning no Clerk exists) - // so return the local time of the host. - return this->get_local_system_time (time_out); - } - else - // Extract the delta time. - this->delta_time_ = (long *) temp; - } - - ACE_UINT32 local_time; - - // If delta_time is positive, it means that the system clock is - // ahead of our local clock so add delta to the local time to get an - // approximation of the system time. Else if delta time is negative, - // it means that our local clock is ahead of the system clock, so - // return the last local time stored (to avoid time conflicts). - if (*this->delta_time_ >=0 ) - { - this->get_local_system_time (local_time); - time_out = local_time + (ACE_UINT32) *this->delta_time_; - } - else - // Return the last local time. Note that this is stored as the - // second field in shared memory. - time_out = *(this->delta_time_ + 1); - return 0; -} - -int -ACE_System_Time::get_master_system_time (ACE_Time_Value &time_out) -{ - ACE_TRACE ("ACE_System_Time::get_master_system_time"); - ACE_UINT32 to; - if (this->get_master_system_time (to) == -1) - return -1; - time_out.sec (to); - return 0; -} - -// Synchronize local system time with the central time server using -// specified mode (currently unimplemented). - -int -ACE_System_Time::sync_local_system_time (ACE_System_Time::Sync_Mode) -{ - ACE_TRACE ("ACE_System_Time::sync_local_system_time"); - ACE_NOTSUP_RETURN (-1); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/System_Time.h b/ace/System_Time.h deleted file mode 100644 index 744df70a034..00000000000 --- a/ace/System_Time.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file System_Time.h - * - * $Id$ - * - * @author Prashant Jain - * @author Tim H. Harrison and Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_SYSTEM_TIME_H -#define ACE_SYSTEM_TIME_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/MMAP_Memory_Pool.h" -#include "ace/Malloc_T.h" -#include "ace/Null_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_System_Time - * - * @brief Defines the timer services of the OS interface to access the - * system time either on the local host or on the central time - * server in the network. - */ -class ACE_Export ACE_System_Time -{ -public: - /** - * Enumeration types to specify mode of synchronization with master - * clock. Jump will set local system time directly (thus possibly - * producing time gaps or ambiguous local system times. Adjust will - * smoothly slow down or speed up the local system clock to reach - * the system time of the master clock. - */ - enum Sync_Mode { Jump, Adjust }; - - /// Default constructor. - ACE_System_Time (const ACE_TCHAR *poolname = 0); - - /// Default destructor. - ~ACE_System_Time (void); - - /// Get the local system time, i.e., the value returned by - /// ACE_OS::time(). - static int get_local_system_time (ACE_UINT32 &time_out); - - /// Get the local system time, i.e., the value returned by - /// ACE_OS::time(). - static int get_local_system_time (ACE_Time_Value &time_out); - - /// Get the system time of the central time server. - int get_master_system_time (ACE_UINT32 &time_out); - - /// Get the system time of the central time server. - int get_master_system_time (ACE_Time_Value &time_out); - - /// Synchronize local system time with the central time server using - /// specified mode. - int sync_local_system_time (ACE_System_Time::Sync_Mode mode); - -private: - typedef ACE_Malloc MALLOC; - typedef ACE_Allocator_Adapter ALLOCATOR; - - /// Our allocator (used for obtaining system time from shared memory). - ALLOCATOR *shmem_; - - /// The name of the pool used by the allocator. - ACE_TCHAR poolname_[MAXPATHLEN + 1]; - - /// Pointer to delta time kept in shared memory. - long *delta_time_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_SYSTEM_TIME_H */ diff --git a/ace/TLI.cpp b/ace/TLI.cpp deleted file mode 100644 index c53ed5a7e4e..00000000000 --- a/ace/TLI.cpp +++ /dev/null @@ -1,273 +0,0 @@ -// $Id$ - -// Defines the member functions for the base class of the ACE_TLI -// abstraction. - -#include "ace/TLI.h" -#include "ace/Log_Msg.h" -#include "ace/OS_Memory.h" -#include "ace/OS_TLI.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_sys_socket.h" -#include "ace/Auto_Ptr.h" - -ACE_RCSID(ace, TLI, "$Id$") - -#if defined (ACE_HAS_TLI) - -#if !defined (__ACE_INLINE__) -#include "ace/TLI.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_TLI) - -void -ACE_TLI::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_TLI::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_TLI::ACE_TLI (void) -{ - ACE_TRACE ("ACE_TLI::ACE_TLI"); -#if defined (ACE_HAS_SVR4_TLI) -// Solaris 2.4 ACE_TLI option handling is broken. Thus, we must do -// the memory allocation ourselves... Thanks to John P. Hearn -// (jph@ccrl.nj.nec.com) for the help. - - this->so_opt_req.opt.maxlen = sizeof (opthdr) + sizeof (long); - ACE_NEW (this->so_opt_req.opt.buf, - char[this->so_opt_req.opt.maxlen]); - - this->so_opt_ret.opt.maxlen = sizeof (opthdr) + sizeof (long); - ACE_NEW (this->so_opt_ret.opt.buf, - char[this->so_opt_ret.opt.maxlen]); - - if (this->so_opt_ret.opt.buf == 0) - { - delete [] this->so_opt_req.opt.buf; - this->so_opt_req.opt.buf = 0; - return; - } -#endif /* ACE_HAS_SVR4_TLI */ -} - -ACE_HANDLE -ACE_TLI::open (const char device[], int oflag, struct t_info *info) -{ - ACE_TRACE ("ACE_TLI::open"); - if (oflag == 0) - oflag = O_RDWR; - this->set_handle (ACE_OS::t_open ((char *) device, oflag, info)); - - return this->get_handle (); -} - -ACE_TLI::~ACE_TLI (void) -{ - ACE_TRACE ("ACE_TLI::~ACE_TLI"); -#if defined (ACE_HAS_SVR4_TLI) - if (this->so_opt_req.opt.buf) - { - delete [] this->so_opt_req.opt.buf; - delete [] this->so_opt_ret.opt.buf; - this->so_opt_req.opt.buf = 0; - this->so_opt_ret.opt.buf = 0; - } -#endif /* ACE_HAS_SVR4_TLI */ -} - -ACE_TLI::ACE_TLI (const char device[], int oflag, struct t_info *info) -{ - ACE_TRACE ("ACE_TLI::ACE_TLI"); - if (this->open (device, oflag, info) == ACE_INVALID_HANDLE) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_TLI::ACE_TLI"))); -} - -int -ACE_TLI::get_local_addr (ACE_Addr &sa) const -{ - ACE_TRACE ("ACE_TLI::get_local_addr"); - struct netbuf name; - - name.maxlen = sa.get_size (); - name.buf = (char *) sa.get_addr (); - - if (ACE_OS::t_getname (this->get_handle (), &name, LOCALNAME) == -1) - return -1; - else - return 0; -} - -int -ACE_TLI::close (void) -{ - ACE_TRACE ("ACE_TLI::close"); - int result = 0; // Geisler: result must be int - - if (this->get_handle () != ACE_INVALID_HANDLE) - { - result = ACE_OS::t_close (this->get_handle ()); - this->set_handle (ACE_INVALID_HANDLE); - } - return result; -} - -int -ACE_TLI::set_option (int level, int option, void *optval, int optlen) -{ - /* Set up options for ACE_TLI */ - ACE_TRACE ("ACE_TLI::set_option"); - -#if defined (ACE_HAS_XTI) - // ret will get the negotiated option back after attempting to set it. - // Assume this will fit in the requested size. - struct t_optmgmt req, ret; - ACE_NEW_RETURN (req.opt.buf, char[sizeof (struct t_opthdr) + optlen], -1); -# if (_XOPEN_SOURCE - 0 >= 500) - auto_ptr req_opt_buf_p (reinterpret_cast (req.opt.buf)); -# else - ACE_Auto_Array_Ptr req_opt_buf_p (req.opt.buf); -# endif /* XPG5 vs XPG4 */ - struct t_opthdr *opthdr = - reinterpret_cast (req.opt.buf); - ACE_NEW_RETURN (ret.opt.buf, char[sizeof (struct t_opthdr) + optlen], -1); -# if (_XOPEN_SOURCE - 0 >= 500) - auto_ptr ret_opt_buf_p (reinterpret_cast (ret.opt.buf)); -# else - ACE_Auto_Array_Ptr ret_opt_buf_p (ret.opt.buf); -# endif /* XPG5 vs XPG4 */ - - req.flags = T_NEGOTIATE; - req.opt.len = sizeof *opthdr + optlen; - ret.opt.maxlen = req.opt.len; - opthdr->level = level; - opthdr->name = option; - opthdr->len = req.opt.len; // We only request one option at a time. - ACE_OS::memcpy (&opthdr[1], optval, optlen); - return ACE_OS::t_optmgmt (this->get_handle (), &req, &ret); - -#elif defined (ACE_HAS_SVR4_TLI) - struct opthdr *opthdr = 0; /* See for info on this format */ - - this->so_opt_req.flags = T_NEGOTIATE; - this->so_opt_req.opt.len = sizeof *opthdr + OPTLEN (optlen); - - if (this->so_opt_req.opt.len > this->so_opt_req.opt.maxlen) - { -# if !defined (ACE_HAS_SET_T_ERRNO) - t_errno = TBUFOVFLW; -# else - set_t_errno (TBUFOVFLW); -# endif /* ACE_HAS_SET_T_ERRNO */ - return -1; - } - - opthdr = reinterpret_cast (this->so_opt_req.opt.buf); - opthdr->level = level; - opthdr->name = option; - opthdr->len = OPTLEN (optlen); - ACE_OS::memcpy (OPTVAL (opthdr), optval, optlen); - - return ACE_OS::t_optmgmt (this->get_handle (), - &this->so_opt_req, - &this->so_opt_ret); -#else - ACE_UNUSED_ARG (level); - ACE_UNUSED_ARG (option); - ACE_UNUSED_ARG (optval); - ACE_UNUSED_ARG (optlen); - return -1; -#endif /* ACE_HAS_XTI, else ACE_HAS_SVR4_TLI */ -} - -int -ACE_TLI::get_option (int level, int option, void *optval, int &optlen) -{ - ACE_TRACE ("ACE_TLI::get_option"); -#if defined (ACE_HAS_XTI) - // ret will get the option requested in req. - struct t_optmgmt req, ret; - ACE_NEW_RETURN (req.opt.buf, char[sizeof (struct t_opthdr)], -1); -# if (_XOPEN_SOURCE - 0 >= 500) - auto_ptr req_opt_buf_p (reinterpret_cast (req.opt.buf)); -# else - ACE_Auto_Array_Ptr req_opt_buf_p (req.opt.buf); -# endif /* XPG5 vs XPG4 */ - struct t_opthdr *opthdr = - reinterpret_cast (req.opt.buf); - ACE_NEW_RETURN (ret.opt.buf, char[sizeof (struct t_opthdr) + optlen], -1); -# if (_XOPEN_SOURCE - 0 >= 500) - auto_ptr ret_opt_buf_p (reinterpret_cast (ret.opt.buf)); -# else - ACE_Auto_Array_Ptr ret_opt_buf_p (ret.opt.buf); -# endif /* XPG5 vs XPG4 */ - - req.flags = T_CURRENT; - req.opt.len = sizeof *opthdr; - ret.opt.maxlen = sizeof (struct t_opthdr) + optlen; - opthdr->level = level; - opthdr->name = option; - opthdr->len = sizeof (*opthdr); // Just the header on the request - if (ACE_OS::t_optmgmt (this->get_handle (), &req, &ret) == -1) - return -1; - else - { - opthdr = reinterpret_cast (ret.opt.buf); - if (opthdr->status == T_NOTSUPPORT) - { - errno = ENOTSUP; - return -1; - } - else - { - ACE_OS::memcpy (optval, &opthdr[1], optlen); - return 0; - } - } - -#elif defined (ACE_HAS_SVR4_TLI) - struct opthdr *opthdr = 0; /* See for details on this format */ - - this->so_opt_req.flags = T_CHECK; - this->so_opt_ret.opt.len = sizeof *opthdr + OPTLEN (optlen); - - if (this->so_opt_ret.opt.len > this->so_opt_ret.opt.maxlen) - { -#if !defined (ACE_HAS_SET_T_ERRNO) - t_errno = TBUFOVFLW; -#else - set_t_errno (TBUFOVFLW); -#endif /* ACE_HAS_SET_T_ERRNO */ - return -1; - } - - opthdr = (struct opthdr *) this->so_opt_req.opt.buf; - opthdr->level = level; - opthdr->name = option; - opthdr->len = OPTLEN (optlen); - if (ACE_OS::t_optmgmt (this->get_handle (), &this->so_opt_req, &this->so_opt_ret) == -1) - return -1; - else - { - ACE_OS::memcpy (optval, OPTVAL (opthdr), optlen); - return 0; - } -#else - ACE_UNUSED_ARG (level); - ACE_UNUSED_ARG (option); - ACE_UNUSED_ARG (optval); - ACE_UNUSED_ARG (optlen); - return -1; -#endif /* ACE_HAS_SVR4_TLI */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TLI */ diff --git a/ace/TLI.h b/ace/TLI.h deleted file mode 100644 index 20fcec2841a..00000000000 --- a/ace/TLI.h +++ /dev/null @@ -1,116 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file TLI.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_TLI_H -#define ACE_TLI_H -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_TLI.h" - -#if defined (ACE_HAS_TLI) - -#include "ace/IPC_SAP.h" -#include "ace/Addr.h" -#include "ace/os_include/os_fcntl.h" - -// There's not a universal device name for TLI devices. If the platform -// needs something other than /dev/tcp, it needs to be set up in the config.h -// file as ACE_TLI_TCP_DEVICE. -#ifndef ACE_TLI_TCP_DEVICE -#define ACE_TLI_TCP_DEVICE "/dev/tcp" -#endif - -// There's not a universal device name for XTI/ATM devices. If the platform -// needs something other than /dev/xtisvc0, it needs to be set up in the -// config.h file as ACE_XTI_ATM_DEVICE. This may be FORE vendor specific and -// there may be no good default. -#ifndef ACE_XTI_ATM_DEVICE -#define ACE_XTI_ATM_DEVICE "/dev/xtisvc0" -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_TLI - * - * @brief Defines the member functions for the base class of the - * ACE_TLI abstraction. - */ -class ACE_Export ACE_TLI : public ACE_IPC_SAP -{ -public: - // = Initialization and termination methods. - /// Initialize a TLI endpoint. - ACE_HANDLE open (const char device[], - int oflag = O_RDWR, - struct t_info *info = 0); - - /// Close a TLI endpoint and release resources. - int close (void); - - /// Set underlying protocol options. - int set_option (int level, int option, void *optval, int optlen); - - /// Get underlying protocol options. - int get_option (int level, int option, void *optval, int &optlen); - - // = Calls to underlying TLI operations. - int look (void) const; - int rcvdis (struct t_discon * = 0) const; - int snddis (struct t_call * = 0) const; - int sndrel (void) const; - int rcvrel (void) const; - - /// Return our local endpoint address. - int get_local_addr (ACE_Addr &) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Ensure we are an abstract class. - /// Default constructor. - ACE_TLI (void); - - /// Destructor. - ~ACE_TLI (void); - - /// Initialize a TLI endpoint. - ACE_TLI (const char device[], int oflag = O_RDWR, struct t_info *info = 0); - -private: -#if defined (ACE_HAS_SVR4_TLI) - // XTI/TLI option management. - struct t_optmgmt so_opt_req; - struct t_optmgmt so_opt_ret; -#endif /* ACE_HAS_SVR4_TLI */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/TLI.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_TLI */ -#include /**/ "ace/post.h" -#endif /* ACE_TLI_H */ diff --git a/ace/TLI.inl b/ace/TLI.inl deleted file mode 100644 index 2485cdc5557..00000000000 --- a/ace/TLI.inl +++ /dev/null @@ -1,50 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/TLI.h" - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -int -ACE_TLI::look (void) const -{ - ACE_TRACE ("ACE_TLI::look"); - return ACE_OS::t_look (this->get_handle ()); -} - -ACE_INLINE -int -ACE_TLI::rcvdis (struct t_discon *discon) const -{ - ACE_TRACE ("ACE_TLI::rcvdis"); - return ACE_OS::t_rcvdis (this->get_handle (), discon); -} - -ACE_INLINE -int -ACE_TLI::snddis (struct t_call *call) const -{ - ACE_TRACE ("ACE_TLI::snddis"); - return ACE_OS::t_snddis (this->get_handle (), call); -} - -ACE_INLINE -int -ACE_TLI::rcvrel (void) const -{ - ACE_TRACE ("ACE_TLI::rcvrel"); - return ACE_OS::t_rcvrel (this->get_handle ()); -} - -ACE_INLINE -int -ACE_TLI::sndrel (void) const -{ - ACE_TRACE ("ACE_TLI::sndrel"); - return ACE_OS::t_sndrel (this->get_handle ()); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TLI_Acceptor.cpp b/ace/TLI_Acceptor.cpp deleted file mode 100644 index 34890b40de6..00000000000 --- a/ace/TLI_Acceptor.cpp +++ /dev/null @@ -1,553 +0,0 @@ -// $Id$ - -#include "ace/TLI_Acceptor.h" -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_Memory.h" - -ACE_RCSID(ace, TLI_Acceptor, "$Id$") - -#if defined (ACE_HAS_TLI) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Put the actual definitions of the ACE_TLI_Request and -// ACE_TLI_Request_Queue classes here to hide them from clients... - -struct ACE_TLI_Request -{ - struct t_call *callp_; - ACE_HANDLE handle_; - ACE_TLI_Request *next_; -}; - -class ACE_TLI_Request_Queue -{ -public: - ACE_TLI_Request_Queue (void); - - ACE_HANDLE open (ACE_HANDLE fd, int size); - int close (void); - - int enqueue (const char device[], int restart, int rwflag); - int dequeue (ACE_TLI_Request *&ptr); - int remove (int sequence_number); - - int is_empty (void) const; - int is_full (void) const; - - ACE_TLI_Request *alloc (void); - void free (ACE_TLI_Request *node); - - void dump (void) const; - // Dump the state of an object. - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -private: - ACE_HANDLE handle_; - int size_; - int current_count_; - ACE_TLI_Request *base_; - ACE_TLI_Request *tail_; - ACE_TLI_Request *free_list_; -}; - -ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Request_Queue) - -void -ACE_TLI_Request_Queue::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_TLI_Request_Queue::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_TLI_Request_Queue::is_empty (void) const -{ - ACE_TRACE ("ACE_TLI_Request_Queue::is_empty"); - return this->current_count_ == 0; -} - -int -ACE_TLI_Request_Queue::is_full (void) const -{ - ACE_TRACE ("ACE_TLI_Request_Queue::is_full"); - return this->current_count_ + 1 == this->size_; // Add 1 for the dummy. -} - -// Add a node to the free list stack. - -void -ACE_TLI_Request_Queue::free (ACE_TLI_Request *node) -{ - ACE_TRACE ("ACE_TLI_Request_Queue::free"); - node->next_ = this->free_list_; - this->free_list_ = node; -} - -// Remove a node from the free list stack. - -ACE_TLI_Request * -ACE_TLI_Request_Queue::alloc (void) -{ - ACE_TRACE ("ACE_TLI_Request_Queue::alloc"); - ACE_TLI_Request *temp = this->free_list_; - this->free_list_ = this->free_list_->next_; - return temp; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Acceptor) - -void -ACE_TLI_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_TLI_Acceptor::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_TLI_Acceptor::ACE_TLI_Acceptor (void) - : queue_ (0) -{ - ACE_TRACE ("ACE_TLI_Acceptor::ACE_TLI_Acceptor"); -} - -int -ACE_TLI_Request_Queue::dequeue (ACE_TLI_Request *&ptr) -{ - ACE_TRACE ("ACE_TLI_Request_Queue::dequeue"); - ptr = this->tail_->next_; - this->tail_->next_ = ptr->next_; - this->current_count_--; - return 0; -} - -// This is hideous... - -static ACE_HANDLE -open_new_endpoint (ACE_HANDLE listen_handle, - const char dev[], - struct t_call *callp, - int rwf, - ACE_Addr *remote_sap = 0) -{ - ACE_TRACE ("open_new_endpoint"); - ACE_HANDLE fd = ACE_OS::t_open ((char *) dev, - O_RDWR, - 0); - - struct t_bind req, *req_p = 0; - if (remote_sap != 0) - { - req.qlen = 0; - req.addr.buf = (char *) remote_sap->get_addr (); - req.addr.len = remote_sap->get_size (); - req.addr.maxlen = remote_sap->get_size (); - req_p = &req; - } - - if (fd == ACE_INVALID_HANDLE - || ACE_OS::t_bind (fd, req_p, 0) == -1) - fd = ACE_INVALID_HANDLE; -#if defined (I_PUSH) && !defined (ACE_HAS_FORE_ATM_XTI) - else if (rwf != 0 && ACE_OS::ioctl (fd, - I_PUSH, - const_cast ("tirdwr")) - == ACE_INVALID_HANDLE) - fd = ACE_INVALID_HANDLE; -#else - ACE_UNUSED_ARG(rwf); -#endif /* I_PUSH */ - - if (fd == ACE_INVALID_HANDLE) - ACE_OS::t_snddis (listen_handle, - callp); - return fd; -} - -// Close down the acceptor and release resources. - -int -ACE_TLI_Request_Queue::close (void) -{ - ACE_TRACE ("ACE_TLI_Request_Queue::close"); - int res = 0; - - for (int i = 0; i < this->size_; i++) - { - ACE_TLI_Request &item = this->base_[i]; - - item.handle_ = ACE_INVALID_HANDLE; - if (ACE_OS::t_free ((char *) item.callp_, - T_CALL) != 0) - res = -1; - } - - delete [] this->base_; - this->base_ = 0; - return res; -} - -ACE_HANDLE -ACE_TLI_Request_Queue::open (ACE_HANDLE f, int sz) -{ - ACE_TRACE ("ACE_TLI_Request_Queue::open"); - this->handle_ = f; - this->size_ = sz + 1; // Add one more for the dummy node. - - ACE_NEW_RETURN (this->base_, - ACE_TLI_Request[this->size_], - ACE_INVALID_HANDLE); - - // Initialize the ACE_Queue and the free list. - - for (int i = 0; i < this->size_; i++) - { - ACE_TLI_Request *item = &this->base_[i]; - this->free (item); - - item->handle_ = ACE_INVALID_HANDLE; - item->callp_ = (t_call *) ACE_OS::t_alloc (this->handle_, - T_CALL, - T_ALL); - if (item->callp_ == 0) - return ACE_INVALID_HANDLE; - } - - this->tail_ = this->alloc (); - this->tail_->next_ = this->tail_; - return 0; -} - -ACE_TLI_Request_Queue::ACE_TLI_Request_Queue (void) - : size_ (0), - current_count_ (0), - base_ (0), - tail_ (0), - free_list_ (0) -{ - ACE_TRACE ("ACE_TLI_Request_Queue::ACE_TLI_Request_Queue"); -} - -// Listen for a new connection request and allocate appropriate data -// structures when one arrives. - -int -ACE_TLI_Request_Queue::enqueue (const char device[], - int restart, int rwflag) -{ - ACE_TRACE ("ACE_TLI_Request_Queue::enqueue"); - ACE_TLI_Request *temp = this->alloc (); - ACE_TLI_Request &req = *this->tail_; - int res; - - do - res = ACE_OS::t_listen (this->handle_, req.callp_); - while (res == -1 - && restart - && t_errno == TSYSERR - && errno == EINTR); - - if (res != -1) - { - req.handle_ = open_new_endpoint (this->handle_, - device, - req.callp_, - rwflag); - if (req.handle_ != ACE_INVALID_HANDLE) - { - temp->next_ = this->tail_->next_; - this->tail_->next_ = temp; - this->tail_ = temp; - this->current_count_++; - return 0; - } - } - - // Something must have gone wrong, so free up allocated space. - this->free (temp); - return -1; -} - -// Locate and remove SEQUENCE_NUMBER from the list of pending -// connections. - -int -ACE_TLI_Request_Queue::remove (int sequence_number) -{ - ACE_TRACE ("ACE_TLI_Request_Queue::remove"); - ACE_TLI_Request *prev = this->tail_; - - // Put the sequence # in the dummy node to simply the search... - prev->callp_->sequence = sequence_number; - - ACE_TLI_Request *temp; - - for (temp = this->tail_->next_; - temp->callp_->sequence != sequence_number; - temp = temp->next_) - prev = temp; - - if (temp == this->tail_) - // Sequence # was not found, since we're back at the dummy node! - return -1; - else - { - prev->next_ = temp->next_; - ACE_OS::t_close (temp->handle_); - this->current_count_--; - this->free (temp); - return 0; - } -} - -ACE_HANDLE -ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap, - int reuse_addr, - int oflag, - struct t_info *info, - int qlen, - const char dev[]) -{ - ACE_TRACE ("ACE_TLI_Acceptor::open"); - ACE_HANDLE res = 0; - int one = 1; - - this->disp_ = 0; - - ACE_ALLOCATOR_RETURN (this->device_, - ACE_OS::strdup (dev), - ACE_INVALID_HANDLE); - if (this->ACE_TLI::open (dev, - oflag, - info) == ACE_INVALID_HANDLE) - res = ACE_INVALID_HANDLE; -#if !defined (ACE_HAS_FORE_ATM_XTI) - // Reusing the address causes problems with FORE's API. The issue - // may be that t_optmgmt isn't fully supported by FORE. t_errno is - // TBADOPT after the t_optmgmt call so maybe options are configured - // differently for XTI than for TLI (at least for FORE's - // implementation - XTI is supposed to be a superset of TLI). - else if (reuse_addr - && this->set_option (SOL_SOCKET, - SO_REUSEADDR, - &one, - sizeof one) == -1) - res = ACE_INVALID_HANDLE; -#endif /* ACE_HAS_FORE_ATM_XTI */ - else if ((this->disp_ = - (struct t_discon *) ACE_OS::t_alloc (this->get_handle (), - T_DIS, - T_ALL)) == 0) - res = ACE_INVALID_HANDLE; - else - { - struct t_bind req; - -#if defined (ACE_HAS_FORE_ATM_XTI) - // Not sure why but FORE's t_bind call won't work if t_bind.qlen - // != 1 Adjust the backlog accordingly. - this->backlog_ = 1; - req.qlen = 1; -#else - this->backlog_ = qlen; - req.qlen = qlen; -#endif /* ACE_HAS_FORE_ATM_XTI */ - req.addr.maxlen = remote_sap.get_size (); - - if (remote_sap == ACE_Addr::sap_any) - // Note that if addr.len == 0 then ACE_TLI selects the port - // number. - req.addr.len = 0; - else - { - req.addr.buf = (char *) remote_sap.get_addr (); - req.addr.len = remote_sap.get_size (); - } - - res = (ACE_HANDLE) ACE_OS::t_bind (this->get_handle (), - &req, - 0); - if (res != ACE_INVALID_HANDLE) - { - ACE_NEW_RETURN (this->queue_, - ACE_TLI_Request_Queue, - ACE_INVALID_HANDLE); - res = this->queue_->open (this->get_handle (), - this->backlog_); - } - } - if (res == ACE_INVALID_HANDLE) - this->close (); - return this->get_handle (); -} - -ACE_TLI_Acceptor::ACE_TLI_Acceptor (const ACE_Addr &remote_sap, - int reuse_addr, - int oflag, - struct t_info *info, - int back, - const char dev[]) -{ - ACE_TRACE ("ACE_TLI_Acceptor::ACE_TLI_Acceptor"); - if (this->open (remote_sap, - reuse_addr, - oflag, - info, - back, - dev) == ACE_INVALID_HANDLE) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_TLI_Acceptor::ACE_TLI_Acceptor"))); -} - -int -ACE_TLI_Acceptor::close (void) -{ - ACE_TRACE ("ACE_TLI_Acceptor::close"); - if (this->device_ != 0) - { - if (this->queue_ != 0) - { - this->queue_->close (); - delete this->queue_; - } - - ACE_OS::t_free ((char *) this->disp_, T_DIS); - ACE_OS::free (ACE_MALLOC_T (this->device_)); - this->disp_ = 0; - this->device_ = 0; - return this->ACE_TLI::close (); - } - return 0; -} - -// Perform the logic required to handle the arrival of asynchronous -// events while we are trying to accept a new connection request. - -int -ACE_TLI_Acceptor::handle_async_event (int restart, int rwf) -{ - ACE_TRACE ("ACE_TLI_Acceptor::handle_async_event"); - int event = this->look (); - - switch (event) - { - case T_DISCONNECT: - this->rcvdis (this->disp_); - this->queue_->remove (this->disp_->sequence); - break; - case T_LISTEN: - this->queue_->enqueue (this->device_, - restart, - rwf); - break; - default: - return -1; - } - return 0; -} - -int -ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle, - int rwf, - netbuf *udata, - netbuf *opt) -{ - ACE_TRACE ("ACE_TLI_Acceptor::accept"); - ACE_UNUSED_ARG (reset_new_handle); - - ACE_TLI_Request *req = 0; - int res = 0; - if (timeout != 0 - && ACE::handle_timed_accept (this->get_handle (), - timeout, - restart) == -1) - return -1; - else if (this->queue_->is_empty ()) - { - req = this->queue_->alloc (); - - do - res = ACE_OS::t_listen (this->get_handle (), - req->callp_); - while (res == -1 - && restart - && errno == EINTR); - - if (res != -1) - { - req->handle_ = open_new_endpoint (this->get_handle (), - this->device_, - req->callp_, - rwf -#if defined (ACE_WIN32) - , remote_addr -#endif /* ACE_WIN32 */ - ); - if (req->handle_ == ACE_INVALID_HANDLE) - res = -1; - else - res = 0; - } - } - else - res = this->queue_->dequeue (req); - - if (udata != 0) - ACE_OS::memcpy ((void *) &req->callp_->udata, - (void *) udata, - sizeof *udata); - if (opt != 0) - ACE_OS::memcpy ((void *) &req->callp_->opt, - (void *) opt, - sizeof *opt); - - while (res != -1) - { - res = ACE_OS::t_accept (this->get_handle (), - req->handle_, - req->callp_); - if (res != -1) - break; // Got one! - else if (t_errno == TLOOK) - res = this->handle_async_event (restart, rwf); - else if (restart && t_errno == TSYSERR && errno == EINTR) - res = 0; - } - - if (res == -1) - { - if (errno != EWOULDBLOCK) - { - new_tli_sap.set_handle (ACE_INVALID_HANDLE); - if (req->handle_ != ACE_INVALID_HANDLE) - ACE_OS::t_close (req->handle_); - } - } - else - { - new_tli_sap.set_handle (req->handle_); - - if (remote_addr != 0) - remote_addr->set_addr ((void *) req->callp_->addr.buf, - req->callp_->addr.len); - } - - req->handle_ = ACE_INVALID_HANDLE; - this->queue_->free (req); - new_tli_sap.set_rwflag (rwf); - return new_tli_sap.get_handle () == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TLI */ diff --git a/ace/TLI_Acceptor.h b/ace/TLI_Acceptor.h deleted file mode 100644 index e7855b83c8f..00000000000 --- a/ace/TLI_Acceptor.h +++ /dev/null @@ -1,123 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file TLI_Acceptor.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_TLI_ACCEPTOR_H -#define ACE_TLI_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include "ace/TLI.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/TLI_Stream.h" -#include "ace/Default_Constants.h" - -#if defined (ACE_HAS_TLI) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward reference... -class ACE_TLI_Request_Queue; -class ACE_Time_Value; - -/** - * @class ACE_TLI_Acceptor - * - * @brief Defines the member functions for ACE_TLI_Acceptor abstraction. - * - * This class implements the algorithm described in Steve Rago's - * book on System V UNIX network programming. It basically - * makes TLI look like the C++ SOCK_SAP socket wrappers with - * respect to establishing passive-mode listener endpoints. - */ -class ACE_Export ACE_TLI_Acceptor : public ACE_TLI -{ -public: - friend class ACE_Request_Queue; - - // = Initialization and termination methods. - /// Default constructor. - ACE_TLI_Acceptor (void); - - /// Initiate a passive mode socket. - ACE_TLI_Acceptor (const ACE_Addr &remote_sap, - int reuse_addr = 0, - int oflag = O_RDWR, - struct t_info *info = 0, - int backlog = ACE_DEFAULT_BACKLOG, - const char device[] = ACE_TLI_TCP_DEVICE); - - /// Initiate a passive mode socket. - ACE_HANDLE open (const ACE_Addr &remote_sap, - int reuse_addr = 0, - int oflag = O_RDWR, - struct t_info *info = 0, - int backlog = ACE_DEFAULT_BACKLOG, - const char device[] = ACE_TLI_TCP_DEVICE); - - /// Close down the acceptor and release resources. - int close (void); - - // = Passive connection acceptance method. - - /** - * Accept a new data transfer connection. A of 0 means - * block forever, a of {0, 0} means poll. == 1 - * means "restart if interrupted." - */ - int accept (ACE_TLI_Stream &new_tli_sap, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0, - int rwflag = 1, - netbuf *udata = 0, - netbuf *opt = 0); - - // = Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_TLI_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Network "device" we are using. - const char *device_; - - /// Number of connections to queue. - int backlog_; - - /// Are we using "tirdwr" mod? - int rwflag_; - - /// Handle TLI accept insanity... - int handle_async_event (int restart, int rwflag); - - /// Used for queueing up pending requests. - ACE_TLI_Request_Queue *queue_; - - /// Used for handling disconnects - struct t_discon *disp_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TLI */ -#include /**/ "ace/post.h" -#endif /* ACE_TLI_ACCEPTOR_H */ diff --git a/ace/TLI_Connector.cpp b/ace/TLI_Connector.cpp deleted file mode 100644 index 9a11d2c880b..00000000000 --- a/ace/TLI_Connector.cpp +++ /dev/null @@ -1,256 +0,0 @@ -// $Id$ - -#include "ace/TLI_Connector.h" - -ACE_RCSID(ace, TLI_Connector, "$Id$") - -#if defined (ACE_HAS_TLI) - -#if !defined (__ACE_INLINE__) -#include "ace/TLI_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Handle_Set.h" -#include "ace/ACE.h" -#include "ace/OS_NS_string.h" -#include "ace/Time_Value.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Connector) - -void -ACE_TLI_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_TLI_Connector::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_TLI_Connector::ACE_TLI_Connector (void) -{ - ACE_TRACE ("ACE_TLI_Connector::ACE_TLI_Connector"); -} - -// Connect the to the , waiting up to -// amount of time if necessary. It's amazing how -// complicated this is to do in TLI... - -int -ACE_TLI_Connector::connect (ACE_TLI_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int /* perms */, - const char device[], - struct t_info *info, - int rwf, - struct netbuf *udata, - struct netbuf *opt) -{ - ACE_TRACE ("ACE_TLI_Connector::connect"); - int result = 0; - - // Only open a new endpoint if we don't already have a valid handle. - - if (new_stream.get_handle () == ACE_INVALID_HANDLE - && new_stream.open (device, flags, info) == ACE_INVALID_HANDLE) - return -1; - - if (local_sap != ACE_Addr::sap_any) - { - // Bind the local endpoint to a specific addr. - - struct t_bind *localaddr; - - localaddr = (struct t_bind *) - ACE_OS::t_alloc (new_stream.get_handle (), T_BIND, T_ADDR); - - if (localaddr == 0) - result = -1; - else - { - int one = 1; -#if !defined (ACE_HAS_FORE_ATM_XTI) - // Reusing the address causes problems with FORE's API. The - // issue may be that t_optmgmt isn't fully supported by - // FORE. t_errno is TBADOPT after the t_optmgmt call so - // maybe options are configured differently for XTI than for - // TLI (at least for FORE's implementation - XTI is supposed - // to be a superset of TLI). - if (reuse_addr - && new_stream.set_option (SOL_SOCKET, - SO_REUSEADDR, - &one, - sizeof one) == -1) - result = -1; - else -#endif /* ACE_HAS_FORE_ATM_XTI */ - { - void *addr_buf = local_sap.get_addr (); - localaddr->addr.len = local_sap.get_size (); - ACE_OS::memcpy(localaddr->addr.buf, - addr_buf, - localaddr->addr.len); - - if (ACE_OS::t_bind (new_stream.get_handle (), - localaddr, - localaddr) == -1) - result = -1; - - ACE_OS::t_free ((char *) localaddr, - T_BIND); - } - } - - if (result == -1) - { - new_stream.close (); - return -1; - } - } - // Let TLI select the local endpoint addr. - else if (ACE_OS::t_bind (new_stream.get_handle (), 0, 0) == -1) - return -1; - - struct t_call *callptr = 0; - - callptr = (struct t_call *) - ACE_OS::t_alloc (new_stream.get_handle (), T_CALL, T_ADDR); - - if (callptr == 0) - { - new_stream.close (); - return -1; - } - - void *addr_buf = remote_sap.get_addr (); - callptr->addr.len = remote_sap.get_size (); - ACE_OS::memcpy (callptr->addr.buf, - addr_buf, - callptr->addr.len); - //callptr->addr.buf = (char *) remote_sap.get_addr (); - - if (udata != 0) - ACE_OS::memcpy ((void *) &callptr->udata, (void *) udata, sizeof *udata); - if (opt != 0) - ACE_OS::memcpy ((void *) &callptr->opt, (void *) opt, sizeof *opt); - - // Connect to remote endpoint. -#if defined (ACE_HAS_FORE_ATM_XTI) - // FORE's XTI/ATM driver has problems with ioctl/fcntl calls so (at least - // for now) always have blocking calls. - timeout = 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ - - if (timeout != 0) // Enable non-blocking, if required. - { - if (new_stream.enable (ACE_NONBLOCK) == -1) - result = -1; - - // Do a non-blocking connect. - if (ACE_OS::t_connect (new_stream.get_handle (), callptr, 0) == -1) - { - result = -1; - - // Check to see if we simply haven't connected yet on a - // non-blocking handle or whether there's really an error. - if (t_errno == TNODATA) - { - if (timeout->sec () == 0 && timeout->usec () == 0) - errno = EWOULDBLOCK; - else - result = this->complete (new_stream, 0, timeout); - } - else if (t_errno == TLOOK && new_stream.look () == T_DISCONNECT) - new_stream.rcvdis (); - } - } - // Do a blocking connect to the server. - else if (ACE_OS::t_connect (new_stream.get_handle (), callptr, 0) == -1) - result = -1; - - if (result != -1) - { - new_stream.set_rwflag (rwf); -#if defined (I_PUSH) && !defined (ACE_HAS_FORE_ATM_XTI) - if (new_stream.get_rwflag ()) - result = ACE_OS::ioctl (new_stream.get_handle (), - I_PUSH, - const_cast ("tirdwr")); -#endif /* I_PUSH */ - } - else if (!(errno == EWOULDBLOCK || errno == ETIME)) - { - // If things have gone wrong, close down and return an error. - new_stream.close (); - new_stream.set_handle (ACE_INVALID_HANDLE); - } - - if (ACE_OS::t_free ((char *) callptr, T_CALL) == -1) - return -1; - return result; -} - -// Try to complete a non-blocking connection. - -int -ACE_TLI_Connector::complete (ACE_TLI_Stream &new_stream, - ACE_Addr *remote_sap, - ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_TLI_Connector::complete"); -#if defined (ACE_WIN32) - if (WaitForSingleObject (new_stream.get_handle(), tv->msec()) == WAIT_OBJECT_0) - { - if (ACE_OS::t_look (new_stream.get_handle()) == T_CONNECT) - return t_rcvconnect (new_stream.get_handle(), 0); - else - return -1; - } - else - return -1; -#else - ACE_HANDLE h = ACE::handle_timed_complete (new_stream.get_handle (), - tv, - 1); - if (h == ACE_INVALID_HANDLE) - { - new_stream.close (); - return -1; - } - else // We've successfully connected! - { - if (remote_sap != 0) - { -#if defined (ACE_HAS_XTI) || defined (ACE_HAS_SVR4_TLI) - struct netbuf name; - - name.maxlen = remote_sap->get_size (); - name.buf = (char *) remote_sap->get_addr (); - - if (ACE_OS::t_getname (new_stream.get_handle (), - &name, - REMOTENAME) == -1) -#else /* SunOS4 */ - if (0) -#endif /* ACE_HAS_XTI || ACE_HAS_SVR4_TLI */ - { - new_stream.close (); - return -1; - } - } - - // Start out with non-blocking disabled on the . - new_stream.disable (ACE_NONBLOCK); - - return 0; - } -#endif /* ACE_WIN32 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TLI */ diff --git a/ace/TLI_Connector.h b/ace/TLI_Connector.h deleted file mode 100644 index d8e8f381bfb..00000000000 --- a/ace/TLI_Connector.h +++ /dev/null @@ -1,130 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file TLI_Connector.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_TLI_CONNECTOR_H -#define ACE_TLI_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/TLI_Stream.h" -#include "ace/Log_Msg.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_TLI) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_TLI_Connector - * - * @brief Defines an active connection factory for the ACE_TLI C++ - * wrappers. - */ -class ACE_Export ACE_TLI_Connector -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_TLI_Connector (void); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made . The - * is the value of local address to bind to. If it's - * the default value of then the user is letting - * the OS do the binding. If == 1 then the - * is reused, even if it hasn't been cleanedup yet. - */ - ACE_TLI_Connector (ACE_TLI_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0, - const char device[] = ACE_TLI_TCP_DEVICE, - struct t_info *info = 0, - int rw_flag = 1, - struct netbuf *udata = 0, - struct netbuf *opt = 0); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made . The - * is the value of local address to bind to. If it's - * the default value of then the user is letting - * the OS do the binding. If == 1 then the - * is reused, even if it hasn't been cleanedup yet. - */ - int connect (ACE_TLI_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0, - const char device[] = ACE_TLI_TCP_DEVICE, - struct t_info *info = 0, - int rw_flag = 1, - struct netbuf *udata = 0, - struct netbuf *opt = 0); - - /** - * Try to complete a non-blocking connection. - * If connection completion is successful then contains - * the connected ACE_SOCK_Stream. If is non-NULL then it - * will contain the address of the connected peer. - */ - int complete (ACE_TLI_Stream &new_stream, - ACE_Addr *remote_sap, - ACE_Time_Value *tv); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - // = Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_TLI_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/TLI_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_TLI */ -#include /**/ "ace/post.h" -#endif /* ACE_TLI_CONNECTOR_H */ diff --git a/ace/TLI_Connector.inl b/ace/TLI_Connector.inl deleted file mode 100644 index f2a29f122c3..00000000000 --- a/ace/TLI_Connector.inl +++ /dev/null @@ -1,49 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_TLI_Connector::ACE_TLI_Connector (ACE_TLI_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms, - const char device[], - struct t_info *info, - int rw_flag, - struct netbuf *udata, - struct netbuf *opt) -{ - ACE_TRACE ("ACE_TLI_Connector::ACE_TLI_Connector"); - if (this->connect (new_stream, - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms, - device, - info, - rw_flag, - udata, - opt) == -1 - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_TLI_Stream::ACE_TLI_Stream"))); -} - -ACE_INLINE -int -ACE_TLI_Connector::reset_new_handle (ACE_HANDLE handle) -{ - ACE_UNUSED_ARG (handle); - // Nothing to do here since the handle is not a socket - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TLI_Stream.cpp b/ace/TLI_Stream.cpp deleted file mode 100644 index 7b7e41fa42d..00000000000 --- a/ace/TLI_Stream.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// $Id$ - -/* Defines the member functions for the base class of the ACE_TLI_Stream - abstraction. */ - -#include "ace/TLI_Stream.h" -#include "ace/ACE.h" -#include "ace/OS_NS_unistd.h" - -ACE_RCSID(ace, TLI_Stream, "$Id$") - -#if defined (ACE_HAS_TLI) - -#if !defined (__ACE_INLINE__) -#include "ace/TLI_Stream.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Stream) - -void -ACE_TLI_Stream::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_TLI_Stream::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_TLI_Stream::ACE_TLI_Stream (void) - : rwflag_ (0) -{ - ACE_TRACE ("ACE_TLI_Stream::ACE_TLI_Stream"); -} - -int -ACE_TLI_Stream::get_remote_addr (ACE_Addr &sa) const -{ - ACE_TRACE ("ACE_TLI_Stream::get_remote_addr"); - - struct netbuf name; - name.maxlen = sa.get_size (); - name.buf = (char *) sa.get_addr (); - - if (ACE_OS::t_getname (this->get_handle (), &name, REMOTENAME) == -1) - return -1; - else - return 0; -} - -// Send a release and then await the release from the other side. - -int -ACE_TLI_Stream::active_close (void) -{ - ACE_TRACE ("ACE_TLI_Stream::active_close"); - char buf; - - if (this->sndrel () == -1) - return -1; - else if (this->recv (&buf, sizeof buf) == -1) - { - if (t_errno == TLOOK && this->look () == T_ORDREL) - { - if (this->rcvrel () == -1) - return -1; - } - else - return -1; - } - - return this->close (); -} - -// Acknowledge the release from the other side and then send the -// release to the other side. - -int -ACE_TLI_Stream::passive_close (void) -{ - ACE_TRACE ("ACE_TLI_Stream::passive_close"); - - if (this->rcvrel () == -1) - return -1; - else if (this->sndrel () == -1) - return -1; - - return this->close (); -} - -int -ACE_TLI_Stream::close (void) -{ - ACE_TRACE ("ACE_TLI_Stream::close"); - - ACE_HANDLE fd = this->get_handle (); - - this->set_handle (ACE_INVALID_HANDLE); - -#if !defined (ACE_WIN32) - if (this->rwflag_) - return ACE_OS::close (fd); - else -#endif /* ACE_WIN32 */ - return ACE_OS::t_close (fd); -} - -ssize_t -ACE_TLI_Stream::send (const void *buf, - size_t n, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_TLI_Stream::send"); - return ACE::send (this->get_handle (), - buf, - n, - timeout); -} - -ssize_t -ACE_TLI_Stream::send (const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_TLI_Stream::send"); - return ACE::t_snd (this->get_handle (), - buf, - n, - flags, - timeout); -} - -ssize_t -ACE_TLI_Stream::recv (void *buf, - size_t n, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_TLI_Stream::recv"); - return ACE::recv (this->get_handle (), - buf, - n, - timeout); -} - -ssize_t -ACE_TLI_Stream::recv (void *buf, - size_t n, - int *flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_TLI_Stream::recv"); - int f = 0; - - if (flags == 0) - flags = &f; - - return ACE::t_rcv (this->get_handle (), - buf, - n, - flags, - timeout); -} - -ssize_t -ACE_TLI_Stream::send_n (const void *buf, - size_t n, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_TLI_Stream::send_n"); - return ACE::send_n (this->get_handle (), - buf, - n, - timeout, - bytes_transferred); -} - -ssize_t -ACE_TLI_Stream::send_n (const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_TLI_Stream::send_n"); - - return ACE::t_snd_n (this->get_handle (), - buf, - n, - flags, - timeout, - bytes_transferred); -} - -ssize_t -ACE_TLI_Stream::recv_n (void *buf, - size_t n, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_TLI_Stream::recv_n"); - return ACE::recv_n (this->get_handle (), - buf, - n, - timeout, - bytes_transferred); -} - -ssize_t -ACE_TLI_Stream::recv_n (void *buf, - size_t n, - int *flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_TLI_Stream::recv_n"); - - return ACE::t_rcv_n (this->get_handle (), - buf, - n, - flags, - timeout, - bytes_transferred); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TLI */ diff --git a/ace/TLI_Stream.h b/ace/TLI_Stream.h deleted file mode 100644 index fe54f76f30b..00000000000 --- a/ace/TLI_Stream.h +++ /dev/null @@ -1,141 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file TLI_Stream.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_TLI_STREAM_H -#define ACE_TLI_STREAM_H -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/TLI.h" - -#include "ace/INET_Addr.h" - -#if defined (ACE_HAS_TLI) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_TLI_Stream - * - * @brief Defines the member functions for ACE_TLI_Stream abstraction. - */ -class ACE_Export ACE_TLI_Stream : public ACE_TLI -{ -public: - friend class ACE_TLI_Acceptor; - friend class ACE_TLI_Connector; - - // = Initialization and termination methods. - /// Default constructor. - ACE_TLI_Stream (void); - - // = TLI-specific shutdown operations. - /// Close down and release resources. - int close (void); - - /// Send a release and then await the release from the other side. - int active_close (void); - - /// Acknowledge the release from the other side and then send the - /// release to the other side. - int passive_close (void); - - /// Return address of remotely connected peer. - int get_remote_addr (ACE_Addr &) const; - - // = timod bindings - /// Send an n byte buffer to the connected socket (uses t_snd(3)). - ssize_t send (const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout = 0) const; - - /// Recv an n byte buffer from the connected socket (uses t_rcv(3)). - ssize_t recv (void *buf, - size_t n, - int *flags, - const ACE_Time_Value *timeout = 0) const; - - /// Send exactly n bytes to the connected socket (uses t_snd(3)). - ssize_t send_n (const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Recv exactly n bytes from the connected socket (uses t_rcv(3)). - ssize_t recv_n (void *buf, - size_t n, - int *flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - // = tirdwr bindings - /// Send an n byte buffer to the connected socket (uses write(2)). - ssize_t send (const void *buf, - size_t n, - const ACE_Time_Value *timeout = 0) const; - - /// Recv an n byte buffer from the connected socket (uses read(2)). - ssize_t recv (void *buf, - size_t n, - const ACE_Time_Value *timeout = 0) const; - - /// Send n bytes, keep trying until n are sent (uses write(2)). - ssize_t send_n (const void *buf, - size_t n, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - /// Recv n bytes, keep trying until n are received (uses read (2)). - ssize_t recv_n (void *buf, - size_t n, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - - // = Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Indicates whether the tirdwr module should be pushed - int rwflag_; - - /// Get rwflag - int get_rwflag (void) const; - - /// Set rwflag - void set_rwflag (int value); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/TLI_Stream.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_TLI */ -#include /**/ "ace/post.h" -#endif /* ACE_TLI_STREAM_H */ diff --git a/ace/TLI_Stream.inl b/ace/TLI_Stream.inl deleted file mode 100644 index 8ef7265f8cd..00000000000 --- a/ace/TLI_Stream.inl +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/TLI_Stream.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -void -ACE_TLI_Stream::set_rwflag (int value) -{ - ACE_TRACE ("ACE_TLI_Stream::set_rwflag"); - this->rwflag_ = value; -} - -ACE_INLINE -int -ACE_TLI_Stream::get_rwflag (void) const -{ - ACE_TRACE ("ACE_TLI_Stream::get_rwflag"); - return this->rwflag_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TP_Reactor.cpp b/ace/TP_Reactor.cpp deleted file mode 100644 index 1207cd7c93b..00000000000 --- a/ace/TP_Reactor.cpp +++ /dev/null @@ -1,732 +0,0 @@ -// $Id$ - -#include "ace/TP_Reactor.h" -#include "ace/Thread.h" -#include "ace/Timer_Queue.h" -#include "ace/Sig_Handler.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_time.h" - -#if !defined (__ACE_INLINE__) -#include "ace/TP_Reactor.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - TP_Reactor, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_TP_Reactor) - -int -ACE_TP_Token_Guard::acquire_read_token (ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_TP_Token_Guard::acquire_read_token"); - - // The order of these events is very subtle, modify with care. - - // Try to grab the lock. If someone if already there, don't wake - // them up, just queue up in the thread pool. - int result = 0; - - if (max_wait_time) - { - ACE_Time_Value tv = ACE_OS::gettimeofday (); - tv += *max_wait_time; - - ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook, - 0, - &tv)); - } - else - { - ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook)); - } - - // Check for timeouts and errors. - if (result == -1) - { - if (errno == ETIME) - return 0; - else - return -1; - } - - // We got the token and so let us mark ourselves as owner - this->owner_ = 1; - - return result; -} - -int -ACE_TP_Token_Guard::acquire_token (ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_TP_Token_Guard::acquire_token"); - - // Try to grab the lock. If someone if already there, don't wake - // them up, just queue up in the thread pool. - int result = 0; - - if (max_wait_time) - { - ACE_Time_Value tv = ACE_OS::gettimeofday (); - tv += *max_wait_time; - - ACE_MT (result = this->token_.acquire (0, - 0, - &tv)); - } - else - { - ACE_MT (result = this->token_.acquire ()); - } - - // Check for timeouts and errors. - if (result == -1) - { - if (errno == ETIME) - return 0; - else - return -1; - } - - // We got the token and so let us mark ourselves as owner - this->owner_ = 1; - - return result; -} - - -ACE_TP_Reactor::ACE_TP_Reactor (ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int mask_signals, - int s_queue) - : ACE_Select_Reactor (sh, tq, 0, 0, mask_signals, s_queue) -{ - ACE_TRACE ("ACE_TP_Reactor::ACE_TP_Reactor"); - this->supress_notify_renew (1); -} - -ACE_TP_Reactor::ACE_TP_Reactor (size_t max_number_of_handles, - int restart, - ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int mask_signals, - int s_queue) - : ACE_Select_Reactor (max_number_of_handles, restart, sh, tq, 0, 0, mask_signals, s_queue) -{ - ACE_TRACE ("ACE_TP_Reactor::ACE_TP_Reactor"); - this->supress_notify_renew (1); -} - -int -ACE_TP_Reactor::owner (ACE_thread_t, ACE_thread_t *o_id) -{ - ACE_TRACE ("ACE_TP_Reactor::owner"); - if (o_id) - *o_id = ACE_Thread::self (); - - return 0; -} - -int -ACE_TP_Reactor::owner (ACE_thread_t *t_id) -{ - ACE_TRACE ("ACE_TP_Reactor::owner"); - *t_id = ACE_Thread::self (); - - return 0; -} - -int -ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_TP_Reactor::handle_events"); - - // Stash the current time -- the destructor of this object will - // automatically compute how much time elapsed since this method was - // called. - ACE_Countdown_Time countdown (max_wait_time); - - // - // The order of these events is very subtle, modify with care. - // - - // Instantiate the token guard which will try grabbing the token for - // this thread. - ACE_TP_Token_Guard guard (this->token_); - - int const result = guard.acquire_read_token (max_wait_time); - - // If the guard is NOT the owner just return the retval - if (!guard.is_owner ()) - return result; - - // After getting the lock just just for deactivation.. - if (this->deactivated_) - return -1; - - // Update the countdown to reflect time waiting for the token. - countdown.update (); - - return this->dispatch_i (max_wait_time, - guard); -} - -/* - * Hook to specialize the register_handler method. - */ -//@@ REACTOR_SPL_COMMENT_HOOK_START -int -ACE_TP_Reactor::register_handler (int, - ACE_Event_Handler *, - ACE_Sig_Action *, - ACE_Event_Handler **, - ACE_Sig_Action *) -{ - ACE_NOTSUP_RETURN (-1); -} -//@@ REACTOR_SPL_COMMENT_HOOK_END - -int -ACE_TP_Reactor::register_handler (const ACE_Sig_Set &, - ACE_Event_Handler *, - ACE_Sig_Action *) -{ - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_TP_Reactor::register_handler (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - return ACE_Select_Reactor::register_handler (eh, - mask); -} - -int -ACE_TP_Reactor::register_handler (ACE_HANDLE handle, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - return ACE_Select_Reactor::register_handler (handle, - eh, - mask); -} - -#if defined (ACE_WIN32) - -int -ACE_TP_Reactor::register_handler (ACE_Event_Handler *eh, - ACE_HANDLE h) -{ - return ACE_Select_Reactor::register_handler (eh, - h); -} - -#endif /* ACE_WIN32 */ -int -ACE_TP_Reactor::register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - return ACE_Select_Reactor::register_handler (event_handle, - io_handle, - event_handler, - mask); -} - -int -ACE_TP_Reactor::register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - return ACE_Select_Reactor::register_handler (handles, - eh, - mask); -} - -int -ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, - ACE_TP_Token_Guard &guard) -{ - int event_count = - this->get_event_for_dispatching (max_wait_time); - - int result = 0; - - // Note: We are passing the around, to have record of - // how many events still need processing. May be this could be - // useful in future. - - // Dispatch signals - if (event_count == -1) - { - // Looks like we dont do any upcalls in dispatch signals. If at - // a later point of time, we decide to handle signals we have to - // release the lock before we make any upcalls.. What is here - // now is not the right thing... - // - // @@ We need to do better.. - return this->handle_signals (event_count, - guard); - } - - // If there are no signals and if we had received a proper - // event_count then first look at dispatching timeouts. We need to - // handle timers early since they may have higher latency - // constraints than I/O handlers. Ideally, the order of dispatching - // should be a strategy... - - // NOTE: The event count does not have the number of timers that - // needs dispatching. But we are still passing this along. We dont - // need to do that. In the future we *may* have the timers also - // returned through the . Just passing that along for - // that day. - result = this->handle_timer_events (event_count, - guard); - - if (result > 0) - return result; - - // Else just go ahead fall through for further handling. - - if (event_count > 0) - { - // Next dispatch the notification handlers (if there are any to - // dispatch). These are required to handle multiple-threads - // that are trying to update the . - result = this->handle_notify_events (event_count, - guard); - - if (result > 0) - return result; - - // Else just fall through for further handling - } - - if (event_count > 0) - { - // Handle socket events - return this->handle_socket_events (event_count, - guard); - } - - return 0; -} - -int -ACE_TP_Reactor::handle_signals (int & /*event_count*/, - ACE_TP_Token_Guard & /*guard*/) -{ - ACE_TRACE ("ACE_TP_Reactor::handle_signals"); - - /* - * - * THIS METHOD SEEMS BROKEN - * - * - */ - // First check for interrupts. - // Bail out -- we got here since are persistent if not - * acted upon immediately. It works by remembering the event handler - * that just got activated, releasing the internal lock (so that some - * other thread can start waiting in the event loop) and then - * dispatching the event handler outside the context of the Reactor - * lock. After the event handler has been dispatched the event handler is - * resumed again. Don't call remove_handler() from the handle_x methods, - * instead return -1. - * - * This Reactor is best suited for situations when the callbacks to - * event handlers can take arbitrarily long and/or a number of threads - * are available to run the event loops. Note that callback code in - * Event Handlers (e.g. Event_Handler::handle_input) does not have to - * be modified or made thread-safe for this Reactor. This is because - * an activated Event Handler is suspended in the Reactor before the - * upcall is made and resumed after the upcall completes. Therefore, - * one Event Handler cannot be called by multiple threads - * simultaneously. - */ -class ACE_Export ACE_TP_Reactor : public ACE_Select_Reactor -{ -public: - - // = Initialization and termination methods. - - /// Initialize ACE_TP_Reactor with the default size. - ACE_TP_Reactor (ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int mask_signals = 1, - int s_queue = ACE_Select_Reactor_Token::FIFO); - - /** - * Initialize the ACE_TP_Reactor to manage - * @a max_number_of_handles. If @a restart is non-0 then the - * ACE_Reactor's method will be restarted - * automatically when occurs. If or - * are non-0 they are used as the signal handler and - * timer queue, respectively. - */ - ACE_TP_Reactor (size_t max_number_of_handles, - int restart = 0, - ACE_Sig_Handler *sh = 0, - ACE_Timer_Queue *tq = 0, - int mask_signals = 1, - int s_queue = ACE_Select_Reactor_Token::FIFO); - - // = Event loop drivers. - - /** - * This event loop driver that blocks for before - * returning. It will return earlier if timer events, I/O events, - * or signal events occur. Note that can be 0, in - * which case this method blocks indefinitely until events occur. - * - * is decremented to reflect how much time this call - * took. For instance, if a time value of 3 seconds is passed to - * handle_events and an event occurs after 2 seconds, - * will equal 1 second. This can be used if an - * application wishes to handle events for some fixed amount of - * time. - * - * Returns the total number of ACE_Event_Handlers that were - * dispatched, 0 if the elapsed without dispatching - * any handlers, or -1 if something goes wrong. - */ - virtual int handle_events (ACE_Time_Value *max_wait_time = 0); - - virtual int handle_events (ACE_Time_Value &max_wait_time); - - /* - * @todo The following methods are not supported. Support for - * signals is not available in the TP_Reactor. These methods will be - * supported once signal handling is supported. - */ - virtual int register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0, - ACE_Event_Handler **old_sh = 0, - ACE_Sig_Action *old_disp = 0); - - virtual int register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0); - - /** - * The following template methods have been declared here to avoid - * some compilers complaining that we have hidden some of the other - * virtual functions. We need to override functions with signal - * handlers and return -1 since the TP_Reactor does not support - * signals. The definition of the following functions is just a - * side-effect. The actual definitions will just call the base class - * method. For detailed documentation of these methods please see - * Select_Reactor_T.h. - */ -//@{ - - virtual int register_handler (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - virtual int register_handler (ACE_HANDLE handle, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - -#if defined (ACE_WIN32) - - - - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_HANDLE event_handle = ACE_INVALID_HANDLE); - -#endif /* ACE_WIN32 */ - - virtual int register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - virtual int register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - //@} - - /// Does the reactor allow the application to resume the handle on - /// its own ie. can it pass on the control of handle resumption to - /// the application. The TP reactor has can allow applications to - /// resume handles. So return a positive value. - virtual int resumable_handler (void); - - /// Called from handle events - static void no_op_sleep_hook (void *); - - // = Any thread can perform a , override the owner() - // methods to avoid the overhead of setting the owner thread. - - /// Set the new owner of the thread and return the old owner. - virtual int owner (ACE_thread_t n_id, ACE_thread_t *o_id = 0); - - /// Return the current owner of the thread. - virtual int owner (ACE_thread_t *t_id); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Internal methods that do the actual work. - - /// Template method from the base class. - virtual void clear_dispatch_mask (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - /// Dispatch just 1 signal, timer, notification handlers - int dispatch_i (ACE_Time_Value *max_wait_time, - ACE_TP_Token_Guard &guard); - - /// Get the event that needs dispatching. It could be either a - /// signal, timer, notification handlers or return possibly 1 I/O - /// handler for dispatching. In the most common use case, this would - /// return 1 I/O handler for dispatching - int get_event_for_dispatching (ACE_Time_Value *max_wait_time); - - /// Method to handle signals - /// @note It is just busted at this point in time. - int handle_signals (int &event_count, - ACE_TP_Token_Guard &g); - - /// Handle timer events - int handle_timer_events (int &event_count, - ACE_TP_Token_Guard &g); - - /// Handle notify events - int handle_notify_events (int &event_count, - ACE_TP_Token_Guard &g); - - /// handle socket events - int handle_socket_events (int &event_count, - ACE_TP_Token_Guard &g); - - /// This method shouldn't get called. - virtual void notify_handle (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Handle_Set &, - ACE_Event_Handler *eh, - ACE_EH_PTMF callback); -private: - - /// Get the handle of the notify pipe from the ready set if there is - /// an event in the notify pipe. - ACE_HANDLE get_notify_handle (void); - - /// Get socket event dispatch information. - int get_socket_event_info (ACE_EH_Dispatch_Info &info); - - /// Notify the appropriate in the context of the - /// associated with that a particular event has occurred. - int dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info); - - /// Clear the @a handle from the read_set - void clear_handle_read_set (ACE_HANDLE handle); - - int post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info,int status); - -private: - /// Deny access since member-wise won't work... - ACE_TP_Reactor (const ACE_TP_Reactor &); - ACE_TP_Reactor &operator = (const ACE_TP_Reactor &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/TP_Reactor.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_TP_REACTOR_H */ diff --git a/ace/TP_Reactor.inl b/ace/TP_Reactor.inl deleted file mode 100644 index b4fa3c258d1..00000000000 --- a/ace/TP_Reactor.inl +++ /dev/null @@ -1,114 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/************************************************************************/ -// Methods for ACE_EH_Dispatch_Info -/************************************************************************/ - -ACE_INLINE -ACE_EH_Dispatch_Info::ACE_EH_Dispatch_Info (void) : - handle_ (ACE_INVALID_HANDLE), - event_handler_ (0), - mask_ (ACE_Event_Handler::NULL_MASK), - callback_ (0), - resume_flag_ (ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER), - reference_counting_required_ (false), - dispatch_ (false) -{ -} - -ACE_INLINE void -ACE_EH_Dispatch_Info::set (ACE_HANDLE handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - ACE_EH_PTMF callback) -{ - this->dispatch_ = true; - - this->handle_ = handle; - this->event_handler_ = event_handler; - this->mask_ = mask; - this->callback_ = callback; - this->resume_flag_ = event_handler->resume_handler (); - this->reference_counting_required_ = - (event_handler_->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED); -} - -ACE_INLINE bool -ACE_EH_Dispatch_Info::dispatch (void) const -{ - return this->dispatch_; -} - -/************************************************************************/ -// Methods for ACE_TP_Token_Guard -/************************************************************************/ - -ACE_INLINE -ACE_TP_Token_Guard::ACE_TP_Token_Guard (ACE_Select_Reactor_Token &token) - - : token_ (token), - owner_ (0) -{ -} - -ACE_INLINE -ACE_TP_Token_Guard::~ACE_TP_Token_Guard (void) -{ - if (this->owner_ == 1) - { - ACE_MT (this->token_.release ()); - this->owner_ = 0; - } -} - -ACE_INLINE void -ACE_TP_Token_Guard::release_token (void) -{ - if (this->owner_) - { - ACE_MT (this->token_.release ()); - - // We are not the owner anymore.. - this->owner_ = 0; - } -} - -ACE_INLINE int -ACE_TP_Token_Guard::is_owner (void) -{ - return this->owner_; -} - - -/************************************************************************/ -// Methods for ACE_TP_Reactor -/************************************************************************/ - -ACE_INLINE void -ACE_TP_Reactor::no_op_sleep_hook (void *) -{ -} - -ACE_INLINE void -ACE_TP_Reactor::clear_handle_read_set (ACE_HANDLE handle) -{ - this->ready_set_.wr_mask_.clr_bit (handle); - this->ready_set_.ex_mask_.clr_bit (handle); - this->ready_set_.rd_mask_.clr_bit (handle); -} - -ACE_INLINE void -ACE_TP_Reactor::clear_dispatch_mask (ACE_HANDLE , - ACE_Reactor_Mask ) -{ - this->ready_set_.rd_mask_.reset (); - this->ready_set_.wr_mask_.reset (); - this->ready_set_.ex_mask_.reset (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TSS_Adapter.cpp b/ace/TSS_Adapter.cpp deleted file mode 100644 index ddca0236d4f..00000000000 --- a/ace/TSS_Adapter.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file TSS_Adapter.cpp - * - * $Id$ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/TSS_Adapter.h" - -ACE_RCSID(ace, TSS_Adapter, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_TSS_Adapter::ACE_TSS_Adapter (void *object, ACE_THR_DEST f) - : ts_obj_ (object), - func_ (f) -{ - // ACE_TRACE ("ACE_TSS_Adapter::ACE_TSS_Adapter"); -} - -void -ACE_TSS_Adapter::cleanup (void) -{ - // ACE_TRACE ("ACE_TSS_Adapter::cleanup"); - (*this->func_)(this->ts_obj_); // call cleanup routine for ts_obj_ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -extern "C" void -ACE_TSS_C_cleanup (void *object) -{ - // ACE_TRACE ("ACE_TSS_C_cleanup"); - if (object != 0) - { - ACE_TSS_Adapter * const tss_adapter = (ACE_TSS_Adapter *) object; - // Perform cleanup on the real TS object. - tss_adapter->cleanup (); - // Delete the adapter object. - delete tss_adapter; - } -} diff --git a/ace/TSS_Adapter.h b/ace/TSS_Adapter.h deleted file mode 100644 index d4f20979b46..00000000000 --- a/ace/TSS_Adapter.h +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file TSS_Adapter.h - * - * $Id$ - * - * Originally in Synch.h - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_TSS_ADAPTER_H -#define ACE_TSS_ADAPTER_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_TSS_Adapter - * - * @brief This class encapsulates a TSS object and its associated - * C++ destructor function. It is used by the ACE_TSS... - * methods (in Synch_T.cpp) in order to allow an extern - * "C" cleanup routine to be used. Needed by the "frigging" - * MVS C++ compiler. - * - * Objects of this class are stored in thread specific - * storage. ts_obj_ points to the "real" object and - * func_ is a pointer to the C++ cleanup function for ts_obj_. - */ -class ACE_Export ACE_TSS_Adapter -{ -public: - /// Initialize the adapter. - ACE_TSS_Adapter (void *object, ACE_THR_DEST f); - - /// Perform the cleanup operation. - void cleanup (void); - -//private: - - /// The real TS object. - void * const ts_obj_; - - /// The real cleanup routine for ts_obj; - ACE_THR_DEST func_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_TSS_ADAPTER_H */ diff --git a/ace/TSS_T.cpp b/ace/TSS_T.cpp deleted file mode 100644 index aa2160c28c9..00000000000 --- a/ace/TSS_T.cpp +++ /dev/null @@ -1,733 +0,0 @@ -// $Id$ - -#ifndef ACE_TSS_T_CPP -#define ACE_TSS_T_CPP - -#include "ace/TSS_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/TSS_T.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Thread.h" -#include "ace/Log_Msg.h" -#include "ace/Guard_T.h" -#include "ace/OS_NS_stdio.h" - -#if defined (ACE_HAS_THR_C_DEST) -# include "ace/TSS_Adapter.h" -#endif /* ACE_HAS_THR_C_DEST */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_TSS) - -template -ACE_TSS::~ACE_TSS (void) -{ -#if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) - if (this->once_ != 0) - { - ACE_OS::thr_key_detach (this->key_, this); - ACE_OS::thr_keyfree (this->key_); - } -#else // defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) - // We own it, we need to delete it. - delete type_; -#endif // defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) -} - -template TYPE * -ACE_TSS::operator-> () const -{ - return this->ts_get (); -} - -template -ACE_TSS::operator TYPE *(void) const -{ - return this->ts_get (); -} - -template TYPE * -ACE_TSS::make_TSS_TYPE (void) const -{ - TYPE *temp = 0; - ACE_NEW_RETURN (temp, - TYPE, - 0); - return temp; -} - -template void -ACE_TSS::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_TSS::dump"); -#if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->keylock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("key_ = %d\n"), this->key_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nonce_ = %d"), this->once_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */ -#endif /* ACE_HAS_DUMP */ -} - -#if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) -#if defined (ACE_HAS_THR_C_DEST) -extern "C" void ACE_TSS_C_cleanup (void *); // defined in Synch.cpp -#endif /* ACE_HAS_THR_C_DEST */ - -template void -ACE_TSS::cleanup (void *ptr) -{ - // Cast this to the concrete TYPE * so the destructor gets called. - delete (TYPE *) ptr; -} - -template int -ACE_TSS::ts_init (void) -{ - // Ensure that we are serialized! - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->keylock_, 0); - - // Use the Double-Check pattern to make sure we only create the key - // once! - if (this->once_ == 0) - { - if (ACE_Thread::keycreate (&this->key_, -#if defined (ACE_HAS_THR_C_DEST) - &ACE_TSS_C_cleanup, -#else - &ACE_TSS::cleanup, -#endif /* ACE_HAS_THR_C_DEST */ - (void *) this) != 0) - return -1; // Major problems, this should *never* happen! - else - { - // This *must* come last to avoid race conditions! - this->once_ = 1; - return 0; - } - } - - return 0; -} - -template -ACE_TSS::ACE_TSS (TYPE *ts_obj) - : once_ (0), - key_ (ACE_OS::NULL_key) -{ - // If caller has passed us a non-NULL TYPE *, then we'll just use - // this to initialize the thread-specific value. Thus, subsequent - // calls to operator->() will return this value. This is useful - // since it enables us to assign objects to thread-specific data - // that have arbitrarily complex constructors! - - if (ts_obj != 0) - { - if (this->ts_init () == -1) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - // What should we do if this call fails?! -#if defined (ACE_HAS_WINCE) - ::MessageBox (0, - ACE_LIB_TEXT ("ACE_Thread::keycreate() failed!"), - ACE_LIB_TEXT ("ACE_TSS::ACE_TSS"), - MB_OK); -#else - ACE_OS::fprintf (stderr, - "ACE_Thread::keycreate() failed!"); -#endif /* ACE_HAS_WINCE */ - return; - } - -#if defined (ACE_HAS_THR_C_DEST) - // Encapsulate a ts_obj and it's destructor in an - // ACE_TSS_Adapter. - ACE_TSS_Adapter *tss_adapter; - ACE_NEW (tss_adapter, - ACE_TSS_Adapter ((void *) ts_obj, - ACE_TSS::cleanup)); - - // Put the adapter in thread specific storage - if (ACE_Thread::setspecific (this->key_, - (void *) tss_adapter) != 0) - { - delete tss_adapter; - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Thread::setspecific() failed!"))); - } -#else - if (ACE_Thread::setspecific (this->key_, - (void *) ts_obj) != 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Thread::setspecific() failed!"))); -#endif /* ACE_HAS_THR_C_DEST */ - } -} - -template TYPE * -ACE_TSS::ts_get (void) const -{ - if (this->once_ == 0) - { - // Create and initialize thread-specific ts_obj. - if (const_cast< ACE_TSS < TYPE > * >(this)->ts_init () == -1) - // Seriously wrong.. - return 0; - } - - TYPE *ts_obj = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - - // Get the adapter from thread-specific storage - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - if (ACE_Thread::getspecific (this->key_, &temp) == -1) - return 0; // This should not happen! - tss_adapter = static_cast (temp); - - // Check to see if this is the first time in for this thread. - if (tss_adapter == 0) -#else - // Get the ts_obj from thread-specific storage. Note that no locks - // are required here... - void *temp = ts_obj; // Need this temp to keep G++ from complaining. - if (ACE_Thread::getspecific (this->key_, &temp) == -1) - return 0; // This should not happen! - ts_obj = static_cast (temp); - - // Check to see if this is the first time in for this thread. - if (ts_obj == 0) -#endif /* ACE_HAS_THR_C_DEST */ - { - // Allocate memory off the heap and store it in a pointer in - // thread-specific storage (on the stack...). - - ts_obj = this->make_TSS_TYPE (); - - if (ts_obj == 0) - return 0; - -#if defined (ACE_HAS_THR_C_DEST) - // Encapsulate a ts_obj and it's destructor in an - // ACE_TSS_Adapter. - ACE_NEW_RETURN (tss_adapter, - ACE_TSS_Adapter (ts_obj, - ACE_TSS::cleanup), 0); - - // Put the adapter in thread specific storage - if (ACE_Thread::setspecific (this->key_, - (void *) tss_adapter) != 0) - { - delete tss_adapter; - delete ts_obj; - return 0; // Major problems, this should *never* happen! - } -#else - // Store the dynamically allocated pointer in thread-specific - // storage. - if (ACE_Thread::setspecific (this->key_, - (void *) ts_obj) != 0) - { - delete ts_obj; - return 0; // Major problems, this should *never* happen! - } -#endif /* ACE_HAS_THR_C_DEST */ - } - -#if defined (ACE_HAS_THR_C_DEST) - // Return the underlying ts object. - return static_cast (tss_adapter->ts_obj_); -#else - return ts_obj; -#endif /* ACE_HAS_THR_C_DEST */ -} - -// Get the thread-specific object for the key associated with this -// object. Returns 0 if the ts_obj has never been initialized, -// otherwise returns a pointer to the ts_obj. - -template TYPE * -ACE_TSS::ts_object (void) const -{ - // Ensure that we are serialized! - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->keylock_, 0); - - if (this->once_ == 0) // Return 0 if we've never been initialized. - return 0; - - TYPE *ts_obj = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - - // Get the tss adapter from thread-specific storage - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - if (ACE_Thread::getspecific (this->key_, &temp) == -1) - { - return 0; // This should not happen! - } - else - { - tss_adapter = static_cast (temp); - { - if (tss_adapter != 0) - // Extract the real TS object. - ts_obj = static_cast (tss_adapter->ts_obj_); - } - } -#else - void *temp = ts_obj; // Need this temp to keep G++ from complaining. - if (ACE_Thread::getspecific (this->key_, &temp) == -1) - return 0; // This should not happen! - ts_obj = static_cast (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - return ts_obj; -} - -template TYPE * -ACE_TSS::ts_object (TYPE *new_ts_obj) -{ - // Note, we shouldn't hold the keylock at this point because - // does it for us and we'll end up with deadlock - // otherwise... - if (this->once_ == 0) - { - // Create and initialize thread-specific ts_obj. - if (this->ts_init () == -1) - return 0; - } - - // Ensure that we are serialized! - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->keylock_, 0); - - TYPE *ts_obj = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - if (ACE_Thread::getspecific (this->key_, &temp) == -1) - return 0; // This should not happen! - tss_adapter = static_cast (temp); - - if (tss_adapter != 0) - { - ts_obj = static_cast (tss_adapter->ts_obj_); - delete tss_adapter; // don't need this anymore - } - - ACE_NEW_RETURN (tss_adapter, - ACE_TSS_Adapter ((void *) new_ts_obj, - ACE_TSS::cleanup), - 0); - - if (ACE_Thread::setspecific (this->key_, - (void *) tss_adapter) == -1) - { - delete tss_adapter; - return ts_obj; // This should not happen! - } -#else - void *temp = ts_obj; // Need this temp to keep G++ from complaining. - if (ACE_Thread::getspecific (this->key_, - &temp) == -1) - return 0; // This should not happen! - ts_obj = static_cast (temp); - if (ACE_Thread::setspecific (this->key_, - (void *) new_ts_obj) == -1) - return ts_obj; // This should not happen! -#endif /* ACE_HAS_THR_C_DEST */ - - return ts_obj; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_TSS_Guard) - -template void -ACE_TSS_Guard::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_TSS_Guard::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("key_ = %d"), this->key_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template void -ACE_TSS_Guard::init_key (void) -{ -// ACE_TRACE ("ACE_TSS_Guard::init_key"); - - this->key_ = ACE_OS::NULL_key; - ACE_Thread::keycreate (&this->key_, -#if defined (ACE_HAS_THR_C_DEST) - &ACE_TSS_C_cleanup, -#else - &ACE_TSS_Guard::cleanup, -#endif /* ACE_HAS_THR_C_DEST */ - (void *) this); -} - -template -ACE_TSS_Guard::ACE_TSS_Guard (void) -{ -// ACE_TRACE ("ACE_TSS_Guard::ACE_TSS_Guard"); - this->init_key (); -} - -template int -ACE_TSS_Guard::release (void) -{ -// ACE_TRACE ("ACE_TSS_Guard::release"); - - ACE_Guard *guard = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - tss_adapter = static_cast (temp); - guard = static_cast *> (tss_adapter->ts_obj_); -#else - void *temp = guard; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - guard = static_cast *> (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - return guard->release (); -} - -template int -ACE_TSS_Guard::remove (void) -{ -// ACE_TRACE ("ACE_TSS_Guard::remove"); - - ACE_Guard *guard = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - tss_adapter = static_cast (temp); - guard = static_cast *> (tss_adapter->ts_obj_); -#else - void *temp = guard; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - guard = static_cast *> (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - return guard->remove (); -} - -template -ACE_TSS_Guard::~ACE_TSS_Guard (void) -{ -// ACE_TRACE ("ACE_TSS_Guard::~ACE_TSS_Guard"); - - ACE_Guard *guard = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - tss_adapter = static_cast (temp); - guard = static_cast *> (tss_adapter->ts_obj_); -#else - void *temp = guard; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - guard = static_cast *> (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - // Make sure that this pointer is NULL when we shut down... - ACE_Thread::setspecific (this->key_, 0); - ACE_Thread::keyfree (this->key_); - // Destructor releases lock. - delete guard; -} - -template void -ACE_TSS_Guard::cleanup (void *ptr) -{ -// ACE_TRACE ("ACE_TSS_Guard::cleanup"); - - // Destructor releases lock. - delete (ACE_Guard *) ptr; -} - -template -ACE_TSS_Guard::ACE_TSS_Guard (ACE_LOCK &lock, int block) -{ -// ACE_TRACE ("ACE_TSS_Guard::ACE_TSS_Guard"); - - this->init_key (); - ACE_Guard *guard; - ACE_NEW (guard, - ACE_Guard (lock, - block)); - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter; - ACE_NEW (tss_adapter, - ACE_TSS_Adapter ((void *) guard, - ACE_TSS_Guard::cleanup)); - ACE_Thread::setspecific (this->key_, - (void *) tss_adapter); -#else - ACE_Thread::setspecific (this->key_, - (void *) guard); -#endif /* ACE_HAS_THR_C_DEST */ -} - -template int -ACE_TSS_Guard::acquire (void) -{ -// ACE_TRACE ("ACE_TSS_Guard::acquire"); - - ACE_Guard *guard = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - tss_adapter = static_cast (temp); - guard = static_cast *> (tss_adapter->ts_obj_); -#else - void *temp = guard; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - guard = static_cast *> (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - return guard->acquire (); -} - -template int -ACE_TSS_Guard::tryacquire (void) -{ -// ACE_TRACE ("ACE_TSS_Guard::tryacquire"); - - ACE_Guard *guard = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - tss_adapter = static_cast (temp); - guard = static_cast *> (tss_adapter->ts_obj_); -#else - void *temp = guard; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - guard = static_cast *> (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - return guard->tryacquire (); -} - -template -ACE_TSS_Write_Guard::ACE_TSS_Write_Guard (ACE_LOCK &lock, - int block) -{ -// ACE_TRACE ("ACE_TSS_Write_Guard::ACE_TSS_Write_Guard"); - - this->init_key (); - ACE_Guard *guard; - ACE_NEW (guard, - ACE_Write_Guard (lock, - block)); - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter; - ACE_NEW (tss_adapter, - ACE_TSS_Adapter ((void *) guard, - ACE_TSS_Guard::cleanup)); - ACE_Thread::setspecific (this->key_, - (void *) tss_adapter); -#else - ACE_Thread::setspecific (this->key_, - (void *) guard); -#endif /* ACE_HAS_THR_C_DEST */ -} - -template int -ACE_TSS_Write_Guard::acquire (void) -{ -// ACE_TRACE ("ACE_TSS_Write_Guard::acquire"); - - ACE_Write_Guard *guard = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - tss_adapter = static_cast (temp); - guard = static_cast *> (tss_adapter->ts_obj_); -#else - void *temp = guard; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - guard = static_cast *> (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - return guard->acquire_write (); -} - -template int -ACE_TSS_Write_Guard::tryacquire (void) -{ -// ACE_TRACE ("ACE_TSS_Write_Guard::tryacquire"); - - ACE_Write_Guard *guard = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - tss_adapter = static_cast (temp); - guard = static_cast *> (tss_adapter->ts_obj_); -#else - void *temp = guard; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, temp); - guard = static_cast *> (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - return guard->tryacquire_write (); -} - -template int -ACE_TSS_Write_Guard::acquire_write (void) -{ -// ACE_TRACE ("ACE_TSS_Write_Guard::acquire_write"); - - return this->acquire (); -} - -template int -ACE_TSS_Write_Guard::tryacquire_write (void) -{ -// ACE_TRACE ("ACE_TSS_Write_Guard::tryacquire_write"); - - return this->tryacquire (); -} - -template void -ACE_TSS_Write_Guard::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_TSS_Write_Guard::dump"); - ACE_TSS_Guard::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_TSS_Read_Guard::ACE_TSS_Read_Guard (ACE_LOCK &lock, int block) -{ -// ACE_TRACE ("ACE_TSS_Read_Guard::ACE_TSS_Read_Guard"); - - this->init_key (); - ACE_Guard *guard; - ACE_NEW (guard, - ACE_Read_Guard (lock, - block)); -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter; - ACE_NEW (tss_adapter, - ACE_TSS_Adapter ((void *)guard, - ACE_TSS_Guard::cleanup)); - ACE_Thread::setspecific (this->key_, - (void *) tss_adapter); -#else - ACE_Thread::setspecific (this->key_, - (void *) guard); -#endif /* ACE_HAS_THR_C_DEST */ -} - -template int -ACE_TSS_Read_Guard::acquire (void) -{ -// ACE_TRACE ("ACE_TSS_Read_Guard::acquire"); - - ACE_Read_Guard *guard = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - tss_adapter = static_cast (temp); - guard = static_cast *> (tss_adapter->ts_obj_); -#else - void *temp = guard; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - guard = static_cast *> (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - return guard->acquire_read (); -} - -template int -ACE_TSS_Read_Guard::tryacquire (void) -{ -// ACE_TRACE ("ACE_TSS_Read_Guard::tryacquire"); - - ACE_Read_Guard *guard = 0; - -#if defined (ACE_HAS_THR_C_DEST) - ACE_TSS_Adapter *tss_adapter = 0; - void *temp = tss_adapter; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - tss_adapter = static_cast (temp); - guard = static_cast *> (tss_adapter->ts_obj_); -#else - void *temp = guard; // Need this temp to keep G++ from complaining. - ACE_Thread::getspecific (this->key_, &temp); - guard = static_cast *> (temp); -#endif /* ACE_HAS_THR_C_DEST */ - - return guard->tryacquire_read (); -} - -template int -ACE_TSS_Read_Guard::acquire_read (void) -{ -// ACE_TRACE ("ACE_TSS_Read_Guard::acquire_read"); - - return this->acquire (); -} - -template int -ACE_TSS_Read_Guard::tryacquire_read (void) -{ -// ACE_TRACE ("ACE_TSS_Read_Guard::tryacquire_read"); - - return this->tryacquire (); -} - -template void -ACE_TSS_Read_Guard::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_TSS_Read_Guard::dump"); - ACE_TSS_Guard::dump (); -#endif /* ACE_HAS_DUMP */ -} - -#endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TSS_T_CPP */ diff --git a/ace/TSS_T.h b/ace/TSS_T.h deleted file mode 100644 index ee336ebe870..00000000000 --- a/ace/TSS_T.h +++ /dev/null @@ -1,257 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file TSS_T.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_TSS_T_H -#define ACE_TSS_T_H -#include /**/ "ace/pre.h" - -#include "ace/Lock.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// This should probably go somewhere else, but it's only used here and -// in Thread_Manager. -// Note there is no ACE_TSS_SET because one would typicaly do -// 'ACE_TSS_GET()->xyz_ = value', so the macro would have been too -// complicated. -# if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) -# define ACE_TSS_TYPE(T) ACE_TSS< T > -# if defined (ACE_HAS_BROKEN_CONVERSIONS) -# define ACE_TSS_GET(I, T) (*(I)) -# else -# define ACE_TSS_GET(I, T) ((I)->operator T * ()) -# endif /* ACE_HAS_BROKEN_CONVERSIONS */ -# else -# define ACE_TSS_TYPE(T) T -# define ACE_TSS_GET(I, T) (I) -# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ - -#include "ace/Thread_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_TSS - * - * @brief Allows objects that are "physically" in thread specific - * storage (i.e., private to a thread) to be accessed as though - * they were "logically" global to a program. - * - * This class helps to maintain a separate copy of an object for each thread - * that needs access to it. All threads access a single instance of ACE_TSS - * to obtain a pointer to a thread-specific copy of a TYPE object. Using - * a pointer to TYPE in TSS instead of TYPE itself is useful because, - * in addition to avoiding copies on what may be a complex class, it allows - * assignment of objects to thread-specific data that have arbitrarily - * complex constructors. - * - * When the ACE_TSS object is destroyed, all threads's instances of the - * data are deleted. - * - * Modern compilers have no problem using a built-in type for @c TYPE. - * However, if you must use an older compiler that won't work with a built-in - * type, the ACE_TSS_Type_Adapter class template, below, can be used for - * adapting built-in types to work with ACE_TSS. - * - * @note Beware when creating static instances of this type - * (as with any other, btw). The unpredictable order of initialization - * across different platforms may cause a situation where one uses - * the instance before it is fully initialized. That's why typically - * instances of this type are dynamicaly allocated. On the stack it is - * typically allocated inside the ACE_Thread::svc() method which - * limits its lifetime appropriately. - * - */ -template -class ACE_TSS -{ -public: - /** - * Default constructor. Can also initialize this ACE_TSS instance, - * readying it for use by the calling thread as well as all other - * threads in the process. If the constructor does not initialize this - * object, the first access to it will perform the initialization, which - * could possibly (under odd error conditions) fail. - * - * @param ts_obj If non-zero, this object is initialized for use by - * all threads and @a ts_obj is used to set the - * thread-specific value for the calling thread. Other - * threads use the ts_object (TYPE *) method to set - * a specific value. - */ - ACE_TSS (TYPE *ts_obj = 0); - - /// Deregister this object from thread-specific storage administration. - /// Will cause all threads' copies of TYPE to be destroyed. - virtual ~ACE_TSS (void); - - /** - * Set the thread-specific object for the calling thread. - * If this object has not been initialized yet, this method performs the - * initialization. - * - * @param new_ts_obj The new value for the calling thread's copy of - * this object. - * - * @return The previous value of the calling thread's copy of this - * object; 0 if there was no previous value. This method also - * returns 0 on errors. To tell the difference between an error - * and a returned 0 pointer, it's recommended that one set errno - * to 0 prior to calling ts_object() and check for a new errno - * value if ts_object() returns 0. - */ - TYPE *ts_object (TYPE *new_ts_obj); - - /** @name Accessors - * - * All accessors return a pointer to the calling thread's copy of the - * TYPE data. The pointer may be 0 on error conditions or if the calling - * thread's copy of the data has not yet been set. See specific method - * descriptions for complete details. - */ - //@{ - /** - * Get the thread-specific object for this object. - * - * @return 0 if the object has never been initialized, otherwise returns - * the calling thread's copy of the data. The returned pointer - * may be 0 under odd error conditions; check errno for further - * information. - */ - TYPE *ts_object (void) const; - - /** - * Use a "smart pointer" to get the thread-specific data associated - * with this object. - * If this ACE_TSS object hasn't been initialized, this method - * will initialize it as a side-affect. If the calling thread has not - * set a value, a default-constructed instance of TYPE is allocated and it - * becomes the thread's instance. - * - * @return The calling thread's copy of the data. The returned pointer - * may be 0 under odd error conditions; check errno for further - * information. - */ - TYPE *operator-> () const; - - /** - * Obtain a pointer to the calling thread's TYPE object. - * If this ACE_TSS object hasn't been initialized, this method - * will initialize it as a side-affect. If the calling thread has not - * set a value, a default-constructed instance of TYPE is allocated and it - * becomes the thread's instance. - * - * @return The calling thread's copy of the data. The returned pointer - * may be 0 under odd error conditions; check errno for further - * information. - */ - operator TYPE *(void) const; - - //@} - - /// Hook for construction parameters. - virtual TYPE *make_TSS_TYPE (void) const; - - // = Utility methods. - - /// Dump the state of an object. - void dump (void) const; - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -protected: - /// Actually implements the code that retrieves the object from - /// thread-specific storage. - TYPE *ts_get (void) const; - - /// Factors out common code for initializing TSS. This must NOT be - /// called with the lock held... - int ts_init (void); - -#if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) - /// This implementation only works for non-threading systems... - TYPE *type_; -#else - /// Avoid race conditions during initialization. - ACE_Thread_Mutex keylock_; - - /// "First time in" flag. - int once_; - - /// Key for the thread-specific error data. - ACE_thread_key_t key_; - - /// "Destructor" that deletes internal TYPE * when thread exits. - static void cleanup (void *ptr); -#endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */ - // = Disallow copying... - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_TSS &)) - ACE_UNIMPLEMENTED_FUNC (ACE_TSS (const ACE_TSS &)) -}; - -/** - * @class ACE_TSS_Type_Adapter - * - * @brief Adapter that allows built-in types to be used with ACE_TSS. - * - * Wraps a value of a built-in type, providing conversions to - * and from the type. Example use with ACE_TSS: - * ACE_TSS > i; - * *i = 37; - * ACE_OS::fprintf (stderr, "%d\n", *i); - * Unfortunately, though, some compilers have trouble with the - * implicit type conversions. This seems to work better: - * ACE_TSS > i; - * i->operator int & () = 37; - * ACE_OS::fprintf (stderr, "%d\n", i->operator int ()); - */ -template -class ACE_TSS_Type_Adapter -{ -public: - /// Constructor. Inlined here so that it should _always_ be inlined. - ACE_TSS_Type_Adapter (const TYPE value = 0): value_ (value) {} - - /// TYPE conversion. Inlined here so that it should _always_ be - /// inlined. - operator TYPE () const { return value_; }; - - /// TYPE & conversion. Inlined here so that it should _always_ be - /// inlined. - operator TYPE &() { return value_; }; - -private: - /// The wrapped value. - TYPE value_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/TSS_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/TSS_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("TSS_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TSS_T_H */ diff --git a/ace/TSS_T.inl b/ace/TSS_T.inl deleted file mode 100644 index 1d74573c658..00000000000 --- a/ace/TSS_T.inl +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_TSS::ACE_TSS (TYPE *type) - : type_ (type) -{ -} - -template ACE_INLINE int -ACE_TSS::ts_init (void) -{ - return 0; -} - -template ACE_INLINE TYPE * -ACE_TSS::ts_object (void) const -{ - return this->type_; -} - -template ACE_INLINE TYPE * -ACE_TSS::ts_object (TYPE *type) -{ - this->type_ = type; - return this->type_; -} - -template ACE_INLINE TYPE * -ACE_TSS::ts_get (void) const -{ - return this->type_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ! (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) */ diff --git a/ace/TTY_IO.cpp b/ace/TTY_IO.cpp deleted file mode 100644 index 4d6175362eb..00000000000 --- a/ace/TTY_IO.cpp +++ /dev/null @@ -1,586 +0,0 @@ -// $Id$ - -#include "ace/TTY_IO.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_strings.h" - -#if defined (ACE_HAS_TERMIOS) -# include "ace/os_include/os_termios.h" -#elif defined (ACE_HAS_TERMIO) -# include -#endif - -ACE_RCSID (ace, - TTY_IO, - "$Id$") - -#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO) || defined (ACE_WIN32) -namespace -{ - const char ACE_TTY_IO_ODD[] = "odd"; - const char ACE_TTY_IO_EVEN[] = "even"; - const char ACE_TTY_IO_NONE[] = "none"; -#if defined (ACE_WIN32) - const char ACE_TTY_IO_MARK[] = "mark"; - const char ACE_TTY_IO_SPACE[] = "space"; -#endif /* ACE_WIN32 */ -} -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_TTY_IO::Serial_Params::Serial_Params (void) -{ -#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO) || defined (ACE_WIN32) - baudrate = 9600; - xonlim = 0; - xofflim = 0; - readmincharacters = 0; - readtimeoutmsec = 10000; - parityenb = true; - paritymode = ACE_TTY_IO_NONE; - ctsenb = false; - rtsenb = 0; - xinenb = false; - xoutenb = false; - modem = false; - rcvenb = true; - dsrenb = false; - dtrdisable = false; - databits = 8; - stopbits = 1; -#endif -} - -// Interface for reading/writing serial device parameters - -int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const -{ -#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO) - -#if defined (ACE_HAS_TERMIOS) - struct termios devpar; - speed_t newbaudrate = 0; - if (tcgetattr (get_handle () , &devpar) == -1) -#elif defined (TCGETS) - struct termios devpar; - unsigned int newbaudrate = 0; - if (this->ACE_IO_SAP::control (TCGETS, static_cast(&devpar)) == -1) -#elif defined (TCGETA) - struct termio devpar; - unsigned int newbaudrate = 0; - if (this->ACE_IO_SAP::control (TCGETA, static_cast(&devpar)) == -1) -#else - errno = ENOSYS; -#endif /* ACE_HAS_TERMIOS */ - return -1; - - switch (cmd) - { - case SETPARAMS: - switch (arg->baudrate) - { -#if defined (B0) - case 0: newbaudrate = B0; break; -#endif /* B0 */ -#if defined (B50) - case 50: newbaudrate = B50; break; -#endif /* B50 */ -#if defined (B75) - case 75: newbaudrate = B75; break; -#endif /* B75 */ -#if defined (B110) - case 110: newbaudrate = B110; break; -#endif /* B110 */ -#if defined (B134) - case 134: newbaudrate = B134; break; -#endif /* B134 */ -#if defined (B150) - case 150: newbaudrate = B150; break; -#endif /* B150 */ -#if defined (B200) - case 200: newbaudrate = B200; break; -#endif /* B200 */ -#if defined (B300) - case 300: newbaudrate = B300; break; -#endif /* B300 */ -#if defined (B600) - case 600: newbaudrate = B600; break; -#endif /* B600 */ -#if defined (B1200) - case 1200: newbaudrate = B1200; break; -#endif /* B1200 */ -#if defined (B1800) - case 1800: newbaudrate = B1800; break; -#endif /* B1800 */ -#if defined (B2400) - case 2400: newbaudrate = B2400; break; -#endif /* B2400 */ -#if defined (B4800) - case 4800: newbaudrate = B4800; break; -#endif /* B4800 */ -#if defined (B9600) - case 9600: newbaudrate = B9600; break; -#endif /* B9600 */ -#if defined (B19200) - case 19200: newbaudrate = B19200; break; -#endif /* B19200 */ -#if defined (B38400) - case 38400: newbaudrate = B38400; break; -#endif /* B38400 */ -#if defined (B56000) - case 56000: newbaudrate = B56000; break; -#endif /* B56000 */ -#if defined (B57600) - case 57600: newbaudrate = B57600; break; -#endif /* B57600 */ -#if defined (B76800) - case 76800: newbaudrate = B76800; break; -#endif /* B76800 */ -#if defined (B115200) - case 115200: newbaudrate = B115200; break; -#endif /* B115200 */ -#if defined (B128000) - case 128000: newbaudrate = B128000; break; -#endif /* B128000 */ -#if defined (B153600) - case 153600: newbaudrate = B153600; break; -#endif /* B153600 */ -#if defined (B230400) - case 230400: newbaudrate = B230400; break; -#endif /* B230400 */ -#if defined (B307200) - case 307200: newbaudrate = B307200; break; -#endif /* B307200 */ -#if defined (B256000) - case 256000: newbaudrate = B256000; break; -#endif /* B256000 */ -#if defined (B460800) - case 460800: newbaudrate = B460800; break; -#endif /* B460800 */ -#if defined (B500000) - case 500000: newbaudrate = B500000; break; -#endif /* B500000 */ -#if defined (B576000) - case 576000: newbaudrate = B576000; break; -#endif /* B576000 */ -#if defined (B921600) - case 921600: newbaudrate = B921600; break; -#endif /* B921600 */ -#if defined (B1000000) - case 1000000: newbaudrate = B1000000; break; -#endif /* B1000000 */ -#if defined (B1152000) - case 1152000: newbaudrate = B1152000; break; -#endif /* B1152000 */ -#if defined (B1500000) - case 1500000: newbaudrate = B1500000; break; -#endif /* B1500000 */ -#if defined (B2000000) - case 2000000: newbaudrate = B2000000; break; -#endif /* B2000000 */ -#if defined (B2500000) - case 2500000: newbaudrate = B2500000; break; -#endif /* B2500000 */ -#if defined (B3000000) - case 3000000: newbaudrate = B3000000; break; -#endif /* B3000000 */ -#if defined (B3500000) - case 3500000: newbaudrate = B3500000; break; -#endif /* B3500000 */ -#if defined (B4000000) - case 4000000: newbaudrate = B4000000; break; -#endif /* B4000000 */ - default: - return -1; - } - -#if defined (ACE_HAS_TERMIOS) - // Can you really have different input and output baud rates?! - if (cfsetospeed (&devpar, newbaudrate) == -1) - return -1; - if (cfsetispeed (&devpar, newbaudrate) == -1) - return -1; -#else - devpar.c_cflag &= ~CBAUD; -# if defined (CBAUDEX) - devpar.c_cflag &= ~CBAUDEX; -# endif /* CBAUDEX */ - devpar.c_cflag |= newbaudrate; -#endif /* ACE_HAS_TERMIOS */ - - devpar.c_cflag &= ~CSIZE; - switch (arg->databits) - { - case 5: - devpar.c_cflag |= CS5; - break; - case 6: - devpar.c_cflag |= CS6; - break; - case 7: - devpar.c_cflag |= CS7; - break; - case 8: - devpar.c_cflag |= CS8; - break; - default: - return -1; - } - - switch (arg->stopbits) - { - case 1: - devpar.c_cflag &= ~CSTOPB; - break; - case 2: - devpar.c_cflag |= CSTOPB; - break; - default: - return -1; - } - - if (arg->parityenb && arg->paritymode) - { - if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_ODD) == 0) - { - devpar.c_cflag |= PARENB; - devpar.c_cflag |= PARODD; - } - else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_EVEN) == 0) - { - devpar.c_cflag |= PARENB; - devpar.c_cflag &= ~PARODD; - } - else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_NONE) == 0) - devpar.c_cflag &= ~PARENB; - else - return -1; - } - else - { - devpar.c_cflag &= ~PARENB; - } - -#if defined (CNEW_RTSCTS) - if ((arg->ctsenb) || (arg->rtsenb)) // Enable RTS/CTS protocol - devpar.c_cflag |= CNEW_RTSCTS; - else - devpar.c_cflag &= ~CNEW_RTSCTS; -#elif defined (CRTSCTS) - if ((arg->ctsenb) || (arg->rtsenb)) // Enable RTS/CTS protocol - devpar.c_cflag |= CRTSCTS; - else - devpar.c_cflag &= ~CRTSCTS; -#endif /* NEW_RTSCTS || CRTSCTS */ - -#if defined (CREAD) - // Enable/disable receiver - if (arg->rcvenb) - devpar.c_cflag |= CREAD; - else - devpar.c_cflag &= ~CREAD; -#endif /* CREAD */ - -#if defined (HUPCL) - // Cause DTR to drop after port close. - devpar.c_cflag |= HUPCL; -#endif /* HUPCL */ - -#if defined (CLOCAL) - // If device is not a modem set to local device. - if (arg->modem) - devpar.c_cflag &= ~CLOCAL; - else - devpar.c_cflag |= CLOCAL; -#endif /* CLOCAL */ - - devpar.c_iflag = IGNPAR | INPCK; - if (arg->databits < 8) - devpar.c_iflag |= ISTRIP; - -#if defined (IGNBRK) - // If device is not a modem set to ignore break points - if(arg->modem) - devpar.c_iflag &= ~IGNBRK; - else - devpar.c_iflag |= IGNBRK; -#endif /* IGNBRK */ - -#if defined (IXOFF) - // Enable/disable software flow control on input - if (arg->xinenb) - devpar.c_iflag |= IXOFF; - else - devpar.c_iflag &= ~IXOFF; -#endif /* IXOFF */ - -#if defined (IXON) - // Enable/disable software flow control on output - if (arg->xoutenb) - devpar.c_iflag |= IXON; - else - devpar.c_iflag &= ~IXON; -#endif /* IXON */ - -#if defined (ICANON) - // Enable noncanonical input processing mode - devpar.c_lflag &= ~ICANON; -#endif /* ICANON */ - -#if defined (ECHO) - // Disable echoing of input characters - devpar.c_lflag &= ~ECHO; -#endif /* ECHO */ - -#if defined (ECHOE) - // Disable echoing erase chareacter as BS-SP-BS - devpar.c_lflag &= ~ECHOE; -#endif /* ECHOE */ - -#if defined (ISIG) - // Disable SIGINTR, SIGSUSP, SIGDSUSP and SIGQUIT signals - devpar.c_lflag &= ~ISIG; -#endif /* ISIG */ - -#if defined (OPOST) - // Disable post-processing of output data - devpar.c_oflag &= ~OPOST; -#endif /* OPOST */ - - if (arg->readtimeoutmsec < 0) - { - // Settings for infinite timeout. - devpar.c_cc[VTIME] = 0; - // In case of infinite timeout [VMIN] must be at least 1. - if (arg->readmincharacters > UCHAR_MAX) - devpar.c_cc[VMIN] = UCHAR_MAX; - else if (arg->readmincharacters < 1) - devpar.c_cc[VMIN] = 1; - else - devpar.c_cc[VMIN] = static_cast(arg->readmincharacters); - } - else - { - devpar.c_cc[VTIME] = static_cast(arg->readtimeoutmsec / 100); - - if (arg->readmincharacters > UCHAR_MAX) - devpar.c_cc[VMIN] = UCHAR_MAX; - else if (arg->readmincharacters < 1) - devpar.c_cc[VMIN] = 0; - else - devpar.c_cc[VMIN] = static_cast(arg->readmincharacters); - } - -#if defined (TIOCMGET) && !defined (__Lynx__) - // This sets serial port under LynxOS to non-functional state - int status; - this->ACE_IO_SAP::control (TIOCMGET, &status); - - if (arg->dtrdisable) - status &= ~TIOCM_DTR; - else - status |= TIOCM_DTR; - - this->ACE_IO_SAP::control (TIOCMSET, &status); -#endif /* definded (TIOCMGET) */ - -#if defined (ACE_HAS_TERMIOS) - return tcsetattr (get_handle (), TCSANOW, &devpar); -#elif defined (TCSETS) - return this->ACE_IO_SAP::control (TCSETS, static_cast(&devpar)); -#elif defined (TCSETA) - return this->ACE_IO_SAP::control (TCSETA, static_cast(&devpar)); -#else - errno = ENOSYS; - return -1; -#endif /* ACE_HAS_TERMIOS */ - - case GETPARAMS: - return -1; // Not yet implemented. - default: - return -1; // Wrong cmd. - } -#elif defined (ACE_WIN32) - switch (cmd) - { - case SETPARAMS: - DCB dcb; - dcb.DCBlength = sizeof dcb; - if (!::GetCommState (this->get_handle (), &dcb)) - { - ACE_OS::set_errno_to_last_error (); - return -1; - } - - dcb.BaudRate = arg->baudrate; - - switch (arg->databits) - { - case 4: - case 5: - case 6: - case 7: - case 8: - dcb.ByteSize = arg->databits; - break; - default: - return -1; - } - - switch (arg->stopbits) - { - case 1: - dcb.StopBits = ONESTOPBIT; - break; - case 2: - dcb.StopBits = TWOSTOPBITS; - break; - default: - return -1; - } - - if (arg->parityenb && arg->paritymode) - { - dcb.fParity = TRUE; - if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_ODD) == 0) - dcb.Parity = ODDPARITY; - else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_EVEN) == 0) - dcb.Parity = EVENPARITY; - else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_NONE) == 0) - dcb.Parity = NOPARITY; - else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_MARK) == 0) - dcb.Parity = MARKPARITY; - else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_SPACE) == 0) - dcb.Parity = SPACEPARITY; - else - return -1; - } - else - { - dcb.fParity = FALSE; - dcb.Parity = NOPARITY; - } - - // Enable/disable RTS protocol. - switch (arg->rtsenb) - { - case 1: - dcb.fRtsControl = RTS_CONTROL_ENABLE; - break; - case 2: - dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; - break; - case 3: - dcb.fRtsControl = RTS_CONTROL_TOGGLE; - break; - default: - dcb.fRtsControl = RTS_CONTROL_DISABLE; - } - - // Enable/disable CTS protocol. - if (arg->ctsenb) - dcb.fOutxCtsFlow = TRUE; - else - dcb.fOutxCtsFlow = FALSE; - - // Enable/disable DSR protocol. - if (arg->dsrenb) - dcb.fOutxDsrFlow = TRUE; - else - dcb.fOutxDsrFlow = FALSE; - - // Disable/enable DTR protocol - if (arg->dtrdisable) - dcb.fDtrControl = DTR_CONTROL_DISABLE; - else - dcb.fDtrControl = DTR_CONTROL_ENABLE; - - // Enable/disable software flow control on input - if (arg->xinenb) - dcb.fInX = TRUE; - else - dcb.fInX = FALSE; - - // Enable/disable software flow control on output - if (arg->xoutenb) - dcb.fOutX = TRUE; - else - dcb.fOutX = FALSE; - - // Always set limits unless set to negative to use default. - if (arg->xonlim >= 0) - dcb.XonLim = static_cast(arg->xonlim); - if (arg->xofflim >= 0) - dcb.XoffLim = static_cast(arg->xofflim); - - dcb.fAbortOnError = FALSE; - dcb.fErrorChar = FALSE; - dcb.fNull = FALSE; - dcb.fBinary = TRUE; - - if (!::SetCommState (this->get_handle (), &dcb)) - { - ACE_OS::set_errno_to_last_error (); - return -1; - } - - COMMTIMEOUTS timeouts; - if (!::GetCommTimeouts (this->get_handle(), &timeouts)) - { - ACE_OS::set_errno_to_last_error (); - return -1; - } - - if (arg->readtimeoutmsec < 0) - { - // Settings for infinite timeout. - timeouts.ReadIntervalTimeout = 0; - timeouts.ReadTotalTimeoutMultiplier = 0; - timeouts.ReadTotalTimeoutConstant = 0; - } - else if (arg->readtimeoutmsec == 0) - { - // Return immediately if no data in the input buffer. - timeouts.ReadIntervalTimeout = MAXDWORD; - timeouts.ReadTotalTimeoutMultiplier = 0; - timeouts.ReadTotalTimeoutConstant = 0; - } - else - { - // Wait for specified timeout for char to arrive before returning. - timeouts.ReadIntervalTimeout = MAXDWORD; - timeouts.ReadTotalTimeoutMultiplier = MAXDWORD; - timeouts.ReadTotalTimeoutConstant = arg->readtimeoutmsec; - } - - if (!::SetCommTimeouts (this->get_handle (), &timeouts)) - { - ACE_OS::set_errno_to_last_error (); - return -1; - } - - return 0; - - case GETPARAMS: - ACE_NOTSUP_RETURN (-1); // Not yet implemented. - default: - return -1; // Wrong cmd. - - } // arg switch -#else - ACE_UNUSED_ARG (cmd); - ACE_UNUSED_ARG (arg); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_TERMIOS || ACE_HAS_TERMIO */ -} - -#if defined (ACE_NEEDS_DEV_IO_CONVERSION) -ACE_TTY_IO::operator ACE_DEV_IO &() -{ - return static_cast(*this); -} -#endif /* ACE_NEEDS_DEV_IO_CONVERSION */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TTY_IO.h b/ace/TTY_IO.h deleted file mode 100644 index f4f3d12b54d..00000000000 --- a/ace/TTY_IO.h +++ /dev/null @@ -1,122 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file TTY_IO.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_TTY_IO_H -#define ACE_TTY_IO_H - -#include "ace/DEV_IO.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_TTY_IO - * - * @brief Class definitions for platform specific TTY features. - * - * This class represents an example interface for a specific - * device (a serial line). It extends the capability of the - * underlying DEV_IO class by adding a control method that takes - * a special structure (Serial_Params) as argument to allow a - * comfortable user interface (away from that annoying termios - * structure, which is very specific to UNIX). - */ -class ACE_Export ACE_TTY_IO : public ACE_DEV_IO -{ -public: - enum Control_Mode - { - SETPARAMS, ///< Set control parameters. - GETPARAMS ///< Get control parameters. - }; - - struct ACE_Export Serial_Params - { - Serial_Params (void); - - /** Specifies the baudrate at which the communnication port operates. */ - int baudrate; - /** Specifies the minimum number of bytes in input buffer before XON char - is sent. Negative value indicates that default value should - be used (Win32). */ - int xonlim; - /** Specifies the maximum number of bytes in input buffer before XOFF char - is sent. Negative value indicates that default value should - be used (Win32). */ - int xofflim; - /** Specifies the minimum number of characters for non-canonical - read (POSIX). */ - unsigned int readmincharacters; - /** Specifies the time to wait before returning from read. Negative value - means infinite timeout. */ - int readtimeoutmsec; - /** - * @deprecated - * Note that this member is going away in a subsequent - * release. Use paritymode = "none" to disable parity - * checking. - * - * Enable/disable parity checking. - */ - bool parityenb; - /** Specifies the parity mode. POSIX supports "none", "even" and - "odd" parity. Additionally Win32 supports "mark" and "space" - parity modes. */ - const char *paritymode; - /** Enable & set CTS mode. Note that RTS & CTS are enabled/disabled - together on some systems (RTS/CTS is enabled if either - ctsenb or rtsenb is set). */ - bool ctsenb; - /** Enable & set RTS mode. Note that RTS & CTS are enabled/disabled - together on some systems (RTS/CTS is enabled if either - ctsenb or rtsenb is set). - - 0 = Disable RTS. - - 1 = Enable RTS. - - 2 = Enable RTS flow-control handshaking (Win32). - - 3 = Specifies that RTS line will be high if bytes are available - for transmission. After transmission RTS will be low (Win32). */ - unsigned char rtsenb; - /** Enable/disable software flow control on input. */ - bool xinenb; - /** Enable/disable software flow control on output. */ - bool xoutenb; - /** Specifies if device is a modem (POSIX). If not set modem status - lines are ignored. */ - bool modem; - /** Enable/disable receiver (POSIX). */ - bool rcvenb; - /** Controls whether DSR is disabled or enabled (Win32). */ - bool dsrenb; - /** Controls whether DTR is disabled or enabled. */ - bool dtrdisable; - /** Data bits. Valid values 5, 6, 7 and 8 data bits. - Additionally Win32 supports 4 data bits. */ - unsigned char databits; - /** Stop bits. Valid values are 1 and 2. */ - unsigned char stopbits; - }; - - /** Interface for reading/writing serial device parameters. */ - int control (Control_Mode cmd, Serial_Params *arg) const; - -#if defined (ACE_NEEDS_DEV_IO_CONVERSION) - /** This is necessary to pass ACE_TTY_IO as parameter to DEV_Connector. */ - operator ACE_DEV_IO &(); -#endif /* ACE_NEEDS_DEV_IO_CONVERSION */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TTY_IO_H */ diff --git a/ace/Task.cpp b/ace/Task.cpp deleted file mode 100644 index 8e3db2ff169..00000000000 --- a/ace/Task.cpp +++ /dev/null @@ -1,287 +0,0 @@ -// $Id$ - -#include "ace/Task.h" -#include "ace/Module.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Task.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_RCSID (ace, - Task, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Task_Base::ACE_Task_Base (ACE_Thread_Manager *thr_man) - : thr_count_ (0), - thr_mgr_ (thr_man), - flags_ (0), - grp_id_ (-1), - last_thread_id_ (0) -{ -} - -ACE_Task_Base::~ACE_Task_Base (void) -{ -} - -// Default ACE_Task service routine - -int -ACE_Task_Base::svc (void) -{ - ACE_TRACE ("ACE_Task_Base::svc"); - return 0; -} - -// Default ACE_Task open routine - -int -ACE_Task_Base::open (void *) -{ - ACE_TRACE ("ACE_Task_Base::open"); - return 0; -} - -// Default ACE_Task close routine - -int -ACE_Task_Base::close (u_long) -{ - ACE_TRACE ("ACE_Task_Base::close"); - return 0; -} - -// Forward the call to close() so that existing applications don't -// break. - -int -ACE_Task_Base::module_closed (void) -{ - return this->close (1); -} - -// Default ACE_Task put routine. - -int -ACE_Task_Base::put (ACE_Message_Block *, ACE_Time_Value *) -{ - ACE_TRACE ("ACE_Task_Base::put"); - return 0; -} - -// Wait for all threads running in a task to exit. - -int -ACE_Task_Base::wait (void) -{ - ACE_TRACE ("ACE_Task_Base::wait"); - - // If we don't have a thread manager, we probably were never - // activated. - if (this->thr_mgr () != 0) - return this->thr_mgr ()->wait_task (this); - else - return 0; -} - -// Suspend a task. -int -ACE_Task_Base::suspend (void) -{ - ACE_TRACE ("ACE_Task_Base::suspend"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - if (this->thr_count_ > 0) - return this->thr_mgr_->suspend_task (this); - - return 0; -} - -// Resume a suspended task. -int -ACE_Task_Base::resume (void) -{ - ACE_TRACE ("ACE_Task_Base::resume"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - if (this->thr_count_ > 0) - return this->thr_mgr_->resume_task (this); - - return 0; -} - -int -ACE_Task_Base::activate (long flags, - int n_threads, - int force_active, - long priority, - int grp_id, - ACE_Task_Base *task, - ACE_hthread_t thread_handles[], - void *stack[], - size_t stack_size[], - ACE_thread_t thread_ids[]) -{ - ACE_TRACE ("ACE_Task_Base::activate"); - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - - // If the task passed in is zero, we will use - if (task == 0) - task = this; - - if (this->thr_count_ > 0 && force_active == 0) - return 1; // Already active. - else - { - if (this->thr_count_ > 0 && this->grp_id_ != -1) - // If we're joining an existing group of threads then make - // sure to use its group id. - grp_id = this->grp_id_; - this->thr_count_ += n_threads; - } - - // Use the ACE_Thread_Manager singleton if we're running as an - // active object and the caller didn't supply us with a - // Thread_Manager. - if (this->thr_mgr_ == 0) -# if defined (ACE_THREAD_MANAGER_LACKS_STATICS) - this->thr_mgr_ = ACE_THREAD_MANAGER_SINGLETON::instance (); -# else /* ! ACE_THREAD_MANAGER_LACKS_STATICS */ - this->thr_mgr_ = ACE_Thread_Manager::instance (); -# endif /* ACE_THREAD_MANAGER_LACKS_STATICS */ - - int grp_spawned = -1; - if (thread_ids == 0) - // Thread Ids were not specified - grp_spawned = - this->thr_mgr_->spawn_n (n_threads, - &ACE_Task_Base::svc_run, - (void *) this, - flags, - priority, - grp_id, - task, - thread_handles, - stack, - stack_size); - else - // thread names were specified - grp_spawned = - this->thr_mgr_->spawn_n (thread_ids, - n_threads, - &ACE_Task_Base::svc_run, - (void *) this, - flags, - priority, - grp_id, - stack, - stack_size, - thread_handles, - task); - if (grp_spawned == -1) - { - // If spawn_n fails, restore original thread count. - this->thr_count_ -= n_threads; - return -1; - } - - if (this->grp_id_ == -1) - this->grp_id_ = grp_spawned; - - this->last_thread_id_ = 0; // Reset to prevent inadvertant match on ID - - return 0; - -#else - { - // Keep the compiler from complaining. - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (n_threads); - ACE_UNUSED_ARG (force_active); - ACE_UNUSED_ARG (priority); - ACE_UNUSED_ARG (grp_id); - ACE_UNUSED_ARG (task); - ACE_UNUSED_ARG (thread_handles); - ACE_UNUSED_ARG (stack); - ACE_UNUSED_ARG (stack_size); - ACE_UNUSED_ARG (thread_ids); - ACE_NOTSUP_RETURN (-1); - } -#endif /* ACE_MT_SAFE */ -} - -void -ACE_Task_Base::cleanup (void *object, void *) -{ - ACE_Task_Base *t = (ACE_Task_Base *) object; - - // The thread count must be decremented first in case the - // hook does something crazy like "delete this". - { - ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, t->lock_)); - t->thr_count_--; - if (0 == t->thr_count_) - t->last_thread_id_ = ACE_Thread::self (); - } - - // @@ Is it possible to pass in the exit status somehow? - t->close (); - // t is undefined here. close() could have deleted it. -} - - -#if defined (ACE_HAS_SIG_C_FUNC) -extern "C" void -ACE_Task_Base_cleanup (void *object, void *) -{ - ACE_Task_Base::cleanup (object, 0); -} -#endif /* ACE_HAS_SIG_C_FUNC */ - -ACE_THR_FUNC_RETURN -ACE_Task_Base::svc_run (void *args) -{ - ACE_TRACE ("ACE_Task_Base::svc_run"); - - ACE_Task_Base *t = (ACE_Task_Base *) args; - - // Register ourself with our 's thread exit hook - // mechanism so that our close() hook will be sure to get invoked - // when this thread exits. - -#if defined ACE_HAS_SIG_C_FUNC - t->thr_mgr ()->at_exit (t, ACE_Task_Base_cleanup, 0); -#else - t->thr_mgr ()->at_exit (t, ACE_Task_Base::cleanup, 0); -#endif /* ACE_HAS_SIG_C_FUNC */ - - // Call the Task's svc() hook method. - int svc_status = t->svc (); - ACE_THR_FUNC_RETURN status; -#if (defined (__BORLANDC__) && (__BORLANDC__ < 0x600)) || defined (__MINGW32__) || (defined (_MSC_VER) && (_MSC_VER <= 1400)) || (defined (ACE_WIN32) && defined(__IBMCPP__) || defined (__DCC__)) - // Some compilers complain about reinterpret_cast from int to unsigned long... - status = static_cast (svc_status); -#else - status = reinterpret_cast (svc_status); -#endif /* (__BORLANDC__ < 0x600) || __MINGW32__ || _MSC_VER <= 1400 || __IBMCPP__ */ - -// If we changed this zero change the other if in OS.cpp Thread_Adapter::invoke -#if 1 - // Call the close> hook. - ACE_Thread_Manager *thr_mgr_ptr = t->thr_mgr (); - - // This calls the Task->close () hook. - t->cleanup (t, 0); - - // This prevents a second invocation of the cleanup code - // (called later by . - thr_mgr_ptr->at_exit (t, 0, 0); -#endif - return status; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Task.h b/ace/Task.h deleted file mode 100644 index 8f5336f536e..00000000000 --- a/ace/Task.h +++ /dev/null @@ -1,306 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Task.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_TASK_H -#define ACE_TASK_H -#include /**/ "ace/pre.h" - -#include "ace/Service_Object.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Thread_Manager.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Task_Flags - * - * @brief These flags are used within the ACE_Task. - * - * These flags should be hidden within ACE_Task. Unfortunately, the - * HP/UX C++ compiler can't grok this... Fortunately, there's no - * code defined here, so we don't have to worry about multiple - * definitions. - */ -namespace ACE_Task_Flags -{ - enum - { - /// Identifies a Task as being the "reader" in a Module. - ACE_READER = 01, - /// Just flush data messages in the queue. - ACE_FLUSHDATA = 02, - /// Flush all messages in the Queue. - ACE_FLUSHALL = 04, - /// Flush read queue - ACE_FLUSHR = 010, - /// Flush write queue - ACE_FLUSHW = 020, - /// Flush both queues - ACE_FLUSHRW = 030 - }; -} - -/** - * @class ACE_Task_Base - * - * @brief Direct base class for the ACE_Task template. - * - * This class factors out the non-template code in order to - * reduce template bloat, as well as to make it possible for the - * to store *'s - * polymorphically. - */ -class ACE_Export ACE_Task_Base : public ACE_Service_Object -{ -public: - // = Initialization and termination methods. - /// Constructor. - ACE_Task_Base (ACE_Thread_Manager * = 0); - - /// Destructor. - virtual ~ACE_Task_Base (void); - - // = Initialization and termination hooks. - - // These methods should be overridden by subclasses if you'd like to - // provide -specific initialization and termination behavior. - - /// Hook called to initialize a task and prepare it for execution. - /// @a args can be used to pass arbitrary information into . - virtual int open (void *args = 0); - - /** - * Hook called from ACE_Thread_Exit when during thread exit and from - * the default implementation of . In general, this - * method shouldn't be called directly by an application, - * particularly if the is running as an Active Object. - * Instead, a special message should be passed into the via - * the method defined below, and the method should - * interpret this as a flag to shut down the . - */ - virtual int close (u_long flags = 0); - - /** - * Hook called during . The default - * implementation calls forwards the call to close(1). Please - * notice the changed value of the default argument of . - * This allows tasks to differ between the call has been originated - * from or from . Be aware that - * close(0) will be also called when a thread associated with the - * ACE_Task instance exits. - */ - virtual int module_closed (void); - - // = Immediate and deferred processing methods, respectively. - - // These methods should be overridden by subclasses if you'd like to - // provide -specific message processing behavior. - - /// A hook method that can be used to pass a message to a - /// task, where it can be processed immediately or queued for subsequent - /// processing in the hook method. - virtual int put (ACE_Message_Block *, ACE_Time_Value * = 0); - - /// Run by a daemon thread to handle deferred processing. - virtual int svc (void); - - // = Active object activation method. - /** - * Turn the task into an active object, i.e., having of - * control, all running at the level (see below) with the - * same , all of which invoke . Returns -1 if - * failure occurs, returns 1 if Task is already an active object and - * is false (i.e., do *not* create a new thread in - * this case), and returns 0 if Task was not already an active - * object and a thread is created successfully or thread is an - * active object and is true. Note that if - * is true and there are already threads spawned in - * this , the parameter is ignored and the - * of any newly activated thread(s) will inherit the existing - * of the existing thread(s) in the . - * - * The <{flags}> are a bitwise-OR of the following: - * = BEGIN - * THR_CANCEL_DISABLE, THR_CANCEL_ENABLE, THR_CANCEL_DEFERRED, - * THR_CANCEL_ASYNCHRONOUS, THR_BOUND, THR_NEW_LWP, THR_DETACHED, - * THR_SUSPENDED, THR_DAEMON, THR_JOINABLE, THR_SCHED_FIFO, - * THR_SCHED_RR, THR_SCHED_DEFAULT, THR_EXPLICIT_SCHED, - * THR_SCOPE_SYSTEM, THR_SCOPE_PROCESS - * = END - * If THR_SCHED_INHERIT is not desirable, applications should - * specifically pass in THR_EXPLICIT_SCHED. - * - * - * By default, or if <{priority}> is set to - * ACE_DEFAULT_THREAD_PRIORITY, an "appropriate" priority value for - * the given scheduling policy (specified in <{flags}>, e.g., - * ) is used. This value is calculated - * dynamically, and is the median value between the minimum and - * maximum priority values for the given policy. If an explicit - * value is given, it is used. Note that actual priority values are - * EXTREMEMLY implementation-dependent, and are probably best - * avoided. - * - * If != 0 it is assumed to be an array of - * thread_handles that will be assigned the values of the thread - * handles being spawned. Returns -1 on failure ( will - * explain...), otherwise returns the group id of the threads. - * - * Assigning allows you to associate the newly spawned - * threads with an instance of ACE_Task_Base. If == 0, then - * the new threads are associated automatically with - * ACE_Task_Base. Setting the argument to value other than - * makes the thread manipulating methods, such as wait(), - * suspend(), resume(), useless. Threads spawned with user - * specified value must therefore be manipulated thru - * ACE_Thread_Manager directly. - * - * If != 0 it is assumed to be an array of pointers to - * the base of the stacks to use for the threads being spawned. - * Likewise, if != 0 it is assumed to be an array of - * values indicating how big each of the corresponding s - * are. - * - * - */ - virtual int activate (long flags = THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, - int n_threads = 1, - int force_active = 0, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - int grp_id = -1, - ACE_Task_Base *task = 0, - ACE_hthread_t thread_handles[] = 0, - void *stack[] = 0, - size_t stack_size[] = 0, - ACE_thread_t thread_ids[] = 0); - - /** - * Block until there are no more threads running in this task. - * This method will not wait for either detached or daemon threads; - * the threads must have been spawned with the @c THR_JOINABLE flag. - * Upon successful completion, the threads have been joined, so further - * attempts to join with any of the waited-for threads will fail. - * - * @retval 0 Success. - * @retval -1 Failure (consult errno for further information). - */ - virtual int wait (void); - - // = Suspend/resume a Task. - - // Note that these methods are not portable and should be avoided - // since they are inherently error-prone to use. They are only here - // for (the rare) applications that know how to use them correctly. - /// Suspend a task. - virtual int suspend (void); - /// Resume a suspended task. - virtual int resume (void); - - /// Get the current group id. - int grp_id (void) const; - - /// Set the current group id. - void grp_id (int); - - /// Get the thread manager associated with this Task. - ACE_Thread_Manager *thr_mgr (void) const; - - /// Set the thread manager associated with this Task. - void thr_mgr (ACE_Thread_Manager *); - - /// True if queue is a reader, else false. - int is_reader (void) const; - - /// True if queue is a writer, else false. - int is_writer (void) const; - - /** - * Returns the number of threads currently running within a task. - * If we're a passive object this value is 0, else it's greater than - * 0. - */ - size_t thr_count (void) const; - - /** - * Returns the thread ID of the thread whose exit caused this object's - * thread count to be decremented to 0. - * - * When a thread spawned in the context of this object (using activate()) - * returns from its svc() method ACE calls the close() hook. Before it does - * so, it decrements the number of active threads. If the number of threads - * is decremented to 0, the thread ID of the current thread is stored for - * access by this method. If the returned thread ID matches the calling - * thread's ID, the calling thread knows that there are no other threads - * still active in the ACE_Task. - * - * @retval ACE_thread_t of the last thread to close. 0 if the last thread - * is not yet known; for example, if no threads are active, or if - * multiple threads are active. - */ - ACE_thread_t last_thread (void) const; - - /// Routine that runs the service routine as a daemon thread. - static ACE_THR_FUNC_RETURN svc_run (void *); - - /// Cleanup hook that is called when a thread exits to gracefully - /// shutdown an ACE_Task. - static void cleanup (void *object, void *params); - -protected: - /** - * Count of the number of threads running within the task. If this - * value is greater than 0 then we're an active object and the value - * of is the number of active threads at this instant. - * If the value == 0, then we're a passive object. - */ - size_t thr_count_; - - /// Multi-threading manager. - ACE_Thread_Manager *thr_mgr_; - - /// ACE_Task flags. - u_long flags_; - - /// This maintains the group id of the Task. - int grp_id_; - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - /// Protect the state of a Task during concurrent operations, but - /// only if we're configured as MT safe... - ACE_Thread_Mutex lock_; -#endif /* ACE_MT_SAFE */ - - /// Holds the thread ID of the last thread to exit svc() in this object. - ACE_thread_t last_thread_id_; - -private: - - // = Disallow these operations. - ACE_Task_Base &operator= (const ACE_Task_Base &); - ACE_Task_Base (const ACE_Task_Base &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Task.inl" -#endif /* __ACE_INLINE__ */ - -// Include the ACE_Task templates classes at this point. -#include "ace/Task_T.h" - -#include /**/ "ace/post.h" -#endif /* ACE_TASK_H */ diff --git a/ace/Task.inl b/ace/Task.inl deleted file mode 100644 index 2430651ccc5..00000000000 --- a/ace/Task.inl +++ /dev/null @@ -1,77 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Get the current group id. -ACE_INLINE int -ACE_Task_Base::grp_id (void) const -{ - ACE_TRACE ("ACE_Task_Base::grp_id"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, const_cast (this->lock_), -1)); - return this->grp_id_; -} - -// Set the current group id. - -ACE_INLINE void -ACE_Task_Base::grp_id (int identifier) -{ - ACE_TRACE ("ACE_Task_Base::grp_id"); - ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); - - // Cache the group id in the task and then set it in the - // Thread_Manager, if there is one. - this->grp_id_ = identifier; - if (this->thr_mgr ()) - this->thr_mgr ()->set_grp (this, identifier); -} - -ACE_INLINE ACE_Thread_Manager * -ACE_Task_Base::thr_mgr (void) const -{ - ACE_TRACE ("ACE_Task_Base::thr_mgr"); - return this->thr_mgr_; -} - -ACE_INLINE void -ACE_Task_Base::thr_mgr (ACE_Thread_Manager *thr_mgr) -{ - ACE_TRACE ("ACE_Task_Base::thr_mgr"); - this->thr_mgr_ = thr_mgr; -} - -ACE_INLINE int -ACE_Task_Base::is_reader (void) const -{ - ACE_TRACE ("ACE_Task_Base::is_reader"); - return (ACE_BIT_ENABLED (this->flags_, ACE_Task_Flags::ACE_READER)); -} - -ACE_INLINE int -ACE_Task_Base::is_writer (void) const -{ - ACE_TRACE ("ACE_Task_Base::is_writer"); - return (ACE_BIT_DISABLED (this->flags_, ACE_Task_Flags::ACE_READER)); -} - -// Return the count of the current number of threads. -ACE_INLINE size_t -ACE_Task_Base::thr_count (void) const -{ - ACE_TRACE ("ACE_Task_Base::thr_count"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, const_cast (this->lock_), 0)); - - return this->thr_count_; -} - -// Return the thread ID of the last thread to exit svc(). -ACE_INLINE ACE_thread_t -ACE_Task_Base::last_thread (void) const -{ - ACE_TRACE ("ACE_Task_Base::last_thread"); - return this->last_thread_id_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Task_Ex_T.cpp b/ace/Task_Ex_T.cpp deleted file mode 100644 index 0c5871657dd..00000000000 --- a/ace/Task_Ex_T.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// $Id$ - -#ifndef ACE_TASK_EX_T_CPP -#define ACE_TASK_EX_T_CPP - -#include "ace/Task_Ex_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Module.h" -#include "ace/Null_Condition.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Task_Ex_T.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template void -ACE_Task_Ex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Task_Ex::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_)); - this->msg_queue_->dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nflags = %x"), this->flags_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nmod_ = %x"), this->mod_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nnext_ = %x"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nthr_count_ = %d"), this->thr_count_)); -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - this->lock_.dump (); -#endif /* ACE_MT_SAFE */ - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// If the user doesn't supply a ACE_Message_Queue_Ex pointer then we'll -// allocate one dynamically. Otherwise, we'll use the one they give. - -template -ACE_Task_Ex::ACE_Task_Ex (ACE_Thread_Manager *thr_man, - ACE_Message_Queue_Ex *mq) - : ACE_Task_Base (thr_man), - msg_queue_ (0), - delete_msg_queue_ (0), - mod_ (0), - next_ (0) -{ - ACE_TRACE ("ACE_Task_Ex::ACE_Task_Ex"); - - if (mq == 0) - { - ACE_NEW (mq, - (ACE_Message_Queue_Ex)); - this->delete_msg_queue_ = 1; - } - - this->msg_queue_ = mq; -} - -template -ACE_Task_Ex::~ACE_Task_Ex (void) -{ - ACE_TRACE ("ACE_Task_Ex::~ACE_Task_Ex"); - if (this->delete_msg_queue_) - delete this->msg_queue_; - - // These assignments aren't strickly necessary but they help guard - // against odd race conditions... - this->delete_msg_queue_ = 0; -} - -template ACE_Task * -ACE_Task_Ex::sibling (void) -{ - ACE_TRACE ("ACE_Task_Ex::sibling"); - /// @todo FIXME Need to impl ACE_Moudle to support ACE_Task as well. - /// Now always return 0 for sibling - return 0; -/* - if (this->mod_ == 0) - return 0; - else - return this->mod_->sibling (this); -*/ -} - -template const ACE_TCHAR * -ACE_Task_Ex::name (void) const -{ - ACE_TRACE ("ACE_Task_Ex::name"); - if (this->mod_ == 0) - return 0; - else - return this->mod_->name (); -} - -template ACE_Module * -ACE_Task_Ex::module (void) const -{ - ACE_TRACE ("ACE_Task_Ex::module"); - return this->mod_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TASK_EX_T_CPP */ diff --git a/ace/Task_Ex_T.h b/ace/Task_Ex_T.h deleted file mode 100644 index d958bd2d5e6..00000000000 --- a/ace/Task_Ex_T.h +++ /dev/null @@ -1,208 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Task_Ex_T.h - * - * $Id$ - * - * @author Kobi Cohen-Arazi - */ -//============================================================================= - -#ifndef ACE_TASK_EX_T_H -#define ACE_TASK_EX_T_H -#include /**/ "ace/pre.h" - -#include "ace/Service_Object.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Synch_Traits.h" -#include "ace/Task.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decls... -template class ACE_Module; - -/** - * @class ACE_Task_Ex - * - * @brief Primary interface for application message processing, as well - * as input and output message queueing. - * - * Unlike ACE_Task, these class doesn't have the ability to be a part of - * a Stream chain. I.e. You cannot (yet) chain modules based on ACE_Task_Ex. - * - * @todo: We can merge ACE_Task and ACE_Task_Ex to be one class. - * something like that: - * template - * class ACE_Task : public ACE_Task_Base - * { - * // use here the code from ACE_Task_Ex using ACE_Message_Queue_Ex - * }; - * - * Now specialized version of ACE_Task with ACE_Message_Block as its - * ACE_MESSAGE_TYPE... - * - * template - * class ACE_Task : public ACE_Task_Base - * { - * // put here the good old ACE_Task code - * }; - * - * When User (and legacy code) write ACE_Task, specialized ACE_Task - * code is in action. - */ -template -class ACE_Task_Ex : public ACE_Task_Base -{ -public: - friend class ACE_Module; - friend class ACE_Module_Type; - typedef ACE_Message_Queue_Ex MESSAGE_QUEUE_EX; - - // = Initialization/termination methods. - /** - * Initialize a Task, supplying a thread manager and a message - * queue. If the user doesn't supply a ACE_Message_Queue pointer - * then we'll allocate one dynamically. Otherwise, we'll use the - * one passed as a parameter. - */ - ACE_Task_Ex (ACE_Thread_Manager *thr_mgr = 0, - MESSAGE_QUEUE_EX *mq = 0); - - /// Destructor. - virtual ~ACE_Task_Ex (void); - - /// Gets the message queue associated with this task. - MESSAGE_QUEUE_EX *msg_queue (void); - - /// Sets the message queue associated with this task. - void msg_queue (MESSAGE_QUEUE_EX *); - -public: // Should be protected: - // = Message queue manipulation methods. - - // = Enqueue and dequeue methods. - - // For the following five method if == 0, the caller will - // block until action is possible, else will wait until the - // <{absolute}> time specified in * elapses). These calls - // will return, however, when queue is closed, deactivated, when a - // signal occurs, or if the time specified in timeout elapses, (in - // which case errno = EWOULDBLOCK). - - /// Insert message into the message queue. Note that uses - /// <{absolute}> time rather than <{relative}> time. - int putq (ACE_MESSAGE_TYPE *, ACE_Time_Value *timeout = 0); - - /** - * Extract the first message from the queue (blocking). Note that - * uses <{absolute}> time rather than <{relative}> time. - * Returns number of items in queue if the call succeeds or -1 otherwise. - */ - int getq (ACE_MESSAGE_TYPE *&mb, ACE_Time_Value *timeout = 0); - - /// Return a message to the queue. Note that uses - /// <{absolute}> time rather than <{relative}> time. - int ungetq (ACE_MESSAGE_TYPE *, ACE_Time_Value *timeout = 0); - - /** - * Turn the message around and send it back down the Stream. Note - * that uses <{absolute}> time rather than <{relative}> - * time. - */ - int reply (ACE_MESSAGE_TYPE *, ACE_Time_Value *timeout = 0); - - /** - * Transfer message to the adjacent ACE_Task_Ex in a ACE_Stream. Note - * that uses <{absolute}> time rather than <{relative}> - * time. - */ - int put_next (ACE_MESSAGE_TYPE *msg, ACE_Time_Value *timeout = 0); - - /// Tests whether we can enqueue a message without blocking. - int can_put (ACE_MESSAGE_TYPE *); - - // = ACE_Task utility routines to identify names et al. - /// Return the name of the enclosing Module if there's one associated - /// with the Task, else returns 0. - const ACE_TCHAR *name (void) const; - - // = Pointers to next ACE_Task_Base (if ACE is part of an ACE_Stream). - /// Get next Task pointer. - ACE_Task *next (void); - - /// Set next Task pointer. - void next (ACE_Task *); - - /// Alwasy return 0. @todo FIXME - ACE_Task *sibling (void); - - /// Return the Task's Module if there is one, else returns 0. - ACE_Module *module (void) const; - - /** - * Flush the task's queue, i.e., free all of the enqueued - * message blocks and releases any threads blocked on the queue. - * Note that if this conflicts with the C++ iostream - * function, just rewrite the iostream function as ::. - */ - -#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) - // Make LynxOS 3.x buggy compiler happy - int flush (u_long flag = ACE_FLUSHALL); -#else - int flush (u_long flag = ACE_Task_Flags::ACE_FLUSHALL); -#endif - - // = Special routines corresponding to certain message types. - - /// Manipulate watermarks. - void water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds, size_t); - - /// Queue of messages on the ACE_Task.. - MESSAGE_QUEUE_EX *msg_queue_; - - /// 1 if should delete Message_Queue, 0 otherwise. - int delete_msg_queue_; - - /// Back-pointer to the enclosing module. - ACE_Module *mod_; - - /// Pointer to adjacent ACE_Task. - ACE_Task *next_; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Task_Ex &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Task_Ex (const ACE_Task_Ex &)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Task_Ex_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Task_Ex_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Task_Ex_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TASK_EX_H */ diff --git a/ace/Task_Ex_T.inl b/ace/Task_Ex_T.inl deleted file mode 100644 index b49f4bf53f1..00000000000 --- a/ace/Task_Ex_T.inl +++ /dev/null @@ -1,112 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/os_include/os_assert.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE void -ACE_Task_Ex::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, - size_t wm_size) -{ - ACE_TRACE ("ACE_Task_Ex::water_marks"); - if (cmd == ACE_IO_Cntl_Msg::SET_LWM) - this->msg_queue_->low_water_mark (wm_size); - else /* cmd == ACE_IO_Cntl_Msg::SET_HWM */ - this->msg_queue_->high_water_mark (wm_size); -} - -template ACE_INLINE int -ACE_Task_Ex::getq (ACE_MESSAGE_TYPE *&mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Task_Ex::getq"); - return this->msg_queue_->dequeue_head (mb, tv); -} - -template ACE_INLINE int -ACE_Task_Ex::can_put (ACE_MESSAGE_TYPE *) -{ - ACE_TRACE ("ACE_Task_Ex::can_put"); - assert (!"not implemented"); - return -1; -} - -template ACE_INLINE int -ACE_Task_Ex::putq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Task_Ex::putq"); - return this->msg_queue_->enqueue_tail (mb, tv); -} - -template ACE_INLINE int -ACE_Task_Ex::ungetq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Task_Ex::ungetq"); - return this->msg_queue_->enqueue_head (mb, tv); -} - -template ACE_INLINE int -ACE_Task_Ex::flush (u_long flag) -{ - ACE_TRACE ("ACE_Task_Ex::flush"); - if (ACE_BIT_ENABLED (flag, ACE_Task_Flags::ACE_FLUSHALL)) - return this->msg_queue_ != 0 && this->msg_queue_->close (); - else - return -1; // Note, need to be more careful about what we free... -} - -template ACE_INLINE void -ACE_Task_Ex::msg_queue (ACE_Message_Queue_Ex *mq) -{ - ACE_TRACE ("ACE_Task_Ex::msg_queue"); - if (this->delete_msg_queue_) - { - delete this->msg_queue_; - this->delete_msg_queue_ = 0; - } - this->msg_queue_ = mq; -} - -template ACE_Message_Queue_Ex * -ACE_Task_Ex::msg_queue (void) -{ - ACE_TRACE ("ACE_Task_Ex::msg_queue"); - return this->msg_queue_; -} - -template ACE_INLINE int -ACE_Task_Ex::reply (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Task_Ex::reply"); - ACE_UNUSED_ARG (mb); - ACE_UNUSED_ARG (tv); - return -1 ; // this->sibling ()->put_next (mb, tv); -} - -template ACE_INLINE ACE_Task * -ACE_Task_Ex::next (void) -{ - ACE_TRACE ("ACE_Task_Ex::next"); - return this->next_; -} - -template ACE_INLINE void -ACE_Task_Ex::next (ACE_Task *q) -{ - ACE_TRACE ("ACE_Task_Ex::next"); - this->next_ = q; -} - -// Transfer msg to the next ACE_Task_Ex. - -template ACE_INLINE int -ACE_Task_Ex::put_next ( - ACE_MESSAGE_TYPE * /* msg */, - ACE_Time_Value * /* tv */) -{ - ACE_TRACE ("ACE_Task_Ex::put_next"); - return -1; // this->next_ == 0 ? -1 : this->next_->put (msg, tv); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Task_T.cpp b/ace/Task_T.cpp deleted file mode 100644 index f0c97e74193..00000000000 --- a/ace/Task_T.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// $Id$ - -#ifndef ACE_TASK_T_CPP -#define ACE_TASK_T_CPP - -#include "ace/Task_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Module.h" -#include "ace/Null_Condition.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Task_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template void -ACE_Task::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Task::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_)); - this->msg_queue_->dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nflags = %x"), this->flags_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nmod_ = %x"), this->mod_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nnext_ = %x"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nthr_count_ = %d"), this->thr_count_)); -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - this->lock_.dump (); -#endif /* ACE_MT_SAFE */ - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// If the user doesn't supply a ACE_Message_Queue pointer then we'll -// allocate one dynamically. Otherwise, we'll use the one they give. - -template -ACE_Task::ACE_Task (ACE_Thread_Manager *thr_man, - ACE_Message_Queue *mq) - : ACE_Task_Base (thr_man), - msg_queue_ (0), - delete_msg_queue_ (0), - mod_ (0), - next_ (0) -{ - ACE_TRACE ("ACE_Task::ACE_Task"); - - if (mq == 0) - { - ACE_NEW (mq, - ACE_Message_Queue); - this->delete_msg_queue_ = 1; - } - - this->msg_queue_ = mq; -} - -template -ACE_Task::~ACE_Task (void) -{ - ACE_TRACE ("ACE_Task::~ACE_Task"); - if (this->delete_msg_queue_) - delete this->msg_queue_; - - // These assignments aren't strickly necessary but they help guard - // against odd race conditions... - this->delete_msg_queue_ = 0; -} - -template ACE_Task * -ACE_Task::sibling (void) -{ - ACE_TRACE ("ACE_Task::sibling"); - if (this->mod_ == 0) - return 0; - else - return this->mod_->sibling (this); -} - -template const ACE_TCHAR * -ACE_Task::name (void) const -{ - ACE_TRACE ("ACE_Task::name"); - if (this->mod_ == 0) - return 0; - else - return this->mod_->name (); -} - -template ACE_Module * -ACE_Task::module (void) const -{ - ACE_TRACE ("ACE_Task::module"); - return this->mod_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TASK_T_CPP */ diff --git a/ace/Task_T.h b/ace/Task_T.h deleted file mode 100644 index 285972f9d1f..00000000000 --- a/ace/Task_T.h +++ /dev/null @@ -1,198 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Task_T.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_TASK_T_H -#define ACE_TASK_T_H -#include /**/ "ace/pre.h" - -#include "ace/Message_Queue.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Synch_Traits.h" -#include "ace/Task.h" -#include "ace/IO_Cntl_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decls... -template class ACE_Module; - -#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) - using namespace ACE_Task_Flags; -#endif - -/** - * @class ACE_Task - * - * @brief Primary interface for application message processing, as well - * as input and output message queueing. - * - * This class serves as the basis for passive and active objects - * in ACE. - */ -template -class ACE_Task : public ACE_Task_Base -{ -public: - friend class ACE_Module; - friend class ACE_Module_Type; - - // = Initialization/termination methods. - /** - * Initialize a Task, supplying a thread manager and a message - * queue. If the user doesn't supply a ACE_Message_Queue pointer - * then we'll allocate one dynamically. Otherwise, we'll use the - * one passed as a parameter. - */ - ACE_Task (ACE_Thread_Manager *thr_mgr = 0, - ACE_Message_Queue *mq = 0); - - /// Destructor. - virtual ~ACE_Task (void); - - /// Gets the message queue associated with this task. - ACE_Message_Queue *msg_queue (void); - - /// Sets the message queue associated with this task. - void msg_queue (ACE_Message_Queue *); - -public: // Should be protected: - // = Message queue manipulation methods. - - // = Enqueue and dequeue methods. - - // For the following five method if == 0, the caller will - // block until action is possible, else will wait until the - // <{absolute}> time specified in * elapses). These calls - // will return, however, when queue is closed, deactivated, when a - // signal occurs, or if the time specified in timeout elapses, (in - // which case errno = EWOULDBLOCK). - - /// Insert message into the message queue. Note that uses - /// <{absolute}> time rather than <{relative}> time. - int putq (ACE_Message_Block *, ACE_Time_Value *timeout = 0); - - /** - * Extract the first message from the queue (blocking). Note that - * uses <{absolute}> time rather than <{relative}> time. - * Returns number of items in queue if the call succeeds or -1 otherwise. - */ - int getq (ACE_Message_Block *&mb, ACE_Time_Value *timeout = 0); - - /// Return a message to the queue. Note that uses - /// <{absolute}> time rather than <{relative}> time. - int ungetq (ACE_Message_Block *, ACE_Time_Value *timeout = 0); - - /** - * Turn the message around and send it back down the Stream. Note - * that uses <{absolute}> time rather than <{relative}> - * time. - */ - int reply (ACE_Message_Block *, ACE_Time_Value *timeout = 0); - - /** - * Transfer message to the adjacent ACE_Task in a ACE_Stream. Note - * that uses <{absolute}> time rather than <{relative}> - * time. - */ - int put_next (ACE_Message_Block *msg, ACE_Time_Value *timeout = 0); - - /// Tests whether we can enqueue a message without blocking. - int can_put (ACE_Message_Block *); - - // = ACE_Task utility routines to identify names et al. - /// Return the name of the enclosing Module if there's one associated - /// with the Task, else returns 0. - const ACE_TCHAR *name (void) const; - - // = Pointers to next ACE_Task_Base (if ACE is part of an ACE_Stream). - /// Get next Task pointer. - ACE_Task *next (void); - - /// Set next Task pointer. - void next (ACE_Task *); - - /// Return the Task's sibling if there's one associated with the - /// Task's Module, else returns 0. - ACE_Task *sibling (void); - - /// Return the Task's Module if there is one, else returns 0. - ACE_Module *module (void) const; - - /** - * Flush the task's queue, i.e., free all of the enqueued - * message blocks and unblocks any threads waiting on the queue. - * Note that if this conflicts with the C++ iostream - * function, just rewrite the iostream function as ::. - */ - -#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) - // Make LynxOS 3.x buggy compiler happy - int flush (u_long flag = ACE_FLUSHALL); -#else - int flush (u_long flag = ACE_Task_Flags::ACE_FLUSHALL); -#endif - - // = Special routines corresponding to certain message types. - - /// Manipulate watermarks. - void water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds, size_t); - - /// Queue of messages on the ACE_Task.. - ACE_Message_Queue *msg_queue_; - - /// 1 if should delete Message_Queue, 0 otherwise. - int delete_msg_queue_; - - /// Back-pointer to the enclosing module. - ACE_Module *mod_; - - /// Pointer to adjacent ACE_Task. - ACE_Task *next_; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Task &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Task (const ACE_Task &)) -}; - -#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT -template class ACE_Export ACE_Task; -template class ACE_Export ACE_Task; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Task_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Task_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Task_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TASK_T_H */ diff --git a/ace/Task_T.inl b/ace/Task_T.inl deleted file mode 100644 index 77d7c0d789e..00000000000 --- a/ace/Task_T.inl +++ /dev/null @@ -1,108 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/os_include/os_assert.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE void -ACE_Task::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, - size_t wm_size) -{ - ACE_TRACE ("ACE_Task::water_marks"); - if (cmd == ACE_IO_Cntl_Msg::SET_LWM) - this->msg_queue_->low_water_mark (wm_size); - else /* cmd == ACE_IO_Cntl_Msg::SET_HWM */ - this->msg_queue_->high_water_mark (wm_size); -} - -template ACE_INLINE int -ACE_Task::getq (ACE_Message_Block *&mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Task::getq"); - return this->msg_queue_->dequeue_head (mb, tv); -} - -template ACE_INLINE int -ACE_Task::can_put (ACE_Message_Block *) -{ - ACE_TRACE ("ACE_Task::can_put"); - assert (!"not implemented"); - return -1; -} - -template ACE_INLINE int -ACE_Task::putq (ACE_Message_Block *mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Task::putq"); - return this->msg_queue_->enqueue_tail (mb, tv); -} - -template ACE_INLINE int -ACE_Task::ungetq (ACE_Message_Block *mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Task::ungetq"); - return this->msg_queue_->enqueue_head (mb, tv); -} - -template ACE_INLINE int -ACE_Task::flush (u_long flag) -{ - ACE_TRACE ("ACE_Task::flush"); - if (ACE_BIT_ENABLED (flag, ACE_Task_Flags::ACE_FLUSHALL)) - return this->msg_queue_ != 0 && this->msg_queue_->close (); - else - return -1; // Note, need to be more careful about what we free... -} - -template ACE_INLINE void -ACE_Task::msg_queue (ACE_Message_Queue *mq) -{ - ACE_TRACE ("ACE_Task::msg_queue"); - if (this->delete_msg_queue_) - { - delete this->msg_queue_; - this->delete_msg_queue_ = 0; - } - this->msg_queue_ = mq; -} - -template ACE_Message_Queue * -ACE_Task::msg_queue (void) -{ - ACE_TRACE ("ACE_Task::msg_queue"); - return this->msg_queue_; -} - -template ACE_INLINE int -ACE_Task::reply (ACE_Message_Block *mb, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Task::reply"); - return this->sibling ()->put_next (mb, tv); -} - -template ACE_INLINE ACE_Task * -ACE_Task::next (void) -{ - ACE_TRACE ("ACE_Task::next"); - return this->next_; -} - -template ACE_INLINE void -ACE_Task::next (ACE_Task *q) -{ - ACE_TRACE ("ACE_Task::next"); - this->next_ = q; -} - -// Transfer msg to the next ACE_Task. - -template ACE_INLINE int -ACE_Task::put_next (ACE_Message_Block *msg, ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_Task::put_next"); - return this->next_ == 0 ? -1 : this->next_->put (msg, tv); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Test_and_Set.cpp b/ace/Test_and_Set.cpp deleted file mode 100644 index ea420bbe508..00000000000 --- a/ace/Test_and_Set.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// $Id$ - -#ifndef ACE_TEST_AND_SET_CPP -#define ACE_TEST_AND_SET_CPP - -#include "ace/Test_and_Set.h" -#include "ace/Guard_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Test_and_Set::ACE_Test_and_Set (TYPE initial_value) - : is_set_ (initial_value) -{ -} - -// Returns true if we are done, else false. -template TYPE -ACE_Test_and_Set::is_set (void) const -{ - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_, this->is_set_); - return this->is_set_; -} - -// Sets the status. -template TYPE -ACE_Test_and_Set::set (TYPE status) -{ - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, this->is_set_); - TYPE o_status = this->is_set_; - this->is_set_ = status; - return o_status; -} - -template int -ACE_Test_and_Set::handle_signal (int, siginfo_t *, ucontext_t *) -{ - // By setting this to 1, we are "signaling" to anyone calling - // or or that the "test and set" object is in the - // "signaled" state, i.e., it's "available" to be set back to 0. - this->set (1); - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TEST_AND_SET_CPP */ diff --git a/ace/Test_and_Set.h b/ace/Test_and_Set.h deleted file mode 100644 index d72c3d474b0..00000000000 --- a/ace/Test_and_Set.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Test_and_Set.h - * - * $Id$ - */ -//============================================================================= - - -#ifndef ACE_TEST_AND_SET_H -#define ACE_TEST_AND_SET_H - -#include /**/ "ace/pre.h" -#include "ace/Event_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Test_and_Set - * - * @brief Implements the classic ``test and set'' operation. - * - * - * This class keeps track of the status of , which can - * be set based on various events (such as receipt of a - * signal). This class is derived from ACE_Event_Handler so - * that it can be "signaled" by a Reactor when a signal occurs. - * We assume that is a data type that can be assigned the - * value 0 or 1. - */ -template -class ACE_Test_and_Set : public ACE_Event_Handler -{ -public: - ACE_Test_and_Set (TYPE initial_value = 0); - - /// Returns true if we are set, else false. - TYPE is_set (void) const; - - /// Sets the status, returning the original value of - /// . - TYPE set (TYPE); - - /// Called when object is signaled by OS (either via UNIX signals or - /// when a Win32 object becomes signaled). - virtual int handle_signal (int signum, - siginfo_t * = 0, - ucontext_t * = 0); - -private: - /// Keeps track of our state. - TYPE is_set_; - - /// Protect the state from race conditions. - ACE_LOCK lock_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Test_and_Set.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Test_and_Set.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TEST_AND_SET_H */ diff --git a/ace/Thread.cpp b/ace/Thread.cpp deleted file mode 100644 index a920e131be9..00000000000 --- a/ace/Thread.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// $Id$ - -#include "ace/Thread.h" - -ACE_RCSID(ace, - Thread, - "$Id$") - -#if !defined (__ACE_INLINE__) -#include "ace/Thread.inl" -#endif /* !defined (__ACE_INLINE__) */ - -#if defined (ACE_HAS_THREADS) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -size_t -ACE_Thread::spawn_n (size_t n, - ACE_THR_FUNC func, - void *arg, - long flags, - long priority, - void *stack[], - size_t stack_size[], - ACE_Thread_Adapter *thread_adapter) -{ - ACE_TRACE ("ACE_Thread::spawn_n"); - ACE_thread_t t_id; - size_t i; - - for (i = 0; i < n; i++) - // Bail out if error occurs. - if (ACE_OS::thr_create (func, - arg, - flags, - &t_id, - 0, - priority, - stack == 0 ? 0 : stack[i], - stack_size == 0 ? 0 : stack_size[i], - thread_adapter) != 0) - break; - - return i; -} - -size_t -ACE_Thread::spawn_n (ACE_thread_t thread_ids[], - size_t n, - ACE_THR_FUNC func, - void *arg, - long flags, - long priority, - void *stack[], - size_t stack_size[], - ACE_hthread_t thread_handles[], - ACE_Thread_Adapter *thread_adapter) -{ - ACE_TRACE ("ACE_Thread::spawn_n"); - size_t i; - - for (i = 0; i < n; i++) - { - ACE_thread_t t_id; - ACE_hthread_t t_handle; - - int result = - ACE_OS::thr_create (func, - arg, - flags, - &t_id, - &t_handle, - priority, - stack == 0 ? 0 : stack[i], - stack_size == 0 ? 0 : stack_size[i], - thread_adapter); - - if (result == 0) - { - if (thread_ids != 0) - thread_ids[i] = t_id; - if (thread_handles != 0) - thread_handles[i] = t_handle; - } - else - // Bail out if error occurs. - break; - } - - return i; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/Thread.h b/ace/Thread.h deleted file mode 100644 index ba1b9d64a57..00000000000 --- a/ace/Thread.h +++ /dev/null @@ -1,278 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Thread.h - * - * $Id$ - * - * @author Douglas Schmidt - */ -//========================================================================== - -#ifndef ACE_THREAD_H -#define ACE_THREAD_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_Thread.h" -#include "ace/Thread_Adapter.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -struct cancel_state -{ - /// e.g., PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE, - /// PTHREAD_CANCELED. - int cancelstate; - - /// e.g., PTHREAD_CANCEL_DEFERRED and PTHREAD_CANCEL_ASYNCHRONOUS. - int canceltype; -}; - -/** - * @class ACE_Thread - * - * @brief Provides a wrapper for threads. - * - * This class provides a common interface that is mapped onto - * POSIX Pthreads, Solaris threads, Win32 threads, VxWorks - * threads, or pSoS threads. Note, however, that it is - * generally a better idea to use the - * programming API rather than the API since the - * thread manager is more powerful. - */ -class ACE_Export ACE_Thread -{ -public: - /** - * Creates a new thread having attributes and running - * with (if is non-0 then and - * are ignored and are obtained from ). - * and are set to the thread's ID and handle (?), - * respectively. The thread runs at priority (see - * below). - * - * The are a bitwise-OR of the following: - * = BEGIN - * THR_CANCEL_DISABLE, THR_CANCEL_ENABLE, THR_CANCEL_DEFERRED, - * THR_CANCEL_ASYNCHRONOUS, THR_BOUND, THR_NEW_LWP, THR_DETACHED, - * THR_SUSPENDED, THR_DAEMON, THR_JOINABLE, THR_SCHED_FIFO, - * THR_SCHED_RR, THR_SCHED_DEFAULT, THR_EXPLICIT_SCHED, - * THR_SCOPE_SYSTEM, THR_SCOPE_PROCESS - * = END - * - * By default, or if is set to - * ACE_DEFAULT_THREAD_PRIORITY, an "appropriate" priority value for - * the given scheduling policy (specified in , e.g., - * ) is used. This value is calculated - * dynamically, and is the median value between the minimum and - * maximum priority values for the given policy. If an explicit - * value is given, it is used. Note that actual priority values are - * EXTREMEMLY implementation-dependent, and are probably best - * avoided. - * - * Note that is always deleted when - * is called, so it must be allocated with global operator new. - */ - static int spawn (ACE_THR_FUNC func, - void *arg = 0, - long flags = THR_NEW_LWP | THR_JOINABLE, - ACE_thread_t *t_id = 0, - ACE_hthread_t *t_handle = 0, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - void *stack = 0, - size_t stack_size = 0, - ACE_Thread_Adapter *thread_adapter = 0); - - /** - * Spawn N new threads, which execute with argument (if - * is non-0 then and are ignored and - * are obtained from ). If != 0 it is - * assumed to be an array of pointers to the base of the stacks - * to use for the threads being spawned. Likewise, if - * != 0 it is assumed to be an array of values indicating how - * big each of the corresponding s are. Returns the number - * of threads actually spawned (if this doesn't equal the number - * requested then something has gone wrong and will - * explain...). - * - * @see spawn() - */ - static size_t spawn_n (size_t n, - ACE_THR_FUNC func, - void *arg = 0, - long flags = THR_NEW_LWP | THR_JOINABLE, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - void *stack[] = 0, - size_t stack_size[] = 0, - ACE_Thread_Adapter *thread_adapter = 0); - - /** - * Spawn new threads, which execute with argument - * (if is non-0 then and are ignored - * and are obtained from ). The thread_ids of - * successfully spawned threads will be placed into the - * buffer (which must be the same size as ). If != 0 it - * is assumed to be an array of pointers to the base of the - * stacks to use for the threads being spawned. If != - * 0 it is assumed to be an array of values indicating how big - * each of the corresponding s are. If != 0 - * it is assumed to be an array of thread_handles that will be - * assigned the values of the thread handles being spawned. Returns - * the number of threads actually spawned (if this doesn't equal the - * number requested then something has gone wrong and will - * explain...). - * - * @see spawn() - */ - static size_t spawn_n (ACE_thread_t thread_ids[], - size_t n, - ACE_THR_FUNC func, - void *arg, - long flags, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - void *stack[] = 0, - size_t stack_size[] = 0, - ACE_hthread_t thread_handles[] = 0, - ACE_Thread_Adapter *thread_adapter = 0); - - /** - * Wait for one or more threads to exit and reap their exit status. - * thr_join() returns successfully when the target thread terminates. - * - * @param thread_id is the ACE_thread_t ID of the thread to wait for. - * If @a thread_id is 0, join() waits for any - * undetached thread in the process to terminate - * on platforms that support this capability - * (for example, Solaris). - * @param departed points to a location that is set to the ID of the - * terminated thread if join() returns successfully. - * If @a departed is 0, it is ignored. - * @param status Points to the location that receives the joined - * thread's exit value. If @a status is 0, it is ignored. - * - * @retval 0 for success; -1 (with errno set) for failure. - */ - static int join (ACE_thread_t thread_id, - ACE_thread_t *departed, - ACE_THR_FUNC_RETURN *status); - - /// Wait for one thread to exit and reap its exit status. - static int join (ACE_hthread_t, - ACE_THR_FUNC_RETURN * = 0); - - /// Continue the execution of a previously suspended thread. - static int resume (ACE_hthread_t); - - /// Suspend the execution of a particular thread. - static int suspend (ACE_hthread_t); - - /// Get the priority of a particular thread. - static int getprio (ACE_hthread_t ht_id, int &priority); - - /// Get the priority and policy of a particular thread. - static int getprio (ACE_hthread_t ht_id, int &priority, int &policy); - - /// Set the priority of a particular thread. - static int setprio (ACE_hthread_t ht_id, int priority, int policy = -1); - - /// Send a signal to the thread. - static int kill (ACE_thread_t, int signum); - - /// Yield the thread to another. - static void yield (void); - - /** - * Return the unique kernel handle of the thread. Note that on - * Win32 this is actually a pseudohandle, which cannot be shared - * with other processes or waited on by threads. To locate the real - * handle, please use the ACE_Thread_Manager::thr_self() method. - */ - static void self (ACE_hthread_t &t_handle); - - /// Return the unique ID of the thread. - static ACE_thread_t self (void); - - /// Exit the current thread and return "status". - /// Should _not_ be called by main thread. - static void exit (ACE_THR_FUNC_RETURN status = 0); - - /// Get the LWP concurrency level of the process. - static int getconcurrency (void); - - /// Set the LWP concurrency level of the process. - static int setconcurrency (int new_level); - - /// Change and/or examine calling thread's signal mask. - static int sigsetmask (int how, - const sigset_t *sigset, - sigset_t *osigset = 0); - - /** - * Allocates a that is used to identify data that is specific - * to each thread in the process. The key is global to all threads - * in the process. - */ - static int keycreate (ACE_thread_key_t *keyp, -#if defined (ACE_HAS_THR_C_DEST) - ACE_THR_C_DEST destructor, -#else - ACE_THR_DEST destructor, -#endif /* ACE_HAS_THR_C_DEST */ - void * = 0); - - /// Free up the key so that other threads can reuse it. - static int keyfree (ACE_thread_key_t key); - - /// Bind value to the thread-specific data key, , for the calling - /// thread. - static int setspecific (ACE_thread_key_t key, - void *value); - - /// Stores the current value bound to for the calling thread - /// into the location pointed to by . - static int getspecific (ACE_thread_key_t key, - void **valuep); - - /// Disable thread cancellation. - static int disablecancel (struct cancel_state *old_state); - - /// Enable thread cancellation. - static int enablecancel (struct cancel_state *old_state, - int flag); - - /// Set the cancellation state. - static int setcancelstate (struct cancel_state &new_state, - struct cancel_state *old_state); - - /** - * Cancel a thread. Note that this method is only portable on - * platforms, such as POSIX pthreads, that support thread - * cancellation. - */ - static int cancel (ACE_thread_t t_id); - - /// Test the cancel. - static void testcancel (void); - -private: - /// Ensure that we don't get instantiated. - ACE_Thread (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Thread.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_THREAD_H */ diff --git a/ace/Thread.inl b/ace/Thread.inl deleted file mode 100644 index ba635c6b2f0..00000000000 --- a/ace/Thread.inl +++ /dev/null @@ -1,284 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Allocates a that is used to identify data that is specific -// to each thread in the process. The key is global to all threads in -// the process. - -ACE_INLINE int -ACE_Thread::keycreate (ACE_thread_key_t *keyp, -#if defined (ACE_HAS_THR_C_DEST) - ACE_THR_C_DEST destructor, -#else - ACE_THR_DEST destructor, -#endif /* ACE_HAS_THR_C_DEST */ - void *inst) -{ - // ACE_TRACE ("ACE_Thread::keycreate"); - return ACE_OS::thr_keycreate (keyp, destructor, inst); -} - -// Free up the key so that other threads can reuse it. - -ACE_INLINE int -ACE_Thread::keyfree (ACE_thread_key_t key) -{ - ACE_TRACE ("ACE_Thread::keyfree"); - return ACE_OS::thr_keyfree (key); -} - -// Bind value to the thread-specific data key, , for the calling -// thread. - -ACE_INLINE int -ACE_Thread::setspecific (ACE_thread_key_t key, void *value) -{ - // ACE_TRACE ("ACE_Thread::setspecific"); - return ACE_OS::thr_setspecific (key, value); -} - -// Stores the current value bound to for the calling thread -// into the location pointed to by . - -ACE_INLINE int -ACE_Thread::getspecific (ACE_thread_key_t key, void **valuep) -{ - // ACE_TRACE ("ACE_Thread::getspecific"); - return ACE_OS::thr_getspecific (key, valuep); -} - -ACE_INLINE ACE_thread_t -ACE_Thread::self (void) -{ -// ACE_TRACE ("ACE_Thread::self"); - return ACE_OS::thr_self (); -} - -ACE_INLINE void -ACE_Thread::exit (ACE_THR_FUNC_RETURN status) -{ - ACE_TRACE ("ACE_Thread::exit"); - ACE_OS::thr_exit (status); -} - -ACE_INLINE void -ACE_Thread::yield (void) -{ - ACE_TRACE ("ACE_Thread::yield"); - ACE_OS::thr_yield (); -} - -ACE_INLINE int -ACE_Thread::spawn (ACE_THR_FUNC func, - void *arg, - long flags, - ACE_thread_t *t_id, - ACE_hthread_t *t_handle, - long priority, - void *thr_stack, - size_t thr_stack_size, - ACE_Thread_Adapter *thread_adapter) -{ - ACE_TRACE ("ACE_Thread::spawn"); - - return ACE_OS::thr_create (func, - arg, - flags, - t_id, - t_handle, - priority, - thr_stack, - thr_stack_size, - thread_adapter); -} - -ACE_INLINE int -ACE_Thread::resume (ACE_hthread_t t_id) -{ - ACE_TRACE ("ACE_Thread::resume"); - return ACE_OS::thr_continue (t_id); -} - -ACE_INLINE int -ACE_Thread::suspend (ACE_hthread_t t_id) -{ - ACE_TRACE ("ACE_Thread::suspend"); - return ACE_OS::thr_suspend (t_id); -} - -ACE_INLINE int -ACE_Thread::kill (ACE_thread_t t_id, int signum) -{ - ACE_TRACE ("ACE_Thread::kill"); - return ACE_OS::thr_kill (t_id, signum); -} - -ACE_INLINE int -ACE_Thread::join (ACE_thread_t wait_for, - ACE_thread_t *departed, - ACE_THR_FUNC_RETURN *status) -{ - ACE_TRACE ("ACE_Thread::join"); - return ACE_OS::thr_join (wait_for, departed, status); -} - -ACE_INLINE int -ACE_Thread::join (ACE_hthread_t wait_for, - ACE_THR_FUNC_RETURN *status) -{ - ACE_TRACE ("ACE_Thread::join"); - return ACE_OS::thr_join (wait_for, status); -} - -ACE_INLINE int -ACE_Thread::getconcurrency (void) -{ - ACE_TRACE ("ACE_Thread::getconcurrency"); - return ACE_OS::thr_getconcurrency (); -} - -ACE_INLINE int -ACE_Thread::setconcurrency (int new_level) -{ - ACE_TRACE ("ACE_Thread::setconcurrency"); - return ACE_OS::thr_setconcurrency (new_level); -} - -ACE_INLINE int -ACE_Thread::sigsetmask (int how, - const sigset_t *sigset, - sigset_t *osigset) -{ - ACE_TRACE ("ACE_Thread::sigsetmask"); - return ACE_OS::thr_sigsetmask (how, sigset, osigset); -} - -ACE_INLINE int -ACE_Thread::disablecancel (struct cancel_state *old_state) -{ - ACE_TRACE ("ACE_Thread::disablecancel"); - int old_cstate = 0; - int result = ACE_OS::thr_setcancelstate (THR_CANCEL_DISABLE, - &old_cstate); - if (result == 0 && old_state != 0) - { - ACE_OS::memset (old_state, - 0, - sizeof (old_state)); - old_state->cancelstate = old_cstate; - } - - return result; -} - -ACE_INLINE int -ACE_Thread::enablecancel (struct cancel_state *old_state, - int flag) -{ - ACE_TRACE ("ACE_Thread::enablecancel"); - int old_cstate = 0; - int old_ctype = 0; - int result; - - result = ACE_OS::thr_setcancelstate (THR_CANCEL_ENABLE, - &old_cstate); - if (result != 0) - return result; - - result = ACE_OS::thr_setcanceltype (flag, - &old_ctype); - if (result != 0) - return result; - - if (old_state != 0) - { - old_state->cancelstate = old_cstate; - old_state->canceltype = old_ctype; - } - - return 0; -} - -ACE_INLINE int -ACE_Thread::setcancelstate (struct cancel_state &new_state, - struct cancel_state *old_state) -{ - ACE_TRACE ("ACE_Thread::setcancelstate"); - int old_cstate = 0; - int old_ctype = 0; - - if (new_state.cancelstate != 0 - && ACE_OS::thr_setcancelstate (new_state.cancelstate, - &old_cstate) != 0) - return -1; - - if (new_state.canceltype != 0 - && ACE_OS::thr_setcanceltype (new_state.canceltype, - &old_ctype) != 0) - { - int o_cstate; - - ACE_OS::thr_setcancelstate (old_cstate, - &o_cstate); - return -1; - } - - if (old_state != 0) - { - old_state->cancelstate = old_cstate; - old_state->canceltype = old_ctype; - } - - return 0; -} - -ACE_INLINE int -ACE_Thread::cancel (ACE_thread_t t_id) -{ - ACE_TRACE ("ACE_Thread::cancel"); - - return ACE_OS::thr_cancel (t_id); -} - -ACE_INLINE void -ACE_Thread::testcancel (void) -{ - ACE_TRACE ("ACE_Thread::testcancel"); - - ACE_OS::thr_testcancel (); -} - -ACE_INLINE void -ACE_Thread::self (ACE_hthread_t &t_id) -{ -// ACE_TRACE ("ACE_Thread::self"); - ACE_OS::thr_self (t_id); -} - -ACE_INLINE int -ACE_Thread::getprio (ACE_hthread_t ht_id, int &priority) -{ - ACE_TRACE ("ACE_Thread::getprio"); - return ACE_OS::thr_getprio (ht_id, priority); -} - -ACE_INLINE int -ACE_Thread::getprio (ACE_hthread_t ht_id, int &priority, int &policy) -{ - ACE_TRACE ("ACE_Thread::getprio"); - return ACE_OS::thr_getprio (ht_id, priority, policy); -} - -ACE_INLINE int -ACE_Thread::setprio (ACE_hthread_t ht_id, int priority, int policy) -{ - ACE_TRACE ("ACE_Thread::setprio"); - return ACE_OS::thr_setprio (ht_id, priority, policy); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Adapter.cpp b/ace/Thread_Adapter.cpp deleted file mode 100644 index d68dc6c8061..00000000000 --- a/ace/Thread_Adapter.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// $Id$ - -#include "ace/Thread_Adapter.h" -#include "ace/Thread_Manager.h" -#include "ace/Thread_Exit.h" -#include "ace/Thread_Hook.h" -#include "ace/Object_Manager_Base.h" - -ACE_RCSID (ace, - Thread_Adapter, - "$Id$") - -#if !defined (ACE_HAS_INLINED_OSCALLS) -# include "ace/Thread_Adapter.inl" -#endif /* ACE_HAS_INLINED_OSCALLS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func, - void *arg, - ACE_THR_C_FUNC entry_point, - ACE_Thread_Manager *tm, - ACE_Thread_Descriptor *td -#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector, - ACE_SEH_EXCEPT_HANDLER handler -#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ) - : ACE_Base_Thread_Adapter ( - user_func - , arg - , entry_point - , td -#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , selector - , handler -#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ) - , thr_mgr_ (tm) -{ - ACE_OS_TRACE ("ACE_Thread_Adapter::ACE_Thread_Adapter"); -} - -ACE_Thread_Adapter::~ACE_Thread_Adapter (void) -{ -} - -ACE_THR_FUNC_RETURN -ACE_Thread_Adapter::invoke (void) -{ - // Inherit the logging features if the parent thread has an - // ACE_Log_Msg instance in thread-specific storage. - this->inherit_log_msg (); - -#if !defined(ACE_USE_THREAD_MANAGER_ADAPTER) - // NOTE: this preprocessor directive should match the one in above - // ACE_Thread_Exit::instance (). With the Xavier Pthreads package, - // the exit_hook in TSS causes a seg fault. So, this works around - // that by creating exit_hook on the stack. -# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION) - // Obtain our thread-specific exit hook and make sure that it knows - // how to clean us up! Note that we never use this pointer directly - // (it's stored in thread-specific storage), so it's ok to - // dereference it here and only store it as a reference. - - // Except if it is null, then the thr_mgr() method crashes. - // -jxh - - ACE_Thread_Exit *exit_hook_instance = ACE_Thread_Exit::instance (); - ACE_Thread_Exit_Maybe exit_hook_maybe (exit_hook_instance == 0); - ACE_Thread_Exit *exit_hook_ptr = exit_hook_instance - ? exit_hook_instance - : exit_hook_maybe.instance (); - ACE_Thread_Exit &exit_hook = *exit_hook_ptr; - - if (this->thr_mgr () != 0) - { - // Keep track of the that's associated with this - // . - exit_hook.thr_mgr (this->thr_mgr ()); - } -# else - // Without TSS, create an instance. When this - // function returns, its destructor will be called because the - // object goes out of scope. The drawback with this appraoch is - // that the destructor _won't_ get called if is called. - // So, threads shouldn't exit that way. Instead, they should return - // from . - ACE_Thread_Exit exit_hook; - exit_hook.thr_mgr (this->thr_mgr ()); -# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ - -#endif /* ! ACE_USE_THREAD_MANAGER_ADAPTER */ - - return this->invoke_i (); -} - -ACE_THR_FUNC_RETURN -ACE_Thread_Adapter::invoke_i (void) -{ - // Extract the arguments. - ACE_THR_FUNC func = reinterpret_cast (this->user_func_); - void *arg = this->arg_; - -#if defined (ACE_WIN32) && defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) - ACE_OS_Thread_Descriptor *thr_desc = this->thr_desc_; -#endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */ - - // Delete ourselves since we don't need anymore. Make sure - // not to access anywhere below this point. - delete this; - -#if defined (ACE_NEEDS_LWP_PRIO_SET) - // On SunOS, the LWP priority needs to be set in order to get - // preemption when running in the RT class. This is the ACE way to - // do that . . . - ACE_hthread_t thr_handle; - ACE_OS::thr_self (thr_handle); - int prio; - - // thr_getprio () on the current thread should never fail. - ACE_OS::thr_getprio (thr_handle, prio); - - // ACE_OS::thr_setprio () has the special logic to set the LWP priority, - // if running in the RT class. - ACE_OS::thr_setprio (prio); - -#endif /* ACE_NEEDS_LWP_PRIO_SET */ - - ACE_THR_FUNC_RETURN status = 0; - - ACE_SEH_TRY - { - ACE_SEH_TRY - { - ACE_Thread_Hook *hook = - ACE_OS_Object_Manager::thread_hook (); - - if (hook) - // Invoke the start hook to give the user a chance to - // perform some initialization processing before the - // is invoked. - status = hook->start (func, arg); - else - // Call thread entry point. - status = (*func) (arg); - } - -#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - ACE_SEH_EXCEPT (ACE_OS_Object_Manager::seh_except_selector ()( - (void *) GetExceptionInformation ())) - { - ACE_OS_Object_Manager::seh_except_handler ()(0); - } -#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - } - - ACE_SEH_FINALLY - { - // If we changed this to 1, change the respective if in - // Task::svc_run to 0. -#if 0 - // Call the close> hook. - if (func == reinterpret_cast ( - ACE_Task_Base::svc_run)) - { - ACE_Task_Base *task_ptr = (ACE_Task_Base *) arg; - ACE_Thread_Manager *thr_mgr_ptr = task_ptr->thr_mgr (); - - // This calls the Task->close () hook. - task_ptr->cleanup (task_ptr, 0); - - // This prevents a second invocation of the cleanup code - // (called later by . - thr_mgr_ptr->at_exit (task_ptr, 0, 0); - } -#endif /* 0 */ - -#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) -# if defined (ACE_WIN32) && defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) - int using_afx = -1; - if (thr_desc) - using_afx = ACE_BIT_ENABLED (thr_desc->flags (), THR_USE_AFX); -# endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */ - // Call TSS destructors. - ACE_OS::cleanup_tss (0 /* not main thread */); - -# if defined (ACE_WIN32) - // Exit the thread. Allow CWinThread-destructor to be invoked - // from AfxEndThread. _endthreadex will be called from - // AfxEndThread so don't exit the thread now if we are running - // an MFC thread. -# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) - if (using_afx != -1) - { - if (using_afx) - ::AfxEndThread ((DWORD) status); - else - ACE_ENDTHREADEX (status); - } - else - { - // Not spawned by ACE_Thread_Manager, use the old buggy - // version. You should seriously consider using - // ACE_Thread_Manager to spawn threads. The following code - // is know to cause some problem. - CWinThread *pThread = ::AfxGetThread (); - - if (!pThread || pThread->m_nThreadID != ACE_OS::thr_self ()) - ACE_ENDTHREADEX (status); - else - ::AfxEndThread ((DWORD)status); - } -# else - - ACE_ENDTHREADEX (status); -# endif /* ACE_HAS_MFC && ACE_HAS_MFS != 0*/ -# endif /* ACE_WIN32 */ -#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */ - } - - return status; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Adapter.h b/ace/Thread_Adapter.h deleted file mode 100644 index 046d21b238f..00000000000 --- a/ace/Thread_Adapter.h +++ /dev/null @@ -1,100 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Thread_Adapter.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ -//============================================================================= - -#ifndef ACE_THREAD_ADAPTER_H -#define ACE_THREAD_ADAPTER_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Base_Thread_Adapter.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl. -class ACE_Thread_Manager; -class ACE_Thread_Descriptor; - -/** - * @class ACE_Thread_Adapter - * - * @brief Converts a C++ function into a function that - * can be called from a thread creation routine - * (e.g., pthread_create() or _beginthreadex()) that expects an - * extern "C" entry point. This class also makes it possible to - * transparently provide hooks to register a thread with an - * ACE_Thread_Manager. - * - * This class is used in ACE_OS::thr_create(). In general, the - * thread that creates an object of this class is different from - * the thread that calls @c invoke() on this object. Therefore, - * the @c invoke() method is responsible for deleting itself. - */ -class ACE_Export ACE_Thread_Adapter : public ACE_Base_Thread_Adapter -{ -public: - /// Constructor. - ACE_Thread_Adapter (ACE_THR_FUNC user_func, - void *arg, - ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, - ACE_Thread_Manager *thr_mgr = 0, - ACE_Thread_Descriptor *td = 0 -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector = 0, - ACE_SEH_EXCEPT_HANDLER handler = 0 -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ); - - /** - * Execute the with the . This function deletes - * , thereby rendering the object useless after the call - * returns. - */ - virtual ACE_THR_FUNC_RETURN invoke (void); - - /// Accessor for the optional . - ACE_Thread_Manager *thr_mgr (void); - -protected: - - /// Ensure that this object must be allocated on the heap. - ~ACE_Thread_Adapter (void); - -private: - - /// Called by invoke, mainly here to separate the SEH stuff because - /// SEH on Win32 doesn't compile with local vars with destructors. - virtual ACE_THR_FUNC_RETURN invoke_i (void); - -private: - - /// Optional thread manager. - ACE_Thread_Manager *thr_mgr_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_HAS_INLINED_OSCALLS) -# if defined (ACE_INLINE) -# undef ACE_INLINE -# endif /* ACE_INLINE */ -# define ACE_INLINE inline -# include "ace/Thread_Adapter.inl" -# endif /* ACE_HAS_INLINED_OSCALLS */ - -#include /**/ "ace/post.h" -#endif /* ACE_THREAD_ADAPTER_H */ diff --git a/ace/Thread_Adapter.inl b/ace/Thread_Adapter.inl deleted file mode 100644 index 4f1fa0fce49..00000000000 --- a/ace/Thread_Adapter.inl +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_Thread_Manager * -ACE_Thread_Adapter::thr_mgr (void) -{ - return this->thr_mgr_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Control.cpp b/ace/Thread_Control.cpp deleted file mode 100644 index 594aa4618cb..00000000000 --- a/ace/Thread_Control.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// $Id$ - -// -#include "ace/config-all.h" -#if defined (ACE_LEGACY_MODE) -// This silly include breaks a cycle when compiling in backwards -// compatibility mode -# include "ace/Thread_Exit.h" -#endif /* ACE_LEGACY_MODE */ -// - -#include "ace/Thread_Control.h" -#include "ace/Thread_Manager.h" - -ACE_RCSID(ace, Thread_Control, "$Id$") - -#if !defined (ACE_HAS_INLINED_OSCALLS) -# include "ace/Thread_Control.inl" -#endif /* ACE_HAS_INLINED_OSCALLS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Thread_Control::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_OS_TRACE ("ACE_Thread_Control::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_Thread_Control::insert (ACE_Thread_Manager *tm, int insert) -{ - ACE_OS_TRACE ("ACE_Thread_Control::insert"); - - ACE_hthread_t t_id; - ACE_OS::thr_self (t_id); - this->tm_ = tm; - - if (insert) - return this->tm_->insert_thr (ACE_OS::thr_self (), t_id); - else - return 0; -} - -// Initialize the thread controller. - -ACE_Thread_Control::ACE_Thread_Control (ACE_Thread_Manager *t, - int insert) - : tm_ (t), - status_ (0) -{ - ACE_OS_TRACE ("ACE_Thread_Control::ACE_Thread_Control"); - - if (this->tm_ != 0 && insert) - { - ACE_hthread_t t_id; - ACE_OS::thr_self (t_id); - this->tm_->insert_thr (ACE_OS::thr_self (), t_id); - } -} - -// Automatically kill thread on exit. - -ACE_Thread_Control::~ACE_Thread_Control (void) -{ - ACE_OS_TRACE ("ACE_Thread_Control::~ACE_Thread_Control"); - -#if defined (ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS) || defined (ACE_HAS_TSS_EMULATION) || defined (ACE_WIN32) - this->exit (this->status_, 0); -#else - this->exit (this->status_, 1); -#endif /* ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS */ -} - -// Exit from thread (but clean up first). - -ACE_THR_FUNC_RETURN -ACE_Thread_Control::exit (ACE_THR_FUNC_RETURN exit_status, int do_thr_exit) -{ - ACE_OS_TRACE ("ACE_Thread_Control::exit"); - - if (this->tm_ != 0) - return this->tm_->exit (exit_status, do_thr_exit); - else - { -#if !defined (ACE_HAS_TSS_EMULATION) - // With ACE_HAS_TSS_EMULATION, we let ACE_Thread_Adapter::invoke () - // exit the thread after cleaning up TSS. - ACE_OS::thr_exit (exit_status); -#endif /* ! ACE_HAS_TSS_EMULATION */ - return 0; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Control.h b/ace/Thread_Control.h deleted file mode 100644 index 6989d77daad..00000000000 --- a/ace/Thread_Control.h +++ /dev/null @@ -1,102 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Thread_Control.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ -//============================================================================= - - -#ifndef ACE_THREAD_CONTROL_H -#define ACE_THREAD_CONTROL_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Thread_Manager; - -/** - * @class ACE_Thread_Control - * - * @brief Used to keep track of a thread's activities within its entry - * point function. - * - * A ACE_Thread_Manager uses this class to ensure that threads - * it spawns automatically register and unregister themselves - * with it. - * This class can be stored in thread-specific storage using the - * ACE_TSS wrapper. When a thread exits the - * function deletes this object, thereby - * ensuring that it gets removed from its associated - * ACE_Thread_Manager. - */ -class ACE_Export ACE_Thread_Control -{ -public: - /// Initialize the thread control object. If != 0, then - /// register the thread with the Thread_Manager. - ACE_Thread_Control (ACE_Thread_Manager *tm = 0, - int insert = 0); - - /// Remove the thread from its associated and exit - /// the thread if is enabled. - ~ACE_Thread_Control (void); - - /// Remove this thread from its associated ACE_Thread_Manager and exit - /// the thread if @a do_thr_exit is enabled. - ACE_THR_FUNC_RETURN exit (ACE_THR_FUNC_RETURN status, - int do_thr_exit); - - /// Store the and use it to register ourselves for - /// correct shutdown. - int insert (ACE_Thread_Manager *tm, int insert = 0); - - /// Returns the current . - ACE_Thread_Manager *thr_mgr (void); - - /// Atomically set a new and return the old - /// . - ACE_Thread_Manager *thr_mgr (ACE_Thread_Manager *); - - /// Set the exit status (and return existing status). - ACE_THR_FUNC_RETURN status (ACE_THR_FUNC_RETURN status); - - /// Get the current exit status. - ACE_THR_FUNC_RETURN status (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Pointer to the thread manager for this block of code. - ACE_Thread_Manager *tm_; - - /// Keeps track of the exit status for the thread. - ACE_THR_FUNC_RETURN status_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_HAS_INLINED_OSCALLS) -# if defined (ACE_INLINE) -# undef ACE_INLINE -# endif /* ACE_INLINE */ -# define ACE_INLINE inline -# include "ace/Thread_Control.inl" -# endif /* ACE_HAS_INLINED_OSCALLS */ - -#include /**/ "ace/post.h" -#endif /* ACE_THREAD_CONTROL_H */ diff --git a/ace/Thread_Control.inl b/ace/Thread_Control.inl deleted file mode 100644 index 7b96cb369f8..00000000000 --- a/ace/Thread_Control.inl +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Set the exit status. - -ACE_INLINE ACE_THR_FUNC_RETURN -ACE_Thread_Control::status (ACE_THR_FUNC_RETURN s) -{ - ACE_OS_TRACE ("ACE_Thread_Control::status"); - return this->status_ = s; -} - -// Get the exit status. - -ACE_INLINE ACE_THR_FUNC_RETURN -ACE_Thread_Control::status (void) -{ - ACE_OS_TRACE ("ACE_Thread_Control::status"); - return this->status_; -} - -// Returns the current . - -ACE_INLINE ACE_Thread_Manager * -ACE_Thread_Control::thr_mgr (void) -{ - ACE_OS_TRACE ("ACE_Thread_Control::thr_mgr"); - return this->tm_; -} - -// Atomically set a new and return the old -// . - -ACE_INLINE ACE_Thread_Manager * -ACE_Thread_Control::thr_mgr (ACE_Thread_Manager *tm) -{ - ACE_OS_TRACE ("ACE_Thread_Control::thr_mgr"); - ACE_Thread_Manager *o_tm = this->tm_; - this->tm_ = tm; - return o_tm; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Exit.cpp b/ace/Thread_Exit.cpp deleted file mode 100644 index 6ef493e7b97..00000000000 --- a/ace/Thread_Exit.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// $Id$ - -#include "ace/Thread_Exit.h" -#include "ace/Managed_Object.h" -#include "ace/Thread_Manager.h" -#include "ace/Guard_T.h" - -ACE_RCSID(ace, Thread_Exit, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -u_int ACE_Thread_Exit::is_constructed_ = 0; - -void -ACE_Thread_Exit::cleanup (void *instance) -{ - ACE_OS_TRACE ("ACE_Thread_Exit::cleanup"); - - delete (ACE_TSS_TYPE (ACE_Thread_Exit) *) instance; - - // Set the thr_exit_ static to null to keep things from crashing if - // ACE::fini() is enabled here. - ACE_Thread_Manager::thr_exit_ = 0; - - ACE_Thread_Exit::is_constructed_ = 0; - // All TSS objects have been destroyed. Reset this flag so - // ACE_Thread_Exit singleton can be created again. -} - -// NOTE: this preprocessor directive should match the one in -// ACE_Task_Base::svc_run () below. This prevents the two statics -// from being defined. - -ACE_Thread_Exit * -ACE_Thread_Exit::instance (void) -{ -#if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION) - ACE_OS_TRACE ("ACE_Thread_Exit::instance"); - - // Determines if we were dynamically allocated. - static ACE_TSS_TYPE (ACE_Thread_Exit) *instance_; - - // Implement the Double Check pattern. - - if (ACE_Thread_Exit::is_constructed_ == 0) - { - ACE_MT (ACE_Thread_Mutex *lock = - ACE_Managed_Object::get_preallocated_object - (ACE_Object_Manager::ACE_THREAD_EXIT_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0)); - - if (ACE_Thread_Exit::is_constructed_ == 0) - { - ACE_NEW_RETURN (instance_, - ACE_TSS_TYPE (ACE_Thread_Exit), - 0); - - ACE_Thread_Exit::is_constructed_ = 1; - - ACE_Thread_Manager::set_thr_exit (instance_); - } - } - - return ACE_TSS_GET (instance_, ACE_Thread_Exit); -#else - return 0; -#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ -} - -// Grab hold of the Task * so that we can close() it in the -// destructor. - -ACE_Thread_Exit::ACE_Thread_Exit (void) -{ - ACE_OS_TRACE ("ACE_Thread_Exit::ACE_Thread_Exit"); -} - -// Set the this pointer... - -void -ACE_Thread_Exit::thr_mgr (ACE_Thread_Manager *tm) -{ - ACE_OS_TRACE ("ACE_Thread_Exit::thr_mgr"); - - if (tm != 0) - this->thread_control_.insert (tm, 0); -} - -// When this object is destroyed the Task is automatically closed -// down! - -ACE_Thread_Exit::~ACE_Thread_Exit (void) -{ - ACE_OS_TRACE ("ACE_Thread_Exit::~ACE_Thread_Exit"); -} - -ACE_Thread_Exit_Maybe::ACE_Thread_Exit_Maybe (int flag) - : instance_ (0) -{ - if (flag) - { - ACE_NEW (instance_, ACE_Thread_Exit); - } -} - -ACE_Thread_Exit_Maybe::~ACE_Thread_Exit_Maybe (void) -{ - delete this->instance_; -} - -ACE_Thread_Exit * -ACE_Thread_Exit_Maybe::operator -> (void) const -{ - return this->instance_; -} - -ACE_Thread_Exit * -ACE_Thread_Exit_Maybe::instance (void) const -{ - return this->instance_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Exit.h b/ace/Thread_Exit.h deleted file mode 100644 index fc828c5aa03..00000000000 --- a/ace/Thread_Exit.h +++ /dev/null @@ -1,111 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Thread_Exit.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ -//============================================================================= - - -#ifndef ACE_THREAD_EXIT_H -#define ACE_THREAD_EXIT_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Thread_Control.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Thread_Exit - * - * @brief Keep exit information for a Thread in thread specific storage. - * so that the thread-specific exit hooks will get called no - * matter how the thread exits (e.g., via , C++ - * or Win32 exception, "falling off the end" of the thread entry - * point function, etc.). - * - * This clever little helper class is stored in thread-specific - * storage using the wrapper. When a thread exits the - * function deletes this object, thereby - * closing it down gracefully. - */ -class ACE_Export ACE_Thread_Exit -{ -public: - /// Capture the Thread that will be cleaned up automatically. - ACE_Thread_Exit (void); - - /// Set the . - void thr_mgr (ACE_Thread_Manager *tm); - - /// Destructor calls the thread-specific exit hooks when a thread - /// exits. - ~ACE_Thread_Exit (void); - - /// Singleton access point. - static ACE_Thread_Exit *instance (void); - - /// Cleanup method, used by the to destroy the - /// singleton. - static void cleanup (void *instance); - -private: - /// Automatically add/remove the thread from the - /// . - ACE_Thread_Control thread_control_; - - /** - * Used to detect whether we should create a new instance (or not) - * within the instance method -- we don't trust the instance_ ptr - * because the destructor may have run (if ACE::fini() was called). - * See bug #526. - * We don't follow the singleton pattern due to dependency issues. - */ - static unsigned int is_constructed_; -}; - -/** - * @class ACE_Thread_Exit_Maybe - * - * @brief A version of ACE_Thread_Exit that is created dynamically - * under the hood if the flag is set to TRUE. - * - * Allows the appearance of a "smart pointer", but is not - * always created. - */ -class ACE_Export ACE_Thread_Exit_Maybe -{ -public: - /// Don't create an ACE_Thread_Exit instance by default. - ACE_Thread_Exit_Maybe (int flag = 0); - - /// Destroys the underlying ACE_Thread_Exit instance if it exists. - ~ACE_Thread_Exit_Maybe (void); - - /// Delegates to underlying instance. - ACE_Thread_Exit * operator -> (void) const; - - /// Returns the underlying instance. - ACE_Thread_Exit * instance (void) const; - -private: - - /// Holds the underlying instance. - ACE_Thread_Exit *instance_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_THREAD_EXIT_H */ diff --git a/ace/Thread_Hook.cpp b/ace/Thread_Hook.cpp deleted file mode 100644 index e69eb0a482c..00000000000 --- a/ace/Thread_Hook.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ - -#include "ace/Thread_Hook.h" -#include "ace/Object_Manager_Base.h" - -ACE_RCSID(ace, Thread_Hook, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Thread_Hook::~ACE_Thread_Hook () -{ -} - -ACE_THR_FUNC_RETURN -ACE_Thread_Hook::start (ACE_THR_FUNC func, - void *arg) -{ - return (func) (arg); -} - -ACE_Thread_Hook * -ACE_Thread_Hook::thread_hook (ACE_Thread_Hook *hook) -{ - return ACE_OS_Object_Manager::thread_hook (hook); -} - -ACE_Thread_Hook * -ACE_Thread_Hook::thread_hook (void) -{ - return ACE_OS_Object_Manager::thread_hook (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Hook.h b/ace/Thread_Hook.h deleted file mode 100644 index a6748d25061..00000000000 --- a/ace/Thread_Hook.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Thread_Hook.h - * - * $Id$ - * - * @author Carlos O'Ryan - */ -//============================================================================= - - -#ifndef ACE_THREAD_HOOK_H -#define ACE_THREAD_HOOK_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/ACE_export.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Thread_Hook - * - * @brief This class makes it possible to provide user-defined "start" - * hooks that are called before the thread entry point function - * is invoked. - */ -class ACE_Export ACE_Thread_Hook -{ - -public: - - /// Destructor. - virtual ~ACE_Thread_Hook (void); - - /** - * This method can be overridden in a subclass to customize this - * pre-function call "hook" invocation that can perform - * initialization processing before the thread entry point - * method is called back. The @a func and @a arg passed into the - * start hook are the same as those passed by the application that - * spawned the thread. - */ - virtual ACE_THR_FUNC_RETURN start (ACE_THR_FUNC func, - void *arg); - - /// sets the system wide thread hook, returns the previous thread - /// hook or 0 if none is set. - static ACE_Thread_Hook *thread_hook (ACE_Thread_Hook *hook); - - /// Returns the current system thread hook. - static ACE_Thread_Hook *thread_hook (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_THREAD_HOOK_H */ diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp deleted file mode 100644 index 4daf221f8d9..00000000000 --- a/ace/Thread_Manager.cpp +++ /dev/null @@ -1,2327 +0,0 @@ -// $Id$ - -#include "ace/TSS_T.h" -#include "ace/Thread_Manager.h" -#include "ace/Dynamic.h" -#include "ace/Object_Manager.h" -#include "ace/Singleton.h" -#include "ace/Auto_Ptr.h" -#include "ace/Guard_T.h" - -#include "ace/Time_Value.h" -#include "ace/OS_NS_sys_time.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Thread_Manager.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_RCSID (ace, - Thread_Manager, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - -ACE_At_Thread_Exit::~ACE_At_Thread_Exit (void) -{ - this->do_apply (); -} - -ACE_At_Thread_Exit_Func::~ACE_At_Thread_Exit_Func (void) -{ - this->do_apply (); -} - -void -ACE_At_Thread_Exit_Func::apply (void) -{ - this->func_ (this->object_, this->param_); -} - -#endif /* ! ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - - -ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Control) -ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Manager) - -#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) -// Process-wide Thread Manager. -ACE_Thread_Manager *ACE_Thread_Manager::thr_mgr_ = 0; - -// Controls whether the Thread_Manager is deleted when we shut down -// (we can only delete it safely if we created it!) -int ACE_Thread_Manager::delete_thr_mgr_ = 0; -#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ - -ACE_TSS_TYPE (ACE_Thread_Exit) *ACE_Thread_Manager::thr_exit_ = 0; - -int -ACE_Thread_Manager::set_thr_exit (ACE_TSS_TYPE (ACE_Thread_Exit) *ptr) -{ - if (ACE_Thread_Manager::thr_exit_ == 0) - ACE_Thread_Manager::thr_exit_ = ptr; - else - return -1; - return 0; -} - -void -ACE_Thread_Manager::dump (void) -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Thread_Manager::dump"); - // Cast away const-ness of this in order to use its non-const lock_. - ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, - ((ACE_Thread_Manager *) this)->lock_)); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncurrent_count_ = %d"), this->thr_list_.size ())); - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - iter.next ()->dump (); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Thread_Descriptor::~ACE_Thread_Descriptor (void) -{ - delete this->sync_; -} - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) -void ACE_Thread_Descriptor::at_pop (int apply) - -{ - ACE_TRACE ("ACE_Thread_Descriptor::at_pop"); - // Get first at from at_exit_list - ACE_At_Thread_Exit* at = this->at_exit_list_; - // Remove at from at_exit list - this->at_exit_list_ = at->next_; - // Apply if required - if (apply) - { - at->apply (); - // Do the apply method - at->was_applied (1); - // Mark at has been applied to avoid double apply from - // at destructor - } - // If at is not owner delete at. - if (!at->is_owner ()) - delete at; -} - -void -ACE_Thread_Descriptor::at_push (ACE_At_Thread_Exit* cleanup, int is_owner) - -{ - ACE_TRACE ("ACE_Thread_Descriptor::at_push"); - cleanup->is_owner (is_owner); - cleanup->td_ = this; - cleanup->next_ = at_exit_list_; - at_exit_list_ = cleanup; -} - -int -ACE_Thread_Descriptor::at_exit (ACE_At_Thread_Exit& cleanup) - -{ - ACE_TRACE ("ACE_Thread_Descriptor::at_exit"); - at_push (&cleanup, 1); - return 0; -} - -int -ACE_Thread_Descriptor::at_exit (ACE_At_Thread_Exit* cleanup) - -{ - ACE_TRACE ("ACE_Thread_Descriptor::at_exit"); - if (cleanup==0) - return -1; - else - { - this->at_push (cleanup); - return 0; - } -} - -void -ACE_Thread_Descriptor::do_at_exit () - -{ - ACE_TRACE ("ACE_Thread_Descriptor::do_at_exit"); - while (at_exit_list_!=0) - this->at_pop (); -} - -void -ACE_Thread_Descriptor::terminate () - -{ - ACE_TRACE ("ACE_Thread_Descriptor::terminate"); - - if (!terminated_) - { - ACE_Log_Msg* log_msg = this->log_msg_; - terminated_ = true; - // Run at_exit hooks - this->do_at_exit (); - // We must remove Thread_Descriptor from Thread_Manager list - if (this->tm_ != 0) - { - int close_handle = 0; - -#if !defined (ACE_VXWORKS) - // Threads created with THR_DAEMON shouldn't exist here, but - // just to be safe, let's put it here. - - if (ACE_BIT_DISABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_JOINING)) - { - if (ACE_BIT_DISABLED (this->flags_, THR_DETACHED | THR_DAEMON) - || ACE_BIT_ENABLED (this->flags_, THR_JOINABLE)) - { - // Mark thread as terminated. - ACE_SET_BITS (this->thr_state_, ACE_Thread_Manager::ACE_THR_TERMINATED); - tm_->register_as_terminated (this); - // Must copy the information here because td will be - // "freed" below. - } -#if defined (ACE_WIN32) - else - { - close_handle = 1; - } -#endif /* ACE_WIN32 */ - } -#endif /* ! ACE_VXWORKS */ - - // Remove thread descriptor from the table. - if (this->tm_ != 0) - tm_->remove_thr (this, close_handle); - } - - // Check if we need delete ACE_Log_Msg instance - // If ACE_TSS_cleanup was not executed first log_msg == 0 - if (log_msg == 0) - { - // Only inform to ACE_TSS_cleanup that it must delete the log instance - // setting ACE_LOG_MSG thr_desc to 0. - ACE_LOG_MSG->thr_desc (0); - } - else - { - // Thread_Descriptor is the owner of the Log_Msg instance!! - // deleted. - this->log_msg_ = 0; - delete log_msg; - } - } -} - -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - -int -ACE_Thread_Descriptor::at_exit (void *object, - ACE_CLEANUP_FUNC cleanup_hook, - void *param) -{ - ACE_TRACE ("ACE_Thread_Descriptor::at_exit"); -#if defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - this->cleanup_info_.cleanup_hook_ = cleanup_hook; - this->cleanup_info_.object_ = object; - this->cleanup_info_.param_ = param; -#else - // To keep compatibility, when cleanup_hook is null really is a at_pop - // without apply. - if (cleanup_hook == 0) - { - if (this->at_exit_list_!= 0) - this->at_pop(0); - } - else - { - ACE_At_Thread_Exit* cleanup = 0; - ACE_NEW_RETURN (cleanup, - ACE_At_Thread_Exit_Func (object, - cleanup_hook, - param), - -1); - this->at_push (cleanup); - } -#endif /* ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - return 0; -} - -void -ACE_Thread_Descriptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Thread_Descriptor::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nthr_id_ = %d"), this->thr_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nthr_handle_ = %d"), this->thr_handle_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nthr_state_ = %d"), this->thr_state_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncleanup_info_.cleanup_hook_ = %x"), this->cleanup_info_.cleanup_hook_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nflags_ = %x\n"), this->flags_)); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Thread_Descriptor::ACE_Thread_Descriptor (void) -#if !defined (ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - : log_msg_ (0), - at_exit_list_ (0), - terminated_ (false) -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ -{ - ACE_TRACE ("ACE_Thread_Descriptor::ACE_Thread_Descriptor"); - ACE_NEW (this->sync_, - ACE_DEFAULT_THREAD_MANAGER_LOCK); -} - -void -ACE_Thread_Descriptor::acquire_release (void) -{ - // Just try to acquire the lock then release it. -#if defined (ACE_THREAD_MANAGER_USES_SAFE_SPAWN) - if (ACE_BIT_DISABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_SPAWNED)) -#endif /* ACE_THREAD_MANAGER_USES_SAFE_SPAWN */ - { - this->sync_->acquire (); - // Acquire the lock before removing from the thread table. If - // this thread is in the table already, it should simply acquire the - // lock easily. - - // Once we get the lock, we must have registered. - ACE_ASSERT (ACE_BIT_ENABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_SPAWNED)); - - this->sync_->release (); - // Release the lock before putting it back to freelist. - } -} - -void -ACE_Thread_Descriptor::acquire (void) -{ - // Just try to acquire the lock then release it. -#if defined (ACE_THREAD_MANAGER_USES_SAFE_SPAWN) - if (ACE_BIT_DISABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_SPAWNED)) -#endif /* ACE_THREAD_MANAGER_USES_SAFE_SPAWN */ - { - this->sync_->acquire (); - } -} - -void -ACE_Thread_Descriptor::release (void) -{ - // Just try to acquire the lock then release it. -#if defined (ACE_THREAD_MANAGER_USES_SAFE_SPAWN) - if (ACE_BIT_DISABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_SPAWNED)) -#endif /* ACE_THREAD_MANAGER_USES_SAFE_SPAWN */ - { - this->sync_->release (); - // Release the lock before putting it back to freelist. - } -} - -// The following macro simplifies subsequence code. -#define ACE_FIND(OP,INDEX) \ - ACE_Thread_Descriptor *INDEX = OP; \ - -ACE_Thread_Descriptor * -ACE_Thread_Manager::thread_descriptor (ACE_thread_t thr_id) -{ - ACE_TRACE ("ACE_Thread_Manager::thread_descriptor"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - ACE_FIND (this->find_thread (thr_id), ptr); - return ptr; -} - -ACE_Thread_Descriptor * -ACE_Thread_Manager::hthread_descriptor (ACE_hthread_t thr_handle) -{ - ACE_TRACE ("ACE_Thread_Manager::hthread_descriptor"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - ACE_FIND (this->find_hthread (thr_handle), ptr); - return ptr; -} - -// Return the thread descriptor (indexed by ACE_hthread_t). - -int -ACE_Thread_Manager::thr_self (ACE_hthread_t &self) -{ - ACE_TRACE ("ACE_Thread_Manager::thr_self"); - - ACE_Thread_Descriptor *desc = - this->thread_desc_self (); - - if (desc == 0) - return -1; - else - desc->self (self); - - return 0; -} - -// Initialize the synchronization variables. - -ACE_Thread_Manager::ACE_Thread_Manager (size_t prealloc, - size_t lwm, - size_t inc, - size_t hwm) - : grp_id_ (1), - automatic_wait_ (1) -#if defined (ACE_HAS_THREADS) - , zero_cond_ (lock_) -#endif /* ACE_HAS_THREADS */ - , thread_desc_freelist_ (ACE_FREE_LIST_WITH_POOL, - prealloc, lwm, hwm, inc) -{ - ACE_TRACE ("ACE_Thread_Manager::ACE_Thread_Manager"); -} - -#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) -ACE_Thread_Manager * -ACE_Thread_Manager::instance (void) -{ - ACE_TRACE ("ACE_Thread_Manager::instance"); - - if (ACE_Thread_Manager::thr_mgr_ == 0) - { - // Perform Double-Checked Locking Optimization. - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance (), 0)); - - if (ACE_Thread_Manager::thr_mgr_ == 0) - { - ACE_NEW_RETURN (ACE_Thread_Manager::thr_mgr_, - ACE_Thread_Manager, - 0); - ACE_Thread_Manager::delete_thr_mgr_ = 1; - } - } - - return ACE_Thread_Manager::thr_mgr_; -} - -ACE_Thread_Manager * -ACE_Thread_Manager::instance (ACE_Thread_Manager *tm) -{ - ACE_TRACE ("ACE_Thread_Manager::instance"); - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance (), 0)); - - ACE_Thread_Manager *t = ACE_Thread_Manager::thr_mgr_; - // We can't safely delete it since we don't know who created it! - ACE_Thread_Manager::delete_thr_mgr_ = 0; - - ACE_Thread_Manager::thr_mgr_ = tm; - return t; -} - -void -ACE_Thread_Manager::close_singleton (void) -{ - ACE_TRACE ("ACE_Thread_Manager::close_singleton"); - - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance ())); - - if (ACE_Thread_Manager::delete_thr_mgr_) - { - // First, we clean up the thread descriptor list. - ACE_Thread_Manager::thr_mgr_->close (); - delete ACE_Thread_Manager::thr_mgr_; - ACE_Thread_Manager::thr_mgr_ = 0; - ACE_Thread_Manager::delete_thr_mgr_ = 0; - } - - ACE_Thread_Exit::cleanup (ACE_Thread_Manager::thr_exit_); -} -#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ - -// Close up and release all resources. - -int -ACE_Thread_Manager::close () -{ - ACE_TRACE ("ACE_Thread_Manager::close"); - - // Clean up the thread descriptor list. - if (this->automatic_wait_) - this->wait (0, 1); - else - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - this->remove_thr_all (); - } - - return 0; -} - -ACE_Thread_Manager::~ACE_Thread_Manager (void) -{ - ACE_TRACE ("ACE_Thread_Manager::~ACE_Thread_Manager"); - this->close (); -} - - -// Run the entry point for thread spawned under the control of the -// . This must be an extern "C" to make certain -// compilers happy... -// -// The interaction with and -// works like this, with -// ACE_HAS_THREAD_SPECIFIC_STORAGE or ACE_HAS_TSS_EMULATION: -// -// o Every thread in the is run with -// . -// -// o retrieves the singleton -// instance from . -// The singleton gets created in thread-specific storage -// in the first call to that function. The key point is that the -// instance is in thread-specific storage. -// -// o A thread can exit by various means, such as , C++ -// or Win32 exception, "falling off the end" of the thread entry -// point function, etc. -// -// o If you follow this so far, now it gets really fun . . . -// When the thread-specific storage (for the thread that -// is being destroyed) is cleaned up, the OS threads package (or -// the ACE emulation of thread-specific storage) will destroy any -// objects that are in thread-specific storage. It has a list of -// them, and just walks down the list and destroys each one. -// -// o That's where the ACE_Thread_Exit destructor gets called. - -#if defined(ACE_USE_THREAD_MANAGER_ADAPTER) -extern "C" void * -ace_thread_manager_adapter (void *args) -{ -#if defined (ACE_HAS_TSS_EMULATION) - // As early as we can in the execution of the new thread, allocate - // its local TS storage. Allocate it on the stack, to save dynamic - // allocation/dealloction. - void *ts_storage[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX]; - ACE_TSS_Emulation::tss_open (ts_storage); -#endif /* ACE_HAS_TSS_EMULATION */ - - ACE_Thread_Adapter *thread_args = (ACE_Thread_Adapter *) args; - - // NOTE: this preprocessor directive should match the one in above - // ACE_Thread_Exit::instance (). With the Xavier Pthreads package, - // the exit_hook in TSS causes a seg fault. So, this works around - // that by creating exit_hook on the stack. -#if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION) - // Obtain our thread-specific exit hook and make sure that it knows - // how to clean us up! Note that we never use this pointer directly - // (it's stored in thread-specific storage), so it's ok to - // dereference it here and only store it as a reference. - ACE_Thread_Exit &exit_hook = *ACE_Thread_Exit::instance (); -#else - // Without TSS, create an instance. When this - // function returns, its destructor will be called because the - // object goes out of scope. The drawback with this appraoch is - // that the destructor _won't_ get called if is called. - // So, threads shouldn't exit that way. Instead, they should return - // from . - ACE_Thread_Exit exit_hook; -#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ - - // Keep track of the that's associated with this - // . - exit_hook.thr_mgr (thread_args->thr_mgr ()); - - // Invoke the user-supplied function with the args. - void *status = thread_args->invoke (); - - return status; -} -#endif - -// Call the appropriate OS routine to spawn a thread. Should *not* be -// called with the lock_ held... - -int -ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func, - void *args, - long flags, - ACE_thread_t *t_id, - ACE_hthread_t *t_handle, - long priority, - int grp_id, - void *stack, - size_t stack_size, - ACE_Task_Base *task) -{ - // First, threads created by Thread Manager should not be daemon threads. - // Using assertion is probably a bit too strong. However, it helps - // finding this kind of error as early as possible. Perhaps we can replace - // assertion by returning error. - ACE_ASSERT (ACE_BIT_DISABLED (flags, THR_DAEMON)); - - // Create a new thread running . *Must* be called with the - // held... - // Get a "new" Thread Descriptor from the freelist. - auto_ptr new_thr_desc (this->thread_desc_freelist_.remove ()); - - // Reset thread descriptor status - new_thr_desc->reset (this); - - ACE_Thread_Adapter *thread_args = 0; -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - ACE_NEW_RETURN (thread_args, - ACE_Thread_Adapter (func, - args, - (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, - this, - new_thr_desc.get (), - ACE_OS_Object_Manager::seh_except_selector(), - ACE_OS_Object_Manager::seh_except_handler()), - -1); -# else - ACE_NEW_RETURN (thread_args, - ACE_Thread_Adapter (func, - args, - (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, - this, - new_thr_desc.get ()), - -1); -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - - ACE_TRACE ("ACE_Thread_Manager::spawn_i"); - ACE_hthread_t thr_handle; - -#if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) - // On VxWorks, ACE_thread_t is char *. If t_id is 0, allocate space - // for ACE_OS::thr_create () to store the task name. If t_id is not - // 0, and it doesn't point to a 0 char *, then the non-zero char * - // will be used for the task name in ACE_OS::thr_create (). If t_id - // is not 0, but does point to a 0 char *, the t_id will be set to - // point to the task name in the TCB in ACE_OS::thr_create (). - if (t_id == 0) - { - ACE_NEW_RETURN (t_id, - char*, - -1); - ACE_NEW_RETURN (*t_id, - char[16], - -1); - // Mark the thread ID to show that the ACE_Thread_Manager - // allocated it. - (*t_id)[0] = ACE_THR_ID_ALLOCATED; - (*t_id)[1] = '\0'; - } -#else /* ! ACE_VXWORKS */ - ACE_thread_t thr_id; - if (t_id == 0) - t_id = &thr_id; -#endif /* ! ACE_VXWORKS */ - - new_thr_desc->sync_->acquire (); - // Acquire the lock to block the spawned thread from - // removing this Thread Descriptor before it gets put into our - // thread table. - - int const result = ACE_Thread::spawn (func, - args, - flags, - t_id, - &thr_handle, - priority, - stack, - stack_size, - thread_args); - - if (result != 0) - { - // _Don't_ clobber errno here! result is either 0 or -1, and - // ACE_OS::thr_create () already set errno! D. Levine 28 Mar 1997 - // errno = result; - ACE_Errno_Guard guard (errno); // Lock release may smash errno - new_thr_desc->sync_->release (); - return -1; - } - -#if defined (ACE_HAS_WTHREADS) - // Have to duplicate handle if client asks for it. - // @@ How are thread handles implemented on AIX? Do they - // also need to be duplicated? - if (t_handle != 0) -# if defined (ACE_HAS_WINCE) - *t_handle = thr_handle; -# else /* ! ACE_HAS_WINCE */ - (void) ::DuplicateHandle (::GetCurrentProcess (), - thr_handle, - ::GetCurrentProcess (), - t_handle, - 0, - TRUE, - DUPLICATE_SAME_ACCESS); -# endif /* ! ACE_HAS_WINCE */ -#else /* ! ACE_HAS_WTHREADS */ - if (t_handle != 0) - *t_handle = thr_handle; -#endif /* ! ACE_HAS_WTHREADS */ - - // append_thr also put the into Thread_Manager's - // double-linked list. Only after this point, can we manipulate - // double-linked list from a spawned thread's context. - return this->append_thr (*t_id, - thr_handle, - ACE_THR_SPAWNED, - grp_id, - task, - flags, - new_thr_desc.release ()); -} - -int -ACE_Thread_Manager::spawn (ACE_THR_FUNC func, - void *args, - long flags, - ACE_thread_t *t_id, - ACE_hthread_t *t_handle, - long priority, - int grp_id, - void *stack, - size_t stack_size) -{ - ACE_TRACE ("ACE_Thread_Manager::spawn"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - if (grp_id == -1) - grp_id = this->grp_id_++; // Increment the group id. - - if (priority != ACE_DEFAULT_THREAD_PRIORITY) - ACE_CLR_BITS (flags, THR_INHERIT_SCHED); - - if (this->spawn_i (func, - args, - flags, - t_id, - t_handle, - priority, - grp_id, - stack, - stack_size, - 0) == -1) - return -1; - - return grp_id; -} - -// Create N new threads running FUNC. - -int -ACE_Thread_Manager::spawn_n (size_t n, - ACE_THR_FUNC func, - void *args, - long flags, - long priority, - int grp_id, - ACE_Task_Base *task, - ACE_hthread_t thread_handles[], - void *stack[], - size_t stack_size[]) -{ - ACE_TRACE ("ACE_Thread_Manager::spawn_n"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - if (grp_id == -1) - grp_id = this->grp_id_++; // Increment the group id. - - for (size_t i = 0; i < n; i++) - { - // @@ What should happen if this fails?! e.g., should we try to - // cancel the other threads that we've already spawned or what? - if (this->spawn_i (func, - args, - flags, - 0, - thread_handles == 0 ? 0 : &thread_handles[i], - priority, - grp_id, - stack == 0 ? 0 : stack[i], - stack_size == 0 ? 0 : stack_size[i], - task) == -1) - return -1; - } - - return grp_id; -} - -// Create N new threads running FUNC. - -int -ACE_Thread_Manager::spawn_n (ACE_thread_t thread_ids[], - size_t n, - ACE_THR_FUNC func, - void *args, - long flags, - long priority, - int grp_id, - void *stack[], - size_t stack_size[], - ACE_hthread_t thread_handles[], - ACE_Task_Base *task) -{ - ACE_TRACE ("ACE_Thread_Manager::spawn_n"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - if (grp_id == -1) - grp_id = this->grp_id_++; // Increment the group id. - - for (size_t i = 0; i < n; i++) - { - // @@ What should happen if this fails?! e.g., should we try to - // cancel the other threads that we've already spawned or what? - if (this->spawn_i (func, - args, - flags, - thread_ids == 0 ? 0 : &thread_ids[i], - thread_handles == 0 ? 0 : &thread_handles[i], - priority, - grp_id, - stack == 0 ? 0 : stack[i], - stack_size == 0 ? 0 : stack_size[i], - task) == -1) - return -1; - } - - return grp_id; -} - -// Append a thread into the pool (does not check for duplicates). -// Must be called with locks held. - -int -ACE_Thread_Manager::append_thr (ACE_thread_t t_id, - ACE_hthread_t t_handle, - ACE_UINT32 thr_state, - int grp_id, - ACE_Task_Base *task, - long flags, - ACE_Thread_Descriptor *td) -{ - ACE_TRACE ("ACE_Thread_Manager::append_thr"); - ACE_Thread_Descriptor *thr_desc = 0; - - if (td == 0) - { - ACE_NEW_RETURN (thr_desc, - ACE_Thread_Descriptor, - -1); -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - thr_desc->tm_ = this; - // Setup the Thread_Manager. -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - } - else - thr_desc = td; - - thr_desc->thr_id_ = t_id; - thr_desc->thr_handle_ = t_handle; - thr_desc->grp_id_ = grp_id; - thr_desc->task_ = task; - thr_desc->flags_ = flags; - - this->thr_list_.insert_head (thr_desc); - ACE_SET_BITS (thr_desc->thr_state_, thr_state); - thr_desc->sync_->release (); - - return 0; -} - -// Return the thread descriptor (indexed by ACE_hthread_t). - -ACE_Thread_Descriptor * -ACE_Thread_Manager::find_hthread (ACE_hthread_t h_id) -{ - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if (ACE_OS::thr_cmp (iter.next ()->thr_handle_, h_id)) - return iter.next (); - - return 0; -} - -// Locate the index in the table associated with . Must be -// called with the lock held. - -ACE_Thread_Descriptor * -ACE_Thread_Manager::find_thread (ACE_thread_t t_id) -{ - ACE_TRACE ("ACE_Thread_Manager::find_thread"); - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if (ACE_OS::thr_equal (iter.next ()->thr_id_, t_id)) - return iter.next (); - return 0; -} - -// Insert a thread into the pool (checks for duplicates and doesn't -// allow them to be inserted twice). - -int -ACE_Thread_Manager::insert_thr (ACE_thread_t t_id, - ACE_hthread_t t_handle, - int grp_id, - long flags) -{ - ACE_TRACE ("ACE_Thread_Manager::insert_thr"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - // Check for duplicates and bail out if we're already registered... -#if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) - if (this->find_hthread (t_handle) != 0 ) - return -1; -#else /* ! ACE_VXWORKS */ - if (this->find_thread (t_id) != 0 ) - return -1; -#endif /* ! ACE_VXWORKS */ - - if (grp_id == -1) - grp_id = this->grp_id_++; - - if (this->append_thr (t_id, - t_handle, - ACE_THR_SPAWNED, - grp_id, - 0, - flags) == -1) - return -1; - - return grp_id; -} - -// Run the registered hooks when the thread exits. - -void -ACE_Thread_Manager::run_thread_exit_hooks (int i) -{ -#if 0 // currently unused! - ACE_TRACE ("ACE_Thread_Manager::run_thread_exit_hooks"); - - // @@ Currently, we have just one hook. This should clearly be - // generalized to support an arbitrary number of hooks. - - ACE_Thread_Descriptor *td = this->thread_desc_self (); - if (td != 0 && td->cleanup_info.cleanup_hook_ != 0) - { - (*td->cleanup_info_.cleanup_hook_) - (td->cleanup_info_.object_, - td->cleanup_info_.param_); - - td->cleanup_info_.cleanup_hook_ = 0; - } - ACE_UNUSED_ARG (i); -#else - ACE_UNUSED_ARG (i); -#endif /* 0 */ -} - -// Remove a thread from the pool. Must be called with locks held. - -void -ACE_Thread_Manager::remove_thr (ACE_Thread_Descriptor *td, - int close_handler) -{ - ACE_TRACE ("ACE_Thread_Manager::remove_thr"); - -#if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) - ACE_thread_t tid = td->self (); -#endif /* ACE_VXWORKS */ - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - td->tm_ = 0; -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - this->thr_list_.remove (td); - -#if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) - // Delete the thread ID, if the ACE_Thread_Manager allocated it. - if (tid && tid[0] == ACE_THR_ID_ALLOCATED) - { - delete [] tid; - } -#endif /* ACE_VXWORKS */ - -#if defined (ACE_WIN32) - if (close_handler != 0) - ::CloseHandle (td->thr_handle_); -#else - ACE_UNUSED_ARG (close_handler); -#endif /* ACE_WIN32 */ - - this->thread_desc_freelist_.add (td); - -#if defined (ACE_HAS_THREADS) - // Tell all waiters when there are no more threads left in the pool. - if (this->thr_list_.size () == 0) - this->zero_cond_.broadcast (); -#endif /* ACE_HAS_THREADS */ -} - -// Repeatedly call remove_thr on all table entries until there -// is no thread left. Must be called with lock held. -void -ACE_Thread_Manager::remove_thr_all (void) -{ - ACE_Thread_Descriptor *td = 0; - - while ((td = this->thr_list_.delete_head ()) != 0) - { - this->remove_thr (td, 1); - } -} - -// ------------------------------------------------------------------ -// Factor out some common behavior to simplify the following methods. -#define ACE_THR_OP(OP,STATE) \ - int result = OP (td->thr_handle_); \ - if (result == -1) { \ - if (errno != ENOTSUP) \ - this->thr_to_be_removed_.enqueue_tail (td); \ - return -1; \ - } \ - else { \ - ACE_SET_BITS (td->thr_state_, STATE); \ - return 0; \ - } - -int -ACE_Thread_Manager::join_thr (ACE_Thread_Descriptor *td, int) -{ - ACE_TRACE ("ACE_Thread_Manager::join_thr"); - int result = ACE_Thread::join (td->thr_handle_); - if (result != 0) - { - // Since the thread are being joined, we should - // let it remove itself from the list. - - // this->remove_thr (td); - errno = result; - return -1; - } - - return 0; -} - -int -ACE_Thread_Manager::suspend_thr (ACE_Thread_Descriptor *td, int) -{ - ACE_TRACE ("ACE_Thread_Manager::suspend_thr"); - - int const result = ACE_Thread::suspend (td->thr_handle_); - if (result == -1) { - if (errno != ENOTSUP) - this->thr_to_be_removed_.enqueue_tail (td); - return -1; - } - else { - ACE_SET_BITS (td->thr_state_, ACE_THR_SUSPENDED); - return 0; - } -} - -int -ACE_Thread_Manager::resume_thr (ACE_Thread_Descriptor *td, int) -{ - ACE_TRACE ("ACE_Thread_Manager::resume_thr"); - - int const result = ACE_Thread::resume (td->thr_handle_); - if (result == -1) { - if (errno != ENOTSUP) - this->thr_to_be_removed_.enqueue_tail (td); - return -1; - } - else { - ACE_CLR_BITS (td->thr_state_, ACE_THR_SUSPENDED); - return 0; - } -} - -int -ACE_Thread_Manager::cancel_thr (ACE_Thread_Descriptor *td, int async_cancel) -{ - ACE_TRACE ("ACE_Thread_Manager::cancel_thr"); - // Must set the state first and then try to cancel the thread. - ACE_SET_BITS (td->thr_state_, ACE_THR_CANCELLED); - - if (async_cancel != 0) - // Note that this call only does something relevant if the OS - // platform supports asynchronous thread cancellation. Otherwise, - // it's a no-op. - return ACE_Thread::cancel (td->thr_id_); - - return 0; -} - -int -ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int signum) -{ - ACE_TRACE ("ACE_Thread_Manager::kill_thr"); - - ACE_thread_t tid = td->thr_id_; -#if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) - // Skip over the ID-allocated marker, if present. - tid += tid[0] == ACE_THR_ID_ALLOCATED ? 1 : 0; -#endif /* ACE_VXWORKS */ - - int const result = ACE_Thread::kill (tid, signum); - - if (result != 0) - { - // Only remove a thread from us when there is a "real" error. - if (errno != ENOTSUP) - this->thr_to_be_removed_.enqueue_tail (td); - - return -1; - } - - return 0; -} - -// ------------------------------------------------------------------ -// Factor out some common behavior to simplify the following methods. -#define ACE_EXECUTE_OP(OP, ARG) \ - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); \ - ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); \ - ACE_FIND (this->find_thread (t_id), ptr); \ - if (ptr == 0) \ - { \ - errno = ENOENT; \ - return -1; \ - } \ - int result = OP (ptr, ARG); \ - ACE_Errno_Guard error (errno); \ - while (! this->thr_to_be_removed_.is_empty ()) { \ - ACE_Thread_Descriptor * td = 0; \ - this->thr_to_be_removed_.dequeue_head (td); \ - this->remove_thr (td, 1); \ - } \ - return result - -// Suspend a single thread. - -int -ACE_Thread_Manager::suspend (ACE_thread_t t_id) -{ - ACE_TRACE ("ACE_Thread_Manager::suspend"); - ACE_EXECUTE_OP (this->suspend_thr, 0); -} - -// Resume a single thread. - -int -ACE_Thread_Manager::resume (ACE_thread_t t_id) -{ - ACE_TRACE ("ACE_Thread_Manager::resume"); - ACE_EXECUTE_OP (this->resume_thr, 0); -} - -// Cancel a single thread. - -int -ACE_Thread_Manager::cancel (ACE_thread_t t_id, int async_cancel) -{ - ACE_TRACE ("ACE_Thread_Manager::cancel"); - ACE_EXECUTE_OP (this->cancel_thr, async_cancel); -} - -// Send a signal to a single thread. - -int -ACE_Thread_Manager::kill (ACE_thread_t t_id, int signum) -{ - ACE_TRACE ("ACE_Thread_Manager::kill"); - ACE_EXECUTE_OP (this->kill_thr, signum); -} - -int -ACE_Thread_Manager::check_state (ACE_UINT32 state, - ACE_thread_t id, - int enable) -{ - ACE_TRACE ("ACE_Thread_Manager::check_state"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - ACE_UINT32 thr_state; - - int self_check = ACE_OS::thr_equal (id, ACE_OS::thr_self ()); - - // If we're checking the state of our thread, try to get the cached - // value out of TSS to avoid lookup. - if (self_check) - { - ACE_Thread_Descriptor *desc = ACE_LOG_MSG->thr_desc (); - if (desc == 0) - return 0; // Always return false. - thr_state = desc->thr_state_; - } - else - { - // Not calling from self, have to look it up from the list. - ACE_FIND (this->find_thread (id), ptr); - if (ptr == 0) - return 0; - thr_state = ptr->thr_state_; - } - if (enable) - return ACE_BIT_ENABLED (thr_state, state); - - return ACE_BIT_DISABLED (thr_state, state); -} - -// Test if a single thread has terminated. - -int -ACE_Thread_Manager::testterminate (ACE_thread_t t_id) -{ - ACE_TRACE ("ACE_Thread_Manager::testterminate"); - return this->check_state (ACE_THR_TERMINATED, t_id); -} - -// Test if a single thread is suspended. - -int -ACE_Thread_Manager::testsuspend (ACE_thread_t t_id) -{ - ACE_TRACE ("ACE_Thread_Manager::testsuspend"); - return this->check_state (ACE_THR_SUSPENDED, t_id); -} - -// Test if a single thread is active (i.e., resumed). - -int -ACE_Thread_Manager::testresume (ACE_thread_t t_id) -{ - ACE_TRACE ("ACE_Thread_Manager::testresume"); - return this->check_state (ACE_THR_SUSPENDED, t_id, 0); -} - -// Test if a single thread is cancelled. - -int -ACE_Thread_Manager::testcancel (ACE_thread_t t_id) -{ - ACE_TRACE ("ACE_Thread_Manager::testcancel"); - return this->check_state (ACE_THR_CANCELLED, t_id); -} - -// Thread information query functions. - -int -ACE_Thread_Manager::hthread_within (ACE_hthread_t handle) -{ - ACE_TRACE ("ACE_Thread_Manager::hthread_within"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1)); - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if (ACE_OS::thr_cmp(iter.next ()->thr_handle_, handle)) - return 1; - - return 0; -} - -int -ACE_Thread_Manager::thread_within (ACE_thread_t tid) -{ - ACE_TRACE ("ACE_Thread_Manager::thread_within"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1)); - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if (ACE_OS::thr_equal (iter.next ()->thr_id_, tid)) - return 1; - - return 0; -} - -// Get group ids for a particular thread id. - -int -ACE_Thread_Manager::get_grp (ACE_thread_t t_id, int &grp_id) -{ - ACE_TRACE ("ACE_Thread_Manager::get_grp"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - ACE_FIND (this->find_thread (t_id), ptr); - - if (ptr) - grp_id = ptr->grp_id_; - else - return -1; - return 0; -} - -// Set group ids for a particular thread id. - -int -ACE_Thread_Manager::set_grp (ACE_thread_t t_id, int grp_id) -{ - ACE_TRACE ("ACE_Thread_Manager::set_grp"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - ACE_FIND (this->find_thread (t_id), ptr); - if (ptr) - ptr->grp_id_ = grp_id; - else - return -1; - return 0; -} - -// Suspend a group of threads. - -int -ACE_Thread_Manager::apply_grp (int grp_id, - ACE_THR_MEMBER_FUNC func, - int arg) -{ - ACE_TRACE ("ACE_Thread_Manager::apply_grp"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1)); - ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); - - int result = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if (iter.next ()->grp_id_ == grp_id) - if ((this->*func) (iter.next (), arg) == -1) - result = -1; - - // Must remove threads after we have traversed the thr_list_ to - // prevent clobber thr_list_'s integrity. - - if (! this->thr_to_be_removed_.is_empty ()) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - - for (ACE_Thread_Descriptor *td; - this->thr_to_be_removed_.dequeue_head (td) != -1; - ) - this->remove_thr (td, 1); - } - - return result; -} - -int -ACE_Thread_Manager::suspend_grp (int grp_id) -{ - ACE_TRACE ("ACE_Thread_Manager::suspend_grp"); - return this->apply_grp (grp_id, - ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::suspend_thr)); -} - -// Resume a group of threads. - -int -ACE_Thread_Manager::resume_grp (int grp_id) -{ - ACE_TRACE ("ACE_Thread_Manager::resume_grp"); - return this->apply_grp (grp_id, - ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::resume_thr)); -} - -// Kill a group of threads. - -int -ACE_Thread_Manager::kill_grp (int grp_id, int signum) -{ - ACE_TRACE ("ACE_Thread_Manager::kill_grp"); - return this->apply_grp (grp_id, - ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::kill_thr), signum); -} - -// Cancel a group of threads. - -int -ACE_Thread_Manager::cancel_grp (int grp_id, int async_cancel) -{ - ACE_TRACE ("ACE_Thread_Manager::cancel_grp"); - return this->apply_grp (grp_id, - ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::cancel_thr), - async_cancel); -} - -int -ACE_Thread_Manager::apply_all (ACE_THR_MEMBER_FUNC func, int arg) -{ - ACE_TRACE ("ACE_Thread_Manager::apply_all"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); - - int result = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if ((this->*func)(iter.next (), arg) == -1) - result = -1; - - // Must remove threads after we have traversed the thr_list_ to - // prevent clobber thr_list_'s integrity. - - if (! this->thr_to_be_removed_.is_empty ()) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - - for (ACE_Thread_Descriptor *td; - this->thr_to_be_removed_.dequeue_head (td) != -1; - ) - this->remove_thr (td, 1); - } - - return result; -} - -// Resume all threads that are suspended. - -int -ACE_Thread_Manager::resume_all (void) -{ - ACE_TRACE ("ACE_Thread_Manager::resume_all"); - return this->apply_all (ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::resume_thr)); -} - -int -ACE_Thread_Manager::suspend_all (void) -{ - ACE_TRACE ("ACE_Thread_Manager::suspend_all"); - return this->apply_all (ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::suspend_thr)); -} - -int -ACE_Thread_Manager::kill_all (int sig) -{ - ACE_TRACE ("ACE_Thread_Manager::kill_all"); - return this->apply_all (&ACE_Thread_Manager::kill_thr, sig); -} - -int -ACE_Thread_Manager::cancel_all (int async_cancel) -{ - ACE_TRACE ("ACE_Thread_Manager::cancel_all"); - return this->apply_all (ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::cancel_thr), - async_cancel); -} - -int -ACE_Thread_Manager::join (ACE_thread_t tid, ACE_THR_FUNC_RETURN *status) -{ - ACE_TRACE ("ACE_Thread_Manager::join"); - - ACE_Thread_Descriptor_Base tdb; - int found = 0; - - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - -#if !defined (ACE_VXWORKS) - for (ACE_Double_Linked_List_Iterator biter (this->terminated_thr_list_); - !biter.done (); - biter.advance ()) - if (ACE_OS::thr_equal (biter.next ()->thr_id_, tid)) - { - ACE_Thread_Descriptor_Base *tdb = biter.advance_and_remove (0); -# if defined (_AIX) - // The AIX xlC compiler does not match the proper function here - it - // confuses ACE_Thread::join(ACE_thread_t, ACE_thread_t *, void **=0) and - // ACE_Thread::join(ACE_hthread_t, void **=0). At least at 3.1.4.7 and .8. - // The 2nd arg is ignored for pthreads anyway. - - // And, g++ on AIX needs the three-arg thr_join, also, to pick up the - // proper version from the AIX libraries. - if (ACE_Thread::join (tdb->thr_handle_, - &tdb->thr_handle_, - status) == -1) -# else /* ! _AIX */ - if (ACE_Thread::join (tdb->thr_handle_, status) == -1) -# endif /* ! _AIX */ - return -1; - -# if defined (ACE_HAS_PTHREADS_DRAFT4) && defined (ACE_LACKS_SETDETACH) - // Must explicitly detach threads. Threads without THR_DETACHED - // were detached in ACE_OS::thr_create (). - ::pthread_detach (&tdb->thr_handle_); -# endif /* ACE_HAS_PTHREADS_DRAFT4 && ACE_LACKS_SETDETACH */ - - delete tdb; - return 0; - // return immediately if we've found the thread we want to join. - } -#endif /* !ACE_VXWORKS */ - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - // If threads are created as THR_DETACHED or THR_DAEMON, we - // can't help much. - if (ACE_OS::thr_equal (iter.next ()->thr_id_,tid) && - (ACE_BIT_DISABLED (iter.next ()->flags_, THR_DETACHED | THR_DAEMON) - || ACE_BIT_ENABLED (iter.next ()->flags_, THR_JOINABLE))) - { - tdb = *iter.next (); - ACE_SET_BITS (iter.next ()->thr_state_, ACE_THR_JOINING); - found = 1; - break; - } - - if (found == 0) - return -1; - // Didn't find the thread we want or the thread is not joinable. - } - -# if defined (_AIX) - // The AIX xlC compiler does not match the proper function here - it - // confuses ACE_Thread::join(ACE_thread_t, ACE_thread_t *, void **=0) and - // ACE_Thread::join(ACE_hthread_t, void **=0). At least at 3.1.4.7 and .8. - // The 2nd arg is ignored for pthreads anyway. - - // And, g++ on AIX needs the three-arg thr_join, also, to pick up the - // proper version from the AIX libraries. - if (ACE_Thread::join (tdb.thr_handle_, &tdb.thr_handle_, status) == -1) -# else /* ! _AIX */ - if (ACE_Thread::join (tdb.thr_handle_, status) == -1) -# endif /* ! _AIX */ - return -1; - -# if defined (ACE_HAS_PTHREADS_DRAFT4) && defined (ACE_LACKS_SETDETACH) - // Must explicitly detach threads. Threads without THR_DETACHED - // were detached in ACE_OS::thr_create (). - - ::pthread_detach (&tdb.thr_handle_); -# endif /* ACE_HAS_PTHREADS_DRAFT4 && ACE_LACKS_SETDETACH */ - return 0; -} - -// Wait for group of threads - -int -ACE_Thread_Manager::wait_grp (int grp_id) -{ - ACE_TRACE ("ACE_Thread_Manager::wait_grp"); - - int copy_count = 0; - ACE_Thread_Descriptor_Base *copy_table = 0; - - // We have to make sure that while we wait for these threads to - // exit, we do not have the lock. Therefore we make a copy of all - // interesting entries and let go of the lock. - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - -#if !defined (ACE_VXWORKS) - ACE_NEW_RETURN (copy_table, - ACE_Thread_Descriptor_Base [this->thr_list_.size () - + this->terminated_thr_list_.size ()], - -1); -#else - ACE_NEW_RETURN (copy_table, - ACE_Thread_Descriptor_Base [this->thr_list_.size ()], - -1); -#endif /* ACE_VXWORKS */ - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - // If threads are created as THR_DETACHED or THR_DAEMON, we - // can't help much. - if (iter.next ()->grp_id_ == grp_id && - (ACE_BIT_DISABLED (iter.next ()->flags_, THR_DETACHED | THR_DAEMON) - || ACE_BIT_ENABLED (iter.next ()->flags_, THR_JOINABLE))) - { - ACE_SET_BITS (iter.next ()->thr_state_, ACE_THR_JOINING); - copy_table[copy_count++] = *iter.next (); - } - -#if !defined (ACE_VXWORKS) - for (ACE_Double_Linked_List_Iterator biter (this->terminated_thr_list_); - !biter.done (); - biter.advance ()) - // If threads are created as THR_DETACHED or THR_DAEMON, we - // can't help much. - if (biter.next ()->grp_id_ == grp_id) - { - ACE_Thread_Descriptor_Base *tdb = biter.advance_and_remove (0); - copy_table[copy_count++] = *tdb; - delete tdb; - } -#endif /* !ACE_VXWORKS */ - } - - // Now actually join() with all the threads in this group. - int result = 0; - - for (int i = 0; - i < copy_count && result != -1; - i++) - { - if (ACE_Thread::join (copy_table[i].thr_handle_) == -1) - result = -1; - -# if defined (ACE_HAS_PTHREADS_DRAFT4) && defined (ACE_LACKS_SETDETACH) - // Must explicitly detach threads. Threads without THR_DETACHED - // were detached in ACE_OS::thr_create (). - ::pthread_detach (©_table[i].thr_handle_); -# endif /* ACE_HAS_PTHREADS_DRAFT4 && ACE_LACKS_SETDETACH */ - } - - delete [] copy_table; - - return result; -} - -// Must be called when thread goes out of scope to clean up its table -// slot. - -ACE_THR_FUNC_RETURN -ACE_Thread_Manager::exit (ACE_THR_FUNC_RETURN status, int do_thr_exit) -{ - ACE_TRACE ("ACE_Thread_Manager::exit"); -#if defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - int close_handle = 0; -#endif /* ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - -#if defined (ACE_WIN32) - // Remove detached thread handle. - - if (do_thr_exit) - { -#if 0 - // @@ This callback is now taken care of by TSS_Cleanup. Do we - // need it anymore? - - // On Win32, if we really wants to exit from a thread, we must - // first clean up the thread specific storage. By doing so, - // ACE_Thread_Manager::exit will be called again with - // do_thr_exit = 0 and cleaning up the ACE_Cleanup_Info (but not - // exiting the thread.) After the following call returns, we - // are safe to exit this thread. - delete ACE_Thread_Exit::instance (); -#endif /* 0 */ - ACE_Thread::exit (status); - } -#endif /* ACE_WIN32 */ - -#if defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - ACE_Cleanup_Info cleanup_info; - - // Just hold onto the guard while finding this thread's id and - // copying the exit hook. - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - // Find the thread id, but don't use the cache. It might have been - // deleted already. -#if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) - ACE_hthread_t id; - ACE_OS::thr_self (id); - ACE_Thread_Descriptor *td = this->find_hthread (id); -#else /* ! ACE_VXWORKS */ - ACE_thread_t id = ACE_OS::thr_self (); - ACE_Thread_Descriptor *td = this->find_thread (id); -#endif /* ! ACE_VXWORKS */ - - // Locate thread id. - if (td != 0) - { - // @@ Currently, we have just one hook. This should clearly - // be generalized to support an arbitrary number of hooks. - - if (td->cleanup_info_.cleanup_hook_ != 0) - { - // Copy the hook so that we can call it after releasing - // the guard. - cleanup_info = td->cleanup_info_; - td->cleanup_info_.cleanup_hook_ = 0; - } - -#if !defined (ACE_VXWORKS) - // Threads created with THR_DAEMON shouldn't exist here, but - // just to be safe, let's put it here. - - if (ACE_BIT_DISABLED (td->thr_state_, ACE_THR_JOINING)) - if (ACE_BIT_DISABLED (td->flags_, THR_DETACHED | THR_DAEMON) - || ACE_BIT_ENABLED (td->flags_, THR_JOINABLE)) - { - // Mark thread as terminated. - ACE_SET_BITS (td->thr_state_, ACE_THR_TERMINATED); - this->register_as_terminated (td); - // Must copy the information here because td will be "freed" below. - } -#if defined (ACE_WIN32) - else - { - close_handle = 1; - } -#endif /* ACE_WIN32 */ -#endif /* ! ACE_VXWORKS */ - - // Remove thread descriptor from the table. - this->remove_thr (td, close_handle); - } - // Release the guard. - } - - // Call the cleanup hook. - if (cleanup_info.cleanup_hook_ != 0) - (*cleanup_info.cleanup_hook_) (cleanup_info.object_, - cleanup_info.param_); -#else /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - // Just hold onto the guard while finding this thread's id and - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - // Find the thread id, but don't use the cache. It might have been - // deleted already. -#if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) - ACE_hthread_t id; - ACE_OS::thr_self (id); - ACE_Thread_Descriptor* td = this->find_hthread (id); -#else /* ! ACE_VXWORKS */ - ACE_thread_t id = ACE_OS::thr_self (); - ACE_Thread_Descriptor* td = this->find_thread (id); -#endif /* ! ACE_VXWORKS */ - if (td != 0) - { - // @@ We call Thread_Descriptor terminate this realize the cleanup - // process itself. - td->terminate(); - } - } - - -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - - if (do_thr_exit) - { - ACE_Thread::exit (status); - // On reasonable systems should not return. - // However, due to horrible semantics with Win32 thread-specific - // storage this call can return (don't ask...). - } - - return 0; -} - -// Wait for all the threads to exit. - -int -ACE_Thread_Manager::wait (const ACE_Time_Value *timeout, - bool abandon_detached_threads, - bool use_absolute_time) -{ - ACE_TRACE ("ACE_Thread_Manager::wait"); - - ACE_Time_Value local_timeout; - // Check to see if we're using absolute time or not. - if (use_absolute_time == false && timeout != 0) - { - local_timeout = *timeout; - local_timeout += ACE_OS::gettimeofday (); - timeout = &local_timeout; - } - -#if !defined (ACE_VXWORKS) - ACE_Double_Linked_List term_thr_list_copy; -#endif /* ACE_VXWORKS */ - -#if defined (ACE_HAS_THREADS) - { - // Just hold onto the guard while waiting. - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - if (ACE_Object_Manager::shutting_down () != 1) - { - // Program is not shutting down. Perform a normal wait on threads. - if (abandon_detached_threads != 0) - { - ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); - for (ACE_Double_Linked_List_Iterator - iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if (ACE_BIT_ENABLED (iter.next ()->flags_, - THR_DETACHED | THR_DAEMON) - && ACE_BIT_DISABLED (iter.next ()->flags_, THR_JOINABLE)) - { - this->thr_to_be_removed_.enqueue_tail (iter.next ()); - ACE_SET_BITS (iter.next ()->thr_state_, ACE_THR_JOINING); - } - - if (! this->thr_to_be_removed_.is_empty ()) - { - ACE_Thread_Descriptor *td; - while (this->thr_to_be_removed_.dequeue_head (td) != -1) - this->remove_thr (td, 1); - } - } - - while (this->thr_list_.size () > 0) - if (this->zero_cond_.wait (timeout) == -1) - return -1; - } - else - // Program is shutting down, no chance to wait on threads. - // Therefore, we'll just remove threads from the list. - this->remove_thr_all (); - -#if !defined (ACE_VXWORKS) - ACE_Thread_Descriptor_Base* item = 0; - while ((item = this->terminated_thr_list_.delete_head ()) != 0) - { - term_thr_list_copy.insert_tail (item); - } -#endif /* ACE_VXWORKS */ - // Release the guard, giving other threads a chance to run. - } - -#if !defined (ACE_VXWORKS) - // @@ VxWorks doesn't support thr_join (yet.) We are working - //on our implementation. Chorus'es thr_join seems broken. - ACE_Thread_Descriptor_Base *item = 0; - - while ((item = term_thr_list_copy.delete_head ()) != 0) - { - if (ACE_BIT_DISABLED (item->flags_, THR_DETACHED | THR_DAEMON) - || ACE_BIT_ENABLED (item->flags_, THR_JOINABLE)) - // Detached handles shouldn't reached here. - ACE_Thread::join (item->thr_handle_); - -# if defined (ACE_HAS_PTHREADS_DRAFT4) && defined (ACE_LACKS_SETDETACH) - // Must explicitly detach threads. Threads without - // THR_DETACHED were detached in ACE_OS::thr_create (). - ::pthread_detach (&item->thr_handle_); -# endif /* ACE_HAS_PTHREADS_DRAFT4 && ACE_LACKS_SETDETACH */ - delete item; - } - -#endif /* ! ACE_VXWORKS */ -#else - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (abandon_detached_threads); -#endif /* ACE_HAS_THREADS */ - - return 0; -} - -int -ACE_Thread_Manager::apply_task (ACE_Task_Base *task, - ACE_THR_MEMBER_FUNC func, - int arg) -{ - ACE_TRACE ("ACE_Thread_Manager::apply_task"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); - - int result = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if (iter.next ()->task_ == task - && (this->*func) (iter.next (), arg) == -1) - result = -1; - - // Must remove threads after we have traversed the thr_list_ to - // prevent clobber thr_list_'s integrity. - - if (! this->thr_to_be_removed_.is_empty ()) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - - for (ACE_Thread_Descriptor *td; - this->thr_to_be_removed_.dequeue_head (td) != -1; - ) - this->remove_thr (td, 1); - } - - return result; -} - -// Wait for all threads to exit a task. - -int -ACE_Thread_Manager::wait_task (ACE_Task_Base *task) -{ - int copy_count = 0; - ACE_Thread_Descriptor_Base *copy_table = 0; - - // We have to make sure that while we wait for these threads to - // exit, we do not have the lock. Therefore we make a copy of all - // interesting entries and let go of the lock. - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - -#if !defined (ACE_VXWORKS) - ACE_NEW_RETURN (copy_table, - ACE_Thread_Descriptor_Base [this->thr_list_.size () - + this->terminated_thr_list_.size ()], - -1); -#else - ACE_NEW_RETURN (copy_table, - ACE_Thread_Descriptor_Base [this->thr_list_.size ()], - -1); -#endif /* ACE_VXWORKS */ - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - // If threads are created as THR_DETACHED or THR_DAEMON, we - // can't wait on them here. - if (iter.next ()->task_ == task && - (ACE_BIT_DISABLED (iter.next ()->flags_, - THR_DETACHED | THR_DAEMON) - || ACE_BIT_ENABLED (iter.next ()->flags_, - THR_JOINABLE))) - { - ACE_SET_BITS (iter.next ()->thr_state_, - ACE_THR_JOINING); - copy_table[copy_count++] = *iter.next (); - } - -#if !defined (ACE_VXWORKS) - for (ACE_Double_Linked_List_Iterator titer (this->terminated_thr_list_); - !titer.done (); - titer.advance ()) - // If threads are created as THR_DETACHED or THR_DAEMON, we can't help much here. - if (titer.next ()->task_ == task) - { - ACE_Thread_Descriptor_Base *tdb = - titer.advance_and_remove (0); - copy_table[copy_count++] = *tdb; - delete tdb; - } -#endif /* ACE_VXWORKS */ - } - - // Now to do the actual work - int result = 0; - - for (int i = 0; - i < copy_count && result != -1; - i++) - { - if (ACE_Thread::join (copy_table[i].thr_handle_) == -1) - result = -1; - -# if defined (ACE_HAS_PTHREADS_DRAFT4) && defined (ACE_LACKS_SETDETACH) - // Must explicitly detach threads. Threads without THR_DETACHED - // were detached in ACE_OS::thr_create (). - ::pthread_detach (©_table[i].thr_handle_); -# endif /* ACE_HAS_PTHREADS_DRAFT4 && ACE_LACKS_SETDETACH */ - } - - delete [] copy_table; - - return result; -} - -// Suspend a task - -int -ACE_Thread_Manager::suspend_task (ACE_Task_Base *task) -{ - ACE_TRACE ("ACE_Thread_Manager::suspend_task"); - return this->apply_task (task, - ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::suspend_thr)); -} - -// Resume a task. -int -ACE_Thread_Manager::resume_task (ACE_Task_Base *task) -{ - ACE_TRACE ("ACE_Thread_Manager::resume_task"); - return this->apply_task (task, - ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::resume_thr)); -} - -// Kill a task. - -int -ACE_Thread_Manager::kill_task (ACE_Task_Base *task, int /* signum */) -{ - ACE_TRACE ("ACE_Thread_Manager::kill_task"); - return this->apply_task (task, - ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::kill_thr)); -} - -// Cancel a task. -int -ACE_Thread_Manager::cancel_task (ACE_Task_Base *task, - int async_cancel) -{ - ACE_TRACE ("ACE_Thread_Manager::cancel_task"); - return this->apply_task (task, - ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::cancel_thr), - async_cancel); -} - -// Locate the index in the table associated with from the -// beginning of the table up to an index. Must be called with the -// lock held. - -ACE_Thread_Descriptor * -ACE_Thread_Manager::find_task (ACE_Task_Base *task, size_t slot) -{ - ACE_TRACE ("ACE_Thread_Manager::find_task"); - - size_t i = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - { - if (i >= slot) - break; - - if (task == iter.next ()->task_) - return iter.next (); - - i++; - } - - return 0; -} - -// Returns the number of ACE_Task in a group. - -int -ACE_Thread_Manager::num_tasks_in_group (int grp_id) -{ - ACE_TRACE ("ACE_Thread_Manager::num_tasks_in_group"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - int tasks_count = 0; - size_t i = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - { - if (iter.next ()->grp_id_ == grp_id - && this->find_task (iter.next ()->task_, i) == 0 - && iter.next ()->task_ != 0) - tasks_count++; - - i++; - } - return tasks_count; -} - -// Returns the number of threads in an ACE_Task. - -int -ACE_Thread_Manager::num_threads_in_task (ACE_Task_Base *task) -{ - ACE_TRACE ("ACE_Thread_Manager::num_threads_in_task"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - int threads_count = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if (iter.next ()->task_ == task) - threads_count++; - - return threads_count; -} - -// Returns in task_list a list of ACE_Tasks registered with ACE_Thread_Manager. - -ssize_t -ACE_Thread_Manager::task_all_list (ACE_Task_Base *task_list[], - size_t n) -{ - ACE_TRACE ("ACE_Thread_Manager::task_all_list"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - size_t task_list_count = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - { - if (task_list_count >= n) - break; - - ACE_Task_Base *task_p = iter.next ()->task_; - if (0 != task_p) - { - // This thread has a task pointer; see if it's already in the - // list. Don't add duplicates. - size_t i = 0; - for (; i < task_list_count; ++i) - if (task_list[i] == task_p) - break; - if (i == task_list_count) // No match - add this one - task_list[task_list_count++] = task_p; - } - } - - return task_list_count; -} - -// Returns in thread_list a list of all thread ids - -ssize_t -ACE_Thread_Manager::thread_all_list (ACE_thread_t thread_list[], - size_t n) -{ - ACE_TRACE ("ACE_Thread_Manager::thread_all_list"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - size_t thread_count = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - { - if (thread_count >= n) - break; - - thread_list[thread_count] = iter.next ()->thr_id_; - thread_count ++; - } - - return thread_count; -} - - -int -ACE_Thread_Manager::thr_state (ACE_thread_t id, - ACE_UINT32& state) -{ - ACE_TRACE ("ACE_Thread_Manager::thr_state"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - int self_check = ACE_OS::thr_equal (id, ACE_OS::thr_self ()); - - // If we're checking the state of our thread, try to get the cached - // value out of TSS to avoid lookup. - if (self_check) - { - ACE_Thread_Descriptor *desc = ACE_LOG_MSG->thr_desc (); - if (desc == 0) - return 0; // Always return false. - state = desc->thr_state_; - } - else - { - // Not calling from self, have to look it up from the list. - ACE_FIND (this->find_thread (id), ptr); - if (ptr == 0) - return 0; - state = ptr->thr_state_; - } - - return 1; -} - -// Returns in task_list a list of ACE_Tasks in a group. - -ssize_t -ACE_Thread_Manager::task_list (int grp_id, - ACE_Task_Base *task_list[], - size_t n) -{ - ACE_TRACE ("ACE_Thread_Manager::task_list"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - ACE_Task_Base **task_list_iterator = task_list; - size_t task_list_count = 0; - size_t i = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - { - if (task_list_count >= n) - break; - - if (iter.next ()->grp_id_ == grp_id - && this->find_task (iter.next ()->task_, i) == 0) - { - task_list_iterator[task_list_count] = iter.next ()->task_; - task_list_count++; - } - - i++; - } - - return task_list_count; -} - -// Returns in thread_list a list of thread ids in an ACE_Task. - -ssize_t -ACE_Thread_Manager::thread_list (ACE_Task_Base *task, - ACE_thread_t thread_list[], - size_t n) -{ - ACE_TRACE ("ACE_Thread_Manager::thread_list"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - size_t thread_count = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - { - if (thread_count >= n) - break; - - if (iter.next ()->task_ == task) - { - thread_list[thread_count] = iter.next ()->thr_id_; - thread_count++; - } - } - - return thread_count; -} - -// Returns in thread_list a list of thread handles in an ACE_Task. - -ssize_t -ACE_Thread_Manager::hthread_list (ACE_Task_Base *task, - ACE_hthread_t hthread_list[], - size_t n) -{ - ACE_TRACE ("ACE_Thread_Manager::hthread_list"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - size_t hthread_count = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - { - if (hthread_count >= n) - break; - - if (iter.next ()->task_ == task) - { - hthread_list[hthread_count] = iter.next ()->thr_handle_; - hthread_count++; - } - } - - return hthread_count; -} - -ssize_t -ACE_Thread_Manager::thread_grp_list (int grp_id, - ACE_thread_t thread_list[], - size_t n) -{ - ACE_TRACE ("ACE_Thread_Manager::thread_grp_list"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - size_t thread_count = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - { - if (thread_count >= n) - break; - - if (iter.next ()->grp_id_ == grp_id) - { - thread_list[thread_count] = iter.next ()->thr_id_; - thread_count++; - } - } - - return thread_count; -} - -// Returns in thread_list a list of thread handles in an ACE_Task. - -ssize_t -ACE_Thread_Manager::hthread_grp_list (int grp_id, - ACE_hthread_t hthread_list[], - size_t n) -{ - ACE_TRACE ("ACE_Thread_Manager::hthread_grp_list"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - size_t hthread_count = 0; - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - { - if (hthread_count >= n) - break; - - if (iter.next ()->grp_id_ == grp_id) - { - hthread_list[hthread_count] = iter.next ()->thr_handle_; - hthread_count++; - } - } - - return hthread_count; -} - -int -ACE_Thread_Manager::set_grp (ACE_Task_Base *task, int grp_id) -{ - ACE_TRACE ("ACE_Thread_Manager::set_grp"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); - !iter.done (); - iter.advance ()) - if (iter.next ()->task_ == task) - iter.next ()->grp_id_ = grp_id; - - return 0; -} - -int -ACE_Thread_Manager::get_grp (ACE_Task_Base *task, int &grp_id) -{ - ACE_TRACE ("ACE_Thread_Manager::get_grp"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - ACE_FIND (this->find_task (task), ptr); - grp_id = ptr->grp_id_; - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h deleted file mode 100644 index d33f78a48c9..00000000000 --- a/ace/Thread_Manager.h +++ /dev/null @@ -1,1162 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Thread_Manager.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_THREAD_MANAGER_H -#define ACE_THREAD_MANAGER_H -#include /**/ "ace/pre.h" - -#include "ace/Thread.h" -#include "ace/Thread_Adapter.h" -#include "ace/Thread_Exit.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Condition_Thread_Mutex.h" -#include "ace/Unbounded_Queue.h" -#include "ace/Containers.h" -#include "ace/Free_List.h" -#include "ace/Singleton.h" -#include "ace/Log_Msg.h" -#include "ace/Synch_Traits.h" -#include "ace/Basic_Types.h" - -// The following macros control how a Thread Manager manages a pool of -// Thread_Descriptor. Currently, the default behavior is not to -// preallocate any thread descriptor and never (well, almost never) -// free up any thread descriptor until the Thread Manager gets -// destructed. Which means, once your system is stable, you rarely -// need to pay the price of memory allocation. On a deterministic -// system, which means, the number of threads spawned can be -// determined before hand, you can either redefine the memory pool -// size macros to suit your need or constructed the Thread_Manager -// accordingly. That way, you don't pay the price of memory -// allocation when the system is really doing its job. OTOH, on -// system with resources constraint, you may want to lower the size of -// ACE_DEFAULT_THREAD_MANAGER_HWM to avoid unused memory hanging -// around. - -#if !defined (ACE_DEFAULT_THREAD_MANAGER_PREALLOC) -# define ACE_DEFAULT_THREAD_MANAGER_PREALLOC 0 -#endif /* ACE_DEFAULT_THREAD_MANAGER_PREALLOC */ - -#if !defined (ACE_DEFAULT_THREAD_MANAGER_LWM) -# define ACE_DEFAULT_THREAD_MANAGER_LWM 1 -#endif /* ACE_DEFAULT_THREAD_MANAGER_LWM */ - -#if !defined (ACE_DEFAULT_THREAD_MANAGER_INC) -# define ACE_DEFAULT_THREAD_MANAGER_INC 1 -#endif /* ACE_DEFAULT_THREAD_MANAGER_INC */ - -#if !defined (ACE_DEFAULT_THREAD_MANAGER_HWM) -# define ACE_DEFAULT_THREAD_MANAGER_HWM ACE_DEFAULT_FREE_LIST_HWM -// this is a big number -#endif /* ACE_DEFAULT_THREAD_MANAGER_HWM */ - -// This is the synchronization mechanism used to prevent a thread -// descriptor gets removed from the Thread_Manager before it gets -// stash into it. If you want to disable this feature (and risk of -// corrupting the freelist,) you define the lock as ACE_Null_Mutex. -// Usually, if you can be sure that your threads will run for an -// extended period of time, you can safely disable the lock. - -#if !defined (ACE_DEFAULT_THREAD_MANAGER_LOCK) -# define ACE_DEFAULT_THREAD_MANAGER_LOCK ACE_SYNCH_MUTEX -#endif /* ACE_DEFAULT_THREAD_MANAGER_LOCK */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -class ACE_Task_Base; -class ACE_Thread_Manager; -class ACE_Thread_Descriptor; - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - /** - * @class ACE_At_Thread_Exit - * - * @brief Contains a method to be applied when a thread is terminated. - */ -class ACE_Export ACE_At_Thread_Exit -{ - friend class ACE_Thread_Descriptor; - friend class ACE_Thread_Manager; -public: - /// Default constructor - ACE_At_Thread_Exit (void); - - /// The destructor - virtual ~ACE_At_Thread_Exit (void); - - /// has the ownership? - int is_owner (void) const; - - /// Set the ownership of the . - int is_owner (int owner); - - /// This was applied? - int was_applied (void) const; - - /// Set applied state of . - int was_applied (int applied); - -protected: - /// The next hook in the list. - ACE_At_Thread_Exit *next_; - - /// Do the apply if necessary - void do_apply (void); - - /// The apply method. - virtual void apply (void) = 0; - - /// The Thread_Descriptor where this at is registered. - ACE_Thread_Descriptor* td_; - - /// The at was applied? - int was_applied_; - - /// The at has the ownership of this? - int is_owner_; -}; - -class ACE_Export ACE_At_Thread_Exit_Func : public ACE_At_Thread_Exit -{ -public: - /// Constructor - ACE_At_Thread_Exit_Func (void *object, - ACE_CLEANUP_FUNC func, - void *param = 0); - - virtual ~ACE_At_Thread_Exit_Func (void); - -protected: - /// The object to be cleanup - void *object_; - - /// The cleanup func - ACE_CLEANUP_FUNC func_; - - /// A param if required - void *param_; - - /// The apply method - void apply (void); -}; - -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - -/** - * @class ACE_Thread_Descriptor_Base - * - * @brief Basic information for thread descriptors. These information - * gets extracted out because we need it after a thread is - * terminated. - * - * @internal - */ -class ACE_Export ACE_Thread_Descriptor_Base : public ACE_OS_Thread_Descriptor -{ - - friend class ACE_Thread_Manager; - friend class ACE_Double_Linked_List; - friend class ACE_Double_Linked_List_Iterator_Base; - friend class ACE_Double_Linked_List_Iterator; - friend class ACE_Double_Linked_List; - friend class ACE_Double_Linked_List_Iterator_Base; - friend class ACE_Double_Linked_List_Iterator; -public: - ACE_Thread_Descriptor_Base (void); - ~ACE_Thread_Descriptor_Base (void); - - // = We need the following operators to make Borland happy. - - /// Equality operator. - bool operator== (const ACE_Thread_Descriptor_Base &rhs) const; - - /// Inequality operator. - bool operator!= (const ACE_Thread_Descriptor_Base &rhs) const; - - /// Group ID. - int grp_id (void) const; - - /// Current state of the thread. - ACE_UINT32 state (void) const; - - /// Return the pointer to an or NULL if there's no - /// associated with this thread.; - ACE_Task_Base *task (void) const; - -protected: - /// Reset this base thread descriptor. - void reset (void); - - /// Unique thread ID. - ACE_thread_t thr_id_; - - /// Unique handle to thread (used by Win32 and AIX). - ACE_hthread_t thr_handle_; - - /// Group ID. - int grp_id_; - - /// Current state of the thread. - ACE_UINT32 thr_state_; - - /// Pointer to an or NULL if there's no - /// . - ACE_Task_Base *task_; - - /// We need these pointers to maintain the double-linked list in a - /// thread managers. - ACE_Thread_Descriptor_Base *next_; - ACE_Thread_Descriptor_Base *prev_; -}; - -/** - * @class ACE_Thread_Descriptor - * - * @brief Information for controlling threads that run under the control - * of the . - */ -class ACE_Export ACE_Thread_Descriptor : public ACE_Thread_Descriptor_Base -{ -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - friend class ACE_At_Thread_Exit; -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - friend class ACE_Thread_Manager; - friend class ACE_Double_Linked_List; - friend class ACE_Double_Linked_List_Iterator; -public: - // = Initialization method. - ACE_Thread_Descriptor (void); - - // = Accessor methods. - /// Unique thread id. - ACE_thread_t self (void) const; - - /// Unique handle to thread (used by Win32 and AIX). - void self (ACE_hthread_t &); - - /// Dump the state of an object. - void dump (void) const; - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - /** - * This cleanup function must be called only for ACE_TSS_cleanup. - * The ACE_TSS_cleanup delegate Log_Msg instance destruction when - * Log_Msg cleanup is called before terminate. - */ - void log_msg_cleanup(ACE_Log_Msg* log_msg); - - /** - * Register an At_Thread_Exit hook and the ownership is acquire by - * Thread_Descriptor, this is the usual case when the AT is dynamically - * allocated. - */ - int at_exit (ACE_At_Thread_Exit* cleanup); - - /// Register an At_Thread_Exit hook and the ownership is retained for the - /// caller. Normally used when the at_exit hook is created in stack. - int at_exit (ACE_At_Thread_Exit& cleanup); -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - - /** - * Register an object (or array) for cleanup at thread termination. - * "cleanup_hook" points to a (global, or static member) function - * that is called for the object or array when it to be destroyed. - * It may perform any necessary cleanup specific for that object or - * its class. "param" is passed as the second parameter to the - * "cleanup_hook" function; the first parameter is the object (or - * array) to be destroyed. Returns 0 on success, non-zero on - * failure: -1 if virtual memory is exhausted or 1 if the object (or - * arrayt) had already been registered. - */ - int at_exit (void *object, - ACE_CLEANUP_FUNC cleanup_hook, - void *param); - - /// Do nothing destructor to keep some compilers happy - ~ACE_Thread_Descriptor (void); - - /** - * Do nothing but to acquire the thread descriptor's lock and - * release. This will first check if the thread is registered or - * not. If it is already registered, there's no need to reacquire - * the lock again. This is used mainly to get newly spawned thread - * in synch with thread manager and prevent it from accessing its - * thread descriptor before it gets fully built. This function is - * only called from ACE_Log_Msg::thr_desc. - */ - void acquire_release (void); - void acquire (void); - void release (void); - - /** - * Set/get the @c next_ pointer. These are required by the - * ACE_Free_List. - */ - void set_next (ACE_Thread_Descriptor *td); - ACE_Thread_Descriptor *get_next (void) const; - -private: - /// Reset this thread descriptor. - void reset (ACE_Thread_Manager *tm); - -#if !defined (ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - /// Pop an At_Thread_Exit from at thread termination list, apply the at - /// if apply is true. - void at_pop (int apply = 1); - - /// Push an At_Thread_Exit to at thread termination list and set the - /// ownership of at. - void at_push (ACE_At_Thread_Exit* cleanup, - int is_owner = 0); - - /// Run the AT_Thread_Exit hooks. - void do_at_exit (void); - - /// Terminate realize the cleanup process to thread termination - void terminate (void); - - /// Thread_Descriptor is the ownership of ACE_Log_Msg if log_msg_!=0 - /// This can occur because ACE_TSS_cleanup was executed before terminate. - ACE_Log_Msg *log_msg_; - - /// The AT_Thread_Exit list - ACE_At_Thread_Exit *at_exit_list_; -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - - /** - * Stores the cleanup info for a thread. - * @note This should be generalized to be a stack of ACE_Cleanup_Info's. - */ - ACE_Cleanup_Info cleanup_info_; - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - /// Pointer to an ACE_Thread_Manager or NULL if there's no - /// ACE_Thread_Manager> - ACE_Thread_Manager* tm_; -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - - /// Registration lock to prevent premature removal of thread descriptor. - ACE_DEFAULT_THREAD_MANAGER_LOCK *sync_; - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - /// Keep track of termination status. - bool terminated_; -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ -}; - -// Forward declaration. -class ACE_Thread_Control; - -// This typedef should be (and used to be) inside the -// ACE_Thread_Manager declaration. But, it caused compilation -// problems on g++/VxWorks/i960 with -g. Note that -// ACE_Thread_Manager::THR_FUNC is only used internally in -// ACE_Thread_Manager, so it's not useful for anyone else. -// It also caused problems on IRIX5 with g++. -#if defined (__GNUG__) -typedef int (ACE_Thread_Manager::*ACE_THR_MEMBER_FUNC)(ACE_Thread_Descriptor *, int); -#endif /* __GNUG__ */ - -/** - * @class ACE_Thread_Manager - * - * @brief Manages a pool of threads. - * - * This class allows operations on groups of threads atomically. - * The default behavior of thread manager is to wait on - * all threads under it's management when it gets destructed. - * Therefore, remember to remove a thread from thread manager if - * you don't want it to wait for the thread. There are also - * function to disable this default wait-on-exit behavior. - * However, if your program depends on turning this off to run - * correctly, you are probably doing something wrong. Rule of - * thumb, use ACE_Thread to manage your daemon threads. - * Notice that if there're threads live beyond the scope of - *
, you are sure to have resource leaks in your program. - * Remember to wait on threads before exiting
if that - * could happen in your programs. - */ -class ACE_Export ACE_Thread_Manager -{ -public: - friend class ACE_Thread_Control; - - // Allow ACE_THread_Exit to register the global TSS instance object. - friend class ACE_Thread_Exit; -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - friend class ACE_Thread_Descriptor; -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - -#if !defined (__GNUG__) - typedef int (ACE_Thread_Manager::*ACE_THR_MEMBER_FUNC)(ACE_Thread_Descriptor *, int); -#endif /* !__GNUG__ */ - - /// These are the various states a thread managed by the - /// ACE_Thread_Manager can be in. - enum - { - /// Uninitialized. - ACE_THR_IDLE = 0x00000000, - - /// Created but not yet running. - ACE_THR_SPAWNED = 0x00000001, - - /// Thread is active (naturally, we don't know if it's actually - /// *running* because we aren't the scheduler...). - ACE_THR_RUNNING = 0x00000002, - - /// Thread is suspended. - ACE_THR_SUSPENDED = 0x00000004, - - /// Thread has been cancelled (which is an indiction that it needs to - /// terminate...). - ACE_THR_CANCELLED = 0x00000008, - - /// Thread has shutdown, but the slot in the thread manager hasn't - /// been reclaimed yet. - ACE_THR_TERMINATED = 0x00000010, - - /// Join operation has been invoked on the thread by thread manager. - ACE_THR_JOINING = 0x10000000 - }; - - // = Initialization and termination methods. - /** - * @brief Initialization and termination methods. - * - * Internally, ACE_Thread_Manager keeps a freelist for caching - * resources it uses to keep track of managed threads (not the - * threads themselves.) @a prealloc, @a lwm, @a inc, @hwm - * determine the initial size, the low water mark, increment step, - * and high water mark of the freelist. - * - * @sa ACE_Free_List - */ - ACE_Thread_Manager (size_t preaolloc = ACE_DEFAULT_THREAD_MANAGER_PREALLOC, - size_t lwm = ACE_DEFAULT_THREAD_MANAGER_LWM, - size_t inc = ACE_DEFAULT_THREAD_MANAGER_INC, - size_t hwm = ACE_DEFAULT_THREAD_MANAGER_HWM); - ~ACE_Thread_Manager (void); - -#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) - /// Get pointer to a process-wide . - static ACE_Thread_Manager *instance (void); - - /// Set pointer to a process-wide and return - /// existing pointer. - static ACE_Thread_Manager *instance (ACE_Thread_Manager *); - - /// Delete the dynamically allocated Singleton - static void close_singleton (void); -#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ - - /// No-op. Currently unused. - int open (size_t size = 0); - - /** - * Release all resources. - * By default, this method will wait till all threads - * exit. However, when called from , most global resources - * are destroyed and thus, we don't try to wait but just clean up the thread - * descriptor list. - */ - int close (void); - - // The * argument to each of the family member - // functions is interpreted and used as shown in the following - // table. NOTE: the final option, to provide task names, is _only_ - // supported on VxWorks! - // - // Value of ACE_thread_t * argument Use Platforms - // ================================ ========================== ========= - // 0 Not used. All - // non-0 (and points to 0 char * The task name is passed All - // on VxWorks) back in the char *. - // non-0, points to non-0 char * The char * is used as VxWorks only - // the task name. The - // argument is not modified. - - /** - * Create a new thread, which executes with argument . - * Returns: on success a unique group id that can be used to control - * other threads added to the same group. On failure, returns -1. - */ - int spawn (ACE_THR_FUNC func, - void *arg = 0, - long flags = THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, - ACE_thread_t * = 0, - ACE_hthread_t *t_handle = 0, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - int grp_id = -1, - void *stack = 0, - size_t stack_size = 0); - - /** - * Spawn N new threads, which execute with argument . - * If != 0 the thread_ids of successfully spawned - * threads will be placed into the buffer (which must - * be the same size as ). If != 0 it is assumed to be an - * array of pointers to the base of the stacks to use for the - * threads being spawned. If != 0 it is assumed to be - * an array of values indicating how big each of the - * corresponding s are. If != 0 it is - * assumed to be an array of thread_handles that will be - * assigned the values of the thread handles being spawned. - * - * Threads in Thread_Manager can be manipulated in groups based on - * or using functions such as kill_grp() or - * cancel_task(). - * - * If is assigned, the newly spawned threads are added into - * the group. Otherwise, the Thread_Manager assigns these - * threads with a grp_id. You should choose either assigning - * everytime, or let the Thread_Manager handles it for - * you consistently. - * - * The argument is usually assigned by - * . It associates the newly spawned - * threads with an ACE_Task instance, which defaults to . - * - * @retval -1 on failure ( will explain...), otherwise returns the - * group id of the threads. - */ - int spawn_n (size_t n, - ACE_THR_FUNC func, - void *arg = 0, - long flags = THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - int grp_id = -1, - ACE_Task_Base *task = 0, - ACE_hthread_t thread_handles[] = 0, - void *stack[] = 0, - size_t stack_size[] = 0); - - /** - * Spawn N new threads, which execute with argument . - * If != 0 the thread_ids of successfully spawned - * threads will be placed into the buffer (which must - * be the same size as ). If != 0 it is assumed to be an - * array of pointers to the base of the stacks to use for the - * threads being spawned. If != 0 it is assumed to be - * an array of values indicating how big each of the - * corresponding s are. If != 0 it is - * assumed to be an array of thread_handles that will be - * assigned the values of the thread handles being spawned. - * - * Threads in Thread_Manager can be manipulated in groups based on - * or using functions such as kill_grp() or - * cancel_task(). - * - * If is assigned, the newly spawned threads are added into - * the group. Otherwise, the Thread_Manager assigns these - * threads with a grp_id. You should choose either assigning - * everytime, or let the Thread_Manager handles it for - * you consistently. - * - * The argument is usually assigned by - * . It associates the newly spawned - * threads with an ACE_Task instance, which defaults to . - * - * @retval -1 on failure ( will explain...), otherwise returns the - * group id of the threads. - */ - int spawn_n (ACE_thread_t thread_ids[], - size_t n, - ACE_THR_FUNC func, - void *arg, - long flags, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - int grp_id = -1, - void *stack[] = 0, - size_t stack_size[] = 0, - ACE_hthread_t thread_handles[] = 0, - ACE_Task_Base *task = 0); - - /** - * Called to clean up when a thread exits. - * - * @param do_thread_exit If non-0 then ACE_Thread::exit is called to - * exit the thread - * @param status If ACE_Thread_Exit is called, this is passed as - * the exit value of the thread. - * Should _not_ be called by main thread. - */ - ACE_THR_FUNC_RETURN exit (ACE_THR_FUNC_RETURN status = 0, - int do_thread_exit = 1); - - /** - * Block until there are no more threads running in this thread - * manager or @c timeout expires. - * - * @param timeout is treated as "absolute" time by default, but this - * can be changed to "relative" time by setting the @c - * use_absolute_time to 0. - * @param abandon_detached_threads If non-0, @c wait() will first - * check thru its thread list for - * threads with THR_DETACHED or - * THR_DAEMON flags set and remove - * these threads. Notice that - * unlike other @c wait_*() methods, - * by default, @c wait() does wait on - * all thread spawned by this - * thread manager no matter the detached - * flags are set or not unless it is - * called with @c - * abandon_detached_threads flag set. - * @param use_absolute_time If non-0 then treat @c timeout as - * absolute time, else relative time. - * @return 0 on success * and -1 on failure. - * - * NOTE that if this function is called while the @c - * ACE_Object_Manager is shutting down (as a result of program - * rundown via @c ACE::fini()), it will not wait for any threads to - * complete. If you must wait for threads spawned by this thread - * manager to complete and you are in a ACE rundown situation (such - * as your object is being destroyed by the @c ACE_Object_Manager) - * you can use @c wait_grp() instead. - */ - int wait (const ACE_Time_Value *timeout = 0, - bool abandon_detached_threads = false, - bool use_absolute_time = true); - - /// Join a thread specified by . Do not wait on a detached thread. - int join (ACE_thread_t tid, ACE_THR_FUNC_RETURN *status = 0); - - /** - * Block until there are no more threads running in a group. - * Returns 0 on success and -1 on failure. Notice that wait_grp - * will not wait on detached threads. - */ - int wait_grp (int grp_id); - - /** - * Return the "real" handle to the calling thread, caching it if - * necessary in TSS to speed up subsequent lookups. This is - * necessary since on some platforms (e.g., Win32) we can't get this - * handle via direct method calls. Notice that you should *not* - * close the handle passed back from this method. It is used - * internally by Thread Manager. On the other hand, you *have to* - * use this internal thread handle when working on Thread_Manager. - * Return -1 if fail. - */ - int thr_self (ACE_hthread_t &); - - /** - * Return the unique ID of the thread. This is not strictly - * necessary (because a thread can always just call - * ). However, we put it here to be complete. - */ - ACE_thread_t thr_self (void); - - /** - * Returns a pointer to the current we're executing - * in if this thread is indeed running in an , else - * return 0. - */ - ACE_Task_Base *task (void); - - // = Suspend methods, which isn't supported on POSIX pthreads (will not block). - /// Suspend all threads - int suspend_all (void); - - /// Suspend a single thread. - int suspend (ACE_thread_t); - - /// Suspend a group of threads. - int suspend_grp (int grp_id); - - /** - * True if is inactive (i.e., suspended), else false. Always - * return false if is not managed by the Thread_Manager. - */ - int testsuspend (ACE_thread_t t_id); - - // = Resume methods, which isn't supported on POSIX pthreads (will not block). - /// Resume all stopped threads - int resume_all (void); - - /// Resume a single thread. - int resume (ACE_thread_t); - - /// Resume a group of threads. - int resume_grp (int grp_id); - - /** - * True if is active (i.e., resumed), else false. Always - * return false if is not managed by the Thread_Manager. - */ - int testresume (ACE_thread_t t_id); - - // = Send signals to one or more threads without blocking. - /** - * Send to all stopped threads. Not supported on platforms - * that do not have advanced signal support, such as Win32. - * Send the to a single thread. Not supported on platforms - * that do not have advanced signal support, such as Win32. - * Send to a group of threads, not supported on platforms - * that do not have advanced signal support, such as Win32. - */ - int kill_all (int signum); - int kill (ACE_thread_t, - int signum); - int kill_grp (int grp_id, - int signum); - - // = Cancel methods, which provides a cooperative thread-termination mechanism (will not block). - /** - * Cancel's all the threads. - */ - int cancel_all (int async_cancel = 0); - - /** - * Cancel a single thread. - */ - int cancel (ACE_thread_t, int async_cancel = 0); - - /** - * Cancel a group of threads. - */ - int cancel_grp (int grp_id, int async_cancel = 0); - - /** - * True if is cancelled, else false. Always return false if - * is not managed by the Thread_Manager. - */ - int testcancel (ACE_thread_t t_id); - - /** - * True if has terminated (i.e., is no longer running), - * but the slot in the thread manager hasn't been reclaimed yet, - * else false. Always return false if is not managed by the - * Thread_Manager. - */ - int testterminate (ACE_thread_t t_id); - - /// Set group ids for a particular thread id. - int set_grp (ACE_thread_t, - int grp_id); - - /// Get group ids for a particular thread id. - int get_grp (ACE_thread_t, - int &grp_id); - - // = The following methods are new methods which resemble current - // methods in . For example, the - // method resembles the method, and - // resembles . - - // = Operations on ACE_Tasks. - - /** - * Block until there are no more threads running in a specified task. - * This method will not wait for either detached or daemon threads; - * the threads must have been spawned with the @c THR_JOINABLE flag. - * Upon successful completion, the threads have been joined, so further - * attempts to join with any of the waited-for threads will fail. - * - * @param task The ACE_Task_Base object whose threads are to waited for. - * - * @retval 0 Success. - * @retval -1 Failure (consult errno for further information). - */ - int wait_task (ACE_Task_Base *task); - - /** - * Suspend all threads in an ACE_Task. - */ - int suspend_task (ACE_Task_Base *task); - - /** - * Resume all threads in an ACE_Task. - */ - int resume_task (ACE_Task_Base *task); - - /** - * Send a signal to all threads in an . - */ - int kill_task (ACE_Task_Base *task, - int signum); - - /** - * Cancel all threads in an . If is non-0, - * then asynchronously cancel these threads if the OS platform - * supports cancellation. Otherwise, perform a "cooperative" - * cancellation. - */ - int cancel_task (ACE_Task_Base *task, int async_cancel = 0); - - // = Collect thread handles in the thread manager. Notice that - // the collected information is just a snapshot. - /// Check if the thread is managed by the thread manager. Return true if - /// the thread is found, false otherwise. - int hthread_within (ACE_hthread_t handle); - int thread_within (ACE_thread_t tid); - - /// Returns the number of in a group. - int num_tasks_in_group (int grp_id); - - /// Returns the number of threads in an . - int num_threads_in_task (ACE_Task_Base *task); - - /** - * Returns a list of ACE_Task_Base pointers corresponding to the tasks - * that have active threads in a specified thread group. - * - * @param grp_id The thread group ID to obtain task pointers for. - * - * @param task_list is a pointer to an array to receive the list of pointers. - * The caller is responsible for supplying an array with at - * least @arg n entries. - * - * @param n The maximum number of ACE_Task_Base pointers to write - * in @arg task_list. - * - * @retval If successful, the number of pointers returned, which will be - * no greater than @arg n. Returns -1 on error. - * - * @note This method has no way to indicate if there are more than - * @arg n ACE_Task_Base pointers available. Therefore, it may be - * wise to guess a larger value of @arg n than one thinks in cases - * where the exact number of tasks is not known. - * - * @sa num_tasks_in_group(), task_all_list() - */ - ssize_t task_list (int grp_id, - ACE_Task_Base *task_list[], - size_t n); - - /** - * Returns in a list of up to thread ids in an - * . The caller must allocate the memory for - * . In case of an error, -1 is returned. If no - * requested values are found, 0 is returned, otherwise correct - * number of retrieved values are returned. - */ - ssize_t thread_list (ACE_Task_Base *task, - ACE_thread_t thread_list[], - size_t n); - - /** - * Returns in a list of up to thread handles in - * an . The caller must allocate memory for - * . In case of an error, -1 is returned. If no - * requested values are found, 0 is returned, otherwise correct - * number of retrieved values are returned. - */ - ssize_t hthread_list (ACE_Task_Base *task, - ACE_hthread_t hthread_list[], - size_t n); - - /** - * Returns in a list of up to thread ids in a - * group . The caller must allocate the memory for - * . In case of an error, -1 is returned. If no - * requested values are found, 0 is returned, otherwise correct - * number of retrieved values are returned. - */ - ssize_t thread_grp_list (int grp_id, - ACE_thread_t thread_list[], - size_t n); - - /** - * Returns in a list of up to thread handles in - * a group . The caller must allocate memory for - * . - */ - ssize_t hthread_grp_list (int grp_id, - ACE_hthread_t hthread_list[], - size_t n); - - /** - * Returns a list of ACE_Task_Base pointers corresponding to the tasks - * that have active threads managed by this instance. - * - * @param task_list is a pointer to an array to receive the list of pointers. - * The caller is responsible for supplying an array with at - * least @arg n entries. - * - * @param n The maximum number of ACE_Task_Base pointers to write - * in @arg task_list. - * - * @retval If successful, the number of pointers returned, which will be - * no greater than @arg n. Returns -1 on error. - * - * @note This method has no way to indicate if there are more than - * @arg n ACE_Task_Base pointers available. Therefore, it may be - * wise to guess a larger value of @arg n than one thinks in cases - * where the exact number of tasks is not known. - * - * @sa count_threads() - */ - ssize_t task_all_list (ACE_Task_Base *task_list[], - size_t n); - - /** - * Returns in a list of up to thread ids. The - * caller must allocate the memory for . In case of an - * error, -1 is returned. If no requested values are found, 0 is - * returned, otherwise correct number of retrieved values are - * returned. - */ - ssize_t thread_all_list (ACE_thread_t thread_list[], - size_t n); - - /// Set group ids for a particular task. - int set_grp (ACE_Task_Base *task, int grp_id); - - /// Get group ids for a particular task. - int get_grp (ACE_Task_Base *task, int &grp_id); - - /// Return a count of the current number of threads active in the - /// . - size_t count_threads (void) const; - - /// Get the state of the thread. Returns false if the thread is not - /// managed by this thread manager. - int thr_state (ACE_thread_t id, ACE_UINT32& state); - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - /** - * Register an At_Thread_Exit hook and the ownership is acquire by - * Thread_Descriptor, this is the usual case when the AT is dynamically - * allocated. - */ - int at_exit (ACE_At_Thread_Exit* cleanup); - - /// Register an At_Thread_Exit hook and the ownership is retained for the - /// caller. Normally used when the at_exit hook is created in stack. - int at_exit (ACE_At_Thread_Exit& cleanup); -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - - /** - * - ***** - * @deprecated This function is deprecated. Please use the previous two - * at_exit method. Notice that you should avoid mixing this method - * with the previous two at_exit methods. - ***** - * - * Register an object (or array) for cleanup at - * thread termination. "cleanup_hook" points to a (global, or - * static member) function that is called for the object or array - * when it to be destroyed. It may perform any necessary cleanup - * specific for that object or its class. "param" is passed as the - * second parameter to the "cleanup_hook" function; the first - * parameter is the object (or array) to be destroyed. - * "cleanup_hook", for example, may delete the object (or array). - * If == 0, the will _NOT_ get cleanup at - * thread exit. You can use this to cancel the previously added - * at_exit. - */ - int at_exit (void *object, - ACE_CLEANUP_FUNC cleanup_hook, - void *param); - - /// Access function to determine whether the Thread_Manager will - /// wait for its thread to exit or not when being closing down. - void wait_on_exit (int dowait); - int wait_on_exit (void); - - /// Dump the state of an object. - void dump (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Accessors for ACE_Thread_Descriptors. - /** - * Get a pointer to the calling thread's own thread_descriptor. - * This must be called from a spawn thread. This function will - * fetch the info from TSS. - */ - ACE_Thread_Descriptor *thread_desc_self (void); - - /// Return a pointer to the thread's Thread_Descriptor, - /// 0 if fail. - ACE_Thread_Descriptor *thread_descriptor (ACE_thread_t); - - /// Return a pointer to the thread's Thread_Descriptor, - /// 0 if fail. - ACE_Thread_Descriptor *hthread_descriptor (ACE_hthread_t); - - /// Create a new thread (must be called with locks held). - int spawn_i (ACE_THR_FUNC func, - void *arg, - long flags, - ACE_thread_t * = 0, - ACE_hthread_t *t_handle = 0, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - int grp_id = -1, - void *stack = 0, - size_t stack_size = 0, - ACE_Task_Base *task = 0); - - /// Run the registered hooks when the thread exits. - void run_thread_exit_hooks (int i); - - /// Locate the index of the table slot occupied by . Returns - /// -1 if is not in the table doesn't contain . - ACE_Thread_Descriptor *find_thread (ACE_thread_t t_id); - - /// Locate the index of the table slot occupied by . Returns - /// -1 if is not in the table doesn't contain . - ACE_Thread_Descriptor *find_hthread (ACE_hthread_t h_id); - - /** - * Locate the thread descriptor address of the list occupied by - * . Returns 0 if is not in the table doesn't contain - * . - */ - ACE_Thread_Descriptor *find_task (ACE_Task_Base *task, - size_t slot = 0); - - /// Insert a thread in the table (checks for duplicates). - int insert_thr (ACE_thread_t t_id, - ACE_hthread_t, - int grp_id = -1, - long flags = 0); - - /// Append a thread in the table (adds at the end, growing the table - /// if necessary). - int append_thr (ACE_thread_t t_id, ACE_hthread_t, - ACE_UINT32, - int grp_id, - ACE_Task_Base *task = 0, - long flags = 0, - ACE_Thread_Descriptor *td = 0); - - /// Remove thread from the table. - void remove_thr (ACE_Thread_Descriptor *td, - int close_handler); - - /// Remove all threads from the table. - void remove_thr_all (void); - - // = The following four methods implement a simple scheme for - // operating on a collection of threads atomically. - - /** - * Efficiently check whether is in a particular . - * This call updates the TSS cache if possible to speed up - * subsequent searches. - */ - int check_state (ACE_UINT32 state, - ACE_thread_t thread, - int enable = 1); - - /// Apply to all members of the table that match the - int apply_task (ACE_Task_Base *task, - ACE_THR_MEMBER_FUNC, - int = 0); - - /// Apply to all members of the table that match the . - int apply_grp (int grp_id, - ACE_THR_MEMBER_FUNC func, - int arg = 0); - - /// Apply to all members of the table. - int apply_all (ACE_THR_MEMBER_FUNC, - int = 0); - - /// Join the thread described in . - int join_thr (ACE_Thread_Descriptor *td, - int = 0); - - /// Resume the thread described in . - int resume_thr (ACE_Thread_Descriptor *td, - int = 0); - - /// Suspend the thread described in . - int suspend_thr (ACE_Thread_Descriptor *td, - int = 0); - - /// Send signal to the thread described in . - int kill_thr (ACE_Thread_Descriptor *td, - int signum); - - /// Set the cancellation flag for the thread described in . - int cancel_thr (ACE_Thread_Descriptor *td, - int async_cancel = 0); - - /// Register a thread as terminated and put it into the . - int register_as_terminated (ACE_Thread_Descriptor *td); - - /// Setting the static ACE_TSS_TYPE (ACE_Thread_Exit) *thr_exit_ pointer. - static int set_thr_exit (ACE_TSS_TYPE (ACE_Thread_Exit) *ptr); - - /** - * Keeping a list of thread descriptors within the thread manager. - * Double-linked list enables us to cache the entries in TSS - * and adding/removing thread descriptor entries without - * affecting other thread's descriptor entries. - */ - ACE_Double_Linked_List thr_list_; - -#if !defined (ACE_VXWORKS) - /// Collect terminated but not yet joined thread entries. - ACE_Double_Linked_List terminated_thr_list_; -#endif /* ACE_VXWORKS */ - - /// Collect pointers to thread descriptors of threads to be removed later. - ACE_Unbounded_Queue thr_to_be_removed_; - - /// Keeps track of the next group id to assign. - int grp_id_; - - /// Set if we want the Thread_Manager to wait on all threads before - /// being closed, reset otherwise. - int automatic_wait_; - - // = ACE_Thread_Mutex and condition variable for synchronizing termination. -#if defined (ACE_HAS_THREADS) - /// Serialize access to the . - ACE_Thread_Mutex lock_; - - /// Keep track of when there are no more threads. - ACE_Condition_Thread_Mutex zero_cond_; -#endif /* ACE_HAS_THREADS */ - - ACE_Locked_Free_List thread_desc_freelist_; - -private: -#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) - /// Pointer to a process-wide . - static ACE_Thread_Manager *thr_mgr_; - - /// Must delete the if non-0. - static int delete_thr_mgr_; - - /// Global ACE_TSS (ACE_Thread_Exit) object ptr. - static ACE_TSS_TYPE (ACE_Thread_Exit) *thr_exit_; -#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ -}; - -#if defined (ACE_THREAD_MANAGER_LACKS_STATICS) -#define ACE_THREAD_MANAGER_SINGLETON_DEFINE \ - ACE_Singleton; -typedef ACE_Singleton ACE_THREAD_MANAGER_SINGLETON; -#endif /* defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Thread_Manager.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_THREAD_MANAGER_H */ diff --git a/ace/Thread_Manager.inl b/ace/Thread_Manager.inl deleted file mode 100644 index 70a4c936384..00000000000 --- a/ace/Thread_Manager.inl +++ /dev/null @@ -1,320 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) -ACE_INLINE -ACE_At_Thread_Exit::ACE_At_Thread_Exit (void) - : next_ (0), - td_ (0), - was_applied_ (0), - is_owner_ (1) -{ -} - -ACE_INLINE int -ACE_At_Thread_Exit::was_applied() const - -{ - return was_applied_; -} - -ACE_INLINE int -ACE_At_Thread_Exit::was_applied (int applied) -{ - was_applied_ = applied; - if (was_applied_) - td_ = 0; - return was_applied_; -} - -ACE_INLINE int -ACE_At_Thread_Exit::is_owner() const -{ - return is_owner_; -} - -ACE_INLINE int -ACE_At_Thread_Exit::is_owner (int owner) -{ - is_owner_ = owner; - return is_owner_; -} - -ACE_INLINE void -ACE_At_Thread_Exit::do_apply (void) -{ - if (!this->was_applied_ && this->is_owner_) - td_->at_pop(); -} - -ACE_INLINE -ACE_At_Thread_Exit_Func::ACE_At_Thread_Exit_Func (void *object, - ACE_CLEANUP_FUNC func, - void *param) - : object_(object), - func_(func), - param_(param) -{ -} -#endif /* ! ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - -ACE_INLINE -ACE_Thread_Descriptor_Base::ACE_Thread_Descriptor_Base (void) - : ACE_OS_Thread_Descriptor (), - thr_id_ (ACE_OS::NULL_thread), - thr_handle_ (ACE_OS::NULL_hthread), - grp_id_ (0), - thr_state_ (ACE_Thread_Manager::ACE_THR_IDLE), - task_ (0), - next_ (0), - prev_ (0) -{ -} - -ACE_INLINE -ACE_Thread_Descriptor_Base::~ACE_Thread_Descriptor_Base (void) -{ -} - -ACE_INLINE bool -ACE_Thread_Descriptor_Base::operator== ( - const ACE_Thread_Descriptor_Base &rhs) const -{ - return - ACE_OS::thr_cmp (this->thr_handle_, rhs.thr_handle_) - && ACE_OS::thr_equal (this->thr_id_, rhs.thr_id_); -} - -ACE_INLINE bool -ACE_Thread_Descriptor_Base::operator!=(const ACE_Thread_Descriptor_Base &rhs) const -{ - return !(*this == rhs); -} - -ACE_INLINE ACE_Task_Base * -ACE_Thread_Descriptor_Base::task (void) const -{ - ACE_TRACE ("ACE_Thread_Descriptor_Base::task"); - return this->task_; -} - -// Group ID. - -ACE_INLINE int -ACE_Thread_Descriptor_Base::grp_id (void) const -{ - ACE_TRACE ("ACE_Thread_Descriptor_Base::grp_id"); - return grp_id_; -} - -// Current state of the thread. -ACE_INLINE ACE_UINT32 -ACE_Thread_Descriptor_Base::state (void) const -{ - ACE_TRACE ("ACE_Thread_Descriptor_Base::state"); - return thr_state_; -} - -// Reset this base descriptor. -ACE_INLINE void -ACE_Thread_Descriptor_Base::reset (void) -{ - ACE_TRACE ("ACE_Thread_Descriptor_Base::reset"); - this->thr_id_ = ACE_OS::NULL_thread; - this->thr_handle_ = ACE_OS::NULL_hthread; - this->grp_id_ = 0; - this->thr_state_ = ACE_Thread_Manager::ACE_THR_IDLE; - this->task_ = 0; - this->flags_ = 0; -} - -// Unique thread id. -ACE_INLINE ACE_thread_t -ACE_Thread_Descriptor::self (void) const -{ - ACE_TRACE ("ACE_Thread_Descriptor::self"); - return this->thr_id_; -} - -// Unique kernel-level thread handle. - -ACE_INLINE void -ACE_Thread_Descriptor::self (ACE_hthread_t &handle) -{ - ACE_TRACE ("ACE_Thread_Descriptor::self"); - handle = this->thr_handle_; -} - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) -ACE_INLINE void -ACE_Thread_Descriptor::log_msg_cleanup (ACE_Log_Msg* log_msg) - -{ - log_msg_ = log_msg; -} -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - -// Set the pointer -ACE_INLINE void -ACE_Thread_Descriptor::set_next (ACE_Thread_Descriptor *td) -{ - ACE_TRACE ("ACE_Thread_Descriptor::set_next"); - this->next_ = td; -} - -// Get the pointer -ACE_INLINE ACE_Thread_Descriptor * -ACE_Thread_Descriptor::get_next (void) const -{ - ACE_TRACE ("ACE_Thread_Descriptor::get_next"); - return static_cast (this->next_); -} - -// Reset this thread descriptor -ACE_INLINE void -ACE_Thread_Descriptor::reset (ACE_Thread_Manager *tm) -{ - ACE_TRACE ("ACE_Thread_Descriptor::reset"); - this->ACE_Thread_Descriptor_Base::reset (); -#if defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) - this->cleanup_info_.cleanup_hook_ = 0; - this->cleanup_info_.object_ = 0; - this->cleanup_info_.param_ = 0; -#else /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - this->at_exit_list_ = 0; - // Start the at_exit hook list. - this->tm_ = tm; - // Setup the Thread_Manager. - this->log_msg_ = 0; - this->terminated_ = false; -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ -} - -ACE_INLINE ACE_Thread_Descriptor * -ACE_Thread_Manager::thread_desc_self (void) -{ - // This method must be called with lock held. - - // Try to get it from cache. - ACE_Thread_Descriptor *desc = ACE_LOG_MSG->thr_desc (); - -#if 1 - // ACE_ASSERT (desc != 0); - // Thread descriptor should always get cached. -#else - if (desc == 0) - { - ACE_thread_t id = ACE_OS::thr_self (); - - desc = this->find_thread (id); - - // Thread descriptor adapter might not have been put into the - // list yet. - if (desc != 0) - // Update the TSS cache. - ACE_LOG_MSG->thr_desc (desc); - } -#endif - return desc; -} - -// Return the unique ID of the thread. - -ACE_INLINE ACE_thread_t -ACE_Thread_Manager::thr_self (void) -{ - ACE_TRACE ("ACE_Thread_Manager::thr_self"); - return ACE_Thread::self (); -} - -ACE_INLINE ACE_Task_Base * -ACE_Thread_Manager::task (void) -{ - ACE_TRACE ("ACE_Thread_Manager::task"); - - ACE_Thread_Descriptor *td = this->thread_desc_self () ; - - if (td == 0) - return 0; - else - return td->task (); -} - -ACE_INLINE int -ACE_Thread_Manager::open (size_t) -{ - // Currently no-op. - return 0; -} - -#if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) -ACE_INLINE int -ACE_Thread_Manager::at_exit (ACE_At_Thread_Exit* at) -{ - ACE_Thread_Descriptor *td = this->thread_desc_self (); - if (td == 0) - return -1; - else - return td->at_exit (at); -} - -ACE_INLINE int -ACE_Thread_Manager::at_exit (ACE_At_Thread_Exit& at) -{ - ACE_Thread_Descriptor *td = this->thread_desc_self (); - if (td == 0) - return -1; - else - return td->at_exit (at); -} -#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */ - -ACE_INLINE int -ACE_Thread_Manager::at_exit (void *object, - ACE_CLEANUP_FUNC cleanup_hook, - void *param) -{ - ACE_Thread_Descriptor *td = this->thread_desc_self (); - if (td == 0) - return -1; - else - return td->at_exit (object, - cleanup_hook, - param); -} - -ACE_INLINE void -ACE_Thread_Manager::wait_on_exit (int do_wait) -{ - this->automatic_wait_ = do_wait; -} - -ACE_INLINE int -ACE_Thread_Manager::wait_on_exit (void) -{ - return this->automatic_wait_; -} - -ACE_INLINE int -ACE_Thread_Manager::register_as_terminated (ACE_Thread_Descriptor *td) -{ -#if defined (ACE_VXWORKS) - ACE_UNUSED_ARG (td); -#else /* ! ACE_VXWORKS */ - ACE_Thread_Descriptor_Base *tdb = 0; - ACE_NEW_RETURN (tdb, ACE_Thread_Descriptor_Base (*td), -1); - this->terminated_thr_list_.insert_tail (tdb); -#endif /* ! ACE_VXWORKS */ - return 0; -} - -ACE_INLINE size_t -ACE_Thread_Manager::count_threads (void) const -{ - return this->thr_list_.size (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Mutex.cpp b/ace/Thread_Mutex.cpp deleted file mode 100644 index 6a7480902e2..00000000000 --- a/ace/Thread_Mutex.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file Thread_Mutex.cpp - * - * $Id$ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/Thread_Mutex.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/Guard_T.h" -#include "ace/Malloc_T.h" - -ACE_RCSID(ace, Thread_Mutex, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Mutex_Guard) - -#if defined (ACE_USES_OBSOLETE_GUARD_CLASSES) -void -ACE_Thread_Mutex_Guard::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Thread_Mutex_Guard::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} -#endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */ -ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Mutex) - -void -ACE_Thread_Mutex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Thread_Mutex::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Thread_Mutex::~ACE_Thread_Mutex (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::~ACE_Thread_Mutex"); - this->remove (); -} - -ACE_Thread_Mutex::ACE_Thread_Mutex (const ACE_TCHAR *name, ACE_mutexattr_t *arg) - : removed_ (0) -{ -// ACE_TRACE ("ACE_Thread_Mutex::ACE_Thread_Mutex"); - - if (ACE_OS::thread_mutex_init (&this->lock_, - 0, - name, - arg) != 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Thread_Mutex::ACE_Thread_Mutex"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/Thread_Mutex.h b/ace/Thread_Mutex.h deleted file mode 100644 index a56fe08e0cb..00000000000 --- a/ace/Thread_Mutex.h +++ /dev/null @@ -1,239 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Thread_Mutex.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_THREAD_MUTEX_H -#define ACE_THREAD_MUTEX_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_HAS_THREADS) -# include "ace/Null_Mutex.h" -#else /* ACE_HAS_THREADS */ -// ACE platform supports some form of threading. - -#include "ace/ACE_export.h" -#include "ace/OS_NS_Thread.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Thread_Mutex - * - * @brief ACE_Thread_Mutex wrapper (only valid for threads in the same - * process). - * - * This implementation is optimized for locking threads that are - * in the same process. It maps to s on NT - * and with set to on UNIX. - * ACE_Thread_Mutex is recursive on some platforms (like - * Win32). However, on most platforms (like Solaris) it is not - * recursive. To be totally safe and portable, developers - * should use ACE_Recursive_Thread_Mutex when they need a - * recursive mutex. - */ -class ACE_Export ACE_Thread_Mutex -{ - friend class ACE_Condition_Thread_Mutex; -public: - /// Constructor. - ACE_Thread_Mutex (const ACE_TCHAR *name = 0, - ACE_mutexattr_t *attributes = 0); - - /// Implicitly destroy the mutex. - ~ACE_Thread_Mutex (void); - - /** - * Explicitly destroy the mutex. Note that only one thread should - * call this method since it doesn't protect against race - * conditions. - */ - int remove (void); - - /// Acquire lock ownership (wait on queue if necessary). - int acquire (void); - - /** - * Block the thread until we acquire the mutex or until @a tv times - * out, in which case -1 is returned with == . Note - * that @a tv is assumed to be in "absolute" rather than "relative" - * time. The value of @a tv is updated upon return to show the - * actual (absolute) acquisition time. - */ - int acquire (ACE_Time_Value &tv); - - /** - * If @a tv == 0 the call directly. Otherwise, Block the - * thread until we acquire the mutex or until times out, in - * which case -1 is returned with == . Note that - * <*tv> is assumed to be in "absolute" rather than "relative" time. - * The value of <*tv> is updated upon return to show the actual - * (absolute) acquisition time. - */ - int acquire (ACE_Time_Value *tv); - - /** - * Conditionally acquire lock (i.e., don't wait on queue). Returns - * -1 on failure. If we "failed" because someone else already had - * the lock, is set to . - */ - int tryacquire (void); - - /// Release lock and unblock a thread at head of queue. - int release (void); - - /** - * Acquire mutex ownership. This calls and is only here - * to make the ACE_Thread_Mutex interface consistent with the - * other synchronization APIs. - */ - int acquire_read (void); - - /** - * Acquire mutex ownership. This calls and is only here - * to make the ACE_Thread_Mutex interface consistent with the - * other synchronization APIs. - */ - int acquire_write (void); - - /** - * Conditionally acquire mutex (i.e., won't block). This calls - * and is only here to make the ACE_Thread_Mutex - * interface consistent with the other synchronization APIs. - * Returns -1 on failure. If we "failed" because someone else - * already had the lock, is set to . - */ - int tryacquire_read (void); - - /** - * Conditionally acquire mutex (i.e., won't block). This calls - * and is only here to make the ACE_Thread_Mutex - * interface consistent with the other synchronization APIs. - * Returns -1 on failure. If we "failed" because someone else - * already had the lock, is set to . - */ - int tryacquire_write (void); - - /** - * This is only here to make the ACE_Thread_Mutex - * interface consistent with the other synchronization APIs. - * Assumes the caller has already acquired the mutex using one of - * the above calls, and returns 0 (success) always. - */ - int tryacquire_write_upgrade (void); - - /// Return the underlying mutex. - const ACE_thread_mutex_t &lock (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // protected: - /// Mutex type that supports single-process locking efficiently. - ACE_thread_mutex_t lock_; - - /// Keeps track of whether has been called yet to avoid - /// multiple calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure - /// that you don't have multiple threads simultaneously calling - /// on the same object, which is a bad idea anyway... - int removed_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Thread_Mutex &); - ACE_Thread_Mutex (const ACE_Thread_Mutex &); -}; - -#if defined (ACE_USES_OBSOLETE_GUARD_CLASSES) -/** - * @class ACE_Thread_Mutex_Guard - * - * @brief This data structure is meant to be used within a method or - * function... It performs automatic aquisition and release of - * an ACE_Thread_Mutex. - * - * This class is obsolete and should be replaced by - * ACE_Guard. - */ -class ACE_Export ACE_Thread_Mutex_Guard -{ -public: - /// Implicitly and automatically acquire the lock. - ACE_Thread_Mutex_Guard (ACE_Thread_Mutex &m, int block = 1); - - /// Implicitly release the lock. - ~ACE_Thread_Mutex_Guard (void); - - /// 1 if locked, 0 if couldn't acquire the lock (errno will contain - /// the reason for this). - int locked (void); - - /** - * Explicitly release the lock. Note that only one thread should - * call this method since it doesn't protect against race - * conditions. - */ - int remove (void); - - /// Explicitly acquire the lock. - int acquire (void); - - /** - * Conditionally acquire the lock (i.e., won't block). Returns -1 - * on failure. If we "failed" because someone else already had the - * lock, is set to . - */ - int tryacquire (void); - - /// Explicitly release the lock. - int release (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Reference to the mutex. - ACE_Thread_Mutex &lock_; - - /// Keeps track of whether we acquired the lock or failed. - int owner_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Thread_Mutex_Guard &); - ACE_Thread_Mutex_Guard (const ACE_Thread_Mutex_Guard &); -}; -#endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_THREAD_MUTEX_H */ diff --git a/ace/Thread_Mutex.inl b/ace/Thread_Mutex.inl deleted file mode 100644 index 7658522b38f..00000000000 --- a/ace/Thread_Mutex.inl +++ /dev/null @@ -1,172 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE const ACE_thread_mutex_t & -ACE_Thread_Mutex::lock (void) const -{ -// ACE_TRACE ("ACE_Thread_Mutex::lock"); - return this->lock_; -} - -ACE_INLINE int -ACE_Thread_Mutex::acquire_read (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::acquire_read"); - return ACE_OS::thread_mutex_lock (&this->lock_); -} - -ACE_INLINE int -ACE_Thread_Mutex::acquire_write (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::acquire_write"); - return ACE_OS::thread_mutex_lock (&this->lock_); -} - -ACE_INLINE int -ACE_Thread_Mutex::tryacquire_read (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::tryacquire_read"); - return ACE_OS::thread_mutex_trylock (&this->lock_); -} - -ACE_INLINE int -ACE_Thread_Mutex::tryacquire_write (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::tryacquire_write"); - return ACE_OS::thread_mutex_trylock (&this->lock_); -} - -ACE_INLINE int -ACE_Thread_Mutex::tryacquire_write_upgrade (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::tryacquire_write_upgrade"); - return 0; -} - -ACE_INLINE int -ACE_Thread_Mutex::acquire (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::acquire"); - return ACE_OS::thread_mutex_lock (&this->lock_); -} - -ACE_INLINE int -ACE_Thread_Mutex::acquire (ACE_Time_Value &tv) -{ - // ACE_TRACE ("ACE_Thread_Mutex::acquire"); - return ACE_OS::thread_mutex_lock (&this->lock_, tv); -} - -ACE_INLINE int -ACE_Thread_Mutex::acquire (ACE_Time_Value *tv) -{ - // ACE_TRACE ("ACE_Thread_Mutex::acquire"); - return ACE_OS::thread_mutex_lock (&this->lock_, tv); -} - -ACE_INLINE int -ACE_Thread_Mutex::tryacquire (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::tryacquire"); - return ACE_OS::thread_mutex_trylock (&this->lock_); -} - -ACE_INLINE int -ACE_Thread_Mutex::release (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::release"); - return ACE_OS::thread_mutex_unlock (&this->lock_); -} - -ACE_INLINE int -ACE_Thread_Mutex::remove (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex::remove"); - int result = 0; - if (this->removed_ == 0) - { - this->removed_ = 1; - result = ACE_OS::thread_mutex_destroy (&this->lock_); - } - return result; -} - -#if defined (ACE_USES_OBSOLETE_GUARD_CLASSES) -ACE_INLINE int -ACE_Thread_Mutex_Guard::locked (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex_Guard::locked"); - return this->owner_ != -1; -} - -// Explicitly acquire the lock. - -ACE_INLINE int -ACE_Thread_Mutex_Guard::acquire (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex_Guard::acquire"); - return this->owner_ = this->lock_.acquire (); -} - -// Conditionally acquire the lock (i.e., won't block). - -ACE_INLINE int -ACE_Thread_Mutex_Guard::tryacquire (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex_Guard::tryacquire"); - return this->owner_ = this->lock_.tryacquire (); -} - -// Implicitly and automatically acquire the lock. - -ACE_INLINE -ACE_Thread_Mutex_Guard::ACE_Thread_Mutex_Guard (ACE_Thread_Mutex &m, - int block) - : lock_ (m) -{ -// ACE_TRACE ("ACE_Thread_Mutex_Guard::ACE_Thread_Mutex_Guard"); - if (block) - this->acquire (); - else - this->tryacquire (); -} - -// Explicitly release the lock. - -ACE_INLINE int -ACE_Thread_Mutex_Guard::release (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex_Guard::release"); - if (this->owner_ != -1) - { - this->owner_ = -1; - return this->lock_.release (); - } - else - return 0; -} - -// Implicitly release the lock. - -ACE_INLINE -ACE_Thread_Mutex_Guard::~ACE_Thread_Mutex_Guard (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex_Guard::~ACE_Thread_Mutex_Guard"); - this->release (); -} - -// Explicitly release the lock. - -ACE_INLINE int -ACE_Thread_Mutex_Guard::remove (void) -{ -// ACE_TRACE ("ACE_Thread_Mutex_Guard::remove"); - this->owner_ = -1; - return this->release (); -} -#endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Semaphore.cpp b/ace/Thread_Semaphore.cpp deleted file mode 100644 index 741c7c5ec99..00000000000 --- a/ace/Thread_Semaphore.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @file Thread_Semaphore.cpp - * - * $Id$ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/Thread_Semaphore.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/Thread_Semaphore.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/ACE.h" - -ACE_RCSID(ace, Thread_Semaphore, "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Thread_Semaphore::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Thread_Semaphore::dump"); - - ACE_Semaphore::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Thread_Semaphore::ACE_Thread_Semaphore (unsigned int count, - const ACE_TCHAR *name, - void *arg, - int max) - : ACE_Semaphore (count, USYNC_THREAD, name, arg, max) -{ -// ACE_TRACE ("ACE_Thread_Semaphore::ACE_Thread_Semaphore"); -} - -/*****************************************************************************/ - -ACE_Thread_Semaphore * -ACE_Malloc_Lock_Adapter_T::operator () (const ACE_TCHAR *name) -{ - ACE_Thread_Semaphore *p = 0; - if (name == 0) - ACE_NEW_RETURN (p, ACE_Thread_Semaphore (1, name), 0); - else - ACE_NEW_RETURN (p, ACE_Thread_Semaphore (1, ACE::basename (name, - ACE_DIRECTORY_SEPARATOR_CHAR)), - 0); - return p; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/Thread_Semaphore.h b/ace/Thread_Semaphore.h deleted file mode 100644 index 096dce3e93c..00000000000 --- a/ace/Thread_Semaphore.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Thread_Semaphore.h - * - * $Id$ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_THREAD_SEMAPHORE_H -#define ACE_THREAD_SEMAPHORE_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_HAS_THREADS) -# include "ace/Null_Semaphore.h" -#else /* ACE_HAS_THREADS */ -// ACE platform supports some form of threading. - -#include "ace/Semaphore.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Thread_Semaphore - * - * @brief Wrapper for Dijkstra style general semaphores that work - * only within one process. - */ -class ACE_Export ACE_Thread_Semaphore : public ACE_Semaphore -{ -public: - /// Initialize the semaphore, with an initial value of @a count, - /// maximum value of @a max, and unlocked by default. - ACE_Thread_Semaphore (unsigned int count = 1, // By default make this unlocked. - const ACE_TCHAR *name = 0, - void * = 0, - int max = 0x7FFFFFFF); - - /// Default dtor. - ~ACE_Thread_Semaphore (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/*****************************************************************************/ - -template class ACE_Malloc_Lock_Adapter_T; - -/** - * @class ACE_Malloc_Lock_Adapter_T - * - * @brief Template specialization of ACE_Malloc_Lock_Adapter_T for - * ACE_Thread_Semaphore. - * - * This is needed since the ctor for ACE_Thread_Semaphore doesn't match - * the standard form used by other lock strategy classes. - */ -template<> -class ACE_Export ACE_Malloc_Lock_Adapter_T -{ -public: - ACE_Thread_Semaphore * operator () (const ACE_TCHAR *name); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Thread_Semaphore.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_THREAD_SEMAPHORE_H */ diff --git a/ace/Thread_Semaphore.inl b/ace/Thread_Semaphore.inl deleted file mode 100644 index e9535ff088e..00000000000 --- a/ace/Thread_Semaphore.inl +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Thread_Semaphore::~ACE_Thread_Semaphore (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Time_Request_Reply.cpp b/ace/Time_Request_Reply.cpp deleted file mode 100644 index e7524ce6ce7..00000000000 --- a/ace/Time_Request_Reply.cpp +++ /dev/null @@ -1,196 +0,0 @@ -// $Id$ - -#include "ace/Time_Request_Reply.h" -#include "ace/Log_Msg.h" -#include "ace/os_include/netinet/os_in.h" -#include "ace/os_include/arpa/os_inet.h" - -ACE_RCSID(ace, Time_Request_Reply, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Default "do nothing" constructor. - -ACE_Time_Request::ACE_Time_Request (void) -{ - ACE_TRACE ("ACE_Time_Request::ACE_Time_Request"); -} - -// Create a ACE_Time_Request message. - -ACE_Time_Request::ACE_Time_Request (ACE_INT32 t, // Type of request. - const ACE_UINT32 time, - ACE_Time_Value *timeout) // Max time waiting for request. -{ - ACE_TRACE ("ACE_Time_Request::ACE_Time_Request"); - this->msg_type (t); - - // If timeout is a NULL pointer, then block forever... - if (timeout == 0) - { - this->transfer_.block_forever_ = 1; - this->transfer_.sec_timeout_ = 0; - this->transfer_.usec_timeout_ = 0; - } - else // Do a "timed wait." - { - this->block_forever (0); - // Keep track of how long client is willing to wait. - this->transfer_.sec_timeout_ = timeout->sec (); - this->transfer_.usec_timeout_ = timeout->usec (); - } - - // Copy time into request - this->time_ = this->transfer_.time_ = time; -} - -// Initialize length_ in order to avoid problems with byte-ordering -void -ACE_Time_Request::init (void) -{ - ACE_TRACE ("ACE_Time_Request::init"); -// this->length (sizeof this->transfer_); -} - -// Get the fixed size of message -ssize_t -ACE_Time_Request::size (void) const -{ - ACE_TRACE ("ACE_Time_Request::size"); - return sizeof (this->transfer_); -} - -// = Set/get the type of the message. -ACE_INT32 -ACE_Time_Request::msg_type (void) const -{ - ACE_TRACE ("ACE_Time_Request::msg_type"); - return this->transfer_.msg_type_; -} - -void -ACE_Time_Request::msg_type (ACE_INT32 t) -{ - ACE_TRACE ("ACE_Time_Request::msg_type"); - this->transfer_.msg_type_ = t; -} - -// = Set/get the blocking semantics. -ACE_UINT32 -ACE_Time_Request::block_forever (void) const -{ - ACE_TRACE ("ACE_Time_Request::block_forever"); - return this->transfer_.block_forever_; -} - -void -ACE_Time_Request::block_forever (ACE_UINT32 bs) -{ - ACE_TRACE ("ACE_Time_Request::block_forever"); - this->transfer_.block_forever_ = bs; -} - -// = Set/get the timeout. -ACE_Time_Value -ACE_Time_Request::timeout (void) const -{ - ACE_TRACE ("ACE_Time_Request::timeout"); - return ACE_Time_Value (this->transfer_.sec_timeout_, this->transfer_.usec_timeout_); -} - -void -ACE_Time_Request::timeout (const ACE_Time_Value& timeout) -{ - ACE_TRACE ("ACE_Time_Request::timeout"); - this->transfer_.sec_timeout_ = timeout.sec (); - this->transfer_.usec_timeout_ = timeout.usec (); -} - -// = Set/get the time -ACE_UINT32 -ACE_Time_Request::time (void) const -{ - ACE_TRACE ("ACE_Time_Request::time"); - return this->time_; -} - -void -ACE_Time_Request::time (ACE_UINT32 t) -{ - ACE_TRACE ("ACE_Time_Request::time"); - this->time_ = t; -} - -// Encode the transfer buffer into network byte order -// so that it can be sent to the server. -int -ACE_Time_Request::encode (void *&buf) -{ - ACE_TRACE ("ACE_Time_Request::encode"); - // Compute the length *before* doing the marshaling. - - buf = (void *) &this->transfer_; - this->transfer_.block_forever_ = htonl (this->transfer_.block_forever_); - this->transfer_.usec_timeout_ = htonl (this->transfer_.usec_timeout_); - this->transfer_.sec_timeout_ = htonl (this->transfer_.sec_timeout_); - this->transfer_.msg_type_ = htonl (this->transfer_.msg_type_); - this->transfer_.time_ = htonl (this->transfer_.time_); - - return this->size (); // Always fixed -} - -// Decode the transfer buffer into host byte byte order -// so that it can be used by the server. -int -ACE_Time_Request::decode (void) -{ - ACE_TRACE ("ACE_Time_Request::decode"); - // Decode - this->transfer_.block_forever_ = ntohl (this->transfer_.block_forever_); - this->transfer_.usec_timeout_ = ntohl (this->transfer_.usec_timeout_); - this->transfer_.sec_timeout_ = ntohl (this->transfer_.sec_timeout_); - this->transfer_.msg_type_ = ntohl (this->transfer_.msg_type_); - this->transfer_.time_ = ntohl (this->transfer_.time_); - - this->time_ = this->transfer_.time_; - return 0; -} - -// Print out the current values of the ACE_Time_Request. - -void -ACE_Time_Request::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Time_Request::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\nlength = %d\n"), - this->size ())); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("message-type = "))); - - switch (this->msg_type ()) - { - case ACE_Time_Request::TIME_UPDATE: - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("TIME_UPDATE\n"))); - break; - default: - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" = %d\n"), this->msg_type ())); - break; - } - - if (this->block_forever ()) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("blocking forever\n"))); - else - { -#if !defined (ACE_NLOGGING) - ACE_Time_Value tv = this->timeout (); -#endif /* ! ACE_NLOGGING */ - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("waiting for %d secs and %d usecs\n"), - tv.sec (), tv.usec ())); - } - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\ntime = %d\n"), - this->time ())); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("+++++++\n"))); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Time_Request_Reply.h b/ace/Time_Request_Reply.h deleted file mode 100644 index 8c062cbd9a5..00000000000 --- a/ace/Time_Request_Reply.h +++ /dev/null @@ -1,139 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Time_Request_Reply.h - * - * $Id$ - * - * Define the format used to exchange messages between the - * ACE time server and clerks. - * - * @author Prashant Jain - */ -//============================================================================= - - -#ifndef ACE_TIME_REQUEST_REPLY_H -#define ACE_TIME_REQUEST_REPLY_H -#include /**/ "ace/pre.h" - -#include "ace/Time_Value.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Time_Request - * - * @brief Message format for delivering requests to the ACE_Time Server. - * - * This class is implemented to minimize data copying. - * In particular, all marshaling is done in situ... - */ -class ACE_Export ACE_Time_Request -{ -public: - enum Constants - { - /// Request message types. - TIME_UPDATE = 01, - - /// Class-specific constant values. - MAX_TIME_LEN = MAXPATHLEN + 1 - }; - - /// Default constructor. - ACE_Time_Request (void); - - /** - * Create a ACE_Time_Request message. - * @param msg_type Type of request. - * @param time Time. - * @param timeout Max time waiting for request. - */ - ACE_Time_Request (ACE_INT32 msg_type, - const ACE_UINT32 time, - ACE_Time_Value *timeout = 0); - - /** - * Initialize length_ in order to ensure correct byte ordering before a - * request is sent. - * @deprecated This method is a no-op. - */ - void init (void); - - // Get the fixed size of message - ssize_t size (void) const; - - /// Get the type of the message. - ACE_INT32 msg_type (void) const; - - /// Set the type of the message. - void msg_type (ACE_INT32); - - /// Get the time - ACE_UINT32 time (void) const; - - // Set the time - void time (ACE_UINT32 t); - - /// Get the blocking semantics. - ACE_UINT32 block_forever (void) const; - - /// Set the blocking semantics. - void block_forever (ACE_UINT32); - - /// Get the timeout. - ACE_Time_Value timeout (void) const; - - /// Set the timeout. - void timeout (const ACE_Time_Value& timeout); - - /// Encode the message before transmission. - int encode (void *&); - - /// Decode message after reception. - int decode (void); - - /// Print out the values of the message for debugging purposes. - void dump (void) const; - -private: - // = The 5 fields in the struct are transmitted to the server. - // The remaining 2 fields are not tranferred -- they are used only on - // the server-side to simplify lookups. - - struct Transfer - { - /// Type of the request (i.e., ) - ACE_INT32 msg_type_; - - /// Indicates if we should block forever. If 0, then sec_timeout_ - /// and usec_timeout_ indicates how long we should wait. - ACE_UINT32 block_forever_; - - /// Max seconds willing to wait for name if not blocking forever. - ACE_UINT32 sec_timeout_; - - /// Max micro seconds to wait for name if not blocking forever. - ACE_UINT32 usec_timeout_; - - /// The data portion contains - ACE_UINT32 time_; - }; - - /// Transfer buffer. - Transfer transfer_; - - /// Time - ACE_UINT32 time_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_TIME_REQUEST_REPLY_H */ diff --git a/ace/Time_Value.cpp b/ace/Time_Value.cpp deleted file mode 100644 index 25841b6cfa9..00000000000 --- a/ace/Time_Value.cpp +++ /dev/null @@ -1,260 +0,0 @@ -#include "ace/Time_Value.h" - -ACE_RCSID (ace, - Time_Value, - "$Id$") - - -#if !defined (__ACE_INLINE__) -#include "ace/Time_Value.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Numeric_Limits.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Static constant representing `zero-time'. -// Note: this object requires static construction. -const ACE_Time_Value ACE_Time_Value::zero; - -// Constant for maximum time representable. Note that this time -// is not intended for use with select () or other calls that may -// have *their own* implementation-specific maximum time representations. -// Its primary use is in time computations such as those used by the -// dynamic subpriority strategies in the ACE_Dynamic_Message_Queue class. -// Note: this object requires static construction. -// Note: On Win64, time_t is 64 bits, yet the timeval members used -// internally to ACE_Time_Value are still long. This makes time values -// outside the LONG_MAX, LONG_MIN range very broken. -const ACE_Time_Value ACE_Time_Value::max_time ( -#if !defined (ACE_WIN64) - ACE_Numeric_Limits::max (), -#else - LONG_MAX, -#endif - ACE_ONE_SECOND_IN_USECS - 1); - -ACE_ALLOC_HOOK_DEFINE (ACE_Time_Value) - -// Increment microseconds (the only reason this is here is to allow -// the use of ACE_Atomic_Op with ACE_Time_Value). - -ACE_Time_Value -ACE_Time_Value::operator ++ (int) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (int)"); - ACE_Time_Value tv (*this); - ++*this; - return tv; -} - -ACE_Time_Value & -ACE_Time_Value::operator ++ (void) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (void)"); - this->usec (this->usec () + 1); - this->normalize (); - return *this; -} - -// Decrement microseconds (the only reason this is here is / to allow -// the use of ACE_Atomic_Op with ACE_Time_Value). - -ACE_Time_Value -ACE_Time_Value::operator -- (int) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator -- (int)"); - ACE_Time_Value tv (*this); - --*this; - return tv; -} - -ACE_Time_Value & -ACE_Time_Value::operator -- (void) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator -- (void)"); - this->usec (this->usec () - 1); - this->normalize (); - return *this; -} - -#if defined (ACE_WIN32) -// Static constant to remove time skew between FILETIME and POSIX -// time. POSIX and Win32 use different epochs (Jan. 1, 1970 v.s. -// Jan. 1, 1601). The following constant defines the difference -// in 100ns ticks. -// -// In the beginning (Jan. 1, 1601), there was no time and no computer. -// And Bill said: "Let there be time," and there was time.... -# if defined (ACE_LACKS_LONGLONG_T) -const ACE_U_LongLong ACE_Time_Value::FILETIME_to_timval_skew = -ACE_U_LongLong (0xd53e8000, 0x19db1de); -# else -const DWORDLONG ACE_Time_Value::FILETIME_to_timval_skew = -ACE_INT64_LITERAL (0x19db1ded53e8000); -# endif - -// Initializes the ACE_Time_Value object from a Win32 FILETIME - -ACE_Time_Value::ACE_Time_Value (const FILETIME &file_time) -{ - // // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (file_time); -} - -void ACE_Time_Value::set (const FILETIME &file_time) -{ - // Initializes the ACE_Time_Value object from a Win32 FILETIME -#if defined (ACE_LACKS_LONGLONG_T) - ACE_U_LongLong LL_100ns(file_time.dwLowDateTime, file_time.dwHighDateTime); - LL_100ns -= ACE_Time_Value::FILETIME_to_timval_skew; - // Convert 100ns units to seconds; - this->tv_.tv_sec = (long) (LL_100ns / ((double) (10000 * 1000))); - // Convert remainder to microseconds; - this->tv_.tv_usec = (suseconds_t)((LL_100ns % ((ACE_UINT32)(10000 * 1000))) / 10); -#else - // Don't use a struct initializer, gcc don't like it. - ULARGE_INTEGER _100ns; - _100ns.LowPart = file_time.dwLowDateTime; - _100ns.HighPart = file_time.dwHighDateTime; - - _100ns.QuadPart -= ACE_Time_Value::FILETIME_to_timval_skew; - - // Convert 100ns units to seconds; - this->tv_.tv_sec = (long) (_100ns.QuadPart / (10000 * 1000)); - // Convert remainder to microseconds; - this->tv_.tv_usec = (suseconds_t) ((_100ns.QuadPart % (10000 * 1000)) / 10); -#endif // ACE_LACKS_LONGLONG_T - this->normalize (); -} - -// Returns the value of the object as a Win32 FILETIME. - -ACE_Time_Value::operator FILETIME () const -{ - FILETIME file_time; - // ACE_OS_TRACE ("ACE_Time_Value::operator FILETIME"); - -#if defined (ACE_LACKS_LONGLONG_T) - ACE_U_LongLong LL_sec(this->tv_.tv_sec); - ACE_U_LongLong LL_usec(this->tv_.tv_usec); - ACE_U_LongLong LL_100ns = LL_sec * (ACE_UINT32)(10000 * 1000) + - LL_usec * (ACE_UINT32)10 + - ACE_Time_Value::FILETIME_to_timval_skew; - file_time.dwLowDateTime = LL_100ns.lo(); - file_time.dwHighDateTime = LL_100ns.hi(); -#else - ULARGE_INTEGER _100ns; - _100ns.QuadPart = (((DWORDLONG) this->tv_.tv_sec * (10000 * 1000) + - this->tv_.tv_usec * 10) + - ACE_Time_Value::FILETIME_to_timval_skew); - - file_time.dwLowDateTime = _100ns.LowPart; - file_time.dwHighDateTime = _100ns.HighPart; -#endif //ACE_LACKS_LONGLONG_T - - return file_time; -} - -#endif /* ACE_WIN32 */ - -void -ACE_Time_Value::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_OS_TRACE ("ACE_Time_Value::dump"); -#if 0 - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntv_sec_ = %d"), this->tv_.tv_sec)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntv_usec_ = %d\n"), this->tv_.tv_usec)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* 0 */ -#endif /* ACE_HAS_DUMP */ -} - -void -ACE_Time_Value::normalize (void) -{ - // // ACE_OS_TRACE ("ACE_Time_Value::normalize"); - // From Hans Rohnert... - - if (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS) - { - /*! \todo This loop needs some optimization. - */ - do - { - ++this->tv_.tv_sec; - this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; - } - while (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS); - } - else if (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS) - { - /*! \todo This loop needs some optimization. - */ - do - { - --this->tv_.tv_sec; - this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; - } - while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS); - } - - if (this->tv_.tv_sec >= 1 && this->tv_.tv_usec < 0) - { - --this->tv_.tv_sec; - this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; - } -// tv_sec in qnxnto is unsigned -#if !defined ( __QNXNTO__) - else if (this->tv_.tv_sec < 0 && this->tv_.tv_usec > 0) - { - ++this->tv_.tv_sec; - this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; - } -#endif /* __QNXNTO__ */ -} - - -ACE_Time_Value & -ACE_Time_Value::operator *= (double d) -{ - // double is long enough (16 digits) to not lose the accuracy. - double time_total = - (this->sec () - + static_cast (this->usec ()) / ACE_ONE_SECOND_IN_USECS) * d; - - // shall we saturate the result? -#if !defined(ACE_LACKS_NUMERIC_LIMITS) && !defined (ACE_WIN64) - static const double max_int = std::numeric_limits::max () + 0.999999; - static const double min_int = std::numeric_limits::min () - 0.999999; -#else - static const double max_int = LONG_MAX + 0.999999; - static const double min_int = LONG_MIN - 0.999999; -#endif - - if (time_total > max_int) - time_total = max_int; - if (time_total < min_int) - time_total = min_int; - - const time_t time_sec = static_cast (time_total); - - time_total -= time_sec; - time_total *= ACE_ONE_SECOND_IN_USECS; - - suseconds_t time_usec = static_cast (time_total); - - // round up the result to save the last usec - if (time_usec > 0 && (time_total - time_usec) >= 0.5) - ++time_usec; - else if (time_usec < 0 && (time_total - time_usec) <= -0.5) - --time_usec; - - this->set (time_sec, time_usec); - - return *this; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Time_Value.h b/ace/Time_Value.h deleted file mode 100644 index 5216a56c676..00000000000 --- a/ace/Time_Value.h +++ /dev/null @@ -1,350 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Time_Value.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_TIME_VALUE_H -#define ACE_TIME_VALUE_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -# include "ace/os_include/os_time.h" - -// Define some helpful constants. -// Not type-safe, and signed. For backward compatibility. -#define ACE_ONE_SECOND_IN_MSECS 1000L -#define ACE_ONE_SECOND_IN_USECS 1000000L -#define ACE_ONE_SECOND_IN_NSECS 1000000000L - -// needed for ACE_UINT64 -#include "ace/Basic_Types.h" - -// This forward declaration is needed by the set() and FILETIME() functions -#if defined (ACE_LACKS_LONGLONG_T) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_Export ACE_U_LongLong; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_LACKS_LONGLONG_T */ - -// ------------------------------------------------------------------- - -/** - * @class ACE_Time_Value - * - * @brief Operations on "timeval" structures, which express time in - * seconds (secs) and microseconds (usecs). - * - * This class centralizes all the time related processing in - * ACE. These time values are typically used in conjunction with OS - * mechanisms like or other calls that may have - * *their own* implementation-specific maximum time representations. - * Its primary use is in time computations such as those used by the - * dynamic subpriority strategies in the ACE_Dynamic_Message_Queue - * class. - */ - static const ACE_Time_Value max_time; - - // = Initialization methods. - - /// Default Constructor. - ACE_Time_Value (void); - - /// Constructor. - explicit ACE_Time_Value (time_t sec, suseconds_t usec = 0); - - // = Methods for converting to/from various time formats. - - /// Construct the ACE_Time_Value from a timeval. - explicit ACE_Time_Value (const struct timeval &t); - - /// Construct the ACE_Time_Value object from a timespec_t. - explicit ACE_Time_Value (const timespec_t &t); - -# if defined (ACE_WIN32) - /// Construct the ACE_Time_Value object from a Win32 FILETIME - explicit ACE_Time_Value (const FILETIME &ft); -# endif /* ACE_WIN32 */ - - /// Initializes the ACE_Time_Value from seconds and useconds. - void set (time_t sec, suseconds_t usec); - - /// Initializes the ACE_Time_Value from a double, which is assumed to be - /// in second format, with any remainder treated as microseconds. - void set (double d); - - /// Initializes the ACE_Time_Value from a timeval. - void set (const timeval &t); - - /// Initializes the ACE_Time_Value object from a timespec_t. - void set (const timespec_t &t); - -# if defined (ACE_WIN32) - /// Initializes the ACE_Time_Value object from a Win32 FILETIME. - void set (const FILETIME &ft); -# endif /* ACE_WIN32 */ - - /// Converts from ACE_Time_Value format into milli-seconds format. - /** - * @return Sum of second field (in milliseconds) and microsecond field - * (in milliseconds). Note that this method can overflow if - * the second and microsecond field values are large, so use - * the msec (ACE_UINT64 &ms) method instead. - * - * @note The semantics of this method differs from the sec() and - * usec() methods. There is no analogous "millisecond" - * component in an ACE_Time_Value. - */ - unsigned long msec (void) const; - -#if !defined (ACE_LACKS_LONGLONG_T) - /** - * @return Sum of second field (in milliseconds) and microsecond field - * (in milliseconds) and return them via the @param ms parameter. - * - * @note The semantics of this method differs from the sec() and - * usec() methods. There is no analogous "millisecond" - * component in an ACE_Time_Value. - */ - void msec (ACE_UINT64 &ms) const; - -#endif /*ACE_LACKS_LONGLONG_T */ - - /// Converts from milli-seconds format into ACE_Time_Value format. - /** - * @note The semantics of this method differs from the sec() and - * usec() methods. There is no analogous "millisecond" - * component in an ACE_Time_Value. - */ - void msec (long); - - /// Returns the value of the object as a timespec_t. - operator timespec_t () const; - - /// Returns the value of the object as a timeval. - operator timeval () const; - - /// Returns a pointer to the object as a timeval. - operator const timeval *() const; - -# if defined (ACE_WIN32) - /// Returns the value of the object as a Win32 FILETIME. - operator FILETIME () const; -# endif /* ACE_WIN32 */ - - // = The following are accessor/mutator methods. - - /// Get seconds. - /** - * @return The second field/component of this ACE_Time_Value. - * - * @note The semantics of this method differs from the msec() - * method. - */ - time_t sec (void) const; - - /// Set seconds. - void sec (time_t sec); - - /// Get microseconds. - /** - * @return The microsecond field/component of this ACE_Time_Value. - * - * @note The semantics of this method differs from the msec() - * method. - */ - suseconds_t usec (void) const; - - /// Set microseconds. - void usec (suseconds_t usec); - -#if !defined (ACE_LACKS_LONGLONG_T) - /** - * @return Sum of second field (in microseconds) and microsecond field - * and return them via the @param usec parameter. - */ - void to_usec (ACE_UINT64 &usec) const; - -#endif /*ACE_LACKS_LONGLONG_T */ - - // = The following arithmetic methods operate on ACE_Time_Value's. - - /// Add @a tv to this. - ACE_Time_Value &operator += (const ACE_Time_Value &tv); - - /// Add @a tv to this. - ACE_Time_Value &operator += (time_t tv); - - /// Assign @ tv to this - ACE_Time_Value &operator = (const ACE_Time_Value &tv); - - /// Assign @ tv to this - ACE_Time_Value &operator = (time_t tv); - - /// Subtract @a tv to this. - ACE_Time_Value &operator -= (const ACE_Time_Value &tv); - - /// Substract @a tv to this. - ACE_Time_Value &operator -= (time_t tv); - - /** - \brief Multiply the time value by the @a d factor. - \note The result of the operator is valid for results from range - < (ACE_INT32_MIN, -999999), (ACE_INT32_MAX, 999999) >. Result - outside this range are saturated to a limit. - */ - ACE_Time_Value &operator *= (double d); - - /// Increment microseconds as postfix. - /** - * @note The only reason this is here is to allow the use of ACE_Atomic_Op - * with ACE_Time_Value. - */ - ACE_Time_Value operator++ (int); - - /// Increment microseconds as prefix. - /** - * @note The only reason this is here is to allow the use of ACE_Atomic_Op - * with ACE_Time_Value. - */ - ACE_Time_Value &operator++ (void); - - /// Decrement microseconds as postfix. - /** - * @note The only reason this is here is to allow the use of ACE_Atomic_Op - * with ACE_Time_Value. - */ - ACE_Time_Value operator-- (int); - - /// Decrement microseconds as prefix. - /** - * @note The only reason this is here is to allow the use of ACE_Atomic_Op - * with ACE_Time_Value. - */ - ACE_Time_Value &operator-- (void); - - /// Adds two ACE_Time_Value objects together, returns the sum. - friend ACE_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// Subtracts two ACE_Time_Value objects, returns the difference. - friend ACE_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if @a tv1 < @a tv2. - friend ACE_Export bool operator < (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if @a tv1 > @a tv2. - friend ACE_Export bool operator > (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if @a tv1 <= @a tv2. - friend ACE_Export bool operator <= (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if @a tv1 >= @a tv2. - friend ACE_Export bool operator >= (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if @a tv1 == @a tv2. - friend ACE_Export bool operator == (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if @a tv1 != @a tv2. - friend ACE_Export bool operator != (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - //@{ - /// Multiplies the time value by @a d - friend ACE_Export ACE_Time_Value operator * (double d, - const ACE_Time_Value &tv); - - friend ACE_Export ACE_Time_Value operator * (const ACE_Time_Value &tv, - double d); - //@} - - /// Dump is a no-op. - /** - * The dump() method is a no-op. It's here for backwards compatibility - * only, but does not dump anything. Invoking logging methods here - * violates layering restrictions in ACE because this class is part - * of the OS layer and @c ACE_Log_Msg is at a higher level. - */ - void dump (void) const; - -# if defined (ACE_WIN32) - /// Const time difference between FILETIME and POSIX time. -# if defined (ACE_LACKS_LONGLONG_T) - static const ACE_U_LongLong FILETIME_to_timval_skew; -# else - static const DWORDLONG FILETIME_to_timval_skew; -# endif // ACE_LACKS_LONGLONG_T -# endif /* ACE_WIN32 */ - -private: - /// Put the timevalue into a canonical form. - void normalize (void); - - /// Store the values as a timeval. - timeval tv_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Time_Value.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_WIN32) && defined (_WIN32_WCE) -} -#endif - -#if defined (__MINGW32__) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// The MingW linker has problems with the exported statics -// zero and max_time with these two statics the linker will be able to -// resolve the static exported symbols. -static const ACE_Time_Value& __zero_time = ACE_Time_Value::zero; -static const ACE_Time_Value& __max_time = ACE_Time_Value::max_time; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* __MINGW32__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_TIME_VALUE_H */ diff --git a/ace/Time_Value.inl b/ace/Time_Value.inl deleted file mode 100644 index 75c34a2e2cc..00000000000 --- a/ace/Time_Value.inl +++ /dev/null @@ -1,403 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_WIN32) && defined (_WIN32_WCE) -// Something is a bit brain-damaged here and I'm not sure what... this code -// compiled before the OS reorg for ACE 5.4. Since then it hasn't - eVC -// complains that the operators that return ACE_Time_Value are C-linkage -// functions that can't return a C++ class. The only way I've found to -// defeat this is to wrap the whole class in extern "C++". -// - Steve Huston, 23-Aug-2004 -extern "C++" { -#endif - -// Returns the value of the object as a timeval. - -ACE_INLINE -ACE_Time_Value::operator timeval () const -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator timeval"); - return this->tv_; -} - -ACE_INLINE void -ACE_Time_Value::set (const timeval &tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::set"); - this->tv_.tv_sec = tv.tv_sec; - this->tv_.tv_usec = tv.tv_usec; - - this->normalize (); -} - -ACE_INLINE -ACE_Time_Value::ACE_Time_Value (const struct timeval &tv) - // : tv_ () -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (tv); -} - -ACE_INLINE -ACE_Time_Value::operator const timeval * () const -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator const timeval *"); - return (const timeval *) &this->tv_; -} - -ACE_INLINE void -ACE_Time_Value::set (time_t sec, suseconds_t usec) -{ - // ACE_OS_TRACE ("ACE_Time_Value::set"); -#if defined (ACE_WIN64) \ - || (defined (ACE_WIN32) && !defined (_USE_32BIT_TIME_T)) - // Win64 uses 'long' (32 bit) timeval and 64-bit time_t, so we have - // to get these back in range. - if (sec > LONG_MAX) - this->tv_.tv_sec = LONG_MAX; - else if (sec < LONG_MIN) - this->tv_.tv_sec = LONG_MIN; - else - this->tv_.tv_sec = static_cast (sec); -#else - this->tv_.tv_sec = sec; -#endif - this->tv_.tv_usec = usec; -#if __GNUC__ - if (__builtin_constant_p(sec) && - __builtin_constant_p(usec) && - (sec >= 0 && usec >= 0 && usec < ACE_ONE_SECOND_IN_USECS)) - return; -#endif - this->normalize (); -} - -ACE_INLINE void -ACE_Time_Value::set (double d) -{ - // ACE_OS_TRACE ("ACE_Time_Value::set"); - long l = (long) d; - this->tv_.tv_sec = l; - this->tv_.tv_usec = (suseconds_t) ((d - (double) l) * ACE_ONE_SECOND_IN_USECS + .5); - this->normalize (); -} - -// Initializes a timespec_t. Note that this approach loses precision -// since it converts the nano-seconds into micro-seconds. But then -// again, do any real systems have nano-second timer precision?! - -ACE_INLINE void -ACE_Time_Value::set (const timespec_t &tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::set"); - - this->set (tv.tv_sec, - tv.tv_nsec / 1000); // Convert nanoseconds into microseconds. -} - -ACE_INLINE -ACE_Time_Value::ACE_Time_Value (void) - // : tv_ () -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (0, 0); -} - -ACE_INLINE -ACE_Time_Value::ACE_Time_Value (time_t sec, suseconds_t usec) -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (sec, usec); -} - -// Returns number of seconds. - -ACE_INLINE time_t -ACE_Time_Value::sec (void) const -{ - // ACE_OS_TRACE ("ACE_Time_Value::sec"); - return this->tv_.tv_sec; -} - -// Sets the number of seconds. - -ACE_INLINE void -ACE_Time_Value::sec (time_t sec) -{ - // ACE_OS_TRACE ("ACE_Time_Value::sec"); -#if defined (ACE_WIN64) \ - || (defined (ACE_WIN32) && !defined (_USE_32BIT_TIME_T)) - // Win64 uses 'long' (32 bit) timeval and 64-bit time_t, so we have - // to get these back in range. - if (sec > LONG_MAX) - this->tv_.tv_sec = LONG_MAX; - else if (sec < LONG_MIN) - this->tv_.tv_sec = LONG_MIN; - else - this->tv_.tv_sec = static_cast (sec); -#else - this->tv_.tv_sec = sec; -#endif -} - -// Converts from Time_Value format into milli-seconds format. - -ACE_INLINE unsigned long -ACE_Time_Value::msec (void) const -{ - // ACE_OS_TRACE ("ACE_Time_Value::msec"); - return this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000; -} - -#if !defined (ACE_LACKS_LONGLONG_T) -ACE_INLINE void -ACE_Time_Value::msec (ACE_UINT64 &ms) const -{ - // ACE_OS_TRACE ("ACE_Time_Value::msec"); - ms = static_cast (this->tv_.tv_sec); - ms *= 1000; - ms += (this->tv_.tv_usec / 1000); -} -#endif /*ACE_LACKS_LONGLONG_T*/ - -// Converts from milli-seconds format into Time_Value format. - -ACE_INLINE void -ACE_Time_Value::msec (long milliseconds) -{ - // ACE_OS_TRACE ("ACE_Time_Value::msec"); - // Convert millisecond units to seconds; - this->tv_.tv_sec = milliseconds / 1000; - // Convert remainder to microseconds; - this->tv_.tv_usec = (milliseconds - (this->tv_.tv_sec * 1000)) * 1000; -} - -// Returns number of micro-seconds. - -ACE_INLINE suseconds_t -ACE_Time_Value::usec (void) const -{ - // ACE_OS_TRACE ("ACE_Time_Value::usec"); - return this->tv_.tv_usec; -} - -// Sets the number of micro-seconds. - -ACE_INLINE void -ACE_Time_Value::usec (suseconds_t usec) -{ - // ACE_OS_TRACE ("ACE_Time_Value::usec"); - this->tv_.tv_usec = usec; -} - -#if !defined (ACE_LACKS_LONGLONG_T) -ACE_INLINE void -ACE_Time_Value::to_usec (ACE_UINT64 &usec) const -{ - // ACE_OS_TRACE ("ACE_Time_Value::to_usec"); - usec = static_cast (this->tv_.tv_sec); - usec *= 1000000; - usec += this->tv_.tv_usec; -} -#endif /*ACE_LACKS_LONGLONG_T*/ - -ACE_INLINE ACE_Time_Value -operator * (double d, const ACE_Time_Value &tv) -{ - return ACE_Time_Value (tv) *= d; -} - -ACE_INLINE ACE_Time_Value -operator * (const ACE_Time_Value &tv, double d) -{ - return ACE_Time_Value (tv) *= d; -} - -// True if tv1 > tv2. - -ACE_INLINE bool -operator > (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator >"); - if (tv1.sec () > tv2.sec ()) - return 1; - else if (tv1.sec () == tv2.sec () - && tv1.usec () > tv2.usec ()) - return 1; - else - return 0; -} - -// True if tv1 >= tv2. - -ACE_INLINE bool -operator >= (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator >="); - if (tv1.sec () > tv2.sec ()) - return 1; - else if (tv1.sec () == tv2.sec () - && tv1.usec () >= tv2.usec ()) - return 1; - else - return 0; -} - -// Returns the value of the object as a timespec_t. - -ACE_INLINE -ACE_Time_Value::operator timespec_t () const -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator timespec_t"); - timespec_t tv; - tv.tv_sec = this->sec (); - // Convert microseconds into nanoseconds. - tv.tv_nsec = this->tv_.tv_usec * 1000; - return tv; -} - -// Initializes the ACE_Time_Value object from a timespec_t. - -ACE_INLINE -ACE_Time_Value::ACE_Time_Value (const timespec_t &tv) - // : tv_ () -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (tv); -} - -// True if tv1 < tv2. - -ACE_INLINE bool -operator < (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator <"); - return tv2 > tv1; -} - -// True if tv1 >= tv2. - -ACE_INLINE bool -operator <= (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator <="); - return tv2 >= tv1; -} - -// True if tv1 == tv2. - -ACE_INLINE bool -operator == (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator =="); - return tv1.sec () == tv2.sec () - && tv1.usec () == tv2.usec (); -} - -// True if tv1 != tv2. - -ACE_INLINE bool -operator != (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator !="); - return !(tv1 == tv2); -} - -// Add TV to this. - -ACE_INLINE ACE_Time_Value & -ACE_Time_Value::operator+= (const ACE_Time_Value &tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator+="); - this->sec (this->sec () + tv.sec ()); - this->usec (this->usec () + tv.usec ()); - this->normalize (); - return *this; -} - -ACE_INLINE ACE_Time_Value & -ACE_Time_Value::operator+= (time_t tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator+="); - this->sec (this->sec () + tv); - return *this; -} - -ACE_INLINE ACE_Time_Value & -ACE_Time_Value::operator= (const ACE_Time_Value &tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator="); - this->sec (tv.sec ()); - this->usec (tv.usec ()); - return *this; -} - -ACE_INLINE ACE_Time_Value & -ACE_Time_Value::operator= (time_t tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator="); - this->sec (tv); - this->usec (0); - return *this; -} - -// Subtract TV to this. - -ACE_INLINE ACE_Time_Value & -ACE_Time_Value::operator-= (const ACE_Time_Value &tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator-="); - this->sec (this->sec () - tv.sec ()); - this->usec (this->usec () - tv.usec ()); - this->normalize (); - return *this; -} - -ACE_INLINE ACE_Time_Value & -ACE_Time_Value::operator-= (time_t tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::operator-="); - this->sec (this->sec () - tv); - return *this; -} - -// Adds two ACE_Time_Value objects together, returns the sum. - -ACE_INLINE ACE_Time_Value -operator + (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator +"); - ACE_Time_Value sum (tv1); - sum += tv2; - - return sum; -} - -// Subtracts two ACE_Time_Value objects, returns the difference. - -ACE_INLINE ACE_Time_Value -operator - (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator -"); - ACE_Time_Value delta (tv1); - delta -= tv2; - - return delta; -} - -#if defined (ACE_WIN32) && defined (_WIN32_WCE) -} -#endif - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Timeprobe.cpp b/ace/Timeprobe.cpp deleted file mode 100644 index aea68f74ba0..00000000000 --- a/ace/Timeprobe.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -#include "ace/config-all.h" - -ACE_RCSID(ace, Timeprobe, "$Id$") - -#if defined (ACE_COMPILE_TIMEPROBES) - -#include "ace/Timeprobe.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Timeprobe.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_COMPILE_TIMEPROBES */ diff --git a/ace/Timeprobe.h b/ace/Timeprobe.h deleted file mode 100644 index a78619f6e76..00000000000 --- a/ace/Timeprobe.h +++ /dev/null @@ -1,200 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timeprobe.h - * - * $Id$ - * - * @author Irfan Pyarali - * - * If users want to use time probes, the ACE_COMPILE_TIMEPROBES - * flag must be defined when compiling ACE. This can be achieved - * by doing one of the following: - * - * . Use make probe = 1, if you are using the make utility. - * - * . Define ACE_COMPILE_TIMEPROBES in config.h - * - * . Define ACE_COMPILE_TIMEPROBES in the VC project file. - * - * . Other regular methods will also work. - * - * It is not necessary to define ACE_COMPILE_TIMEPROBES when using - * time probes, you simply need ACE_ENABLE_TIMEPROBES. You can use - * the ACE_TIMEPROBE_* macros to program the time probes, and use - * the ACE_ENABLE_TIMEPROBE to enable the time probes. If you - * define ACE_ENABLE_TIMEPROBE in your code, but forget to compile - * ACE with ACE_COMPILE_TIMEPROBES, you will end up with linker - * errors. - * - * Remember that ACE_COMPILE_TIMEPROBES means that the ACE library - * will contain code for time probes. This is only useful when - * compiling ACE. ACE_ENABLE_TIMEPROBES means that the - * ACE_TIMEPROBE_* macros should spring to life. - */ -//============================================================================= - -#ifndef ACE_TIMEPROBE_H -#define ACE_TIMEPROBE_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" -#include "ace/Malloc_Allocator.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -/* Enable ACE Timeprobes */ -#if defined (ACE_ENABLE_TIMEPROBES) - #if !defined (ACE_COMPILE_TIMEPROBES) - #define ACE_COMPILE_TIMEPROBES - #endif /* ACE_COMPILE_TIMEPROBES */ -#endif /* ACE_ENABLE_TIMEPROBES */ - -#if defined (ACE_COMPILE_TIMEPROBES) - -#include "ace/OS_NS_time.h" -#include "ace/OS_NS_Thread.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Event_Descriptions - * - * @brief Event Descriptions. - */ -class ACE_Export ACE_Event_Descriptions -{ -public: - /// Event descriptions - const char **descriptions_; - - /// Minimum id of this description set - u_long minimum_id_; - - /// Comparison - bool operator== (const ACE_Event_Descriptions &rhs) const; -}; - -/** - * @class ACE_timeprobe_t - * - * @brief Time probe record. - */ -class ACE_Export ACE_timeprobe_t -{ -public: - /// Events are record as strings or numbers. - union event - { - u_long event_number_; - const char *event_description_; - }; - - /// Type of event. - enum event_type - { - NUMBER, - STRING - }; - - /// Event. - event event_; - - /// Type of event. - event_type event_type_; - - /// Timestamp. - ACE_hrtime_t time_; - - /// Id of thread posting the time probe. - ACE_thread_t thread_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Timeprobe.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Synch_Traits.h" -#include "ace/Null_Mutex.h" -#include "ace/Singleton.h" -#include "ace/Timeprobe_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// If ACE_MT_TIMEPROBES is defined, use a Thread_Mutex to lock the -// internal state of ACE_Timerprobe. This allows multiple threads to -// use the same ACE_Timerprobe. -# if defined (ACE_MT_TIMEPROBES) -typedef ACE_SYNCH_MUTEX ACE_TIMEPROBE_MUTEX; -# else /* ACE_MT_TIMEPROBES */ -typedef ACE_SYNCH_NULL_MUTEX ACE_TIMEPROBE_MUTEX; -# endif /* ACE_MT_TIMEPROBES */ - -typedef ACE_New_Allocator ACE_TIMEPROBE_ALLOCATOR; - -typedef ACE_Timeprobe_Ex - ACE_TIMEPROBE_WITH_LOCKING; - -// If ACE_TSS_TIMEPROBES is defined, store the ACE_Timeprobe singleton -// in thread specific storage. This allows multiple threads to use -// their own instance of ACE_Timerprobe, without interfering with each -// other. - -# if defined (ACE_TSS_TIMEPROBES) -# define ACE_TIMEPROBE_SINGLETON_TYPE ACE_TSS_Singleton -# define ACE_TIMEPROBE_SINGLETON_LOCK_TYPE ACE_SYNCH_NULL_MUTEX -# else /* ACE_TSS_TIMEPROBES */ -# define ACE_TIMEPROBE_SINGLETON_TYPE ACE_Singleton -# define ACE_TIMEPROBE_SINGLETON_LOCK_TYPE ACE_SYNCH_MUTEX -# endif /* ACE_TSS_TIMEPROBES */ - -ACE_SINGLETON_DECLARE (ACE_TIMEPROBE_SINGLETON_TYPE, \ - ACE_TIMEPROBE_WITH_LOCKING, \ - ACE_TIMEPROBE_SINGLETON_LOCK_TYPE) - -typedef ACE_TIMEPROBE_SINGLETON_TYPE - ACE_TIMEPROBE_SINGLETON; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_COMPILE_TIMEPROBES */ - -// If ACE_ENABLE_TIMEPROBES is defined, the macros below will -// work. Otherwise, they just vanish. Using this macro, you can -// control which files/libraries are probed. -#if defined (ACE_ENABLE_TIMEPROBES) && defined (ACE_COMPILE_TIMEPROBES) - -# define ACE_TIMEPROBE_RESET ACE_TIMEPROBE_SINGLETON::instance ()->reset () - -# define ACE_TIMEPROBE(id) ACE_TIMEPROBE_SINGLETON::instance ()->timeprobe (id) - -# define ACE_TIMEPROBE_PRINT ACE_TIMEPROBE_SINGLETON::instance ()->print_times () - -# define ACE_TIMEPROBE_PRINT_ABSOLUTE ACE_TIMEPROBE_SINGLETON::instance ()->print_absolute_times () - -# define ACE_TIMEPROBE_EVENT_DESCRIPTIONS(descriptions, minimum_id) \ -static int ace_timeprobe_##descriptions##_return = \ - ACE_TIMEPROBE_SINGLETON::instance ()->event_descriptions \ - (descriptions, minimum_id) - -# define ACE_FUNCTION_TIMEPROBE(X) \ - ACE_Function_Timeprobe function_timeprobe \ - (*ACE_TIMEPROBE_SINGLETON::instance (), X) - -#else /* ACE_ENABLE_TIMEPROBES && ACE_COMPILE_TIMEPROBES */ - -# define ACE_TIMEPROBE_RESET -# define ACE_TIMEPROBE(id) -# define ACE_TIMEPROBE_PRINT -# define ACE_TIMEPROBE_PRINT_ABSOLUTE -# define ACE_TIMEPROBE_EVENT_DESCRIPTIONS(descriptions, minimum_id) -# define ACE_FUNCTION_TIMEPROBE(X) - -#endif /* ACE_ENABLE_TIMEPROBES && ACE_COMPILE_TIMEPROBES */ -#include /**/ "ace/post.h" -#endif /* ACE_TIMEPROBE_H */ diff --git a/ace/Timeprobe.inl b/ace/Timeprobe.inl deleted file mode 100644 index d25eb4b0cfa..00000000000 --- a/ace/Timeprobe.inl +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE bool -ACE_Event_Descriptions::operator== (const ACE_Event_Descriptions &rhs) const -{ - return this->minimum_id_ == rhs.minimum_id_ && - this->descriptions_ == rhs.descriptions_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Timeprobe_T.cpp b/ace/Timeprobe_T.cpp deleted file mode 100644 index 254f3290197..00000000000 --- a/ace/Timeprobe_T.cpp +++ /dev/null @@ -1,411 +0,0 @@ -// $Id$ - -#ifndef ACE_TIMEPROBE_T_CPP -#define ACE_TIMEPROBE_T_CPP - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_COMPILE_TIMEPROBES) - -#include "ace/Timeprobe.h" -#include "ace/High_Res_Timer.h" -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Timeprobe_Ex::ACE_Timeprobe_Ex (u_long size) - : timeprobes_ (0), - lock_ (), - max_size_ (size), - current_size_ (0), - report_buffer_full_ (0), - allocator_ (0) -{ - ACE_timeprobe_t *temp; - ACE_NEW_MALLOC_ARRAY (temp, - (ACE_timeprobe_t *) this->allocator ()-> - malloc (this->max_size_*sizeof(ACE_timeprobe_t)), - ACE_timeprobe_t, - this->max_size_); - this->timeprobes_ = temp; - -} - -template -ACE_Timeprobe_Ex:: -ACE_Timeprobe_Ex (ALLOCATOR *allocator, - u_long size) - : timeprobes_ (0), - lock_ (), - max_size_ (size), - current_size_ (0), - report_buffer_full_ (0), - allocator_ (allocator) -{ - ACE_timeprobe_t *temp = 0; - ACE_NEW_MALLOC_ARRAY (temp, - (ACE_timeprobe_t *) this->allocator ()-> - malloc (this->max_size_*sizeof(ACE_timeprobe_t)), - ACE_timeprobe_t, - this->max_size_); - this->timeprobes_ = temp; - -} - -template -ACE_Timeprobe_Ex::ACE_Timeprobe_Ex (const ACE_Timeprobe_Ex &) -{ - // - // Stupid MSVC is forcing me to define this; please don't use it. - // - - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_NOTSUP: %N, line %l\n"))); - errno = ENOTSUP; -} - -template -ACE_Timeprobe_Ex::~ACE_Timeprobe_Ex (void) -{ - ACE_DES_ARRAY_FREE ((ACE_timeprobe_t *) (this->timeprobes_), - this->max_size_, - this->allocator ()->free, - ACE_timeprobe_t); -} - -template void -ACE_Timeprobe_Ex::timeprobe (u_long event) -{ - ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); - -# if defined (ACE_TIMEPROBE_ASSERTS_FIXED_SIZE) - ACE_ASSERT (this->current_size_ < this->max_size_); -# else /* ! ACE_TIMEPROBE_ASSERTS_FIXED_SIZE */ - // wrap around to the beginning on overflow - if (this->current_size_ >= this->max_size_) - { - this->current_size_ = 0; - this->report_buffer_full_ = 1; - } -# endif /* ACE_TIMEPROBE_ASSERTS_FIXED_SIZE */ - - this->timeprobes_[this->current_size_].event_.event_number_ = event; - this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::NUMBER; - this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime (); - this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self (); - - ++this->current_size_; - -} - -template void -ACE_Timeprobe_Ex::timeprobe (const char *event) -{ - ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); - - ACE_ASSERT (this->current_size_ < this->max_size_); - -#if defined (ACE_TIMEPROBE_ASSERTS_FIXED_SIZE) - ACE_ASSERT (this->current_size_ < this->max_size_); -#else /* ! ACE_TIMEPROBE_ASSERTS_FIXED_SIZE */ - // wrap around to the beginning on overflow - if (this->current_size_ >= this->max_size_) - { - this->current_size_ = 0; - this->report_buffer_full_ = 1; - } -#endif /* ACE_TIMEPROBE_ASSERTS_FIXED_SIZE */ - - this->timeprobes_[this->current_size_].event_.event_description_ = event; - this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::STRING; - this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime (); - this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self (); - - ++this->current_size_; -} - -template void -ACE_Timeprobe_Ex::reset (void) -{ - ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); - - this->current_size_ = 0; - this->report_buffer_full_ = 0; -} - -template void -ACE_Timeprobe_Ex::increase_size (u_long size) -{ - ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); - - if (size > this->max_size_) - { - ACE_timeprobe_t *temp = 0; - ACE_NEW_MALLOC_ARRAY (temp, - (ACE_timeprobe_t *) this->allocator ()-> - malloc (this->max_size_ - * sizeof (ACE_timeprobe_t)), - ACE_timeprobe_t, - size); - - if (this->max_size_ > 0) - { - ACE_OS::memcpy (temp, - this->timeprobes_, - this->max_size_ * sizeof (ACE_timeprobe_t)); - - // Iterates over the array explicitly calling the destructor for - // each probe instance, then deallocates the memory - - ACE_DES_ARRAY_FREE ((ACE_timeprobe_t *)(this->timeprobes_), - this->max_size_, - this->allocator ()->free, - ACE_timeprobe_t); - } - this->timeprobes_ = temp; - this->max_size_ = size; - } -} - -template ACE_Unbounded_Set & -ACE_Timeprobe_Ex::event_descriptions (void) -{ - return this->event_descriptions_; -} - -template ACE_Unbounded_Set & -ACE_Timeprobe_Ex::sorted_event_descriptions (void) -{ - return this->sorted_event_descriptions_; -} - -template ACE_timeprobe_t * -ACE_Timeprobe_Ex::timeprobes (void) -{ - return this->timeprobes_; -} - -template ACE_LOCK & -ACE_Timeprobe_Ex::lock (void) -{ - return this->lock_; -} - -template u_long -ACE_Timeprobe_Ex::max_size (void) -{ - return this->max_size_; -} - -template u_long -ACE_Timeprobe_Ex::current_size (void) -{ - return this->current_size_; -} - -template int -ACE_Timeprobe_Ex::event_descriptions (const char **descriptions, - u_long minimum_id) -{ - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - ACE_Event_Descriptions events; - events.descriptions_ = descriptions; - events.minimum_id_ = minimum_id; - - this->event_descriptions_.insert (events); - - return 0; -} - -template void -ACE_Timeprobe_Ex::print_times (void) -{ - ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); - - // Sort the event descriptions - this->sort_event_descriptions_i (); - - ACE_DEBUG ((LM_DEBUG, - "\nACE_Timeprobe_Ex; %d timestamps were recorded:\n", - this->current_size_)); - - if (this->current_size_ == 0) - return; - - ACE_DEBUG ((LM_DEBUG, - "\n%-50.50s %8.8s %13.13s\n\n", - "Event", - "thread", - "usec")); - - ACE_DEBUG ((LM_DEBUG, - "%-50.50s %8.8x %13.13s\n", - this->find_description_i (0), - this->timeprobes_[0].thread_, - "START")); - - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - u_long i, j; - - if (report_buffer_full_ == 0) { - i = 1; - } - else { - i = this->current_size_; - } - - do - { - if (i == 0) { - j = this->max_size_; - } - else { - j = i - 1; - } - - ACE_hrtime_t time_difference = - this->timeprobes_[i].time_ - this->timeprobes_[j].time_; - - ACE_UINT32 elapsed_time_in_micro_seconds = - (ACE_UINT32) (time_difference / gsf); - ACE_UINT32 remainder = - (ACE_UINT32) (time_difference % gsf); - // Convert to the fractional part in microseconds, with 3 digits - // of precision (hence the 1000). - ACE_UINT32 fractional = remainder * 1000 / gsf; - - ACE_DEBUG ((LM_DEBUG, - "%-50.50s %8.8x %10u.%03.3u\n", - this->find_description_i (i), - this->timeprobes_[i].thread_, - (unsigned int) elapsed_time_in_micro_seconds, - (unsigned int) fractional)); - - i = (i + 1) % this ->max_size_; // Modulus increment: loops around at the end. - - } while (i != this->current_size_); -} - -template void -ACE_Timeprobe_Ex::print_absolute_times (void) -{ - ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); - - // Sort the event descriptions - this->sort_event_descriptions_i (); - - ACE_DEBUG ((LM_DEBUG, - "\nACE_Timeprobe_Ex; %d timestamps were recorded:\n", - this->current_size_)); - - if (this->current_size_ == 0 && this->report_buffer_full_ == 0) { - return; - } - - ACE_DEBUG ((LM_DEBUG, - "\n%-50.50s %8.8s %13.13s\n\n", - "Event", - "thread", - "stamp")); - - u_long i; - if (report_buffer_full_ == 0) { - i = 1; - } - else { - i = this->current_size_; - } - - ACE_Time_Value tv; // to convert ACE_hrtime_t - do - { - ACE_High_Res_Timer::hrtime_to_tv (tv, this->timeprobes_ [i].time_); - - ACE_DEBUG ((LM_DEBUG, - "%-50.50s %8.8x %12.12u\n", - this->find_description_i (i), - this->timeprobes_ [i].thread_, - tv.sec () * 1000000 - + tv.usec ())); - i = (i + 1) % this ->max_size_; // Modulus increment: loops around at the end. - - } while (i != this->current_size_); -} - -template const char * -ACE_Timeprobe_Ex::find_description_i (u_long i) -{ - if (this->timeprobes_[i].event_type_ == ACE_timeprobe_t::STRING) { - return this->timeprobes_[i].event_.event_description_; - } - else - { - EVENT_DESCRIPTIONS::iterator iterator = this->sorted_event_descriptions_.begin (); - for (u_long j = 0; - j < this->sorted_event_descriptions_.size () - 1; - iterator++, j++) - { - EVENT_DESCRIPTIONS::iterator next_event_descriptions = iterator; - ++next_event_descriptions; - - if (this->timeprobes_[i].event_.event_number_ < (*next_event_descriptions).minimum_id_) - break; - } - return (*iterator).descriptions_[this->timeprobes_[i].event_.event_number_ - (*iterator).minimum_id_]; - } -} - -template void -ACE_Timeprobe_Ex::sort_event_descriptions_i (void) -{ - size_t total_elements = this->event_descriptions_.size (); - - for (size_t i = 0; - i < total_elements; - i++) - { - EVENT_DESCRIPTIONS::iterator iterator = this->event_descriptions_.begin (); - ACE_Event_Descriptions min_entry = *iterator; - - for (; - iterator != this->event_descriptions_.end (); - iterator++) - if ((*iterator).minimum_id_ < min_entry.minimum_id_) - min_entry = *iterator; - - this->sorted_event_descriptions_.insert (min_entry); - this->event_descriptions_.remove (min_entry); - } -} - -template ALLOCATOR * -ACE_Timeprobe_Ex::allocator (void) -{ - return allocator_ ? allocator_ : ACE_Singleton::instance (); -} - -template -ACE_Function_Timeprobe::ACE_Function_Timeprobe (Timeprobe &timeprobe, - u_long event) - : timeprobe_ (timeprobe), - event_ (event) -{ - this->timeprobe_.timeprobe (this->event_); -} - -template -ACE_Function_Timeprobe::~ACE_Function_Timeprobe (void) -{ - this->timeprobe_.timeprobe (this->event_ + 1); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_COMPILE_TIMEPROBES */ -#endif /* ACE_TIMEPROBE_T_CPP */ diff --git a/ace/Timeprobe_T.h b/ace/Timeprobe_T.h deleted file mode 100644 index 32b5bae1448..00000000000 --- a/ace/Timeprobe_T.h +++ /dev/null @@ -1,222 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timeprobe_T.h - * - * $Id$ - * - * @author Irfan Pyarali - */ -//============================================================================= - - -#ifndef ACE_TIMEPROBE_T_H -#define ACE_TIMEPROBE_T_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_COMPILE_TIMEPROBES) - -#include "ace/Unbounded_Set.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Timeprobe_Ex - * - * @brief This class is used to instrument code. This is accomplished - * by inserting time probes at different location in the code. - * ACE_Timeprobe then measures the time difference between two - * time probes. - * - * This class provides a lightweight implementation for - * measuring the time required to execute code between two time - * probes. When a time probe executes, it records the time, the - * id of the calling thread, and an event description. The - * event description can either be an unsigned long or a string - * (char *). If string are used, care must be taken cause only - * pointer copies are done and the string data is *not* copied. - * The recorded time probes can then be printed by calling - * . If you have used unsigned longs as event - * descriptions in any of your time probes, you must have - * provided an event description table that maps the unsigned - * longs to readable strings. This map is a simple array of - * strings, and the event number is used as the index into the - * array when looking for the event description. If you have - * only used strings for the event description, this map is not - * necessary. - * Multiple maps can also be used to chunk up the time probes. - * Each one can be added by calling . - * Different tables are used internally by consulting the - * minimum_id for each table. It is up to the user to make sure - * that multiple tables do not share the same event id range. - */ -template -class ACE_Timeprobe_Ex -{ -public: - - /// Self - typedef ACE_Timeprobe_Ex - SELF; - - /** - * ACE_Timeprobe - */ - typedef ACE_Timeprobe_Ex ACE_Timeprobe; - - - /// We can hold multiple event description tables. - typedef ACE_Unbounded_Set - EVENT_DESCRIPTIONS; - - /// Create Timeprobes with @a size slots - ACE_Timeprobe_Ex (u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE); - - /// Create Timeprobes with @a size slots - ACE_Timeprobe_Ex (ALLOCATOR *allocator, - u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE); - /// Destructor. - ~ACE_Timeprobe_Ex (void); - - /// Record a time. @a event is used to describe this time probe. - void timeprobe (u_long event); - - /// Record a time. @a id is used to describe this time probe. - void timeprobe (const char *id); - - /// Record event descriptions. - int event_descriptions (const char **descriptions, - u_long minimum_id); - - /// Print the time probes. - void print_times (void); - - /// Print the time probes. - void print_absolute_times (void); - - /// Reset the slots. All old time probes will be lost. - void reset (void); - - void increase_size (u_long size); - - /// Not implemented (stupid MSVC won't let it be protected). - ACE_Timeprobe_Ex (const ACE_Timeprobe_Ex &); - - // = (Somewhat private) Accessors - - /// Event Descriptions - ACE_Unbounded_Set &event_descriptions (void); - - /// Sorted Event Descriptions. - ACE_Unbounded_Set &sorted_event_descriptions (void); - - /// Find description of event \ - const char *find_description_i (u_long i); - - /// Sort event descriptions - void sort_event_descriptions_i (void); - - /// Time probe slots - ACE_timeprobe_t *timeprobes (void); - - /// Synchronization variable. - ACE_LOCK &lock (void); - - /// Max size of timestamp table - u_long max_size (void); - - /// Current size of timestamp table - u_long current_size (void); - -protected: - - /// Obtain an allocator pointer. If there is no allocator stored in - /// the instance, the singleton allocator in the current process is used. - ALLOCATOR * allocator (void); - - /// Event Descriptions - EVENT_DESCRIPTIONS event_descriptions_; - - /// Sorted Event Descriptions. - EVENT_DESCRIPTIONS sorted_event_descriptions_; - - /// Time probe slots - ACE_timeprobe_t *timeprobes_; - - /// Synchronization variable. - ACE_LOCK lock_; - - /// Max size of timestamp table - u_long max_size_; - - /// Current size of timestamp table - u_long current_size_; - - /// Flag indicating the report buffer has filled up, and is now - /// acting as a ring-buffer using modulus arithmetic: this saves the - /// max_size_ most recent time stamps and loses earlier ones until - /// drained. - u_short report_buffer_full_; - - -private: - ALLOCATOR * allocator_; -}; - -// template -// class ACE_Timeprobe : public ACE_Timeprobe_Ex -// { -// public: -// // Initialize a ACE_Timeprobe with default size -// ACE_Timeprobe (ACE_Allocator *allocator = ACE_Allocator::instance()); - -// /// Create Timeprobes with slots -// ACE_Timeprobe (ACE_Allocator *allocator = ACE_Allocator::instance(), -// u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE); -// }; - -/** - * @class ACE_Function_Timeprobe - * - * @brief Auto pointer like time probes. It will record on - * construction and on destruction. - */ -template -class ACE_Function_Timeprobe -{ -public: - /// Constructor. - ACE_Function_Timeprobe (Timeprobe &timeprobe, - u_long event); - - /// Destructor. - ~ACE_Function_Timeprobe (void); - -protected: - /// Reference to timeprobe. - Timeprobe &timeprobe_; - - /// Event. - u_long event_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Timeprobe_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Timeprobe_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* ACE_COMPILE_TIMEPROBES */ -#include /**/ "ace/post.h" -#endif /* ACE_TIMEPROBE_T_H */ diff --git a/ace/Timer_Hash.cpp b/ace/Timer_Hash.cpp deleted file mode 100644 index 532f0d83c64..00000000000 --- a/ace/Timer_Hash.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// $Id$ - -#include "ace/Timer_Hash.h" -#include "ace/Synch_Traits.h" -#include "ace/Recursive_Thread_Mutex.h" - -#if defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_Hash_T.cpp" -#endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ - -ACE_RCSID(ace, Timer_Hash, "$Id$") - diff --git a/ace/Timer_Hash.h b/ace/Timer_Hash.h deleted file mode 100644 index 2d959be39c5..00000000000 --- a/ace/Timer_Hash.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Timer_Hash.h - * - * $Id$ - * - * @author Darrell Brunsch - */ -//============================================================================= - - -#ifndef ACE_TIMER_HASH_H -#define ACE_TIMER_HASH_H -#include /**/ "ace/pre.h" - -#include "ace/Timer_Hash_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Timer_Heap_T.h" -#include "ace/Timer_List_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The following typedef are here for ease of use - -typedef ACE_Timer_Hash_Upcall , - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Hash_Upcall; - -typedef ACE_Timer_List_T - ACE_Hash_Timer_List; - -typedef ACE_Timer_Heap_T - ACE_Hash_Timer_Heap; - - -typedef ACE_Timer_Hash_T, - ACE_SYNCH_RECURSIVE_MUTEX, - ACE_Hash_Timer_List> - - ACE_Timer_Hash; - -typedef ACE_Timer_Hash_Iterator_T, - ACE_SYNCH_RECURSIVE_MUTEX, - ACE_Hash_Timer_List> - ACE_Timer_Hash_Iterator; - -typedef ACE_Timer_Hash_T, - ACE_SYNCH_RECURSIVE_MUTEX, - ACE_Hash_Timer_Heap> - ACE_Timer_Hash_Heap; - -typedef ACE_Timer_Hash_Iterator_T, - ACE_SYNCH_RECURSIVE_MUTEX, - ACE_Hash_Timer_Heap> - ACE_Timer_Hash_Heap_Iterator; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_HASH_H */ diff --git a/ace/Timer_Hash_T.cpp b/ace/Timer_Hash_T.cpp deleted file mode 100644 index 9f5d51fb8d6..00000000000 --- a/ace/Timer_Hash_T.cpp +++ /dev/null @@ -1,789 +0,0 @@ -// $Id$ - -#ifndef ACE_TIMER_HASH_T_C -#define ACE_TIMER_HASH_T_C - -#include "ace/Timer_Hash_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_sys_time.h" -#include "ace/Guard_T.h" -#include "ace/Log_Msg.h" - -ACE_RCSID(ace, - Timer_Hash_T, - "$Id$") - -template -struct Hash_Token -{ - Hash_Token (const void *act, - size_t pos, - long orig_id, - const TYPE &type) - : act_ (act), - pos_ (pos), - orig_id_ (orig_id), - type_ (type) - {} - - const void *act_; - size_t pos_; - long orig_id_; - TYPE type_; -}; - -// Default constructor - -template -ACE_Timer_Hash_Upcall::ACE_Timer_Hash_Upcall (void) - : timer_hash_ (0) -{ - // Nothing -} - -// Constructor that specifies a Timer_Hash to call up to - -template -ACE_Timer_Hash_Upcall::ACE_Timer_Hash_Upcall (ACE_Timer_Queue_T *timer_hash) - : timer_hash_ (timer_hash) -{ - // Nothing -} - -template int -ACE_Timer_Hash_Upcall::registration (TIMER_QUEUE &, - ACE_Event_Handler *, - const void *) -{ - // Registration will be handled by the upcall functor of the timer - // hash. - return 0; -} - -template int -ACE_Timer_Hash_Upcall::preinvoke (TIMER_QUEUE &, - ACE_Event_Handler *, - const void *, - int, - const ACE_Time_Value &, - const void *&) -{ - // This method should never be invoked since we don't invoke - // expire() on the buckets. - ACE_ASSERT (0); - return 0; -} - -template int -ACE_Timer_Hash_Upcall::postinvoke (TIMER_QUEUE &, - ACE_Event_Handler *, - const void *, - int, - const ACE_Time_Value &, - const void *) -{ - // This method should never be invoked since we don't invoke - // expire() on the buckets. - ACE_ASSERT (0); - return 0; -} - -// Calls up to timer_hash's upcall functor -template int -ACE_Timer_Hash_Upcall::timeout (TIMER_QUEUE &, - ACE_Event_Handler *, - const void *, - int, - const ACE_Time_Value &) -{ - // This method should never be invoked since we don't invoke - // expire() on the buckets. - ACE_ASSERT (0); - return 0; -} - -template int -ACE_Timer_Hash_Upcall::cancel_type (TIMER_QUEUE &, - ACE_Event_Handler *, - int, - int &) -{ - // Cancellation will be handled by the upcall functor of the timer - // hash. - return 0; -} - -template int -ACE_Timer_Hash_Upcall::cancel_timer (TIMER_QUEUE &, - ACE_Event_Handler *, - int, - int) -{ - // Cancellation will be handled by the upcall functor of the timer - // hash. - return 0; -} - -template int -ACE_Timer_Hash_Upcall::deletion (TIMER_QUEUE &, - ACE_Event_Handler *event_handler, - const void *arg) -{ - // Call up to the upcall functor of the timer hash since the timer - // hash does not invoke deletion() on its upcall functor directly. - Hash_Token *h = - reinterpret_cast *> (const_cast (arg)); - - int result = - this->timer_hash_->upcall_functor (). - deletion (*this->timer_hash_, - event_handler, - h->act_); - - delete h; - - return result; -} - -template -ACE_Timer_Hash_Iterator_T::ACE_Timer_Hash_Iterator_T (ACE_Timer_Hash_T &hash) - : timer_hash_ (hash) -{ - this->first (); - // Nothing -} - -// Positions the iterator at the first node in the timing hash table - -template void -ACE_Timer_Hash_Iterator_T::first (void) -{ - for (this->position_ = 0; - this->position_ < this->timer_hash_.table_size_; - ++this->position_) - { - // Check for an empty entry - if (!this->timer_hash_.table_[this->position_]->is_empty ()) - { - this->iter_ = &this->timer_hash_.table_[this->position_]->iter (); - this->iter_->first (); - return; - } - } - - // Didn't find any - this->iter_ = 0; -} - -// Positions the iterator at the next node in the bucket or goes to the next -// bucket - -template void -ACE_Timer_Hash_Iterator_T::next (void) -{ - if (this->isdone ()) - return; - - // If there is no more in the current bucket, go to the next - if (this->iter_->isdone ()) - { - for (++this->position_; - this->position_ < this->timer_hash_.table_size_; - ++this->position_) - { - // Check for an empty entry - if (!this->timer_hash_.table_[this->position_]->is_empty ()) - { - this->iter_ = &this->timer_hash_.table_[this->position_]->iter (); - this->iter_->first (); - return; - } - } - - // Didn't find any. - this->iter_ = 0; - } - else - this->iter_->next (); -} - -// Returns true when we are at the end (when bucket_item_ == 0) - -template int -ACE_Timer_Hash_Iterator_T::isdone (void) const -{ - return this->iter_ == 0; -} - -// Returns the node at the current position in the sequence - -template ACE_Timer_Node_T * -ACE_Timer_Hash_Iterator_T::item (void) -{ - if (this->isdone ()) - return 0; - - return this->iter_->item (); -} - -template ACE_Timer_Queue_Iterator_T & -ACE_Timer_Hash_T::iter (void) -{ - this->iterator_->first (); - return *this->iterator_; -} - -// Create an empty queue. - -template -ACE_Timer_Hash_T::ACE_Timer_Hash_T (size_t table_size, - FUNCTOR *upcall_functor, - ACE_Free_List > *freelist) - : ACE_Timer_Queue_T (upcall_functor, freelist), - size_ (0), - table_size_ (table_size), - table_functor_ (this), - earliest_position_ (0) -#if defined (ACE_WIN64) - , pointer_base_ (0) -#endif /* ACE_WIN64 */ -{ - ACE_TRACE ("ACE_Timer_Hash_T::ACE_Timer_Hash_T"); - - ACE_NEW (table_, - BUCKET *[table_size]); - - this->gettimeofday (ACE_OS::gettimeofday); - - for (size_t i = 0; - i < table_size; - ++i) - { - ACE_NEW (this->table_[i], - BUCKET (&this->table_functor_, - this->free_list_)); - this->table_[i]->gettimeofday (ACE_OS::gettimeofday); - } - - ACE_NEW (iterator_, - HASH_ITERATOR (*this)); -} - - -template -ACE_Timer_Hash_T::ACE_Timer_Hash_T (FUNCTOR *upcall_functor, - ACE_Free_List > *freelist) - : ACE_Timer_Queue_T (upcall_functor, freelist), - size_ (0), - table_size_ (ACE_DEFAULT_TIMER_HASH_TABLE_SIZE), - table_functor_ (this), - earliest_position_ (0) -#if defined (ACE_WIN64) - , pointer_base_ (0) -#endif /* ACE_WIN64 */ -{ - ACE_TRACE ("ACE_Timer_Hash_T::ACE_Timer_Hash_T"); - - ACE_NEW (table_, - BUCKET *[ACE_DEFAULT_TIMER_HASH_TABLE_SIZE]); - - - this->gettimeofday (ACE_OS::gettimeofday); - - for (size_t i = 0; - i < this->table_size_; - ++i) - { - ACE_NEW (this->table_[i], - BUCKET (&this->table_functor_, - this->free_list_)); - this->table_[i]->gettimeofday (ACE_OS::gettimeofday); - } - - ACE_NEW (iterator_, - HASH_ITERATOR (*this)); -} - -// Remove all remaining items in the Queue. - -template -ACE_Timer_Hash_T::~ACE_Timer_Hash_T (void) -{ - ACE_TRACE ("ACE_Timer_Hash_T::~ACE_Timer_Hash_T"); - ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); - - delete iterator_; - - for (size_t i = 0; - i < this->table_size_; - ++i) - delete this->table_[i]; - - delete [] this->table_; -} - -// Checks if queue is empty. - -template int -ACE_Timer_Hash_T::is_empty (void) const -{ - ACE_TRACE ("ACE_Timer_Hash_T::is_empty"); - return this->table_[this->earliest_position_]->is_empty (); -} - -// Returns earliest time in a non-empty bucket - -template const ACE_Time_Value & -ACE_Timer_Hash_T::earliest_time (void) const -{ - ACE_TRACE ("ACE_Timer_Hash_T::earliest_time"); - return this->table_[this->earliest_position_]->earliest_time (); -} - -template void -ACE_Timer_Hash_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Timer_Hash_T::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntable_size_ = %d"), this->table_size_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nearliest_position_ = %d"), this->earliest_position_)); - - for (size_t i = 0; i < this->table_size_; ++i) - if (!this->table_[i]->is_empty ()) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nBucket %d contains nodes"), i)); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Reschedule a periodic timer. This function must be called with the -// mutex lock held. - -template void -ACE_Timer_Hash_T::reschedule (ACE_Timer_Node_T *expired) -{ - ACE_TRACE ("ACE_Timer_Hash_T::reschedule"); - - Hash_Token *h = - reinterpret_cast *> ( - const_cast (expired->get_act ())); - - h->pos_ = - expired->get_timer_value ().sec () % this->table_size_; - - h->orig_id_ = - this->table_[h->pos_]->schedule (expired->get_type (), - h, - expired->get_timer_value (), - expired->get_interval ()); - ACE_ASSERT (h->orig_id_ != -1); - -#if 0 - ACE_DEBUG ((LM_DEBUG, "Hash::reschedule() resets %d in slot %d where it's id is %d and token is %x\n", - expired->get_timer_value ().msec (), - h->pos_, - h->orig_id_, - h)); -#endif - - if (this->table_[this->earliest_position_]->is_empty () - || this->table_[h->pos_]->earliest_time () - < this->table_[this->earliest_position_]->earliest_time ()) - this->earliest_position_ = h->pos_; -} - -// Insert a new handler that expires at time future_time; if interval -// is > 0, the handler will be reinvoked periodically. - -template long -ACE_Timer_Hash_T::schedule_i (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Timer_Hash_T::schedule_i"); - - size_t position = - future_time.sec () % this->table_size_; - - Hash_Token *h = 0; - - ACE_NEW_RETURN (h, - Hash_Token (act, - position, - 0, - type), - -1); - - h->orig_id_ = - this->table_[position]->schedule (type, - h, - future_time, - interval); - ACE_ASSERT (h->orig_id_ != -1); - -#if 0 - ACE_DEBUG ((LM_DEBUG, "Hash::schedule() placing %d in slot %d where it's id is %d and token is %x\n", - future_time.msec (), - position, - h->orig_id_, - h)); -#endif - - if (this->table_[this->earliest_position_]->is_empty () - || this->table_[position]->earliest_time () - < this->table_[this->earliest_position_]->earliest_time ()) - this->earliest_position_ = position; - - ++this->size_; - -#if defined (ACE_WIN64) - // This is a Win64 hack, necessary because of the original (bad) decision - // to use a pointer as the timer ID. This class doesn't follow the usual - // timer expiration rules (see comments in header file) and is probably - // not used much. The dynamic allocation of Hash_Tokens without - // recording them anywhere is a large problem for Win64 since the - // size of a pointer is 64 bits, but a long is 32. Since this class - // is not much used, I'm hacking this, at least for now. If it becomes - // an issue, I'll look at it again then. - ptrdiff_t hi = reinterpret_cast (h); - if (this->pointer_base_ == 0) - this->pointer_base_ = hi & 0xffffffff00000000; - return static_cast (hi & 0xffffffff); -#else - return reinterpret_cast (h); -#endif -} - -// Locate and update the inteval on the timer_id - -template int -ACE_Timer_Hash_T::reset_interval (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Timer_Hash_T::reset_interval"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - // Make sure we are getting a valid , not an error - // returned by . - if (timer_id == -1) - return -1; - - -#if defined (ACE_WIN64) - unsigned long timer_offset = static_cast (timer_id); - Hash_Token *h = - reinterpret_cast *> (this->pointer_base_ + timer_offset); -#else - Hash_Token *h = - reinterpret_cast *> (timer_id); -#endif /* ACE_WIN64 */ - - return this->table_[h->pos_]->reset_interval (h->orig_id_, - interval); -} - -// Locate and remove the single with a value of -// from the correct table timer queue. - -template int -ACE_Timer_Hash_T::cancel (long timer_id, - const void **act, - int dont_call) -{ - ACE_TRACE ("ACE_Timer_Hash_T::cancel"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - // Make sure we are getting a valid , not an error - // returned by . - if (timer_id == -1) - return 0; - -#if defined (ACE_WIN64) - unsigned long timer_offset = static_cast (timer_id); - Hash_Token *h = - reinterpret_cast *> (this->pointer_base_ + timer_offset); -#else - Hash_Token *h = - reinterpret_cast *> (timer_id); -#endif /* ACE_WIN64 */ - - int const result = this->table_[h->pos_]->cancel (h->orig_id_, - 0, - dont_call); - - if (result == 1) - { - // Call the close hooks. - int cookie = 0; - - // cancel_type() called once per . - this->upcall_functor ().cancel_type (*this, - h->type_, - dont_call, - cookie); - - // cancel_timer() called once per . - this->upcall_functor ().cancel_timer (*this, - h->type_, - dont_call, - cookie); - - if (h->pos_ == this->earliest_position_) - this->find_new_earliest (); - - if (act != 0) - *act = h->act_; - - delete h; - - --this->size_; - } - - return result; -} - -// Locate and remove all values of from the timer queue. - -template int -ACE_Timer_Hash_T::cancel (const TYPE &type, - int dont_call) -{ - ACE_TRACE ("ACE_Timer_Hash_T::cancel"); - - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - size_t i; // loop variable. - - Hash_Token **timer_ids = 0; - - ACE_NEW_RETURN (timer_ids, - Hash_Token *[this->size_], - -1); - size_t pos = 0; - - for (i = 0; - i < this->table_size_; - ++i) - { - ACE_Timer_Queue_Iterator_T, - ACE_Null_Mutex> &iter = - this->table_[i]->iter (); - - for (iter.first (); - !iter.isdone (); - iter.next ()) - if (iter.item ()->get_type () == type) - timer_ids[pos++] = - reinterpret_cast *> ( - const_cast (iter.item ()->get_act ())); - } - - if (pos > this->size_) - return -1; - - for (i = 0; i < pos; ++i) - { - int const result = - this->table_[timer_ids[i]->pos_]->cancel (timer_ids[i]->orig_id_, - 0, - dont_call); - ACE_ASSERT (result == 1); - ACE_UNUSED_ARG (result); - - delete timer_ids[i]; - - --this->size_; - } - - delete [] timer_ids; - - this->find_new_earliest (); - - // Call the close hooks. - int cookie = 0; - - // cancel_type() called once per . - this->upcall_functor ().cancel_type (*this, - type, - dont_call, - cookie); - - for (i = 0; - i < pos; - ++i) - { - // cancel_timer() called once per . - this->upcall_functor ().cancel_timer (*this, - type, - dont_call, - cookie); - } - - return static_cast (pos); -} - -// Removes the earliest node and finds the new earliest position - -template ACE_Timer_Node_T * -ACE_Timer_Hash_T::remove_first (void) -{ - if (this->is_empty ()) - return 0; - - ACE_Timer_Node_T *temp = - this->table_[this->earliest_position_]->remove_first (); - - this->find_new_earliest (); - - --this->size_; - - return temp; -} - -// Finds a new earliest position - -template void -ACE_Timer_Hash_T::find_new_earliest (void) -{ - for (size_t i = 0; i < this->table_size_; ++i) - if (!this->table_[i]->is_empty ()) - if (this->table_[this->earliest_position_]->is_empty () - || this->earliest_time () == ACE_Time_Value::zero - || this->table_[i]->earliest_time () <= this->earliest_time ()) - this->earliest_position_ = i; -} - -// Returns the earliest node without removing it - -template ACE_Timer_Node_T * -ACE_Timer_Hash_T::get_first (void) -{ - ACE_TRACE ("ACE_Timer_Hash_T::get_first"); - - if (this->is_empty ()) - return 0; - - return this->table_[this->earliest_position_]->get_first (); -} - -template int -ACE_Timer_Hash_T::dispatch_info_i (const ACE_Time_Value &cur_time, - ACE_Timer_Node_Dispatch_Info_T &info) -{ - int const result = - ACE_Timer_Queue_T::dispatch_info_i (cur_time, - info); - - if (result == 1) - { - Hash_Token *h = - reinterpret_cast *> (const_cast (info.act_)); - - info.act_ = h->act_; - } - - return result; -} - -// Dummy version of expire to get rid of warnings in Sun CC 4.2 - -template int -ACE_Timer_Hash_T::expire () -{ - return ACE_Timer_Queue_T::expire(); -} - -// Specialized expire for Timer Hash - -template int -ACE_Timer_Hash_T::expire (const ACE_Time_Value &cur_time) -{ - ACE_TRACE ("ACE_Timer_Hash_T::expire"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - int number_of_timers_expired = 0; - - ACE_Timer_Node_T *expired = 0; - - // Go through the table and expire anything that can be expired - - for (size_t i = 0; - i < this->table_size_; - ++i) - { - while (!this->table_[i]->is_empty () - && this->table_[i]->earliest_time () <= cur_time) - { - expired = this->table_[i]->remove_first (); - const void *act = expired->get_act (); - int reclaim = 1; - - Hash_Token *h = - reinterpret_cast *> (const_cast (act)); - - ACE_ASSERT (h->pos_ == i); - -#if 0 - ACE_DEBUG ((LM_DEBUG, "Hash::expire() expiring %d in slot %d where it's id is %d and token is %x\n", - expired->get_timer_value ().msec (), - h->pos_, - h->orig_id_, - h)); -#endif - - // Check if this is an interval timer. - if (expired->get_interval () > ACE_Time_Value::zero) - { - // Make sure that we skip past values that have already - // "expired". - do - expired->set_timer_value (expired->get_timer_value () - + expired->get_interval ()); - while (expired->get_timer_value () <= cur_time); - - // Since this is an interval timer, we need to - // reschedule it. - this->reschedule (expired); - reclaim = 0; - } - - ACE_Timer_Node_Dispatch_Info_T info; - - // Get the dispatch info - expired->get_dispatch_info (info); - - info.act_ = h->act_; - - const void *upcall_act = 0; - - this->preinvoke (info, cur_time, upcall_act); - - this->upcall (info, cur_time); - - this->postinvoke (info, cur_time, upcall_act); - - if (reclaim) - { - --this->size_; - delete h; - } - - ++number_of_timers_expired; - } - } - - if (number_of_timers_expired > 0) - this->find_new_earliest (); - - return number_of_timers_expired; -} - -#endif /* ACE_TIMER_HASH_T_C */ diff --git a/ace/Timer_Hash_T.h b/ace/Timer_Hash_T.h deleted file mode 100644 index c7eee094c63..00000000000 --- a/ace/Timer_Hash_T.h +++ /dev/null @@ -1,328 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Timer_Hash_T.h - * - * $Id$ - * - * @author Darrell Brunsch - */ -//============================================================================= - -#ifndef ACE_TIMER_HASH_T_H -#define ACE_TIMER_HASH_T_H -#include /**/ "ace/pre.h" - -#include "ace/Timer_Queue_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Free_List.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -template -class ACE_Timer_Hash_T; - -/** - * @class ACE_Timer_Hash_Upcall - * - * @brief Functor for Timer_Hash - * - * This class calls up to the Timer Hash's functor from the - * timer queues in the hash table - */ -template -class ACE_Timer_Hash_Upcall -{ -public: - typedef ACE_Timer_Queue_T, - ACE_Null_Mutex> - TIMER_QUEUE; - - /// Default constructor (creates an invalid object, but needs to be here - /// so timer queues using this functor can be constructed) - ACE_Timer_Hash_Upcall (void); - - /// Constructor that specifies a Timer_Hash to call up to - ACE_Timer_Hash_Upcall (ACE_Timer_Queue_T *timer_hash); - - /// This method is called when a timer is registered. - int registration (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg); - - /// This method is called before the timer expires. - int preinvoke (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time, - const void *&upcall_act); - - /// This method is called when the timer expires. - int timeout (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time); - - /// This method is called after the timer expires. - int postinvoke (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time, - const void *upcall_act); - - /// This method is called when a handler is cancelled - int cancel_type (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - int dont_call, - int &requires_reference_counting); - - /// This method is called when a timer is cancelled - int cancel_timer (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - int dont_call, - int requires_reference_counting); - - /// This method is called when the timer queue is destroyed and - /// the timer is still contained in it - int deletion (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg); - -private: - /// Timer Queue to do the calling up to - ACE_Timer_Queue_T *timer_hash_; - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Hash_Upcall (const ACE_Timer_Hash_Upcall &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_Upcall &)) -}; - -/** - * @class ACE_Timer_Hash_Iterator_T - * - * @brief Iterates over an . - * - * This is a generic iterator that can be used to visit every - * node of a timer queue. Be aware that it doesn't transverse - * in the order of timeout values. - */ -template -class ACE_Timer_Hash_Iterator_T : public ACE_Timer_Queue_Iterator_T -{ -public: - /// Constructor. - ACE_Timer_Hash_Iterator_T (ACE_Timer_Hash_T &); - - /// Positions the iterator at the earliest node in the Timer Queue - virtual void first (void); - - /// Positions the iterator at the next node in the Timer Queue - virtual void next (void); - - /// Returns true when there are no more nodes in the sequence - virtual int isdone (void) const; - - /// Returns the node at the current position in the sequence - virtual ACE_Timer_Node_T *item (void); - -protected: - /// Pointer to the ACE_Timer_Hash that we are iterating over. - ACE_Timer_Hash_T &timer_hash_; - - /// Current position in 's table - size_t position_; - - /// Current iterator used on 's bucket - ACE_Timer_Queue_Iterator_T, ACE_Null_Mutex> *iter_; -}; - -/** - * @class ACE_Timer_Hash_T - * - * @brief Provides a hash table of s as an implementation for - * a timer queue. - * - * This implementation uses a hash table of BUCKETs. The hash - * is based on the time_value of the event. Unlike other Timer - * Queues, ACE_Timer_Hash does not expire events in order. - */ -template -class ACE_Timer_Hash_T : public ACE_Timer_Queue_T -{ -public: - /// Type of iterator - typedef ACE_Timer_Hash_Iterator_T - HASH_ITERATOR; - - /// Iterator is a friend - friend class ACE_Timer_Hash_Iterator_T; - - /// Type inherited from - typedef ACE_Timer_Queue_T INHERITED; - - // = Initialization and termination methods. - /** - * Default constructor. determines the size of the - * hash table. is the instance of the FUNCTOR - * to be used by the buckets. If is 0, a default - * FUNCTOR will be created. - */ - ACE_Timer_Hash_T (size_t table_size, - FUNCTOR *upcall_functor = 0, - ACE_Free_List > *freelist = 0); - - /** - * Default constructor. is the instance of the - * FUNCTOR to be used by the queue. If is 0, Timer - * Hash will create a default FUNCTOR. the freelist of - * timer nodes. If 0, then a default freelist will be created. The default - * size will be ACE_DEFAULT_TIMERS and there will be no preallocation. - */ - ACE_Timer_Hash_T (FUNCTOR *upcall_functor = 0, ACE_Free_List > *freelist = 0); - - /// Destructor - virtual ~ACE_Timer_Hash_T (void); - - /// True if queue is empty, else false. - virtual int is_empty (void) const; - - /// Returns the time of the earlier node in the . - /// Must be called on a non-empty queue. - virtual const ACE_Time_Value &earliest_time (void) const; - - /** - * Resets the interval of the timer represented by to - * , which is specified in relative time to the current - * . If is equal to - * , the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_interval (long timer_id, - const ACE_Time_Value &interval); - - /** - * Cancel all timer associated with . If is 0 - * then the will be invoked. Returns number of timers - * cancelled. - */ - virtual int cancel (const TYPE &type, - int dont_call_handle_close = 1); - - /** - * Cancel the single timer that matches the value (which - * was returned from the method). If act is non-NULL - * then it will be set to point to the ``magic cookie'' argument - * passed in when the timer was registered. This makes it possible - * to free up the memory and avoid memory leaks. If is - * 0 then the will be invoked. Returns 1 if cancellation - * succeeded and 0 if the wasn't found. - */ - virtual int cancel (long timer_id, - const void **act = 0, - int dont_call_handle_close = 1); - - /** - * Run the for all timers whose values are <= - * . Also accounts for . Returns - * the number of timers canceled. - */ - virtual int expire (void); - - /** - * Run the for all timers whose values are <= . - * This does not account for . Returns the number of - * timers canceled. - */ - virtual int expire (const ACE_Time_Value ¤t_time); - - /// Returns a pointer to this ACE_Timer_Queue's iterator. - virtual ACE_Timer_Queue_Iterator_T &iter (void); - - /// Removes the earliest node from the queue and returns it - virtual ACE_Timer_Node_T *remove_first (void); - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Reads the earliest node from the queue and returns it. - virtual ACE_Timer_Node_T *get_first (void); - -private: - - /** - * Schedule that will expire at , - * which is specified in absolute time. If it expires then is - * passed in as the value to the . If is != to - * then it is used to reschedule the - * automatically, using relative time to the current . - * This method returns a that is a pointer to a token - * which stores information about the event. This can be - * used to cancel the timer before it expires. Returns -1 on - * failure. - */ - virtual long schedule_i (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval); - - /// Non-locking version of dispatch_info () - virtual int dispatch_info_i (const ACE_Time_Value ¤t_time, - ACE_Timer_Node_Dispatch_Info_T &info); - - /// Reschedule an "interval" . - virtual void reschedule (ACE_Timer_Node_T *); - - /// Finds the earliest node - void find_new_earliest (void); - - /// Keeps track of the size of the queue - size_t size_; - - /// Table of BUCKETS - BUCKET **table_; - - /// Keeps track of the size of table_ - size_t table_size_; - - /// Functor used for the table's timer queues - ACE_Timer_Hash_Upcall table_functor_; - - /// Index to the position with the earliest entry - size_t earliest_position_; - - /// Iterator used to expire timers. - HASH_ITERATOR *iterator_; - -#if defined (ACE_WIN64) - // Part of a hack... see comments in schedule(). - // This is, essentially, the upper 32 bits of a 64-bit pointer on Win64. - ptrdiff_t pointer_base_; -#endif - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Hash_T (const ACE_Timer_Hash_T &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_T &)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) && !defined(ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_Hash_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE && !ACE_HAS_BROKEN_HPUX_TEMPLATES */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Timer_Hash_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_HASH_T_H */ diff --git a/ace/Timer_Heap.cpp b/ace/Timer_Heap.cpp deleted file mode 100644 index 300859dba8f..00000000000 --- a/ace/Timer_Heap.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -#include "ace/Timer_Heap.h" -#include "ace/Synch_Traits.h" -#include "ace/Recursive_Thread_Mutex.h" - -#if defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_Hash.h" -#include "ace/Timer_Heap_T.cpp" - -ACE_RCSID(ace, - Timer_Heap, - "$Id$") - -#endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ - diff --git a/ace/Timer_Heap.h b/ace/Timer_Heap.h deleted file mode 100644 index a0c9301ebc8..00000000000 --- a/ace/Timer_Heap.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Timer_Heap.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_TIMER_HEAP_H -#define ACE_TIMER_HEAP_H -#include /**/ "ace/pre.h" - -#include "ace/Timer_Heap_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The following typedefs are here for ease of use and backward -// compatibility. - -typedef ACE_Timer_Heap_T, - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Timer_Heap; - -typedef ACE_Timer_Heap_Iterator_T, - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Timer_Heap_Iterator; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_HEAP_H */ diff --git a/ace/Timer_Heap_T.cpp b/ace/Timer_Heap_T.cpp deleted file mode 100644 index 644a13b90db..00000000000 --- a/ace/Timer_Heap_T.cpp +++ /dev/null @@ -1,888 +0,0 @@ -// $Id$ - -#ifndef ACE_TIMER_HEAP_T_CPP -#define ACE_TIMER_HEAP_T_CPP - -#include "ace/Timer_Heap_T.h" -#include "ace/Log_Msg.h" -#include "ace/Guard_T.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_string.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -/* -** The ACE_Timer_Heap::max_size_ and array loops, checks, etc. are all size_t. -** The timer IDs are long, and since they are indices into the heap, we need -** to be sure that the timer heap size can fit in a long. Hence, when size -** is (re)set, limit it to the maximum long value. We use the C++ standard -** limits if available. -*/ -#if !defined(ACE_LACKS_NUMERIC_LIMITS) -// some platforms pollute the namespace by defining max() and min() macros -#ifdef max -#undef max -#endif -#ifdef min -#undef min -#endif -#include -#endif /* ACE_LACKS_NUMERIC_LIMITS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Define some simple macros to clarify the code. -#define ACE_HEAP_PARENT(X) (X == 0 ? 0 : (((X) - 1) / 2)) -#define ACE_HEAP_LCHILD(X) (((X)+(X))+1) - -// Constructor that takes in an to iterate over. - -template -ACE_Timer_Heap_Iterator_T::ACE_Timer_Heap_Iterator_T (ACE_Timer_Heap_T &heap) - : timer_heap_ (heap) -{ - ACE_TRACE ("ACE_Timer_Heap_Iterator_T::ACE_Timer_Heap_Iterator"); - this->first(); -} - -template -ACE_Timer_Heap_Iterator_T::~ACE_Timer_Heap_Iterator_T (void) -{ -} - -// Positions the iterator at the first node in the heap array - -template void -ACE_Timer_Heap_Iterator_T::first (void) -{ - this->position_ = 0; -} - -// Positions the iterator at the next node in the heap array - -template void -ACE_Timer_Heap_Iterator_T::next (void) -{ - if (this->position_ != this->timer_heap_.cur_size_) - this->position_++; -} - -// Returns true the is at the end of the heap array - -template int -ACE_Timer_Heap_Iterator_T::isdone (void) const -{ - return this->position_ == this->timer_heap_.cur_size_; -} - -// Returns the node at the current position in the heap or 0 if at the end - -template ACE_Timer_Node_T * -ACE_Timer_Heap_Iterator_T::item (void) -{ - if (this->position_ != this->timer_heap_.cur_size_) - return this->timer_heap_.heap_[this->position_]; - return 0; -} - -// Constructor -// Note that timer_ids_curr_ and timer_ids_min_free_ both start at 0. -// Since timer IDs are assigned by first incrementing the timer_ids_curr_ -// value, the first ID assigned will be 1 (just as in the previous design). -// When it's time to wrap, the next ID given out will be 0. -template -ACE_Timer_Heap_T::ACE_Timer_Heap_T (size_t size, - int preallocate, - FUNCTOR *upcall_functor, - ACE_Free_List > *freelist) - : ACE_Timer_Queue_T (upcall_functor, freelist), - max_size_ (size), - cur_size_ (0), - cur_limbo_ (0), - timer_ids_curr_ (0), - timer_ids_min_free_ (0), - preallocated_nodes_ (0), - preallocated_nodes_freelist_ (0) -{ - ACE_TRACE ("ACE_Timer_Heap_T::ACE_Timer_Heap_T"); - - // Possibly reduce size to fit in a long. -#if !defined(ACE_LACKS_NUMERIC_LIMITS) - if (size > static_cast (std::numeric_limits::max ())) - { - size = static_cast (std::numeric_limits::max ()); - this->max_size_ = size; - } -#else - if (size > LONG_MAX) - { - size = LONG_MAX; - this->max_size_ = size; - } -#endif /* ACE_LACKS_NUMERIC_LIMITS */ - - // Create the heap array. - ACE_NEW (this->heap_, - ACE_Timer_Node_T *[size]); - - // Create the parallel - ACE_NEW (this->timer_ids_, - ssize_t[size]); - - // Initialize the "freelist," which uses negative values to - // distinguish freelist elements from "pointers" into the - // array. - for (size_t i = 0; i < size; i++) - this->timer_ids_[i] = -1; - - if (preallocate) - { - ACE_NEW (this->preallocated_nodes_, - ACE_Timer_Node_T[size]); - - // Add allocated array to set of such arrays for deletion on - // cleanup. - this->preallocated_node_set_.insert (this->preallocated_nodes_); - - // Form the freelist by linking the next_ pointers together. - for (size_t j = 1; j < size; j++) - this->preallocated_nodes_[j - 1].set_next (&this->preallocated_nodes_[j]); - - // NULL-terminate the freelist. - this->preallocated_nodes_[size - 1].set_next (0); - - // Assign the freelist pointer to the front of the list. - this->preallocated_nodes_freelist_ = - &this->preallocated_nodes_[0]; - } - - ACE_NEW (iterator_, - HEAP_ITERATOR (*this)); -} - -// Note that timer_ids_curr_ and timer_ids_min_free_ both start at 0. -// Since timer IDs are assigned by first incrementing the timer_ids_curr_ -// value, the first ID assigned will be 1 (just as in the previous design). -// When it's time to wrap, the next ID given out will be 0. -template -ACE_Timer_Heap_T::ACE_Timer_Heap_T (FUNCTOR *upcall_functor, - ACE_Free_List > *freelist) - : ACE_Timer_Queue_T (upcall_functor, freelist), - max_size_ (ACE_DEFAULT_TIMERS), - cur_size_ (0), - cur_limbo_ (0), - timer_ids_curr_ (0), - timer_ids_min_free_ (0), - preallocated_nodes_ (0), - preallocated_nodes_freelist_ (0) -{ - ACE_TRACE ("ACE_Timer_Heap_T::ACE_Timer_Heap_T"); - - // Possibly reduce size to fit in a long. -#if !defined(ACE_LACKS_NUMERIC_LIMITS) - if (this->max_size_ > static_cast (std::numeric_limits::max ())) - this->max_size_ = static_cast (std::numeric_limits::max ()); -#else - if (this->max_size_ > LONG_MAX) - this->max_size_ = LONG_MAX; -#endif /* ACE_LACKS_NUMERIC_LIMITS */ - - // Create the heap array. -#if defined (__IBMCPP__) && (__IBMCPP__ >= 400) && defined (_WINDOWS) - ACE_NEW (this->heap_, - ACE_Timer_Node_T *[ACE_DEFAULT_TIMERS]); -#else - ACE_NEW (this->heap_, - ACE_Timer_Node_T *[this->max_size_]); -#endif /* defined (__IBMCPP__) && (__IBMCPP__ >= 400) && defined (_WINDOWS) */ - - // Create the parallel array. - ACE_NEW (this->timer_ids_, - ssize_t[this->max_size_]); - - // Initialize the "freelist," which uses negative values to - // distinguish freelist elements from "pointers" into the - // array. - for (size_t i = 0; i < this->max_size_; i++) - this->timer_ids_[i] = -1; - - ACE_NEW (iterator_, - HEAP_ITERATOR (*this)); -} - -template -ACE_Timer_Heap_T::~ACE_Timer_Heap_T (void) -{ - ACE_TRACE ("ACE_Timer_Heap_T::~ACE_Timer_Heap_T"); - - delete iterator_; - - size_t current_size = - this->cur_size_; - - // Clean up all the nodes still in the queue - for (size_t i = 0; i < current_size; i++) - { - // Grab the event_handler and act, then delete the node before calling - // back to the handler. Prevents a handler from trying to cancel_timer() - // inside handle_close(), ripping the current timer node out from - // under us. - TYPE eh = this->heap_[i]->get_type (); - const void *act = this->heap_[i]->get_act (); - this->free_node (this->heap_[i]); - this->upcall_functor ().deletion (*this, eh, act); - } - - delete [] this->heap_; - delete [] this->timer_ids_; - - // clean up any preallocated timer nodes - if (preallocated_nodes_ != 0) - { - ACE_Unbounded_Set_Iterator *> - set_iterator (this->preallocated_node_set_); - - for (ACE_Timer_Node_T **entry = 0; - set_iterator.next (entry) !=0; - set_iterator.advance ()) - delete [] *entry; - } -} - -template long -ACE_Timer_Heap_T::pop_freelist (void) -{ - ACE_TRACE ("ACE_Timer_Heap_T::pop_freelist"); - - // Scan for a free timer ID. Note that since this function is called - // _after_ the check for a full timer heap, we are guaranteed to find - // a free ID, even if we need to wrap around and start reusing freed IDs. - // On entry, the curr_ index is at the previous ID given out; start - // up where we left off last time. - // NOTE - a timer_ids_ slot with -2 is out of the heap, but not freed. - // It must be either freed (free_node) or rescheduled (reschedule). - ++this->timer_ids_curr_; - while (this->timer_ids_curr_ < this->max_size_ && - (this->timer_ids_[this->timer_ids_curr_] >= 0 || - this->timer_ids_[this->timer_ids_curr_] == -2 )) - ++this->timer_ids_curr_; - if (this->timer_ids_curr_ == this->max_size_) - { - ACE_ASSERT (this->timer_ids_min_free_ < this->max_size_); - this->timer_ids_curr_ = this->timer_ids_min_free_; - // We restarted the free search at min. Since min won't be - // free anymore, and curr_ will just keep marching up the list - // on each successive need for an ID, reset min_free_ to the - // size of the list until an ID is freed that curr_ has already - // gone past (see push_freelist). - this->timer_ids_min_free_ = this->max_size_; - } - - return static_cast (this->timer_ids_curr_); -} - -template void -ACE_Timer_Heap_T::push_freelist (long old_id) -{ - ACE_TRACE ("ACE_Timer_Heap_T::push_freelist"); - - // Since this ID has already been checked by one of the public - // functions, it's safe to cast it here. - size_t oldid = size_t (old_id); - - // The freelist values in the are negative, so set the - // freed entry back to 'free'. If this is the new lowest value free - // timer ID that curr_ won't see on it's normal march through the list, - // remember it. - ACE_ASSERT (this->timer_ids_[oldid] >= 0 || this->timer_ids_[oldid] == -2); - if (this->timer_ids_[oldid] == -2) - --this->cur_limbo_; - else - --this->cur_size_; - this->timer_ids_[oldid] = -1; - if (oldid < this->timer_ids_min_free_ && oldid <= this->timer_ids_curr_) - this->timer_ids_min_free_ = oldid; - return; -} - -template long -ACE_Timer_Heap_T::timer_id (void) -{ - ACE_TRACE ("ACE_Timer_Heap_T::timer_id"); - - // Return the next item off the freelist and use it as the timer id. - return this->pop_freelist (); -} - -// Checks if queue is empty. - -template int -ACE_Timer_Heap_T::is_empty (void) const -{ - ACE_TRACE ("ACE_Timer_Heap_T::is_empty"); - return this->cur_size_ == 0; -} - -template ACE_Timer_Queue_Iterator_T & -ACE_Timer_Heap_T::iter (void) -{ - this->iterator_->first (); - return *this->iterator_; -} - -// Returns earliest time in a non-empty queue. - -template const ACE_Time_Value & -ACE_Timer_Heap_T::earliest_time (void) const -{ - ACE_TRACE ("ACE_Timer_Heap_T::earliest_time"); - return this->heap_[0]->get_timer_value (); -} - -template void -ACE_Timer_Heap_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Timer_Heap_T::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nmax_size_ = %d"), this->max_size_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncur_size_ = %d"), this->cur_size_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncur_limbo_= %d"), this->cur_limbo_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nids_curr_ = %d"), - this->timer_ids_curr_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nmin_free_ = %d"), - this->timer_ids_min_free_)); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nheap_ = \n"))); - - for (size_t i = 0; i < this->cur_size_; i++) - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("%d\n"), - i)); - this->heap_[i]->dump (); - } - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntimer_ids_ = \n"))); - - for (size_t j = 0; j < this->max_size_; j++) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("%d\t%d\n"), - j, - this->timer_ids_[j])); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template void -ACE_Timer_Heap_T::copy (size_t slot, - ACE_Timer_Node_T *moved_node) -{ - // Insert into its new location in the heap. - this->heap_[slot] = moved_node; - - ACE_ASSERT (moved_node->get_timer_id () >= 0 - && moved_node->get_timer_id () < (int) this->max_size_); - - // Update the corresponding slot in the parallel array. - this->timer_ids_[moved_node->get_timer_id ()] = slot; -} - -// Remove the slot'th timer node from the heap, but do not reclaim its -// timer ID or change the size of this timer heap object. The caller of -// this function must call either free_node (to reclaim the timer ID -// and the timer node memory, as well as decrement the size of the queue) -// or reschedule (to reinsert the node in the heap at a new time). -template ACE_Timer_Node_T * -ACE_Timer_Heap_T::remove (size_t slot) -{ - ACE_Timer_Node_T *removed_node = - this->heap_[slot]; - - // NOTE - the cur_size_ is being decremented since the queue has one - // less active timer in it. However, this ACE_Timer_Node is not being - // freed, and there is still a place for it in timer_ids_ (the timer ID - // is not being relinquished). The node can still be rescheduled, or - // it can be freed via free_node. - --this->cur_size_; - - // Only try to reheapify if we're not deleting the last entry. - - if (slot < this->cur_size_) - { - ACE_Timer_Node_T *moved_node = - this->heap_[this->cur_size_]; - - // Move the end node to the location being removed and update - // the corresponding slot in the parallel array. - this->copy (slot, moved_node); - - // If the time_value_> is great than or equal its - // parent it needs be moved down the heap. - size_t parent = ACE_HEAP_PARENT (slot); - - if (moved_node->get_timer_value () - >= this->heap_[parent]->get_timer_value ()) - this->reheap_down (moved_node, - slot, - ACE_HEAP_LCHILD (slot)); - else - this->reheap_up (moved_node, - slot, - parent); - } - - this->timer_ids_[removed_node->get_timer_id ()] = -2; - ++this->cur_limbo_; - return removed_node; -} - -template void -ACE_Timer_Heap_T::reheap_down (ACE_Timer_Node_T *moved_node, - size_t slot, - size_t child) -{ - // Restore the heap property after a deletion. - - while (child < this->cur_size_) - { - // Choose the smaller of the two children. - if (child + 1 < this->cur_size_ - && this->heap_[child + 1]->get_timer_value () - < this->heap_[child]->get_timer_value ()) - child++; - - // Perform a if the child has a larger timeout value than - // the . - if (this->heap_[child]->get_timer_value () - < moved_node->get_timer_value ()) - { - this->copy (slot, - this->heap_[child]); - slot = child; - child = ACE_HEAP_LCHILD (child); - } - else - // We've found our location in the heap. - break; - } - - this->copy (slot, moved_node); -} - -template void -ACE_Timer_Heap_T::reheap_up (ACE_Timer_Node_T *moved_node, - size_t slot, - size_t parent) -{ - // Restore the heap property after an insertion. - - while (slot > 0) - { - // If the parent node is greater than the we need - // to copy it down. - if (moved_node->get_timer_value () - < this->heap_[parent]->get_timer_value ()) - { - this->copy (slot, this->heap_[parent]); - slot = parent; - parent = ACE_HEAP_PARENT (slot); - } - else - break; - } - - // Insert the new node into its proper resting place in the heap and - // update the corresponding slot in the parallel array. - this->copy (slot, - moved_node); -} - -template void -ACE_Timer_Heap_T::insert (ACE_Timer_Node_T *new_node) -{ - if (this->cur_size_ + this->cur_limbo_ + 2 >= this->max_size_) - this->grow_heap (); - - this->reheap_up (new_node, - this->cur_size_, - ACE_HEAP_PARENT (this->cur_size_)); - this->cur_size_++; -} - -template void -ACE_Timer_Heap_T::grow_heap (void) -{ - // All the containers will double in size from max_size_. - size_t new_size = this->max_size_ * 2; - -#if 0 - // Yikes - there's no way to flag a failure of going out of range of - // a 'long' - this is a problem that should be addressed at some point. -#if !defined(ACE_LACKS_NUMERIC_LIMITS) - if (new_size > std::numeric_limits::max ()) - new_size = std::numeric_limits::max (); -#else - if (new_size > LONG_MAX) - new_size = LONG_MAX; -#endif /* ACE_LACKS_NUMERIC_LIMITS */ - - if (new_size <= this->max_size_) // We are already at the limit - { - errno = ENOMEM; - return -1; - } -#endif /* 0 */ - - // First grow the heap itself. - - ACE_Timer_Node_T **new_heap = 0; - -#if defined (__IBMCPP__) && (__IBMCPP__ >= 400) && defined (_WINDOWS) - ACE_NEW (new_heap, - ACE_Timer_Node_T *[1024]); -#else - ACE_NEW (new_heap, - ACE_Timer_Node_T *[new_size]); -#endif /* defined (__IBMCPP__) && (__IBMCPP__ >= 400) && defined (_WINDOWS) */ - ACE_OS::memcpy (new_heap, - this->heap_, - this->max_size_ * sizeof *new_heap); - delete [] this->heap_; - this->heap_ = new_heap; - - // Grow the array of timer ids. - - ssize_t *new_timer_ids = 0; - - ACE_NEW (new_timer_ids, - ssize_t[new_size]); - - ACE_OS::memcpy (new_timer_ids, - this->timer_ids_, - this->max_size_ * sizeof (ssize_t)); - - delete [] timer_ids_; - this->timer_ids_ = new_timer_ids; - - // And add the new elements to the end of the "freelist". - for (size_t i = this->max_size_; i < new_size; i++) - this->timer_ids_[i] = -(static_cast (i) + 1); - - // Grow the preallocation array (if using preallocation) - if (this->preallocated_nodes_ != 0) - { - // Create a new array with max_size elements to link in to - // existing list. -#if defined (__IBMCPP__) && (__IBMCPP__ >= 400) && defined (_WINDOWS) - ACE_NEW (this->preallocated_nodes_, - ACE_Timer_Node_T[88]); -#else - ACE_NEW (this->preallocated_nodes_, - ACE_Timer_Node_T[this->max_size_]); -#endif /* defined (__IBMCPP__) && (__IBMCPP__ >= 400) && defined (_WINDOWS) */ - - // Add it to the set for later deletion - this->preallocated_node_set_.insert (this->preallocated_nodes_); - - // Link new nodes together (as for original list). - for (size_t k = 1; k < this->max_size_; k++) - this->preallocated_nodes_[k - 1].set_next (&this->preallocated_nodes_[k]); - - // NULL-terminate the new list. - this->preallocated_nodes_[this->max_size_ - 1].set_next (0); - - // Link new array to the end of the existling list. - if (this->preallocated_nodes_freelist_ == 0) - this->preallocated_nodes_freelist_ = - &preallocated_nodes_[0]; - else - { - ACE_Timer_Node_T *previous = - this->preallocated_nodes_freelist_; - - for (ACE_Timer_Node_T *current = this->preallocated_nodes_freelist_->get_next (); - current != 0; - current = current->get_next ()) - previous = current; - - previous->set_next (&this->preallocated_nodes_[0]); - } - } - - this->max_size_ = new_size; - // Force rescan of list from beginning for a free slot (I think...) - // This fixed Bugzilla #2447. - this->timer_ids_min_free_ = this->max_size_; -} - -// Reschedule a periodic timer. This function must be called with the -// mutex lock held. - -template void -ACE_Timer_Heap_T::reschedule (ACE_Timer_Node_T *expired) -{ - ACE_TRACE ("ACE_Timer_Heap_T::reschedule"); - - // If we are rescheduling, then the most recent call was to - // remove_first (). That called remove () to remove the node from the - // heap, but did not free the timer ID. The ACE_Timer_Node still has - // its assigned ID - just needs to be inserted at the new proper - // place, and the heap restored properly. - if (this->timer_ids_[expired->get_timer_id ()] == -2) - --this->cur_limbo_; - this->insert (expired); -} - -template ACE_Timer_Node_T * -ACE_Timer_Heap_T::alloc_node (void) -{ - ACE_Timer_Node_T *temp = 0; - - // Only allocate a node if we are *not* using the preallocated heap. - if (this->preallocated_nodes_ == 0) - ACE_NEW_RETURN (temp, - ACE_Timer_Node_T, - 0); - else - { - // check to see if the heap needs to grow - if (this->preallocated_nodes_freelist_ == 0) - this->grow_heap (); - - temp = this->preallocated_nodes_freelist_; - - // Remove the first element from the freelist. - this->preallocated_nodes_freelist_ = - this->preallocated_nodes_freelist_->get_next (); - } - return temp; -} - -template void -ACE_Timer_Heap_T::free_node (ACE_Timer_Node_T *node) -{ - // Return this timer id to the freelist. - this->push_freelist (node->get_timer_id ()); - - // Only free up a node if we are *not* using the preallocated heap. - if (this->preallocated_nodes_ == 0) - delete node; - else - { - node->set_next (this->preallocated_nodes_freelist_); - this->preallocated_nodes_freelist_ = node; - } -} - -// Insert a new timer that expires at time future_time; if interval is -// > 0, the handler will be reinvoked periodically. - -template long -ACE_Timer_Heap_T::schedule_i (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Timer_Heap_T::schedule_i"); - - if ((this->cur_size_ + this->cur_limbo_) < this->max_size_) - { - // Obtain the next unique sequence number. - long timer_id = this->timer_id (); - - // Obtain the memory to the new node. - ACE_Timer_Node_T *temp = 0; - - ACE_ALLOCATOR_RETURN (temp, - this->alloc_node (), - -1); - temp->set (type, - act, - future_time, - interval, - 0, - timer_id); - - this->insert (temp); - return timer_id; - } - else - return -1; -} - -// Locate and remove the single timer with a value of from -// the timer queue. - -template int -ACE_Timer_Heap_T::cancel (long timer_id, - const void **act, - int dont_call) -{ - ACE_TRACE ("ACE_Timer_Heap_T::cancel"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - // Locate the ACE_Timer_Node that corresponds to the timer_id. - - // Check to see if the timer_id is out of range - if (timer_id < 0 - || (size_t) timer_id > this->max_size_) - return 0; - - ssize_t timer_node_slot = this->timer_ids_[timer_id]; - - // Check to see if timer_id is still valid. - if (timer_node_slot < 0) - return 0; - - if (timer_id != this->heap_[timer_node_slot]->get_timer_id ()) - { - ACE_ASSERT (timer_id == this->heap_[timer_node_slot]->get_timer_id ()); - return 0; - } - else - { - ACE_Timer_Node_T *temp = - this->remove (timer_node_slot); - - // Call the close hooks. - int cookie = 0; - - // cancel_type() called once per . - this->upcall_functor ().cancel_type (*this, - temp->get_type (), - dont_call, - cookie); - - // cancel_timer() called once per . - this->upcall_functor ().cancel_timer (*this, - temp->get_type (), - dont_call, - cookie); - - if (act != 0) - *act = temp->get_act (); - - this->free_node (temp); - return 1; - } -} - -// Locate and update the inteval on the timer_id - -template int -ACE_Timer_Heap_T::reset_interval (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Timer_Heap_T::reset_interval"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - // Locate the ACE_Timer_Node that corresponds to the timer_id. - - // Check to see if the timer_id is out of range - if (timer_id < 0 - || (size_t) timer_id > this->max_size_) - return -1; - - ssize_t timer_node_slot = this->timer_ids_[timer_id]; - - // Check to see if timer_id is still valid. - if (timer_node_slot < 0) - return -1; - - if (timer_id != this->heap_[timer_node_slot]->get_timer_id ()) - { - ACE_ASSERT (timer_id == this->heap_[timer_node_slot]->get_timer_id ()); - return -1; - } - else - { - // Reset the timer interval - this->heap_[timer_node_slot]->set_interval (interval); - return 0; - } -} - -// Locate and remove all values of from the timer queue. - -template int -ACE_Timer_Heap_T::cancel (const TYPE &type, - int dont_call) -{ - ACE_TRACE ("ACE_Timer_Heap_T::cancel"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - int number_of_cancellations = 0; - - // Try to locate the ACE_Timer_Node that matches the timer_id. - - for (size_t i = 0; i < this->cur_size_; ) - { - if (this->heap_[i]->get_type () == type) - { - ACE_Timer_Node_T *temp = this->remove (i); - - number_of_cancellations++; - - this->free_node (temp); - - // We reset to zero so that we don't miss checking any nodes - // if a reheapify occurs when a node is removed. There - // may be a better fix than this, however. - i = 0; - } - else - i++; - } - - // Call the close hooks. - int cookie = 0; - - // cancel_type() called once per . - this->upcall_functor ().cancel_type (*this, - type, - dont_call, - cookie); - - for (int j = 0; - j < number_of_cancellations; - ++j) - { - // cancel_timer() called once per . - this->upcall_functor ().cancel_timer (*this, - type, - dont_call, - cookie); - } - - return number_of_cancellations; -} - -// Returns the earliest node or returns 0 if the heap is empty. - -template ACE_Timer_Node_T * -ACE_Timer_Heap_T::remove_first (void) -{ - ACE_TRACE ("ACE_Timer_Heap_T::remove_first"); - - if (this->cur_size_ == 0) - return 0; - - return this->remove (0); -} - -template ACE_Timer_Node_T * -ACE_Timer_Heap_T::get_first (void) -{ - ACE_TRACE ("ACE_Timer_Heap_T::get_first"); - - return this->cur_size_ == 0 ? 0 : this->heap_[0]; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TIMER_HEAP_T_CPP */ diff --git a/ace/Timer_Heap_T.h b/ace/Timer_Heap_T.h deleted file mode 100644 index efe29a0f5f3..00000000000 --- a/ace/Timer_Heap_T.h +++ /dev/null @@ -1,338 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timer_Heap_T.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_TIMER_HEAP_T_H -#define ACE_TIMER_HEAP_T_H -#include /**/ "ace/pre.h" - -#include "ace/Timer_Queue_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Free_List.h" -#include "ace/Unbounded_Set.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration -template -class ACE_Timer_Heap_T; - -/** - * @class ACE_Timer_Heap_Iterator_T - * - * @brief Iterates over an . - * - * This is a generic iterator that can be used to visit every - * node of a timer queue. Be aware that it doesn't transverse - * in the order of timeout values. - */ -template -class ACE_Timer_Heap_Iterator_T : public ACE_Timer_Queue_Iterator_T -{ -public: - /// Constructor. - ACE_Timer_Heap_Iterator_T (ACE_Timer_Heap_T &); - - /// Destructor. - ~ACE_Timer_Heap_Iterator_T (void); - - /// Positions the iterator at the earliest node in the Timer Queue - virtual void first (void); - - /// Positions the iterator at the next node in the Timer Queue - virtual void next (void); - - /// Returns true when there are no more nodes in the sequence - virtual int isdone (void) const; - - /// Returns the node at the current position in the sequence - virtual ACE_Timer_Node_T *item (void); - -protected: - /// Pointer to the ACE_Timer_Heap that we are iterating over. - ACE_Timer_Heap_T &timer_heap_; - - /// Position in the array where the iterator is at - size_t position_; -}; - -/** - * @class ACE_Timer_Heap_T - * - * @brief Provides a very fast and predictable timer implementation. - * - * This implementation uses a heap-based callout queue of - * absolute times. Therefore, in the average and worst case, - * scheduling, canceling, and expiring timers is O(log N) (where - * N is the total number of timers). In addition, we can also - * preallocate as many @c ACE_Timer_Node objects as there are slots - * in the heap. This allows us to completely remove the need for - * dynamic memory allocation, which is important for real-time - * systems. - */ -template -class ACE_Timer_Heap_T : public ACE_Timer_Queue_T -{ -public: - typedef ACE_Timer_Heap_Iterator_T HEAP_ITERATOR; - friend class ACE_Timer_Heap_Iterator_T; - - typedef ACE_Timer_Queue_T INHERITED; - - // = Initialization and termination methods. - /** - * The Constructor creates a heap with specified number of elements. - * This can also take in a upcall functor and freelist (if 0, then - * defaults will be created). - * - * @param size The maximum number of timers that can be - * inserted into the new object. - * @param preallocated Default 0, if non-0 then all the memory - * for the @c ACE_Timer_Node objects will be pre-allocated. This saves - * time and is more predictable (though it requires more space). - * Otherwise, timer nodes are allocated as needed. - * @param freelist is the freelist of timer nodes. - * @param upcall_functor If 0 Timer Heap will create a default FUNCTOR. - */ - ACE_Timer_Heap_T (size_t size, - int preallocated = 0, - FUNCTOR *upcall_functor = 0, - ACE_Free_List > *freelist = 0); - - /** - * Default constructor. @c upcall_functor is the instance of the - * FUNCTOR to be used by the queue. If @c upcall_functor is 0, Timer - * Heap will create a default FUNCTOR. @c freelist is the freelist of - * timer nodes. If 0, then a default freelist will be created. The default - * size will be ACE_DEFAULT_TIMERS and there will be no preallocation. - */ - ACE_Timer_Heap_T (FUNCTOR *upcall_functor = 0, - ACE_Free_List > *freelist = 0); - - /// Destructor. - virtual ~ACE_Timer_Heap_T (void); - - /// True if heap is empty, else false. - virtual int is_empty (void) const; - - /// Returns the time of the earliest node in the Timer_Queue. - /// Must be called on a non-empty queue. - virtual const ACE_Time_Value &earliest_time (void) const; - - /** - * Resets the interval of the timer represented by to - * , which is specified in relative time to the current - * . If is equal to - * , the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_interval (long timer_id, - const ACE_Time_Value &interval); - - /** - * Cancel all timers associated with . If is 0 - * then the will be invoked. Returns number of timers - * cancelled. - */ - virtual int cancel (const TYPE &type, - int dont_call_handle_close = 1); - - /** - * Cancel the single timer that matches the value (which - * was returned from the method). If act is non-NULL - * then it will be set to point to the ``magic cookie'' argument - * passed in when the timer was registered. This makes it possible - * to free up the memory and avoid memory leaks. If is - * 0 then the will be invoked. Returns 1 if cancellation - * succeeded and 0 if the wasn't found. - */ - virtual int cancel (long timer_id, - const void **act = 0, - int dont_call_handle_close = 1); - - /// Returns a pointer to this ACE_Timer_Queue's iterator. - virtual ACE_Timer_Queue_Iterator_T &iter (void); - - /** - * Removes the earliest node from the queue and returns it. Note that - * the timer is removed from the heap, but is not freed, and its ID - * is not reclaimed. The caller is responsible for calling either - * @c reschedule() or @c free_node() after this function returns. Thus, - * this function is for support of @c ACE_Timer_Queue::expire and - * should not be used unadvisedly in other conditions. - */ - ACE_Timer_Node_T *remove_first (void); - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Reads the earliest node from the queue and returns it. - virtual ACE_Timer_Node_T *get_first (void); - -protected: - - /** - * Schedule a timer that may optionally auto-reset. - * Schedule that will expire at , - * which is specified in absolute time. If it expires then is - * passed in as the value to the . If is != to - * then it is used to reschedule the - * automatically, using relative time to the current . - * This method returns a that uniquely identifies the the - * entry in an internal list. This can be used to - * cancel the timer before it expires. The cancellation ensures - * that are unique up to values of greater than 2 - * billion timers. As long as timers don't stay around longer than - * this there should be no problems with accidentally deleting the - * wrong timer. Returns -1 on failure (which is guaranteed never to - * be a valid ). - */ - virtual long schedule_i (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval); - - /// Reschedule an "interval" . - virtual void reschedule (ACE_Timer_Node_T *); - - /// Factory method that allocates a new node (uses operator new if - /// we're *not* preallocating, otherwise uses an internal freelist). - virtual ACE_Timer_Node_T *alloc_node (void); - - /** - * Factory method that frees a previously allocated node (uses - * operator delete if we're *not* preallocating, otherwise uses an - * internal freelist). - */ - virtual void free_node (ACE_Timer_Node_T *); - -private: - /// Remove and return the th and restore the - /// heap property. - ACE_Timer_Node_T *remove (size_t slot); - - /// Insert @a new_node into the heap and restore the heap property. - void insert (ACE_Timer_Node_T *new_node); - - /** - * Doubles the size of the heap and the corresponding timer_ids array. - * If preallocation is used, will also double the size of the - * preallocated array of ACE_Timer_Nodes. - */ - void grow_heap (void); - - /// Restore the heap property, starting at . - void reheap_up (ACE_Timer_Node_T *new_node, - size_t slot, - size_t parent); - - /// Restore the heap property, starting at . - void reheap_down (ACE_Timer_Node_T *moved_node, - size_t slot, - size_t child); - - /// Copy into the slot of and move - /// into the corresponding slot in the array. - void copy (size_t slot, ACE_Timer_Node_T *moved_node); - - /** - * Returns a timer id that uniquely identifies this timer. This id - * can be used to cancel a timer via the method. The - * timer id returned from this method will never == -1 to avoid - * conflicts with other failure return values. - */ - long timer_id (void); - - /// Pops and returns a new timer id from the freelist. - long pop_freelist (void); - - /// Pushes onto the freelist. - void push_freelist (long old_id); - - /// Maximum size of the heap. - size_t max_size_; - - /// Current size of the heap. - size_t cur_size_; - - /// Number of heap entries in transition (removed from the queue, but - /// not freed) and may be rescheduled or freed. - size_t cur_limbo_; - - /// Iterator used to expire timers. - HEAP_ITERATOR *iterator_; - - /** - * Current contents of the Heap, which is organized as a "heap" of - * *'s. In this context, a heap is a "partially - * ordered, almost complete" binary tree, which is stored in an - * array. - */ - ACE_Timer_Node_T **heap_; - - /** - * An array of "pointers" that allows each in the - * to be located in O(1) time. Basically, - * contains the slot in the array where an - * * with timer id \ resides. Thus, the timer id passed back from - * is really a slot into the array. The - * array serves two purposes: negative values are - * indications of free timer IDs, whereas positive values are - * "pointers" into the array for assigned timer IDs. - */ - ssize_t *timer_ids_; - - /// "Pointer" to the element in the array that was - /// last given out as a timer ID. - size_t timer_ids_curr_; - - /// Index representing the lowest timer ID that has been freed. When - /// the timer_ids_next_ value wraps around, it starts back at this - /// point. - size_t timer_ids_min_free_; - - /** - * If this is non-0, then we preallocate number of - * objects in order to reduce dynamic allocation - * costs. In auto-growing implementation, this points to the - * last array of nodes allocated. - */ - ACE_Timer_Node_T *preallocated_nodes_; - - /// This points to the head of the freelist, - /// which is organized as a stack. - ACE_Timer_Node_T *preallocated_nodes_freelist_; - - /// Set of pointers to the arrays of preallocated timer nodes. - /// Used to delete the allocated memory when required. - ACE_Unbounded_Set *> preallocated_node_set_; - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Heap_T (const ACE_Timer_Heap_T &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Heap_T &)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) && !defined(ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_Heap_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE && !ACE_HAS_BROKEN_HPUX_TEMPLATES */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Timer_Heap_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_HEAP_T_H */ diff --git a/ace/Timer_List.cpp b/ace/Timer_List.cpp deleted file mode 100644 index d94976115b5..00000000000 --- a/ace/Timer_List.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// $Id$ - -#include "ace/Timer_List.h" -#include "ace/Synch_Traits.h" -#include "ace/Recursive_Thread_Mutex.h" - -ACE_RCSID(ace, Timer_List, "$Id$") - -#if defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_Hash.h" -#include "ace/Timer_List_T.cpp" -#endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ - diff --git a/ace/Timer_List.h b/ace/Timer_List.h deleted file mode 100644 index 0bc689465ea..00000000000 --- a/ace/Timer_List.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timer_List.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_TIMER_LIST_H -#define ACE_TIMER_LIST_H -#include /**/ "ace/pre.h" - -#include "ace/Timer_List_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The following typedefs are here for ease of use and backward -// compatibility. - -typedef ACE_Timer_List_T, - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Timer_List; - -typedef ACE_Timer_List_Iterator_T, - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Timer_List_Iterator; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_LIST_H */ diff --git a/ace/Timer_List_T.cpp b/ace/Timer_List_T.cpp deleted file mode 100644 index 60a116bb835..00000000000 --- a/ace/Timer_List_T.cpp +++ /dev/null @@ -1,416 +0,0 @@ -// $Id$ - -#ifndef ACE_TIMER_LIST_T_C -#define ACE_TIMER_LIST_T_C - -#include "ace/Timer_List_T.h" -#include "ace/Guard_T.h" -#include "ace/Log_Msg.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_RCSID(ace, Timer_List_T, "$Id$") - -// Default Constructor - -template -ACE_Timer_List_Iterator_T::ACE_Timer_List_Iterator_T (List& lst) - : list_ (lst) -{ - this->first(); -} - -template -ACE_Timer_List_Iterator_T::~ACE_Timer_List_Iterator_T (void) -{ -} - -// Positions the iterator at the node right after the dummy node - -template void -ACE_Timer_List_Iterator_T::first (void) -{ - this->current_node_ = this->list_.get_first(); -} - -// Positions the iterator at the next node in the Timer Queue - -template void -ACE_Timer_List_Iterator_T::next (void) -{ - // Make sure that if we are at the end, we don't wrap around - if (! this->isdone()) - this->current_node_ = this->current_node_->get_next (); - if (this->current_node_ == this->list_.head_) - this->current_node_ = 0; -} - -// Returns true when we are at - -template int -ACE_Timer_List_Iterator_T::isdone (void) const -{ - return this->current_node_ == 0; -} - -// Returns the node at or 0 if we are at the end - -template ACE_Timer_Node_T * -ACE_Timer_List_Iterator_T::item (void) -{ - if (! this->isdone()) - return this->current_node_; - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// Return our instance of the iterator - -template ACE_Timer_Queue_Iterator_T & -ACE_Timer_List_T::iter (void) -{ - this->iterator_->first (); - return *this->iterator_; -} - -// Create an empty list. - -template -ACE_Timer_List_T::ACE_Timer_List_T (FUNCTOR* uf, FreeList* fl) - : Base(uf, fl) - , head_ (new ACE_Timer_Node_T) - , id_counter_ (0) -{ - ACE_TRACE ("ACE_Timer_List_T::ACE_Timer_List_T"); - - this->head_->set_next (this->head_); - this->head_->set_prev (this->head_); - - ACE_NEW (iterator_, Iterator(*this)); -} - - -// Checks if list is empty. - -template int -ACE_Timer_List_T::is_empty (void) const -{ - ACE_TRACE ("ACE_Timer_List_T::is_empty"); - return this->get_first_i() == 0; -} - - -// Returns earliest time in a non-empty list. - -template const ACE_Time_Value & -ACE_Timer_List_T::earliest_time (void) const -{ - ACE_TRACE ("ACE_Timer_List_T::earliest_time"); - ACE_Timer_Node_T* first = this->get_first_i(); - if (first != 0) - return first->get_timer_value (); - return ACE_Time_Value::zero; -} - - -// Remove all remaining items in the list. - -template -ACE_Timer_List_T::~ACE_Timer_List_T (void) -{ - ACE_TRACE ("ACE_Timer_List_T::~ACE_Timer_List_T"); - ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); - - delete iterator_; - - if (!this->is_empty()) - { - for (ACE_Timer_Node_T* n = this->get_first(); - n != this->head_; - ) - { - this->upcall_functor ().deletion (*this, - n->get_type(), - n->get_act()); - - ACE_Timer_Node_T *next = - n->get_next (); - - this->free_node (n); - - n = next; - } - } - - // delete the dummy node - delete this->head_; -} - -template void -ACE_Timer_List_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Timer_List_T::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - int count = 0; - - ACE_Timer_Node_T* n = this->get_first_i(); - if (n != 0) { - for (; n != this->head_; n = n->get_next()) { - ++count; - } - } - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nsize_ = %d"), count)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - - -// Reschedule a periodic timer. This function must be called with the -// lock held. - -template void -ACE_Timer_List_T::reschedule (ACE_Timer_Node_T* n) -{ - ACE_TRACE ("ACE_Timer_List_T::reschedule"); - this->schedule_i(n, n->get_timer_value()); -} - - -// Insert a new handler that expires at time future_time; if interval -// is > 0, the handler will be reinvoked periodically. - -template long -ACE_Timer_List_T::schedule_i (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Timer_List_T::schedule_i"); - - ACE_Timer_Node_T* n = this->alloc_node(); - - if (n != 0) - { - long id = this->id_counter_++; - - if (id != -1) { - n->set (type, act, future_time, interval, 0, 0, id); - this->schedule_i (n, future_time); - } - return id; - } - - // Failure return - errno = ENOMEM; - return -1; -} - -/// The shared scheduling functionality between schedule() and reschedule() -template void -ACE_Timer_List_T::schedule_i (ACE_Timer_Node_T* n, - const ACE_Time_Value& expire) -{ - if (this->is_empty()) { - n->set_prev(this->head_); - n->set_next(this->head_); - this->head_->set_prev(n); - this->head_->set_next(n); - return; - } - - // We always want to search backwards from the tail of the list, because - // this minimizes the search in the extreme case when lots of timers are - // scheduled for exactly the same time, and it also assumes that most of - // the timers will be scheduled later than existing timers. - ACE_Timer_Node_T* p = this->head_->get_prev(); - while (p != this->head_ && p->get_timer_value() > expire) - p = p->get_prev(); - - // insert after - n->set_prev(p); - n->set_next(p->get_next()); - p->get_next()->set_prev(n); - p->set_next(n); -} - -template -ACE_Timer_Node_T* -ACE_Timer_List_T::find_node (long timer_id) const -{ - ACE_Timer_Node_T* n = this->get_first_i(); - if (n == 0) - return 0; - - for (; n != this->head_; n = n->get_next()) { - if (n->get_timer_id() == timer_id) { - return n; - } - } - return 0; -} - -// Locate and update the inteval on the timer_id -template int -ACE_Timer_List_T::reset_interval (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Timer_List_T::reset_interval"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - ACE_Timer_Node_T* n = this->find_node(timer_id); - if (n != 0) { - n->set_interval(interval); // The interval will take effect the next time this node is expired. - return 0; - } - return -1; -} - -// Locate and remove the single with a value of -// from the timer queue. -template int -ACE_Timer_List_T::cancel (long timer_id, - const void **act, - int skip_close) -{ - ACE_TRACE ("ACE_Timer_List_T::cancel"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - ACE_Timer_Node_T* n = this->find_node(timer_id); - if (n != 0) - { - if (act != 0) - *act = n->get_act (); - - // Call the close hooks. - int cookie = 0; - - // cancel_type() called once per . - this->upcall_functor ().cancel_type (*this, - n->get_type (), - skip_close, - cookie); - - // cancel_timer() called once per . - this->upcall_functor ().cancel_timer (*this, - n->get_type (), - skip_close, - cookie); - - this->cancel_i (n); - - return 1; - } - - return 0; -} - -// Locate and remove all values of from the timer queue. -template int -ACE_Timer_List_T::cancel (const TYPE &type, int skip_close) -{ - ACE_TRACE ("ACE_Timer_List_T::cancel"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - int num_canceled = 0; // Note : Technically this can overflow. - - if (!this->is_empty ()) - { - for (ACE_Timer_Node_T* n = this->get_first(); - n != this->head_; - ) - { - if (n->get_type() == type) // Note: Typically Type is an ACE_Event_Handler* - { - ++num_canceled; - - ACE_Timer_Node_T* tmp = n; - n = n->get_next(); - - this->cancel_i (tmp); - } - else - { - n = n->get_next(); - } - } - } - - // Call the close hooks. - int cookie = 0; - - // cancel_type() called once per . - this->upcall_functor ().cancel_type (*this, - type, - skip_close, - cookie); - - for (int i = 0; - i < num_canceled; - ++i) - { - // cancel_timer() called once per . - this->upcall_functor ().cancel_timer (*this, - type, - skip_close, - cookie); - } - - return num_canceled; -} - -template void -ACE_Timer_List_T::unlink (ACE_Timer_Node_T* n) -{ - n->get_prev()->set_next(n->get_next()); - n->get_next()->set_prev(n->get_prev()); - n->set_prev(0); - n->set_next(0); -} - -/// Shared subset of the two cancel() methods. -template void -ACE_Timer_List_T::cancel_i (ACE_Timer_Node_T* n) -{ - this->unlink (n); - this->free_node (n); -} - -// Reads the first node on the list and returns it. -template ACE_Timer_Node_T * -ACE_Timer_List_T::get_first (void) -{ - ACE_TRACE ("ACE_Timer_List_T::get_first"); - return this->get_first_i(); -} - -template ACE_Timer_Node_T * -ACE_Timer_List_T::get_first_i (void) const -{ - ACE_TRACE ("ACE_Timer_List_T::get_first_i"); - ACE_Timer_Node_T* first = this->head_->get_next(); - if (first != this->head_) // Note : is_empty() uses get_first() - return first; - return 0; -} - - -// Removes the first node on the list and returns it. - -template ACE_Timer_Node_T * -ACE_Timer_List_T::remove_first (void) -{ - ACE_TRACE ("ACE_Timer_List_T::remove_first"); - ACE_Timer_Node_T* first = this->get_first(); - if (first != 0) { - this->unlink(first); - return first; - } - return 0; -} - -#endif /* ACE_TIMER_LIST_T_C */ diff --git a/ace/Timer_List_T.h b/ace/Timer_List_T.h deleted file mode 100644 index 763ef9c905c..00000000000 --- a/ace/Timer_List_T.h +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Timer_List_T.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_TIMER_LIST_T_H -#define ACE_TIMER_LIST_T_H -#include /**/ "ace/pre.h" - -#include "ace/Timer_Queue_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Forward declaration. -template -class ACE_Timer_List_T; - -/** - * @class ACE_Timer_List_Iterator_T - * - * @brief Iterates over an ACE_Timer_List. - * - * This is a generic iterator that can be used to visit every - * node of a timer queue. - */ -template -class ACE_Timer_List_Iterator_T -: public ACE_Timer_Queue_Iterator_T -{ -public: - typedef ACE_Timer_List_T List; - /// Constructor. - ACE_Timer_List_Iterator_T (List& lst); - - /// Destructor. - virtual ~ACE_Timer_List_Iterator_T (void); - - /// Positions the iterator at the earliest node in the Timer Queue - virtual void first (void); - - /// Positions the iterator at the next node in the Timer Queue - virtual void next (void); - - /// Returns true when there are no more nodes in the sequence - virtual int isdone (void) const; - - /// Returns the node at the current position in the sequence - virtual ACE_Timer_Node_T *item (void); - -protected: - /// Pointer to the ACE_Timer_List that we are iterating over. - List& list_; - - /// Current position in the ACE_Timer_List - ACE_Timer_Node_T* current_node_; -}; - -/** - * @class ACE_Timer_List_T - * - * @brief Provides a simple implementation of timers. - * - * This implementation uses a linked list of absolute times. - * Therefore, in the average case, scheduling and canceling - * timers is O(N) (where N is the total number of timers) and - * expiring timers is O(K) (where K is the total number of timers - * that are < the current time of day). - * More clever implementations could use a delta-list, a heap, - * or timing wheels, etc. For instance, ACE_Timer_Heap - * is a subclass of ACE_Timer_List that implements a - * heap-based callout queue. For most applications, the - * ACE_Timer_Heap will perform substantially faster than the - * ACE_Timer_List. - */ -template -class ACE_Timer_List_T : public ACE_Timer_Queue_T -{ -public: - /// Type of iterator - typedef ACE_Timer_List_Iterator_T Iterator; - - /// Iterator is a friend - friend class ACE_Timer_List_Iterator_T; - - typedef ACE_Timer_Node_T Node; - /// Type inherited from - typedef ACE_Timer_Queue_T Base; - typedef ACE_Free_List FreeList; - - // = Initialization and termination methods. - /** - * Default constructor. @a upcall_functor is the instance of the - * FUNCTOR to be used by the list. If @a upcall_functor is 0, a - * default FUNCTOR will be created. @a freelist is the freelist of - * timer nodes. If 0, then a default freelist will be created. - */ - ACE_Timer_List_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0); - - /// Destructor - virtual ~ACE_Timer_List_T (void); - - /// True if queue is empty, else false. - virtual int is_empty (void) const; - - /// Returns the time of the earlier node in the ACE_Timer_List. - /// Must be called on a non-empty queue. - virtual const ACE_Time_Value& earliest_time (void) const; - - /** - * Resets the interval of the timer represented by @a timer_id to - * @a interval, which is specified in relative time to the current - * . If @a interval is equal to - * ACE_Time_Value::zero, the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_interval (long timer_id, - const ACE_Time_Value& interval); - - /** - * Cancel all timers associated with @a type. If dont_call_handle_close is 0 - * then the @a functor will be invoked. Returns the number of timers - * cancelled. - */ - virtual int cancel (const TYPE& type, - int dont_call_handle_close = 1); - - /** - * Cancel the single timer that matches the @a timer_id value (which - * was returned from the method). If act is non-NULL - * then it will be set to point to the ``magic cookie'' argument - * passed in when the timer was registered. This makes it possible - * to free up the memory and avoid memory leaks. If is - * 0 then the will be invoked. Returns 1 if cancellation - * succeeded and 0 if the wasn't found. - */ - virtual int cancel (long timer_id, - const void** act = 0, - int dont_call_handle_close = 1); - - /// Returns a pointer to this ACE_Timer_Queue's iterator. - virtual ACE_Timer_Queue_Iterator_T& iter (void); - - /// Removes the earliest node from the queue and returns it - virtual ACE_Timer_Node_T* remove_first (void); - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Reschedule an "interval" ACE_Timer_Node_T. This should be private - /// but for now it needs to be public for - virtual void reschedule (ACE_Timer_Node_T *); - - /// Reads the earliest node from the queue and returns it. - virtual ACE_Timer_Node_T* get_first (void); - -private: - - /** - * Schedule that will expire at , which is - * specified in absolute time. If it expires then is passed - * in as the value to the . If is != to - * then it is used to reschedule the - * automatically, using relative time to the current . - * This method returns a that uniquely identifies the the - * entry in an internal list. This can be used to - * cancel the timer before it expires. The cancellation ensures - * that are unique up to values of greater than 2 - * billion timers. As long as timers don't stay around longer than - * this there should be no problems with accidentally deleting the - * wrong timer. Returns -1 on failure (which is guaranteed never to - * be a valid ). - */ - virtual long schedule_i (const TYPE& type, - const void* act, - const ACE_Time_Value& future_time, - const ACE_Time_Value& interval); - - void schedule_i(ACE_Timer_Node_T* n, const ACE_Time_Value& exp); - - ACE_Timer_Node_T* find_node(long timer_id) const; - - void cancel_i (ACE_Timer_Node_T* n); - - void unlink (ACE_Timer_Node_T* n); - - ACE_Timer_Node_T* get_first_i(void) const; - -private: - - /// Pointer to linked list of . - ACE_Timer_Node_T* head_; - - /// Iterator used to expire timers. - Iterator* iterator_; - - /** - * Keeps track of the timer id that uniquely identifies each timer. - * This id can be used to cancel a timer via the - * method. - */ - long id_counter_; - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_List_T (const ACE_Timer_List_T &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_List_T &)) -}; - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) && !defined(ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_List_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE && !ACE_HAS_BROKEN_HPUX_TEMPLATES */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Timer_List_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_LIST_T_H */ diff --git a/ace/Timer_Queue.cpp b/ace/Timer_Queue.cpp deleted file mode 100644 index f3cf230e6e8..00000000000 --- a/ace/Timer_Queue.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// $Id$ - -#include "ace/Containers.h" -#include "ace/Timer_Queue.h" -#include "ace/Synch_Traits.h" -#include "ace/Recursive_Thread_Mutex.h" - -ACE_RCSID(ace, Timer_Queue, "$Id$") - -#if defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_Hash.h" -#include "ace/Timer_Queue_T.cpp" -#endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ - diff --git a/ace/Timer_Queue.h b/ace/Timer_Queue.h deleted file mode 100644 index 36182f15f95..00000000000 --- a/ace/Timer_Queue.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timer_Queue.h - * - * $Id$ - * - * @author Douglas C. Schmidt - * @author Irfan Pyarali - */ -//============================================================================= - -#ifndef ACE_TIMER_QUEUE_H -#define ACE_TIMER_QUEUE_H - -#include /**/ "ace/pre.h" - -#include "ace/Synch_Traits.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Timer_Queuefwd.h" -#include "ace/Timer_Queue_T.h" -#if defined (ACE_HAS_THREADS) -# include "ace/Recursive_Thread_Mutex.h" -#else -# include "ace/Null_Mutex.h" -#endif /* ACE_HAS_THREADS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The following typedef are here for ease of use and backward -// compatibility. -typedef ACE_Timer_Node_Dispatch_Info_T - ACE_Timer_Node_Dispatch_Info; - -typedef ACE_Timer_Node_T - ACE_Timer_Node; - -typedef ACE_Timer_Queue_Iterator_T, - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Timer_Queue_Iterator; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_TIMER_QUEUE_H */ diff --git a/ace/Timer_Queue_Adapters.cpp b/ace/Timer_Queue_Adapters.cpp deleted file mode 100644 index 4a3c45dc399..00000000000 --- a/ace/Timer_Queue_Adapters.cpp +++ /dev/null @@ -1,363 +0,0 @@ -// $Id$ - -#ifndef ACE_TIMER_QUEUE_ADAPTERS_CPP -#define ACE_TIMER_QUEUE_ADAPTERS_CPP - -#include "ace/Timer_Queue_Adapters.h" - -#if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) -#include "ace/Functor.h" -#endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -# if !defined (__ACE_INLINE__) -# include "ace/Timer_Queue_Adapters.inl" -# endif /* __ACE_INLINE__ */ - -#include "ace/Signal.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_time.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template TQ & -ACE_Async_Timer_Queue_Adapter::timer_queue (void) -{ - return this->timer_queue_; -} - -template int -ACE_Async_Timer_Queue_Adapter::cancel (long timer_id, - const void **act) -{ - // Block designated signals. - ACE_Sig_Guard sg (&this->mask_); - ACE_UNUSED_ARG (sg); - - return this->timer_queue_.cancel (timer_id, act); -} - -template int -ACE_Async_Timer_Queue_Adapter::expire (void) -{ - // Block designated signals. - ACE_Sig_Guard sg (&this->mask_); - ACE_UNUSED_ARG (sg); - - return this->timer_queue_.expire (); -} - -template int -ACE_Async_Timer_Queue_Adapter::schedule_ualarm (void) -{ - ACE_Time_Value tv = this->timer_queue_.earliest_time () - - ACE_OS::gettimeofday (); - - // Beware of negative times and zero times (which cause problems for - // ). - if (tv < ACE_Time_Value::zero) - tv = ACE_Time_Value (0, 1); - - // @@ This code should be clever enough to avoid updating the - // if we haven't actually changed the earliest time. - // Schedule a new timer. - ACE_OS::ualarm (tv); - return 0; -} - -template long -ACE_Async_Timer_Queue_Adapter::schedule (ACE_Event_Handler *eh, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) -{ - ACE_UNUSED_ARG (act); - ACE_UNUSED_ARG (interval); - - // Block designated signals. - ACE_Sig_Guard sg (&this->mask_); - ACE_UNUSED_ARG (sg); - - // @@ We still need to implement interval timers... - long tid = this->timer_queue_.schedule (eh, act, future_time); - - if (tid == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("schedule_timer")), - -1); - - if (this->schedule_ualarm () == -1) - return 0; - - return tid; -} - -template -ACE_Async_Timer_Queue_Adapter::ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask) - // If == 0, block *all* signals when the SIGARLM handler is - // running, else just block those in the mask. - : mask_ (mask) -{ - // The following code is necessary to selectively "block" certain - // signals when SIGALRM is running. Also, we always restart system - // calls that are interrupted by the signals. - - ACE_Sig_Action sa ((ACE_SignalHandler) 0, - this->mask_, - SA_RESTART); - - if (this->sig_handler_.register_handler (SIGALRM, this, &sa) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("register_handler"))); -} - -// This is the signal handler function for the asynchronous timer -// list. It gets invoked asynchronously when the SIGALRM signal -// occurs. - -template int -ACE_Async_Timer_Queue_Adapter::handle_signal (int signum, - siginfo_t *, - ucontext_t *) -{ - switch (signum) - { - case SIGALRM: - { - // Expire the pending timers. - - // @@ We need to figure out how to implement interval - // timers... - this->timer_queue_.expire (); - - // Only schedule a new timer if there is one in the list. - - // @@ This code should also become smarter to avoid - // unnecessary calls to ualarm(). - if (this->timer_queue_.is_empty () == 0) - return this->schedule_ualarm (); - else - return 0; - /* NOTREACHED */ - } - default: - ACE_ERROR_RETURN ((LM_ERROR, - "unexpected signal %S\n", - signum), - -1); - /* NOTREACHED */ - } -} - -template -ACE_Thread_Timer_Queue_Adapter::ACE_Thread_Timer_Queue_Adapter (ACE_Thread_Manager *tm, - TQ* timer_queue) - : ACE_Task_Base (tm), - timer_queue_(timer_queue), - delete_timer_queue_(0), - condition_ (mutex_), - active_ (1), // Assume that we start in active mode. - thr_id_ (ACE_OS::NULL_thread) -{ - if (timer_queue_ == 0) - { - ACE_NEW (this->timer_queue_, - TQ); - this->delete_timer_queue_ = 1; - } -} - -template -ACE_Thread_Timer_Queue_Adapter::~ACE_Thread_Timer_Queue_Adapter (void) -{ - if (this->delete_timer_queue_) - { - delete this->timer_queue_; - this->timer_queue_ = 0; - this->delete_timer_queue_ = 0; - } -} - -template ACE_SYNCH_RECURSIVE_MUTEX & -ACE_Thread_Timer_Queue_Adapter::mutex (void) -{ - return this->mutex_; -} - -template long -ACE_Thread_Timer_Queue_Adapter::schedule - (ACE_Event_Handler* handler, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) -{ - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->mutex_, -1); - - long result = this->timer_queue_->schedule (handler, act, future_time, interval); - this->condition_.signal (); - return result; -} - -template int -ACE_Thread_Timer_Queue_Adapter::cancel (long timer_id, - const void **act) -{ - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->mutex_, -1); - - int result = this->timer_queue_->cancel (timer_id, act); - condition_.signal (); - return result; -} - -template void -ACE_Thread_Timer_Queue_Adapter::deactivate (void) -{ - ACE_GUARD (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->mutex_); - - this->active_ = 0; - this->condition_.signal (); -} - -template int -ACE_Thread_Timer_Queue_Adapter::svc (void) -{ - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->mutex_, -1); - - this->thr_id_ = ACE_Thread::self (); - - // Thread cancellation point, if ACE supports it. - // - // Note: This call generates a warning under Solaris because the header - // file /usr/include/pthread.h redefines the routine argument. This - // is a bug in the Solaris header files and has nothing to do with - // ACE. -# if !defined (ACE_LACKS_PTHREAD_CANCEL) - ACE_PTHREAD_CLEANUP_PUSH (&this->condition_.mutex ().get_nesting_mutex ()); -# endif /* ACE_LACKS_PTHREAD_CANCEL */ - - while (this->active_) - { -# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) - // Temporarily suspend ownership of the timer queue mutex in - // order to dispatch deferred execution commands. These - // commands are to be treated as executing in a context - // "external" to the timer queue adapter, and thus must compete - // separately for this lock. - mutex_.release (); - this->dispatch_commands (); - - // Re-acquire ownership of the timer queue mutex in order to - // restore the "internal" timer queue adapter context - mutex_.acquire (); -# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ - - // If the queue is empty, sleep until there is a change on it. - if (this->timer_queue_->is_empty ()) - this->condition_.wait (); - else - { - // Compute the remaining time, being careful not to sleep - // for "negative" amounts of time. - const ACE_Time_Value tv_curr = this->timer_queue_->gettimeofday (); - const ACE_Time_Value tv_earl = this->timer_queue_->earliest_time (); - - if (tv_earl > tv_curr) - { - // The earliest time on the Timer_Queue is in future, so - // use ACE_OS::gettimeofday() to convert the tv to the - // absolute time. - const ACE_Time_Value tv = ACE_OS::gettimeofday () + (tv_earl - tv_curr); - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("waiting until %u.%3.3u secs\n"), - // tv.sec(), tv.msec())); - this->condition_.wait (&tv); - } - } - - // Expire timers anyway, at worst this is a no-op. - this->timer_queue_->expire (); - } - - // Thread cancellation point, if ACE supports it. -# if !defined (ACE_LACKS_PTHREAD_CANCEL) - ACE_PTHREAD_CLEANUP_POP (0); -# endif /* ACE_LACKS_PTHREAD_CANCEL */ - - return 0; -} - -template int -ACE_Thread_Timer_Queue_Adapter::activate (long flags, - int , - int , - long priority, - int grp_id, - ACE_Task_Base *task, - ACE_hthread_t thread_handles[], - void *stack[], - size_t stack_size[], - ACE_thread_t thread_names[]) -{ - // Macros to avoid "warning: unused parameter" type warning. - ACE_UNUSED_ARG (thread_handles); - - // Make sure to set this flag in case we were deactivated earlier. - this->active_ = 1; - - // Make sure that we only allow a single thread to be spawned for - // our adapter. Otherwise, too many weird things can happen. - return ACE_Task_Base::activate (flags, 1, 0, priority, grp_id, task, 0, - stack, stack_size, thread_names); -} - -# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) - -// Enqueues a command object for execution just before waiting on the next -// timer event. This allows deferred execution of commands that cannot -// be performed in the timer event handler context, such as registering -// or cancelling timers on platforms where the timer queue mutex is not -// recursive. - -template int -ACE_Thread_Timer_Queue_Adapter::enqueue_command (ACE_Command_Base *cmd, - COMMAND_ENQUEUE_POSITION pos) -{ - // Serialize access to the command queue. - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->command_mutex_, -1); - - if (pos == ACE_Thread_Timer_Queue_Adapter::TAIL) - return command_queue_.enqueue_tail (cmd); - else - return command_queue_.enqueue_head (cmd); -} - -// Dispatches all command objects enqueued in the most recent event -// handler context. - -template int -ACE_Thread_Timer_Queue_Adapter::dispatch_commands (void) -{ - // Serialize access to the command queue. - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->command_mutex_, -1); - - // loop through the enqueued commands - ACE_Command_Base *cmd = 0; - while (command_queue_.dequeue_head (cmd) == 0) - if (cmd) - { - cmd->execute (); - delete cmd; - } - - return 0; -} - -# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TIMER_QUEUE_ADAPTERS_CPP */ diff --git a/ace/Timer_Queue_Adapters.h b/ace/Timer_Queue_Adapters.h deleted file mode 100644 index 3905b1d18b7..00000000000 --- a/ace/Timer_Queue_Adapters.h +++ /dev/null @@ -1,260 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timer_Queue_Adapters.h - * - * $Id$ - * - * @author Douglas C. Schmidt and - * Carlos O'Ryan - */ -//============================================================================= - -#ifndef ACE_TIMER_QUEUE_ADAPTERS_H -#define ACE_TIMER_QUEUE_ADAPTERS_H -#include /**/ "ace/pre.h" - -#include "ace/Task.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Signal.h" -#include "ace/Sig_Handler.h" -#include "ace/Condition_Recursive_Thread_Mutex.h" - -#if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) -# include "ace/Unbounded_Queue.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_Command_Base; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Sig_Set; - -/** - * @class ACE_Async_Timer_Queue_Adapter - * - * @brief Adapts an ACE timer queue to be driven asynchronously using signals. - * - * This implementation uses the ACE_OS::ualarm call, to generate - * the SIGARLM signal that is caught by this class. - * - * @note This adapter only works on platforms that support ualarm(). - * POSIX platforms generally do; Windows and some others do not. - * - * @todo This adapter does not automatically reschedule repeating timers. - */ -template -class ACE_Async_Timer_Queue_Adapter : public ACE_Event_Handler -{ -public: - typedef TQ TIMER_QUEUE; - - /// Constructor - /** - * Register the SIGALRM handler. If @a mask == 0 then block all - * signals when @c SIGALRM is run. Otherwise, just block the signals - * indicated in @a mask. - */ - ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask = 0); - - /// Schedule the timer according to the semantics of the - /// ACE_Timer_List. - /** - * This timer gets dispatched via a signal, rather than by a user - * calling expire(). Note that interval timers are not implemented - * yet. - */ - long schedule (ACE_Event_Handler *type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - - /// Cancel the @a timer_id and pass back the @a act if an address is - /// passed in. - int cancel (long timer_id, const void **act = 0); - - /// Dispatch all timers with expiry time at or before the current time. - /// Returns the number of timers expired. - int expire (void); - - /// Return a reference to the underlying timer queue. - TQ &timer_queue (void); - -private: - /// Perform the logic to compute the new ualarm(2) setting. - virtual int schedule_ualarm (void); - - /// Called back by @c SIGALRM handler. - virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); - - /// Handler for the @c SIGALRM signal, so that we can access our state - /// without requiring any global variables. - ACE_Sig_Handler sig_handler_; - - /// Implementation of the timer queue (e.g., ACE_Timer_List, - /// ACE_Timer_Heap, etc.). - TQ timer_queue_; - - /// Mask of signals to be blocked when we're servicing @c SIGALRM. - ACE_Sig_Set mask_; -}; - -/** - * @class ACE_Thread_Timer_Queue_Adapter - * - * @brief Adapts an ACE timer queue using a separate thread for dispatching. - * - * This implementation uses a separate thread to dispatch the timers. - * The base queue need not be thread safe; this class takes all the - * necessary locks. - * - * @note This is a case where template parameters will be useful, but - * (IMHO) the effort and portability problems discourage their - * use. - * - */ -template -class ACE_Thread_Timer_Queue_Adapter : public ACE_Task_Base -{ -public: - /// Trait for the underlying queue type. - typedef TQ TIMER_QUEUE; - -# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) - - /// Typedef for the position at which to enqueue a deferred - /// execution command. - enum COMMAND_ENQUEUE_POSITION {HEAD, TAIL}; - -# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ - - /// Creates the timer queue. Activation of the task is the user's - /// responsibility. Optionally a pointer to a timer queue can be passed, - /// when no pointer is passed, a TQ is dynamically created - ACE_Thread_Timer_Queue_Adapter (ACE_Thread_Manager * = ACE_Thread_Manager::instance (), - TQ* timer_queue = 0); - - /// Destructor. - virtual ~ACE_Thread_Timer_Queue_Adapter (void); - - /// Schedule the timer according to the semantics of the ; wakes - /// up the dispatching thread. - long schedule (ACE_Event_Handler *handler, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - - /// Cancel the @a timer_id and return the @a act parameter if an - /// address is passed in. Also wakes up the dispatching thread. - int cancel (long timer_id, const void **act = 0); - - /// Runs the dispatching thread. - virtual int svc (void); - - /// Inform the dispatching thread that it should terminate. - virtual void deactivate (void); - - /// Access the locking mechanism, useful for iteration. - ACE_SYNCH_RECURSIVE_MUTEX &mutex (void); - - /// Set a user-specified timer queue. - int timer_queue (TQ *tq); - - /// Return the current . - TQ *timer_queue (void) const; - - /// Return the thread id of our active object. - ACE_thread_t thr_id (void) const; - - /** - * We override the default activate() method so that we can ensure - * that only a single thread is ever spawned. Otherwise, too many - * weird things can happen... - */ - virtual int activate (long flags = THR_NEW_LWP | THR_JOINABLE, - int n_threads = 1, - int force_active = 0, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - int grp_id = -1, - ACE_Task_Base *task = 0, - ACE_hthread_t thread_handles[] = 0, - void *stack[] = 0, - size_t stack_size[] = 0, - ACE_thread_t thread_names[] = 0); - -# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) - - /** - * Enqueues a command object for execution just before waiting on the next - * timer event. This allows deferred execution of commands that cannot - * be performed in the timer event handler context, such as registering - * or cancelling timers on platforms where the timer queue mutex is not - * recursive. - */ - int enqueue_command (ACE_Command_Base *command_, - COMMAND_ENQUEUE_POSITION pos = TAIL); - -# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ - -private: - -# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) - /// Dispatches all command objects enqueued in the most - /// recent event handler context. - int dispatch_commands (void); - - /// Queue of commands for deferred execution. - ACE_Unbounded_Queue command_queue_; - - /// The mutual exclusion mechanism for the command queue. - ACE_SYNCH_MUTEX command_mutex_; -# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ - - /// The underlying Timer_Queue. - TQ* timer_queue_; - - /// Keeps track of whether we should delete the timer queue (if we - /// didn't create it, then we don't delete it). - int delete_timer_queue_; - - /// The mutual exclusion mechanism that is required to use the - /// . - ACE_SYNCH_RECURSIVE_MUTEX mutex_; - - /** - * The dispatching thread sleeps on this condition while waiting to - * dispatch the next timer; it is used to wake it up if there is a - * change on the timer queue. - */ - ACE_SYNCH_RECURSIVE_CONDITION condition_; - - /// When deactivate is called this variable turns to false and the - /// dispatching thread is signalled, to terminate its main loop. - int active_; - - /// Thread id of our active object task. - ACE_thread_t thr_id_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/Timer_Queue_Adapters.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -# include "ace/Timer_Queue_Adapters.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -# pragma implementation ("Timer_Queue_Adapters.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_QUEUE_ADAPTERS_H */ diff --git a/ace/Timer_Queue_Adapters.inl b/ace/Timer_Queue_Adapters.inl deleted file mode 100644 index e66168bbe98..00000000000 --- a/ace/Timer_Queue_Adapters.inl +++ /dev/null @@ -1,29 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE TQ * -ACE_Thread_Timer_Queue_Adapter::timer_queue (void) const -{ - return this->timer_queue_; -} - -template ACE_INLINE int -ACE_Thread_Timer_Queue_Adapter::timer_queue (TQ *tq) -{ - if (this->delete_timer_queue_ != 0) - delete this->timer_queue_; - this->timer_queue_ = tq; - this->delete_timer_queue_ = 0; - return 0; -} - -template ACE_INLINE ACE_thread_t -ACE_Thread_Timer_Queue_Adapter::thr_id (void) const -{ - return this->thr_id_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp deleted file mode 100644 index 82030315aab..00000000000 --- a/ace/Timer_Queue_T.cpp +++ /dev/null @@ -1,477 +0,0 @@ -// $Id$ - -#ifndef ACE_TIMER_QUEUE_T_CPP -#define ACE_TIMER_QUEUE_T_CPP - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Timer_Queue_T.h" -#include "ace/Guard_T.h" -#include "ace/Log_Msg.h" -#include "ace/Reactor_Timer_Interface.h" -#include "ace/Null_Mutex.h" -#include "ace/OS_NS_sys_time.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Timer_Queue_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// This fudge factor can be overriden for timers that need it, such as on -// Solaris, by defining the ACE_TIMER_SKEW symbol in the appropriate config -// header. -#if !defined (ACE_TIMER_SKEW) -# define ACE_TIMER_SKEW 0 -#endif /* ACE_TIMER_SKEW */ - -template void -ACE_Timer_Node_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Timer_Node_T::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nact_ = %x"), this->act_)); - this->timer_value_.dump (); - this->interval_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nprev_ = %x"), this->prev_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nnext_ = %x"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntimer_id_ = %d\n"), this->timer_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Timer_Node_T::ACE_Timer_Node_T (void) -{ - ACE_TRACE ("ACE_Timer_Node_T::ACE_Timer_Node_T"); -} - -template -ACE_Timer_Node_T::~ACE_Timer_Node_T (void) -{ - ACE_TRACE ("ACE_Timer_Node_T::~ACE_Timer_Node_T"); -} - -template -ACE_Timer_Queue_Iterator_T::ACE_Timer_Queue_Iterator_T (void) -{ -} - -template -ACE_Timer_Queue_Iterator_T::~ACE_Timer_Queue_Iterator_T (void) -{ -} - -template ACE_Time_Value * -ACE_Timer_Queue_T::calculate_timeout (ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, max_wait_time)); - - if (this->is_empty ()) - // Nothing on the Timer_Queue, so use whatever the caller gave us. - return max_wait_time; - else - { - ACE_Time_Value cur_time = this->gettimeofday (); - - if (this->earliest_time () > cur_time) - { - // The earliest item on the Timer_Queue is still in the - // future. Therefore, use the smaller of (1) caller's wait - // time or (2) the delta time between now and the earliest - // time on the Timer_Queue. - - this->timeout_ = this->earliest_time () - cur_time; - if (max_wait_time == 0 || *max_wait_time > timeout_) - return &this->timeout_; - else - return max_wait_time; - } - else - { - // The earliest item on the Timer_Queue is now in the past. - // Therefore, we've got to "poll" the Reactor, i.e., it must - // just check the descriptors and then dispatch timers, etc. - this->timeout_ = ACE_Time_Value::zero; - return &this->timeout_; - } - } -} - -template ACE_Time_Value * -ACE_Timer_Queue_T::calculate_timeout (ACE_Time_Value *max_wait_time, - ACE_Time_Value *the_timeout) -{ - ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout"); - - if (the_timeout == 0) - return 0; - - if (this->is_empty ()) - { - // Nothing on the Timer_Queue, so use whatever the caller gave us. - if (max_wait_time) - *the_timeout = *max_wait_time; - else - return 0; - } - else - { - ACE_Time_Value cur_time = this->gettimeofday (); - - if (this->earliest_time () > cur_time) - { - // The earliest item on the Timer_Queue is still in the - // future. Therefore, use the smaller of (1) caller's wait - // time or (2) the delta time between now and the earliest - // time on the Timer_Queue. - - *the_timeout = this->earliest_time () - cur_time; - if (!(max_wait_time == 0 || *max_wait_time > *the_timeout)) - *the_timeout = *max_wait_time; - } - else - { - // The earliest item on the Timer_Queue is now in the past. - // Therefore, we've got to "poll" the Reactor, i.e., it must - // just check the descriptors and then dispatch timers, etc. - *the_timeout = ACE_Time_Value::zero; - } - } - return the_timeout; -} - -template void -ACE_Timer_Queue_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Timer_Queue_T::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->timeout_.dump (); - this->timer_skew_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Timer_Queue_T::ACE_Timer_Queue_T (FUNCTOR *upcall_functor, - ACE_Free_List > *freelist) - : gettimeofday_ (ACE_OS::gettimeofday), - delete_upcall_functor_ (upcall_functor == 0), - delete_free_list_ (freelist == 0), - timer_skew_ (0, ACE_TIMER_SKEW) -{ - ACE_TRACE ("ACE_Timer_Queue_T::ACE_Timer_Queue_T"); - - if (!freelist) - ACE_NEW (free_list_, - (ACE_Locked_Free_List,ACE_Null_Mutex>)); - else - free_list_ = freelist; - - if (!upcall_functor) - ACE_NEW (upcall_functor_, - FUNCTOR); - else - upcall_functor_ = upcall_functor; -} - -template -ACE_Timer_Queue_T::~ACE_Timer_Queue_T (void) -{ - ACE_TRACE ("ACE_Timer_Queue_T::~ACE_Timer_Queue_T"); - - // Cleanup the functor and free_list on the way out - if (this->delete_upcall_functor_) - delete this->upcall_functor_; - - if (this->delete_free_list_) - delete this->free_list_; -} - -template ACE_Timer_Node_T * -ACE_Timer_Queue_T::alloc_node (void) -{ - return this->free_list_->remove (); -} - -template void -ACE_Timer_Queue_T::free_node (ACE_Timer_Node_T *node) -{ - this->free_list_->add (node); -} - -template ACE_LOCK & -ACE_Timer_Queue_T::mutex (void) -{ - return this->mutex_; -} - -template long -ACE_Timer_Queue_T::schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - // Schedule the timer. - long const result = - this->schedule_i (type, - act, - future_time, - interval); - - // Return on failure. - if (result == -1) - return result; - - // Inform upcall functor of successful registration. - this->upcall_functor ().registration (*this, - type, - act); - - // Return result; - return result; -} - -// Run the method for all Timers whose values are <= -// . -template int -ACE_Timer_Queue_T::expire (const ACE_Time_Value &cur_time) -{ - ACE_TRACE ("ACE_Timer_Queue_T::expire"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - // Keep looping while there are timers remaining and the earliest - // timer is <= the passed in to the method. - - if (this->is_empty ()) - return 0; - - int number_of_timers_expired = 0; - int result = 0; - - ACE_Timer_Node_Dispatch_Info_T info; - - while ((result = this->dispatch_info_i (cur_time, - info)) != 0) - { - const void *upcall_act = 0; - - this->preinvoke (info, cur_time, upcall_act); - - this->upcall (info, cur_time); - - this->postinvoke (info, cur_time, upcall_act); - - ++number_of_timers_expired; - - } - - ACE_UNUSED_ARG (result); - return number_of_timers_expired; -} - -template int -ACE_Timer_Queue_T::dispatch_info_i (const ACE_Time_Value &cur_time, - ACE_Timer_Node_Dispatch_Info_T &info) -{ - ACE_TRACE ("ACE_Timer_Queue_T::dispatch_info_i"); - - if (this->is_empty ()) - return 0; - - ACE_Timer_Node_T *expired = 0; - - if (this->earliest_time () <= cur_time) - { - expired = this->remove_first (); - - // Get the dispatch info - expired->get_dispatch_info (info); - - // Check if this is an interval timer. - if (expired->get_interval () > ACE_Time_Value::zero) - { - // Make sure that we skip past values that have already - // "expired". - do - expired->set_timer_value (expired->get_timer_value () + - expired->get_interval ()); - while (expired->get_timer_value () <= cur_time); - - // Since this is an interval timer, we need to reschedule - // it. - this->reschedule (expired); - } - else - { - // Call the factory method to free up the node. - this->free_node (expired); - } - - return 1; - } - - return 0; -} - -template void -ACE_Timer_Queue_T::return_node (ACE_Timer_Node_T *node) -{ - ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); - this->free_node (node); -} - - -template -ACE_Event_Handler_Handle_Timeout_Upcall::ACE_Event_Handler_Handle_Timeout_Upcall (void) -{ -} - -template -ACE_Event_Handler_Handle_Timeout_Upcall::~ACE_Event_Handler_Handle_Timeout_Upcall (void) -{ -} - -template int -ACE_Event_Handler_Handle_Timeout_Upcall::registration (TIMER_QUEUE &, - ACE_Event_Handler *event_handler, - const void *) -{ - event_handler->add_reference (); - return 0; -} - -template int -ACE_Event_Handler_Handle_Timeout_Upcall::preinvoke (TIMER_QUEUE & /* timer_queue */, - ACE_Event_Handler *event_handler, - const void * /* timer_act */, - int /* recurring_timer */, - const ACE_Time_Value & /* cur_time */, - const void *&upcall_act) -{ - int requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (requires_reference_counting) - { - event_handler->add_reference (); - - upcall_act = &this->requires_reference_counting_; - } - - return 0; -} - -template int -ACE_Event_Handler_Handle_Timeout_Upcall::postinvoke (TIMER_QUEUE & /* timer_queue */, - ACE_Event_Handler *event_handler, - const void * /* timer_act */, - int /* recurring_timer */, - const ACE_Time_Value & /* cur_time */, - const void *upcall_act) -{ - if (upcall_act == &this->requires_reference_counting_) - { - event_handler->remove_reference (); - } - - return 0; -} - -template int -ACE_Event_Handler_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *event_handler, - const void *act, - int recurring_timer, - const ACE_Time_Value &cur_time) -{ - int requires_reference_counting = 0; - - if (!recurring_timer) - { - requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - } - - // Upcall to the s handle_timeout method. - if (event_handler->handle_timeout (cur_time, act) == -1) - { - if (event_handler->reactor ()) - event_handler->reactor_timer_interface ()->cancel_timer (event_handler, 0); - else - timer_queue.cancel (event_handler, 0); // 0 means "call handle_close()". - } - - if (!recurring_timer && - requires_reference_counting) - { - event_handler->remove_reference (); - } - - return 0; -} - -template int -ACE_Event_Handler_Handle_Timeout_Upcall::cancel_type (TIMER_QUEUE &, - ACE_Event_Handler *event_handler, - int dont_call, - int &requires_reference_counting) -{ - requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - // Upcall to the s handle_close method - if (dont_call == 0) - event_handler->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::TIMER_MASK); - - return 0; -} - -template int -ACE_Event_Handler_Handle_Timeout_Upcall::cancel_timer (TIMER_QUEUE &, - ACE_Event_Handler *event_handler, - int, - int requires_reference_counting) -{ - if (requires_reference_counting) - event_handler->remove_reference (); - - return 0; -} - -template int -ACE_Event_Handler_Handle_Timeout_Upcall::deletion (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *event_handler, - const void *) -{ - int requires_reference_counting = 0; - - this->cancel_type (timer_queue, - event_handler, - 0, - requires_reference_counting); - - this->cancel_timer (timer_queue, - event_handler, - 0, - requires_reference_counting); - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TIMER_QUEUE_T_CPP */ diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h deleted file mode 100644 index f780d8a5240..00000000000 --- a/ace/Timer_Queue_T.h +++ /dev/null @@ -1,562 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timer_Queue_T.h - * - * $Id$ - * - * @author Doug Schmidt - * @author Irfan Pyarali and - * @author Darrell Brunsch - */ -//============================================================================= - -#ifndef ACE_TIMER_QUEUE_T_H -#define ACE_TIMER_QUEUE_T_H -#include /**/ "ace/pre.h" - -#include "ace/Free_List.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Event_Handler.h" -#include "ace/Time_Value.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Timer_Node_Dispatch_Info_T - * - * @brief Maintains generated dispatch information for Timer nodes. - * - */ -template -class ACE_Timer_Node_Dispatch_Info_T -{ -public: - /// The type of object held in the queue - TYPE type_; - - /// Asynchronous completion token associated with the timer. - const void *act_; - - /// Flag to check if the timer is recurring. - int recurring_timer_; -}; - -/** - * @class ACE_Timer_Node_T - * - * @brief Maintains the state associated with a Timer entry. - */ -template -class ACE_Timer_Node_T -{ -public: - /// Default constructor - ACE_Timer_Node_T (void); - - /// Destructor - ~ACE_Timer_Node_T (void); - - /// Useful typedef .. - typedef ACE_Timer_Node_Dispatch_Info_T DISPATCH_INFO; - - /// Singly linked list - void set (const TYPE &type, - const void *a, - const ACE_Time_Value &t, - const ACE_Time_Value &i, - ACE_Timer_Node_T *n, - long timer_id); - - /// Doubly linked list version - void set (const TYPE &type, - const void *a, - const ACE_Time_Value &t, - const ACE_Time_Value &i, - ACE_Timer_Node_T *p, - ACE_Timer_Node_T *n, - long timer_id); - - // = Accessors - - /// Get the type. - TYPE &get_type (void); - - /// Set the type. - void set_type (TYPE &type); - - /// Get the asynchronous completion token. - const void *get_act (void); - - /// Set the asynchronous completion token. - void set_act (void *act); - - /// Get the timer value. - const ACE_Time_Value &get_timer_value (void) const; - - /// Set the timer value. - void set_timer_value (const ACE_Time_Value &timer_value); - - /// Get the timer interval. - const ACE_Time_Value &get_interval (void) const; - - /// Set the timer interval. - void set_interval (const ACE_Time_Value &interval); - - /// Get the previous pointer. - ACE_Timer_Node_T *get_prev (void); - - /// Set the previous pointer. - void set_prev (ACE_Timer_Node_T *prev); - - /// Get the next pointer. - ACE_Timer_Node_T *get_next (void); - - /// Set the next pointer. - void set_next (ACE_Timer_Node_T *next); - - /// Get the timer_id. - long get_timer_id (void) const; - - /// Set the timer_id. - void set_timer_id (long timer_id); - - /// Get the dispatch info. The dispatch information is got - /// through . This form helps us in preventing allocation and - /// deleting data along the criticl path. - /// @@TODO: We may want to have a copying version too, so that our - /// interface will be complete.. - void get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T &info); - - /// Dump the state of an TYPE. - void dump (void) const; - -private: - /// Type of object stored in the Queue - TYPE type_; - - /// Asynchronous completion token associated with the timer. - const void *act_; - - /// Time until the timer expires. - ACE_Time_Value timer_value_; - - /// If this is a periodic timer this holds the time until the next - /// timeout. - ACE_Time_Value interval_; - - /// Pointer to previous timer. - ACE_Timer_Node_T *prev_; - - /// Pointer to next timer. - ACE_Timer_Node_T *next_; - - /// Id of this timer (used to cancel timers before they expire). - long timer_id_; -}; - -/** - * @class ACE_Timer_Queue_Iterator_T - * - * @brief Generic interface for iterating over a subclass of - * ACE_Timer_Queue. - * - * This is a generic iterator that can be used to visit every - * node of a timer queue. Be aware that it isn't guaranteed - * that the transversal will be in order of timeout values. - */ -template -class ACE_Timer_Queue_Iterator_T -{ -public: - // = Initialization and termination methods. - /// Constructor. - ACE_Timer_Queue_Iterator_T (void); - - /// Destructor. - virtual ~ACE_Timer_Queue_Iterator_T (void); - - /// Positions the iterator at the earliest node in the Timer Queue - virtual void first (void) = 0; - - /// Positions the iterator at the next node in the Timer Queue - virtual void next (void) = 0; - - /// Returns true when there are no more nodes in the sequence - virtual int isdone (void) const = 0; - - /// Returns the node at the current position in the sequence - virtual ACE_Timer_Node_T *item (void) = 0; -}; - -/** - * @class ACE_Timer_Queue_T - * - * @brief Provides an interface to timers. - * - * This is an abstract base class that provides hook for - * implementing specialized policies such as ACE_Timer_List - * and ACE_Timer_Heap. - */ -template -class ACE_Timer_Queue_T -{ -public: - /// Type of Iterator. - typedef ACE_Timer_Queue_Iterator_T ITERATOR; - - // = Initialization and termination methods. - /** - * Default constructor. is the instance of the - * FUNCTOR to be used by the queue. If is 0, Timer - * Queue will create a default FUNCTOR. the freelist of - * timer nodes. If 0, then a default freelist will be created. - */ - ACE_Timer_Queue_T (FUNCTOR *upcall_functor = 0, - ACE_Free_List > *freelist = 0); - - /// Destructor - make virtual for proper destruction of inherited - /// classes. - virtual ~ACE_Timer_Queue_T (void); - - /// True if queue is empty, else false. - virtual int is_empty (void) const = 0; - - /// Returns the time of the earlier node in the Timer_Queue. Must - /// be called on a non-empty queue. - virtual const ACE_Time_Value &earliest_time (void) const = 0; - - /** - * Schedule that will expire at , which is - * specified in absolute time. If it expires then is passed - * in as the value to the . If is != to - * then it is used to reschedule the - * automatically, using relative time to the current . - * This method returns a that uniquely identifies the the - * entry in an internal list. This can be used to - * cancel the timer before it expires. The cancellation ensures - * that are unique up to values of greater than 2 - * billion timers. As long as timers don't stay around longer than - * this there should be no problems with accidentally deleting the - * wrong timer. Returns -1 on failure (which is guaranteed never to - * be a valid ). - */ - virtual long schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - - /** - * Resets the interval of the timer represented by to - * , which is specified in relative time to the current - * . If is equal to - * , the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_interval (long timer_id, - const ACE_Time_Value &interval) = 0; - - /** - * Cancel all timer associated with . If - * is 0 then the will be invoked, - * which typically invokes the hook. Returns number - * of timers cancelled. - */ - virtual int cancel (const TYPE &type, - int dont_call_handle_close = 1) = 0; - - /** - * Cancel the single timer that matches the value (which - * was returned from the method). If act is non-NULL - * then it will be set to point to the ``magic cookie'' argument - * passed in when the timer was registered. This makes it possible - * to free up the memory and avoid memory leaks. If - * is 0 then the will be invoked, - * which typically calls the hook. Returns 1 if - * cancellation succeeded and 0 if the wasn't found. - */ - virtual int cancel (long timer_id, - const void **act = 0, - int dont_call_handle_close = 1) = 0; - - /** - * Run the for all timers whose values are <= . - * This does not account for . Returns the number of - * timers canceled. - */ - virtual int expire (const ACE_Time_Value ¤t_time); - - /** - * Get the dispatch information for a timer whose value is <= . - * This does not account for . Returns 1 if - * there is a node whose value <= else returns a 0. - * - */ - virtual int dispatch_info (const ACE_Time_Value ¤t_time, - ACE_Timer_Node_Dispatch_Info_T &info); - - /** - * Run the for all timers whose values are <= - * . Also accounts for . - * - * Depending on the resolution of the underlying OS the system calls - * like select()/poll() might return at time different than that is - * specified in the timeout. Suppose the OS guarantees a resolution of t ms. - * The timeline will look like - * - * A B - * | | - * V V - * |-------------|-------------|-------------|-------------| - * t t t t t - * - * - * If you specify a timeout value of A, then the timeout will not occur - * at A but at the next interval of the timer, which is later than - * that is expected. Similarly, if your timeout value is equal to B, - * then the timeout will occur at interval after B. Now depending upon the - * resolution of your timeouts and the accuracy of the timeouts - * needed for your application, you should set the value of - * . In the above case, if you want the timeout A to fire - * no later than A, then you should specify your to be - * A % t. - * - * The timeout value should be specified via the macro ACE_TIMER_SKEW - * in your config.h file. The default value is zero. - * - * Things get interesting if the t before the timeout value B is zero - * i.e your timeout is less than the interval. In that case, you are - * almost sure of not getting the desired timeout behaviour. Maybe you - * should look for a better OS :-) - * - * Returns the number of timers canceled. - */ - - /* virtual */ int expire (void); - - /** - * Returns the current time of day. This method allows different - * implementations of the timer queue to use special high resolution - * timers. - */ - /* virtual */ ACE_Time_Value gettimeofday (void); - - /// Allows applications to control how the timer queue gets the time - /// of day. - void gettimeofday (ACE_Time_Value (*gettimeofday)(void)); - - /// Determine the next event to timeout. Returns if there are - /// no pending timers or if all pending timers are longer than max. - /// This method acquires a lock internally since it modifies internal state. - virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max); - - /** - * Determine the next event to timeout. Returns if there are - * no pending timers or if all pending timers are longer than max. - * should be a pointer to storage for the timeout value, - * and this value is also returned. This method does not acquire a - * lock internally since it doesn't modify internal state. If you - * need to call this method when the queue is being modified - * concurrently, however, you should make sure to acquire the - * externally before making the call. - */ - virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max, - ACE_Time_Value *the_timeout); - - /// Set the timer skew for the Timer_Queue. - void timer_skew (const ACE_Time_Value &skew); - - /// Get the timer skew for the Timer_Queue. - const ACE_Time_Value &timer_skew (void) const; - - /// Synchronization variable used by the queue - ACE_LOCK &mutex (void); - - /// Accessor to the upcall functor - FUNCTOR &upcall_functor (void); - - /// Returns a pointer to this ACE_Timer_Queue's iterator. - virtual ITERATOR &iter (void) = 0; - - /// Removes the earliest node from the queue and returns it - virtual ACE_Timer_Node_T *remove_first (void) = 0; - - /// Dump the state of a object. - virtual void dump (void) const; - - /// Reads the earliest node from the queue and returns it. - virtual ACE_Timer_Node_T *get_first (void) = 0; - - /// Method used to return a timer node to the queue's ownership - /// after it is returned by a method like . - virtual void return_node (ACE_Timer_Node_T *); - - /// This method will call the preinvoke() on . - void preinvoke (ACE_Timer_Node_Dispatch_Info_T &info, - const ACE_Time_Value &cur_time, - const void *&upcall_act); - - /// This method will call the timeout() on . - void upcall (ACE_Timer_Node_Dispatch_Info_T &info, - const ACE_Time_Value &cur_time); - - /// This method will call the postinvoke() on . - void postinvoke (ACE_Timer_Node_Dispatch_Info_T &info, - const ACE_Time_Value &cur_time, - const void *upcall_act); - -protected: - - /// Schedule a timer. - virtual long schedule_i (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) = 0; - - /// Reschedule an "interval" . - virtual void reschedule (ACE_Timer_Node_T *) = 0; - - /// Factory method that allocates a new node. - virtual ACE_Timer_Node_T *alloc_node (void); - - /// Factory method that frees a previously allocated node. - virtual void free_node (ACE_Timer_Node_T *); - - /// Non-locking version of dispatch_info () - virtual int dispatch_info_i (const ACE_Time_Value ¤t_time, - ACE_Timer_Node_Dispatch_Info_T &info); - - /// Synchronization variable for ACE_Timer_Queue. - /// @note The right name would be lock_, but HP/C++ will choke on that! - ACE_LOCK mutex_; - - /// Class that implements a free list - ACE_Free_List > *free_list_; - - /// Pointer to function that returns the current time of day. - ACE_Time_Value (*gettimeofday_)(void); - - /// Upcall functor - FUNCTOR *upcall_functor_; - - /// To delete or not to delete is the question? - int delete_upcall_functor_; - - /// Flag to delete only if the class created the - int delete_free_list_; - -private: - - /// Returned by . - ACE_Time_Value timeout_; - - /// Adjusts for timer skew in various clocks. - ACE_Time_Value timer_skew_; - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Queue_T (const ACE_Timer_Queue_T &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Queue_T &)) -}; - -/** - * @class ACE_Event_Handler_Handle_Timeout_Upcall - * - * @brief Functor for Timer_Queues. - * - * This class implements the functor required by the Timer - * Queue to call on ACE_Event_Handlers. - */ -template -class ACE_Event_Handler_Handle_Timeout_Upcall -{ -public: - typedef ACE_Timer_Queue_T, - ACE_LOCK> - TIMER_QUEUE; - - // = Initialization and termination methods. - /// Constructor. - ACE_Event_Handler_Handle_Timeout_Upcall (void); - - /// Destructor. - ~ACE_Event_Handler_Handle_Timeout_Upcall (void); - - /// This method is called when a timer is registered. - int registration (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg); - - /// This method is called before the timer expires. - int preinvoke (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time, - const void *&upcall_act); - - /// This method is called when the timer expires. - int timeout (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time); - - /// This method is called after the timer expires. - int postinvoke (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time, - const void *upcall_act); - - /// This method is called when a handler is cancelled - int cancel_type (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - int dont_call, - int &requires_reference_counting); - - /// This method is called when a timer is cancelled - int cancel_timer (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - int dont_call, - int requires_reference_counting); - - /// This method is called when the timer queue is destroyed and - /// the timer is still contained in it - int deletion (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg); - -private: - - /// Flag indicating that reference counting is required for this - /// event handler upcall. - int requires_reference_counting_; - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Event_Handler_Handle_Timeout_Upcall (const ACE_Event_Handler_Handle_Timeout_Upcall &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Event_Handler_Handle_Timeout_Upcall &)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Timer_Queue_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) && !defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_Queue_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE && !ACE_HAS_BROKEN_HPUX_TEMPLATES */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Timer_Queue_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_QUEUE_T_H */ diff --git a/ace/Timer_Queue_T.inl b/ace/Timer_Queue_T.inl deleted file mode 100644 index 7275119e2e1..00000000000 --- a/ace/Timer_Queue_T.inl +++ /dev/null @@ -1,222 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE void -ACE_Timer_Node_T::set (const TYPE &type, - const void *a, - const ACE_Time_Value &t, - const ACE_Time_Value &i, - ACE_Timer_Node_T *n, - long timer_id) -{ - this->type_ = type; - this->act_ = a; - this->timer_value_ = t; - this->interval_ = i; - this->next_ = n; - this->timer_id_ = timer_id; -} - -template ACE_INLINE void -ACE_Timer_Node_T::set (const TYPE &type, - const void *a, - const ACE_Time_Value &t, - const ACE_Time_Value &i, - ACE_Timer_Node_T *p, - ACE_Timer_Node_T *n, - long timer_id) -{ - this->type_ = type; - this->act_ = a; - this->timer_value_ = t; - this->interval_ = i; - this->prev_ = p; - this->next_ = n; - this->timer_id_ = timer_id; -} - -template ACE_INLINE TYPE & -ACE_Timer_Node_T::get_type (void) -{ - return this->type_; -} - -template ACE_INLINE void -ACE_Timer_Node_T::set_type (TYPE &type) -{ - this->type_ = type; -} - -template ACE_INLINE const void * -ACE_Timer_Node_T::get_act (void) -{ - return this->act_; -} - -template ACE_INLINE void -ACE_Timer_Node_T::set_act (void *act) -{ - this->act_ = act; -} - -template ACE_INLINE const ACE_Time_Value & -ACE_Timer_Node_T::get_timer_value (void) const -{ - return this->timer_value_; -} - -template ACE_INLINE void -ACE_Timer_Node_T::set_timer_value (const ACE_Time_Value &timer_value) -{ - this->timer_value_ = timer_value; -} - -template ACE_INLINE const ACE_Time_Value & -ACE_Timer_Node_T::get_interval (void) const -{ - return this->interval_; -} - -template ACE_INLINE void -ACE_Timer_Node_T::set_interval (const ACE_Time_Value &interval) -{ - this->interval_ = interval; -} - -template ACE_INLINE ACE_Timer_Node_T * -ACE_Timer_Node_T::get_prev (void) -{ - return this->prev_; -} - -template ACE_INLINE void -ACE_Timer_Node_T::set_prev (ACE_Timer_Node_T *prev) -{ - this->prev_ = prev; -} - -template ACE_INLINE ACE_Timer_Node_T * -ACE_Timer_Node_T::get_next (void) -{ - return this->next_; -} - -template ACE_INLINE void -ACE_Timer_Node_T::set_next (ACE_Timer_Node_T *next) -{ - this->next_ = next; -} - -template ACE_INLINE long -ACE_Timer_Node_T::get_timer_id (void) const -{ - return this->timer_id_; -} - -template ACE_INLINE void -ACE_Timer_Node_T::set_timer_id (long timer_id) -{ - this->timer_id_ = timer_id; -} - -template ACE_INLINE void -ACE_Timer_Node_T::get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T &info) -{ - // Yes, do a copy - info.type_ = this->type_; - info.act_ = this->act_; - info.recurring_timer_ = - this->interval_ > ACE_Time_Value::zero; -} - -template ACE_INLINE void -ACE_Timer_Queue_T::timer_skew (const ACE_Time_Value &skew) -{ - timer_skew_ = skew; -} - -template ACE_INLINE const ACE_Time_Value & -ACE_Timer_Queue_T::timer_skew (void) const -{ - return timer_skew_; -} - -template ACE_INLINE int -ACE_Timer_Queue_T::expire (void) -{ - if (!this->is_empty ()) - return this->expire (this->gettimeofday () + timer_skew_); - else - return 0; -} - -template int -ACE_Timer_Queue_T::dispatch_info (const ACE_Time_Value &cur_time, - ACE_Timer_Node_Dispatch_Info_T &info) -{ - ACE_TRACE ("ACE_Timer_Queue_T::dispatch_info"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, 0)); - - return this->dispatch_info_i (cur_time, info); -} - -template ACE_INLINE void -ACE_Timer_Queue_T::upcall (ACE_Timer_Node_Dispatch_Info_T &info, - const ACE_Time_Value &cur_time) -{ - this->upcall_functor ().timeout (*this, - info.type_, - info.act_, - info.recurring_timer_, - cur_time); -} - -template ACE_INLINE void -ACE_Timer_Queue_T::preinvoke (ACE_Timer_Node_Dispatch_Info_T &info, - const ACE_Time_Value &cur_time, - const void *&upcall_act) -{ - this->upcall_functor ().preinvoke (*this, - info.type_, - info.act_, - info.recurring_timer_, - cur_time, - upcall_act); -} - -template ACE_INLINE void -ACE_Timer_Queue_T::postinvoke (ACE_Timer_Node_Dispatch_Info_T &info, - const ACE_Time_Value &cur_time, - const void *upcall_act) -{ - this->upcall_functor ().postinvoke (*this, - info.type_, - info.act_, - info.recurring_timer_, - cur_time, - upcall_act); -} - -template ACE_INLINE ACE_Time_Value -ACE_Timer_Queue_T::gettimeofday (void) -{ - // Invoke gettimeofday via pointer to function. - return this->gettimeofday_ (); -} - -template ACE_INLINE void -ACE_Timer_Queue_T::gettimeofday (ACE_Time_Value (*gettimeofday)(void)) -{ - this->gettimeofday_ = gettimeofday; -} - -template ACE_INLINE FUNCTOR & -ACE_Timer_Queue_T::upcall_functor (void) -{ - return *this->upcall_functor_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Timer_Queuefwd.h b/ace/Timer_Queuefwd.h deleted file mode 100644 index 6e03204bdde..00000000000 --- a/ace/Timer_Queuefwd.h +++ /dev/null @@ -1,38 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timer_Queuefwd.h - * - * $Id$ - * - * Forward declarations and typedefs of ACE_Timer_Queue class. - * - * @author Ossama Othman - */ -//============================================================================= - -#ifndef ACE_TIMER_QUEUE_FWD_H -#define ACE_TIMER_QUEUE_FWD_H - -#include /**/ "ace/pre.h" - -#include "ace/Synch_Traits.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template class ACE_Timer_Queue_T; -template class ACE_Event_Handler_Handle_Timeout_Upcall; - -class ACE_Event_Handler; - -typedef ACE_Timer_Queue_T, - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Timer_Queue; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_TIMER_QUEUE_FWD_H */ diff --git a/ace/Timer_Wheel.cpp b/ace/Timer_Wheel.cpp deleted file mode 100644 index 4bd16b73df4..00000000000 --- a/ace/Timer_Wheel.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// $Id$ - -#include "ace/Timer_Wheel.h" -#include "ace/Synch_Traits.h" -#include "ace/Recursive_Thread_Mutex.h" - -#if defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_Wheel_T.cpp" -#endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ - -ACE_RCSID(ace, Timer_Wheel, "$Id$") - diff --git a/ace/Timer_Wheel.h b/ace/Timer_Wheel.h deleted file mode 100644 index 307e56b5542..00000000000 --- a/ace/Timer_Wheel.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timer_Wheel.h - * - * $Id$ - * - * @author Darrell Brunsch (brunsch@cs.wustl.edu) - */ -//============================================================================= - - -#ifndef ACE_TIMER_WHEEL_H -#define ACE_TIMER_WHEEL_H -#include /**/ "ace/pre.h" - -#include "ace/Timer_Wheel_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The following typedefs are here for ease of use and backward -// compatibility. - -typedef ACE_Timer_Wheel_T, - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Timer_Wheel; - -typedef ACE_Timer_Wheel_Iterator_T, - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Timer_Wheel_Iterator; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_WHEEL_H */ diff --git a/ace/Timer_Wheel_T.cpp b/ace/Timer_Wheel_T.cpp deleted file mode 100644 index 149de55c520..00000000000 --- a/ace/Timer_Wheel_T.cpp +++ /dev/null @@ -1,964 +0,0 @@ -// $Id$ - -#ifndef ACE_TIMER_WHEEL_T_CPP -#define ACE_TIMER_WHEEL_T_CPP - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_sys_time.h" -#include "ace/Guard_T.h" -#include "ace/Timer_Wheel_T.h" -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Design/implementation notes for ACE_Timer_Wheel_T. -// -// Each timer queue entry is represented by a ACE_Timer_Node. -// The timing wheel is divided into a number of "spokes"; there are -// spoke_count_ spokes in the wheel. Each timer is hashed into one of the -// spokes. Entries within each spoke are linked in a double-linked list -// in order of increasing expiration. The first ACE_Timer_Node in each -// spoke is a "dummy node" that marks the end of the list of ACE_Timer_Nodes -// in that spoke. -// -// The timer ID for a scheduled timer is formed by its spoke position in -// the wheel, and the number of timers that have been inserted in that spoke -// since the queue was initialized. N bits of the long timer_id are used -// to determine the spoke, and M bits are used as a counter. -// Each time a Node is inserted into a spoke, it's counter -// is incremented. The count is kept in the timer ID field -// of the dummy root Node. In the event of overflow of the counter, the spoke -// must be searched for each new id to make sure it's not already in use. To -// prevent having to do an exhaustive search each time, we keep extra data -// in the dummy root Node. -/** -* Default Constructor that sets defaults for spoke_count_ and resolution_ -* and doesn't do any preallocation. -* -* @param upcall_functor A pointer to a functor to use instead of the default -* @param freelist A pointer to a freelist to use instead of the default -*/ -template -ACE_Timer_Wheel_T::ACE_Timer_Wheel_T -(FUNCTOR* upcall_functor - , FreeList* freelist - ) -: Base (upcall_functor, freelist) -, spokes_(0) -, spoke_count_(0) // calculated in open_i -, spoke_bits_(0) -, res_bits_ (0) -, earliest_spoke_ (0) -, iterator_(0) -, timer_count_(0) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::ACE_Timer_Wheel_T"); - this->open_i (0, - ACE_DEFAULT_TIMER_WHEEL_SIZE, - ACE_DEFAULT_TIMER_WHEEL_RESOLUTION); -} - -/** -* Constructor that sets up the timing wheel and also may preallocate -* some nodes on the free list -* -* @param spoke_count The number of lists in the timer wheel -* @param resolution The time resolution in milliseconds used by the hashing function -* @param prealloc The number of entries to prealloc in the free_list -* @param upcall_functor A pointer to a functor to use instead of the default -* @param freelist A pointer to a freelist to use instead of the default -*/ -template -ACE_Timer_Wheel_T::ACE_Timer_Wheel_T - (u_int spoke_count, - u_int resolution, - size_t prealloc, - FUNCTOR* upcall_functor, - FreeList* freelist) -: Base (upcall_functor, freelist) -, spokes_ (0) -, spoke_count_ (0) // calculated in open_i -, spoke_bits_ (0) -, res_bits_ (0) -, earliest_spoke_ (0) -, iterator_ (0) -, timer_count_ (0) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::ACE_Timer_Wheel_T"); - this->open_i (prealloc, spoke_count, resolution); -} - -template int -ACE_Timer_Wheel_T::power2bits (int n, - int min_bits, - int max_bits) -{ - int max = (1 << max_bits) - 1; - if (n > max) - return max_bits; - - // count the bits in n. - int i = 0; - int tmp = n; - do - { - tmp >>= 1; - ++i; - } - while (tmp != 0); - - if (i <= min_bits) - return min_bits; - - // Which is nearest? - int a = (1 << i) - n; - int b = (1 << (i - 1)) - n; - if (b < 0) - b = -b; - if (b < a) - return i - 1; - return i; -} - -/** -* Initialize the queue. Uses the established members for all needed -* information. -*/ -template void -ACE_Timer_Wheel_T::open_i - (size_t prealloc, u_int spokes, u_int res) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::open_i"); - - this->gettimeofday (ACE_OS::gettimeofday); - - // Rather than waste bits in our timer id, we might as well round up - // the spoke count to the next power of two - 1 . (i.e 1,3,7,15,...127,etc.) - const int MIN_SPOKE_BITS = 3; // Allow between 8 and 4096 spokes - const int MAX_SPOKE_BITS = 12; - const int MAX_RES_BITS = 20; // 20 is plenty, even on 64 bit platforms. - - this->spoke_bits_ = power2bits (spokes, MIN_SPOKE_BITS, MAX_SPOKE_BITS); - this->res_bits_ = power2bits (res, 1, MAX_RES_BITS); - - this->spoke_count_ = 1 << this->spoke_bits_; - - this->free_list_->resize (prealloc + this->spoke_count_); - - this->wheel_time_.msec (1 << (this->res_bits_ + this->spoke_bits_)); - - ACE_NEW (this->spokes_, ACE_Timer_Node_T* [this->spoke_count_]); - - // Create the root nodes. These will be treated specially - for (u_int i = 0; i < this->spoke_count_; ++i) - { - ACE_Timer_Node_T* root = this->alloc_node (); - root->set (0, 0, ACE_Time_Value::zero, ACE_Time_Value::zero, root, root, 0); - this->spokes_[i] = root; - } - - ACE_NEW (iterator_, Iterator (*this)); -} - -/// Destructor just cleans up its memory -template -ACE_Timer_Wheel_T::~ACE_Timer_Wheel_T (void) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::~ACE_Timer_Wheel_T"); - - delete iterator_; - - for (u_int i = 0; i < this->spoke_count_; ++i) - { - // Free all the nodes starting at the root - ACE_Timer_Node_T* root = this->spokes_[i]; - for (ACE_Timer_Node_T* n = root->get_next (); n != root;) - { - ACE_Timer_Node_T* next = n->get_next (); - this->upcall_functor ().deletion (*this, - n->get_type (), - n->get_act ()); - this->free_node (n); - n = next; - } - delete root; - } - delete[] this->spokes_; -} - -/// Searches for a node by timer_id within one spoke. -template -ACE_Timer_Node_T* -ACE_Timer_Wheel_T::find_spoke_node - (u_int spoke, long timer_id) const -{ - ACE_Timer_Node_T* root = this->spokes_[spoke]; - for (ACE_Timer_Node_T* n = root->get_next (); - n != root; - n = n->get_next ()) - { - if (n->get_timer_id () == timer_id) - return n; - } - return 0; -} - -/// Searches all spokes for a node matching the specified timer_id -/// Uses the spoke encoded in the timer_id as a starting place. -template -ACE_Timer_Node_T* -ACE_Timer_Wheel_T::find_node (long timer_id) const -{ - if (timer_id == -1) - return 0; - - // Search the spoke where timer_id was originally scheduled - u_int spoke_mask = this->spoke_count_ - 1; - u_int start = timer_id & spoke_mask; - ACE_Timer_Node_T* n = this->find_spoke_node (start, timer_id); - if (n != 0) - return n; - - //ACE_ERROR((LM_ERROR, "Node not found in original spoke.\n")); - - // Search the rest of the spokes - for (u_int i = 0; i < this->spoke_count_; ++i) - { - if (i != start) - { // already searched this one - n = this->find_spoke_node (i, timer_id); - if (n != 0) - return n; - } - } - - //ACE_ERROR((LM_ERROR, "Node not found.\n")); - return 0; -} - -/** -* Check to see if the wheel is empty -* -* @return True if empty -*/ -template int -ACE_Timer_Wheel_T::is_empty (void) const -{ - ACE_TRACE ("ACE_Timer_Wheel_T::is_empty"); - return timer_count_ == 0; -} - - -/** -* @return First (earliest) node in the wheel_'s earliest_spoke_ list -*/ -template const ACE_Time_Value & -ACE_Timer_Wheel_T::earliest_time (void) const -{ - ACE_TRACE ("ACE_Timer_Wheel_T::earliest_time"); - ACE_Timer_Node_T* n = this->get_first_i (); - if (n != 0) - return n->get_timer_value (); - return ACE_Time_Value::zero; -} - -/// Uses a simple hash to find which spoke to use based on when the -/// timer is due to expire. Hopefully the 64bit int operations avoid -/// any overflow problems. -template u_int -ACE_Timer_Wheel_T::calculate_spoke - (const ACE_Time_Value& t) const -{ - return static_cast ((t.msec () >> this->res_bits_) & (this->spoke_count_ - 1)); -} - -/// Generates a unique timer_id for the given spoke. It should be pretty -/// fast until the point where the counter overflows. At that time you -/// have to do exhaustive searches within the spoke to ensure that a particular -/// timer id is not already in use. Some optimizations are in place so -/// that this hopefully doesn't have to happen often. -template long -ACE_Timer_Wheel_T::generate_timer_id (u_int spoke) -{ - - int cnt_bits = sizeof (long) * 8 - this->spoke_bits_; - long max_cnt = ((long)1 << cnt_bits) - 1; - if (spoke == this->spoke_count_) - --max_cnt; // Because -1 is used as a special invalid timer_id. - - ACE_Timer_Node_T* root = this->spokes_[spoke]; - - if (root == root->get_next ()) - root->set_act(0); - - // We use this field to keep track of the next counter value that - // may be in use. Of course it may have expired, so we just use - // this field so that we know when we don't have to check for duplicates -#if defined (ACE_WIN64) - // The cast below is legit... we know that long is shorter than a - // pointer, but are only using it as a 'long' storage area. -# pragma warning(push) -# pragma warning(disable : 4311) -#endif /* ACE_WIN64 */ - long next_cnt = reinterpret_cast (root->get_act ()); -#if defined (ACE_WIN64) -# pragma warning(pop) -#endif /* ACE_WIN64 */ - - // This field is used as a counter instead of a timer_id. - long cnt = root->get_timer_id (); - - if (cnt >= max_cnt && root == root->get_next ()) - { - // Special case when we overflow on an empty spoke. We can just - // wrap the count around without searching for duplicates. We only - // want to do this when the counter overflows, so that we return - // unique timer_id values as often as possible. - root->set_timer_id (1); - return spoke; - } - else if (cnt >= max_cnt) - { // overflow - cnt = 0; // try again starting at zero - } - else if (next_cnt == 0 || cnt < next_cnt) - { - root->set_timer_id (cnt + 1); - return (cnt << this->spoke_bits_) | spoke; - } - - //ACE_ERROR((LM_ERROR, "Timer id overflow. We have to search now.\n")); - - // We've run out of consecutive id numbers so now we have to search - // for a unique id. - // We'll try increasing numbers until we find one that is not in use, - // and we'll record the next highest number so that we can avoid this - // search as often as possible. - for (; cnt < max_cnt - 1; ++cnt) - { - long id = (cnt << this->spoke_bits_) | spoke; - ACE_Timer_Node_T* n = this->find_spoke_node (spoke, id); - if (n == 0) - { - root->set_timer_id (cnt + 1); - // Now we need to find the next highest cnt in use - next_cnt = 0; - for (; n != root; n = n->get_next ()) - { - long tmp = n->get_timer_id () >> this->spoke_bits_; - if (tmp > cnt && (tmp < next_cnt || next_cnt == 0)) - next_cnt = tmp; - } -#if defined (ACE_WIN64) - // The cast below is legit... we know we're storing a long in - // a pointer, but are only using it as a 'long' storage area. -# pragma warning(push) -# pragma warning(disable : 4312) -#endif /* ACE_WIN64 */ - root->set_act (reinterpret_cast (next_cnt)); -#if defined (ACE_WIN64) -# pragma warning(pop) -#endif /* ACE_WIN64 */ - return id; - } - } - - return -1; // We did our best, but the spoke is full. -} - -/** -* Creates a ACE_Timer_Node_T based on the input parameters. Then inserts -* the node into the wheel using reschedule (). Then returns a timer_id. -* -* @param type The data of the timer node -* @param act Asynchronous Completion Token (AKA magic cookie) -* @param future_time The time the timer is scheduled for (absolute time) -* @param interval If not ACE_Time_Value::zero, then this is a periodic -* timer and interval is the time period -* -* @return Unique identifier (can be used to cancel the timer). -* -1 on failure. -*/ -template long -ACE_Timer_Wheel_T::schedule_i (const TYPE& type, - const void* act, - const ACE_Time_Value& future_time, - const ACE_Time_Value& interval) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::schedule_i"); - - ACE_Timer_Node_T* n = this->alloc_node (); - - if (n != 0) - { - u_int spoke = calculate_spoke (future_time); - long id = generate_timer_id (spoke); - - //ACE_ERROR((LM_ERROR, "Scheduling %x spoke:%d id:%d\n", (long) n, spoke, id)); - - if (id != -1) - { - n->set (type, act, future_time, interval, 0, 0, id); - this->schedule_i (n, spoke, future_time); - } - return id; - } - - // Failure return - errno = ENOMEM; - return -1; -} - -/** -* Takes an ACE_Timer_Node and inserts it into the correct position in -* the correct list. Also makes sure to update the earliest time. -* -* @param n The timer node to reschedule -*/ -template void -ACE_Timer_Wheel_T::reschedule (ACE_Timer_Node_T* n) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::reschedule"); - const ACE_Time_Value& expire = n->get_timer_value (); - u_int spoke = calculate_spoke (expire); - this->schedule_i (n, spoke, expire); -} - -/// The shared scheduling functionality between schedule() and reschedule() -template void -ACE_Timer_Wheel_T::schedule_i - (ACE_Timer_Node_T* n, - u_int spoke, - const ACE_Time_Value& expire) -{ - // See if we need to update the earliest time - if (this->is_empty() || expire < this->earliest_time ()) - this->earliest_spoke_ = spoke; - - ACE_Timer_Node_T* root = this->spokes_[spoke]; - ACE_Timer_Node_T* last = root->get_prev (); - - ++timer_count_; - - // If the spoke is empty - if (last == root) { - n->set_prev (root); - n->set_next (root); - root->set_prev (n); - root->set_next (n); - return; - } - - // We always want to search backwards from the tail of the list, because - // this minimizes the search in the extreme case when lots of timers are - // scheduled for exactly the same time - ACE_Timer_Node_T* p = root->get_prev (); - while (p != root && p->get_timer_value () > expire) - p = p->get_prev (); - - // insert after - n->set_prev (p); - n->set_next (p->get_next ()); - p->get_next ()->set_prev (n); - p->set_next (n); -} - - -/** -* Find the timer node by using the id as a pointer. Then use set_interval() -* on the node to update the interval. -* -* @param timer_id The timer identifier -* @param interval The new interval -* -* @return 0 if successful, -1 if no. -*/ -template int -ACE_Timer_Wheel_T::reset_interval (long timer_id, - const ACE_Time_Value &interval - ) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::reset_interval"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - ACE_Timer_Node_T* n = this->find_node (timer_id); - if (n != 0) - { - // The interval will take effect the next time this node is expired. - n->set_interval (interval); - return 0; - } - return -1; -} - - -/** -* Goes through every list in the wheel and whenever we find one with the -* correct type value, we remove it and continue. At the end make sure -* we reset the earliest time value in case the earliest timers were -* removed. -* -* @param type The value to search for. -* @param skip_close If this non-zero, the cancellation method of the -* functor will not be called for each cancelled timer. -* -* @return Number of timers cancelled -*/ -template int -ACE_Timer_Wheel_T::cancel (const TYPE& type, int skip_close) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::cancel"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - int num_canceled = 0; // Note : Technically this can overflow. - - if (!this->is_empty ()) - { - ACE_Timer_Node_T* first = this->get_first (); - ACE_Time_Value last = first->get_timer_value (); - int recalc = 0; - - for (u_int i = 0; i < this->spoke_count_; ++i) - { - ACE_Timer_Node_T* root = this->spokes_[i]; - for (ACE_Timer_Node_T* n = root->get_next (); n != root; ) - { - if (n->get_type () == type) - { - ++num_canceled; - if (n == first) - recalc = 1; - - ACE_Timer_Node_T* tmp = n; - n = n->get_next (); - - this->cancel_i (tmp); - } - else - { - n = n->get_next (); - } - } - } - - if (recalc) - this->recalc_earliest (last); - } - - // Call the close hooks. - int cookie = 0; - - // cancel_type() called once per . - this->upcall_functor ().cancel_type (*this, - type, - skip_close, - cookie); - - for (int i = 0; - i < num_canceled; - ++i) - { - // cancel_timer() called once per . - this->upcall_functor ().cancel_timer (*this, - type, - skip_close, - cookie); - } - - return num_canceled; -} - - -/** -* Cancels the single timer that is specified by the timer_id. In this -* case the timer_id is actually a pointer to the node, so we cast it -* to the node. This can be dangerous if the timer_id is made up -* (or deleted twice) so we do a little sanity check. Finally we update -* the earliest time in case the earliest timer was removed. -* -* @param timer_id Timer Identifier -* @param act Asychronous Completion Token (AKA magic cookie): -* If this is non-zero, stores the magic cookie of -* the cancelled timer here. -* @param skip_close If this non-zero, the cancellation method of the -* functor will not be called. -* -* @return 1 for sucess and 0 if the timer_id wasn't found (or was -* found to be invalid) -*/ -template int -ACE_Timer_Wheel_T::cancel (long timer_id, - const void **act, - int skip_close) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::cancel"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - ACE_Timer_Node_T* n = this->find_node (timer_id); - if (n != 0) - { - ACE_Time_Value last = n->get_timer_value (); - - int recalc = (this->get_first_i () == n); - - // Call the close hooks. - int cookie = 0; - - // cancel_type() called once per . - this->upcall_functor ().cancel_type (*this, - n->get_type (), - skip_close, - cookie); - - // cancel_timer() called once per . - this->upcall_functor ().cancel_timer (*this, - n->get_type (), - skip_close, - cookie); - if (act != 0) - *act = n->get_act (); - - this->cancel_i (n); - - if (recalc) - this->recalc_earliest (last); - - return 1; - } - return 0; -} - -/// Shared subset of the two cancel() methods. -template void -ACE_Timer_Wheel_T::cancel_i (ACE_Timer_Node_T* n) -{ - this->unlink (n); - this->free_node (n); -} - -/// There are a few places where we have to figure out which timer -/// will expire next. This method makes the assumption that spokes -/// are always sorted, and that timers are always in the correct spoke -/// determined from their expiration time. -/// The last time is always passed in, even though you can often calculate -/// it as get_first()->get_timer_value(). -template void -ACE_Timer_Wheel_T::recalc_earliest - (const ACE_Time_Value& last) -{ - // This is possible because we use a count for is_empty() - if (this->is_empty ()) - return; - - ACE_Time_Value et = ACE_Time_Value::zero; - u_int es = 0; - u_int spoke = this->earliest_spoke_; - - // We will have to go around the wheel at most one time. - for (u_int i = 0; i < this->spoke_count_; ++i) - { - ACE_Timer_Node_T* root = this->spokes_[spoke]; - ACE_Timer_Node_T* n = root->get_next (); - if (n != root) - { - ACE_Time_Value t = n->get_timer_value (); - if (t < last + this->wheel_time_) - { - this->earliest_spoke_ = spoke; - return; - } - else if (et == ACE_Time_Value::zero || t < et) - { - et = t; - es = spoke; - } - } - if (++spoke >= this->spoke_count_) - spoke = 0; - } - - this->earliest_spoke_ = es; - //ACE_ERROR((LM_ERROR, "We had to search the whole wheel.\n")); -} - -/** -* Dumps out the size of the wheel, the resolution, and the contents -* of the wheel. -*/ -template void -ACE_Timer_Wheel_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Timer_Wheel_T::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\nspoke_count_ = %d"), this->spoke_count_)); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\nresolution_ = %d"), 1 << this->res_bits_)); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\nwheel_ = \n"))); - - for (u_int i = 0; i < this->spoke_count_; ++i) - { - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("%d\n"), i)); - ACE_Timer_Node_T* root = this->spokes_[i]; - for (ACE_Timer_Node_T* n = root->get_next (); - n != root; - n = n->get_next ()) - { - n->dump (); - } - } - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - - -/** -* Removes the earliest node and then find the new -* -* @return The earliest timer node. -*/ -template ACE_Timer_Node_T * -ACE_Timer_Wheel_T::remove_first (void) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::remove_first"); - return remove_first_expired (ACE_Time_Value::max_time); -} - -template void -ACE_Timer_Wheel_T::unlink (ACE_Timer_Node_T* n) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::unlink"); - --timer_count_; - n->get_prev ()->set_next (n->get_next ()); - n->get_next ()->set_prev (n->get_prev ()); - n->set_prev (0); - n->set_next (0); -} - -template ACE_Timer_Node_T * -ACE_Timer_Wheel_T::remove_first_expired (const ACE_Time_Value& now) -{ - ACE_Timer_Node_T* n = this->get_first (); - if (n != 0 && n->get_timer_value() <= now) - { - this->unlink (n); - this->recalc_earliest (n->get_timer_value ()); - return n; - } - return 0; -} - -/** -* Returns the earliest node without removing it -* -* @return The earliest timer node. -*/ -template -ACE_Timer_Node_T* -ACE_Timer_Wheel_T::get_first (void) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::get_first"); - return this->get_first_i (); -} - -template -ACE_Timer_Node_T* -ACE_Timer_Wheel_T::get_first_i (void) const -{ - ACE_Timer_Node_T* root = this->spokes_[this->earliest_spoke_]; - ACE_Timer_Node_T* first = root->get_next (); - if (first != root) - return first; - return 0; -} - - -/** -* @return The iterator -*/ -template -ACE_Timer_Queue_Iterator_T& -ACE_Timer_Wheel_T::iter (void) -{ - this->iterator_->first (); - return *this->iterator_; -} - -/** -* Dummy version of expire to get rid of warnings in Sun CC 4.2 -* Just call the expire of the base class. -*/ -template int -ACE_Timer_Wheel_T::expire () -{ - return ACE_Timer_Queue_T::expire (); -} - -/** -* This is a specialized version of expire that is more suited for the -* internal data representation. -* -* @param cur_time The time to expire timers up to. -* -* @return Number of timers expired -*/ -template int -ACE_Timer_Wheel_T::expire (const ACE_Time_Value& cur_time) -{ - ACE_TRACE ("ACE_Timer_Wheel_T::expire"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - int expcount = 0; - ACE_Timer_Node_T* n = this->remove_first_expired (cur_time); - - while (n != 0) - { - ++expcount; - - //ACE_ERROR((LM_ERROR, "Expiring %x\n", (long) n)); - - ACE_Timer_Node_Dispatch_Info_T info; - - // Get the dispatch info - n->get_dispatch_info (info); - - if (n->get_interval () > ACE_Time_Value::zero) - { - // Make sure that we skip past values that have already - // "expired". - do - n->set_timer_value (n->get_timer_value () + - n->get_interval ()); - while (n->get_timer_value () <= cur_time); - - this->reschedule (n); - } - else - { - this->free_node (n); - } - - const void *upcall_act = 0; - - this->preinvoke (info, cur_time, upcall_act); - - this->upcall (info, cur_time); - - this->postinvoke (info, cur_time, upcall_act); - - n = this->remove_first_expired (cur_time); - } - - return expcount; -} - -/////////////////////////////////////////////////////////////////////////// -// ACE_Timer_Wheel_Iterator_T - -/** -* Just initializes the iterator with a ACE_Timer_Wheel_T and then calls -* first() to initialize the rest of itself. -* -* @param wheel A reference for a timer queue to iterate over -*/ -template -ACE_Timer_Wheel_Iterator_T::ACE_Timer_Wheel_Iterator_T -(Wheel& wheel) -: timer_wheel_ (wheel) -{ - this->first(); -} - - -/** -* Destructor, at this level does nothing. -*/ -template -ACE_Timer_Wheel_Iterator_T::~ACE_Timer_Wheel_Iterator_T (void) -{ -} - - -/** -* Positions the iterator at the first position in the timing wheel -* that contains something. spoke_ will be set to the spoke position of -* this entry and current_node_ will point to the first entry in that spoke. -* -* If the wheel is empty, spoke_ will be equal timer_wheel_.spoke_count_ and -* current_node_ would be 0. -*/ -template void -ACE_Timer_Wheel_Iterator_T::first (void) -{ - this->goto_next(0); -} - - -/** -* Positions the iterator at the next node. -*/ -template void -ACE_Timer_Wheel_Iterator_T::next (void) -{ - if (this->isdone()) - return; - - ACE_Timer_Node_T* n = this->current_node_->get_next (); - ACE_Timer_Node_T* root = this->timer_wheel_.spokes_[this->spoke_]; - if (n == root) - this->goto_next (this->spoke_ + 1); - else - this->current_node_ = n; -} - -/// Helper class for common functionality of next() and first() -template void -ACE_Timer_Wheel_Iterator_T::goto_next (u_int start_spoke) -{ - // Find the first non-empty entry. - u_int sc = this->timer_wheel_.spoke_count_; - for (u_int i = start_spoke; i < sc; ++i) - { - ACE_Timer_Node_T* root = this->timer_wheel_.spokes_[i]; - ACE_Timer_Node_T* n = root->get_next (); - if (n != root) - { - this->spoke_ = i; - this->current_node_ = n; - return; - } - } - // empty - this->spoke_ = sc; - this->current_node_ = 0; -} - -/** -* @return True when we there aren't any more items (when current_node_ == 0) -*/ -template int -ACE_Timer_Wheel_Iterator_T::isdone (void) const -{ - return this->current_node_ == 0; -} - -/** -* @return The node at the current spokeition in the sequence or 0 if the wheel -* is empty -*/ -template ACE_Timer_Node_T * -ACE_Timer_Wheel_Iterator_T::item (void) -{ - return this->current_node_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TIMER_WHEEL_T_CPP */ diff --git a/ace/Timer_Wheel_T.h b/ace/Timer_Wheel_T.h deleted file mode 100644 index 984ad6d8bb7..00000000000 --- a/ace/Timer_Wheel_T.h +++ /dev/null @@ -1,228 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Timer_Wheel_T.h - * - * $Id$ - * - * @author Darrell Brunsch - */ -//============================================================================= - -#ifndef ACE_TIMER_WHEEL_T_H -#define ACE_TIMER_WHEEL_T_H -#include /**/ "ace/pre.h" - -#include "ace/Timer_Queue_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration -template -class ACE_Timer_Wheel_T; - -/** - * @class ACE_Timer_Wheel_Iterator_T - * - * @brief Iterates over an . - * - * This is a generic iterator that can be used to visit every - * node of a timer queue. Be aware that it doesn't traverse - * in the order of timeout values. - */ -template -class ACE_Timer_Wheel_Iterator_T - : public ACE_Timer_Queue_Iterator_T -{ -public: - typedef ACE_Timer_Wheel_T Wheel; - typedef ACE_Timer_Node_T Node; - - /// Constructor - ACE_Timer_Wheel_Iterator_T (Wheel &); - - /// Destructor - ~ACE_Timer_Wheel_Iterator_T (void); - - /// Positions the iterator at the earliest node in the Timer Queue - virtual void first (void); - - /// Positions the iterator at the next node in the Timer Queue - virtual void next (void); - - /// Returns true when there are no more nodes in the sequence - virtual int isdone (void) const; - - /// Returns the node at the current position in the sequence - virtual ACE_Timer_Node_T* item (void); - -protected: - /// Pointer to the ACE_Timer_List that we are iterating over. - Wheel& timer_wheel_; - - /// Current position in the timing wheel - u_int spoke_; - - /// Pointer to the position in the the th list - ACE_Timer_Node_T* current_node_; -private: - void goto_next(u_int start_spoke); -}; - -/** - * @class ACE_Timer_Wheel_T - * - * @brief Provides a Timing Wheel version of ACE_Timer_Queue. - * - * This implementation uses a hash table of ordered doubly- - * linked lists of absolute times. The enhancements over the - * @c ACE_Timer_List include adding a free list and the ability - * to preallocate nodes. Timer Wheel is based on the timing - * wheel implementation used in Adam M. Costello and - * George Varghese's paper "Redesigning the BSD Callout and - * Timer Facilities" - * (http://dworkin.wustl.edu/~varghese/PAPERS/newbsd.ps.Z) - */ -template -class ACE_Timer_Wheel_T : public ACE_Timer_Queue_T -{ -public: - /// Type of iterator - typedef ACE_Timer_Wheel_Iterator_T Iterator; - /// Iterator is a friend - friend class ACE_Timer_Wheel_Iterator_T; - typedef ACE_Timer_Node_T Node; - /// Type inherited from - typedef ACE_Timer_Queue_T Base; - typedef ACE_Free_List FreeList; - - /// Default constructor - ACE_Timer_Wheel_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0); - - /// Constructor with opportunities to set the wheelsize and resolution - ACE_Timer_Wheel_T (u_int spoke_count, - u_int resolution, - size_t prealloc = 0, - FUNCTOR* upcall_functor = 0, - FreeList* freelist = 0); - - /// Destructor - virtual ~ACE_Timer_Wheel_T (void); - - /// True if queue is empty, else false. - virtual int is_empty (void) const; - - /// Returns the time of the earlier node in the . - /// Must be called on a non-empty queue. - virtual const ACE_Time_Value& earliest_time (void) const; - - /// Changes the interval of a timer (and can make it periodic or non - /// periodic by setting it to ACE_Time_Value::zero or not). - virtual int reset_interval (long timer_id, - const ACE_Time_Value& interval); - - /// Cancel all timer associated with . If is 0 - /// then the will be invoked. Returns number of timers - /// cancelled. - virtual int cancel (const TYPE& type, - int dont_call_handle_close = 1); - - // Cancel a timer, storing the magic cookie in act (if nonzero). - // Calls the functor if dont_call_handle_close is 0 and returns 1 - // on success - virtual int cancel (long timer_id, - const void** act = 0, - int dont_call_handle_close = 1); - - /// Run the for all timers whose values are <= - /// . Also accounts for . Returns - /// the number of timers canceled. - virtual int expire (void); - - // Run the for all timers whose values are <= . - // This does not account for . Returns the number of - // timers canceled. - int expire (const ACE_Time_Value&); - - /// Returns a pointer to this 's iterator. - virtual ACE_Timer_Queue_Iterator_T& iter (void); - - /// Removes the earliest node from the queue and returns it - virtual ACE_Timer_Node_T* remove_first (void); - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Reads the earliest node from the queue and returns it. - virtual ACE_Timer_Node_T* get_first (void); - -protected: - - /// Schedules a timer. - virtual long schedule_i (const TYPE& type, - const void* act, - const ACE_Time_Value& future_time, - const ACE_Time_Value& interval); - -private: - // The following are documented in the .cpp file. - ACE_Timer_Node_T* get_first_i (void) const; - ACE_Timer_Node_T* remove_first_expired (const ACE_Time_Value& now); - void open_i (size_t prealloc, u_int spokes, u_int res); - virtual void reschedule (ACE_Timer_Node_T *); - ACE_Timer_Node_T* find_spoke_node(u_int spoke, long timer_id) const; - ACE_Timer_Node_T* find_node(long timer_id) const; - u_int calculate_spoke(const ACE_Time_Value& expire) const; - long generate_timer_id(u_int spoke); - void schedule_i (ACE_Timer_Node_T* n, u_int spoke, const ACE_Time_Value& expire); - void cancel_i (ACE_Timer_Node_T* n); - void unlink (ACE_Timer_Node_T* n); - void recalc_earliest(const ACE_Time_Value& last); - -private: - int power2bits (int n, int min_bits, int max_bits); - - /// Timing Wheel. - ACE_Timer_Node_T** spokes_; - /// Size of the timing wheel. - u_int spoke_count_; - /// Number of timer_id bits used for the spoke - int spoke_bits_; - /// Maximum number of timers per spoke - u_int max_per_spoke_; - /// Resolution (in microsoconds) of the timing wheel. - int res_bits_; - /// Index of the list with the earliest time - u_int earliest_spoke_; - /// Iterator used to expire timers. - Iterator* iterator_; - /// The total amount of time in one iteration of the wheel. (resolution * spoke_count) - ACE_Time_Value wheel_time_; - /// The total number of timers currently scheduled. - u_int timer_count_; - - // = Don't allow these operations for now, don't split into multiple lines - // breaks sun compilers - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Wheel_T (const ACE_Timer_Wheel_T &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Wheel_T &)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#if !defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) -#include "ace/Timer_Wheel_T.cpp" -#endif /* !ACE_HAS_BROKEN_HPUX_TEMPLATES */ -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Timer_Wheel_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TIMER_WHEEL_T_H */ diff --git a/ace/TkReactor.cpp b/ace/TkReactor.cpp deleted file mode 100644 index 7f6ae69e320..00000000000 --- a/ace/TkReactor.cpp +++ /dev/null @@ -1,439 +0,0 @@ -#include "ace/TkReactor.h" - -#include "ace/SOCK_Acceptor.h" -#include "ace/SOCK_Connector.h" - -ACE_RCSID(ace, TkReactor, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_TkReactor) - -// Must be called with lock held -ACE_TkReactor::ACE_TkReactor (size_t size, - int restart, - ACE_Sig_Handler *h) - : ACE_Select_Reactor (size, restart, h), - ids_ (0), - timeout_ (0) -{ - // When the ACE_Select_Reactor is constructed it creates the notify - // pipe and registers it with the register_handler_i() method. The - // TkReactor overloads this method BUT because the - // register_handler_i occurs when constructing the base class - // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() - // is called not the TkReactor register_handler_i(). This means - // that the notify pipe is registered with the ACE_Select_Reactor - // event handling code not the TkReactor and so notfications don't - // work. To get around this we simply close and re-opened the - // notification handler in the constructor of the TkReactor. - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - this->notify_handler_->close (); - this->notify_handler_->open (this, 0); -#endif /* ACE_MT_SAFE */ -} - -ACE_TkReactor::~ACE_TkReactor (void) -{ - // Delete the remaining items in the linked list. - - while (this->ids_) - { - ACE_TkReactorID *TkID = this->ids_->next_; - delete this->ids_; - this->ids_ = TkID; - } -} - -// This is just the from ace/Reactor.cpp -// but we use the Tk functions to wait for an event, not to find out which - * one might be available. - */ -void -ACE_TkReactor::InputCallbackProc (ClientData cd, - int /* mask */) -{ - ACE_TkReactor_Input_Callback *callback = (ACE_TkReactor_Input_Callback *) cd; - ACE_TkReactor *self = callback->reactor_; - ACE_HANDLE handle = callback->handle_; - - // my copy isn't const. - ACE_Time_Value zero = ACE_Time_Value::zero; - - ACE_Select_Reactor_Handle_Set wait_set; - - // Deal with one file event. - - // - read which kind of event - if (self->wait_set_.rd_mask_.is_set (handle)) - wait_set.rd_mask_.set_bit (handle); - if (self->wait_set_.wr_mask_.is_set (handle)) - wait_set.wr_mask_.set_bit (handle); - if (self->wait_set_.ex_mask_.is_set (handle)) - wait_set.ex_mask_.set_bit (handle); - - int result = ACE_OS::select (handle + 1, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, &zero); - - ACE_Select_Reactor_Handle_Set dispatch_set; - - // - Use only that one file event (removes events for other files). - if (result > 0) - { - if (wait_set.rd_mask_.is_set (handle)) - dispatch_set.rd_mask_.set_bit (handle); - if (wait_set.wr_mask_.is_set (handle)) - dispatch_set.wr_mask_.set_bit (handle); - if (wait_set.ex_mask_.is_set (handle)) - dispatch_set.ex_mask_.set_bit (handle); - - self->dispatch (1, dispatch_set); - } -} - -int -ACE_TkReactor::TkWaitForMultipleEvents (int width, - ACE_Select_Reactor_Handle_Set &wait_set, - ACE_Time_Value *) -{ - // Check to make sure our handle's are all usable. - ACE_Select_Reactor_Handle_Set temp_set = wait_set; - - if (ACE_OS::select (width, - temp_set.rd_mask_, - temp_set.wr_mask_, - temp_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) - return -1; // Bad file arguments... - - // Instead of waiting using . - return ACE_OS::select (width, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero); -} - -int -ACE_TkReactor::register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_TkReactor::register_handler_i"); - - int result = ACE_Select_Reactor::register_handler_i (handle, - handler, mask); - if (result == -1) - return -1; - - int condition = 0; - -#if !defined ACE_WIN32 - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) - ACE_SET_BITS (condition, TK_READABLE); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) - ACE_SET_BITS (condition, TK_WRITABLE); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) - ACE_SET_BITS (condition, TK_EXCEPTION); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) - ACE_SET_BITS (condition, TK_READABLE); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){ - ACE_SET_BITS (condition, TK_READABLE); // connected, you may write - ACE_SET_BITS (condition, TK_WRITABLE); // connected, you have data/err - } -#else - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) - ACE_SET_BITS (condition, TK_READABLE); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) - ACE_SET_BITS (condition, TK_WRITABLE); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) - ACE_NOTSUP_RETURN(-1); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) - ACE_SET_BITS (condition, TK_READABLE); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){ - ACE_SET_BITS (condition, TK_READABLE); // connected, you may write - ACE_SET_BITS (condition, TK_WRITABLE); // connected, you have data/err - } -#endif /* !ACE_WIN32 */ - - if (condition != 0) - { - ACE_TkReactorID *TkID = this->ids_; - - while(TkID) - { - if (TkID->handle_ == handle) - { - ::Tk_DeleteFileHandler (TkID->handle_); - - ACE_TkReactor_Input_Callback *callback; - ACE_NEW_RETURN (callback, - ACE_TkReactor_Input_Callback, - -1); - callback->reactor_ = this; - callback->handle_ = handle; - ::Tk_CreateFileHandler ((int) handle, - condition, - InputCallbackProc, - (ClientData) callback); - return 0; - } - else - TkID = TkID->next_; - } - - ACE_NEW_RETURN (TkID, - ACE_TkReactorID, - -1); - TkID->next_ = this->ids_; - TkID->handle_ = handle; - ACE_TkReactor_Input_Callback *callback; - ACE_NEW_RETURN (callback, - ACE_TkReactor_Input_Callback, - -1); - callback->reactor_ = this; - callback->handle_ = handle; - - ::Tk_CreateFileHandler ((int) handle, - condition, - InputCallbackProc, - (ClientData) callback); - this->ids_ = TkID; - } - return 0; -} - -int -ACE_TkReactor::register_handler_i (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - return ACE_Select_Reactor::register_handler_i (handles, - handler, - mask); -} - -int -ACE_TkReactor::remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_TkReactor::remove_handler_i"); - - // In the registration phase we registered first with - // ACE_Select_Reactor and then with X. Now we are now doing things - // in reverse order. - - // First clean up the corresponding X11Input. - this->remove_TkFileHandler (handle); - - // Now let the reactor do its work. - return ACE_Select_Reactor::remove_handler_i (handle, - mask); -} - -void -ACE_TkReactor::remove_TkFileHandler (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_TkReactor::remove_TkFileHandler"); - - ACE_TkReactorID *TkID = this->ids_; - - if (TkID) - { - if (TkID->handle_ == handle) - { - ::Tk_DeleteFileHandler (TkID->handle_); - this->ids_ = TkID->next_; - delete TkID; - return; - } - - ACE_TkReactorID *NextID = TkID->next_; - - while (NextID) - { - if (NextID->handle_ == handle) - { - ::Tk_DeleteFileHandler (NextID->handle_); - TkID->next_ = NextID->next_; - delete NextID; - return; - } - else - { - TkID = NextID; - NextID = NextID->next_; - } - } - } -} - -int -ACE_TkReactor::remove_handler_i (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask) -{ - return ACE_Select_Reactor::remove_handler_i (handles, - mask); -} - -// The following functions ensure that there is an Tk timeout for the -// first timeout in the Reactor's Timer_Queue. - -void -ACE_TkReactor::reset_timeout (void) -{ - if (this->timeout_) - ::Tk_DeleteTimerHandler (this->timeout_); - timeout_ = 0; - - ACE_Time_Value *max_wait_time = - this->timer_queue_->calculate_timeout (0); - - if (max_wait_time) - timeout_ = ::Tk_CreateTimerHandler (max_wait_time->msec (), - TimerCallbackProc, - (ClientData) this); -} - -int -ACE_TkReactor::reset_timer_interval - (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_TkReactor::reset_timer_interval"); - ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); - - int result = ACE_Select_Reactor::timer_queue_->reset_interval - (timer_id, - interval); - - if (result == -1) - return -1; - else - { - this->reset_timeout (); - return result; - } -} - -long -ACE_TkReactor::schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_TkReactor::schedule_timer"); - ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); - - long result = ACE_Select_Reactor::schedule_timer (event_handler, - arg, - delay, - interval); - if (result == -1) - return -1; - else - { - this->reset_timeout (); - return result; - } -} - -int -ACE_TkReactor::cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_TkReactor::cancel_timer"); - - if (ACE_Select_Reactor::cancel_timer (handler, - dont_call_handle_close) == -1) - return -1; - else - { - this->reset_timeout (); - return 0; - } -} - -int -ACE_TkReactor::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_TkReactor::cancel_timer"); - - if (ACE_Select_Reactor::cancel_timer (timer_id, - arg, - dont_call_handle_close) == -1) - return -1; - else - { - this->reset_timeout (); - return 0; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TkReactor.h b/ace/TkReactor.h deleted file mode 100644 index 0ae370c0687..00000000000 --- a/ace/TkReactor.h +++ /dev/null @@ -1,136 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file TkReactor.h - * - * $Id$ - * - * @author Nagarajan Surendran - */ -//============================================================================= - - -#ifndef ACE_TKREACTOR_H -#define ACE_TKREACTOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/ACE_TkReactor_export.h" -#include "ace/Select_Reactor.h" -#include /**/ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_TkReactorID - * - * @brief This little class is necessary due to the way that Microsoft - * implements sockets to be pointers rather than indices. - */ -class ACE_TkReactor_Export ACE_TkReactorID -{ -public: - /// Underlying handle. - ACE_HANDLE handle_; - - /// Pointer to next node in the linked list. - ACE_TkReactorID *next_; -}; - -class ACE_TkReactor; - -class ACE_TkReactor_Export ACE_TkReactor_Input_Callback -{ -public: - ACE_TkReactor *reactor_; - ACE_HANDLE handle_; -}; - -/** - * @class ACE_TkReactor - * - * @brief An object-oriented event demultiplexor and event handler - * dispatcher that uses the Tk functions. - */ -class ACE_TkReactor_Export ACE_TkReactor : public ACE_Select_Reactor -{ -public: - // = Initialization and termination methods. - ACE_TkReactor (size_t size = DEFAULT_SIZE, - int restart = 0, - ACE_Sig_Handler * = 0); - - virtual ~ACE_TkReactor (void); - - // = Timer operations. - virtual long schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval); - virtual int reset_timer_interval (long timer_id, - const ACE_Time_Value &interval); - virtual int cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close = 1); - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1); - -protected: - // = Register timers/handles with Tk. - /// Register a single . - virtual int register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask); - - /// Register a set of . - virtual int register_handler_i (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask); - - /// Remove the associated with this . - virtual int remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - /// Remove a set of . - virtual int remove_handler_i (const ACE_Handle_Set &handles, - ACE_Reactor_Mask); - - /// Removes an Tk FileHandler. - virtual void remove_TkFileHandler (ACE_HANDLE handle); - - /// Wait for events to occur. - virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, - ACE_Time_Value *); - - ///Wait for Tk events to occur. - virtual int TkWaitForMultipleEvents (int, - ACE_Select_Reactor_Handle_Set &, - ACE_Time_Value *); - - ACE_TkReactorID *ids_; - Tk_TimerToken timeout_; - -private: - /// This method ensures there's a Tk timeout for the first timeout in - /// the Reactor's Timer_Queue. - void reset_timeout (void); - - // = Integrate with the X callback function mechanism. - static void TimerCallbackProc (ClientData cd); - static void InputCallbackProc (ClientData cd,int mask); - - /// Deny access since member-wise won't work... - ACE_TkReactor (const ACE_TkReactor &); - ACE_TkReactor &operator = (const ACE_TkReactor &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_TK_REACTOR_H */ diff --git a/ace/Token.cpp b/ace/Token.cpp deleted file mode 100644 index f134bd028bf..00000000000 --- a/ace/Token.cpp +++ /dev/null @@ -1,551 +0,0 @@ -// $Id$ - -#include "ace/Token.h" - -#if !defined (__ACE_INLINE__) -# include "ace/Token.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, Token, "$Id$") - -#if defined (ACE_HAS_THREADS) - -#include "ace/Thread.h" -#include "ace/Log_Msg.h" - -#if defined (DEBUGGING) -// FUZZ: disable check_for_streams_include -#include "ace/streams.h" -#endif /* DEBUGGING */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Token) - -void -ACE_Token::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Token::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nthread = %d"), ACE_Thread::self ())); - // @@ Is there a portable way to do this? - // ACE_DEBUG ((LM_DEBUG, "\nowner_ = %d", (long) this->owner_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nowner_ addr = %x"), &this->owner_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nwaiters_ = %d"), this->waiters_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nin_use_ = %d"), this->in_use_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nnesting level = %d"), this->nesting_level_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, - ACE_thread_t t_id) - : next_ (0), - thread_id_ (t_id), -#if defined (ACE_TOKEN_USES_SEMAPHORE) - cv_ (0), -#else - cv_ (m), -#endif /* ACE_TOKEN_USES_SEMAPHORE */ - runable_ (0) -{ -#if defined (ACE_TOKEN_USES_SEMAPHORE) - ACE_UNUSED_ARG (m); -#endif /* ACE_TOKEN_USES_SEMAPHORE */ - - ACE_TRACE ("ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry"); -} - -ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, - ACE_thread_t t_id, - ACE_Condition_Attributes &attributes) - : next_ (0), - thread_id_ (t_id), -#if defined (ACE_TOKEN_USES_SEMAPHORE) - cv_ (0), -#else - cv_ (m, attributes), -#endif /* ACE_TOKEN_USES_SEMAPHORE */ - runable_ (0) -{ -#if defined (ACE_TOKEN_USES_SEMAPHORE) - ACE_UNUSED_ARG (m); - ACE_UNUSED_ARG (attributes); -#endif /* ACE_TOKEN_USES_SEMAPHORE */ - - ACE_TRACE ("ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry"); -} - -ACE_Token::ACE_Token_Queue::ACE_Token_Queue (void) - : head_ (0), - tail_ (0) -{ - ACE_TRACE ("ACE_Token::ACE_Token_Queue::ACE_Token_Queue"); -} - -// -// Remove an entry from the list. Must be called with locks held. -// -void -ACE_Token::ACE_Token_Queue::remove_entry (ACE_Token::ACE_Token_Queue_Entry *entry) -{ - ACE_TRACE ("ACE_Token::ACE_Token_Queue::remove_entry"); - ACE_Token_Queue_Entry *curr = 0; - ACE_Token_Queue_Entry *prev = 0; - - if (this->head_ == 0) - return; - - for (curr = this->head_; - curr != 0 && curr != entry; - curr = curr->next_) - prev = curr; - - if (curr == 0) - // Didn't find the entry... - return; - else if (prev == 0) - // Delete at the head. - this->head_ = this->head_->next_; - else - // Delete in the middle. - prev->next_ = curr->next_; - - // We need to update the tail of the list if we've deleted the last - // entry. - if (curr->next_ == 0) - this->tail_ = prev; -} - -// -// Add an entry into the list. Must be called with locks held. -// -void -ACE_Token::ACE_Token_Queue::insert_entry (ACE_Token::ACE_Token_Queue_Entry &entry, - int requeue_position) -{ - if (this->head_ == 0) - { - // No other threads - just add me - this->head_ = &entry; - this->tail_ = &entry; - } - else if (requeue_position == -1) - { - // Insert at the end of the queue. - this->tail_->next_ = &entry; - this->tail_ = &entry; - } - else if (requeue_position == 0) - { - // Insert at head of queue. - entry.next_ = this->head_; - this->head_ = &entry; - } - else - // Insert in the middle of the queue somewhere. - { - // Determine where our thread should go in the queue of waiters. - - ACE_Token::ACE_Token_Queue_Entry *insert_after = this->head_; - while (requeue_position-- && insert_after->next_ != 0) - insert_after = insert_after->next_; - - entry.next_ = insert_after->next_; - - if (entry.next_ == 0) - this->tail_ = &entry; - - insert_after->next_ = &entry; - } -} - -ACE_Token::ACE_Token (const ACE_TCHAR *name, void *any) - : lock_ (name, (ACE_mutexattr_t *) any), - owner_ (ACE_OS::NULL_thread), - in_use_ (0), - waiters_ (0), - nesting_level_ (0), - attributes_ (USYNC_THREAD), - queueing_strategy_ (FIFO) -{ -// ACE_TRACE ("ACE_Token::ACE_Token"); -} - -ACE_Token::~ACE_Token (void) -{ - ACE_TRACE ("ACE_Token::~ACE_Token"); -} - -int -ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), - void *arg, - ACE_Time_Value *timeout, - ACE_Token_Op_Type op_type) -{ - ACE_TRACE ("ACE_Token::shared_acquire"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - -#if defined (DEBUGGING) - this->dump (); -#endif /* DEBUGGING */ - - ACE_thread_t thr_id = ACE_Thread::self (); - - // Nobody holds the token. - if (!this->in_use_) - { - // Its mine! - this->in_use_ = op_type; - this->owner_ = thr_id; - return 0; - } - - // - // Someone already holds the token. - // - - // Check if it is us. - if (ACE_OS::thr_equal (thr_id, this->owner_)) - { - ++this->nesting_level_; - return 0; - } - - // Do a quick check for "polling" behavior. - if (timeout != 0 && timeout->sec () == 0 && timeout->usec () == 0) - { - errno = ETIME; - return -1; - } - - // - // We've got to sleep until we get the token. - // - - // Which queue we should end up in... - ACE_Token_Queue *queue = (op_type == ACE_Token::READ_TOKEN - ? &this->readers_ - : &this->writers_); - - // Allocate queue entry on stack. This works since we don't exit - // this method's activation record until we've got the token. - ACE_Token::ACE_Token_Queue_Entry my_entry (this->lock_, - thr_id, - this->attributes_); - queue->insert_entry (my_entry, this->queueing_strategy_); - ++this->waiters_; - - // Execute appropriate callback. (@@ should these - // methods return a success/failure status, and if so, what should - // we do with it?) - int ret = 0; - if (sleep_hook_func) - { - (*sleep_hook_func) (arg); - ++ret; - } - else - { - // Execute virtual method. - this->sleep_hook (); - ++ret; - } - - int timed_out = 0; - int error = 0; - - // Sleep until we've got the token (ignore signals). - do - { - int result = my_entry.wait (timeout, - this->lock_); - - if (result == -1) - { - // Note, this should obey whatever thread-specific interrupt - // policy is currently in place... - if (errno == EINTR) - continue; - -#if defined (DEBUGGING) - cerr << '(' << ACE_Thread::self () << ')' - << " acquire: " - << (errno == ETIME ? "timed out" : "error occurred") - << endl; -#endif /* DEBUGGING */ - - // We come here if a timeout occurs or some serious - // ACE_Condition object error. - if (errno == ETIME) - timed_out = 1; - else - error = 1; - - // Stop the loop. - break; - } - } - while (!ACE_OS::thr_equal (thr_id, this->owner_)); - - // Do this always and irrespective of the result of wait(). - --this->waiters_; - queue->remove_entry (&my_entry); - -#if defined (DEBUGGING) - cerr << '(' << ACE_Thread::self () << ')' - << " acquire (UNBLOCKED)" << endl; -#endif /* DEBUGGING */ - - // If timeout occured - if (timed_out) - { - // This thread was still selected to own the token. - if (my_entry.runable_) - { - // Wakeup next waiter since this thread timed out. - this->wakeup_next_waiter (); - } - - // Return error. - return -1; - } - else if (error) - { - // Return error. - return -1; - } - - // If this is a normal wakeup, this thread should be runnable. - ACE_ASSERT (my_entry.runable_); - - return ret; -} - -// By default this is a no-op. - -/* virtual */ -void -ACE_Token::sleep_hook (void) -{ - ACE_TRACE ("ACE_Token::sleep_hook"); -} - -int -ACE_Token::acquire (ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Token::acquire"); - return this->shared_acquire (0, 0, timeout, ACE_Token::WRITE_TOKEN); -} - -// Acquire the token, sleeping until it is obtained or until -// expires. - -int -ACE_Token::acquire (void (*sleep_hook_func)(void *), - void *arg, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Token::acquire"); - return this->shared_acquire (sleep_hook_func, arg, timeout, ACE_Token::WRITE_TOKEN); -} - -// Try to renew the token. - -int -ACE_Token::renew (int requeue_position, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Token::renew"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - -#if defined (DEBUGGING) - this->dump (); -#endif /* DEBUGGING */ - // ACE_ASSERT (ACE_OS::thr_equal (ACE_Thread::self (), this->owner_)); - - // Check to see if there are any waiters worth giving up the lock - // for. - - // If no writers and either we are a writer or there are no readers. - if (this->writers_.head_ == 0 && - (this->in_use_ == ACE_Token::WRITE_TOKEN || - this->readers_.head_ == 0)) - // Immediate return. - return 0; - - // We've got to sleep until we get the token again. - - // Determine which queue should this thread go to. - ACE_Token::ACE_Token_Queue *this_threads_queue = - this->in_use_ == ACE_Token::READ_TOKEN ? - &this->readers_ : &this->writers_; - - ACE_Token::ACE_Token_Queue_Entry my_entry (this->lock_, - this->owner_); - - this_threads_queue->insert_entry (my_entry, - // if requeue_position == 0 then we want to go next, - // otherwise use the queueing strategy, which might also - // happen to be 0. - requeue_position == 0 ? 0 : this->queueing_strategy_); - ++this->waiters_; - - // Remember nesting level... - int const save_nesting_level_ = this->nesting_level_; - - // Reset state for new owner. - this->nesting_level_ = 0; - - // Wakeup waiter. - this->wakeup_next_waiter (); - - int timed_out = 0; - int error = 0; - - // Sleep until we've got the token (ignore signals). - do - { - int result = my_entry.wait (timeout, - this->lock_); - - if (result == -1) - { - // Note, this should obey whatever thread-specific interrupt - // policy is currently in place... - if (errno == EINTR) - continue; - -#if defined (DEBUGGING) - cerr << '(' << ACE_Thread::self () << ')' - << " renew: " - << (errno == ETIME ? "timed out" : "error occurred") - << endl; -#endif /* DEBUGGING */ - - // We come here if a timeout occurs or some serious - // ACE_Condition object error. - if (errno == ETIME) - timed_out = 1; - else - error = 1; - - // Stop the loop. - break; - } - } - while (!ACE_OS::thr_equal (my_entry.thread_id_, this->owner_)); - - // Do this always and irrespective of the result of wait(). - --this->waiters_; - this_threads_queue->remove_entry (&my_entry); - -#if defined (DEBUGGING) - cerr << '(' << ACE_Thread::self () << ')' - << " acquire (UNBLOCKED)" << endl; -#endif /* DEBUGGING */ - - // If timeout occured - if (timed_out) - { - // This thread was still selected to own the token. - if (my_entry.runable_) - { - // Wakeup next waiter since this thread timed out. - this->wakeup_next_waiter (); - } - - // Return error. - return -1; - } - else if (error) - { - // Return error. - return -1; - } - - // If this is a normal wakeup, this thread should be runnable. - ACE_ASSERT (my_entry.runable_); - - // Reinstate nesting level. - this->nesting_level_ = save_nesting_level_; - - return 0; -} - -// Release the current holder of the token (which had -// better be the caller's thread!). - -int -ACE_Token::release (void) -{ - ACE_TRACE ("ACE_Token::release"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - - // ACE_ASSERT (ACE_OS::thr_equal (ACE_Thread::self (), this->owner_)); - -#if defined (DEBUGGING) - this->dump (); -#endif /* DEBUGGING */ - - // Nested release... - if (this->nesting_level_ > 0) - --this->nesting_level_; - else - { - // - // Regular release... - // - - // Wakeup waiter. - this->wakeup_next_waiter (); - } - - return 0; -} - -void -ACE_Token::wakeup_next_waiter (void) -{ - ACE_TRACE ("ACE_Token::wakeup_next_waiter"); - - // Reset state for new owner. - this->owner_ = ACE_OS::NULL_thread; - this->in_use_ = 0; - - // Any waiters... - if (this->writers_.head_ == 0 && - this->readers_.head_ == 0) - { - // No more waiters... - return; - } - - // Wakeup next waiter. - ACE_Token_Queue *queue = 0; - - // Writer threads get priority to run first. - if (this->writers_.head_ != 0) - { - this->in_use_ = ACE_Token::WRITE_TOKEN; - queue = &this->writers_; - } - else - { - this->in_use_ = ACE_Token::READ_TOKEN; - queue = &this->readers_; - } - - // Wake up waiter and make it runable. - queue->head_->runable_ = 1; - queue->head_->signal (); - - this->owner_ = queue->head_->thread_id_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/Token.h b/ace/Token.h deleted file mode 100644 index 2f5174fb95e..00000000000 --- a/ace/Token.h +++ /dev/null @@ -1,376 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Token.h - * - * $Id$ - * - * @author Original author - * @author Karl-Heinz Dorn (kdorn@erlh.siemens.de) - * @author Ported to ACE by - * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) - */ -//============================================================================= - -#ifndef ACE_TOKEN_H -#define ACE_TOKEN_H -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Null_Mutex.h" - -#if defined (ACE_HAS_THREADS) - -#include "ace/Thread_Mutex.h" - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || defined (ACE_VXWORKS) -// If platforms support semaphores with timed wait, then we use semaphores instead of c.v. -# define ACE_TOKEN_USES_SEMAPHORE -#endif /* (ACE_WIN32 && !ACE_HAS_WINCE) || VXWORKS */ - -#if defined (ACE_TOKEN_USES_SEMAPHORE) -# include "ace/Semaphore.h" -#endif /* ACE_TOKEN_USES_SEMAPHORE */ - -#include "ace/Condition_Thread_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_Token - * - * @brief Class that acquires, renews, and releases a synchronization - * token that is serviced in strict FIFO/LIFO ordering and that also - * supports (1) recursion and (2) readers/writer semantics. - * - * This class is a more general-purpose synchronization mechanism - * than many native OS mutexes. For example, it implements - * "recursive mutex" semantics, where a thread that owns the token - * can reacquire it without deadlocking. If the same thread calls - * multiple times, however, it must call an - * equal number of times before the token is actually released. - * Threads that are blocked awaiting the token are serviced in - * strict FIFO/LIFO order as other threads release the token (Solaris - * and Pthread mutexes don't strictly enforce an acquisition - * order). There are two lists within the class. Write - * acquires always have higher priority over read acquires. Which - * means, if you use both write/read operations, care must be - * taken to avoid starvation on the readers. Notice that the - * read/write acquire operations do not have the usual semantic of - * reader/writer locks. Only one reader can acquire the token at - * a time (which is different from the usual reader/writer locks - * where several readers can acquire a lock at the same time as - * long as there is no writer waiting for the lock). We choose - * the names to (1) borrow the semantic to give writers higher - * priority and (2) support a common interface for all locking - * classes in ACE. - */ -class ACE_Export ACE_Token -{ -public: - - /** - * Available queueing strategies. - */ - enum QUEUEING_STRATEGY - { - /// FIFO, First In, First Out. - FIFO = -1, - /// LIFO, Last In, First Out - LIFO = 0 - }; - - // = Initialization and termination. - - /// Constructor - ACE_Token (const ACE_TCHAR *name = 0, void * = 0); - - /// Destructor - virtual ~ACE_Token (void); - - // = Strategies - - /// Retrieve the current queueing strategy. - int queueing_strategy (void); - - /// Set the queueing strategy. - void queueing_strategy (int queueing_strategy); - - // = Synchronization operations. - - /** - * Acquire the token, sleeping until it is obtained or until the - * expiration of , which is treated as "absolute" time. If - * some other thread currently holds the token then is - * called before our thread goes to sleep. This can be - * used by the requesting thread to unblock a token-holder that is - * sleeping, e.g., by means of writing to a pipe (the ACE - * ACE_Reactor uses this functionality). Return values: 0 if - * acquires without calling 1 if is - * called. 2 if the token is signaled. -1 if failure or timeout - * occurs (if timeout occurs errno == ETIME) If == - * <&ACE_Time_Value::zero> then acquire has polling semantics (and - * does *not* call ). - */ - int acquire (void (*sleep_hook)(void *), - void *arg = 0, - ACE_Time_Value *timeout = 0); - - /** - * This behaves just like the previous method, except that - * it invokes the virtual function called that can be - * overridden by a subclass of ACE_Token. - */ - int acquire (ACE_Time_Value *timeout = 0); - - /** - * This should be overridden by a subclass to define the appropriate - * behavior before goes to sleep. By default, this is a - * no-op... - */ - virtual void sleep_hook (void); - - /** - * An optimized method that efficiently reacquires the token if no - * other threads are waiting. This is useful for situations where - * you don't want to degrade the quality of service if there are - * other threads waiting to get the token. If == - * -1 and there are other threads waiting to obtain the token we are - * queued according to the queueing strategy. If - * > -1 then it indicates how many entries to skip over before - * inserting our thread into the list of waiters (e.g., - * == 0 means "insert at front of the queue"). - * Renew has the rather odd semantics such that if there are other - * waiting threads it will give up the token even if the - * nesting_level_ > 1. I'm not sure if this is really the right - * thing to do (since it makes it possible for shared data to be - * changed unexpectedly) so use with caution... This method - * maintians the original token priority. As in , the - * value is an absolute time. - */ - int renew (int requeue_position = 0, - ACE_Time_Value *timeout = 0); - - /// Become interface-compliant with other lock mechanisms (implements - /// a non-blocking ). - int tryacquire (void); - - /// Shuts down the ACE_Token instance. - int remove (void); - - /// Relinquish the token. If there are any waiters then the next one - /// in line gets it. - int release (void); - - /// Behaves like acquire() but at a lower priority. It should probably - /// be called acquire_yield() since the semantics aren't really - /// what's commonly expected for readers/writer locks. See the class - /// documentation above for more details. - int acquire_read (void); - - /// Behaves like acquire() but at a lower priority. It should probably - /// be called acquire_yield() since the semantics aren't really - /// what's commonly expected for readers/writer locks. See the class - /// documentation above for more details. - int acquire_read (void (*sleep_hook)(void *), - void *arg = 0, - ACE_Time_Value *timeout = 0); - - /// Calls acquire(). - int acquire_write (void); - - /// Calls acquire(). - int acquire_write (void (*sleep_hook)(void *), - void *arg = 0, - ACE_Time_Value *timeout = 0); - - /// Lower priority try_acquire(). - int tryacquire_read (void); - - /// Just calls . - int tryacquire_write (void); - - /// Assumes the caller has acquired the token and returns 0. - int tryacquire_write_upgrade (void); - - // = Accessor methods. - - /// Return the number of threads that are currently waiting to get - /// the token. - int waiters (void); - - /// Return the id of the current thread that owns the token. - ACE_thread_t current_owner (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// The following structure implements a LIFO/FIFO queue of waiter threads - /// that are asleep waiting to obtain the token. - struct ACE_Token_Queue_Entry - { - /// Constructor - ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, - ACE_thread_t t_id); - - /// Constructor using a pre-allocated attributes - ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, - ACE_thread_t t_id, - ACE_Condition_Attributes &attributes); - - /// Entry blocks on the token. - int wait (ACE_Time_Value *timeout, ACE_Thread_Mutex &lock); - - /// Notify (unblock) the entry. - int signal (void); - - /// Pointer to next waiter. - ACE_Token_Queue_Entry *next_; - - /// ACE_Thread id of this waiter. - ACE_thread_t thread_id_; - -#if defined (ACE_TOKEN_USES_SEMAPHORE) - /// ACE_Semaphore object used to wake up waiter when it can run again. - ACE_Semaphore cv_; -#else - /// ACE_Condition object used to wake up waiter when it can run again. - ACE_Condition_Thread_Mutex cv_; -#endif /* ACE_TOKEN_USES_SEMAPHORE */ - - /// Ok to run. - int runable_; - }; - -private: - enum ACE_Token_Op_Type - { - READ_TOKEN = 1, - WRITE_TOKEN - }; - - struct ACE_Token_Queue - { - /// Constructor - ACE_Token_Queue (void); - - /// Remove a waiter from the queue. - void remove_entry (ACE_Token_Queue_Entry *); - - /// Insert a waiter into the queue. - void insert_entry (ACE_Token_Queue_Entry &entry, - int requeue_position = -1); - - /// Head of the list of waiting threads. - ACE_Token_Queue_Entry *head_; - - /// Tail of the list of waiting threads. - ACE_Token_Queue_Entry *tail_; - }; - - /// Implements the and methods above. - int shared_acquire (void (*sleep_hook_func)(void *), - void *arg, - ACE_Time_Value *timeout, - ACE_Token_Op_Type op_type); - - /// Wake next in line for ownership. - void wakeup_next_waiter (void); - - /// A queue of writer threads. - ACE_Token_Queue writers_; - - /// A queue of reader threads. - ACE_Token_Queue readers_; - - /// ACE_Thread_Mutex used to lock internal data structures. - ACE_Thread_Mutex lock_; - - /// Current owner of the token. - ACE_thread_t owner_; - - /// Some thread (i.e., ) is using the token. We need this - /// extra variable to deal with POSIX pthreads madness... - int in_use_; - - /// Number of waiters. - int waiters_; - - /// Current nesting level. - int nesting_level_; - - /// The attributes for the condition variables, optimizes lock time. - ACE_Condition_Attributes attributes_; - - /// Queueing strategy, LIFO/FIFO. - int queueing_strategy_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#else - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Export ACE_Token -{ -public: - int queueing_strategy (void) { ACE_NOTSUP_RETURN (-1); } - void queueing_strategy (int /*queueing_strategy*/) { } - int acquire (ACE_Time_Value * = 0) { ACE_NOTSUP_RETURN (-1); } - int tryacquire (void) { ACE_NOTSUP_RETURN (-1); } - int remove (void) { ACE_NOTSUP_RETURN (-1); } - int release (void) { ACE_NOTSUP_RETURN (-1); } -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Export ACE_Noop_Token : public ACE_Null_Mutex -{ -public: - /// Queueing strategy - enum QUEUEING_STRATEGY - { - FIFO = -1, - LIFO = 0 - }; - - /// Get queueing strategy. - int queueing_strategy (void); - - /// Set queueing strategy. - void queueing_strategy (int queueing_strategy); - - int renew (int = 0, ACE_Time_Value * =0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Token.inl" -#endif /* __ACE_INLINE__ */ - - -#include /**/ "ace/post.h" -#endif /* ACE_TOKEN_H */ diff --git a/ace/Token.inl b/ace/Token.inl deleted file mode 100644 index d375789fbd1..00000000000 --- a/ace/Token.inl +++ /dev/null @@ -1,176 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/config-macros.h" - -#if defined (ACE_HAS_THREADS) - -#include "ace/Guard_T.h" -#include "ace/Time_Value.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Token::queueing_strategy (void) -{ - return this->queueing_strategy_; -} - -ACE_INLINE void -ACE_Token::queueing_strategy (int queueing_strategy) -{ - this->queueing_strategy_ = queueing_strategy == -1 ? -1 : 0; -} - -ACE_INLINE int -ACE_Token::remove (void) -{ - ACE_TRACE ("ACE_Token::remove"); - // Don't have an implementation for this yet... - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_Token::tryacquire (void) -{ - ACE_TRACE ("ACE_Token::tryacquire"); - return this->shared_acquire - (0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::WRITE_TOKEN); -} - -ACE_INLINE int -ACE_Token::waiters (void) -{ - ACE_TRACE ("ACE_Token::waiters"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - - int const ret = this->waiters_; - return ret; -} - -ACE_INLINE ACE_thread_t -ACE_Token::current_owner (void) -{ - ACE_TRACE ("ACE_Token::current_owner"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, this->owner_); - - return this->owner_; -} - -ACE_INLINE int -ACE_Token::acquire_read (void) -{ - ACE_TRACE ("ACE_Token::acquire_read"); - return this->shared_acquire - (0, 0, 0, ACE_Token::READ_TOKEN); -} - -ACE_INLINE int -ACE_Token::acquire_write (void) -{ - ACE_TRACE ("ACE_Token::acquire_write"); - return this->shared_acquire - (0, 0, 0, ACE_Token::WRITE_TOKEN); -} - -ACE_INLINE int -ACE_Token::tryacquire_read (void) -{ - ACE_TRACE ("ACE_Token::tryacquire_read"); - return this->shared_acquire - (0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::READ_TOKEN); -} - -ACE_INLINE int -ACE_Token::acquire_read (void (*sleep_hook_func)(void *), - void *arg, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Token::acquire_read"); - return this->shared_acquire (sleep_hook_func, arg, timeout, ACE_Token::READ_TOKEN); -} - -ACE_INLINE int -ACE_Token::tryacquire_write (void) -{ - ACE_TRACE ("ACE_Token::tryacquire_write"); - return this->shared_acquire - (0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::WRITE_TOKEN); -} - -ACE_INLINE int -ACE_Token::tryacquire_write_upgrade (void) -{ - ACE_TRACE ("ACE_Token::tryacquire_write_upgrade"); - return 0; -} - -ACE_INLINE int -ACE_Token::acquire_write (void (*sleep_hook_func)(void *), - void *arg, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Token::acquire_write"); - return this->shared_acquire (sleep_hook_func, arg, timeout, ACE_Token::WRITE_TOKEN); -} - -ACE_INLINE int -ACE_Token::ACE_Token_Queue_Entry::wait (ACE_Time_Value *timeout, ACE_Thread_Mutex &lock) -{ -#if defined (ACE_TOKEN_USES_SEMAPHORE) - lock.release (); - int const retv = (timeout == 0 ? - this->cv_.acquire () : - this->cv_.acquire (*timeout)); - lock.acquire (); - return retv; -#else - ACE_UNUSED_ARG (lock); - return this->cv_.wait (timeout); -#endif /* ACE_TOKEN_USES_SEMAPHORE */ -} - -ACE_INLINE int -ACE_Token::ACE_Token_Queue_Entry::signal (void) -{ - return -#if defined (ACE_TOKEN_USES_SEMAPHORE) - this->cv_.release (); -#else - this->cv_.signal (); -#endif /* ACE_TOKEN_USES_SEMAPHORE */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ - -/*****************************************************************************/ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Noop_Token::queueing_strategy (void) -{ - return -1; -} - -ACE_INLINE void -ACE_Noop_Token::queueing_strategy (int /* queueing_strategy */) -{ -} - -ACE_INLINE int -ACE_Noop_Token::renew (int, ACE_Time_Value *) -{ - return 0; -} - -ACE_INLINE void -ACE_Noop_Token::dump (void) const -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - diff --git a/ace/Token_Collection.cpp b/ace/Token_Collection.cpp deleted file mode 100644 index 7356844165e..00000000000 --- a/ace/Token_Collection.cpp +++ /dev/null @@ -1,294 +0,0 @@ -#include "ace/Token_Collection.h" - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#if !defined (__ACE_INLINE__) -#include "ace/Token_Collection.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_RCSID (ace, - Token_Collection, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Token_Collection::ACE_Token_Collection (int debug, - const ACE_TCHAR *name) -: debug_ (debug) -{ - ACE_TRACE ("ACE_Token_Collection::ACE_Token_Collection"); - - if (name == 0) - name = ACE_LIB_TEXT ("no name"); - - ACE_OS::strsncpy (this->name_, - const_cast (name), - ACE_MAXTOKENNAMELEN); -} - -int -ACE_Token_Collection::insert (ACE_Token_Proxy &new_token) -{ - ACE_TRACE ("ACE_Token_Collection::insert"); - - TOKEN_NAME name (new_token.name ()); - - // Check if the new_proxy is already in the list. - if (collection_.find (name) == 1) - // One already exists, so fail. - return -1; - - // Clone the new token. - ACE_Token_Proxy *temp = new_token.clone (); - - if (collection_.bind (name, temp) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("bind failed\n")), -1); - return 0; -} - -int -ACE_Token_Collection::extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&proxy) -{ - ACE_TRACE ("ACE_Token_Collection::extract"); - TOKEN_NAME name (token_name); - return collection_.unbind (token_name, proxy); -} - -ACE_Token_Proxy * -ACE_Token_Collection::is_member (const ACE_TCHAR *token_name) -{ - ACE_TRACE ("ACE_Token_Collection::is_member"); - TOKEN_NAME name (token_name); - ACE_Token_Proxy *temp; - // Get the token from the collection. - return collection_.find (name, temp) == -1 ? 0 : temp; -} - -int -ACE_Token_Collection::is_member (const ACE_Token_Proxy &token) -{ - ACE_TRACE ("ACE_Token_Collection::is_member"); - TOKEN_NAME token_name (token.name ()); - return collection_.find (token_name) == 0; -} - -int -ACE_Token_Collection::acquire (int notify, - void (*sleep_hook)(void *), - ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Token_Collection::acquire"); - - COLLECTION::ITERATOR iterator (collection_); - - for (COLLECTION::ENTRY *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (debug_) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("collection acquiring %s\n"), - temp->int_id_->name ())); - if (temp->int_id_->acquire (notify, - sleep_hook, - options) == -1) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - this->release (); - ACE_RETURN (-1); - } - } - - return 0; -} - -int -ACE_Token_Collection::acquire (const ACE_TCHAR *token_name, - int notify, - void (*sleep_hook)(void *), - ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Token_Collection::acquire"); - TOKEN_NAME name (token_name); - ACE_Token_Proxy *temp; - // Get the token from the collection. - int result = collection_.find (name, temp); - // did we find it? - if (result == -1) - return result; - // perform the operation - return temp->acquire (notify, sleep_hook, options); -} - - -int -ACE_Token_Collection::tryacquire (const ACE_TCHAR *token_name, - void (*sleep_hook)(void *)) -{ - ACE_TRACE ("ACE_Token_Collection::tryacquire"); - TOKEN_NAME name (token_name); - ACE_Token_Proxy *temp; - // Get the token from the collection. - int result = collection_.find (name, temp); - // did we find it? - if (result == -1) - return result; - - // perform the operation - return temp->tryacquire (sleep_hook); -} - -int -ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *)) -{ - ACE_TRACE ("ACE_Token_Collection::tryacquire"); - - COLLECTION::ITERATOR iterator (collection_); - - for (COLLECTION::ENTRY *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection acquiring %s\n"), - temp->int_id_->name ())); - // We will fail if _any_ token is not free. - if (temp->int_id_->tryacquire (sleep_hook) == -1) - return -1; - } - - return 0; -} - -int -ACE_Token_Collection::renew (int requeue_position, - ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Token_Collection::renew"); - - COLLECTION::ITERATOR iterator (collection_); - - for (COLLECTION::ENTRY *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection renewing %s\n"), - temp->int_id_->name ())); - if (temp->int_id_->renew (requeue_position, options) == -1) - return -1; - } - - return 0; -} - -int -ACE_Token_Collection::renew (const ACE_TCHAR *token_name, - int requeue_position, - ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Token_Collection::renew"); - TOKEN_NAME name (token_name); - ACE_Token_Proxy *temp; - - // Get the token from the collection. - int result = collection_.find (name, temp); - - // Did we find it? - if (result == -1) - ACE_ERROR_RETURN ((LM_DEBUG, ACE_LIB_TEXT ("%p %s\n"), - ACE_LIB_TEXT ("not in collection "), - token_name), -1); - // perform the operation - return temp->renew (requeue_position, options); -} - -int -ACE_Token_Collection::release (ACE_Synch_Options &) - -{ - ACE_TRACE ("ACE_Token_Collection::release"); - COLLECTION::ITERATOR iterator (collection_); - - for (COLLECTION::ENTRY *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection releasing %s\n"), - temp->int_id_->name ())); - temp->int_id_->release (); - } - - return 0; -} - -int -ACE_Token_Collection::release (const ACE_TCHAR *token_name, - ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Token_Collection::release"); - TOKEN_NAME name (token_name); - ACE_Token_Proxy *temp; - // get the token from the collection - int result = collection_.find (name, temp); - // did we find it? - if (result != 0) - return result; - // perform the operation - return temp->release (options); -} - -ACE_Token_Collection::~ACE_Token_Collection (void) -{ - ACE_TRACE ("ACE_Token_Collection::~ACE_Token_Collection"); - COLLECTION::ITERATOR iterator (collection_); - - for (COLLECTION::ENTRY *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - delete temp->int_id_; - // The ext_id_'s delete themselves when the array of - // COLLECTION::ENTRYs goes away. - } -} - - -// This method doesn't mean anything for a collection. -ACE_Token_Proxy * -ACE_Token_Collection::clone (void) const -{ - ACE_TRACE ("ACE_Token_Collection::clone"); - return (ACE_Token_Proxy *) 0; -} - -// This method doesn't mean anything for a collection. -ACE_Tokens * -ACE_Token_Collection::create_token (const ACE_TCHAR *) -{ - ACE_TRACE ("ACE_Token_Collection::create_token"); - return (ACE_Tokens *) 0; -} - -void -ACE_Token_Collection::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Token_Collection::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_Token_Collection::dump:\n") - ACE_LIB_TEXT (" debug_ = %d\n"), debug_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection_\n"))); - collection_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("base:\n"))); - ACE_Token_Proxy::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Collection.h b/ace/Token_Collection.h deleted file mode 100644 index 0d57cc0ca58..00000000000 --- a/ace/Token_Collection.h +++ /dev/null @@ -1,243 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Token_Collection.h - * - * $Id$ - * - * The ACE_Token class offers methods for acquiring, renewing, - * and releasing a synchronization token on a per-token basis. The - * ACE_Token_Collection offers an interface for performing - * operations on groups of tokens as a whole, or on a single token - * within the collection. - * - * The atomic group operations are not yet implemented. - * - * - * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) - * @author Tim Harrison (harrison@cs.wustl.edu) - */ -//============================================================================= - -#ifndef ACE_TOKEN_COLLECTION_H -#define ACE_TOKEN_COLLECTION_H -#include /**/ "ace/pre.h" - -#include "ace/Map_Manager.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#include "ace/Local_Tokens.h" -#include "ace/Null_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Token_Collection - * - * @brief Allows atomic token group operations AND - * provides a ACE_Token manager interface. - * - * There are two types of operations offered by - * ACE_Token_Collection. The first is atomic operations on - * collections of Token_Proxies. In this respect, the - * ACE_Token_Collection can be thought of as a single token - * consisting of multiple Token_Proxies. The second role of the - * ACE_Token_Collection is as a ACE_Token manager. - * ACE_Token_Collection allows individual operations on single - * members of a collection of Token_Proxies. This provides a - * single access point for operations on multiple tokens. - */ -class ACE_Export ACE_Token_Collection : public ACE_Token_Proxy -{ - - // = BUGS - // Although ACE_Token_Collection inherits from ACE_Token_Proxy, it - // can not be including in a collection. This is because - // returns zero for now. -public: - /** - * @a debug print out verbose debugging messages. @a name will give a - * name to the collection. Collections don't really need names, but - * are sometimes useful for debugging. - */ - ACE_Token_Collection (int debug = 0, - const ACE_TCHAR *name = 0); - -// Collection Management operations - - /** - * Insert a Token into the collection. All ACE_Token type - * operations performed on the collection will also be performed on - * the new_proxy until it is removed. Note that no operations - * performed prior to the insertion will be performed. Returns: 0 - * on success, -1 on failure with == problem. If a token - * proxy already exists in the collection with the same name, the - * insertion will fail. Also, is copied. Note that during - * the copy, client_id's are *not* inherited. The client ID of the - * thread using the collection will be used. Client ID's can be - * changed explicity on each proxy using is_member. - */ - int insert (ACE_Token_Proxy &token); - - /** - * removes the ACE_Token matching the given token_name from the - * collection. On success, extract returns 0. On failure - * (token_name was not in the collection,) extract returns -1. On - * success, the state of the token found is copied into proxy. - * The returned ACE_Token_Proxy* must be deleted by the user. - */ - int extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&proxy); - - /// returns the proxy if true. 0 otherwise. - ACE_Token_Proxy *is_member (const ACE_TCHAR *token_name); - - /** - * Is the specified token in the collection? - * 1, yes. - * 0, no. - */ - int is_member (const ACE_Token_Proxy &token); - -// = Collective operation semantics. - -// For acquire, renew, and release, there are two interfaces. Once -// interface allows an operation on a single token in the -// collection. The collective interfaces perform atomic operations -// on the entire collection. For instance, a collective acquire -// will perform an acquire for each and every token in the -// collection or the operation will fail. Currently, these -// operations are performed with no ordering heuristics. That is, -// the Collection steps through the tokens in the order they were -// inserted. For each one it performs the operation (acquire, -// renew, or release). - - /** - * Acquire "atomically" all resources in the collection. This is - * only successfull if all tokens in the collection could be - * acquired. options contains the blocking semantics, timeout - * value, etc. Returns: 0 on success, -1 on failure with == - * problem. If and error or deadlock occurs for one of the tokens, - * all the tokens will be released and the method will return -1. - * Note that returning on detection of deadlock prevents livelock - * between competing collections. If a collection returns after - * detecting deadlock, it is the application's responsibility to not - * to blindly loop on the collection::acquire operation. In other - * words, once the collection reports deadlock, it is out of our - * hands. - */ - virtual int acquire (int notify = 0, - void (*sleep_hook)(void *) = 0, - ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - /// Acquire the token corresponding to @a token_name. The other - /// parameters are passed to ::acquire. - virtual int acquire (const ACE_TCHAR *token_name, - int notify = 0, - void (*sleep_hook)(void *) = 0, - ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - /// Try to acquire all tokens in collection. - virtual int tryacquire (void (*sleep_hook)(void *) = 0); - - /// Try to acquire @a token_name. - virtual int tryacquire (const ACE_TCHAR *token_name, - void (*sleep_hook)(void *) = 0); - - /** - * Renews "atomically" all resources in the collection. This is - * only successfull if all tokens in the collection could be - * renewed. options contains the blocking semantics, timeout - * value, etc. Returns: 0 on success, -1 on failure with == - * problem. - */ - virtual int renew (int requeue_position = 0, - ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - - /// Renew the token corresponding to @a token_name. The other - /// parameters are passed to ::renew. - virtual int renew (const ACE_TCHAR *token_name, - int requeue_position = 0, - ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - /** - * Releases "atomically" all resources in the collection. This is - * only successfull if all tokens in the collection could be - * released. options contains the blocking semantics, timeout - * value, etc. Returns: 0 on success, -1 on failure with == - * problem. - */ - virtual int release (ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - - /// Release the token corresponding to . The other - /// parameters are passed to ::release. - virtual int release (const ACE_TCHAR *token_name, - ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - ~ACE_Token_Collection (void); - - /// Dump the state of the class. - void dump (void) const; - - /// Return the name of the collection. Not very functionally - /// important, but sometimes a useful debugging tool. - virtual const ACE_TCHAR *name (void) const; - -protected: - - typedef ACE_Token_Name TOKEN_NAME; - - /// COLLECTION maintains a mapping from token names to ACE_Tokens* - typedef ACE_Map_Manager - COLLECTION; - - /// Allows iterations through collection_ - /** - * @deprecated Deprecated typedef. Use COLLECTION::ITERATOR trait instead. - */ - typedef COLLECTION::ITERATOR COLLECTION_ITERATOR; - - /// Allows iterations through collection_ - /** - * @deprecated Deprecated typedef. Use COLLECTION::ENTRY trait instead. - */ - typedef COLLECTION::ENTRY COLLECTION_ENTRY; - - /// COLLECTION maintains a mapping from token names to ACE_Tokens*. - COLLECTION collection_; - - /// Whether to print out debug messages or not. - int debug_; - - /// Name of the collection. - ACE_TCHAR name_[ACE_MAXTOKENNAMELEN]; - - // = I'm not sure what these mean, but they have to be defined since they're - // pure virtual in ACE_Token_Proxy. - virtual ACE_Token_Proxy *clone (void) const; - virtual ACE_Tokens *create_token (const ACE_TCHAR *name); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Token_Collection.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_TOKENS_LIBRARY */ - -#include /**/ "ace/post.h" -#endif /* ACE_TOKEN_COLLECTION_H */ diff --git a/ace/Token_Collection.inl b/ace/Token_Collection.inl deleted file mode 100644 index db86701a325..00000000000 --- a/ace/Token_Collection.inl +++ /dev/null @@ -1,17 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE const ACE_TCHAR * -ACE_Token_Collection::name (void) const -{ - return name_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Invariants.cpp b/ace/Token_Invariants.cpp deleted file mode 100644 index 1c7ca9677d3..00000000000 --- a/ace/Token_Invariants.cpp +++ /dev/null @@ -1,355 +0,0 @@ -#include "ace/Token_Invariants.h" - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#include "ace/Object_Manager.h" - -ACE_RCSID (ace, - Token_Invariants, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Token_Invariant_Manager *ACE_Token_Invariant_Manager::instance_ = 0; - -ACE_Token_Invariant_Manager * -ACE_Token_Invariant_Manager::instance (void) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::instance"); - - // Perform the Double-Check pattern... - if (instance_ == 0) - { - ACE_MT (ACE_TOKEN_CONST::MUTEX *lock = - ACE_Managed_Object::get_preallocated_object - (ACE_Object_Manager::ACE_TOKEN_INVARIANTS_CREATION_LOCK); - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, *lock, 0)); - - if (instance_ == 0) - { - ACE_NEW_RETURN (instance_, - ACE_Token_Invariant_Manager, - 0); - // Register for destruction with ACE_Object_Manager. - ACE_Object_Manager::at_exit (instance_); - } - } - - return instance_; -} - -ACE_Token_Invariant_Manager::ACE_Token_Invariant_Manager (void) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::ACE_Token_Invariant_Manager"); -} - -int -ACE_Token_Invariant_Manager::mutex_acquired (const ACE_TCHAR *token_name) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::mutex_acquired"); - - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); - - ACE_Mutex_Invariants *inv = 0; - if (this->get_mutex (token_name, inv) == -1) - return -1; - - return inv->acquired (); -} - -int -ACE_Token_Invariant_Manager::acquired (const ACE_Token_Proxy *proxy) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::acquired"); - - // Reach into the proxy to find the token type. - if (proxy->token_->type () == ACE_Tokens::MUTEX) - return this->mutex_acquired (proxy->name ()); - else // ACE_Tokens::RWLOCK. - { - if (proxy->type () == ACE_RW_Token::READER) - return this->reader_acquired (proxy->name ()); - else // ACE_RW_Token::WRITER. - return this->writer_acquired (proxy->name ()); - } -} - -void -ACE_Token_Invariant_Manager::releasing (const ACE_Token_Proxy *proxy) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::releasing"); - - // Reach into the proxy to find the token type. - if (proxy->token_->type () == ACE_Tokens::MUTEX) - this->mutex_releasing (proxy->name ()); - else // ACE_Tokens::RWLOCK. - this->rwlock_releasing (proxy->name ()); -} - -void -ACE_Token_Invariant_Manager::mutex_releasing (const ACE_TCHAR *token_name) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::mutex_releasing"); - ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_); - - ACE_Mutex_Invariants *inv = 0; - if (this->get_mutex (token_name, inv) == 0) - inv->releasing (); -} - -int -ACE_Token_Invariant_Manager::reader_acquired (const ACE_TCHAR *token_name) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::reader_acquired"); - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); - - ACE_RWLock_Invariants *inv = 0; - if (this->get_rwlock (token_name, inv) == -1) - return -1; - - return inv->reader_acquired (); -} - -int -ACE_Token_Invariant_Manager::writer_acquired (const ACE_TCHAR *token_name) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::writer_acquired"); - - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); - - ACE_RWLock_Invariants *inv = 0; - if (this->get_rwlock (token_name, inv) == -1) - return -1; - - return inv->writer_acquired (); -} - -void -ACE_Token_Invariant_Manager::rwlock_releasing (const ACE_TCHAR *token_name) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::rwlock_releasing"); - - ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_); - - ACE_RWLock_Invariants *inv = 0; - if (this->get_rwlock (token_name, inv) == 0) - inv->releasing (); -} - -void -ACE_Token_Invariant_Manager::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Token_Invariant_Manager::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("mutex_collection_:\n"))); - mutex_collection_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("rwlock_collection_:\n"))); - rwlock_collection_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - - -int -ACE_Token_Invariant_Manager::get_mutex (const ACE_TCHAR *token_name, - ACE_Mutex_Invariants *&inv) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::get_mutex"); - TOKEN_NAME name (token_name); - if (mutex_collection_.find (name, inv) == -1) - // We did not find one in the collection. - { - ACE_Mutex_Invariants *new_invariant; - - ACE_NEW_RETURN (new_invariant, - ACE_Mutex_Invariants, - -1); - if (mutex_collection_.bind (name, new_invariant) == -1) - { - delete new_invariant; - return -1; - } - - if (mutex_collection_.find (name, inv) == -1) - // We did not find one in the collection. - return -1; - } - - return 0; -} - -int -ACE_Token_Invariant_Manager::get_rwlock (const ACE_TCHAR *token_name, - ACE_RWLock_Invariants *&inv) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::get_rwlock"); - TOKEN_NAME name (token_name); - if (rwlock_collection_.find (name, inv) == -1) - // We did not find one in the collection. - { - ACE_RWLock_Invariants *new_invariant; - - ACE_NEW_RETURN (new_invariant, - ACE_RWLock_Invariants, - -1); - if (rwlock_collection_.bind (name, new_invariant) == -1) - return -1; - - if (rwlock_collection_.find (name, inv) == -1) - // We did not find one in the collection. - return -1; - } - - return 0; -} - - -ACE_Token_Invariant_Manager::~ACE_Token_Invariant_Manager (void) -{ - ACE_TRACE ("ACE_Token_Invariant_Manager::~ACE_Token_Invariant_Manager"); - - MUTEX_COLLECTION::ITERATOR iterator (mutex_collection_); - - for (MUTEX_COLLECTION::ENTRY *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - delete temp->int_id_; - - RWLOCK_COLLECTION::ITERATOR iterator2 (rwlock_collection_); - - for (RWLOCK_COLLECTION::ENTRY *temp2 = 0; - iterator2.next (temp2) != 0; - iterator2.advance ()) - delete temp2->int_id_; -} - -// ************************************************** -// ************************************************** -// ************************************************** - -ACE_Mutex_Invariants::ACE_Mutex_Invariants (void) -: owners_ (0) -{ -} - -int -ACE_Mutex_Invariants::acquired (void) -{ - if (++owners_ > 1) - { - owners_ = 42; - return 0; - } - else - return 1; -} - -void -ACE_Mutex_Invariants::releasing (void) -{ - if (owners_ == 1) - --owners_; -} - -ACE_Mutex_Invariants::ACE_Mutex_Invariants (const ACE_Mutex_Invariants &rhs) -: owners_ (rhs.owners_) -{ -} - -void -ACE_Mutex_Invariants::operator= (const ACE_Mutex_Invariants &rhs) -{ - owners_ = rhs.owners_; -} - -void -ACE_Mutex_Invariants::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Mutex_Invariants::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("owners_ = %d\n"), owners_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// ************************************************** -// ************************************************** -// ************************************************** - -ACE_RWLock_Invariants::ACE_RWLock_Invariants (void) -: writers_ (0), - readers_ (0) -{ -} - -int -ACE_RWLock_Invariants::writer_acquired (void) -{ - if (readers_ > 0) - { - writers_ = readers_ = 42; - return 0; - } - else if (++writers_ > 1) - { - writers_ = readers_ = 42; - return 0; - } - else - return 1; -} - -int -ACE_RWLock_Invariants::reader_acquired (void) -{ - if (writers_ > 0) - { - writers_ = readers_ = 42; - return 0; - } - else - { - ++readers_; - return 1; - } -} - -void -ACE_RWLock_Invariants::releasing (void) -{ - if (writers_ == 1) - writers_ = 0; - else if (readers_ > 0) - --readers_; -} - -ACE_RWLock_Invariants::ACE_RWLock_Invariants (const ACE_RWLock_Invariants &rhs) -: writers_ (rhs.writers_), - readers_ (rhs.readers_) -{ -} - -void -ACE_RWLock_Invariants::operator= (const ACE_RWLock_Invariants &rhs) -{ - writers_ = rhs.writers_; - readers_ = rhs.readers_; -} - -void -ACE_RWLock_Invariants::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_RWLock_Invariants::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("writers_ = %d readers_ = %d\n"), - writers_, readers_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Invariants.h b/ace/Token_Invariants.h deleted file mode 100644 index 6816d209ab3..00000000000 --- a/ace/Token_Invariants.h +++ /dev/null @@ -1,245 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Token_Invariants.h - * - * $Id$ - * - * @author Tim Harrison (harrison@cs.wustl.edu) - * - * Allows applications to test that invariants are always - * satisfied. Can test mutexes and readers/writer locks. Does - * not test recursive acquisition. - * - * - */ -//============================================================================= - -#ifndef ACE_TOKEN_INVARIANTS_H -#define ACE_TOKEN_INVARIANTS_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#include "ace/Map_Manager.h" -#include "ace/Local_Tokens.h" -#include "ace/Null_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Mutex_Invariants - * - * @brief Mutex Invariants - * = INVARIANTS - * 1. Only one owner at a time. - */ -class ACE_Export ACE_Mutex_Invariants -{ -public: - /// Default construction. - ACE_Mutex_Invariants (void); - - /// Returns 1 on success, 0 when an invariant has been violated and - /// -1 on error. - int acquired (void); - - /// Updates internal database. - void releasing (void); - - // = Map_Manager operations. - - /// Copy construction. - ACE_Mutex_Invariants (const ACE_Mutex_Invariants &rhs); - - /// Copy. - void operator= (const ACE_Mutex_Invariants &rhs); - - /// Dump the state of the class. - void dump (void) const; - -private: - /// Number of owners. This had better be 0 >= owners_ <= 1; - int owners_; -}; - -/** - * @class ACE_RWLock_Invariants - * - * @brief RWLock Invariants - * - * Preserve the following invariants: - * -# Only one writer at a time. - * -# If there is an owning writer, there are no owning readers. - */ -class ACE_Export ACE_RWLock_Invariants -{ -public: - /// Default construction. - ACE_RWLock_Invariants (void); - - /// Returns 1 on success, 0 when an invariant has been violated and - /// -1 on error. - int writer_acquired (void); - - /// Returns 1 on success, 0 when an invariant has been violated and - /// -1 on error. - int reader_acquired (void); - - /// Updates internal database. - void releasing (void); - - // = Map_Manager operations. - - /// Copy construction. - ACE_RWLock_Invariants (const ACE_RWLock_Invariants &rhs); - - /// Copy. - void operator= (const ACE_RWLock_Invariants &rhs); - - /// Dump the state of the class. - void dump (void) const; - -private: - /// Number of owning writers. - int writers_; - - /// Number of owning readers. - int readers_; -}; - -/** - * @class ACE_Token_Invariant_Manager - * - * @brief Token Invariants - * - * The Token Invariant Manager allows applications to test that - * invariants are always satisfied. Currently, Token_Invariants - * can test mutexes and readers/writer locks. Does not test - * recursive acquisition. - * Note that this class does not ever clean its database. Until - * destroyed, it's size will forever increase. - */ -class ACE_Export ACE_Token_Invariant_Manager : public ACE_Cleanup -{ -public: - - /// Singleton access point. - static ACE_Token_Invariant_Manager *instance (void); - - // = Polymorphic methods. Just pass in the proxy and the method - // figures out the type of the token. - - /// Returns 1 on success, 0 when an invariant has been violated and - /// -1 on error. - int acquired (const ACE_Token_Proxy *proxy); - - /// Updates internal database. - void releasing (const ACE_Token_Proxy *proxy); - - // = Explicit methods. These to not require actual proxies in order - // to test a scenario. - - /// Returns 1 on success, 0 when an invariant has been violated and - /// -1 on error. - int mutex_acquired (const ACE_TCHAR *token_name); - - /// Updates internal database. - void mutex_releasing (const ACE_TCHAR *token_name); - - /// Returns 1 on success, 0 when an invariant has been violated and - /// -1 on error. - int reader_acquired (const ACE_TCHAR *token_name); - - /// Returns 1 on success, 0 when an invariant has been violated and - /// -1 on error. - int writer_acquired (const ACE_TCHAR *token_name); - - /// Updates internal database. - void rwlock_releasing (const ACE_TCHAR *token_name); - - /// Dump the state of the class. - void dump (void) const; - - // = The following two method should be in the protected part of the - // class. Bugs with certain compilers preclude this. - /// Prevent non-singleton construction. - ACE_Token_Invariant_Manager (void); - - /// Destruction. - virtual ~ACE_Token_Invariant_Manager (void); - -protected: - /// Return or create. - int get_mutex (const ACE_TCHAR *token_name, - ACE_Mutex_Invariants *&inv); - - /// Return or create. - int get_rwlock (const ACE_TCHAR *token_name, - ACE_RWLock_Invariants *&inv); - - /// ACE_Mutex_Token used to lock internal data structures. - ACE_TOKEN_CONST::MUTEX lock_; - - /// This may be changed to a template type. - typedef ACE_Token_Name TOKEN_NAME; - - /// COLLECTION maintains a mapping from token names to mutexes. - typedef ACE_Map_Manager - MUTEX_COLLECTION; - - /// Allows iterations through collection. - /** - * @deprecated Deprecated typedef. Use MUTEX_COLLECTION::ITERATOR trait - * instead. - */ - typedef MUTEX_COLLECTION::ITERATOR MUTEX_COLLECTION_ITERATOR; - - /// Allows iterations through collection. - /** - * @deprecated Deprecated typedef. Use MUTEX_COLLECTION::ENTRY trait - * instead. - */ - typedef MUTEX_COLLECTION::ENTRY MUTEX_COLLECTION_ENTRY; - - /// MUTEX_COLLECTION maintains a mapping from token names to mutexes. - MUTEX_COLLECTION mutex_collection_; - - /// COLLECTION maintains a mapping from token names to mutexes. - typedef ACE_Map_Manager - RWLOCK_COLLECTION; - - /// Allows iterations through collection. - /** - * @deprecated Deprecated typedef. Use RWLOCK_COLLECTION::ITERATOR trait - * instead. - */ - typedef RWLOCK_COLLECTION::ITERATOR RWLOCK_COLLECTION_ITERATOR; - - /// Allows iterations through collection. - /** - * @deprecated Deprecated typedef. Use RWLOCK_COLLECTION::ENTRY trait - * instead. - */ - typedef RWLOCK_COLLECTION::ENTRY RWLOCK_COLLECTION_ENTRY; - - /// MUTEX_COLLECTION maintains a mapping from token names to mutexes. - RWLOCK_COLLECTION rwlock_collection_; - - /// Singleton pointer. - static ACE_Token_Invariant_Manager *instance_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ - -#include /**/ "ace/post.h" -#endif /* ACE_TOKEN_INVARIANTS_H */ diff --git a/ace/Token_Manager.cpp b/ace/Token_Manager.cpp deleted file mode 100644 index a68ac717ebf..00000000000 --- a/ace/Token_Manager.cpp +++ /dev/null @@ -1,273 +0,0 @@ -#include "ace/Token_Manager.h" - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#include "ace/Object_Manager.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Token_Manager.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - Token_Manager, - "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// singleton token manager -ACE_Token_Manager *ACE_Token_Manager::token_manager_ = 0; - -ACE_Token_Manager::ACE_Token_Manager () -{ - ACE_TRACE ("ACE_Token_Manager::ACE_Token_Manager"); -} - -ACE_Token_Manager::~ACE_Token_Manager () -{ - ACE_TRACE ("ACE_Token_Manager::~ACE_Token_Manager"); - - COLLECTION::ITERATOR iterator (collection_); - - for (COLLECTION::ENTRY *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - // @ should I be doing an unbind here? - delete temp->int_id_; - // The ext_id_'s delete themselves when the array of - // COLLECTION::ENTRYs goes away. - } -} - -ACE_Token_Manager * -ACE_Token_Manager::instance (void) -{ - ACE_TRACE ("ACE_Token_Manager::instance"); - - // This first check is to avoid acquiring the mutex in the common - // case. Double-Check pattern rules. - if (token_manager_ == 0) - { -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_TOKEN_CONST::MUTEX *lock = - ACE_Managed_Object::get_preallocated_object - (ACE_Object_Manager::ACE_TOKEN_MANAGER_CREATION_LOCK); - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, *lock, 0); -#endif /* ACE_MT_SAFE */ - - if (token_manager_ == 0) - { - ACE_NEW_RETURN (token_manager_, - ACE_Token_Manager, - 0); - // Register for destruction with ACE_Object_Manager. - ACE_Object_Manager::at_exit (token_manager_); - } - } - - return token_manager_; -} - -void -ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy, - const ACE_TCHAR *token_name) -{ - ACE_TRACE ("ACE_Token_Manager::get_token"); - // Hmm. I think this makes sense. We perform our own locking here - // (see safe_acquire.) We have to make sure that only one thread - // uses the collection at a time. - - ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_); - - TOKEN_NAME name (token_name); - - if (collection_.find (name, proxy->token_) == -1) - // We did not find one in the collection. - { - // Make one. - proxy->token_ = proxy->create_token (token_name); - - // Put it in the collection. - if (collection_.bind (name, proxy->token_) == -1) - { - delete proxy->token_; - proxy->token_ = 0; - } - } - - if (proxy->token_ != 0) - proxy->token_->inc_reference (); - - // We may be returning proxy->token_ == 0 if new failed, caller must - // check. -} - -// 0. check_deadlock (TOKEN) -// 1. if TOKEN->visited (), return 0. -// 2. mark TOKEN visited. -// 3. get ALL_OWNERS -// 4. if CLIENT in ALL_OWNERS, return *DEADLOCK*. -// 5. for each OWNER in ALL_OWNERS, -// 6. if OWNER is not waiting for a NEW_TOKEN, continue. -// 7. else, if check_deadlock (NEW_TOKEN) == 1, return *DEADLOCK* -// 8. return 0. - -int -ACE_Token_Manager::check_deadlock (ACE_Token_Proxy *proxy) -{ - ACE_TRACE ("ACE_Token_Manager::check_deadlock"); - - // Start the recursive deadlock detection algorithm. - int result = this->check_deadlock (proxy->token_, proxy); - - // Whether or not we detect deadlock, we have to unmark all tokens - // for the next time. - COLLECTION::ITERATOR iterator (collection_); - for (COLLECTION::ENTRY *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - temp->int_id_->visit (0); - - return result; -} - -int -ACE_Token_Manager::check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy) -{ - ACE_TRACE ("ACE_Token_Manager::check_deadlock"); - - if (token->visited ()) - return 0; - - token->visit (1); - - ACE_Tokens::OWNER_STACK owners; - - int is_owner = token->owners (owners, proxy->client_id ()); - - switch (is_owner) - { - case -1: - // Error. - return -1; - case 1: - // The caller is an owner, so we have a deadlock situation. - if (debug_) - { - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) Deadlock detected.\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("%s owns %s and is waiting for %s.\n"), - proxy->client_id (), - token->name (), - proxy->token_->name ())); - } - - return 1; - case 0: - default: - // Recurse on each owner. - while (!owners.is_empty ()) - { - ACE_TPQ_Entry *e; - owners.pop (e); - // If the owner is waiting on another token, recurse. - ACE_Tokens *twf = this->token_waiting_for (e->client_id ()); - if ((twf != 0) && - (this->check_deadlock (twf, proxy) == 1)) - { - if (debug_) - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("%s owns %s and is waiting for %s.\n"), - e->client_id (), - token->name (), - twf->name ())); - } - return 1; - } - // else, check the next owner. - } - - // We've checked all the owners and found no deadlock. - return 0; - } -} - - -ACE_Tokens * -ACE_Token_Manager::token_waiting_for (const ACE_TCHAR *client_id) -{ - COLLECTION::ITERATOR iterator (collection_); - for (COLLECTION::ENTRY *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (temp->int_id_->is_waiting_for (client_id)) - return temp->int_id_; - } - - // nothing was found, return NULL. - return 0; -} - -// Notify the token manager that a token is has been released. If -// as a result, there is no owner of the token, the token is -// deleted. -void -ACE_Token_Manager::release_token (ACE_Tokens *&token) -{ - ACE_TRACE ("ACE_Token_Manager::release_token"); - // again, let's perform our own locking here. - - ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_); - - if (token->dec_reference () == 0) - { - // No one has the token, so we can delete it and remove it from - // our collection. First, let's get it from the collection. - TOKEN_NAME token_name (token->name ()); - - ACE_Tokens *temp; - - if (collection_.unbind (token_name, temp) == -1) - // we did not find one in the collection - { - errno = ENOENT; - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("Token Manager could not release %s:%d\n"), - token->name (), token->type ())); - // @@ bad - } - else - // we found it - { - // sanity pointer comparison. The token referenced by the - // proxy better be the one we found in the list. - ACE_ASSERT (token == temp); - delete token; // or delete temp - // we set their token to zero. if the calling proxy is - // still going to be used, it had better check it's token - // value before calling a method on it! - token = 0; - } - } - // else - // someone is still interested in the token, so keep it around. -} - -void -ACE_Token_Manager::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Token_Manager::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_Token_Manager::dump:\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("lock_\n"))); - lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection_\n"))); - collection_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Manager.h b/ace/Token_Manager.h deleted file mode 100644 index 63c78712203..00000000000 --- a/ace/Token_Manager.h +++ /dev/null @@ -1,150 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Token_Manager.h - * - * $Id$ - * - * @author Tim Harrison (harrison@cs.wustl.edu) - */ -//============================================================================= - -#ifndef ACE_TOKEN_MANAGER_H -#define ACE_TOKEN_MANAGER_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Local_Tokens.h" - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#include "ace/Null_Mutex.h" -#include "ace/Map_Manager.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Local_Mutex; -class ACE_Mutex_Token; - -/** - * @class ACE_Token_Manager - * - * @brief Manages all tokens in a process space. - * - * Factory: Proxies use the token manager to obtain token - * references. This allows multiple proxies to reference the same - * logical token. - * Deadlock detection: Tokens use the manager to check for - * deadlock situations during acquires. - */ -class ACE_Export ACE_Token_Manager : public ACE_Cleanup -{ - - // To add a new type of token (e.g. semaphore), do the following - // steps: 1. Create a new derivation of ACE_Token. This class - // defines the semantics of the new Token. 2. Create a - // derivation of ACE_Token_Manager. You will only need to - // redefine make_mutex. -public: - ACE_Token_Manager (void); - virtual ~ACE_Token_Manager (void); - - /// Get the pointer to token manager singleton. - static ACE_Token_Manager *instance (void); - - /// Set the pointer to token manager singleton. - void instance (ACE_Token_Manager *); - - /** - * The Token manager uses ACE_Token_Proxy::token_id_ to look for - * an existing token. If none is found, the Token Manager calls - * ACE_Token_Proxy::create_token to create a new one. When - * finished, sets ACE_Token_Proxy::token_. @a token_name uniquely - * id's the token name. - */ - void get_token (ACE_Token_Proxy *, const ACE_TCHAR *token_name); - - /** - * Check whether acquire will cause deadlock or not. - * returns 1 if the acquire will _not_ cause deadlock. - * returns 0 if the acquire _will_ cause deadlock. - * This method ignores recursive acquisition. That is, it will not - * report deadlock if the client holding the token requests the - * token again. Thus, it assumes recursive mutexes. - */ - int check_deadlock (ACE_Token_Proxy *proxy); - int check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy); - - /// Notify the token manager that a token has been released. If as a - /// result, there is no owner of the token, the token is deleted. - void release_token (ACE_Tokens *&token); - - /** - * This is to allow Tokens to perform atomic transactions. The - * typical usage is to acquire this mutex, check for a safe_acquire, - * perform some queueing (if need be) and then release the lock. - * This is necessary since safe_acquire is implemented in terms of - * the Token queues. - */ - ACE_TOKEN_CONST::MUTEX &mutex (void); - - /// Dump the state of the class. - void dump (void) const; - - /// Turn debug mode on/off. - void debug (int d); - -private: - /// Whether to print debug messages or not. - int debug_; - - /// pointer to singleton token manager. - static ACE_Token_Manager *token_manager_; - - /// Return the token that the given client_id is waiting for, if any - ACE_Tokens *token_waiting_for (const ACE_TCHAR *client_id); - - /// ACE_Mutex_Token used to lock internal data structures. - ACE_TOKEN_CONST::MUTEX lock_; - - /// This may be changed to a template type. - typedef ACE_Token_Name TOKEN_NAME; - - /// COLLECTION maintains a mapping from token names to ACE_Tokens* - typedef ACE_Map_Manager - COLLECTION; - - /// Allows iterations through collection_ - /** - * @deprecated Deprecated typedef. Use COLLECTION::ITERATOR trait - * instead. - */ - typedef COLLECTION::ITERATOR COLLECTION_ITERATOR; - - /// Allows iterations through collection_ - /** - * @deprecated Deprecated typedef. Use COLLECTION::ENTRY trait - * instead. - */ - typedef COLLECTION::ENTRY COLLECTION_ENTRY; - - /// COLLECTION maintains a mapping from token names to ACE_Tokens*. - COLLECTION collection_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Token_Manager.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_TOKENS_LIBRARY */ - -#include /**/ "ace/post.h" -#endif /* ACE_TOKEN_MANAGER_H */ diff --git a/ace/Token_Manager.inl b/ace/Token_Manager.inl deleted file mode 100644 index b38c4b9e346..00000000000 --- a/ace/Token_Manager.inl +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_TOKEN_CONST::MUTEX & -ACE_Token_Manager::mutex (void) -{ - ACE_TRACE ("ACE_Token_Manager::mutex"); - return lock_; -} - -ACE_INLINE void -ACE_Token_Manager::debug (int d) -{ - ACE_TRACE ("ACE_Token_Manager::debug"); - debug_ = d; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Request_Reply.cpp b/ace/Token_Request_Reply.cpp deleted file mode 100644 index 802cbc5f697..00000000000 --- a/ace/Token_Request_Reply.cpp +++ /dev/null @@ -1,186 +0,0 @@ -// $Id$ - -#include "ace/Token_Request_Reply.h" - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#if !defined (__ACE_INLINE__) -#include "ace/Token_Request_Reply.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, Token_Request_Reply, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Default "do nothing" constructor. - -ACE_Token_Request::ACE_Token_Request (void) - : token_name_ (0), - client_id_ (0) -{ -} - -// Create a ACE_Token_Request message. - -ACE_Token_Request::ACE_Token_Request (int token_type, - int proxy_type, - ACE_UINT32 operation_type, - const ACE_TCHAR token_name[], - const ACE_TCHAR client_id[], - const ACE_Synch_Options &options) -{ - this->token_type (token_type); - this->proxy_type (proxy_type); - this->operation_type (operation_type); - this->requeue_position (0); // to avoid Purify UMR - this->notify (0); // to avoid Purify UMR - transfer_.arg_ = 0; // to avoid Purify UMR - ACE_OS::memset (transfer_.data_, 0, sizeof transfer_.data_); // to avoid Purify UMR - this->token_name (token_name, client_id); - this->options (options); -} - -// Encode the transfer buffer into network byte order -// so that it can be sent to the server. - -int -ACE_Token_Request::encode (void *&buf) -{ - buf = (void *) &this->transfer_; - return this->length (); -} - -// Decode the transfer buffer into host byte byte order -// so that it can be used by the server. - -int -ACE_Token_Request::decode (void) -{ - this->token_name_ = this->transfer_.data_; - - options_.set (transfer_.use_timeout_ == 1 ? ACE_Synch_Options::USE_TIMEOUT : 0, - ACE_Time_Value (transfer_.sec_, transfer_.usec_), - (void *) transfer_.arg_); - - // Decode the variable-sized portion. - size_t token_len = ACE_OS::strlen (this->token_name_); - - // Check to make sure this->tokenName_ isn't too long! - if (token_len >= ACE_MAXTOKENNAMELEN) - { - errno = ENAMETOOLONG; - return -1; - } - else // Skip this->tokenName_ + '\0' + ':'. - this->client_id_ = - &this->token_name_[(token_len + 2) * sizeof (ACE_TCHAR)]; - - // Fixed size header - // token_name_ plus '\0' - // ':' - // client_id_ plus '\0' - size_t data_size = ACE_TOKEN_REQUEST_HEADER_SIZE - + ACE_OS::strlen (this->token_name_) + 1 - + ACE_OS::strlen (this->client_id_) + 1 - + 1; - - // Make sure the message was correctly received and framed. - return this->length () == data_size ? 0 : -1; -} - -// Print out the current values of the ACE_Token_Request. - -void -ACE_Token_Request::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\nlength = %d\ntoken name = %s\nclient id = %s\n"), - this->length (), this->token_name (), this->client_id ())); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("type = "))); - - if (this->token_type () == ACE_Tokens::MUTEX) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("MUTEX\n"))); - else // == ACE_Tokens::RWLOCK - { - if (this->proxy_type () == ACE_RW_Token::READER) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RLOCK\n"))); - else // == WRITER - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("WLOCK\n"))); - } - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("operation = "))); - switch (this->operation_type ()) - { - case ACE_Token_Request::ACQUIRE: - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACQUIRE\n"))); - break; - case ACE_Token_Request::RELEASE: - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RELEASE\n"))); - break; - case ACE_Token_Request::RENEW: - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RENEW\n"))); - break; - default: - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" = %d\n"), this->operation_type ())); - break; - } - - if (this->options ()[ACE_Synch_Options::USE_TIMEOUT] == 0) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("blocking forever\n"))); - else - { - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("waiting for %d secs and %d usecs\n"), - this->options ().timeout ().sec (), this->options ().timeout ().usec ())); - } - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// ************************************************************ -// ************************************************************ -// ************************************************************ - -// Create a ACE_Token_Reply message. - -ACE_Token_Reply::ACE_Token_Reply (void) // Type of reply. -{ - this->arg (0); - this->errnum (0); - this->length (sizeof (Transfer)); -} - -// Encode the transfer buffer into network byte order -// so that it can be sent to the client. - -int -ACE_Token_Reply::encode (void *&buf) -{ - buf = (void *) &this->transfer_; - return this->length (); -} - -// Decode the transfer buffer into host byte order -// so that it can be used by the client. - -int -ACE_Token_Reply::decode (void) -{ - return 0; -} - -// Print out current values of the ACE_Token_Reply object. - -void -ACE_Token_Reply::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\nlength = %d\nerrnum = %d"), - this->length (), this->errnum ())); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("arg = %d"), this->arg ())); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Request_Reply.h b/ace/Token_Request_Reply.h deleted file mode 100644 index 15dea490bc7..00000000000 --- a/ace/Token_Request_Reply.h +++ /dev/null @@ -1,270 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Token_Request_Reply.h - * - * $Id$ - * - * Define the format used to exchange messages between the - * ACE_Token Server and its clients. - * - * - * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) - * @author Tim Harrison (harrison@cs.wustl.edu) - */ -//============================================================================= - - -#ifndef ACE_TOKEN_REQUEST_REPLY_H -#define ACE_TOKEN_REQUEST_REPLY_H -#include /**/ "ace/pre.h" - -#include "ace/Local_Tokens.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/// Specifies the size of the fixed length portion of -/// the Transfer structure in ACE_Token_Request -#define ACE_TOKEN_REQUEST_HEADER_SIZE 40 - -/** - * @class ACE_Token_Request - * - * @brief Message format for delivering requests to the ACE_Token Server. - * - * This class is implemented to minimize data copying. - * In particular, all marshaling is done in situ... - */ -class ACE_Export ACE_Token_Request -{ -public: - /// Operation types. - enum OPERATION - { - /// Acquire the token. - ACQUIRE, - /// Release the token. - RELEASE, - /// Renew the token. - RENEW, - /// Remove the token. - REMOVE, - // Try to acquire the token. - TRY_ACQUIRE - }; - - /// Default constructor. - ACE_Token_Request (void); - - /** - * @param token_type MUTEX, RWLOCK - * @param proxy_type MUTEX, RLOCK, WLOCK (acquires mean different things) - * @param operation method - * @param token_name - * @param client_id - * @param options We check USE_TIMEOUT and use the arg. - */ - ACE_Token_Request (int token_type, - int proxy_type, - ACE_UINT32 operation, - const ACE_TCHAR token_name[], - const ACE_TCHAR client_id[], - const ACE_Synch_Options &options); - - /// Get the length of the encoded/decoded message. - ACE_UINT32 length (void) const; - - /// Set the length of the encoded/decoded message. - void length (ACE_UINT32); - - /// Get the type of proxy - int proxy_type (void) const; - - /// Set the type of proxy - void proxy_type (int proxy_type); - - /// Get the type of token - int token_type (void) const; - - /// Set the type of token - void token_type (int token_type); - - /// Get the type of the operation. - ACE_UINT32 operation_type (void) const; - - /// Set the type of the operation. - void operation_type (ACE_UINT32); - - /// Get the requeue position. These should be used when renew - /// is the operation type. - ACE_UINT32 requeue_position (void) const; - - /// Set the requeue position. These should be used when renew - /// is the operation type. - void requeue_position (ACE_UINT32); - - /// Get notify. These should be used when acquire is the operation type. - ACE_UINT32 notify (void) const; - - /// Set notify. These should be used when acquire is the operation type. - void notify (ACE_UINT32); - - /// Get the timeout. - ACE_Synch_Options &options (void) const; - - /// Set the timeout. - void options (const ACE_Synch_Options &options); - - // = Set/get the name of the token and the client id. The set - // method is combined to make it easier on us. We're copying the - // names as a contiguous buffer. - ACE_TCHAR *token_name (void) const; - ACE_TCHAR *client_id (void) const; - void token_name (const ACE_TCHAR *token_name, const ACE_TCHAR *client_id); - - /// Encode the message before transmission. - int encode (void *&); - - /// Decode message after reception. This must be called to set the - /// internal options. - int decode (void); - - /// Print out the values of the message for debugging purposes. - void dump (void) const; - -private: - // = The 5 fields in the struct are transmitted to the server. - // The remaining 2 fields are not tranferred -- they are used only on - // the server-side to simplify lookups. - - struct Transfer - { - /// Length of entire request. - ACE_UINT32 length_; - - /// Type of the request (i.e., MUTEX, RLOCK, WLOCK... - ACE_UINT32 token_type_; - - /// Type of the request (i.e., MUTEX, RLOCK, WLOCK... - ACE_UINT32 proxy_type_; - - /// Type of the request (i.e., , , , and ). - ACE_UINT32 operation_type_; - - /// this only makes sense when operation type is renew - ACE_UINT32 requeue_position_; - - /// this only makes sense when operation type is renew - ACE_UINT32 notify_; - - // = ACE_Synch_Options stuff - - /// Indicates if we should block forever. If 1, then - /// and indicates how long we should wait. If 0, - /// then we block forever. - ACE_UINT32 use_timeout_; - - /// Max seconds willing to wait for token if not blocking forever. - ACE_UINT32 sec_; - - /// Max micro seconds to wait for token if not blocking forever. - ACE_UINT32 usec_; - - /// value returned in ; - ACE_UINT32 arg_; - - /// The data portion contains the including a 0 terminator, - /// a ':', then the including a 0 terminator - ACE_TCHAR data_[ACE_MAXTOKENNAMELEN + ACE_MAXCLIENTIDLEN + 3]; - } transfer_; - - /// Pointer to the beginning of the token name in this->data_. - ACE_TCHAR *token_name_; - - /// Pointer to the beginning of the client id in this->data_; - ACE_TCHAR *client_id_; - - /// Holds arg, sec, usec, etc. - ACE_Synch_Options options_; -}; - -/** - * @class ACE_Token_Reply - * - * @brief Message format for delivering replies from the ACE_Token Server. - * - * This class is implemented to minimize data copying. - * In particular, all marshaling is done in situ... - */ -class ACE_Export ACE_Token_Reply -{ -public: - /// Default constructor. - ACE_Token_Reply (void); - - /// Get the length of the encoded/decoded message. - ACE_UINT32 length (void) const; - - /// Set the length of the encoded/decoded message. - void length (ACE_UINT32); - - /// Get the errno of a reply. - ACE_UINT32 errnum (void) const; - - /// Set the errno of a reply. - void errnum (ACE_UINT32); - - /// Get the arg of a reply. - ACE_UINT32 arg (void) const; - - /// Set the arg of a reply. - void arg (ACE_UINT32); - - /// Encode the message before transfer. - int encode (void *&); - - /// Decode a message after reception. - int decode (void); - - /// Print out the values of the message for debugging purposes. - void dump (void) const; - -private: - // = The 2 fields in the struct are transmitted to the server. - - struct Transfer - { - /// Length of entire reply. - ACE_UINT32 length_; - - /// Indicates why error occurred if type_> == . - /// Typical reasons include: - /// (if client requested a non-blocking check for the token). - /// (if the client timed out after waiting for the token). - /// (if the token lock was removed out from underneath a waiter). - /// (attempt to renew a token that isn't owned by the client). - ACE_UINT32 errno_; - - /// magic cookie - ACE_UINT32 arg_; - - } transfer_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Token_Request_Reply.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_TOKENS_LIBRARY */ - -#include /**/ "ace/post.h" -#endif /* ACE_TOKEN_REQUEST_REPLY_H */ diff --git a/ace/Token_Request_Reply.inl b/ace/Token_Request_Reply.inl deleted file mode 100644 index 9955c4c66ea..00000000000 --- a/ace/Token_Request_Reply.inl +++ /dev/null @@ -1,206 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#include "ace/Truncate.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// = Set/get the length of the encoded/decoded message. - -ACE_INLINE ACE_UINT32 -ACE_Token_Request::length (void) const -{ - return ntohl (this->transfer_.length_); -} - -ACE_INLINE void -ACE_Token_Request::length (ACE_UINT32 l) -{ - this->transfer_.length_ = htonl (l); -} - -// = Set/get the type of the message. -ACE_INLINE int -ACE_Token_Request::token_type (void) const -{ - return (int) ntohl (this->transfer_.token_type_); -} - -ACE_INLINE void -ACE_Token_Request::token_type (int t) -{ - this->transfer_.token_type_ = htonl ((ACE_UINT32) t); -} - -// = Set/get the type of the message. -ACE_INLINE int -ACE_Token_Request::proxy_type (void) const -{ - return (int) ntohl (this->transfer_.proxy_type_); -} - -ACE_INLINE void -ACE_Token_Request::proxy_type (int t) -{ - this->transfer_.proxy_type_ = htonl ((ACE_UINT32) t); -} - -// = Set/get the type of the message. -ACE_INLINE ACE_UINT32 -ACE_Token_Request::operation_type (void) const -{ - return ntohl (this->transfer_.operation_type_); -} - -ACE_INLINE void -ACE_Token_Request::operation_type (ACE_UINT32 t) -{ - this->transfer_.operation_type_ = htonl (t); -} - -// = Set/get the requeue position -ACE_INLINE ACE_UINT32 -ACE_Token_Request::requeue_position (void) const -{ - return ntohl (this->transfer_.requeue_position_); -} - -ACE_INLINE void -ACE_Token_Request::requeue_position (ACE_UINT32 rq) -{ - this->transfer_.requeue_position_ = htonl (rq); -} - -// = Set/get the requeue position -ACE_INLINE ACE_UINT32 -ACE_Token_Request::notify (void) const -{ - return ntohl (this->transfer_.notify_); -} - -ACE_INLINE void -ACE_Token_Request::notify (ACE_UINT32 rq) -{ - this->transfer_.notify_ = htonl (rq); -} - -// = Set/get the blocking semantics. -ACE_INLINE ACE_Synch_Options & -ACE_Token_Request::options (void) const -{ - return (ACE_Synch_Options &) options_; -} - -ACE_INLINE void -ACE_Token_Request::options (const ACE_Synch_Options &opt) -{ - // fight the friggin const from hell - ACE_Synch_Options *options = (ACE_Synch_Options *) &opt; - - transfer_.use_timeout_ = options->operator[](ACE_Synch_Options::USE_TIMEOUT); - if (transfer_.use_timeout_ == 1) - { - transfer_.usec_ = options->timeout ().usec (); - if (options->timeout ().sec () > (time_t) ACE_UINT32_MAX) - transfer_.sec_ = ACE_UINT32_MAX; - else - transfer_.sec_ = static_cast (options->timeout ().sec ()); - } - else - { - transfer_.usec_ = 0; - transfer_.sec_ = 0; - } -} - -// = Set/get the name of the token. -ACE_INLINE ACE_TCHAR * -ACE_Token_Request::token_name (void) const -{ - return token_name_; -} - -ACE_INLINE void -ACE_Token_Request::token_name (const ACE_TCHAR *token_name, - const ACE_TCHAR *client_id) -{ - size_t token_name_length = ACE_OS::strlen (token_name) + 1; // Add 1 for '\0'. - size_t client_id_length = ACE_OS::strlen (client_id) + 1; // Add 1 for '\0'. - - // Set up pointers and copy token_name and client_id into request. - token_name_ = this->transfer_.data_; - client_id_ = &this->token_name_[token_name_length + 1]; // Add 1 for ':'; - client_id_[-1] = ACE_LIB_TEXT (':'); // Insert the ':' before this->clientId_. - - (void) ACE_OS::memcpy (this->token_name_, - token_name, - token_name_length * sizeof (ACE_TCHAR)); - (void) ACE_OS::memcpy (this->client_id_, - client_id, - client_id_length * sizeof (ACE_TCHAR)); - - // Fixed length header size - size_t len = ACE_TOKEN_REQUEST_HEADER_SIZE; - - // ... then add in the amount of the variable-sized portion. - len += token_name_length + client_id_length + 1; - - this->length (ACE_Utils::Truncate (len)); -} - -// = Set/get the id of the client. -ACE_INLINE ACE_TCHAR * -ACE_Token_Request::client_id (void) const -{ - return this->client_id_; -} - -// ************************************************************ -// ************************************************************ -// ************************************************************ - -// = Set/get the length of the encoded/decoded message. -ACE_INLINE ACE_UINT32 -ACE_Token_Reply::length (void) const -{ - return ntohl (this->transfer_.length_); -} - -ACE_INLINE void -ACE_Token_Reply::length (ACE_UINT32 l) -{ - this->transfer_.length_ = htonl (l); -} - -// = Set/get the errno of a failed reply. -ACE_INLINE ACE_UINT32 -ACE_Token_Reply::errnum (void) const -{ - return ntohl (this->transfer_.errno_); -} - -ACE_INLINE void -ACE_Token_Reply::errnum (ACE_UINT32 e) -{ - this->transfer_.errno_ = htonl (e); -} - -// = Set/get the length of the encoded/decoded message. -ACE_INLINE ACE_UINT32 -ACE_Token_Reply::arg (void) const -{ - return ntohl (this->transfer_.arg_); -} - -ACE_INLINE void -ACE_Token_Reply::arg (ACE_UINT32 arg) -{ - this->transfer_.arg_ = htonl (arg); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Trace.cpp b/ace/Trace.cpp deleted file mode 100644 index 63faa316d4e..00000000000 --- a/ace/Trace.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// $Id$ - - -#include "ace/Trace.h" - -ACE_RCSID (ace, - Trace, - "$Id$") - -// Turn off tracing for the duration of this file. -#if defined (ACE_NTRACE) -#undef ACE_NTRACE -#endif /* ACE_NTRACE */ -#define ACE_NTRACE 1 - -#include "ace/Log_Msg.h" -#include "ace/Object_Manager_Base.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// = Static initialization. - -// Keeps track of how far to indent per trace call. -int ACE_Trace::nesting_indent_ = ACE_Trace::DEFAULT_INDENT; - -// Is tracing enabled? -int ACE_Trace::enable_tracing_ = ACE_Trace::DEFAULT_TRACING; - -ACE_ALLOC_HOOK_DEFINE(ACE_Trace) - -void -ACE_Trace::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -#endif /* ACE_HAS_DUMP */ -} - -// Determine whether or not tracing is enabled - -int -ACE_Trace::is_tracing (void) -{ - return ACE_Trace::enable_tracing_; -} - -// Enable the tracing facility. - -void -ACE_Trace::start_tracing (void) -{ - ACE_Trace::enable_tracing_ = 1; -} - -// Disable the tracing facility. - -void -ACE_Trace::stop_tracing (void) -{ - ACE_Trace::enable_tracing_ = 0; -} - -// Change the nesting indentation level. - -void -ACE_Trace::set_nesting_indent (int indent) -{ - ACE_Trace::nesting_indent_ = indent; -} - -// Get the nesting indentation level. - -int -ACE_Trace::get_nesting_indent (void) -{ - return ACE_Trace::nesting_indent_; -} - -// Perform the first part of the trace, which prints out the string N, -// the LINE, and the ACE_FILE as the function is entered. - -ACE_Trace::ACE_Trace (const ACE_TCHAR *n, - int line, - const ACE_TCHAR *file) -{ -#if defined (ACE_NLOGGING) - ACE_UNUSED_ARG (line); - ACE_UNUSED_ARG (file); -#endif /* ACE_NLOGGING */ - - this->name_ = n; - - // If ACE has not yet been initialized, don't try to trace... there's - // too much stuff not yet initialized. - if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ()) - { - ACE_Log_Msg *lm = ACE_LOG_MSG; - if (lm->tracing_enabled () - && lm->trace_active () == 0) - { - lm->trace_active (1); - ACE_DEBUG ((LM_TRACE, - ACE_LIB_TEXT ("%*s(%t) calling %s in file `%s' on line %d\n"), - ACE_Trace::nesting_indent_ * lm->inc (), - ACE_LIB_TEXT (""), - this->name_, - file, - line)); - lm->trace_active (0); - } - } -} - -// Perform the second part of the trace, which prints out the NAME as -// the function is exited. - -ACE_Trace::~ACE_Trace (void) -{ - // If ACE has not yet been initialized, don't try to trace... there's - // too much stuff not yet initialized. - if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ()) - { - ACE_Log_Msg *lm = ACE_LOG_MSG; - if (lm->tracing_enabled () - && lm->trace_active () == 0) - { - lm->trace_active (1); - ACE_DEBUG ((LM_TRACE, - ACE_LIB_TEXT ("%*s(%t) leaving %s\n"), - ACE_Trace::nesting_indent_ * lm->dec (), - ACE_LIB_TEXT (""), - this->name_)); - lm->trace_active (0); - } - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Trace.h b/ace/Trace.h deleted file mode 100644 index c473ee14014..00000000000 --- a/ace/Trace.h +++ /dev/null @@ -1,96 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Trace.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_TRACE_H -#define ACE_TRACE_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Trace - * - * @brief A C++ trace facility that keeps track of which methods are - * entered and exited. - * - * This class uses C++ constructors and destructors to automate - * the ACE_Trace nesting. In addition, thread-specific storage - * is used to enable multiple threads to work correctly. - */ -class ACE_Export ACE_Trace -{ -public: - // = Initialization and termination methods. - - /// Perform the first part of the trace, which prints out the string - /// N, the LINE, and the ACE_FILE as the function is entered. - ACE_Trace (const ACE_TCHAR *n, - int line = 0, - const ACE_TCHAR *file = ACE_LIB_TEXT ("")); - - /// Perform the second part of the trace, which prints out the NAME - /// as the function is exited. - ~ACE_Trace (void); - - // = Control the tracing level. - /// Determine if tracing is enabled (return == 1) or not (== 0) - static int is_tracing(void); - - /// Enable the tracing facility. - static void start_tracing (void); - - /// Disable the tracing facility. - static void stop_tracing (void); - - /// Change the nesting indentation level. - static void set_nesting_indent (int indent); - - /// Get the nesting indentation level. - static int get_nesting_indent (void); - - /// Dump the state of an object. - void dump (void) const; - -private: - // Keeps track of how deeply the call stack is nested (this is - // maintained in thread-specific storage to ensure correctness in - // multiple threads of control. - - /// Name of the method we are in. - const ACE_TCHAR *name_; - - /// Keeps track of how far to indent per trace call. - static int nesting_indent_; - - /// Is tracing enabled? - static int enable_tracing_; - - /// Default values. - enum - { - DEFAULT_INDENT = 3, - DEFAULT_TRACING = 1 - }; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_TRACE_H */ diff --git a/ace/Truncate.h b/ace/Truncate.h deleted file mode 100644 index de347d1dc06..00000000000 --- a/ace/Truncate.h +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file Truncate.h - * - * $Id$ - * - * @author Steve Huston - */ -//============================================================================= -#ifndef ACE_TRUNCATE_H -#define ACE_TRUNCATE_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" - -#if !defined(ACE_LACKS_NUMERIC_LIMITS) -// some platforms pollute the namespace by defining max() and min() macros -# ifdef max -# undef max -# endif -# ifdef min -# undef min -# endif -# include -#else -# include "ace/os_include/os_limits.h" -#endif /* ACE_LACKS_NUMERIC_LIMITS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE_Utils -{ -/** - * @class Truncate - * - * @brief Helper function to truncate an integral value to an int. - * - * Very useful since ACE methods return int very often and the value's - * source is often a different-size integral type, such as size_t. - * This function hides the truncation logic and resolves compiler - * diagnostics. - * - * @internal Internal use only. - */ -template -inline int Truncate (const X& val) -{ -#if !defined (ACE_LACKS_NUMERIC_LIMITS) - if (val > static_cast (std::numeric_limits::max ())) - return std::numeric_limits::max (); -#else - if (val > static_cast (INT_MAX)) - return INT_MAX; -#endif /* ACE_LACKS_NUMERIC_LIMITS */ - return static_cast (val); -} - -// Specialize one for size_t to alleviate the explicit instantiation pain. -template<> -inline int Truncate (const size_t& val) -{ -#if !defined (ACE_LACKS_NUMERIC_LIMITS) - if (val > static_cast (std::numeric_limits::max ())) - return std::numeric_limits::max (); -#else - if (val > static_cast (INT_MAX)) - return INT_MAX; -#endif /* ACE_LACKS_NUMERIC_LIMITS */ - return static_cast (val); -} - -} // namespace ACE_Utils - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_TRUNCATE_H*/ diff --git a/ace/Typed_SV_Message.cpp b/ace/Typed_SV_Message.cpp deleted file mode 100644 index 79f931b77df..00000000000 --- a/ace/Typed_SV_Message.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// $Id$ - -#ifndef ACE_TYPED_SV_MESSAGE_CPP -#define ACE_TYPED_SV_MESSAGE_CPP - -#include "ace/Typed_SV_Message.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Typed_SV_Message.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Typed_SV_Message) - -template void -ACE_Typed_SV_Message::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Typed_SV_Message::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TYPED_SV_MESSAGE_CPP */ diff --git a/ace/Typed_SV_Message.h b/ace/Typed_SV_Message.h deleted file mode 100644 index e88ddd6bf00..00000000000 --- a/ace/Typed_SV_Message.h +++ /dev/null @@ -1,107 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Typed_SV_Message.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//========================================================================== - - -#ifndef ACE_TYPED_SV_MESSAGE_H -#define ACE_TYPED_SV_MESSAGE_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Typed_SV_Message - * - * @brief Defines the header file for the C++ wrapper for System V - * message queues. - */ -template -class ACE_Typed_SV_Message -{ -public: - // = Initialization and termination methods. - ACE_Typed_SV_Message (long type = 0, - int length = sizeof (T), - int max_size = sizeof (T)); - ACE_Typed_SV_Message (const T &data, - long type = 0, - int length = sizeof (T), - int max_size = sizeof (T)); - ~ACE_Typed_SV_Message (void); - - /// Get the type of the message. - long type (void) const; - - /// Set the type of the message. - void type (long type); - - /// Get the length of the message. - int length (void) const; - - /// Set the length of the message. - void length (int l); - - /// Get the maximum size of the message. - int max_size (void) const; - - /// Set the maximum size of the message. - void max_size (int m); - - /// Get a pointer to the data in the message. - T &data (void); - - /// Set a pointer to the data in the message. - void data (const T &data); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Type of message. - long type_; - - /// Length of this message. - int length_; - - /// Maximum length of any message. - int max_; - - /// Data stored in a message. - T data_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Typed_SV_Message.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Typed_SV_Message.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Typed_SV_Message.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_TYPED_SV_MESSAGE_H */ diff --git a/ace/Typed_SV_Message.inl b/ace/Typed_SV_Message.inl deleted file mode 100644 index 00ff07109ac..00000000000 --- a/ace/Typed_SV_Message.inl +++ /dev/null @@ -1,96 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/config-all.h" -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Typed_SV_Message::ACE_Typed_SV_Message (long t, - int l, - int m) - : type_ (t) -{ - ACE_TRACE ("ACE_Typed_SV_Message::ACE_Typed_SV_Message"); - this->length (l); - this->max_size (m); -} - -template ACE_INLINE -ACE_Typed_SV_Message::ACE_Typed_SV_Message (const T &d, - long t, - int l, - int m) - : type_ (t), - data_ (d) -{ - ACE_TRACE ("ACE_Typed_SV_Message::ACE_Typed_SV_Message"); - this->length (l); - this->max_size (m); -} - -template ACE_INLINE -ACE_Typed_SV_Message::~ACE_Typed_SV_Message (void) -{ - ACE_TRACE ("ACE_Typed_SV_Message::~ACE_Typed_SV_Message"); -} - -template ACE_INLINE long -ACE_Typed_SV_Message::type (void) const -{ - ACE_TRACE ("ACE_Typed_SV_Message::type"); - return this->type_; -} - -template ACE_INLINE void -ACE_Typed_SV_Message::type (long t) -{ - ACE_TRACE ("ACE_Typed_SV_Message::type"); - this->type_ = t; -} - -template ACE_INLINE int -ACE_Typed_SV_Message::length (void) const -{ - ACE_TRACE ("ACE_Typed_SV_Message::length"); - return this->length_; -} - -template ACE_INLINE void -ACE_Typed_SV_Message::length (int len) -{ - ACE_TRACE ("ACE_Typed_SV_Message::length"); - this->length_ = len + (sizeof *this - (sizeof this->type_ + sizeof this->data_)); -} - -template ACE_INLINE int -ACE_Typed_SV_Message::max_size (void) const -{ - ACE_TRACE ("ACE_Typed_SV_Message::max_size"); - return this->max_; -} - -template ACE_INLINE void -ACE_Typed_SV_Message::max_size (int m) -{ - ACE_TRACE ("ACE_Typed_SV_Message::max_size"); - this->max_ = m + (sizeof *this - (sizeof this->type_ + sizeof this->data_)); -} - -template T & -ACE_Typed_SV_Message::data (void) -{ - ACE_TRACE ("ACE_Typed_SV_Message::data"); - return this->data_; -} - -template void -ACE_Typed_SV_Message::data (const T &d) -{ - ACE_TRACE ("ACE_Typed_SV_Message::data"); - this->data_ = d; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Typed_SV_Message_Queue.cpp b/ace/Typed_SV_Message_Queue.cpp deleted file mode 100644 index 7fc2b0fd38d..00000000000 --- a/ace/Typed_SV_Message_Queue.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -#ifndef ACE_TYPED_SV_MESSAGE_QUEUE_CPP -#define ACE_TYPED_SV_MESSAGE_QUEUE_CPP - -#include "ace/Typed_SV_Message.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Typed_SV_Message_Queue.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Typed_SV_Message_Queue.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Typed_SV_Message_Queue) - -template void -ACE_Typed_SV_Message_Queue::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Typed_SV_Message_Queue::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue (void) -{ - ACE_TRACE ("ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue"); -} - -template -ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue (key_t external_id, - int create, - int perms) -{ - ACE_TRACE ("ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue"); - if (this->open (external_id, create, perms) == -1) - ACE_ERROR ((LM_ERROR, - "ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue")); -} - -template -ACE_Typed_SV_Message_Queue::~ACE_Typed_SV_Message_Queue (void) -{ - ACE_TRACE ("ACE_Typed_SV_Message_Queue::~ACE_Typed_SV_Message_Queue"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_TYPED_SV_MESSAGE_QUEUE_CPP */ diff --git a/ace/Typed_SV_Message_Queue.h b/ace/Typed_SV_Message_Queue.h deleted file mode 100644 index f7c2c066654..00000000000 --- a/ace/Typed_SV_Message_Queue.h +++ /dev/null @@ -1,92 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Typed_SV_Message_Queue.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_TYPED_MESSAGE_QUEUE_H -#define ACE_TYPED_MESSAGE_QUEUE_H -#include /**/ "ace/pre.h" - -#include "ace/SV_Message_Queue.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Typed_SV_Message.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Typed_SV_Message_Queue - * - * @brief Defines the header file for the C++ wrapper facade for typed message queues. - */ -template -class ACE_Typed_SV_Message_Queue -{ -public: - enum - { - ACE_CREATE = IPC_CREAT, - ACE_OPEN = 0, - ACE_NOWAIT = IPC_NOWAIT - }; - - // = Initialization and termination operations. - ACE_Typed_SV_Message_Queue (void); - ACE_Typed_SV_Message_Queue (key_t external_id, - int create = ACE_OPEN, - int perms = ACE_DEFAULT_FILE_PERMS); - int open (key_t external_id, - int create = ACE_OPEN, - int perms = ACE_DEFAULT_FILE_PERMS); - int close (void); - int remove (void); - ~ACE_Typed_SV_Message_Queue (void); - - /// Send method. - int send (const ACE_Typed_SV_Message &mb, int mflags = 0); - - /// Recv method. - int recv (ACE_Typed_SV_Message &mb, int mflags = 0); - - /// Return the id of the underlying ACE_SV_Message_Queue. - int get_id (void) const; - - /// Control the underlying message queue. - int control (int option, void *arg = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - ACE_SV_Message_Queue message_queue_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Typed_SV_Message_Queue.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Typed_SV_Message_Queue.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Typed_SV_Message_Queue.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_TYPED_MESSAGE_QUEUE_H */ diff --git a/ace/Typed_SV_Message_Queue.inl b/ace/Typed_SV_Message_Queue.inl deleted file mode 100644 index 21ae9536501..00000000000 --- a/ace/Typed_SV_Message_Queue.inl +++ /dev/null @@ -1,80 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/SV_Message_Queue.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Typed_SV_Message_Queue::open (key_t external_id, - int create, - int perms) -{ - ACE_TRACE ("ACE_Typed_SV_Message_Queue::open"); - return this->message_queue_.open (external_id, create, perms); -} - -// What does it mean to close a message queue?! - -template ACE_INLINE int -ACE_Typed_SV_Message_Queue::close (void) -{ - ACE_TRACE ("ACE_Typed_SV_Message_Queue::close"); - return 1; -} - -template ACE_INLINE int -ACE_Typed_SV_Message_Queue::recv (ACE_Typed_SV_Message &mb, - int mflags) -{ - ACE_TRACE ("ACE_Typed_SV_Message_Queue::recv"); - - int length = - this->message_queue_.recv (reinterpret_cast (mb), - mb.max_size (), - mb.type (), - mflags); - if (length != -1) - mb.length (length); - - return length; -} - -template ACE_INLINE int -ACE_Typed_SV_Message_Queue::send (const ACE_Typed_SV_Message &mb, - int mflags) -{ - ACE_TRACE ("ACE_Typed_SV_Message_Queue::send"); - return - this->message_queue_.send ( - reinterpret_cast ( - const_cast &> (mb)), - mb.length (), - mflags); -} - -template ACE_INLINE int -ACE_Typed_SV_Message_Queue::remove (void) -{ - ACE_TRACE ("ACE_Typed_SV_Message_Queue::remove"); - - return this->message_queue_.remove (); -} - -template ACE_INLINE int -ACE_Typed_SV_Message_Queue::control (int option, - void *arg) -{ - ACE_TRACE ("ACE_Typed_SV_Message_Queue::control"); - - return this->message_queue_.control (option, arg); -} - -template ACE_INLINE int -ACE_Typed_SV_Message_Queue::get_id (void) const -{ - return this->message_queue_.get_id (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UNIX_Addr.cpp b/ace/UNIX_Addr.cpp deleted file mode 100644 index 8dd3c52a36c..00000000000 --- a/ace/UNIX_Addr.cpp +++ /dev/null @@ -1,151 +0,0 @@ -// $Id$ - -#include "ace/UNIX_Addr.h" - -ACE_RCSID(ace, UNIX_Addr, "$Id$") - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#if !defined (__ACE_INLINE__) -#include "ace/UNIX_Addr.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_UNIX_Addr) - -// Set a pointer to the address. -void -ACE_UNIX_Addr::set_addr (void *addr, int len) -{ - ACE_TRACE ("ACE_UNIX_Addr::set_addr"); - - this->ACE_Addr::base_set (AF_UNIX, len); - ACE_OS::memcpy ((void *) &this->unix_addr_, - (void *) addr, - len); -} - -// Return a pointer to the underlying address. - -void * -ACE_UNIX_Addr::get_addr (void) const -{ - return (void *) &this->unix_addr_; -} - -// Transform the string into the current addressing format. - -int -ACE_UNIX_Addr::string_to_addr (const char addr[]) -{ - ACE_OS::strsncpy (this->unix_addr_.sun_path, addr, - sizeof this->unix_addr_.sun_path); - return 0; -} - -// Transform the current address into string format. - -int -ACE_UNIX_Addr::addr_to_string (ACE_TCHAR s[], size_t len) const -{ - ACE_OS::strsncpy (s, - ACE_TEXT_CHAR_TO_TCHAR (this->unix_addr_.sun_path), - len); - return 0; -} - -u_long -ACE_UNIX_Addr::hash (void) const -{ - return ACE::hash_pjw (this->unix_addr_.sun_path); -} - -void -ACE_UNIX_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -#endif /* ACE_HAS_DUMP */ -} - -// Do nothing constructor. - -ACE_UNIX_Addr::ACE_UNIX_Addr (void) - : ACE_Addr (AF_UNIX, sizeof this->unix_addr_) -{ - (void) ACE_OS::memset ((void *) &this->unix_addr_, - 0, - sizeof this->unix_addr_); - - this->unix_addr_.sun_family = AF_UNIX; -} - -int -ACE_UNIX_Addr::set (const ACE_UNIX_Addr &sa) -{ - if (sa.get_type () == AF_ANY) - (void) ACE_OS::memset ((void *) &this->unix_addr_, - 0, - sizeof this->unix_addr_); - else - ACE_OS::strcpy (this->unix_addr_.sun_path, - sa.unix_addr_.sun_path); - - this->unix_addr_.sun_family = AF_UNIX; - this->base_set (sa.get_type (), sa.get_size ()); - - return 0; -} - -// Copy constructor. - -ACE_UNIX_Addr::ACE_UNIX_Addr (const ACE_UNIX_Addr &sa) - : ACE_Addr (AF_UNIX, sa.get_size ()) -{ - this->set (sa); -} - -int -ACE_UNIX_Addr::set (const sockaddr_un *un, int len) -{ - (void) ACE_OS::memset ((void *) &this->unix_addr_, 0, - sizeof this->unix_addr_); - this->unix_addr_.sun_family = AF_UNIX; - ACE_OS::strcpy (this->unix_addr_.sun_path, un->sun_path); - this->base_set (AF_UNIX, len); - return 0; -} - -ACE_UNIX_Addr::ACE_UNIX_Addr (const sockaddr_un *un, int len) -{ - this->set (un, len); -} - -int -ACE_UNIX_Addr::set (const char rendezvous_point[]) -{ - (void) ACE_OS::memset ((void *) &this->unix_addr_, - 0, - sizeof this->unix_addr_); - this->unix_addr_.sun_family = AF_UNIX; - (void) ACE_OS::strsncpy (this->unix_addr_.sun_path, - rendezvous_point, - sizeof this->unix_addr_.sun_path); - - this->ACE_Addr::base_set (AF_UNIX, - sizeof this->unix_addr_ - - sizeof (this->unix_addr_.sun_path) + - ACE_OS::strlen (this->unix_addr_.sun_path)); - return 0; -} - -// Create a ACE_Addr from a UNIX pathname. - -ACE_UNIX_Addr::ACE_UNIX_Addr (const char rendezvous_point[]) -{ - this->set (rendezvous_point); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/UNIX_Addr.h b/ace/UNIX_Addr.h deleted file mode 100644 index fcd6ed9bf46..00000000000 --- a/ace/UNIX_Addr.h +++ /dev/null @@ -1,117 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file UNIX_Addr.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_UNIX_ADDR_H -#define ACE_UNIX_ADDR_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/Addr.h" -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/os_include/sys/os_un.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_UNIX_Addr - * - * @brief Defines the ``UNIX domain address family'' address format. - */ -class ACE_Export ACE_UNIX_Addr : public ACE_Addr -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_UNIX_Addr (void); - - /// Copy constructor. - ACE_UNIX_Addr (const ACE_UNIX_Addr &sa); - - /// Creates an ACE_UNIX_Addr from a string. - ACE_UNIX_Addr (const char rendezvous_point[]); - - /// Creates an ACE_INET_Addr from a sockaddr_un structure. - ACE_UNIX_Addr (const sockaddr_un *, int len); - - /// Creates an ACE_UNIX_Addr from another ACE_UNIX_Addr. - int set (const ACE_UNIX_Addr &sa); - - /// Creates an ACE_UNIX_Addr from a string. - int set (const char rendezvous_point[]); - - /// Creates an ACE_UNIX_Addr from a sockaddr_un structure. - int set (const sockaddr_un *, int len); - - /// Return a pointer to the underlying network address. - virtual void *get_addr (void) const; - - /// Set a pointer to the underlying network address. - virtual void set_addr (void *addr, int len); - - /// Transform the current address into string format. - virtual int addr_to_string (ACE_TCHAR addr[], size_t) const; - - /// Transform the string into the current addressing format. - virtual int string_to_addr (const char addr[]); - -#if defined (ACE_HAS_WCHAR) - /// Creates an ACE_UNIX_Addr from a string. - ACE_UNIX_Addr (const wchar_t rendezvous_point[]); - - /// Creates an ACE_UNIX_Addr from a string. - int set (const wchar_t rendezvous_point[]); -#endif /* ACE_HAS_WCHAR */ - - /// Compare two addresses for equality. - bool operator == (const ACE_UNIX_Addr &SAP) const; - - /// Compare two addresses for inequality. - bool operator != (const ACE_UNIX_Addr &SAP) const; - - /// Return the path name of the underlying rendezvous point. - const char *get_path_name (void) const; - - /// Computes and returns hash value. - virtual u_long hash (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Underlying socket address. - sockaddr_un unix_addr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/UNIX_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ - -#include /**/ "ace/post.h" - -#endif /* ACE_UNIX_ADDR_H */ diff --git a/ace/UNIX_Addr.inl b/ace/UNIX_Addr.inl deleted file mode 100644 index 34fa002ef34..00000000000 --- a/ace/UNIX_Addr.inl +++ /dev/null @@ -1,57 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - - -#include "ace/OS_NS_string.h" - - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_HAS_WCHAR) -/// Creates an ACE_UNIX_Addr from a string. -ACE_INLINE -ACE_UNIX_Addr::ACE_UNIX_Addr (const wchar_t rendezvous_point[]) -{ - this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point)); -} - -/// Creates an ACE_UNIX_Addr from a string. -ACE_INLINE int -ACE_UNIX_Addr::set (const wchar_t rendezvous_point[]) -{ - return this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point)); -} -#endif /* ACE_HAS_WCHAR */ - -// Compare two addresses for equality. - -ACE_INLINE bool -ACE_UNIX_Addr::operator == (const ACE_UNIX_Addr &sap) const -{ - return ACE_OS::strncmp (this->unix_addr_.sun_path, - sap.unix_addr_.sun_path, - sizeof this->unix_addr_.sun_path) == 0; -} - -// Compare two addresses for inequality. - -ACE_INLINE bool -ACE_UNIX_Addr::operator != (const ACE_UNIX_Addr &sap) const -{ - return !((*this) == sap); // This is lazy, of course... ;-) -} - -// Return the path name used for the rendezvous point. - -ACE_INLINE const char * -ACE_UNIX_Addr::get_path_name (void) const -{ - return this->unix_addr_.sun_path; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/UPIPE_Acceptor.cpp b/ace/UPIPE_Acceptor.cpp deleted file mode 100644 index 4b106b4a4be..00000000000 --- a/ace/UPIPE_Acceptor.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// $Id$ - -#include "ace/UPIPE_Acceptor.h" - -ACE_RCSID(ace, UPIPE_Acceptor, "$Id$") - -#if defined (ACE_HAS_THREADS) - -#include "ace/OS_NS_unistd.h" - -#if !defined (__ACE_INLINE__) -#include "ace/UPIPE_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Acceptor) - -void -ACE_UPIPE_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_UPIPE_Acceptor::dump"); -#endif /* ACE_HAS_DUMP */ -} - -/* Do nothing routine for constructor. */ - -ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor (void) - : mb_ (sizeof (ACE_UPIPE_Stream *)) -{ - ACE_TRACE ("ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor"); -} - -ACE_UPIPE_Acceptor::~ACE_UPIPE_Acceptor (void) -{ - ACE_TRACE ("ACE_UPIPE_Acceptor::~ACE_UPIPE_Acceptor"); -} - -// General purpose routine for performing server ACE_UPIPE. - -int -ACE_UPIPE_Acceptor::open (const ACE_UPIPE_Addr &local_addr, - int reuse_addr) -{ - ACE_TRACE ("ACE_UPIPE_Acceptor::open"); - return this->ACE_SPIPE_Acceptor::open (local_addr, reuse_addr); -} - -int -ACE_UPIPE_Acceptor::close (void) -{ - ACE_TRACE ("ACE_UPIPE_Acceptor::close"); - return this->ACE_SPIPE_Acceptor::close (); -} - -// General purpose routine for accepting new connections. - -ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_addr, - int reuse_addr) - : mb_ (sizeof (ACE_UPIPE_Stream *)) -{ - ACE_TRACE ("ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor"); - - if (this->open (local_addr, reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_UPIPE_Acceptor"))); -} - -int -ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream, - ACE_UPIPE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) -{ - ACE_TRACE ("ACE_UPIPE_Acceptor::accept"); - ACE_UNUSED_ARG (reset_new_handle); - - ACE_SPIPE_Stream new_io; - - if (this->ACE_SPIPE_Acceptor::accept (new_io, remote_addr, - timeout, restart) == -1) - return -1; - else - { - ACE_UPIPE_Stream *remote_stream = 0; - - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, new_stream.lock_, -1)); - - new_stream.set_handle (new_io.get_handle ()); - new_stream.reference_count_++; - - // Transfer address ownership. - new_io.get_local_addr (new_stream.local_addr_); - new_io.get_remote_addr (new_stream.remote_addr_); - - // Now that we got the handle, we'll read the address of the - // connector-side ACE_UPIPE_Stream out of the pipe and link that - // ACE_UPIPE_Stream to our ACE_UPIPE_Stream. - - if (ACE_OS::read (new_stream.get_handle (), - (char *) &remote_stream, - sizeof remote_stream) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"), - ACE_LIB_TEXT ("read stream address failed"))); - else if (new_stream.stream_.link (remote_stream->stream_) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"), - ACE_LIB_TEXT ("link streams failed"))); - // Send a message over the new streampipe to confirm acceptance. - else if (new_stream.send (&mb_, 0) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"), - ACE_LIB_TEXT ("linked stream.put failed"))); - - // Close down the new_stream at this point in order to conserve - // handles. Note that we don't need the SPIPE connection - // anymore since we're now linked via the . - new_stream.ACE_SPIPE::close (); - return 0; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/UPIPE_Acceptor.h b/ace/UPIPE_Acceptor.h deleted file mode 100644 index b7b94179cb6..00000000000 --- a/ace/UPIPE_Acceptor.h +++ /dev/null @@ -1,99 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file UPIPE_Acceptor.h - * - * $Id$ - * - * @author Gerhard Lenzer - * @author Douglas C. Schmidt - */ -//============================================================================= - - -#ifndef ACE_UPIPE_ACCEPTOR_H -#define ACE_UPIPE_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include "ace/UPIPE_Stream.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_THREADS) - -#include "ace/SPIPE_Acceptor.h" -#include "ace/Thread_Manager.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_UPIPE_Acceptor - * - * @brief Defines the format and interface for the listener side of the - * ACE_UPIPE_Stream. - */ -class ACE_Export ACE_UPIPE_Acceptor : public ACE_SPIPE_Acceptor -{ -public: - // = Initialization and termination. - /// Default constructor. - ACE_UPIPE_Acceptor (void); - - /// Initialize passive endpoint. - ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_sap, - int reuse_addr = 0); - - /// Initialize passive endpoint. - int open (const ACE_UPIPE_Addr &local_sap, - int reuse_addr = 0); - - /// Close down and release resources. - ~ACE_UPIPE_Acceptor (void); - - /// Close down and release resources. - int close (void); - - /// Close down and release resources and remove the underlying SPIPE - /// rendezvous point. - int remove (void); - - // = Passive connection acceptance method. - /** - * Accept a new data transfer connection. A @a timeout of 0 means - * block forever, a @a timeout of {0, 0} means poll. @a restart == 1 - * means "restart if interrupted." - */ - int accept (ACE_UPIPE_Stream &server_stream, - ACE_UPIPE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Manage threads. - ACE_Thread_Manager tm; - - /// To confirm connection establishment. - ACE_Message_Block mb_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/UPIPE_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" - -#endif /* ACE_UPIPE_ACCEPTOR_H */ diff --git a/ace/UPIPE_Acceptor.inl b/ace/UPIPE_Acceptor.inl deleted file mode 100644 index 731d6be4a6c..00000000000 --- a/ace/UPIPE_Acceptor.inl +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_UPIPE_Acceptor::remove (void) -{ - ACE_TRACE ("ACE_UPIPE_Acceptor::remove"); - return this->ACE_SPIPE_Acceptor::remove (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UPIPE_Addr.h b/ace/UPIPE_Addr.h deleted file mode 100644 index 75f948c6bf5..00000000000 --- a/ace/UPIPE_Addr.h +++ /dev/null @@ -1,33 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file UPIPE_Addr.h - * - * $Id$ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_UPIPE_ADDR_H -#define ACE_UPIPE_ADDR_H - -#include /**/ "ace/pre.h" - -#include "ace/SPIPE_Addr.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -typedef ACE_SPIPE_Addr ACE_UPIPE_Addr; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_UPIPE_ADDR_H */ diff --git a/ace/UPIPE_Connector.cpp b/ace/UPIPE_Connector.cpp deleted file mode 100644 index ba0b4592d2f..00000000000 --- a/ace/UPIPE_Connector.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// $Id$ - -#include "ace/UPIPE_Connector.h" - -ACE_RCSID(ace, UPIPE_Connector, "$Id$") - -#if defined (ACE_HAS_THREADS) - -#include "ace/Handle_Ops.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_stropts.h" - -#if !defined (__ACE_INLINE__) -#include "ace/UPIPE_Connector.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Connector) - -void -ACE_UPIPE_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_UPIPE_Connector::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_UPIPE_Connector::ACE_UPIPE_Connector (void) -{ - ACE_TRACE ("ACE_UPIPE_Connector::ACE_UPIPE_Connector"); -} - -int -ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream, - const ACE_UPIPE_Addr &addr, - ACE_Time_Value *timeout, - const ACE_Addr & /* local_sap */, - int /* reuse_addr */, - int flags, - int perms) -{ - ACE_TRACE ("ACE_UPIPE_Connector::connect"); - ACE_ASSERT (new_stream.get_handle () == ACE_INVALID_HANDLE); - - ACE_HANDLE handle = ACE::handle_timed_open (timeout, - addr.get_path_name (), - flags, perms); - - if (handle == ACE_INVALID_HANDLE) - return -1; -#if !defined (ACE_WIN32) - else if (ACE_OS::isastream (handle) != 1) - return -1; -#endif - else // We're connected! - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, new_stream.lock_, -1)); - - ACE_UPIPE_Stream *ustream = &new_stream; - - new_stream.set_handle (handle); - new_stream.remote_addr_ = addr; // class copy. - new_stream.reference_count_++; - - // Now send the address of our ACE_UPIPE_Stream over this pipe - // to our corresponding ACE_UPIPE_Acceptor, so he may link the - // two streams. - ssize_t result = ACE_OS::write (handle, - (const char *) &ustream, - sizeof ustream); - if (result == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_UPIPE_Connector %p\n"), - ACE_LIB_TEXT ("write to pipe failed"))); - - // Wait for confirmation of stream linking. - ACE_Message_Block *mb_p = 0; - - // Our part is done, wait for server to confirm connection. - result = new_stream.recv (mb_p, 0); - - // Do *not* coalesce the following two checks for result == -1. - // They perform different checks and cannot be merged. - if (result == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_UPIPE_Connector %p\n"), - ACE_LIB_TEXT ("no confirmation from server"))); - else - // Close down the new_stream at this point in order to - // conserve handles. Note that we don't need the SPIPE - // connection anymore since we're linked via the Message_Queue - // now. - new_stream.ACE_SPIPE::close (); - return static_cast (result); - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/UPIPE_Connector.h b/ace/UPIPE_Connector.h deleted file mode 100644 index c2778f82a11..00000000000 --- a/ace/UPIPE_Connector.h +++ /dev/null @@ -1,115 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file UPIPE_Connector.h - * - * $Id$ - * - * @author Gerhard Lenzer and Douglas C. Schmidt - */ -//============================================================================= - - -#ifndef ACE_UPIPE_CONNECTOR_H -#define ACE_UPIPE_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/UPIPE_Stream.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_THREADS) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_UPIPE_Connector - * - * @brief Defines an active connection factory for the - * ACE_UPIPE_STREAM wrappers. - */ -class ACE_Export ACE_UPIPE_Connector -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_UPIPE_Connector (void); - - /** - * Actively connect and produce a @a new_stream if things go well. - * The @a addr is the address that we are trying to connect - * with. The @a timeout is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made . The - * @a local_sap is the value of local address to bind to. If it's - * the default value of ACE_Addr::sap_any then the user is letting - * the OS do the binding. If @a reuse_addr == 1 then the - * @a local_addr is reused, even if it hasn't been cleanedup yet. - * The @a flags and @a perms arguments are passed down to the open() - * method. - */ - ACE_UPIPE_Connector (ACE_UPIPE_Stream &new_stream, - const ACE_UPIPE_Addr &addr, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /** - * Actively connect and produce a @a new_stream if things go well. - * The @a addr is the address that we are trying to connect - * with. The @a timeout is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made . The - * @a local_sap is the value of local address to bind to. If it's - * the default value of ACE_Addr::sap_any then the user is letting - * the OS do the binding. If @a reuse_addr == 1 then the - * @a local_addr is reused, even if it hasn't been cleanedup yet. - * The @a flags and @a perms arguments are passed down to the open() - * method. - */ - int connect (ACE_UPIPE_Stream &new_stream, - const ACE_UPIPE_Addr &addr, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - // = Meta-type info - typedef ACE_UPIPE_Addr PEER_ADDR; - typedef ACE_UPIPE_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/UPIPE_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" - -#endif /* ACE_UPIPE_CONNECTOR_H */ diff --git a/ace/UPIPE_Connector.inl b/ace/UPIPE_Connector.inl deleted file mode 100644 index b45134f1067..00000000000 --- a/ace/UPIPE_Connector.inl +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Creates a Local ACE_UPIPE. -ACE_INLINE -ACE_UPIPE_Connector::ACE_UPIPE_Connector (ACE_UPIPE_Stream &new_stream, - const ACE_UPIPE_Addr &addr, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_UPIPE_Connector::ACE_UPIPE_Connector"); - if (this->connect (new_stream, addr, timeout, local_sap, - reuse_addr, flags, perms) == -1 - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("address %s, %p\n"), - addr.get_path_name (), - ACE_LIB_TEXT ("ACE_UPIPE_Connector"))); -} - -ACE_INLINE int -ACE_UPIPE_Connector::reset_new_handle (ACE_HANDLE /* handle */) -{ - // Nothing to do here since the handle is not a socket - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UPIPE_Stream.cpp b/ace/UPIPE_Stream.cpp deleted file mode 100644 index 53b170d23cd..00000000000 --- a/ace/UPIPE_Stream.cpp +++ /dev/null @@ -1,231 +0,0 @@ -// $Id$ - -#include "ace/UPIPE_Stream.h" - -ACE_RCSID(ace, UPIPE_Stream, "$Id$") - -#if defined (ACE_HAS_THREADS) - -#include "ace/OS_NS_string.h" - -#if !defined (__ACE_INLINE__) -#include "ace/UPIPE_Stream.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Stream) - -ACE_UPIPE_Stream::ACE_UPIPE_Stream (void) - : mb_last_ (0), - reference_count_ (0) -{ - ACE_TRACE ("ACE_UPIPE_Stream::ACE_UPIPE_STREAM"); -} - -ACE_UPIPE_Stream::~ACE_UPIPE_Stream (void) -{ - if (this->mb_last_ != 0) - { - this->mb_last_->release (); - this->mb_last_ = 0; - } -} - -int -ACE_UPIPE_Stream::control (int cmd, - void * val) const -{ - ACE_TRACE ("ACE_UPIPE_Stream::control"); - - return ((ACE_UPIPE_Stream *) this)->stream_.control - ((ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds) cmd, val); -} - -void -ACE_UPIPE_Stream::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_UPIPE_Stream::dump"); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_UPIPE_Stream::close (void) -{ - ACE_TRACE ("ACE_UPIPE_Stream::close"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - - this->reference_count_--; - - if (this->reference_count_ == 0) - { - // Since the UPIPE should have been closed earlier we won't bother - // checking to see if closing it now fails. - - if (this->ACE_SPIPE::get_handle () != ACE_INVALID_HANDLE) - this->ACE_SPIPE::close (); - - // Close down the ACE_stream. - return this->stream_.close (); - } - return 0; -} - -int -ACE_UPIPE_Stream::get_remote_addr (ACE_UPIPE_Addr &remote_sap) const -{ - ACE_TRACE ("ACE_UPIPE_Stream::get_remote_addr"); - remote_sap = this->remote_addr_; - return 0; -} - -int -ACE_UPIPE_Stream::send (ACE_Message_Block *mb_p, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_UPIPE_Stream::send_msg"); - return this->stream_.put (mb_p, timeout) == -1 ? -1 : 0; -} - -int ACE_UPIPE_Stream::recv (ACE_Message_Block *& mb_p, - ACE_Time_Value *timeout) -{ - return this->stream_.get (mb_p, timeout) == -1 ? -1 : 0; -} - -// Send a buffer. - -ssize_t -ACE_UPIPE_Stream::send (const char *buffer, - size_t n, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_UPIPE_Stream::send"); - - ACE_Message_Block *mb_p; - ACE_NEW_RETURN (mb_p, - ACE_Message_Block (n), - -1); - mb_p->copy (buffer, n); - return - this->stream_.put (mb_p, timeout) == -1 - ? -1 - : static_cast (n); -} - -// Receive a buffer. - -ssize_t -ACE_UPIPE_Stream::recv (char *buffer, - size_t n, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_UPIPE_Stream::recv"); - // Index in buffer. - size_t bytes_read = 0; - - while (bytes_read < n) - if (this->mb_last_ != 0) - { - // We have remaining data in our last read Message_Buffer. - size_t this_len = this->mb_last_->length (); - if (this_len < n) - { - // The remaining data is not enough. - - ACE_OS::memcpy ((void *) &buffer[bytes_read], - this->mb_last_->rd_ptr (), - this_len); - bytes_read += this_len; - this->mb_last_ = this->mb_last_->release (); // mb_last_ now 0 - return bytes_read; - } - else - { - // The remaining data is at least enough. If there's - // more, we'll get it the next time through. - ACE_OS::memcpy (&buffer[bytes_read], - this->mb_last_->rd_ptr (), - n); - bytes_read += n; - - // Advance rd_ptr. - this->mb_last_->rd_ptr (n); - - if (this->mb_last_->length () == 0) - // Now the Message_Buffer is empty. - this->mb_last_ = this->mb_last_->release (); - } - } - else - { - // We have to get a new Message_Buffer from our stream. - int result = this->stream_.get (this->mb_last_, timeout); - - if (result == -1) - { - if (errno == EWOULDBLOCK && bytes_read > 0) - // Return the number of bytes read before we timed out. - return bytes_read; - else - return -1; - } - } - - return bytes_read; -} - -ssize_t -ACE_UPIPE_Stream::send_n (const char *buf, - size_t n, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_UPIPE_Stream::send_n"); - - size_t bytes_written; - ssize_t len = 0; - - for (bytes_written = 0; - bytes_written < n; - bytes_written += len) - { - len = this->send (buf + bytes_written, - n - bytes_written, - timeout); - - if (len == -1) - return -1; - } - - return bytes_written; -} - -ssize_t -ACE_UPIPE_Stream::recv_n (char *buf, - size_t n, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_UPIPE_Stream::recv_n"); - size_t bytes_read; - ssize_t len = 0; - - for (bytes_read = 0; - bytes_read < n; - bytes_read += len) - { - len = this->recv (buf + bytes_read, - n - bytes_read, - timeout); - if (len == -1) - return -1; - else if (len == 0) - break; - } - - return bytes_read; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/ace/UPIPE_Stream.h b/ace/UPIPE_Stream.h deleted file mode 100644 index 98e31cf3349..00000000000 --- a/ace/UPIPE_Stream.h +++ /dev/null @@ -1,141 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file UPIPE_Stream.h - * - * $Id$ - * - * @author Gerhard Lenzer - * @author Douglas C. Schmidt - */ -//============================================================================= - - -#ifndef ACE_UPIPE_STREAM_H -#define ACE_UPIPE_STREAM_H -#include /**/ "ace/pre.h" - -#include "ace/Stream.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_THREADS) - -#include "ace/SPIPE.h" -#include "ace/Message_Queue.h" -#include "ace/UPIPE_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_UPIPE_Stream - * - * @brief Defines the method that transfer data on a UPIPE. - */ -class ACE_Export ACE_UPIPE_Stream : public ACE_SPIPE -{ -public: - friend class ACE_UPIPE_Acceptor; - friend class ACE_UPIPE_Connector; - - typedef ACE_Stream MT_Stream; - - // = Initialization and Termination. - - ACE_UPIPE_Stream (void); - - virtual ~ACE_UPIPE_Stream (void); - - /// Shut down the UPIPE and release resources. - int close (void); - - /// Return the underlying I/O handle. - ACE_HANDLE get_handle (void) const; - - // = Send/recv ACE Message_Blocks. - /// Send a message through the message queue. Returns -1 on error, - /// else 0. - int send (ACE_Message_Block *mb_p, - ACE_Time_Value *timeout = 0); - - /// Recv a message from the message queue. Returns -1 on error, else - /// 0. - int recv (ACE_Message_Block *&mb_p, - ACE_Time_Value *timeout = 0); - - // = Send/recv char buffers. - /// Send a buffer of @a n bytes through the message queue. Returns -1 - /// on error, else number of bytes sent. - ssize_t send (const char *buffer, - size_t n, - ACE_Time_Value *timeout = 0); - - /// Recv a buffer of upto @a n bytes from the message queue. Returns - /// -1 on error, else number of bytes read. - ssize_t recv (char *buffer, - size_t n, - ACE_Time_Value *timeout = 0); - - /// Send a buffer of exactly @a n bytes to the message queue. Returns - /// -1 on error, else number of bytes written (which should == n). - ssize_t send_n (const char *buffer, - size_t n, - ACE_Time_Value *timeout = 0); - - /// Recv a buffer of exactly bytes from the message queue. - /// Returns -1 on error, else the number of bytes read. - ssize_t recv_n (char *buffer, - size_t n, - ACE_Time_Value *timeout = 0); - - /// Perform control operations on the UPIPE_Stream. - int control (int cmd, void *val) const; - - /// Return the remote address we are connected to. - int get_remote_addr (ACE_UPIPE_Addr &remote_sap) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Meta-type info - typedef ACE_UPIPE_Addr PEER_ADDR; - -private: - /// To hold the last ACE_Message_Block read out of the stream. Thus - /// allowing subsequent reads from one ACE_Message_Block - ACE_Message_Block *mb_last_; - - /// Address of who we are connected to. - ACE_UPIPE_Addr remote_addr_; - - /// Stream component used by the @c UPIPE_Acceptor and - /// @c UPIPE_Connector to link together two UPIPE_Streams. - MT_Stream stream_; - - /// Keep track of whether the sender and receiver have both shut - /// down. - int reference_count_; - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - /// Ensure that we are thread-safe. - ACE_Thread_Mutex lock_; -#endif /* ACE_MT_SAFE */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/UPIPE_Stream.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" - -#endif /*ACE_UPIPE_STREAM_H */ diff --git a/ace/UPIPE_Stream.inl b/ace/UPIPE_Stream.inl deleted file mode 100644 index 3a33d287b0b..00000000000 --- a/ace/UPIPE_Stream.inl +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_HANDLE -ACE_UPIPE_Stream::get_handle (void) const -{ - ACE_TRACE ("ACE_UPIPE_Stream::get_handle"); - return this->ACE_SPIPE::get_handle (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UTF16_Encoding_Converter.cpp b/ace/UTF16_Encoding_Converter.cpp deleted file mode 100644 index d57ab9e5154..00000000000 --- a/ace/UTF16_Encoding_Converter.cpp +++ /dev/null @@ -1,364 +0,0 @@ -// $Id$ - -// ====================================================================== -// -// The actual conversion methods are covered by the copyright information -// below. It is not the actual code provided by Unicode, Inc. but is an -// ACE-ified and only slightly modified version. -// Chad Elliott 4/28/2005 -// -// Copyright 2001-2004 Unicode, Inc. -// -// Limitations on Rights to Redistribute This Code -// -// Unicode, Inc. hereby grants the right to freely use the information -// supplied in this file in the creation of products supporting the -// Unicode Standard, and to make copies of this file in any form -// for internal or external distribution as long as this notice -// remains attached. -// -// ====================================================================== - -#include "ace/UTF16_Encoding_Converter.h" - -#if defined (ACE_USES_WCHAR) -#include "ace/OS_NS_stdio.h" -#include "ace/OS_Memory.h" -#include "ace/Min_Max.h" - -#if !defined (__ACE_INLINE__) -#include "ace/UTF16_Encoding_Converter.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -static const ACE_UINT32 halfShift = 10; -static const ACE_UINT32 halfBase = 0x00010000; -static const ACE_UINT32 halfMask = 0x000003FF; - -static const ACE_UINT32 UNI_SUR_HIGH_START = 0x0000D800; -static const ACE_UINT32 UNI_SUR_HIGH_END = 0x0000DBFF; -static const ACE_UINT32 UNI_SUR_LOW_START = 0x0000DC00; -static const ACE_UINT32 UNI_SUR_LOW_END = 0x0000DFFF; -static const ACE_UINT32 UNI_REPLACEMENT_CHAR = 0x0000FFFD; -static const ACE_UINT32 UNI_MAX_BMP = 0x0000FFFF; -static const ACE_UINT32 UNI_MAX_UTF16 = 0x0010FFFF; - -// Once the bits are split out into bytes of UTF-8, this is a mask OR-ed -// into the first byte, depending on how many bytes follow. There are -// as many entries in this table as there are UTF-8 sequence types. -// (I.e., one byte sequence, two byte... etc.). Remember that sequencs -// for *legal* UTF-8 will be 4 or fewer bytes total. -static const ACE_Byte firstByteMark[7] = { 0x00, 0x00, 0xC0, - 0xE0, 0xF0, 0xF8, 0xFC }; - -// Index into the table below with the first byte of a UTF-8 sequence to -// get the number of trailing bytes that are supposed to follow it. -// Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is -// left as-is for anyone who may want to do such conversion, which was -// allowed in earlier algorithms. -static const ACE_Byte trailingBytesForUTF8[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 -}; - -// Magic values subtracted from a buffer value during UTF8 conversion. -// This table contains as many values as there might be trailing bytes -// in a UTF-8 sequence. -static const ACE_UINT32 offsetsFromUTF8[6] = { 0x00000000, 0x00003080, - 0x000E2080, 0x03C82080, - 0xFA082080, 0x82082080 }; - - -ACE_UTF16_Encoding_Converter::ACE_UTF16_Encoding_Converter (bool swap) - : swap_ (swap) -{ -} - -ACE_UTF16_Encoding_Converter::~ACE_UTF16_Encoding_Converter (void) -{ -} - -ACE_UTF16_Encoding_Converter::Result -ACE_UTF16_Encoding_Converter::to_utf8 (const void* source, - size_t source_size, - ACE_Byte* target, - size_t target_size, - bool strict) -{ - static const ACE_UINT32 byteMask = 0xBF; - static const ACE_UINT32 byteMark = 0x80; - Result result = CONVERSION_OK; - - ACE_Byte* targetEnd = target + target_size; - const ACE_UINT16* sourceStart = static_cast (source); - const ACE_UINT16* sourceEnd = sourceStart + - (source_size / sizeof (ACE_UINT16)); - - while (sourceStart < sourceEnd) - { - ACE_UINT16 nw = *sourceStart++; - ACE_UINT32 ch = (this->swap_ ? ACE_SWAP_WORD (nw) : nw); - - // If we have a surrogate pair, convert to ACE_UINT32 first. - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) - { - // If the 16 bits following the high surrogate are in the - // sourceStart buffer... - if (sourceStart < sourceEnd) - { - ACE_UINT32 ch2 = (this->swap_ ? ACE_SWAP_WORD (*sourceStart) : - *sourceStart); - // If it's a low surrogate, convert to ACE_UINT32. - if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) - { - ch = ((ch - UNI_SUR_HIGH_START) << halfShift) - + (ch2 - UNI_SUR_LOW_START) + halfBase; - ++sourceStart; - } - else if (strict) - { - // it's an unpaired high surrogate - result = SOURCE_ILLEGAL; - break; - } - } - else - { - // We don't have the 16 bits following the high surrogate. - result = SOURCE_EXHAUSTED; - break; - } - } - else if (strict) - { - // UTF-16 surrogate values are illegal in UTF-32 - if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) - { - result = SOURCE_ILLEGAL; - break; - } - } - - // Figure out how many bytes the result will require - unsigned short bytesToWrite = 0; - if (ch < 0x80) - bytesToWrite = 1; - else if (ch < 0x800) - bytesToWrite = 2; - else if (ch < 0x10000) - bytesToWrite = 3; - else if (ch < 0x110000) - bytesToWrite = 4; - else - { - bytesToWrite = 3; - ch = UNI_REPLACEMENT_CHAR; - } - - target += bytesToWrite; - if (target > targetEnd) - { - result = TARGET_EXHAUSTED; - break; - } - - // NOTE: Everything falls through for efficiency purposes. - switch (bytesToWrite) - { - case 4: - *--target = (ACE_Byte)((ch | byteMark) & byteMask); - ch >>= 6; - case 3: - *--target = (ACE_Byte)((ch | byteMark) & byteMask); - ch >>= 6; - case 2: - *--target = (ACE_Byte)((ch | byteMark) & byteMask); - ch >>= 6; - case 1: - *--target = (ACE_Byte)(ch | firstByteMark[bytesToWrite]); - } - target += bytesToWrite; - } - - return result; -} - -ACE_UTF16_Encoding_Converter::Result -ACE_UTF16_Encoding_Converter::from_utf8 (const ACE_Byte* source, - size_t source_size, - void* target, - size_t target_size, - bool strict) -{ - Result result = CONVERSION_OK; - const ACE_Byte* sourceEnd = source + source_size; - ACE_UINT16* targetStart = static_cast (target); - ACE_UINT16* targetEnd = targetStart + target_size; - - while (source < sourceEnd) - { - ACE_UINT32 ch = 0; - unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; - if (source + extraBytesToRead >= sourceEnd) - { - result = SOURCE_EXHAUSTED; - break; - } - - // Do this check whether lenient or strict - if (!this->is_legal_utf8 (source, extraBytesToRead + 1)) - { - result = SOURCE_ILLEGAL; - break; - } - - // The cases all fall through. See "Note A" below. - switch (extraBytesToRead) - { - case 5: // remember, illegal UTF-8 - ch += *source++; - ch <<= 6; - case 4: // remember, illegal UTF-8 - ch += *source++; - ch <<= 6; - case 3: - ch += *source++; - ch <<= 6; - case 2: - ch += *source++; - ch <<= 6; - case 1: - ch += *source++; - ch <<= 6; - case 0: - ch += *source++; - } - ch -= offsetsFromUTF8[extraBytesToRead]; - - if (targetStart >= targetEnd) - { - result = TARGET_EXHAUSTED; - break; - } - - if (ch <= UNI_MAX_BMP) // Target is a character <= 0xFFFF - { - // UTF-16 surrogate values are illegal in UTF-32 - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) - { - if (strict) - { - result = SOURCE_ILLEGAL; - break; - } - else - { - *targetStart++ = UNI_REPLACEMENT_CHAR; - } - } - else - { - *targetStart++ = (ACE_UINT16)ch; - } - } - else if (ch > UNI_MAX_UTF16) - { - if (strict) - { - result = SOURCE_ILLEGAL; - break; - } - else - { - *targetStart++ = UNI_REPLACEMENT_CHAR; - } - } - else - { - // targetStart is a character in range 0xFFFF - 0x10FFFF. - if (targetStart + 1 >= targetEnd) - { - result = TARGET_EXHAUSTED; - break; - } - ch -= halfBase; - *targetStart++ = (ACE_UINT16)((ch >> halfShift) + UNI_SUR_HIGH_START); - *targetStart++ = (ACE_UINT16)((ch & halfMask) + UNI_SUR_LOW_START); - } - } - - return result; -} - -ACE_UTF16_Encoding_Converter* -ACE_UTF16_Encoding_Converter::encoded (const ACE_Byte* source, - size_t source_size) -{ - static const size_t begin = 16; - static const size_t converted = begin * 4; - - ACE_Byte target[converted]; - ACE_UTF16_Encoding_Converter* converter; - ACE_NEW_RETURN (converter, - ACE_UTF16_Encoding_Converter (false), - 0); - if (converter->to_utf8 (source, - ACE_MIN (begin, source_size), - target, - converted) == CONVERSION_OK) - { - return converter; - } - else - { - delete converter; - } - - return 0; -} - -ACE_UINT32 -ACE_UTF16_Encoding_Converter::get_UNI_SUR_HIGH_START (void) -{ - return UNI_SUR_HIGH_START; -} - -ACE_UINT32 -ACE_UTF16_Encoding_Converter::get_UNI_SUR_LOW_END (void) -{ - return UNI_SUR_LOW_END; -} - -ACE_UINT32 -ACE_UTF16_Encoding_Converter::get_UNI_REPLACEMENT_CHAR (void) -{ - return UNI_REPLACEMENT_CHAR; -} - -const ACE_Byte* -ACE_UTF16_Encoding_Converter::get_first_byte_mark (void) -{ - return firstByteMark; -} - -const ACE_Byte* -ACE_UTF16_Encoding_Converter::get_trailing_bytes_for_utf8 (void) -{ - return trailingBytesForUTF8; -} - -const ACE_UINT32* -ACE_UTF16_Encoding_Converter::get_offsets_from_utf8 (void) -{ - return offsetsFromUTF8; -} - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ diff --git a/ace/UTF16_Encoding_Converter.h b/ace/UTF16_Encoding_Converter.h deleted file mode 100644 index 82d8255b286..00000000000 --- a/ace/UTF16_Encoding_Converter.h +++ /dev/null @@ -1,86 +0,0 @@ -// -*- C++ -*- - -//========================================================================= -/** - * @file UTF16_Encoding_Converter.h - * - * $Id$ - * - * This class contains declarations for methods that convert between - * UTF-16 (both BE and LE) and UTF-8 - * - * @author Chad Elliott - */ -//========================================================================= - -#ifndef ACE_UTF16_ENCODING_CONVERTER_H -#define ACE_UTF16_ENCODING_CONVERTER_H - -#include /**/ "ace/pre.h" - -#include "ace/Encoding_Converter.h" - -#if defined (ACE_USES_WCHAR) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** Convert from UTF-16 to UTF-8 and from UTF-8 to UTF-16. - * This class implements the ACE_Encoding_Converter interface. - */ -class ACE_UTF16_Encoding_Converter: public ACE_Encoding_Converter -{ -public: - /// The swap parameter determines whether we need to swap byte order on - /// the stream as each word is pulled off when converting to UTF-8. - ACE_UTF16_Encoding_Converter (bool swap = false); - - /// This is a do nothing destructor. - virtual ~ACE_UTF16_Encoding_Converter (void); - - /// Convert the source from UTF-16 to UTF-8 and store it in the - /// provided target buffer. - virtual Result to_utf8 (const void* source, - size_t source_size, - ACE_Byte* target, - size_t target_size, - bool strict = true); - - /// Convert the UTF-8 source into a UTF-16 encoding and store it - /// in the provided target buffer. - virtual Result from_utf8 (const ACE_Byte* source, - size_t source_size, - void* target, - size_t target_size, - bool strict = true); - - /// This factory helper method determines if the source stream is UTF-16 - /// encoded. If it is, allocate an ACE_UTF16_Encoding_Converter and - /// return it. The caller then owns the allocated object. - static ACE_UTF16_Encoding_Converter* encoded (const ACE_Byte* source, - size_t source_size); - -protected: - /// Determines if the source buffer is legal UTF-8 - bool is_legal_utf8 (const ACE_Byte* source, - size_t length) const; - - static ACE_UINT32 get_UNI_SUR_HIGH_START (void); - static ACE_UINT32 get_UNI_SUR_LOW_END (void); - static ACE_UINT32 get_UNI_REPLACEMENT_CHAR (void); - static const ACE_Byte* get_first_byte_mark (void); - static const ACE_Byte* get_trailing_bytes_for_utf8 (void); - static const ACE_UINT32* get_offsets_from_utf8 (void); - - bool swap_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/UTF16_Encoding_Converter.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_USES_WCHAR */ - -#include /**/ "ace/post.h" - -#endif /* ACE_UTF16_ENCODING_CONVERTER_H */ diff --git a/ace/UTF16_Encoding_Converter.inl b/ace/UTF16_Encoding_Converter.inl deleted file mode 100644 index 1c716092092..00000000000 --- a/ace/UTF16_Encoding_Converter.inl +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ====================================================================== -// -// The actual conversion methods are covered by the copyright information -// below. -// Chad Elliott 4/28/2005 -// -// Copyright 2001-2004 Unicode, Inc. -// -// Limitations on Rights to Redistribute This Code -// -// Unicode, Inc. hereby grants the right to freely use the information -// supplied in this file in the creation of products supporting the -// Unicode Standard, and to make copies of this file in any form -// for internal or external distribution as long as this notice -// remains attached. -// -// ====================================================================== - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE bool -ACE_UTF16_Encoding_Converter::is_legal_utf8 (const ACE_Byte* source, - size_t length) const -{ - ACE_Byte a; - const ACE_Byte* srcptr = source + length; - - switch (length) - { - default: - return false; - - // Everything else falls through when "true"... - case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; - case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; - case 2: if ((a = (*--srcptr)) > 0xBF) return false; - - switch (*source) - { - // no fall-through in this inner switch - case 0xE0: - if (a < 0xA0) - return false; - break; - case 0xED: - if (a > 0x9F) - return false; - break; - case 0xF0: - if (a < 0x90) - return false; - break; - case 0xF4: - if (a > 0x8F) - return false; - break; - default: - if (a < 0x80) - return false; - } - - case 1: - if (*source >= 0x80 && *source < 0xC2) - return false; - } - - if (*source > 0xF4) - return false; - - return true; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UTF32_Encoding_Converter.cpp b/ace/UTF32_Encoding_Converter.cpp deleted file mode 100644 index 2280232e58a..00000000000 --- a/ace/UTF32_Encoding_Converter.cpp +++ /dev/null @@ -1,254 +0,0 @@ -// $Id$ - -// ====================================================================== -// -// The actual conversion methods are covered by the copyright information -// below. It is not the actual code provided by Unicode, Inc. but is an -// ACE-ified and only slightly modified version. -// -// Chad Elliott 4/28/2005 -// -// Copyright 2001-2004 Unicode, Inc. -// -// Limitations on Rights to Redistribute This Code -// -// Unicode, Inc. hereby grants the right to freely use the information -// supplied in this file in the creation of products supporting the -// Unicode Standard, and to make copies of this file in any form -// for internal or external distribution as long as this notice -// remains attached. -// -// ====================================================================== - -#include "ace/UTF32_Encoding_Converter.h" - -#if defined (ACE_USES_WCHAR) -#include "ace/OS_NS_stdio.h" -#include "ace/OS_Memory.h" -#include "ace/Min_Max.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -static const ACE_UINT32 UNI_MAX_LEGAL_UTF32 = 0x0010FFFF; - -ACE_UTF32_Encoding_Converter::ACE_UTF32_Encoding_Converter (bool swap) - : ACE_UTF16_Encoding_Converter (swap) -{ -} - -ACE_UTF32_Encoding_Converter::~ACE_UTF32_Encoding_Converter (void) -{ -} - -ACE_UTF32_Encoding_Converter::Result -ACE_UTF32_Encoding_Converter::to_utf8 (const void* source, - size_t source_size, - ACE_Byte* target, - size_t target_size, - bool strict) -{ - static const ACE_UINT32 byteMask = 0xBF; - static const ACE_UINT32 byteMark = 0x80; - static const ACE_UINT32 UNI_SUR_HIGH_START = get_UNI_SUR_HIGH_START (); - static const ACE_UINT32 UNI_SUR_LOW_END = get_UNI_SUR_LOW_END (); - static const ACE_Byte* firstByteMark = get_first_byte_mark (); - - Result result = CONVERSION_OK; - ACE_Byte* targetEnd = target + target_size; - const ACE_UINT32* sourceStart = static_cast (source); - const ACE_UINT32* sourceEnd = sourceStart + (source_size / sizeof (ACE_UINT32)); - - while (sourceStart < sourceEnd) - { - ACE_UINT32 nw = *sourceStart++; - ACE_UINT32 ch = (this->swap_ ? ACE_SWAP_LONG (nw) : nw); - unsigned short bytesToWrite = 0; - - if (strict) - { - // UTF-16 surrogate values are illegal in UTF-32 - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) - { - result = SOURCE_ILLEGAL; - break; - } - } - - // Figure out how many bytes the result will require. Turn any - // illegally large ACE_UINT32 things (> Plane 17) into replacement - // chars. - if (ch < 0x80) - { - bytesToWrite = 1; - } - else if (ch < 0x800) - { - bytesToWrite = 2; - } - else if (ch < 0x10000) - { - bytesToWrite = 3; - } - else if (ch <= UNI_MAX_LEGAL_UTF32) - { - bytesToWrite = 4; - } - else - { - result = SOURCE_ILLEGAL; - break; - } - - target += bytesToWrite; - if (target > targetEnd) - { - result = TARGET_EXHAUSTED; - break; - } - - // NOTE: everything falls through. - switch (bytesToWrite) - { - case 4: - *--target = (ACE_Byte)((ch | byteMark) & byteMask); - ch >>= 6; - case 3: - *--target = (ACE_Byte)((ch | byteMark) & byteMask); - ch >>= 6; - case 2: - *--target = (ACE_Byte)((ch | byteMark) & byteMask); - ch >>= 6; - case 1: - *--target = (ACE_Byte) (ch | firstByteMark[bytesToWrite]); - } - target += bytesToWrite; - } - - return result; -} - -ACE_UTF32_Encoding_Converter::Result -ACE_UTF32_Encoding_Converter::from_utf8 (const ACE_Byte* source, - size_t source_size, - void* target, - size_t target_size, - bool strict) -{ - static const ACE_UINT32 UNI_SUR_HIGH_START = get_UNI_SUR_HIGH_START (); - static const ACE_UINT32 UNI_SUR_LOW_END = get_UNI_SUR_LOW_END (); - static const ACE_UINT32 UNI_REPLACEMENT_CHAR = get_UNI_REPLACEMENT_CHAR (); - static const ACE_Byte* trailingBytesForUTF8 = get_trailing_bytes_for_utf8 (); - static const ACE_UINT32* offsetsFromUTF8 = get_offsets_from_utf8 (); - - Result result = CONVERSION_OK; - const ACE_Byte* sourceEnd = source + source_size; - ACE_UINT32* targetStart = static_cast (target); - ACE_UINT32* targetEnd = targetStart + target_size; - - while (source < sourceEnd) - { - ACE_UINT32 ch = 0; - unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; - if (source + extraBytesToRead >= sourceEnd) - { - result = SOURCE_EXHAUSTED; - break; - } - - // Do this check whether lenient or strict - if (!this->is_legal_utf8 (source, extraBytesToRead + 1)) - { - result = SOURCE_ILLEGAL; - break; - } - - // The cases all fall through. See "Note A" below. - switch (extraBytesToRead) - { - case 5: - ch += *source++; - ch <<= 6; - case 4: - ch += *source++; - ch <<= 6; - case 3: - ch += *source++; - ch <<= 6; - case 2: - ch += *source++; - ch <<= 6; - case 1: - ch += *source++; - ch <<= 6; - case 0: - ch += *source++; - } - ch -= offsetsFromUTF8[extraBytesToRead]; - - if (targetStart >= targetEnd) - { - result = TARGET_EXHAUSTED; - break; - } - - if (ch <= UNI_MAX_LEGAL_UTF32) - { - // UTF-16 surrogate values are illegal in UTF-32, and anything - // over Plane 17 (> 0x10FFFF) is illegal. - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) - { - if (strict) - { - result = SOURCE_ILLEGAL; - break; - } - else - { - *targetStart++ = UNI_REPLACEMENT_CHAR; - } - } - else - { - *targetStart++ = ch; - } - } - else - { - result = SOURCE_ILLEGAL; - break; - } - } - - return result; -} - -ACE_UTF32_Encoding_Converter* -ACE_UTF32_Encoding_Converter::encoded (const ACE_Byte* source, - size_t source_size) -{ - static const size_t begin = 16; - static const size_t converted = begin * 4; - - ACE_Byte target[converted]; - ACE_UTF32_Encoding_Converter* converter = 0; - ACE_NEW_RETURN (converter, - ACE_UTF32_Encoding_Converter (false), - 0); - - if (converter->to_utf8 (source, - ACE_MIN (begin, source_size), - target, - converted) == CONVERSION_OK) - { - return converter; - } - else - { - delete converter; - } - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ diff --git a/ace/UTF32_Encoding_Converter.h b/ace/UTF32_Encoding_Converter.h deleted file mode 100644 index 3777d2eff0a..00000000000 --- a/ace/UTF32_Encoding_Converter.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- - -//========================================================================= -/** - * @file UTF32_Encoding_Converter.h - * - * $Id$ - * - * This class contains declarations for methods that convert between - * UTF-32 (both BE and LE) and UTF-8 - * - * @author Chad Elliott - */ -//========================================================================= - -#ifndef ACE_UTF32_ENCODING_CONVERTER_H -#define ACE_UTF32_ENCODING_CONVERTER_H - -#include /**/ "ace/pre.h" - -#include "ace/UTF16_Encoding_Converter.h" - -#if defined (ACE_USES_WCHAR) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** Convert from UTF-32 to UTF-8 and from UTF-8 to UTF-32. - * This class implements the ACE_Encoding_Converter interface. - */ -class ACE_UTF32_Encoding_Converter: public ACE_UTF16_Encoding_Converter -{ -public: - /// This class has some similarities to the UTF16 converter, so - /// we just construct our base class and pass the swap parameter. - ACE_UTF32_Encoding_Converter (bool swap = false); - - /// This is a do nothing destructor. - virtual ~ACE_UTF32_Encoding_Converter (void); - - /// Convert the source from UTF-32 to UTF-8 and store it in the - /// provided target buffer. - virtual Result to_utf8 (const void* source, - size_t source_size, - ACE_Byte* target, - size_t target_size, - bool strict = true); - - /// Convert the UTF-8 source into a UTF-32 encoding and store it - /// in the provided target buffer. - virtual Result from_utf8 (const ACE_Byte* source, - size_t source_size, - void* target, - size_t target_size, - bool strict = true); - - /// This factory helper method determines if the source stream is UTF-32 - /// encoded. If it is, allocate an ACE_UTF32_Encoding_Converter and - /// return it. The caller then owns the allocated object. - static ACE_UTF32_Encoding_Converter* encoded (const ACE_Byte* source, - size_t source_size); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ - -#include /**/ "ace/post.h" - -#endif /* ACE_UTF32_ENCODING_CONVERTER_H */ diff --git a/ace/UTF8_Encoding_Converter.cpp b/ace/UTF8_Encoding_Converter.cpp deleted file mode 100644 index 0a6ee6e54f5..00000000000 --- a/ace/UTF8_Encoding_Converter.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// $Id$ - -#include "ace/UTF8_Encoding_Converter.h" - -#if defined (ACE_USES_WCHAR) -#include "ace/UTF16_Encoding_Converter.h" -#include "ace/UTF32_Encoding_Converter.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_Memory.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_UTF8_Encoding_Converter::ACE_UTF8_Encoding_Converter (void) - : native_ (0) -{ - // Choose a converter for the ASCII or UTF-8 string to a wide character - // string which we will use in from_utf8. We have to make an - // assumption here about the encoding based on the size of ACE_TCHAR. - switch (sizeof (ACE_TCHAR)) - { - case 4: - ACE_NEW(this->native_, ACE_UTF32_Encoding_Converter); - break; - case 2: - ACE_NEW(this->native_, ACE_UTF16_Encoding_Converter); - break; - } -} - -ACE_UTF8_Encoding_Converter::~ACE_UTF8_Encoding_Converter (void) -{ - delete native_; -} - -ACE_UTF8_Encoding_Converter::Result -ACE_UTF8_Encoding_Converter::to_utf8 (const void* source, - size_t source_size, - ACE_Byte* target, - size_t target_size, - bool /*strict*/) -{ - if (target_size >= source_size) - { - ACE_OS::memcpy (target, source, source_size); - return CONVERSION_OK; - } - - return TARGET_EXHAUSTED; -} - -ACE_UTF8_Encoding_Converter::Result -ACE_UTF8_Encoding_Converter::from_utf8 (const ACE_Byte* source, - size_t source_size, - void* target, - size_t target_size, - bool strict) -{ - if (this->native_ != 0) - { - return this->native_->from_utf8(source, source_size, - target, target_size, strict); - } - - ACE_TCHAR* targetStart = static_cast (target); - ACE_OS::strncpy (targetStart, - ACE_TEXT_CHAR_TO_TCHAR ( - reinterpret_cast (source)), - source_size); - targetStart[source_size] = 0; - return CONVERSION_OK; -} - -ACE_UTF8_Encoding_Converter* -ACE_UTF8_Encoding_Converter::encoded (const ACE_Byte* source, - size_t source_size) -{ - for(size_t i = 0; i < source_size; i++) - { - if (source[i] < 0x01 || source[i] > 0x7f) - return 0; - } - - // All characters are "valid" ASCII - ACE_UTF8_Encoding_Converter* converter = 0; - ACE_NEW_RETURN (converter, - ACE_UTF8_Encoding_Converter, - 0); - return converter; -} - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ diff --git a/ace/UTF8_Encoding_Converter.h b/ace/UTF8_Encoding_Converter.h deleted file mode 100644 index 4ef6fb7fad3..00000000000 --- a/ace/UTF8_Encoding_Converter.h +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- - -//========================================================================= -/** - * @file UTF8_Encoding_Converter.h - * - * $Id$ - * - * This class contains declarations for methods that convert between - * UTF-8 and the native ACE_TCHAR representation. - * - * @author Chad Elliott - */ -//========================================================================= - -#ifndef ACE_UTF8_ENCODING_CONVERTER_H -#define ACE_UTF8_ENCODING_CONVERTER_H - -#include /**/ "ace/pre.h" - -#include "ace/Encoding_Converter.h" - -#if defined (ACE_USES_WCHAR) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** Convert from UTF-16 or UTF-32 to UTF-8. - * This class implements the ACE_Encoding_Converter interface. - */ -class ACE_UTF8_Encoding_Converter: public ACE_Encoding_Converter -{ -public: - /// Allocate the converter to be used by the from_utf8() method based - /// on the size of the native wide character. - ACE_UTF8_Encoding_Converter (void); - - /// De-allocate the native converter. - virtual ~ACE_UTF8_Encoding_Converter (void); - - /// Since the source *must be* UTF-8, there is no conversion required. - /// This method just copies the source to the target given that there - /// is enough space. - virtual Result to_utf8 (const void* source, - size_t source_size, - ACE_Byte* target, - size_t target_size, - bool strict = true); - - /// Utilize the native converter to convert the UTF-8 source into an - /// alternate encoding and store it in the provided target buffer. - virtual Result from_utf8 (const ACE_Byte* source, - size_t source_size, - void* target, - size_t target_size, - bool strict = true); - - - /// This factory helper method determines if the source stream is UTF-8 - /// encoded. If it is, allocate an ACE_UTF8_Encoding_Converter and - /// return it. The caller then owns the allocated object. - static ACE_UTF8_Encoding_Converter* encoded (const ACE_Byte* source, - size_t source_size); - -private: - ACE_Encoding_Converter* native_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ - -#include /**/ "ace/post.h" - -#endif /* ACE_UTF8_ENCODING_CONVERTER_H */ diff --git a/ace/UUID.cpp b/ace/UUID.cpp deleted file mode 100644 index 1a4d0386d40..00000000000 --- a/ace/UUID.cpp +++ /dev/null @@ -1,481 +0,0 @@ -//$Id$ - -#include "ace/UUID.h" -#include "ace/Guard_T.h" - -#if !defined (__ACE_INLINE__) -#include "ace/UUID.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_sys_time.h" -#include "ace/OS_NS_netdb.h" -#include "ace/OS_NS_unistd.h" -#include "ace/ACE.h" - -ACE_RCSID (ace, - UUID, - "$Id$") - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE_Utils -{ - - UUID_node::UUID_node (void) - { - for (int i = 0; i < UUID_node::NODE_ID_SIZE; ++i) - { - nodeID_[i] = 0; - } - } - - UUID_node::NodeID& - UUID_node::nodeID (void) - { - return nodeID_; - } - - void - UUID_node::nodeID (NodeID& nodeID) - { - for (int i = 0; i < UUID_node::NODE_ID_SIZE; ++i) - { - nodeID_[i] = nodeID[i]; - } - } - - UUID UUID::NIL_UUID; - - /// Construct a nil UUID. Such a UUID has every one of it's data - /// elements set to zero. - UUID::UUID(void) - : timeLow_ (0), - timeMid_ (0), - timeHiAndVersion_ (0), - clockSeqHiAndReserved_ (0), - clockSeqLow_ (0), - as_string_ (0) - { - ACE_NEW (node_, - UUID_node); - - node_release_ = 1; - } - - /// Construct a UUID from a string representation of an UUID. - UUID::UUID (const ACE_CString& uuid_string) - : timeLow_ (0), - timeMid_ (0), - timeHiAndVersion_ (0), - clockSeqHiAndReserved_ (0), - clockSeqLow_ (0), - as_string_ (0) - { - ACE_NEW (node_, - UUID_node); - - node_release_ = 1; - - - if (uuid_string.length() < NIL_UUID.to_string ()->length ()) - { - ACE_DEBUG ((LM_DEBUG, - "%N ACE_UUID::UUID - " - "IllegalArgument(incorrect string length)\n")); - return; - } - - /// Special case for the nil UUID. - if (uuid_string == *NIL_UUID.to_string ()) - { - bool copy_constructor_not_supported = false; - ACE_ASSERT (copy_constructor_not_supported); - //*this = NIL_UUID; - ACE_UNUSED_ARG (copy_constructor_not_supported); - return; - } - - unsigned int timeLow; - unsigned int timeMid; - unsigned int timeHiAndVersion; - unsigned int clockSeqHiAndReserved; - unsigned int clockSeqLow; - unsigned int node [UUID_node::NODE_ID_SIZE]; - char thr_pid_buf [BUFSIZ]; - - if (uuid_string.length() == NIL_UUID.to_string()->length()) - { - // This might seem quite strange this being in ACE, but it - // seems to be a bit difficult to write a facade for ::sscanf - // because some compilers dont support vsscanf, including - // MSVC. It appears that most platforms support sscanf though - // so we need to use it directly. - const int nScanned = - ::sscanf(uuid_string.c_str(), - "%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x", - &timeLow, - &timeMid, - &timeHiAndVersion, - &clockSeqHiAndReserved, - &clockSeqLow, - &node[0], - &node[1], - &node[2], - &node[3], - &node[4], - &node[5] - ); - - if (nScanned != 11) - { - ACE_DEBUG ((LM_DEBUG, - "UUID::UUID - " - "IllegalArgument(invalid string representation)\n")); - return; - } - } - else - { - const int nScanned = - ::sscanf (uuid_string.c_str(), - "%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x-%s", - &timeLow, - &timeMid, - &timeHiAndVersion, - &clockSeqHiAndReserved, - &clockSeqLow, - &node[0], - &node[1], - &node[2], - &node[3], - &node[4], - &node[5], - thr_pid_buf - ); - - if (nScanned != 12) - { - ACE_DEBUG ((LM_DEBUG, - "ACE_UUID::ACE_UUID - " - "IllegalArgument(invalid string representation)\n")); - return; - } - } - - this->timeLow_ = static_cast (timeLow); - this->timeMid_ = static_cast (timeMid); - this->timeHiAndVersion_ = static_cast (timeHiAndVersion); - this->clockSeqHiAndReserved_ = static_cast (clockSeqHiAndReserved); - this->clockSeqLow_ = static_cast (clockSeqLow); - - UUID_node::NodeID nodeID; - for (int i = 0; i < UUID_node::NODE_ID_SIZE; ++i) - nodeID [i] = static_cast (node[i]); - - this->node_->nodeID (nodeID); - - // Support varient 10- only - if ((this->clockSeqHiAndReserved_ & 0xc0) != 0x80 && (this->clockSeqHiAndReserved_ & 0xc0) != 0xc0) - { - ACE_DEBUG ((LM_DEBUG, - "ACE_UUID_Impl::ACE_UUID_Impl - " - "IllegalArgument(unsupported variant)\n")); - return; - } - - /// Support versions 1, 3, and 4 only - ACE_UINT16 V1 = this->timeHiAndVersion_; - - if ((V1 & 0xF000) != 0x1000 && - (V1 & 0xF000) != 0x3000 && - (V1 & 0xF000) != 0x4000) - { - ACE_DEBUG ((LM_DEBUG, - "ACE_UUID::ACE_UUID - " - "IllegalArgument(unsupported version)\n")); - return; - } - if ((this->clockSeqHiAndReserved_ & 0xc0) == 0xc0) - { - if (uuid_string.length() == NIL_UUID.to_string()->length()) - { - ACE_DEBUG ((LM_DEBUG, - "ACE_UUID::ACE_UUID - " - "IllegalArgument (Missing Thread and Process Id)\n")); - return; - } - ACE_CString thr_pid_str (thr_pid_buf); - ssize_t pos = thr_pid_str.find ('-'); - if (pos == -1) - ACE_DEBUG ((LM_DEBUG, - "ACE_UUID::ACE_UUID - " - "IllegalArgument (Thread and Process Id format incorrect)\n")); - - this->thr_id_ = thr_pid_str.substr (0, pos); - this->pid_ = thr_pid_str.substr (pos+1, thr_pid_str.length ()-pos-1); - } - } - - UUID::~UUID (void) - { - if (node_release_) - delete node_; - - if (as_string_ != 0) - delete as_string_; - } - - const ACE_CString* - UUID::to_string (void) - { - /// Only compute the string representation once. - if (as_string_ == 0) - { - // Get a buffer exactly the correct size. Use the nil UUID as a - // gauge. Don't forget the trailing nul. - size_t UUID_STRING_LENGTH = 36 + thr_id_.length () + pid_.length (); - char *buf; - - if ((thr_id_.length () != 0) && (pid_.length () != 0)) - { - UUID_STRING_LENGTH += 2; //for '-' - ACE_NEW_RETURN (buf, - char[UUID_STRING_LENGTH + 1], - 0); - - ACE_OS::sprintf(buf, - "%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x-%s-%s", - this->timeLow_, - this->timeMid_, - this->timeHiAndVersion_, - this->clockSeqHiAndReserved_, - this->clockSeqLow_, - (this->node_->nodeID ()) [0], - (this->node_->nodeID ()) [1], - (this->node_->nodeID ()) [2], - (this->node_->nodeID ()) [3], - (this->node_->nodeID ()) [4], - (this->node_->nodeID ()) [5], - thr_id_.c_str (), - pid_.c_str () - ); - } - else - { - ACE_NEW_RETURN (buf, - char[UUID_STRING_LENGTH + 1], - 0); - - ACE_OS::sprintf (buf, - "%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", - this->timeLow_, - this->timeMid_, - this->timeHiAndVersion_, - this->clockSeqHiAndReserved_, - this->clockSeqLow_, - (this->node_->nodeID ()) [0], - (this->node_->nodeID ()) [1], - (this->node_->nodeID ()) [2], - (this->node_->nodeID ()) [3], - (this->node_->nodeID ()) [4], - (this->node_->nodeID ()) [5] - ); - } - - ACE_NEW_RETURN (this->as_string_, - ACE_CString (buf, UUID_STRING_LENGTH), - 0); - delete [] buf; - } - - return as_string_; - } - - UUID_Generator::UUID_Generator () - : timeLast_ (0) - { - ACE_NEW (lock_, - ACE_SYNCH_MUTEX); - destroy_lock_ = 1; - } - - UUID_Generator::~UUID_Generator() - { - if (destroy_lock_) - delete lock_; - } - - void - UUID_Generator::init (void) - { - ACE_OS::macaddr_node_t macaddress; - int result = - ACE_OS::getmacaddress (&macaddress); - - UUID_node::NodeID nodeID; - if (result != -1) - { -// ACE_DEBUG ((LM_DEBUG, -// "%02X-%02X-%02X-%02X-%02X-%02X\n", -// macaddress.node [0], -// macaddress.node [1], -// macaddress.node [2], -// macaddress.node [3], -// macaddress.node [4], -// macaddress.node [5])); - - ACE_OS::memcpy (&nodeID, - macaddress.node, - sizeof (nodeID)); - } - else - { - nodeID [0] = static_cast (ACE_OS::rand()); - nodeID [1] = static_cast (ACE_OS::rand()); - nodeID [2] = static_cast (ACE_OS::rand()); - nodeID [3] = static_cast (ACE_OS::rand()); - nodeID [4] = static_cast (ACE_OS::rand()); - nodeID [5] = static_cast (ACE_OS::rand()); - } - - this->get_timestamp (timeLast_); - - { - ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, *lock_); - uuid_state_.timestamp = timeLast_; - uuid_state_.node.nodeID (nodeID); - } - } - - - void - UUID_Generator::generateUUID (UUID& uuid,ACE_UINT16 version, u_char variant) - { - UUID_time timestamp; - this->get_timestamp (timestamp); - - - // Construct a Version 1 UUID with the information in the arguements. - uuid.timeLow (static_cast (timestamp & 0xFFFFFFFF)); - uuid.timeMid (static_cast ((timestamp >> 32) & 0xFFFF)); - - - ACE_UINT16 tHAV = static_cast ((timestamp >> 48) & 0xFFFF); - tHAV |= (version << 12); - uuid.timeHiAndVersion (tHAV); - - u_char cseqHAV; - { - ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_); - uuid.clockSeqLow (static_cast (uuid_state_.clockSequence & 0xFF)); - cseqHAV = static_cast ((uuid_state_.clockSequence & 0x3f00) >> 8); - uuid_state_.timestamp = timestamp; - } - - cseqHAV |= variant; - uuid.clockSeqHiAndReserved (cseqHAV); - uuid.node (&(uuid_state_.node)); - - if (variant == 0xc0) - { - ACE_Thread_ID thread_id; - char buf [BUFSIZ]; - thread_id.to_string (buf); - uuid.thr_id (buf); - - ACE_OS::sprintf (buf, - "%d", - static_cast (ACE_OS::getpid ())); - uuid.pid (buf); - } - } - - UUID* - UUID_Generator::generateUUID (ACE_UINT16 version, u_char variant) - { - UUID* uuid; - ACE_NEW_RETURN (uuid, - UUID, - 0); - - this->generateUUID (*uuid, version, variant); - return uuid; - } - - /// Obtain a new timestamp. If UUID's are being generated too quickly - /// the clock sequence will be incremented - void - UUID_Generator::get_timestamp (UUID_time& timestamp) - { - ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_); - - this->get_systemtime(timestamp); - - // Account for the clock being set back. Increment the clock / - // sequence. - if (timestamp <= timeLast_) - uuid_state_.clockSequence = static_cast ((uuid_state_.clockSequence + 1) & ACE_UUID_CLOCK_SEQ_MASK); - - // If the system time ticked since the last UUID was - // generated. Set / the clock sequence back. - else if (timestamp > timeLast_) - uuid_state_.clockSequence = 0; - - timeLast_ = timestamp; - } - - /** - * ACE_Time_Value is in POSIX time, seconds since Jan 1, 1970. UUIDs use - * time in 100ns ticks since 15 October 1582. The difference is: - * 15 Oct 1582 - 1 Jan 1600: 17 days in Oct, 30 in Nov, 31 in Dec + - * 17 years and 4 leap days (1584, 88, 92 and 96) - * 1 Jan 1600 - 1 Jan 1900: 3 centuries + 73 leap days ( 25 in 17th cent. - * and 24 each in 18th and 19th centuries) - * 1 Jan 1900 - 1 Jan 1970: 70 years + 17 leap days. - * This adds up, in days: (17+30+31+365*17+4)+(365*300+73)+(365*70+17) or - * 122192928000000000U (0x1B21DD213814000) 100 ns ticks. - */ - void - UUID_Generator::get_systemtime (UUID_time & timestamp) - { - const UUID_time timeOffset = ACE_UINT64_LITERAL (0x1B21DD213814000); - - /// Get the time of day, convert to 100ns ticks then add the offset. - ACE_Time_Value now = ACE_OS::gettimeofday(); - ACE_UINT64 time; - now.to_usec (time); - time = time * 10; - timestamp = time + timeOffset; -} - - ACE_SYNCH_MUTEX* - UUID_Generator::lock (void) - { - return this->lock_; - } - - ACE_SYNCH_MUTEX* - UUID_Generator::lock (ACE_SYNCH_MUTEX* lock, - int release_lock_) - { - if (destroy_lock_) - delete lock_; - - ACE_SYNCH_MUTEX* prev_lock = this->lock_; - this->lock_ = lock; - this->destroy_lock_ = release_lock_; - return prev_lock; - } - -} - -#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) -template ACE_Singleton * - ACE_Singleton::singleton_; -#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UUID.h b/ace/UUID.h deleted file mode 100644 index 9a1a9cce956..00000000000 --- a/ace/UUID.h +++ /dev/null @@ -1,232 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file UUID.h - * - * $Id$ - * - * @author Andrew T. Finnel - * @author Yamuna Krishnmaurthy - */ -//============================================================================= - -#ifndef ACE_UUID_H -#define ACE_UUID_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SString.h" -#include "ace/Singleton.h" -#include "ace/Synch_Traits.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE_Utils -{ - /// Class to hold a MAC address - class ACE_Export UUID_node - { - public: - - /// Constructor - UUID_node (void); - - enum {NODE_ID_SIZE = 6}; - typedef u_char NodeID[NODE_ID_SIZE]; - - NodeID& nodeID (void); - void nodeID (NodeID&); - - ///// Equality Operations - //bool operator == (const UUID_node& right) const; - //bool operator != (const UUID_node& right) const; - - ///// Relational Operations - //bool operator < (const UUID_node& right) const; - - private: - NodeID nodeID_; - }; - - - - /** - * @class ACE_UUID - * - * ACE_UUID represents a Universally Unique IDentifier (UUID) as - * described in (the expired) INTERNET-DRAFT specification entitled - * UUIDs and GUIDs. All instances of UUID are of the time-based - * variety. That is, the version number part of the timeHiAndVersion - * field is 1. - * - * The default constructor creates a nil UUID. - * - * UUIDs have value semantics. In addition, they may be compared for - * ordering and equality. - * - * Additionally in this implementation provisions have been made to include - * process and thread ids to make the UUIDs more unique. The variant 0xc0 - * has been added to facilitate this. - */ - class ACE_Export UUID - { - public: - - /// Constructor - UUID (void); - - /// Constructs a UUID from a string representation. - UUID (const ACE_CString& uuidString); - - // Destructor - ~UUID (void); - - ACE_UINT32 timeLow (void); - void timeLow (ACE_UINT32); - - ACE_UINT16 timeMid (void); - void timeMid (ACE_UINT16); - - ACE_UINT16 timeHiAndVersion (void); - void timeHiAndVersion (ACE_UINT16); - - u_char clockSeqHiAndReserved (void); - void clockSeqHiAndReserved (u_char); - - u_char clockSeqLow (void); - void clockSeqLow (u_char); - - UUID_node* node (void); - void node (UUID_node*); - - ACE_CString* thr_id (void); - void thr_id (char*); - - ACE_CString* pid (void); - void pid (char*); - - /// Returns a string representation of the UUID - const ACE_CString* to_string (void); - - static UUID NIL_UUID; - - /// Equality Operations - //bool operator== (const UUID &right) const; - //bool operator!= (const UUID &right) const; - - /// Relational Operations - //bool operator< (const UUID &right) const; - //bool operator> (const UUID &right) const; - //bool operator<= (const UUID &right) const; - //bool operator>= (const UUID &right) const; - - private: - // Copy constructor and assignment operator were not implemented - // correctly, so I removed their implementation as an easy solution. - UUID (const UUID&); - UUID& operator= (const UUID&); - - /// Data Members for Class Attributes - ACE_UINT32 timeLow_; - ACE_UINT16 timeMid_; - ACE_UINT16 timeHiAndVersion_; - u_char clockSeqHiAndReserved_; - u_char clockSeqLow_; - UUID_node* node_; - int node_release_; - ACE_CString thr_id_; - ACE_CString pid_; - - /// The string representation of the UUID. This is created and - /// updated only on demand. - ACE_CString *as_string_; - }; - - - /** - * @class ACE_UUID_Generator - * - * Singleton class that generates UUIDs. - * - */ - class ACE_Export UUID_Generator - { - public: - - enum {ACE_UUID_CLOCK_SEQ_MASK = 0x3FFF}; - - UUID_Generator(); - ~UUID_Generator(); - - void init (void); - - /// Format timestamp, clockseq, and nodeID into an UUID of the - /// specified version and variant. For generating UUID's with - /// thread and process ids use variant=0xc0 - void generateUUID (UUID&, ACE_UINT16 version=0x0001, u_char variant=0x80); - - /// Format timestamp, clockseq, and nodeID into a VI UUID. For - /// generating UUID's with thread and process ids use variant=0xc0 - UUID* generateUUID (ACE_UINT16 version=0x0001, u_char variant=0x80); - - /// Type to represent UTC as a count of 100 nanosecond intervals - /// since 00:00:00.00, 15 October 1582. - typedef ACE_UINT64 UUID_time; - - /// The locking strategy prevents multiple generators from accessing - /// the UUID_state at the same time. Get the locking strategy. - ACE_SYNCH_MUTEX* lock (void); - - /// Set a new locking strategy and return the old one. - ACE_SYNCH_MUTEX* lock (ACE_SYNCH_MUTEX*lock, - int release_lock); - - - private: - - /// The system time when that last uuid was generated. - UUID_time timeLast_; - - /// Type to contain the UUID generator persistent state. This will - /// be kept in memory mapped shared memory - struct UUID_State - { - UUID_time timestamp; - UUID_node node; - ACE_UINT16 clockSequence; - }; - - /// Obtain a UUID timestamp. Compensate for the fact that the time - /// obtained from getSystem time has a resolution less than 100ns. - void get_timestamp (UUID_time& timestamp); - - /// Obtain the system time in UTC as a count of 100 nanosecond intervals - /// since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to - /// the Christian calendar). - void get_systemtime( UUID_time& timeNow); - - /// The UUID generator persistent state. - UUID_State uuid_state_; - - ACE_SYNCH_MUTEX* lock_; - int destroy_lock_; - }; - - typedef ACE_Singleton UUID_GENERATOR; - -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/UUID.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif // ACE_UUID_H diff --git a/ace/UUID.inl b/ace/UUID.inl deleted file mode 100644 index 7eb8dd323de..00000000000 --- a/ace/UUID.inl +++ /dev/null @@ -1,201 +0,0 @@ -// -*- C++ -*- -// -//$Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE_Utils -{ - - /// Data Members for Class Attributes - ACE_INLINE ACE_UINT32 - UUID::timeLow (void) - { - return this->timeLow_; - } - - ACE_INLINE void - UUID::timeLow (ACE_UINT32 timelow) - { - this->timeLow_ = timelow; - } - - ACE_INLINE ACE_UINT16 - UUID::timeMid (void) - { - return this->timeMid_; - } - - ACE_INLINE void - UUID::timeMid (ACE_UINT16 time_mid) - { - this->timeMid_ = time_mid; - } - - ACE_INLINE ACE_UINT16 - UUID::timeHiAndVersion (void) - { - return this->timeHiAndVersion_; - } - - ACE_INLINE void - UUID::timeHiAndVersion (ACE_UINT16 timeHiAndVersion) - { - this->timeHiAndVersion_ = timeHiAndVersion; - } - - ACE_INLINE u_char - UUID::clockSeqHiAndReserved (void) - { - return this->clockSeqHiAndReserved_; - } - - ACE_INLINE void - UUID::clockSeqHiAndReserved (u_char clockSeqHiAndReserved) - { - this->clockSeqHiAndReserved_ = clockSeqHiAndReserved; - } - - ACE_INLINE u_char - UUID::clockSeqLow (void) - { - return this->clockSeqLow_; - } - - ACE_INLINE void - UUID::clockSeqLow (u_char clockSeqLow) - { - this->clockSeqLow_ = clockSeqLow; - } - - ACE_INLINE UUID_node* - UUID::node (void) - { - return this->node_; - } - - ACE_INLINE void - UUID::node (UUID_node* node) - { - if (node_release_ == 1) - delete node_; - - this->node_ = node; - node_release_ = 0; - } - - ACE_INLINE ACE_CString* - UUID::thr_id (void) - { - return &this->thr_id_; - } - - ACE_INLINE void - UUID::thr_id (char* thr_id) - { - this->thr_id_ = thr_id; - } - - ACE_INLINE ACE_CString* - UUID::pid (void) - { - return &this->pid_; - } - - ACE_INLINE void - UUID::pid (char* pid) - { - this->pid_ = pid; - } - - //ACE_INLINE bool - //UUID::operator == (const UUID &right) const - //{ - // UUID rt (right); - // if ((timeLow_ != rt.timeLow ()) || - // (timeMid_ != rt.timeMid ()) || - // (timeHiAndVersion_ != rt.timeHiAndVersion ()) || - // (clockSeqHiAndReserved_ != rt.clockSeqHiAndReserved ()) || - // (clockSeqLow_ != rt.clockSeqLow ()) || - // (node_ != rt.node ())) - // { - // return false; - // } - - // return true; - //} - - //ACE_INLINE bool - //UUID::operator != (const UUID &right) const - //{ - // return !(*this == right); - //} - -// ACE_INLINE bool -//UUID::operator < (const UUID &rt) const -// { -// UUID right (rt); -// if ((timeLow_ < right.timeLow ()) || -// (timeMid_ < right.timeMid ()) || -// (timeHiAndVersion_ < right.timeHiAndVersion ()) || -// (clockSeqHiAndReserved_ < right.clockSeqHiAndReserved ()) || -// (clockSeqLow_ < right.clockSeqLow ()) || -// (node_ < right.node ())) -// { -// return true; -// } -// -// return false; -// } -// -// ACE_INLINE bool -// UUID::operator > (const UUID &right) const -// { -// return right < *this; -// } -// -// ACE_INLINE bool -// UUID::operator <= (const UUID &right) const -// { -// return !(*this > right); -// } -// -// ACE_INLINE bool -// UUID::operator >= (const UUID &right) const -// { -// return !(*this < right); -// } -// -// ACE_INLINE bool -// UUID_node::operator == (const UUID_node& rt) const -// { -// UUID_node right = rt; -// for (size_t i = 0; i < NODE_ID_SIZE; ++i) -// { -// if (nodeID_ [i] != right.nodeID ()[i]) -// { -// return false; -// } -// } -// return true; -// } -// -// ACE_INLINE bool -// UUID_node::operator != (const UUID_node& right) const -// { -// return !(*this == right); -// } -// -// ACE_INLINE bool -// UUID_node::operator < (const UUID_node& rt) const -// { -// UUID_node right = rt; -// for (size_t i = 0; i < NODE_ID_SIZE; ++i) -// if (nodeID_ [i] < right.nodeID ()[i]) -// return true; -// -// return false; -// } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Unbounded_Queue.cpp b/ace/Unbounded_Queue.cpp deleted file mode 100644 index f7a11c2de9d..00000000000 --- a/ace/Unbounded_Queue.cpp +++ /dev/null @@ -1,434 +0,0 @@ -// $Id$ - -#ifndef ACE_UNBOUNDED_QUEUE_CPP -#define ACE_UNBOUNDED_QUEUE_CPP - -#include "ace/Unbounded_Queue.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Unbounded_Queue.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Malloc_Base.h" -#include "ace/Log_Msg.h" -#include "ace/os_include/os_errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Queue) - -template -ACE_Unbounded_Queue::ACE_Unbounded_Queue (ACE_Allocator *alloc) - : head_ (0), - cur_size_ (0), - allocator_ (alloc) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::ACE_Unbounded_Queue (void)"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node); - // Make the list circular by pointing it back to itself. - this->head_->next_ = this->head_; -} - -template -ACE_Unbounded_Queue::ACE_Unbounded_Queue (const ACE_Unbounded_Queue &us) - : head_ (0), - cur_size_ (0), - allocator_ (us.allocator_) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::ACE_Unbounded_Queue"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node); - this->head_->next_ = this->head_; - this->copy_nodes (us); -} - -template void -ACE_Unbounded_Queue::operator= (const ACE_Unbounded_Queue &us) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::operator="); - - if (this != &us) - { - this->delete_nodes (); - this->copy_nodes (us); - } -} - -template ACE_Unbounded_Queue_Iterator -ACE_Unbounded_Queue::begin (void) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::begin"); - return ACE_Unbounded_Queue_Iterator (*this); -} - -template ACE_Unbounded_Queue_Iterator -ACE_Unbounded_Queue::end (void) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::end"); - return ACE_Unbounded_Queue_Iterator (*this, 1); -} - -template void -ACE_Unbounded_Queue::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Unbounded_Queue::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nhead_ = %u"), this->head_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nhead_->next_ = %u"), this->head_->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncur_size_ = %d\n"), this->cur_size_)); - - T *item = 0; -#if !defined (ACE_NLOGGING) - size_t count = 1; -#endif /* ! ACE_NLOGGING */ - - for (ACE_Unbounded_Queue_Iterator iter (*(ACE_Unbounded_Queue *) this); - iter.next (item) != 0; - iter.advance ()) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("count = %d\n"), count++)); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template void -ACE_Unbounded_Queue::copy_nodes (const ACE_Unbounded_Queue &us) -{ - for (ACE_Node *curr = us.head_->next_; - curr != us.head_; - curr = curr->next_) - if (this->enqueue_tail (curr->item_) == -1) - // @@ What's the right thing to do here? - this->delete_nodes (); -} - -template void -ACE_Unbounded_Queue::delete_nodes (void) -{ - for (ACE_Node *curr = this->head_->next_; - // Keep looking until we've hit the dummy node. - curr != this->head_; - ) - { - ACE_Node *temp = curr; - curr = curr->next_; - - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_Node, - ); - --this->cur_size_; - // @@ Doesnt make sense to have this check since - // this will always be true. - // ACE_ASSERT (this->cur_size_ >= 0); - } - - // Reset the list to be a circular list with just a dummy node. - this->head_->next_ = this->head_; -} - -template -ACE_Unbounded_Queue::~ACE_Unbounded_Queue (void) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::~ACE_Unbounded_Queue (void)"); - - this->delete_nodes (); - ACE_DES_FREE_TEMPLATE (head_, - this->allocator_->free, - ACE_Node, - ); - this->head_ = 0; -} - -template int -ACE_Unbounded_Queue::enqueue_head (const T &new_item) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::enqueue_head"); - - ACE_Node *temp = 0; - - // Create a new node that points to the original head. - ACE_NEW_MALLOC_RETURN (temp, - static_cast *> (this->allocator_->malloc (sizeof (ACE_Node))), - ACE_Node (new_item, this->head_->next_), - -1); - // Link this pointer into the front of the list. Note that the - // "real" head of the queue is next_>, whereas is - // just a pointer to the dummy node. - this->head_->next_ = temp; - - ++this->cur_size_; - return 0; -} - -template int -ACE_Unbounded_Queue::enqueue_tail (const T &new_item) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::enqueue_tail"); - - // Insert into the old dummy node location. Note that this - // isn't actually the "head" item in the queue, it's a dummy node at - // the "tail" of the queue... - this->head_->item_ = new_item; - - ACE_Node *temp = 0; - - // Create a new dummy node. - ACE_NEW_MALLOC_RETURN (temp, - static_cast *> (this->allocator_->malloc (sizeof (ACE_Node))), - ACE_Node (this->head_->next_), - -1); - // Link this dummy pointer into the list. - this->head_->next_ = temp; - - // Point the head to the new dummy node. - this->head_ = temp; - - ++this->cur_size_; - return 0; -} - -template int -ACE_Unbounded_Queue::dequeue_head (T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::dequeue_head"); - - // Check for empty queue. - if (this->is_empty ()) - return -1; - - ACE_Node *temp = this->head_->next_; - - item = temp->item_; - this->head_->next_ = temp->next_; - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_Node, - ); - --this->cur_size_; - return 0; -} - -template void -ACE_Unbounded_Queue::reset (void) -{ - ACE_TRACE ("reset"); - - this->delete_nodes (); -} - -template int -ACE_Unbounded_Queue::get (T *&item, size_t slot) const -{ - // ACE_TRACE ("ACE_Unbounded_Queue::get"); - - ACE_Node *curr = this->head_->next_; - - size_t i; - - for (i = 0; i < this->cur_size_; i++) - { - if (i == slot) - break; - - curr = curr->next_; - } - - if (i < this->cur_size_) - { - item = &curr->item_; - return 0; - } - else - return -1; -} - -template int -ACE_Unbounded_Queue::set (const T &item, - size_t slot) -{ - // ACE_TRACE ("ACE_Unbounded_Queue::set"); - - ACE_Node *curr = this->head_->next_; - - size_t i; - - for (i = 0; - i < slot && i < this->cur_size_; - i++) - curr = curr->next_; - - if (i < this->cur_size_) - { - // We're in range, so everything's cool. - curr->item_ = item; - return 0; - } - else - { - // We need to expand the list. - - // A common case will be increasing the set size by 1. - // Therefore, we'll optimize for this case. - if (i == slot) - { - // Try to expand the size of the set by 1. - if (this->enqueue_tail (item) == -1) - return -1; - else - return 0; - } - else - { - T dummy; - - // We need to expand the list by multiple (dummy) items. - for (; i < slot; i++) - { - // This head points to the existing dummy node, which is - // about to be overwritten when we add the new dummy - // node. - curr = this->head_; - - // Try to expand the size of the set by 1, but don't - // store anything in the dummy node (yet). - if (this->enqueue_tail (dummy) == -1) - return -1; - } - - curr->item_ = item; - return 0; - } - } -} - -// **************************************************************** - -template void -ACE_Unbounded_Queue_Const_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Unbounded_Queue_Const_Iterator::ACE_Unbounded_Queue_Const_Iterator (const ACE_Unbounded_Queue &q, int end) - : current_ (end == 0 ? q.head_->next_ : q.head_ ), - queue_ (q) -{ - // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::ACE_Unbounded_Queue_Const_Iterator"); -} - -template int -ACE_Unbounded_Queue_Const_Iterator::advance (void) -{ - // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::advance"); - this->current_ = this->current_->next_; - return this->current_ != this->queue_.head_; -} - -template int -ACE_Unbounded_Queue_Const_Iterator::first (void) -{ - // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::first"); - this->current_ = this->queue_.head_->next_; - return this->current_ != this->queue_.head_; -} - -template int -ACE_Unbounded_Queue_Const_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::done"); - - return this->current_ == this->queue_.head_; -} - -template int -ACE_Unbounded_Queue_Const_Iterator::next (T *&item) -{ - // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::next"); - if (this->current_ == this->queue_.head_) - return 0; - else - { - item = &this->current_->item_; - return 1; - } -} - -// **************************************************************** - -template void -ACE_Unbounded_Queue_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Unbounded_Queue_Iterator::ACE_Unbounded_Queue_Iterator (ACE_Unbounded_Queue &q, int end) - : current_ (end == 0 ? q.head_->next_ : q.head_ ), - queue_ (q) -{ - // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::ACE_Unbounded_Queue_Iterator"); -} - -template int -ACE_Unbounded_Queue_Iterator::advance (void) -{ - // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::advance"); - this->current_ = this->current_->next_; - return this->current_ != this->queue_.head_; -} - -template int -ACE_Unbounded_Queue_Iterator::first (void) -{ - // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::first"); - this->current_ = this->queue_.head_->next_; - return this->current_ != this->queue_.head_; -} - -template int -ACE_Unbounded_Queue_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Unbounded_Queue_Iterator::done"); - - return this->current_ == this->queue_.head_; -} - -template int -ACE_Unbounded_Queue_Iterator::next (T *&item) -{ - // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::next"); - if (this->current_ == this->queue_.head_) - return 0; - else - { - item = &this->current_->item_; - return 1; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_UNBOUNDED_QUEUE_CPP */ diff --git a/ace/Unbounded_Queue.h b/ace/Unbounded_Queue.h deleted file mode 100644 index ae70125ffbd..00000000000 --- a/ace/Unbounded_Queue.h +++ /dev/null @@ -1,297 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Unbounded_Queue.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_UNBOUNDED_QUEUE_H -#define ACE_UNBOUNDED_QUEUE_H -#include /**/ "ace/pre.h" - -#include "ace/Node.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_stddef.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Allocator; - -template -class ACE_Unbounded_Queue; - -/** - * @class ACE_Unbounded_Queue_Iterator - * - * @brief Implement an iterator over an unbounded queue. - */ -template -class ACE_Unbounded_Queue_Iterator -{ -public: - // = Initialization method. - ACE_Unbounded_Queue_Iterator (ACE_Unbounded_Queue &q, int end = 0); - - // = Iteration methods. - - /// Pass back the @a next_item that hasn't been seen in the queue. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the queue have been seen, else 1. - int advance (void); - - /// Move to the first element in the queue. Returns 0 if the - /// queue is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Pointer to the current node in the iteration. - ACE_Node *current_; - - /// Pointer to the queue we're iterating over. - ACE_Unbounded_Queue &queue_; -}; - -/** - * @class ACE_Unbounded_Queue_Const_Iterator - * - * @brief Implement an iterator over an const unbounded queue. - */ -template -class ACE_Unbounded_Queue_Const_Iterator -{ -public: - // = Initialization method. - ACE_Unbounded_Queue_Const_Iterator (const ACE_Unbounded_Queue &q, int end = 0); - - // = Iteration methods. - - /// Pass back the @a next_item that hasn't been seen in the queue. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the queue have been seen, else 1. - int advance (void); - - /// Move to the first element in the queue. Returns 0 if the - /// queue is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Pointer to the current node in the iteration. - ACE_Node *current_; - - /// Pointer to the queue we're iterating over. - const ACE_Unbounded_Queue &queue_; -}; - -/** - * @class ACE_Unbounded_Queue - * - * @brief A Queue of "infinite" length. - * - * This implementation of an unbounded queue uses a circular - * linked list with a dummy node. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Circular linked list - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * N/A - * - Insert/replace speed - * N/A - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * Yes - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * - */ -template -class ACE_Unbounded_Queue -{ -public: - friend class ACE_Unbounded_Queue_Iterator; - friend class ACE_Unbounded_Queue_Const_Iterator; - - // Trait definition. - typedef ACE_Unbounded_Queue_Iterator ITERATOR; - typedef ACE_Unbounded_Queue_Const_Iterator CONST_ITERATOR; - - // = Initialization and termination methods. - /// Construction. Use user specified allocation strategy - /// if specified. - /** - * Initialize an empty queue using the strategy provided. - */ - ACE_Unbounded_Queue (ACE_Allocator *alloc = 0); - - /// Copy constructor. - /** - * Initialize the queue to be a copy of the provided queue. - */ - ACE_Unbounded_Queue (const ACE_Unbounded_Queue &); - - /// Assignment operator. - /** - * Perform a deep copy of rhs. - */ - void operator= (const ACE_Unbounded_Queue &); - - /// Destructor. - /** - * Clean up the memory for the queue. - */ - ~ACE_Unbounded_Queue (void); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Constant time check to see if the queue is empty. - */ - int is_empty (void) const; - - /// Returns 0. - /** - * The queue cannot be full, so it always returns 0. - */ - int is_full (void) const; - - // = Classic queue operations. - - /// Adds @a new_item to the tail of the queue. Returns 0 on success, - /// -1 on failure. - /** - * Insert an item at the end of the queue. - */ - int enqueue_tail (const T &new_item); - - /// Adds @a new_item to the head of the queue. Returns 0 on success, - /// -1 on failure. - /** - * Insert an item at the head of the queue. - */ - int enqueue_head (const T &new_item); - - /// Removes and returns the first @a item on the queue. Returns 0 on - /// success, -1 if the queue was empty. - /** - * Remove an item from the head of the queue. - */ - int dequeue_head (T &item); - - // = Additional utility methods. - - /// Reset the ACE_Unbounded_Queue to be empty and release all its - /// dynamically allocated resources. - /** - * Delete the queue nodes. - */ - void reset (void); - - /// Get the @a slot th element in the set. Returns -1 if the element - /// isn't in the range {0..#cur_size_ - 1}, else 0. - /** - * Find the item in the queue between 0 and the provided index of the - * queue. - */ - int get (T *&item, size_t slot = 0) const; - - /// Set the @a slot th element of the queue to @a item. - /** - * Set the @a slot th element in the set. Will pad out the set with - * empty nodes if @a slot is beyond the range {0..#cur_size_ - 1}. - * Returns -1 on failure, 0 if @a slot isn't initially in range, and - * 0 otherwise. - */ - int set (const T &item, size_t slot); - - /// The number of items in the queue. - /** - * Return the size of the queue. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - // = STL-styled unidirectional iterator factory. - ACE_Unbounded_Queue_Iterator begin (void); - ACE_Unbounded_Queue_Iterator end (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Delete all the nodes in the queue. - void delete_nodes (void); - - /// Copy nodes into this queue. - void copy_nodes (const ACE_Unbounded_Queue &); - - /// Pointer to the dummy node in the circular linked Queue. - ACE_Node *head_; - - /// Current size of the queue. - size_t cur_size_; - - /// Allocation Strategy of the queue. - ACE_Allocator *allocator_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Unbounded_Queue.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Unbounded_Queue.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Unbounded_Queue.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_UNBOUNDED_QUEUE_H */ diff --git a/ace/Unbounded_Queue.inl b/ace/Unbounded_Queue.inl deleted file mode 100644 index 35bb7fb9cdf..00000000000 --- a/ace/Unbounded_Queue.inl +++ /dev/null @@ -1,27 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE size_t -ACE_Unbounded_Queue::size (void) const -{ - return this->cur_size_; -} - -template ACE_INLINE int -ACE_Unbounded_Queue::is_empty (void) const -{ - // ACE_TRACE ("ACE_Unbounded_Queue::is_empty"); - return this->head_ == this->head_->next_; -} - -template ACE_INLINE int -ACE_Unbounded_Queue::is_full (void) const -{ - // ACE_TRACE ("ACE_Unbounded_Queue::is_full"); - return 0; // We should implement a "node of last resort for this..." -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Unbounded_Set.cpp b/ace/Unbounded_Set.cpp deleted file mode 100644 index c3a444ccd8a..00000000000 --- a/ace/Unbounded_Set.cpp +++ /dev/null @@ -1,452 +0,0 @@ -// $Id$ - -#ifndef ACE_UNBOUNDED_SET_CPP -#define ACE_UNBOUNDED_SET_CPP - -#include "ace/Unbounded_Set.h" -#include "ace/Malloc_Base.h" -#include "ace/Log_Msg.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Unbounded_Set.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set) - - template size_t -ACE_Unbounded_Set::size (void) const -{ - // ACE_TRACE ("ACE_Unbounded_Set::size"); - return this->cur_size_; -} - -template int -ACE_Unbounded_Set::insert_tail (const T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Set::insert_tail"); - ACE_Node *temp; - - // Insert into the old dummy node location. - this->head_->item_ = item; - - // Create a new dummy node. - ACE_NEW_MALLOC_RETURN (temp, - static_cast*> (this->allocator_->malloc (sizeof (ACE_Node))), - ACE_Node (this->head_->next_), - -1); - // Link this pointer into the list. - this->head_->next_ = temp; - - // Point the head to the new dummy node. - this->head_ = temp; - - ++this->cur_size_; - return 0; -} - -template void -ACE_Unbounded_Set::reset (void) -{ - ACE_TRACE ("reset"); - - this->delete_nodes (); -} - -template void -ACE_Unbounded_Set::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Unbounded_Set::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nhead_ = %u"), this->head_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nhead_->next_ = %u"), this->head_->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncur_size_ = %d\n"), this->cur_size_)); - - T *item = 0; -#if !defined (ACE_NLOGGING) - size_t count = 1; -#endif /* ! ACE_NLOGGING */ - - for (ACE_Unbounded_Set_Iterator iter (*(ACE_Unbounded_Set *) this); - iter.next (item) != 0; - iter.advance ()) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("count = %d\n"), count++)); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template void -ACE_Unbounded_Set::copy_nodes (const ACE_Unbounded_Set &us) -{ - for (ACE_Node *curr = us.head_->next_; - curr != us.head_; - curr = curr->next_) - this->insert_tail (curr->item_); -} - -template void -ACE_Unbounded_Set::delete_nodes (void) -{ - ACE_Node *curr = this->head_->next_; - - // Keep looking until we've hit the dummy node. - - while (curr != this->head_) - { - ACE_Node *temp = curr; - curr = curr->next_; - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_Node, - ); - --this->cur_size_; - } - - // Reset the list to be a circular list with just a dummy node. - this->head_->next_ = this->head_; -} - -template -ACE_Unbounded_Set::~ACE_Unbounded_Set (void) -{ - // ACE_TRACE ("ACE_Unbounded_Set::~ACE_Unbounded_Set"); - - this->delete_nodes (); - - // Delete the dummy node. - ACE_DES_FREE_TEMPLATE (head_, - this->allocator_->free, - ACE_Node, - ); - this->head_ = 0; -} - -template -ACE_Unbounded_Set::ACE_Unbounded_Set (ACE_Allocator *alloc) - : head_ (0), - cur_size_ (0), - allocator_ (alloc) -{ - // ACE_TRACE ("ACE_Unbounded_Set::ACE_Unbounded_Set"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (ACE_Node*) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node); - // Make the list circular by pointing it back to itself. - this->head_->next_ = this->head_; -} - -template -ACE_Unbounded_Set::ACE_Unbounded_Set (const ACE_Unbounded_Set &us) - : head_ (0), - cur_size_ (0), - allocator_ (us.allocator_) -{ - ACE_TRACE ("ACE_Unbounded_Set::ACE_Unbounded_Set"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (ACE_Node*) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node); - this->head_->next_ = this->head_; - this->copy_nodes (us); -} - -template ACE_Unbounded_Set & -ACE_Unbounded_Set::operator= (const ACE_Unbounded_Set &us) -{ - ACE_TRACE ("ACE_Unbounded_Set::operator="); - - if (this != &us) - { - this->delete_nodes (); - this->copy_nodes (us); - } - - return *this; -} - -template int -ACE_Unbounded_Set::find (const T &item) const -{ - // ACE_TRACE ("ACE_Unbounded_Set::find"); - // Set into the dummy node. - this->head_->item_ = item; - - ACE_Node *temp = this->head_->next_; - - // Keep looping until we find the item. - while (!(temp->item_ == item)) - temp = temp->next_; - - // If we found the dummy node then it's not really there, otherwise, - // it is there. - return temp == this->head_ ? -1 : 0; -} - -template int -ACE_Unbounded_Set::insert (const T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Set::insert"); - if (this->find (item) == 0) - return 1; - else - return this->insert_tail (item); -} - -template int -ACE_Unbounded_Set::remove (const T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Set::remove"); - - // Insert the item to be founded into the dummy node. - this->head_->item_ = item; - - ACE_Node *curr = this->head_; - - while (!(curr->next_->item_ == item)) - curr = curr->next_; - - if (curr->next_ == this->head_) - return -1; // Item was not found. - else - { - ACE_Node *temp = curr->next_; - // Skip over the node that we're deleting. - curr->next_ = temp->next_; - --this->cur_size_; - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_Node, - ); - return 0; - } -} - -template ACE_Unbounded_Set_Iterator -ACE_Unbounded_Set::begin (void) -{ - // ACE_TRACE ("ACE_Unbounded_Set::begin"); - return ACE_Unbounded_Set_Iterator (*this); -} - -template ACE_Unbounded_Set_Iterator -ACE_Unbounded_Set::end (void) -{ - // ACE_TRACE ("ACE_Unbounded_Set::end"); - return ACE_Unbounded_Set_Iterator (*this, 1); -} - - -ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set_Iterator) - - template void -ACE_Unbounded_Set_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Unbounded_Set_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Unbounded_Set_Iterator::ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set &s, int end) - : current_ (end == 0 ? s.head_->next_ : s.head_ ), - set_ (&s) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Iterator::ACE_Unbounded_Set_Iterator"); -} - -template int -ACE_Unbounded_Set_Iterator::advance (void) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Iterator::advance"); - this->current_ = this->current_->next_; - return this->current_ != this->set_->head_; -} - -template int -ACE_Unbounded_Set_Iterator::first (void) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Iterator::first"); - this->current_ = this->set_->head_->next_; - return this->current_ != this->set_->head_; -} - -template int -ACE_Unbounded_Set_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Unbounded_Set_Iterator::done"); - - return this->current_ == this->set_->head_; -} - -template int -ACE_Unbounded_Set_Iterator::next (T *&item) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Iterator::next"); - if (this->current_ == this->set_->head_) - return 0; - else - { - item = &this->current_->item_; - return 1; - } -} - -template ACE_Unbounded_Set_Iterator -ACE_Unbounded_Set_Iterator::operator++ (int) -{ - //ACE_TRACE ("ACE_Unbounded_Set_Iterator::operator++ (int)"); - ACE_Unbounded_Set_Iterator retv (*this); - - // postfix operator - - this->advance (); - return retv; -} - -template ACE_Unbounded_Set_Iterator& -ACE_Unbounded_Set_Iterator::operator++ (void) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Iterator::operator++ (void)"); - - // prefix operator - - this->advance (); - return *this; -} - -template T& -ACE_Unbounded_Set_Iterator::operator* (void) -{ - //ACE_TRACE ("ACE_Unbounded_Set_Iterator::operator*"); - T *retv = 0; - - int result = this->next (retv); - ACE_ASSERT (result != 0); - ACE_UNUSED_ARG (result); - - return *retv; -} - -template bool -ACE_Unbounded_Set_Iterator::operator== (const ACE_Unbounded_Set_Iterator &rhs) const -{ - //ACE_TRACE ("ACE_Unbounded_Set_Iterator::operator=="); - return (this->set_ == rhs.set_ && this->current_ == rhs.current_); -} - -template bool -ACE_Unbounded_Set_Iterator::operator!= (const ACE_Unbounded_Set_Iterator &rhs) const -{ - //ACE_TRACE ("ACE_Unbounded_Set_Iterator::operator!="); - return (this->set_ != rhs.set_ || this->current_ != rhs.current_); -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set_Const_Iterator) - -template void -ACE_Unbounded_Set_Const_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Unbounded_Set_Const_Iterator::ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set &s, int end) - : current_ (end == 0 ? s.head_->next_ : s.head_ ), - set_ (&s) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator::ACE_Unbounded_Set_Const_Iterator"); -} - -template int -ACE_Unbounded_Set_Const_Iterator::advance (void) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator::advance"); - this->current_ = this->current_->next_; - return this->current_ != this->set_->head_; -} - -template int -ACE_Unbounded_Set_Const_Iterator::first (void) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator::first"); - this->current_ = this->set_->head_->next_; - return this->current_ != this->set_->head_; -} - -template int -ACE_Unbounded_Set_Const_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator::done"); - - return this->current_ == this->set_->head_; -} - -template int -ACE_Unbounded_Set_Const_Iterator::next (T *&item) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator::next"); - if (this->current_ == this->set_->head_) - return 0; - else - { - item = &this->current_->item_; - return 1; - } -} - -template ACE_Unbounded_Set_Const_Iterator -ACE_Unbounded_Set_Const_Iterator::operator++ (int) -{ - //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator::operator++ (int)"); - ACE_Unbounded_Set_Const_Iterator retv (*this); - - // postfix operator - - this->advance (); - return retv; -} - -template ACE_Unbounded_Set_Const_Iterator& -ACE_Unbounded_Set_Const_Iterator::operator++ (void) -{ - // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator::operator++ (void)"); - - // prefix operator - - this->advance (); - return *this; -} - -template T& -ACE_Unbounded_Set_Const_Iterator::operator* (void) -{ - //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator::operator*"); - T *retv = 0; - - int const result = this->next (retv); - ACE_ASSERT (result != 0); - ACE_UNUSED_ARG (result); - - return *retv; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_UNBOUNDED_SET_CPP */ diff --git a/ace/Unbounded_Set.h b/ace/Unbounded_Set.h deleted file mode 100644 index 8cddab86f12..00000000000 --- a/ace/Unbounded_Set.h +++ /dev/null @@ -1,319 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Unbounded_Set.h - * - * $Id$ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_UNBOUNDED_SET_H -#define ACE_UNBOUNDED_SET_H -#include /**/ "ace/pre.h" - -#include "ace/Node.h" -#include "ace/os_include/os_stddef.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Allocator; - -/** - * @class ACE_Unbounded_Set_Iterator - * - * @brief Implement an iterator over an unbounded set. - */ -template -class ACE_Unbounded_Set_Iterator -{ -public: - // = Initialization method. - ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set &s, int end = 0); - - // = Iteration methods. - - /// Pass back the that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Move to the first element in the set. Returns 0 if the - /// set is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Postfix advance. - ACE_Unbounded_Set_Iterator operator++ (int); - - /// Prefix advance. - ACE_Unbounded_Set_Iterator& operator++ (void); - - /// Returns a reference to the internal element is pointing to. - T& operator* (void); - - /// Check if two iterators point to the same position - bool operator== (const ACE_Unbounded_Set_Iterator &) const; - bool operator!= (const ACE_Unbounded_Set_Iterator &) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /// Pointer to the current node in the iteration. - ACE_Node *current_; - - /// Pointer to the set we're iterating over. - ACE_Unbounded_Set *set_; -}; - -/** - * @class ACE_Unbounded_Set_Const_Iterator - * - * @brief Implement an const iterator over an unbounded set. - */ -template -class ACE_Unbounded_Set_Const_Iterator -{ -public: - // = Initialization method. - ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set &s, int end = 0); - - // = Iteration methods. - - /// Pass back the @a next_item that hasn't been seen in the Set. - /// @return Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Move to the first element in the set. Returns 0 if the - /// set is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Postfix advance. - ACE_Unbounded_Set_Const_Iterator operator++ (int); - - /// Prefix advance. - ACE_Unbounded_Set_Const_Iterator& operator++ (void); - - /// Returns a reference to the internal element is pointing to. - T& operator* (void); - - /// Check if two iterators point to the same position - bool operator== (const ACE_Unbounded_Set_Const_Iterator &) const; - bool operator!= (const ACE_Unbounded_Set_Const_Iterator &) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /// Pointer to the current node in the iteration. - ACE_Node *current_; - - /// Pointer to the set we're iterating over. - const ACE_Unbounded_Set *set_; -}; - -/** - * @class ACE_Unbounded_Set - * - * @brief Implement a simple unordered set of of unbounded size. - * - * This implementation of an unordered set uses a circular - * linked list with a dummy node. This implementation does not - * allow duplicates, but it maintains FIFO ordering of insertions. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Circular linked list - * - Duplicates allowed? - * No - * - Random access allowed? - * No - * - Search speed - * Linear - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * Yes - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * - */ -template -class ACE_Unbounded_Set -{ -public: - friend class ACE_Unbounded_Set_Iterator; - friend class ACE_Unbounded_Set_Const_Iterator; - - // Trait definition. - typedef ACE_Unbounded_Set_Iterator ITERATOR; - typedef ACE_Unbounded_Set_Iterator iterator; - typedef ACE_Unbounded_Set_Const_Iterator CONST_ITERATOR; - typedef ACE_Unbounded_Set_Const_Iterator const_iterator; - - // = Initialization and termination methods. - /// Constructor. Use user specified allocation strategy - /// if specified. - /** - * Initialize an empty set using the allocation strategy of the user if - * provided. - */ - ACE_Unbounded_Set (ACE_Allocator *alloc = 0); - - /// Copy constructor. - /** - * Initialize this set to be an exact copy of the set provided. - */ - ACE_Unbounded_Set (const ACE_Unbounded_Set &); - - /// Assignment operator. - /** - * Perform a deep copy of the rhs into the lhs. - */ - ACE_Unbounded_Set & operator= (const ACE_Unbounded_Set &); - - /// Destructor. - /** - * Destroy the nodes of the set. - */ - ~ACE_Unbounded_Set (void); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Constant time is_empty check. - */ - int is_empty (void) const; - - /// Returns 0. - /** - * Always returns 0 since the set can never fill up. - */ - int is_full (void) const; - - // = Classic unordered set operations. - - /// Linear insertion of an item. - /** - * Insert @a new_item into the set (doesn't allow duplicates). - * Returns -1 if failures occur, 1 if item is already present, else - * 0. - */ - int insert (const T &new_item); - - /// Insert @a item at the tail of the set (doesn't check for - /// duplicates). - /** - * Constant time insert at the end of the set. - */ - int insert_tail (const T &item); - - /// Linear remove operation. - /** - * Remove first occurrence of @a item from the set. Returns 0 if - * it removes the item, -1 if it can't find the item, and -1 if a - * failure occurs. - */ - int remove (const T &item); - - /// Finds if @a item occurs in the set. Returns 0 if find succeeds, - /// else -1. - /** - * Performs a linear find operation. - */ - int find (const T &item) const; - - /// Size of the set. - /** - * Access the size of the set. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Reset the to be empty. - /** - * Delete the nodes of the set. - */ - void reset (void); - - // = STL-styled unidirectional iterator factory. - ACE_Unbounded_Set_Iterator begin (void); - ACE_Unbounded_Set_Iterator end (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Delete all the nodes in the Set. - void delete_nodes (void); - - /// Copy nodes into this set. - void copy_nodes (const ACE_Unbounded_Set &); - - /// Head of the linked list of Nodes. - ACE_Node *head_; - - /// Current size of the set. - size_t cur_size_; - - /// Allocation strategy of the set. - ACE_Allocator *allocator_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Unbounded_Set.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Unbounded_Set.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Unbounded_Set.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_UNBOUNDED_SET_H */ diff --git a/ace/Unbounded_Set.inl b/ace/Unbounded_Set.inl deleted file mode 100644 index 363fe6e4a6d..00000000000 --- a/ace/Unbounded_Set.inl +++ /dev/null @@ -1,23 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Unbounded_Set::is_empty (void) const -{ - ACE_TRACE ("ACE_Unbounded_Set::is_empty"); - return this->head_ == this->head_->next_; -} - -template ACE_INLINE int -ACE_Unbounded_Set::is_full (void) const -{ - ACE_TRACE ("ACE_Unbounded_Set::is_full"); - return 0; // We should implement a "node of last resort for this..." -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Value_Ptr.h b/ace/Value_Ptr.h deleted file mode 100644 index 70570f9c34b..00000000000 --- a/ace/Value_Ptr.h +++ /dev/null @@ -1,167 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Value_Ptr.h - * - * $Id$ - * - * Value_Ptr implementation based on code in Herb Sutter's book "More - * Exceptional C++". - * - * @author Ossama Othman - */ -//========================================================================== - -#ifndef ACE_VALUE_PTR_H -#define ACE_VALUE_PTR_H - -#include "ace/config-lite.h" - -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE -{ - /** - * @struct VP_traits - * - * @brief @c Value_Ptr traits template structure. - * - * The @c Value_Ptr template class delegates some operations to this - * template traits structure. - * - * Specialize this trait template if cloning through copy - * construction is not sufficient. For example, to avoid slicing - * when copying an object through a base class pointer, one can - * implement a virtual "clone" method that can be used to - * polymorphically invoke the appropriate cloning operation(s). - * That virtual method would then be invoked by the @c VP_traits\<\> - * specialization. - */ - template - struct VP_traits - { - /// Copy the given object. - static T * clone (T const * p) { return new T (*p); } - }; - - /** - * @class Value_Ptr - * - * @brief Smart pointer implementation designed for use as a class - * member. - * - * Using a @c std::auto_ptr\<\> as a class member is sometimes - * problematic since ownership of memory is transferred when copying - * such members. This @c Value_Ptr class is explicitly designed to - * avoid such problems by performing copies of the underlying object - * rather than transfer ownership. This, for example, allows it to - * be readily used as a member in classes placed inside STL - * containers. - * - * @see Item 31 in "More Exceptional C++" by Herb Sutter. - */ - template - class Value_Ptr - { - public: - - /// Constructor. - explicit Value_Ptr (T * p = 0) : p_ (p) { } - - /// Destructor. - ~Value_Ptr (void) { delete this->p_; } - - /// Deference operator. - T & operator* (void) const { return *this->p_; } - - /// Pointer operator. - T * operator-> (void) const { return this->p_; } - - /// Non-throwing swap operation used to make assignment strongly - /// exception-safe. - /** - * @note As implemented, the swap operation may not work correctly - * for @c auto_ptr\<\>s, but why would one use an @c - * auto_ptr\<\> as the template argument for this particular - * template class!? - */ - void swap (Value_Ptr & other) { std::swap (this->p_, other.p_); } - - /// Copy constructor. - Value_Ptr (Value_Ptr const & other) - : p_ (create_from (other.p_)) { } - - /// Assignment operator. - Value_Ptr & operator= (Value_Ptr const & other) - { - // Strongly exception-safe. - Value_Ptr temp (other); - this->swap (temp); - return *this; - } - -#ifndef ACE_LACKS_MEMBER_TEMPLATES - - // Compiler can't handle member templates so we lose converting - // copy operations. - - /// Converting copy constructor. - template - Value_Ptr (Value_Ptr const & other) - : p_ (create_from (other.p_)) { } - - /// Converting assignment operator. - template - Value_Ptr & operator= (Value_Ptr const & other) - { - // Strongly exception-safe. - Value_Ptr temp (other); - this->swap (temp); - return *this; - } - -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ - - private: - -#ifndef ACE_LACKS_MEMBER_TEMPLATES - - /// Copying method invoked when copy constructing. - template - T * create_from (U const * p) const - { - return p ? VP_traits::clone (p) : 0; - } - -#else - - // Compiler can't handle member templates so we lose converting - // copy operations. - - /// Copying method invoked when copy constructing. - T * create_from (T const * p) const - { - return p ? VP_traits::clone (p) : 0; - } - -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ - - private: - -#ifndef ACE_LACKS_MEMBER_TEMPLATES - template friend class Value_Ptr; -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ - - /// Object owned by this @c Value_Ptr. - T * p_; - - }; - -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_VALUE_PTR_H */ diff --git a/ace/Vector_T.cpp b/ace/Vector_T.cpp deleted file mode 100644 index adf9727c6ff..00000000000 --- a/ace/Vector_T.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// $Id$ - -#ifndef ACE_VECTOR_T_CPP -#define ACE_VECTOR_T_CPP - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Vector_T.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Vector_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Vector) - -template -void ACE_Vector::resize (const size_t new_size, - const T& t) -{ - ACE_Array::size (new_size); - if (new_size > length_) - for (size_t i = length_; i < new_size; ++i) - (*this)[i]=t; - - curr_max_size_ = this->max_size (); - length_ = new_size; -} - -template -void ACE_Vector::push_back (const T& elem) -{ - if (length_ == curr_max_size_) - { - ACE_Array::size (curr_max_size_ * 2); - curr_max_size_ = this->max_size (); - } - ++length_; - (*this)[length_-1] = elem; -} - -template -void ACE_Vector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -#if 0 - // Can't do this unless the vector is an object with a dump - // function. - for (size_t i = 0; i < this->size (); ++i) - (*this)[i].dump (); -#endif /* 0 */ -#endif /* ACE_HAS_DUMP */ -} - -// Compare this vector with for equality. -template bool -ACE_Vector::operator== (const ACE_Vector &s) const -{ - if (this == &s) - return true; - else if (this->size () != s.size ()) - return false; - - const size_t len = s.size (); - for (size_t slot = 0; slot < len; ++slot) - if ((*this)[slot] != s[slot]) - return false; - - return true; -} - -#if 0 -template -int compare(const ACE_Vector& v1, - const ACE_Vector& v2, - const size_t from_ndx, - const size_t to_ndx) -{ - size_t last1 = v1.size () - 1; - size_t last2 = v2.size () - 1; - if (last1 < from_ndx || last1 < to_ndx) - { - return false; - } - if (last2 < from_ndx || last2 < to_ndx) - { - return false; - } - if (last1 != last2) - { - return false; - } - - // cout<<"compare() <================="<"< -int partial_compare(const ACE_Vector& v1, - const ACE_Vector& v2, - const size_t from_ndx, - const size_t to_ndx) -{ - size_t last1 = v1.size () - 1; - size_t last2 = v2.size () - 1; - if (last1 < from_ndx || last1 < to_ndx) - { - return false; - } - if (last2 < from_ndx || last2 < to_ndx) - { - return false; - } - // cout<<"partial_compare() <================="<"< int -ACE_Vector_Iterator::next (T *&item) -{ - // ACE_TRACE ("ACE_Vector_Iterator::next"); - - if (this->done ()) - { - item = 0; - return 0; - } - else - { - item = &vector_[current_]; - return 1; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_VECTOR_T_CPP */ diff --git a/ace/Vector_T.h b/ace/Vector_T.h deleted file mode 100644 index b82ea62b90e..00000000000 --- a/ace/Vector_T.h +++ /dev/null @@ -1,314 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Vector_T.h - * - * $Id$ - * - * @author Craig L. Ching - * @author Gonzalo Diethelm - */ -//========================================================================== - -#ifndef ACE_VECTOR_T_H -#define ACE_VECTOR_T_H - -#include /**/ "ace/pre.h" - -#include "ace/Array.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/* - * Default size for an ACE_Vector. - */ -static const size_t ACE_VECTOR_DEFAULT_SIZE = 32; - -// Forward declaration. -template class ACE_Vector_Iterator; - -/** - * @class ACE_Vector - * - * @brief Defines an STL-like vector container. - * - * This is an STL-like template vector container, a wrapper around - * ACE_Array. It provides at least the basic std::vector look and - * feel: push_back(), clear(), resize(), capacity(). This template - * class uses the copy semantic paradigm, though it is okay to use - * reference counted smart pointers (see ACE_Ptr<T>) with this - * template class. - * - * Requirements and Performance Characteristics - * - Internal Structure - * ACE_Array - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * N/A - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - */ -template -class ACE_Vector : public ACE_Array -{ -public: - /** - * A short name for iterator for ACE_Vector. - */ - typedef ACE_Vector_Iterator Iterator; - - - /** - * General constructor. - * - * @param init_size Initial size of the vector with the default - * value of DEFAULT_SIZE - * @param alloc Pointer to an ACE allocator. If it is NULL then the - * default ACE allocator is used - */ - ACE_Vector (const size_t init_size = DEFAULT_SIZE, - ACE_Allocator* alloc = 0); - - /** - * Destructor. - */ - ~ACE_Vector (); - - /** - * Returns the current vector capacity, that is, the currently - * allocated buffer size. - * - * @return Current buffer size of the vector - */ - size_t capacity (void) const; - - /** - * Returns the vector's dynamic size / actual current size of the - * vector. Do not confuse it with ACE_Array::size(), which returns - * the array's capacity. Unfortunately, ACE is not very consistent - * with the function names. - * - * @return Dynamic size / actual current size of the vector. - */ - size_t size (void) const; - - /** - * Clears out the vector. It does not reallocate the vector's - * buffer, it is just sets the vector's dynamic size to 0. - */ - void clear (void); - - /** - * Resizes the vector to the new capacity. If the vector's current - * capacity is smaller than the size to be specified, then the - * buffer gets reallocated. If the new capacity is less than the - * current capacity of the vector, the buffer size stays the same. - * - * @param new_size New capacity of the vector - * @param t A filler value (of the class T) for initializing the - * elements of the vector with. By default, if this - * parameter is not specified, the default value of the - * class T will be used (for more detail, see the - * initialization clause for this parameter). - */ - void resize (const size_t new_size, - const T& t); - - /** - * Appends a new element to the vector ("push back"). If the - * dynamic size of the vector is equal to the capacity of the vector - * (vector is at capacity), the vector automatically doubles its - * capacity. - * - * @param elem A reference to the new element to be appended. By - * default, this parameters gets initialized with the - * default value of the class T. - */ - void push_back (const T& elem); - - /** - * Deletes the last element from the vector ("pop back"). What this - * function really does is decrement the dynamic size of the - * vector. The vector's buffer does not get reallocated for - * performance. - */ - void pop_back (void); - - /** - * This function dumps the content of the vector. TO BE MOVED out - * of this class. It needs to be implemented as a global template - * function that accepts a const ACE_Vector<T>, in order to - * make instances of this class compile on Linux, AIX. G++ and xlC - * have template instantiation algoriths, which are different from - * the one in Visual C++. The algorithms try to instantiate ALL - * methods declared in the template class, regardless of whether the - * functions are used or not. That is, all of the classes, that are - * used as elements in ACE_Vector's, have to have the dump() methods - * defined in them (seems to be overkill). - * - * This function calls T::dump() for each element of the vector. - */ - void dump (void) const; - - // = Compare operators - - ///Equality comparison operator. - /** - * Compare this vector with @arg s for equality. Two vectors are equal - * if their sizes are equal and all the elements are equal. - */ - bool operator== (const ACE_Vector &s) const; - - ///Inequality comparison operator. - /** - * Compare this vector with @arg s for inequality such that @c *this != - * @arg s is always the complement of the boolean return value of - * @c *this == @arg s. - */ - bool operator!= (const ACE_Vector &s) const; - -protected: - - /** - * Dynamic size (length) of the vector. - */ - size_t length_; - - /** - * Current capacity (buffer size) of the vector. - */ - size_t curr_max_size_; - - friend class ACE_Vector_Iterator; -}; - -#if 0 -/* - * Not sure about including these functions, if for no other reason, - * because they polute the global namespace! - */ - -/** - * Compare two vectors in the range of [from_ndx..to_ndx]. This - * template function requires class T to have the bool operator!=() - * declared in the class. It is safe to define vectors of scalar data - * types, like int, double, etc., including class ACE_TString. - * - * @param v1 The first vector (out of the two) to be compared. - * @param v2 The Second vector (out of the two) to be compared. - * @param from_ndx Compare vector v1 and v2, starting with the - * "from_ndx" index . - * @param to_ndx Compare vector v1 and v2, from "from_ndx" to - * "to_ndx". - * @return Returns true if v1==v2 in the specified index range, - * returns false otherwise. Also, returns false in case if - * v1's size is not equal to v2's size. - */ -template -int compare (const ACE_Vector& v1, - const ACE_Vector& v2, - const size_t from_ndx, - const size_t to_ndx); - -/** - * Does a partial comparison of two vectors in the range of - * [from_ndx..to_ndx]. The only difference between this function and - * the template compare<T> function is that this function does - * not require v1 and v2 to be of equal size. - * - * @param v1 The first vector (out of the two) to be compared. - * @param v2 The Second vector (out of the two) to be compared. - * @param from_ndx Compare vector v1 and v2, starting with the - * "from_ndx" index . - * @param to_ndx Compare vector v1 and v2, from "from_ndx" to - * "to_ndx". - * @return Returns true if vector v1 and v2 are equal in the specified - * index range. - */ - -template -int partial_compare (const ACE_Vector& v1, - const ACE_Vector& v2, - const size_t from_ndx, - const size_t to_ndx); -#endif /* 0 */ -// **************************************************************** - -/** - * @class ACE_Vector_Iterator - * - * @brief Implement an iterator over an ACE_Vector. - * - * This iterator is safe in the face of vector element deletions. - * But it is NOT safe if the vector is resized via the assignment - * operator during iteration. That would be very odd, and dangerous. - */ -template -class ACE_Vector_Iterator -{ -public: - // = Initialization method. - ACE_Vector_Iterator (ACE_Vector &); - - // = Iteration methods. - - /// Pass back the that hasn't been seen in the vector. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the vector. Returns 0 when all the - /// items in the vector have been seen, else 1. - int advance (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Pointer to the current item in the iteration. - size_t current_; - - /// Reference to the vector we're iterating over. - ACE_Vector &vector_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Vector_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Vector_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Vector_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_VECTOR_T_H */ diff --git a/ace/Vector_T.inl b/ace/Vector_T.inl deleted file mode 100644 index aef981b447d..00000000000 --- a/ace/Vector_T.inl +++ /dev/null @@ -1,95 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Vector::ACE_Vector (const size_t init_size, - ACE_Allocator* alloc) - : ACE_Array (init_size == 0 ? DEFAULT_SIZE : init_size, alloc) -{ - length_ = 0; - curr_max_size_ = this->max_size (); -} - -template ACE_INLINE -ACE_Vector::~ACE_Vector () -{ -} - -template ACE_INLINE -size_t ACE_Vector::capacity (void) const -{ - return curr_max_size_; -} - -template ACE_INLINE -size_t ACE_Vector::size (void) const -{ - return length_; -} - -template ACE_INLINE -void ACE_Vector::clear (void) -{ - length_ = 0; -} - -template ACE_INLINE -void ACE_Vector::pop_back (void) -{ - if (length_ > 0) - --length_; -} - -// Compare this vector with for inequality. - -template ACE_INLINE bool -ACE_Vector::operator!= (const ACE_Vector &s) const -{ - return !(*this == s); -} - -// **************************************************************** - -template ACE_INLINE void -ACE_Vector_Iterator::dump (void) const -{ - // ACE_TRACE ("ACE_Vector_Iterator::dump"); -} - -template ACE_INLINE -ACE_Vector_Iterator::ACE_Vector_Iterator (ACE_Vector &v) - : current_ (0), - vector_ (v) -{ - // ACE_TRACE ("ACE_Vector_Iterator::ACE_Vector_Iterator"); -} - -template ACE_INLINE int -ACE_Vector_Iterator::advance (void) -{ - // ACE_TRACE ("ACE_Vector_Iterator::advance"); - - if (this->current_ < vector_.size ()) - { - ++this->current_; - return 1; - } - else - { - // Already finished iterating. - return 0; - } -} - -template ACE_INLINE int -ACE_Vector_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Vector_Iterator::done"); - - return this->current_ >= vector_.size (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Version.h b/ace/Version.h deleted file mode 100644 index 71ca7f854ea..00000000000 --- a/ace/Version.h +++ /dev/null @@ -1,10 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// This is file was automatically generated by $ACE_ROOT/bin/make_release. - -#define ACE_MAJOR_VERSION 5 -#define ACE_MINOR_VERSION 5 -#define ACE_BETA_VERSION 2 -#define ACE_VERSION "5.5.2" - diff --git a/ace/Versioned_Namespace.h b/ace/Versioned_Namespace.h deleted file mode 100644 index 542254876ff..00000000000 --- a/ace/Versioned_Namespace.h +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Versioned_Namespace.h - * - * $Id$ - * - * Versioned namespace support. - * - * Useful for preventing conflicts when using a third party library. - * - * @author Ossama Othman - */ -//============================================================================= - -#ifndef ACE_VERSIONED_NAMESPACE_H -#define ACE_VERSIONED_NAMESPACE_H - -#ifndef ACE_CONFIG_MACROS_H -# error This header is only meant to be included by or after "ace/config-lite.h". -#endif /* !ACE_CONFIG_LITE_H */ - - -#if defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1 - -# ifndef ACE_VERSIONED_NAMESPACE_NAME -//# include "ace/Version.h" - -// Preprocessor symbols will not be expanded if they are -// concatenated. Force the preprocessor to expand them during the -// argument prescan by calling a macro that itself calls another that -// performs the actual concatenation. -# define ACE_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA) ACE_ ## MAJOR ## _ ## MINOR ## _ ## BETA -# define ACE_MAKE_VERSIONED_NAMESPACE_NAME(MAJOR,MINOR,BETA) ACE_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA) -# define ACE_VERSIONED_NAMESPACE_NAME ACE_MAKE_VERSIONED_NAMESPACE_NAME(ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION) -# endif /* !ACE_VERSIONED_NAMESPACE_NAME */ - -# define ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_VERSIONED_NAMESPACE_NAME { -# define ACE_END_VERSIONED_NAMESPACE_DECL } \ - using namespace ACE_VERSIONED_NAMESPACE_NAME; - -#else - -# define ACE_VERSIONED_NAMESPACE_NAME -# define ACE_BEGIN_VERSIONED_NAMESPACE_DECL -# define ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_VERSIONED_NAMESPACE */ - -#endif /* !ACE_VERSIONED_NAMESPACE_H */ diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp deleted file mode 100644 index 536a43ee7e1..00000000000 --- a/ace/WFMO_Reactor.cpp +++ /dev/null @@ -1,2714 +0,0 @@ -// $Id$ - -#include "ace/WFMO_Reactor.h" - -#if defined (ACE_WIN32) - -#include "ace/Handle_Set.h" -#include "ace/Timer_Heap.h" -#include "ace/Thread.h" -#include "ace/OS_NS_errno.h" -#include "ace/Null_Condition.h" - -#if !defined (__ACE_INLINE__) -#include "ace/WFMO_Reactor.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(ace, WFMO_Reactor, "$Id$") - -#include "ace/Auto_Ptr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_WFMO_Reactor_Handler_Repository::ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor) - : wfmo_reactor_ (wfmo_reactor) -{ -} - -int -ACE_WFMO_Reactor_Handler_Repository::open (size_t size) -{ - if (size > MAXIMUM_WAIT_OBJECTS) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%d exceeds MAXIMUM_WAIT_OBJECTS (%d)\n"), - size, - MAXIMUM_WAIT_OBJECTS), - -1); - - // Dynamic allocation - ACE_NEW_RETURN (this->current_handles_, - ACE_HANDLE[size], - -1); - ACE_NEW_RETURN (this->current_info_, - Current_Info[size], - -1); - ACE_NEW_RETURN (this->current_suspended_info_, - Suspended_Info[size], - -1); - ACE_NEW_RETURN (this->to_be_added_info_, - To_Be_Added_Info[size], - -1); - - // Initialization - this->max_size_ = size; - this->max_handlep1_ = 0; - this->suspended_handles_ = 0; - this->handles_to_be_added_ = 0; - this->handles_to_be_deleted_ = 0; - this->handles_to_be_suspended_ = 0; - this->handles_to_be_resumed_ = 0; - - for (size_t i = 0; i < size; ++i) - this->current_handles_[i] = ACE_INVALID_HANDLE; - - return 0; -} - -ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void) -{ - // Free up dynamically allocated space - delete [] this->current_handles_; - delete [] this->current_info_; - delete [] this->current_suspended_info_; - delete [] this->to_be_added_info_; -} - -ACE_Reactor_Mask -ACE_WFMO_Reactor_Handler_Repository::bit_ops (long &existing_masks, - ACE_Reactor_Mask change_masks, - int operation) -{ - // Find the old reactor masks. This automatically does the work of - // the GET_MASK operation. - - ACE_Reactor_Mask old_masks = ACE_Event_Handler::NULL_MASK; - - if (ACE_BIT_ENABLED (existing_masks, FD_READ) - || ACE_BIT_ENABLED (existing_masks, FD_CLOSE)) - ACE_SET_BITS (old_masks, ACE_Event_Handler::READ_MASK); - - if (ACE_BIT_ENABLED (existing_masks, FD_WRITE)) - ACE_SET_BITS (old_masks, ACE_Event_Handler::WRITE_MASK); - - if (ACE_BIT_ENABLED (existing_masks, FD_OOB)) - ACE_SET_BITS (old_masks, ACE_Event_Handler::EXCEPT_MASK); - - if (ACE_BIT_ENABLED (existing_masks, FD_ACCEPT)) - ACE_SET_BITS (old_masks, ACE_Event_Handler::ACCEPT_MASK); - - if (ACE_BIT_ENABLED (existing_masks, FD_CONNECT)) - ACE_SET_BITS (old_masks, ACE_Event_Handler::CONNECT_MASK); - - if (ACE_BIT_ENABLED (existing_masks, FD_QOS)) - ACE_SET_BITS (old_masks, ACE_Event_Handler::QOS_MASK); - - if (ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS)) - ACE_SET_BITS (old_masks, ACE_Event_Handler::GROUP_QOS_MASK); - - switch (operation) - { - case ACE_Reactor::CLR_MASK: - // For the CLR_MASK operation, clear only the specific masks. - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK)) - { - ACE_CLR_BITS (existing_masks, FD_READ); - ACE_CLR_BITS (existing_masks, FD_CLOSE); - } - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK)) - ACE_CLR_BITS (existing_masks, FD_WRITE); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK)) - ACE_CLR_BITS (existing_masks, FD_OOB); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK)) - ACE_CLR_BITS (existing_masks, FD_ACCEPT); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK)) - ACE_CLR_BITS (existing_masks, FD_CONNECT); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK)) - ACE_CLR_BITS (existing_masks, FD_QOS); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK)) - ACE_CLR_BITS (existing_masks, FD_GROUP_QOS); - - break; - - case ACE_Reactor::SET_MASK: - // If the operation is a set, first reset any existing masks - - existing_masks = 0; - /* FALLTHRU */ - - case ACE_Reactor::ADD_MASK: - // For the ADD_MASK and the SET_MASK operation, add only the - // specific masks. - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK)) - { - ACE_SET_BITS (existing_masks, FD_READ); - ACE_SET_BITS (existing_masks, FD_CLOSE); - } - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK)) - ACE_SET_BITS (existing_masks, FD_WRITE); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK)) - ACE_SET_BITS (existing_masks, FD_OOB); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK)) - ACE_SET_BITS (existing_masks, FD_ACCEPT); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK)) - ACE_SET_BITS (existing_masks, FD_CONNECT); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK)) - ACE_SET_BITS (existing_masks, FD_QOS); - - if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK)) - ACE_SET_BITS (existing_masks, FD_GROUP_QOS); - - break; - - case ACE_Reactor::GET_MASK: - - // The work for this operation is done in all cases at the - // begining of the function. - - ACE_UNUSED_ARG (change_masks); - - break; - } - - return old_masks; -} - -int -ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int &changes_required) -{ - int error = 0; - - // Remember this value; only if it changes do we need to wakeup - // the other threads - size_t const original_handle_count = this->handles_to_be_deleted_; - int result = 0; - size_t i; - - // Go through all the handles looking for . Even if we find - // it, we continue through the rest of the list since could - // appear multiple times. All handles are checked. - - // First check the current entries - for (i = 0; i < this->max_handlep1_ && error == 0; ++i) - // Since the handle can either be the event or the I/O handle, - // we have to check both - if ((this->current_handles_[i] == handle - || this->current_info_[i].io_handle_ == handle) - && // Make sure that it is not already marked for deleted - !this->current_info_[i].delete_entry_) - { - result = this->remove_handler_i (i, - mask); - if (result == -1) - error = 1; - } - - // Then check the suspended entries - for (i = 0; i < this->suspended_handles_ && error == 0; ++i) - // Since the handle can either be the event or the I/O handle, we - // have to check both - if ((this->current_suspended_info_[i].io_handle_ == handle - || this->current_suspended_info_[i].event_handle_ == handle) - && - // Make sure that it is not already marked for deleted - !this->current_suspended_info_[i].delete_entry_) - { - result = this->remove_suspended_handler_i (i, - mask); - if (result == -1) - error = 1; - } - - // Then check the to_be_added entries - for (i = 0; i < this->handles_to_be_added_ && error == 0; ++i) - // Since the handle can either be the event or the I/O handle, - // we have to check both - if ((this->to_be_added_info_[i].io_handle_ == handle - || this->to_be_added_info_[i].event_handle_ == handle) - && - // Make sure that it is not already marked for deleted - !this->to_be_added_info_[i].delete_entry_) - { - result = this->remove_to_be_added_handler_i (i, - mask); - if (result == -1) - error = 1; - } - - // Only if the number of handlers to be deleted changes do we need - // to wakeup the other threads - if (original_handle_count < this->handles_to_be_deleted_) - changes_required = 1; - - return error ? -1 : 0; -} - -int -ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t slot, - ACE_Reactor_Mask to_be_removed_masks) -{ - // I/O entries - if (this->current_info_[slot].io_entry_) - { - // See if there are other events that the is - // interested in - this->bit_ops (this->current_info_[slot].network_events_, - to_be_removed_masks, - ACE_Reactor::CLR_MASK); - - // Disassociate/Reassociate the event from/with the I/O handle. - // This will depend on the value of remaining set of network - // events that the is interested in. I don't - // think we can do anything about errors here, so I will not - // check this. - ::WSAEventSelect ((SOCKET) this->current_info_[slot].io_handle_, - this->current_handles_[slot], - this->current_info_[slot].network_events_); - } - // Normal event entries. - else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL)) - // Preserve DONT_CALL - to_be_removed_masks = ACE_Event_Handler::DONT_CALL; - else - // Make sure that the is the NULL_MASK - to_be_removed_masks = ACE_Event_Handler::NULL_MASK; - - // If this event was marked for suspension, undo the suspension flag - // and reduce the to be suspended count. - if (this->current_info_[slot].suspend_entry_) - { - // Undo suspension - this->current_info_[slot].suspend_entry_ = 0; - // Decrement the handle count - --this->handles_to_be_suspended_; - } - - // If there are no more events that the is - // interested in, or this is a non-I/O entry, schedule the - // for removal - if (this->current_info_[slot].network_events_ == 0) - { - // Mark to be deleted - this->current_info_[slot].delete_entry_ = 1; - // Remember the mask - this->current_info_[slot].close_masks_ = to_be_removed_masks; - // Increment the handle count - ++this->handles_to_be_deleted_; - } - - // Since it is not a complete removal, we'll call handle_close - // for all the masks that were removed. This does not change - // the internal state of the reactor. - // - // Note: this condition only applies to I/O entries - else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0) - { - ACE_HANDLE handle = this->current_info_[slot].io_handle_; - this->current_info_[slot].event_handler_->handle_close (handle, - to_be_removed_masks); - } - - return 0; -} - -int -ACE_WFMO_Reactor_Handler_Repository::remove_suspended_handler_i (size_t slot, - ACE_Reactor_Mask to_be_removed_masks) -{ - // I/O entries - if (this->current_suspended_info_[slot].io_entry_) - { - // See if there are other events that the is - // interested in - this->bit_ops (this->current_suspended_info_[slot].network_events_, - to_be_removed_masks, - ACE_Reactor::CLR_MASK); - - // Disassociate/Reassociate the event from/with the I/O handle. - // This will depend on the value of remaining set of network - // events that the is interested in. I don't - // think we can do anything about errors here, so I will not - // check this. - ::WSAEventSelect ((SOCKET) this->current_suspended_info_[slot].io_handle_, - this->current_suspended_info_[slot].event_handle_, - this->current_suspended_info_[slot].network_events_); - } - // Normal event entries. - else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL)) - // Preserve DONT_CALL - to_be_removed_masks = ACE_Event_Handler::DONT_CALL; - else - // Make sure that the is the NULL_MASK - to_be_removed_masks = ACE_Event_Handler::NULL_MASK; - - // If this event was marked for resumption, undo the resumption flag - // and reduce the to be resumed count. - if (this->current_suspended_info_[slot].resume_entry_) - { - // Undo resumption - this->current_suspended_info_[slot].resume_entry_ = 0; - // Decrement the handle count - --this->handles_to_be_resumed_; - } - - // If there are no more events that the is - // interested in, or this is a non-I/O entry, schedule the - // for removal - if (this->current_suspended_info_[slot].network_events_ == 0) - { - // Mark to be deleted - this->current_suspended_info_[slot].delete_entry_ = 1; - // Remember the mask - this->current_suspended_info_[slot].close_masks_ = to_be_removed_masks; - // Increment the handle count - ++this->handles_to_be_deleted_; - } - // Since it is not a complete removal, we'll call handle_close for - // all the masks that were removed. This does not change the - // internal state of the reactor. - // - // Note: this condition only applies to I/O entries - else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0) - { - ACE_HANDLE handle = this->current_suspended_info_[slot].io_handle_; - this->current_suspended_info_[slot].event_handler_->handle_close (handle, - to_be_removed_masks); - } - - return 0; -} - -int -ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i (size_t slot, - ACE_Reactor_Mask to_be_removed_masks) -{ - // I/O entries - if (this->to_be_added_info_[slot].io_entry_) - { - // See if there are other events that the is - // interested in - this->bit_ops (this->to_be_added_info_[slot].network_events_, - to_be_removed_masks, - ACE_Reactor::CLR_MASK); - - // Disassociate/Reassociate the event from/with the I/O handle. - // This will depend on the value of remaining set of network - // events that the is interested in. I don't - // think we can do anything about errors here, so I will not - // check this. - ::WSAEventSelect ((SOCKET) this->to_be_added_info_[slot].io_handle_, - this->to_be_added_info_[slot].event_handle_, - this->to_be_added_info_[slot].network_events_); - } - // Normal event entries. - else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL)) - // Preserve DONT_CALL - to_be_removed_masks = ACE_Event_Handler::DONT_CALL; - else - // Make sure that the is the NULL_MASK - to_be_removed_masks = ACE_Event_Handler::NULL_MASK; - - // If this event was marked for suspension, undo the suspension flag - // and reduce the to be suspended count. - if (this->to_be_added_info_[slot].suspend_entry_) - { - // Undo suspension - this->to_be_added_info_[slot].suspend_entry_ = 0; - // Decrement the handle count - --this->handles_to_be_suspended_; - } - - // If there are no more events that the is - // interested in, or this is a non-I/O entry, schedule the - // for removal - if (this->to_be_added_info_[slot].network_events_ == 0) - { - // Mark to be deleted - this->to_be_added_info_[slot].delete_entry_ = 1; - // Remember the mask - this->to_be_added_info_[slot].close_masks_ = to_be_removed_masks; - // Increment the handle count - ++this->handles_to_be_deleted_; - } - // Since it is not a complete removal, we'll call handle_close - // for all the masks that were removed. This does not change - // the internal state of the reactor. - // - // Note: this condition only applies to I/O entries - else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0) - { - ACE_HANDLE handle = this->to_be_added_info_[slot].io_handle_; - this->to_be_added_info_[slot].event_handler_->handle_close (handle, - to_be_removed_masks); - } - - return 0; -} - -int -ACE_WFMO_Reactor_Handler_Repository::suspend_handler_i (ACE_HANDLE handle, - int &changes_required) -{ - size_t i = 0; - - // Go through all the handles looking for . Even if we find - // it, we continue through the rest of the list since could - // appear multiple times. All handles are checked. - - // Check the current entries first. - for (i = 0; i < this->max_handlep1_; ++i) - // Since the handle can either be the event or the I/O handle, - // we have to check both - if ((this->current_handles_[i] == handle || - this->current_info_[i].io_handle_ == handle) && - // Make sure that it is not already marked for suspension - !this->current_info_[i].suspend_entry_) - { - // Mark to be suspended - this->current_info_[i].suspend_entry_ = 1; - // Increment the handle count - ++this->handles_to_be_suspended_; - // Changes will be required - changes_required = 1; - } - - // Then check the suspended entries. - for (i = 0; i < this->suspended_handles_; ++i) - // Since the handle can either be the event or the I/O handle, - // we have to check both - if ((this->current_suspended_info_[i].event_handle_ == handle || - this->current_suspended_info_[i].io_handle_ == handle) && - // Make sure that the resumption is not already undone - this->current_suspended_info_[i].resume_entry_) - { - // Undo resumption - this->current_suspended_info_[i].resume_entry_ = 0; - // Decrement the handle count - --this->handles_to_be_resumed_; - // Changes will be required - changes_required = 1; - } - - // Then check the to_be_added entries. - for (i = 0; i < this->handles_to_be_added_; ++i) - // Since the handle can either be the event or the I/O handle, - // we have to check both - if ((this->to_be_added_info_[i].io_handle_ == handle || - this->to_be_added_info_[i].event_handle_ == handle) && - // Make sure that it is not already marked for suspension - !this->to_be_added_info_[i].suspend_entry_) - { - // Mark to be suspended - this->to_be_added_info_[i].suspend_entry_ = 1; - // Increment the handle count - ++this->handles_to_be_suspended_; - // Changes will be required - changes_required = 1; - } - - return 0; -} - -int -ACE_WFMO_Reactor_Handler_Repository::resume_handler_i (ACE_HANDLE handle, - int &changes_required) -{ - size_t i = 0; - - // Go through all the handles looking for . Even if we find - // it, we continue through the rest of the list since could - // appear multiple times. All handles are checked. - - // Check the current entries first. - for (i = 0; i < this->max_handlep1_; ++i) - // Since the handle can either be the event or the I/O handle, - // we have to check both - if ((this->current_handles_[i] == handle || - this->current_info_[i].io_handle_ == handle) && - // Make sure that the suspension is not already undone - this->current_info_[i].suspend_entry_) - { - // Undo suspension - this->current_info_[i].suspend_entry_ = 0; - // Decrement the handle count - --this->handles_to_be_suspended_; - // Changes will be required - changes_required = 1; - } - - // Then check the suspended entries. - for (i = 0; i < this->suspended_handles_; ++i) - // Since the handle can either be the event or the I/O handle, - // we have to check both - if ((this->current_suspended_info_[i].event_handle_ == handle || - this->current_suspended_info_[i].io_handle_ == handle) && - // Make sure that it is not already marked for resumption - !this->current_suspended_info_[i].resume_entry_) - { - // Mark to be resumed - this->current_suspended_info_[i].resume_entry_ = 1; - // Increment the handle count - ++this->handles_to_be_resumed_; - // Changes will be required - changes_required = 1; - } - - // Then check the to_be_added entries. - for (i = 0; i < this->handles_to_be_added_; ++i) - // Since the handle can either be the event or the I/O handle, - // we have to check both - if ((this->to_be_added_info_[i].io_handle_ == handle || - this->to_be_added_info_[i].event_handle_ == handle) && - // Make sure that the suspension is not already undone - this->to_be_added_info_[i].suspend_entry_) - { - // Undo suspension - this->to_be_added_info_[i].suspend_entry_ = 0; - // Decrement the handle count - --this->handles_to_be_suspended_; - // Changes will be required - changes_required = 1; - } - - return 0; -} - -void -ACE_WFMO_Reactor_Handler_Repository::unbind_all (void) -{ - { - ACE_GUARD (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_); - - int dummy; - size_t i; - - // Remove all the current handlers - for (i = 0; i < this->max_handlep1_; ++i) - this->unbind_i (this->current_handles_[i], - ACE_Event_Handler::ALL_EVENTS_MASK, - dummy); - - // Remove all the suspended handlers - for (i = 0; i < this->suspended_handles_; ++i) - this->unbind_i (this->current_suspended_info_[i].event_handle_, - ACE_Event_Handler::ALL_EVENTS_MASK, - dummy); - - // Remove all the to_be_added handlers - for (i = 0; i < this->handles_to_be_added_; ++i) - this->unbind_i (this->to_be_added_info_[i].event_handle_, - ACE_Event_Handler::ALL_EVENTS_MASK, - dummy); - - } - - // The guard is released here - - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wfmo_reactor_.wakeup_all_threads (); -} - -int -ACE_WFMO_Reactor_Handler_Repository::bind_i (int io_entry, - ACE_Event_Handler *event_handler, - long network_events, - ACE_HANDLE io_handle, - ACE_HANDLE event_handle, - int delete_event) -{ - // Make sure that the is valid - if (event_handle == ACE_INVALID_HANDLE) - event_handle = event_handler->get_handle (); - if (this->invalid_handle (event_handle)) - return -1; - - size_t current_size = this->max_handlep1_ + - this->handles_to_be_added_ - - this->handles_to_be_deleted_ + - this->suspended_handles_; - - // Make sure that there's room in the table and that total pending - // additions should not exceed what the array - // can hold. - if (current_size < this->max_size_ && - this->handles_to_be_added_ < this->max_size_) - { - // Cache this set into the , till we come - // around to actually adding this to the - this->to_be_added_info_[this->handles_to_be_added_].set (event_handle, - io_entry, - event_handler, - io_handle, - network_events, - delete_event); - - ++this->handles_to_be_added_; - - event_handler->add_reference (); - - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wfmo_reactor_.wakeup_all_threads (); - } - else - { - errno = EMFILE; // File descriptor table is full (better than nothing) - return -1; - } - - return 0; -} - -int -ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void) -{ - // Go through the entire valid array and check for all handles that - // have been schedule for deletion - if (this->handles_to_be_deleted_ > 0 || this->handles_to_be_suspended_ > 0) - { - size_t i = 0; - while (i < this->max_handlep1_) - { - // This stuff is necessary here, since we should not make - // the upcall until all the internal data structures have - // been updated. This is to protect against upcalls that - // try to deregister again. - ACE_HANDLE handle = ACE_INVALID_HANDLE; - ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK; - ACE_Event_Handler *event_handler = 0; - - // See if this entry is scheduled for deletion - if (this->current_info_[i].delete_entry_) - { - // Calling the method here will ensure that we - // will only call it once per deregistering . - // This is essential in the case when the will - // do something like delete itself and we have multiple - // threads in WFMO_Reactor. - // - // Make sure that the DONT_CALL mask is not set - masks = this->current_info_[i].close_masks_; - if (ACE_BIT_ENABLED (masks, ACE_Event_Handler::DONT_CALL) == 0) - { - // Grab the correct handle depending on the type entry - if (this->current_info_[i].io_entry_) - handle = this->current_info_[i].io_handle_; - else - handle = this->current_handles_[i]; - - // Event handler - event_handler = this->current_info_[i].event_handler_; - } - - // If created the event, we need to clean it up - if (this->current_info_[i].delete_event_) - ACE_OS::event_destroy (&this->current_handles_[i]); - - // Reduce count by one - --this->handles_to_be_deleted_; - } - - // See if this entry is scheduled for suspension - else if (this->current_info_[i].suspend_entry_) - { - this->current_suspended_info_ [this->suspended_handles_].set (this->current_handles_[i], - this->current_info_[i]); - // Increase number of suspended handles - ++this->suspended_handles_; - - // Reduce count by one - --this->handles_to_be_suspended_; - } - - // See if this entry is scheduled for deletion or suspension - // If so we need to clean up - if (this->current_info_[i].delete_entry_ || - this->current_info_[i].suspend_entry_ ) - { - size_t last_valid_slot = this->max_handlep1_ - 1; - // If this is the last handle in the set, no need to swap - // places. Simply remove it. - if (i < last_valid_slot) - // Swap this handle with the last valid handle - { - // Struct copy - this->current_info_[i] = - this->current_info_[last_valid_slot]; - this->current_handles_[i] = - this->current_handles_[last_valid_slot]; - } - // Reset the info in this slot - this->current_info_[last_valid_slot].reset (); - this->current_handles_[last_valid_slot] = ACE_INVALID_HANDLE; - --this->max_handlep1_; - } - else - { - // This current entry is not up for deletion or - // suspension. Proceed to the next entry in the current - // handles. - ++i; - } - - // Now that all internal structures have been updated, make - // the upcall. - if (event_handler != 0) - { - int requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - event_handler->handle_close (handle, masks); - - if (requires_reference_counting) - { - event_handler->remove_reference (); - } - } - } - } - - return 0; -} - -int -ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void) -{ - // Go through the array - if (this->handles_to_be_deleted_ > 0 || this->handles_to_be_resumed_ > 0) - { - size_t i = 0; - while (i < this->suspended_handles_) - { - // This stuff is necessary here, since we should not make - // the upcall until all the internal data structures have - // been updated. This is to protect against upcalls that - // try to deregister again. - ACE_HANDLE handle = ACE_INVALID_HANDLE; - ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK; - ACE_Event_Handler *event_handler = 0; - - // See if this entry is scheduled for deletion - if (this->current_suspended_info_[i].delete_entry_) - { - // Calling the method here will ensure that we - // will only call it once per deregistering . - // This is essential in the case when the will - // do something like delete itself and we have multiple - // threads in WFMO_Reactor. - // - // Make sure that the DONT_CALL mask is not set - masks = this->current_suspended_info_[i].close_masks_; - if (ACE_BIT_ENABLED (masks, ACE_Event_Handler::DONT_CALL) == 0) - { - // Grab the correct handle depending on the type entry - if (this->current_suspended_info_[i].io_entry_) - handle = this->current_suspended_info_[i].io_handle_; - else - handle = this->current_suspended_info_[i].event_handle_; - - // Upcall - event_handler = this->current_suspended_info_[i].event_handler_; - } - - // If created the event, we need to clean it up - if (this->current_suspended_info_[i].delete_event_) - ACE_OS::event_destroy (&this->current_suspended_info_[i].event_handle_); - - // Reduce count by one - --this->handles_to_be_deleted_; - } - - else if (this->current_suspended_info_[i].resume_entry_) - { - // Add to the end of the current handles set - this->current_handles_[this->max_handlep1_] = this->current_suspended_info_[i].event_handle_; - // Struct copy - this->current_info_[this->max_handlep1_].set (this->current_suspended_info_[i]); - ++this->max_handlep1_; - - // Reduce count by one - --this->handles_to_be_resumed_; - } - - // If an entry needs to be removed, either because it - // was deleted or resumed, remove it now before doing - // the upcall. - if (this->current_suspended_info_[i].resume_entry_ || - this->current_suspended_info_[i].delete_entry_) - { - size_t last_valid_slot = this->suspended_handles_ - 1; - // Net effect is that we're removing an entry and - // compressing the list from the end. So, if removing - // an entry from the middle, copy the last valid one to the - // removed slot. Reset the end and decrement the number - // of suspended handles. - if (i < last_valid_slot) - // Struct copy - this->current_suspended_info_[i] = - this->current_suspended_info_[last_valid_slot]; - this->current_suspended_info_[last_valid_slot].reset (); - --this->suspended_handles_; - } - else - { - // This current entry is not up for deletion or - // resumption. Proceed to the next entry in the - // suspended handles. - ++i; - } - - // Now that all internal structures have been updated, make - // the upcall. - if (event_handler != 0) - { - int requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - event_handler->handle_close (handle, masks); - - if (requires_reference_counting) - { - event_handler->remove_reference (); - } - } - } - } - - return 0; -} - -int -ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void) -{ - // Go through the arrays - for (size_t i = 0; i < this->handles_to_be_added_; ++i) - { - // This stuff is necessary here, since we should not make - // the upcall until all the internal data structures have - // been updated. This is to protect against upcalls that - // try to deregister again. - ACE_HANDLE handle = ACE_INVALID_HANDLE; - ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK; - ACE_Event_Handler *event_handler = 0; - - // See if this entry is scheduled for deletion - if (this->to_be_added_info_[i].delete_entry_) - { - // Calling the method here will ensure that we - // will only call it once per deregistering . - // This is essential in the case when the will - // do something like delete itself and we have multiple - // threads in WFMO_Reactor. - // - // Make sure that the DONT_CALL mask is not set - masks = this->to_be_added_info_[i].close_masks_; - if (ACE_BIT_ENABLED (masks, ACE_Event_Handler::DONT_CALL) == 0) - { - // Grab the correct handle depending on the type entry - if (this->to_be_added_info_[i].io_entry_) - handle = this->to_be_added_info_[i].io_handle_; - else - handle = this->to_be_added_info_[i].event_handle_; - - // Upcall - event_handler = this->to_be_added_info_[i].event_handler_; - } - - // If created the event, we need to clean it up - if (this->to_be_added_info_[i].delete_event_) - ACE_OS::event_destroy (&this->to_be_added_info_[i].event_handle_); - - // Reduce count by one - --this->handles_to_be_deleted_; - } - - // See if this entry is scheduled for suspension - else if (this->to_be_added_info_[i].suspend_entry_) - { - this->current_suspended_info_ [this->suspended_handles_].set (this->to_be_added_info_[i].event_handle_, - this->to_be_added_info_[i]); - // Increase number of suspended handles - ++this->suspended_handles_; - - // Reduce count by one - --this->handles_to_be_suspended_; - } - - // If neither of the two flags are on, add to current - else - { - // Add to the end of the current handles set - this->current_handles_[this->max_handlep1_] = this->to_be_added_info_[i].event_handle_; - // Struct copy - this->current_info_[this->max_handlep1_].set (this->to_be_added_info_[i]); - ++this->max_handlep1_; - } - - // Reset the - this->to_be_added_info_[i].reset (); - - // Now that all internal structures have been updated, make the - // upcall. - if (event_handler != 0) - { - int requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - event_handler->handle_close (handle, masks); - - if (requires_reference_counting) - { - event_handler->remove_reference (); - } - } - } - - // Since all to be added handles have been taken care of, reset the - // counter - this->handles_to_be_added_ = 0; - - return 0; -} - -void -ACE_WFMO_Reactor_Handler_Repository::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - size_t i = 0; - - ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Max size = %d\n"), - this->max_size_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Current info table\n\n"))); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\tSize = %d\n"), - this->max_handlep1_)); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\tHandles to be suspended = %d\n"), - this->handles_to_be_suspended_)); - - for (i = 0; i < this->max_handlep1_; ++i) - this->current_info_[i].dump (this->current_handles_[i]); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\n"))); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("To-be-added info table\n\n"))); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\tSize = %d\n"), - this->handles_to_be_added_)); - - for (i = 0; i < this->handles_to_be_added_; ++i) - this->to_be_added_info_[i].dump (); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\n"))); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Suspended info table\n\n"))); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\tSize = %d\n"), - this->suspended_handles_)); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\tHandles to be resumed = %d\n"), - this->handles_to_be_resumed_)); - - for (i = 0; i < this->suspended_handles_; ++i) - this->current_suspended_info_[i].dump (); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\n"))); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Total handles to be deleted = %d\n"), - this->handles_to_be_deleted_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -/************************************************************/ - -int -ACE_WFMO_Reactor::work_pending (const ACE_Time_Value &) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_WFMO_Reactor::ACE_WFMO_Reactor (ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - ACE_Reactor_Notify *notify) - : signal_handler_ (0), - delete_signal_handler_ (0), - timer_queue_ (0), - delete_timer_queue_ (0), - delete_handler_rep_ (0), - delete_notify_handler_ (0), - lock_adapter_ (lock_), - handler_rep_ (*this), - // this event is initially signaled - ok_to_wait_ (1), - // this event is initially unsignaled - wakeup_all_threads_ (0), - // this event is initially unsignaled - waiting_to_change_state_ (0), - active_threads_ (0), - owner_ (ACE_Thread::self ()), - new_owner_ (0), - change_state_thread_ (0), - open_for_business_ (0), - deactivated_ (0) -{ - if (this->open (ACE_WFMO_Reactor::DEFAULT_SIZE, 0, sh, tq, 0, notify) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("WFMO_Reactor"))); -} - -ACE_WFMO_Reactor::ACE_WFMO_Reactor (size_t size, - int unused, - ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - ACE_Reactor_Notify *notify) - : signal_handler_ (0), - delete_signal_handler_ (0), - timer_queue_ (0), - delete_timer_queue_ (0), - delete_handler_rep_ (0), - delete_notify_handler_ (0), - lock_adapter_ (lock_), - handler_rep_ (*this), - // this event is initially signaled - ok_to_wait_ (1), - // this event is initially unsignaled - wakeup_all_threads_ (0), - // this event is initially unsignaled - waiting_to_change_state_ (0), - active_threads_ (0), - owner_ (ACE_Thread::self ()), - new_owner_ (0), - change_state_thread_ (0), - open_for_business_ (0), - deactivated_ (0) -{ - ACE_UNUSED_ARG (unused); - - if (this->open (size, 0, sh, tq, 0, notify) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("WFMO_Reactor"))); -} - -int -ACE_WFMO_Reactor::current_info (ACE_HANDLE, size_t &) -{ - return -1; -} - -int -ACE_WFMO_Reactor::open (size_t size, - int unused, - ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify) -{ - ACE_UNUSED_ARG (unused); - ACE_UNUSED_ARG (disable_notify_pipe); - - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - // If we are already open, return -1 - if (this->open_for_business_) - return -1; - - // Timer Queue - if (this->delete_timer_queue_) - delete this->timer_queue_; - - if (tq == 0) - { - ACE_NEW_RETURN (this->timer_queue_, - ACE_Timer_Heap, - -1); - this->delete_timer_queue_ = 1; - } - else - { - this->timer_queue_ = tq; - this->delete_timer_queue_ = 0; - } - - // Signal Handler - if (this->delete_signal_handler_) - delete this->signal_handler_; - - if (sh == 0) - { - ACE_NEW_RETURN (this->signal_handler_, - ACE_Sig_Handler, - -1); - this->delete_signal_handler_ = 1; - } - else - { - this->signal_handler_ = sh; - this->delete_signal_handler_ = 0; - } - - // Setup the atomic wait array (used later in ) - this->atomic_wait_array_[0] = this->lock_.lock ().proc_mutex_; - this->atomic_wait_array_[1] = this->ok_to_wait_.handle (); - - // Prevent memory leaks when the ACE_WFMO_Reactor is reopened. - if (this->delete_handler_rep_) - { - if (this->handler_rep_.changes_required ()) - { - // Make necessary changes to the handler repository - this->handler_rep_.make_changes (); - // Turn off since all necessary changes - // have completed - this->wakeup_all_threads_.reset (); - } - - this->handler_rep_.~ACE_WFMO_Reactor_Handler_Repository (); - } - - // Open the handle repository. Two additional handles for internal - // purposes - if (this->handler_rep_.open (size + 2) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("opening handler repository")), - -1); - else - this->delete_handler_rep_ = 1; - - if (this->notify_handler_ != 0 - && this->delete_notify_handler_ != 0) - delete this->notify_handler_; - - this->notify_handler_ = notify; - - if (this->notify_handler_ == 0) - { - ACE_NEW_RETURN (this->notify_handler_, - ACE_WFMO_Reactor_Notify, - -1); - - if (this->notify_handler_ == 0) - return -1; - else - this->delete_notify_handler_ = 1; - } - - /* NOTE */ - // The order of the following two registrations is very important - - // Open the notification handler - if (this->notify_handler_->open (this, this->timer_queue_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("opening notify handler ")), - -1); - - // Register for event - if (this->register_handler (&this->wakeup_all_threads_handler_, - this->wakeup_all_threads_.handle ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("registering thread wakeup handler")), - -1); - - // Since we have added two handles into the handler repository, - // update the - if (this->handler_rep_.changes_required ()) - { - // Make necessary changes to the handler repository - this->handler_rep_.make_changes (); - // Turn off since all necessary changes - // have completed - this->wakeup_all_threads_.reset (); - } - - // We are open for business - this->open_for_business_ = 1; - - return 0; -} - -int -ACE_WFMO_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler) -{ - if (this->signal_handler_ != 0 && this->delete_signal_handler_ != 0) - delete this->signal_handler_; - this->signal_handler_ = signal_handler; - this->delete_signal_handler_ = 0; - return 0; -} - -ACE_Timer_Queue * -ACE_WFMO_Reactor::timer_queue (void) const -{ - return this->timer_queue_; -} - -int -ACE_WFMO_Reactor::timer_queue (ACE_Timer_Queue *tq) -{ - if (this->timer_queue_ != 0 && this->delete_timer_queue_ != 0) - delete this->timer_queue_; - this->timer_queue_ = tq; - this->delete_timer_queue_ = 0; - return 0; -} - -int -ACE_WFMO_Reactor::close (void) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - // If we are already closed, return error - if (!this->open_for_business_) - return -1; - - // We are now closed - this->open_for_business_ = 0; - // This will unregister all handles - this->handler_rep_.close (); - - return 0; -} - -ACE_WFMO_Reactor::~ACE_WFMO_Reactor (void) -{ - // Assumption: No threads are left in the Reactor when this method - // is called (i.e., active_threads_ == 0) - - // Close down - this->close (); - - // Make necessary changes to the handler repository that we caused - // by . - this->handler_rep_.make_changes (); - - if (this->delete_timer_queue_) - { - delete this->timer_queue_; - this->timer_queue_ = 0; - this->delete_timer_queue_ = 0; - } - - if (this->delete_signal_handler_) - { - delete this->signal_handler_; - this->signal_handler_ = 0; - this->delete_signal_handler_ = 0; - } - - if (this->delete_notify_handler_) - { - delete this->notify_handler_; - this->notify_handler_ = 0; - this->delete_notify_handler_ = 0; - } -} - -int -ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask new_masks) -{ - // If this is a Winsock 1 system, the underlying event assignment will - // not work, so don't try. Winsock 1 must use ACE_Select_Reactor for - // reacting to socket activity. - -#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) - - ACE_UNUSED_ARG (event_handle); - ACE_UNUSED_ARG (io_handle); - ACE_UNUSED_ARG (event_handler); - ACE_UNUSED_ARG (new_masks); - ACE_NOTSUP_RETURN (-1); - -#else - - // Make sure that the is valid - if (io_handle == ACE_INVALID_HANDLE) - io_handle = event_handler->get_handle (); - - if (this->handler_rep_.invalid_handle (io_handle)) - { - errno = ERROR_INVALID_HANDLE; - return -1; - } - - long new_network_events = 0; - int delete_event = 0; - auto_ptr event; - - // Look up the repository to see if the is already - // there. - ACE_Reactor_Mask old_masks; - int found = this->handler_rep_.modify_network_events_i (io_handle, - new_masks, - old_masks, - new_network_events, - event_handle, - delete_event, - ACE_Reactor::ADD_MASK); - - // Check to see if the user passed us a valid event; If not then we - // need to create one - if (event_handle == ACE_INVALID_HANDLE) - { - // Note: don't change this since some C++ compilers have - // s that don't work properly... - auto_ptr tmp (new ACE_Auto_Event); - event = tmp; - event_handle = event->handle (); - delete_event = 1; - } - - int result = ::WSAEventSelect ((SOCKET) io_handle, - event_handle, - new_network_events); - // If we had found the there is nothing more to do - if (found) - return result; - else if (result != SOCKET_ERROR && - this->handler_rep_.bind_i (1, - event_handler, - new_network_events, - io_handle, - event_handle, - delete_event) != -1) - { - // The was not found in the repository, add to - // the repository. - if (delete_event) - { - // Clear out the handle in the ACE_Auto_Event so that when - // it is destroyed, the handle isn't closed out from under - // the reactor. After setting it, running down the event - // (via auto_ptr<> event, above) at function return will - // cause an error because it'll try to close an invalid handle. - // To avoid that smashing the errno value, save the errno - // here, explicitly remove the event so the dtor won't do it - // again, then restore errno. - ACE_Errno_Guard guard (errno); - event->handle (ACE_INVALID_HANDLE); - event->remove (); - } - return 0; - } - else - return -1; - -#endif /* ACE_HAS_WINSOCK2 || ACE_HAS_WINSOCK2 == 0 */ - -} - -int -ACE_WFMO_Reactor::mask_ops_i (ACE_HANDLE io_handle, - ACE_Reactor_Mask new_masks, - int operation) -{ - // Make sure that the is valid - if (this->handler_rep_.invalid_handle (io_handle)) - return -1; - - long new_network_events = 0; - int delete_event = 0; - ACE_HANDLE event_handle = ACE_INVALID_HANDLE; - - // Look up the repository to see if the is already - // there. - ACE_Reactor_Mask old_masks; - int found = this->handler_rep_.modify_network_events_i (io_handle, - new_masks, - old_masks, - new_network_events, - event_handle, - delete_event, - operation); - if (found) - { - int result = ::WSAEventSelect ((SOCKET) io_handle, - event_handle, - new_network_events); - if (result == 0) - return old_masks; - else - return result; - } - else - return -1; -} - - - -int -ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_handle, - ACE_Reactor_Mask new_masks, - ACE_Reactor_Mask &old_masks, - long &new_network_events, - ACE_HANDLE &event_handle, - int &delete_event, - int operation) -{ - long *modified_network_events = &new_network_events; - int found = 0; - size_t i; - - // First go through the current entries - // - // Look for all entries in the current handles for matching handle - // (except those that have been scheduled for deletion) - for (i = 0; i < this->max_handlep1_ && !found; ++i) - if (io_handle == this->current_info_[i].io_handle_ && - !this->current_info_[i].delete_entry_) - { - found = 1; - modified_network_events = &this->current_info_[i].network_events_; - delete_event = this->current_info_[i].delete_event_; - event_handle = this->current_handles_[i]; - } - - // Then pass through the suspended handles - // - // Look for all entries in the suspended handles for matching handle - // (except those that have been scheduled for deletion) - for (i = 0; i < this->suspended_handles_ && !found; ++i) - if (io_handle == this->current_suspended_info_[i].io_handle_ && - !this->current_suspended_info_[i].delete_entry_) - { - found = 1; - modified_network_events = &this->current_suspended_info_[i].network_events_; - delete_event = this->current_suspended_info_[i].delete_event_; - event_handle = this->current_suspended_info_[i].event_handle_; - } - - // Then check the to_be_added handles - // - // Look for all entries in the to_be_added handles for matching - // handle (except those that have been scheduled for deletion) - for (i = 0; i < this->handles_to_be_added_ && !found; ++i) - if (io_handle == this->to_be_added_info_[i].io_handle_ && - !this->to_be_added_info_[i].delete_entry_) - { - found = 1; - modified_network_events = &this->to_be_added_info_[i].network_events_; - delete_event = this->to_be_added_info_[i].delete_event_; - event_handle = this->to_be_added_info_[i].event_handle_; - } - - old_masks = this->bit_ops (*modified_network_events, - new_masks, - operation); - - new_network_events = *modified_network_events; - - return found; -} - -ACE_Event_Handler * -ACE_WFMO_Reactor_Handler_Repository::find_handler (ACE_HANDLE handle) -{ - long existing_masks_ignored = 0; - return this->handler (handle, - existing_masks_ignored); -} - -ACE_Event_Handler * -ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, - long &existing_masks) -{ - int found = 0; - size_t i = 0; - ACE_Event_Handler *event_handler = 0; - existing_masks = 0; - - // Look for the handle first - - // First go through the current entries - // - // Look for all entries in the current handles for matching handle - // (except those that have been scheduled for deletion) - for (i = 0; i < this->max_handlep1_ && !found; ++i) - if ((handle == this->current_info_[i].io_handle_ || - handle == this->current_handles_[i]) && - !this->current_info_[i].delete_entry_) - { - found = 1; - event_handler = this->current_info_[i].event_handler_; - existing_masks = this->current_info_[i].network_events_; - } - - // Then pass through the suspended handles - // - // Look for all entries in the suspended handles for matching handle - // (except those that have been scheduled for deletion) - for (i = 0; i < this->suspended_handles_ && !found; ++i) - if ((handle == this->current_suspended_info_[i].io_handle_ || - handle == this->current_suspended_info_[i].event_handle_) && - !this->current_suspended_info_[i].delete_entry_) - { - found = 1; - event_handler = this->current_suspended_info_[i].event_handler_; - existing_masks = this->current_suspended_info_[i].network_events_; - } - - // Then check the to_be_added handles - // - // Look for all entries in the to_be_added handles for matching - // handle (except those that have been scheduled for deletion) - for (i = 0; i < this->handles_to_be_added_ && !found; ++i) - if ((handle == this->to_be_added_info_[i].io_handle_ || - handle == this->to_be_added_info_[i].event_handle_) && - !this->to_be_added_info_[i].delete_entry_) - { - found = 1; - event_handler = this->to_be_added_info_[i].event_handler_; - existing_masks = this->to_be_added_info_[i].network_events_; - } - - if (event_handler) - event_handler->add_reference (); - - return event_handler; -} - -int -ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, - ACE_Reactor_Mask user_masks, - ACE_Event_Handler **user_event_handler) -{ - long existing_masks = 0; - int found = 0; - - ACE_Event_Handler_var safe_event_handler = - this->handler (handle, - existing_masks); - - if (safe_event_handler.handler ()) - found = 1; - - if (!found) - return -1; - - // Otherwise, make sure that the masks that the user is looking for - // are on. - if (found && - ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::READ_MASK)) - if (!ACE_BIT_ENABLED (existing_masks, FD_READ) && - !ACE_BIT_ENABLED (existing_masks, FD_CLOSE)) - found = 0; - - if (found && - ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::WRITE_MASK)) - if (!ACE_BIT_ENABLED (existing_masks, FD_WRITE)) - found = 0; - - if (found && - ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::EXCEPT_MASK)) - if (!ACE_BIT_ENABLED (existing_masks, FD_OOB)) - found = 0; - - if (found && - ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::ACCEPT_MASK)) - if (!ACE_BIT_ENABLED (existing_masks, FD_ACCEPT)) - found = 0; - - if (found && - ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::CONNECT_MASK)) - if (!ACE_BIT_ENABLED (existing_masks, FD_CONNECT)) - found = 0; - - if (found && - ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::QOS_MASK)) - if (!ACE_BIT_ENABLED (existing_masks, FD_QOS)) - found = 0; - - if (found && - ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::GROUP_QOS_MASK)) - if (!ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS)) - found = 0; - - if (found && - user_event_handler) - *user_event_handler = safe_event_handler.release (); - - if (found) - return 0; - else - return -1; -} - -// Waits for and dispatches all events. Returns -1 on error, 0 if -// max_wait_time expired, or the number of events that were dispatched. -int -ACE_WFMO_Reactor::event_handling (ACE_Time_Value *max_wait_time, - int alertable) -{ - ACE_TRACE ("ACE_WFMO_Reactor::event_handling"); - - // Make sure we are not closed - if (!this->open_for_business_ || this->deactivated_) - return -1; - - // Stash the current time -- the destructor of this object will - // automatically compute how much time elapsed since this method was - // called. - ACE_Countdown_Time countdown (max_wait_time); - - int result; - do - { - // Check to see if it is ok to enter ::WaitForMultipleObjects - // This will acquire lock_> on success On failure, the - // lock will not be acquired - result = this->ok_to_wait (max_wait_time, alertable); - if (result != 1) - return result; - - // Increment the number of active threads - ++this->active_threads_; - - // Release the - this->lock_.release (); - - // Update the countdown to reflect time waiting to play with the - // mut and event. - countdown.update (); - - // Calculate timeout - int timeout = this->calculate_timeout (max_wait_time); - - // Wait for event to happen - DWORD wait_status = this->wait_for_multiple_events (timeout, - alertable); - - // Upcall - result = this->safe_dispatch (wait_status); - if (0 == result) - { - // wait_for_multiple_events timed out without dispatching - // anything. Because of rounding and conversion errors and - // such, it could be that the wait loop timed out, but - // the timer queue said it wasn't quite ready to expire a - // timer. In this case, max_wait_time won't have quite been - // reduced to 0, and we need to go around again. If max_wait_time - // is all the way to 0, just return, as the entire time the - // caller wanted to wait has been used up. - countdown.update (); // Reflect time waiting for events - if (0 == max_wait_time || max_wait_time->usec () == 0) - break; - } - } - while (result == 0); - - return result; -} - -int -ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time, - int alertable) -{ - // Calculate the max time we should spend here - // - // Note: There is really no need to involve the here - // because even if a timeout in the does expire we - // will not be able to dispatch it - int timeout = max_wait_time == 0 ? INFINITE : max_wait_time->msec (); - - // Atomically wait for both the and event - DWORD result = 0; - while (1) - { -#if defined (ACE_HAS_PHARLAP) - // PharLap doesn't implement WaitForMultipleObjectsEx, and doesn't - // do async I/O, so it's not needed in this case anyway. - result = ::WaitForMultipleObjects (sizeof this->atomic_wait_array_ / sizeof (ACE_HANDLE), - this->atomic_wait_array_, - TRUE, - timeout); - - if (result != WAIT_IO_COMPLETION) - break; - -#elif defined (ACE_HAS_WINCE) - result = ::WaitForMultipleObjects (sizeof this->atomic_wait_array_ / sizeof (ACE_HANDLE), - this->atomic_wait_array_, - TRUE, - timeout); - break; // CE does not have WAIT_IO_COMPLETION defined. -#else - result = ::WaitForMultipleObjectsEx (sizeof this->atomic_wait_array_ / sizeof (ACE_HANDLE), - this->atomic_wait_array_, - TRUE, - timeout, - alertable); - - if (result != WAIT_IO_COMPLETION) - break; - -#endif /* ACE_HAS_PHARLAP */ - } - - switch (result) - { - case WAIT_TIMEOUT: - errno = ETIME; - return 0; - case WAIT_FAILED: - case WAIT_ABANDONED_0: - ACE_OS::set_errno_to_last_error (); - return -1; - default: - break; - } - - // It is ok to enter ::WaitForMultipleObjects - return 1; -} - -DWORD -ACE_WFMO_Reactor::wait_for_multiple_events (int timeout, - int alertable) -{ - // Wait for any of handles_ to be active, or until timeout expires. - // If is enabled allow asynchronous completion of - // ReadFile and WriteFile operations. - -#if defined (ACE_HAS_PHARLAP) || defined (ACE_HAS_WINCE) - // PharLap doesn't do async I/O and doesn't implement - // WaitForMultipleObjectsEx, so use WaitForMultipleObjects. - ACE_UNUSED_ARG (alertable); - return ::WaitForMultipleObjects (this->handler_rep_.max_handlep1 (), - this->handler_rep_.handles (), - FALSE, - timeout); -#else - return ::WaitForMultipleObjectsEx (this->handler_rep_.max_handlep1 (), - this->handler_rep_.handles (), - FALSE, - timeout, - alertable); -#endif /* ACE_HAS_PHARLAP */ -} - -DWORD -ACE_WFMO_Reactor::poll_remaining_handles (DWORD slot) -{ - return ::WaitForMultipleObjects (this->handler_rep_.max_handlep1 () - slot, - this->handler_rep_.handles () + slot, - FALSE, - 0); -} - -int -ACE_WFMO_Reactor::calculate_timeout (ACE_Time_Value *max_wait_time) -{ - ACE_Time_Value *time = 0; - if (this->owner_ == ACE_Thread::self ()) - time = this->timer_queue_->calculate_timeout (max_wait_time); - else - time = max_wait_time; - - if (time == 0) - return INFINITE; - else - return time->msec (); -} - - -int -ACE_WFMO_Reactor::expire_timers (void) -{ - // If "owner" thread - if (ACE_Thread::self () == this->owner_) - // expire all pending timers. - return this->timer_queue_->expire (); - - else - // Nothing to expire - return 0; -} - -int -ACE_WFMO_Reactor::dispatch (DWORD wait_status) -{ - int handlers_dispatched = 0; - - // Expire timers - handlers_dispatched += this->expire_timers (); - - switch (wait_status) - { - case WAIT_FAILED: // Failure. - ACE_OS::set_errno_to_last_error (); - return -1; - - case WAIT_TIMEOUT: // Timeout. - errno = ETIME; - return handlers_dispatched; - -#ifndef ACE_HAS_WINCE - case WAIT_IO_COMPLETION: // APC. - return handlers_dispatched; -#endif // ACE_HAS_WINCE - - default: // Dispatch. - // We'll let dispatch worry about abandoned mutes. - handlers_dispatched += this->dispatch_handles (wait_status); - return handlers_dispatched; - } -} - -// Dispatches any active handles from to -// , polling through our handle set looking -// for active handles. -int -ACE_WFMO_Reactor::dispatch_handles (DWORD wait_status) -{ - // dispatch_slot is the absolute slot. Only += is used to - // increment it. - DWORD dispatch_slot = 0; - - // Cache this value, this is the absolute value. - DWORD max_handlep1 = this->handler_rep_.max_handlep1 (); - - // nCount starts off at , this is a transient count of - // handles last waited on. - DWORD nCount = max_handlep1; - - for (int number_of_handlers_dispatched = 1; - ; - ++number_of_handlers_dispatched) - { - const bool ok = ( -#if ! (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0530)) \ - && !defined (ghs) \ - && !defined (__MINGW32__) \ - && !(defined (_MSC_VER) && _MSC_VER >= 1300) - // wait_status is unsigned in Borland, Green Hills, - // mingw32 and MSVC++ >= 7.1. - // This >= is always true, with a warning. - wait_status >= WAIT_OBJECT_0 && -#endif - wait_status <= (WAIT_OBJECT_0 + nCount)); - - if (ok) - dispatch_slot += wait_status - WAIT_OBJECT_0; - else - // Otherwise, a handle was abandoned. - dispatch_slot += wait_status - WAIT_ABANDONED_0; - - // Dispatch handler - if (this->dispatch_handler (dispatch_slot, max_handlep1) == -1) - return -1; - - // Increment slot - ++dispatch_slot; - - // We're done. - if (dispatch_slot >= max_handlep1) - return number_of_handlers_dispatched; - - // Readjust nCount - nCount = max_handlep1 - dispatch_slot; - - // Check the remaining handles - wait_status = this->poll_remaining_handles (dispatch_slot); - switch (wait_status) - { - case WAIT_FAILED: // Failure. - ACE_OS::set_errno_to_last_error (); - /* FALLTHRU */ - case WAIT_TIMEOUT: - // There are no more handles ready, we can return. - return number_of_handlers_dispatched; - } - } -} - -int -ACE_WFMO_Reactor::dispatch_handler (DWORD slot, - DWORD max_handlep1) -{ - // Check if there are window messages that need to be dispatched - if (slot == max_handlep1) - return this->dispatch_window_messages (); - - // Dispatch the handler if it has not been scheduled for deletion. - // Note that this is a very week test if there are multiple threads - // dispatching this slot as no locks are held here. Generally, you - // do not want to do something like deleting the this pointer in - // handle_close() if you have registered multiple times and there is - // more than one thread in WFMO_Reactor->handle_events(). - else if (!this->handler_rep_.scheduled_for_deletion (slot)) - { - ACE_HANDLE event_handle = *(this->handler_rep_.handles () + slot); - - if (this->handler_rep_.current_info ()[slot].io_entry_) - return this->complex_dispatch_handler (slot, - event_handle); - else - return this->simple_dispatch_handler (slot, - event_handle); - } - else - // The handle was scheduled for deletion, so we will skip it. - return 0; -} - -int -ACE_WFMO_Reactor::simple_dispatch_handler (DWORD slot, - ACE_HANDLE event_handle) -{ - // This dispatch is used for non-I/O entires - - // Assign the ``signaled'' HANDLE so that callers can get it. - // siginfo_t is an ACE - specific fabrication. Constructor exists. - siginfo_t sig (event_handle); - - ACE_Event_Handler *event_handler = - this->handler_rep_.current_info ()[slot].event_handler_; - - int requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (requires_reference_counting) - { - event_handler->add_reference (); - } - - // Upcall - if (event_handler->handle_signal (0, &sig) == -1) - this->handler_rep_.unbind (event_handle, - ACE_Event_Handler::NULL_MASK); - - // Call remove_reference() if needed. - if (requires_reference_counting) - { - event_handler->remove_reference (); - } - - return 0; -} - -int -ACE_WFMO_Reactor::complex_dispatch_handler (DWORD slot, - ACE_HANDLE event_handle) -{ - // This dispatch is used for I/O entires. - - ACE_WFMO_Reactor_Handler_Repository::Current_Info ¤t_info = - this->handler_rep_.current_info ()[slot]; - - WSANETWORKEVENTS events; - ACE_Reactor_Mask problems = ACE_Event_Handler::NULL_MASK; - if (::WSAEnumNetworkEvents ((SOCKET) current_info.io_handle_, - event_handle, - &events) == SOCKET_ERROR) - problems = ACE_Event_Handler::ALL_EVENTS_MASK; - else - { - // Prepare for upcalls. Clear the bits from representing - // events the handler is not interested in. If there are any left, - // do the upcall(s). upcall will replace events.lNetworkEvents - // with bits representing any functions that requested a repeat - // callback before checking handles again. In this case, continue - // to call back unless the handler is unregistered as a result of - // one of the upcalls. The way this is written, the upcalls will - // keep being done even if one or more upcalls reported problems. - // In practice this may turn out not so good, but let's see. If any - // problems, please notify Steve Huston - // before or after you change this code. - events.lNetworkEvents &= current_info.network_events_; - while (events.lNetworkEvents != 0) - { - ACE_Event_Handler *event_handler = - current_info.event_handler_; - - int reference_counting_required = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - // Call add_reference() if needed. - if (reference_counting_required) - { - event_handler->add_reference (); - } - - // Upcall - problems |= this->upcall (current_info.event_handler_, - current_info.io_handle_, - events); - - // Call remove_reference() if needed. - if (reference_counting_required) - { - event_handler->remove_reference (); - } - - if (this->handler_rep_.scheduled_for_deletion (slot)) - break; - } - } - - if (problems != ACE_Event_Handler::NULL_MASK - && !this->handler_rep_.scheduled_for_deletion (slot) ) - this->handler_rep_.unbind (event_handle, problems); - - return 0; -} - -ACE_Reactor_Mask -ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - WSANETWORKEVENTS &events) -{ - // This method figures out what exactly has happened to the socket - // and then calls appropriate methods. - ACE_Reactor_Mask problems = ACE_Event_Handler::NULL_MASK; - - // Go through the events and do the indicated upcalls. If the handler - // doesn't want to be called back, clear the bit for that event. - // At the end, set the bits back to to request a repeat call. - - long actual_events = events.lNetworkEvents; - int action; - - if (ACE_BIT_ENABLED (actual_events, FD_WRITE)) - { - action = event_handler->handle_output (io_handle); - if (action <= 0) - { - ACE_CLR_BITS (actual_events, FD_WRITE); - if (action == -1) - ACE_SET_BITS (problems, ACE_Event_Handler::WRITE_MASK); - } - } - - if (ACE_BIT_ENABLED (actual_events, FD_CONNECT)) - { - if (events.iErrorCode[FD_CONNECT_BIT] == 0) - { - // Successful connect - action = event_handler->handle_output (io_handle); - if (action <= 0) - { - ACE_CLR_BITS (actual_events, FD_CONNECT); - if (action == -1) - ACE_SET_BITS (problems, - ACE_Event_Handler::CONNECT_MASK); - } - } - // Unsuccessful connect - else - { - action = event_handler->handle_input (io_handle); - if (action <= 0) - { - ACE_CLR_BITS (actual_events, FD_CONNECT); - if (action == -1) - ACE_SET_BITS (problems, - ACE_Event_Handler::CONNECT_MASK); - } - } - } - - if (ACE_BIT_ENABLED (actual_events, FD_OOB)) - { - action = event_handler->handle_exception (io_handle); - if (action <= 0) - { - ACE_CLR_BITS (actual_events, FD_OOB); - if (action == -1) - ACE_SET_BITS (problems, ACE_Event_Handler::EXCEPT_MASK); - } - } - - if (ACE_BIT_ENABLED (actual_events, FD_READ)) - { - action = event_handler->handle_input (io_handle); - if (action <= 0) - { - ACE_CLR_BITS (actual_events, FD_READ); - if (action == -1) - ACE_SET_BITS (problems, ACE_Event_Handler::READ_MASK); - } - } - - if (ACE_BIT_ENABLED (actual_events, FD_CLOSE) - && ACE_BIT_DISABLED (problems, ACE_Event_Handler::READ_MASK)) - { - action = event_handler->handle_input (io_handle); - if (action <= 0) - { - ACE_CLR_BITS (actual_events, FD_CLOSE); - if (action == -1) - ACE_SET_BITS (problems, ACE_Event_Handler::READ_MASK); - } - } - - if (ACE_BIT_ENABLED (actual_events, FD_ACCEPT)) - { - action = event_handler->handle_input (io_handle); - if (action <= 0) - { - ACE_CLR_BITS (actual_events, FD_ACCEPT); - if (action == -1) - ACE_SET_BITS (problems, ACE_Event_Handler::ACCEPT_MASK); - } - } - - if (ACE_BIT_ENABLED (actual_events, FD_QOS)) - { - action = event_handler->handle_qos (io_handle); - if (action <= 0) - { - ACE_CLR_BITS (actual_events, FD_QOS); - if (action == -1) - ACE_SET_BITS (problems, ACE_Event_Handler::QOS_MASK); - } - } - - if (ACE_BIT_ENABLED (actual_events, FD_GROUP_QOS)) - { - action = event_handler->handle_group_qos (io_handle); - if (action <= 0) - { - ACE_CLR_BITS (actual_events, FD_GROUP_QOS); - if (action == -1) - ACE_SET_BITS (problems, ACE_Event_Handler::GROUP_QOS_MASK); - } - } - - events.lNetworkEvents = actual_events; - return problems; -} - - -int -ACE_WFMO_Reactor::update_state (void) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); - - // Decrement active threads - --this->active_threads_; - - // Check if the state of the handler repository has changed or new - // owner has to be set - if (this->handler_rep_.changes_required () || this->new_owner ()) - { - if (this->change_state_thread_ == 0) - // Try to become the thread which will be responsible for the - // changes - { - this->change_state_thread_ = ACE_Thread::self (); - // Make sure no new threads are allowed to enter - this->ok_to_wait_.reset (); - - if (this->active_threads_ > 0) - // Check for other active threads - { - // Wake up all other threads - this->wakeup_all_threads_.signal (); - // Release - monitor.release (); - // Go to sleep waiting for all other threads to get done - this->waiting_to_change_state_.wait (); - // Re-acquire again - monitor.acquire (); - } - - // Note that make_changes() calls into user code which can - // request other changes. So keep looping until all - // requested changes are completed. - while (this->handler_rep_.changes_required ()) - // Make necessary changes to the handler repository - this->handler_rep_.make_changes (); - if (this->new_owner ()) - // Update the owner - this->change_owner (); - // Turn off - this->wakeup_all_threads_.reset (); - // Let everyone know that it is ok to go ahead - this->ok_to_wait_.signal (); - // Reset this flag - this->change_state_thread_ = 0; - } - else if (this->active_threads_ == 0) - // This thread did not get a chance to become the change - // thread. If it is the last one out, it will wakeup the - // change thread - this->waiting_to_change_state_.signal (); - } - // This is if we were woken up explicitily by the user and there are - // no state changes required. - else if (this->active_threads_ == 0) - // Turn off - this->wakeup_all_threads_.reset (); - - return 0; -} - -void -ACE_WFMO_Reactor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_WFMO_Reactor::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Count of currently active threads = %d\n"), - this->active_threads_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("ID of owner thread = %d\n"), - this->owner_)); - - this->handler_rep_.dump (); - this->signal_handler_->dump (); - this->timer_queue_->dump (); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_WFMO_Reactor_Notify::dispatch_notifications (int & /*number_of_active_handles*/, - ACE_Handle_Set & /*rd_mask*/) -{ - return -1; -} - -int -ACE_WFMO_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer & /*buffer*/) -{ - return 0; -} - -ACE_HANDLE -ACE_WFMO_Reactor_Notify::notify_handle (void) -{ - return ACE_INVALID_HANDLE; -} - -int -ACE_WFMO_Reactor_Notify::read_notify_pipe (ACE_HANDLE , - ACE_Notification_Buffer &) -{ - return 0; -} - -int -ACE_WFMO_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &) -{ - return 0; -} - -int -ACE_WFMO_Reactor_Notify::close (void) -{ - return -1; -} - -ACE_WFMO_Reactor_Notify::ACE_WFMO_Reactor_Notify (size_t max_notifies) - : timer_queue_ (0), - message_queue_ (max_notifies * sizeof (ACE_Notification_Buffer), - max_notifies * sizeof (ACE_Notification_Buffer)), - max_notify_iterations_ (-1) -{ -} - -int -ACE_WFMO_Reactor_Notify::open (ACE_Reactor_Impl *wfmo_reactor, - ACE_Timer_Queue *timer_queue, - int ignore_notify) -{ - ACE_UNUSED_ARG (ignore_notify); - timer_queue_ = timer_queue; - return wfmo_reactor->register_handler (this); -} - -ACE_HANDLE -ACE_WFMO_Reactor_Notify::get_handle (void) const -{ - return this->wakeup_one_thread_.handle (); -} - -// Handle all pending notifications. - -int -ACE_WFMO_Reactor_Notify::handle_signal (int signum, - siginfo_t *siginfo, - ucontext_t *) -{ - ACE_UNUSED_ARG (signum); - - // Just check for sanity... - if (siginfo->si_handle_ != this->wakeup_one_thread_.handle ()) - return -1; - - // This will get called when wakeup_one_thread_> event - // is signaled. - // ACE_DEBUG ((LM_DEBUG, - // ACE_LIB_TEXT ("(%t) waking up to handle internal notifications\n"))); - - for (int i = 1; ; ++i) - { - ACE_Message_Block *mb = 0; - // Copy ACE_Time_Value::zero since dequeue_head will modify it. - ACE_Time_Value zero_timeout (ACE_Time_Value::zero); - if (this->message_queue_.dequeue_head (mb, &zero_timeout) == -1) - { - if (errno == EWOULDBLOCK) - // We've reached the end of the processing, return - // normally. - return 0; - else - return -1; // Something weird happened... - } - else - { - ACE_Notification_Buffer *buffer = - reinterpret_cast (mb->base ()); - - // If eh == 0 then we've got major problems! Otherwise, we - // need to dispatch the appropriate handle_* method on the - // ACE_Event_Handler pointer we've been passed. - - if (buffer->eh_ != 0) - { - ACE_Event_Handler *event_handler = - buffer->eh_; - - int requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - int result = 0; - - switch (buffer->mask_) - { - case ACE_Event_Handler::READ_MASK: - case ACE_Event_Handler::ACCEPT_MASK: - result = event_handler->handle_input (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::WRITE_MASK: - result = event_handler->handle_output (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::EXCEPT_MASK: - result = event_handler->handle_exception (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::QOS_MASK: - result = event_handler->handle_qos (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::GROUP_QOS_MASK: - result = event_handler->handle_group_qos (ACE_INVALID_HANDLE); - break; - default: - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("invalid mask = %d\n"), - buffer->mask_)); - break; - } - - if (result == -1) - event_handler->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::EXCEPT_MASK); - - if (requires_reference_counting) - { - event_handler->remove_reference (); - } - } - - // Make sure to delete the memory regardless of success or - // failure! - mb->release (); - - // Bail out if we've reached the . - // Note that by default is -1, so - // we'll loop until we're done. - if (i == this->max_notify_iterations_) - { - // If there are still notification in the queue, we need - // to wake up again - if (!this->message_queue_.is_empty ()) - this->wakeup_one_thread_.signal (); - - // Break the loop as we have reached max_notify_iterations_ - return 0; - } - } - } -} - -// Notify the WFMO_Reactor, potentially enqueueing the -// for subsequent processing in the WFMO_Reactor -// thread of control. - -int -ACE_WFMO_Reactor_Notify::notify (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - ACE_Time_Value *timeout) -{ - if (event_handler != 0) - { - ACE_Message_Block *mb = 0; - ACE_NEW_RETURN (mb, - ACE_Message_Block (sizeof (ACE_Notification_Buffer)), - -1); - - ACE_Notification_Buffer *buffer = - (ACE_Notification_Buffer *) mb->base (); - buffer->eh_ = event_handler; - buffer->mask_ = mask; - - // Convert from relative time to absolute time by adding the - // current time of day. This is what - // expects. - if (timeout != 0) - *timeout += timer_queue_->gettimeofday (); - - if (this->message_queue_.enqueue_tail - (mb, timeout) == -1) - { - mb->release (); - return -1; - } - - event_handler->add_reference (); - } - - return this->wakeup_one_thread_.signal (); -} - -void -ACE_WFMO_Reactor_Notify::max_notify_iterations (int iterations) -{ - ACE_TRACE ("ACE_WFMO_Reactor_Notify::max_notify_iterations"); - // Must always be > 0 or < 0 to optimize the loop exit condition. - if (iterations == 0) - iterations = 1; - - this->max_notify_iterations_ = iterations; -} - -int -ACE_WFMO_Reactor_Notify::max_notify_iterations (void) -{ - ACE_TRACE ("ACE_WFMO_Reactor_Notify::max_notify_iterations"); - return this->max_notify_iterations_; -} - -int -ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_WFMO_Reactor_Notify::purge_pending_notifications"); - - // Go over message queue and take out all the matching event - // handlers. If eh == 0, purge all. Note that reactor notifies (no - // handler specified) are never purged, as this may lose a needed - // notify the reactor queued for itself. - - if (this->message_queue_.is_empty ()) - return 0; - - // Guard against new and/or delivered notifications while purging. - // WARNING!!! The use of the notification queue's lock object for - // this guard makes use of the knowledge that on Win32, the mutex - // protecting the queue is really a CriticalSection, which is - // recursive. This is how we can get away with locking it down here - // and still calling member functions on the queue object. - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, monitor, this->message_queue_.lock(), -1); - - // first, copy all to our own local queue. Since we've locked everyone out - // of here, there's no need to use any synchronization on this queue. - ACE_Message_Queue local_queue; - - size_t queue_size = this->message_queue_.message_count (); - int number_purged = 0; - - size_t index; - - for (index = 0; index < queue_size; ++index) - { - ACE_Message_Block *mb = 0; - if (-1 == this->message_queue_.dequeue_head (mb)) - return -1; // This shouldn't happen... - - ACE_Notification_Buffer *buffer = - reinterpret_cast (mb->base ()); - - // If this is not a Reactor notify (it is for a particular handler), - // and it matches the specified handler (or purging all), - // and applying the mask would totally eliminate the notification, then - // release it and count the number purged. - if ((0 != buffer->eh_) && - (0 == eh || eh == buffer->eh_) && - ACE_BIT_DISABLED (buffer->mask_, ~mask)) // the existing notification mask - // is left with nothing when - // applying the mask - { - ACE_Event_Handler *event_handler = buffer->eh_; - - event_handler->remove_reference (); - - mb->release (); - ++number_purged; - } - else - { - // To preserve it, move it to the local_queue. But first, if - // this is not a Reactor notify (it is for a - // particularhandler), and it matches the specified handler - // (or purging all), then apply the mask - if ((0 != buffer->eh_) && - (0 == eh || eh == buffer->eh_)) - ACE_CLR_BITS(buffer->mask_, mask); - if (-1 == local_queue.enqueue_head (mb)) - return -1; - } - } - - if (this->message_queue_.message_count ()) - { // Should be empty! - ACE_ASSERT (0); - return -1; - } - - // Now copy back from the local queue to the class queue, taking - // care to preserve the original order... - queue_size = local_queue.message_count (); - for (index = 0; index < queue_size; ++index) - { - ACE_Message_Block *mb = 0; - if (-1 == local_queue.dequeue_head (mb)) - { - ACE_ASSERT (0); - return -1; - } - - if (-1 == this->message_queue_.enqueue_head (mb)) - { - ACE_ASSERT (0); - return -1; - } - } - - return number_purged; -} - -void -ACE_WFMO_Reactor_Notify::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_WFMO_Reactor_Notify::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->timer_queue_->dump (); - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Max. iteration: %d\n"), - this->max_notify_iterations_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -void -ACE_WFMO_Reactor::max_notify_iterations (int iterations) -{ - ACE_TRACE ("ACE_WFMO_Reactor::max_notify_iterations"); - ACE_GUARD (ACE_Process_Mutex, monitor, this->lock_); - - // Must always be > 0 or < 0 to optimize the loop exit condition. - this->notify_handler_->max_notify_iterations (iterations); -} - -int -ACE_WFMO_Reactor::max_notify_iterations (void) -{ - ACE_TRACE ("ACE_WFMO_Reactor::max_notify_iterations"); - ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); - - return this->notify_handler_->max_notify_iterations (); -} - -int -ACE_WFMO_Reactor::purge_pending_notifications (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_WFMO_Reactor::purge_pending_notifications"); - if (this->notify_handler_ == 0) - return 0; - else - return this->notify_handler_->purge_pending_notifications (eh, mask); -} - -int -ACE_WFMO_Reactor::resumable_handler (void) -{ - ACE_TRACE ("ACE_WFMO_Reactor::resumable_handler"); - return 0; -} - - -// No-op WinSOCK2 methods to help WFMO_Reactor compile -#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) -int -WSAEventSelect (SOCKET /* s */, - WSAEVENT /* hEventObject */, - long /* lNetworkEvents */) -{ - return -1; -} - -int -WSAEnumNetworkEvents (SOCKET /* s */, - WSAEVENT /* hEventObject */, - LPWSANETWORKEVENTS /* lpNetworkEvents */) -{ - return -1; -} -#endif /* !defined ACE_HAS_WINSOCK2 */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 */ diff --git a/ace/WFMO_Reactor.h b/ace/WFMO_Reactor.h deleted file mode 100644 index 8e3cdb4cc28..00000000000 --- a/ace/WFMO_Reactor.h +++ /dev/null @@ -1,1357 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file WFMO_Reactor.h - * - * $Id$ - * - * @author Irfan Pyarali - * @author Tim Harrison - * @author Doug Schmidt - */ -//============================================================================= - -#ifndef ACE_WFMO_REACTOR_H -#define ACE_WFMO_REACTOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_WIN32) - -#include "ace/Signal.h" -#include "ace/Timer_Queue.h" -#include "ace/Event_Handler.h" -#include "ace/Auto_Event.h" -#include "ace/Manual_Event.h" -#include "ace/Condition_Thread_Mutex.h" -#include "ace/Lock_Adapter_T.h" -#include "ace/Reactor_Impl.h" -#include "ace/Message_Queue.h" -#include "ace/Process_Mutex.h" - -// If we don't have WinSOCK2, we need these defined -#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) -/* - * WinSock 2 extension -- bit values and indices for FD_XXX network events - */ -#define FD_READ_BIT 0 -#define FD_WRITE_BIT 1 -#define FD_OOB_BIT 2 -#define FD_ACCEPT_BIT 3 -#define FD_CONNECT_BIT 4 -#define FD_CLOSE_BIT 5 -#define FD_QOS_BIT 6 -#define FD_GROUP_QOS_BIT 7 - -#define FD_QOS (1 << FD_QOS_BIT) -#define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT) - -#define FD_MAX_EVENTS 8 -#define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1) - -#define WSAEVENT HANDLE - -typedef struct _WSANETWORKEVENTS -{ - long lNetworkEvents; - int iErrorCode[FD_MAX_EVENTS]; -} WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS; - -int WSAEventSelect (SOCKET s, - WSAEVENT hEventObject, - long lNetworkEvents); - -int WSAEnumNetworkEvents (SOCKET s, - WSAEVENT hEventObject, - LPWSANETWORKEVENTS lpNetworkEvents); - -#endif /* !defined ACE_HAS_WINSOCK2 */ - -class ACE_WFMO_Reactor_Test; // Must be out of versioned namespace. - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl. -class ACE_WFMO_Reactor; -class ACE_Handle_Set; - -/** - * @class ACE_Wakeup_All_Threads_Handler - * - * @brief This is a helper class whose sole purpose is to handle events - * on wakeup_all_threads_> - */ -class ACE_Export ACE_Wakeup_All_Threads_Handler : public ACE_Event_Handler -{ -public: - /// Called when the wakeup_all_threads_> - virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); -}; - -/** - * @class ACE_WFMO_Reactor_Handler_Repository - * - * @brief Used to map ACE_HANDLEs onto the appropriate - * ACE_Event_Handler * and other information. - */ -class ACE_Export ACE_WFMO_Reactor_Handler_Repository -{ -public: - friend class ACE_WFMO_Reactor; - friend class ACE_WFMO_Reactor_Test; - - /** - * @class Common_Info - * - * @brief This struct contains the necessary information for every - * entry. The reason the event is not in this - * structure is because we need to pass an event array into - * WaitForMultipleObjects and therefore keeping the events - * seperate makes sense. - */ - class Common_Info - { - public: - /// This indicates whether this entry is for I/O or for a regular - /// event - int io_entry_; - - /// The assosiated - ACE_Event_Handler *event_handler_; - - /// The I/O handle related to the . This entry is - /// only valid if the flag is true. - ACE_HANDLE io_handle_; - - /** - * This is the set of events that the is - * interested in. This entry is only valid if the flag - * is true. - */ - long network_events_; - - /** - * This flag indicates that created the event on - * behalf of the user. Therefore we need to clean this up when the - * removes itself from . This entry - * is only valid if the flag is true. - */ - int delete_event_; - - /// This is set when the entry needed to be deleted. - int delete_entry_; - - /** - * These are the masks related to for the - * . This is only valid when is - * set. - */ - ACE_Reactor_Mask close_masks_; - - /// Constructor used for initializing the structure - Common_Info (void); - - /// Reset the state of the structure - void reset (void); - - /// Set the structure to these new values - void set (int io_entry, - ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - long network_events, - int delete_event, - int delete_entry, - ACE_Reactor_Mask close_masks); - - /// Set the structure to these new values - void set (Common_Info &common_info); - - /// Dump the state of an object. - void dump (void) const; - }; - - /** - * @class Current_Info - * - * @brief This structure inherits from the common structure to add - * information for current entries. - */ - class Current_Info : public Common_Info - { - public: - /// This is set when the entry needed to be suspended. - int suspend_entry_; - - /// Default constructor - Current_Info (void); - - /// Reset the state of the structure - void reset (void); - - /// Set the structure to these new values - void set (int io_entry, - ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - long network_events, - int delete_event, - int delete_entry = 0, - ACE_Reactor_Mask close_masks = ACE_Event_Handler::NULL_MASK, - int suspend_entry = 0); - - /// Set the structure to these new values - void set (Common_Info &common_info, - int suspend_entry = 0); - - /// Dump the state of an object. - void dump (ACE_HANDLE event_handle) const; - }; - - /** - * @class To_Be_Added_Info - * - * @brief This structure inherits from the common structure to add - * information for entries. - */ - class To_Be_Added_Info : public Common_Info - { - public: - /// Handle for the event - ACE_HANDLE event_handle_; - - /// This is set when the entry needed to be suspended. - int suspend_entry_; - - /// Default constructor - To_Be_Added_Info (void); - - /// Reset the state of the structure - void reset (void); - - /// Set the structure to these new values - void set (ACE_HANDLE event_handle, - int io_entry, - ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - long network_events, - int delete_event, - int delete_entry = 0, - ACE_Reactor_Mask close_masks = ACE_Event_Handler::NULL_MASK, - int suspend_entry = 0); - - /// Set the structure to these new values - void set (ACE_HANDLE event_handle, - Common_Info &common_info, - int suspend_entry = 0); - - /// Dump the state of an object. - void dump (void) const; - }; - - /** - * @class Suspended_Info - * - * @brief This structure inherits from the common structure to add - * information for suspended entries. - */ - class Suspended_Info : public Common_Info - { - public: - /// Handle for the event - ACE_HANDLE event_handle_; - - /// This is set when the entry needed to be resumed. - int resume_entry_; - - /// Constructor used for initializing the structure - Suspended_Info (void); - - /// Reset the state of the structure - void reset (void); - - /// Set the structure to these new values - void set (ACE_HANDLE event_handle, - int io_entry, - ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - long network_events, - int delete_event, - int delete_entry = 0, - ACE_Reactor_Mask close_masks = 0, - int resume_entry = 0); - - /// Set the structure to these new values - void set (ACE_HANDLE event_handle, - Common_Info &common_info, - int resume_entry = 0); - - /// Dump the state of an object. - void dump (void) const; - }; - - /// Constructor. - ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor); - - /// Destructor. - virtual ~ACE_WFMO_Reactor_Handler_Repository (void); - - /// Initialize the repository of the approriate . - int open (size_t size); - - /// Close down the handler repository. - int close (void); - - // = Search structure operations. - - /// Bind the to the ACE_HANDLE. This is for - /// the simple event entry. - int bind (ACE_HANDLE, ACE_Event_Handler *); - - /// Insert I/O entry into the system. This method - /// assumes that the lock are head *before* this method is invoked. - int bind_i (int io_entry, - ACE_Event_Handler *event_handler, - long network_events, - ACE_HANDLE io_handle, - ACE_HANDLE event_handle, - int delete_event); - - /// Remove the binding of ACE_HANDLE in accordance with the . - int unbind (ACE_HANDLE, - ACE_Reactor_Mask mask); - - /// Non-lock-grabbing version of - int unbind_i (ACE_HANDLE, - ACE_Reactor_Mask mask, - int &changes_required); - - /// Remove all bindings of tuples. - void unbind_all (void); - - // = Sanity checking. - - // Check the to make sure it's a valid ACE_HANDLE - int invalid_handle (ACE_HANDLE handle) const; - - // = Accessors. - /// Maximum ACE_HANDLE value, plus 1. - DWORD max_handlep1 (void) const; - - /// Pointer to the beginning of the current array of ACE_HANDLE - /// *'s. - ACE_HANDLE *handles (void) const; - - /// Pointer to the beginning of the current array of - /// ACE_Event_Handler *'s. - Current_Info *current_info (void) const; - - /// Check if changes to the handle set are required. - virtual int changes_required (void); - - /// Make changes to the handle set - virtual int make_changes (void); - - /// Check to see if has been scheduled for deletion - int scheduled_for_deletion (size_t slot) const; - - /** - * This method is used to calculate the network mask after a mask_op - * request to . Note that because the - * may already be in the handler repository, we may have to find the - * old event and the old network events - */ - int modify_network_events_i (ACE_HANDLE io_handle, - ACE_Reactor_Mask new_masks, - ACE_Reactor_Mask &old_masks, - long &new_network_events, - ACE_HANDLE &event_handle, - int &delete_event, - int operation); - - /// This method is used to change the network mask left (if any) - /// after a remove request to - ACE_Reactor_Mask bit_ops (long &existing_masks, - ACE_Reactor_Mask to_be_removed_masks, - int operation); - - /// Temporarily suspend entry - int suspend_handler_i (ACE_HANDLE handle, - int &changes_required); - - /// Resume suspended entry - int resume_handler_i (ACE_HANDLE handle, - int &changes_required); - - /// Deletions and suspensions in current_info_ - int make_changes_in_current_infos (void); - - /// Deletions and resumptions in current_suspended_info_ - int make_changes_in_suspension_infos (void); - - /// Deletions in to_be_added_info_, or transfers to current_info_ or - /// current_suspended_info_ from to_be_added_info_ - int make_changes_in_to_be_added_infos (void); - - /// Removes the ACE_Event_Handler at from the table. - int remove_handler_i (size_t slot, - ACE_Reactor_Mask mask); - - /// Removes the ACE_Event_Handler at from the table. - int remove_suspended_handler_i (size_t slot, - ACE_Reactor_Mask mask); - - /// Removes the ACE_Event_Handler at from the table. - int remove_to_be_added_handler_i (size_t slot, - ACE_Reactor_Mask to_be_removed_masks); - - /** - * Return the Event_Handler associated with . Return 0 if - * is not registered. - */ - ACE_Event_Handler *find_handler (ACE_HANDLE handle); - - /** - * Check to see if is associated with a valid Event_Handler - * bound to . Return the associated with this - * if != 0. - */ - int handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler = 0); - - /** - * Check to see if is associated with a valid - * Event_Handler. Return Event_Handler and associated masks. - */ - ACE_Event_Handler *handler (ACE_HANDLE handle, - long &existing_masks); - - /// Dump the state of an object. - void dump (void) const; - -protected: - /// Reference to our . - ACE_WFMO_Reactor &wfmo_reactor_; - - /// Maximum number of handles. - size_t max_size_; - - /** - * Array of passed to . This - * is not part of the structure as the handle array needs to be - * passed directly to . - */ - ACE_HANDLE *current_handles_; - - /// Array of current entries in the table - Current_Info *current_info_; - - /// A count of the number of active handles. - DWORD max_handlep1_; - - /// Information for entries to be added - To_Be_Added_Info *to_be_added_info_; - - /// Number of records to be added - size_t handles_to_be_added_; - - /// Currently suspended handles - Suspended_Info *current_suspended_info_; - - /// Number of currently suspended handles - size_t suspended_handles_; - - /// Number of records to be suspended - size_t handles_to_be_suspended_; - - /// Number of records to be resumed - size_t handles_to_be_resumed_; - - /// Number of records to be deleted - size_t handles_to_be_deleted_; - -}; - -/** - * @class ACE_WFMO_Reactor_Notify - * - * @brief Unblock the from its event loop, passing - * it an optional ACE_Event_Handler to dispatch. - * - * This implementation is necessary for cases where the - * is run in a multi-threaded program. In - * this case, we need to be able to unblock - * when updates occur other than in the - * main thread. To do this, we signal an - * auto-reset event the is listening on. If - * an ACE_Event_Handler and is passed to - * , the appropriate method is dispatched. - */ -class ACE_Export ACE_WFMO_Reactor_Notify : public ACE_Reactor_Notify -{ -public: - /// Constructor - ACE_WFMO_Reactor_Notify (size_t max_notifies = 1024); - - /// Initialization. is stored to call . - virtual int open (ACE_Reactor_Impl *wfmo_reactor, - ACE_Timer_Queue *timer_queue, - int disable_notify = 0); - - /// No-op. - virtual int close (void); - - /** - * Special trick to unblock when updates - * occur. All we do is enqueue and onto the - * ACE_Message_Queue and wakeup the by signaling - * its handle. The indicates how long - * to blocking trying to notify the . If == - * 0, the caller will block until action is possible, else will wait - * until the relative time specified in elapses). - */ - virtual int notify (ACE_Event_Handler *event_handler = 0, - ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value *timeout = 0); - - /// No-op. - virtual int dispatch_notifications (int &number_of_active_handles, - ACE_Handle_Set &rd_mask); - - /// Returns a handle to the . - virtual ACE_HANDLE get_handle (void) const; - - /// Returns the ACE_HANDLE of the notify pipe on which the reactor - /// is listening for notifications so that other threads can unblock - /// the - virtual ACE_HANDLE notify_handle (void); - - /// Handle one of the notify call on the . This could be - /// because of a thread trying to unblock the - virtual int dispatch_notify (ACE_Notification_Buffer &buffer); - - /// Verify whether the buffer has dispatchable info or not. - virtual int is_dispatchable (ACE_Notification_Buffer &buffer); - - /// Read one of the notify call on the into the - /// . This could be because of a thread trying to unblock - /// the - virtual int read_notify_pipe (ACE_HANDLE handle, - ACE_Notification_Buffer &buffer); - - /** - * Set the maximum number of times that the - * method will iterate and - * dispatch the that are passed in via the - * notify queue before breaking out of its - * loop. By default, this is set to - * -1, which means "iterate until the queue is empty." Setting this - * to a value like "1 or 2" will increase "fairness" (and thus - * prevent starvation) at the expense of slightly higher dispatching - * overhead. - */ - void max_notify_iterations (int); - - /** - * Get the maximum number of times that the - * method will iterate and - * dispatch the that are passed in via the - * notify queue before breaking out of its - * loop. - */ - int max_notify_iterations (void); - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. If == 0, all notifications for all - * handlers are removed (but not any notifications posted just to wake up - * the reactor itself). Returns the number of notifications purged. - * Returns -1 on error. - */ - virtual int purge_pending_notifications (ACE_Event_Handler *, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Dump the state of an object. - virtual void dump (void) const; - -private: - /// Pointer to the wfmo_reactor's timer queue. - ACE_Timer_Queue *timer_queue_; - - /** - * Called when the notification event waited on by - * is signaled. This dequeues all pending - * and dispatches them. - */ - virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - - /// An auto event is used so that we can it to wakeup one - /// thread up (e.g., when the method is called). - ACE_Auto_Event wakeup_one_thread_; - - /// Message queue that keeps track of pending . - /// This queue must be thread-safe because it can be called by - /// multiple threads of control. - ACE_Message_Queue message_queue_; - - /** - * Keeps track of the maximum number of times that the - * method will iterate and - * dispatch the that are passed in via the - * notify queue before breaking out of its - * loop. By default, this is set to - * -1, which means "iterate until the queue is empty." - */ - int max_notify_iterations_; -}; - -/** - * @class ACE_WFMO_Reactor - * - * @brief An object oriented event demultiplexor and event handler. - * ACE_WFMO_Reactor is a Windows-only implementation of the ACE_Reactor - * interface that uses the WaitForMultipleObjects() event demultiplexer. - * - * Like the other ACE Reactors, ACE_WFMO_Reactor can schedule timers. - * It also reacts to signalable handles, such as events (see the documentation - * for WaitForMultipleObjects() for a complete list of signalable handle - * types). Therefore, I/O handles are not directly usable for registering - * for input, output, and exception notification. The exception to this - * is ACE_SOCK-based handles, which can be registered for input, output, and - * exception notification just as with other platforms. See Chapter 4 in - * C++NPv2 for complete details. - * - * Note that changes to the state of ACE_WFMO_Reactor are not - * instantaneous. Most changes (registration, removal, - * suspension, and resumption of handles, and changes in - * ownership) are made when the ACE_WFMO_Reactor reaches a stable - * state. Users should be careful, especially when removing - * handlers. This is because the ACE_WFMO_Reactor will call - * handle_close() on the handler when it is finally removed and - * not when remove_handler() is called. If the registered handler's pointer - * is not valid when ACE_WFMO_Reactor calls ACE_Event_Handler::handle_close(), - * use the DONT_CALL flag with remove_handler(). Preferably, use dynamically - * allocated event handlers and call "delete this" inside the handle_close() - * hook method. - */ -class ACE_Export ACE_WFMO_Reactor : public ACE_Reactor_Impl -{ -public: - friend class ACE_WFMO_Reactor_Handler_Repository; - friend class ACE_WFMO_Reactor_Test; - - enum - { - /// Default size of the WFMO_Reactor's handle table. - /** - * Two slots will be added to the @a size parameter in the - * constructor and open methods which will store handles used for - * internal management purposes. - */ - DEFAULT_SIZE = MAXIMUM_WAIT_OBJECTS - 2 - }; - - // = Initialization and termination methods. - - /// Initialize ACE_WFMO_Reactor with the default size. - ACE_WFMO_Reactor (ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - ACE_Reactor_Notify * = 0); - - /** - * Initialize ACE_WFMO_Reactor with the specified size. - * - * @param size The maximum number of handles the reactor can - * register. The value should not exceed - * ACE_WFMO_Reactor::DEFAULT_SIZE. Two slots will be - * added to the @a size parameter which will store handles - * used for internal management purposes. - */ - ACE_WFMO_Reactor (size_t size, - int unused = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - ACE_Reactor_Notify * = 0); - - /** - * Initialize ACE_WFMO_Reactor with the specified size. - * - * @param size The maximum number of handles the reactor can - * register. The value should not exceed - * ACE_WFMO_Reactor::DEFAULT_SIZE. Two slots will be - * added to the @a size parameter which will store handles - * used for internal management purposes. - */ - virtual int open (size_t size = ACE_WFMO_Reactor::DEFAULT_SIZE, - int restart = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify * = 0); - - /// Returns -1 (not used in this implementation); - virtual int current_info (ACE_HANDLE, size_t & /* size */); - - /// Use a user specified signal handler instead. - virtual int set_sig_handler (ACE_Sig_Handler *signal_handler); - - /// Set a user-specified timer queue. - virtual int timer_queue (ACE_Timer_Queue *tq); - - /// Return the current ACE_Timer_Queue. - virtual ACE_Timer_Queue *timer_queue (void) const; - - /// Close down the ACE_WFMO_Reactor and release all of its resources. - virtual int close (void); - - /// Close down the ACE_WFMO_Reactor and release all of its resources. - virtual ~ACE_WFMO_Reactor (void); - - // = Event loop drivers. - - /** - * This method is not currently implemented. We recommend that you - * use handle_events (ACE_Time_Value::zero) to get basically the - * same effect, i.e., it won't block the caller if there are no events. - */ - virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); - - /** - * This event loop driver blocks for up to before - * returning. It will return earlier if timer events, I/O events, - * or signal events occur. Note that can be 0, in - * which case this method blocks indefinitely until events occur. - * - * is decremented to reflect how much time this call - * took. For instance, if a time value of 3 seconds is passed to - * handle_events and an event occurs after 2 seconds, - * will equal 1 second. This can be used if an - * application wishes to handle events for some fixed amount of - * time. - * - * is used as the demultiplexing call - * - * Returns the total number of I/O and timer ACE_Event_Handlers - * that were dispatched, 0 if the elapsed without - * dispatching any handlers, or -1 if an error occurs. - * - * The only difference between and - * is that in the alertable case, TRUE is passed to - * for the option. - */ - virtual int handle_events (ACE_Time_Value *max_wait_time = 0); - virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0); - - /** - * This method is just like the one above, except the - * value is a reference and can therefore never be - * NULL. - * - * The only difference between and - * is that in the alertable case, TRUE is passed to - * for the option. - */ - virtual int handle_events (ACE_Time_Value &max_wait_time); - virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); - - - // = Event handling control. - - /** - * Return the status of Reactor. If this function returns 0, the reactor is - * actively handling events. If it returns non-zero, and - * return -1 immediately. - */ - virtual int deactivated (void); - - /** - * Control whether the Reactor will handle any more incoming events or not. - * If == 1, the Reactor will be disabled. By default, a reactor - * is in active state and can be deactivated/reactived as wish. - */ - virtual void deactivate (int do_stop); - - // = Register and remove Handlers. - - /** - * Register an ACE_Event_Handler . Since no Event - * Mask is passed through this interface, it is assumed that the - * being passed in is an event handle and when the event - * becomes signaled, will call handle_signal on - * . If == the - * will call the method of - * to extract the underlying event handle. - */ - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_HANDLE event_handle = ACE_INVALID_HANDLE); - - /** - * Register an ACE_Event_Handler . specifies - * the network events that the is interested in. If - * == the will - * call the method of to extract the - * underlying I/O handle. If the == - * , WFMO_Reactor will create an event for - * associating it with the I/O handle. When the is - * signalled, the appropriate callback will be invoked on - * the - */ - virtual int register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * This is a simple version of the above method - * where the I/O handle is passed in and the event handle will - * always be created by - */ - virtual int register_handler (ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * This is a simple version of the above method - * where the I/O handle will always come from on the - * and the event handle will always be created by - * - */ - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /// Register with all the in the - /// . - virtual int register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Register to handle the signal using the - * . Returns the that was previously registered - * (if any), along with the of the signal handler. - */ - virtual int register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0, - ACE_Event_Handler **old_sh = 0, - ACE_Sig_Action *old_disp = 0); - - /// Registers to handle a set of signals using the - /// . - virtual int register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0); - - /** - * Removes from the . Note that - * the will call the method of - * to extract the underlying handle. If == - * then the method of - * the is not invoked. Note that the can - * either be the or the - */ - virtual int remove_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Removes from the . If == - * then the method of - * the is not invoked. Note that the can - * either be the or the - * - * For the case of I/O entries, this removes the binding of - * whose handle is from . If - * there are no more bindings for this then it is - * removed from the WFMO_Reactor. For simple event entries, mask is - * mostly ignored and the is always removed from - * - */ - virtual int remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - /** - * Removes all the bindings for handles in the - * bind of . If there are no more bindings for any - * of these handles then they are removed from WFMO_Reactor. - */ - virtual int remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask); - - /** - * Remove the ACE_Event_Handler currently associated with . - * is ignored in this implementation since there is only - * one instance of a signal handler. Install the new disposition - * (if given) and return the previous disposition (if desired by the - * caller). Returns 0 on success and -1 if is invalid. - */ - virtual int remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp = 0, - int sigkey = -1); - - /// Calls for every signal in . - virtual int remove_handler (const ACE_Sig_Set &sigset); - - // = Suspend and resume Handlers. - - /// Suspend temporarily. Use - /// to get the handle. - virtual int suspend_handler (ACE_Event_Handler *event_handler); - - /// Suspend temporarily. - virtual int suspend_handler (ACE_HANDLE handle); - - /// Suspend all in handle set temporarily. - virtual int suspend_handler (const ACE_Handle_Set &handles); - - /// Suspend all temporarily. - virtual int suspend_handlers (void); - - /// Resume . Use to - /// get the handle. - virtual int resume_handler (ACE_Event_Handler *event_handler); - - /// Resume . - virtual int resume_handler (ACE_HANDLE handle); - - /// Resume all in handle set. - virtual int resume_handler (const ACE_Handle_Set &handles); - - /// Resume all . - virtual int resume_handlers (void); - - /// Does the reactor allow the application to resume the handle on - /// its own ie. can it pass on the control of handle resumption to - /// the application. A positive value indicates that the handlers - /// are application resumable. A value of 0 indicates otherwise. - virtual int resumable_handler (void); - - /** - * Return 1 if we any event associations were made by the reactor - * for the handles that it waits on, 0 otherwise. Since the - * WFMO_Reactor does use event associations, this function always - * return 1. - */ - virtual int uses_event_associations (void); - - // Timer management. - - /** - * Schedule an ACE_Event_Handler that will expire after an amount - * of time. The return value of this method, a timer_id value, - * uniquely identifies the event_handler in the ACE_Reactor's - * internal list of timers. - * This timer_id value can be used to cancel the timer - * with the cancel_timer() call. - * - * @see cancel_timer() - * @see reset_timer_interval() - * - * @param event_handler event handler to schedule on reactor - * @param arg argument passed to the handle_timeout() method of event_handler - * @param delay time interval after which the timer will expire - * @param interval time interval after which the timer will be automatically rescheduled - * @return -1 on failure, a timer_id value on success - */ - virtual long schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - - /** - * Resets the interval of the timer represented by to - * , which is specified in relative time to the current - * . If is equal to - * , the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_timer_interval (long timer_id, - const ACE_Time_Value &interval); - - /// Cancel all Event_Handlers that match the address of - /// . Returns number of handler's cancelled. - virtual int cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close = 1); - - /** - * Cancel the single Event_Handler that matches the value - * (which was returned from the schedule method). If arg is - * non-NULL then it will be set to point to the ``magic cookie'' - * argument passed in when the Event_Handler was registered. This - * makes it possible to free up the memory and avoid memory leaks. - * Returns 1 if cancellation succeeded and 0 if the - * wasn't found. - */ - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1); - - // = High-level Event_Handler scheduling operations - - /** - * Add to the 's entry in - * WFMO_Reactor. must already have been registered - * with WFMO_Reactor. - */ - virtual int schedule_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_added); - - /** - * Add to the 's entry in WFMO_Reactor. - * The Event_Handler associated with must already have been - * registered with WFMO_Reactor. - */ - virtual int schedule_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_added); - - /** - * Remove to the 's entry in - * WFMO_Reactor. The Event_Handler associated with must - * already have been registered with WFMO_Reactor. - */ - virtual int cancel_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_deleted); - - /** - * Remove to the 's entry in - * WFMO_Reactor. The Event_Handler associated with must - * already have been registered with WFMO_Reactor. - */ - virtual int cancel_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_deleted); - - // = Notification methods. - - /** - * Wakeup one thread if it is currently blocked - * in . The indicates how - * long to blocking trying to notify the . If - * == 0, the caller will block until action is possible, - * else will wait until the relative time specified in - * elapses). - */ - virtual int notify (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value * = 0); - - /** - * Set the maximum number of times that the - * method will iterate and - * dispatch the that are passed in via the - * notify queue before breaking out of its - * loop. By default, this is set to - * -1, which means "iterate until the queue is empty." Setting this - * to a value like "1 or 2" will increase "fairness" (and thus - * prevent starvation) at the expense of slightly higher dispatching - * overhead. - */ - virtual void max_notify_iterations (int); - - /** - * Get the maximum number of times that the - * method will iterate and - * dispatch the that are passed in via the - * notify queue before breaking out of its - * loop. - */ - virtual int max_notify_iterations (void); - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. Returns the number of notifications - * purged. Returns -1 on error. - */ - virtual int purge_pending_notifications (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - // = Assorted helper methods. - - /** - * Return the Event_Handler associated with . Return 0 if - * is not registered. - */ - ACE_Event_Handler *find_handler (ACE_HANDLE handle); - - /** - * Check to see if is associated with a valid Event_Handler - * bound to . Return the associated with this - * if != 0. - */ - virtual int handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler = 0); - - /** - * Check to see if is associated with a valid Event_Handler - * bound to a signal. Return the associated with - * this if != 0. - */ - virtual int handler (int signum, - ACE_Event_Handler ** = 0); - - /// Returns true if WFMO_Reactor has been successfully initialized, else - /// false. - virtual int initialized (void); - - /// Returns the current size of the WFMO_Reactor's internal - /// descriptor table. - virtual size_t size (void) const; - - /// Returns a reference to the WFMO_Reactor's internal lock. - virtual ACE_Lock &lock (void); - - /// Wake up all threads in WaitForMultipleObjects so that they can - /// reconsult the handle set - virtual void wakeup_all_threads (void); - - /** - * Transfers ownership of the WFMO_Reactor to the . The - * transfer will not complete until all threads are ready (just like - * the handle set). - */ - virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0); - - /// Return the ID of the "owner" thread. - virtual int owner (ACE_thread_t *owner); - - /// Get the existing restart value. - virtual int restart (void); - - /// Set a new value for restart and return the original value. - virtual int restart (int r); - - /// Not implemented - virtual void requeue_position (int); - - /// Not implemented - virtual int requeue_position (void); - - // = Low-level wait_set mask manipulation methods. - - /** - * Modify of the 's entry in WFMO_Reactor - * depending upon . must already have - * been registered with WFMO_Reactor. - */ - virtual int mask_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks, - int operation); - - /** - * Modify of the 's entry in WFMO_Reactor depending - * upon . must already have been registered - * with WFMO_Reactor. - */ - virtual int mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask masks, - int ops); - - // = Low-level ready_set mask manipulation methods. - - /// Not implemented - virtual int ready_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops); - - /// Not implemented - virtual int ready_ops (ACE_HANDLE handle, - ACE_Reactor_Mask, - int ops); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// Dump the state of an object. - virtual void dump (void) const; - -protected: - /// Registration workhorse - virtual int register_handler_i (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /// Event handling workhorse - virtual int event_handling (ACE_Time_Value *max_wait_time = 0, - int alertable = 0); - - /// Bit masking workhorse - virtual int mask_ops_i (ACE_HANDLE io_handle, - ACE_Reactor_Mask masks, - int operation); - - /// Return the ID of the "owner" thread. Does not do any locking. - virtual ACE_thread_t owner_i (void); - - /// Check to see if it is ok to enter <::WaitForMultipleObjects>. - virtual int ok_to_wait (ACE_Time_Value *max_wait_time, - int alertable); - - /// Wait for timer and I/O events to occur. - virtual DWORD wait_for_multiple_events (int timeout, - int alertable); - - /// Check for activity on remaining handles. - virtual DWORD poll_remaining_handles (DWORD slot); - - /// Expire timers. Only the owner thread does useful stuff in this - /// function. - virtual int expire_timers (void); - - /// Dispatches the timers and I/O handlers. - virtual int dispatch (DWORD wait_status); - - /// Protect against structured exceptions caused by user code when - /// dispatching handles - virtual int safe_dispatch (DWORD wait_status); - - /** - * Dispatches any active handles from handles_[] to - * handles_[active_handles_] using to poll - * through our handle set looking for active handles. - */ - virtual int dispatch_handles (DWORD slot); - - /// Dispatches a single handler. Returns 0 on success, -1 if the - /// handler was removed. - virtual int dispatch_handler (DWORD slot, - DWORD max_handlep1); - - /// Dispatches a single handler. Returns 0 on success, -1 if the - /// handler was removed. - virtual int simple_dispatch_handler (DWORD slot, - ACE_HANDLE event_handle); - - /// Dispatches a single handler. Returns 0 on success, -1 if the - /// handler was removed. - virtual int complex_dispatch_handler (DWORD slot, - ACE_HANDLE event_handle); - - /// Dispatches window messages. Noop for WFMO_Reactor. - virtual int dispatch_window_messages (void); - - virtual ACE_Reactor_Mask upcall (ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - WSANETWORKEVENTS &events); - - /// Used to caluculate the next timeout - virtual int calculate_timeout (ACE_Time_Value *time); - - /// Update the state of the handler repository - virtual int update_state (void); - - /// Check to see if we have a new owner - virtual int new_owner (void); - - /// Set owner to new owner - virtual int change_owner (void); - - /// Handle signals without requiring global/static variables. - ACE_Sig_Handler *signal_handler_; - - /// Keeps track of whether we should delete the signal handler (if we - /// didn't create it, then we don't delete it). - int delete_signal_handler_; - - /// Defined as a pointer to allow overriding by derived classes... - ACE_Timer_Queue *timer_queue_; - - /// Keeps track of whether we should delete the timer queue (if we - /// didn't create it, then we don't delete it). - int delete_timer_queue_; - - /// Keeps track of whether we should delete the handler repository - int delete_handler_rep_; - - /// Used when is called. - ACE_Reactor_Notify *notify_handler_; - - /// Keeps track of whether we should delete the notify handler. - int delete_notify_handler_; - - /** - * Synchronization for the ACE_WFMO_Reactor. - * - * A Process Mutex is used here because of two reasons: - * (a) The implementation of ACE_Thread_Mutex uses CriticalSections - * CriticalSections are not waitable using ::WaitForMultipleObjects - * (b) This is really not a process mutex because it is not - * named. No other process can use this mutex. - */ - ACE_Process_Mutex lock_; - - /// Adapter used to return internal lock to outside world. - ACE_Lock_Adapter lock_adapter_; - - /// Table that maps to 's. - ACE_WFMO_Reactor_Handler_Repository handler_rep_; - - /// A manual event used to block threads from proceeding into - /// WaitForMultipleObjects - ACE_Manual_Event ok_to_wait_; - - /** - * A manual event is used so that we can wake everyone up (e.g., - * when are bounded and unbound from the - * handler repository). - */ - ACE_Manual_Event wakeup_all_threads_; - - /// Used when is signaled - ACE_Wakeup_All_Threads_Handler wakeup_all_threads_handler_; - - /// The changing thread waits on this event, till all threads are not - /// active anymore - ACE_Auto_Event waiting_to_change_state_; - - /// Count of currently active threads - size_t active_threads_; - - /** - * The thread which is "owner" of the WFMO_Reactor. The owner - * concept is used because we don't want multiple threads to try to - * expire timers. Therefore the "owner" thread is the only one - * allowed to expire timers. Also, the owner thread is the only - * thread which waits on the notify handle. Note that the ownership - * can be transferred. - */ - ACE_thread_t owner_; - - /// The owner to be of the WFMO_Reactor - ACE_thread_t new_owner_; - - /// This is the thread which is responsible for the changing the - /// state of the handle set - ACE_thread_t change_state_thread_; - - /// This is an array of ACE_HANDLEs which keep track of the - /// and handles - ACE_HANDLE atomic_wait_array_ [2]; - - /// This flag is used to keep track of whether we are already closed. - int open_for_business_; - - /// This flag is used to keep track of whether we are actively handling - /// events or not. - sig_atomic_t deactivated_; - -private: - /// Deny access since member-wise won't work... - ACE_WFMO_Reactor (const ACE_WFMO_Reactor &); - ACE_WFMO_Reactor &operator = (const ACE_WFMO_Reactor &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/WFMO_Reactor.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_WIN32 */ -#include /**/ "ace/post.h" -#endif /* ACE_WFMO_REACTOR_H */ diff --git a/ace/WFMO_Reactor.inl b/ace/WFMO_Reactor.inl deleted file mode 100644 index b2d24fb05d7..00000000000 --- a/ace/WFMO_Reactor.inl +++ /dev/null @@ -1,1173 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/Handle_Set.h" -#include "ace/Reactor.h" -#include "ace/Thread.h" -#include "ace/Sig_Handler.h" -#include "ace/OS_NS_errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/************************************************************/ - -ACE_INLINE int -ACE_Wakeup_All_Threads_Handler::handle_signal (int /* signum */, - siginfo_t * /* siginfo */, - ucontext_t *) -{ - // This will get called when wakeup_all_threads_> event - // is signaled. There is nothing to be done here. - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) waking up to get updated handle set info\n"))); - return 0; -} - -#if defined (ACE_WIN32) - -/************************************************************/ - -ACE_INLINE -ACE_WFMO_Reactor_Handler_Repository::Common_Info::Common_Info (void) - : io_entry_ (0), - event_handler_ (0), - io_handle_ (ACE_INVALID_HANDLE), - network_events_ (0), - delete_event_ (0), - delete_entry_ (0), - close_masks_ (ACE_Event_Handler::NULL_MASK) -{ -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Common_Info::reset (void) -{ - this->event_handler_ = 0; - this->io_entry_ = 0; - this->io_handle_ = ACE_INVALID_HANDLE; - this->network_events_ = 0; - this->delete_event_ = 0; - this->delete_entry_ = 0; - this->close_masks_ = ACE_Event_Handler::NULL_MASK; -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (int io_entry, - ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - long network_events, - int delete_event, - int delete_entry, - ACE_Reactor_Mask close_masks) -{ - this->event_handler_ = event_handler; - this->io_entry_ = io_entry; - this->io_handle_ = io_handle; - this->network_events_ = network_events; - this->delete_event_ = delete_event; - this->delete_entry_ = delete_entry; - this->close_masks_ = close_masks; -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (Common_Info &common_info) -{ - *this = common_info; -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("I/O Entry = %d\n"), - this->io_entry_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Event Handler = %d\n"), - this->event_handler_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("I/O Handle = %d\n"), - this->io_handle_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Network Events = %d\n"), - this->network_events_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Delete Event = %d\n"), - this->delete_event_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Delete Entry = %d\n"), - this->delete_entry_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Close Masks = %d\n"), - this->close_masks_)); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -/************************************************************/ - -ACE_INLINE -ACE_WFMO_Reactor_Handler_Repository::Current_Info::Current_Info (void) - : suspend_entry_ (0) -{ -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (int io_entry, - ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - long network_events, - int delete_event, - int delete_entry, - ACE_Reactor_Mask close_masks, - int suspend_entry) -{ - this->suspend_entry_ = suspend_entry; - Common_Info::set (io_entry, - event_handler, - io_handle, - network_events, - delete_event, - delete_entry, - close_masks); -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (Common_Info &common_info, - int suspend_entry) -{ - this->suspend_entry_ = suspend_entry; - Common_Info::set (common_info); -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Current_Info::reset (void) -{ - this->suspend_entry_ = 0; - Common_Info::reset (); -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump (ACE_HANDLE event_handle) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - Common_Info::dump (); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Event Handle = %d\n"), - event_handle)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Suspend Entry = %d\n"), - this->suspend_entry_)); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#else /* !ACE_HAS_DUMP */ - ACE_UNUSED_ARG (event_handle); -#endif /* ACE_HAS_DUMP */ -} - -/************************************************************/ - -ACE_INLINE -ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::To_Be_Added_Info (void) - : event_handle_ (ACE_INVALID_HANDLE), - suspend_entry_ (0) -{ -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle, - int io_entry, - ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - long network_events, - int delete_event, - int delete_entry, - ACE_Reactor_Mask close_masks, - int suspend_entry) -{ - this->event_handle_ = event_handle; - this->suspend_entry_ = suspend_entry; - Common_Info::set (io_entry, - event_handler, - io_handle, - network_events, - delete_event, - delete_entry, - close_masks); -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle, - Common_Info &common_info, - int suspend_entry) -{ - this->event_handle_ = event_handle; - this->suspend_entry_ = suspend_entry; - Common_Info::set (common_info); -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::reset (void) -{ - this->event_handle_ = ACE_INVALID_HANDLE; - this->suspend_entry_ = 0; - Common_Info::reset (); -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - Common_Info::dump (); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Event Handle = %d\n"), - this->event_handle_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Suspend Entry = %d\n"), - this->suspend_entry_)); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -/************************************************************/ - -ACE_INLINE -ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::Suspended_Info (void) - : event_handle_ (ACE_INVALID_HANDLE), - resume_entry_ (0) -{ -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::reset (void) -{ - this->event_handle_ = ACE_INVALID_HANDLE; - this->resume_entry_ = 0; - Common_Info::reset (); -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle, - int io_entry, - ACE_Event_Handler *event_handler, - ACE_HANDLE io_handle, - long network_events, - int delete_event, - int delete_entry, - ACE_Reactor_Mask close_masks, - int resume_entry) -{ - this->event_handle_ = event_handle; - this->resume_entry_ = resume_entry; - Common_Info::set (io_entry, - event_handler, - io_handle, - network_events, - delete_event, - delete_entry, - close_masks); -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle, - Common_Info &common_info, - int resume_entry) -{ - this->event_handle_ = event_handle; - this->resume_entry_ = resume_entry; - Common_Info::set (common_info); -} - -ACE_INLINE void -ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - Common_Info::dump (); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Event Handle = %d\n"), - this->event_handle_)); - - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("Resume Entry = %d\n"), - this->resume_entry_)); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -/************************************************************/ - -ACE_INLINE int -ACE_WFMO_Reactor_Handler_Repository::close (void) -{ - // Let all the handlers know that the is closing down - this->unbind_all (); - - return 0; -} - -ACE_INLINE ACE_HANDLE * -ACE_WFMO_Reactor_Handler_Repository::handles (void) const -{ - // This code is probably too subtle to be useful in the long run... - // The basic idea is that all threads wait on all user handles plus - // the handle. The owner thread additional - // waits on the handle. This is to ensure that only the - // thread get to expire timers and handle event on the - // notify pipe. - if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) - return this->current_handles_; - else - return this->current_handles_ + 1; -} - -ACE_INLINE ACE_WFMO_Reactor_Handler_Repository::Current_Info * -ACE_WFMO_Reactor_Handler_Repository::current_info (void) const -{ - if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) - return this->current_info_; - else - return this->current_info_ + 1; -} - -ACE_INLINE DWORD -ACE_WFMO_Reactor_Handler_Repository::max_handlep1 (void) const -{ - if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) - return this->max_handlep1_; - else - return this->max_handlep1_ - 1; -} - -ACE_INLINE int -ACE_WFMO_Reactor_Handler_Repository::scheduled_for_deletion (size_t slot) const -{ - if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) - return this->current_info_[slot].delete_entry_ == 1; - else - return this->current_info_[slot + 1].delete_entry_ == 1; -} - -ACE_INLINE int -ACE_WFMO_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::invalid_handle"); - // It's too expensive to perform more exhaustive validity checks on - // Win32 due to the way that they implement SOCKET HANDLEs. - if (handle == ACE_INVALID_HANDLE) - { - errno = EINVAL; - return 1; - } - else - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor_Handler_Repository::changes_required (void) -{ - // Check if handles have be scheduled for additions or removal - return this->handles_to_be_added_ > 0 - || this->handles_to_be_deleted_ > 0 - || this->handles_to_be_suspended_ > 0 - || this->handles_to_be_resumed_ > 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor_Handler_Repository::make_changes (void) -{ - // This method must ONLY be called by the - // change_state_thread_>. We therefore assume that - // there will be no contention for this method and hence no guards - // are neccessary. - - // Deletions and suspensions in current_info_ - this->make_changes_in_current_infos (); - - // Deletions and resumptions in current_suspended_info_ - this->make_changes_in_suspension_infos (); - - // Deletions in to_be_added_info_, or transfers to current_info_ or - // current_suspended_info_ from to_be_added_info_ - this->make_changes_in_to_be_added_infos (); - - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - if (this->invalid_handle (handle)) - return -1; - - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_, -1); - - int changes_required = 0; - int const result = this->unbind_i (handle, - mask, - changes_required); - - if (changes_required) - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wfmo_reactor_.wakeup_all_threads (); - - return result; -} - -ACE_INLINE int -ACE_WFMO_Reactor::reset_timer_interval - (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_WFMO_Reactor::reset_timer_interval"); - - if (0 != this->timer_queue_) - { - long result = this->timer_queue_->reset_interval - (timer_id, - interval); - - // Wakeup the owner thread so that it gets the latest timer values - this->notify (); - - return result; - } - - errno = ESHUTDOWN; - return -1; -} - -ACE_INLINE long -ACE_WFMO_Reactor::schedule_timer (ACE_Event_Handler *handler, - const void *arg, - const ACE_Time_Value &delay_time, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_WFMO_Reactor::schedule_timer"); - - if (0 != this->timer_queue_) - { - long result = this->timer_queue_->schedule - (handler, - arg, - timer_queue_->gettimeofday () + delay_time, - interval); - - // Wakeup the owner thread so that it gets the latest timer values - this->notify (); - - return result; - } - - errno = ESHUTDOWN; - return -1; -} - -ACE_INLINE int -ACE_WFMO_Reactor::cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_WFMO_Reactor::cancel_timer"); - if (0 != this->timer_queue_) - return this->timer_queue_->cancel (handler, dont_call_handle_close); - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_WFMO_Reactor::cancel_timer"); - if (0 != this->timer_queue_) - return this->timer_queue_->cancel (timer_id, arg, dont_call_handle_close); - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler, - ACE_HANDLE event_handle) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - return this->handler_rep_.bind_i (0, - event_handler, - 0, - ACE_INVALID_HANDLE, - event_handle, - 0); -} - -ACE_INLINE int -ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - return this->register_handler_i (ACE_INVALID_HANDLE, - ACE_INVALID_HANDLE, - event_handler, - mask); -} - -ACE_INLINE int -ACE_WFMO_Reactor::register_handler (ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - return this->register_handler_i (ACE_INVALID_HANDLE, - io_handle, - event_handler, - mask); -} - -ACE_INLINE int -ACE_WFMO_Reactor::register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - return this->register_handler_i (event_handle, - io_handle, - event_handler, - mask); -} - -ACE_INLINE int -ACE_WFMO_Reactor::register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - ACE_Handle_Set_Iterator handle_iter (handles); - ACE_HANDLE h; - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->register_handler_i (h, - ACE_INVALID_HANDLE, - handler, - mask) == -1) - return -1; - - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::schedule_wakeup (ACE_HANDLE io_handle, - ACE_Reactor_Mask masks_to_be_added) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - return this->mask_ops_i (io_handle, - masks_to_be_added, - ACE_Reactor::ADD_MASK); -} - -ACE_INLINE int -ACE_WFMO_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_added) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - return this->mask_ops_i (event_handler->get_handle (), - masks_to_be_added, - ACE_Reactor::ADD_MASK); -} - -ACE_INLINE int -ACE_WFMO_Reactor::cancel_wakeup (ACE_HANDLE io_handle, - ACE_Reactor_Mask masks_to_be_removed) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - return this->mask_ops_i (io_handle, - masks_to_be_removed, - ACE_Reactor::CLR_MASK); -} - -ACE_INLINE int -ACE_WFMO_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_removed) -{ - // This GUARD is necessary since we are updating shared state. - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - return this->mask_ops_i (event_handler->get_handle (), - masks_to_be_removed, - ACE_Reactor::CLR_MASK); -} - -ACE_INLINE int -ACE_WFMO_Reactor::remove_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - return this->handler_rep_.unbind (event_handler->get_handle (), - mask); -} - -ACE_INLINE int -ACE_WFMO_Reactor::remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - return this->handler_rep_.unbind (handle, - mask); -} - -ACE_INLINE int -ACE_WFMO_Reactor::remove_handler (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask) -{ - ACE_Handle_Set_Iterator handle_iter (handles); - ACE_HANDLE h; - int changes_required = 0; - - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->handler_rep_.unbind_i (h, - mask, - changes_required) == -1) - return -1; - - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wakeup_all_threads (); - - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::suspend_handler (ACE_HANDLE handle) -{ - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - int changes_required = 0; - int const result = - this->handler_rep_.suspend_handler_i (handle, - changes_required); - - if (changes_required) - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wakeup_all_threads (); - - return result; -} - -ACE_INLINE int -ACE_WFMO_Reactor::suspend_handler (ACE_Event_Handler *event_handler) -{ - return this->suspend_handler (event_handler->get_handle ()); -} - -ACE_INLINE int -ACE_WFMO_Reactor::suspend_handler (const ACE_Handle_Set &handles) -{ - ACE_Handle_Set_Iterator handle_iter (handles); - ACE_HANDLE h; - int changes_required = 0; - - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->handler_rep_.suspend_handler_i (h, - changes_required) == -1) - return -1; - - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wakeup_all_threads (); - - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::suspend_handlers (void) -{ - int error = 0; - int result = 0; - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - // First suspend all current handles - int changes_required = 0; - - for (size_t i = 0; - i < this->handler_rep_.max_handlep1_ && error == 0; - i++) - { - result = - this->handler_rep_.suspend_handler_i (this->handler_rep_.current_handles_[i], - changes_required); - if (result == -1) - error = 1; - } - - if (!error) - // Then suspend all to_be_added_handles - for (size_t i = 0; - i < this->handler_rep_.handles_to_be_added_; - i++) - this->handler_rep_.to_be_added_info_[i].suspend_entry_ = 1; - - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wakeup_all_threads (); - - return error ? -1 : 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::resume_handler (ACE_HANDLE handle) -{ - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - int changes_required = 0; - int result = - this->handler_rep_.resume_handler_i (handle, - changes_required); - - if (changes_required) - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wakeup_all_threads (); - - return result; -} - -ACE_INLINE int -ACE_WFMO_Reactor::resume_handler (ACE_Event_Handler *event_handler) -{ - return this->resume_handler (event_handler->get_handle ()); -} - -ACE_INLINE int -ACE_WFMO_Reactor::resume_handler (const ACE_Handle_Set &handles) -{ - ACE_Handle_Set_Iterator handle_iter (handles); - ACE_HANDLE h; - int changes_required = 0; - - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->handler_rep_.resume_handler_i (h, - changes_required) == -1) - return -1; - - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wakeup_all_threads (); - - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::resume_handlers (void) -{ - int error = 0; - int result = 0; - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - int changes_required = 0; - for (size_t i = 0; - i < this->handler_rep_.suspended_handles_ && error == 0; - i++) - { - result = - this->handler_rep_.resume_handler_i (this->handler_rep_.current_suspended_info_[i].event_handle_, - changes_required); - if (result == -1) - error = 1; - } - - if (!error) - // Then resume all to_be_added_handles - for (size_t i = 0; - i < this->handler_rep_.handles_to_be_added_; - i++) - this->handler_rep_.to_be_added_info_[i].suspend_entry_ = 0; - - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the handle set - this->wakeup_all_threads (); - - return error ? -1 : 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::uses_event_associations (void) -{ - // Since the WFMO_Reactor does use event associations, this function - // always return 1. - return 1; -} - -ACE_INLINE int -ACE_WFMO_Reactor::handle_events (ACE_Time_Value &how_long) -{ - return this->event_handling (&how_long, FALSE); -} - -ACE_INLINE int -ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value &how_long) -{ - return this->event_handling (&how_long, TRUE); -} - -ACE_INLINE int -ACE_WFMO_Reactor::handle_events (ACE_Time_Value *how_long) -{ - return this->event_handling (how_long, FALSE); -} - -ACE_INLINE int -ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value *how_long) -{ - return this->event_handling (how_long, TRUE); -} - -ACE_INLINE int -ACE_WFMO_Reactor::deactivated (void) -{ - return this->deactivated_; -} - -ACE_INLINE void -ACE_WFMO_Reactor::deactivate (int do_stop) -{ - this->deactivated_ = do_stop; - this->wakeup_all_threads (); -} - -ACE_INLINE int -ACE_WFMO_Reactor::owner (ACE_thread_t *t) -{ - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - *t = this->owner_i (); - return 0; -} - -ACE_INLINE ACE_thread_t -ACE_WFMO_Reactor::owner_i (void) -{ - return this->owner_; -} - -ACE_INLINE int -ACE_WFMO_Reactor::owner (ACE_thread_t new_owner, ACE_thread_t *old_owner) -{ - ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); - this->new_owner_ = new_owner; - - if (old_owner != 0) - *old_owner = this->owner_i (); - - // Wake up all threads in WaitForMultipleObjects so that they can - // reconsult the new owner responsibilities - this->wakeup_all_threads (); - - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::new_owner (void) -{ - return this->new_owner_ != ACE_thread_t (0); -} - -ACE_INLINE int -ACE_WFMO_Reactor::change_owner (void) -{ - this->owner_ = this->new_owner_; - this->new_owner_ = ACE_thread_t (0); - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::safe_dispatch (DWORD wait_status) -{ - int result = -1; - ACE_SEH_TRY - { - result = this->dispatch (wait_status); - } - ACE_SEH_FINALLY - { - this->update_state (); - } - - return result; -} - -ACE_INLINE int -ACE_WFMO_Reactor::dispatch_window_messages (void) -{ - return 0; -} - -ACE_INLINE void -ACE_WFMO_Reactor::wakeup_all_threads (void) -{ - this->wakeup_all_threads_.signal (); -} - -ACE_INLINE int -ACE_WFMO_Reactor::notify (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - ACE_Time_Value *timeout) -{ - return this->notify_handler_->notify (event_handler, mask, timeout); -} - -ACE_INLINE int -ACE_WFMO_Reactor::register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp, - ACE_Event_Handler **old_sh, - ACE_Sig_Action *old_disp) -{ - return this->signal_handler_->register_handler (signum, - new_sh, new_disp, - old_sh, old_disp); -} - -ACE_INLINE int -ACE_WFMO_Reactor::register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp) -{ - int result = 0; - -#if (ACE_NSIG > 0) - for (int s = 1; s < ACE_NSIG; s++) - if (sigset.is_member (s) - && this->signal_handler_->register_handler (s, - new_sh, - new_disp) == -1) - result = -1; -#else - ACE_UNUSED_ARG (sigset); - ACE_UNUSED_ARG (new_sh); - ACE_UNUSED_ARG (new_disp); -#endif /* ACE_NSIG */ - - return result; -} - -ACE_INLINE int -ACE_WFMO_Reactor::remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp, - int sigkey) -{ - return this->signal_handler_->remove_handler (signum, - new_disp, - old_disp, - sigkey); -} - -ACE_INLINE int -ACE_WFMO_Reactor::remove_handler (const ACE_Sig_Set &sigset) -{ - int result = 0; - -#if (ACE_NSIG > 0) - for (int s = 1; s < ACE_NSIG; s++) - if (sigset.is_member (s) - && this->signal_handler_->remove_handler (s) == -1) - result = -1; -#else - ACE_UNUSED_ARG (sigset); -#endif /* ACE_NSIG */ - - return result; -} - -ACE_INLINE int -ACE_WFMO_Reactor::handler (int signum, ACE_Event_Handler **eh) -{ - ACE_Event_Handler *handler = - this->signal_handler_->handler (signum); - - if (handler == 0) - return -1; - else if (eh != 0) - *eh = handler; - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::mask_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int operation) -{ - ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); - - return this->mask_ops_i (event_handler->get_handle (), - mask, - operation); -} - -ACE_INLINE int -ACE_WFMO_Reactor::mask_ops (ACE_HANDLE io_handle, - ACE_Reactor_Mask mask, - int operation) -{ - ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); - - return this->mask_ops_i (io_handle, - mask, - operation); -} - -ACE_INLINE void -ACE_WFMO_Reactor::requeue_position (int) -{ - // Not implemented -} - -ACE_INLINE int -ACE_WFMO_Reactor::requeue_position (void) -{ - // Don't have an implementation for this yet... - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_WFMO_Reactor::restart (void) -{ - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::restart (int) -{ - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor::ready_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops) -{ - // Don't have an implementation for this yet... - ACE_UNUSED_ARG (event_handler); - ACE_UNUSED_ARG (mask); - ACE_UNUSED_ARG (ops); - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_WFMO_Reactor::ready_ops (ACE_HANDLE handle, - ACE_Reactor_Mask, - int ops) -{ - // Don't have an implementation for this yet... - ACE_UNUSED_ARG (handle); - ACE_UNUSED_ARG (ops); - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE ACE_Event_Handler * -ACE_WFMO_Reactor::find_handler (ACE_HANDLE handle) -{ - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, 0); - - return this->handler_rep_.find_handler (handle); -} - -ACE_INLINE int -ACE_WFMO_Reactor::handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler) -{ - ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); - - return this->handler_rep_.handler (handle, - mask, - event_handler); -} - -ACE_INLINE int -ACE_WFMO_Reactor::initialized (void) -{ - return this->open_for_business_; -} - -ACE_INLINE ACE_Lock & -ACE_WFMO_Reactor::lock (void) -{ - return this->lock_adapter_; -} - -ACE_INLINE size_t -ACE_WFMO_Reactor::size (void) const -{ - // Size of repository minus the 2 used for internal purposes - return this->handler_rep_.max_size_ - 2; -} -#else -ACE_INLINE int -ACE_WFMO_Reactor_Handler_Repository::changes_required (void) -{ - return 0; -} - -ACE_INLINE int -ACE_WFMO_Reactor_Handler_Repository::make_changes (void) -{ - return 0; -} - -ACE_INLINE -ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void) -{ -} - -#endif /* ACE_WIN32 */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/WIN32_Asynch_IO.cpp b/ace/WIN32_Asynch_IO.cpp deleted file mode 100644 index afe50d51c05..00000000000 --- a/ace/WIN32_Asynch_IO.cpp +++ /dev/null @@ -1,3755 +0,0 @@ -// $Id$ - -#include "ace/WIN32_Asynch_IO.h" - -ACE_RCSID (ace, - Win32_Asynch_IO, - "$Id$") - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - -#include "ace/WIN32_Proactor.h" -#include "ace/Message_Block.h" -#include "ace/Service_Config.h" -#include "ace/INET_Addr.h" -#include "ace/Task_T.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -size_t -ACE_WIN32_Asynch_Result::bytes_transferred (void) const -{ - return this->bytes_transferred_; -} - -const void * -ACE_WIN32_Asynch_Result::act (void) const -{ - return this->act_; -} - -int -ACE_WIN32_Asynch_Result::success (void) const -{ - return this->success_; -} - -const void * -ACE_WIN32_Asynch_Result::completion_key (void) const -{ - return this->completion_key_; -} - -u_long -ACE_WIN32_Asynch_Result::error (void) const -{ - return this->error_; -} - -ACE_HANDLE -ACE_WIN32_Asynch_Result::event (void) const -{ - return this->hEvent; -} - -u_long -ACE_WIN32_Asynch_Result::offset (void) const -{ - return this->Offset; -} - -u_long -ACE_WIN32_Asynch_Result::offset_high (void) const -{ - return this->OffsetHigh; -} - -int -ACE_WIN32_Asynch_Result::priority (void) const -{ - ACE_NOTSUP_RETURN (0); -} - -int -ACE_WIN32_Asynch_Result::signal_number (void) const -{ - ACE_NOTSUP_RETURN (0); -} - -int -ACE_WIN32_Asynch_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - // Get to the platform specific implementation. - ACE_WIN32_Proactor *win32_proactor = dynamic_cast (proactor); - - if (win32_proactor == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("Dynamic cast to WIN32 Proactor failed\n")), - -1); - - // Post myself. - return win32_proactor->post_completion (this); -} - -void -ACE_WIN32_Asynch_Result::set_bytes_transferred (size_t nbytes) -{ - this->bytes_transferred_ = nbytes; -} - -void -ACE_WIN32_Asynch_Result::set_error (u_long errcode) -{ - this->error_ = errcode; -} - -ACE_WIN32_Asynch_Result::~ACE_WIN32_Asynch_Result (void) -{ -} - -ACE_WIN32_Asynch_Result::ACE_WIN32_Asynch_Result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - const void* act, - ACE_HANDLE event, - u_long offset, - u_long offset_high, - int priority, - int signal_number) - : ACE_Asynch_Result_Impl (), - OVERLAPPED (), - handler_proxy_ (handler_proxy), - act_ (act), - bytes_transferred_ (0), - success_ (0), - completion_key_ (0), - error_ (0) -{ - // Set the ACE_OVERLAPPED structure - this->Internal = 0; - this->InternalHigh = 0; - this->Offset = offset; - this->OffsetHigh = offset_high; - this->hEvent = event; - - ACE_UNUSED_ARG (priority); - ACE_UNUSED_ARG (signal_number); -} - -int -ACE_WIN32_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - this->proactor_ = proactor; - this->handler_proxy_ = handler_proxy; - this->handle_ = handle; - - // Grab the handle from the if is invalid - if (this->handle_ == ACE_INVALID_HANDLE) - { - ACE_Handler *handler = handler_proxy.get ()->handler (); - if (handler != 0) - this->handle_ = handler->handle (); - } - if (this->handle_ == ACE_INVALID_HANDLE) - return -1; - - // Register with the . - return this->win32_proactor_->register_handle (this->handle_, - completion_key); -} - -int -ACE_WIN32_Asynch_Operation::cancel (void) -{ -#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) \ - && ( (defined (_MSC_VER)) \ - || (defined (__BORLANDC__)) \ - || (defined (__MINGW32))) - // All I/O operations that are canceled will complete with the error - // ERROR_OPERATION_ABORTED. All completion notifications for the I/O - // operations will occur normally. - - // @@ This API returns 0 on failure. So, I am returning -1 in that - // case. Is that right? (Alex). - - int const result = (int) ::CancelIo (this->handle_); - - if (result == 0) - // Couldnt cancel the operations. - return 2; - - // result is non-zero. All the operations are cancelled then. - return 0; - -#else /* Not ACE_HAS_WINNT4 && ACE_HAS_WINNT4!=0 && _MSC... */ - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_AIO_CALLS */ -} - -ACE_Proactor * -ACE_WIN32_Asynch_Operation::proactor (void) const -{ - return this->proactor_; -} - -ACE_WIN32_Asynch_Operation::ACE_WIN32_Asynch_Operation (ACE_WIN32_Proactor *win32_proactor) - : ACE_Asynch_Operation_Impl (), - win32_proactor_ (win32_proactor), - proactor_ (0), - handle_ (ACE_INVALID_HANDLE) -{ -} - -ACE_WIN32_Asynch_Operation::~ACE_WIN32_Asynch_Operation (void) -{ -} - -// ************************************************************ - -size_t -ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read (void) const -{ - return this->bytes_to_read_; -} - -ACE_Message_Block & -ACE_WIN32_Asynch_Read_Stream_Result::message_block (void) const -{ - return this->message_block_; -} - -ACE_HANDLE -ACE_WIN32_Asynch_Read_Stream_Result::handle (void) const -{ - return this->handle_; -} - -ACE_WIN32_Asynch_Read_Stream_Result::ACE_WIN32_Asynch_Read_Stream_Result ( - const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number, - int scatter_enabled) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Read_Stream_Result_Impl (), - ACE_WIN32_Asynch_Result (handler_proxy, - act, - event, - 0, - 0, - priority, - signal_number), - bytes_to_read_ (bytes_to_read), - message_block_ (message_block), - handle_ (handle), - scatter_enabled_ (scatter_enabled) -{ -} - -void -ACE_WIN32_Asynch_Read_Stream_Result::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - // Copy the data which was returned by GetQueuedCompletionStatus - this->bytes_transferred_ = bytes_transferred; - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // Appropriately move the pointers in the message block. - if (!this->scatter_enabled ()) - this->message_block_.wr_ptr (bytes_transferred); - else - { - for (ACE_Message_Block* mb = &this->message_block_; - (mb != 0) && (bytes_transferred > 0); - mb = mb->cont ()) - { - size_t len_part = mb->space (); - - if (len_part > bytes_transferred) - len_part = bytes_transferred; - - mb->wr_ptr (len_part); - - bytes_transferred -= len_part; - } - } - - // Create the interface result class. - ACE_Asynch_Read_Stream::Result result (this); - - // Call the application handler. - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_read_stream (result); -} - -ACE_WIN32_Asynch_Read_Stream_Result::~ACE_WIN32_Asynch_Read_Stream_Result (void) -{ -} - -// Base class operations. These operations are here to kill dominance -// warnings. These methods call the base class methods. - -size_t -ACE_WIN32_Asynch_Read_Stream_Result::bytes_transferred (void) const -{ - return ACE_WIN32_Asynch_Result::bytes_transferred (); -} - -const void * -ACE_WIN32_Asynch_Read_Stream_Result::act (void) const -{ - return ACE_WIN32_Asynch_Result::act (); -} - -int -ACE_WIN32_Asynch_Read_Stream_Result::success (void) const -{ - return ACE_WIN32_Asynch_Result::success (); -} - -const void * -ACE_WIN32_Asynch_Read_Stream_Result::completion_key (void) const -{ - return ACE_WIN32_Asynch_Result::completion_key (); -} - -u_long -ACE_WIN32_Asynch_Read_Stream_Result::error (void) const -{ - return ACE_WIN32_Asynch_Result::error (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Read_Stream_Result::event (void) const -{ - return ACE_WIN32_Asynch_Result::event (); -} - -u_long -ACE_WIN32_Asynch_Read_Stream_Result::offset (void) const -{ - return ACE_WIN32_Asynch_Result::offset (); -} - -u_long -ACE_WIN32_Asynch_Read_Stream_Result::offset_high (void) const -{ - return ACE_WIN32_Asynch_Result::offset_high (); -} - -int -ACE_WIN32_Asynch_Read_Stream_Result::priority (void) const -{ - return ACE_WIN32_Asynch_Result::priority (); -} - -int -ACE_WIN32_Asynch_Read_Stream_Result::signal_number (void) const -{ - return ACE_WIN32_Asynch_Result::signal_number (); -} - -int -ACE_WIN32_Asynch_Read_Stream_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - return ACE_WIN32_Asynch_Result::post_completion (proactor); -} - -int -ACE_WIN32_Asynch_Read_Stream_Result::scatter_enabled (void) const -{ - return this->scatter_enabled_; -} - -ACE_WIN32_Asynch_Read_Stream::ACE_WIN32_Asynch_Read_Stream (ACE_WIN32_Proactor *win32_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Read_Stream_Impl (), - ACE_WIN32_Asynch_Operation (win32_proactor) -{ -} - -int -ACE_WIN32_Asynch_Read_Stream::read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) -{ - size_t space = message_block.space (); - if (bytes_to_read > space) - bytes_to_read = space; - - if (bytes_to_read == 0) - { - errno = ENOSPC; - return -1; - } - - // Create the Asynch_Result. - ACE_WIN32_Asynch_Read_Stream_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_Stream_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_read, - act, - this->win32_proactor_->get_handle (), - priority, - signal_number), - -1); - - // Shared read - int const return_val = this->shared_read (result); - - // Upon errors - if (return_val == -1) - delete result; - - return return_val; -} - -int -ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) -{ -#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - // We should not read more than user requested, - // but it is allowed to read less - - for (const ACE_Message_Block* msg = &message_block; - msg != 0 && bytes_to_read > 0 && iovcnt < ACE_IOV_MAX; - msg = msg->cont () , ++iovcnt ) - { - size_t msg_space = msg->space (); - - // OS should correctly process zero length buffers - // if ( msg_space == 0 ) - // ACE_ERROR_RETURN ((LM_ERROR, - // ACE_LIB_TEXT ("ACE_WIN32_Asynch_Read_Stream::readv:") - // ACE_LIB_TEXT ("No space in the message block\n")), - // -1); - - if (msg_space > bytes_to_read) - msg_space = bytes_to_read; - bytes_to_read -= msg_space; - - // Make as many iovec as needed to fit all of msg_space. - size_t wr_ptr_offset = 0; - while (msg_space > 0 && iovcnt < ACE_IOV_MAX) - { - u_long this_chunk_length; - if (msg_space > ULONG_MAX) - this_chunk_length = ULONG_MAX; - else - this_chunk_length = static_cast (msg_space); - // Collect the data in the iovec. - iov[iovcnt].iov_base = msg->wr_ptr () + wr_ptr_offset; - iov[iovcnt].iov_len = this_chunk_length; - msg_space -= this_chunk_length; - wr_ptr_offset += this_chunk_length; - - // Increment iovec counter if there's more to do. - if (msg_space > 0) - ++iovcnt; - } - if (msg_space > 0) // Ran out of iovecs before msg_space exhausted - { - errno = ERANGE; - return -1; - } - } - - // Re-calculate number bytes to read - bytes_to_read = 0; - - for (int i = 0; i < iovcnt ; ++i) - bytes_to_read += iov[i].iov_len; - - if (bytes_to_read == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Read_Stream::readv:") - ACE_LIB_TEXT ("Attempt to read 0 bytes\n")), - -1); - - // Create the Asynch_Result. - ACE_WIN32_Asynch_Read_Stream_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_Stream_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_read, - act, - this->win32_proactor_->get_handle (), - priority, - signal_number, - 1), // scatter read enabled - -1); - - // do the scatter recv - - result->set_error (0); // Clear error before starting IO. - - DWORD bytes_recvd = 0; - u_long flags = 0; - - int initiate_result = ::WSARecv (reinterpret_cast (result->handle ()), - reinterpret_cast (iov), - iovcnt, - &bytes_recvd, - &flags, - result, - 0); - - if (0 == initiate_result) - // Immediate success: the OVERLAPPED will still get queued. - return 1; - - ACE_ASSERT (initiate_result == SOCKET_ERROR); - - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - initiate_result = 0; - break; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("WSARecv"))); - } - - delete result; - initiate_result = -1; - break; - } - - return initiate_result; -#else - ACE_UNUSED_ARG (message_block); - ACE_UNUSED_ARG (bytes_to_read); - ACE_UNUSED_ARG (act); - ACE_UNUSED_ARG (priority); - ACE_UNUSED_ARG (signal_number); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 != 0 */ -} - -ACE_WIN32_Asynch_Read_Stream::~ACE_WIN32_Asynch_Read_Stream (void) -{ -} - -int -ACE_WIN32_Asynch_Read_Stream::shared_read (ACE_WIN32_Asynch_Read_Stream_Result *result) -{ - // ReadFile API limits us to DWORD range. - if (result->bytes_to_read () > MAXDWORD) - { - errno = ERANGE; - return -1; - } - DWORD bytes_to_read = static_cast (result->bytes_to_read ()); - u_long bytes_read; - - result->set_error (0); // Clear error before starting IO. - - // Initiate the read - int initiate_result = ::ReadFile (result->handle (), - result->message_block ().wr_ptr (), - bytes_to_read, - &bytes_read, - result); - if (initiate_result == 1) - // Immediate success: the OVERLAPPED will still get queued. - return 0; - - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - /* FALLTHRU */ - case ERROR_MORE_DATA: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - return 0; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ReadFile"))); - } - - return -1; - } -} - -// Methods belong to ACE_WIN32_Asynch_Operation base class. These -// methods are defined here to avoid VC++ warnings. They route the -// call to the ACE_WIN32_Asynch_Operation base class. - -int -ACE_WIN32_Asynch_Read_Stream::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return ACE_WIN32_Asynch_Operation::open (handler_proxy, - handle, - completion_key, - proactor); -} - -int -ACE_WIN32_Asynch_Read_Stream::cancel (void) -{ - return ACE_WIN32_Asynch_Operation::cancel (); -} - -ACE_Proactor * -ACE_WIN32_Asynch_Read_Stream::proactor (void) const -{ - return ACE_WIN32_Asynch_Operation::proactor (); -} - -size_t -ACE_WIN32_Asynch_Write_Stream_Result::bytes_to_write (void) const -{ - return this->bytes_to_write_; -} - -ACE_Message_Block & -ACE_WIN32_Asynch_Write_Stream_Result::message_block (void) const -{ - return this->message_block_; -} - -ACE_HANDLE -ACE_WIN32_Asynch_Write_Stream_Result::handle (void) const -{ - return this->handle_; -} - -ACE_WIN32_Asynch_Write_Stream_Result::ACE_WIN32_Asynch_Write_Stream_Result ( - const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number, - int gather_enabled) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Write_Stream_Result_Impl (), - ACE_WIN32_Asynch_Result - (handler_proxy, act, event, 0, 0, priority, signal_number), - bytes_to_write_ (bytes_to_write), - message_block_ (message_block), - handle_ (handle), - gather_enabled_ (gather_enabled) -{ -} - -void -ACE_WIN32_Asynch_Write_Stream_Result::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - // Copy the data which was returned by . - this->bytes_transferred_ = bytes_transferred; - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // Appropriately move the pointers in the message block. - if (!this->gather_enabled ()) - this->message_block_.rd_ptr (bytes_transferred); - else - { - for (ACE_Message_Block* mb = &this->message_block_; - (mb != 0) && (bytes_transferred > 0); - mb = mb->cont ()) - { - size_t len_part = mb->length (); - - if ( len_part > bytes_transferred) - len_part = bytes_transferred; - - mb->rd_ptr (len_part); - - bytes_transferred -= len_part; - } - } - - // Create the interface result class. - ACE_Asynch_Write_Stream::Result result (this); - - // Call the application handler. - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_write_stream (result); -} - -ACE_WIN32_Asynch_Write_Stream_Result::~ACE_WIN32_Asynch_Write_Stream_Result (void) -{ -} - -// Base class operations. These operations are here to kill dominance -// warnings. These methods call the base class methods. - -size_t -ACE_WIN32_Asynch_Write_Stream_Result::bytes_transferred (void) const -{ - return ACE_WIN32_Asynch_Result::bytes_transferred (); -} - -const void * -ACE_WIN32_Asynch_Write_Stream_Result::act (void) const -{ - return ACE_WIN32_Asynch_Result::act (); -} - -int -ACE_WIN32_Asynch_Write_Stream_Result::success (void) const -{ - return ACE_WIN32_Asynch_Result::success (); -} - -const void * -ACE_WIN32_Asynch_Write_Stream_Result::completion_key (void) const -{ - return ACE_WIN32_Asynch_Result::completion_key (); -} - -u_long -ACE_WIN32_Asynch_Write_Stream_Result::error (void) const -{ - return ACE_WIN32_Asynch_Result::error (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Write_Stream_Result::event (void) const -{ - return ACE_WIN32_Asynch_Result::event (); -} - -u_long -ACE_WIN32_Asynch_Write_Stream_Result::offset (void) const -{ - return ACE_WIN32_Asynch_Result::offset (); -} - -u_long -ACE_WIN32_Asynch_Write_Stream_Result::offset_high (void) const -{ - return ACE_WIN32_Asynch_Result::offset_high (); -} - -int -ACE_WIN32_Asynch_Write_Stream_Result::priority (void) const -{ - return ACE_WIN32_Asynch_Result::priority (); -} - -int -ACE_WIN32_Asynch_Write_Stream_Result::signal_number (void) const -{ - return ACE_WIN32_Asynch_Result::signal_number (); -} - -int -ACE_WIN32_Asynch_Write_Stream_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - return ACE_WIN32_Asynch_Result::post_completion (proactor); -} - -int -ACE_WIN32_Asynch_Write_Stream_Result::gather_enabled (void) const -{ - return this->gather_enabled_; -} - -ACE_WIN32_Asynch_Write_Stream::ACE_WIN32_Asynch_Write_Stream (ACE_WIN32_Proactor *win32_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Write_Stream_Impl (), - ACE_WIN32_Asynch_Operation (win32_proactor) -{ -} - -int -ACE_WIN32_Asynch_Write_Stream::write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) -{ - size_t len = message_block.length(); - - if (bytes_to_write > len) - bytes_to_write = len ; - - if (bytes_to_write == 0) - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Write_Stream::write:") - ACE_LIB_TEXT ("Attempt to write 0 bytes\n")), - -1); - - ACE_WIN32_Asynch_Write_Stream_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_Stream_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_write, - act, - this->win32_proactor_->get_handle (), - priority, - signal_number), - -1); - - // Shared write - int return_val = this->shared_write (result); - - // Upon errors - if (return_val == -1) - delete result; - - return return_val; -} - -int -ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) -{ -#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - // We should not write more than user requested, - // but it is allowed to write less - - for (const ACE_Message_Block* msg = &message_block; - msg != 0 && bytes_to_write > 0 && iovcnt < ACE_IOV_MAX; - msg = msg->cont ()) - { - size_t msg_len = msg->length (); - - // Skip 0-length blocks. - if (msg_len == 0) - continue; - if (msg_len > bytes_to_write) - msg_len = bytes_to_write; - bytes_to_write -= msg_len; - - // Make as many iovec as needed to fit all of msg_len. - size_t rd_ptr_offset = 0; - while (msg_len > 0 && iovcnt < ACE_IOV_MAX) - { - u_long this_chunk_length; - if (msg_len > ULONG_MAX) - this_chunk_length = ULONG_MAX; - else - this_chunk_length = static_cast (msg_len); - // Collect the data in the iovec. - iov[iovcnt].iov_base = msg->rd_ptr () + rd_ptr_offset; - iov[iovcnt].iov_len = this_chunk_length; - msg_len -= this_chunk_length; - rd_ptr_offset += this_chunk_length; - - // Increment iovec counter if there's more to do. - if (msg_len > 0) - iovcnt++; - } - if (msg_len > 0) // Ran out of iovecs before msg_space exhausted - { - errno = ERANGE; - return -1; - } - ++iovcnt; - } - - // Re-calculate number bytes to write - bytes_to_write = 0; - - for ( int i=0; i < iovcnt ; ++i ) - bytes_to_write += iov[i].iov_len; - - if ( bytes_to_write == 0 ) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Write_Stream::writev:") - ACE_LIB_TEXT ("Attempt to write 0 bytes\n")), - -1); - - - ACE_WIN32_Asynch_Write_Stream_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_Stream_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_write, - act, - this->win32_proactor_->get_handle (), - priority, - signal_number, - 1), // gather write enabled - -1); - - // do the gather send - - u_long bytes_sent = 0; - - int initiate_result = ::WSASend (reinterpret_cast (result->handle ()), - reinterpret_cast (iov), - iovcnt, - &bytes_sent, - 0, // flags - result, - 0); - - if (0 == initiate_result) - // Immediate success: the OVERLAPPED will still get queued. - return 1; - - ACE_ASSERT (initiate_result == SOCKET_ERROR); - - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - initiate_result = 0; - break; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("WSASend"))); - } - - delete result; - initiate_result = -1; - break; - } - - return initiate_result; -#else - ACE_UNUSED_ARG (message_block); - ACE_UNUSED_ARG (bytes_to_write); - ACE_UNUSED_ARG (act); - ACE_UNUSED_ARG (priority); - ACE_UNUSED_ARG (signal_number); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 != 0 */ -} - -ACE_WIN32_Asynch_Write_Stream::~ACE_WIN32_Asynch_Write_Stream (void) -{ -} - -int -ACE_WIN32_Asynch_Write_Stream::shared_write (ACE_WIN32_Asynch_Write_Stream_Result *result) -{ - u_long bytes_written; - if (result->bytes_to_write () > MAXDWORD) - { - errno = ERANGE; - return -1; - } - DWORD bytes_to_write = static_cast (result->bytes_to_write ()); - - result->set_error (0); // Clear error before starting IO. - - // Initiate the write - int initiate_result = ::WriteFile (result->handle (), - result->message_block ().rd_ptr (), - bytes_to_write, - &bytes_written, - result); - if (initiate_result == 1) - // Immediate success: the OVERLAPPED will still get queued. - return 0; - - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - return 0; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - if (ACE::debug ()) - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("WriteFile"))); - return -1; - } -} - -// Methods belong to ACE_WIN32_Asynch_Operation base class. These -// methods are defined here to avoid VC++ warnings. They route the -// call to the ACE_WIN32_Asynch_Operation base class. - -int -ACE_WIN32_Asynch_Write_Stream::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return ACE_WIN32_Asynch_Operation::open (handler_proxy, - handle, - completion_key, - proactor); -} - -int -ACE_WIN32_Asynch_Write_Stream::cancel (void) -{ - return ACE_WIN32_Asynch_Operation::cancel (); -} - -ACE_Proactor * -ACE_WIN32_Asynch_Write_Stream::proactor (void) const -{ - return ACE_WIN32_Asynch_Operation::proactor (); -} - -ACE_WIN32_Asynch_Read_File_Result::ACE_WIN32_Asynch_Read_File_Result ( - const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number, - int scatter_enabled) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Read_Stream_Result_Impl (), - ACE_Asynch_Read_File_Result_Impl (), - ACE_WIN32_Asynch_Read_Stream_Result (handler_proxy, - handle, - message_block, - bytes_to_read, - act, - event, - priority, - signal_number, - scatter_enabled) -{ - this->Offset = offset; - this->OffsetHigh = offset_high; -} - -void -ACE_WIN32_Asynch_Read_File_Result::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - // Copy the data which was returned by GetQueuedCompletionStatus. - this->bytes_transferred_ = bytes_transferred; - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // Appropriately move the pointers in the message block. - if (!this->scatter_enabled ()) - this->message_block_.wr_ptr (bytes_transferred); - else - { - static const size_t page_size = ACE_OS::getpagesize(); - - for (ACE_Message_Block* mb = &this->message_block_; - (mb != 0) && (bytes_transferred > 0); - mb = mb->cont ()) - { - // mb->space () is ought to be >= page_size. - // this is verified in the readv method - // ACE_ASSERT (mb->space () >= page_size); - - size_t len_part = page_size ; - - if ( len_part > bytes_transferred) - len_part = bytes_transferred; - - mb->wr_ptr (len_part); - - bytes_transferred -= len_part; - } - } - - // Create the interface result class. - ACE_Asynch_Read_File::Result result (this); - - // Call the application handler. - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_read_file (result); -} - -ACE_WIN32_Asynch_Read_File_Result::~ACE_WIN32_Asynch_Read_File_Result (void) -{ -} - -// Base class operations. These operations are here to kill dominance -// warnings. These methods call the base class methods. - -size_t -ACE_WIN32_Asynch_Read_File_Result::bytes_transferred (void) const -{ - return ACE_WIN32_Asynch_Result::bytes_transferred (); -} - -const void * -ACE_WIN32_Asynch_Read_File_Result::act (void) const -{ - return ACE_WIN32_Asynch_Result::act (); -} - -int -ACE_WIN32_Asynch_Read_File_Result::success (void) const -{ - return ACE_WIN32_Asynch_Result::success (); -} - -const void * -ACE_WIN32_Asynch_Read_File_Result::completion_key (void) const -{ - return ACE_WIN32_Asynch_Result::completion_key (); -} - -u_long -ACE_WIN32_Asynch_Read_File_Result::error (void) const -{ - return ACE_WIN32_Asynch_Result::error (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Read_File_Result::event (void) const -{ - return ACE_WIN32_Asynch_Result::event (); -} - -u_long -ACE_WIN32_Asynch_Read_File_Result::offset (void) const -{ - return ACE_WIN32_Asynch_Result::offset (); -} - -u_long -ACE_WIN32_Asynch_Read_File_Result::offset_high (void) const -{ - return ACE_WIN32_Asynch_Result::offset_high (); -} - -int -ACE_WIN32_Asynch_Read_File_Result::priority (void) const -{ - return ACE_WIN32_Asynch_Result::priority (); -} - -int -ACE_WIN32_Asynch_Read_File_Result::signal_number (void) const -{ - return ACE_WIN32_Asynch_Result::signal_number (); -} - -// The following methods belong to -// ACE_WIN32_Asynch_Read_Stream_Result. They are here to avoid VC++ -// warnings. These methods route their call to the -// ACE_WIN32_Asynch_Read_Stream_Result base class. - -size_t -ACE_WIN32_Asynch_Read_File_Result::bytes_to_read (void) const -{ - return ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read (); -} - -ACE_Message_Block & -ACE_WIN32_Asynch_Read_File_Result::message_block (void) const -{ - return ACE_WIN32_Asynch_Read_Stream_Result::message_block (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Read_File_Result::handle (void) const -{ - return ACE_WIN32_Asynch_Read_Stream_Result::handle (); -} - -int -ACE_WIN32_Asynch_Read_File_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - return ACE_WIN32_Asynch_Result::post_completion (proactor); -} - -// ************************************************************ - -ACE_WIN32_Asynch_Read_File::ACE_WIN32_Asynch_Read_File (ACE_WIN32_Proactor *win32_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Read_Stream_Impl (), - ACE_Asynch_Read_File_Impl (), - ACE_WIN32_Asynch_Read_Stream (win32_proactor) -{ -} - -int -ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block, - size_t bytes_to_read, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) -{ - size_t space = message_block.space (); - if ( bytes_to_read > space ) - bytes_to_read = space; - - if ( bytes_to_read == 0 ) - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Read_File::read:") - ACE_LIB_TEXT ("Attempt to read 0 bytes or no space in the message block\n")), - -1); - - - ACE_WIN32_Asynch_Read_File_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_File_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_read, - act, - offset, - offset_high, - this->win32_proactor_->get_handle (), - priority, - signal_number), - -1); - - // Shared read - int return_val = this->shared_read (result); - - // Upon errors - if (return_val == -1) - delete result; - - return return_val; -} - -int -ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) -{ -#if ((ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - static const size_t page_size = ACE_OS::getpagesize(); - - FILE_SEGMENT_ELEMENT buffer_pointers[ACE_IOV_MAX + 1]; - int buffer_pointers_count = 0; - - // Each buffer must be at least the size of a system memory page - // and must be aligned on a system memory page size boundary - - // We should not read more than user requested, - // but it is allowed to read less - - size_t total_space = 0; - - for (const ACE_Message_Block* msg = &message_block; - msg != 0 && buffer_pointers_count < ACE_IOV_MAX && total_space < bytes_to_read; - msg = msg->cont(), ++buffer_pointers_count ) - { - size_t msg_space = msg->space (); - - if (msg_space < page_size) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Read_File::readv:") - ACE_LIB_TEXT ("Invalid message block size\n")), - -1); - - buffer_pointers[buffer_pointers_count].Buffer = msg->wr_ptr (); - total_space += page_size; - } - - // not read more than buffers space - if (bytes_to_read > total_space) - bytes_to_read = total_space; - - // ReadFileScatter API limits us to DWORD range. - if (bytes_to_read > MAXDWORD) - { - errno = ERANGE; - return -1; - } - DWORD dword_bytes_to_read = static_cast (bytes_to_read); - - // last one should be completely 0 - buffer_pointers[buffer_pointers_count].Buffer = 0; - - ACE_WIN32_Asynch_Read_File_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_File_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_read, - act, - offset, - offset_high, - this->win32_proactor_->get_handle (), - priority, - signal_number, - 1), // scatter read enabled - -1); - - // do the scatter read - result->set_error (0); // Clear error before starting IO. - - int initiate_result = ::ReadFileScatter (result->handle (), - buffer_pointers, - dword_bytes_to_read, - 0, // reserved, must be NULL - result); - - if (0 != initiate_result) - // Immediate success: the OVERLAPPED will still get queued. - return 1; - - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - initiate_result = 0; - break; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ReadFileScatter"))); - } - - delete result; - initiate_result = -1; - break; - } - - return initiate_result; -#else /*#if ( (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))*/ - ACE_NOTSUP_RETURN (-1); -#endif /*#if ( (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))*/ -} - - -ACE_WIN32_Asynch_Read_File::~ACE_WIN32_Asynch_Read_File (void) -{ -} - -int -ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) -{ - return ACE_WIN32_Asynch_Read_Stream::read (message_block, - bytes_to_read, - act, - priority, - signal_number); -} - -int -ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) -{ - return ACE_WIN32_Asynch_Read_Stream::readv (message_block, - bytes_to_read, - act, - priority, - signal_number); -} - -// Methods belong to ACE_WIN32_Asynch_Operation base class. These -// methods are defined here to avoid VC++ warnings. They route the -// call to the ACE_WIN32_Asynch_Operation base class. - -int -ACE_WIN32_Asynch_Read_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return ACE_WIN32_Asynch_Operation::open (handler_proxy, - handle, - completion_key, - proactor); -} - -int -ACE_WIN32_Asynch_Read_File::cancel (void) -{ - return ACE_WIN32_Asynch_Operation::cancel (); -} - -ACE_Proactor * -ACE_WIN32_Asynch_Read_File::proactor (void) const -{ - return ACE_WIN32_Asynch_Operation::proactor (); -} - -ACE_WIN32_Asynch_Write_File_Result::ACE_WIN32_Asynch_Write_File_Result ( - const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number, - int gather_enabled) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Write_Stream_Result_Impl (), - ACE_Asynch_Write_File_Result_Impl (), - ACE_WIN32_Asynch_Write_Stream_Result (handler_proxy, - handle, - message_block, - bytes_to_write, - act, - event, - priority, - signal_number, - gather_enabled) -{ - this->Offset = offset; - this->OffsetHigh = offset_high; -} - -void -ACE_WIN32_Asynch_Write_File_Result::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - // Copy the data which was returned by GetQueuedCompletionStatus - this->bytes_transferred_ = bytes_transferred; - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // Appropriately move the pointers in the message block. - if (!this->gather_enabled ()) - this->message_block_.rd_ptr (bytes_transferred); - else - { - static const size_t page_size = ACE_OS::getpagesize(); - - for (ACE_Message_Block* mb = &this->message_block_; - (mb != 0) && (bytes_transferred > 0); - mb = mb->cont ()) - { - // mb->length () is ought to be >= page_size. - // this is verified in the writev method - // ACE_ASSERT (mb->length () >= page_size); - - size_t len_part = page_size; - - if ( len_part > bytes_transferred) - len_part = bytes_transferred; - - mb->rd_ptr (len_part); - - bytes_transferred -= len_part; - } - - } - - // Create the interface result class. - ACE_Asynch_Write_File::Result result (this); - - // Call the application handler. - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_write_file (result); -} - -ACE_WIN32_Asynch_Write_File_Result::~ACE_WIN32_Asynch_Write_File_Result (void) -{ -} - -// Base class operations. These operations are here to kill dominance -// warnings. These methods call the base class methods. - -size_t -ACE_WIN32_Asynch_Write_File_Result::bytes_transferred (void) const -{ - return ACE_WIN32_Asynch_Result::bytes_transferred (); -} - -const void * -ACE_WIN32_Asynch_Write_File_Result::act (void) const -{ - return ACE_WIN32_Asynch_Result::act (); -} - -int -ACE_WIN32_Asynch_Write_File_Result::success (void) const -{ - return ACE_WIN32_Asynch_Result::success (); -} - -const void * -ACE_WIN32_Asynch_Write_File_Result::completion_key (void) const -{ - return ACE_WIN32_Asynch_Result::completion_key (); -} - -u_long -ACE_WIN32_Asynch_Write_File_Result::error (void) const -{ - return ACE_WIN32_Asynch_Result::error (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Write_File_Result::event (void) const -{ - return ACE_WIN32_Asynch_Result::event (); -} - -u_long -ACE_WIN32_Asynch_Write_File_Result::offset (void) const -{ - return ACE_WIN32_Asynch_Result::offset (); -} - -u_long -ACE_WIN32_Asynch_Write_File_Result::offset_high (void) const -{ - return ACE_WIN32_Asynch_Result::offset_high (); -} - -int -ACE_WIN32_Asynch_Write_File_Result::priority (void) const -{ - return ACE_WIN32_Asynch_Result::priority (); -} - -int -ACE_WIN32_Asynch_Write_File_Result::signal_number (void) const -{ - return ACE_WIN32_Asynch_Result::signal_number (); -} - -// The following methods belong to -// ACE_WIN32_Asynch_Write_Stream_Result. They are here to avoid VC++ -// warnings. These methods route their call to the -// ACE_WIN32_Asynch_Write_Stream_Result base class. - -size_t -ACE_WIN32_Asynch_Write_File_Result::bytes_to_write (void) const -{ - return ACE_WIN32_Asynch_Write_Stream_Result::bytes_to_write (); -} - -ACE_Message_Block & -ACE_WIN32_Asynch_Write_File_Result::message_block (void) const -{ - return ACE_WIN32_Asynch_Write_Stream_Result::message_block (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Write_File_Result::handle (void) const -{ - return ACE_WIN32_Asynch_Write_Stream_Result::handle (); -} - -int -ACE_WIN32_Asynch_Write_File_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - return ACE_WIN32_Asynch_Result::post_completion (proactor); -} - -ACE_WIN32_Asynch_Write_File::ACE_WIN32_Asynch_Write_File (ACE_WIN32_Proactor *win32_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Write_Stream_Impl (), - ACE_Asynch_Write_File_Impl (), - ACE_WIN32_Asynch_Write_Stream (win32_proactor) -{ -} - -int -ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) -{ - size_t len = message_block.length (); - if ( bytes_to_write > len ) - bytes_to_write = len; - - if ( bytes_to_write == 0 ) - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Write_File::write:") - ACE_LIB_TEXT ("Attempt to read 0 bytes\n")), - -1); - - ACE_WIN32_Asynch_Write_File_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_File_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_write, - act, - offset, - offset_high, - this->win32_proactor_->get_handle (), - priority, - signal_number), - -1); - - // Shared write - int return_val = this->shared_write (result); - - // Upon errors - if (return_val == -1) - delete result; - - return return_val; -} - -int -ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) -{ -#if ((ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - static const size_t page_size = ACE_OS::getpagesize(); - - FILE_SEGMENT_ELEMENT buffer_pointers[ACE_IOV_MAX + 1]; - int buffer_pointers_count = 0; - - // Each buffer must be at least the size of a system memory page - // and must be aligned on a system memory page size boundary - - // We should not read more than user requested, - // but it is allowed to read less - - size_t total_len = 0; - - for (const ACE_Message_Block* msg = &message_block; - msg != 0 && buffer_pointers_count < ACE_IOV_MAX && total_len < bytes_to_write; - msg = msg->cont (), ++buffer_pointers_count ) - { - size_t msg_len = msg->length (); - - // Don't allow writing less than page_size, unless - // the size of the message block is big enough (so we don't write from - // memory which does not belong to the message block), and the message - // block is the last in the chain. - if (msg_len < page_size && - (msg->size () - (msg->rd_ptr () - msg->base ()) < page_size || // message block too small - bytes_to_write - total_len > page_size ))// NOT last chunk - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Write_File::writev:") - ACE_LIB_TEXT ("Invalid message block length\n")), - -1); - - buffer_pointers[buffer_pointers_count].Buffer = msg->rd_ptr (); - total_len += page_size; - } - - // not write more than we have in buffers - if (bytes_to_write > total_len) - bytes_to_write = total_len; - // WriteFileGather API limits us to DWORD range. - if (bytes_to_write > MAXDWORD) - { - errno = ERANGE; - return -1; - } - DWORD dword_bytes_to_write = static_cast (bytes_to_write); - - // last one should be completely 0 - buffer_pointers[buffer_pointers_count].Buffer = 0; - - ACE_WIN32_Asynch_Write_File_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_File_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_write, - act, - offset, - offset_high, - this->win32_proactor_->get_handle (), - priority, - signal_number, - 1), // gather write enabled - -1); - - result->set_error(0); - - // do the gather write - int initiate_result = ::WriteFileGather (result->handle (), - buffer_pointers, - dword_bytes_to_write, - 0, // reserved, must be NULL - result); - - if (0 != initiate_result) - // Immediate success: the OVERLAPPED will still get queued. - return 1; - - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - initiate_result = 0; - break; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("WriteFileGather"))); - } - - delete result; - initiate_result = -1; - break; - } - - return initiate_result; -#else /*#if ((ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))*/ - - ACE_NOTSUP_RETURN (-1); - -#endif /* */ -} - - -ACE_WIN32_Asynch_Write_File::~ACE_WIN32_Asynch_Write_File (void) -{ -} - -int -ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) -{ - return ACE_WIN32_Asynch_Write_Stream::write (message_block, - bytes_to_write, - act, - priority, - signal_number); -} - -int -ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) -{ - return ACE_WIN32_Asynch_Write_Stream::writev (message_block, - bytes_to_write, - act, - priority, - signal_number); -} - -// Methods belong to ACE_WIN32_Asynch_Operation base class. These -// methods are defined here to avoid VC++ warnings. They route the -// call to the ACE_WIN32_Asynch_Operation base class. - -int -ACE_WIN32_Asynch_Write_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return ACE_WIN32_Asynch_Operation::open (handler_proxy, - handle, - completion_key, - proactor); -} - -int -ACE_WIN32_Asynch_Write_File::cancel (void) -{ - return ACE_WIN32_Asynch_Operation::cancel (); -} - -ACE_Proactor * -ACE_WIN32_Asynch_Write_File::proactor (void) const -{ - return ACE_WIN32_Asynch_Operation::proactor (); -} - -size_t -ACE_WIN32_Asynch_Accept_Result::bytes_to_read (void) const -{ - return this->bytes_to_read_; -} - -ACE_Message_Block & -ACE_WIN32_Asynch_Accept_Result::message_block (void) const -{ - return this->message_block_; -} - -ACE_HANDLE -ACE_WIN32_Asynch_Accept_Result::listen_handle (void) const -{ - return this->listen_handle_; -} - -ACE_HANDLE -ACE_WIN32_Asynch_Accept_Result::accept_handle (void) const -{ - return this->accept_handle_; -} - -ACE_WIN32_Asynch_Accept_Result::ACE_WIN32_Asynch_Accept_Result ( - const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE listen_handle, - ACE_HANDLE accept_handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Accept_Result_Impl (), - ACE_WIN32_Asynch_Result (handler_proxy, - act, - event, - 0, - 0, - priority, - signal_number), - bytes_to_read_ (bytes_to_read), - message_block_ (message_block), - listen_handle_ (listen_handle), - accept_handle_ (accept_handle) -{ -} - -void -ACE_WIN32_Asynch_Accept_Result::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - // Copy the data which was returned by GetQueuedCompletionStatus - this->bytes_transferred_ = bytes_transferred; - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // Appropriately move the pointers in the message block. - this->message_block_.wr_ptr (bytes_transferred); - - if (!success && this->accept_handle_ != ACE_INVALID_HANDLE) - { - ACE_OS::closesocket (this->accept_handle_); - this->accept_handle_ = ACE_INVALID_HANDLE; - } - - // Create the interface result class. - ACE_Asynch_Accept::Result result (this); - - // Call the application handler. - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_accept (result); -} - -ACE_WIN32_Asynch_Accept_Result::~ACE_WIN32_Asynch_Accept_Result (void) -{ -} - -// Base class operations. These operations are here to kill dominance -// warnings. These methods call the base class methods. - -size_t -ACE_WIN32_Asynch_Accept_Result::bytes_transferred (void) const -{ - return ACE_WIN32_Asynch_Result::bytes_transferred (); -} - -const void * -ACE_WIN32_Asynch_Accept_Result::act (void) const -{ - return ACE_WIN32_Asynch_Result::act (); -} - -int -ACE_WIN32_Asynch_Accept_Result::success (void) const -{ - return ACE_WIN32_Asynch_Result::success (); -} - -const void * -ACE_WIN32_Asynch_Accept_Result::completion_key (void) const -{ - return ACE_WIN32_Asynch_Result::completion_key (); -} - -u_long -ACE_WIN32_Asynch_Accept_Result::error (void) const -{ - return ACE_WIN32_Asynch_Result::error (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Accept_Result::event (void) const -{ - return ACE_WIN32_Asynch_Result::event (); -} - -u_long -ACE_WIN32_Asynch_Accept_Result::offset (void) const -{ - return ACE_WIN32_Asynch_Result::offset (); -} - -u_long -ACE_WIN32_Asynch_Accept_Result::offset_high (void) const -{ - return ACE_WIN32_Asynch_Result::offset_high (); -} - -int -ACE_WIN32_Asynch_Accept_Result::priority (void) const -{ - return ACE_WIN32_Asynch_Result::priority (); -} - -int -ACE_WIN32_Asynch_Accept_Result::signal_number (void) const -{ - return ACE_WIN32_Asynch_Result::signal_number (); -} - -int -ACE_WIN32_Asynch_Accept_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - return ACE_WIN32_Asynch_Result::post_completion (proactor); -} - -ACE_WIN32_Asynch_Accept::ACE_WIN32_Asynch_Accept (ACE_WIN32_Proactor *win32_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Accept_Impl (), - ACE_WIN32_Asynch_Operation (win32_proactor) -{ -} - -int -ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block, - size_t bytes_to_read, - ACE_HANDLE accept_handle, - const void *act, - int priority, - int signal_number, - int addr_family) -{ -#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) - // Sanity check: make sure that enough space has been allocated by - // the caller. - size_t address_size = -#if defined (ACE_HAS_IPV6) - addr_family == AF_INET ? sizeof (sockaddr_in) : sizeof (sockaddr_in6); -#else - sizeof (sockaddr_in); -#endif /* ACE_HAS_IPV6 */ - address_size += 16; // AcceptEx requires address size + 16 (minimum) - size_t available_space = message_block.space (); - size_t space_needed = bytes_to_read + 2 * address_size; - if (available_space < space_needed) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("Buffer too small\n")), -1); - - // WIN Specific. - - // AcceptEx API limits us to DWORD range. - if (bytes_to_read > MAXDWORD) - { - errno = ERANGE; - return -1; - } - DWORD dword_bytes_to_read = static_cast (bytes_to_read); - - int close_accept_handle = 0; - // If the is invalid, we will create a new socket. - if (accept_handle == ACE_INVALID_HANDLE) - { - accept_handle = ACE_OS::socket (addr_family, - SOCK_STREAM, - 0); - if (accept_handle == ACE_INVALID_HANDLE) - { - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_OS::socket"))); - } - return -1; - } - else - // Remember to close the socket down if failures occur. - close_accept_handle = 1; - } - - // Common code for both WIN and POSIX. - ACE_WIN32_Asynch_Accept_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Accept_Result (this->handler_proxy_, - this->handle_, - accept_handle, - message_block, - bytes_to_read, - act, - this->win32_proactor_->get_handle (), - priority, - signal_number), - -1); - - u_long bytes_read; - - // Initiate the accept. - int initiate_result = ::AcceptEx ((SOCKET) result->listen_handle (), - (SOCKET) result->accept_handle (), - result->message_block ().wr_ptr (), - dword_bytes_to_read, - static_cast (address_size), - static_cast (address_size), - &bytes_read, - result); - if (initiate_result == 1) - // Immediate success: the OVERLAPPED will still get queued. - return 1; - - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - return 0; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - if (close_accept_handle == 1) - // Close the newly created socket - ACE_OS::closesocket (accept_handle); - - // Cleanup dynamically allocated Asynch_Result. - delete result; - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("AcceptEx"))); - } - return -1; - } -#else /* ACE_HAS_WINNT4 .......|| ACE_HAS_AIO_CALLS */ - ACE_UNUSED_ARG (message_block); - ACE_UNUSED_ARG (bytes_to_read); - ACE_UNUSED_ARG (accept_handle); - ACE_UNUSED_ARG (act); - ACE_UNUSED_ARG (priority); - ACE_UNUSED_ARG (signal_number); - ACE_UNUSED_ARG (addr_family); - ACE_NOTSUP_RETURN (-1); -#endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || (defined (ACE_HAS_AIO_CALLS) */ -} - -ACE_WIN32_Asynch_Accept::~ACE_WIN32_Asynch_Accept (void) -{ -} - -// Methods belong to ACE_WIN32_Asynch_Operation base class. These -// methods are defined here to avoid VC++ warnings. They route the -// call to the ACE_WIN32_Asynch_Operation base class. - -int -ACE_WIN32_Asynch_Accept::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return ACE_WIN32_Asynch_Operation::open (handler_proxy, - handle, - completion_key, - proactor); -} - -int -ACE_WIN32_Asynch_Accept::cancel (void) -{ - return ACE_WIN32_Asynch_Operation::cancel (); -} - -ACE_Proactor * -ACE_WIN32_Asynch_Accept::proactor (void) const -{ - return ACE_WIN32_Asynch_Operation::proactor (); -} - -// ********************************************************************* - -ACE_HANDLE -ACE_WIN32_Asynch_Connect_Result::connect_handle (void) const -{ - return this->connect_handle_; -} - -void ACE_WIN32_Asynch_Connect_Result::connect_handle ( ACE_HANDLE handle ) -{ - this->connect_handle_ = handle; -} - - -ACE_WIN32_Asynch_Connect_Result::ACE_WIN32_Asynch_Connect_Result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE connect_handle, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Connect_Result_Impl (), - ACE_WIN32_Asynch_Result - (handler_proxy, act, event, 0, 0, priority, signal_number), - connect_handle_ (connect_handle) -{ - ; -} - -void -ACE_WIN32_Asynch_Connect_Result::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - // Copy the data. - this->bytes_transferred_ = bytes_transferred; - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // Create the interface result class. - ACE_Asynch_Connect::Result result (this); - - // Call the application handler. - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_connect (result); -} - -ACE_WIN32_Asynch_Connect_Result::~ACE_WIN32_Asynch_Connect_Result (void) -{ -} - -// Base class operations. These operations are here to kill dominance -// warnings. These methods call the base class methods. - -size_t -ACE_WIN32_Asynch_Connect_Result::bytes_transferred (void) const -{ - return ACE_WIN32_Asynch_Result::bytes_transferred (); -} - -const void * -ACE_WIN32_Asynch_Connect_Result::act (void) const -{ - return ACE_WIN32_Asynch_Result::act (); -} - -int -ACE_WIN32_Asynch_Connect_Result::success (void) const -{ - return ACE_WIN32_Asynch_Result::success (); -} - -const void * -ACE_WIN32_Asynch_Connect_Result::completion_key (void) const -{ - return ACE_WIN32_Asynch_Result::completion_key (); -} - -u_long -ACE_WIN32_Asynch_Connect_Result::error (void) const -{ - return ACE_WIN32_Asynch_Result::error (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Connect_Result::event (void) const -{ - return ACE_WIN32_Asynch_Result::event (); -} - -u_long -ACE_WIN32_Asynch_Connect_Result::offset (void) const -{ - return ACE_WIN32_Asynch_Result::offset (); -} - -u_long -ACE_WIN32_Asynch_Connect_Result::offset_high (void) const -{ - return ACE_WIN32_Asynch_Result::offset_high (); -} - -int -ACE_WIN32_Asynch_Connect_Result::priority (void) const -{ - return ACE_WIN32_Asynch_Result::priority (); -} - -int -ACE_WIN32_Asynch_Connect_Result::signal_number (void) const -{ - return ACE_WIN32_Asynch_Result::signal_number (); -} - -int -ACE_WIN32_Asynch_Connect_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - return ACE_WIN32_Asynch_Result::post_completion (proactor); -} - -// ********************************************************************* - -ACE_WIN32_Asynch_Connect::ACE_WIN32_Asynch_Connect (ACE_WIN32_Proactor * win32_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Connect_Impl (), - ACE_WIN32_Asynch_Operation (win32_proactor), - flg_open_ (false) -{ -} - -ACE_WIN32_Asynch_Connect::~ACE_WIN32_Asynch_Connect (void) -{ - this->close (); - this->reactor (0); // to avoid purge_pending_notifications -} - -ACE_Proactor * -ACE_WIN32_Asynch_Connect::proactor (void) const -{ - return ACE_WIN32_Asynch_Operation::proactor (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Connect::get_handle (void) const -{ - - ACE_ASSERT (0); - return ACE_INVALID_HANDLE; -} - -void -ACE_WIN32_Asynch_Connect::set_handle (ACE_HANDLE) -{ - ACE_ASSERT (0) ; -} - -int -ACE_WIN32_Asynch_Connect::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE, - const void *completion_key, - ACE_Proactor *proactor) -{ - ACE_TRACE ("ACE_WIN32_Asynch_Connect::open"); - - // if we are already opened, - // we could not create a new handler without closing the previous - if (this->flg_open_) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%N:%l:ACE_WIN32_Asynch_Connect::open:") - ACE_LIB_TEXT ("connector already open \n")), - -1); - - //int result = - ACE_WIN32_Asynch_Operation::open (handler_proxy, - ACE_INVALID_HANDLE, - completion_key, - proactor); - - // Ignore result as we pass ACE_INVALID_HANDLE - //if (result == -1) - // return result; - - this->flg_open_ = true; - - return 0; -} - -int -ACE_WIN32_Asynch_Connect::connect (ACE_HANDLE connect_handle, - const ACE_Addr & remote_sap, - const ACE_Addr & local_sap, - int reuse_addr, - const void *act, - int priority, - int signal_number) -{ - ACE_TRACE ("ACE_WIN32_Asynch_Connect::connect"); - - if (!this->flg_open_) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%N:%l:ACE_WIN32_Asynch_Connect::connect") - ACE_LIB_TEXT ("connector was not opened before\n")), - -1); - - // Common code for both WIN and WIN32. - // Create future Asynch_Connect_Result - ACE_WIN32_Asynch_Connect_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Connect_Result (this->handler_proxy_, - connect_handle, - act, - this->win32_proactor_->get_handle (), - priority, - signal_number), - -1); - - int rc = connect_i (result, - remote_sap, - local_sap, - reuse_addr); - - // update handle - connect_handle = result->connect_handle (); - - if (rc != 0) - return post_result (result, true); - - // Enqueue result we will wait for completion - { - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); - - if (this->result_map_.bind (connect_handle, result) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Connect::connect: %p\n"), - ACE_LIB_TEXT ("bind"))); - result->set_error (EFAULT); - return post_result (result, true); - } - } - - ACE_Asynch_Pseudo_Task & task = - this->win32_proactor_->get_asynch_pseudo_task (); - - if (-1 == task.register_io_handler (connect_handle, - this, - ACE_Event_Handler::CONNECT_MASK, - 0)) // not to suspend after register - { - result = 0; - { - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); - this->result_map_.unbind (connect_handle, result); - } - if (result != 0) - { - result->set_error (EFAULT); - this->post_result (result, true); - } - } - - return 0; -} - -int ACE_WIN32_Asynch_Connect::post_result (ACE_WIN32_Asynch_Connect_Result * result, - bool post_enable) -{ - if (this->flg_open_ && post_enable) - { - if (this->win32_proactor_ ->post_completion (result) == 0) - return 0; - - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("Error:(%P | %t):%p\n"), - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Connect::post_result: ") - ACE_LIB_TEXT (" failed"))); - } - - ACE_HANDLE handle = result->connect_handle (); - - if (handle != ACE_INVALID_HANDLE) - ACE_OS::closesocket (handle); - - delete result; - - return -1; -} - -// connect_i -// return code : -// -1 errors before attempt to connect -// 0 connect started -// 1 connect finished ( may be unsuccessfully) - -int -ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result, - const ACE_Addr & remote_sap, - const ACE_Addr & local_sap, - int reuse_addr) -{ - result->set_bytes_transferred (0); - - ACE_HANDLE handle = result->connect_handle (); - if (handle == ACE_INVALID_HANDLE) - { - int protocol_family = remote_sap.get_type (); - handle = ACE_OS::socket (protocol_family, - SOCK_STREAM, - 0); - - // save it - result->connect_handle (handle); - if (handle == ACE_INVALID_HANDLE) - { - result->set_error (errno); - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Connect::connect_i: %p\n"), - ACE_LIB_TEXT ("socket")), - -1); - } - - // Reuse the address - int one = 1; - if (protocol_family != PF_UNIX && - reuse_addr != 0 && - ACE_OS::setsockopt (handle, - SOL_SOCKET, - SO_REUSEADDR, - (const char*) &one, - sizeof one) == -1) - { - result->set_error (errno); - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Connect::connect_i: %p\n"), - ACE_LIB_TEXT ("setsockopt")), - -1); - } - } - - if (local_sap != ACE_Addr::sap_any) - { - sockaddr * laddr = reinterpret_cast (local_sap.get_addr ()); - int size = local_sap.get_size (); - if (ACE_OS::bind (handle, laddr, size) == -1) - { - result->set_error (errno); - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Connect::connect_i: %p\n"), - ACE_LIB_TEXT ("bind")), - -1); - } - } - - // set non blocking mode - if (ACE::set_flags (handle, ACE_NONBLOCK) != 0) - { - result->set_error (errno); - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Connect::connect_i: %p\n"), - ACE_LIB_TEXT ("set_flags")), - -1); - } - - for (;;) - { - int rc = ACE_OS::connect - (handle, - reinterpret_cast (remote_sap.get_addr ()), - remote_sap.get_size ()); - - if (rc < 0) // failure - { - if (errno == EWOULDBLOCK || errno == EINPROGRESS) - return 0; // connect started - - if (errno == EINTR) - continue; - - result->set_error (errno); - } - return 1 ; // connect finished - } -} - - -// cancel_uncompleted -// It performs cancellation of all pending requests -// -// Parameter flg_notify can be -// 0 - don't send notifications about canceled accepts -// !0 - notify user about canceled accepts -// according WIN32 standards we should receive notifications -// on canceled AIO requests -// -// Return value : number of cancelled requests -// - -int -ACE_WIN32_Asynch_Connect::cancel_uncompleted (bool flg_notify, - ACE_Handle_Set &set) -{ - ACE_TRACE ("ACE_WIN32_Asynch_Connect::cancel_uncompleted"); - - int retval = 0; - - MAP_MANAGER::ITERATOR iter (result_map_); - MAP_MANAGER::ENTRY * me = 0; - - set.reset (); - - for (; iter.next (me) != 0; retval++, iter.advance ()) - { - ACE_HANDLE handle = me->ext_id_; - ACE_WIN32_Asynch_Connect_Result* result = me->int_id_ ; - - set.set_bit (handle); - - result->set_bytes_transferred (0); - result->set_error (ERROR_OPERATION_ABORTED); - this->post_result (result, flg_notify); - } - - result_map_.unbind_all (); - - return retval; -} - -int -ACE_WIN32_Asynch_Connect::cancel (void) -{ - ACE_TRACE ("ACE_WIN32_Asynch_Connect::cancel"); - - int rc = -1 ; // ERRORS - - ACE_Handle_Set set; - int num_cancelled = 0; - { - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); - - num_cancelled = cancel_uncompleted (flg_open_, set); - } - if (num_cancelled == 0) - rc = 1; // AIO_ALLDONE - else if (num_cancelled > 0) - rc = 0; // AIO_CANCELED - - if (!this->flg_open_) - return rc; - - ACE_Asynch_Pseudo_Task & task = - this->win32_proactor_->get_asynch_pseudo_task (); - - task.remove_io_handler (set); - return rc; -} - -int -ACE_WIN32_Asynch_Connect::close (void) -{ - ACE_TRACE ("ACE_WIN32_Asynch_Connect::close"); - - ACE_Handle_Set set; - int num_cancelled = 0; - { - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); - - num_cancelled = cancel_uncompleted (flg_open_, set); - } - if (num_cancelled == 0 || this->flg_open_ == 0) - { - this->flg_open_ = false; - return 0; - } - - ACE_Asynch_Pseudo_Task & task = - this->win32_proactor_->get_asynch_pseudo_task (); - - task.remove_io_handler (set); - return 0; -} - -int -ACE_WIN32_Asynch_Connect::handle_exception (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_exception"); - return handle_output (fd); -} - -int -ACE_WIN32_Asynch_Connect::handle_input (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_input"); - return handle_output (fd); -} - -int -ACE_WIN32_Asynch_Connect::handle_output (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_output"); - - ACE_WIN32_Asynch_Connect_Result* result = 0; - - { - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0)); - if (this->result_map_.unbind (fd, result) != 0) // not found - return -1; - } - - int sockerror = 0 ; - int lsockerror = sizeof sockerror; - - ACE_OS::getsockopt (fd, - SOL_SOCKET, - SO_ERROR, - (char*) & sockerror, - & lsockerror); - - // This previously just did a "return -1" and let handle_close() clean - // things up. However, this entire object may be gone as a result of - // the application's completion handler, so don't count on 'this' being - // legitimate on return from post_result(). - // remove_io_handler() contains flag DONT_CALL - this->win32_proactor_->get_asynch_pseudo_task().remove_io_handler (fd); - - result->set_bytes_transferred (0); - result->set_error (sockerror); - this->post_result (result, this->flg_open_); - return 0; -} - - -int -ACE_WIN32_Asynch_Connect::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask) -{ - ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_close"); - - ACE_Asynch_Pseudo_Task & task = - this->win32_proactor_->get_asynch_pseudo_task (); - task.remove_io_handler (fd); - - ACE_WIN32_Asynch_Connect_Result* result = 0; - - { - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0)); - if (this->result_map_.unbind (fd, result) != 0) // not found - return -1; - } - - result->set_bytes_transferred (0); - result->set_error (ERROR_OPERATION_ABORTED); - this->post_result (result, this->flg_open_); - - return 0; -} - -// ********************************************************************* - -ACE_HANDLE -ACE_WIN32_Asynch_Transmit_File_Result::socket (void) const -{ - return this->socket_; -} - -ACE_HANDLE -ACE_WIN32_Asynch_Transmit_File_Result::file (void) const -{ - return this->file_; -} - -ACE_Asynch_Transmit_File::Header_And_Trailer * -ACE_WIN32_Asynch_Transmit_File_Result::header_and_trailer (void) const -{ - return this->header_and_trailer_; -} - -size_t -ACE_WIN32_Asynch_Transmit_File_Result::bytes_to_write (void) const -{ - return this->bytes_to_write_; -} - -size_t -ACE_WIN32_Asynch_Transmit_File_Result::bytes_per_send (void) const -{ - return this->bytes_per_send_; -} - -u_long -ACE_WIN32_Asynch_Transmit_File_Result::flags (void) const -{ - return this->flags_; -} - -ACE_WIN32_Asynch_Transmit_File_Result::ACE_WIN32_Asynch_Transmit_File_Result ( - const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE socket, - ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Transmit_File_Result_Impl (), - ACE_WIN32_Asynch_Result (handler_proxy, - act, - event, - offset, - offset_high, - priority, - signal_number), - socket_ (socket), - file_ (file), - header_and_trailer_ (header_and_trailer), - bytes_to_write_ (bytes_to_write), - bytes_per_send_ (bytes_per_send), - flags_ (flags) -{ -} - -void -ACE_WIN32_Asynch_Transmit_File_Result::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - // Copy the data which was returned by GetQueuedCompletionStatus - this->bytes_transferred_ = bytes_transferred; - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // We will not do this because (a) the header and trailer blocks may - // be the same message_blocks and (b) in cases of failures we have - // no idea how much of what (header, data, trailer) was sent. - /* - if (this->success_ && this->header_and_trailer_ != 0) - { - ACE_Message_Block *header = this->header_and_trailer_->header (); - if (header != 0) - header->rd_ptr (this->header_and_trailer_->header_bytes ()); - - ACE_Message_Block *trailer = this->header_and_trailer_->trailer (); - if (trailer != 0) - trailer->rd_ptr (this->header_and_trailer_->trailer_bytes ()); - } - */ - - // Create the interface result class. - ACE_Asynch_Transmit_File::Result result (this); - - // Call the application handler. - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_transmit_file (result); -} - -ACE_WIN32_Asynch_Transmit_File_Result::~ACE_WIN32_Asynch_Transmit_File_Result (void) -{ -} - -// Base class operations. These operations are here to kill dominance -// warnings. These methods call the base class methods. - -size_t -ACE_WIN32_Asynch_Transmit_File_Result::bytes_transferred (void) const -{ - return ACE_WIN32_Asynch_Result::bytes_transferred (); -} - -const void * -ACE_WIN32_Asynch_Transmit_File_Result::act (void) const -{ - return ACE_WIN32_Asynch_Result::act (); -} - -int -ACE_WIN32_Asynch_Transmit_File_Result::success (void) const -{ - return ACE_WIN32_Asynch_Result::success (); -} - -const void * -ACE_WIN32_Asynch_Transmit_File_Result::completion_key (void) const -{ - return ACE_WIN32_Asynch_Result::completion_key (); -} - -u_long -ACE_WIN32_Asynch_Transmit_File_Result::error (void) const -{ - return ACE_WIN32_Asynch_Result::error (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Transmit_File_Result::event (void) const -{ - return ACE_WIN32_Asynch_Result::event (); -} - -u_long -ACE_WIN32_Asynch_Transmit_File_Result::offset (void) const -{ - return ACE_WIN32_Asynch_Result::offset (); -} - -u_long -ACE_WIN32_Asynch_Transmit_File_Result::offset_high (void) const -{ - return ACE_WIN32_Asynch_Result::offset_high (); -} - -int -ACE_WIN32_Asynch_Transmit_File_Result::priority (void) const -{ - return ACE_WIN32_Asynch_Result::priority (); -} - -int -ACE_WIN32_Asynch_Transmit_File_Result::signal_number (void) const -{ - return ACE_WIN32_Asynch_Result::signal_number (); -} - -int -ACE_WIN32_Asynch_Transmit_File_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - return ACE_WIN32_Asynch_Result::post_completion (proactor); -} - -ACE_WIN32_Asynch_Transmit_File::ACE_WIN32_Asynch_Transmit_File (ACE_WIN32_Proactor *win32_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Transmit_File_Impl (), - ACE_WIN32_Asynch_Operation (win32_proactor) -{ -} - -int -ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - int priority, - int signal_number) -{ -#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) - - // TransmitFile API limits us to DWORD range. - if (bytes_to_write > MAXDWORD || bytes_per_send > MAXDWORD) - { - errno = ERANGE; - return -1; - } - DWORD dword_bytes_to_write = static_cast (bytes_to_write); - DWORD dword_bytes_per_send = static_cast (bytes_per_send); - - ACE_WIN32_Asynch_Transmit_File_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Transmit_File_Result (this->handler_proxy_, - this->handle_, - file, - header_and_trailer, - bytes_to_write, - offset, - offset_high, - bytes_per_send, - flags, - act, - this->win32_proactor_->get_handle (), - priority, - signal_number), - -1); - - ACE_LPTRANSMIT_FILE_BUFFERS transmit_buffers = 0; - if (result->header_and_trailer () != 0) - transmit_buffers = result->header_and_trailer ()->transmit_buffers (); - - // Initiate the transmit file - int initiate_result = ::TransmitFile ((SOCKET) result->socket (), - result->file (), - dword_bytes_to_write, - dword_bytes_per_send, - result, - transmit_buffers, - result->flags ()); - if (initiate_result == 1) - // Immediate success: the OVERLAPPED will still get queued. - return 1; - - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - return 0; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - // Cleanup dynamically allocated Asynch_Result - delete result; - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("TransmitFile"))); - } - return -1; - } -#else /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) */ - ACE_UNUSED_ARG (file); - ACE_UNUSED_ARG (header_and_trailer); - ACE_UNUSED_ARG (bytes_to_write); - ACE_UNUSED_ARG (offset); - ACE_UNUSED_ARG (offset_high); - ACE_UNUSED_ARG (bytes_per_send); - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (act); - ACE_UNUSED_ARG (priority); - ACE_UNUSED_ARG (signal_number); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_AIO_CALLS */ -} - -ACE_WIN32_Asynch_Transmit_File::~ACE_WIN32_Asynch_Transmit_File (void) -{ -} - -// Methods belong to ACE_WIN32_Asynch_Operation base class. These -// methods are defined here to avoid VC++ warnings. They route the -// call to the ACE_WIN32_Asynch_Operation base class. - -int -ACE_WIN32_Asynch_Transmit_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return ACE_WIN32_Asynch_Operation::open (handler_proxy, - handle, - completion_key, - proactor); -} - -int -ACE_WIN32_Asynch_Transmit_File::cancel (void) -{ - return ACE_WIN32_Asynch_Operation::cancel (); -} - -ACE_Proactor * -ACE_WIN32_Asynch_Transmit_File::proactor (void) const -{ - return ACE_WIN32_Asynch_Operation::proactor (); -} - -size_t -ACE_WIN32_Asynch_Read_Dgram_Result::bytes_to_read (void) const -{ - return this->bytes_to_read_; -} - -ACE_Message_Block* -ACE_WIN32_Asynch_Read_Dgram_Result::message_block (void) const -{ - return this->message_block_; -} - - -int -ACE_WIN32_Asynch_Read_Dgram_Result::remote_address (ACE_Addr& addr) const -{ - int retVal = -1; // failure - - // make sure the addresses are of the same type - if (addr.get_type () == this->remote_address_->get_type ()) - { // copy the remote_address_ into addr - addr.set_addr (this->remote_address_->get_addr (), - this->remote_address_->get_size ()); - retVal = 0; // success - } - - return retVal; -} - -sockaddr * -ACE_WIN32_Asynch_Read_Dgram_Result::saddr () const -{ - return (sockaddr *) this->remote_address_->get_addr (); -} - - -int -ACE_WIN32_Asynch_Read_Dgram_Result::flags (void) const -{ - return this->flags_; -} - -ACE_HANDLE -ACE_WIN32_Asynch_Read_Dgram_Result::handle (void) const -{ - return this->handle_; -} - -size_t -ACE_WIN32_Asynch_Read_Dgram_Result::bytes_transferred (void) const -{ - return ACE_WIN32_Asynch_Result::bytes_transferred (); -} - -const void * -ACE_WIN32_Asynch_Read_Dgram_Result::act (void) const -{ - return ACE_WIN32_Asynch_Result::act (); -} - -int -ACE_WIN32_Asynch_Read_Dgram_Result::success (void) const -{ - return ACE_WIN32_Asynch_Result::success (); -} - -const void * -ACE_WIN32_Asynch_Read_Dgram_Result::completion_key (void) const -{ - return ACE_WIN32_Asynch_Result::completion_key (); -} - -u_long -ACE_WIN32_Asynch_Read_Dgram_Result::error (void) const -{ - return ACE_WIN32_Asynch_Result::error (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Read_Dgram_Result::event (void) const -{ - return ACE_WIN32_Asynch_Result::event (); -} - -u_long -ACE_WIN32_Asynch_Read_Dgram_Result::offset (void) const -{ - return ACE_WIN32_Asynch_Result::offset (); -} - -u_long -ACE_WIN32_Asynch_Read_Dgram_Result::offset_high (void) const -{ - return ACE_WIN32_Asynch_Result::offset_high (); -} - -int -ACE_WIN32_Asynch_Read_Dgram_Result::priority (void) const -{ - return ACE_WIN32_Asynch_Result::priority (); -} - -int -ACE_WIN32_Asynch_Read_Dgram_Result::signal_number (void) const -{ - return ACE_WIN32_Asynch_Result::signal_number (); -} - -int -ACE_WIN32_Asynch_Read_Dgram_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - return ACE_WIN32_Asynch_Result::post_completion (proactor); -} - -ACE_WIN32_Asynch_Read_Dgram_Result::ACE_WIN32_Asynch_Read_Dgram_Result ( - const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - int protocol_family, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Read_Dgram_Result_Impl(), - ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), - bytes_to_read_ (bytes_to_read), - message_block_ (message_block), - remote_address_ (0), - addr_len_ (0), - flags_ (flags), - handle_ (handle) -{ - ACE_ASSERT (protocol_family == PF_INET); // only supporting INET addresses - - ACE_NEW (remote_address_, ACE_INET_Addr); - addr_len_ = remote_address_->get_size (); - - ACE_UNUSED_ARG (protocol_family); -} - -void -ACE_WIN32_Asynch_Read_Dgram_Result::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - // Copy the data which was returned by GetQueuedCompletionStatus - this->bytes_transferred_ = bytes_transferred; - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // Appropriately move the pointers in the message block. - for (ACE_Message_Block* mb = this->message_block_; - (mb != 0) && (bytes_transferred > 0); - mb = mb->cont ()) - { - size_t len_part = mb->space (); - - if ( len_part > bytes_transferred) - len_part = bytes_transferred; - - mb->wr_ptr (len_part); - - bytes_transferred -= len_part; - } - - // Adjust the address length - this->remote_address_->set_size (this->addr_len_); - - // Create the interface result class. - ACE_Asynch_Read_Dgram::Result result (this); - - // Call the application handler. - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_read_dgram (result); -} - -ACE_WIN32_Asynch_Read_Dgram_Result::~ACE_WIN32_Asynch_Read_Dgram_Result (void) -{ - delete this->remote_address_; -} - -//*************************************************************************** - -ACE_WIN32_Asynch_Read_Dgram::~ACE_WIN32_Asynch_Read_Dgram (void) -{ -} - -ssize_t -ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, - size_t & number_of_bytes_recvd, - int flags, - int protocol_family, - const void *act, - int priority, - int signal_number) -{ - number_of_bytes_recvd = 0; - - size_t bytes_to_read = 0; - - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - for (const ACE_Message_Block* msg = message_block; - msg != 0 && iovcnt < ACE_IOV_MAX; - msg = msg->cont () , ++iovcnt ) - { - size_t msg_space = msg->space (); - - // OS should correctly process zero length buffers - // if ( msg_space == 0 ) - // ACE_ERROR_RETURN ((LM_ERROR, - // ACE_LIB_TEXT ("ACE_WIN32_Asynch_Read_Dgram::recv:") - // ACE_LIB_TEXT ("No space in the message block\n")), - // -1); - - bytes_to_read += msg_space; - - // Make as many iovec as needed to fit all of msg_len. - size_t wr_ptr_offset = 0; - while (msg_space > 0 && iovcnt < ACE_IOV_MAX) - { - u_long this_chunk_length; - if (msg_space > ULONG_MAX) - this_chunk_length = ULONG_MAX; - else - this_chunk_length = static_cast (msg_space); - // Collect the data in the iovec. - iov[iovcnt].iov_base = msg->wr_ptr () + wr_ptr_offset; - iov[iovcnt].iov_len = this_chunk_length; - msg_space -= this_chunk_length; - wr_ptr_offset += this_chunk_length; - - // Increment iovec counter if there's more to do. - if (msg_space > 0) - iovcnt++; - } - if (msg_space > 0) // Ran out of iovecs before msg_space exhausted - { - errno = ERANGE; - return -1; - } - } - - if (bytes_to_read == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Read_Dgram::recv:") - ACE_LIB_TEXT ("Attempt to read 0 bytes\n")), - -1); - - // Create the Asynch_Result. - ACE_WIN32_Asynch_Read_Dgram_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_Dgram_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_read, - flags, - protocol_family, - act, - this->win32_proactor_->get_handle (), - priority, - signal_number), - -1); - - // do the scatter/gather recv - ssize_t initiate_result = ACE_OS::recvfrom (result->handle (), - iov, - iovcnt, - number_of_bytes_recvd, - result->flags_, - result->saddr (), - &(result->addr_len_), - result, - 0); - if (initiate_result == SOCKET_ERROR) - { - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - initiate_result = 0; - break; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("WSARecvFrom"))); - } - - delete result; - initiate_result = -1; - break; - } - - } - else - { - // Immediate success: the OVERLAPPED will still get queued. - // number_of_bytes_recvd contains the number of bytes recvd - // addr contains the peer address - // flags was updated - - // number_of_bytes_recvd = bytes_recvd; - initiate_result = 1; - } - - return initiate_result; -} - -int -ACE_WIN32_Asynch_Read_Dgram::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return ACE_WIN32_Asynch_Operation::open (handler_proxy, - handle, - completion_key, - proactor); -} - -int -ACE_WIN32_Asynch_Read_Dgram::cancel (void) -{ - return ACE_WIN32_Asynch_Operation::cancel (); -} - -ACE_Proactor * -ACE_WIN32_Asynch_Read_Dgram::proactor (void) const -{ - return ACE_WIN32_Asynch_Operation::proactor (); -} - -ACE_WIN32_Asynch_Read_Dgram::ACE_WIN32_Asynch_Read_Dgram (ACE_WIN32_Proactor *win32_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Read_Dgram_Impl (), - ACE_WIN32_Asynch_Operation (win32_proactor) -{ -} - -//*********************************************** - -size_t -ACE_WIN32_Asynch_Write_Dgram_Result::bytes_to_write (void) const -{ - return this->bytes_to_write_; -} - -ACE_Message_Block* -ACE_WIN32_Asynch_Write_Dgram_Result::message_block () const -{ - return this->message_block_; -} - -int -ACE_WIN32_Asynch_Write_Dgram_Result::flags (void) const -{ - return this->flags_; -} - -ACE_HANDLE -ACE_WIN32_Asynch_Write_Dgram_Result::handle (void) const -{ - return this->handle_; -} - -size_t -ACE_WIN32_Asynch_Write_Dgram_Result::bytes_transferred (void) const -{ - return ACE_WIN32_Asynch_Result::bytes_transferred (); -} - -const void * -ACE_WIN32_Asynch_Write_Dgram_Result::act (void) const -{ - return ACE_WIN32_Asynch_Result::act (); -} - -int -ACE_WIN32_Asynch_Write_Dgram_Result::success (void) const -{ - return ACE_WIN32_Asynch_Result::success (); -} - -const void * -ACE_WIN32_Asynch_Write_Dgram_Result::completion_key (void) const -{ - return ACE_WIN32_Asynch_Result::completion_key (); -} - -u_long -ACE_WIN32_Asynch_Write_Dgram_Result::error (void) const -{ - return ACE_WIN32_Asynch_Result::error (); -} - -ACE_HANDLE -ACE_WIN32_Asynch_Write_Dgram_Result::event (void) const -{ - return ACE_WIN32_Asynch_Result::event (); -} - -u_long -ACE_WIN32_Asynch_Write_Dgram_Result::offset (void) const -{ - return ACE_WIN32_Asynch_Result::offset (); -} - -u_long -ACE_WIN32_Asynch_Write_Dgram_Result::offset_high (void) const -{ - return ACE_WIN32_Asynch_Result::offset_high (); -} - -int -ACE_WIN32_Asynch_Write_Dgram_Result::priority (void) const -{ - return ACE_WIN32_Asynch_Result::priority (); -} - -int -ACE_WIN32_Asynch_Write_Dgram_Result::signal_number (void) const -{ - return ACE_WIN32_Asynch_Result::signal_number (); -} - -int -ACE_WIN32_Asynch_Write_Dgram_Result::post_completion (ACE_Proactor_Impl *proactor) -{ - return ACE_WIN32_Asynch_Result::post_completion (proactor); -} - -ACE_WIN32_Asynch_Write_Dgram_Result::ACE_WIN32_Asynch_Write_Dgram_Result ( - const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_write, - int flags, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Write_Dgram_Result_Impl(), - ACE_WIN32_Asynch_Result (handler_proxy, - act, - event, - 0, - 0, - priority, - signal_number), - bytes_to_write_ (bytes_to_write), - message_block_ (message_block), - flags_ (flags), - handle_ (handle) -{ -} - -void -ACE_WIN32_Asynch_Write_Dgram_Result::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - // Copy the data which was returned by GetQueuedCompletionStatus - this->bytes_transferred_ = bytes_transferred; - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // Appropriately move the pointers in the message block. - for (ACE_Message_Block* mb = this->message_block_; - (mb != 0) && (bytes_transferred > 0); - mb = mb->cont ()) - { - size_t len_part = mb->length (); - - if ( len_part > bytes_transferred) - len_part = bytes_transferred; - - mb->rd_ptr (len_part); - - bytes_transferred -= len_part; - } - - // Create the interface result class. - ACE_Asynch_Write_Dgram::Result result (this); - - // Call the application handler. - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_write_dgram (result); -} - -ACE_WIN32_Asynch_Write_Dgram_Result::~ACE_WIN32_Asynch_Write_Dgram_Result (void) -{ -} - - -//*********************************************** - -ACE_WIN32_Asynch_Write_Dgram::~ACE_WIN32_Asynch_Write_Dgram (void) -{ -} - -ssize_t -ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr &addr, - const void *act, - int priority, - int signal_number) -{ - number_of_bytes_sent = 0; - - size_t bytes_to_write = 0; - - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - for (const ACE_Message_Block* msg = message_block; - msg != 0 && iovcnt < ACE_IOV_MAX; - msg = msg->cont () , ++iovcnt ) - { - size_t msg_len = msg->length (); - - // OS should process zero length block correctly - // if ( msg_len == 0 ) - // ACE_ERROR_RETURN ((LM_ERROR, - // ACE_LIB_TEXT ("ACE_WIN32_Asynch_Write_Dgram::send:") - // ACE_LIB_TEXT ("Zero-length message block\n")), - // -1); - - bytes_to_write += msg_len; - - // Make as many iovec as needed to fit all of msg_len. - size_t rd_ptr_offset = 0; - while (msg_len > 0 && iovcnt < ACE_IOV_MAX) - { - u_long this_chunk_length; - if (msg_len > ULONG_MAX) - this_chunk_length = ULONG_MAX; - else - this_chunk_length = static_cast (msg_len); - // Collect the data in the iovec. - iov[iovcnt].iov_base = msg->rd_ptr () + rd_ptr_offset; - iov[iovcnt].iov_len = this_chunk_length; - msg_len -= this_chunk_length; - rd_ptr_offset += this_chunk_length; - - // Increment iovec counter if there's more to do. - if (msg_len > 0) - iovcnt++; - } - if (msg_len > 0) // Ran out of iovecs before msg_space exhausted - { - errno = ERANGE; - return -1; - } - } - - if ( bytes_to_write == 0 ) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("ACE_WIN32_Asynch_Write_Dgram::send:") - ACE_LIB_TEXT ("Attempt to write 0 bytes\n")), - -1); - - // Create the Asynch_Result. - ACE_WIN32_Asynch_Write_Dgram_Result *result = 0; - ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_Dgram_Result (this->handler_proxy_, - this->handle_, - message_block, - bytes_to_write, - flags, - act, - this->win32_proactor_->get_handle (), - priority, - signal_number), - -1); - - // do the scatter/gather send - - ssize_t initiate_result = ACE_OS::sendto (result->handle (), - iov, - iovcnt, - number_of_bytes_sent, - result->flags_, - (sockaddr *) addr.get_addr (), - addr.get_size(), - result, - 0); - - - if (initiate_result == SOCKET_ERROR) - { - // If initiate failed, check for a bad error. - ACE_OS::set_errno_to_last_error (); - switch (errno) - { - case ERROR_IO_PENDING: - // The IO will complete proactively: the OVERLAPPED will still - // get queued. - initiate_result = 0; - break; - - default: - // Something else went wrong: the OVERLAPPED will not get - // queued. - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("WSASendTo"))); - } - - delete result; - initiate_result = -1; - break; - } - - } - else - { - // Immediate success: the OVERLAPPED will still get queued. - // number_of_bytes_recvd contains the number of bytes recvd - // addr contains the peer address - // flags was updated - - // number_of_bytes_sent = bytes_sent; - initiate_result = 1; - } - - return initiate_result; -} - -int -ACE_WIN32_Asynch_Write_Dgram::open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return ACE_WIN32_Asynch_Operation::open (handler_proxy, - handle, - completion_key, - proactor); -} - -int -ACE_WIN32_Asynch_Write_Dgram::cancel (void) -{ - return ACE_WIN32_Asynch_Operation::cancel (); -} - -ACE_Proactor * -ACE_WIN32_Asynch_Write_Dgram::proactor (void) const -{ - return ACE_WIN32_Asynch_Operation::proactor (); -} - -ACE_WIN32_Asynch_Write_Dgram::ACE_WIN32_Asynch_Write_Dgram (ACE_WIN32_Proactor *win32_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Write_Dgram_Impl (), - ACE_WIN32_Asynch_Operation (win32_proactor) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 || ACE_HAS_WINCE */ diff --git a/ace/WIN32_Asynch_IO.h b/ace/WIN32_Asynch_IO.h deleted file mode 100644 index 298563c7d88..00000000000 --- a/ace/WIN32_Asynch_IO.h +++ /dev/null @@ -1,1936 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file WIN32_Asynch_IO.h - * - * $Id$ - * - * - * These classes only works on Win32 platforms. - * - * The implementation of ACE_Asynch_Transmit_File, - * ACE_Asynch_Accept, and ACE_Asynch_Connect are only supported if - * ACE_HAS_WINSOCK2 is defined or you are on WinNT 4.0 or higher. - * - * - * @author Irfan Pyarali - * @author Tim Harrison - * @author Alexander Babu Arulanthu - * @author Roger Tragin - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_WIN32_ASYNCH_IO_H -#define ACE_WIN32_ASYNCH_IO_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - -#include "ace/Asynch_IO_Impl.h" -#include "ace/Addr.h" -#include "ace/Event_Handler.h" -#include "ace/Handle_Set.h" -#include "ace/Map_Manager.h" -#include "ace/Null_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration -class ACE_WIN32_Proactor; - -/** - * @class ACE_WIN32_Asynch_Result - * - * @brief An abstract class which adds information to the OVERLAPPED - * structure to make it more useful. - * - * An abstract base class from which you can obtain some basic - * information like the number of bytes transferred, the ACT - * associated with the asynchronous operation, indication of - * success or failure, etc. Subclasses may want to store more - * information that is particular to the asynchronous operation - * it represents. - */ -class ACE_Export ACE_WIN32_Asynch_Result : public virtual ACE_Asynch_Result_Impl, - public OVERLAPPED -{ - /// Factory class has special permissions. - friend class ACE_WIN32_Asynch_Accept; - - /// Proactor class has special permission. - friend class ACE_WIN32_Proactor; - -public: - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// Returns 0. - int signal_number (void) const; - - /// Post to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Result (void); - - /// Simulate error value to use in the post_completion () - void set_error (u_long errcode); - - /// Simulate value to use in the post_completion () - void set_bytes_transferred (size_t nbytes); - -protected: - /// Constructor. - ACE_WIN32_Asynch_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - const void* act, - ACE_HANDLE event, - u_long offset, - u_long offset_high, - int priority, - int signal_number = 0); - - /// Proxy for the ACE_Handler that will be called back. - ACE_Handler::Proxy_Ptr handler_proxy_; - - /// ACT for this operation. - const void *act_; - - /// Bytes transferred by this operation. - size_t bytes_transferred_; - - /// Success indicator. - int success_; - - /// ACT associated with handle. - const void *completion_key_; - - /// Error if operation failed. - u_long error_; -}; - -/** - * @class ACE_WIN32_Asynch_Operation - * - * @brief This class abstracts out the common things needed for - * implementing Asynch_Operation for WIN32 platform. - * - */ -class ACE_Export ACE_WIN32_Asynch_Operation : public virtual ACE_Asynch_Operation_Impl -{ -public: - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ( == ACE_INVALID_HANDLE), - * will be called on the to get the - * correct handle. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - int cancel (void); - - // = Access methods. - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - -protected: - /// Constructor. - ACE_WIN32_Asynch_Operation (ACE_WIN32_Proactor *win32_proactor); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Operation (void); - - /// Win32 Proactor. - ACE_WIN32_Proactor *win32_proactor_; - - /// Proactor that this asynch IO is registered with. - ACE_Proactor *proactor_; - - /// Handler that will receive the callback. - ACE_Handler::Proxy_Ptr handler_proxy_; - - /// I/O handle used for reading. - ACE_HANDLE handle_; -}; - -/** - * @class ACE_WIN32_Asynch_Read_Stream_Result - * - * @brief This class provides concrete implementation for - * ACE_Asynch_Read_Stream::Result class. - */ -class ACE_Export ACE_WIN32_Asynch_Read_Stream_Result : public virtual ACE_Asynch_Read_Stream_Result_Impl, - public ACE_WIN32_Asynch_Result -{ - /// Factory class will have special permissions. - friend class ACE_WIN32_Asynch_Read_Stream; - - /// Proactor class has special permission. - friend class ACE_WIN32_Proactor; - -public: - /// The number of bytes which were requested at the start of the - /// asynchronous read. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for reading. - ACE_HANDLE handle (void) const; - - // Base class operations. These operations are here to kill - // dominance warnings. These methods call the base class methods. - - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// No-op. Returns 0. - int signal_number (void) const; - - /// Post to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - - /// Accessor for the scatter read flag - int scatter_enabled (void) const; - -protected: - /// Constructor is protected since creation is limited to - /// ACE_Asynch_Read_Stream factory. - ACE_WIN32_Asynch_Read_Stream_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0, - int scatter_enabled = 0); - - /// Proactor will call this method when the read completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Read_Stream_Result (void); - - /// Bytes requested when the asynchronous read was initiated. - size_t bytes_to_read_; - - /// Message block for reading the data into. - ACE_Message_Block &message_block_; - - /// I/O handle used for reading. - ACE_HANDLE handle_; - - /// Flag for scatter read - int scatter_enabled_; -}; - -/** - * @class ACE_WIN32_Asynch_Read_Stream - * - * @brief This class is a factory for starting off asynchronous reads - * on a stream. - * - * Once is called, multiple asynchronous s can - * started using this class. An ACE_Asynch_Read_Stream::Result - * will be passed back to the when the asynchronous - * reads completes through the - * callback. - */ -class ACE_Export ACE_WIN32_Asynch_Read_Stream : public virtual ACE_Asynch_Read_Stream_Impl, - public ACE_WIN32_Asynch_Operation -{ - -public: - /// Constructor. - ACE_WIN32_Asynch_Read_Stream (ACE_WIN32_Proactor *win32_proactor); - - /// This starts off an asynchronous read. Upto will - /// be read and stored in the . - int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number = 0); - - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - */ - int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number = 0); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Read_Stream (void); - - // Methods belong to ACE_WIN32_Asynch_Operation base class. These - // methods are defined here to avoid VC++ warnings. They route the - // call to the ACE_WIN32_Asynch_Operation base class. - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ( == ACE_INVALID_HANDLE), - * will be called on the to get the - * correct handle. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - int cancel (void); - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - -protected: - /// This is the method which does the real work and is there so that - /// the ACE_Asynch_Read_File class can use it too. - int shared_read (ACE_WIN32_Asynch_Read_Stream_Result *result); -}; - -/** - * @class ACE_WIN32_Asynch_Write_Stream_Result - * - * @brief This class provides concrete implementation for - * ACE_Asynch_Write_Stream::Result class. - */ -class ACE_Export ACE_WIN32_Asynch_Write_Stream_Result : public virtual ACE_Asynch_Write_Stream_Result_Impl, - public ACE_WIN32_Asynch_Result -{ - /// Factory class willl have special permissions. - friend class ACE_WIN32_Asynch_Write_Stream; - - /// Proactor class has special permission. - friend class ACE_WIN32_Proactor; - -public: - /// The number of bytes which were requested at the start of the - /// asynchronous write. - size_t bytes_to_write (void) const; - - /// Message block that contains the data to be written. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for writing. - ACE_HANDLE handle (void) const; - - // = Base class operations. These operations are here to kill some - // warnings. These methods call the base class methods. - - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// No-op. Returns 0. - int signal_number (void) const; - - /// Post to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - - /// Accessor for the gather write flag - int gather_enabled (void) const; - -protected: - /// Constructor is protected since creation is limited to - /// ACE_Asynch_Write_Stream factory. - ACE_WIN32_Asynch_Write_Stream_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0, - int gather_enabled = 0); - - /// ACE_Proactor will call this method when the write completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Write_Stream_Result (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous write. - size_t bytes_to_write_; - - /// Message block that contains the data to be written. - ACE_Message_Block &message_block_; - - /// I/O handle used for writing. - ACE_HANDLE handle_; - - /// Flag for gather write - int gather_enabled_; -}; - -/** - * @class ACE_WIN32_Asynch_Write_Stream - * - * @brief This class is a factory for starting off asynchronous writes - * on a stream. - * - * - * Once is called, multiple asynchronous s can - * started using this class. A ACE_Asynch_Write_Stream::Result - * will be passed back to the when the asynchronous - * write completes through the - * callback. - */ -class ACE_Export ACE_WIN32_Asynch_Write_Stream : public virtual ACE_Asynch_Write_Stream_Impl, - public ACE_WIN32_Asynch_Operation -{ -public: - /// Constructor. - ACE_WIN32_Asynch_Write_Stream (ACE_WIN32_Proactor *win32_proactor); - - /// This starts off an asynchronous write. Upto - /// will be written from the . - int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number = 0); - - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - */ - int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number = 0); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Write_Stream (void); - - // = Methods belonging to base class. - - // These methods are defined here to avoid VC++ warnings. They route - // the call to the base class. - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ( == ACE_INVALID_HANDLE), - * will be called on the to get the - * correct handle. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - int cancel (void); - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - -protected: - /// This is the method which does the real work and is there so that - /// the ACE_Asynch_Write_File class can use it too. - int shared_write (ACE_WIN32_Asynch_Write_Stream_Result *result); -}; - -/** - * @class ACE_WIN32_Asynch_Read_File_Result - * - * @brief This class provides concrete implementation for - * ACE_Asynch_Read_File::Result class. - */ -class ACE_Export ACE_WIN32_Asynch_Read_File_Result : public virtual ACE_Asynch_Read_File_Result_Impl, - public ACE_WIN32_Asynch_Read_Stream_Result -{ - /// Factory class will have special permissions. - friend class ACE_WIN32_Asynch_Read_File; - - /// Proactor class has special permission. - friend class ACE_WIN32_Proactor; - -public: - // = These methods belong to ACE_WIN32_Asynch_Result class base - // class. These operations are here to kill some warnings. These - // methods call the base class methods. - - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// No-op. Returns 0. - int signal_number (void) const; - - // The following methods belong to - // ACE_WIN32_Asynch_Read_Stream_Result. They are here to avoid VC++ - // dominance warnings. These methods route their call to the - // ACE_WIN32_Asynch_Read_Stream_Result base class. - - /// The number of bytes which were requested at the start of the - /// asynchronous read. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for reading. - ACE_HANDLE handle (void) const; - - /// Post to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - -protected: - /// Constructor is protected since creation is limited to - /// ACE_Asynch_Read_File factory. - ACE_WIN32_Asynch_Read_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number = 0, - int scatter_enabled = 0); - - /// ACE_Proactor will call this method when the read completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Read_File_Result (void); -}; - -/** - * @class ACE_WIN32_Asynch_Read_File - * - * @brief This class is a factory for starting off asynchronous reads - * on a file. - * - * Once is called, multiple asynchronous s can - * started using this class. A ACE_Asynch_Read_File::Result - * will be passed back to the when the asynchronous - * reads completes through the - * callback. - * - * This class differs slightly from ACE_Asynch_Read_Stream as it - * allows the user to specify an offset for the read. - */ -class ACE_Export ACE_WIN32_Asynch_Read_File : public virtual ACE_Asynch_Read_File_Impl, - public ACE_WIN32_Asynch_Read_Stream -{ - -public: - /// Constructor. - ACE_WIN32_Asynch_Read_File (ACE_WIN32_Proactor *win32_proactor); - - /** - * This starts off an asynchronous read. Upto will - * be read and stored in the . The read will start - * at from the beginning of the file. - */ - int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number = 0); - - /** - * Same as above but with scatter support, through chaining of - * composite message blocks using the continuation field. - * @note Each data block payload must be at least the size of a - * system memory page and must be aligned on a system memory page - * size boundary - */ - int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number = 0); - - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Read_File (void); - - // = Methods belong to ACE_WIN32_Asynch_Operation base class. These - // methods are defined here to avoid VC++ warnings. They route the - // call to the ACE_WIN32_Asynch_Operation base class. - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ( == ACE_INVALID_HANDLE), - * will be called on the to get the - * correct handle. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - int cancel (void); - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - -private: - /** - * This method belongs to ACE_WIN32_Asynch_Read_Stream. It is here - * to avoid the compiler warnings. We forward this call to the - * ACE_WIN32_Asynch_Read_Stream class. - */ - int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number = 0); - - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - */ - int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number = 0); -}; - -/** - * @class ACE_WIN32_Asynch_Write_File_Result - * - * @brief This class provides implementation for - * ACE_Asynch_Write_File_Result for WIN32 platforms. - * - * This class has all the information necessary for the - * to uniquiely identify the completion of the - * asynchronous write. - * - * This class differs slightly from - * ACE_Asynch_Write_Stream::Result as it calls back - * on the instead - * of . No additional state - * is required by this class as ACE_Asynch_Result can store - * the . - */ -class ACE_Export ACE_WIN32_Asynch_Write_File_Result : public virtual ACE_Asynch_Write_File_Result_Impl, - public ACE_WIN32_Asynch_Write_Stream_Result -{ - /// Factory class will have special permission. - friend class ACE_WIN32_Asynch_Write_File; - - /// Proactor class has special permission. - friend class ACE_WIN32_Proactor; - -public: - // = Base class operations. These operations are here to kill some - // warnings. These methods call the base class methods. - - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// No-op. Returns 0. - int signal_number (void) const; - - // The following methods belong to - // ACE_WIN32_Asynch_Read_Stream_Result. They are here to avoid VC++ - // warnings. These methods route their call to the - // ACE_WIN32_Asynch_Read_Stream_Result base class. - - /// The number of bytes which were requested at the start of the - /// asynchronous write. - size_t bytes_to_write (void) const; - - /// Message block that contains the data to be written. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for writing. - ACE_HANDLE handle (void) const; - - /// Post to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - -protected: - /// Constructor is protected since creation is limited to - /// ACE_Asynch_Write_File factory. - ACE_WIN32_Asynch_Write_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number = 0, - int gather_enabled = 0); - - /// ACE_Proactor will call this method when the write completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Write_File_Result (void); -}; - -/** - * @class ACE_WIN32_Asynch_Write_File - * - * @brief This class is a factory for starting off asynchronous writes - * on a file. - * - * Once is called, multiple asynchronous s can be - * started using this class. A ACE_Asynch_Write_File::Result - * will be passed back to the when the asynchronous - * writes completes through the - * callback. - */ -class ACE_Export ACE_WIN32_Asynch_Write_File : public virtual ACE_Asynch_Write_File_Impl, - public ACE_WIN32_Asynch_Write_Stream -{ -public: - /// Constructor. - ACE_WIN32_Asynch_Write_File (ACE_WIN32_Proactor *win32_proactor); - - /** - * This starts off an asynchronous write. Upto - * will be write and stored in the . The write will - * start at from the beginning of the file. - */ - int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number = 0); - - /** - * Same as above but with gather support, through chaining of - * composite message blocks using the continuation field. - * @note Each data block payload must be at least the size of a - * system memory page and must be aligned on a system memory page - * size boundary - */ - int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number = 0); - - /// Destrcutor. - virtual ~ACE_WIN32_Asynch_Write_File (void); - - // = Methods belong to ACE_WIN32_Asynch_Operation base class. These - // methods are defined here to avoid VC++ warnings. They route the - // call to the ACE_WIN32_Asynch_Operation base class. - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ( == ACE_INVALID_HANDLE), - * will be called on the to get the - * correct handle. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - int cancel (void); - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - -private: - /** - * This method belongs to ACE_WIN32_Asynch_Write_Stream. It is here - * to avoid compiler warnings. This method is forwarded to the - * ACE_WIN32_Asynch_Write_Stream class. - */ - int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number = 0); - - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - */ - int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number = 0); -}; - -/** - * @class ACE_WIN32_Asynch_Accept_Result - * - * @brief This class implements ACE_Asynch_Accept::Result for WIN32 - * platform. - * - * This class has all the information necessary for the - * to uniquiely identify the completion of the - * asynchronous accept. - */ -class ACE_Export ACE_WIN32_Asynch_Accept_Result : public virtual ACE_Asynch_Accept_Result_Impl, - public ACE_WIN32_Asynch_Result -{ - /// Factory will have special permission. - friend class ACE_WIN32_Asynch_Accept; - - /// Proactor class has special permission. - friend class ACE_WIN32_Proactor; - -public: - /// The number of bytes which were requested at the start of the - /// asynchronous accept. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for accepting new connections. - ACE_HANDLE listen_handle (void) const; - - /// I/O handle for the new connection. - ACE_HANDLE accept_handle (void) const; - - // = Base class operations. These operations are here to kill some - // warnings. These methods call the base class methods. - - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// No-op. Returns 0. - int signal_number (void) const; - - /// Post to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - -protected: - /// Constructor is protected since creation is limited to - /// ACE_Asynch_Accept factory. - ACE_WIN32_Asynch_Accept_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE listen_handle, - ACE_HANDLE accept_handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - /// ACE_Proactor will call this method when the accept completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Accept_Result (void); - - /// Bytes requested when the asynchronous read was initiated. - size_t bytes_to_read_; - - /// Message block for reading the data into. - ACE_Message_Block &message_block_; - - /// I/O handle used for accepting new connections. - ACE_HANDLE listen_handle_; - - /// I/O handle for the new connection. - ACE_HANDLE accept_handle_; -}; - -/** - * @class ACE_WIN32_Asynch_Accept - * - * @brief This class is a factory for starting off asynchronous accepts - * on a listen handle. - * - * Once is called, multiple asynchronous s can - * started using this class. A ACE_Asynch_Accept::Result will - * be passed back to the when the asynchronous accept - * completes through the - * callback. - */ -class ACE_Export ACE_WIN32_Asynch_Accept : public virtual ACE_Asynch_Accept_Impl, - public ACE_WIN32_Asynch_Operation -{ -public: - /// Constructor. - ACE_WIN32_Asynch_Accept (ACE_WIN32_Proactor *win32_proactor); - - /** - * This starts off an asynchronous accept. The asynchronous accept - * call also allows any initial data to be returned to the - * . Upto will be read and stored in the - * . The will be used for the - * call. If ( == INVALID_HANDLE), a new - * handle will be created. - * - * must be specified. This is because the address of - * the new connection is placed at the end of this buffer. - */ - int accept (ACE_Message_Block &message_block, - size_t bytes_to_read, - ACE_HANDLE accept_handle, - const void *act, - int priority, - int signal_number = 0, - int addr_family = AF_INET); - - /// Destructor. - ~ACE_WIN32_Asynch_Accept (void); - - // Methods belong to ACE_WIN32_Asynch_Operation base class. These - // methods are defined here to avoid VC++ warnings. They route the - // call to the ACE_WIN32_Asynch_Operation base class. - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ( == ACE_INVALID_HANDLE), - * will be called on the to get the - * correct handle. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - int cancel (void); - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; -}; - -/** - * @class ACE_WIN32_Asynch_Connect_Result - * - * @brief This is that class which will be passed back to the - * completion handler when the asynchronous connect completes. - * - * This class has all the information necessary for the - * completion handler to uniquiely identify the completion of the - * asynchronous connect. - */ -class ACE_Export ACE_WIN32_Asynch_Connect_Result : public virtual ACE_Asynch_Connect_Result_Impl, - public ACE_WIN32_Asynch_Result -{ - /// Factory classes will have special permissions. - friend class ACE_WIN32_Asynch_Connect; - - /// The Proactor constructs the Result class for faking results. - friend class ACE_WIN32_Proactor; - -public: - - /// I/O handle for the connection. - ACE_HANDLE connect_handle (void) const; - - // = Base class operations. These operations are here to kill some - // warnings. These methods call the base class methods. - - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * Returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// No-op. Returns 0. - int signal_number (void) const; - - /// Post this object to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - -protected: - /// Constructor is protected since creation is limited to - /// ACE_Asynch_Connect factory. - ACE_WIN32_Asynch_Connect_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE connect_handle, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number); - - /// ACE_Proactor will call this method when the accept completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Connect_Result (void); - - /// Set the I/O handle for the new connection. - void connect_handle (ACE_HANDLE handle); - - ACE_HANDLE connect_handle_; -}; - - -/** - * @class ACE_WIN32_Asynch_Connect - */ -class ACE_Export ACE_WIN32_Asynch_Connect : - public virtual ACE_Asynch_Connect_Impl, - public ACE_WIN32_Asynch_Operation, - public ACE_Event_Handler -{ -public: - - /// Constructor. - ACE_WIN32_Asynch_Connect (ACE_WIN32_Proactor * win32_proactor); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Connect (void); - - /** - * This open belongs to ACE_WIN32_Asynch_Operation. We forward - * this call to that method. We have put this here to avoid the - * compiler warnings. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor = 0); - - /** - * Start an asynchronous connect. - * - * @param connect_handle Handle to use for the connect. If the value - * ACE_INVALID_HANDLE, a new handle will be created. - * - * @retval 0 Success - * @retval -1 Error - */ - int connect (ACE_HANDLE connect_handle, - const ACE_Addr &remote_sap, - const ACE_Addr &local_sap, - int reuse_addr, - const void *act, - int priority, - int signal_number = 0); - - /** - * Cancel all pending pseudo-asynchronus requests - * Behavior as usual AIO request - */ - int cancel (void); - - /** - * Close performs cancellation of all pending requests - * and close the connect handle - */ - int close (void); - - /// Virtual from ACE_Event_Handler - ACE_HANDLE get_handle (void) const; - - /// Virtual from ACE_Event_Handler - void set_handle (ACE_HANDLE handle); - - /// Virtual from ACE_Event_Handler - int handle_input ( ACE_HANDLE handle); - int handle_output ( ACE_HANDLE handle); - int handle_exception ( ACE_HANDLE handle); - - /// Virtual from ACE_Event_Handler - int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) ; - - // = Methods belong to ACE_WIN32_Asynch_Operation base class. These - // methods are defined here to avoid dominace warnings. They route - // the call to the ACE_WIN32_Asynch_Operation base class. - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - -private: - int connect_i (ACE_WIN32_Asynch_Connect_Result *result, - const ACE_Addr &remote_sap, - const ACE_Addr &local_sap, - int reuse_addr); - - int post_result (ACE_WIN32_Asynch_Connect_Result *result, bool flg_post); - - /// Cancel uncompleted connect operations. - /** - * @param flg_notify Indicates whether or not to send notification about - * canceled connect operations. If false, don't send - * notifications. If true, notify user about canceled - * connects. - * According WIN32 standards we should receive - * notifications on canceled AIO requests. - * - * @param set Receives the set of I/O handles on which asynchronous - * connect requests were canceled as a result of this - * method. The contents of @a set are completely - * replaced. - */ - int cancel_uncompleted (bool flg_notify, ACE_Handle_Set &set); - - /// true - Connect is registered in ACE_Asynch_Pseudo_Task - /// false - Accept is deregisted in ACE_Asynch_Pseudo_Task - bool flg_open_ ; - - typedef ACE_Map_Manager - MAP_MANAGER; - - /// Map of Result pointers that correspond to all the 's - /// pending. - MAP_MANAGER result_map_; - - /// The lock to protect the result map which is shared. The queue - /// is updated by main thread in the register function call and - /// through the auxillary thread in the asynch pseudo task. - ACE_SYNCH_MUTEX lock_; -}; - -/** - * @class ACE_WIN32_Asynch_Transmit_File_Result - * - * - * @brief This class implements ACE_Asynch_Transmit_File::Result for - * WIN32 platforms. - * - * This class has all the information necessary for the - * to uniquiely identify the completion of the - * asynchronous transmit file. - */ -class ACE_Export ACE_WIN32_Asynch_Transmit_File_Result : public virtual ACE_Asynch_Transmit_File_Result_Impl, - public ACE_WIN32_Asynch_Result -{ - /// Factory class will have special permission. - friend class ACE_WIN32_Asynch_Transmit_File; - - /// Proactor class has special permission. - friend class ACE_WIN32_Proactor; - -public: - /// Socket used for transmitting the file. - ACE_HANDLE socket (void) const; - - /// File from which the data is read. - ACE_HANDLE file (void) const; - - /// Header and trailer data associated with this transmit file. - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const; - - /// The number of bytes which were requested at the start of the - /// asynchronous transmit file. - size_t bytes_to_write (void) const; - - /// Number of bytes per send requested at the start of the transmit - /// file. - size_t bytes_per_send (void) const; - - /// Flags which were passed into transmit file. - u_long flags (void) const; - - // Base class operations. These operations are here to kill some - // warnings. These methods call the base class methods. - - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// No-op. Returns 0. - int signal_number (void) const; - - /// Post to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - -protected: - /// Constructor is protected since creation is limited to - /// ACE_Asynch_Transmit_File factory. - ACE_WIN32_Asynch_Transmit_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE socket, - ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - /// Proactor will call this method when the write completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Transmit_File_Result (void); - - /// Network I/O handle. - ACE_HANDLE socket_; - - /// File I/O handle. - ACE_HANDLE file_; - - /// Header and trailer data associated with this transmit file. - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer_; - - /// The number of bytes which were requested at the start of the - /// asynchronous transmit file. - size_t bytes_to_write_; - - /// Number of bytes per send requested at the start of the transmit - /// file. - size_t bytes_per_send_; - - /// Flags which were passed into transmit file. - u_long flags_; -}; - -/** - * @class ACE_WIN32_Asynch_Transmit_File - * - * @brief This class is a factory for starting off asynchronous - * transmit files on a stream. - * - * Once is called, multiple asynchronous s - * can started using this class. A - * ACE_Asynch_Transmit_File::Result will be passed back to the - * when the asynchronous transmit file completes - * through the callback. - * - * The transmit_file function transmits file data over a - * connected network connection. The function uses the operating - * system's cache manager to retrieve the file data. This - * function provides high-performance file data transfer over - * network connections. This function would be of great use in - * a Web Server, Image Server, etc. - */ -class ACE_Export ACE_WIN32_Asynch_Transmit_File : public virtual ACE_Asynch_Transmit_File_Impl, - public ACE_WIN32_Asynch_Operation -{ -public: - /// Constructor. - ACE_WIN32_Asynch_Transmit_File (ACE_WIN32_Proactor *win32_proactor); - - /** - * This starts off an asynchronous transmit file. The is a - * handle to an open file. is a pointer to a - * data structure that contains pointers to data to send before and - * after the file data is sent. Set this parameter to 0 if you only - * want to transmit the file data. Upto will be - * written to the . If you want to send the entire file, - * let = 0. is the size of each - * block of data sent per send operation. Please read the Win32 - * documentation on what the flags should be. - */ - int transmit_file (ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - int priority, - int signal_number = 0); - - /// Destructor. - ~ACE_WIN32_Asynch_Transmit_File (void); - - // Methods belong to ACE_WIN32_Asynch_Operation base class. These - // methods are defined here to avoid VC++ warnings. They route the - // call to the ACE_WIN32_Asynch_Operation base class. - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ( == ACE_INVALID_HANDLE), - * will be called on the to get the - * correct handle. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - int cancel (void); - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; -}; - -/** - * @class ACE_WIN32_Asynch_Read_Dgram_Result - * - * @brief This class provides concrete implementation for - * ACE_Asynch_Read_Dgram::Result class. - */ -class ACE_Export ACE_WIN32_Asynch_Read_Dgram_Result : public virtual ACE_Asynch_Read_Dgram_Result_Impl, - public ACE_WIN32_Asynch_Result -{ - /// Factory class will have special permissions. - friend class ACE_WIN32_Asynch_Read_Dgram; - - /// Proactor class has special permission. - friend class ACE_WIN32_Proactor; - -public: - /// The number of bytes which were requested at the start of the - /// asynchronous read. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data - ACE_Message_Block *message_block (void) const; - - /// The address of where the packet came from - int remote_address (ACE_Addr& addr) const; - - sockaddr *saddr () const; - - /// The flags used in the read - int flags (void) const; - - /// I/O handle used for reading. - ACE_HANDLE handle (void) const; - - // Base class operations. These operations are here to kill - // dominance warnings. These methods call the base class methods. - - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// No-op. Returns 0. - int signal_number (void) const; - - /// Post to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - -protected: - /// Constructor is protected since creation is limited to - /// ACE_Asynch_Read_Dgram factory. - ACE_WIN32_Asynch_Read_Dgram_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - int protocol_family, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - /// Proactor will call this method when the read completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Read_Dgram_Result (void); - - /// Bytes requested when the asynchronous read was initiated. - size_t bytes_to_read_; - - /// Message block for reading the data into. - ACE_Message_Block *message_block_; - - /// The address of where the packet came from - ACE_Addr *remote_address_; - - int addr_len_; - - /// The flags used in the read - int flags_; - - /// I/O handle used for reading. - ACE_HANDLE handle_; -}; - -/** - * @class ACE_WIN32_Asynch_Read_Dgram - * - * @brief This class is a factory for starting off asynchronous reads - * on a UDP socket. - * - * Once is called, multiple asynchronous s can be - * started using this class. An ACE_Asynch_Read_Dgram::Result - * will be passed back to the when the asynchronous - * reads completes through the - * callback. - * - */ -class ACE_Export ACE_WIN32_Asynch_Read_Dgram : public virtual ACE_Asynch_Read_Dgram_Impl, - public ACE_WIN32_Asynch_Operation -{ -public: - /// Constructor. - ACE_WIN32_Asynch_Read_Dgram (ACE_WIN32_Proactor *win32_proactor); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Read_Dgram (void); - - /** This starts off an asynchronous read. Upto - * total_size()> will be read and stored in the - * . 's will be updated to reflect - * the added bytes if the read operation is successfully completed. - * Return code of 1 means immediate success and - * will contain number of bytes read. The - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the cont()> - * method. Up to ACE_IOV_MAX 's are supported. Upto - * size()> bytes will be read into each for - * a total of total_size()> bytes. All 's - * 's will be updated to reflect the added bytes for each - * - */ - virtual ssize_t recv (ACE_Message_Block *message_block, - size_t &number_of_bytes_recvd, - int flags, - int protocol_family, - const void *act, - int priority, - int signal_number); - - // Methods belong to ACE_WIN32_Asynch_Operation base class. These - // methods are defined here to avoid VC++ warnings. They route the - // call to the ACE_WIN32_Asynch_Operation base class. - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ( == ACE_INVALID_HANDLE), - * will be called on the to get the - * correct handle. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - int cancel (void); - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - -protected: - /// Do-nothing constructor. - ACE_WIN32_Asynch_Read_Dgram (void); -}; - -/** - * @class ACE_WIN32_Asynch_Write_Dgram_Result - * - * @brief This class provides concrete implementation for - * ACE_Asynch_Write_Dgram::Result class. - */ -class ACE_Export ACE_WIN32_Asynch_Write_Dgram_Result : public virtual ACE_Asynch_Write_Dgram_Result_Impl, - public ACE_WIN32_Asynch_Result -{ - /// Factory class willl have special permissions. - friend class ACE_WIN32_Asynch_Write_Dgram; - - /// Proactor class has special permission. - friend class ACE_WIN32_Proactor; - -public: - /// The number of bytes which were requested at the start of the - /// asynchronous write. - size_t bytes_to_write (void) const; - - /// Message block which contains the sent data - ACE_Message_Block *message_block (void) const; - - /// The flags using in the write - int flags (void) const; - - /// I/O handle used for writing. - ACE_HANDLE handle (void) const; - - // = Base class operations. These operations are here to kill some - // warnings. These methods call the base class methods. - - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This returns the ACT associated with the handle when it was - * registered with the I/O completion port. This ACT is not the - * same as the ACT associated with the asynchronous operation. - */ - const void *completion_key (void) const; - - /// Error value if the operation fail. - u_long error (void) const; - - /// Event associated with the OVERLAPPED structure. - ACE_HANDLE event (void) const; - - /// This really make sense only when doing file I/O. - u_long offset (void) const; - - /// Offset_high associated with the OVERLAPPED structure. - u_long offset_high (void) const; - - /// The priority of the asynchronous operation. Currently, this is - /// not supported on Win32. - int priority (void) const; - - /// No-op. Returns 0. - int signal_number (void) const; - - /// Post to the Proactor's completion port. - int post_completion (ACE_Proactor_Impl *proactor); - -protected: - /// Constructor is protected since creation is limited to - /// ACE_Asynch_Write_Stream factory. - ACE_WIN32_Asynch_Write_Dgram_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_write, - int flags, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - /// ACE_Proactor will call this method when the write completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Write_Dgram_Result (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous write. - size_t bytes_to_write_; - - /// Message block used for the send. - ACE_Message_Block *message_block_; - - /// The flags using in the write - int flags_; - - /// I/O handle used for writing. - ACE_HANDLE handle_; -}; - -/** - * @class ACE_WIN32_Asynch_Write_Dgram - * - * @brief This class is a factory for starting off asynchronous writes - * on a UDP socket. - * - * - * Once is called, multiple asynchronous s can - * started using this class. A ACE_Asynch_Write_Stream::Result - * will be passed back to the when the asynchronous - * write completes through the - * callback. - */ -class ACE_Export ACE_WIN32_Asynch_Write_Dgram : public virtual ACE_Asynch_Write_Dgram_Impl, - public ACE_WIN32_Asynch_Operation -{ -public: - /// Constructor. - ACE_WIN32_Asynch_Write_Dgram (ACE_WIN32_Proactor *win32_proactor); - - /// Destructor. - virtual ~ACE_WIN32_Asynch_Write_Dgram (void); - - /** This starts off an asynchronous send. Upto - * total_length()> will be sent. 's - * will be updated to reflect the sent bytes if the send operation - * is successfully completed. - * Return code of 1 means immediate success and - * is updated to number of bytes sent. The - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the cont()> - * method. Up to ACE_IOV_MAX 's are supported. Upto - * length()> bytes will be sent from each - * for a total of total_length()> bytes. All - * 's 's will be updated to reflect the bytes sent - * from each . - */ - virtual ssize_t send (ACE_Message_Block *message_block, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr &addr, - const void *act, - int priority, - int signal_number); - - // = Methods belonging to base class. - - // These methods are defined here to avoid VC++ warnings. They route - // the call to the base class. - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ( == ACE_INVALID_HANDLE), - * will be called on the to get the - * correct handle. - */ - int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - int cancel (void); - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - -protected: - /// Do-nothing constructor. - ACE_WIN32_Asynch_Write_Dgram (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE */ -#include /**/ "ace/post.h" -#endif /* ACE_WIN32_ASYNCH_IO_H */ diff --git a/ace/WIN32_Proactor.cpp b/ace/WIN32_Proactor.cpp deleted file mode 100644 index 7ace0d987b0..00000000000 --- a/ace/WIN32_Proactor.cpp +++ /dev/null @@ -1,804 +0,0 @@ -// $Id$ - -// ACE_RCSID(ace, Proactor, "$Id$") - -#include "ace/WIN32_Proactor.h" - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) -// WIN implemenatation of the Proactor. - -#include "ace/Log_Msg.h" -#include "ace/Object_Manager.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_WIN32_Wakeup_Completion - * - * This is result object is used by the of the - * ACE_Proactor interface to wake up all the threads blocking - * for completions. - */ -class ACE_WIN32_Wakeup_Completion : public ACE_WIN32_Asynch_Result -{ - -public: - /// Constructor. - ACE_WIN32_Wakeup_Completion (ACE_Handler::Proxy_Ptr &handler_proxy, - const void *act = 0, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Destructor. - virtual ~ACE_WIN32_Wakeup_Completion (void); - - /// This method calls the 's method. - virtual void complete (size_t bytes_transferred = 0, - int success = 1, - const void *completion_key = 0, - u_long error = 0); -}; - -ACE_WIN32_Proactor::ACE_WIN32_Proactor (size_t number_of_threads, - int used_with_reactor_event_loop) - : completion_port_ (0), - // This *MUST* be 0, *NOT* ACE_INVALID_HANDLE !!! - number_of_threads_ (static_cast (number_of_threads)), - used_with_reactor_event_loop_ (used_with_reactor_event_loop) -{ - // Create the completion port. - this->completion_port_ = ::CreateIoCompletionPort (INVALID_HANDLE_VALUE, - 0, - 0, - this->number_of_threads_); - if (this->completion_port_ == 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("CreateIoCompletionPort"))); - - this->get_asynch_pseudo_task ().start (); -} - -ACE_WIN32_Proactor::~ACE_WIN32_Proactor (void) -{ - this->get_asynch_pseudo_task ().stop (); - - this->close (); -} - -ACE_Asynch_Pseudo_Task & -ACE_WIN32_Proactor::get_asynch_pseudo_task () -{ - return this->pseudo_task_; -} - -int -ACE_WIN32_Proactor::close (void) -{ - // Close the completion port - if (this->completion_port_ != 0) - { - // To avoid memory leaks we should delete all results from queue. - - for (;;) - { - ACE_OVERLAPPED *overlapped = 0; - u_long bytes_transferred = 0; - ULONG_PTR completion_key = 0; - - // Get the next asynchronous operation that completes - BOOL res = ::GetQueuedCompletionStatus - (this->completion_port_, - &bytes_transferred, - &completion_key, - &overlapped, - 0); // poll - - if (overlapped == 0 || res == FALSE) - break; - - ACE_WIN32_Asynch_Result *asynch_result = - (ACE_WIN32_Asynch_Result *) overlapped; - - delete asynch_result; - } - - int result = ACE_OS::close (this->completion_port_); - this->completion_port_ = 0; - return result; - } - - return 0; -} - -int -ACE_WIN32_Proactor::register_handle (ACE_HANDLE handle, - const void *completion_key) -{ - ULONG_PTR comp_key (reinterpret_cast (completion_key)); - - // No locking is needed here as no state changes. - ACE_HANDLE cp = ::CreateIoCompletionPort (handle, - this->completion_port_, - comp_key, - this->number_of_threads_); - if (cp == 0) - { - ACE_OS::set_errno_to_last_error (); - // If errno == ERROR_INVALID_PARAMETER, then this handle was - // already registered. - if (errno != ERROR_INVALID_PARAMETER) - { - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("CreateIoCompletionPort"))); - } - return -1; - } - } - return 0; -} - -ACE_Asynch_Read_Stream_Impl * -ACE_WIN32_Proactor::create_asynch_read_stream (void) -{ - ACE_Asynch_Read_Stream_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Read_Stream (this), - 0); - return implementation; -} - -ACE_Asynch_Write_Stream_Impl * -ACE_WIN32_Proactor::create_asynch_write_stream (void) -{ - ACE_Asynch_Write_Stream_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Write_Stream (this), - 0); - return implementation; -} - -ACE_Asynch_Read_Dgram_Impl * -ACE_WIN32_Proactor::create_asynch_read_dgram (void) -{ - ACE_Asynch_Read_Dgram_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Read_Dgram (this), - 0); - return implementation; -} - -ACE_Asynch_Write_Dgram_Impl * -ACE_WIN32_Proactor::create_asynch_write_dgram (void) -{ - ACE_Asynch_Write_Dgram_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Write_Dgram (this), - 0); - return implementation; -} - -ACE_Asynch_Read_File_Impl * -ACE_WIN32_Proactor::create_asynch_read_file (void) -{ - ACE_Asynch_Read_File_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Read_File (this), - 0); - return implementation; -} - -ACE_Asynch_Write_File_Impl * -ACE_WIN32_Proactor::create_asynch_write_file (void) -{ - ACE_Asynch_Write_File_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Write_File (this), - 0); - return implementation; -} - -ACE_Asynch_Accept_Impl * -ACE_WIN32_Proactor::create_asynch_accept (void) -{ - ACE_Asynch_Accept_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Accept (this), - 0); - return implementation; -} - -ACE_Asynch_Connect_Impl * -ACE_WIN32_Proactor::create_asynch_connect (void) -{ - ACE_Asynch_Connect_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Connect (this), - 0); - return implementation; -} - -ACE_Asynch_Transmit_File_Impl * -ACE_WIN32_Proactor::create_asynch_transmit_file (void) -{ - ACE_Asynch_Transmit_File_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Transmit_File (this), - 0); - return implementation; -} - -ACE_Asynch_Read_Stream_Result_Impl * -ACE_WIN32_Proactor::create_asynch_read_stream_result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Read_Stream_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Read_Stream_Result (handler_proxy, - handle, - message_block, - bytes_to_read, - act, - event, - priority, - signal_number), - 0); - return implementation; -} - -ACE_Asynch_Write_Stream_Result_Impl * -ACE_WIN32_Proactor::create_asynch_write_stream_result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Write_Stream_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Write_Stream_Result (handler_proxy, - handle, - message_block, - bytes_to_write, - act, - event, - priority, - signal_number), - 0); - return implementation; -} - -ACE_Asynch_Read_File_Result_Impl * -ACE_WIN32_Proactor::create_asynch_read_file_result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Read_File_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Read_File_Result (handler_proxy, - handle, - message_block, - bytes_to_read, - act, - offset, - offset_high, - event, - priority, - signal_number), - 0); - return implementation; -} - -ACE_Asynch_Write_File_Result_Impl * -ACE_WIN32_Proactor::create_asynch_write_file_result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Write_File_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Write_File_Result (handler_proxy, - handle, - message_block, - bytes_to_write, - act, - offset, - offset_high, - event, - priority, - signal_number), - 0); - return implementation; -} - -ACE_Asynch_Read_Dgram_Result_Impl * -ACE_WIN32_Proactor::create_asynch_read_dgram_result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - int protocol_family, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Read_Dgram_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Read_Dgram_Result (handler_proxy, - handle, - message_block, - bytes_to_read, - flags, - protocol_family, - act, - event, - priority, - signal_number), - 0); - return implementation; -} - -ACE_Asynch_Write_Dgram_Result_Impl * -ACE_WIN32_Proactor::create_asynch_write_dgram_result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Write_Dgram_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Write_Dgram_Result(handler_proxy, - handle, - message_block, - bytes_to_read, - flags, - act, - event, - priority, - signal_number), - 0); - return implementation; -} - -ACE_Asynch_Accept_Result_Impl * -ACE_WIN32_Proactor::create_asynch_accept_result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE listen_handle, - ACE_HANDLE accept_handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Accept_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Accept_Result (handler_proxy, - listen_handle, - accept_handle, - message_block, - bytes_to_read, - act, - event, - priority, - signal_number), - 0); - return implementation; -} - -ACE_Asynch_Connect_Result_Impl * -ACE_WIN32_Proactor::create_asynch_connect_result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE connect_handle, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Connect_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Connect_Result (handler_proxy, - connect_handle, - act, - event, - priority, - signal_number), - 0); - return implementation; -} - -ACE_Asynch_Transmit_File_Result_Impl * -ACE_WIN32_Proactor::create_asynch_transmit_file_result - (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE socket, - ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Transmit_File_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Transmit_File_Result (handler_proxy, - socket, - file, - header_and_trailer, - bytes_to_write, - offset, - offset_high, - bytes_per_send, - flags, - act, - event, - priority, - signal_number), - 0); - return implementation; -} - -ACE_Asynch_Result_Impl * -ACE_WIN32_Proactor::create_asynch_timer (const ACE_Handler::Proxy_Ptr &handler_proxy, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event, - int priority, - int signal_number) -{ - ACE_Asynch_Result_Impl *implementation = 0; - ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Timer (handler_proxy, - act, - tv, - event, - priority, - signal_number), - 0); - return implementation; -} - -int -ACE_WIN32_Proactor::handle_signal (int, siginfo_t *, ucontext_t *) -{ - // Perform a non-blocking "poll" for all the I/O events that have - // completed in the I/O completion queue. - - int result = 0; - - for (ACE_Time_Value timeout (0, 0); - ; - ) - { - result = this->handle_events (timeout); - - if (result != 1) - break; - } - - // If our handle_events failed, we'll report a failure to the - // Reactor. - return result == -1 ? -1 : 0; -} - -int -ACE_WIN32_Proactor::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) -{ - ACE_UNUSED_ARG (close_mask); - ACE_UNUSED_ARG (handle); - - return this->close (); -} - -ACE_HANDLE -ACE_WIN32_Proactor::get_handle (void) const -{ - if (this->used_with_reactor_event_loop_) - return this->event_.handle (); - else - return 0; -} - -int -ACE_WIN32_Proactor::handle_events (ACE_Time_Value &wait_time) -{ - // Decrement with the amount of time spent in the method - ACE_Countdown_Time countdown (&wait_time); - return this->handle_events (wait_time.msec ()); -} - -int -ACE_WIN32_Proactor::handle_events (void) -{ - return this->handle_events (ACE_INFINITE); -} - -int -ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds) -{ - ACE_OVERLAPPED *overlapped = 0; - u_long bytes_transferred = 0; - ULONG_PTR completion_key = 0; - - // Get the next asynchronous operation that completes - BOOL result = ::GetQueuedCompletionStatus (this->completion_port_, - &bytes_transferred, - &completion_key, - &overlapped, - milli_seconds); - if (result == FALSE && overlapped == 0) - { - ACE_OS::set_errno_to_last_error (); - - switch (errno) - { - case WAIT_TIMEOUT: - errno = ETIME; - return 0; - - case ERROR_SUCCESS: - // Calling GetQueuedCompletionStatus with timeout value 0 - // returns FALSE with extended errno "ERROR_SUCCESS" errno = - // ETIME; ?? I don't know if this has to be done !! - return 0; - - default: - if (ACE::debug ()) - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("GetQueuedCompletionStatus"))); - return -1; - } - } - else - { - // Narrow the result. - ACE_WIN32_Asynch_Result *asynch_result = (ACE_WIN32_Asynch_Result *) overlapped; - - // If errors happen, grab the error. - if (result == FALSE) - ACE_OS::set_errno_to_last_error (); - else - errno = 0; - - u_long result_err = asynch_result->error (); - - // if "result_err" is 0 than - // It is normal OS/WIN32 AIO completion. - // We have cleared asynch_result->error_ - // during shared_read/shared_write. - // The real error code is already stored in "errno", - // so copy "errno" value to the "result_err" - // and pass this "result_err" code - // to the application_specific_code () - // else - // "result_err" non zero - // it means we have "post_completed" result - // so pass this "result_err" code - // to the application_specific_code () - - if (result_err == 0) - result_err = errno ; - - this->application_specific_code (asynch_result, - static_cast (bytes_transferred), - (void *) completion_key, - result_err); - } - return 1; -} - -void -ACE_WIN32_Proactor::application_specific_code (ACE_WIN32_Asynch_Result *asynch_result, - size_t bytes_transferred, - const void *completion_key, - u_long error) -{ - ACE_SEH_TRY - { - // Call completion hook - asynch_result->complete (bytes_transferred, - error ? 0 : 1, - (void *) completion_key, - error); - } - ACE_SEH_FINALLY - { - // This is crucial to prevent memory leaks - delete asynch_result; - } -} - -int -ACE_WIN32_Proactor::post_completion (ACE_WIN32_Asynch_Result *result) -{ - // Grab the event associated with the Proactor - HANDLE handle = this->get_handle (); - - // pass - // bytes_transferred - // completion_key - // to the ::PostQueuedCompletionStatus() - // error will be extracted later in handle_events() - - DWORD bytes_transferred = 0; - const void * completion_key = 0 ; - - if (result != 0) - { - // This cast is ok since the original API calls restricted the transfer - // counts to DWORD range. - bytes_transferred = static_cast (result->bytes_transferred ()); - completion_key = result->completion_key(); - } - - ULONG_PTR comp_key (reinterpret_cast (completion_key)); - - // Post a completion - if (::PostQueuedCompletionStatus (this->completion_port_, // completion port - bytes_transferred, // xfer count - comp_key, // completion key - result // overlapped - ) == FALSE) - { - delete result; - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("PostQueuedCompletionStatus failed"))); - } - return -1; - } - - // If Proactor event is valid, signal it - if (handle != ACE_INVALID_HANDLE - && handle != 0) - ACE_OS::event_signal (&handle); - - return 0; -} - -int -ACE_WIN32_Proactor::post_wakeup_completions (int how_many) -{ - ACE_WIN32_Wakeup_Completion *wakeup_completion = 0; - - for (ssize_t ci = 0; ci < how_many; ci++) - { - ACE_NEW_RETURN - (wakeup_completion, - ACE_WIN32_Wakeup_Completion (this->wakeup_handler_.proxy ()), - -1); - - if (wakeup_completion->post_completion (this) == -1) - return -1; - } - - return 0; -} - -int -ACE_WIN32_Proactor::wake_up_dispatch_threads (void) -{ - return 0; -} - -int -ACE_WIN32_Proactor::close_dispatch_threads (int) -{ - return 0; -} - -size_t -ACE_WIN32_Proactor::number_of_threads (void) const -{ - return static_cast (this->number_of_threads_); -} - -void -ACE_WIN32_Proactor::number_of_threads (size_t threads) -{ - this->number_of_threads_ = static_cast (threads); -} - -ACE_WIN32_Asynch_Timer::ACE_WIN32_Asynch_Timer - (const ACE_Handler::Proxy_Ptr &handler_proxy, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event, - int priority, - int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, 0, priority, - signal_number), - time_ (tv) -{ -} - -void -ACE_WIN32_Asynch_Timer::complete (size_t, - int, - const void *, - u_long) -{ - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_time_out (this->time_, this->act ()); -} - -ACE_WIN32_Wakeup_Completion::ACE_WIN32_Wakeup_Completion - (ACE_Handler::Proxy_Ptr &handler_proxy, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_WIN32_Asynch_Result - (handler_proxy, act, event, 0, 0, priority, signal_number) -{ -} - -ACE_WIN32_Wakeup_Completion::~ACE_WIN32_Wakeup_Completion (void) -{ -} - -void -ACE_WIN32_Wakeup_Completion::complete (size_t /* bytes_transferred */, - int /* success */, - const void * /* completion_key */, - u_long /* error */) -{ - ACE_Handler *handler = this->handler_proxy_.get ()->handler (); - if (handler != 0) - handler->handle_wakeup (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 */ diff --git a/ace/WIN32_Proactor.h b/ace/WIN32_Proactor.h deleted file mode 100644 index fc4fd7312de..00000000000 --- a/ace/WIN32_Proactor.h +++ /dev/null @@ -1,325 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file WIN32_Proactor.h - * - * $Id$ - * - * @author Irfan Pyarali (irfan@cs.wustl.edu) - * @author Tim Harrison (harrison@cs.wustl.edu) - * @author Alexander Babu Arulanthu - * @author Roger Tragin - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_WIN32_PROACTOR_H -#define ACE_WIN32_PROACTOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) -// WIN32 implementation of the Proactor. - -#include "ace/WIN32_Asynch_IO.h" -#include "ace/Event_Handler.h" - -#include "ace/Proactor_Impl.h" -#include "ace/Asynch_Pseudo_Task.h" -#include "ace/Auto_Event.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -class ACE_WIN32_Asynch_Result; -class ACE_WIN32_Proactor_Timer_Handler; - -/** - * @class ACE_WIN32_Proactor - * - * @brief A manager for asynchronous event demultiplexing on Win32. - * - * See the Proactor pattern description at - * http://www.cs.wustl.edu/~schmidt/PDF/proactor.pdf for more - * details. - */ -class ACE_Export ACE_WIN32_Proactor : public ACE_Proactor_Impl -{ - friend class ACE_WIN32_Asynch_Connect; - -public: - /// A do nothing constructor. - ACE_WIN32_Proactor (size_t number_of_threads = 0, - int used_with_reactor_event_loop = 0); - - /// Virtual destruction. - virtual ~ACE_WIN32_Proactor (void); - - /// Close the IO completion port. - virtual int close (void); - - /// This method adds the @a handle to the I/O completion port. This - /// function is a no-op function for Unix systems. - virtual int register_handle (ACE_HANDLE handle, - const void *completion_key); - - /** - * Dispatch a single set of events. If @a wait_time elapses before - * any events occur, return 0. Return 1 on success i.e., when a - * completion is dispatched, non-zero (-1) on errors and errno is - * set accordingly. - */ - virtual int handle_events (ACE_Time_Value &wait_time); - - /** - * Block indefinitely until at least one event is dispatched. - * Dispatch a single set of events. Return 1 on success i.e., when a - * completion is dispatched, non-zero (-1) on errors and errno is - * set accordingly. - */ - virtual int handle_events (void); - - /** - * Post a result to the completion port of the Proactor. If errors - * occur, the result will be deleted by this method. If successful, - * the result will be deleted by the Proactor when the result is - * removed from the completion port. Therefore, the result should - * have been dynamically allocated and should be orphaned by the - * user once this method is called. - */ - virtual int post_completion (ACE_WIN32_Asynch_Result *result); - - /// Add wakeup dispatch threads (reinit). - int wake_up_dispatch_threads (void); - - /// Close all dispatch threads. - int close_dispatch_threads (int wait); - - /// Get number of thread used as a parameter to @c CreateIoCompletionPort. - size_t number_of_threads (void) const; - - /// Set number of thread used as a parameter to @c CreateIoCompletionPort. - void number_of_threads (size_t threads); - - /// Get the event handle. - virtual ACE_HANDLE get_handle (void) const; - - virtual ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void); - virtual ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void); - virtual ACE_Asynch_Read_File_Impl *create_asynch_read_file (void); - virtual ACE_Asynch_Write_File_Impl *create_asynch_write_file (void); - virtual ACE_Asynch_Read_Dgram_Impl *create_asynch_read_dgram (void); - virtual ACE_Asynch_Write_Dgram_Impl *create_asynch_write_dgram (void); - virtual ACE_Asynch_Accept_Impl *create_asynch_accept (void); - virtual ACE_Asynch_Connect_Impl *create_asynch_connect (void); - virtual ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void); - - // Methods used to create Asynch_IO_Result objects. We create the right - // objects here in these methods. - - virtual ACE_Asynch_Read_Stream_Result_Impl *create_asynch_read_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - virtual ACE_Asynch_Write_Stream_Result_Impl *create_asynch_write_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - virtual ACE_Asynch_Read_File_Result_Impl *create_asynch_read_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - virtual ACE_Asynch_Write_File_Result_Impl *create_asynch_write_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - /// Create the correct implementation class for ACE_Asynch_Read_Dgram::Result. - virtual ACE_Asynch_Read_Dgram_Result_Impl *create_asynch_read_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - int protocol_family, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - /// Create the correct implementation class for ACE_Asynch_Write_Dgram::Result. - virtual ACE_Asynch_Write_Dgram_Result_Impl *create_asynch_write_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_write, - int flags, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - virtual ACE_Asynch_Accept_Result_Impl *create_asynch_accept_result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE listen_handle, - ACE_HANDLE accept_handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - virtual ACE_Asynch_Connect_Result_Impl *create_asynch_connect_result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE connect_handle, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - - virtual ACE_Asynch_Transmit_File_Result_Impl *create_asynch_transmit_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE socket, - ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number = 0); - - /// Create a timer result object which can be used with the Timer - /// mechanism of the Proactor. - virtual ACE_Asynch_Result_Impl *create_asynch_timer (const ACE_Handler::Proxy_Ptr &handler_proxy, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event, - int priority, - int signal_number = 0); - -protected: - /// Task to process pseudo-asynchronous operations - ACE_Asynch_Pseudo_Task & get_asynch_pseudo_task (void); - - /// Called when object is signaled by OS (either via UNIX signals or - /// when a Win32 object becomes signaled). - virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - - /// Called when object is removed from the ACE_Reactor. - virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - - /** - * Dispatch a single set of events. If @a milli_seconds elapses - * before any events occur, return 0. Return 1 if a completion is - * dispatched. Return -1 on errors. - */ - virtual int handle_events (unsigned long milli_seconds); - - /// Protect against structured exceptions caused by user code when - /// dispatching handles. - void application_specific_code (ACE_WIN32_Asynch_Result *asynch_result, - size_t bytes_transferred, - const void *completion_key, - u_long error); - - /** - * Post @a how_many completions to the completion port so that all - * threads can wake up. This is used in conjunction with the - * run_event_loop(). - */ - virtual int post_wakeup_completions (int how_many); - - /// Handle for the completion port. Unix doesnt have completion - /// ports. - ACE_HANDLE completion_port_; - - /// This number is passed to the @c CreateIOCompletionPort system - /// call. - DWORD number_of_threads_; - - /// This event is used in conjunction with Reactor when we try to - /// integrate the event loops of Reactor and the Proactor. - ACE_Auto_Event event_; - - /// Flag that indicates whether we are used in conjunction with - /// Reactor. - int used_with_reactor_event_loop_; - - /// Handler to handle the wakeups. This works in conjunction with the - /// ACE_Proactor::run_event_loop(). - ACE_Handler wakeup_handler_; - - /// Pseudo-task for asynch connect ( NT/2000) - /// In future should removed in XP with ConnectEx support - ACE_Asynch_Pseudo_Task pseudo_task_; -}; - -/** - * @class ACE_WIN32_Asynch_Timer - * - * @brief This class is posted to the completion port when a timer - * expires. When the complete method of this object is - * called, the 's handle_timeout method will be - * called. - */ -class ACE_WIN32_Asynch_Timer : public ACE_WIN32_Asynch_Result -{ - /// The factory method for this class is with the POSIX_Proactor - /// class. - friend class ACE_WIN32_Proactor; - -protected: - /// Constructor. - ACE_WIN32_Asynch_Timer (const ACE_Handler::Proxy_Ptr &handler_proxy, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = 0); - - /// This method calls the 's handle_timeout method. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error = 0); - - /// Time value requested by caller - ACE_Time_Value time_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 */ -#include /**/ "ace/post.h" -#endif /* ACE_PROACTOR_H */ diff --git a/ace/XML_Svc_Conf.cpp b/ace/XML_Svc_Conf.cpp deleted file mode 100644 index b81c9162076..00000000000 --- a/ace/XML_Svc_Conf.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -#include "ace/XML_Svc_Conf.h" - -#if (ACE_USES_CLASSIC_SVC_CONF == 0) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_XML_Svc_Conf::~ACE_XML_Svc_Conf (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ diff --git a/ace/XML_Svc_Conf.h b/ace/XML_Svc_Conf.h deleted file mode 100644 index a91594b6075..00000000000 --- a/ace/XML_Svc_Conf.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file XML_Svc_Conf.h - * - * $Id$ - * - * @author Nanbor Wang - */ -//============================================================================= - - -#ifndef ACE_XML_SVC_CONF_H -#define ACE_XML_SVC_CONF_H - -#include /**/ "ace/pre.h" - -#include "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (ACE_USES_CLASSIC_SVC_CONF==0) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_XML_Svc_Conf - * - * @brief This abstract class defines the common operations - * ACE_Service_Config expects when using the XML Service Config Parser. - * - * When implementing a concret XML_Svc_Conf class, be sure to overload - * the new/delete function so the dynamically created concret XML_Svc_Conf - * instance can be deleted from the original heap in the DLL/SO. The - * concret XML_Svc_Conf implementation will be put into a DLL/SO that - * ACE applications can link to dynamically using the ACE_DLL class. - * This DLL should include an operation as follow: - * - * extern "C" ACE_XML_Svc_Conf_Parser * _ACEXML_create_XML_Svc_Conf_Object (void); - * - * - */ - -class ACE_Export ACE_XML_Svc_Conf -{ -public: - typedef ACE_XML_Svc_Conf *(*Factory)(void); - - virtual ~ACE_XML_Svc_Conf (void) = 0; - - virtual int parse_file (const ACE_TCHAR file[]) = 0; - - virtual int parse_string (const ACE_TCHAR str[]) = 0; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ - -#include /**/ "ace/post.h" - -#endif /* ACE_XML_SVC_CONF_H */ diff --git a/ace/XTI_ATM_Mcast.cpp b/ace/XTI_ATM_Mcast.cpp deleted file mode 100644 index 854e2a36489..00000000000 --- a/ace/XTI_ATM_Mcast.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// $Id$ - -#include "ace/XTI_ATM_Mcast.h" - -ACE_RCSID(ace, XTI_ATM_Mcast, "$Id$") - -#if defined (ACE_HAS_XTI_ATM) - -#if !defined (__ACE_INLINE__) -#include "ace/XTI_ATM_Mcast.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_XTI_ATM_Mcast) - -void -ACE_XTI_ATM_Mcast::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_XTI_ATM_Mcast::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (void) -{ - ACE_TRACE ("ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast"); -} - -// Add a leaf to the current connection (i.e., multicast). - -int -ACE_XTI_ATM_Mcast::add_leaf (ACE_TLI_Stream ¤t_stream, - const ACE_Addr &remote_sap, - ACE_INT32 leaf_id, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_XTI_ATM_Mcast::add_leaf"); - - struct netbuf call_req; - memset(&call_req, 0, sizeof(call_req)); - call_req.len = remote_sap.get_size (); - call_req.buf = (char *)remote_sap.get_addr (); - - if (::t_addleaf(current_stream.get_handle(), - leaf_id, - &call_req) < 0) - { - // Check for asynchronous event - if (t_errno == TLOOK) - { - int const event = ACE_OS::t_look(current_stream.get_handle()); - if (event != TNODATA && event != T_DATA) - return -1; - else - // If this doesn't work for asynchronous calls we need to call - // the XTI/ATM t_rcvleafchange() function to check for t_addleaf - // completion. - return complete (current_stream, 0, timeout); - } - else - return -1; - } - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_XTI_ATM */ diff --git a/ace/XTI_ATM_Mcast.h b/ace/XTI_ATM_Mcast.h deleted file mode 100644 index 357af246784..00000000000 --- a/ace/XTI_ATM_Mcast.h +++ /dev/null @@ -1,137 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file XTI_ATM_Mcast.h - * - * $Id$ - * - * @author Joe Hoffert - */ -//============================================================================= - - -#ifndef ACE_XTI_ATM_MCAST_H -#define ACE_XTI_ATM_MCAST_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_XTI_ATM) - -#include "ace/TLI_Connector.h" -#include "ace/ATM_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_XTI_ATM_Mcast - * - * @brief Defines an active connection factory for the ACE_TLI C++ - * wrappers to support XTI/ATM multicast. - */ -class ACE_Export ACE_XTI_ATM_Mcast : public ACE_TLI_Connector -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_XTI_ATM_Mcast (void); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the amount of time to wait before timing out. If the - * time expires before the connection is made . The - * is the value of local address to bind to. If it's - * the default value of then the user is letting - * the OS do the binding. If == 1 then the - * is reused, even if it hasn't been cleanedup yet. - */ - ACE_XTI_ATM_Mcast (ACE_TLI_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0, - const char device[] = ACE_XTI_ATM_DEVICE, - struct t_info *info = 0, - int rw_flag = 1, - struct netbuf *udata = 0, - struct netbuf *opt = 0); - - /** - * Actively connect and produce a if things go well. - * The is the address that we are trying to connect - * with. The is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with . If *timeout > {0, 0} then - * this is the amount of time to wait before timing out. If the - * time expires before the connection is made . The - * is the value of local address to bind to. If it's - * the default value of then the user is letting - * the OS do the binding. If == 1 then the - * is reused, even if it hasn't been cleanedup yet. - */ - int connect (ACE_TLI_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0, - const char device[] = ACE_XTI_ATM_DEVICE, - struct t_info *info = 0, - int rw_flag = 1, - struct netbuf *udata = 0, - struct netbuf *opt = 0); - - /** - * Actively add a leaf to the currently connected stream (i.e., - * multicast). The is the address of the leaf that we - * are trying to add. The is the amount of time to wait to - * connect. If it's 0 then we block indefinitely. If *timeout == - * {0, 0} then the connection is done using non-blocking mode. In - * this case, if the connection can't be made immediately the value - * of -1 is returned with . If *timeout > - * {0, 0} then this is the amount of time to wait before timing out. - * If the time expires before the connection is made . - */ - int add_leaf (ACE_TLI_Stream ¤t_stream, - const ACE_Addr &remote_sap, - ACE_INT32 leaf_id, - ACE_Time_Value *timeout = 0); - - // = Meta-type info - typedef ACE_ATM_Addr PEER_ADDR; - typedef ACE_TLI_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/XTI_ATM_Mcast.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_XTI_ATM */ - -#include /**/ "ace/post.h" - -#endif /* ACE_XTI_ATM_MCAST_H */ diff --git a/ace/XTI_ATM_Mcast.inl b/ace/XTI_ATM_Mcast.inl deleted file mode 100644 index b062f8423b2..00000000000 --- a/ace/XTI_ATM_Mcast.inl +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (ACE_TLI_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms, - const char device[], - struct t_info *info, - int rw_flag, - struct netbuf *udata, - struct netbuf *opt) -{ - ACE_TRACE ("ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast"); - if (this->connect (new_stream, remote_sap, timeout, local_sap, reuse_addr, - flags, perms, device, - info, rw_flag, - udata, opt) == ACE_INVALID_HANDLE - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_TLI_Stream::ACE_TLI_Stream"))); -} - -// Connect the to the , waiting up to -// amount of time if necessary. This is simple a pass- -// through function to ACE_TLI_Connector::connect(). It is over- -// ridden to change the default device from TCP to XTI/ATM. - -ACE_INLINE -int -ACE_XTI_ATM_Mcast::connect (ACE_TLI_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms, - const char device[], - struct t_info *info, - int rw_flag, - struct netbuf *udata, - struct netbuf *opt) -{ - ACE_TRACE ("ACE_XTI_ATM_Mcast::connect"); - return ACE_TLI_Connector::connect(new_stream, - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms, - device, - info, - rw_flag, - udata, - opt); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/XtReactor.cpp b/ace/XtReactor.cpp deleted file mode 100644 index ab4612c9472..00000000000 --- a/ace/XtReactor.cpp +++ /dev/null @@ -1,450 +0,0 @@ -// $Id$ - -#include "ace/XtReactor.h" - -#include "ace/SOCK_Acceptor.h" -#include "ace/SOCK_Connector.h" - -ACE_RCSID(ace, XtReactor, "$Id$") - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_XtReactor) - -// Must be called with lock held -ACE_XtReactor::ACE_XtReactor (XtAppContext context, - size_t size, - int restart, - ACE_Sig_Handler *h) - : ACE_Select_Reactor (size, restart, h), - context_ (context), - ids_ (0), - timeout_ (0) -{ - // When the ACE_Select_Reactor is constructed it creates the notify - // pipe and registers it with the register_handler_i() method. The - // XtReactor overloads this method BUT because the - // register_handler_i occurs when constructing the base class - // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() - // is called not the XtReactor register_handler_i(). This means - // that the notify pipe is registered with the ACE_Select_Reactor - // event handling code not the XtReactor and so notfications don't - // work. To get around this we simply close and re-opened the - // notification handler in the constructor of the XtReactor. - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - this->notify_handler_->close (); - this->notify_handler_->open (this, 0); -#endif /* ACE_MT_SAFE */ -} - -ACE_XtReactor::~ACE_XtReactor (void) -{ - // Delete the remaining items in the linked list. - - while (this->ids_) - { - ACE_XtReactorID *XtID = this->ids_->next_; - delete this->ids_; - this->ids_ = XtID; - } -} - -// This is just the from ace/Reactor.cpp -// but we use the Xt functions to wait for an event, not to find out which one might be -// available. - -void -ACE_XtReactor::InputCallbackProc (XtPointer closure, - int *source, - XtInputId *) -{ - ACE_XtReactor *self = (ACE_XtReactor *) closure; - ACE_HANDLE handle = (ACE_HANDLE) *source; - - // my copy isn't const. - ACE_Time_Value zero = ACE_Time_Value::zero; - - ACE_Select_Reactor_Handle_Set wait_set; - - // Deal with one file event. - - // - read which kind of event - if (self->wait_set_.rd_mask_.is_set (handle)) - wait_set.rd_mask_.set_bit (handle); - if (self->wait_set_.wr_mask_.is_set (handle)) - wait_set.wr_mask_.set_bit (handle); - if (self->wait_set_.ex_mask_.is_set (handle)) - wait_set.ex_mask_.set_bit (handle); - - int result = ACE_OS::select (*source + 1, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, &zero); - - ACE_Select_Reactor_Handle_Set dispatch_set; - - // - Use only that one file event (removes events for other files). - if (result > 0) - { - if (wait_set.rd_mask_.is_set (handle)) - dispatch_set.rd_mask_.set_bit (handle); - if (wait_set.wr_mask_.is_set (handle)) - dispatch_set.wr_mask_.set_bit (handle); - if (wait_set.ex_mask_.is_set (handle)) - dispatch_set.ex_mask_.set_bit (handle); - - self->dispatch (1, dispatch_set); - } -} - -int -ACE_XtReactor::XtWaitForMultipleEvents (int width, - ACE_Select_Reactor_Handle_Set &wait_set, - ACE_Time_Value *) -{ - // Make sure we have a valid context - ACE_ASSERT (this->context_ != 0); - - // Check to make sure our handle's are all usable. - ACE_Select_Reactor_Handle_Set temp_set = wait_set; - - if (ACE_OS::select (width, - temp_set.rd_mask_, - temp_set.wr_mask_, - temp_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) - return -1; // Bad file arguments... - - // Instead of waiting using . - return ACE_OS::select (width, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero); -} - -XtAppContext -ACE_XtReactor::context (void) const -{ - return this->context_; -} - -void -ACE_XtReactor::context (XtAppContext context) -{ - this->context_ = context; -} - -int -ACE_XtReactor::register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_XtReactor::register_handler_i"); - - // Make sure we have a valid context - ACE_ASSERT (this->context_ != 0); - - int result = ACE_Select_Reactor::register_handler_i (handle, - handler, mask); - if (result == -1) - return -1; - - int condition = 0; - -#if !defined ACE_WIN32 - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) - ACE_SET_BITS (condition, XtInputReadMask); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) - ACE_SET_BITS (condition, XtInputWriteMask); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) - ACE_SET_BITS (condition, XtInputExceptMask); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) - ACE_SET_BITS (condition, XtInputReadMask); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){ - ACE_SET_BITS (condition, XtInputWriteMask); // connected, you may write - ACE_SET_BITS (condition, XtInputReadMask); // connected, you have data/err - } -#else - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) - ACE_SET_BITS (condition, XtInputReadWinsock); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) - ACE_SET_BITS (condition, XtInputWriteWinsock); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) - ACE_NOTSUP_RETURN(-1); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) - ACE_SET_BITS (condition, XtInputReadWinsock); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){ - ACE_SET_BITS (condition, XtInputWriteWinsock); // connected, you may write - ACE_SET_BITS (condition, XtInputReadWinsock); // connected, you have data/err - } -#endif /* !ACE_WIN32 */ - - if (condition != 0) - { - ACE_XtReactorID *XtID = this->ids_; - - while(XtID) - { - if (XtID->handle_ == handle) - { - ::XtRemoveInput (XtID->id_); - - XtID->id_ = ::XtAppAddInput (this->context_, - (int) handle, - (XtPointer) condition, - InputCallbackProc, - (XtPointer) this); - return 0; - } - else - XtID = XtID->next_; - } - - ACE_NEW_RETURN (XtID, - ACE_XtReactorID, - -1); - XtID->next_ = this->ids_; - XtID->handle_ = handle; - XtID->id_ = ::XtAppAddInput (this->context_, - (int) handle, - (XtPointer) condition, - InputCallbackProc, - (XtPointer) this); - this->ids_ = XtID; - } - return 0; -} - -int -ACE_XtReactor::register_handler_i (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - return ACE_Select_Reactor::register_handler_i (handles, - handler, - mask); -} - -int -ACE_XtReactor::remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_XtReactor::remove_handler_i"); - - // In the registration phase we registered first with - // ACE_Select_Reactor and then with X. Now we are now doing things - // in reverse order. - - // First clean up the corresponding X11Input. - this->remove_XtInput (handle); - - // Now let the reactor do its work. - return ACE_Select_Reactor::remove_handler_i (handle, - mask); -} - -void -ACE_XtReactor::remove_XtInput (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_XtReactor::remove_XtInput"); - - ACE_XtReactorID *XtID = this->ids_; - - if (XtID) - { - if (XtID->handle_ == handle) - { - ::XtRemoveInput (XtID->id_); - this->ids_ = XtID->next_; - delete XtID; - return; - } - - ACE_XtReactorID *NextID = XtID->next_; - - while (NextID) - { - if (NextID->handle_ == handle) - { - ::XtRemoveInput(NextID->id_); - XtID->next_ = NextID->next_; - delete NextID; - return; - } - else - { - XtID = NextID; - NextID = NextID->next_; - } - } - } -} - -int -ACE_XtReactor::remove_handler_i (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask) -{ - return ACE_Select_Reactor::remove_handler_i (handles, - mask); -} - -// The following functions ensure that there is an Xt timeout for the -// first timeout in the Reactor's Timer_Queue. - -void -ACE_XtReactor::reset_timeout (void) -{ - // Make sure we have a valid context - ACE_ASSERT (this->context_ != 0); - - if (timeout_) - ::XtRemoveTimeOut (timeout_); - timeout_ = 0; - - ACE_Time_Value *max_wait_time = - this->timer_queue_->calculate_timeout (0); - - if (max_wait_time) - timeout_ = ::XtAppAddTimeOut (this->context_, - max_wait_time->msec (), - TimerCallbackProc, - (XtPointer) this); -} - -int -ACE_XtReactor::reset_timer_interval - (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_XtReactor::reset_timer_interval"); - ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); - - int const result = ACE_Select_Reactor::timer_queue_->reset_interval - (timer_id, - interval); - - if (result == -1) - return -1; - else - { - this->reset_timeout (); - return result; - } -} - -long -ACE_XtReactor::schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_XtReactor::schedule_timer"); - ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); - - long const result = ACE_Select_Reactor::schedule_timer (event_handler, - arg, - delay, - interval); - if (result == -1) - return -1; - else - { - this->reset_timeout (); - return result; - } -} - -int -ACE_XtReactor::cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_XtReactor::cancel_timer"); - - if (ACE_Select_Reactor::cancel_timer (handler, - dont_call_handle_close) == -1) - return -1; - else - { - this->reset_timeout (); - return 0; - } -} - -int -ACE_XtReactor::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_XtReactor::cancel_timer"); - - if (ACE_Select_Reactor::cancel_timer (timer_id, - arg, - dont_call_handle_close) == -1) - return -1; - else - { - this->reset_timeout (); - return 0; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/XtReactor.h b/ace/XtReactor.h deleted file mode 100644 index fdd0ccae273..00000000000 --- a/ace/XtReactor.h +++ /dev/null @@ -1,140 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file XtReactor.h - * - * $Id$ - * - * @author Eric C. Newton - * @author Kirill Rybaltchenko - * @author Douglas C. Schmidt - */ -//============================================================================= - - -#ifndef ACE_XTREACTOR_H -#define ACE_XTREACTOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/ACE_XtReactor_export.h" -#include "ace/Select_Reactor.h" - -//#define String XtString -#include /**/ -//#undef String - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_XtReactorID - * - * @brief This little class is necessary due to the way that Microsoft - * implements sockets to be pointers rather than indices. - */ -class ACE_XtReactor_Export ACE_XtReactorID -{ -public: - /// Magic cookie. - XtInputId id_; - - /// Underlying handle. - ACE_HANDLE handle_; - - /// Pointer to next node in the linked list. - ACE_XtReactorID *next_; -}; - -/** - * @class ACE_XtReactor - * - * @brief An object-oriented event demultiplexor and event handler - * dispatcher that uses the X Toolkit functions. - */ -class ACE_XtReactor_Export ACE_XtReactor : public ACE_Select_Reactor -{ -public: - // = Initialization and termination methods. - ACE_XtReactor (XtAppContext context = 0, - size_t size = DEFAULT_SIZE, - int restart = 0, - ACE_Sig_Handler * = 0); - virtual ~ACE_XtReactor (void); - - XtAppContext context (void) const; - void context (XtAppContext); - - // = Timer operations. - virtual long schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval); - virtual int reset_timer_interval (long timer_id, - const ACE_Time_Value &interval); - virtual int cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close = 1); - - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1); - -protected: - // = Register timers/handles with Xt. - /// Register a single . - virtual int register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask); - - /// Register a set of . - virtual int register_handler_i (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask); - - /// Remove the associated with this . - virtual int remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - /// Remove a set of . - virtual int remove_handler_i (const ACE_Handle_Set &handles, - ACE_Reactor_Mask); - - /// Removes an Xt handle. - virtual void remove_XtInput (ACE_HANDLE handle); - - /// Wait for events to occur. - virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, - ACE_Time_Value *); - - ///Wait for Xt events to occur. - virtual int XtWaitForMultipleEvents (int, - ACE_Select_Reactor_Handle_Set &, - ACE_Time_Value *); - - XtAppContext context_; - ACE_XtReactorID *ids_; - XtIntervalId timeout_; - -private: - /// This method ensures there's an Xt timeout for the first timeout - /// in the Reactor's Timer_Queue. - void reset_timeout (void); - - // = Integrate with the X callback function mechanism. - static void TimerCallbackProc (XtPointer closure, XtIntervalId *id); - static void InputCallbackProc (XtPointer closure, int* source, XtInputId *id); - - /// Deny access since member-wise won't work... - ACE_XtReactor (const ACE_XtReactor &); - ACE_XtReactor &operator = (const ACE_XtReactor &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_XTREACTOR_H */ diff --git a/ace/ace.mpc b/ace/ace.mpc deleted file mode 100644 index 6ec468c8ed9..00000000000 --- a/ace/ace.mpc +++ /dev/null @@ -1,462 +0,0 @@ -// -*- MPC -*- now wouldn't this be cool... -// $Id$ - -project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache, versioned_namespace, pkgconfig { - avoids = ace_for_tao - libout = $(ACE_ROOT)/lib - sharedname = ACE - dynamicflags = ACE_BUILD_DLL - - Source_Files(ACE_COMPONENTS) { - ACE.cpp - ACE_crc_ccitt.cpp - ACE_crc32.cpp - Activation_Queue.cpp - Active_Map_Manager.cpp - Addr.cpp - Argv_Type_Converter.cpp - Assert.cpp - Asynch_IO.cpp - Asynch_IO_Impl.cpp - Asynch_Pseudo_Task.cpp - ATM_Acceptor.cpp - ATM_Addr.cpp - ATM_Connector.cpp - ATM_Params.cpp - ATM_QoS.cpp - ATM_Stream.cpp - Atomic_Op.cpp - Atomic_Op_Sparc.c - Auto_Event.cpp - Barrier.cpp - Base_Thread_Adapter.cpp - Based_Pointer_Repository.cpp - Basic_Stats.cpp - Basic_Types.cpp - Capabilities.cpp - CDR_Base.cpp - CDR_Stream.cpp - CDR_Size.cpp - Cleanup.cpp - Codeset_IBM1047.cpp - Codeset_Registry.cpp - Codeset_Registry_db.cpp - Condition_Recursive_Thread_Mutex.cpp - Condition_Thread_Mutex.cpp - Configuration.cpp - Configuration_Import_Export.cpp - Connection_Recycling_Strategy.cpp - Containers.cpp - Copy_Disabled.cpp - Countdown_Time.cpp - Date_Time.cpp - DEV.cpp - DEV_Addr.cpp - DEV_Connector.cpp - DEV_IO.cpp - DLL_Manager.cpp - Dev_Poll_Reactor.cpp - Dirent.cpp - Dirent_Selector.cpp - Dump.cpp - Dynamic.cpp - Event.cpp - Event_Handler.cpp - FIFO.cpp - FIFO_Recv.cpp - FIFO_Recv_Msg.cpp - FIFO_Send.cpp - FIFO_Send_Msg.cpp - FILE.cpp - FILE_Addr.cpp - FILE_Connector.cpp - FILE_IO.cpp - File_Lock.cpp - Flag_Manip.cpp - Framework_Component.cpp - Functor.cpp - Functor_String.cpp - Get_Opt.cpp - gethrtime.cpp - Handle_Ops.cpp - Handle_Set.cpp - Hashable.cpp - High_Res_Timer.cpp - ICMP_Socket.cpp - INET_Addr.cpp - Init_ACE.cpp - IO_SAP.cpp - IO_Cntl_Msg.cpp - IOStream.cpp - IPC_SAP.cpp - Lib_Find.cpp - Local_Memory_Pool.cpp - Lock.cpp - Log_Msg.cpp - Log_Msg_Backend.cpp - Log_Msg_Callback.cpp - Log_Msg_IPC.cpp - Log_Msg_NT_Event_Log.cpp - Log_Msg_UNIX_Syslog.cpp - Log_Record.cpp - Logging_Strategy.cpp - LSOCK.cpp - LSOCK_Acceptor.cpp - LSOCK_CODgram.cpp - LSOCK_Connector.cpp - LSOCK_Dgram.cpp - LSOCK_Stream.cpp - Malloc.cpp - Malloc_Allocator.cpp - Manual_Event.cpp - MEM_Acceptor.cpp - MEM_Addr.cpp - MEM_Connector.cpp - MEM_IO.cpp - Mem_Map.cpp - MEM_SAP.cpp - MEM_Stream.cpp - Message_Block.cpp - Message_Queue.cpp - Method_Request.cpp - MMAP_Memory_Pool.cpp - Msg_WFMO_Reactor.cpp - Multihomed_INET_Addr.cpp - Mutex.cpp - Netlink_Addr.cpp - Notification_Strategy.cpp - Obchunk.cpp - Object_Manager.cpp - Object_Manager_Base.cpp - OS_Errno.cpp - OS_Log_Msg_Attributes.cpp - OS_main.cpp - OS_NS_arpa_inet.cpp - OS_NS_ctype.cpp - OS_NS_dirent.cpp - OS_NS_dlfcn.cpp - OS_NS_errno.cpp - OS_NS_fcntl.cpp - OS_NS_math.cpp - OS_NS_netdb.cpp - OS_NS_poll.cpp - OS_NS_pwd.cpp - OS_NS_regex.cpp - OS_NS_signal.cpp - OS_NS_stdio.cpp - OS_NS_stdlib.cpp - OS_NS_string.cpp - OS_NS_strings.cpp - OS_NS_stropts.cpp - OS_NS_sys_mman.cpp - OS_NS_sys_msg.cpp - OS_NS_sys_resource.cpp - OS_NS_sys_select.cpp - OS_NS_sys_sendfile.cpp - OS_NS_sys_shm.cpp - OS_NS_sys_socket.cpp - OS_NS_sys_stat.cpp - OS_NS_sys_time.cpp - OS_NS_sys_uio.cpp - OS_NS_sys_utsname.cpp - OS_NS_sys_wait.cpp - OS_NS_Thread.cpp - OS_NS_time.cpp - OS_NS_unistd.cpp - OS_NS_wchar.cpp - OS_QoS.cpp - OS_Thread_Adapter.cpp - OS_TLI.cpp - Pagefile_Memory_Pool.cpp - Parse_Node.cpp - PI_Malloc.cpp - Ping_Socket.cpp - Pipe.cpp - POSIX_Asynch_IO.cpp - POSIX_CB_Proactor.cpp - POSIX_Proactor.cpp - Priority_Reactor.cpp - Proactor.cpp - Proactor_Impl.cpp - Process.cpp - Process_Manager.cpp - Process_Mutex.cpp - Process_Semaphore.cpp - Profile_Timer.cpp - Reactor.cpp - Reactor_Impl.cpp - Reactor_Notification_Strategy.cpp - Reactor_Timer_Interface.cpp - Read_Buffer.cpp - Recursive_Thread_Mutex.cpp - Recyclable.cpp - Refcountable.cpp - Registry.cpp - RW_Mutex.cpp - RW_Process_Mutex.cpp - RW_Thread_Mutex.cpp - Sample_History.cpp - Sbrk_Memory_Pool.cpp - Sched_Params.cpp - Select_Reactor_Base.cpp - Semaphore.cpp - Shared_Memory.cpp - Shared_Memory_MM.cpp - Shared_Memory_Pool.cpp - Shared_Memory_SV.cpp - Sig_Adapter.cpp - Sig_Handler.cpp - Signal.cpp - SOCK.cpp - SOCK_Acceptor.cpp - SOCK_CODgram.cpp - Sock_Connect.cpp - SOCK_Connector.cpp - SOCK_Dgram.cpp - SOCK_Dgram_Bcast.cpp - SOCK_Dgram_Mcast.cpp - SOCK_IO.cpp - SOCK_Netlink.cpp - SOCK_SEQPACK_Acceptor.cpp - SOCK_SEQPACK_Association.cpp - SOCK_SEQPACK_Connector.cpp - SOCK_Stream.cpp - SPIPE.cpp - SPIPE_Acceptor.cpp - SPIPE_Addr.cpp - SPIPE_Connector.cpp - SPIPE_Stream.cpp - SString.cpp - Stats.cpp - String_Base_Const.cpp - SUN_Proactor.cpp - SV_Message.cpp - SV_Message_Queue.cpp - SV_Semaphore_Complex.cpp - SV_Semaphore_Simple.cpp - SV_Shared_Memory.cpp - Synch_Options.cpp - System_Time.cpp - Task.cpp - Thread.cpp - Thread_Adapter.cpp - Thread_Control.cpp - Thread_Exit.cpp - Thread_Hook.cpp - Thread_Manager.cpp - Thread_Mutex.cpp - Thread_Semaphore.cpp - Time_Request_Reply.cpp - Time_Value.cpp - Timeprobe.cpp - Timer_Hash.cpp - Timer_Heap.cpp - Timer_List.cpp - Timer_Queue.cpp - Timer_Wheel.cpp - TLI.cpp - TLI_Acceptor.cpp - TLI_Connector.cpp - TLI_Stream.cpp - Token.cpp - TP_Reactor.cpp - Trace.cpp - TSS_Adapter.cpp - TTY_IO.cpp - UNIX_Addr.cpp - UPIPE_Acceptor.cpp - UPIPE_Connector.cpp - UPIPE_Stream.cpp - WFMO_Reactor.cpp - WIN32_Asynch_IO.cpp - WIN32_Proactor.cpp - XTI_ATM_Mcast.cpp - } - - Template_Files { - Acceptor.cpp - Active_Map_Manager_T.cpp - ARGV.cpp - Arg_Shifter.cpp - Array_Base.cpp - Array_Map.cpp - Asynch_Acceptor.cpp - Asynch_Connector.cpp - Atomic_Op_T.cpp - Auto_Functor.cpp - Auto_IncDec_T.cpp - Auto_Ptr.cpp - Based_Pointer_T.cpp - Cache_Map_Manager_T.cpp - Cached_Connect_Strategy_T.cpp - Caching_Strategies_T.cpp - Caching_Utility_T.cpp - Cleanup_Strategies_T.cpp - Condition_T.cpp - Connector.cpp - Containers_T.cpp - Dump_T.cpp - Dynamic_Service.cpp - Env_Value_T.cpp - Event_Handler_T.cpp - Framework_Component_T.cpp - Free_List.cpp - Functor_T.cpp - Future.cpp - Future_Set.cpp - Guard_T.cpp - Hash_Cache_Map_Manager_T.cpp - Hash_Map_Manager_T.cpp - Hash_Map_With_Allocator_T.cpp - IOStream_T.cpp - Intrusive_List.cpp - Intrusive_List_Node.cpp - LOCK_SOCK_Acceptor.cpp - Local_Name_Space_T.cpp - Lock_Adapter_T.cpp - Malloc_T.cpp - Managed_Object.cpp - Map_Manager.cpp - Map_T.cpp - Message_Block_T.cpp - Message_Queue_T.cpp - Module.cpp - Node.cpp - Obstack_T.cpp - Pair_T.cpp - RB_Tree.cpp - Reactor_Token_T.cpp - Refcounted_Auto_Ptr.cpp - Reverse_Lock_T.cpp - Select_Reactor_T.cpp - Singleton.cpp - Strategies_T.cpp - Stream.cpp - Stream_Modules.cpp - String_Base.cpp - Svc_Handler.cpp - Synch_T.cpp - TSS_T.cpp - Task_Ex_T.cpp - Task_T.cpp - Test_and_Set.cpp - Timeprobe_T.cpp - Timer_Hash_T.cpp - Timer_Heap_T.cpp - Timer_List_T.cpp - Timer_Queue_Adapters.cpp - Timer_Queue_T.cpp - Timer_Wheel_T.cpp - Typed_SV_Message.cpp - Typed_SV_Message_Queue.cpp - Unbounded_Queue.cpp - Unbounded_Set.cpp - Vector_T.cpp - } - - Inline_Files { - Bound_Ptr.inl - Condition_T.inl - Guard_T.inl - Handle_Gobbler.inl - Lock_Adapter_T.inl - Refcounted_Auto_Ptr.inl - Reverse_Lock_T.inl - Swap.inl - TSS_T.inl - ace_wchar.inl - } - - Header_Files { - ACE_export.h - Array.h - Bound_Ptr.h - CORBA_macros.h - Condition_T.h - Default_Constants.h - Exception_Macros.h - Global_Macros.h - Guard_T.h - Hash_Map_Manager.h - Handle_Gobbler.h - If_Then_Else.h - IO_Cntl_Msg.h - Lock_Adapter_T.h - Log_Priority.h - Malloc_Base.h - Method_Object.h - Memory_Pool.h - Min_Max.h - Netlink_Addr.h - Null_Barrier.h - Null_Condition.h - Null_Mutex.h - Null_Semaphore.h - Numeric_Limits.h - OS.h - OS_Dirent.h - OS_Memory.h - OS_NS_macros.h - OS_String.h - OS_Thread_Adapter.h - Object_Manager_Base.h - Pair.h - Proactor_Impl.h - Reactor_Impl.h - Reactor_Timer_Interface.h - Refcounted_Auto_Ptr.h - Reverse_Lock_T.h - SOCK_Netlink.h - SStringfwd.h - Static_Object_Lock.h - Strategies.h - String_Base_Const.h - Svc_Conf.h - Svc_Conf_Tokens.h - Swap.h - Synch.h - Synch_Traits.h - TSS_T.h - Timer_Queuefwd.h - Truncate.h - UPIPE_Addr.h - Value_Ptr.h - Version.h - Versioned_Namespace.h - ace_wchar.h - config-WinCE.h - config-all.h - config-borland-common.h - config-lite.h - config-macros.h - config-minimal.h - config-win32-borland.h - config-win32-common.h - config-win32-ghs.h - config-win32-msvc-7.h - config-win32-msvc-8.h - config-win32-msvc.h - config-win32-visualage.h - config-win32.h - config.h - iosfwd.h - os_include - os_include/arpa - os_include/net - os_include/netinet - os_include/sys - post.h - pre.h - streams.h - svc_export.h - } - - Documentation_Files { - README - ../VERSION - } - - Pkgconfig_Files { - ACE.pc.in - } -} diff --git a/ace/ace.mwc b/ace/ace.mwc deleted file mode 100644 index 60eecba03e4..00000000000 --- a/ace/ace.mwc +++ /dev/null @@ -1,14 +0,0 @@ -// -*- MPC -*- -// -// $Id$ - -workspace { - ace.mpc - ace_for_tao.mpc - ace_flreactor.mpc - ace_qtreactor.mpc - ace_tkreactor.mpc - ace_xtreactor.mpc - QoS - SSL -} diff --git a/ace/ace.rc b/ace/ace.rc deleted file mode 100644 index 54792491900..00000000000 --- a/ace/ace.rc +++ /dev/null @@ -1,38 +0,0 @@ -#include "Version.h" - -1 VERSIONINFO - FILEVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION,0 - PRODUCTVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION,0 - FILEFLAGSMASK 0x3fL - FILEFLAGS 0x0L - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "FileDescription", "ACE\0" - VALUE "FileVersion", ACE_VERSION "\0" - VALUE "InternalName", "ACEDLL\0" - VALUE "LegalCopyright", "\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "ACE.DLL\0" - VALUE "ProductName", "ACE\0" - VALUE "ProductVersion", ACE_VERSION "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -/* - * The following resource is used by the ACE logger to write messages - * to the NT event log. If you are statically linking to the ACE - * library, and you wish to use the NT event log, you should copy this - * message table to your application's resource script. - */ -1 MESSAGETABLE ace_message_table.bin diff --git a/ace/ace_ce_dll.cfg b/ace/ace_ce_dll.cfg deleted file mode 100644 index 80c479b3205..00000000000 --- a/ace/ace_ce_dll.cfg +++ /dev/null @@ -1 +0,0 @@ -WCE_CFG=WCE200; \ No newline at end of file diff --git a/ace/ace_flreactor.mpc b/ace/ace_flreactor.mpc deleted file mode 100644 index af3f7afaf9c..00000000000 --- a/ace/ace_flreactor.mpc +++ /dev/null @@ -1,30 +0,0 @@ -// -*- MPC -*- now wouldn't this be cool... -// $Id$ - -project(ACE_FlReactor) : acedefaults, core, acelib, ace_fl{ - - sharedname = ACE_FlReactor - dynamicflags = ACE_FLREACTOR_BUILD_DLL - - Source_Files { - FlReactor.cpp - } - - Header_Files { - ACE_FlReactor_export.h - FlReactor.h - } - - Inline_Files { - } - - Template_Files { - } - - Resource_Files { - } - - Pkgconfig_Files { - ACE_FlReactor.pc.in - } -} diff --git a/ace/ace_for_tao.mpc b/ace/ace_for_tao.mpc deleted file mode 100644 index 7856c9158d3..00000000000 --- a/ace/ace_for_tao.mpc +++ /dev/null @@ -1,381 +0,0 @@ -// -*- MPC -*- -// -// $Id$ - -// The ACE_FOR_TAO subset is designed primarily for use with the -// TAO CosNotification service. It is not intended to be used -// for some of other TAO features and services, such as the TAO -// Strategies library, the CosNaming service, etc. -// -// Avoid adding source files simply to get some ACE/TAO-based code to -// link. This ACE_FOR_TAO subset library must remain as small as -// possible. - -project(ACE_FOR_TAO) : acedefaults, core, svcconf, versioned_namespace, pkgconfig { - macros += ACE_LACKS_ACE_TOKEN - requires = ace_for_tao ace_svcconf - libout = $(ACE_ROOT)/lib - sharedname = ACE_FOR_TAO - dynamicflags = ACE_BUILD_DLL - - Source_Files(ACE_COMPONENTS) { - ACE.cpp - Active_Map_Manager.cpp - Addr.cpp - Argv_Type_Converter.cpp - Assert.cpp - Atomic_Op.cpp - Auto_Event.cpp - Barrier.cpp // Required by orbsvcs/tests/Notify/lib - Base_Thread_Adapter.cpp - Based_Pointer_Repository.cpp - Basic_Stats.cpp // Required by ace/Stats - Basic_Types.cpp - Capabilities.cpp // Required by TAO/orbsvcs/examples/ImR/Advanced - CDR_Base.cpp - CDR_Stream.cpp - CDR_Size.cpp - Cleanup.cpp - Codeset_IBM1047.cpp - Codeset_Registry.cpp - Codeset_Registry_db.cpp - Condition_Recursive_Thread_Mutex.cpp - Condition_Thread_Mutex.cpp - Countdown_Time.cpp - Copy_Disabled.cpp - DLL_Manager.cpp - Dirent.cpp // Required by TAO_IDL - Dirent_Selector.cpp - Dump.cpp - Dynamic.cpp - Event.cpp - Event_Handler.cpp - FILE.cpp - FILE_Addr.cpp - Flag_Manip.cpp - Framework_Component.cpp - Functor.cpp - Functor_String.cpp - Get_Opt.cpp - Handle_Ops.cpp - Handle_Set.cpp - Hashable.cpp - High_Res_Timer.cpp // Required by orbsvcs/tests/Notify/lib - INET_Addr.cpp - Init_ACE.cpp - IO_SAP.cpp - IO_Cntl_Msg.cpp - IOStream.cpp - IPC_SAP.cpp - Lib_Find.cpp - Local_Memory_Pool.cpp - Lock.cpp - Log_Msg.cpp - Log_Msg_Backend.cpp - Log_Msg_Callback.cpp - Log_Msg_IPC.cpp - Log_Msg_NT_Event_Log.cpp - Log_Msg_UNIX_Syslog.cpp - Log_Record.cpp - Logging_Strategy.cpp - Malloc.cpp - Malloc_Allocator.cpp - Manual_Event.cpp - Mem_Map.cpp - Message_Block.cpp - Message_Queue.cpp - MMAP_Memory_Pool.cpp - Mutex.cpp - Notification_Strategy.cpp - Obchunk.cpp - Object_Manager.cpp - Object_Manager_Base.cpp - OS_Errno.cpp - OS_Log_Msg_Attributes.cpp - OS_main.cpp - OS_NS_arpa_inet.cpp - OS_NS_ctype.cpp - OS_NS_dirent.cpp - OS_NS_dlfcn.cpp - OS_NS_errno.cpp - OS_NS_fcntl.cpp - OS_NS_math.cpp - OS_NS_netdb.cpp - OS_NS_poll.cpp - OS_NS_pwd.cpp - OS_NS_regex.cpp - OS_NS_signal.cpp - OS_NS_stdio.cpp - OS_NS_stdlib.cpp - OS_NS_string.cpp - OS_NS_strings.cpp - OS_NS_stropts.cpp - OS_NS_sys_mman.cpp - OS_NS_sys_msg.cpp - OS_NS_sys_resource.cpp - OS_NS_sys_select.cpp - OS_NS_sys_sendfile.cpp - OS_NS_sys_shm.cpp - OS_NS_sys_socket.cpp - OS_NS_sys_stat.cpp - OS_NS_sys_time.cpp - OS_NS_sys_uio.cpp - OS_NS_sys_utsname.cpp - OS_NS_sys_wait.cpp - OS_NS_Thread.cpp - OS_NS_time.cpp - OS_NS_unistd.cpp - OS_NS_wchar.cpp - OS_QoS.cpp - OS_Thread_Adapter.cpp - OS_TLI.cpp - Parse_Node.cpp - Pipe.cpp - Process.cpp - Reactor.cpp - Reactor_Impl.cpp - Reactor_Notification_Strategy.cpp - Reactor_Timer_Interface.cpp - Read_Buffer.cpp - Recursive_Thread_Mutex.cpp - Refcountable.cpp - RW_Mutex.cpp - RW_Thread_Mutex.cpp - Sched_Params.cpp - Select_Reactor_Base.cpp - Signal.cpp - Sig_Handler.cpp - Sig_Adapter.cpp - SOCK.cpp - SOCK_Acceptor.cpp - Sock_Connect.cpp - SOCK_Connector.cpp - SOCK_Dgram.cpp - SOCK_Dgram_Mcast.cpp - SOCK_IO.cpp - SOCK_Stream.cpp - SPIPE.cpp - SPIPE_Acceptor.cpp - SPIPE_Connector.cpp - SPIPE_Addr.cpp - SPIPE_Stream.cpp - SString.cpp - Stats.cpp // Required by orbsvcs/tests/Notify - String_Base_Const.cpp - Synch_Options.cpp - Task.cpp - Thread.cpp - Thread_Adapter.cpp - Thread_Control.cpp - Thread_Exit.cpp - Thread_Hook.cpp - Thread_Manager.cpp - Thread_Mutex.cpp - Time_Value.cpp - Timeprobe.cpp - Timer_Hash.cpp - Timer_Heap.cpp - Timer_List.cpp - Timer_Queue.cpp - Timer_Wheel.cpp - Token.cpp - TP_Reactor.cpp - Trace.cpp - TSS_Adapter.cpp - - // Dev_Poll_Reactor isn't available on Windows. - conditional(automake,make,gnuace) { - Dev_Poll_Reactor.cpp - } - - // ACE_Token implementation uses semaphores on Windows and VxWorks. - conditional(vc6,vc71,vc8,nmake,bmake,borland) { - ACE_crc32.cpp // Required by SV_Semaphore_Simple - NT_Service.cpp // Required by ace_for_tao sponsors - Semaphore.cpp - Process_Mutex.cpp - WFMO_Reactor.cpp - SV_Semaphore_Simple.cpp - SV_Semaphore_Complex.cpp - } - } - - Template_Files { - Acceptor.cpp - Active_Map_Manager_T.cpp - Array_Base.cpp - Array_Map.cpp - Arg_Shifter.cpp - ARGV.cpp - Atomic_Op_T.cpp - Auto_Functor.cpp - Auto_IncDec_T.cpp - Auto_Ptr.cpp - Based_Pointer_T.cpp - Cache_Map_Manager_T.cpp - Cached_Connect_Strategy_T.cpp - Caching_Strategies_T.cpp - Caching_Utility_T.cpp - Cleanup_Strategies_T.cpp - Condition_T.cpp - Connector.cpp - Containers_T.cpp - Dump_T.cpp - Dynamic_Service.cpp - Env_Value_T.cpp - Event_Handler_T.cpp - Framework_Component_T.cpp - Free_List.cpp - Functor_T.cpp - Guard_T.cpp - Hash_Cache_Map_Manager_T.cpp - Hash_Map_Manager_T.cpp - Hash_Map_With_Allocator_T.cpp - IOStream_T.cpp - Intrusive_List.cpp - Intrusive_List_Node.cpp - Lock_Adapter_T.cpp - Malloc_T.cpp - Managed_Object.cpp - Map_Manager.cpp - Map_T.cpp - Message_Block_T.cpp - Message_Queue_T.cpp - Module.cpp - Node.cpp - Obstack_T.cpp - Pair_T.cpp - RB_Tree.cpp - Reactor_Token_T.cpp - Refcounted_Auto_Ptr.cpp - Reverse_Lock_T.cpp - Select_Reactor_T.cpp - Singleton.cpp - Strategies_T.cpp - Stream.cpp - Stream_Modules.cpp - String_Base.cpp - Svc_Handler.cpp - Synch_T.cpp - TSS_T.cpp - Task_Ex_T.cpp - Task_T.cpp - Timeprobe_T.cpp - Timer_Hash_T.cpp - Timer_Heap_T.cpp - Timer_List_T.cpp - Timer_Queue_Adapters.cpp - Timer_Queue_T.cpp - Timer_Wheel_T.cpp - Typed_SV_Message.cpp - Typed_SV_Message_Queue.cpp - Unbounded_Queue.cpp - Unbounded_Set.cpp - Vector_T.cpp - } - - Inline_Files { - Bound_Ptr.inl - Condition_T.inl - Guard_T.inl - Handle_Gobbler.inl - Lock_Adapter_T.inl - OS.inl - OS_Memory.inl - OS_String.inl - Refcounted_Auto_Ptr.inl - Reverse_Lock_T.inl - Swap.inl - TSS_T.inl - ace_wchar.inl - MMAP_Memory_Pool.inl - Mem_Map.inl - } - - Header_Files { - ACE_export.h - Array.h - Based_Pointer_Repository.h - Bound_Ptr.h - CORBA_macros.h - Condition_T.h - Default_Constants.h - Exception_Macros.h - Global_Macros.h - Guard_T.h - Handle_Gobbler.h - If_Then_Else.h - IO_Cntl_Msg.h - Lock_Adapter_T.h - Log_Priority.h - Malloc_Base.h - MMAP_Memory_Pool.h - Memory_Pool.h - Mem_Map.h - Min_Max.h - Null_Barrier.h - Null_Condition.h - Null_Mutex.h - Null_Semaphore.h - Numeric_Limits.h - OS.h - OS_Dirent.h - OS_Memory.h - OS_NS_macros.h - OS_String.h - OS_Thread_Adapter.h - Object_Manager_Base.h - Pair.h - Reactor_Impl.h - Reactor_Timer_Interface.h - Refcounted_Auto_Ptr.h - Reverse_Lock_T.h - SStringfwd.h - Static_Object_Lock.h - Strategies.h - String_Base_Const.h - Svc_Conf.h - Svc_Conf_Tokens.h - Swap.h - Synch.h - Synch_Traits.h - TSS_T.h - Timer_Queuefwd.h - Value_Ptr.h - Version.h - ace_wchar.h - config-WinCE.h - config-all.h - config-borland-common.h - config-lite.h - config-minimal.h - config-win32-borland.h - config-win32-common.h - config-win32-ghs.h - config-win32-msvc-6.h - config-win32-msvc-7.h - config-win32-msvc.h - config-win32-visualage.h - config-win32.h - config.h - iosfwd.h - os_include - os_include/arpa - os_include/net - os_include/netinet - os_include/sys - post.h - pre.h - streams.h - svc_export.h - } - - Documentation_Files { - README - ../VERSION - } - - Pkgconfig_Files { - ACE_FOR_TAO.pc.in - } -} diff --git a/ace/ace_message_table.bin b/ace/ace_message_table.bin deleted file mode 100644 index 6ac08e5dc69..00000000000 Binary files a/ace/ace_message_table.bin and /dev/null differ diff --git a/ace/ace_qtreactor.mpc b/ace/ace_qtreactor.mpc deleted file mode 100644 index 549181b1348..00000000000 --- a/ace/ace_qtreactor.mpc +++ /dev/null @@ -1,34 +0,0 @@ -// -*- MPC -*- now wouldn't this be cool... -// $Id$ - -project(ACE_QtReactor) : acedefaults, core, acelib, ace_qt { - - sharedname = ACE_QtReactor - dynamicflags = ACE_QTREACTOR_BUILD_DLL - - MOC_Files { - QtReactor.h - } - - Source_Files { - QtReactor_moc.cpp - QtReactor.cpp - } - - Header_Files { - ACE_QtReactor_export.h - } - - Inline_Files { - } - - Template_Files { - } - - Resource_Files { - } - - Pkgconfig_Files { - ACE_QtReactor.pc.in - } -} diff --git a/ace/ace_tkreactor.mpc b/ace/ace_tkreactor.mpc deleted file mode 100644 index fbbda18160c..00000000000 --- a/ace/ace_tkreactor.mpc +++ /dev/null @@ -1,30 +0,0 @@ -// -*- MPC -*- now wouldn't this be cool... -// $Id$ - -project(ACE_TkReactor) : acedefaults, core, acelib, ace_tk { - - sharedname = ACE_TkReactor - dynamicflags = ACE_TKREACTOR_BUILD_DLL - - Source_Files { - TkReactor.cpp - } - - Header_Files { - ACE_TkReactor_export.h - TkReactor.h - } - - Inline_Files { - } - - Template_Files { - } - - Resource_Files { - } - - Pkgconfig_Files { - ACE_TkReactor.pc.in - } -} diff --git a/ace/ace_wchar.h b/ace/ace_wchar.h deleted file mode 100644 index 2d3af93ffb4..00000000000 --- a/ace/ace_wchar.h +++ /dev/null @@ -1,352 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file ace_wchar.h - * - * $Id$ - * - * @author Darrell Brunsch - */ -//============================================================================= - -#ifndef ACE_WCHAR_H -#define ACE_WCHAR_H - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// These macros have been deprecated and should be replaced by their -// ACE_TEXT_* equivalents. These macros are just hacks and may not -// completely provide the old functionality. -#if defined (ACE_LEGACY_MODE) -// Convert the old unicode indicators -# if defined (ACE_HAS_MOSTLY_UNICODE_APIS) -# define ACE_USES_WCHAR -# endif /* ACE_HAS_MOSTLY_UNICODE_APIS */ -# if defined (ACE_HAS_UNICODE) -# define ACE_HAS_WCHAR -# endif /* ACE_HAS_UNICODE */ - -// These are defined to get older stuff to compile -// FUZZ: disable check_for_tchar -# define ASYS_TCHAR ACE_TCHAR -# define ASYS_TEXT ACE_TEXT -# define ASYS_ONLY_MULTIBYTE_STRING ACE_TEXT_ALWAYS_CHAR -# define ASYS_MULTIBYTE_STRING ACE_TEXT_CHAR_TO_TCHAR -# define ASYS_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR -# define ACE_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR - -# if defined (ACE_USES_WCHAR) -# define ASYS_ONLY_WIDE_STRING(STRING) STRING -# else /* ACE_USES_WCHAR */ -# define ASYS_ONLY_WIDE_STRING(STRING) \ - ACE_Ascii_To_Wide (STRING).wchar_rep () -# endif /* ACE_USES_WCHAR */ - -# define ACE_TEXT_STRING ACE_TString - -#endif /* ACE_LEGACY_MODE */ - -#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) -# if !defined (ACE_HAS_WCHAR) -# define ACE_HAS_WCHAR -# endif -# include /**/ -#endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ - -#if defined (ACE_HAS_WCHAR) -# if defined (ACE_VXWORKS) -# include /**/ /* For wchar_t */ -# include /**/ /* For mbstowcs, etc. */ -# include /**/ /* For strlen */ -# if !defined (__RTP__) -# define wint_t unsigned int /* VxWorks has wchar_t but not wint_t */ -# else -# include /**/ -# include /**/ -# endif -# elif defined (ACE_OPENVMS) -# include /**/ -# include /**/ -# elif defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ - (ACE_HAS_STANDARD_CPP_LIBRARY != 0) -# include /**/ -# include /**/ -# elif defined (ACE_HAS_WINCE) -# include /**/ -# elif !defined (__BORLANDC__) -# include /**/ -# endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ -#endif /* ACE_HAS_WCHAR */ - -#if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) -using std::size_t; -#endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ - -// This makes the somewhat dubious assumption that if a platform lacks -// a native wchar_t type, then it will typedef it as unsigned short. -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_NATIVE_WCHAR_T) -# if !defined (ACE_WSTRING_HAS_USHORT_SUPPORT) -# define ACE_WSTRING_HAS_USHORT_SUPPORT -# endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */ -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_NATIVE_WCHAR_T */ - -// Set the default behaviour for ACE_TEXT_WIDE to use the L-prefix -#if !defined (ACE_USES_L_PREFIX) -# define ACE_USES_L_PREFIX 1 -#endif /* ACE_USES_L_PREFIX */ - -// Define the unicode/wchar related macros correctly - -# if !defined (ACE_TEXT_WIDE) -# if (ACE_USES_L_PREFIX == 1) -# define ACE_TEXT_WIDE_I(STRING) L##STRING -# else /* ACE_USES_L_PREFIX */ -# define ACE_TEXT_WIDE_I(STRING) STRING -# endif /* ACE_USES_L_PREFIX */ -# define ACE_TEXT_WIDE(STRING) ACE_TEXT_WIDE_I (STRING) -# endif /* ACE_TEXT_WIDE */ - -#if defined (ACE_USES_WCHAR) -typedef wchar_t ACE_TCHAR; -typedef char ACE_ANTI_TCHAR; -# define ACE_LIB_TEXT(STRING) ACE_TEXT_WIDE (STRING) -# define ACE_TEXT_ALWAYS_CHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep () -# define ACE_TEXT_ALWAYS_WCHAR(STRING) STRING -# define ACE_TEXT_CHAR_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep () -# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) STRING -# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep () -#else /* ACE_USES_WCHAR */ -typedef char ACE_TCHAR; -typedef wchar_t ACE_ANTI_TCHAR; -# define ACE_LIB_TEXT(STRING) STRING -# define ACE_TEXT_ALWAYS_CHAR(STRING) STRING -# define ACE_TEXT_ALWAYS_WCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep () -# define ACE_TEXT_CHAR_TO_TCHAR(STRING) STRING -# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep () -# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep () -#endif /* ACE_USES_WCHAR */ - -#if defined (ACE_LEGACY_MODE) -# define ACE_TEXT TEXT -#else /* ACE_LEGACY_MODE */ -# define ACE_TEXT ACE_LIB_TEXT -#endif /* ACE_LEGACY_MODE */ - -// The OS_String module defines some wide-char functions that are not -// universally available. In particular, they're not part of the -// XPG4 Worldwide Portability Interface wide-character string handling -// functions. So, if ACE_HAS_XPG4_MULTIBYTE_CHAR is defined, note that -// these functions are missing. -#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) - -# if !defined (ACE_LACKS_ITOW) -# define ACE_LACKS_ITOW -# endif - -# if !defined (ACE_LACKS_WCSICMP) -# define ACE_LACKS_WCSICMP -# endif - -# if !defined (ACE_LACKS_WCSNICMP) -# define ACE_LACKS_WCSNICMP -# endif - -# if !defined (ACE_LACKS_WCSDUP) -# define ACE_LACKS_WCSDUP -# endif - -#endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ - -#if defined ACE_HAS_WCHAR - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Wide_To_Ascii - * - * @brief A lightweight wchar* to char* string conversion class. - * - * The purpose of this class is to perform conversion from - * wchar* to char* strings. It is not intended for general - * purpose use. - */ -class ACE_Wide_To_Ascii -{ -public: - /// Ctor must take a wchar string. - ACE_Wide_To_Ascii (const wchar_t *s); - - /// Dtor will free up the memory. - ~ACE_Wide_To_Ascii (void); - - /// Return the internal char* representation. - char *char_rep (void); - - /// Converts an wchar_t string to ascii and returns a new string. - static char *convert (const wchar_t *wstr); - -private: - /// Internal pointer to the converted string. - char *s_; - - /// Disallow these operation. - ACE_Wide_To_Ascii (void); - ACE_Wide_To_Ascii (ACE_Wide_To_Ascii &); - ACE_Wide_To_Ascii& operator= (ACE_Wide_To_Ascii &); -}; - -/** - * @class ACE_Ascii_To_Wide - * - * @brief A lightweight char* to wchar* string conversion class. - * - * The purpose of this class is to perform conversion from - * char* to wchar* strings. It is not intended for general - * purpose use. - */ -class ACE_Ascii_To_Wide -{ -public: - /// Ctor must take a wchar string. - ACE_Ascii_To_Wide (const char *s); - - /// Dtor will free up the memory. - ~ACE_Ascii_To_Wide (void); - - /// Return the internal wchar* representation. - wchar_t *wchar_rep (void); - - /// Converts an char string to unicode/wide and returns a new string. - static wchar_t *convert (const char *str); - -private: - /// Internal pointer to the converted string. - wchar_t *s_; - - /// Disallow these operation. - ACE_Ascii_To_Wide (void); - ACE_Ascii_To_Wide (ACE_Ascii_To_Wide &); - ACE_Ascii_To_Wide operator= (ACE_Ascii_To_Wide &); -}; - -#if defined (ACE_LEGACY_MODE) -typedef ACE_Ascii_To_Wide ACE_OS_CString; -typedef ACE_Wide_To_Ascii ACE_OS_WString; -#endif /* ACE_LEGACY_MODE */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_WCHAR */ - -#if defined (ACE_WIN32) -#if defined (ACE_USES_WCHAR) -#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYW -#define ACE_TEXT_STARTUPINFO STARTUPINFOW -#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAW -#define ACE_TEXT_OSVERSIONINFO OSVERSIONINFOW - -#define ACE_TEXT_CreateEvent ::CreateEventW -#define ACE_TEXT_CreateFile ::CreateFileW -#define ACE_TEXT_CreateFileMapping ::CreateFileMappingW -#define ACE_TEXT_CreateMutex ::CreateMutexW -#define ACE_TEXT_CreateProcess ::CreateProcessW -#define ACE_TEXT_CreateSemaphore ::CreateSemaphoreW -#define ACE_TEXT_CreateService ::CreateServiceW -#define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsW -#define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationW -#define ACE_TEXT_FindFirstFile ::FindFirstFileW -#define ACE_TEXT_FindNextFile ::FindNextFileW -#define ACE_TEXT_FormatMessage ::FormatMessageW -#define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsW -#define ACE_TEXT_GetComputerName ::GetComputerNameW -#define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsW -#define ACE_TEXT_GetFileAttributes ::GetFileAttributesW -#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameW -#define ACE_TEXT_GetTempPath ::GetTempPathW -#define ACE_TEXT_GetUserName ::GetUserNameW -#define ACE_TEXT_GetVersionEx ::GetVersionExW -#define ACE_TEXT_LoadLibrary ::LoadLibraryW -#define ACE_TEXT_MoveFileEx ::MoveFileExW -#define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeW -#define ACE_TEXT_OpenFileMapping ::OpenFileMappingW -#define ACE_TEXT_OpenSCManager ::OpenSCManagerW -#define ACE_TEXT_OpenService ::OpenServiceW -#define ACE_TEXT_OutputDebugString ::OutputDebugStringW -#define ACE_TEXT_RegisterEventSource ::RegisterEventSourceW -#define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerW -#define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryW -#define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExW -#define ACE_TEXT_RegDeleteKey ::RegDeleteKeyW -#define ACE_TEXT_RegDeleteValue ::RegDeleteValueW -#define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExW -#define ACE_TEXT_RegEnumValue ::RegEnumValueW -#define ACE_TEXT_RegCreateKey ::RegCreateKeyW -#define ACE_TEXT_RegOpenKey ::RegOpenKeyW -#define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExW -#define ACE_TEXT_RegQueryValueEx ::RegQueryValueExW -#define ACE_TEXT_RegSetValueEx ::RegSetValueExW -#define ACE_TEXT_ReportEvent ::ReportEventW -#define ACE_TEXT_SearchPath ::SearchPathW -#define ACE_TEXT_StartService ::StartServiceW -#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherW - -#else /* ACE_USES_WCHAR */ -#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYA -#define ACE_TEXT_STARTUPINFO STARTUPINFOA -#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAA -#define ACE_TEXT_OSVERSIONINFO OSVERSIONINFOA - -#define ACE_TEXT_CreateEvent ::CreateEventA -#define ACE_TEXT_CreateFile ::CreateFileA -#define ACE_TEXT_CreateFileMapping ::CreateFileMappingA -#define ACE_TEXT_CreateMutex ::CreateMutexA -#define ACE_TEXT_CreateProcess ::CreateProcessA -#define ACE_TEXT_CreateSemaphore ::CreateSemaphoreA -#define ACE_TEXT_CreateService ::CreateServiceA -#define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsA -#define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationA -#define ACE_TEXT_FindFirstFile ::FindFirstFileA -#define ACE_TEXT_FindNextFile ::FindNextFileA -#define ACE_TEXT_FormatMessage ::FormatMessageA -#define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsA -#define ACE_TEXT_GetComputerName ::GetComputerNameA -#define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsA -#define ACE_TEXT_GetFileAttributes ::GetFileAttributesA -#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameA -#define ACE_TEXT_GetTempPath ::GetTempPathA -#define ACE_TEXT_GetUserName ::GetUserNameA -#define ACE_TEXT_GetVersionEx ::GetVersionExA -#define ACE_TEXT_LoadLibrary ::LoadLibraryA -#define ACE_TEXT_MoveFileEx ::MoveFileExA -#define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeA -#define ACE_TEXT_OpenFileMapping ::OpenFileMappingA -#define ACE_TEXT_OpenSCManager ::OpenSCManagerA -#define ACE_TEXT_OpenService ::OpenServiceA -#define ACE_TEXT_OutputDebugString ::OutputDebugStringA -#define ACE_TEXT_RegisterEventSource ::RegisterEventSourceA -#define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerA -#define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryA -#define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExA -#define ACE_TEXT_RegDeleteKey ::RegDeleteKeyA -#define ACE_TEXT_RegDeleteValue ::RegDeleteValueA -#define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExA -#define ACE_TEXT_RegEnumValue ::RegEnumValueA -#define ACE_TEXT_RegCreateKey ::RegCreateKeyA -#define ACE_TEXT_RegOpenKey ::RegOpenKeyA -#define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExA -#define ACE_TEXT_RegQueryValueEx ::RegQueryValueExA -#define ACE_TEXT_RegSetValueEx ::RegSetValueExA -#define ACE_TEXT_ReportEvent ::ReportEventA -#define ACE_TEXT_SearchPath ::SearchPathA -#define ACE_TEXT_StartService ::StartServiceA -#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherA -#endif /* ACE_USES_WCHAR */ -#endif /* ACE_WIN32 */ - -#include "ace/ace_wchar.inl" - -#endif /* ACE_WCHAR_H */ diff --git a/ace/ace_wchar.inl b/ace/ace_wchar.inl deleted file mode 100644 index e99549e3f04..00000000000 --- a/ace/ace_wchar.inl +++ /dev/null @@ -1,127 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// These are always inlined -// FUZZ: disable check_for_inline - -#if defined (ACE_HAS_WCHAR) - -#if !defined (ACE_WIN32) -# include /**/ // Need to see strlen() -#endif /* ACE_WIN32 */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -inline -ACE_Wide_To_Ascii::~ACE_Wide_To_Ascii (void) -{ - delete [] this->s_; -} - -inline char * -ACE_Wide_To_Ascii::char_rep (void) -{ - return this->s_; -} - -inline char * -ACE_Wide_To_Ascii::convert (const wchar_t *wstr) -{ - // Short circuit null pointer case - if (wstr == 0) - return 0; - -# if defined (ACE_WIN32) - UINT const cp = GetACP (); // Codepage - int const len = ::WideCharToMultiByte (cp, - 0, - wstr, - -1, - 0, - 0, - 0, - 0); -# elif defined (ACE_LACKS_WCSLEN) - const wchar_t * wtemp = wstr; - while (wtemp != 0) - ++wtemp; - - int const len = wtemp - wstr + 1; -# else /* ACE_WIN32 */ - size_t const len = ::wcslen (wstr) + 1; -# endif /* ACE_WIN32 */ - - char *str = new char[len]; - -# if defined (ACE_WIN32) - ::WideCharToMultiByte (cp, 0, wstr, -1, str, len, 0, 0); -# elif defined (ACE_VXWORKS) - ::wcstombs (str, wstr, len); -# else /* ACE_WIN32 */ - for (size_t i = 0; i < len; ++i) - { - wchar_t *t = const_cast (wstr); - str[i] = static_cast (*(t + i)); - } -# endif /* ACE_WIN32 */ - return str; -} - -inline -ACE_Wide_To_Ascii::ACE_Wide_To_Ascii (const wchar_t *s) - : s_ (ACE_Wide_To_Ascii::convert (s)) -{ -} - -inline -ACE_Ascii_To_Wide::~ACE_Ascii_To_Wide (void) -{ - delete [] this->s_; -} - -inline wchar_t * -ACE_Ascii_To_Wide::wchar_rep (void) -{ - return this->s_; -} - -inline wchar_t * -ACE_Ascii_To_Wide::convert (const char *str) -{ - // Short circuit null pointer case - if (str == 0) - return 0; - -# if defined (ACE_WIN32) - UINT const cp = GetACP (); // Codepage - int const len = ::MultiByteToWideChar (cp, 0, str, -1, 0, 0); -# else /* ACE_WIN32 */ - size_t const len = strlen (str) + 1; -# endif /* ACE_WIN32 */ - - wchar_t *wstr = new wchar_t[len]; - -# if defined (ACE_WIN32) - ::MultiByteToWideChar (cp, 0, str, -1, wstr, len); -# elif defined (ACE_VXWORKS) - ::mbstowcs (wstr, str, len); -# else /* ACE_WIN32 */ - for (size_t i = 0; i < len; ++i) - { - char *t = const_cast (str); - wstr[i] = static_cast (*((unsigned char*)(t + i))); - } -# endif /* ACE_WIN32 */ - return wstr; -} - -inline -ACE_Ascii_To_Wide::ACE_Ascii_To_Wide (const char *s) - : s_ (ACE_Ascii_To_Wide::convert (s)) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_WCHAR */ diff --git a/ace/ace_xtreactor.mpc b/ace/ace_xtreactor.mpc deleted file mode 100644 index 9d8c44e666f..00000000000 --- a/ace/ace_xtreactor.mpc +++ /dev/null @@ -1,30 +0,0 @@ -// -*- MPC -*- now wouldn't this be cool... -// $Id$ - -project(ACE_XtReactor) : acedefaults, core, acelib, ace_xt { - - sharedname = ACE_XtReactor - dynamicflags = ACE_XTREACTOR_BUILD_DLL - - Source_Files { - XtReactor.cpp - } - - Header_Files { - XtReactor.h - ACE_XtReactor_export.h - } - - Inline_Files { - } - - Template_Files { - } - - Resource_Files { - } - - Pkgconfig_Files { - ACE_XtReactor.pc.in - } -} diff --git a/ace/codecs.mpb b/ace/codecs.mpb deleted file mode 100644 index d8c85fffddb..00000000000 --- a/ace/codecs.mpb +++ /dev/null @@ -1,8 +0,0 @@ -// -*- MPC -*- -// $Id$ - -feature(ace_codecs) { - Source_Files(ACE_COMPONENTS) { - Codecs.cpp - } -} diff --git a/ace/config-WinCE.h b/ace/config-WinCE.h deleted file mode 100644 index 8a31e29f9fd..00000000000 --- a/ace/config-WinCE.h +++ /dev/null @@ -1,231 +0,0 @@ -// $Id$ - -// Note: For WinCE build, simply use: #include "ace/config-win32.h" -// It is same as config.h for Windows NT/2k so that you can -// share same files and directories for both WinCE and NT/2k -// builds, unless you add additional definition(s) for each -// specific build or change the output directory. - -#ifndef ACE_CONFIG_WINCE_H -#define ACE_CONFIG_WINCE_H - -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -# error Use config-win32.h in config.h instead of this header -#endif // ACE_CONFIG_WIN32_H - -#if !defined (UNDER_CE) -# error Define UNDER_CE to version (i.e. 300 = 3.0) -#endif // UNDER_CE - -#if (UNDER_CE < 300) -# error ACE requires Windows CE 3.0 and later. -#endif // UNDER_CE - -#if (UNDER_CE < 400) -// CE 3 doesn't have Winsock 2, but CE 4 does. -# if !defined (ACE_HAS_WINSOCK2) -# define ACE_HAS_WINSOCK2 0 -# endif -# define ACE_LACKS_ASSERT_H -# define ACE_LACKS_SEARCH_H -# define ACE_LACKS_WCHAR_H -# define ACE_LACKS_WCTYPE_H -# define ACE_LACKS_STDDEF_H -# define ACE_LACKS_PTRDIFF_T -#endif /* UNDER_CE < 400 */ - -#if !defined (ACE_HAS_WINCE) -# define ACE_HAS_WINCE 1 -#endif - -// We need these libraries to build: -#pragma comment(lib,"corelibc.lib") -#pragma comment(linker, "/nodefaultlib:oldnames.lib") - -// Only DLL version is supported on CE. -//#if defined (ACE_HAS_DLL) -//# undef ACE_HAS_DLL -//#endif // ACE_HAS_DLL -//#define ACE_HAS_DLL 1 - -// Need to define LD search path explicitly on CE because -// CE doesn't have environment variables and we can't get -// the information using getenv. -#define ACE_DEFAULT_LD_SEARCH_PATH ACE_LIB_TEXT (".\\;\\windows") - -#define ACE_LACKS_FCNTL_H -#define ACE_LACKS_SYS_TYPES_H -#define ACE_LACKS_GETCWD -#define ACE_LACKS_ASCTIME -#define ACE_LACKS_ASCTIME_R -#define ACE_LACKS_GMTIME -#define ACE_LACKS_GMTIME_R -#define ACE_LACKS_LOCALTIME -#define ACE_LACKS_STRFTIME -#define ACE_LACKS_SETFILEPOINTEREX - -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 - -// CE is not NT. -#if defined (ACE_HAS_WINNT4) -# undef ACE_HAS_WINNT4 -#endif // ACE_HAS_WINNT4 -#define ACE_HAS_WINNT4 0 - -#define ACE_LACKS_MSG_WFMO -#define ACE_LACKS_UMASK - -// WinCE only supports the UNICODE API -#if !defined (ACE_USES_WCHAR) -# define ACE_USES_WCHAR -#endif /* ACE_USES_WCHAR */ - -#define ACE_USES_WINCE_SEMA_SIMULATION - -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER 1 - -// FILE stuff isn't always defined in CE -#if (_MSC_VER < 1400) && !defined (_FILE_DEFINED) - typedef void FILE; -# define _FILE_DEFINED -#endif /* _MSC_VER < 1400 && !_FILE_DEFINED */ - -// This was defined in previous versions of CE, but not 2.11 -#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION - -#define ACE_MAIN WINAPI WinMain - -// SH3 cross-compiler can't handle inline functions correctly -// (along with other bugs.) -#if defined (SH3) -# define ACE_LACKS_INLINE_FUNCTIONS -#endif // SH3 && _DEBUG - -#ifndef ACE_DEFAULT_SERVER_HOST -# define ACE_DEFAULT_SERVER_HOST ACE_LIB_TEXT("localhost") -#endif // ACE_DEFAULT_SERVER_HOST - -// @@ Need to remap every function that uses any of these flags to -// Win32 API. These are for ANSI styled function and are not -// available on WinCE. - -#define _O_RDONLY 0x0000 // open for reading only -#define _O_WRONLY 0x0001 // open for writing only -#define _O_RDWR 0x0002 // open for reading and writing -#define _O_APPEND 0x0008 // writes done at eof - -#define _O_CREAT 0x0100 // create and open file -#define _O_TRUNC 0x0200 // open and truncate -#define _O_EXCL 0x0400 // open only if file doesn't already exist - -// O_TEXT files have sequences translated to on read()'s, -// and sequences translated to on write()'s -#define _O_TEXT 0x4000 // file mode is text (translated) -#define _O_BINARY 0x8000 // file mode is binary (untranslated) - -// macro to translate the C 2.0 name used to force binary mode for files -//#define _O_RAW _O_BINARY - -// Open handle inherit bit -//#define _O_NOINHERIT 0x0080 // child process doesn't inherit file - -// Temporary file bit - file is deleted when last handle is closed -#define _O_TEMPORARY 0x0040 // temporary file bit - -// temporary access hint -//#define _O_SHORT_LIVED 0x1000 // temporary storage file, try not to flush - -// sequential/random access hints -//#define _O_SEQUENTIAL 0x0020 // file access is primarily sequential -//#define _O_RANDOM 0x0010 // file access is primarily random - - -// Non-ANSI names -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_RDWR _O_RDWR -#define O_APPEND _O_APPEND -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC -#define O_EXCL _O_EXCL -#define O_TEXT _O_TEXT -#define O_BINARY _O_BINARY -#define O_TEMPORARY _O_TEMPORARY -//#define O_RAW _O_BINARY -//#define O_NOINHERIT _O_NOINHERIT -//#define O_SEQUENTIAL _O_SEQUENTIAL -//#define O_RANDOM _O_RANDOM - - -// @@ NSIG value. This is definitely not correct. -#define NSIG 23 - - -// @@ For some reason, WinCE forgot to define this. -// Need to find out what it is. (Used in MapViewOfFile ().) -#define FILE_MAP_COPY 0 - - -#define ACE_LACKS_STRCASECMP // WinCE doesn't support _stricmp -#define ACE_LACKS_GETSERVBYNAME -#define ACE_LACKS_ACCESS -#define ACE_LACKS_FILELOCKS -#define ACE_LACKS_EXEC -#define ACE_LACKS_MKTEMP -#define ACE_LACKS_STRRCHR -#define ACE_LACKS_BSEARCH -#define ACE_LACKS_SOCKET_BUFSIZ -#define ACE_LACKS_ISATTY -#define ACE_LACKS_STRERROR -#define ACE_LACKS_SYSTEM -#define ACE_LACKS_SIGACTION -#define ACE_LACKS_PIPE - -#define ACE_LACKS_CUSERID -#define ACE_LACKS_CHDIR -#define ACE_LACKS_ENV -#define ACE_LACKS_HOSTNAME -#define ACE_LACKS_REALPATH -#define ACE_LACKS_READLINK -#define ACE_LACKS_SWAB -#define ACE_LACKS_TEMPNAM -#define ACE_LACKS_GETPROTOBYNUMBER -#define ACE_LACKS_GETPROTOBYNAME - -#if defined (_WIN32_WCE_EMULATION) -// @@ For some reason, qsort isn't defined correctly (_stdcall vs _cdecl) -// under emulation. So for right now, exclude it. -# define ACE_LACKS_QSORT -#endif // _WIN32_WCE_EMULATION - -#if !defined (BUFSIZ) -# define BUFSIZ 1024 -#endif - -typedef void (__cdecl * __sighandler_t)(int); // keep Signal compilation happy -typedef long off_t; - -#define ACE_LACKS_MALLOC_H // We do have malloc.h, but don't use it. - -#define ACE_HAS_WINCE_BROKEN_ERRNO - -#define ACE_HAS_STRDUP_EMULATION - -// WinCE can't do fixed addresses for memory-mapped files. -#if defined (ACE_DEFAULT_BASE_ADDR) -# undef ACE_DEFAULT_BASE_ADDR -#endif -#define ACE_DEFAULT_BASE_ADDR 0 - -#define ACE_HAS_TSS_EMULATION - -// This is still true up thru VC8... -#define ACE_LACKS_ERRNO_H -#define ACE_LACKS_SIGNAL_H -#define ACE_LACKS_SYS_STAT_H - -#include /**/ "ace/post.h" - -#endif // ACE_CONFIG_WINCE_H diff --git a/ace/config-aix-4.1.x.h b/ace/config-aix-4.1.x.h deleted file mode 100644 index a739c1ae49a..00000000000 --- a/ace/config-aix-4.1.x.h +++ /dev/null @@ -1,8 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_AIX_VERS -# define ACE_AIX_VERS 401 -#endif - -#include "ace/config-aix-4.x.h" diff --git a/ace/config-aix-4.2.x.h b/ace/config-aix-4.2.x.h deleted file mode 100644 index b44c851a437..00000000000 --- a/ace/config-aix-4.2.x.h +++ /dev/null @@ -1,8 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_AIX_VERS -# define ACE_AIX_VERS 402 -#endif - -#include "ace/config-aix-4.x.h" diff --git a/ace/config-aix-4.3.x.h b/ace/config-aix-4.3.x.h deleted file mode 100644 index d6b2824ec35..00000000000 --- a/ace/config-aix-4.3.x.h +++ /dev/null @@ -1,8 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_AIX_VERS -# define ACE_AIX_VERS 403 -#endif - -#include "ace/config-aix-4.x.h" diff --git a/ace/config-aix-4.x.h b/ace/config-aix-4.x.h deleted file mode 100644 index cf0f486bbb9..00000000000 --- a/ace/config-aix-4.x.h +++ /dev/null @@ -1,341 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for OS -// platforms running AIX 4.x using the IBM C++ compiler (xlC), -// Visual Age C++ or g++. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -// Both IBM and g++ compilers set _THREAD_SAFE if compiler is asked to compile -// threaded code (xlC_r, as opposed to xlC; and g++ -pthread) -#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0) -# if defined (ACE_HAS_THREADS) -# undef ACE_HAS_THREADS -# endif -# if defined (_THREAD_SAFE) -# define ACE_HAS_THREADS 1 -// # else -// # define ACE_HAS_THREADS 0 -# endif /* _THREAD_SAFE */ -#endif /* !ACE_MT_SAFE || (ACE_MT_SAFE != 0) */ - -#if defined (__xlC__) || defined (__IBMCPP__) - // AIX xlC, IBM C/C++, and Visual Age C++ compilers - //******************************************************************** - // - -// Compiler does this with a builtin - it's not in libc. -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//# define ACE_HAS_ALLOCA - -// Compiler supports the ssize_t typedef. -# define ACE_HAS_SSIZE_T - -// When using the preprocessor, Ignore info msg; invalid #pragma -# if defined (__IBMCPP__) && (__IBMCPP__ < 400) // IBM C++ 3.6 -# define ACE_CC_PREPROCESSOR_ARGS "-E -qflag=w:w" -# endif /* (__IBMCPP__) && (__IBMCPP__ < 400) */ - - // Keep an eye on this as the compiler and standards converge... -# define ACE_LACKS_LINEBUFFERED_STREAMBUF -# define ACE_LACKS_PRAGMA_ONCE - - // C Set++ 3.1, IBM C/C++ 3.6, and Visual Age C++ 5 batch (__xlC__) -# if defined (__xlC__) -# if (__xlC__ < 0x0500) -# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE -# endif /* __xlC__ < 0x0500 */ -# endif - - // These are for Visual Age C++ only -# if defined (__IBMCPP__) && (__IBMCPP__ >= 400) -# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS -# define ACE_HAS_TYPENAME_KEYWORD - // When using -qtempinc, we don't need to see template implementation - // source (though we do need a pragma to find the correct source file). - // However, without -qtempinc (either -qnotempinc or -qtemplateregistry) - // we do need to see the source. -# if defined (__TEMPINC__) -# if !defined ACE_TEMPLATES_REQUIRE_PRAGMA -# define ACE_TEMPLATES_REQUIRE_PRAGMA -# endif -# else -# if !defined (ACE_TEMPLATES_REQUIRE_SOURCE) -# define ACE_TEMPLATES_REQUIRE_SOURCE -# endif -# endif /* __TEMPINC__ */ - -# undef WIFEXITED -# undef WEXITSTATUS - -# if (__IBMCPP__ >= 500) /* Visual Age C++ 5 */ -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# endif /* __IBMCPP__ >= 500 */ -# endif /* __IBMCPP__ */ - -#elif defined (__GNUG__) - // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so - // this must appear before its #include. -# define ACE_HAS_STRING_CLASS - -# include "ace/config-g++-common.h" - // Denotes that GNU has cstring.h as standard, to redefine memchr(). -# define ACE_HAS_GNU_CSTRING_H -# define ACE_HAS_SSIZE_T - -// We have to explicitly instantiate static template members -# define ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION - -# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0 - // ACE_MT_SAFE is #defined below, for all compilers. -# if !defined (_REENTRANT) -# define _REENTRANT -# endif /* _REENTRANT */ -# endif /* !ACE_MT_SAFE */ - -#else /* ! __xlC__ && ! __GNUG__ */ -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler in ace/config-aix-4.x.h -# endif /* __cplusplus */ -#endif /* ! __xlC__ && ! __GNUG__ */ - - -// Compiling for AIX. -#ifndef AIX -# define AIX -#endif /* AIX */ - -// Pick up all the detectable settings. -#include "ace/config-posix.h" - -#if defined (ACE_HAS_POSIX_SEM_TIMEOUT) -# undef ACE_HAS_POSIX_SEM_TIMEOUT -#endif /* ACE_HAS_POSIX_SEM_TIMEOUT */ - -// AIX shared libs look strangely like archive libs until you look inside -// them. -#if defined (ACE_DLL_SUFFIX) -# undef ACE_DLL_SUFFIX -#endif -#define ACE_DLL_SUFFIX ".a" - -// Use BSD 4.4 socket definitions for pre-AIX 4.2. The _BSD setting also -// controls the data type used for waitpid(), wait(), and wait3(). -#if (ACE_AIX_VERS < 402) -# define _BSD 44 -# define ACE_HAS_UNION_WAIT -#endif /* ACE_AIX_VERS < 402 */ - -// This environment requires this thing, pre-AIX 4.3 -#if (ACE_AIX_VERS < 403) -# define _BSD_INCLUDES -#endif /* ACE_AIX_VERS < 403 */ - -#define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) - -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - -// ACE_HAS_AIX_BROKEN_SOCKET_HEADER may be required if your OS patches are -// not up to date. On up-to-date 4.2+ systems, it should not be required. -// 4.2+ has 4.4 BSD sendmsg/recvmsg -#if (ACE_AIX_VERS < 402) -# define ACE_HAS_AIX_BROKEN_SOCKET_HEADER -#else -# if (ACE_AIX_VERS == 402) -# define ACE_HAS_SIZET_SOCKET_LEN -# else -# define ACE_HAS_SOCKLEN_T -# endif -# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#endif /* ACE_AIX_VERS < 402 */ - -#if (ACE_AIX_VERS >= 403) -// AIX has AIO, but the functions don't match those of other AIO-enabled -// platforms. If this is to work, it'll require some significant work, -// maybe moving the OS-abstraction stuff to an OS_AIO or some such thing. -//# define ACE_HAS_AIO_CALLS -#endif /* ACE_AIX_VERS >= 403 */ - -#define ACE_HAS_AIX_HI_RES_TIMER - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS -#if (ACE_AIX_VERS < 403) -# define ACE_HAS_CHARPTR_DL -#endif /* ACE_AIX_VERS < 403 */ - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// OS has readdir and friends. -#define ACE_HAS_DIRENT - -// OS supports the getrusage() system call -#define ACE_HAS_GETRUSAGE - -#define ACE_HAS_GPERF - -#define ACE_HAS_H_ERRNO - -#define ACE_LACKS_STDINT_H -#define ACE_LACKS_SYS_SYSCTL_H - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_IP_MULTICAST - -// Lacks perfect filtering, must bind group address. -#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING -# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 -#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ - -#define ACE_HAS_MSG -#if (ACE_AIX_VERS < 402) -# define ACE_LACKS_MSG_ACCRIGHTS -# define ACE_LACKS_RLIMIT -#endif - -// Compiler/platform supports poll(). -#define ACE_HAS_POLL - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -#define ACE_HAS_POSIX_TIME -// ... but needs to include another header for it on 4.2+ -#if (ACE_AIX_VERS >= 402) -# define ACE_HAS_BROKEN_POSIX_TIME -#endif /* ACE_AIX_VERS > 402 */ -// ... and needs another typedef -#define ACE_LACKS_TIMESPEC_T -#define ACE_HAS_SELECT_H - -#define ACE_HAS_REENTRANT_FUNCTIONS - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T -#if (ACE_AIX_VERS >= 402) -# define ACE_HAS_SIGINFO_T -# define ACE_LACKS_SIGINFO_H -#endif /* ACE_AIX_VERS >= 402 */ -#if (ACE_AIX_VERS >= 403) -// it may exist in earlier revs, but I'm not sure and I don't have a -// system to validate -# define ACE_HAS_P_READ_WRITE -#endif /* ACE_AIX_VERS >= 403 */ - -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_STRBUF_T - -// Compiler supports stropts.h -#define ACE_HAS_STREAMS -// #define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// AIX bzero() -#define ACE_HAS_STRINGS - -#define ACE_HAS_STRUCT_NETDB_DATA - -// Dynamic linking is in good shape on newer OS/patch levels. If you have -// trouble with the dynamic linking parts of ACE, and can't patch your OS -// up to latest levels, comment this out. -#define ACE_HAS_SVR4_DYNAMIC_LINKING -// This is tightly related to dynamic linking... -#define ACE_HAS_AUTOMATIC_INIT_FINI - -#define ACE_HAS_SVR4_GETTIMEOFDAY - -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_TIMOD_H -#define ACE_HAS_XTI -#define ACE_HAS_BROKEN_T_ERROR -#define ACE_TLI_TCP_DEVICE "/dev/xti/tcp" - -#define ACE_HAS_UALARM - -#if (ACE_AIX_VERS >= 402) -# define ACE_HAS_UCONTEXT_T -#endif /* ACE_AIX_VERS >= 402 */ - -#define ACE_HAS_UTIME - -// Platform has XPG4 wide character type and functions. However, the size -// of wchar_t changes for 32- vs. 64-bit builds (unsigned short vs. unsigned -// int, respectively). -#define ACE_HAS_XPG4_MULTIBYTE_CHAR -#ifdef __64BIT__ -# define ACE_SIZEOF_WCHAR 4 -#else -# define ACE_SIZEOF_WCHAR 2 -#endif /* __64BIT__ */ - -#define ACE_LACKS_NETINET_TCP_H - -// AIX uses LIBPATH to search for libraries -#define ACE_LD_SEARCH_PATH "LIBPATH" - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -//************************************************************** -// -// Threads related definitions. -// -// The threads on AIX are generally POSIX P1003.1c (ACE_HAS_PTHREADS). -// However, there is also a kernel thread ID (tid_t) that is used in -// ACE_Log_Msg (printing the thread ID). The tid_t is not the same as -// pthread_t, and can't derive one from the other - thread_self() gets -// the tid_t (kernel thread ID) if called from a thread. -// Thanks very much to Chris Lahey for straightening this out. - -#if defined (ACE_HAS_THREADS) -# if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -# endif - -# define ACE_HAS_PTHREADS -// 4.3 and up has 1003.1c standard; 4.2 has draft 7 -# if (ACE_AIX_VERS >= 403) -# define ACE_HAS_PTHREADS_STD -# define ACE_HAS_PTHREADS_UNIX98_EXT -# define ACE_HAS_PTHREAD_CONTINUE -# define ACE_HAS_PTHREAD_SUSPEND -# define ACE_HAS_RECURSIVE_MUTEXES -# else -# define ACE_HAS_PTHREADS_DRAFT7 -# define ACE_LACKS_RWLOCK_T -# define ACE_LACKS_THREAD_STACK_ADDR -// If ACE doesn't compile due to the lack of these methods, please -// send email to ace-users@cs.wustl.edu reporting this. -// #define ACE_LACKS_CONDATTR_PSHARED -// #define ACE_LACKS_MUTEXATTR_PSHARED -# define ACE_LACKS_SETSCHED -# endif /* ACE_AIX_VERS >= 403 */ - -# define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -# define ACE_HAS_SIGTHREADMASK -# define ACE_HAS_THREAD_SPECIFIC_STORAGE - -# define ACE_LACKS_THREAD_PROCESS_SCOPING -#else -# undef ACE_HAS_THREADS -#endif /* ACE_HAS_THREADS != 0 */ - -#define ACE_MALLOC_ALIGN 8 - -#if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) && !defined(_UNIX95) -# define ACE_HAS_3_PARAM_WCSTOK -#endif /* (_XOPEN_SOURCE -0) >= 500 && !_UNIX95 */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-aix-5.x.h b/ace/config-aix-5.x.h deleted file mode 100644 index 42cb40b96db..00000000000 --- a/ace/config-aix-5.x.h +++ /dev/null @@ -1,59 +0,0 @@ -// $Id$ -// -// Config file for AIX 5.1 and higher. - -#ifndef ACE_CONFIG_AIX_5_X_H -#define ACE_CONFIG_AIX_5_X_H - -// This define is needed for building with Visual Age C++ 5 in incremental -// mode. In the batch mode build, platform_aix_ibm.GNU sets it. The incremental -// mode compiler won't be supported after ACE 5.3, so this will also go away -// in that timeframe, so don't worry about future AIX versions. -#if !defined (ACE_AIX_VERS) -# define ACE_AIX_VERS 501 -#endif - -// AIX 5.1 has AIO, but it doesn't have the same API as other POSIX -// systems, and the semantics of operations are a bit different. Will take -// some real work to get this going. -// AIX 5.2, however, has the POSIX API implemented. However, the libc functions -// to implement it aren't exported by default. You need to use smit to enable -// them. So, leave AIO disabled unless the user explicitly enables it. -// config-aix-4.x.h will set ACE_HAS_AIO_CALLS if config-posix.h senses the -// feature-test macros, so set up _ACE_DISABLE_AIO_CALLS_ if the user didn't -// set it. Then check for it after including config-aix-4.x.h and remove -// ACE_HAS_AIO_CALLS if so. -#if !defined (ACE_HAS_AIO_CALLS) -# define _ACE_DISABLE_AIO_CALLS_ -#endif -#include "ace/config-aix-4.x.h" -#if defined (_ACE_DISABLE_AIO_CALLS_) -# if defined (ACE_HAS_AIO_CALLS) -# undef ACE_HAS_AIO_CALLS -# endif -# undef _ACE_DISABLE_AIO_CALLS_ -#endif - -// AIX's /usr/include/unistd.h sets _POSIX_SEMAPHORE to indicate the system -// supplies such a facility, but the headers don't enable it unless -// _XOPEN_SOURCE >= 500. So disable semaphores here if _XOPEN_SOURCE isn't -// up to snuff. -#if defined (ACE_HAS_POSIX_SEM) && \ - (!defined (_XOPEN_SOURCE) || (_XOPEN_SOURCE-0 < 500)) -# undef ACE_HAS_POSIX_SEM -#endif - -// I think this is correct, but needs to be verified... -Steve Huston -#define ACE_HAS_SIGTIMEDWAIT - -// AIX 5.1 has netinet/tcp.h -#undef ACE_LACKS_NETINET_TCP_H - -#define ACE_HAS_POSIX_GETPWNAM_R -#define ACE_HAS_SCANDIR -# define ACE_SCANDIR_CMP_USES_VOIDPTR -# define ACE_SCANDIR_SEL_LACKS_CONST -#define ACE_HAS_SIGSUSPEND -#define ACE_HAS_TIMEZONE /* Call tzset() to set timezone */ - -#endif /* ACE_CONFIG_AIX_5_X_H */ diff --git a/ace/config-all.h b/ace/config-all.h deleted file mode 100644 index 9c0f3bf6efc..00000000000 --- a/ace/config-all.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file config-all.h - * - * $Id$ - * - * @author (Originally in OS.h)Doug Schmidt - * @author Jesper S. M|ller - * @author and a cast of thousands... - */ -//========================================================================== - -#ifndef ACE_CONFIG_ALL_H -#define ACE_CONFIG_ALL_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// This is used to indicate that a platform doesn't support a -// particular feature. -#if defined ACE_HAS_VERBOSE_NOTSUP - // Print a console message with the file and line number of the - // unsupported function. -# include "ace/OS_NS_stdio.h" -# define ACE_NOTSUP_RETURN(FAILVALUE) do { errno = ENOTSUP; ACE_OS::fprintf (stderr, ACE_LIB_TEXT ("ACE_NOTSUP: %s, line %d\n"), __FILE__, __LINE__); return FAILVALUE; } while (0) -# define ACE_NOTSUP do { errno = ENOTSUP; ACE_OS::fprintf (stderr, ACE_LIB_TEXT ("ACE_NOTSUP: %s, line %d\n"), __FILE__, __LINE__); return; } while (0) -#else /* ! ACE_HAS_VERBOSE_NOTSUP */ -# define ACE_NOTSUP_RETURN(FAILVALUE) do { errno = ENOTSUP ; return FAILVALUE; } while (0) -# define ACE_NOTSUP do { errno = ENOTSUP; return; } while (0) -#endif /* ! ACE_HAS_VERBOSE_NOTSUP */ - -// ---------------------------------------------------------------- - -# define ACE_TRACE_IMPL(X) ACE_Trace ____ (ACE_LIB_TEXT (X), __LINE__, ACE_LIB_TEXT (__FILE__)) - -// By default tracing is turned off. -#if !defined (ACE_NTRACE) -# define ACE_NTRACE 1 -#endif /* ACE_NTRACE */ - -#if (ACE_NTRACE == 1) -# define ACE_TRACE(X) -#else -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* ACE_NTRACE */ - -// By default we perform no tracing on the OS layer, otherwise the -// coupling between the OS layer and Log_Msg is too tight. But the -// application can override the default if they wish to. -#if !defined (ACE_OS_NTRACE) -# define ACE_OS_NTRACE 1 -#endif /* ACE_OS_NTRACE */ - -#if (ACE_OS_NTRACE == 1) -# define ACE_OS_TRACE(X) -#else -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_OS_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* ACE_OS_NTRACE */ - -// These includes are here to avoid circular dependencies. -// Keep this at the bottom of the file. It contains the main macros. -#include "ace/OS_main.h" - -#include /**/ "ace/post.h" - -#endif /* ACE_CONFIG_ALL_H */ diff --git a/ace/config-borland-common.h b/ace/config-borland-common.h deleted file mode 100644 index 46829114990..00000000000 --- a/ace/config-borland-common.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- -//$Id$ - -// The following configuration file contains defines for Borland compilers. - -#ifndef ACE_CONFIG_BORLAND_COMMON_H -#define ACE_CONFIG_BORLAND_COMMON_H -#include /**/ "ace/pre.h" - -#define ACE_HAS_CUSTOM_EXPORT_MACROS -#define ACE_Proper_Export_Flag __declspec (dllexport) -#define ACE_Proper_Import_Flag __declspec (dllimport) -#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T -#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE; -#define ACE_IMPORT_SINGLETON_DECLARATION(T) template class __declspec (dllimport) T -#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllimport) SINGLETON_TYPE ; - -# if (__BORLANDC__ == 0x540) -// The linker in C++Builder 4 has trouble with the large number of DLL -// function exports created when you compile without inline functions. -// Therefore we will always use inline functions with this version of -// the compiler. -# if defined (__ACE_INLINE__) -# undef __ACE_INLINE__ -# endif /* __ACE_INLINE__ */ -# define __ACE_INLINE__ 1 -# else /* __BORLANDC__ == 0x540 */ -// In later versions of C++Builder we will prefer inline functions by -// default. The debug configuration of ACE is built with functions -// out-of-line, so when linking your application against a debug ACE -// build, you can choose to use the out-of-line functions by adding -// ACE_NO_INLINE=1 to your project settings. -# if !defined (__ACE_INLINE__) -# define __ACE_INLINE__ 1 -# endif /* __ACE_INLINE__ */ -# endif /* __BORLANDC__ == 0x540 */ - -# define ACE_CC_NAME ACE_LIB_TEXT ("Borland C++ Builder") -# define ACE_CC_MAJOR_VERSION (__BORLANDC__ / 0x100) -# define ACE_CC_MINOR_VERSION (__BORLANDC__ % 0x100) -# define ACE_CC_BETA_VERSION (0) -# define ACE_CC_PREPROCESSOR_ARGS "-q -P- -o%s" - -# define ACE_EXPORT_NESTED_CLASSES 1 -# define ACE_HAS_CPLUSPLUS_HEADERS 1 -# define ACE_HAS_EXCEPTIONS -# define ACE_HAS_GNU_CSTRING_H 1 -# define ACE_HAS_NONCONST_SELECT_TIMEVAL -# define ACE_HAS_SIG_ATOMIC_T -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_HAS_STDCPP_STL_INCLUDES 1 -# define ACE_HAS_STRERROR -# define ACE_HAS_STRING_CLASS 1 -# define ACE_HAS_TEMPLATE_SPECIALIZATION 1 -# define ACE_HAS_TEMPLATE_TYPEDEFS 1 -# define ACE_HAS_TYPENAME_KEYWORD 1 -# define ACE_HAS_USER_MODE_MASKS 1 -# define ACE_LACKS_ACE_IOSTREAM 1 -# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 -# define ACE_LACKS_STRPTIME 1 -# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE 1 -# define ACE_LACKS_PRAGMA_ONCE 1 -# define ACE_HAS_NEW_NOTHROW -# define ACE_TEMPLATES_REQUIRE_SOURCE 1 -# define ACE_SIZEOF_LONG_DOUBLE 10 -# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Lu") -# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Ld") -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# define ACE_USES_STD_NAMESPACE_FOR_STDC_LIB 0 -# define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) -# define ACE_LACKS_SWAB - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_BORLAND_COMMON_H */ diff --git a/ace/config-cray.h b/ace/config-cray.h deleted file mode 100644 index 6b9977895d8..00000000000 --- a/ace/config-cray.h +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_CONFIG_CRAY_H -#define ACE_CONFIG_CRAY_H -#include /**/ "ace/pre.h" - -/* - The following predefined macros are used within ACE ifdefs. - These are defined when using the Cray compilers. _CRAYMPP - is defined, for example, if you are running on a Cray T3E - massively parallel machine. Moreover, in the case of the T3E, - _CRAYT3E will be defined. This is used to determine the - ACE_SIZEOF defines for primitive types. - - _UNICOS is defined as either the major version of UNICOS being run, - e.g. 9 or 10 on the vector machines (e.g. C90, T90, J90, YMP, ...) - or the major+minor+level UNICOS/mk version, e.g. 2.0.3 => 203, - being run on an MPP machine. - - Summary: - - _CRAYMPP (defined only if running on MPP machine, e.g. T3E, UNICOS/mk) - _CRAYT3E (defined specifically if compiling on a Cray T3E) - _UNICOS (defined if running UNICOS or UNICOS/mk) - - Tested on UNICOS 10.0.0.5, UNICOS/mk 2.0.4.57 - Compiles on UNICOS 9.0.2.8, but some tests deadlock - - Contributed by Doug Anderson -*/ - -#if defined (_UNICOS) && !defined (MAXPATHLEN) -#define MAXPATHLEN 1023 -#endif /* _UNICOS */ - -#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0 - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -#define ACE_HAS_CPLUSPLUS_HEADERS - -#define ACE_HAS_TEMPLATE_SPECIALIZATION - -#define ACE_HAS_SSIZE_T - -#define ACE_HAS_SYSV_IPC - -#define ACE_MT_SAFE 1 - -#define ACE_HAS_THREADS - -#define ACE_HAS_PTHREADS - -// UNICOS 10 and UNICOS/mk implement a small subset of POSIX Threads, -// but the prototypes follow the POSIX.1c-1995 definitions. Earlier -// UNICOS versions sport Draft 7 threads. - -#if _UNICOS > 9 -# define ACE_HAS_PTHREADS_STD -#else -# define ACE_HAS_PTHREADS_DRAFT7 -# define ACE_LACKS_THREAD_STACK_SIZE -# define ACE_LACKS_THREAD_STACK_ADDR - // UNICOS 9 doesn't have this, nor sched.h -# define SCHED_OTHER 0 -# define SCHED_FIFO 1 -# define SCHED_RR 2 -#endif - -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP - -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - -#define ACE_HAS_POSIX_TIME - -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -#define ACE_HAS_POSIX_NONBLOCK - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -#define ACE_HAS_DIRENT - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_IP_MULTICAST - -#define ACE_HAS_SOCKADDR_IN_SIN_LEN - -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -#define ACE_HAS_NONCONST_READLINK - -#define ACE_HAS_CHARPTR_SOCKOPT - -#define ACE_HAS_NONCONST_GETBY - -// has man pages, but links with missing symbols and I can't find lib yet -/* #define ACE_HAS_REGEX */ - -#define ACE_HAS_SIG_MACROS - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -#if _UNICOS > 9 -# define ACE_HAS_SIGWAIT -#endif - -#define ACE_HAS_SIG_ATOMIC_T - -#define ACE_HAS_SIGISMEMBER_BUG - -#define ACE_HAS_MSG - -#define ACE_HAS_STRERROR - -#define ACE_HAS_GPERF - -// Special modifications that apply to UNICOS/mk -#if defined(_CRAYMPP) - -# define ACE_HAS_SIGINFO_T -# define ACE_HAS_UCONTEXT_T - -#endif - -// The Cray T90 supposedly supports SYSV SHMEM, but I was unable to get it -// working. Of course, all other Cray PVP and MPP systems do NOT support it, -// so it's probably good to just define like this for consistency -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_MMAP -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_MADVISE -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_PTHREAD_CLEANUP -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_THREAD_PROCESS_SCOPING - -#if !defined(_CRAYMPP) - -#define ACE_LACKS_PTHREAD_CANCEL -#define ACE_LACKS_PTHREAD_KILL - -#endif - -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_PRI_T -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID -#define ACE_LACKS_MPROTECT -#define ACE_LACKS_MSYNC -#define ACE_LACKS_READV -#define ACE_LACKS_RLIMIT - -// we probably want to fake not having this, since Cray memory mgmt is different -#define ACE_LACKS_SBRK - -#define ACE_LACKS_SETSCHED - -#define ACE_LACKS_SIGINFO_H - -#define ACE_LACKS_TIMESPEC_T - -#define ACE_LACKS_WRITEV - -// Cray vector machines are "word" oriented, and modern ones are hard 64-bit. -// "char" is somewhat of a special case. Most problems arise when code thinks -// it can address 32-bit quantities and the like. MPP crays are typically -// byte oriented, e.g. T3E uses Alpha processors, so we don't need as much -// special treatment. - -#ifndef _CRAYMPP - -# define ACE_SIZEOF_CHAR 1 -# define ACE_SIZEOF_SHORT 8 -# define ACE_SIZEOF_INT 8 -# define ACE_SIZEOF_LONG 8 -# define ACE_SIZEOF_LONG_LONG 8 -# define ACE_SIZEOF_FLOAT 8 -# define ACE_SIZEOF_DOUBLE 8 -# define ACE_SIZEOF_LONG_DOUBLE 16 -# define ACE_SIZEOF_VOID_P 8 - -#elif defined(_CRAYT3E) - -# define ACE_SIZEOF_CHAR 1 -# define ACE_SIZEOF_SHORT 4 -# define ACE_SIZEOF_INT 8 -# define ACE_SIZEOF_LONG 8 -# define ACE_SIZEOF_LONG_LONG 8 -# define ACE_SIZEOF_FLOAT 4 -# define ACE_SIZEOF_DOUBLE 8 -# define ACE_SIZEOF_LONG_DOUBLE 8 -# define ACE_SIZEOF_VOID_P 8 - -#endif - -// Ones to check out at some point - -/* #define ACE_HAS_SYS_SIGLIST */ - -// C++ Compiler stuff to verify -/* #define ACE_NEW_THROWS_EXCEPTIONS */ -/* #define ACE_HAS_TEMPLATE_TYPEDEFS */ - -// thread issues to check out -/* #define ACE_LACKS_TIMEDWAIT_PROTOTYPES */ - -// Cray does seem to support it, in -lnsl and has tiuser.h header -/* #define ACE_HAS_TLI */ -/* #define ACE_HAS_TIUSER_H */ -/* #define ACE_HAS_TLI_PROTOTYPES */ -/* #define ACE_LACKS_T_ERRNO */ - -/* #define ACE_LACKS_NAMED_POSIX_SEM */ - -/* #define ACE_HAS_SYS_ERRLIST */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_CRAY_H */ diff --git a/ace/config-cxx-common.h b/ace/config-cxx-common.h deleted file mode 100644 index f4549840c55..00000000000 --- a/ace/config-cxx-common.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#ifndef ACE_CXX_COMMON_H -#define ACE_CXX_COMMON_H -#include /**/ "ace/pre.h" - -#if !defined (ACE_CONFIG_INCLUDE_CXX_COMMON) -# error ace/config-cxx-common.h: ACE configuration error! Do not #include this file directly! -#endif - -#if defined (__DECCXX) -# if !defined (linux) -# define ACE_HAS_STRING_CLASS -# if (__DECCXX_VER >= 60090010) -# define ACE_HAS_STDCPP_STL_INCLUDES -# endif /* __DECCXX_VER < 60090010 */ -# endif /* ! linux */ - -# define DEC_CXX -# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR -# define ACE_LACKS_LINEBUFFERED_STREAMBUF -# define ACE_LACKS_SIGNED_CHAR -# define ACE_HAS_CPLUSPLUS_HEADERS -# define ACE_TEMPLATES_REQUIRE_SOURCE -# if (__DECCXX_VER >= 60090010) - // DEC CXX 6.0 supports exceptions, etc., by default. Exceptions - // are enabled by platform_osf1_4.x.GNU/wrapper_macros.GNU. -# if defined (ACE_HAS_EXCEPTIONS) -# define ACE_NEW_THROWS_EXCEPTIONS -# endif /* ACE_HAS_EXCEPTIONS */ -# if !defined (__RTTI) -# define ACE_LACKS_RTTI -# endif -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_HAS_TEMPLATE_SPECIALIZATION -# define ACE_HAS_TEMPLATE_TYPEDEFS -# define ACE_HAS_TYPENAME_KEYWORD - -# define ACE_ENDLESS_LOOP \ - unsigned int ace_endless_loop____ = 0; if (ace_endless_loop____) break; - -# if defined (__USE_STD_IOSTREAM) -# define ACE_LACKS_CHAR_RIGHT_SHIFTS -# define ACE_LACKS_IOSTREAM_FX -# define ACE_LACKS_UNBUFFERED_STREAMBUF -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# else /* ! __USE_STD_IOSTREAM */ -# define ACE_USES_OLD_IOSTREAMS -# endif /* ! __USE_STD_IOSTREAM */ - -// 9: nested comment not allowed. (/usr/include/pdsc.h!) (nestcomment) -// 177: variable was declared but never referenced (declbutnotref) -// 193: zero used for undefined preprocessing identifier (undpreid) -// 236: controlling expression is constant (boolexprconst) -// 401: base_class_with_nonvirtual_dtor (basclsnondto) -// 1016: expected type is incompatible with declared type of int (incint) -// 1136: conversion to smaller size integer could lose data (intconlosbit) - -# pragma message disable basclsnondto -# pragma message disable boolexprconst -# pragma message disable undpreid - -# if (__DECCXX_VER >= 60190029) - // 6.1-029 and later support msg 1136. Disable it because it - // causes warnings from ACE and/or TAO. -# pragma message disable intconlosbit -# endif /* __DECCXX_VER >= 60190029 */ - -# if (__DECCXX_VER == 60190027) - // Seems that this version of cxx doesn't have reset -# define ACE_AUTO_PTR_LACKS_RESET -# endif /* __DECCXX_VER == 60190027 */ - -# if defined (DIGITAL_UNIX) && DIGITAL_UNIX >= 0x40D - // variable "PTHREAD_THIS_CATCH_NP" was declared but never referenced -# pragma message disable declbutnotref -# endif /* DIGITAL_UNIX >= 4.0f */ - -# else /* __DECCXX_VER < 60090010 */ -# define ACE_LACKS_PRAGMA_ONCE -# endif /* __DECCXX_VER < 60090010 */ -#else /* ! __DECCXX */ -# error ace/config-cxx-common.h can only be used with Compaq CXX! -#endif /* ! __DECCXX */ - -#include /**/ "ace/post.h" -#endif /* ACE_CXX_COMMON_H */ diff --git a/ace/config-cygwin32.h b/ace/config-cygwin32.h deleted file mode 100644 index 60fcf4576f3..00000000000 --- a/ace/config-cygwin32.h +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for CygWin -// platforms using GNU C++. - -#ifndef ACE_CONFIG_CYGWIN32_H -#define ACE_CONFIG_CYGWIN32_H - -#include /**/ "ace/pre.h" - -#if !defined (ACE_MT_SAFE) -#define ACE_MT_SAFE 1 -#endif - -#define CYGWIN32 - -// We trust this file will get included before -#if !defined(FD_SETSIZE) -# define FD_SETSIZE 1024 -#endif - -#if !defined (ACE_IOV_MAX) -# define ACE_IOV_MAX 64 -#endif /* ACE_IOV_MAX */ - -// Define custom export macros for export/import of symbols from/of dll's -#define ACE_HAS_CUSTOM_EXPORT_MACROS -#define ACE_Proper_Export_Flag __declspec (dllexport) -#define ACE_Proper_Import_Flag __declspec (dllimport) -#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T -#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE; -#define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T -#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE ; - -#define ACE_HAS_SELECT_H - -#define ACE_LACKS_PRAGMA_ONCE - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#include /**/ - -// Needed to differentiate between libc 5 and libc 6 (aka glibc). -// It's there on all libc 5 systems I checked. -#include /**/ - -// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so -// this must appear before its #include. -#define ACE_HAS_STRING_CLASS - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#else -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler in ace/config-cygwin32.h -# endif /* __cplusplus */ -#endif /* __GNUG__ */ - -#define ACE_HAS_VOIDPTR_SOCKOPT 1 -#define ACE_HAS_UALARM 1 -#define ACE_HAS_SYS_ERRLIST 1 -#define ACE_HAS_STRNLEN 1 -#define ACE_HAS_POSIX_GETPWNAM_R 1 -#define ACE_HAS_POSIX_NONBLOCK 1 -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_CLOCK_GETTIME 1 -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_HAS_MSG -#define ACE_DEFAULT_BASE_ADDR ((char *) 0x8000000) -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_SVR4_DYNAMIC_LINKING -//#define ACE_HAS_SYSV_IPC -#define ACE_HAS_VOIDPTR_MMAP -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_MEMCHR 1 -#define ACE_HAS_POLL -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 -#define ACE_HAS_SOCKADDR_MSG_NAME 1 -#define ACE_LACKS_PRI_T 1 - -// Compiler/platform supports alloca(). -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you want ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_IP_MULTICAST - -#define ACE_HAS_BIG_FD_SET - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 - -#define ACE_DEFAULT_SELECT_REACTOR_SIZE 256 - -#define ACE_HAS_GETPAGESIZE - -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -#define ACE_HAS_SOCKLEN_T 1 - -#define ACE_HAS_GPERF - -#define ACE_HAS_DIRENT -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG - -#define ACE_LACKS_MKFIFO -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_FGETWC 1 -#define ACE_LACKS_NAMED_POSIX_SEM -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_MADVISE -#define ACE_LACKS_GETPGID_PROTOTYPE -#define ACE_LACKS_GETHOSTENT -#define ACE_LACKS_ITOW 1 -#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 -#define ACE_LACKS_RLIMIT -#define ACE_LACKS_RWLOCK_T 1 -#define ACE_LACKS_SUSECONDS_T -#define ACE_LACKS_SYS_SYSCTL_H - -#define ACE_LACKS_FGETWS 1 -#define ACE_LACKS_FPUTWS 1 - -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_SNPRINTF - -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGACTION_CONSTP2 -#define ACE_HAS_SIGSUSPEND -#define ACE_HAS_SIG_C_FUNC 1 -#define ACE_HAS_SIG_ATOMIC_T - -#define ACE_HAS_POSIX_SEM - -#define ACE_HAS_P_READ_WRITE - -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - -// Cygwin DLL suffix is .dll -#define ACE_DLL_SUFFIX ACE_LIB_TEXT (".dll") - -// Cygwin runs on Windows, so we have to get the environment variable PATH and -// not LD_LIBRARY_PATH which is the default in ACE -#define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("PATH") - -#if ACE_MT_SAFE -// Yes, we do have threads. -# define ACE_HAS_THREADS -// And they're even POSIX pthreads (LinuxThreads implementation) -# define ACE_HAS_PTHREADS - -# define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS - -// Compiler/platform has thread-specific storage -# define ACE_HAS_THREAD_SPECIFIC_STORAGE - -# define ACE_HAS_PTHREADS_UNIX98_EXT -# define ACE_HAS_PTHREAD_CONTINUE 1 -# define ACE_HAS_PTHREAD_SUSPEND 1 - -// ... and the final standard even! -# define ACE_HAS_PTHREADS_STD -# define ACE_LACKS_THREAD_STACK_ADDR -// Cygwin (see pthread.h): Not supported or implemented. -# define ACE_LACKS_SETSCHED -# define ACE_LACKS_SETDETACH -# define ACE_LACKS_PTHREAD_CANCEL -# define ACE_LACKS_THREAD_PROCESS_SCOPING -# define ACE_LACKS_MUTEXATTR_PSHARED -# define ACE_LACKS_RWLOCKATTR_PSHARED -# define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 -# define ACE_LACKS_PTHREAD_YIELD 1 - -// In the 1.5.9 release of Cygwin the pthread_kill gives an access violation -// so for the time being we say Cygwin doesn't support pthread_kill. -# define ACE_LACKS_PTHREAD_KILL - -#endif /* ACE_MT_SAFE */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CONFIG_CYGWIN32_H */ diff --git a/ace/config-dgux-4.11-epc.h b/ace/config-dgux-4.11-epc.h deleted file mode 100644 index 4ac2079a768..00000000000 --- a/ace/config-dgux-4.11-epc.h +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for DG/UX -// 4.11 platforms using the EPC compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define ACE_DGUX - -// Platform requires (struct sockaddr *) for msg_name field of struct -// msghdr. -#define ACE_HAS_SOCKADDR_MSG_NAME - -// Platform lacks strcasecmp(). -#define ACE_LACKS_STRCASECMP - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Platform supports system configuration information. -#define ACE_HAS_SYSINFO - -// Platform supports the POSIX regular expression library. -#define ACE_HAS_REGEX - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -// #define ACE_HAS_SYS_SYSCALL_H - -// Platform supports reentrant functions (i.e., all the POSIX *_r functions). -#define ACE_HAS_REENTRANT_FUNCTIONS - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform supports SunOS high resolution timers. -// #define ACE_HAS_HI_RES_TIMER - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Compiler/platform supports alloca() -// #define ACE_HAS_ALLOCA - -// Compiler/platform has -// #define ACE_HAS_ALLOCA_H - -// Platform contains . -#define ACE_HAS_POLL - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -// Platform supports the prusage_t struct. -// #define ACE_HAS_PRUSAGE_T -#define ACE_HAS_GETRUSAGE - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes. -#define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -// #define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform supports SVR4 gettimeofday() prototype. -// #define ACE_HAS_SVR4_GETTIMEOFDAY - -// DG/UX uses the same gettimeofday() prototype as OSF/1. -#define ACE_HAS_OSF1_GETTIMEOFDAY - -// Compiler/platform supports SVR4 signal typedef. -#define ACE_HAS_SVR4_SIGNAL_T - -// Compiler/platform supports SVR4 ACE_TLI (in particular, T_GETNAME stuff)... -#define ACE_HAS_SVR4_TLI - -// Platform provides header. -// #define ACE_HAS_SYS_FILIO_H - -// Compiler/platform supports sys_siglist array. -#define ACE_HAS_SYS_SIGLIST - -/* Turn off the following four defines if you want to disable threading. */ -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 0 -#endif - -// Platform supports threads. -// #define ACE_HAS_THREADS - -// Platform supports POSIX pthreads *and* Solaris threads! -// #define ACE_HAS_STHREADS -// #define ACE_HAS_PTHREADS -#define ACE_HAS_SIGWAIT -// If ACE doesn't compile due to the lack of these methods, please -// send email to schmidt@cs.wustl.edu reporting this. -// #define ACE_LACKS_CONDATTR_PSHARED -// #define ACE_LACKS_MUTEXATTR_PSHARED - -// Compiler/platform has thread-specific storage -// -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Reactor detects deadlock -// #define ACE_REACTOR_HAS_DEADLOCK_DETECTION - -// Platform supports ACE_TLI timod STREAMS module. -#define ACE_HAS_TIMOD_H - -// Platform supports ACE_TLI tiuser header. -#define ACE_HAS_TIUSER_H - -// Platform provides ACE_TLI function prototypes. -#define ACE_HAS_TLI_PROTOTYPES - -// Platform supports ACE_TLI. -#define ACE_HAS_TLI - -// Use the poll() event demultiplexor rather than select(). -//#define ACE_USE_POLL - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// #define _USING_POSIX4A_DRAFT6 -#define _POSIX_SOURCE -#define _DGUX_SOURCE -// #define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_NONCONST_GETBY -#define ACE_LACKS_MADVISE - -#if !defined (IP_ADD_MEMBERSHIP) -# define IP_ADD_MEMBERSHIP 0x13 -#endif - -#if !defined (IP_DROP_MEMBERSHIP) -# define IP_DROP_MEMBERSHIP 0x14 -#endif - -// Header files lack t_errno for ACE_TLI. -#define ACE_LACKS_T_ERRNO - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_IDTYPE_T - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-dgux-4.x-ghs.h b/ace/config-dgux-4.x-ghs.h deleted file mode 100644 index 67b028c3bf4..00000000000 --- a/ace/config-dgux-4.x-ghs.h +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for DG/UX -// 4.x platforms using the Green Hills Multi C++ compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define ACE_DGUX - -# define ACE_CONFIG_INCLUDE_GHS_COMMON -# include "ace/config-ghs-common.h" - -// Static objects do not get initialized correctly, so this is needed. -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER - -// Platform requires (struct sockaddr *) for msg_name field of struct -// msghdr. -#define ACE_HAS_SOCKADDR_MSG_NAME - -// Platform lacks strcasecmp(). -#define ACE_LACKS_STRCASECMP - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Platform supports system configuration information. -#define ACE_HAS_SYSINFO - -// Platform supports the POSIX regular expression library. -#define ACE_HAS_REGEX - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Platform supports reentrant functions (i.e., all the POSIX *_r functions). -//#define ACE_HAS_REENTRANT_FUNCTIONS - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform supports SunOS high resolution timers. -// #define ACE_HAS_HI_RES_TIMER - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Green Hills doesn't give a preprocessor symbol for long double -#define ACE_SIZEOF_LONG_DOUBLE 8 - -// Platform contains . -#define ACE_HAS_POLL - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -// Platform supports the prusage_t struct. -// #define ACE_HAS_PRUSAGE_T -#define ACE_HAS_GETRUSAGE - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes. -#define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING -// ... but redefines the entrypoint names with a leading underscore -#define dlopen _dlopen -#define dlclose _dlclose -#define dlerror _dlerror -#define dlsym _dlsym -// ... and uses 'char *' rather than 'const char *' -#define ACE_HAS_CHARPTR_DL - -// DG/UX uses the same gettimeofday() prototype as OSF/1. -#define ACE_HAS_OSF1_GETTIMEOFDAY - -// Compiler/platform supports SVR4 signal typedef. -#define ACE_HAS_SVR4_SIGNAL_T - -// Compiler/platform supports SVR4 ACE_TLI (in particular, T_GETNAME stuff)... -#define ACE_HAS_SVR4_TLI - -// Compiler/platform supports sys_siglist array. -// On DG/UX this is only done if the /usr/include/sys/_int_dg_features.h -// file determines it should be turned on. It will take some work to -// figure out the magic options to turn it on reliably, so it'll have to -// be delayed for now. -//#define _TARGETTING_DGUXELF 1 -//#define _IX86_DG 1 -//#define _DGUX_TARGET 1 -//#define ACE_HAS_SYS_SIGLIST - -/* Turn off the following four defines if you want to disable threading. */ -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -// Platform supports threads. -#define ACE_HAS_THREADS -#define ACE_HAS_PTHREADS -// DG/UX claims to implement draft 10 of the pthreads standard (which became -// (with editorial change only) the final standard. To get the behavior, some -// further macros need to be defined which are specific to DG/UX. -// _POSIX4A_DRAFT10_SOURCE turns on the draft 10 variant of threads. -// _POSIX4A_DRAFT_SOURCE turns on sched_yield(). -#define _POSIX4A_DRAFT10_SOURCE -#define ACE_HAS_PTHREADS_STD -#define _POSIX4_DRAFT_SOURCE -// Well, here are some from the standard they don't have... -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_HAS_SIGWAIT -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_THREAD_PROCESS_SCOPING -// The default thread stacksize on DG/UX 4.x is 4096. This needs to be bumped -// up to do anything real in ACE. -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 - -// Need to #include -#define ACE_NEEDS_SCHED_H - -// Compiler/platform has thread-specific storage -// -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Platform supports ACE_TLI timod STREAMS module. -#define ACE_HAS_TIMOD_H - -// Platform supports ACE_TLI tiuser header. -#define ACE_HAS_TIUSER_H - -// Platform provides ACE_TLI function prototypes. -#define ACE_HAS_TLI_PROTOTYPES - -// Platform supports ACE_TLI. -#define ACE_HAS_TLI - -// Platform doesn't have read-write locks natively. -#define ACE_LACKS_RWLOCK_T - -// Platform doesn't have timespec_t data type. -#define ACE_LACKS_TIMESPEC_T - -// Use the poll() event demultiplexor rather than select(). -//#define ACE_USE_POLL - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -#define ACE_TEMPLATES_REQUIRE_SOURCE - -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_NONCONST_GETBY -#define ACE_LACKS_MADVISE - -#if !defined (IP_ADD_MEMBERSHIP) -#define IP_ADD_MEMBERSHIP 0x13 -#endif - -#if !defined (IP_DROP_MEMBERSHIP) -# define IP_DROP_MEMBERSHIP 0x14 -#endif - -// Header files lack t_errno for ACE_TLI. -#define ACE_LACKS_T_ERRNO - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-doxygen.h b/ace/config-doxygen.h deleted file mode 100644 index 4f9618be7c9..00000000000 --- a/ace/config-doxygen.h +++ /dev/null @@ -1,116 +0,0 @@ -// -*- C++ -*- - -/** - * This is a configuration file to define all the macros that Doxygen - * needs - * - * @file config-doxygen.h - * - * $Id$ - * - * @author Carlos O'Ryan - * @author Darrell Brunsch - * - */ -#ifndef ACE_CONFIG_DOXYGEN_H -#define ACE_CONFIG_DOXYGEN_H - -/// Make sure that we always turn inlining on. -#define __ACE_INLINE__ - -/// Make the wchar_t interfaces available. -#define ACE_HAS_WCHAR - -/// Make all the emulation versions of string operations visible -// #define ACE_LACKS_WCSTOK -#define ACE_LACKS_ITOW -#define ACE_LACKS_STRCASECMP -#define ACE_LACKS_STRRCHR -#define ACE_LACKS_WCSCAT -#define ACE_LACKS_WCSCHR -#define ACE_LACKS_WCSCMP -#define ACE_LACKS_WCSCPY -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSLEN -#define ACE_LACKS_WCSNCAT -#define ACE_LACKS_WCSNCMP -#define ACE_LACKS_WCSNCPY -#define ACE_LACKS_WCSNICMP -#define ACE_LACKS_WCSPBRK -#define ACE_LACKS_WCSRCHR -#define ACE_LACKS_WCSCSPN -#define ACE_LACKS_WCSSPN -#define ACE_LACKS_WCSSTR - -/// Support for threads enables several important classes -#define ACE_HAS_THREADS - -/// Support for Win32 enables the WFMO_Reactor and several Async I/O -/// classes -#define ACE_WIN32 - -/// Enable support for POSIX Asynchronous I/O calls -#define ACE_HAS_AIO_CALLS - -/// Enable support for TLI interfaces -#define ACE_HAS_TLI - -/// Enable support for the SSL wrappers -#define ACE_HAS_SSL 1 - -/// Enable exceptions -#define ACE_HAS_EXCEPTIONS - -/// Enable timeprobes -#define ACE_COMPILE_TIMEPROBES - -/// Enable unicode to generate ACE_Registry_Name_Space -#define UNICODE - -/// These defines make sure that Svc_Conf_y.cpp and Svc_Conf_l.cpp are correctly -/// parsed -#define __cplusplus -#define ACE_YY_USE_PROTOS - -/// TAO features that should be documented too -#define TAO_HAS_RT_CORBA 1 -#define TAO_HAS_MINIMUM_CORBA 0 -#define TAO_HAS_AMI 1 -#define TAO_HAS_INTERCEPTORS 1 -#define TAO_HAS_SCIOP 1 - -/// Generate token library documentation -#define ACE_HAS_TOKENS_LIBRARY - -/// Generate ACE ATM classes documentation -#define ACE_HAS_ATM - -/// Generate ACE XTI ATM class documentation -#define ACE_HAS_XTI_ATM - -/// Generate ACE_Dev_Poll_Reactor documentation -#define ACE_HAS_EVENT_POLL - -/// Generate ACE_Event_Handler_T documentation -#define ACE_HAS_TEMPLATE_TYPEDEFS - -/// Generate ACE_Log_Msg_NT_Event_Log documentation -#define ACE_HAS_LOG_MSG_NT_EVENT_LOG - -/// Generate icmp documentation -#define ACE_HAS_ICMP_SUPPORT 1 - -/// Don't expand ACE_RCSID macro -#define ACE_USE_RCSID 0 - -/// Parse some ACE_SSL classes that depend on recent versions of -/// OpenSSL. -#define OPENSSL_VERSION_NUMBER 0x00905820L - -/// Enable IPv6 -#define ACE_HAS_IPV6 - -/// Enable netlink socket support -#define ACE_HAS_NETLINK - -#endif /* ACE_CONFIG_DOXYGEN_H */ diff --git a/ace/config-freebsd.h b/ace/config-freebsd.h deleted file mode 100644 index 6ed6e250bcc..00000000000 --- a/ace/config-freebsd.h +++ /dev/null @@ -1,272 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for FreeBSD - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#if ACE_MT_SAFE - // Yes, we do have threads. -# define ACE_HAS_THREADS 1 -#else - // Set to 0 since that's what config-posix.h checks for. -# define ACE_HAS_THREADS 0 -#endif /* ACE_MT_SAFE */ - -#include "ace/config-posix.h" - -#include -// Make sure we source in the OS version. - -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#if (__FreeBSD_version < 220000) -#if defined (ACE_HAS_THREADS) -#error Threads are not supported. -#endif /* ACE_HAS_THREADS */ -#endif /* __FreeBSD_version < 220000 */ - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ - -#if defined (ACE_HAS_PENTIUM) -# undef ACE_HAS_PENTIUM -#endif /* ACE_HAS_PENTIUM */ - -// Platform specific directives -// gcc defines __FreeBSD__ automatically for us. -#ifdef ACE_HAS_THREADS -#if !defined (_THREAD_SAFE) -#define _THREAD_SAFE -#endif /* _THREAD_SAFE */ -#endif - -#define ACE_HAS_GPERF - -#if (__FreeBSD_version < 420000) -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID -#define ACE_LACKS_PTHREAD_CANCEL -#endif /* __FreeBSD_version < 420000 */ - -#define ACE_HAS_ALT_CUSERID -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -#define ACE_HAS_SIG_MACROS -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_CHARPTR_DL - -#if (__FreeBSD_version < 400000) -#define ACE_LACKS_SIGSET -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_SETSCHED -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS -#endif - -#define ACE_NEEDS_SCHED_H - -#if (__FreeBSD_version < 400000) -enum schedparam_policy { - SCHED_RR, - SCHED_IO, - SCHED_FIFO, - SCHED_OTHER -}; -#endif - -// Use of is deprecated. -#define ACE_LACKS_MALLOC_H - - -// This won't be necessary after it is fixed in the system include headers. -extern "C" { char * cuserid (char *s); } - -// Platform supports POSIX timers via struct timespec. -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_UALARM - -// Platform defines struct timespec but not timespec_t -#define ACE_LACKS_TIMESPEC_T - -#if (__FreeBSD_version < 501000) -#define ACE_LACKS_STDINT_H -#endif - -#define ACE_HAS_SYSCTL -#define ACE_LACKS_STRRECVFD - -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -#if (__FreeBSD_version >= 300000) -#define ACE_HAS_SIGINFO_T -#endif /* __FreeBSD_version >= 300000 */ - -#if (__FreeBSD_version >= 320000) -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -#endif /* __FreeBSD_version >= 320000 */ - -#if (__FreeBSD_version < 501000) -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS -#endif - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_LACKS_SIGINFO_H - -#define ACE_LACKS_SI_ADDR - -// Compiler/platform supports SVR4 signal typedef -#define ACE_HAS_SVR4_SIGNAL_T - -// Compiler/platform supports alloca(). -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform supports SVR4 dynamic linking semantics.. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Explicit dynamic linking permits "lazy" symbol resolution -#define ACE_HAS_RTLD_LAZY_V - -// platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Lacks perfect filtering, must bind group address. -#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING -# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 -#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ - -// Compiler/platform has -//#define ACE_HAS_ALLOCA_H - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler/platform supports sys_siglist array. -// *** This refers to (_sys_siglist) instead of (sys_siglist) -// #define ACE_HAS_SYS_SIGLIST - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Platform/compiler supports timezone * as second parameter to gettimeofday(). -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -#define ACE_HAS_MSG -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG - -#if (__FreeBSD_version < 500100) -# define ACE_HAS_NONCONST_MSGSND -#endif - -// Thread specific settings -// Yes, we do have threads. -#ifdef ACE_HAS_THREADS -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif /* ! ACE_MT_SAFE */ -#endif /* ACE_HAS_THREADS */ - -#define ACE_LACKS_THREAD_PROCESS_SCOPING -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_DIRENT - -#define ACE_HAS_SIGWAIT - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -#if (__FreeBSD_version > 400000) -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_SOCKLEN_T -#define ACE_HAS_GETIFADDRS -#define ACE_HAS_PTHREADS_UNIX98_EXT -#endif - -#ifndef ACE_HAS_SNPRINTF -#define ACE_HAS_SNPRINTF -#endif - -// Note, on FreeBSD 5, POSIX aio is now an optional kernel module which -// must be loaded. -// Read the aio(4) man page for what to do, otherwise any aio_* call -// will coredump. - -// By default use Proactor which does not use POSIX Real-time Signals. -#ifdef ACE_HAS_AIO_CALLS -# ifndef ACE_POSIX_AIOCB_PROACTOR -# define ACE_POSIX_AIOCB_PROACTOR -# endif /* ACE_POSIX_AIOCB_PROACTOR */ -#endif /* ACE_HAS_AIO_CALLS */ - -/* FreeBSD does not define sigval_t */ -#include -typedef union sigval sigval_t; - -#define ACE_LACKS_STROPTS_H - -// Needed when ACE_HAS_WCHAR is defined. -#define ACE_LACKS_WCSNICMP -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSDUP -#define ACE_LACKS_ITOW -#define ACE_HAS_3_PARAM_WCSTOK - -#if (__FreeBSD_version >= 501000) -# define ACE_HAS_PTHREAD_SETSTACK -#endif - -#include /**/ "ace/post.h" - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-g++-common.h b/ace/config-g++-common.h deleted file mode 100644 index 0886e0442a0..00000000000 --- a/ace/config-g++-common.h +++ /dev/null @@ -1,118 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// This configuration file is designed to be included by another, -// specific configuration file. It provides config information common -// to all g++ platforms, including egcs. - -#ifndef ACE_GNUG_COMMON_H -#define ACE_GNUG_COMMON_H -#include /**/ "ace/pre.h" - -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_STDCPP_STL_INCLUDES -#define ACE_HAS_TEMPLATE_TYPEDEFS -#define ACE_HAS_TYPENAME_KEYWORD -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#define ACE_HAS_TEMPLATE_SPECIALIZATION -#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#define ACE_TEMPLATES_REQUIRE_SOURCE - -#if ( __GNUC__ == 2 && __GNUC_MINOR__ < 97 ) - // gcc 2.97 and lower use old iostreams -# define ACE_USES_OLD_IOSTREAMS -#endif /* __GNUC__ >= 2.97 */ - -#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS -#endif /* __GNUC__ >= 3.4 */ - -#if (__GNUC__ < 3) -# define ACE_LACKS_MEMBER_TEMPLATES -#endif /* __GNUC__ < 3 */ - -// __EXCEPTIONS is defined with -fexceptions, the egcs default. It -// is not defined with -fno-exceptions, the ACE default for g++. -// ACE_HAS_EXCEPTIONS is defined in -// include/makeinclude/wrapper_macros.GNU, so this really isn't -// necessary. Just in case . . . -#if defined (__EXCEPTIONS) && !defined (ACE_HAS_EXCEPTIONS) -# define ACE_HAS_EXCEPTIONS -#endif /* __EXCEPTIONS && ! ACE_HAS_EXCEPTIONS */ - -#if defined (ACE_HAS_EXCEPTIONS) -# define ACE_NEW_THROWS_EXCEPTIONS -#endif /* ACE_HAS_EXCEPTIONS */ - -#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE) -# define ACE_SIZEOF_LONG_DOUBLE 12 -#endif /* i386 */ - -#if !defined (__MINGW32__) && (defined (i386) || defined (__i386__)) - // If running an Intel, assume that it's a Pentium so that - // ACE_OS::gethrtime () can use the RDTSC instruction. If running a - // 486 or lower, be sure to comment this out. (If not running an - // Intel CPU, this #define will not be seen because of the i386 - // protection, so it can be ignored.) -# define ACE_HAS_PENTIUM -#endif /* i386 */ - -// GNU g++ >= 4.x implements "#pragma once". -#if (__GNUC__ < 4) && !defined (ACE_LACKS_PRAGMA_ONCE) -// We define it with a -D with make depend. -# define ACE_LACKS_PRAGMA_ONCE -#endif /* ! ACE_LACKS_PRAGMA_ONCE */ - -// Take advantage of G++ (>= 4.x) visibility attributes to generate -// improved shared library binaries. -#if (__GNUC__ > 3) - -# if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 -# undef ACE_HAS_CUSTOM_EXPORT_MACROS -# else -# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS -# define ACE_HAS_CUSTOM_EXPORT_MACROS -# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ -# define ACE_Proper_Export_Flag __attribute__ ((visibility("default"))) -# define ACE_Proper_Import_Flag - -// Sadly, G++ 4.x silently ignores visibility attributes on -// template instantiations, which breaks singletons. -// As a workaround, we use the GCC visibility pragmas. -// And to make them fit in a macro, we use C99's _Pragma() -// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17470 -# if 0 /* ... replace if/when gcc bug 17470 is fixed */ -# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T -# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE ; -# else /* ! GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */ -# define ACE_EXPORT_SINGLETON_DECLARATION(T) \ - _Pragma ("GCC visibility push(default)") \ - template class T \ - _Pragma ("GCC visibility pop") -# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) \ - _Pragma ("GCC visibility push(default)") \ - template class SINGLETON_TYPE; \ - _Pragma ("GCC visibility pop") -# endif /* ! GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */ - -// Note that the "__extension__" is needed to prevent g++ from issuing -// an error when using its "-pedantic" command line flag. -# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T -# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE; - - -# endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ -#endif /* __GNU__ > 3 */ - -#if defined (ACE_HAS_GNU_REPO) - // -frepo causes unresolved symbols of basic_string left- and - // right-shift operators with ACE_HAS_STRING_CLASS. -# if defined (ACE_HAS_STRING_CLASS) -# undef ACE_HAS_STRING_CLASS -# endif /* ACE_HAS_STRING_CLASS */ -#endif /* ! ACE_HAS_GNU_REPO */ - -#include /**/ "ace/post.h" -#endif /* ACE_GNUG_COMMON_H */ diff --git a/ace/config-ghs-common.h b/ace/config-ghs-common.h deleted file mode 100644 index 1cca934a067..00000000000 --- a/ace/config-ghs-common.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// This configuration file is designed to be included by another, -// specific configuration file. It provides config information common -// to all Green Hills platforms. - -#ifndef ACE_GHS_COMMON_H -#define ACE_GHS_COMMON_H -#include /**/ "ace/pre.h" - -#if !defined (ACE_CONFIG_INCLUDE_GHS_COMMON) -# error ace/config-ghs-common.h: ACE configuration error! Do not #include this file directly! -#endif - -#if defined (ghs) - -# if defined (sun) - // Need nonstatic Object_Manager on Solaris to prevent seg fault - // on startup. -# define ACE_HAS_NONSTATIC_OBJECT_MANAGER -# endif /* sun */ - -# if defined (__STANDARD_CXX) - // Green Hills 1.8.9, but not 1.8.8. -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_LACKS_AUTO_PTR -# define ACE_LACKS_CHAR_RIGHT_SHIFTS -# define ACE_LACKS_UNBUFFERED_STREAMBUF -# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION -# else -# define ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA -# endif /* __STANDARD_CXX */ - -# define ACE_LACKS_LINEBUFFERED_STREAMBUF -# define ACE_LACKS_LONGLONG_T -# define ACE_LACKS_SIGNED_CHAR - -#else /* ! ghs */ -# error ace/config-ghs-common.h can only be used with Green Hills compilers! -#endif /* ! ghs */ - -#include /**/ "ace/post.h" -#endif /* ACE_GHS_COMMON_H */ diff --git a/ace/config-hpux-11.00.h b/ace/config-hpux-11.00.h deleted file mode 100644 index 44513e885e4..00000000000 --- a/ace/config-hpux-11.00.h +++ /dev/null @@ -1,506 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for HP -// platforms running HP-UX 11.00 using aC++, CC, or gcc (2.95 and up). - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define ACE_LACKS_STDINT_H -#define ACE_LACKS_SYS_SELECT_H - -#if defined (__GNUG__) - -// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so -// this must appear before its #include. -# define ACE_HAS_STRING_CLASS - -# include "ace/config-g++-common.h" - -# if __GLIBC__ >= 2 - // glibc 2 and higher has wchar support -# define ACE_HAS_XPG4_MULTIBYTE_CHAR -# endif - -// gcc 2.95.2 supplies the ssize_t typedef. -# define ACE_HAS_SSIZE_T - -// We have to explicitly instantiate static template members -# define ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION - -// gcc 3.0 claims to have wide character stuff, but (at least the version -// built by HP) can't actually compile it. It refers to a wctype.h file -// that's only available with aC++. - -#else - -// The following configuration section is designed to work for HP -// platforms running HP/UX 11.x with either of the HP C++ compilers. -// There isn't a predefined macro for all cases of the compilers that -// can be used to tell them apart from other compilers -// only to tell C++ from aC++, using the value of __cplusplus. -// -// NOTE - HP advises people on 11.x to use aC++ since the older C++ doesn't -// support 64-bit or kernel threads. So, though this file has the C++ info -// in it, it's copied from the 10.x file and hasn't been verified. - -// There are 2 compiler-specific sections, plus a 3rd for common to both. -// First is the HP C++ section... -# if __cplusplus < 199707L - -# define ACE_HAS_BROKEN_HPUX_TEMPLATES - -// Compiler can't handle calls like foo->operator T *() -# define ACE_HAS_BROKEN_CONVERSIONS - -// Necessary with some compilers to pass ACE_TTY_IO as parameter to -// DEV_Connector. -# define ACE_NEEDS_DEV_IO_CONVERSION - -// Compiler's template mechanism must see source code (i.e., .C files). -# define ACE_TEMPLATES_REQUIRE_SOURCE - -// Compiler's template mechanism requires the use of explicit C++ -// specializations for all used templates. -# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION - -// The HP/UX compiler doesn't support volatile!!!! -# define volatile - -# else // aC++ definitions - -// Parts of TAO (at least) use __HP_aCC to detect this compiler, but the -// macro is not set until A.03.13. If it's not set, set it - it won't be an -// HP-advertised value, but we don't check the value/version - just whether -// it's set or not. -# if !defined (__HP_aCC) -# define __HP_aCC -# endif /* __HP_aCC */ - -// Precompiler needs extra flags to ignore "invalid #pragma directive" -# define ACE_CC_PREPROCESSOR_ARGS "-E +W 67" - -// Compiler can't handle calls like foo->operator T *() -# define ACE_HAS_BROKEN_CONVERSIONS - -// Compiler supports C++ exception handling. It's on by default. If the -// +noeh compiler option is used to disable exceptions, the compiler defines -// __HPACC_NOEH. -# if !defined (__HPACC_NOEH) -# define ACE_HAS_EXCEPTIONS 1 -# endif - -// If the -AA compile option is used, the compiler defines _HP_NAMESPACE_STD. -// The -AA option enables the 2.0 standard C++ library. If not used, then -// we have the old, 1.2.1 C++ library. -# if defined (_HP_NAMESPACE_STD) -# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) -# undef ACE_HAS_STANDARD_CPP_LIBRARY -# endif -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) -# undef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB -# endif -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# else -# define ACE_USES_OLD_IOSTREAMS -# endif /* _HP_NAMESPACE_STD */ - -# define ACE_HAS_TYPENAME_KEYWORD - -// Compiler implements templates that support typedefs inside of classes -// used as formal arguments to a template class. -# define ACE_HAS_TEMPLATE_TYPEDEFS - -# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR - -// Platform lacks streambuf "linebuffered ()". -# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 - -// Lack of (and broken) support for placement operator delete is a known -// bug by HP, up until aC++ A.03.55.02. -# if (__HP_aCC < 35502) -# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE -# endif /* __HP_aCC < 35502 */ - -// Compiler's 'new' throws exceptions on failure, regardless of whether or -// not exception handling is enabled in the compiler options. Fortunately, -// new(nothrow_t) is offered. -# define ACE_NEW_THROWS_EXCEPTIONS -# define ACE_HAS_NEW_NOTHROW -# define ACE_HAS_NEW_NO_H 1 - -// Compiler's template mechanism must see source code (i.e., .C files). -# define ACE_TEMPLATES_REQUIRE_SOURCE - -// Compiler supports template specialization. -# define ACE_HAS_TEMPLATE_SPECIALIZATION - -// Preprocessor needs some help with data types -# if defined (__LP64__) -# define ACE_SIZEOF_LONG 8 -# else -# define ACE_SIZEOF_LONG 4 -# endif - -// Platform has XPG4 wide character support -# define ACE_HAS_XPG4_MULTIBYTE_CHAR -# define ACE_HAS_WCHAR -# define ACE_SIZEOF_WCHAR _WCHAR_T - -# endif /* __cplusplus < 199707L */ - -// Compiler supports the ssize_t typedef. -# define ACE_HAS_SSIZE_T - -// Compiler doesn't handle 'signed char' correctly (used in ace/IOStream.h) -# define ACE_LACKS_SIGNED_CHAR - -#endif /* __GNUG__, HP */ - -//********************************************************************* -// -// From here down is the compiler-INdependent OS settings. -// -//********************************************************************* - -// Compiling for HPUX. -#if !defined (HPUX) -#define HPUX -#endif /* HPUX */ -#define HPUX_11 - -#ifndef _HPUX_SOURCE -#define _HPUX_SOURCE -#endif - -#include /**/ - -#if defined (_INCLUDE_HPUX_SOURCE) -# define ACE_HAS_SNPRINTF -#endif - -// HP-UX is a POSIX-compliant system - see what's available. -#include "ace/config-posix.h" - -// config-posix.h sets up ACE_HAS_AIO_CALLS if the headers define the -// proper things. In HP-UX 11's case, the AIOCB Proactor works the best -// overall. If the user hasn't overridden it, select AIOCB. -#if defined (ACE_HAS_AIO_CALLS) -# if !defined (ACE_POSIX_AIOCB_PROACTOR) && !defined (ACE_POSIX_SIG_PROACTOR) -# define ACE_POSIX_AIOCB_PROACTOR -# endif /* !ACE_HAS_POSIX_AIOCB_PROACTOR && !ACE_POSIX_SIG_PROACTOR */ -#endif /* ACE_HAS_AIO_CALLS */ - -//////////////////////////////////////////////////////////////////////////// -// -// General OS information - see README for more details on what they mean -// -/////////////////////////////////////////////////////////////////////////// - -// HP/UX needs to have these addresses in a special range. -// If this is on a 64-bit model, the default is to use 64-bit addressing. -// It can also be set so that the mapped region is shareable with 32-bit -// programs. To enable the 32/64 sharing, comment out the first definition -// of ACE_DEFAULT_BASE_ADDR and uncomment the two lines after it. -#if defined (__LP64__) -# define ACE_DEFAULT_BASE_ADDR ((char *) 0x0000001100000000) -//# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) -//# define ACE_OS_EXTRA_MMAP_FLAGS MAP_ADDR32 - -# define ACE_DEFAULT_BASE_ADDRL (0x0000001100000000) -//# define ACE_DEFAULT_BASE_ADDRL (0x80000000) -#else -# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) -#endif /* __LP64__ */ - -// Platform can do async I/O (aio_*) (set up in config-posix.h) -// ... but seems to require this in order to keep from hanging. Needs some -// investigation, maybe with HP. John Mulhern determined this value -// empirically. YMMV. If it does vary, set it up in your own config.h which -// then includes the ACE-supplied config. -#if !defined (ACE_INFINITE) -# define ACE_INFINITE 10000000 -#endif - -/* Compiler/platform correctly calls init()/fini() for shared libraries. */ -#define ACE_HAS_AUTOMATIC_INIT_FINI 1 - -// Manually tweak the malloc control block paddings to properly align -// things. -#define ACE_MALLOC_PADDING 16 -#define ACE_MALLOC_ALIGN 8 -#define ACE_PI_CONTROL_BLOCK_ALIGN_LONGS 3 - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -#define ACE_HAS_SYS_PSTAT_H - -// But doesn't have a prototype for syscall() -#define ACE_LACKS_SYSCALL - -// Platform supports POSIX.1b clock_gettime () -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform has Dirent iterator functions. -#define ACE_HAS_DIRENT - -// Platform supports getpagesize() call -#define ACE_HAS_GETPAGESIZE -// But we define this just to be safe -#define ACE_PAGE_SIZE 4096 - -// Can run gperf on this platform (needed for TAO) -# define ACE_HAS_GPERF - -// Optimize ACE_Handle_Set for select(). -# define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST -// At least for 11iv2, lacks perfect filtering. -#if (HPUX_VERS >= 1123) && !defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING) -# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 -#endif - -/* Platform defines MAP_FAILED as a long constant. */ -#define ACE_HAS_LONG_MAP_FAILED 1 - -/* Define to 1 if platform has memchr(). */ -#define ACE_HAS_MEMCHR 1 - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Platform's select() has non-const timeval argument -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -// Compiler/platform supports poll(). -#define ACE_HAS_POLL - -/* Platform supports "position-independent" features provided by - ACE_Based_Pointer<>. */ -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 - -/* Platform supports POSIX getpwnam_r() function */ -#define ACE_HAS_POSIX_GETPWNAM_R 1 - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Platform supports the POSIX struct timespec type -#define ACE_HAS_POSIX_TIME - -/* Platform has pread() and pwrite() support. */ -#define ACE_HAS_P_READ_WRITE 1 - -/* Platform will recurse infinitely on thread exits from TSS cleanup routines - (e.g., AIX) */ -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 - -// Platform supports reentrant functions (all the POSIX *_r functions). -#define ACE_HAS_REENTRANT_FUNCTIONS -// ctime_r and asctime_r conform to POSIX.1c (2 param version) -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - -// Platform offers scandir(), and requires no adjustments for its API. -#define ACE_HAS_SCANDIR - -// HP-UX 11 has reentrant netdb functions. The catch is that the old -// functions (gethostbyname, etc.) are thread-safe and the _r versions are -// not used and will be removed at some point. So, define things so -// the _r versions are not used. This will slow things down a bit due to -// the extra mutex lock in the ACE_NETDBCALL_RETURN macro, and will be fixed -// in the future (problem ID P64). -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS - -/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */ -#define ACE_LACKS_PRI_T 1 - -// Platform has shm_open -#define ACE_HAS_SHM_OPEN - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T - -/* Compiler requires extern "C" functions for signals. */ -#define ACE_HAS_SIG_C_FUNC 1 - -// Platform's sigaction() function takes const sigaction* as 2nd parameter. -#define ACE_HAS_SIGACTION_CONSTP2 - -// Platform supports SVR4 extended signals -#define ACE_HAS_SIGINFO_T - -/* Define to 1 if platform has sigsuspend(). */ -#define ACE_HAS_SIGSUSPEND 1 - -// Platform doesn't detect a signal out of range unless it's way out of range. -#define ACE_HAS_SIGISMEMBER_BUG - -/* Platform provides socklen_t type, such as Linux with glibc2. */ -#define ACE_HAS_SOCKLEN_T 1 - -/* Platform/compiler supports _sys_errlist symbol */ -#define ACE_HAS_SYS_ERRLIST 1 - -#define ACE_HAS_UALARM - -// Platform supports ucontext_t (which is used in the extended signal API). -#define ACE_HAS_UCONTEXT_T - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Platform/compiler supports void * as second parameter to gettimeofday(). -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY - -/* Platform requires void * for mmap(). */ -#define ACE_HAS_VOIDPTR_MMAP 1 - -/* OS/compiler uses void * arg 4 setsockopt() rather than const char * */ -#define ACE_HAS_VOIDPTR_SOCKOPT 1 - -// Platform supports SVR4 dynamic linking semantics. -// When used, this requires -ldl on the ACE library link line. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Platform supports the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -/* Define to 1 if platform has the declaration of getrusage(). */ -#define ACE_HAS_GETRUSAGE_PROTOTYPE 1 - -// Platform has the sigwait function in a header file -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIGTIMEDWAIT - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// accept() is thread-safe -#define ACE_HAS_THREAD_SAFE_ACCEPT - -// Platform lacks a typedef for timespec_t, but has struct timespec -#define ACE_LACKS_TIMESPEC_T - -// dlopen() takes a char* instead of const char* -#define ACE_HAS_CHARPTR_DL - -// lacks setegid and seteuid -#define ACE_LACKS_SETEGID -#define ACE_LACKS_SETEUID - -#define ACE_LACKS_SUSECONDS_T -#define ACE_LACKS_SYS_SYSCTL_H - -// Shared library name/path components -#if defined (__ia64) -# define ACE_DLL_SUFFIX ".so" -#else -# define ACE_DLL_SUFFIX ".sl" -#endif /* __ia64 */ -#if defined (__LP64__) -# define ACE_LD_SEARCH_PATH "LD_LIBRARY_PATH" -#else -# define ACE_LD_SEARCH_PATH "SHLIB_PATH" -#endif /* __LP64__ */ - -#if defined (_INCLUDE__STDC_A1_SOURCE) -# define ACE_HAS_3_PARAM_WCSTOK -#endif - -////////////////////////////////////////////////////////////////////////// -// -// STREAMS information -// -////////////////////////////////////////////////////////////////////////// - -// Platform supports STREAMS -#define ACE_HAS_STREAMS -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T -// But the putmsg signature doesn't have it as const... -// Well, it really does, but it depends on preprocessor defines. -#define ACE_LACKS_CONST_STRBUF_PTR -/* Platform supports TLI timod STREAMS module */ -#define ACE_HAS_TIMOD_H 1 - -// Platform supports STREAM pipes -// This is possible, but not by default - need to rebuild the kernel to -// get them enabled - see pipe(2) and "STREAMS/UX for the HP 9000" -// #define ACE_HAS_STREAM_PIPES - -///////////////////////////////////////////////////////////////////////// -// -// TLI/XTI information -// -//////////////////////////////////////////////////////////////////////// - -// Platform supports XTI (includes TLI). -#define ACE_HAS_XTI -// HP-UX 11 conforms to the XPG4 spec, which ACE calls broken for the -// errmsg not being const... -#define ACE_HAS_BROKEN_T_ERROR -// The definitions of TCP_NODELAY and TCP_MAXSEG conflict between -// sys/xti.h and netinet/tcp.h. -#define ACE_HAS_CONFLICTING_XTI_MACROS -/* Platform provides header */ -#define ACE_HAS_SYS_XTI_H 1 - -///////////////////////////////////////////////////////////////////////// -// -// Threads information. -// -// Use of threads is controlled by the 'threads' argument to make. See -// include/makeinclude/platform_hpux_aCC.GNU for details. If it's not set, -// the default is to enable it, since kernel threads are always available -// on HP-UX 11, as opposed to 10.x where it was optional software. -// -//////////////////////////////////////////////////////////////////////// - -#if defined (ACE_HAS_THREADS) -# if (ACE_HAS_THREADS == 0) -# undef ACE_HAS_THREADS -# endif /* ACE_HAS_THREADS == 0 */ -#else -# define ACE_HAS_THREADS -#endif /* ACE_HAS_THREADS */ - -#if defined (ACE_HAS_THREADS) - -# if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -# endif - -// HP-UX doesn't define _POSIX_THREADS since it doesn't implement all -// features (lacks thread priority inheritance and protection), so -// config-posix.h doesn't get this one... -# define ACE_HAS_PTHREADS - -# define ACE_HAS_PTHREADS_STD -# define ACE_HAS_PTHREADS_UNIX98_EXT -# define ACE_HAS_PTHREAD_CONTINUE -# define ACE_HAS_PTHREAD_RESUME_NP -# define ACE_HAS_PTHREAD_SUSPEND -# define ACE_HAS_RECURSIVE_MUTEXES -# define ACE_HAS_THREAD_SPECIFIC_STORAGE -#endif /* ACE_HAS_THREADS */ - -#define ACE_HAS_POSIX_SEM - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-icc-common.h b/ace/config-icc-common.h deleted file mode 100644 index 6a37c13690e..00000000000 --- a/ace/config-icc-common.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#ifndef ACE_LINUX_ICC_COMMON_H -#define ACE_LINUX_ICC_COMMON_H -#include /**/ "ace/pre.h" - -# define ACE_HAS_CPLUSPLUS_HEADERS -# define ACE_HAS_STDCPP_STL_INCLUDES -# define ACE_HAS_TEMPLATE_TYPEDEFS -# define ACE_HAS_TYPENAME_KEYWORD -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_HAS_TEMPLATE_SPECIALIZATION -# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# define ACE_HAS_STRING_CLASS - -#if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 -# undef ACE_HAS_CUSTOM_EXPORT_MACROS -#else -# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS -# define ACE_HAS_CUSTOM_EXPORT_MACROS -# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ -# define ACE_Proper_Export_Flag __attribute__ ((visibility("default"))) -# define ACE_Proper_Import_Flag -# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T -# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE ; -# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T -# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE; -#endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ - -// __EXCEPTIONS is defined with -fexceptions, the egcs default. It -// is not defined with -fno-exceptions, the ACE default for g++. -// ACE_HAS_EXCEPTIONS is defined in -// include/makeinclude/wrapper_macros.GNU, so this really isn't -// necessary. Just in case . . . -# if defined (__EXCEPTIONS) && !defined (ACE_HAS_EXCEPTIONS) -# define ACE_HAS_EXCEPTIONS -# endif /* __EXCEPTIONS && ! ACE_HAS_EXCEPTIONS */ - -# if defined (ACE_HAS_EXCEPTIONS) -# define ACE_NEW_THROWS_EXCEPTIONS -# endif /* ACE_HAS_EXCEPTIONS */ - -#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE) -# define ACE_SIZEOF_LONG_DOUBLE 12 -#endif /* i386 */ - -#if !defined (__MINGW32__) && (defined (i386) || defined (__i386__)) - // If running an Intel, assume that it's a Pentium so that - // ACE_OS::gethrtime () can use the RDTSC instruction. If running a - // 486 or lower, be sure to comment this out. (If not running an - // Intel CPU, this #define will not be seen because of the i386 - // protection, so it can be ignored.) -# define ACE_HAS_PENTIUM -#endif /* i386 */ - -#if !defined (ACE_LACKS_PRAGMA_ONCE) - // We define it with a -D with make depend. -# define ACE_LACKS_PRAGMA_ONCE -#endif /* ! ACE_LACKS_PRAGMA_ONCE */ - -#define ACE_TEMPLATES_REQUIRE_SOURCE - -#include /**/ "ace/post.h" -#endif /* ACE_LINUX_ICC_COMMON_H */ diff --git a/ace/config-integritySCA.h b/ace/config-integritySCA.h deleted file mode 100644 index d4dcb2d70f8..00000000000 --- a/ace/config-integritySCA.h +++ /dev/null @@ -1,237 +0,0 @@ -// -*- C++ -*- - -#ifndef ACE_INT_CONFIG_H -#define ACE_INT_CONFIG_H - -/* - * This config.h file is for version 4.0.x of the - * Integrity RTOS with SCA from Green Hills Software - * http://www.ghs.com/products/rtos/integrity.html - * - * $Id$ - */ - -#define ghs -/* compilation defines */ -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREUID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETSID -#define ACE_LACKS_SETEGID -#define ACE_LACKS_SETUID -#define ACE_LACKS_SETEUID -#define ACE_LACKS_GETEUID -#define ACE_LACKS_GETUID -#define ACE_LACKS_GETEGID -#define ACE_LACKS_GETGID - -#ifndef ACE_HAS_EXCEPTIONS - #define ACE_HAS_EXCEPTIONS -#endif -#define ACE_NEW_THROWS_EXCEPTIONS -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#define ACE_HAS_TEMPLATE_SPECIALIZATION -#define ACE_TEMPLATES_REQUIRE_SOURCE 1 -#define ACE_HAS_TEMPLATE_TYPEDEFS -#define TAO_USE_SEQUENCE_TEMPLATES -#define ACE_NEEDS_FUNC_DEFINITIONS -#define _REENTRANT -#define ACE_MT_SAFE 1 - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -#define ACE_HAS_SHM_OPEN - -/***** Operating System Defines *****/ - -/***** ANSI defines *****/ -#define ACE_LACKS_TEMPNAM /* believe it or not, this is ANSI C */ -#define ACE_HAS_STRERROR - - -#define ACE_LACKS_SENDMSG - -/***** End Stack Defines *****/ - - -/* SCA STUFF */ -#if defined(INTEGRITY_VERSION) && (INTEGRITY_VERSION >= 40108) -#define ACE_HAS_SIG_ATOMIC_T -#endif /* INTEGRITY_VERSION */ -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIGACTION -#define ACE_HAS_SIGINFO_T -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_UCONTEXT_H -#define ACE_HAS_SIG_C_FUNC -#define ACE_LACKS_SI_ADDR -#define ACE_HAS_AIO_CALLS - -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_DIRENT - -#define ACE_HAS_THREADS - -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREADS_STD -/***** End Threading Defines *****/ - -/***** Hardware Defines *****/ -#define ACE_PAGE_SIZE 4096 -/***** End Hardware Defines *****/ - -/****** SYSV_IPC STUFF *****/ -#define ACE_LACKS_KEY_T - -/****** Posix Defines *****/ -#define ACE_LACKS_WAIT -#define ACE_LACKS_WAITPID -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_POSIX_SEM -#define ACE_HAS_STRDUP_EMULATION -#define ACE_HAS_MSG -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_EXEC -#define ACE_LACKS_FORK -#define ACE_LACKS_MKFIFO -#define ACE_LACKS_MKTEMP -#define ACE_LACKS_MKSTEMP -#define ACE_LACKS_MPROTECT -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_PIPE -#define ACE_LACKS_RLIMIT -#define ACE_LACKS_RECVMSG -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SEMBUF_T -#define ACE_LACKS_UNIX_DOMAIN_SOCKETS -#define ACE_LACKS_USER -#define ACE_LACKS_FILE_FCNTL -#define ACE_LACKS_FCNTL -#define ACE_LACKS_UMASK -#define ACE_LACKS_SEEK -#define ACE_LACKS_SHARED_MEMORY -#define ACE_LACKS_MSYNC -#define ACE_LACKS_PID_STUFF -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_IPC_H -#define ACE_LACKS_SETGID -#define ACE_LACKS_PIPE -#define ACE_LACKS_SYS_PARAM_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_UTSNAME_T -#define ACE_LACKS_UNAME -#define ACE_LACKS_UMASK -#define ACE_LACKS_ISATTY -#define ACE_LACKS_GETOPT -#define ACE_LACKS_STRCASECMP -#define ACE_LACKS_TRUNCATE -#define ACE_LACKS_PWD_FUNCTIONS -#define ACE_LACKS_UNIX_SIGNALS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_PUTENV -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_LACKS_THREAD_PROCESS_SCOPING -#define ACE_LACKS_SETSCHED -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_WRITEV -#define ACE_LACKS_READV -#define ACE_LACKS_SYSCONF -#define ACE_LACKS_GETOPT -/* below refers to fcntl style locking */ -#define ACE_LACKS_FILELOCKS - -#define ACE_LACKS_REALPATH -#define ACE_HAS_CONST_CHAR_SWAB -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -/***** Not tied to standards AFAIK ****/ -#define ACE_LACKS_MADVISE /* paging optimization not needed with INTEGRITY */ -#define ACE_LACKS_MALLOC_H /* netbsd's just includes stdlib.h */ -#define ACE_LACKS_MEMORY_H /* netbsd's just includes string.h */ -#define ACE_LACKS_INTTYPES_H -#define ACE_LACKS_SYS_RESOURCE_H -#define ACE_LACKS_SYS_WAIT_H -#define ACE_LACKS_SEARCH_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_PWD_H -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_DLFCN_H -#define ACE_LACKS_REGEX_H -#define ACE_LACKS_POLL_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_TERMIOS_H - -/***** STUFF INTEGRITY 4.0.8 APPEARS TO SUPPORT ****/ -/* note, possibly untested with ace */ - -/***** TAO STUFF ****/ -#define TAO_USE_DOTTED_DECIMAL_ADDRESSES 1 - -#include - -#include - -typedef void (*__sighandler_t)(int); - -extern "C" -{ - inline int isatty(int) { return 0; } -} - -#ifdef ppc -#define ACE_HAS_POWERPC_TIMER -#endif - -typedef union sigval sigval_t; - -/* MIKEC Addtions */ -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#include // needed to define iovec -#define ACE_LACKS_READLINK -#define ACE_LACKS_GETPPID -#define NSIG (SIGRTMAX+1) -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#define ACE_USE_RCSID 0 -#define ACE_LACKS_CUSERID -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 0x5000 -#define fileno(file) ((file)->io_channel) //Hack to get Svc_Conf_l.cpp compiled -#define ACE_DEFAULT_THREAD_PRIORITY 127 -#define PRI_FIFO_MIN 1 -#define PRI_FIFO_MAX 127 -#define ACE_THR_PRI_FIFO_DEF 127 -#define PRI_RR_MIN 1 -#define PRI_RR_MAX 127 -#define ACE_THR_PRI_RR_DEF 127 -#define PRI_OTHER_MIN 1 -#define PRI_OTHER_MAX 127 -#define ACE_THR_PRI_OTHER_DEF 127 -#define ACE_PTHREAD_RETURN_ON_EXIT -#undef ACE_LACKS_UNLINK - -#define ACE_HAS_TIMED_MESSAGE_BLOCKS - -extern "C" { -int unlink(const char *); -} - -#define ACE_LACKS_SETSID -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY -#define ACE_LACKS_UNIX_SYSLOG -#define ACE_LACKS_TELLDIR -#define ACE_LACKS_SEEKDIR -#define ACE_LACKS_GETHOSTENT - - -/* end MIKEC Addtions */ - -// Hack to avoid ensure that things defined in ind_io.h -// have the right linkage -#include - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-irix5.2.h b/ace/config-irix5.2.h deleted file mode 100644 index cdb1fb49bdd..00000000000 --- a/ace/config-irix5.2.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for the SGI -// Indigo2EX running Irix 5.2 platform using the gcc v2.6.x compiler -// and libg++ v2.6.x. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -// Platform supports STREAM pipes (note that this is disabled by -// default, see the manual page on pipe(2) to find out how to enable -// it). -//#define ACE_HAS_STREAM_PIPES - -// Platform supports getpagesize() call. -#define ACE_HAS_GETPAGESIZE -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_SIGWAIT - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform requires void * for mmap(). -#define ACE_HAS_VOIDPTR_MMAP - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -#define ACE_SIZEOF_LONG_DOUBLE 8 - -#define IRIX5 -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA -// Compiler/platform has -#define ACE_HAS_ALLOCA_H -#define ACE_HAS_BSTRING -#define ACE_HAS_GETRUSAGE -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_POLL -#define ACE_HAS_PROC_FS -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_STREAMS -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRERROR -#define ACE_HAS_STRBUF_T -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_SVR4_SIGNAL_T -#define ACE_HAS_SYS_SIGLIST -#define ACE_HAS_SYS_FILIO_H -#define ACE_HAS_SEMUN -#define ACE_NEEDS_DEV_IO_CONVERSION - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-irix5.3-g++.h b/ace/config-irix5.3-g++.h deleted file mode 100644 index c9f3cc99773..00000000000 --- a/ace/config-irix5.3-g++.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for the SGI -// Indigo2EX running Irix 5.3 platform using the GNU C++ Compiler - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so -// this must appear before its #include. -#define ACE_HAS_STRING_CLASS - -#include "ace/config-g++-common.h" - -#define ACE_SIZEOF_LONG_DOUBLE 8 - -// Platform supports getpagesize() call. -#define ACE_HAS_GETPAGESIZE -#define IRIX5 -#define ACE_HAS_SIGWAIT -#define ACE_HAS_DIRENT - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform requires void * for mmap(). -#define ACE_HAS_VOIDPTR_MMAP - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has -#define ACE_HAS_ALLOCA_H - -// IRIX5 needs to define bzero() in this odd file -#define ACE_HAS_BSTRING - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Denotes that GNU has cstring.h as standard -// which redefines memchr() -#define ACE_HAS_GNU_CSTRING_H - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Platform contains . -#define ACE_HAS_POLL - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes (note that this is disabled by -// default, see the manual page on pipe(2) to find out how to enable -// it). -// #define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform supports SVR4 signal typedef. -#define ACE_HAS_IRIX_53_SIGNALS - -// Compiler/platform supports sys_siglist array. -// #define ACE_HAS_SYS_SIGLIST - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-irix5.3-sgic++.h b/ace/config-irix5.3-sgic++.h deleted file mode 100644 index b1a4e4cb13c..00000000000 --- a/ace/config-irix5.3-sgic++.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work -// for the SGI Indigo2EX running Irix 5.3 platform using -// the SGI C++ Compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define IRIX5 - -#include -#define _BSD_TYPES - -#define ACE_SIZEOF_LONG_DOUBLE 8 - -#define ACE_LACKS_STDINT_H -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform supports getpagesize() call. -#define ACE_HAS_GETPAGESIZE - -#define ACE_HAS_SIGWAIT - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform requires void * for mmap(). -#define ACE_HAS_VOIDPTR_MMAP - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has -#define ACE_HAS_ALLOCA_H - -// IRIX5 needs to define bzero() in this odd file -#define ACE_HAS_BSTRING - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Platform contains . -#define ACE_HAS_POLL - -// No multi-threading so use poll() call -// - for easier debugging, if nothing else -// #define ACE_USE_POLL - -// Platform supports the /proc file system. -// #define ACE_HAS_PROC_FS - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T -// #define ACE_HAS_UCONTEXT_T -#define ACE_LACKS_UCONTEXT_H - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes (note that this is disabled by -// default, see the manual page on pipe(2) to find out how to enable -// it). -// #define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform supports SVR4 signal typedef. -#define ACE_HAS_IRIX_53_SIGNALS - -// Compiler/platform supports sys_siglist array. -// #define ACE_HAS_SYS_SIGLIST - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -#define ACE_NEEDS_DEV_IO_CONVERSION - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-irix6.5.x-sgic++.h b/ace/config-irix6.5.x-sgic++.h deleted file mode 100644 index 62a0d0f14ca..00000000000 --- a/ace/config-irix6.5.x-sgic++.h +++ /dev/null @@ -1,20 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// Use this file for IRIX 6.5.x - -#ifndef ACE_CONFIG_IRIX65X_H -#define ACE_CONFIG_IRIX65X_H -#include /**/ "ace/pre.h" - -// Include IRIX 6.[234] configuration -#include "ace/config-irix6.x-sgic++.h" - -#undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION - -// Irix 6.5 man pages show that they exist -#undef ACE_LACKS_CONDATTR_PSHARED -#undef ACE_LACKS_MUTEXATTR_PSHARED - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_IRIX65X_H */ diff --git a/ace/config-irix6.x-common.h b/ace/config-irix6.x-common.h deleted file mode 100644 index dc6350b6717..00000000000 --- a/ace/config-irix6.x-common.h +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- C++ -*- */ -// -// $Id$ -// -// This file contains the common configuration options for both -// SGI/MIPSPro C++ and g++ under IRIX 6.X -// -// For IRIX 6.2 there are several patches that should be applied to -// get reliable operation with multi-threading and exceptions. -// Specifically you should get a reasonable current IRIX, Compiler -// and POSIX patch-sets. - -// For IRIX 6.[34] it's less critical, but it's still recommended -// that you apply the applicable patch-sets (IRIX and Compiler I believe). - -// These patches are updated frequently, so you should ask your support -// contact or search SGI's web site (http://www.sgi.com) for the latest -// version. - -// Use this file for IRIX 6.[234] if you have the pthreads patches -// installed. - -#ifndef ACE_CONFIG_IRIX6X_COMMON_H - -#ifndef IRIX6 -# define IRIX6 -#endif - -#if ! defined(ACE_CONFIG_H) -#error "This file may only be included by config-irix6.x-sgic++.h, config-irix6.x-kcc.h or config-irix6.x-g++.h" -#endif - -// The Irix 6.x float.h doesn't allow us to distinguish between a -// double and a long double. So, we have to hard-code this. Thanks -// to Bob Laferriere for figuring it out. -#if defined (_MIPS_SIM) /* 6.X System */ -# include -# if defined (__GNUC__) -# define ACE_SIZEOF_LONG_DOUBLE 16 -# elif defined (_MIPS_SIM_NABI32) && (_MIPS_SIM == _MIPS_SIM_NABI32) -# define ACE_SIZEOF_LONG_DOUBLE 16 -# elif defined (_MIPS_SIM_ABI32) && (_MIPS_SIM == _MIPS_SIM_ABI32) -# define ACE_SIZEOF_LONG_DOUBLE 8 -# elif defined (_MIPS_SIM_ABI64) && (_MIPS_SIM == _MIPS_SIM_ABI64) -# define ACE_SIZEOF_LONG_DOUBLE 16 -# elif !defined (ACE_SIZEOF_LONG_DOUBLE) -# define ACE_SIZEOF_LONG_DOUBLE 8 -# endif -#else -# define ACE_SIZEOF_LONG_DOUBLE 8 /* 5.3 System */ -#endif - -// petern, Next part of it: - -// Platform supports getpagesize() call. -#define ACE_HAS_GETPAGESIZE - -// Platform has no implementation of pthread_condattr_setpshared(), -// even though it supports pthreads! (like Irix 6.2) -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_MUTEXATTR_PSHARED - -// Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform requires void * for mmap(). -#define ACE_HAS_VOIDPTR_MMAP - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform supports snprintf -#define ACE_HAS_SNPRINTF - -// Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has -#define ACE_HAS_ALLOCA_H - -// Irix needs to define bzero() in this odd file -#define ACE_HAS_BSTRING - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Platform contains . -#define ACE_HAS_POLL - -// No multi-threading so use poll() call -// - for easier debugging, if nothing else -// #define ACE_USE_POLL - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes (note that this is disabled by -// default, see the manual page on pipe(2) to find out how to enable -// it). -// #define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST -#ifdef ACE_LACKS_PERFECT_MULTICAST_FILTERING - #undef ACE_LACKS_PERFECT_MULTICAST_FILTERING -#endif -#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 - -//************************************************************** -// Not so sure how next lines should look like - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -//************************************************************** - -// IRIX 6.4 and below do not support reentrant netdb functions -// (getprotobyname_r, getprotobynumber_r, gethostbyaddr_r, -// gethostbyname_r, getservbyname_r). -#if (ACE_IRIX_VERS <= 64) && !defined (ACE_HAS_NETDB_REENTRANT_FUNCTIONS) -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#endif /* ACE_HAS_NETDB_REENTRANT_FUNCTIONS */ - -#define ACE_HAS_DIRENT -// Unless the thread enabled version is used the readdir_r interface -// does not get defined in IRIX 6.2 -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_RWLOCK_T - -#define ACE_HAS_GPERF - -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_BROKEN_DGRAM_SENDV - -#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE -#define ACE_PI_CONTROL_BLOCK_ALIGN_LONGS 2 - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// IRIX 6.5 supports AIO -#define ACE_HAS_AIO_CALLS -#define ACE_POSIX_AIOCB_PROACTOR -#define ACE_HAS_SGIDLADD -#define ACE_HAS_P_READ_WRITE -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_STDINT_H -#define ACE_HAS_SYSENT_H -#define ACE_HAS_SYSINFO - -// Platform has support for multi-byte character support compliant -// with the XPG4 Worldwide Portability Interface wide-character -// classification. -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -// We need to setup a very high address or Naming_Test won't run. -#define ACE_DEFAULT_BASE_ADDR ((char *) (1024U * 1024 * 1024)) - -#define ACE_LACKS_SIGNED_CHAR - -// Platform supports reentrant functions (i.e., all the POSIX *_r -// functions). -#define ACE_HAS_REENTRANT_FUNCTIONS - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform does not support reentrant password file accessor functiions. -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS - -// uses ctime_r & asctime_r with only two parameters vs. three -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -#define ACE_HAS_UALARM - -// Scheduling functions are declared in -#define ACE_NEEDS_SCHED_H - -// Compile using multi-thread libraries by default -#if !defined (ACE_MT_SAFE) - #define ACE_MT_SAFE 1 -#endif /* ACE_MT_SAFE */ - -#if (ACE_MT_SAFE != 0) - -// Add threading support - -#define ACE_HAS_IRIX62_THREADS - -// Needed for the threading stuff? -#include /**/ -#define PTHREAD_MIN_PRIORITY PX_PRIO_MIN -#define PTHREAD_MAX_PRIORITY PX_PRIO_MAX - -// ACE supports threads. -#define ACE_HAS_THREADS - -// Platform has no implementation of pthread_condattr_setpshared(), -// even though it supports pthreads! (like Irix 6.2) -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_MUTEXATTR_PSHARED - -// IRIX 6.2 supports a variant of POSIX Pthreads, supposedly POSIX 1c -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREADS_STD - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// The pthread_cond_timedwait call does not reset the timer. -#define ACE_LACKS_COND_TIMEDWAIT_RESET 1 - -// When threads are enabled READDIR_R is supported on IRIX. -#undef ACE_LACKS_READDIR_R - -#endif /* (ACE_MT_SAFE == 0) */ - - -#endif /* ACE_CONFIG_IRIX6X_COMMON_H */ diff --git a/ace/config-irix6.x-g++.h b/ace/config-irix6.x-g++.h deleted file mode 100644 index 69455f27120..00000000000 --- a/ace/config-irix6.x-g++.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for the SGI -// Indigo2EX running Irix 6.2 platform using the GNU C++ Compiler - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so -// this must appear before its #include. -#define ACE_HAS_STRING_CLASS - -#include "ace/config-g++-common.h" -#include "ace/config-irix6.x-common.h" - -// Denotes that GNU has cstring.h as standard -// which redefines memchr() -#define ACE_HAS_GNU_CSTRING_H - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-irix6.x-sgic++-nothreads.h b/ace/config-irix6.x-sgic++-nothreads.h deleted file mode 100644 index a2a0efb02ea..00000000000 --- a/ace/config-irix6.x-sgic++-nothreads.h +++ /dev/null @@ -1,5 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#error "Please use config-irix6.x-sgic++.h." -#error "Set threads=0 in your platform_macros.GNU to disable multi-threading." diff --git a/ace/config-irix6.x-sgic++.h b/ace/config-irix6.x-sgic++.h deleted file mode 100644 index 16e7d5e04fe..00000000000 --- a/ace/config-irix6.x-sgic++.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// Use this file for IRIX 6.[234] if you have the pthreads patches -// installed. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#include "ace/config-irix6.x-common.h" - -// This is the config file for IRIX 6.2, 6.4 and hopefully 6.3, using -// the SGI C++ compiler (7.1 or higher). - -// The following three should be enabled/disabled together. -#if _COMPILER_VERSION >= 720 -#define ACE_HAS_TEMPLATE_SPECIALIZATION -#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION -# ifdef _STANDARD_C_PLUS_PLUS -# define ACE_HAS_TYPENAME_KEYWORD -# endif /* _STANDARD_C_PLUS_PLUS */ -#else -#define ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA -#endif /* _COMPILER_VERSION >= 720 */ -#define ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_NEEDS_FUNC_DEFINITIONS - -// Platform supports STREAM pipes (note that this is disabled by -// default, see the manual page on pipe(2) to find out how to enable -// it). -// #define ACE_HAS_STREAM_PIPES - -#if defined (_COMPILER_VERSION) -# define ACE_CC_NAME ACE_LIB_TEXT ("SGI/MIPSPro") -# define ACE_CC_MAJOR_VERSION (_COMPILER_VERSION / 100) -# define ACE_CC_MINOR_VERSION (_COMPILER_VERSION % 100) -# define ACE_CC_BETA_VERSION (0) -#endif /* _COMPILER_VERSION */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-linux-common.h b/ace/config-linux-common.h deleted file mode 100644 index 95a7a07d8c0..00000000000 --- a/ace/config-linux-common.h +++ /dev/null @@ -1,414 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// Do not use this configuration file directly since it's designed to -// be included by another, specific configuration file, such as -// config-linux.h. It provides config information common to all Linux -// platforms. It automatically determines the CPU architecture, -// compiler (g++ or egcs), and libc (libc5 or glibc), and configures -// based on those. - -#ifndef ACE_LINUX_COMMON_H -#define ACE_LINUX_COMMON_H -#include /**/ "ace/pre.h" - -#define ACE_HAS_BYTESEX_H - -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// #ifndef _XOPEN_SOURCE -// # define _XOPEN_SOURCE 600 -// #endif /* _XOPEN_SOURCE */ - -// Needed to differentiate between libc 5 and libc 6 (aka glibc). -#include - -#if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) -# define ACE_HAS_PTHREADS_UNIX98_EXT -#endif /* _XOPEN_SOURCE - 0 >= 500 */ - -#if (defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L) -# if !defined (ACE_HAS_CLOCK_GETTIME) -# define ACE_HAS_CLOCK_GETTIME -# define ACE_HAS_CLOCK_SETTIME -# endif /* !ACE_HAS_CLOCK_GETTIME */ -#endif /* _POSIX_C_SOURCE >= 199309L */ - -#if defined (ACE_HAS_LINUX_NPTL) -# include "ace/config-posix.h" - - // Temporary fix because NPTL kernels do have shm_open but there is a problem - // with shm_open/shm_unlink pairing in ACE which needs to be fixed when I have time. -# if defined (ACE_HAS_SHM_OPEN) -# undef ACE_HAS_SHM_OPEN -# endif - -# include - -# if defined (ACE_USES_FIFO_SEM) - // Don't use this for Linux NPTL since this has complete - // POSIX semaphores which are more efficient -# undef ACE_USES_FIFO_SEM -# endif /* ACE_USES_FIFO_SEM */ - -# if defined (ACE_HAS_POSIX_SEM) - // Linux NPTL may not define the right POSIX macro - // but they have the actual runtime support for this stuff -# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) -# define ACE_HAS_POSIX_SEM_TIMEOUT -# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) */ -# endif /* ACE_HAS_POSIX_SEM */ -#endif /* ACE_HAS_LINUX_NPTL */ - -// First the machine specific part - -#if defined (__powerpc__) -# if !defined (ACE_DEFAULT_BASE_ADDR) -# define ACE_DEFAULT_BASE_ADDR ((char *) 0x40000000) -# endif /* ! ACE_DEFAULT_BASE_ADDR */ -#elif defined (__ia64) || defined (__x86_64__) -# if !defined (ACE_DEFAULT_BASE_ADDR) -// Zero base address should work fine for Linux of IA-64: it just lets -// the kernel to choose the right value. -# define ACE_DEFAULT_BASE_ADDR ((char *) 0x0000000000000000) -# endif /* ! ACE_DEFAULT_BASE_ADDR */ -#endif /* ! __powerpc__ && ! __ia64 */ - -// Then glibc/libc5 specific parts - -#if defined(__GLIBC__) -# define ACE_HAS_NONCONST_SETRLIMIT -# define ACE_HAS_RUSAGE_WHO_ENUM enum __rusage_who -# define ACE_HAS_RLIMIT_RESOURCE_ENUM enum __rlimit_resource -# define ACE_HAS_SOCKLEN_T -# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG - - // glibc defines both of these, used in OS_String. -# if defined (_GNU_SOURCE) -# define ACE_HAS_STRNLEN -# define ACE_HAS_WCSNLEN - - // This is probably not a 100%-sure-fire check... Red Hat Linux 9 - // and Enterprise Linux 3 and up have a new kernel that can send signals - // across threads. This was not possible prior because there was no real - // difference between a process and a thread. With this, the - // ACE_POSIX_SIG_Proactor is the only chance of getting asynch I/O working. - // There are restrictions, such as all socket operations being silently - // converted to synchronous by the kernel, that make aio a non-starter - // for most Linux platforms at this time. But we'll start to crawl... -# define ACE_POSIX_SIG_PROACTOR -# endif - - // To avoid the strangeness with Linux's ::select (), which modifies - // its timeout argument, use ::poll () instead. -# define ACE_HAS_POLL - -// Don't define _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED in ACE to make -// getpgid() prototype visible. ACE shouldn't depend on feature test -// macros to make prototypes visible. -# define ACE_LACKS_GETPGID_PROTOTYPE - -// @note the following defines are necessary with glibc 2.0 (0.961212-5) -// on Alpha. I assume that they're necessary on Intel as well, -// but that may depend on the version of glibc that is used. -//# define ACE_HAS_DLFCN_H_BROKEN_EXTERN_C -# define ACE_HAS_VOIDPTR_SOCKOPT - -// Don't define _POSIX_SOURCE in ACE to make strtok() prototype -// visible. ACE shouldn't depend on feature test macros to make -// prototypes visible. -# define ACE_LACKS_STRTOK_R_PROTOTYPE -// @note end of glibc 2.0 (0.961212-5)-specific configuration. - -// These macros determined by reading on RH 7.1 and glibc's -// . -# if defined (_BSD_SOURCE) \ - || defined (_ISOC99_SOURCE) \ - || defined (_ISOC9X_SOURCE) \ - || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) \ - || (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) -# define ACE_HAS_SNPRINTF -# endif - -# if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 - // These were suggested by Robert Hanzlik to get - // ACE to compile on Linux using glibc 2.1 and libg++/gcc 2.8. -# undef ACE_HAS_BYTESEX_H -# define ACE_HAS_SIGINFO_T -# define ACE_LACKS_SIGINFO_H -# define ACE_HAS_UCONTEXT_T - - // Pre-glibc (RedHat 5.2) doesn't have sigtimedwait. -# define ACE_HAS_SIGTIMEDWAIT -# endif /* __GLIBC__ 2.1+ */ -#else /* ! __GLIBC__ */ - // Fixes a problem with some non-glibc versions of Linux... -# define ACE_LACKS_MADVISE -# define ACE_LACKS_MSG_ACCRIGHTS -#endif /* ! __GLIBC__ */ - -// Don't define _LARGEFILE64_SOURCE in ACE to make llseek() or -// lseek64() prototype visible. ACE shouldn't depend on feature test -// macros to make prototypes visible. -#if __GLIBC__ > 1 -# if __GLIBC_MINOR__ == 0 -# define ACE_HAS_LLSEEK -# define ACE_LACKS_LLSEEK_PROTOTYPE -# else /* __GLIBC_MINOR__ > 0 */ -# define ACE_HAS_LSEEK64 -# define ACE_LACKS_LSEEK64_PROTOTYPE -# endif -#endif /* __GLIBC__ > 1 */ - -#if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 -# define ACE_HAS_P_READ_WRITE -# define ACE_LACKS_PREAD_PROTOTYPE -// Use ACE's alternate cuserid() implementation since the use of the -// system cuserid() is discouraged. -# define ACE_HAS_ALT_CUSERID -#endif /* __GLIBC__ > 1 && __GLIBC_MINOR__ >= 0 */ - -#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) -# define ACE_HAS_ISASTREAM_PROTOTYPE -# define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE -# define ACE_HAS_CPU_SET_T -#endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 3) */ - -// Then the compiler specific parts - -#if defined (__INTEL_COMPILER) -# include "ace/config-icc-common.h" -#elif defined (__GNUG__) - // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so - // this must appear before its #include. -# define ACE_HAS_STRING_CLASS -# include "ace/config-g++-common.h" -#define ACE_CC_NAME ACE_LIB_TEXT ("g++") -#define ACE_CC_MAJOR_VERSION __GNUC__ -#define ACE_CC_MINOR_VERSION __GNUC_MINOR__ -//#define ACE_CC_BETA_VERSION 0 /* ??? */ -#elif defined (__DECCXX) -# define ACE_CONFIG_INCLUDE_CXX_COMMON -# include "ace/config-cxx-common.h" -#elif defined (__BORLANDC__) -# undef ACE_HAS_LLSEEK -# undef ACE_HAS_LSEEK64 -# undef ACE_LACKS_LLSEEK_PROTOTYPE -# undef ACE_LACKS_LSEEK64_PROTOTYPE -# include "ace/config-borland-common.h" -#elif defined (__PGI) -// Portable group compiler -# define ACE_HAS_CPLUSPLUS_HEADERS -# define ACE_HAS_STDCPP_STL_INCLUDES -# define ACE_HAS_TEMPLATE_TYPEDEFS -# define ACE_HAS_TYPENAME_KEYWORD -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# define ACE_LACKS_SWAB -# undef ACE_HAS_CLOCK_GETTIME -#elif defined (__GNUC__) -/** - * GNU C compiler. - * - * We need to recognize the GNU C compiler since TAO has at least one - * C source header and file - * (TAO/orbsvcs/orbsvcs/SSLIOP/params_dup.{h,c}) that may indirectly - * include this - */ -#else /* ! __GNUG__ && !__DECCXX && !__INTEL_COMPILER && !__BORLANDC__ && !__PGI */ -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler in ace/config-linux-common.h -# endif /* __cplusplus */ -#endif /* ! __GNUG__*/ - -// Completely common part :-) - -// Platform/compiler has the sigwait(2) prototype -# define ACE_HAS_SIGWAIT - -# define ACE_HAS_SIGSUSPEND - -# define ACE_HAS_UALARM - -#if __GLIBC__ >= 2 -#ifndef ACE_HAS_POSIX_REALTIME_SIGNALS -#define ACE_HAS_POSIX_REALTIME_SIGNALS -#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ - -#ifndef ACE_HAS_AIO_CALLS -#define ACE_HAS_AIO_CALLS -#endif /* ACE_HAS_AIO_CALLS */ -#endif - -#if __GLIBC__ >= 2 -// glibc 2 and higher has wchar support -# define ACE_HAS_XPG4_MULTIBYTE_CHAR -#endif - -#if __GLIBC__ < 2 -// These are present in glibc 2 and higher -# define ACE_LACKS_WCSTOK -# define ACE_LACKS_WCSDUP_PROTOTYPE -#endif /* __GLIBC__ < 2 */ - -#define ACE_LACKS_ITOW -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSNICMP - -#if __GLIBC__ >= 2 -# define ACE_HAS_3_PARAM_WCSTOK -#endif - -#if !defined (ACE_DEFAULT_BASE_ADDR) -# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) -#endif /* ! ACE_DEFAULT_BASE_ADDR */ - -// Compiler/platform supports alloca(). -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has -#define ACE_HAS_ALLOCA_H - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE -#define ACE_HAS_GETRUSAGE_PROTOTYPE - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// ONLY define this if you have config'd multicast into a 2.0.34 or -// prior kernel. It is enabled by default in 2.0.35 kernels. -#if !defined (ACE_HAS_IP_MULTICAST) -# define ACE_HAS_IP_MULTICAST -#endif /* ! ACE_HAS_IP_MULTICAST */ - -// At least for IPv4, Linux lacks perfect filtering. -#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING -# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 -#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ - -#define ACE_HAS_BIG_FD_SET - -// Linux defines struct msghdr in /usr/include/socket.h -#define ACE_HAS_MSG - -// Linux "improved" the interface to select() so that it modifies -// the struct timeval to reflect the amount of time not slept -// (see NOTES in Linux's select(2) man page). -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 - -#define ACE_HAS_GETPAGESIZE 1 - -#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2) - -// glibc supports wchar, but lacks fgetwc and ungetwc -#define ACE_LACKS_FGETWC -#define ACE_HAS_NONCONST_MSGSND - -#endif - -// glibc requires _XOPEN_SOURCE_EXTENDED to make this prototype -// visible, so force ACE to declare one. Yuk! -#ifndef _XOPEN_SOURCE_EXTENDED -# define ACE_LACKS_MKSTEMP_PROTOTYPE -#endif /* !_XOPEN_SOURCE_EXTENDED */ - -// Platform defines struct timespec but not timespec_t -#define ACE_LACKS_TIMESPEC_T - -// Platform supplies scandir() -#define ACE_HAS_SCANDIR -// Although the scandir man page says otherwise, this setting is correct. -#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR - -//#define ACE_LACKS_STRRECVFD -#define ACE_HAS_STRBUF_T - -//#define ACE_LACKS_MSYNC - -// A conflict appears when including both and -// with recent glibc headers. -//#define ACE_HAS_PROC_FS - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Platform/compiler supports global timezone variable. -#define ACE_HAS_TIMEZONE - -// Platform/compiler supports void * as second parameter to gettimeofday(). -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Don't define _XOPEN_SOURCE in ACE to make strptime() prototype -// visible. ACE shouldn't depend on feature test macros to make -// prototypes visible. -#define ACE_LACKS_STRPTIME_PROTOTYPE - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -#define ACE_HAS_POSIX_TIME - -#define ACE_HAS_GPERF - -#define ACE_HAS_DIRENT - -#if defined (__ia64) || defined(__alpha) || defined (__x86_64__) -// On 64 bit platforms, the "long" type is 64-bits. Override the -// default 32-bit platform-specific format specifiers appropriately. -# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") -# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld") -# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") -#endif /* __ia64 */ - -#define ACE_SIZEOF_WCHAR 4 - -#define ACE_LACKS_GETIPNODEBYADDR -#define ACE_LACKS_GETIPNODEBYNAME - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Linux implements sendfile(). -#define ACE_HAS_SENDFILE - -#define ACE_HAS_VOIDPTR_MMAP - -#define ACE_HAS_NETLINK - -#if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) -// Detect if getsockname() and getpeername() returns random values in -// the sockaddr_in::sin_zero field by evaluation of the kernel -// version. Since version 2.5.47 this problem is fixed. -#include -# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47)) -# define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 0 -# else -# define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 1 -# endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,47)) */ -#endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */ - -#include /**/ "ace/post.h" - -#endif /* ACE_LINUX_COMMON_H */ diff --git a/ace/config-linux.h b/ace/config-linux.h deleted file mode 100644 index 39103f0eb81..00000000000 --- a/ace/config-linux.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// The following configuration file is designed to work for Linux -// platforms using GNU C++. - -#ifndef ACE_CONFIG_LINUX_H -#define ACE_CONFIG_LINUX_H -#include /**/ "ace/pre.h" - -#define ACE_PLATFORM_CONFIG config-linux.h - -#include "ace/config-linux-common.h" - -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE - -#if !defined (ACE_MT_SAFE) -#define ACE_MT_SAFE 1 // JCEJ 12/22/96 #1 -#endif - -#if ACE_MT_SAFE -// Yes, we do have threads. -#define ACE_HAS_THREADS -// And they're even POSIX pthreads (LinuxThreads implementation) -#define ACE_HAS_PTHREADS -// ... and the final standard even! -#define ACE_HAS_PTHREADS_STD - -#if !defined (ACE_HAS_PTHREADS_UNIX98_EXT) -# define ACE_LACKS_RWLOCK_T -#else -# define ACE_HAS_RECURSIVE_MUTEXES -#endif /* !ACE_HAS_PTHREADS_UNIX98_EXT */ - -#define ACE_HAS_THREAD_SPECIFIC_STORAGE // jcej 12/22/96 #2 - -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS // JCEJ 1/7-8/96 - -#if defined(__GLIBC__) -// Platform supports reentrant functions (i.e., all the POSIX *_r -// functions). -#define ACE_HAS_REENTRANT_FUNCTIONS - -#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) - // Older versions of glibc lacked reentrant netdb functions -# define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS - - // glibc < 2.1 lacks pthread_attr_setstacksize() -# define ACE_LACKS_THREAD_STACK_SIZE -#endif /* (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) */ - -// uses ctime_r & asctime_r with only two parameters vs. three -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -#endif - -#endif /* ACE_MT_SAFE */ - - -#include /**/ "ace/post.h" - -#endif /* ACE_CONFIG_LINUX_H */ diff --git a/ace/config-lite.h b/ace/config-lite.h deleted file mode 100644 index 117933cbe61..00000000000 --- a/ace/config-lite.h +++ /dev/null @@ -1,104 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file config-lite.h - * - * $Id$ - * - * @author (Originally in OS.h)Doug Schmidt - * @author Jesper S. M|ller - * @author and a cast of thousands... - * - * This file contains the contents of the old config-all.h in order to - * avoid a circular dependency problem caused by some of the new - * includes added to config-all.h, e.g., OS_main.h. - */ -//========================================================================== - -#ifndef ACE_CONFIG_LITE_H -#define ACE_CONFIG_LITE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-macros.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Empty ACE_OS namespace to help identify compiler errors more -// easily. -- @@ Do we really need this? -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -namespace ACE_OS {} -ACE_END_VERSIONED_NAMESPACE_DECL - -// ============================================================================ -// UNICODE macros (to be added later) -// ============================================================================ - -// Get the unicode (i.e. ACE_TCHAR) defines -# include "ace/ace_wchar.h" - -// ============================================================================ -// at_exit declarations -// ============================================================================ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Marker for cleanup, used by ACE_Exit_Info. -extern int ace_exit_hook_marker; - -ACE_END_VERSIONED_NAMESPACE_DECL - -// For use by . -extern "C" -{ - typedef void (*ACE_EXIT_HOOK) (void); -} - -// Signature for registering a cleanup function that is used by the -// and the . -# if defined (ACE_HAS_SIG_C_FUNC) -extern "C" { -# endif /* ACE_HAS_SIG_C_FUNC */ -typedef void (*ACE_CLEANUP_FUNC)(void *object, void *param) /* throw () */; -# if defined (ACE_HAS_SIG_C_FUNC) -} -# endif /* ACE_HAS_SIG_C_FUNC */ - -// ============================================================================ -// log_msg declarations -// ============================================================================ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) -typedef int (*ACE_SEH_EXCEPT_HANDLER)(void *); -// Prototype of win32 structured exception handler functions. -// They are used to get the exception handling expression or -// as exception handlers. -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - -class ACE_OS_Thread_Descriptor; -class ACE_OS_Log_Msg_Attributes; -typedef void (*ACE_INIT_LOG_MSG_HOOK) (ACE_OS_Log_Msg_Attributes &attr -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector - , ACE_SEH_EXCEPT_HANDLER handler -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ); -typedef void (*ACE_INHERIT_LOG_MSG_HOOK) (ACE_OS_Thread_Descriptor*, - ACE_OS_Log_Msg_Attributes &); - -typedef void (*ACE_CLOSE_LOG_MSG_HOOK) (void); - -typedef void (*ACE_SYNC_LOG_MSG_HOOK) (const ACE_TCHAR *prog_name); - -typedef ACE_OS_Thread_Descriptor *(*ACE_THR_DESC_LOG_MSG_HOOK) (void); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_CONFIG_LITE_H */ diff --git a/ace/config-lynxos.h b/ace/config-lynxos.h deleted file mode 100644 index 850073f990f..00000000000 --- a/ace/config-lynxos.h +++ /dev/null @@ -1,207 +0,0 @@ -// $Id$ - -// The following configuration file is designed to work for LynxOS, -// version 3.0.0 and later, using the GNU g++ compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ - -#if ACE_LYNXOS_MAJOR > 3 || (ACE_LYNXOS_MAJOR == 3 && ACE_LYNXOS_MINOR > 0) - // LynxOS 3.1.0 or greater needs ipc_1c.h to be included before net/if.h - // to avoid macro conflict. -# define ACE_NEEDS_IPC_1C_H -#endif /* ACE_LYNXOS_MAJOR */ - -#if defined (__x86__) -# define ACE_HAS_PENTIUM -#elif defined (__powerpc__) - // It looks like the default stack size is 15000. - // ACE's Recursive_Mutex_Test needs more. -# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 - // This doesn't work on LynxOS 3.0.0, because it resets the TimeBaseRegister. - // # define ACE_HAS_POWERPC_TIMER -#endif /* __x86__ || __powerpc__ */ - -#define ACE_DEFAULT_BASE_ADDR ((char *) 0) -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#define ACE_HAS_ALLOCA -#define ACE_HAS_ALLOCA_H -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_CHARPTR_SHMAT -#define ACE_HAS_CHARPTR_SHMDT -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_DIRENT -#define ACE_HAS_GETPAGESIZE -#define ACE_HAS_GETRUSAGE -#define ACE_HAS_GNU_CSTRING_H -#define ACE_HAS_GPERF -#define ACE_HAS_ICMP_SUPPORT 1 -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_LYNXOS_SIGNALS -#define ACE_HAS_MEMCHR -#define ACE_HAS_MSG -#define ACE_HAS_NONCONST_CLOCK_SETTIME -#define ACE_HAS_NONCONST_GETBY -#define ACE_HAS_NONCONST_MSGSND -#define ACE_HAS_NONCONST_READV -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONCONST_SETRLIMIT -#define ACE_HAS_NONCONST_WRITEV -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_REALTIME_SIGNALS -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -#define ACE_HAS_SCANDIR -#define ACE_HAS_SEMUN -#define ACE_HAS_SHM_OPEN -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRBUF_T -#define ACE_HAS_STREAMS -#define ACE_HAS_STRERROR -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_SYS_SIGLIST -#define ACE_HAS_SYS_SOCKIO_H -#define ACE_HAS_TERMIOS -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_HAS_TYPENAME_KEYWORD -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_GETOPT_PROTOTYPE -#define ACE_LACKS_GETPGID -#define ACE_LACKS_INET_ATON_PROTOTYPE -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MKSTEMP_PROTOTYPE -#define ACE_LACKS_MKTEMP_PROTOTYPE -#define ACE_LACKS_PUTENV_PROTOTYPE -#define ACE_LACKS_REALPATH -#define ACE_LACKS_REGEX_H -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SCANDIR_PROTOTYPE -#define ACE_LACKS_SETEGID -#define ACE_LACKS_SETEUID -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_STRCASECMP_PROTOTYPE -#define ACE_LACKS_STRNCASECMP_PROTOTYPE -#define ACE_LACKS_STRPTIME -#define ACE_LACKS_SWAB_PROTOTYPE -#define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_WCHAR_H -#define ACE_LACKS_SUSECONDS_T -#define ACE_LACKS_USECONDS_T -#define ACE_MALLOC_ALIGN 8 -#define ACE_PAGE_SIZE 4096 -#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR - -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -# define _REENTRANT -#endif - -#if ACE_MT_SAFE == 1 - // Platform supports threads. -# define ACE_HAS_PTHREADS -# if ACE_LYNXOS_MAJOR > 3 || (ACE_LYNXOS_MAJOR == 3 && ACE_LYNXOS_MINOR > 0) - /* LynxOS 3.1.0 or greater */ -# define ACE_HAS_PTHREADS_STD -# else /* LynxOS < 3.1.0 */ -# define ACE_HAS_PTHREADS_DRAFT4 -# define ACE_HAS_STDARG_THR_DEST -# define ACE_LACKS_MUTEXATTR_PSHARED - // Without TSS emulation, you'll only have 3 native TSS keys on - // LynxOS 3.0.0/ppc. -# define ACE_HAS_TSS_EMULATION -# endif /* LynxOS < 3.1.0 */ -# define ACE_HAS_THREADS -# define ACE_HAS_THREAD_SPECIFIC_STORAGE -# define ACE_LACKS_NULL_PTHREAD_STATUS -# define ACE_LACKS_SETDETACH -# define ACE_LACKS_THREAD_PROCESS_SCOPING -# define ACE_LACKS_THREAD_STACK_ADDR -#endif /* ACE_MT_SAFE */ - -#define ACE_HAS_AIO_CALLS -#define ACE_POSIX_AIOCB_PROACTOR -// AIOCB Proactor works on Lynx. But it is not multi-threaded. -// Lynx OS 3.0.0 lacks POSIX call . So,we cannot use -// SIG Proactor also, with multiple threads. So, let us use the AIOCB -// Proactor. Once is available on Lynx, we can turn -// on SIG Proactor for this platform. -// #define ACE_POSIX_SIG_PROACTOR - -#define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1 - -#if __GNUC__ == 2 && __GNUC_MINOR__ == 9 - // config-g++-common.h defines these incorrectly for LynxOS 3.x - // with G++ version 2.9-gnupro-98r2 -# define ACE_HAS_TEMPLATE_SPECIALIZATION -# define ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION -# undef ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES -#endif /* __GNUC__ == 2 && __GNUC_MINOR__ == 9 */ - -#if __GNUC__ < 3 -# define ACE_LACKS_NUMERIC_LIMITS -#endif /* __GNUC__ < 3 */ - -// By default, don't include RCS Id strings in object code. -#if !defined (ACE_USE_RCSID) -# define ACE_USE_RCSID 0 -#endif /* ! ACE_USE_RCSID */ - -// System include files are not in sys/, this gets rid of warning. -#define __NO_INCLUDE_WARN__ - -#if ACE_LYNXOS_MAJOR > 3 /* LynxOS 4.x */ -# define ACE_HAS_POSIX_SEM - // "changes signedness" error (OS.i and many other files) -# define ACE_HAS_SOCKLEN_T - // LSOCK.cpp uses a macro from param.h, not included -# define ALIGNBYTES (sizeof(int) - 1) -# define ALIGN(p) (((unsigned)p + ALIGNBYTES) & ~ALIGNBYTES) -#else /* LynxOS 3.x */ - // Note on why ACE_HAS_POSIX_SEM is not #defined: - // ACE_HAS_POSIX_SEM would cause native LynxOS mutexes and condition - // variables to be used. But, they don't appear to be intended to be - // used between processes. Without ACE_HAS_POSIX_SEM, ACE uses - // semaphores for all synchronization. Those can be used between - // processes - //# define ACE_HAS_POSIX_SEM - - // Don't use MAP_FIXED, at least for now. -# define ACE_MAP_FIXED 0 - // LynxOS, through 3.0.0, does not support MAP_PRIVATE, - // so map it to MAP_SHARED. -# define ACE_MAP_PRIVATE ACE_MAP_SHARED - - // This gets around Lynx broken macro calls resulting in "::0" -# define _POSIX_THREADS_CALLS - -# define ACE_HAS_LYNXOS_BROKEN_MMAP -# define ACE_HAS_POLL -# define ACE_LACKS_AUTO_PTR -# define ACE_LACKS_DLFCN_H -# define ACE_LACKS_SETPGID -# define ACE_LACKS_SETREGID -# define ACE_LACKS_SETREUID -# define ACE_LACKS_SETUID -# define ACE_LACKS_SI_ADDR -# define ACE_LACKS_TCP_NODELAY -#endif /* ACE_LYNXOS_MAJOR > 3 */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-m88k.h b/ace/config-m88k.h deleted file mode 100644 index 8409f53cd3b..00000000000 --- a/ace/config-m88k.h +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for Motorola -// 88k SVR4 platforms using pthreads from Florida State (ACE_HAS_FSU_PTHREADS). - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" - // This config file has not been tested with ACE_HAS_TEMPLATE_SPECIALIZATION. - // Maybe it will work? -# undef ACE_HAS_TEMPLATE_SPECIALIZATION -#endif /* __GNUG__ */ - -#if !defined (m88k) -#define m88k -#endif - -extern "C" void pthread_init(); - -#define PTHREAD_STACK_MIN 1024 - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#if !defined (IP_ADD_MEMBERSHIP) -#define IP_ADD_MEMBERSHIP 0x13 -#endif /* m88k */ - -#if !defined (IP_DROP_MEMBERSHIP) -#define IP_DROP_MEMBERSHIP 0x14 -#endif /* m88k */ - -struct sched_param -{ - int sched_priority; - int prio; -}; - -// This seems to be necessary for m88k. -struct ip_mreq -{ - struct in_addr imr_multiaddr; // IP multicast address of the group - struct in_addr imr_interface; // local IP address of the interface -}; - -#if !defined (ACE_HAS_FSU_PTHREADS) -# define ACE_HAS_FSU_PTHREADS -#endif -#if !defined (ACE_HAS_PTHREADS_DRAFT6) -# define ACE_HAS_PTHREADS_DRAFT6 -#endif - -// Added for compilation on the m88k -#if defined (m88k) -# define ACE_LACKS_T_ERRNO -# define ACE_LACKS_MADVISE -# define ACE_HAS_GNU_CSTRING_H -#endif /* m88k */ - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Sun has the wrong prototype for sendmsg. -#define ACE_HAS_NONCONST_SENDMSG - -// The SunOS 5.x version of rand_r is inconsistent with the header files... -#define ACE_HAS_BROKEN_RANDR - -// Platform supports system configuration information. -#define ACE_HAS_SYSINFO - -// Platform supports the POSIX regular expression library. -#define ACE_HAS_REGEX - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -#if !defined (ACE_HAS_FSU_PTHREADS) -// Platform supports reentrant functions (i.e., all the POSIX *_r functions). -#define ACE_HAS_REENTRANT_FUNCTIONS -#endif /* ACE_HAS_FSU_PTHREADS */ - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -#if !defined (m88k) -// Compiler/platform supports SunOS high resolution timers. -# define ACE_HAS_HI_RES_TIMER -#endif /* m88k */ - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -#if !defined (m88k) -// Compiler/platform has -#define ACE_HAS_ALLOCA_H -#endif /* m88k */ - -// Platform contains . -#define ACE_HAS_POLL - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -#if !defined (m88k) -// Platform supports the prusage_t struct. -#define ACE_HAS_PRUSAGE_T -#endif /* m88k */ - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes. -#define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform supports SVR4 gettimeofday() prototype. -#define ACE_HAS_SVR4_GETTIMEOFDAY - -// Compiler/platform supports SVR4 signal typedef. -#define ACE_HAS_SVR4_SIGNAL_T - -// Compiler/platform supports SVR4 ACE_TLI (in particular, T_GETNAME stuff)... -#define ACE_HAS_SVR4_TLI - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -#if !defined (m88k) -// Compiler/platform supports sys_siglist array. -#define ACE_HAS_SYS_SIGLIST -#endif /* m88k */ - -/* Turn off the following five defines if you want to disable threading. */ -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#define ACE_HAS_PTHREADS -#define ACE_LACKS_RWLOCK_T - -// Platform supports threads. -#define ACE_HAS_THREADS - -#if defined (ACE_HAS_FSU_PTHREADS) -#define ACE_LACKS_THREAD_STACK_ADDR -#endif /* ACE_HAS_FSU_PTHREADS */ - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Reactor detects deadlock -// #define ACE_REACTOR_HAS_DEADLOCK_DETECTION - -// Platform supports ACE_TLI timod STREAMS module. -#define ACE_HAS_TIMOD_H - -// Platform supports ACE_TLI tiuser header. -#define ACE_HAS_TIUSER_H - -// Platform provides ACE_TLI function prototypes. -#define ACE_HAS_TLI_PROTOTYPES - -// Platform supports ACE_TLI. -#define ACE_HAS_TLI - -// Use the poll() event demultiplexor rather than select(). -//#define ACE_USE_POLL - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-macosx-panther.h b/ace/config-macosx-panther.h deleted file mode 100644 index 52d8778d2b1..00000000000 --- a/ace/config-macosx-panther.h +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// This configuration file is designed to work with the MacOS X operating system. - -#ifndef ACE_CONFIG_MACOSX_H -#define ACE_CONFIG_MACOSX_H - -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ - -#undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION - -#define ACE_LACKS_SUSECONDS_T -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") - -#if defined (ACE_HAS_PENTIUM) -# undef ACE_HAS_PENTIUM -#endif /* ACE_HAS_PENTIUM */ - -#if !defined (_THREAD_SAFE) -#define _THREAD_SAFE -#endif /* _THREAD_SAFE */ - -#define ACE_HAS_GPERF -#define ACE_HAS_POSIX_SEM - -//#define ACE_HAS_SVR4_TLI - -#define ACE_HAS_MEMCHR - -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_WCHAR_H - -// -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler/platform supports SVR4 signal typedef -#define ACE_HAS_SVR4_SIGNAL_T - -//Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT - -//Platform supports sigsuspend() -#define ACE_HAS_SIGSUSPEND - -//Platform/compiler has macros for sig{empty,fill,add,del}set (e.g., SCO and FreeBSD) -#define ACE_HAS_SIG_MACROS - -//#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -#define ACE_LACKS_GETPGID -#define ACE_LACKS_RWLOCK_T - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -//? -#define ACE_LACKS_SIGSET - -#define ACE_NEEDS_SCHED_H - -// Use of is deprecated. -#define ACE_LACKS_MALLOC_H - -#define ACE_HAS_ALT_CUSERID - -// Platform supports POSIX timers via struct timespec. -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_UALARM - -// Platform defines struct timespec but not timespec_t -#define ACE_LACKS_TIMESPEC_T - -#define ACE_LACKS_STRRECVFD - -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform supports alloca(). -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Explicit dynamic linking permits "lazy" symbol resolution -//#define ACE_HAS_RTLD_LAZY_V - -// platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// platform supports IP multicast -#define ACE_HAS_IP_MULTICAST -#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 - -//platform supports snprintf () -#define ACE_HAS_SNPRINTF - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Defines the page size of the system. -#define ACE_HAS_GETPAGESIZE - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Platform/compiler supports timezone * as second parameter to gettimeofday(). -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_SYSV_MSQ_PROTOS -#define ACE_HAS_MSG -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#define ACE_HAS_NONCONST_MSGSND - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#if ACE_MT_SAFE == 1 -// Yes, we do have threads. -# define ACE_HAS_THREADS -// And they're even POSIX pthreads -# define ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD -# define ACE_HAS_PTHREAD_SCHEDPARAM -# define ACE_HAS_THREAD_SPECIFIC_STORAGE -#endif /* ACE_MT_SAFE == 1 */ - -# define ACE_LACKS_THREAD_PROCESS_SCOPING - -#define ACE_HAS_DIRENT -#define ACE_LACKS_POLL_H -#define ACE_LACKS_SEARCH_H - -#define ACE_LACKS_SETSCHED -//#define ACE_HAS_RECURSIVE_MUTEXES - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -#define ACE_HAS_SEMUN -#define ACE_HAS_SIGINFO_T -#define ACE_LACKS_SIGINFO_H -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_GETIFADDRS -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES -#define ACE_LACKS_UNNAMED_SEMAPHORE - -// dlcompat package (not part of base Darwin) is needed for dlopen(). -// You may download directly from sourceforge and install or use fink -// Fink installer puts libraries in /sw/lib and headers in /sw/include -// In order to install dlcompat do the following: -// - download fink from http://fink.sf.net -// - type: -// fink install dlcompat -// as of Dec 2002, if you use fink you will need to uncomment the next line -//#define ACE_NEEDS_DL_UNDERSCORE -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("DYLD_LIBRARY_PATH") -#define ACE_DLL_SUFFIX ACE_LIB_TEXT (".dylib") -//#define ACE_LACKS_DLCLOSE - -// gperf seems to need this -//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER - -#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173) -#error "Compiler must be upgraded, see http://developer.apple.com" -#endif /* __APPLE_CC__ */ - -#endif /* ACE_CONFIG_MACOSX_H */ diff --git a/ace/config-macosx-tiger.h b/ace/config-macosx-tiger.h deleted file mode 100644 index ab8b5c15c15..00000000000 --- a/ace/config-macosx-tiger.h +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// This configuration file is designed to work with the MacOS X operating system. - -#ifndef ACE_CONFIG_MACOSX_TIGER_H -#define ACE_CONFIG_MACOSX_TIGER_H - -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ - -// #undef ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR -#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR -#undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION - -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") - -#if !defined (ACE_SIZEOF_LONG_DOUBLE) -# if (__GNUC__ == 3 && __GNUC_MINOR__ == 3) - // Size of long double in GCC 3.3 is 8. -# define ACE_SIZEOF_LONG_DOUBLE 8 -# else // Else, the compiler is GCC4 - // For GCC4, the size is 16. -# define ACE_SIZEOF_LONG_DOUBLE 16 -# endif // GCC 3.3 -#endif // ACE_SIZEOF_LONG_DOUBLE - -#if defined (ACE_HAS_PENTIUM) -# undef ACE_HAS_PENTIUM -#endif /* ACE_HAS_PENTIUM */ - -#if !defined (_THREAD_SAFE) -#define _THREAD_SAFE -#endif /* _THREAD_SAFE */ - -#define ACE_HAS_GPERF -#define ACE_HAS_POSIX_SEM - -//#define ACE_HAS_SVR4_TLI -#define ACE_HAS_SUNOS4_GETTIMEOFDAY - -#define ACE_HAS_MEMCHR - -#define ACE_LACKS_STROPTS_H - -// Wcharness.... -//#define ACE_LACKS_WCHAR_H -#define ACE_HAS_WCHAR -#define ACE_SIZEOF_WCHAR 4 - - -#define ACE_HAS_3_PARAM_WCSTOK -#define ACE_LACKS_ITOW -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSNICMP -#define ACE_LACKS_WCSDUP -// #define ACE_LACKS_WCSLEN - -// Mac lacks the following pthread features -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_CONDATTR_PSHARED -// -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler/platform supports SVR4 signal typedef -#define ACE_HAS_SVR4_SIGNAL_T - -//Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT - -#define ACE_HAS_AIO_CALLS - -//Platform supports sigsuspend() -#define ACE_HAS_SIGSUSPEND - -//Platform/compiler has macros for sig{empty,fill,add,del}set (e.g., SCO and FreeBSD) -#define ACE_HAS_SIG_MACROS - -//#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -#define ACE_LACKS_GETPGID -#define ACE_LACKS_RWLOCK_T - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -//? -#define ACE_LACKS_SIGSET - -#define ACE_NEEDS_SCHED_H - -// Use of is deprecated. -#define ACE_LACKS_MALLOC_H - -#define ACE_HAS_ALT_CUSERID - -// Platform supports POSIX timers via struct timespec. -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_UALARM - -// Platform defines struct timespec but not timespec_t -#define ACE_LACKS_TIMESPEC_T - -#define ACE_LACKS_STRRECVFD - -#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform supports alloca(). -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Explicit dynamic linking permits "lazy" symbol resolution -//#define ACE_HAS_RTLD_LAZY_V - -// platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// platform supports IP multicast -#define ACE_HAS_IP_MULTICAST -#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 - -//platform supports snprintf () -#define ACE_HAS_SNPRINTF - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler/platform provides the socklen_t type. -#define ACE_HAS_SOCKLEN_T - -// Defines the page size of the system. -#define ACE_HAS_GETPAGESIZE - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Platform/compiler supports timezone * as second parameter to gettimeofday(). -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_SYSV_MSQ_PROTOS -#define ACE_HAS_MSG -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#define ACE_HAS_NONCONST_MSGSND - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#if ACE_MT_SAFE == 1 -// Yes, we do have threads. -# define ACE_HAS_THREADS -// And they're even POSIX pthreads -# define ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD -# define ACE_HAS_PTHREAD_SCHEDPARAM -# define ACE_HAS_THREAD_SPECIFIC_STORAGE -#endif /* ACE_MT_SAFE == 1 */ - -#define ACE_LACKS_THREAD_PROCESS_SCOPING - -#define ACE_HAS_DIRENT -#define ACE_LACKS_POLL_H -#define ACE_LACKS_SEARCH_H - -#define ACE_LACKS_SETSCHED -//#define ACE_HAS_RECURSIVE_MUTEXES - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -#define ACE_HAS_SEMUN -#define ACE_HAS_SIGINFO_T -#define ACE_LACKS_SIGINFO_H -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_GETIFADDRS -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES -#define ACE_LACKS_UNNAMED_SEMAPHORE - -// dlcompat package (not part of base Darwin) is needed for dlopen(). -// You may download directly from sourceforge and install or use fink -// Fink installer puts libraries in /sw/lib and headers in /sw/include -// In order to install dlcompat do the following: -// - download fink from http://fink.sf.net -// - type: -// fink install dlcompat -// as of Dec 2002, if you use fink you will need to uncomment the next line -// #define ACE_NEEDS_DL_UNDERSCORE -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("DYLD_LIBRARY_PATH") -#define ACE_DLL_SUFFIX ACE_LIB_TEXT (".dylib") -//#define ACE_LACKS_DLCLOSE - -// gperf seems to need this -//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER - -#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173) -#error "Compiler must be upgraded, see http://developer.apple.com" -#endif /* __APPLE_CC__ */ - -#endif /* ACE_CONFIG_MACOSX_TIGER_H */ diff --git a/ace/config-macosx.h b/ace/config-macosx.h deleted file mode 100644 index 6cfaa1eec67..00000000000 --- a/ace/config-macosx.h +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// This configuration file is designed to work with the MacOS X operating system, version 10.2 (Jaguar). - -#ifndef ACE_CONFIG_MACOSX_H -#define ACE_CONFIG_MACOSX_H - -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ - -#undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION - -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") - -#if defined (ACE_HAS_PENTIUM) -# undef ACE_HAS_PENTIUM -#endif /* ACE_HAS_PENTIUM */ - -#if !defined (_THREAD_SAFE) -#define _THREAD_SAFE -#endif /* _THREAD_SAFE */ - -#define ACE_HAS_GPERF -#define ACE_HAS_POSIX_SEM - -//#define ACE_HAS_SVR4_TLI - -#define ACE_HAS_MEMCHR - -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_WCHAR_H - -#define ACE_SYS_SELECT_NEEDS_UNISTD_H - -// -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler/platform supports SVR4 signal typedef -#define ACE_HAS_SVR4_SIGNAL_T - -//Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT - -//Platform supports sigsuspend() -#define ACE_HAS_SIGSUSPEND - -//Platform/compiler has macros for sig{empty,fill,add,del}set (e.g., SCO and FreeBSD) -#define ACE_HAS_SIG_MACROS - -//#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -#define ACE_LACKS_GETPGID -#define ACE_LACKS_RWLOCK_T - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -#define ACE_HAS_SYSCTL - -//? -#define ACE_LACKS_SIGSET - -#define ACE_NEEDS_SCHED_H - -// Use of is deprecated. -#define ACE_LACKS_MALLOC_H - -#define ACE_HAS_ALT_CUSERID - -// Platform supports POSIX timers via struct timespec. -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_UALARM - -// Platform defines struct timespec but not timespec_t -#define ACE_LACKS_TIMESPEC_T - -#define ACE_LACKS_STRRECVFD - -#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -//#define ACE_HAS_SYSV_IPC - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform supports alloca(). -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Explicit dynamic linking permits "lazy" symbol resolution -//#define ACE_HAS_RTLD_LAZY_V - -// platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// platform supports IP multicast -#define ACE_HAS_IP_MULTICAST -#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 - -//platform supports snprintf () -#define ACE_HAS_SNPRINTF - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Defines the page size of the system. -#define ACE_HAS_GETPAGESIZE - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Platform/compiler supports timezone * as second parameter to gettimeofday(). -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_SYSV_MSQ_PROTOS -#define ACE_HAS_MSG -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#define ACE_HAS_NONCONST_MSGSND - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#if ACE_MT_SAFE == 1 -// Yes, we do have threads. -# define ACE_HAS_THREADS -// And they're even POSIX pthreads -# define ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD -# define ACE_HAS_THREAD_SPECIFIC_STORAGE -# define ACE_LACKS_THREAD_PROCESS_SCOPING -#endif /* ACE_MT_SAFE == 1 */ - -#define ACE_HAS_DIRENT -#define ACE_LACKS_POLL_H -#define ACE_LACKS_SEARCH_H - -#define ACE_LACKS_SETSCHED -//#define ACE_HAS_RECURSIVE_MUTEXES - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -#define ACE_HAS_SEMUN -#define ACE_HAS_SIGINFO_T -#define ACE_LACKS_SIGINFO_H -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_GETIFADDRS -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES -#define ACE_LACKS_UNNAMED_SEMAPHORE - -// dlcompat package (not part of base Darwin) is needed for dlopen(). -// You may download directly from sourceforge and install or use fink -// Fink installer puts libraries in /sw/lib and headers in /sw/include -// In order to install dlcompat do the following: -// - download fink from http://fink.sf.net -// - type: -// fink install dlcompat -// as of Dec 2002, if you use fink you will need to uncomment the next line -//#define ACE_NEEDS_DL_UNDERSCORE -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("DYLD_LIBRARY_PATH") -#define ACE_DLL_SUFFIX ACE_LIB_TEXT (".dylib") -#define ACE_LACKS_DLCLOSE - -// gperf seems to need this -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER - -#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173) -#error "Compiler must be upgraded, see http://developer.apple.com" -#endif /* __APPLE_CC__ */ - -#endif /* ACE_CONFIG_MACOSX_H */ diff --git a/ace/config-macros.h b/ace/config-macros.h deleted file mode 100644 index d6c073423c4..00000000000 --- a/ace/config-macros.h +++ /dev/null @@ -1,638 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file config-macros.h - * - * $Id$ - * - * @author (Originally in OS.h)Doug Schmidt - * @author Jesper S. M|ller - * @author and a cast of thousands... - * - * This file contains the contents of the old config-lite.h header - * without C++ code (except for C++ code in macros). Specifically, - * only macros or C language constructs are found in this header. - * Allows configuration values and macros to be used by some C - * language sources. - */ -//========================================================================== - -#ifndef ACE_CONFIG_MACROS_H -#define ACE_CONFIG_MACROS_H - -#include "ace/config.h" - -#include "ace/Version.h" -#include "ace/Versioned_Namespace.h" - -// ACE_HAS_TLI is used to decide whether to try any XTI/TLI functionality -// so if it isn't set, set it. Capabilities and differences between -// XTI and TLI favor XTI, but when deciding to do anything, as opposed to -// ACE_NOTSUP_RETURN for example, ACE_HAS_TLI is the deciding factor. -#if !defined (ACE_HAS_TLI) -# if defined (ACE_HAS_XTI) -# define ACE_HAS_TLI -# endif /* ACE_HAS_XTI */ -#endif /* ACE_HAS_TLI */ - -#define ACE_BITS_PER_ULONG (8 * sizeof (u_long)) - -#if !defined (ACE_OSTREAM_TYPE) -# if defined (ACE_LACKS_IOSTREAM_TOTALLY) -# define ACE_OSTREAM_TYPE FILE -# else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ -# define ACE_OSTREAM_TYPE ostream -# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ -#endif /* ! ACE_OSTREAM_TYPE */ - -#if !defined (ACE_DEFAULT_LOG_STREAM) -# if defined (ACE_LACKS_IOSTREAM_TOTALLY) -# define ACE_DEFAULT_LOG_STREAM 0 -# else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ -# define ACE_DEFAULT_LOG_STREAM (&cerr) -# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ -#endif /* ! ACE_DEFAULT_LOG_STREAM */ - -// These two are only for backward compatibility. You should avoid -// using them if not necessary. -#if !defined (ACE_LACKS_DEPRECATED_MACROS) -/** - * @deprecated The ACE_SYNCH_1 macro is deprecated - */ -# define ACE_SYNCH_1 ACE_SYNCH_DECL -/** - * @deprecated The ACE_SYNCH_2 macro is deprecated - */ -# define ACE_SYNCH_2 ACE_SYNCH_USE -#endif - -// For Win32 compatibility... -# if !defined (ACE_WSOCK_VERSION) -# define ACE_WSOCK_VERSION 0, 0 -# endif /* ACE_WSOCK_VERSION */ - -# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -# define ACE_MT(X) X -# if !defined (_REENTRANT) -# define _REENTRANT -# endif /* _REENTRANT */ -# else -# define ACE_MT(X) -# endif /* ACE_MT_SAFE */ - -# if defined (ACE_HAS_PURIFY) -# define ACE_INITIALIZE_MEMORY_BEFORE_USE -# endif /* ACE_HAS_PURIFY */ - -# if defined (ACE_HAS_VALGRIND) -# define ACE_INITIALIZE_MEMORY_BEFORE_USE -# endif /* ACE_HAS_VALGRIND */ - -#if !defined (ACE_LACKS_DEPRECATED_MACROS) -/** - * @deprecated The @c ACE_HAS_USING macros are deprecated - */ -# define ACE_USING using -#endif /* !ACE_LACKS_DEPRECATED_MACROS */ - -# if defined (ACE_HAS_TYPENAME_KEYWORD) -# define ACE_TYPENAME typename -# else -# define ACE_TYPENAME -# endif /* ACE_HAS_TYPENAME_KEYWORD */ - -#if !defined (ACE_LACKS_DEPRECATED_MACROS) -/** - * @deprecated The @c ACE_TEMPLATE_SPECIALIZATION and - * @c ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION macros are - * deprecated. Use standard C++ template specialization - * syntax instead. - */ -# define ACE_TEMPLATE_SPECIALIZATION template<> -# define ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION -#endif /* !ACE_LACKS_DEPRECATED_MACROS */ - -// ========================================================================= -// Perfect Multicast filting refers to RFC 3376, where a socket is only -// delivered dgrams for groups joined even if it didn't bind the group -// address. We turn this option off by default, although most OS's -// except for Windows and Solaris probably lack perfect filtering. -// ========================================================================= - -# if !defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING) -# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 0 -# endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ - -// ========================================================================= -// Enable/Disable Features By Default -// ========================================================================= - -# if !defined (ACE_HAS_POSITION_INDEPENDENT_POINTERS) -# define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 -# endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS */ - -# if !defined (ACE_HAS_PROCESS_SPAWN) -# if !defined (ACE_LACKS_FORK) || defined (ACE_WIN32) || defined (ACE_WINCE) || defined (ACE_OPENVMS) -# define ACE_HAS_PROCESS_SPAWN 1 -# endif -# endif /* ACE_HAS_PROCESS_SPAWN */ - -# if !defined (ACE_HAS_DYNAMIC_LINKING) -# if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) || defined (ACE_WIN32) || defined (ACE_VXWORKS) || defined (__hpux) -# define ACE_HAS_DYNAMIC_LINKING 1 -# endif -# endif /* ACE_HAS_DYNAMIC_LINKING */ - -# if defined (ACE_USES_FIFO_SEM) -# if defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_MKFIFO) || defined (ACE_LACKS_FCNTL) -# undef ACE_USES_FIFO_SEM -# endif -# endif /* ACE_USES_FIFO_SEM */ - -// ========================================================================= -// RCSID Macros -// ========================================================================= - -// By default, DO NOT include RCS Id strings in object code. -#if ! defined (ACE_USE_RCSID) -# define ACE_USE_RCSID 0 -#endif /* #if ! defined (ACE_USE_RCSID) */ - -#if (defined (ACE_USE_RCSID) && (ACE_USE_RCSID != 0)) -# if ! defined (ACE_RCSID) - - // This hack has the following purposes: - // 1. To define the RCS id string variable as a static char*, so - // that there won't be any duplicate extern symbols at link - // time. - // 2. To have a RCS id string variable with a unique name for each - // file. - // 3. To avoid warnings of the type "variable declared and never - // used". - -# define ACE_RCSID(path, file, id) \ - static inline const char* get_rcsid_ ## path ## _ ## file (const char*) \ - { \ - return id ; \ - } \ - static const char* rcsid_ ## path ## _ ## file = \ - get_rcsid_ ## path ## _ ## file ( rcsid_ ## path ## _ ## file ) ; - -# endif /* #if ! defined (ACE_RCSID) */ -#else - - // RCS id strings are not wanted. -# if defined (ACE_RCSID) -# undef ACE_RCSID -# endif /* #if defined (ACE_RCSID) */ -# define ACE_RCSID(path, file, id) /* noop */ -#endif /* #if (defined (ACE_USE_RCSID) && (ACE_USE_RCSID != 0)) */ - -// ========================================================================= -// INLINE macros -// -// These macros handle all the inlining of code via the .i or .inl files -// ========================================================================= - -#if defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) -# define ACE_NO_INLINE -#endif /* defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) */ - -// ACE inlining has been explicitly disabled. Implement -// internally within ACE by undefining __ACE_INLINE__. -#if defined (ACE_NO_INLINE) -# undef __ACE_INLINE__ -#endif /* ! ACE_NO_INLINE */ - -#if defined (__ACE_INLINE__) -# define ACE_INLINE inline -# if !defined (ACE_HAS_INLINED_OSCALLS) -# define ACE_HAS_INLINED_OSCALLS -# endif /* !ACE_HAS_INLINED_OSCALLS */ -#else -# define ACE_INLINE -#endif /* __ACE_INLINE__ */ - -#if !defined (ACE_LACKS_DEPRECATED_MACROS) - // ========================================================================= - // EXPLICIT macro - // ========================================================================= - - /** - * @deprecated explicit is deprecated. ACE requires C++ - * "explicit" keyword support. - */ - # define ACE_EXPLICIT explicit -#endif /* ACE_LACKS_DEPRECATED_MACROS */ - -#if !defined (ACE_LACKS_DEPRECATED_MACROS) - // ========================================================================= - // MUTABLE macro - // ========================================================================= - - /** - * @deprecated ACE_MUTABLE is deprecated. ACE requires C++ "mutable" - * keyword support. - */ - # define ACE_MUTABLE mutable - # define ACE_CONST_WHEN_MUTABLE const -#endif /* ACE_LACKS_DEPRECATED_MACROS */ - -// ============================================================================ -// EXPORT macros -// -// Since Win32 DLL's do not export all symbols by default, they must be -// explicitly exported (which is done by *_Export macros). -// ============================================================================ - -// Win32 should have already defined the macros in config-win32-common.h -#if !defined (ACE_HAS_CUSTOM_EXPORT_MACROS) -# define ACE_Proper_Export_Flag -# define ACE_Proper_Import_Flag -# define ACE_EXPORT_SINGLETON_DECLARATION(T) -# define ACE_IMPORT_SINGLETON_DECLARATION(T) -# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#else -// An export macro should at the very least have been defined. - -# ifndef ACE_Proper_Import_Flag -# define ACE_Proper_Import_Flag -# endif /* !ACE_Proper_Import_Flag */ - -# ifndef ACE_EXPORT_SINGLETON_DECLARATION -# define ACE_EXPORT_SINGLETON_DECLARATION(T) -# endif /* !ACE_EXPORT_SINGLETON_DECLARATION */ - -# ifndef ACE_IMPORT_SINGLETON_DECLARATION -# define ACE_IMPORT_SINGLETON_DECLARATION(T) -# endif /* !ACE_IMPORT_SINGLETON_DECLARATION */ - -# ifndef ACE_EXPORT_SINGLETON_DECLARE -# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* !ACE_EXPORT_SINGLETON_DECLARE */ - -# ifndef ACE_IMPORT_SINGLETON_DECLARE -# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* !ACE_IMPORT_SINGLETON_DECLARE */ - -#endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ - -// This is a whim of mine -- that instead of annotating a class with -// ACE_Export in its declaration, we make the declaration near the TOP -// of the file with ACE_DECLARE_EXPORT. -// TS = type specifier (e.g., class, struct, int, etc.) -// ID = identifier -// So, how do you use it? Most of the time, just use ... -// ACE_DECLARE_EXPORT(class, someobject); -// If there are global functions to be exported, then use ... -// ACE_DECLARE_EXPORT(void, globalfunction) (int, ...); -// Someday, when template libraries are supported, we made need ... -// ACE_DECLARE_EXPORT(template class, sometemplate) ; -# define ACE_DECLARE_EXPORT(TS,ID) TS ACE_Export ID - -// ============================================================================ -// Cast macros -// -// These macros are used to choose between the old cast style and the new -// *_cast<> operators -// ============================================================================ - -# define ACE_sap_any_cast(TYPE) reinterpret_cast (const_cast (ACE_Addr::sap_any)) - -#if !defined (ACE_LACKS_DEPRECATED_MACROS) - /** - * @deprecated ACE_{static,reinterpret,dynamic,const}_cast@<@> is - * deprecated. Directly use standard C++ casts instead. - */ - # define ACE_static_cast(TYPE, EXPR) static_cast (EXPR) - # define ACE_static_cast_1_ptr(TYPE, T1, EXPR) static_cast *> (EXPR) - # define ACE_static_cast_2_ptr(TYPE, T1, T2, EXPR) static_cast *> (EXPR) - # define ACE_static_cast_3_ptr(TYPE, T1, T2, T3, EXPR) static_cast *> (EXPR) - # define ACE_static_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) static_cast *> (EXPR) - # define ACE_static_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast *> (EXPR) - # define ACE_static_cast_1_ref(TYPE, T1, EXPR) static_cast &> (EXPR) - # define ACE_static_cast_2_ref(TYPE, T1, T2, EXPR) static_cast &> (EXPR) - # define ACE_static_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast &> (EXPR) - # define ACE_static_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast &> (EXPR) - # define ACE_static_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast &> (EXPR) - - # define ACE_const_cast(TYPE, EXPR) const_cast (EXPR) - # define ACE_const_cast_1_ptr(TYPE, T1, EXPR) const_cast *> (EXPR) - # define ACE_const_cast_2_ptr(TYPE, T1, T2, EXPR) const_cast *> (EXPR) - # define ACE_const_cast_3_ptr(TYPE, T1, T2, T3, EXPR) const_cast *> (EXPR) - # define ACE_const_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) const_cast *> (EXPR) - # define ACE_const_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) const_cast *> (EXPR) - # define ACE_const_cast_1_ref(TYPE, T1, EXPR) const_cast &> (EXPR) - # define ACE_const_cast_2_ref(TYPE, T1, T2, EXPR) const_cast &> (EXPR) - # define ACE_const_cast_3_ref(TYPE, T1, T2, T3, EXPR) const_cast &> (EXPR) - # define ACE_const_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) const_cast &> (EXPR) - # define ACE_const_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) const_cast &> (EXPR) - - # define ACE_reinterpret_cast(TYPE, EXPR) reinterpret_cast (EXPR) - # define ACE_reinterpret_cast_1_ptr(TYPE, T1, EXPR) reinterpret_cast *> (EXPR) - # define ACE_reinterpret_cast_2_ptr(TYPE, T1, T2, EXPR) reinterpret_cast *> (EXPR) - # define ACE_reinterpret_cast_3_ptr(TYPE, T1, T2, T3, EXPR) reinterpret_cast *> (EXPR) - # define ACE_reinterpret_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) reinterpret_cast *> (EXPR) - # define ACE_reinterpret_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) reinterpret_cast *> (EXPR) - # define ACE_reinterpret_cast_1_ref(TYPE, T1, EXPR) reinterpret_cast &> (EXPR) - # define ACE_reinterpret_cast_2_ref(TYPE, T1, T2, EXPR) reinterpret_cast &> (EXPR) - # define ACE_reinterpret_cast_3_ref(TYPE, T1, T2, T3, EXPR) reinterpret_cast &> (EXPR) - # define ACE_reinterpret_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) reinterpret_cast &> (EXPR) - # define ACE_reinterpret_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) reinterpret_cast &> (EXPR) - - # if defined (ACE_LACKS_RTTI) - # define ACE_dynamic_cast(TYPE, EXPR) static_cast (EXPR) - # define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) static_cast *> (EXPR) - # define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) static_cast *> (EXPR) - # define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) static_cast *> (EXPR) - # define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) static_cast *> (EXPR) - # define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast *> (EXPR) - # define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) static_cast &> (EXPR) - # define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) static_cast &> (EXPR) - # define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast &> (EXPR) - # define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast &> (EXPR) - # define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast &> (EXPR) - # else /* ! ACE_LACKS_RTTI */ - # define ACE_dynamic_cast(TYPE, EXPR) dynamic_cast (EXPR) - # define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) dynamic_cast *> (EXPR) - # define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) dynamic_cast *> (EXPR) - # define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) dynamic_cast *> (EXPR) - # define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast *> (EXPR) - # define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast *> (EXPR) - # define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) dynamic_cast &> (EXPR) - # define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) dynamic_cast &> (EXPR) - # define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) dynamic_cast &> (EXPR) - # define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast &> (EXPR) - # define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast &> (EXPR) - # endif /* ! ACE_LACKS_RTTI */ -#endif /* ACE_LACKS_DEPRECATED_MACROS */ - -# if !defined (ACE_CAST_CONST) - // Sun CC 4.2, for example, requires const in reinterpret casts of - // data members in const member functions. But, other compilers - // complain about the useless const. This keeps everyone happy. -# if defined (__SUNPRO_CC) -# define ACE_CAST_CONST const -# else /* ! __SUNPRO_CC */ -# define ACE_CAST_CONST -# endif /* ! __SUNPRO_CC */ -# endif /* ! ACE_CAST_CONST */ - -// ============================================================================ -// Compiler Silencing macros -// -// Some compilers complain about parameters that are not used. This macro -// should keep them quiet. -// ============================================================================ - -#if defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__rational__) || defined (__USLC__) || defined (ACE_RM544) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) -// Some compilers complain about "statement with no effect" with (a). -// This eliminates the warnings, and no code is generated for the null -// conditional statement. @note that may only be true if -O is enabled, -// such as with GreenHills (ghs) 1.8.8. -# define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0) -#elif defined (__DMC__) - #define ACE_UNUSED_ID(identifier) - template - inline void ACE_UNUSED_ARG(const T& ACE_UNUSED_ID(t)) { } -#else /* ghs || __GNUC__ || ..... */ -# define ACE_UNUSED_ARG(a) (a) -#endif /* ghs || __GNUC__ || ..... */ - -#if defined (__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (ACE_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || (defined (__HP_aCC) && (__HP_aCC >= 60500)) -# define ACE_NOTREACHED(a) -#else /* __sgi || ghs || ..... */ -# define ACE_NOTREACHED(a) a -#endif /* __sgi || ghs || ..... */ - -// ============================================================================ -// ACE_ALLOC_HOOK* macros -// -// Macros to declare and define class-specific allocation operators. -// ============================================================================ - -# if defined (ACE_HAS_ALLOC_HOOKS) -# define ACE_ALLOC_HOOK_DECLARE \ - void *operator new (size_t bytes); \ - void operator delete (void *ptr); - - // Note that these are just place holders for now. Some day they - // may be be replaced by . -# define ACE_ALLOC_HOOK_DEFINE(CLASS) \ - void *CLASS::operator new (size_t bytes) { return ::new char[bytes]; } \ - void CLASS::operator delete (void *ptr) { delete [] ((char *) ptr); } -# else -# define ACE_ALLOC_HOOK_DECLARE struct __Ace {} /* Just need a dummy... */ -# define ACE_ALLOC_HOOK_DEFINE(CLASS) -# endif /* ACE_HAS_ALLOC_HOOKS */ - -// ============================================================================ -/** - * ACE_OSCALL* macros - * - * @deprecated ACE_OSCALL_RETURN and ACE_OSCALL should not be used. - * Please restart system calls in your application code. - * See the @c sigaction(2) man page for documentation - * regarding enabling restartable system calls across - * signals via the @c SA_RESTART flag. - * - * The following two macros used ensure that system calls are properly - * restarted (if necessary) when interrupts occur. However, that - * capability was never enabled by any of our supported platforms. - * In fact, some parts of ACE would not function properly when that - * ability was enabled. Furthermore, they assumed that ability to - * restart system calls was determined statically. That assumption - * does not hold for modern platforms, where that ability is - * determined dynamically at run-time. - */ -// ============================================================================ - -#define ACE_OSCALL_RETURN(X,TYPE,FAILVALUE) \ - do \ - return (TYPE) (X); \ - while (0) -#define ACE_OSCALL(X,TYPE,FAILVALUE,RESULT) \ - do \ - RESULT = (TYPE) (X); \ - while (0) - -#if defined (ACE_WIN32) -# if defined (__BORLANDC__) && (__BORLANDC__ <= 0x550) -# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ - do { \ - TYPE ace_result_; \ - TYPE ace_local_result_ = (TYPE) X; \ - ace_result_ = ace_local_result_; \ - if (ace_result_ == FAILVALUE) \ - ACE_OS::set_errno_to_last_error (); \ - return ace_result_; \ - } while (0) -# else -# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ - do { \ - TYPE ace_result_ = (TYPE) X; \ - if (ace_result_ == FAILVALUE) \ - ACE_OS::set_errno_to_last_error (); \ - return ace_result_; \ - } while (0) -# endif /* defined (__BORLANDC__) && (__BORLANDC__ <= 0x550) */ -# define ACE_WIN32CALL(X,TYPE,FAILVALUE,RESULT) \ - do { \ - RESULT = (TYPE) X; \ - if (RESULT == FAILVALUE) \ - ACE_OS::set_errno_to_last_error (); \ - } while (0) -#endif /* ACE_WIN32 */ - -// ============================================================================ -// Fundamental types -// ============================================================================ - -#if defined (ACE_WIN32) - -typedef HANDLE ACE_HANDLE; -typedef SOCKET ACE_SOCKET; -# define ACE_INVALID_HANDLE INVALID_HANDLE_VALUE - -#else /* ! ACE_WIN32 */ - -typedef int ACE_HANDLE; -typedef ACE_HANDLE ACE_SOCKET; -# define ACE_INVALID_HANDLE -1 - -#endif /* ACE_WIN32 */ - -// Define the type that's returned from the platform's native thread -// functions. ACE_THR_FUNC_RETURN is the type defined as the thread -// function's return type, except when the thread function doesn't return -// anything (pSoS). The ACE_THR_FUNC_NO_RETURN_VAL macro is used to -// indicate that the actual thread function doesn't return anything. The -// rest of ACE uses a real type so there's no a ton of conditional code -// everywhere to deal with the possibility of no return type. -# if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) -# include /**/ -typedef int ACE_THR_FUNC_RETURN; -# elif defined (ACE_WIN32) -typedef DWORD ACE_THR_FUNC_RETURN; -# else -typedef void* ACE_THR_FUNC_RETURN; -# endif /* ACE_VXWORKS */ -typedef ACE_THR_FUNC_RETURN (*ACE_THR_FUNC)(void *); - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -typedef void (*ACE_THR_C_DEST)(void *); -#ifdef __cplusplus -} -#endif /* __cplusplus */ -typedef void (*ACE_THR_DEST)(void *); - -// Now some platforms have special requirements... -# if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) -typedef FUNCPTR ACE_THR_FUNC_INTERNAL; // where typedef int (*FUNCPTR) (...) -# else -typedef ACE_THR_FUNC ACE_THR_FUNC_INTERNAL; -# endif /* ACE_VXWORKS */ - -# ifdef __cplusplus -extern "C" -{ -# endif /* __cplusplus */ -# if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) -typedef FUNCPTR ACE_THR_C_FUNC; // where typedef int (*FUNCPTR) (...) -# else -typedef ACE_THR_FUNC_RETURN (*ACE_THR_C_FUNC)(void *); -# endif /* ACE_VXWORKS */ -# ifdef __cplusplus -} -# endif /* __cplusplus */ - -// ============================================================================ -// Macros for controlling the lifetimes of dlls loaded by ACE_DLL--including -// all dlls loaded via the ACE Service Config framework. -// -// Please don't change these values or add new ones wantonly, since we use -// the ACE_BIT_ENABLED, etc..., macros to test them. -// ============================================================================ - -// Per-process policy that unloads dlls eagerly. -#define ACE_DLL_UNLOAD_POLICY_PER_PROCESS 0 -// Apply policy on a per-dll basis. If the dll doesn't use one of the macros -// below, the current per-process policy will be used. -#define ACE_DLL_UNLOAD_POLICY_PER_DLL 1 -// Don't unload dll when refcount reaches zero, i.e., wait for either an -// explicit unload request or program exit. -#define ACE_DLL_UNLOAD_POLICY_LAZY 2 -// Default policy allows dlls to control their own destinies, but will -// unload those that don't make a choice eagerly. -#define ACE_DLL_UNLOAD_POLICY_DEFAULT ACE_DLL_UNLOAD_POLICY_PER_DLL - -// Add this macro you one of your cpp file in your dll. X should -// be either ACE_DLL_UNLOAD_POLICY_DEFAULT or ACE_DLL_UNLOAD_POLICY_LAZY. -#define ACE_DLL_UNLOAD_POLICY(CLS,X) \ -extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \ - { return X;} - -// ============================================================================ -// ACE_USES_CLASSIC_SVC_CONF macro -// ============================================================================ - -// For now, default is to use the classic svc.conf format. -#if !defined (ACE_USES_CLASSIC_SVC_CONF) -# if defined (ACE_HAS_CLASSIC_SVC_CONF) && defined (ACE_HAS_XML_SVC_CONF) -# error You can only use either CLASSIC or XML svc.conf, not both. -# endif -// Change the ACE_HAS_XML_SVC_CONF to ACE_HAS_CLASSIC_SVC_CONF when -// we switch ACE to use XML svc.conf as default format. -# if defined (ACE_HAS_XML_SVC_CONF) -# define ACE_USES_CLASSIC_SVC_CONF 0 -# else -# define ACE_USES_CLASSIC_SVC_CONF 1 -# endif /* ACE_HAS_XML_SVC_CONF */ -#endif /* ACE_USES_CLASSIC_SVC_CONF */ - -// ============================================================================ -// Default svc.conf file extension. -// ============================================================================ -#if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1) -# define ACE_DEFAULT_SVC_CONF_EXT ".conf" -#else -# define ACE_DEFAULT_SVC_CONF_EXT ".conf.xml" -#endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ - -// ============================================================================ -// Miscellaneous macros -// ============================================================================ - -#if defined (ACE_USES_EXPLICIT_STD_NAMESPACE) -# define ACE_STD_NAMESPACE std -#else -# define ACE_STD_NAMESPACE -#endif - -#if !defined (ACE_OS_String) -# define ACE_OS_String ACE_OS -#endif /* ACE_OS_String */ -#if !defined (ACE_OS_Memory) -# define ACE_OS_Memory ACE_OS -#endif /* ACE_OS_Memory */ -#if !defined (ACE_OS_Dirent) -# define ACE_OS_Dirent ACE_OS -#endif /* ACE_OS_Dirent */ -#if !defined (ACE_OS_TLI) -# define ACE_OS_TLI ACE_OS -#endif /* ACE_OS_TLI */ - -// ------------------------------------------------------------------- -// Preprocessor symbols will not be expanded if they are -// concatenated. Force the preprocessor to expand them during the -// argument prescan by calling a macro that itself calls another that -// performs the actual concatenation. -#define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B -#define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B) -// ------------------------------------------------------------------- - -#endif /* ACE_CONFIG_MACROS_H */ diff --git a/ace/config-minimal.h b/ace/config-minimal.h deleted file mode 100644 index e7937690ee5..00000000000 --- a/ace/config-minimal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// This configuration file is designed to build only the minimal -// ACE_OS adaptation layer. - -#ifndef ACE_CONFIG_MINIMAL_H -#define ACE_CONFIG_MINIMAL_H -#include /**/ "ace/pre.h" - -#define ACE_HAS_MINIMAL_ACE_OS - -// Only instantiate the ACE_OS_Object_Manager. -#define ACE_MAIN_OBJECT_MANAGER \ - ACE_OS_Object_Manager ace_os_object_manager; - -#if !defined(ACE_USE_THREAD_MANAGER_ADAPTER) - // To prevent use of ACE_Thread_Exit functions in - // ACE_Thread_Adapter::invoke (). -# define ACE_USE_THREAD_MANAGER_ADAPTER -#endif /* ! ACE_USE_THREAD_MANAGER_ADAPTER */ - -#if defined (ACE_ASSERT) -# undef ACE_ASSERT -#endif /* ACE_ASSERT */ -#define ACE_ASSERT(x) - -#if defined (ACE_DEBUG) -# undef ACE_DEBUG -#endif /* ACE_DEBUG */ -#define ACE_DEBUG(x) - -#if defined (ACE_ERROR) -# undef ACE_ERROR -#endif /* ACE_ERROR */ -#define ACE_ERROR(x) - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_MINIMAL_H */ diff --git a/ace/config-mit-pthread.h b/ace/config-mit-pthread.h deleted file mode 100644 index afaf665c383..00000000000 --- a/ace/config-mit-pthread.h +++ /dev/null @@ -1,49 +0,0 @@ -// $Id$ - -#ifndef ACE_CONFIG_MIT_PTHREAD_H -#define ACE_CONFIG_MIT_PTHREAD_H -#include /**/ "ace/pre.h" - -// Platform uses int for select() rather than fd_set. -#if !defined(ACE_HAS_SELECT_H) -#define ACE_HAS_SELECT_H -#endif - -// Threads -#define ACE_HAS_THREADS -#if !defined (ACE_MT_SAFE) - #define ACE_MT_SAFE 1 -#endif -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREADS_STD -#define ACE_LACKS_PTHREAD_CANCEL -#define ACE_HAS_SIGWAIT -#define ACE_LACKS_THREAD_PROCESS_SCOPING -//#define ACE_LACKS_THREAD_STACK_ADDR -// If ACE doesn't compile due to the lack of these methods, please -// send email to schmidt@cs.wustl.edu reporting this. -// #define ACE_LACKS_CONDATTR_PSHARED -// #define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SETSCHED - -#include -#if defined(_M_UNIX) -#include -#endif - -#define ACE_LACKS_TIMEDWAIT_PROTOTYPES -#define ACE_HAS_RECV_TIMEDWAIT -#define ACE_HAS_RECVFROM_TIMEDWAIT -#define ACE_HAS_RECVMSG_TIMEDWAIT -#define ACE_HAS_SEND_TIMEDWAIT -#define ACE_HAS_SENDTO_TIMEDWAIT -#define ACE_HAS_SENDMSG_TIMEDWAIT -#define ACE_HAS_READ_TIMEDWAIT -#define ACE_HAS_READV_TIMEDWAIT -#define ACE_HAS_WRITE_TIMEDWAIT -#define ACE_HAS_WRITEV_TIMEDWAIT - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_MIT_PTHREAD_H */ diff --git a/ace/config-mklinux.h b/ace/config-mklinux.h deleted file mode 100644 index 7487484f103..00000000000 --- a/ace/config-mklinux.h +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for MkLinux -// platforms using GNU C++. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#include "ace/config-linux-common.h" - -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_AUTOMATIC_INIT_FINI - -#undef ACE_HAS_SOCKLEN_T -#define ACE_HAS_SIZET_SOCKET_LEN - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-mvs.h b/ace/config-mvs.h deleted file mode 100644 index 7f490764501..00000000000 --- a/ace/config-mvs.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// Config file for MVS with OpenEdition - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -// The following #defines are hacks to get around things -// that seem to be missing or different in MVS land -#define MAXPATHLEN 1024 /* sys/param.h not on MVS */ -#define NSIG 44 /* missing from Signal.h */ -#define MAXHOSTNAMELEN 256 /* missing form netdb.h */ -#define howmany __howmany /* MVS uses different names than most others */ -#define fd_mask __fd_mask -#define MAXNAMLEN __DIR_NAME_MAX -#if defined (log) /* log is a macro in math.h */ -# undef log /* conflicts with log function in ACE */ -#endif /* log */ - -#define ACE_MVS - -// Preprocesor requires an extra argument -#define ACE_CC_PREPROCESSOR_ARGS "-+ -E" - -// See the README file in this directory -// for a description of the following ACE_ macros - -#if __COMPILER_VER__ >= 0x21020000 /* OS/390 r2 or higher */ -# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -# define ACE_HAS_UCONTEXT_T -#else /* __COMPILER_VER__ < 0x21020000 */ -# define ACE_LACKS_UCONTEXT_H -#endif /* __COMPILER_VER__ < 0x21020000 */ - -#if __COMPILER_VER__ < 0x22060000 /* before OS/390 r2.6 */ -# define ACE_LACKS_LONGLONG_T -#endif /* __COMPILER_VER__ < 0x22060000 */ - -#define ACE_HAS_BROKEN_CTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_DIRENT -#define ACE_HAS_EXCEPTIONS -#define ACE_HAS_GETPAGESIZE -#define ACE_HAS_GETRUSAGE -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_LIMITED_RUSAGE_T -#define ACE_HAS_MSG -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONSCALAR_THREAD_KEY_T -#define ACE_HAS_POLL -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREADS_DRAFT6 -#define ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP -#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SIG_C_FUNC -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_SIZET_SOCKET_LEN -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRERROR -#define ACE_HAS_STRINGS -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_TEMPLATE_SPECIALIZATION -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_THR_C_DEST -#define ACE_HAS_THR_C_FUNC -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_HAS_UALARM -#define ACE_HAS_UTIME -#define ACE_HAS_VOIDPTR_MMAP -#define ACE_HAS_VOIDPTR_SOCKOPT -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_IOSTREAM_FX -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MALLOC_H -#define ACE_LACKS_SYS_PARAM_H -#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SETSCHED -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_NETINET_TCP_H -#define ACE_LACKS_THREAD_PROCESS_SCOPING -#define ACE_LACKS_THREAD_STACK_ADDR -#define ACE_LACKS_TIMESPEC_T - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#define ACE_NEEDS_DEV_IO_CONVERSION - -#define ACE_SIZEOF_FLOAT 4 -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_LONG_DOUBLE 16 - -#define ACE_TEMPLATES_REQUIRE_SOURCE - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-netbsd.h b/ace/config-netbsd.h deleted file mode 100644 index c7508bba3bb..00000000000 --- a/ace/config-netbsd.h +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H - -#define ACE_HAS_CLOCK_SETTIME 1 -#define ACE_HAS_CLOCK_GETTIME 1 -#define ACE_HAS_SETTIMEOFDAY 1 -#define ACE_HAS_GETTIMEOFDAY 1 -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1 -#define ACE_HAS_3_PARAM_WCSTOK 1 -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG 1 -#define ACE_HAS_ALT_CUSERID 1 -#define ACE_HAS_AUTOMATIC_INIT_FINI 1 -#define ACE_HAS_CLOCK_GETTIME 1 -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 -#define ACE_HAS_CPLUSPLUS_HEADERS 1 -#define ACE_HAS_DIRENT 1 -#define ACE_HAS_EXCEPTIONS 1 -#define ACE_HAS_GETIFADDRS 1 -#define ACE_HAS_GETPAGESIZE 1 -#define ACE_HAS_GETRUSAGE 1 -#define ACE_HAS_GETRUSAGE_PROTOTYPE 1 -#define ACE_HAS_GNU_CSTRING_H 1 -#define ACE_HAS_GPERF 1 -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1 -#define ACE_HAS_IP_MULTICAST 1 -#define ACE_HAS_MEMCHR 1 -#define ACE_HAS_MSG 1 -#define ACE_HAS_NEW_NOTHROW 1 -#define ACE_HAS_NEW_NO_H 1 -#define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 -#define ACE_HAS_ONLY_SCHED_OTHER 1 -#define ACE_HAS_POLL 1 -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 -#define ACE_HAS_POSIX_NONBLOCK 1 -#define ACE_HAS_POSIX_TIME 1 -#define ACE_HAS_PTHREADS 1 -#define ACE_HAS_PTHREADS_STD 1 -#define ACE_HAS_PTHREADS_UNIX98_EXT 1 -#define ACE_HAS_PTHREAD_RESUME_NP 1 -#define ACE_HAS_PTHREAD_SUSPEND_NP 1 -#define ACE_HAS_P_READ_WRITE 1 -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 -#define ACE_HAS_REENTRANT_FUNCTIONS 1 -#define ACE_HAS_SCANDIR 1 -#define ACE_HAS_SIGACTION_CONSTP2 1 -#define ACE_HAS_SIGINFO_T 1 -#define ACE_HAS_SIGSUSPEND 1 -#define ACE_HAS_SIGTIMEDWAIT 1 -#define ACE_HAS_SIGWAIT 1 -#define ACE_HAS_SIG_ATOMIC_T 1 -#define ACE_HAS_SIG_C_FUNC 1 -#define ACE_HAS_SOCKADDR_IN_SIN_LEN 1 -#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN 1 -#define ACE_HAS_SNPRINTF 1 -#define ACE_HAS_SOCKADDR_MSG_NAME 1 -#define ACE_HAS_SOCKLEN_T 1 -#define ACE_HAS_SSIZE_T 1 -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#define ACE_HAS_STDCPP_STL_INCLUDES 1 -#define ACE_HAS_STDEXCEPT_NO_H 1 -#define ACE_HAS_STRERROR 1 -#define ACE_HAS_STRINGS 1 -#define ACE_HAS_STRING_CLASS 1 -#define ACE_HAS_SVR4_DYNAMIC_LINKING 1 -#define ACE_HAS_SYSV_IPC 1 -#define ACE_HAS_SYS_ERRLIST 1 -#define ACE_HAS_SYS_FILIO_H 1 -#define ACE_HAS_SYS_SIGLIST 1 -#define ACE_HAS_SYS_SOCKIO_H 1 -#define ACE_HAS_SYS_SYSCALL_H 1 -#define ACE_HAS_SYSCTL -#define ACE_HAS_TEMPLATE_SPECIALIZATION 1 -#define ACE_HAS_TEMPLATE_TYPEDEFS 1 -#define ACE_HAS_TERMIOS 1 -#define ACE_HAS_THREADS 1 -#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 -#define ACE_HAS_TIMEZONE 1 -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY 1 -#define ACE_HAS_TYPENAME_KEYWORD 1 -#define ACE_HAS_UALARM 1 -#define ACE_HAS_UCONTEXT_T 1 -#define ACE_HAS_VOIDPTR_MMAP 1 -#define ACE_HAS_VOIDPTR_SOCKOPT 1 -#define ACE_HAS_WCHAR 1 -#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR 1 -#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 -#define ACE_IOCTL_TYPE_ARG2 u_long -#define ACE_LACKS_CONDATTR_PSHARED 1 -#define ACE_LACKS_GETHOSTENT 1 -#define ACE_LACKS_GETIPNODEBYADDR 1 -#define ACE_LACKS_GETIPNODEBYNAME 1 -#define ACE_LACKS_IOSTREAM_FX 1 -#define ACE_LACKS_ITOW 1 -#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 -#define ACE_LACKS_MSG_ACCRIGHTS 1 -#define ACE_LACKS_MUTEXATTR_PSHARED 1 -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 -#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 -#define ACE_LACKS_PRAGMA_ONCE 1 -#define ACE_LACKS_PRI_T 1 -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 -#define ACE_LACKS_PTHREAD_YIELD 1 -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS 1 -#define ACE_LACKS_RWLOCKATTR_PSHARED 1 -#define ACE_LACKS_RWLOCK_T 1 -#define ACE_LACKS_SETSCHED 1 -#define ACE_LACKS_SIGINFO_H 1 -#define ACE_LACKS_STROPTS_H 1 -#define ACE_LACKS_STRRECVFD 1 -#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1 -#define ACE_LACKS_TIMESPEC_T 1 -#define ACE_LACKS_UNBUFFERED_STREAMBUF 1 -#define ACE_LACKS_WCSDUP 1 -#define ACE_LACKS_WCSICMP 1 -#define ACE_LACKS_WCSNICMP 1 -#define ACE_MT_SAFE 1 -#define ACE_NEW_THROWS_EXCEPTIONS 1 -#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR 1 -#define ACE_TEMPLATES_REQUIRE_SOURCE 1 -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -#if defined(__x86_64__) -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_FLOAT 4 -#define ACE_SIZEOF_INT 4 -#define ACE_SIZEOF_LONG 8 -#define ACE_SIZEOF_LONG_DOUBLE 16 -#define ACE_SIZEOF_LONG_LONG 8 -#define ACE_SIZEOF_SHORT 2 -#define ACE_SIZEOF_VOID_P 8 -#define ACE_SIZEOF_WCHAR 4 - -typedef unsigned long ACE_UINT64; -typedef signed long ACE_INT64; - -#define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld") -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") - -#elif defined(__i386__) -#define ACE_HAS_PENTIUM 1 - -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_FLOAT 4 -#define ACE_SIZEOF_INT 4 -#define ACE_SIZEOF_LONG 4 -#define ACE_SIZEOF_LONG_DOUBLE 12 -#define ACE_SIZEOF_LONG_LONG 8 -#define ACE_SIZEOF_SHORT 2 -#define ACE_SIZEOF_VOID_P 4 -#define ACE_SIZEOF_WCHAR 4 - -typedef unsigned long long ACE_UINT64; -typedef signed long long ACE_INT64; - -#else -# error unknown CPU architecture -#endif - -#endif /* ACE_CONFIG_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/ace/config-openbsd.h b/ace/config-openbsd.h deleted file mode 100644 index ff5de9d77dd..00000000000 --- a/ace/config-openbsd.h +++ /dev/null @@ -1,242 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for OpenBSD -// platforms using GNU g++. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if defined (ACE_HAS_THREADS) -#include /**/ -#endif /* ACE_HAS_THREADS */ - -#include "ace/config-posix.h" - -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#define ACE_SIZEOF_LONG_DOUBLE 12 - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ - - -// Platform specific directives -// gcc defines __OpenBSD__ automatically for us. -#include - -#if defined (ACE_HAS_THREADS) -#if !defined (_THREAD_SAFE) -#define _THREAD_SAFE -#endif /* _THREAD_SAFE */ - -// Check if pthreads and native exceptions are being used together. -// This causes SEGVs to tbe thrown somewhat randomly for some -// reason. According to newsgroup postings, it appears to be an -// OpenBSD or gcc bug. -#if defined (ACE_USES_NATIVE_EXCEPTIONS) -#error "OpenBSD pthreads and native exceptions currently do not work. See OpenBSD bug #1750" -#endif /* ACE_USES_NATIVE_EXCEPTIONS */ - -#endif /* ACE_HAS_THREADS */ - -#define ACE_HAS_GPERF - -// Platform specific directives -/* Are the following true? */ -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID - -#define ACE_HAS_ALT_CUSERID -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS - -#define ACE_LACKS_RWLOCK_T -#define ACE_HAS_SIG_MACROS -#define ACE_HAS_CHARPTR_DL -#define ACE_HAS_DIRENT -#define ACE_USES_ASM_SYMBOL_IN_DLSYM - -#define ACE_LACKS_UCONTEXT_H - -// ucontext_t is in OpenBSD 3.5 and later. -#if (OpenBSD >= 200405) -# define ACE_HAS_UCONTEXT_T -#endif /* OpenBSD >= 200405 */ - - -// OpenBSD has sigwait defined -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIGINFO_T - -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS -#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - -#define ACE_HAS_SOCKLEN_T - -#define ACE_HAS_POLL - -// Use of is deprecated. -#define ACE_LACKS_MALLOC_H - -// NetBSD appears to have a sigset_t type. -// #define ACE_LACKS_SIGSET - -// Platform supports POSIX timers via struct timespec. -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_UALARM - -// Platform defines struct timespec but not timespec_t -#define ACE_LACKS_TIMESPEC_T - -#define ACE_LACKS_STDINT_H -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_WCHAR_H - -#define ACE_LACKS_STRRECVFD - -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// OpenBSD supports the getifaddrs interface -#define ACE_HAS_GETIFADDRS - -// Compiler/platform supports SVR4 signal typedef -#define ACE_HAS_SVR4_SIGNAL_T -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform supports alloca(). -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform supports SVR4 dynamic linking semantics.. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Explicit dynamic linking permits "lazy" symbol resolution -#define ACE_HAS_RTLD_LAZY_V - -// platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Lacks perfect filtering, must bind group address. -#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING -# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 -#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ - -// Compiler/platform has -//#define ACE_HAS_ALLOCA_H - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler/platform supports sys_siglist array. -// *** This refers to (_sys_siglist) instead of (sys_siglist) -// #define ACE_HAS_SYS_SIGLIST - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -#define ACE_HAS_SYSCTL - -// Platform/compiler supports timezone * as second parameter to gettimeofday(). -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -//#define ACE_HAS_SIG_C_FUNC - -// OpenBSD's dlsym call segfaults when passed an invalid handle. -// It seems as if most other OSs detect this and just report an -// error. -#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE - -#define ACE_HAS_MSG -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#define ACE_HAS_NONCONST_MSGSND - -#ifdef ACE_HAS_THREADS -// Thread specific settings - -// And they're even POSIX pthreads -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif /* ! ACE_MT_SAFE */ -#endif /* ACE_HAS_THREADS */ - -#define ACE_HAS_SIGWAIT - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_LACKS_THREAD_PROCESS_SCOPING -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_DIRENT - -#if !defined (ACE_HAS_THREADS) -// OpenBSD really has readdir_r () in single threaded mode, -// but the #ifdefs in OS.i select one with the wrong parameter -// sets if the ACE_HAS_POSIX_STD isn't defined (which is defined -// when ACE_HAS_THREADS is defined.) - -#define ACE_LACKS_READDIR_R - -#endif /* ! ACE_HAD_THREADS */ - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// OpenBSD actually has the clearerr call, but it causes a -// bogus compiler syntax error. -#define ACE_LACKS_CLEARERR - -#define ACE_HAS_SNPRINTF - -// OpenBSD 3.2 lacks sched_setscheduler (see /usr/src/lib/libc_r/TODO) -#define ACE_LACKS_SETSCHED - -// OpenBSD supports IPv6 by default, but ACE IPv6 code -// has compile errors. -//#define ACE_HAS_IPV6 - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-openvms.h b/ace/config-openvms.h deleted file mode 100644 index 20ccfe872a8..00000000000 --- a/ace/config-openvms.h +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for OpenVMS 7.3-2 - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H - -#if !defined (ACE_USE_RCSID) -# define ACE_USE_RCSID 0 -#endif - -#ifdef __cplusplus -#pragma message disable CODCAUUNR -#pragma message disable CODEUNREACHABLE -//#pragma message disable DOLLARID -//#pragma message disable NOSIMPINT -//#pragma message disable NOSTDLONGLONG -#pragma message disable NARROWPTR -//#pragma message disable LONGEXTERN -#pragma message disable UNSCOMZER -#endif - -// Use a signed int to match POSIX -#define __SIGNED_INT_TIME_T - -#define ACE_OPENVMS 0x0821 - -#define ACE_DLL_SUFFIX ACE_LIB_TEXT("") - -#define ACE_HAS_DUMP 1 - -// need this includes to ensure proper sequence of definitions so that -// f.i. HP C/C++ does not '#define ' memcpy, memmove etc. -#include -#include -#include -#undef clearerr -#undef memset -#undef memcpy -#undef memmove - -#define ACE_DEFAULT_BASE_ADDR ((char*)(0x30000000)) - -#define ACE_MAX_UDP_PACKET_SIZE 65535 - -#define ACE_HAS_STDCPP_STL_INCLUDES 1 - -#define ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION - -/* missing system headers */ -#define ACE_LACKS_STDINT_H 1 -#define ACE_LACKS_SYS_IPC_H 1 -#define ACE_LACKS_SYS_SEM_H 1 -#define ACE_LACKS_SEMAPHORE_H 1 -#define ACE_LACKS_SYS_SELECT_H 1 -#define ACE_LACKS_TERMIOS_H 1 -#define ACE_LACKS_SYS_SHM_H 1 -#define ACE_LACKS_SYS_MSG_H 1 -#define ACE_LACKS_REGEX_H 1 -#define ACE_LACKS_SEARCH_H 1 -#define ACE_LACKS_SCHED_H 1 -#define ACE_LACKS_SYS_SYSCTL_H 1 -#define ACE_LACKS_MALLOC_H 1 -#define ACE_LACKS_SYS_PARAM_H 1 -#define ACE_LACKS_SIGINFO_H 1 -#define ACE_LACKS_UCONTEXT_H 1 - -/* missing rtl functions */ -#define ACE_LACKS_SETPGID 1 -#define ACE_LACKS_SETREUID 1 -#define ACE_LACKS_SETREGID 1 -#define ACE_LACKS_FORK 1 -#define ACE_LACKS_GETPGID 1 -#define ACE_LACKS_SETSID 1 -#define ACE_LACKS_FCNTL 1 -#define ACE_LACKS_SETEGID 1 -#define ACE_LACKS_SETEUID 1 - -#define ACE_LACKS_REALPATH 1 - -#define ACE_LACKS_SYMLINKS 1 - -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS 1 -#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS 1 - -#define ACE_HAS_SNPRINTF 1 -#define ACE_HAS_P_READ_WRITE -#define ACE_HAS_CHARPTR_DL 1 -#define ACE_HAS_CLOCK_GETTIME 1 -#define ACE_HAS_CLOCK_SETTIME 1 -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY 1 -#define ACE_HAS_DIRENT 1 -#define ACE_HAS_GETPAGESIZE 1 -#define ACE_HAS_MEMCHR 1 -#define ACE_HAS_MSG -#define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1 -#define ACE_HAS_3_PARAM_WCSTOK 1 -#define ACE_HAS_SIGSUSPEND 1 -#define ACE_HAS_SIG_MACROS 1 -#define ACE_HAS_SIGWAIT 1 -#define ACE_HAS_SIGTIMEDWAIT 1 - -#define ACE_HAS_SIG_C_FUNC 1 -#define ACE_HAS_SIGISMEMBER_BUG -#define ACE_HAS_STRNLEN 1 -#define ACE_HAS_STREAMS 1 -#define ACE_HAS_STRERROR 1 -#define ACE_HAS_UALARM 1 -#define ACE_HAS_VOIDPTR_MMAP 1 -#define ACE_HAS_VOIDPTR_SOCKOPT 1 -#define ACE_LACKS_LSTAT 1 -#define ACE_LACKS_MADVISE 1 -#define ACE_LACKS_MKFIFO 1 -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 -#define ACE_LACKS_READLINK 1 -#define ACE_LACKS_RLIMIT 1 -#define ACE_LACKS_RLIMIT_PROTOTYPE 1 -#define ACE_LACKS_SETSCHED -//#define ACE_LACKS_SOCKETPAIR 1 -#define ACE_LACKS_SYSCALL 1 - -/* (missing) standard data types */ -//#define ACE_LACKS_TIMESPEC_T 1 -#define ACE_LACKS_CONST_TIMESPEC_PTR 1 -#define ACE_LACKS_SUSECONDS_T 1 -#define ACE_HAS_IDTYPE_T 1 -#define ACE_HAS_SIGINFO_T 1 -#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 -#define ACE_HAS_SIZET_SOCKET_LEN 1 -#define ACE_HAS_SSIZE_T 1 -#define ACE_LACKS_PRI_T 1 -#define ACE_LACKS_SEMBUF_T 1 -#define ACE_LACKS_STRRECVFD 1 -#define ACE_LACKS_T_ERRNO 1 - -/* POSIX threads ompatibilities */ -#define ACE_LACKS_RWLOCK_T 1 -#define ACE_LACKS_PTHREAD_KILL 1 -#define ACE_LACKS_THREAD_PROCESS_SCOPING 1 - -#define ACE_HAS_PTHREADS 1 -#define ACE_HAS_PTHREADS_STD 1 -#define ACE_HAS_PTHREAD_PROCESS_ENUM 1 -#define ACE_LACKS_UNNAMED_SEMAPHORE 1 -#define ACE_MT_SAFE 1 -#define ACE_HAS_THREADS 1 -#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 -#define ACE_HAS_THR_C_DEST 1 -#define ACE_HAS_THR_C_FUNC 1 -#define ACE_LACKS_PTHREAD_SIGMASK 1 -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE (64U*1024) -#define ACE_HAS_PTHREAD_SETCONCURRENCY 1 -#define ACE_HAS_PTHREAD_GETCONCURRENCY 1 -#define ACE_HAS_PTHREAD_SCHEDPARAM 1 - - -/* language/platform conformance */ -#define ACE_NEW_THROWS_EXCEPTIONS 1 -#define ACE_TEMPLATES_REQUIRE_SOURCE 1 -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#define ACE_HAS_AUTOMATIC_INIT_FINI 1 -#define ACE_LACKS_UNIX_SIGNALS 1 - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 -#define ACE_HAS_CPLUSPLUS_HEADERS 1 -#define ACE_HAS_EXCEPTIONS 1 -#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 - -#define ACE_HAS_GPERF 1 -#define ACE_HAS_IP_MULTICAST 1 -#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 -#define ACE_HAS_POSIX_NONBLOCK 1 -#define ACE_HAS_POSIX_TIME 1 -#define ACE_HAS_BROKEN_POSIX_TIME 1 -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#define ACE_HAS_STRING_CLASS 1 -#define ACE_HAS_SVR4_DYNAMIC_LINKING 1 -#define ACE_HAS_TEMPLATE_SPECIALIZATION 1 - -#define ACE_HAS_TEMPLATE_TYPEDEFS 1 -#define ACE_LACKS_NAMED_POSIX_SEM 1 -#define ACE_LACKS_SYSV_SHMEM 1 -#define ACE_LACKS_UNIX_DOMAIN_SOCKETS 1 -#define ACE_LACKS_UNIX_SYSLOG 1 - -#define ACE_HAS_SOCK_BUF_SIZE_MAX - -#endif diff --git a/ace/config-pharlap.h b/ace/config-pharlap.h deleted file mode 100644 index fa274e22383..00000000000 --- a/ace/config-pharlap.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// This configuration file is for use with the PharLap Realtime ETS Kernel. -// It has been tested with PharLap TNT Embedded ToolSuite version 9.1. - -#ifndef ACE_CONFIG_PHARLAP_H -#define ACE_CONFIG_PHARLAP_H -#include /**/ "ace/pre.h" - -#define ACE_HAS_PHARLAP -// Some features are only available with the Realtime edition of ETS. -// Assume that if using ACE, the realtime version is also being used, but -// allow it to be turned off as well. -#ifndef ACE_HAS_PHARLAP_RT -# define ACE_HAS_PHARLAP_RT -#else -# if (ACE_HAS_PHARLAP_RT == 0) -# undef ACE_HAS_PHARLAP_RT -# endif -#endif - -// Fortunately, PharLap ETS offers much of the Win32 API. But it's still on -// WinNT 3.5, Winsock 1.1 -#define ACE_HAS_WINNT4 0 -#define ACE_HAS_WINSOCK2 0 - -// The TSS implementation doesn't pass muster on the TSS_Test, but it works -// well with ACE's TSS emulation. -#define ACE_HAS_TSS_EMULATION - -#define ACE_LACKS_MMAP -#define ACE_LACKS_MPROTECT -#define ACE_LACKS_MSYNC -#define ACE_LACKS_TCP_NODELAY -#define ACE_LACKS_MSG_WFMO - -// There's no host table, by default. So using "localhost" won't work. -// If your system does have the ability to use "localhost" and you want to, -// define it before including this file. -#if !defined (ACE_LOCALHOST) -# define ACE_LOCALHOST "127.0.0.1" -#endif /* ACE_LOCALHOST */ - -// Don't know how to get the page size at execution time. This is most likely -// the correct value. -#define ACE_PAGE_SIZE 4096 - -#if defined (ACE_HAS_PHARLAP_RT) - // ETS winsock doesn't define IP level socket options -# define IP_TOS 8 -#endif /* ACE_HAS_PHARLAP_RT */ - -// Let the config-win32.h file do its thing -#undef ACE_CONFIG_H -#include "ace/config-win32.h" -#undef ACE_HAS_WCHAR - -#include /**/ -#if defined (ACE_HAS_PHARLAP_RT) -# include /**/ -#define ACE_LACKS_IP_ADD_MEMBERSHIP -#endif /* ACE_HAS_PHARLAP_RT */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_PHARLAP_H */ diff --git a/ace/config-posix.h b/ace/config-posix.h deleted file mode 100644 index 81b11be381f..00000000000 --- a/ace/config-posix.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_CONFIG_POSIX_H -#define ACE_CONFIG_POSIX_H - -#include - -/* The following POSIX constants are defined after is - * included. They are documented in: - * http://www.opengroup.org/onlinepubs/007904975/basedefs/unistd.h.html - */ -#if defined(_POSIX_REALTIME_SIGNALS) && (_POSIX_REALTIME_SIGNALS-0 != -1 ) -# if !defined(ACE_HAS_POSIX_REALTIME_SIGNALS) -# define ACE_HAS_POSIX_REALTIME_SIGNALS -# endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ -#endif /* _POSIX_REALTIME_SIGNALS */ - -#if defined(_POSIX_ASYNCHRONOUS_IO) && (_POSIX_ASYNCHRONOUS_IO-0 != -1 ) -# if !defined(ACE_HAS_AIO_CALLS) -# define ACE_HAS_AIO_CALLS -# endif /* ACE_HAS_AIO_CALLS */ -#endif /* _POSIX_ASYNCHRONOUS_IO */ - -#if defined(_POSIX_SEMAPHORES) && (_POSIX_SEMAPHORES-0 != -1 ) -# if !defined(ACE_HAS_POSIX_SEM) -# define ACE_HAS_POSIX_SEM -# endif /* ACE_HAS_POSIX_SEM */ -# if defined(ACE_HAS_POSIX_SEM) -# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) && defined (_POSIX_TIMEOUTS) -# define ACE_HAS_POSIX_SEM_TIMEOUT -# endif /* ACE_HAS_POSIX_SEM_TIMEOUT && _POSIX_TIMEOUTS */ -# endif /* ACE_HAS_POSIX_SEM */ -#endif /* ACE_HAS_POSIX_SEM */ - -#if defined(_POSIX_MESSAGE_PASSING) && (_POSIX_MESSAGE_PASSING-0 != -1 ) -# if !defined(ACE_HAS_POSIX_MESSAGE_PASSING) -# define ACE_HAS_POSIX_MESSAGE_PASSING -# endif /* ACE_HAS_POSIX_MESSAGE_PASSING */ -#endif /* _POSIX_MESSAGE_PASSING */ - -#if defined(_POSIX_SHARED_MEMORY_OBJECTS) && (_POSIX_SHARED_MEMORY_OBJECTS-0 != -1 ) -# if !defined(ACE_HAS_SHM_OPEN) -# define ACE_HAS_SHM_OPEN -# endif /* ACE_HAS_SHM_OPEN */ -#endif /* _POSIX_SHARED_MEMORY_OBJECTS */ - -// Check if threading enabled/disable through platform_macros -#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0) -// Allow the user to disable use of threads by setting ACE_HAS_THREADS to 0 -// before including this file. The platform config (not macros) file can -// often detect that the compiler was invoked with or without threads support -// and set this accordingly. -# if defined (ACE_HAS_THREADS) && (ACE_HAS_THREADS == 0) -# undef ACE_HAS_THREADS -# else -# if defined(_POSIX_THREADS) && (_POSIX_THREADS-0 != -1 ) -# if !defined(ACE_HAS_THREADS) -# define ACE_HAS_THREADS -# endif /* ACE_HAS_THREADS */ - -# if !defined(ACE_HAS_PTHREADS) -# define ACE_HAS_PTHREADS -# endif /* ACE_HAS_PTHREADS */ - -# if !defined(ACE_HAS_PTHREADS_STD) -# define ACE_HAS_PTHREADS_STD -# endif /* ACE_HAS_PTHREADS_STD */ -# endif /* _POSIX_THREADS */ -# endif /* ACE_HAS_THREADS */ -#endif /* !ACE_MT_SAFE */ - -#if defined(_POSIX_MESSAGE_PASSING) && (_POSIX_MESSAGE_PASSING-0 != -1 ) -# if !defined(ACE_HAS_POSIX_MESSAGE_PASSING) -# define ACE_HAS_POSIX_MESSAGE_PASSING -# endif /* ACE_HAS_POSIX_MESSAGE_PASSING */ -#endif /* _POSIX_MESSAGE_PASSING */ - -#if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) -# define ACE_HAS_SNPRINTF -#endif /* _XOPEN_SOURCE */ - -#endif /* ACE_CONFIG_POSIX_H */ - diff --git a/ace/config-qnx-neutrino.h b/ace/config-qnx-neutrino.h deleted file mode 100644 index 32549c1aa87..00000000000 --- a/ace/config-qnx-neutrino.h +++ /dev/null @@ -1,143 +0,0 @@ -// -*- C++ -*- -// $Id$ -// The following configuration file is designed to work for Neutrino -// 2.0 (Beta) with GNU C++ and the POSIX (pthread) threads package. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define _POSIX_C_SOURCE 199506 -#define _QNX_SOURCE - -// These constants are in i386-nto/include/limits.h, but egcs -// picks up its own limits.h instead: -#define _POSIX_NAME_MAX 14 /* Max bytes in a filename */ -#define _POSIX_PATH_MAX 256 /* Num. bytes in pathname (excl. NULL) */ - -// gcc can do inline -#if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# if !defined (__ACE_INLINE__) -# define __ACE_INLINE__ -# endif /* ! __ACE_INLINE__ */ -#endif - -#if defined(__OPTIMIZE__) -# if defined(__X86__) - // string.h can't be used by ACE with __OPTIMIZE__. -# undef __OPTIMIZE__ -# include -# define __OPTIMIZE__ -# endif /* __X86__ */ -#endif /* __OPTIMIZE__ */ - -#include "ace/config-g++-common.h" - -// The following defines the Neutrino compiler. -// gcc should know to call g++ as necessary -#ifdef __GNUC__ -# define ACE_CC_NAME ACE_LIB_TEXT ("gcc") -#else -# define ACE_CC_NAME ACE_LIB_TEXT ("NTO compiler ??") -#endif - -// /usr/nto/include/float.h defines -// FLT_MAX_EXP 127 -// DBL_MAX_EXP 1023 -// ace expects 128 & 1024 respectively -// to set the following macros in ace/Basic_Types.h -// These macros are: -// #define ACE_SIZEOF_DOUBLE 8 -// #define ACE_SIZEOF_FLOAT 4 - -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA -#define ACE_HAS_ALLOCA_H -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_DIRENT -#define ACE_HAS_GETPAGESIZE -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#define ACE_HAS_INLINED_OSCALLS -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_MSG -#define ACE_HAS_MT_SAFE_MKTIME -#define ACE_HAS_MUTEX_TIMEOUTS -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_POSIX_SEM -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREADS_STD -#define ACE_HAS_P_READ_WRITE -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_SELECT_H -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGISMEMBER_BUG -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SIG_MACROS -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_SIZET_SOCKET_LEN -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRERROR -#define ACE_HAS_STRINGS -#define ACE_HAS_SVR4_GETTIMEOFDAY -#define ACE_HAS_TERMIOS -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_THR_C_DEST -#define ACE_HAS_THR_C_FUNC -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_HAS_UALARM -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_VOIDPTR_MMAP -#define ACE_HAS_VOIDPTR_SOCKOPT -#define ACE_LACKS_CMSG_DATA_MEMBER -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_FORK -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_NAMED_POSIX_SEM -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_RTTI -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SBRK -#define ACE_LACKS_SEEKDIR -#define ACE_LACKS_SOCKET_BUFSIZ -#define ACE_LACKS_SOCKETPAIR -#define ACE_LACKS_STREAM_MODULES -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_TCP_NODELAY -#define ACE_LACKS_TELLDIR -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_TRUNCATE -#define ACE_LACKS_T_ERRNO -#define ACE_LACKS_UALARM_PROTOTYPE -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_UNIX_DOMAIN_SOCKETS -#define ACE_LACKS_U_LONGLONG_T -#define ACE_MT_SAFE 1 -#define ACE_NEEDS_FUNC_DEFINITIONS -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 -#define ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_THR_PRI_FIFO_DEF 10 -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-qnx-rtp-62x.h b/ace/config-qnx-rtp-62x.h deleted file mode 100644 index a54bc100225..00000000000 --- a/ace/config-qnx-rtp-62x.h +++ /dev/null @@ -1,129 +0,0 @@ -// -*- C++ -*- -// $Id$ -// The following configuration file is designed to work for QNX RTP 621 -// GNU C++ and the POSIX (pthread) threads package. You can get QNX -// RTP at http://get.qnx.com -#ifndef ACE_CONFIG_QNX_RTP_62x_H -#define ACE_CONFIG_QNX_RTP_62x_H -#include /**/ "ace/pre.h" -#include /**/ "ace/config-qnx-rtp-common.h" - -///////////////////////////////////////////////////////////////// -// Definition of the features that are available. -// -// ACE_HAS Section -///////////////////////////////////////////////////////////////// -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -#define ACE_HAS_3_PARAM_WCSTOK -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA -#define ACE_HAS_ALLOCA_H -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_DIRENT -#define ACE_HAS_GETPAGESIZE -// Enable gperf, this is a hosted configuration. -#define ACE_HAS_GPERF -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#define ACE_HAS_INLINED_OSCALLS -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_MSG -#define ACE_HAS_MT_SAFE_MKTIME -#define ACE_HAS_MUTEX_TIMEOUTS -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONCONST_SWAB -#define ACE_HAS_POSIX_SEM -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREADS_STD -#define ACE_HAS_P_READ_WRITE -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_SELECT_H -#define ACE_HAS_SHM_OPEN -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGISMEMBER_BUG -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SIG_MACROS -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_SNPRINTF -#define ACE_HAS_SOCKLEN_T -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRERROR -#define ACE_HAS_STRINGS -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_SVR4_GETTIMEOFDAY -#define ACE_HAS_TERMIOS -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_THR_C_DEST -#define ACE_HAS_THR_C_FUNC -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_HAS_UALARM -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_VOIDPTR_MMAP -#define ACE_HAS_VOIDPTR_SOCKOPT - -///////////////////////////////////////////////////////////////// -// Definition of the features that are not available. -// -// ACE_LACKS Section -///////////////////////////////////////////////////////////////// -#define ACE_LACKS_CMSG_DATA_MEMBER -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_MADVISE -// lacks mqueue mgr or speed-up named sem by shm emulation -#define ACE_LACKS_NAMED_POSIX_SEM -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -// Multicast_Tests reports for NTO 621 frames from unsubscribed groups -#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 -#define ACE_LACKS_POLL_H -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SOCKET_BUFSIZ -#define ACE_LACKS_STREAM_MODULES -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_T_ERRNO -#define ACE_LACKS_U_LONGLONG_T - -#define ACE_LACKS_RLIMIT // QNX rlimit syscalls don't work properly with ACE. - -#define ACE_MT_SAFE 1 -#define ACE_NEEDS_FUNC_DEFINITIONS -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 64000 -#define ACE_THR_PRI_FIFO_DEF 10 -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND - -#define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1 - -#define ACE_SIZEOF_WCHAR 4 - -// No prototypes -#define ACE_LACKS_ITOW -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSNICMP -#define ACE_LACKS_WCSDUP -#define ACE_LACKS_CUSERID -// The default value of FD_SETSIZE is 32, but actually x86 NTO -// supports by default at least 1000 descriptors in fd_set. -#if defined( FD_SETSIZE ) -#undef FD_SETSIZE -#endif -#define FD_SETSIZE 1000 -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_QNX_RTP_62x_H*/ diff --git a/ace/config-qnx-rtp-common.h b/ace/config-qnx-rtp-common.h deleted file mode 100644 index 0047add1818..00000000000 --- a/ace/config-qnx-rtp-common.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -// $Id$ -// several macros common to various qnx neutrino version. - -#ifndef ACE_CONFIG_QNX_RTP_COMMON_H -#define ACE_CONFIG_QNX_RTP_COMMON_H -#include /**/ "ace/pre.h" - -#define _POSIX_C_SOURCE 199506 -#define _QNX_SOURCE - -// These constants are in i386-nto/include/limits.h, but egcs -// picks up its own limits.h instead: -#define _POSIX_NAME_MAX 14 /* Max bytes in a filename */ -#define _POSIX_PATH_MAX 256 /* Num. bytes in pathname (excl. NULL) */ - -#if defined(__OPTIMIZE__) -# if defined(__X86__) - // string.h can't be used by ACE with __OPTIMIZE__. -# undef __OPTIMIZE__ -# include -# define __OPTIMIZE__ -# endif /* __X86__ */ -#endif /* __OPTIMIZE__ */ - -#include "ace/config-g++-common.h" - -// The following defines the Neutrino compiler. -// gcc should know to call g++ as necessary -#ifdef __GNUC__ -# define ACE_CC_NAME ACE_LIB_TEXT ("gcc") -#else -# define ACE_CC_NAME ACE_LIB_TEXT ("QNX-RTP compiler ??") -#endif - -// /usr/nto/include/float.h defines -// FLT_MAX_EXP 127 -// DBL_MAX_EXP 1023 -// ace expects 128 & 1024 respectively -// to set the following macros in ace/Basic_Types.h -// These macros are: -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_FLOAT 4 - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_QNX_RTP_COMMON_H */ diff --git a/ace/config-qnx-rtp-pre62x.h b/ace/config-qnx-rtp-pre62x.h deleted file mode 100644 index 46734ef8670..00000000000 --- a/ace/config-qnx-rtp-pre62x.h +++ /dev/null @@ -1,154 +0,0 @@ -// -*- C++ -*- -// $Id$ -// The following configuration file is designed to work for QNX RTP -// GNU C++ and the POSIX (pthread) threads package. You can get QNX -// RTP at http://get.qnx.com - -#ifndef ACE_CONFIG_RTP_PRE62x_H -#define ACE_CONFIG_RTP_PRE62x_H -#include /**/ "ace/pre.h" -#include /**/ "ace/config-qnx-rtp-common.h" - -///////////////////////////////////////////////////////////////// -// Definition of the features that are available. -// -// ACE_HAS Section -///////////////////////////////////////////////////////////////// - -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA -#define ACE_HAS_ALLOCA_H -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_DIRENT -#define ACE_HAS_GETPAGESIZE -// Enable gperf, this is a hosted configuration. -#define ACE_HAS_GPERF -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#define ACE_HAS_INLINED_OSCALLS -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_MSG -#define ACE_HAS_MT_SAFE_MKTIME -#define ACE_HAS_MUTEX_TIMEOUTS -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_POSIX_SEM -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREADS_STD -#define ACE_HAS_P_READ_WRITE -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_SELECT_H -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGISMEMBER_BUG -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SIG_MACROS -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -// #define ACE_HAS_SIZET_SOCKET_LEN -#define ACE_HAS_SOCKLEN_T -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRERROR -#define ACE_HAS_STRINGS -#define ACE_HAS_SVR4_GETTIMEOFDAY -#define ACE_HAS_TERMIOS -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_THR_C_DEST -#define ACE_HAS_THR_C_FUNC -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_HAS_UALARM -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_VOIDPTR_MMAP -#define ACE_HAS_VOIDPTR_SOCKOPT - -///////////////////////////////////////////////////////////////// -// Definition of the features that are not available. -// -// ACE_LACKS Section -///////////////////////////////////////////////////////////////// -#define ACE_LACKS_CMSG_DATA_MEMBER -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_NAMED_POSIX_SEM -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_RTTI -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SBRK -#define ACE_LACKS_SEEKDIR -#define ACE_LACKS_SOCKET_BUFSIZ -#define ACE_LACKS_SOCKETPAIR -// Even if the QNX RTP docs says that socket pair are -// available, there is actually no implementation of -// soket-pairs. -#define ACE_LACKS_STREAM_MODULES -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_SYSV_SHMEM -//#define ACE_LACKS_TCP_NODELAY // Based on the QNX RTP documentation, this option seems to - // to be supported. -#define ACE_LACKS_TELLDIR -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_TRUNCATE -#define ACE_LACKS_T_ERRNO -#define ACE_LACKS_UALARM_PROTOTYPE -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_UNIX_DOMAIN_SOCKETS -#define ACE_LACKS_U_LONGLONG_T - -#define ACE_LACKS_RLIMIT // QNX rlimit syscalls don't work properly with ACE. - -#define ACE_MT_SAFE 1 -#define ACE_NEEDS_FUNC_DEFINITIONS -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 64000 -#define ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_THR_PRI_FIFO_DEF 10 -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND - -#define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1 - -#define ACE_SIZEOF_WCHAR 4 - -// Not really, but the prototype returns wchar_t instead of wchar_t * -#define ACE_LACKS_WCSSTR - -// No prototypes -#define ACE_LACKS_ITOW -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSNICMP -#define ACE_LACKS_WCSDUP - -// And these have prototypes but no implementation -#define ACE_LACKS_WCSLEN -#define ACE_LACKS_WCSNCMP -#define ACE_LACKS_WCSCPY -#define ACE_LACKS_WCSNCPY -#define ACE_LACKS_TOWLOWER -#define ACE_LACKS_TOWUPPER -#define ACE_LACKS_WCSCMP -#define ACE_LACKS_WCSCAT -#define ACE_LACKS_WCSNCAT -#define ACE_LACKS_WCSSPN -#define ACE_LACKS_WCSCHR -#define ACE_LACKS_WCSPBRK -#define ACE_LACKS_WCSRCHR - -#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION -#define ACE_LACKS_ACE_IOSTREAM - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_RTP_PRE62x_H */ diff --git a/ace/config-qnx-rtp.h b/ace/config-qnx-rtp.h deleted file mode 100644 index c881d1db3f6..00000000000 --- a/ace/config-qnx-rtp.h +++ /dev/null @@ -1,20 +0,0 @@ -// -*- C++ -*- -// $Id$ -// The following configuration file is designed to work for QNX RTP -// GNU C++ and the POSIX (pthread) threads package. You can get QNX -// RTP at http://get.qnx.com. -// This header is intended to switch between configuration for -// various NTO versions. -#ifndef ACE_CONFIG_QNX_RTP_H -#define ACE_CONFIG_QNX_RTP_H -#include /**/ "ace/pre.h" - -#if !defined(ACE_NTO_VERS) -# error "Correct ACE_NTO_VERS in include/makeinclude/platform_qnx_rtp_gcc.GNU" -#elif ACE_NTO_VERS < 620 -# include /**/ "ace/config-qnx-rtp-pre62x.h" -#else -# include /**/ "ace/config-qnx-rtp-62x.h" -#endif -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_QNX_RTP_H */ diff --git a/ace/config-rtems.h b/ace/config-rtems.h deleted file mode 100644 index 61e0edf7337..00000000000 --- a/ace/config-rtems.h +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- C -*- */ -// $Id$ - -/* The following configuration file is designed to work for RTEMS - platforms using GNU C. -*/ - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H - -// begin of linux-common.h - -/* #define ACE_HAS_BYTESEX_H */ - -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// Needed to make some prototypes visible. -// #if ! defined (_GNU_SOURCE) -// #define _GNU_SOURCE -// #endif /* ! _GNU_SOURCE */ - -// First the machine specific part -// There are no known port specific issues with the RTEMS port of ACE. -// XXX Pentium and PowerPC have high res timer support in ACE. - -// Then the compiler specific parts -#if defined (__GNUG__) - // config-g-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so - // this must appear before its #include. -# define ACE_HAS_STRING_CLASS -# include "ace/config-g-common.h" -#elif defined (__DECCXX) -# define ACE_CONFIG_INCLUDE_CXX_COMMON -# include "ace/config-cxx-common.h" -#else /* ! __GNUG__ && ! __KCC && !__DECCXX */ -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler in ace/config-rtems.h -# endif /* __cplusplus */ -#endif /* ! __GNUG__ && ! __KCC */ - -// Completely common part :-) - -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER -# if !defined (ACE_MAIN) -# define ACE_MAIN ace_main -# endif /* ! ACE_MAIN */ - -// Yes, we do have threads. -#define ACE_HAS_THREADS -// And they're even POSIX pthreads (MIT implementation) -#define ACE_HAS_PTHREADS -// ... and the final standard even! -#define ACE_HAS_PTHREADS_STD -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// XXX thread defines go here -#define ACE_MT_SAFE 1 -#define ACE_PAGE_SIZE 4096 -#define ACE_HAS_ALT_CUSERID -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -/* #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */ -#define ACE_HAS_DIRENT -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -/* #define ACE_HAS_LLSEEK */ -#define ACE_HAS_MEMCHR -#define ACE_HAS_MSG -#define ACE_HAS_MT_SAFE_MKTIME -#define ACE_HAS_POSIX_SEM -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_SIGACTION_CONSTP2 -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGSUSPEND -#define ACE_HAS_SSIZE_T -/* #define ACE_HAS_STANDARD_CPP_LIBRARY */ -#define ACE_HAS_STRERROR -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY -#define ACE_HAS_SYS_ERRLIST -#define ACE_HAS_SYS_FILIO_H -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_LACKS_DIFFTIME -#define ACE_LACKS_EXEC -#define ACE_LACKS_FILELOCKS -#define ACE_LACKS_FORK -#define ACE_LACKS_GETOPT_PROTOTYPE -#define ACE_LACKS_GETPGID -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MKFIFO -#define ACE_LACKS_MMAP -#define ACE_LACKS_MPROTECT -#define ACE_LACKS_MSYNC -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_READLINK -#define ACE_HAS_NONCONST_READV -#define ACE_LACKS_READV -#define ACE_LACKS_RLIMIT -#define ACE_LACKS_RLIMIT_PROTOTYPE -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SBRK -#define ACE_LACKS_SEMBUF_T -#define ACE_LACKS_SETREUID -#define ACE_LACKS_SETREUID_PROTOTYPE -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREGID_PROTOTYPE -#define ACE_LACKS_STRPTIME -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SI_ADDR -#define ACE_LACKS_SOCKETPAIR -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_UALARM_PROTOTYPE -#define ACE_LACKS_UCONTEXT_H -#define ACE_HAS_NONCONST_WRITEV -#define ACE_LACKS_WRITEV -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 -#define ACE_NEEDS_SCHED_H -#define ACE_HAS_POSIX_NONBLOCK - -/* What should these be set to?. - -ACE_TLI_TCP_DEVICE -ACE_HAS_RECVFROM_TIMEDWAIT -ACE_HAS_SEND_TIMEDWAIT -ACE_HAS_SENDTO_TIMEDWAIT -ACE_HAS_IP_MULTICAST -ACE_HAS_NONCONST_SELECT_TIMEVAL -ACE_HAS_WCHAR_TYPEDEFS_CHAR -ACE_HAS_WCHAR_TYPEDEFS_USHORT -ACE_HAS_SIZET_SOCKET_LEN -ACE_HAS_SOCKADDR_MSG_NAME -ACE_HAS_SOCKLEN_T -ACE_HAS_STRBUF_T -ACE_HAS_SYS_SIGLIST -ACE_HAS_TERMIOS -ACE_HAS_THREAD_SAFE_ACCEPT -ACE_LACKS_COND_TIMEDWAIT_RESET -ACE_LACKS_MSG_ACCRIGHTS -ACE_LACKS_NETDB_REENTRANT_FUNCTIONS - -Why don't we have alloca.h? - */ - -#include /**/ - -extern "C" -{ - int getopt (int, char *const *, const char *); -} - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sco-4.2-nothread.h b/ace/config-sco-4.2-nothread.h deleted file mode 100644 index 67ff29a6333..00000000000 --- a/ace/config-sco-4.2-nothread.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SCO UNIX -// version 4.2 without threads. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" - // This config file has not been tested with ACE_HAS_TEMPLATE_SPECIALIZATION. - // Maybe it will work? -# undef ACE_HAS_TEMPLATE_SPECIALIZATION -#endif /* __GNUG__ */ - -// Compiling for SCO. -#if !defined (SCO) -#define SCO -#endif /* SCO */ - -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0 - -#if defined (SCO) && !defined (MAXPATHLEN) -#define MAXPATHLEN 1023 -#endif /* SCO */ - -#define ACE_HAS_SIG_MACROS -#define ACE_LACKS_UNIX_DOMAIN_SOCKETS -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_MMAP -#define ACE_LACKS_SOCKETPAIR -#define ACE_HAS_SEMUN -#define ACE_LACKS_MSYNC -#define ACE_LACKS_MADVISE -#define ACE_LACKS_WRITEV -#define ACE_LACKS_READV -#define ACE_NEEDS_FTRUNCATE -#define ACE_LACKS_RLIMIT -#define ACE_LACKS_RECVMSG -#define ACE_LACKS_SENDMSG - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform supports recvmsg and sendmsg. -//#define ACE_HAS_MSG - -// Compiler/platform contains the file. -//#define ACE_HAS_SYS_SYSCALL_H - -// Fixes a problem with HP/UX not wrapping the mmap(2) header files -// with extern "C". -//#define ACE_HAS_BROKEN_MMAP_H - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Header files lack t_errno for ACE_TLI. -//#define ACE_LACKS_T_ERRNO - -// Compiler/platform supports poll(). -#define ACE_HAS_POLL - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler supports the ssize_t typedef. -//#define ACE_HAS_SSIZE_T - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Platform/compiler supports void * as second parameter to gettimeofday(). -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY - -// Note, this only works if the flag is set above! -//#define ACE_HAS_GETRUSAGE - -// Platform uses int for select() rather than fd_set. -#define ACE_SELECT_USES_INT - -// Platform has prototypes for ACE_TLI. -//#define ACE_HAS_TLI_PROTOTYPES -// Platform has the XLI version of ACE_TLI. -// #define ACE_HAS_XLI - -#define ACE_HAS_GNU_CSTRING_H - -#define ACE_HAS_DIRENT - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sco-5.0.0-fsu-pthread.h b/ace/config-sco-5.0.0-fsu-pthread.h deleted file mode 100644 index 6d94c55d3a8..00000000000 --- a/ace/config-sco-5.0.0-fsu-pthread.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#include "ace/config-g++-common.h" -#include "ace/config-sco-5.0.0.h" -#include "ace/config-fsu-pthread.h" - -#define ACE_HAS_GNU_CSTRING_H - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sco-5.0.0-mit-pthread.h b/ace/config-sco-5.0.0-mit-pthread.h deleted file mode 100644 index bfc938a9213..00000000000 --- a/ace/config-sco-5.0.0-mit-pthread.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SCO UNIX -// version 5.0 with MIT pthreads. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if !defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" - // This config file has not been tested with ACE_HAS_TEMPLATE_SPECIALIZATION. - // Maybe it will work? -# undef ACE_HAS_TEMPLATE_SPECIALIZATION -#endif /* __GNUG__ */ - -// Compiling for SCO. -#if !defined (SCO) -#define SCO -#define _SVID3 -#endif /* SCO */ - -#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0 -#define ACE_HAS_SIG_MACROS -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#if defined (SCO) && !defined (MAXPATHLEN) -#define MAXPATHLEN 1023 -#endif /* SCO */ - -#define ACE_LACKS_PWD_FUNCTIONS -#define ACE_HAS_BIG_FD_SET - -//#define ACE_LACKS_SYSCALL -//#define ACE_LACKS_STRRECVFD -//#define ACE_NEEDS_FTRUNCATE -#define ACE_LACKS_RLIMIT -#define ACE_LACKS_MADVISE - -#define ACE_HAS_REENTRANT_FUNCTIONS - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_NONCONST_MSGSND -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -//#define ACE_HAS_SYS_SYSCALL_H - -// Fixes a problem with HP/UX not wrapping the mmap(2) header files -// with extern "C". -//#define ACE_HAS_BROKEN_MMAP_H - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Header files lack t_errno for ACE_TLI. -//#define ACE_LACKS_T_ERRNO - -// Compiler/platform supports poll(). -// #define ACE_HAS_POLL - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler supports the ssize_t typedef. -//#define ACE_HAS_SSIZE_T - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// ??? -// #define ACE_HAS_VOIDPTR_GETTIMEOFDAY -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Note, this only works if the flag is set above! -//#define ACE_HAS_GETRUSAGE - -// Platform uses int for select() rather than fd_set. -#define ACE_HAS_SELECT_H - -// Platform has prototypes for ACE_TLI. -#define ACE_HAS_TLI -//#define ACE_HAS_SVR4_TLI -#define ACE_HAS_TLI_PROTOTYPES -#define ACE_HAS_TIMOD_H -#define ACE_HAS_TIUSER_H -#define ACE_LACKS_T_ERRNO - -// Platform has the XLI version of ACE_TLI. -// #define ACE_HAS_XLI - -#define ACE_HAS_GNU_CSTRING_H - -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -#define ACE_HAS_INLINED_OSCALLS - -#define ACE_HAS_STRBUF_T -#define ACE_HAS_STREAMS -//#define ACE_HAS_STREAM_PIPES -#define ACE_HAS_IP_MULTICAST - -// Threads -#define ACE_HAS_THREADS -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREADS_STD -#define ACE_LACKS_PTHREAD_CANCEL -#define ACE_HAS_SIGWAIT -#define ACE_LACKS_THREAD_PROCESS_SCOPING -//#define ACE_LACKS_THREAD_STACK_ADDR -// If ACE doesn't compile due to the lack of these methods, please -// send email to schmidt@cs.wustl.edu reporting this. -// #define ACE_LACKS_CONDATTR_PSHARED -// #define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SETSCHED -#define ACE_HAS_POSIX_TIME - -#include -#include - -#define ACE_LACKS_TIMEDWAIT_PROTOTYPES -#define ACE_HAS_RECV_TIMEDWAIT -#define ACE_HAS_RECVFROM_TIMEDWAIT -#define ACE_HAS_RECVMSG_TIMEDWAIT -#define ACE_HAS_SEND_TIMEDWAIT -#define ACE_HAS_SENDTO_TIMEDWAIT -#define ACE_HAS_SENDMSG_TIMEDWAIT -#define ACE_HAS_READ_TIMEDWAIT -#define ACE_HAS_READV_TIMEDWAIT -#define ACE_HAS_WRITE_TIMEDWAIT -#define ACE_HAS_WRITEV_TIMEDWAIT -#define ACE_HAS_DIRENT - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sco-5.0.0-nothread.h b/ace/config-sco-5.0.0-nothread.h deleted file mode 100644 index 5c7b0b06c0f..00000000000 --- a/ace/config-sco-5.0.0-nothread.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#include "ace/config-g++-common.h" -#include "ace/config-sco-5.0.0.h" - -#define ACE_HAS_GNU_CSTRING_H - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sco-5.0.0.h b/ace/config-sco-5.0.0.h deleted file mode 100644 index c155651a29a..00000000000 --- a/ace/config-sco-5.0.0.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_CONFIG_SCO_5_0_0_H -#define ACE_CONFIG_SCO_5_0_0_H -#include /**/ "ace/pre.h" - -// Compiling for SCO. -#if !defined (SCO) -#define SCO -#endif /* SCO */ - -#if defined (SCO) && !defined (MAXPATHLEN) -#define MAXPATHLEN 1023 -#endif /* SCO */ - -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_SIG_MACROS -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_STRRECVFD -#define ACE_NEEDS_FTRUNCATE -#define ACE_LACKS_MADVISE -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS - -#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0 - -// Compiler doesn't support static data member templates. -//#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_NONCONST_MSGSND -#define ACE_HAS_BIG_FD_SET -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Compiler/platform contains the file. -//#define ACE_HAS_SYS_SYSCALL_H - -// Fixes a problem with HP/UX not wrapping the mmap(2) header files -// with extern "C". -//#define ACE_HAS_BROKEN_MMAP_H - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Header files lack t_errno for ACE_TLI. -//#define ACE_LACKS_T_ERRNO - -// Compiler/platform supports poll(). -// #define ACE_HAS_POLL - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler supports the ssize_t typedef. -//#define ACE_HAS_SSIZE_T - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Note, this only works if the flag is set above! -//#define ACE_HAS_GETRUSAGE - -// Platform uses int for select() rather than fd_set. -#define ACE_HAS_SELECT_H - -// Platform has prototypes for ACE_TLI. -#define ACE_HAS_TLI_PROTOTYPES -// Platform has the XLI version of ACE_TLI. -// #define ACE_HAS_XLI - -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -#define ACE_LACKS_STRCASECMP - -// #define ACE_HAS_POSIX_TIME -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_DIRENT -#define ACE_LACKS_READDIR_R -#define ACE_HAS_GPERF - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_SCO_5_0_0_H */ diff --git a/ace/config-suncc-common.h b/ace/config-suncc-common.h deleted file mode 100644 index 707d93ca83d..00000000000 --- a/ace/config-suncc-common.h +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#ifndef ACE_SUNCC_COMMON_H -#define ACE_SUNCC_COMMON_H -#include /**/ "ace/pre.h" - -# define ACE_HAS_CPLUSPLUS_HEADERS -# define ACE_HAS_STDCPP_STL_INCLUDES -# define ACE_HAS_TEMPLATE_TYPEDEFS -# define ACE_HAS_TYPENAME_KEYWORD -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_HAS_TEMPLATE_SPECIALIZATION -# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# define ACE_HAS_STRING_CLASS -# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS -# define ACE_HAS_THR_C_DEST 1 -# define ACE_LACKS_SWAB -#if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 -# undef ACE_HAS_CUSTOM_EXPORT_MACROS -#else -# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS -# define ACE_HAS_CUSTOM_EXPORT_MACROS -# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ -# define ACE_Proper_Export_Flag __attribute__ ((visibility("default"))) -# define ACE_Proper_Import_Flag -# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T -# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE ; -# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T -# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE; -#endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ - -// __EXCEPTIONS is defined with -fexceptions, the egcs default. It -// is not defined with -fno-exceptions, the ACE default for g++. -// ACE_HAS_EXCEPTIONS is defined in -// include/makeinclude/wrapper_macros.GNU, so this really isn't -// necessary. Just in case . . . -# if defined (__EXCEPTIONS) && !defined (ACE_HAS_EXCEPTIONS) -# define ACE_HAS_EXCEPTIONS -# endif /* __EXCEPTIONS && ! ACE_HAS_EXCEPTIONS */ - -# if defined (ACE_HAS_EXCEPTIONS) -# define ACE_NEW_THROWS_EXCEPTIONS -# endif /* ACE_HAS_EXCEPTIONS */ - -#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE) -# define ACE_SIZEOF_LONG_DOUBLE 12 -#endif /* i386 */ - -#if defined (i386) || defined (__i386__) - // If running an Intel, assume that it's a Pentium so that - // ACE_OS::gethrtime () can use the RDTSC instruction. If running a - // 486 or lower, be sure to comment this out. (If not running an - // Intel CPU, this #define will not be seen because of the i386 - // protection, so it can be ignored.) -# define ACE_HAS_PENTIUM -#endif /* i386 */ - -#if !defined (ACE_LACKS_PRAGMA_ONCE) - // We define it with a -D with make depend. -# define ACE_LACKS_PRAGMA_ONCE -#endif /* ! ACE_LACKS_PRAGMA_ONCE */ - -#define ACE_TEMPLATES_REQUIRE_SOURCE - -#include /**/ "ace/post.h" -#endif /* ACE_SUNCC_COMMON_H */ diff --git a/ace/config-sunos4-g++.h b/ace/config-sunos4-g++.h deleted file mode 100644 index 76eb7d0e0e5..00000000000 --- a/ace/config-sunos4-g++.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// for SunOS4 platforms using the GNU g++ compiler - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so -// this must appear before its #include. -#define ACE_HAS_STRING_CLASS - -#include "ace/config-g++-common.h" -// This config file has not been tested with ACE_HAS_TEMPLATE_SPECIALIZATION. -// Maybe it will work? -#undef ACE_HAS_TEMPLATE_SPECIALIZATION - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID - -#define ACE_HAS_CHARPTR_SPRINTF -#define ACE_HAS_UNION_WAIT - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Compiler/platform supports strerror (). -// #define ACE_HAS_STRERROR -#define ACE_HAS_SYS_ERRLIST - -// Header files lack t_errno for ACE_TLI. -// #define ACE_LACKS_T_ERRNO - -// Compiler/platform uses old malloc()/free() prototypes (ugh). -#define ACE_HAS_OLD_MALLOC - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Compiler/platform supports poll(). -#define ACE_HAS_POLL - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler/platform supports struct strbuf -#define ACE_HAS_STRBUF_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H -// Platform supports ACE_TLI tiuser header. -// #define ACE_HAS_TIUSER_H - -// Platform has ACE_TLI. -// #define ACE_HAS_TLI - -#define ACE_LACKS_U_LONGLONG_T - -#define ACE_LACKS_DIFFTIME -#define ACE_HAS_DIRENT - -#define ACE_HAS_SUNOS4_SIGNAL_T -#define ACE_HAS_CPLUSPLUS_HEADERS -#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)) -#define ACE_HAS_SYSENT_H -#endif -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA -// Compiler/platform has -#define ACE_HAS_ALLOCA_H -#define ACE_HAS_SVR4_GETTIMEOFDAY - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos4-lucid3.2.h b/ace/config-sunos4-lucid3.2.h deleted file mode 100644 index c4ec4919a5d..00000000000 --- a/ace/config-sunos4-lucid3.2.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work -// for SunOS4 platforms using the Lucid 3.2 compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_SYS_ERRLIST -#define ACE_HAS_CHARPTR_SPRINTF -#define ACE_HAS_UNION_WAIT - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has -#define ACE_HAS_ALLOCA_H - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Header files lack t_errno for ACE_TLI. -// #define ACE_LACKS_T_ERRNO - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Compiler/platform supports poll(). -#define ACE_HAS_POLL - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler/platform supports struct strbuf -#define ACE_HAS_STRBUF_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Compiler/platform supports strerror (). -// #define ACE_HAS_STRERROR - -// Platform/compiler supports timezone * as second parameter to gettimeofday(). -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Platform provides header. -#define ACE_HAS_SYSENT_H - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Platform supports ACE_TLI tiuser header. -// #define ACE_HAS_TIUSER_H - -// Platform has ACE_TLI. -// #define ACE_HAS_TLI - -#define ACE_NEEDS_DEV_IO_CONVERSION - -#define ACE_LACKS_U_LONGLONG_T - -#define ACE_LACKS_DIFFTIME - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos4-sun3.x.h b/ace/config-sunos4-sun3.x.h deleted file mode 100644 index 2a6fd6cde09..00000000000 --- a/ace/config-sunos4-sun3.x.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS4 -// platforms using the SunC++ 3.0.x compiler. - -#ifndef ACE_CONFIG_H - -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_UNION_WAIT -#define ACE_HAS_SPARCWORKS_401_SIGNALS - -#define ACE_CONFIG_H -#define ACE_HAS_CHARPTR_SPRINTF -#define ACE_HAS_SYS_ERRLIST - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Header files lack t_errno for ACE_TLI. -// #define ACE_LACKS_T_ERRNO - -// Compiler/platform uses old malloc()/free() prototypes (ugh). -#define ACE_HAS_OLD_MALLOC - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Compiler/platform supports poll(). -#define ACE_HAS_POLL - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler/platform supports struct strbuf -#define ACE_HAS_STRBUF_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform/compiler supports timezone * as second parameter to gettimeofday(). -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Platform supports ACE_TLI tiuser header. -// #define ACE_HAS_TIUSER_H - -// Platform has ACE_TLI. -// #define ACE_HAS_TLI - -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_SIGNED_CHAR - -#define ACE_NEEDS_DEV_IO_CONVERSION - -#define ACE_LACKS_U_LONGLONG_T - -#define ACE_LACKS_DIFFTIME - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos4-sun4.1.4.h b/ace/config-sunos4-sun4.1.4.h deleted file mode 100644 index ea612d66b70..00000000000 --- a/ace/config-sunos4-sun4.1.4.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS4.1.4 -// platforms using the SunC++ 4.x compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_CHARPTR_SPRINTF -#define ACE_HAS_UNION_WAIT - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Compiler/platform supports strerror (). -// #define ACE_HAS_STRERROR -#define ACE_HAS_SYS_ERRLIST - -// Header files lack t_errno for ACE_TLI. -// #define ACE_LACKS_T_ERRNO - -// Compiler/platform uses old malloc()/free() prototypes (ugh). -#define ACE_HAS_OLD_MALLOC - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Compiler/platform supports poll(). -#define ACE_HAS_POLL - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler has brain-damaged SPARCwork signal prototype... -#define ACE_HAS_SPARCWORKS_401_SIGNALS - -// Compiler/platform supports struct strbuf -#define ACE_HAS_STRBUF_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform/compiler supports timezone * as second parameter to gettimeofday(). -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Platform supports ACE_TLI tiuser header. -// #define ACE_HAS_TIUSER_H - -// Platform has ACE_TLI. -// #define ACE_HAS_TLI - -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_SIGNED_CHAR - -#define ACE_NEEDS_DEV_IO_CONVERSION - -#define ACE_LACKS_U_LONGLONG_T - -#define ACE_LACKS_DIFFTIME - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos4-sun4.x.h b/ace/config-sunos4-sun4.x.h deleted file mode 100644 index 034b6011315..00000000000 --- a/ace/config-sunos4-sun4.x.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work -// for SunOS4 platforms using the SunC++ 4.x compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID - -#define ACE_HAS_CHARPTR_SPRINTF - -// Maximum compensation (10 ms) for early return from timed ::select (). -#if !defined (ACE_TIMER_SKEW) -# define ACE_TIMER_SKEW 10 * 1000 -#endif /* ACE_TIMER_SKEW */ - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Compiler/platform supports strerror (). -// #define ACE_HAS_STRERROR -#define ACE_HAS_SYS_ERRLIST - -// Header files lack t_errno for ACE_TLI. -// #define ACE_LACKS_T_ERRNO - -// Compiler/platform uses old malloc()/free() prototypes (ugh). -#define ACE_HAS_OLD_MALLOC - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -// Compiler/platform supports poll(). -#define ACE_HAS_POLL - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler has brain-damaged SPARCwork signal prototype... -#define ACE_HAS_SPARCWORKS_401_SIGNALS - -// Compiler/platform supports struct strbuf -#define ACE_HAS_STRBUF_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform/compiler supports timezone * as second parameter to gettimeofday(). -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Platform supports ACE_TLI tiuser header. -// #define ACE_HAS_TIUSER_H - -// Platform has ACE_TLI. -// #define ACE_HAS_TLI - -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_SIGNED_CHAR - -#define ACE_NEEDS_DEV_IO_CONVERSION - -#define ACE_LACKS_U_LONGLONG_T - -#define ACE_LACKS_DIFFTIME - -// 10 millisecond fudge factor to account for Solaris timers... -#if !defined (ACE_TIMER_SKEW) -#define ACE_TIMER_SKEW 1000 * 10 -#endif /* ACE_TIMER_SKEW */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.10.h b/ace/config-sunos5.10.h deleted file mode 100644 index 3258d03da19..00000000000 --- a/ace/config-sunos5.10.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS 5.10 -// (Solaris 10) platforms using the SunC++ 5.x (Sun Studio 8-10), or g++ -// compilers. - -#ifndef ACE_CONFIG_H - -// ACE_CONFIG_H is defined by one of the following #included headers. - -// #include the SunOS 5.9 config, then add any SunOS 5.10 updates below. -#include "ace/config-sunos5.9.h" - -#define ACE_HAS_SCANDIR - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.4-centerline-2.x.h b/ace/config-sunos5.4-centerline-2.x.h deleted file mode 100644 index 2aa9e407c43..00000000000 --- a/ace/config-sunos5.4-centerline-2.x.h +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS 5.4 -// platforms using the Centerline 2.x C++ compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define ACE_HAS_TEMPLATE_SPECIALIZATION - -// Platform supports pread() and pwrite() -#define ACE_HAS_P_READ_WRITE - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Sun has the wrong prototype for sendmsg. -#define ACE_HAS_NONCONST_SENDMSG - -// The SunOS 5.x version of rand_r is inconsistent with the header files... -#define ACE_HAS_BROKEN_RANDR - -// Platform supports system configuration information. -#define ACE_HAS_SYSINFO - -// Platform supports the POSIX regular expression library -#define ACE_HAS_REGEX - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform supports SunOS high resolution timers. -#define ACE_HAS_HI_RES_TIMER - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Platform contains . -#define ACE_HAS_POLL - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -// Platform supports the prusage_t struct. -#define ACE_HAS_PRUSAGE_T - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes. -#define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform supports SVR4 signal typedef. -#define ACE_HAS_SVR4_SIGNAL_T - -// Platform lacks pthread_sigaction -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK - -// Compiler/platform supports SVR4 ACE_TLI (in particular, T_GETNAME stuff)... -#define ACE_HAS_SVR4_TLI - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Compiler/platform supports sys_siglist array. -#define ACE_HAS_SYS_SIGLIST - -/* Turn off the following defines if you want to disable threading. */ -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -// Platform supports threads. -#define ACE_HAS_THREADS - -// Platform supports Solaris threads. -#define ACE_HAS_STHREADS - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Platform supports reentrant functions (i.e., all the POSIX *_r functions). -#define ACE_HAS_REENTRANT_FUNCTIONS - -/* end threading defines */ - -#define ACE_HAS_PRIOCNTL -#define ACE_NEEDS_LWP_PRIO_SET - -// Platform supports ACE_TLI timod STREAMS module. -#define ACE_HAS_TIMOD_H - -// Platform supports ACE_TLI tiuser header. -#define ACE_HAS_TIUSER_H - -// Platform provides ACE_TLI function prototypes. -#define ACE_HAS_TLI_PROTOTYPES - -// Platform supports ACE_TLI. -#define ACE_HAS_TLI - -#define ACE_NEEDS_DEV_IO_CONVERSION - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 -#define ACE_HAS_IDTYPE_T -#define ACE_HAS_DIRENT - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.4-g++.h b/ace/config-sunos5.4-g++.h deleted file mode 100644 index 8530ebdecde..00000000000 --- a/ace/config-sunos5.4-g++.h +++ /dev/null @@ -1,180 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS 5.4 -// platforms using the GNU g++ compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so -// this must appear before its #include. -#define ACE_HAS_STRING_CLASS - -#include "ace/config-g++-common.h" -#define ACE_HAS_GNU_CSTRING_H - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform supports pread() and pwrite() -#define ACE_HAS_P_READ_WRITE - -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Sun has the wrong prototype for sendmsg. -#define ACE_HAS_NONCONST_SENDMSG - -// The SunOS 5.x version of rand_r is inconsistent with the header files... -#define ACE_HAS_BROKEN_RANDR - -// Platform supports system configuration information. -#define ACE_HAS_SYSINFO - -// Platform supports the POSIX regular expression library -#define ACE_HAS_REGEX - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform supports SunOS high resolution timers. -#define ACE_HAS_HI_RES_TIMER - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has -#define ACE_HAS_ALLOCA_H - -// Platform contains . -#define ACE_HAS_POLL - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -// Platform supports the prusage_t struct. -#define ACE_HAS_PRUSAGE_T - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes. -#define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform supports SVR4 gettimeofday() prototype. -#define ACE_HAS_SVR4_GETTIMEOFDAY - -// Platform lacks pthread_sigaction -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK - -// Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... -#define ACE_HAS_SVR4_TLI - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Compiler/platform supports sys_siglist array. -#define ACE_HAS_SYS_SIGLIST - -/* Turn off the following defines if you want to disable threading. */ -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -# if !defined (_REENTRANT) -# define _REENTRANT -# endif /* _REENTRANT */ -#endif /* !ACE_MT_SAFE */ - -// Platform supports Solaris threads. -#define ACE_HAS_STHREADS - -// Platform supports threads. -#define ACE_HAS_THREADS - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Platform supports reentrant functions (i.e., all the POSIX *_r functions). -#define ACE_HAS_REENTRANT_FUNCTIONS - -/* end threading defines */ - -#define ACE_HAS_PRIOCNTL -#define ACE_NEEDS_LWP_PRIO_SET - -// Platform supports TLI timod STREAMS module. -#define ACE_HAS_TIMOD_H - -// Platform supports TLI tiuser header. -#define ACE_HAS_TIUSER_H - -// Platform provides TLI function prototypes. -#define ACE_HAS_TLI_PROTOTYPES - -// Platform supports TLI. -#define ACE_HAS_TLI - -// Use the poll() event demultiplexor rather than select(). -//#define ACE_USE_POLL - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 -#define ACE_HAS_IDTYPE_T -#define ACE_HAS_GPERF -#define ACE_HAS_DIRENT - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.4-sunc++-4.x.h b/ace/config-sunos5.4-sunc++-4.x.h deleted file mode 100644 index 882307aab64..00000000000 --- a/ace/config-sunos5.4-sunc++-4.x.h +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS 5.4 -// platforms using the SunC++ 4.0.x compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#define ACE_HAS_TEMPLATE_SPECIALIZATION - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform supports pread() and pwrite() -#define ACE_HAS_P_READ_WRITE - -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Sun has the wrong prototype for sendmsg. -#define ACE_HAS_NONCONST_SENDMSG - -// The SunOS 5.x version of rand_r is inconsistent with the header files... -#define ACE_HAS_BROKEN_RANDR - -// Platform supports system configuration information. -#define ACE_HAS_SYSINFO - -// Platform supports the POSIX regular expression library. -#define ACE_HAS_REGEX - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform supports SunOS high resolution timers. -#define ACE_HAS_HI_RES_TIMER - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has -#define ACE_HAS_ALLOCA_H - -// Platform contains . -#define ACE_HAS_POLL - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -// Platform supports the prusage_t struct. -#define ACE_HAS_PRUSAGE_T - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes. -#define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform supports SVR4 gettimeofday() prototype. -#define ACE_HAS_SVR4_GETTIMEOFDAY - -// Compiler/platform supports SVR4 signal typedef. -#define ACE_HAS_SVR4_SIGNAL_T - -// Platform lacks pthread_sigaction -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK - -// Compiler/platform supports SVR4 ACE_TLI (in particular, T_GETNAME stuff)... -#define ACE_HAS_SVR4_TLI - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Compiler/platform supports sys_siglist array. -#define ACE_HAS_SYS_SIGLIST - -/* Turn off the following defines if you want to disable threading. */ -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -// Platform supports Solaris threads. -#define ACE_HAS_STHREADS - -// Platform supports threads. -#define ACE_HAS_THREADS - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Platform supports reentrant functions (i.e., all the POSIX *_r functions). -#define ACE_HAS_REENTRANT_FUNCTIONS - -/* end threading defines */ - -#define ACE_HAS_PRIOCNTL -#define ACE_NEEDS_LWP_PRIO_SET - -// Reactor detects deadlock -// #define ACE_REACTOR_HAS_DEADLOCK_DETECTION - -// Platform supports ACE_TLI timod STREAMS module. -#define ACE_HAS_TIMOD_H - -// Platform supports ACE_TLI tiuser header. -#define ACE_HAS_TIUSER_H - -// Platform provides ACE_TLI function prototypes. -#define ACE_HAS_TLI_PROTOTYPES - -// Platform supports ACE_TLI. -#define ACE_HAS_TLI - -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_SIGNED_CHAR - -// Use the poll() event demultiplexor rather than select(). -//#define ACE_USE_POLL - -#define ACE_NEEDS_DEV_IO_CONVERSION - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 -#define ACE_HAS_IDTYPE_T - -#define ACE_HAS_GPERF -#define ACE_HAS_DIRENT - -# if defined (ACE_HAS_EXCEPTIONS) - // If exceptions are enabled and we are using Sun/CC then - // throws an exception instead of returning 0. -# define ACE_NEW_THROWS_EXCEPTIONS -# endif /* ACE_HAS_EXCEPTIONS */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.5.h b/ace/config-sunos5.5.h deleted file mode 100644 index 1276d00ba66..00000000000 --- a/ace/config-sunos5.5.h +++ /dev/null @@ -1,405 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// This configuration file is designed to work for SunOS 5.5 platforms -// using the following compilers: -// * Sun C++ 4.2 and later (including 5.x), patched as noted below -// * g++ 2.7.2 and later, including egcs -// * Green Hills 1.8.8 and later - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define ACE_LACKS_STDINT_H - -// SunOS 5.5 does not provide getloadavg() -#define ACE_LACKS_GETLOADAVG - -// Before we do anything, we should include to -// ensure that things are set up properly. -#include - -// Sun has the posix defines so let this file sort out what Sun delivers -#include "ace/config-posix.h" - -// Compiler version-specific settings: -#if defined (__SUNPRO_CC) -# if (__SUNPRO_CC < 0x410) - // The following might not be necessary, but I can't tell: my build - // with Sun C++ 4.0.1 never completes. -# define ACE_NEEDS_DEV_IO_CONVERSION -# elif (__SUNPRO_CC >= 0x420) -# if (__SUNPRO_CC >= 0x500) - // string.h and memory.h conflict for memchr definitions -# define ACE_LACKS_MEMORY_H - // Sun C++ 5.0 supports the `using' and `typename' keywords. -# define ACE_HAS_TYPENAME_KEYWORD - // If -compat=4 is turned on, the old 4.2 settings for iostreams are used, - // but the newer, explicit instantiation is used (above) -# if (__SUNPRO_CC_COMPAT >= 5) -# define ACE_HAS_TEMPLATE_TYPEDEFS -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# define ACE_HAS_THR_C_DEST -# endif /* __SUNPRO_CC_COMPAT >= 5 */ -# if defined (ACE_HAS_EXCEPTIONS) -# define ACE_HAS_NEW_NOTHROW -# else - // See /opt/SUNWspro_5.0/SC5.0/include/CC/stdcomp.h: -# define _RWSTD_NO_EXCEPTIONS 1 -# endif /* ! ACE_HAS_EXCEPTIONS */ -# elif (__SUNPRO_CC == 0x420) || (__SUNPRO_CC == 0x410) -# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE -# endif /* __SUNPRO_CC >= 0x500 */ -# endif /* __SUNPRO_CC >= 0x420 */ - -# define ACE_CAST_CONST const -# define ACE_HAS_HI_RES_TIMER -# define ACE_HAS_SIG_C_FUNC /* Sun CC 5.0 needs this, 4.2 doesn't mind. */ -# define ACE_HAS_TEMPLATE_SPECIALIZATION -# define ACE_HAS_XPG4_MULTIBYTE_CHAR -# define ACE_LACKS_LINEBUFFERED_STREAMBUF -# define ACE_LACKS_SIGNED_CHAR - - // ACE_HAS_EXCEPTIONS precludes -noex in - // include/makeinclude/platform_macros.GNU. But beware, we have - // seen problems with exception handling on multiprocessor - // UltraSparcs: threaded executables core dump when threads exit. - // This problem does not seem to appear on single-processor UltraSparcs. - // And, it is solved with the application of patch - // 104631-02 "C++ 4.2: Jumbo Patch for C++ 4.2 on Solaris SPARC" - // to Sun C++ 4.2. - // To provide optimum performance, ACE_HAS_EXCEPTIONS is disabled by - // default. It can be enabled by adding "exceptions=1" to the "make" - // invocation. See include/makeinclude/platform_sunos5_sunc++.GNU - // for details. - -# if defined (ACE_HAS_EXCEPTIONS) - // If exceptions are enabled and we are using Sun/CC then - // throws an exception instead of returning 0. -# define ACE_NEW_THROWS_EXCEPTIONS -# endif /* ACE_HAS_EXCEPTIONS */ - - /* If you want to disable threading with Sun CC, remove -mt - from your CFLAGS, e.g., using make threads=0. */ - - -// Take advantage of Sun Studio 8 (Sun C++ 5.5) or better symbol -// visibility to generate improved shared library binaries. -# if (__SUNPRO_CC > 0x540) - -# if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 -# undef ACE_HAS_CUSTOM_EXPORT_MACROS -# else -# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS -# define ACE_HAS_CUSTOM_EXPORT_MACROS -# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ -# define ACE_Proper_Export_Flag __symbolic -# define ACE_Proper_Import_Flag __global - -# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T -# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE ; - -// # define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T -// # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE; - -# endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ -# endif /* __SUNPRO_CC > 0x540 (> Sun C++ 5.4) */ - -#elif defined (__GNUG__) - // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so - // this must appear before its #include. -# define ACE_HAS_STRING_CLASS -# include "ace/config-g++-common.h" -# define ACE_HAS_HI_RES_TIMER - // Denotes that GNU has cstring.h as standard, to redefine memchr(). -# define ACE_HAS_GNU_CSTRING_H -# define ACE_HAS_XPG4_MULTIBYTE_CHAR - -# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0 - // ACE_MT_SAFE is #defined below, for all compilers. -# if !defined (_REENTRANT) - /* If you want to disable threading, comment out the following - line. Or, add -DACE_MT_SAFE=0 to your CFLAGS, e.g., using - make threads=0. */ -# define _REENTRANT -# endif /* _REENTRANT */ -# endif /* !ACE_MT_SAFE */ - -#elif defined (ghs) - -# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0 - // ACE_MT_SAFE is #defined below, for all compilers. -# if !defined (_REENTRANT) - /* If you want to disable threading, comment out the following - line. Or, add -DACE_MT_SAFE=0 to your CFLAGS, e.g., using - make threads=0. */ -# define _REENTRANT -# endif /* _REENTRANT */ -# endif /* !ACE_MT_SAFE */ - -# define ACE_CONFIG_INCLUDE_GHS_COMMON -# include "ace/config-ghs-common.h" - - // To avoid warning about inconsistent declaration between Sun's - // stdlib.h and Green Hills' ctype.h. -# include - - // IOStream_Test never halts with Green Hills 1.8.9. -# define ACE_LACKS_ACE_IOSTREAM - -#else /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */ -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler in ace/config-sunos5.5.h -# endif /* __cplusplus */ -#endif /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */ - -#if !defined (__ACE_INLINE__) -// @note If you have link problems with undefined inline template -// functions with Sun C++, be sure that the #define of __ACE_INLINE__ -// below is not commented out. -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// Platform supports the POSIX regular expression library. -// @note Please comment out the ACE_HAS_REGEX #define if you -// have link problems with g++ or egcs on SunOS 5.5. -#define ACE_HAS_REGEX - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// select()'s timeval arg is not declared as const and may be modified -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -// Platform supports pread() and pwrite() -#define ACE_HAS_P_READ_WRITE -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -#define ACE_HAS_UALARM -#define ACE_LACKS_UALARM_PROTOTYPE - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Platform supports system configuration information. -#define ACE_HAS_SYSINFO - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Compiler/platform correctly calls init()/fini() for shared libraries. -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// This setting was determined by running the autoconf tests. If it doesn't -// work uniformly, will need some tweaking, possibly based on other -// XPG feature-test macros. -#define ACE_HAS_CONST_CHAR_SWAB - -// Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has -#define ACE_HAS_ALLOCA_H - -// Platform contains . -#define ACE_HAS_POLL - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// ACE_HAS_CLOCK_GETTIME requires linking with -lposix4. -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -// Platform supports the prusage_t struct. -#define ACE_HAS_PRUSAGE_T - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -// Compiler/platform provides the sockio.h file. -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform supports STREAM pipes. -#define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports strerror (). -#define ACE_HAS_STRERROR - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Compiler/platform supports SVR4 gettimeofday() prototype. -#define ACE_HAS_SVR4_GETTIMEOFDAY - -// Compiler/platform supports SVR4 ACE_TLI (in particular, T_GETNAME stuff)... -#define ACE_HAS_SVR4_TLI - -// Platform provides header. -#define ACE_HAS_SYS_FILIO_H - -// Compiler/platform supports sys_siglist array. -#define ACE_HAS_SYS_SIGLIST - -// SunOS 5.5.x does not support mkstemp -#define ACE_LACKS_MKSTEMP -#define ACE_LACKS_SYS_SYSCTL_H - -#if !(defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)) -# define ACE_HAS_CHARPTR_SHMDT -#endif - -// Platform has posix getpwnam_r -#if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE - 0 >= 199506L) || \ - defined(_POSIX_PTHREAD_SEMANTICS) -# define ACE_HAS_POSIX_GETPWNAM_R -#endif /* _POSIX_C_SOURCE || _POSIX_PTHREAD_SEMANTICS */ - -#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE == 1) -#if defined (_REENTRANT) || \ - (defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) || \ - defined (_POSIX_PTHREAD_SEMANTICS) - // Compile using multi-thread libraries. -# define ACE_HAS_THREADS - -# if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -# endif /* ACE_MT_SAFE */ - - // Platform supports POSIX pthreads *and* Solaris threads, by - // default! If you only want to use POSIX pthreads, add - // -D_POSIX_PTHREAD_SEMANTICS to your CFLAGS. Or, #define it right - // here. See the Intro (3) man page for information on - // -D_POSIX_PTHREAD_SEMANTICS. -# if defined (_POSIX_PTHREAD_SEMANTICS) -# define ACE_LACKS_RWLOCK_T -# else -# define ACE_HAS_STHREADS -# endif /* ! _POSIX_PTHREAD_SEMANTICS */ - -# define ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD - // . . . but only supports SCHED_OTHER scheduling policy -# define ACE_HAS_ONLY_SCHED_OTHER -# define ACE_HAS_SIGWAIT -# define ACE_HAS_SIGTIMEDWAIT -# define ACE_HAS_SIGSUSPEND - - // Compiler/platform has thread-specific storage -# define ACE_HAS_THREAD_SPECIFIC_STORAGE - - // Platform supports reentrant functions (i.e., all the POSIX *_r functions). -# define ACE_HAS_REENTRANT_FUNCTIONS - -# define ACE_NEEDS_LWP_PRIO_SET -# define ACE_HAS_THR_YIELD -# define ACE_LACKS_PTHREAD_YIELD -#endif /* _REENTRANT || _POSIX_C_SOURCE >= 199506L || \ - _POSIX_PTHREAD_SEMANTICS */ -#endif /* !ACE_MT_SAFE || ACE_MT_SAFE == 1 */ - -# define ACE_HAS_PRIOCNTL - -// Platform supports ACE_TLI timod STREAMS module. -#define ACE_HAS_TIMOD_H - -// Platform supports ACE_TLI tiuser header. -#define ACE_HAS_TIUSER_H - -// Platform provides ACE_TLI function prototypes. -#define ACE_HAS_TLI_PROTOTYPES - -// Platform has broken t_error() prototype. -#define ACE_HAS_BROKEN_T_ERROR - -// Platform supports ACE_TLI. -#define ACE_HAS_TLI - -#define ACE_HAS_GETPAGESIZE 1 - -#define ACE_HAS_STL_MAP_CONFLICT - -// Sieg - gcc 2.95.1 declares queue in stream.h. Might want to change -// the == to >= to allow for future versions -#if !( __GNUG__ && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95) ) -#define ACE_HAS_STL_QUEUE_CONFLICT -#endif /* !( __GNUG__ && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95) ) */ -#define ACE_HAS_IDTYPE_T - -#define ACE_HAS_GPERF -#define ACE_HAS_DIRENT -#define ACE_HAS_MEMCHR - -#if defined (__SUNPRO_CC) -# define ACE_CC_NAME ACE_LIB_TEXT ("SunPro C++") -# define ACE_CC_MAJOR_VERSION (__SUNPRO_CC >> 8) -# define ACE_CC_MINOR_VERSION (__SUNPRO_CC & 0x00ff) -# define ACE_CC_BETA_VERSION (0) -#elif defined (__GNUG__) -# define ACE_CC_MAJOR_VERSION __GNUC__ -# define ACE_CC_MINOR_VERSION __GNUC_MINOR__ -# define ACE_CC_BETA_VERSION (0) -# if __GNUC_MINOR__ >= 90 -# define ACE_CC_NAME ACE_LIB_TEXT ("egcs") -# else -# define ACE_CC_NAME ACE_LIB_TEXT ("g++") -# endif /* __GNUC_MINOR__ */ -#endif /* __GNUG__ */ - -#if defined (i386) -# define ACE_HAS_X86_STAT_MACROS -#endif /* i386 */ - -#define ACE_MALLOC_ALIGN 8 -#define ACE_LACKS_SETREUID_PROTOTYPE -#define ACE_LACKS_SETREGID_PROTOTYPE - -// Solaris does indeed implement the inet_aton() function, but it is -// found in `libresolv.*'. It doesn't seem worth it to link another -// library just for that function. Just use the emulation in ACE that -// has been used for years. -#define ACE_LACKS_INET_ATON - -#if defined (_LARGEFILE_SOURCE) || (_FILE_OFFSET_BITS==64) -#undef ACE_HAS_PROC_FS -#undef ACE_HAS_PRUSAGE_T -#endif /* (_LARGEFILE_SOURCE) || (_FILE_OFFSET_BITS==64) */ -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.6.h b/ace/config-sunos5.6.h deleted file mode 100644 index 59eb8661926..00000000000 --- a/ace/config-sunos5.6.h +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS 5.6 -// platforms using the SunC++ 4.x or g++ compilers. - -#ifndef ACE_CONFIG_H - -// ACE_CONFIG_H is defined by one of the following #included headers. - -// #include the SunOS 5.5 config file, then add SunOS 5.6 updates below. - -#include "ace/config-sunos5.5.h" - -#if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 95 -// gcc-2.95 fixes this problem for us! -#undef ACE_HAS_STL_QUEUE_CONFLICT -#endif /* __GNUC__ */ - -#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE > 2) || \ - defined (__EXTENSIONS__) -// The asctime_r/ctime_r parameters change at POSIX.1c-1995 -# if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199506L) -# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -# endif /* POSIX_C_SOURCE >= 199506L */ -# define ACE_HAS_SIGWAIT -// Hack 'cuz _POSIX_C_SOURCE > 2 and -DEXTENSIONS hides this. -# define ACE_LACKS_MADVISE_PROTOTYPE -#endif /* _POSIX_C_SOURCE > 2 || __EXTENSIONS__ */ - -// Support for the SunC++ 5.2 compiler. -// Do not undefine for compat mode < 5 -#if defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510 -#if defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT >= 5) -#ifdef ACE_LACKS_ACE_IOSTREAM -#undef ACE_LACKS_ACE_IOSTREAM -#endif /* ACE_LACKS_ACE_IOSTREAM */ -#endif /* defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT >= 5) */ - -#ifndef ACE_LACKS_UNBUFFERED_STREAMBUF -#define ACE_LACKS_UNBUFFERED_STREAMBUF 1 -#endif /* ACE_LACKS_UNBUFFERED_STREAMBUF */ -#ifndef ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_TEMPLATES_REQUIRE_SOURCE 1 -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ -#ifndef ACE_HAS_TEMPLATE_TYPEDEFS -#define ACE_HAS_TEMPLATE_TYPEDEFS 1 -#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ -// Forte 7 seems to botch this one... -#if __SUNPRO_CC == 0x540 -#undef ACE_HAS_TEMPLATE_TYPEDEFS -#endif -#ifndef ACE_HAS_TYPENAME_KEYWORD -#define ACE_HAS_TYPENAME_KEYWORD 1 -#endif /* ACE_HAS_TYPENAME_KEYWORD */ -#ifndef ACE_HAS_THR_C_DEST -#define ACE_HAS_THR_C_DEST 1 -#endif /* ACE_HAS_THR_C_DEST */ -#ifndef ACE_HAS_THR_C_FUNC -#define ACE_HAS_THR_C_FUNC 1 -#endif /* ACE_HAS_THR_C_FUNC */ -#ifndef ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 -#endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */ -#ifndef ACE_HAS_SIG_C_FUNC -#define ACE_HAS_SIG_C_FUNC 1 -#endif /* ACE_HAS_SIG_C_FUNC */ -#ifndef ACE_HAS_STDCPP_STL_INCLUDES -#define ACE_HAS_STDCPP_STL_INCLUDES 1 -#endif /* ACE_HAS_STDCPP_STL_INCLUDES */ -#ifndef ACE_HAS_STRING_CLASS -#define ACE_HAS_STRING_CLASS 1 -#endif /* ACE_HAS_STRING_CLASS */ -#ifndef ACE_HAS_STANDARD_CPP_LIBRARY -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ -#ifndef ACE_HAS_STDCPP_STL_INCLUDES -#define ACE_HAS_STDCPP_STL_INCLUDES 1 -#endif /* ACE_HAS_STDCPP_STL_INCLUDES */ -#ifndef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ -#ifndef ACE_HAS_TEMPLATE_SPECIALIZATION -#define ACE_HAS_TEMPLATE_SPECIALIZATION 1 -#endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ -#ifndef ACE_LACKS_IOSTREAM_FX -#define ACE_LACKS_IOSTREAM_FX 1 -#endif /* ACE_LACKS_IOSTREAM_FX */ -#ifndef ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 -#endif /* ACE_LACKS_LINEBUFFERED_STREAMBUF */ - -#endif /* defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510 */ - -// SunOS 5.6 and above support mkstemp -#undef ACE_LACKS_MKSTEMP - - -// SunOS 5.6 has AIO calls. -#if !defined (ACE_HAS_AIO_CALLS) -#define ACE_HAS_AIO_CALLS -#endif /* ACE_HAS_AIO_CALLS */ - -#if !defined (ACE_HAS_POSIX_REALTIME_SIGNALS) -#define ACE_HAS_POSIX_REALTIME_SIGNALS -#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ - -#if !defined (ACE_HAS_POSIX_MESSAGE_PASSING) -#define ACE_HAS_POSIX_MESSAGE_PASSING -#endif /* ACE_HAS_POSIX_MESSAGE_PASSING */ - -#if !defined (ACE_HAS_POSIX_SEM) -#define ACE_HAS_POSIX_SEM -#endif /* ACE_HAS_POSIX_SEM */ - -// Sunos 5.6's aio_* with RT signals is broken. -#if !defined (ACE_POSIX_AIOCB_PROACTOR) -#define ACE_POSIX_AIOCB_PROACTOR -#endif /* ACE_POSIX_AIOCB_PROACTOR */ - -// SunOS 5.6 has a buggy select -#define ACE_HAS_LIMITED_SELECT - -// SunOS 5.6 introduced shm_open, but need to turn on POSIX.1b or higher -// to pick it up. -#if defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE > 2) -# define ACE_HAS_SHM_OPEN -#else -# undef ACE_HAS_SHM_OPEN -#endif /* _POSIX_C_SOURCE > 2 */ - -// The struct msghdr is conditional on SunOS 5.6 based on _XPG4_2 -#if defined(_XPG4_2) -# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#endif /* _XPG4_2 */ - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.7.h b/ace/config-sunos5.7.h deleted file mode 100644 index 5e8b21a6469..00000000000 --- a/ace/config-sunos5.7.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS 5.7 -// (Solaris 7) platforms using the SunC++ 4.x, 5.x, or g++ compilers. - -#ifndef ACE_CONFIG_H - -// ACE_CONFIG_H is defined by one of the following #included headers. - -// #include the SunOS 5.6 config file, then add SunOS 5.7 updates below. - -#include "ace/config-sunos5.6.h" - -// Sun began distributing with SunOS 5.7 -#define ACE_HAS_SYS_LOADAVG_H - -// SunOS 5.7 has getloadavg() -#undef ACE_LACKS_GETLOADAVG - -#if defined (__GNUG__) -# if __GNUC__ <= 2 && __GNUC_MINOR__ < 8 - // Assume that later g++ were built on SunOS 5.7, so they don't - // have these problems . . . - - // Disable the following, because g++ 2.7.2.3 can't handle it. - // Maybe later g++ versions can? -# undef ACE_HAS_XPG4_MULTIBYTE_CHAR - - // The Solaris86 g++ 2.7.2.3 sys/types.h doesn't have these . . . - typedef long t_scalar_t; /* historical versions */ - typedef unsigned long t_uscalar_t; - typedef void *timeout_id_t; -# endif /* __GNUC__ <= 2 && __GNUC_MINOR__ < 8 */ - -#elif defined (ghs) - // SunOS 5.7's /usr/include/sys/procfs_isa.h needs uint64_t, - // but /usr/include/sys/int_types.h doesn't #define it because - // _NO_LONGLONG is # -# undef ACE_HAS_PROC_FS -# undef ACE_HAS_PRUSAGE_T - -#elif defined (__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - // Wide character methods are in std:: when using SunCC 5.3 -# define ACE_WCHAR_IN_STD_NAMESPACE -#endif /* __GNUG__ || ghs */ - -// SunOS 5.7 supports SCHED_FIFO and SCHED_RR, as well as SCHED_OTHER. -#undef ACE_HAS_ONLY_SCHED_OTHER - -// SunOS 5.7 gets this right . . . -#undef ACE_HAS_BROKEN_T_ERROR - -// And doesn't need to set LWP priorities, as shown by -// performance-tests/Misc/preempt. -#undef ACE_NEEDS_LWP_PRIO_SET - -// SunOS 5.7 can support Real-Time Signals and POSIX4 AIO operations -// are supported. - -#if !defined (ACE_HAS_AIO_CALLS) -#define ACE_HAS_AIO_CALLS -#endif /* !ACE_HAS_AIO_CALLS */ - -#ifdef ACE_HAS_LIMITED_SELECT -#undef ACE_HAS_LIMITED_SELECT -#endif /* ACE_HAS_LIMITED_SELECT */ - -// SunOS 5.7 has socklen_t -#define ACE_HAS_SOCKLEN_T - -// snprintf() is available at least from Solaris 7 on. If it can be determined -// that it's also available in Solaris 2.6, this can be moved into -// config-sunos5.6.h. -#define ACE_HAS_SNPRINTF - -#if defined (__sparcv9) -#define _LP64 -#define ACE_SIZEOF_LONG 8 /* Needed to circumvent compiler bug #4294969 */ -#endif /* __sparcv9 */ - -#if (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)) /* XPG4 or XPG4v2 */ -// 2 parameter wcstok() -#else /* XPG4 or XPG4v2 */ -# define ACE_HAS_3_PARAM_WCSTOK -#endif - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.8.h b/ace/config-sunos5.8.h deleted file mode 100644 index fdaa9c3bbe2..00000000000 --- a/ace/config-sunos5.8.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS 5.8 -// (Solaris 8) platforms using the SunC++ 4.x, 5.x, 6.x, or g++ compilers. - -#ifndef ACE_CONFIG_H - -// ACE_CONFIG_H is defined by one of the following #included headers. - -// #include the SunOS 5.7 config, then add any SunOS 5.8 updates below. -#include "ace/config-sunos5.7.h" - -#undef ACE_WCHAR_IN_STD_NAMESPACE - -// This may be true for earlier Solaris versions, but I can only verify it -// for Solaris 8 and later. -#define ACE_HAS_VFWPRINTF - -// This may be true for versions prior to Solaris 8 as well, but I don't -// have any to try it on. -#if !defined (ACE_HAS_TIMEZONE) -# define ACE_HAS_TIMEZONE -#endif - -// The range of thread priorities for 5.8 differs from 5.7 in the -// minimum priority for the SCHED_OTHER policy (i.e., -// ACE_THR_PRI_OTHER_MIN) -# define ACE_THR_PRI_OTHER_MIN (long) -20 - -# if defined (_POSIX_PTHREAD_SEMANTICS) -# ifdef ACE_LACKS_RWLOCK_T -# undef ACE_LACKS_RWLOCK_T -# endif /* ACE_LACKS_RWLOCK_T */ -# endif /* _POSIX_PTHREAD_SEMANTICS */ - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.9.h b/ace/config-sunos5.9.h deleted file mode 100644 index fd2cdd82acb..00000000000 --- a/ace/config-sunos5.9.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for SunOS 5.9 -// (Solaris 9) platforms using the SunC++ 5.x (Forte 6 and 7), or g++ -// compilers. - -#ifndef ACE_CONFIG_H - -// ACE_CONFIG_H is defined by one of the following #included headers. - -// #include the SunOS 5.8 config, then add any SunOS 5.9 updates below. -#include "ace/config-sunos5.8.h" - -#define ACE_HAS_SENDFILE - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-tandem-nsk-mips-v2.h b/ace/config-tandem-nsk-mips-v2.h deleted file mode 100644 index cba5b7b8148..00000000000 --- a/ace/config-tandem-nsk-mips-v2.h +++ /dev/null @@ -1,424 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#ifndef ACE_CONFIG_NSK_H -#define ACE_CONFIG_NSK_H - -#include /**/ "ace/pre.h" - -// The following configuration file contains defines for Tandem NSK -// platform, MIPS processor, version 2 C++ compiler. - - -//========================================================================= -// Tandem NSK specific parts -//========================================================================= - - -// Disable pthread renaming of symbols such as "open" and "close" -#define _CMA_NOWRAPPERS_ 1 - -// Get Handle_Set.cpp to generate correct bit operations for NSK platform -#define ACE_TANDEM_NSK_BIT_ORDER - -// Use facilities provided by T1248 version of pthreads. -// (If not defined, will use old version of pthreads.) -#define ACE_TANDEM_T1248_PTHREADS - -// Use all available T1248 thread aware wrapper functions for providing -// non-blocking I/O. -// [@note this causes a significant performance degradation] -//#define ACE_TANDEM_T1248_PTHREADS_ALL_IO_WRAPPERS - - -// Need this include here because some symbols defined by pthreads -// (e.g. timespec_t) are needed before spthread.h is normally included -// by ACE -#ifdef ACE_TANDEM_T1248_PTHREADS -#include -#else -#include "pthread.h" -#include "dce/cma_dispatch_coop.h" -#endif - -// The following #defines are hacks to get around things -// that seem to be missing or different in Tandem land -#define NSIG 32 // missing from Signal.h - // note: on nsk TNS/R there is room in - // sigset_t for 128 signals but those - // above 31 are not valid. -typedef long fd_mask; // should be in select.h but no such file -#define NBBY 8 // must be consistent with value in sys/types.h -#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ -#define MAXNAMLEN 248 // missing from dirent.h -#define ERRMAX 4218 // from errno.h - -// Following seems to be missing from G06.20 version of standard -// pthreads includes (it appeared in older version of standard pthreads) -// (SCHED_FIFO (aka cma_c_sched_fifo) used in Dynamic_Priority_Test) -#ifdef ACE_TANDEM_T1248_PTHREADS -typedef enum CMA_T_SCHED_POLICY { - cma_c_sched_fifo = 0, - cma_c_sched_rr = 1, - cma_c_sched_throughput = 2, - cma_c_sched_background = 3, - cma_c_sched_ada_low = 4 - } cma_t_sched_policy; -#endif - -// T1248 doesn't define these constants. They're defined in spt/cma.h -// (formerly dce/cma.h), but this header is not included or provided -// by T1248 G07-AAL. -#define cma_c_prio_fifo_min 16 -#define cma_c_prio_fifo_mid 24 -#define cma_c_prio_fifo_max 31 -#define cma_c_prio_rr_min 16 -#define cma_c_prio_rr_mid 24 -#define cma_c_prio_rr_max 31 -#define cma_c_prio_through_min 8 -#define cma_c_prio_through_mid 12 -#define cma_c_prio_through_max 15 -#define cma_c_prio_back_min 1 -#define cma_c_prio_back_mid 4 -#define cma_c_prio_back_max 7 - -// Enable NSK Pluggable Protocols -#define TAO_HAS_NSKPW 1 -#define TAO_HAS_NSKFS 1 - -//========================================================================= -// Platform specific parts -//========================================================================= - -// Platform lacks getpwnam_r() methods (e.g., SGI 6.2). -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS - -// Platform/compiler lacks {get,set}rlimit() function -#define ACE_LACKS_RLIMIT - -// The platform doesn't have mmap(2) -#define ACE_LACKS_MMAP - -// Platform lacks streambuf "linebuffered ()". [C++ iostream] -#define ACE_LACKS_LINEBUFFERED_STREAMBUF - -// Use native implementation of memchr. -#define ACE_HAS_MEMCHR - -// Platform supports recvmsg and sendmsg -#define ACE_HAS_MSG - -// Platform has ACE_HAS_4_4BSD_SENDMSG_RECVMSG but its cmsghdr -// structure does not contain an 'unsigned char cmsg_data[0]' member. -#define ACE_LACKS_CMSG_DATA_MEMBER - -// Platform defines ACE_HAS_MSG, but lacks msg_accrights{,len}. -#define ACE_LACKS_MSG_ACCRIGHTS - -// Platform supports sigsuspend() -#define ACE_HAS_SIGSUSPEND - -// Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T - -// OS/compiler uses size_t * rather than int * for socket lengths -#define ACE_HAS_SIZET_SOCKET_LEN - -// OS/compiler uses void * arg 4 setsockopt() rather than const char * -#define ACE_HAS_VOIDPTR_SOCKOPT - -// The platform doesn't have mprotect(2) -#define ACE_LACKS_MPROTECT - -// Platform lacks msync() -#define ACE_LACKS_MSYNC - -// Platform does not support reentrant netdb functions (getprotobyname_r, -// getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS Platform does not support - -// Platform lacks madvise() -#define ACE_LACKS_MADVISE - -// Platform lacks pri_t -#define ACE_LACKS_PRI_T - -// Platform lacks a working sbrk() -#define ACE_LACKS_SBRK - -// Platform doesn't have syscall() prototype -#define ACE_LACKS_SYSCALL - -// Platform lacks the inet_aton() function. -#define ACE_LACKS_INET_ATON - -// Compiler/platform has Dirent iterator functions -#define ACE_HAS_DIRENT - -// Platform uses ACE_HAS_DIRENT but does not have readdir_r() -#define ACE_LACKS_READDIR_R - -// Platform supports getpagesize() call (otherwise, -// ACE_PAGE_SIZE must be defined) -#define ACE_HAS_GETPAGESIZE - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Platform's select() uses non-const timeval* -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -// Platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// Platform lacks named POSIX semaphores -#define ACE_LACKS_NAMED_POSIX_SEM - -// Platform has support for multi-byte character support compliant -// with the XPG4 Worldwide Portability Interface wide-character -// classification. -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -// No wcsstr function available for this compiler -#define ACE_LACKS_WCSSTR - -// No wctype.h available for this compiler -#define ACE_LACKS_WCTYPE_H - -// Platform supports the POSIX regular expression library. -// [Note Tandem NSK platform does have regular expresson support but it -// does not follow the assumptions made by ACE. To use it would need -// to make some ACE modifications.] -//#define ACE_HAS_REGEX - -// Compiler/platform supports strerror () -#define ACE_HAS_STRERROR - -// Platform doesn't have truncate() -#define ACE_LACKS_TRUNCATE - -// Platform lacks readers/writer locks. -#define ACE_LACKS_RWLOCK_T - -// Compiler's 'new' throws exception on failure (ANSI C++ behavior). -#define ACE_NEW_THROWS_EXCEPTIONS - -// Optimize ACE_Handle_Set::count_bits for select() operations (common -// case) -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform lacks setreuid() -#define ACE_LACKS_SETREUID - -// Platform lacks setregid() -#define ACE_LACKS_SETREGID - -// Compile using multi-thread libraries -#define ACE_MT_SAFE 1 - - - -// Platform supports System V IPC -#define ACE_HAS_SYSV_IPC - -// Platform lacks the socketpair() call -// [Needed due to failure of Pipe_Test. even though nsk platform -// has socketpair(), Pipe.cpp tries to set socket buf size but this -// is not allowed for AF_UNIX protocol on nsk.] -#define ACE_LACKS_SOCKET_BUFSIZ - -// Platform lacks the socketpair() call -#define ACE_LACKS_SOCKETPAIR - -// Platform limits the maximum socket message size. -#define ACE_HAS_SOCK_BUF_SIZE_MAX - -// hrtime_t is a basic type that doesn't require ACE_U64_TO_U32 conversion -#define ACE_HRTIME_T_IS_BASIC_TYPE - -// printf format specifiers for 64 bit integers -# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Ld") -# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Ld") - -//========================================================================= -// Threads specific parts -//========================================================================= - -// Platform supports threads -#define ACE_HAS_THREADS - -// Platform supports POSIX Pthreads, of one form or another. This -// macro says the platform has a pthreads variety - should also define -// one of the below to say which one. Also may need some -// ACE_HAS_... thing for extensions. -#define ACE_HAS_PTHREADS - -// Platform's 'Pthreads' is .4a draft 4 -#ifndef ACE_TANDEM_T1248_PTHREADS -# define ACE_HAS_PTHREADS_DRAFT4 -# define ACE_LACKS_CONST_TIMESPEC_PTR -extern int cma_sigwait (sigset_t *); -#endif - -// Platform supports POSIX.1c-1995 threads -// (This is the final standard Pthreads). -#ifdef ACE_TANDEM_T1248_PTHREADS -#define ACE_HAS_PTHREADS_STD -#endif - -// Standard pthreads supports only SCHED_FIFO -#define ACE_HAS_ONLY_SCHED_FIFO - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Platform has no implementation of pthread_condattr_setpshared(), -// even though it supports pthreads! -#define ACE_LACKS_CONDATTR_PSHARED - -// pthread_cond_timedwait does *not* reset the time argument when the -// lock is acquired. -#define ACE_LACKS_COND_TIMEDWAIT_RESET - -// Platform lacks pthread_attr_setsched() -#define ACE_LACKS_SETSCHED - -// Platform has pthread_mutexattr_setkind_np(). -#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP - -// Platform lacks pthread_mutexattr_setpshared(). -#define ACE_LACKS_MUTEXATTR_PSHARED - -// Platform lacks pthread_attr_setscope() -#define ACE_LACKS_THREAD_PROCESS_SCOPING - -// Platform lacks pthread_attr_setstackaddr -#define ACE_LACKS_THREAD_STACK_ADDR - -// Defining ACE_HAS_UCONTEXT_T since G06.21 version of spthreads has -// a definition for it. -#ifdef ACE_TANDEM_T1248_PTHREADS -#define ACE_HAS_UCONTEXT_T -#endif - -//========================================================================= -// Include file characteristics -//========================================================================= - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Platform lacks malloc.h -#define ACE_LACKS_MALLOC_H - -// Platform lacks the siginfo.h include file -#define ACE_LACKS_SIGINFO_H - -// Platform doesn't define struct strrecvfd. -#define ACE_LACKS_STRRECVFD - -// Platform lacks the ucontext.h file -#define ACE_LACKS_UCONTEXT_H - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Platform supports the POSIX struct timespec type -#define ACE_HAS_POSIX_TIME - -// Platform/compiler supports timezone * as second parameter to gettimeofday() -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Platform has (which contains bzero() prototype) -#define ACE_HAS_STRINGS 1 - - -// OS/compiler omits the const from the iovec parameter in the -// writev() prototype. -#define ACE_HAS_NONCONST_WRITEV - -// Platform lacks -#define ACE_LACKS_STDINT_H - -// Platform lacks -#define ACE_LACKS_INTTYPES_H - -// Platform lacks -#define ACE_LACKS_SYS_SELECT_H - -// Platform lacks -#define ACE_LACKS_DLFCN_H - -// Platform lacks -#define ACE_LACKS_SEMAPHORE_H - -// Platform lacks -#define ACE_LACKS_POLL_H - -//========================================================================= -// Compiler specific parts -//========================================================================= - -// Compiler supports C++ exception handling -#define ACE_HAS_EXCEPTIONS - -// Compiler/platform has correctly prototyped header files -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform does not support the unsigned long long datatype. -#define ACE_LACKS_LONGLONG_T - -// Compiler supports the ssize_t typedef -#define ACE_HAS_SSIZE_T - -// Platform/compiler supports Standard C++ Library -#define ACE_HAS_STANDARD_CPP_LIBRARY 0 - -// Compiler's template mechanism must see source code (i.e., -// .cpp files). -#define ACE_TEMPLATES_REQUIRE_SOURCE - -// Compiler implements template specialization -#define ACE_HAS_TEMPLATE_SPECIALIZATION - -// Compiler implements templates that support typedefs inside -// of classes used as formal arguments to a template class. -#define ACE_HAS_TEMPLATE_TYPEDEFS - -// Platform has its standard c++ library in the namespace std. -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -// Compiler doesn't support static data member templates -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES - -// Platform lacks "signed char" type (broken!) -// Following will not be needed if use standard c library (G06.20 and later) -#define ACE_LACKS_SIGNED_CHAR - -//========================================================================= -// Build options -//========================================================================= - -// Disable the inclusion of RCS ids in the generated code. -#define ACE_USE_RCSID 0 - -// For debugging problems in os calls (but this doesn't work too well -// since output is not interleaved properly with output from ACE_TRACE -//# define ACE_OS_TRACE(X) ::printf(X) - -// Uncomment the following if timed message blocks are needed (e.g. -// for Dynamic_Priority_Test. Otherwise leave this disabled because -// enabling it adds overhead to message blocks and timed message blocks -// are "rarely used." -//#define ACE_HAS_TIMED_MESSAGE_BLOCKS - -// Uncomment the following if tokens library is needed. -//#define ACE_HAS_TOKENS_LIBRARY - -#include /**/ "ace/post.h" - -#endif /* ACE_CONFIG_NSK_H */ diff --git a/ace/config-tandem-nsk-mips-v3.h b/ace/config-tandem-nsk-mips-v3.h deleted file mode 100644 index bd3500e0d5f..00000000000 --- a/ace/config-tandem-nsk-mips-v3.h +++ /dev/null @@ -1,471 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - - -#ifndef ACE_CONFIG_NSK_H -#define ACE_CONFIG_NSK_H - -#include /**/ "ace/pre.h" - -// The following configuration file contains defines for Tandem NSK -// platform, MIPS processor, version 3 C++ compiler. - - -//========================================================================= -// Tandem NSK specific parts -//========================================================================= - - -// Disable pthread renaming of symbols such as "open" and "close" -#define _CMA_NOWRAPPERS_ 1 - -// Get Handle_Set.cpp to generate correct bit operations for NSK platform -#define ACE_TANDEM_NSK_BIT_ORDER - -// Use facilities provided by T1248 version of pthreads. -// (If not defined, will use old version of pthreads.) -#define ACE_TANDEM_T1248_PTHREADS - -// Use all available T1248 thread aware wrapper functions for providing -// non-blocking I/O. -// [Note: this causes a significant performance degradation] -//#define ACE_TANDEM_T1248_PTHREADS_ALL_IO_WRAPPERS - - -// Need this include here because some symbols defined by pthreads -// (e.g. timespec_t) are needed before spthread.h is normally included -// by ACE -#ifdef ACE_TANDEM_T1248_PTHREADS -#include -#else -#include "pthread.h" -#include "dce/cma_dispatch_coop.h" -#endif - -// The following #defines are hacks to get around things -// that seem to be missing or different in Tandem land -#define NSIG 32 // missing from Signal.h - // note: on nsk TNS/R there is room in - // sigset_t for 128 signals but those - // above 31 are not valid. -typedef long fd_mask; // should be in select.h but no such file -#define NBBY 8 // must be consistent with value in sys/types.h -#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ -#define MAXNAMLEN 248 // missing from dirent.h -#define ERRMAX 4218 // from errno.h - -// Following seems to be missing from G06.20 version of standard -// pthreads includes (it appeared in older version of standard pthreads) -// (SCHED_FIFO (aka cma_c_sched_fifo) used in Dynamic_Priority_Test) -#ifdef ACE_TANDEM_T1248_PTHREADS -typedef enum CMA_T_SCHED_POLICY { - cma_c_sched_fifo = 0, - cma_c_sched_rr = 1, - cma_c_sched_throughput = 2, - cma_c_sched_background = 3, - cma_c_sched_ada_low = 4 - } cma_t_sched_policy; -#endif - -// T1248 doesn't define these constants. They're defined in spt/cma.h -// (formerly dce/cma.h), but this header is not included or provided -// by T1248 G07-AAL. -#define cma_c_prio_fifo_min 16 -#define cma_c_prio_fifo_mid 24 -#define cma_c_prio_fifo_max 31 -#define cma_c_prio_rr_min 16 -#define cma_c_prio_rr_mid 24 -#define cma_c_prio_rr_max 31 -#define cma_c_prio_through_min 8 -#define cma_c_prio_through_mid 12 -#define cma_c_prio_through_max 15 -#define cma_c_prio_back_min 1 -#define cma_c_prio_back_mid 4 -#define cma_c_prio_back_max 7 - -// Enable NSK Pluggable Protocols -#define TAO_HAS_NSKPW 1 -#define TAO_HAS_NSKFS 1 - -//========================================================================= -// Platform specific parts -//========================================================================= - -// Platform lacks getpwnam_r() methods (e.g., SGI 6.2). -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS - -// Platform/compiler lacks {get,set}rlimit() function -#define ACE_LACKS_RLIMIT - -// The platform doesn't have mmap(2) -#define ACE_LACKS_MMAP - -// Platform lacks streambuf "linebuffered ()". [C++ iostream] -#define ACE_LACKS_LINEBUFFERED_STREAMBUF - -// Use native implementation of memchr. -#define ACE_HAS_MEMCHR - -// Platform supports recvmsg and sendmsg -#define ACE_HAS_MSG - -// Platform has ACE_HAS_4_4BSD_SENDMSG_RECVMSG but its cmsghdr -// structure does not contain an 'unsigned char cmsg_data[0]' member. -#define ACE_LACKS_CMSG_DATA_MEMBER - -// Platform defines ACE_HAS_MSG, but lacks msg_accrights{,len}. -#define ACE_LACKS_MSG_ACCRIGHTS - -// Platform supports sigsuspend() -#define ACE_HAS_SIGSUSPEND - -// Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T - -// OS/compiler uses size_t * rather than int * for socket lengths -#define ACE_HAS_SIZET_SOCKET_LEN - -// OS/compiler uses void * arg 4 setsockopt() rather than const char * -#define ACE_HAS_VOIDPTR_SOCKOPT - -// The platform doesn't have mprotect(2) -#define ACE_LACKS_MPROTECT - -// Platform lacks msync() -#define ACE_LACKS_MSYNC - -// Platform does not support reentrant netdb functions (getprotobyname_r, -// getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS Platform does not support - -// Platform lacks madvise() -#define ACE_LACKS_MADVISE - -// Platform lacks pri_t -#define ACE_LACKS_PRI_T - -// Platform lacks a working sbrk() -#define ACE_LACKS_SBRK - -// Platform doesn't have syscall() prototype -#define ACE_LACKS_SYSCALL - -// Platform lacks the inet_aton() function. -#define ACE_LACKS_INET_ATON - -// Compiler/platform has Dirent iterator functions -#define ACE_HAS_DIRENT - -// Platform uses ACE_HAS_DIRENT but does not have readdir_r() -#define ACE_LACKS_READDIR_R - -// Platform supports getpagesize() call (otherwise, -// ACE_PAGE_SIZE must be defined) -#define ACE_HAS_GETPAGESIZE - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Platform's select() uses non-const timeval* -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -// Platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// Platform lacks named POSIX semaphores -#define ACE_LACKS_NAMED_POSIX_SEM - -// Platform has support for multi-byte character support compliant -// with the XPG4 Worldwide Portability Interface wide-character -// classification. -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -// No wcsstr function available for this compiler -#define ACE_LACKS_WCSSTR - -// No wctype.h available for this compiler -#define ACE_LACKS_WCTYPE_H - -// Platform supports the POSIX regular expression library. -// [Note Tandem NSK platform does have regular expresson support but it -// does not follow the assumptions made by ACE. To use it would need -// to make some ACE modifications.] -//#define ACE_HAS_REGEX - -// Compiler/platform supports strerror () -#define ACE_HAS_STRERROR - -// Platform doesn't have truncate() -#define ACE_LACKS_TRUNCATE - -// Platform lacks readers/writer locks. -#define ACE_LACKS_RWLOCK_T - -// Compiler's 'new' throws exception on failure (ANSI C++ behavior). -#define ACE_NEW_THROWS_EXCEPTIONS - -// Optimize ACE_Handle_Set::count_bits for select() operations (common -// case) -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform lacks setreuid() -#define ACE_LACKS_SETREUID - -// Platform lacks setregid() -#define ACE_LACKS_SETREGID - -// Compile using multi-thread libraries -#define ACE_MT_SAFE 1 - - - -// Platform supports System V IPC -#define ACE_HAS_SYSV_IPC - -// Platform lacks the socketpair() call -// [Needed due to failure of Pipe_Test. even though nsk platform -// has socketpair(), Pipe.cpp tries to set socket buf size but this -// is not allowed for AF_UNIX protocol on nsk.] -#define ACE_LACKS_SOCKET_BUFSIZ - -// Platform lacks the socketpair() call -#define ACE_LACKS_SOCKETPAIR - -// Platform limits the maximum socket message size. -#define ACE_HAS_SOCK_BUF_SIZE_MAX - -// hrtime_t is a basic type that doesn't require ACE_U64_TO_U32 conversion -#define ACE_HRTIME_T_IS_BASIC_TYPE - -// printf format specifiers for 64 bit integers -# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Ld") -# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Ld") - -// Use larger default buffer size for ease of interoperability -#define ACE_DEFAULT_CDR_BUFSIZE 4096 - -// Size of a wchar -#define ACE_SIZEOF_WCHAR 2 - - -//========================================================================= -// Threads specific parts -//========================================================================= - -// Platform supports threads -#define ACE_HAS_THREADS - -// Platform supports POSIX Pthreads, of one form or another. This -// macro says the platform has a pthreads variety - should also define -// one of the below to say which one. Also may need some -// ACE_HAS_... thing for extensions. -#define ACE_HAS_PTHREADS - -// Platform's 'Pthreads' is .4a draft 4 -#ifndef ACE_TANDEM_T1248_PTHREADS -# define ACE_HAS_PTHREADS_DRAFT4 -# define ACE_LACKS_CONST_TIMESPEC_PTR -extern int cma_sigwait (sigset_t *); -#endif - -// Platform supports POSIX.1c-1995 threads -// (This is the final standard Pthreads). -#ifdef ACE_TANDEM_T1248_PTHREADS -#define ACE_HAS_PTHREADS_STD -#endif - -// Standard pthreads supports only SCHED_FIFO -#define ACE_HAS_ONLY_SCHED_FIFO - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Platform has no implementation of pthread_condattr_setpshared(), -// even though it supports pthreads! -#define ACE_LACKS_CONDATTR_PSHARED - -// pthread_cond_timedwait does *not* reset the time argument when the -// lock is acquired. -#define ACE_LACKS_COND_TIMEDWAIT_RESET - -// Platform lacks pthread_attr_setsched() -#define ACE_LACKS_SETSCHED - -// Platform has pthread_getschedparam and pthread_setschedparam -// even when ACE_LACKS_SETSCHED is defined. -#define ACE_HAS_PTHREAD_SCHEDPARAM - -// Platform has pthread_mutexattr_setkind_np(). -#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP - -// Platform lacks pthread_mutexattr_setpshared(). -#define ACE_LACKS_MUTEXATTR_PSHARED - -// Platform lacks pthread_attr_setscope() -#define ACE_LACKS_THREAD_PROCESS_SCOPING - -// Platform lacks pthread_attr_setstackaddr -#define ACE_LACKS_THREAD_STACK_ADDR - -// Defining ACE_HAS_UCONTEXT_T since G06.21 version of spthreads has -// a definition for it. -#ifdef ACE_TANDEM_T1248_PTHREADS -#define ACE_HAS_UCONTEXT_T -#endif - -//========================================================================= -// Include file characteristics -//========================================================================= - -// Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -// Platform lacks malloc.h -#define ACE_LACKS_MALLOC_H - -// Platform lacks the siginfo.h include file -#define ACE_LACKS_SIGINFO_H - -// Platform doesn't define struct strrecvfd. -#define ACE_LACKS_STRRECVFD - -// Platform lacks the ucontext.h file -#define ACE_LACKS_UCONTEXT_H - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Platform supports the POSIX struct timespec type -#define ACE_HAS_POSIX_TIME - -// Platform/compiler supports timezone * as second parameter to gettimeofday() -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Platform has (which contains bzero() prototype) -#define ACE_HAS_STRINGS 1 - - -// OS/compiler omits the const from the iovec parameter in the -// writev() prototype. -#define ACE_HAS_NONCONST_WRITEV - -// Platform lacks -#define ACE_LACKS_STDINT_H - -// Platform lacks -#define ACE_LACKS_INTTYPES_H - -// Platform lacks -#define ACE_LACKS_SYS_SELECT_H - -// Platform lacks -#define ACE_LACKS_DLFCN_H - -// Platform lacks -#define ACE_LACKS_SEMAPHORE_H - -// Platform lacks -#define ACE_LACKS_POLL_H - -//========================================================================= -// Compiler specific parts -//========================================================================= - -// Compiler supports C++ exception handling -#define ACE_HAS_EXCEPTIONS - -// Compiler/platform has correctly prototyped header files -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform does not support the unsigned long long datatype. -#define ACE_LACKS_UNSIGNEDLONGLONG_T - -// Compiler supports the ssize_t typedef -#define ACE_HAS_SSIZE_T - -// Platform/compiler supports Standard C++ Library -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 - -// Compiler's template mechanism must see source code (i.e., -// .cpp files). -#define ACE_TEMPLATES_REQUIRE_SOURCE - -// Compiler implements template specialization -#define ACE_HAS_TEMPLATE_SPECIALIZATION - -// Compiler implements templates that support typedefs inside -// of classes used as formal arguments to a template class. -#define ACE_HAS_TEMPLATE_TYPEDEFS - -// Platform/Compiler supports a String class -#define ACE_HAS_STRING_CLASS -#define ACE_HAS_STDCPP_STL_INCLUDES - -// Platform has its standard c++ library in the namespace std. -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -// Compiler doesn't support static data member templates -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES - -// Platform lacks "signed char" type (broken!) -// Following will not be needed if use standard c library (G06.20 and later) -#define ACE_LACKS_SIGNED_CHAR - -// Compiler supports the typename keyword for templates -#define ACE_HAS_TYPENAME_KEYWORD - -// Compiler can handle any operators in namespace -#define ACE_ANY_OPS_USE_NAMESPACE - -//========================================================================= -// C++ version3 import/export macros -//========================================================================= - -// Define the export macros needed to export symbols outside a DLL -// The ACE_IMPORT_SINGLETON_DECLARE macro has been modified to not explicitly -// instantiate the class template. -#if defined(USE_EXPLICIT_EXPORT) -#define ACE_LACKS_INLINE_FUNCTIONS - -#define ACE_HAS_CUSTOM_EXPORT_MACROS -#define ACE_Proper_Export_Flag export$ -#define ACE_Proper_Import_Flag import$ -#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class export$ T -#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class export$ SINGLETON_TYPE; -#define ACE_IMPORT_SINGLETON_DECLARATION(T) template class import$ T -#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class import$ SINGLETON_TYPE ; -#endif - - -//========================================================================= -// Build options -//========================================================================= - -// Disable the inclusion of RCS ids in the generated code. -#define ACE_USE_RCSID 0 - -// For debugging problems in os calls (but this doesn't work too well -// since output is not interleaved properly with output from ACE_TRACE -//# define ACE_OS_TRACE(X) ::printf(X) - -// Uncomment the following if timed message blocks are needed (e.g. -// for Dynamic_Priority_Test. Otherwise leave this disabled because -// enabling it adds overhead to message blocks and timed message blocks -// are "rarely used." -//#define ACE_HAS_TIMED_MESSAGE_BLOCKS - -// Uncomment the following if tokens library is needed. -//#define ACE_HAS_TOKENS_LIBRARY - -// NonStop CORBA uses the XML Service Configurator -#define ACE_HAS_XML_SVC_CONF - -#define ACE_LD_SEARCH_PATH "_RLD_LIB_PATH" - -#include /**/ "ace/post.h" - -#endif /* ACE_CONFIG_NSK_H */ diff --git a/ace/config-tandem.h b/ace/config-tandem.h deleted file mode 100644 index 7b2867a0fda..00000000000 --- a/ace/config-tandem.h +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- C++ -*- */ -// Testing TANDEM -// $Id$ - -// The following configuration file is designed to work for Tandems NonStop-UX -// 4.2MP platforms using the NCC 3.20 compiler. - -// Note this is a test version it might include several errors I -// have done a test and set/unset until I errors disappered. -// Some of the options that should be set aren't because of the simple fact -// that i haven't the time to check what is wrong. -// e.g. widecharacter are supported but a wcstok which only take 2 parameters -// are included by the compiler, to get the correct wcstok that takes 3 params -// we must set _XOPEN_SOURCE and we get ALOT of errors and warnings. -// So this config is done to get things to start to work it isn't finished. -// Janne (Jan.Perman@osd.Ericsson.se) - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#define ACE_HAS_IDTYPE_T -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Tandem doesn't include this although they are defined -// in sys/time.h and sys/resource.h -#define ACE_LACKS_RLIMIT_PROTOTYPE // jjpp -// Tandem has a function to set t_errno (set_t_errno) -#define ACE_HAS_SET_T_ERRNO // jjpp - -//Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// OS/compiler omits the const from the sendmsg() prototype. -#define ACE_HAS_NONCONST_SENDMSG - -//Platform supports system configuration information -#define ACE_HAS_SYSINFO - -//Platform supports the POSIX regular expression library -#define ACE_HAS_REGEX - -// Platform supports recvmsg and sendmsg -#define ACE_HAS_MSG - -//Compiler/platform contains the file. -#define ACE_HAS_SYS_SYSCALL_H - -//Platform provides header -#define ACE_HAS_SYSENT_H - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -//Platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files -#define ACE_HAS_CPLUSPLUS_HEADERS - -//Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -//Compiler/platform has -#define ACE_HAS_ALLOCA_H - -//Platform contains -#define ACE_HAS_POLL - -// Platform supports the POSIX struct timespec type -#define ACE_HAS_POSIX_TIME // As i understand it, but i'm in deep water -//Platform supports the SVR4 timestruc_t type - -// To get this to work a patch in sys/signal must be made -// typedef void SIG_FUNC_TYPE(int); -//#if defined (__cplusplus) -// void (*sa_handler)(int); -//#else -// ... -//#endif -//#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_TANDEM_SIGNALS -//Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T -//Platform supports SVR4 extended signals -#define ACE_HAS_SIGINFO_T -//Platform supports ucontext_t (which is used in the extended signal API). -#define ACE_HAS_UCONTEXT_T - -// Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT - -//Compiler/platform provides the sockio.h file -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler supports the ssize_t typedef -#define ACE_HAS_SSIZE_T // Limits.h must be included - -//Platform supports STREAMS -#define ACE_HAS_STREAMS - -#define ACE_HAS_STREAM_PIPES -//Platform supports STREAM pipes - -//Compiler/platform supports strerror () -#define ACE_HAS_STRERROR - -//Compiler/platform supports struct strbuf -#define ACE_HAS_STRBUF_T - -//Compiler/platform supports SVR4 dynamic linking semantics -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -//Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... -#define ACE_HAS_SVR4_TLI - -//Platform provides header -#define ACE_HAS_SYS_FILIO_H - -//Platform supports TLI timod STREAMS module -#define ACE_HAS_TIMOD_H -//Platform supports TLI tiuser header -#define ACE_HAS_TIUSER_H - -//Platform supports TLI -#define ACE_HAS_TLI -//Platform provides TLI function prototypes -#define ACE_HAS_TLI_PROTOTYPES - -//Platform lacks streambuf "linebuffered ()". -#define ACE_LACKS_LINEBUFFERED_STREAMBUF - -// Platform lacks "signed char" type (broken!) -#define ACE_LACKS_SIGNED_CHAR - - -#define ACE_PAGE_SIZE 4096 -// Defines the page size of the system (not used on Win32 or -// with ACE_HAS_GETPAGESIZE). - -/****** THREAD SPECIFIC **********/ -/* If you want to remove threading then comment out the following four #defines .*/ -#if !defined (ACE_MT_SAFE) - #define ACE_MT_SAFE 1 //Compile using multi-thread libraries -#endif -#define ACE_HAS_THREADS //Platform supports threads -#define ACE_HAS_STHREADS //Platform supports Solaris threads - -// Compiler/platform has threadspecific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -//Platform supports thr_keydelete (e.g,. UNIXWARE) - -#define ACE_HAS_THR_MINSTACK // Tandem uses thr_minstack instead of thr_min_stack -#define ACE_LACKS_PRI_T // Tandem lacks pri_t -#define ACE_HAS_THR_KEYDELETE - -//************************************* - -/*********************************/ - -/******* SIGNAL STUFF *******/ - -//Platform uses non-const char * in calls to gethostbyaddr, gethostbyname, -// getservbyname -#define ACE_HAS_NONCONST_GETBY -// Platform's select() uses non-const timeval* (only found on Linux right now) -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -// And on Tandem :-) -//Uses ctime_r & asctime_r with only two parameters vs. three. -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -//Platform has special header for select(). -#define ACE_HAS_SELECT_H -// Platform/compiler supports Standard C++ Library -#define ACE_HAS_STANDARD_CPP_LIBRARY -//Platform lacks madvise() (e.g., Linux) -#define ACE_LACKS_MADVISE -//Compiler/platform lacks strcasecmp() (e.g., DG/UX, UNIXWARE, VXWORKS) -#define ACE_LACKS_STRCASECMP - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-tru64.h b/ace/config-tru64.h deleted file mode 100644 index d0e6556bd23..00000000000 --- a/ace/config-tru64.h +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for the -// Digital UNIX V4.0a and later platforms. It relies on -// config-osf1-4.0.h, and adds deltas for newer platforms. - -#ifndef ACE_CONFIG_TRU64_H -#define ACE_CONFIG_TRU64_H -#include /**/ "ace/pre.h" - -#if !defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif /* ! ACE_MT_SAFE */ - -/*clearerr is not defined when _REENTRANT is not defined*/ -#if ACE_MT_SAFE == 0 -#define ACE_LACKS_CLEARERR -#endif /* ACE_MT_SAFE == 0 */ - -// Include unistd.h to define _POSIX_C_SOURCE. -#include - -// Configuration-specific #defines: -// 1) g++ or cxx -// 2) pthreads or DCE threads -#if defined (__GNUG__) - // g++ with pthreads - - // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so - // this must appear before its #include. -# define ACE_HAS_STRING_CLASS - -# include "ace/config-g++-common.h" - -# define ACE_HAS_GNU_CSTRING_H -# define ACE_HAS_REENTRANT_FUNCTIONS -#elif defined (__DECCXX) - -# define ACE_CONFIG_INCLUDE_CXX_COMMON -# include "ace/config-cxx-common.h" - -#elif defined (__rational__) -# define ACE_HAS_REENTRANT_FUNCTIONS -# define ACE_HAS_STRING_CLASS -# define ACE_LACKS_LINEBUFFERED_STREAMBUF -# define ACE_LACKS_SIGNED_CHAR - - // Exceptions are enabled by platform_osf1_4.0_rcc.GNU. -# define ACE_HAS_STDCPP_STL_INCLUDES -# define ACE_HAS_TEMPLATE_SPECIALIZATION -# define ACE_HAS_TYPENAME_KEYWORD -#else -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler on Digital Unix -# endif /* __cplusplus */ -#endif /* ! __GNUG__ && ! __DECCXX && ! __rational__ */ - -#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199506L) - // cxx with POSIX 1003.1c-1995 threads (pthreads) . . . -# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -# define ACE_HAS_BROKEN_IF_HEADER -# define ACE_HAS_BROKEN_R_ROUTINES -#if (ACE_MT_SAFE != 0) -# define ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD -# define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -#endif /* ACE_MT_SAFE != 0 */ -# define ACE_LACKS_T_ERRNO -# if !defined (DIGITAL_UNIX) -# define DIGITAL_UNIX 0x400 -# endif /* ! DIGITAL_UNIX */ - // DJT removed this due to some minor issues related to the - // definitions of timestruc_t and tid_t in procfs.h not sure what - // functionality is lost? Platform supports - //#define ACE_HAS_PROC_FS -#else /* _POSIX_C_SOURCE < 199506L */ - // cxx with DCE threads . . . - // This ACE configuration is only supported with cxx; it has not been - // test with g++. -# define ACE_HAS_BROKEN_MSG_H -# define ACE_HAS_BROKEN_POSIX_TIME -#if (ACE_MT_SAFE != 0) -# define ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_DRAFT4 -# define ACE_HAS_THREAD_SELF -# define ACE_LACKS_THREAD_PROCESS_SCOPING -# define ACE_LACKS_PTHREAD_THR_SIGSETMASK -# define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#endif -# define ACE_HAS_GETPAGESIZE -# define ACE_HAS_PROC_FS -# define ACE_HAS_SETKIND_NP -# define ACE_LACKS_CONST_TIMESPEC_PTR -# define ACE_LACKS_READDIR_R -# define ACE_LACKS_SETSCHED -# define ACE_LACKS_SIGNED_CHAR -# define ACE_LACKS_SYSV_MSQ_PROTOS -#endif /* _POSIX_C_SOURCE < 199506L */ - -#define ACE_SIZEOF_LONG 8 - -#define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_NONCONST_SETRLIMIT -#define ACE_HAS_BROKEN_T_ERROR -#define ACE_HAS_NONCONST_WRITEV -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_DIRENT -#define ACE_HAS_GETRUSAGE -#define ACE_HAS_GPERF -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_LLSEEK -#define ACE_HAS_LONG_MAP_FAILED -#define ACE_HAS_MSG -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONCONST_SENDMSG -#define ACE_HAS_OSF1_GETTIMEOFDAY -#define ACE_HAS_OSF_TIMOD_H -#define ACE_HAS_POLL -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_PRIOCNTL -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRBUF_T -#define ACE_HAS_STREAMS -#define ACE_HAS_STRERROR -#define ACE_HAS_STRPTIME -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_SVR4_SIGNAL_T -#define ACE_HAS_SYS_SYSCALL_H -#define ACE_HAS_SYSV_IPC -#if (ACE_MT_SAFE == 0) -// clearerr is not defined when _REENTRANT is not defined -#define ACE_LACKS_CLEARERR -#else /* ACE_MT_SAFE != 0 */ -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_LACKS_THREAD_STACK_ADDR -#endif /* ACE_MT_SAFE != 0 */ -#define ACE_HAS_TIUSER_H -#define ACE_HAS_XTI -#define ACE_HAS_TLI_PROTOTYPES -#define ACE_HAS_UALARM -#define ACE_HAS_UCONTEXT_T -#define ACE_LACKS_PRI_T -#define ACE_LACKS_RWLOCK_T -#define ACE_PAGE_SIZE 8192 -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND - -// DJT 6/10/96 All these broken macro's can now be removed with the -// approporiate ordering of the include files. The Platinum release -// now temporarily supports both forms. Platform's implementation of -// sendmsg() has a non-const msgheader parameter. -#define ACE_HAS_NONCONST_SENDMSG -#define ACE_HAS_IDTYPE_T -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER - -#if DIGITAL_UNIX >= 0x500 -# ifndef ACE_HAS_SNPRINTF -# define ACE_HAS_SNPRINTF -# endif /* ACE_HAS_SNPRINTF */ -# define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 -#endif /* DIGITAL_UNIX >= 0x500 */ - -#if DIGITAL_UNIX >= 0x40E -# define ACE_LACKS_STDINT_H -#endif /* DIGITAL_UNIX >= 0x40E */ - -#if (DIGITAL_UNIX >= 0x400) && (DIGITAL_UNIX < 0x500) -#define ACE_LACKS_PREAD_PROTOTYPE -#endif /* (DIGITAL_UNIX >= 0x400) && (DIGITAL_UNIX < 0x500) */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_TRU64_H */ diff --git a/ace/config-unixware-2.01-g++.h b/ace/config-unixware-2.01-g++.h deleted file mode 100644 index c476b9784d5..00000000000 --- a/ace/config-unixware-2.01-g++.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work -// for Unixware platforms running UnixWare 2.01. -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -// See README for what the ACE_HAS... and ACE_LACKS... macros mean - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so -// this must appear before its #include. -#define ACE_HAS_STRING_CLASS - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_IDTYPE_T -#define ACE_LACKS_STRCASECMP -#define ACE_HAS_SIZET_SOCKET_LEN -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_GNU_CSTRING_H -#define ACE_HAS_MSG -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -// Not yet sure about threads -#define ACE_HAS_NONCONST_GETBY -#define ACE_HAS_OSF1_GETTIMEOFDAY -#define ACE_HAS_POLL -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_REGEX -#define ACE_HAS_SELECT_H -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SYS_SOCKIO_H -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STHREADS -#define ACE_HAS_THR_KEYDELETE -#define ACE_HAS_STRBUF_T -#define ACE_HAS_STREAMS -#define ACE_HAS_STREAM_PIPES -#define ACE_HAS_STRERROR -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_SYS_SYSCALL_H -#define ACE_HAS_SYSINFO -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_SYS_FILIO_H -#define ACE_HAS_SYS_SIGLIST -#define ACE_HAS_TERMIOS -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_TIMOD_H -#define ACE_HAS_TIUSER_H -#define ACE_HAS_TLI -#define ACE_HAS_TLI_PROTOTYPES -#define ACE_HAS_UNIXWARE_SVR4_SIGNAL_T -#define ACE_HAS_VOIDPTR_SOCKOPT - -#define ACE_LACKS_MADVISE -#define ACE_LACKS_SYSCALL - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#define ACE_PAGE_SIZE 4096 -#define ACE_REDEFINES_XTI_FUNCTIONS - -// Compiling for UNIXWARE -#if !defined (UNIXWARE) -# define UNIXWARE -# define UNIXARE_2_0 -#endif /* UNIXWARE */ - -// These seem to be missing... Process_Manager uses them -// -//typedef int Process_t; -//typedef int hProcess_t; -//typedef int hpid_t; - - -// Compiler/platform supports OSF/1 gettimeofday() prototype. -//#define ACE_HAS_OSF1_GETTIMEOFDAY - -// Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... -//#define ACE_HAS_SVR4_TLI - - -// Platform doesn't have getby... char *arg defined as const -//#define ACE_GET_BLAH_BY_NO_CONST - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-unixware-2.1.2-g++.h b/ace/config-unixware-2.1.2-g++.h deleted file mode 100644 index 32536ce3003..00000000000 --- a/ace/config-unixware-2.1.2-g++.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work -// for Unixware platforms running UnixWare 2.1.2 and gcc version 2.7.2.2 - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -// See README for what the ACE_HAS... and ACE_LACKS... macros mean - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so -// this must appear before its #include. -#define ACE_HAS_STRING_CLASS - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// ualarm is only in BSD compatibility lib, but no header is provided -// #define ACE_HAS_UALARM -#define ACE_HAS_SIZET_SOCKET_LEN -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_GNU_CSTRING_H -#define ACE_HAS_MSG -#define ACE_HAS_SVR4_GETTIMEOFDAY -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -#define ACE_HAS_NONCONST_GETBY -#define ACE_HAS_POLL -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_LACKS_TIMESPEC_T -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_REGEX -#define ACE_HAS_SELECT_H -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SYS_SOCKIO_H -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STHREADS -#define ACE_HAS_THR_KEYDELETE -#define ACE_HAS_STRBUF_T -#define ACE_HAS_STREAMS -#define ACE_HAS_STREAM_PIPES -#define ACE_HAS_STRERROR -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_SYS_SYSCALL_H -#define ACE_HAS_SYSINFO -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_SYS_FILIO_H -#define ACE_HAS_TERMIOS -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_TIMOD_H -#define ACE_HAS_TIUSER_H -#define ACE_HAS_TLI -#define ACE_HAS_TLI_PROTOTYPES -#define ACE_HAS_UNIXWARE_SVR4_SIGNAL_T -#define ACE_HAS_VOIDPTR_SOCKOPT -#define ACE_HAS_THR_MINSTACK - -#define ACE_LACKS_MADVISE -#define ACE_LACKS_STRCASECMP -#define ACE_LACKS_PRI_T -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#define ACE_PAGE_SIZE 4096 -#define ACE_REDEFINES_XTI_FUNCTIONS - -#if !defined (UNIXWARE) -# define UNIXWARE -# define UNIXWARE_2_1 -#endif /* ! UNIXWARE */ - -#define ACE_HAS_IDTYPE_T - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-unixware-7.1.0.h b/ace/config-unixware-7.1.0.h deleted file mode 100644 index 667b93db8b0..00000000000 --- a/ace/config-unixware-7.1.0.h +++ /dev/null @@ -1,422 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H - -/* ACE configuration header file */ - -/* Include the commong gnu config file */ -#include "config-g++-common.h" - -/* For unixware 7.1 && g++ 2.91.57, see if this fixes my problem */ -#ifndef UNIXWARE_7_1 -#define UNIXWARE_7_1 -#endif - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have the strftime function. */ -#define HAVE_STRFTIME 1 - -/* Define if you have that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if lex declares yytext as a char * by default, not a char[]. */ -#define YYTEXT_POINTER 1 - -/* Define _REENTRANT if reentrant functions should be used. */ -#ifndef _REENTRANT -# define _REENTRANT 1 -#endif - -#define ACE_HAS_NEW_NO_H 1 -#define ACE_HAS_STDEXCEPT_NO_H 1 - -#define ACE_THREAD_MIN_PRIORITY 0 -#if defined (ACE_THREAD_MIN_PRIORITY) -# define PTHREAD_MIN_PRIORITY ACE_THREAD_MIN_PRIORITY -#endif /* #if defined (ACE_THREAD_MIN_PRIORITY) */ - -#define ACE_THREAD_MAX_PRIORITY 99 -#if defined (ACE_THREAD_MAX_PRIORITY) -# define PTHREAD_MAX_PRIORITY ACE_THREAD_MAX_PRIORITY -#endif /* #if defined (ACE_THREAD_MAX_PRIORITY) */ - -/* Specify sizes of given built-in types. If a size isn't defined here, - then ace/Basic_Types.h will attempt to deduce the size. */ -/* #undef ACE_SIZEOF_CHAR */ -#define ACE_SIZEOF_SHORT 2 -#define ACE_SIZEOF_INT 4 -#define ACE_SIZEOF_LONG 4 -#define ACE_SIZEOF_LONG_LONG 8 -#define ACE_SIZEOF_VOID_P 4 -#define ACE_SIZEOF_FLOAT 4 -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_LONG_DOUBLE 12 - -/* Enable ACE inlining */ -#define __ACE_INLINE__ 1 - -/* OS has priocntl (2) */ -#define ACE_HAS_PRIOCNTL 1 - -/* Platform has pread() and pwrite() support */ -#define ACE_HAS_P_READ_WRITE 1 - -/* Compiler/platform supports alloca() */ -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA 1 - -/* Compiler/platform correctly calls init()/fini() for shared libraries */ -#define ACE_HAS_AUTOMATIC_INIT_FINI 1 - -/* Platform doesn't cast MAP_FAILED to a (void *). */ -/* #undef ACE_HAS_BROKEN_MAP_FAILED */ -/* Staller: oh yes, let's do this! */ -#define ACE_HAS_BROKEN_MAP_FAILED - -/* Prototypes for both signal() and struct sigaction are consistent. */ -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 - -/* Platform supports operations on directories via struct dirent, - readdir_r, etc. */ -#define ACE_HAS_DIRENT 1 - -/* Compiler supports C++ exception handling */ -// MM-Graz if ! defined inserted, to prevent warnings, because it is already -// defined in config-g++common.h -# if !defined (ACE_HAS_EXCEPTIONS) -#define ACE_HAS_EXCEPTIONS 1 -# endif - -/* Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be - defined, except on Win32) */ -#define ACE_HAS_GETPAGESIZE 1 - -/* Platform supports the getrusage() system call. */ -#define ACE_HAS_GETRUSAGE 1 - -/* Platform has a getrusage () prototype in sys/resource.h that differs from - the one in ace/OS.i. */ -#define ACE_HAS_GETRUSAGE_PROTOTYPE 1 - -/* Denotes that GNU has cstring.h as standard which redefines memchr() */ -#define ACE_HAS_GNU_CSTRING_H - -/* The GPERF utility is compiled for this platform */ -#define ACE_HAS_GPERF 1 - -/* Optimize ACE_Handle_Set::count_bits for select() operations (common case) */ -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1 - -/* Compiler/platform supports idtype_t. */ -#define ACE_HAS_IDTYPE_T 1 - -/* Platform supports IP multicast */ -#define ACE_HAS_IP_MULTICAST 1 - -/* Platform supports thr_keydelete (e.g,. UNIXWARE) */ -#define ACE_HAS_THR_KEYDELETE 1 - -/* Platform calls thr_minstack() rather than thr_min_stack() (e.g., Tandem). */ -#define ACE_HAS_THR_MINSTACK 1 - -/* Platform supports recvmsg and sendmsg */ -#define ACE_HAS_MSG 1 - -/* Platform's select() uses non-const timeval* (only found on Linux right - now) */ -#define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 - -/* Uses ctime_r & asctime_r with only two parameters vs. three. */ -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1 - -/* Platform is an Intel Pentium microprocessor. */ -/* There is a problem with the gethrtime() because of (apparently) a problem - with the inline assembly instruction. Hopefully there is a way to resolve - that with an improvement to the assembler -*/ -#ifdef ACE_HAS_PENTIUM -#undef ACE_HAS_PENTIUM -#endif /* ACE_HAS_PENTIUM */ - - -/* Platform contains */ -#define ACE_HAS_POLL 1 - -/* Platform supports POSIX O_NONBLOCK semantics */ -#define ACE_HAS_POSIX_NONBLOCK 1 - -/* Platform supports the POSIX struct timespec type */ -#define ACE_HAS_POSIX_TIME 1 - -/* Platform supports the /proc file system and defines tid_t - in */ -#define ACE_HAS_PROC_FS 1 - -/* Platform supports POSIX Threads */ -#define ACE_HAS_PTHREADS 1 - -/* Platform supports POSIX.1c-1995 threads */ -#define ACE_HAS_PTHREADS_STD 1 - -/* pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and - PTHREAD_PROCESS_SHARED values */ -#define ACE_HAS_PTHREAD_PROCESS_ENUM 1 - -/* Platform will recurse infinitely on thread exits from TSS cleanup routines - (e.g., AIX) */ -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 - -/* Platform supports reentrant functions (i.e., all the POSIX *_r - functions). */ -#define ACE_HAS_REENTRANT_FUNCTIONS 1 - -/* Platform has support for multi-byte character support compliant with the - XPG4 Worldwide Portability Interface wide-character classification. */ -#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 - -/* Platform does not support reentrant netdb functions (getprotobyname_r, - getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). */ -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 - -/* Platform supports the POSIX regular expression library */ -#define ACE_HAS_REGEX 1 - -/* Platform has special header for select(). */ -#define ACE_HAS_SELECT_H 1 - -/* Platform has a function to set t_errno (e.g., Tandem). */ -#define ACE_HAS_SET_T_ERRNO 1 - -/* Platform supports SVR4 extended signals */ -#define ACE_HAS_SIGINFO_T 1 - -/* Platform/compiler has the sigwait(2) prototype */ -#define ACE_HAS_SIGWAIT 1 - -/* Compiler/platform defines the sig_atomic_t typedef */ -#define ACE_HAS_SIG_ATOMIC_T 1 - -/* Platform supports new BSD inet_addr len field. */ -#define ACE_HAS_SOCKADDR_IN_SIN_LEN 1 - -/* OS/compiler uses size_t * rather than int * for socket lengths */ -#define ACE_HAS_SIZET_SOCKET_LEN 1 - -/* Compiler/platform provides the sys/sockio.h file */ -#define ACE_HAS_SYS_SOCKIO_H 1 - -/* Compiler supports the ssize_t typedef */ -#define ACE_HAS_SSIZE_T 1 - -/* Platform supports UNIX International Threads */ -#define ACE_HAS_STHREADS 1 - -/* Platform has thr_yield() */ -#define ACE_HAS_THR_YIELD 1 - -/* Compiler/platform supports struct strbuf */ -#define ACE_HAS_STRBUF_T 1 - -/* Platform supports STREAMS */ -#define ACE_HAS_STREAMS 1 - -/* Platform supports STREAM pipes */ -#define ACE_HAS_STREAM_PIPES 1 - -/* Compiler/platform supports strerror () */ -#define ACE_HAS_STRERROR 1 - -/* Platform/Compiler supports a String class (e.g., GNU or Win32). */ -#define ACE_HAS_STRING_CLASS 1 - -/* Platform has (which contains bzero() prototype) */ -#define ACE_HAS_STRINGS 1 - -/* Platform/compiler supports void * as second parameter to gettimeofday(). */ -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY 1 - -/* Compiler/platform supports SVR4 dynamic linking semantics */ -#define ACE_HAS_SVR4_DYNAMIC_LINKING 1 - -/* Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... */ -#define ACE_HAS_SVR4_TLI 1 - -/* Compiler/platform contains the file. */ -#define ACE_HAS_SYS_SYSCALL_H 1 - -/* Platform supports system configuration information */ -#define ACE_HAS_SYSINFO 1 - -/* Platform supports System V IPC (most versions of UNIX, but not Win32) */ -#define ACE_HAS_SYSV_IPC 1 - -/* Platform provides header */ -#define ACE_HAS_SYS_FILIO_H 1 - -/* Platform provides header */ -#define ACE_HAS_SYS_XTI_H 1 - -/* Platform has POSIX terminal interface. */ -#define ACE_HAS_TERMIOS 1 - -/* Platform supports threads */ -#define ACE_HAS_THREADS 1 - -/* Compiler/platform has thread-specific storage */ -#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 - -/* Platform supports TLI timod STREAMS module */ -#define ACE_HAS_TIMOD_H 1 - -/* Platform supports TLI tiuser header */ -#define ACE_HAS_TIUSER_H 1 - -/* Platform supports TLI. Also see ACE_TLI_TCP_DEVICE. */ -#define ACE_HAS_TLI 1 - -/* Platform provides TLI function prototypes */ -#define ACE_HAS_TLI_PROTOTYPES 1 - -/* Platform supports ualarm() */ -#define ACE_HAS_UALARM 1 - -/* Platform supports ucontext_t (which is used in the extended signal API). */ -#define ACE_HAS_UCONTEXT_T 1 - -/* Platform has header file */ -#define ACE_HAS_UTIME 1 - -/* Platform requires void * for mmap(). */ -#define ACE_HAS_VOIDPTR_MMAP 1 - -/* Platform has XTI (X/Open-standardized superset of TLI). Implies - ACE_HAS_TLI but uses a different header file. */ -#define ACE_HAS_XTI 1 - -/* Platform can not build ace/IOStream{,_T}.cpp. This does not necessarily - mean that the platform does not support iostreams. */ -#define ACE_LACKS_ACE_IOSTREAM 1 - -/* Platform does not have u_longlong_t typedef */ -#define ACE_LACKS_U_LONGLONG_T 1 - -/* Platform lacks madvise() (e.g., Linux) */ -#define ACE_LACKS_MADVISE 1 - -/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */ -#define ACE_LACKS_PRI_T 1 - -/* Platform lacks pthread_thr_sigsetmask (e.g., MVS, HP/UX, and OSF/1 3.2) */ -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 - -/* Platfrom lack pthread_yield() support. */ -#define ACE_LACKS_PTHREAD_YIELD 1 - -/* Platform lacks readers/writer locks. */ -#define ACE_LACKS_RWLOCK_T 1 - -/* MIT pthreads platform lacks the timedwait prototypes */ -#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1 - -/* Platform does not define timepec_t as a typedef for struct timespec. */ -#define ACE_LACKS_TIMESPEC_T 1 - -/* Compile using multi-thread libraries */ -#define ACE_MT_SAFE 1 - -/* Platform needs regexpr.h for regular expression support */ -#define ACE_NEEDS_REGEXPR_H 1 - -/* Platform needs to #include to get thread scheduling defs. */ -#define ACE_NEEDS_SCHED_H 1 - -/*********************************************************************/ -/* Compiler's template mechanim must see source code (i.e., .cpp files). This - is used for GNU G++. */ -/* Staller -> make 0 */ -// #undef ACE_TEMPLATES_REQUIRE_SOURCE - -/* Compiler's template instantiation mechanism supports the use of explicit - C++ specializations for all used templates. This is also used for GNU G++ - if you don't use the "repo" patches. */ -/* Staller -> make 0 */ -// #define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION 1 -/*********************************************************************/ - -/* The OS/platform supports the poll() event demultiplexor */ -#define ACE_USE_POLL 1 - -/* Platform has its standard c++ library in the namespace std. */ -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -/* The number of bytes in a double. */ -#define SIZEOF_DOUBLE 8 - -/* The number of bytes in a float. */ -#define SIZEOF_FLOAT 4 - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long double. */ -#define SIZEOF_LONG_DOUBLE 12 - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* The number of bytes in a short. */ -#define SIZEOF_SHORT 2 - -/* The number of bytes in a signed char. */ -#define SIZEOF_SIGNED_CHAR 1 - -/* The number of bytes in a void *. */ -#define SIZEOF_VOID_P 4 - -/* Define if you have the execv function. */ -#define HAVE_EXECV 1 - -/* Define if you have the execve function. */ -#define HAVE_EXECVE 1 - -/* Define if you have the execvp function. */ -#define HAVE_EXECVP 1 - -/* Define if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the header file. */ -#define HAVE_FSTREAM 1 - -/* Define if you have the header file. */ -#define HAVE_IOMANIP 1 - -/* Define if you have the header file. */ -#define HAVE_IOSTREAM 1 - -/* Define if you have the header file. */ -#define HAVE_PWD_H 1 - -/* Name of package */ -#define PACKAGE "ace" - -/* Added by Staller */ -#define ENUM_BOOLEAN // See file /usr/local/lib/gcc-lib/i486-pc-sysv5/egcs-2.91.60/include/sys/types.h -#define howmany(x, y) (((x)+((y)-1))/(y)) -#define ACE_HAS_BROKEN_T_ERROR // make a nasty warning disappear in OS.i -#define __USLC__ 1 -#define __IOCTL_VERSIONED__ // By Carlo! - -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-unixware-7.1.0.udk.h b/ace/config-unixware-7.1.0.udk.h deleted file mode 100644 index f449152026d..00000000000 --- a/ace/config-unixware-7.1.0.udk.h +++ /dev/null @@ -1,492 +0,0 @@ -/* -*- C++ -*- */ -#ifndef ACE_CONFIG_UNIXWARE_UDK_H -#define ACE_CONFIG_UNIXWARE_UDK_H - -// $Id$ - -// Configuration for the unixware UDK compiler. derived from the unixware/g++ config -// which was itself derived from an autoconfig run. - -/* ACE configuration header file */ - -#define ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION - -/* For unixware 7.1 && g++ 2.91.57, see if this fixes my problem */ -//#define ACE_HAS_BROKEN_NOOP_DTORS -#ifndef UNIXWARE_7_1 -#define UNIXWARE_7_1 -#endif - -#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE - -/* Define if you have the strftime function. */ -#define HAVE_STRFTIME 1 - -/* Define if you have that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if lex declares yytext as a char * by default, not a char[]. */ -#define YYTEXT_POINTER 1 - -/* Define _REENTRANT if reentrant functions should be used. */ -#ifndef _REENTRANT -# define _REENTRANT 1 -#endif - -#define ACE_HAS_NEW_NO_H 1 -#define ACE_HAS_STDEXCEPT_NO_H 1 - -/* - * TODO: These two next #defines have an #undef before them, in - * case the variable being defined already had a value. - * The #undefs are being picked up by configure, and are commented out! - */ -#define ACE_THREAD_MIN_PRIORITY 0 -#if defined (ACE_THREAD_MIN_PRIORITY) -/* # undef PTHREAD_MIN_PRIORITY */ -# define PTHREAD_MIN_PRIORITY ACE_THREAD_MIN_PRIORITY -#endif /* #if defined (ACE_THREAD_MIN_PRIORITY) */ - -#define ACE_THREAD_MAX_PRIORITY 99 -#if defined (ACE_THREAD_MAX_PRIORITY) -/* # undef PTHREAD_MAX_PRIORITY */ -# define PTHREAD_MAX_PRIORITY ACE_THREAD_MAX_PRIORITY -#endif /* #if defined (ACE_THREAD_MAX_PRIORITY) */ - - - -/* UnixWare specific configuration parameters */ -/* #undef UNIXWARE */ -/* #undef UNIXWARE_2_0 */ -/* #undef UNIXWARE_2_1 */ - -/* Specify sizes of given built-in types. If a size isn't defined here, - then ace/Basic_Types.h will attempt to deduce the size. */ -/* #undef ACE_SIZEOF_CHAR */ -#define ACE_SIZEOF_SHORT 2 -#define ACE_SIZEOF_INT 4 -#define ACE_SIZEOF_LONG 4 -#define ACE_SIZEOF_LONG_LONG 8 -#define ACE_SIZEOF_VOID_P 4 -#define ACE_SIZEOF_FLOAT 4 -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_LONG_DOUBLE 12 - -/* Enable ACE inlining */ -#define __ACE_INLINE__ 1 - -/* Platform supports Asynchronous IO calls */ -/* #define ACE_HAS_AIO_CALLS */ - -/* Specify this if you don't want threads to inherit parent thread's - ACE_Log_Msg properties. */ -/* #undef ACE_THREADS_DONT_INHERIT_LOG_MSG */ - -/* OS has priocntl (2) */ -#define ACE_HAS_PRIOCNTL 1 - -/* Platform has pread() and pwrite() support */ -#define ACE_HAS_P_READ_WRITE 1 - -/* Compiler/platform correctly calls init()/fini() for shared libraries */ -#define ACE_HAS_AUTOMATIC_INIT_FINI 1 - -/* Compiler handles explicit calling of template destructor correctly. - See "ace/OS.h" for details. */ -/* Staller: already defined by config-g++-common.h -#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR 1 -*/ - -/* Platform doesn't cast MAP_FAILED to a (void *). */ -/* #undef ACE_HAS_BROKEN_MAP_FAILED */ -/* Staller: oh yes, let's do this! */ -#define ACE_HAS_BROKEN_MAP_FAILED - - -/* Prototypes for both signal() and struct sigaction are consistent. */ -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 - -/* Compiler/platform has correctly prototyped header files */ -#define ACE_HAS_CPLUSPLUS_HEADERS - -/* Platform supports operations on directories via struct dirent, - readdir_r, etc. */ -#define ACE_HAS_DIRENT - -/* Compiler supports C++ exception handling */ -# if !defined (ACE_HAS_EXCEPTIONS) -#define ACE_HAS_EXCEPTIONS -# endif - -/* Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be - defined, except on Win32) */ -#define ACE_HAS_GETPAGESIZE - -/* Platform supports the getrusage() system call. */ -#define ACE_HAS_GETRUSAGE - -/* Platform has a getrusage () prototype in sys/resource.h that differs from - the one in ace/OS.i. */ -#define ACE_HAS_GETRUSAGE_PROTOTYPE - -/* The GPERF utility is compiled for this platform */ -#define ACE_HAS_GPERF - -/* Optimize ACE_Handle_Set::count_bits for select() operations (common case) */ -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1 - -/* Compiler/platform supports SunOS high resolution timers */ -/* #undef ACE_HAS_HI_RES_TIMER */ - -/* Compiler/platform supports idtype_t. */ -#define ACE_HAS_IDTYPE_T - -/* Inline all the static class OS methods to remove call overhead */ -/* Note: This gets defined by OS.h if __ACE_INLINE__ is defined */ -/* #undef ACE_HAS_INLINED_OSCALLS */ - -/* Platform supports IP multicast */ -#define ACE_HAS_IP_MULTICAST - -/* Platform supports thr_keydelete (e.g,. UNIXWARE) */ -#define ACE_HAS_THR_KEYDELETE - -/* Platform calls thr_minstack() rather than thr_min_stack() (e.g., Tandem). */ -#define ACE_HAS_THR_MINSTACK - -/* Some files, such as ace/streams.h, want to include new style C++ stream - headers. These headers are iomanip, ios, iostream, istream, ostream, - fstream and streambuf. If _all_ of these headers aren't available, then - assume that only iostream.h and fstream.h are available. */ -/* #define ACE_USES_OLD_IOSTREAMS */ - -/* Platform supports recvmsg and sendmsg */ -#define ACE_HAS_MSG - -/* Platform's select() uses non-const timeval* (only found on Linux right - now) */ -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -/* Uses ctime_r & asctime_r with only two parameters vs. three. */ -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - - -/* Platform is an Intel Pentium microprocessor. */ -/* There is a problem with the gethrtime() because of (apparently) a problem - with the inline assembly instruction. Hopefully there is a way to resolve - that with an improvement to the assembler -*/ -#ifdef ACE_HAS_PENTIUM -//#undef ACE_HAS_PENTIUM -#endif /* ACE_HAS_PENTIUM */ - - -/* Platform contains */ -#define ACE_HAS_POLL - -/* Platform supports POSIX O_NONBLOCK semantics */ -#define ACE_HAS_POSIX_NONBLOCK - -/* Platform supports the POSIX struct timespec type */ -#define ACE_HAS_POSIX_TIME - -/* Platform supports the /proc file system and defines tid_t - in */ -#define ACE_HAS_PROC_FS - -/* Platform supports POSIX Threads */ -#define ACE_HAS_PTHREADS - -/* Platform supports POSIX Threads .4a Draft 4 */ -/* #undef ACE_HAS_PTHREADS_DRAFT4 */ - -/* Platform supports POSIX Threads .4a Draft 6 */ -/* #undef ACE_HAS_PTHREADS_DRAFT6 */ - -/* Platform supports POSIX Threads .1c Draft 7 */ -/* #undef ACE_HAS_PTHREADS_DRAFT7 */ - -/* Platform supports POSIX.1c-1995 threads */ -#define ACE_HAS_PTHREADS_STD - -/* Platform has pthread_condattr_setkind_np(). */ -/* #undef ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP */ - -/* Platform has pthread_mutexattr_setkind_np(). */ -/* #undef ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP */ - -/* pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and - PTHREAD_PROCESS_SHARED values */ -#define ACE_HAS_PTHREAD_PROCESS_ENUM - -/* Platform will recurse infinitely on thread exits from TSS cleanup routines - (e.g., AIX) */ -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS - -/* Platform supports reentrant functions (i.e., all the POSIX *_r - functions). */ -#define ACE_HAS_REENTRANT_FUNCTIONS - -/* Platform has support for multi-byte character support compliant with the - XPG4 Worldwide Portability Interface wide-character classification. */ -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -/* Platform does not support reentrant netdb functions (getprotobyname_r, - getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). */ -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS - -/* Platform supports the POSIX regular expression library */ -#define ACE_HAS_REGEX - -/* Platform has special header for select(). */ -#define ACE_HAS_SELECT_H - -/* Platform has a function to set t_errno (e.g., Tandem). */ -#define ACE_HAS_SET_T_ERRNO - -/* Platform supports SVR4 extended signals */ -#define ACE_HAS_SIGINFO_T - -/* Platform/compiler has the sigwait(2) prototype */ -#define ACE_HAS_SIGWAIT - -/* Compiler/platform defines the sig_atomic_t typedef */ -#define ACE_HAS_SIG_ATOMIC_T - -/* Platform supports new BSD inet_addr len field. */ -#define ACE_HAS_SOCKADDR_IN_SIN_LEN - -/* OS/compiler uses size_t * rather than int * for socket lengths */ -#define ACE_HAS_SIZET_SOCKET_LEN - -/* Compiler/platform provides the sys/sockio.h file */ -#define ACE_HAS_SYS_SOCKIO_H - -/* Compiler supports the ssize_t typedef */ -#define ACE_HAS_SSIZE_T - -/* Platform supports UNIX International Threads */ -#define ACE_HAS_STHREADS - -/* Platform has thr_yield() */ -#define ACE_HAS_THR_YIELD - -/* Platform/compiler supports Standard C++ Library */ -/* It seems that UDK provides std-like declarations for only portions - such as -*/ -#define ACE_HAS_STANDARD_CPP_LIBRARY 0 - -/* Compiler/platform supports struct strbuf */ -#define ACE_HAS_STRBUF_T - -/* Platform supports STREAMS */ -#define ACE_HAS_STREAMS - -/* Platform supports STREAM pipes */ -#define ACE_HAS_STREAM_PIPES - -/* Compiler/platform supports strerror () */ -#define ACE_HAS_STRERROR - -/* Platform/Compiler supports a String class (e.g., GNU or Win32). */ -#define ACE_HAS_STRING_CLASS - -/* Platform has (which contains bzero() prototype) */ -#define ACE_HAS_STRINGS - -/* Platform/compiler supports void * as second parameter to gettimeofday(). */ -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY - -/* Compiler/platform supports SVR4 dynamic linking semantics */ -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -/* Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... */ -#define ACE_HAS_SVR4_TLI - -/* Compiler/platform contains the file. */ -#define ACE_HAS_SYS_SYSCALL_H - -/* Platform supports system configuration information */ -#define ACE_HAS_SYSINFO 1 - -/* Platform supports System V IPC (most versions of UNIX, but not Win32) */ -#define ACE_HAS_SYSV_IPC 1 - -/* Platform provides header */ -#define ACE_HAS_SYS_FILIO_H 1 - -/* Platform provides header */ -#define ACE_HAS_SYS_XTI_H 1 - -/* Compiler implements template specialization */ -#define ACE_HAS_TEMPLATE_SPECIALIZATION 1 - -/* Compiler implements templates that support typedefs inside of classes used - as formal arguments to a template class. */ -#define ACE_HAS_TEMPLATE_TYPEDEFS 1 - -/* Platform has POSIX terminal interface. */ -#define ACE_HAS_TERMIOS 1 - -/* Platform supports threads */ -#define ACE_HAS_THREADS 1 - -/* Compiler/platform has thread-specific storage */ -#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 - -/* Platform supports TLI timod STREAMS module */ -#define ACE_HAS_TIMOD_H 1 - -/* Platform supports TLI tiuser header */ -#define ACE_HAS_TIUSER_H 1 - -/* Platform supports TLI. Also see ACE_TLI_TCP_DEVICE. */ -#define ACE_HAS_TLI 1 - -/* Platform provides TLI function prototypes */ -#define ACE_HAS_TLI_PROTOTYPES 1 - -/* Platform supports ualarm() */ -#define ACE_HAS_UALARM 1 - -/* Platform supports ucontext_t (which is used in the extended signal API). */ -#define ACE_HAS_UCONTEXT_T 1 - -/* Platform has header file */ -#define ACE_HAS_UTIME 1 - -/* Compiler supports the C++ typename keyword */ -#define ACE_HAS_TYPENAME_KEYWORD 1 - -/* Prints out console message in ACE_NOTSUP. Useful for tracking down origin - of ACE_NOTSUP. */ -/* #undef ACE_HAS_VERBOSE_NOTSUP */ - -/* Platform requires void * for mmap(). */ -#define ACE_HAS_VOIDPTR_MMAP 1 - -/* Platform has XTI (X/Open-standardized superset of TLI). Implies - ACE_HAS_TLI but uses a different header file. */ -#define ACE_HAS_XTI 1 - -/* Platform can not build ace/IOStream{,_T}.cpp. This does not necessarily - mean that the platform does not support iostreams. */ -#define ACE_LACKS_ACE_IOSTREAM 1 - -/* Platform does not have u_longlong_t typedef */ -#define ACE_LACKS_U_LONGLONG_T 1 - -/* Platform lacks madvise() (e.g., Linux) */ -#define ACE_LACKS_MADVISE 1 - -/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */ -#define ACE_LACKS_PRI_T 1 - -/* Platform lacks pthread_thr_sigsetmask (e.g., MVS, HP/UX, and OSF/1 3.2) */ -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 - -/* Platfrom lack pthread_yield() support. */ -#define ACE_LACKS_PTHREAD_YIELD 1 - -/* Platform lacks readers/writer locks. */ -#define ACE_LACKS_RWLOCK_T 1 - -/* MIT pthreads platform lacks the timedwait prototypes */ -#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1 - -/* Platform does not define timepec_t as a typedef for struct timespec. */ -#define ACE_LACKS_TIMESPEC_T 1 - -/* Compile using multi-thread libraries */ -#define ACE_MT_SAFE 1 - -/* Platform needs regexpr.h for regular expression support */ -#define ACE_NEEDS_REGEXPR_H 1 - -/* Platform needs to #include to get thread scheduling defs. */ -#define ACE_NEEDS_SCHED_H 1 - -/* Turns off the LM_DEBUG and LM_ERROR logging macros... */ -/* #undef ACE_NLOGGING */ - -/* The OS/platform supports the poll() event demultiplexor */ -#define ACE_USE_POLL 1 - -/* Platform has its standard c++ library in the namespace std. */ -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -/* The number of bytes in a double. */ -#define SIZEOF_DOUBLE 8 - -/* The number of bytes in a float. */ -#define SIZEOF_FLOAT 4 - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long double. */ -#define SIZEOF_LONG_DOUBLE 12 - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* The number of bytes in a short. */ -#define SIZEOF_SHORT 2 - -/* The number of bytes in a signed char. */ -#define SIZEOF_SIGNED_CHAR 1 - -/* The number of bytes in a void *. */ -#define SIZEOF_VOID_P 4 - -/* Define if you have the execv function. */ -#define HAVE_EXECV 1 - -/* Define if you have the execve function. */ -#define HAVE_EXECVE 1 - -/* Define if you have the execvp function. */ -#define HAVE_EXECVP 1 - -/* Define if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the header file. */ -#define HAVE_FSTREAM 1 - -/* Define if you have the header file. */ -#define HAVE_IOMANIP 1 - -/* Define if you have the header file. */ -#define HAVE_IOSTREAM 1 - -/* Define if you have the header file. */ -#define HAVE_PWD_H 1 - -/* Name of package */ -#define PACKAGE "ace" - -/* Version number of package */ -#define VERSION "4.6.37" - -/* Added by Staller */ -#define ENUM_BOOLEAN // See file /usr/local/lib/gcc-lib/i486-pc-sysv5/egcs-2.91.60/include/sys/types.h -/* Hat nix gebracht -#define ACE_DEFAULT_SELECT_REACTOR_SIZE 256 // this is like in linux config fileto avoid another error -*/ -#define howmany(x, y) (((x)+((y)-1))/(y)) -#define ACE_HAS_BROKEN_T_ERROR // let disappear a nasty warning from OS.i -#if !defined (__USLC__) -# define __USLC__ 1 -#endif - -#define __IOCTL_VERSIONED__ // By Carlo! -#endif /* ACE_UNIXWARE_UDK_H */ diff --git a/ace/config-visualage.h b/ace/config-visualage.h deleted file mode 100644 index f4613f39c8f..00000000000 --- a/ace/config-visualage.h +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// This configuration file automatically includes the proper -// configurations for IBM's VisualAge C++ compiler on Win32 and AIX. - -#ifndef CONFIG_VISUALAGE_H -#define CONFIG_VISUALAGE_H -#include /**/ "ace/pre.h" - -#ifdef __TOS_WIN__ - #include "ace/config-win32.h" -#elif __TOS_AIX__ - #include "ace/config-aix-4.x.h" -#else - #include "PLATFORM NOT SPECIFIED" -#endif /* __TOS_WIN__ */ - -#include /**/ "ace/post.h" -#endif //CONFIG_VISUALAGE_H diff --git a/ace/config-vxworks5.x.h b/ace/config-vxworks5.x.h deleted file mode 100644 index 22ca2fa37b3..00000000000 --- a/ace/config-vxworks5.x.h +++ /dev/null @@ -1,331 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for VxWorks -// 5.5.x platforms using one of these compilers: -// 1) The GNU g++ compiler that is shipped with Tornado 2.2 or newer. -// 2) The Green Hills 1.8.8 and newer 1.8.9 compilers (not tested -// already for a long time) -// 3) The WindRiver Compiler (formerly known as Diab) - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (VXWORKS) -# define VXWORKS -#endif /* ! VXWORKS */ - -#if ! defined (ACE_VXWORKS) -# define ACE_VXWORKS 0x551 -#endif /* ! ACE_VXWORKS */ - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// Compiler-specific configuration. -#if defined (__GNUG__) -# include "ace/config-g++-common.h" - -# define ACE_LACKS_IOSTREAM_FX - -# if !defined (ACE_MAIN) -# define ACE_MAIN ace_main -# endif /* ! ACE_MAIN */ - -# define ACE_LACKS_LINEBUFFERED_STREAMBUF - -// An explicit check for Tornado 2.1, which had very limited release. -// See include/makeinclude/platform_vxworks5.x_g++.GNU for details -// on version conventions used by ACE for VxWorks. -# if ACE_VXWORKS == 0x542 - // Older versions of Tornado accidentally omitted math routines from - // the link library to support long long arithmetic. These could be - // found and used from another library in the distro. - // Recent versions of Tornado include these symbols, so we no longer - // have a problem. -# define ACE_LACKS_LONGLONG_T -# define ACE_LACKS_CLEARERR -# define ACE_LACKS_AUTO_PTR -# endif /* ACE_VXWORKS == 0x542 */ - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) - // GNU 3.3+ toolchain supports long long types but fails to define this so STL - // skips some definitions -# if !defined (_GLIBCPP_USE_LONG_LONG) -# define _GLIBCPP_USE_LONG_LONG -# endif -# endif /* (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) */ - -#elif defined (ghs) - // Processor type, if necessary. Green Hills defines "ppc". -# if defined (ppc) -# define ACE_HAS_POWERPC_TIMER -# define ACE_LACKS_CLEARERR -# endif /* ppc */ - -# define ACE_CONFIG_INCLUDE_GHS_COMMON -# include "ace/config-ghs-common.h" - -# define ACE_LACKS_UNISTD_H -# define ACE_LACKS_IOSTREAM_TOTALLY - -// Short-circuit the include of -// Green Hills has a problem with multiply defined functions -// with different parameters. -# define __INCineth - -#elif defined (__DCPLUSPLUS__) || defined (__DCC__) - // Diab 4.2a or later. -# if !defined (ACE_LACKS_PRAGMA_ONCE) - // We define it with a -D with make depend. -# define ACE_LACKS_PRAGMA_ONCE -# endif /* ! ACE_LACKS_PRAGMA_ONCE */ - - // Diab doesn't support VxWorks' iostream libraries. -# define ACE_LACKS_IOSTREAM_TOTALLY -# define ACE_LACKS_ACE_IOSTREAM - -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 0 - -# define ACE_TEMPLATES_REQUIRE_SOURCE - -#else /* ! __GNUG__ && ! ghs && !__DCC__ */ -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler on VxWorks -# endif /* __cplusplus */ -#endif /* ! __GNUG__ && ! ghs */ - -// OS-specific configuration -#define ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R -#define ACE_MKDIR_LACKS_MODE -#define ACE_HAS_NONCONST_GETBY -#define ACE_HAS_NONCONST_STAT -#define ACE_HAS_NONCONST_SWAB -#define ACE_HAS_NONCONST_READV -#define ACE_HAS_NONCONST_CHDIR -#define ACE_HAS_NONCONST_UNLINK -#define ACE_HAS_NONCONST_OPENDIR -#define ACE_LACKS_UNIX_SYSLOG -#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 32768 -#define ACE_DEFAULT_THREAD_KEYS 16 -#define ACE_HAS_BROKEN_ACCEPT_ADDR -#define ACE_HAS_NONCONST_SENDMSG -#define ACE_HAS_NONCONST_WRITEV -#define ACE_HAS_CHARPTR_DL -#define ACE_HAS_CHARPTR_SOCKOPT -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_DIRENT -#define ACE_HAS_DLL 0 -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_MSG -#define ACE_HAS_NONCONST_READV -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_STRDUP_EMULATION -#define ACE_HAS_STRERROR -#define ACE_HAS_THREADS -#define ACE_LACKS_ACCESS -#define ACE_LACKS_EXEC -#define ACE_LACKS_FCNTL -#define ACE_LACKS_FILELOCKS -#define ACE_LACKS_FORK -#define ACE_LACKS_FSYNC -#define ACE_LACKS_GETHOSTENT -#define ACE_LACKS_GETOPT -#define ACE_LACKS_GETPID -#define ACE_LACKS_GETPPID -#define ACE_LACKS_GETSERVBYNAME -#define ACE_LACKS_KEY_T -#define ACE_LACKS_LSTAT -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MALLOC_H -#define ACE_LACKS_MEMORY_H -#define ACE_LACKS_MKFIFO -#define ACE_LACKS_MKTEMP -#define ACE_LACKS_MKSTEMP -#define ACE_LACKS_MMAP -#define ACE_LACKS_MPROTECT -#define ACE_LACKS_MSYNC -#define ACE_LACKS_NUMERIC_LIMITS -#define ACE_LACKS_GETPROTOBYNAME -#define ACE_LACKS_GETPROTOBYNUMBER -#define ACE_LACKS_GETHOSTBYADDR -#define ACE_LACKS_GETHOSTBYNAME -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_SYS_PARAM_H -#define ACE_LACKS_PWD_FUNCTIONS -#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_READLINK -#define ACE_LACKS_REALPATH -#define ACE_LACKS_RLIMIT -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SBRK -#define ACE_LACKS_SEEKDIR -#define ACE_LACKS_SEMBUF_T -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_SI_ADDR -#define ACE_LACKS_SOCKETPAIR -#define ACE_LACKS_STRCASECMP -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYSCONF -#define ACE_LACKS_SYS_SYSCTL_H -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_TELLDIR -#define ACE_LACKS_TEMPNAM -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_TRUNCATE -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_UMASK -#define ACE_LACKS_UTSNAME_T -#define ACE_LACKS_UNAME -#define ACE_LACKS_STRPTIME -#define ACE_LACKS_WAIT -#define ACE_LACKS_WAITPID -#define ACE_LACKS_DUP2 -#define ACE_LACKS_DUP -#define ACE_LACKS_SUSECONDS_T -#define ACE_LACKS_USECONDS_T -#define ACE_PAGE_SIZE 4096 -#define ACE_THR_PRI_FIFO_DEF 101 -#define ACE_THR_PRI_OTHER_DEF ACE_THR_PRI_FIFO_DEF -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND -#if !defined (ACE_VXWORKS_SPARE) -# define ACE_VXWORKS_SPARE spare4 -#endif /* ! ACE_VXWORKS_SPARE */ - -#define ACE_LACKS_SETEGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID -#define ACE_LACKS_SETSID -#define ACE_LACKS_SETUID -#define ACE_LACKS_SETEUID -#define ACE_LACKS_GETEGID -#define ACE_LACKS_GETGID -#define ACE_LACKS_GETEUID -#define ACE_LACKS_GETUID -#define ACE_LACKS_SETGID -#define ACE_LACKS_GETPGID - -#define ACE_LACKS_PIPE -#define ACE_LACKS_STDINT_H -#define ACE_LACKS_INTTYPES_H -#define ACE_LACKS_UNISTD_H -#define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_SYS_TIME_H -#define ACE_LACKS_SYS_RESOURCE_H -#define ACE_LACKS_DLFCN_H -#define ACE_LACKS_SYS_UIO_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_WCHAR_H -#define ACE_LACKS_PWD_H -#define ACE_LACKS_SEARCH_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_STRINGS_H -#define ACE_LACKS_TERMIOS_H -#define ACE_LACKS_POLL_H -#define ACE_LACKS_WCTYPE_H - -// Not sure if these should always be defined. -#define ACE_LACKS_SYS_UN_H - -// Some string things -#define ACE_LACKS_WCSCAT -#define ACE_LACKS_WCSCHR -#define ACE_LACKS_WCSCMP -#define ACE_LACKS_WCSCPY -#define ACE_LACKS_WCSCSPN -#define ACE_LACKS_WCSLEN -#define ACE_LACKS_WCSNCAT -#define ACE_LACKS_WCSNCMP -#define ACE_LACKS_WCSNCPY -#define ACE_LACKS_WCSPBRK -#define ACE_LACKS_WCSRCHR -#define ACE_LACKS_WCSSPN -#define ACE_LACKS_WCSSTR -#define ACE_LACKS_WCSTOK -#define ACE_LACKS_TOWLOWER -#define ACE_LACKS_TOWUPPER -#define ACE_LACKS_ITOW -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSNICMP -#define ACE_LACKS_WCSTOD -#define ACE_LACKS_WCSTOL -#define ACE_LACKS_WCSTOUL -#define ACE_LACKS_WCSDUP - -#define ACE_LACKS_SYMLINKS -#define ACE_LACKS_FGETWC -#define ACE_LACKS_FGETWS -#define ACE_LACKS_FPUTWS - -// It is possible to enable pthread support with VxWorks, when the user decides -// to use this, we need some more defines -#if defined ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD -# define ACE_LACKS_CONDATTR_PSHARED -# define ACE_LACKS_MUTEXATTR_PSHARED -# define ACE_HAS_THREAD_SPECIFIC_STORAGE -# define ACE_HAS_POSIX_SEM -// Include this file, the sys/stat.h file shipped with VxWorks has old types -// and without this include we get a lot of compile errors. A TSR has been filed -// so that hopefully in the future we can zap this include -#include "types/vxTypesOld.h" -#else -# define ACE_LACKS_PTHREAD_H -# define ACE_LACKS_COND_T -// VxWorks has no recursive mutexes. This was set in the past but it doesn't -// work with the pthread support, so only set it for the time being when pthread -// is disabled -# define ACE_HAS_RECURSIVE_MUTEXES -// VxWorks does not have the pthread_mutex_timedlock operation, but there is -// an emulation for this when not using the pthread mapping -#define ACE_HAS_MUTEX_TIMEOUTS -#define ACE_HAS_TSS_EMULATION -#endif - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -// Needed include to get all VxWorks CPU types -#include "types/vxCpu.h" -#if (CPU == PENTIUM || CPU == PENTIUM2 || CPU == PENTIUM3 || CPU == PENTIUM4) -// If running an Intel Pentium the -// ACE_OS::gethrtime () can use the RDTSC instruction. -# define ACE_HAS_PENTIUM -#endif - -#if !defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE) -# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 -#endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */ - -#if !defined (ACE_NTRACE) -# define ACE_NTRACE 1 -#endif /* ACE_NTRACE */ - -// By default, don't include RCS Id strings in object code. -#if !defined (ACE_USE_RCSID) -#define ACE_USE_RCSID 0 -#endif /* !ACE_USE_RCSID */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-vxworks6.2.h b/ace/config-vxworks6.2.h deleted file mode 100644 index c3624fd82c1..00000000000 --- a/ace/config-vxworks6.2.h +++ /dev/null @@ -1,321 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for VxWorks -// 6.2 platforms using one of these compilers: -// 1) The GNU g++ compiler that is shipped with VxWorks 6.2 - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (VXWORKS) -# define VXWORKS -#endif /* ! VXWORKS */ - -#if ! defined (ACE_VXWORKS) -# define ACE_VXWORKS 0x620 -#endif /* ! ACE_VXWORKS */ - -// Fix for wrong typedef of suseconds_t -// *and* for including right typedef for pid_t in VxTypes.h (int) -// before wrong typedef in unistd.h (unsigned short) -#include -#include -#define suseconds_t long -// END Fix - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// Compiler-specific configuration. -#if defined (__GNUG__) -# include "ace/config-g++-common.h" - -# define ACE_LACKS_IOSTREAM_FX -# define ACE_LACKS_LINEBUFFERED_STREAMBUF - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) - // GNU 3.3+ toolchain supports long long types but fails to define this so STL - // skips some definitions -# if !defined (_GLIBCPP_USE_LONG_LONG) -# define _GLIBCPP_USE_LONG_LONG -# endif -# endif /* (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) */ - -#elif defined (ghs) - // Processor type, if necessary. Green Hills defines "ppc". -# if defined (ppc) -# define ACE_HAS_POWERPC_TIMER -# define ACE_LACKS_CLEARERR -# endif /* ppc */ - -# define ACE_CONFIG_INCLUDE_GHS_COMMON -# include "ace/config-ghs-common.h" - -# define ACE_LACKS_UNISTD_H -# define ACE_LACKS_IOSTREAM_TOTALLY - -// Short-circuit the include of -// Green Hills has a problem with multiply defined functions -// with different parameters. -# define __INCineth - -#elif defined (__DCPLUSPLUS__) || defined (__DCC__) - // Diab 4.2a or later. -# if !defined (ACE_LACKS_PRAGMA_ONCE) - // We define it with a -D with make depend. -# define ACE_LACKS_PRAGMA_ONCE -# endif /* ! ACE_LACKS_PRAGMA_ONCE */ - -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# define ACE_TEMPLATES_REQUIRE_SOURCE - -#else /* ! __GNUG__ && ! ghs && !__DCC__ */ -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler on VxWorks -# endif /* __cplusplus */ -#endif /* ! __GNUG__ && ! ghs */ - -// OS-specific configuration -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#define ACE_HAS_NONCONST_GETBY -#define ACE_HAS_NONCONST_SWAB -#define ACE_HAS_NONCONST_READV -#define ACE_LACKS_UNIX_SYSLOG -#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 32768 -#define ACE_DEFAULT_THREAD_KEYS 16 -#define ACE_HAS_BROKEN_ACCEPT_ADDR -#define ACE_HAS_NONCONST_SENDMSG -#define ACE_HAS_NONCONST_WRITEV -#define ACE_HAS_CHARPTR_DL -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_DIRENT -#define ACE_HAS_DLL 0 -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_MSG -#define ACE_HAS_NONCONST_READV -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SNPRINTF -#define ACE_HAS_STRERROR -#define ACE_HAS_THREADS -#define ACE_HAS_SYSCTL -#define ACE_LACKS_EXEC -#define ACE_LACKS_FILELOCKS -#define ACE_LACKS_FORK -#define ACE_LACKS_GETHOSTENT -#define ACE_LACKS_GETSERVBYNAME -#define ACE_LACKS_GETPROTOBYNAME -#define ACE_LACKS_GETPROTOBYNUMBER -#define ACE_LACKS_KEY_T -#define ACE_LACKS_LSTAT -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MALLOC_H -#define ACE_LACKS_MEMORY_H -#define ACE_LACKS_MKFIFO -#define ACE_LACKS_MKTEMP -#define ACE_LACKS_MKSTEMP -#define ACE_LACKS_MMAP -#define ACE_LACKS_MPROTECT -#define ACE_LACKS_MSYNC -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_SYS_PARAM_H -#define ACE_LACKS_PWD_FUNCTIONS -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_READLINK -#define ACE_LACKS_REALPATH -#define ACE_LACKS_PIPE -#define ACE_LACKS_RLIMIT -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SBRK -#define ACE_LACKS_SEEKDIR -#define ACE_LACKS_SEMBUF_T -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_SI_ADDR -#define ACE_LACKS_SOCKETPAIR -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_TELLDIR -#define ACE_LACKS_TEMPNAM -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_TRUNCATE -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_USECONDS_T -#define ACE_LACKS_UMASK -#define ACE_LACKS_STRPTIME -#define ACE_PAGE_SIZE 4096 -#define ACE_THR_PRI_FIFO_DEF 101 -#define ACE_THR_PRI_OTHER_DEF ACE_THR_PRI_FIFO_DEF -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND -#if !defined (ACE_VXWORKS_SPARE) -# define ACE_VXWORKS_SPARE spare4 -#endif /* ! ACE_VXWORKS_SPARE */ -#define ACE_HAS_GETIFADDRS - -#define ACE_LACKS_SETEGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID -#define ACE_LACKS_SETSID -#define ACE_LACKS_SETUID -#define ACE_LACKS_SETEUID -#define ACE_LACKS_GETEUID -#define ACE_LACKS_GETUID -#define ACE_LACKS_GETPGID -#define ACE_LACKS_GETEGID -#define ACE_LACKS_GETGID -#define ACE_LACKS_SETGID - -#define ACE_LACKS_SYS_UIO_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_PWD_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_TERMIOS_H -#define ACE_LACKS_POLL_H -#define ACE_LACKS_FCNTL - -// Some string things -#define ACE_LACKS_STRCASECMP -#define ACE_LACKS_ITOW -#define ACE_LACKS_WCSDUP -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSNICMP - -#define ACE_HAS_CHARPTR_SOCKOPT -#define ACE_LACKS_SYMLINKS - -#if defined __RTP__ - // We are building for RTP mode - #define ACE_HAS_SVR4_DYNAMIC_LINKING - #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - #define ACE_LACKS_REGEX_H - #define ACE_LACKS_PUTENV - #define ACE_HAS_SETENV - #define ACE_HAS_3_PARAM_WCSTOK - #define ACE_HAS_WCHAR - #define ACE_SIZEOF_WCHAR 2 -#else - // We are building for kernel mode - #define ACE_LACKS_SUSECONDS_T - #define ACE_LACKS_INTTYPES_H - #define ACE_LACKS_STDINT_H - #define ACE_LACKS_UNAME - #define ACE_LACKS_UTSNAME_T - #define ACE_LACKS_RAND_REENTRANT_FUNCTIONS - #define ACE_LACKS_DLFCN_H - #define ACE_LACKS_WAIT - #define ACE_LACKS_WAITPID - #define ACE_LACKS_SYS_TIME_H - #define ACE_LACKS_SYS_SELECT_H - #define ACE_LACKS_STRINGS_H - #define ACE_MKDIR_LACKS_MODE - #define ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R - #define ACE_LACKS_SEARCH_H - #define ACE_LACKS_SYSCONF - #define ACE_LACKS_GETPID - #define ACE_LACKS_GETPPID - #define ACE_LACKS_WCHAR_H - #define ACE_LACKS_WCTYPE_H - #define ACE_LACKS_WCSCAT - #define ACE_LACKS_WCSCHR - #define ACE_LACKS_WCSCMP - #define ACE_LACKS_WCSCPY - #define ACE_LACKS_WCSCSPN - #define ACE_LACKS_WCSLEN - #define ACE_LACKS_WCSNCAT - #define ACE_LACKS_WCSNCMP - #define ACE_LACKS_WCSNCPY - #define ACE_LACKS_WCSPBRK - #define ACE_LACKS_WCSRCHR - #define ACE_LACKS_WCSSPN - #define ACE_LACKS_WCSSTR - #define ACE_LACKS_WCSTOK - #define ACE_LACKS_TOWLOWER - #define ACE_LACKS_TOWUPPER - #define ACE_LACKS_WCSTOD - #define ACE_LACKS_WCSTOL - #define ACE_LACKS_WCSTOUL - #define ACE_LACKS_FGETWC - #define ACE_LACKS_FGETWS - #define ACE_LACKS_FPUTWS - #if !defined (ACE_MAIN) - # define ACE_MAIN ace_main - #endif /* ! ACE_MAIN */ -#endif - -// It is possible to enable pthread support with VxWorks, when the user decides -// to use this, we need some more defines -#if defined ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD -# define ACE_HAS_THREAD_SPECIFIC_STORAGE -# define ACE_HAS_POSIX_SEM -# define ACE_LACKS_MUTEXATTR_PSHARED -# define ACE_LACKS_CONDATTR_PSHARED -// Include this file, the sys/stat.h file shipped with VxWorks has old types -// and without this include we get a lot of compile errors. A TSR has been filed -// so that hopefully in the future we can zap this include -#include "types/vxTypesOld.h" -#else -# define ACE_LACKS_PTHREAD_H -# if !defined __RTP__ -// Only when building for kernel mode we can use TSS emulation, in rtp mode -// we can't use the WIND_TCB struct anymore -# define ACE_HAS_TSS_EMULATION -# endif -// VxWorks has no recursive mutexes. This was set in the past but it doesn't -// work with the pthread support, so only set it for the time being when pthread -// is disabled -# define ACE_HAS_RECURSIVE_MUTEXES -# define ACE_LACKS_COND_T -# define ACE_HAS_MUTEX_TIMEOUTS -#endif - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -// Needed include to get all VxWorks CPU types -#include "types/vxCpu.h" -#if (CPU == PENTIUM || CPU == PENTIUM2 || CPU == PENTIUM3 || CPU == PENTIUM4) -// If running an Intel Pentium the -// ACE_OS::gethrtime () can use the RDTSC instruction. -# define ACE_HAS_PENTIUM -#endif - -// VxWorks defines the CPU define MAP, undef it to prevent problems with -// application code -#if defined (MAP) -#undef MAP -#endif /* MAP */ - -#if !defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE) -# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 -#endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */ - -#if !defined (ACE_NTRACE) -# define ACE_NTRACE 1 -#endif /* ACE_NTRACE */ - -// By default, don't include RCS Id strings in object code. -#if !defined (ACE_USE_RCSID) -#define ACE_USE_RCSID 0 -#endif /* !ACE_USE_RCSID */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-vxworks6.3.h b/ace/config-vxworks6.3.h deleted file mode 100644 index 5212287b2ea..00000000000 --- a/ace/config-vxworks6.3.h +++ /dev/null @@ -1,283 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for VxWorks -// 6.2 platforms using one of these compilers: -// 1) The GNU g++ compiler that is shipped with VxWorks 6.3 - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (VXWORKS) -# define VXWORKS -#endif /* ! VXWORKS */ - -#if ! defined (ACE_VXWORKS) -# define ACE_VXWORKS 0x630 -#endif /* ! ACE_VXWORKS */ - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// Compiler-specific configuration. -#if defined (__GNUG__) -# include "ace/config-g++-common.h" - -# define ACE_LACKS_IOSTREAM_FX -# define ACE_LACKS_LINEBUFFERED_STREAMBUF - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) - // GNU 3.3+ toolchain supports long long types but fails to define this so STL - // skips some definitions -# if !defined (_GLIBCPP_USE_LONG_LONG) -# define _GLIBCPP_USE_LONG_LONG -# endif -# endif /* (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) */ - -#else /* ! __GNUG__ && ! ghs && !__DCC__ */ -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler on VxWorks -# endif /* __cplusplus */ -#endif /* ! __GNUG__ && ! ghs */ - -// OS-specific configuration -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#define ACE_HAS_NONCONST_GETBY -#define ACE_HAS_NONCONST_SWAB -#define ACE_HAS_NONCONST_READV -#define ACE_LACKS_UNIX_SYSLOG -#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 32768 -#define ACE_DEFAULT_THREAD_KEYS 16 -#define ACE_HAS_BROKEN_ACCEPT_ADDR -#define ACE_HAS_NONCONST_SENDMSG -#define ACE_HAS_NONCONST_WRITEV -#define ACE_HAS_CHARPTR_DL -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_DIRENT -#define ACE_HAS_DLL 0 -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_MSG -#define ACE_HAS_NONCONST_READV -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SNPRINTF -#define ACE_HAS_STRERROR -#define ACE_HAS_THREADS -#define ACE_HAS_SYSCTL -#define ACE_LACKS_EXEC -#define ACE_LACKS_FILELOCKS -#define ACE_LACKS_FORK -#define ACE_LACKS_GETHOSTENT -#define ACE_LACKS_GETSERVBYNAME -#define ACE_LACKS_GETPROTOBYNAME -#define ACE_LACKS_GETPROTOBYNUMBER -#define ACE_LACKS_LSTAT -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MALLOC_H -#define ACE_LACKS_MEMORY_H -#define ACE_LACKS_MKFIFO -#define ACE_LACKS_MKTEMP -#define ACE_LACKS_MKSTEMP -#define ACE_LACKS_MMAP -#define ACE_LACKS_MPROTECT -#define ACE_LACKS_MSYNC -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_SYS_PARAM_H -#define ACE_LACKS_PWD_FUNCTIONS -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_READLINK -#define ACE_LACKS_REALPATH -#define ACE_LACKS_PIPE -#define ACE_LACKS_RLIMIT -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SBRK -#define ACE_LACKS_SEEKDIR -#define ACE_LACKS_SEMBUF_T -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_SI_ADDR -#define ACE_LACKS_SOCKETPAIR -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_TELLDIR -#define ACE_LACKS_TEMPNAM -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_TRUNCATE -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_USECONDS_T -#define ACE_LACKS_UMASK -#define ACE_LACKS_STRPTIME -#define ACE_PAGE_SIZE 4096 -#define ACE_THR_PRI_FIFO_DEF 101 -#define ACE_THR_PRI_OTHER_DEF ACE_THR_PRI_FIFO_DEF -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND -#if !defined (ACE_VXWORKS_SPARE) -# define ACE_VXWORKS_SPARE spare4 -#endif /* ! ACE_VXWORKS_SPARE */ -#define ACE_HAS_GETIFADDRS - -#define ACE_LACKS_SETEGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID -#define ACE_LACKS_SETSID -#define ACE_LACKS_SETUID -#define ACE_LACKS_SETEUID -#define ACE_LACKS_GETEUID -#define ACE_LACKS_GETUID -#define ACE_LACKS_GETPGID -#define ACE_LACKS_GETEGID -#define ACE_LACKS_GETGID -#define ACE_LACKS_SETGID - -#define ACE_LACKS_SYS_UIO_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_PWD_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_TERMIOS_H -#define ACE_LACKS_POLL_H -#define ACE_LACKS_FCNTL - -// Some string things -#define ACE_LACKS_STRCASECMP -#define ACE_LACKS_ITOW -#define ACE_LACKS_WCSDUP -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSNICMP - -#define ACE_HAS_CHARPTR_SOCKOPT -#define ACE_LACKS_SYMLINKS - -#if defined __RTP__ - // We are building for RTP mode - #define ACE_HAS_SVR4_DYNAMIC_LINKING - #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - #define ACE_LACKS_REGEX_H - #define ACE_LACKS_PUTENV - #define ACE_HAS_SETENV - #define ACE_HAS_3_PARAM_WCSTOK - #define ACE_HAS_WCHAR - #define ACE_SIZEOF_WCHAR 2 -#else - // We are building for kernel mode - #define ACE_LACKS_SUSECONDS_T - #define ACE_LACKS_INTTYPES_H - #define ACE_LACKS_STDINT_H - #define ACE_LACKS_UNAME - #define ACE_LACKS_UTSNAME_T - #define ACE_LACKS_RAND_REENTRANT_FUNCTIONS - #define ACE_LACKS_DLFCN_H - #define ACE_LACKS_WAIT - #define ACE_LACKS_WAITPID - #define ACE_LACKS_SYS_TIME_H - #define ACE_LACKS_SYS_SELECT_H - #define ACE_LACKS_STRINGS_H - #define ACE_MKDIR_LACKS_MODE - #define ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R - #define ACE_LACKS_SEARCH_H - #define ACE_LACKS_SYSCONF - #define ACE_LACKS_GETPID - #define ACE_LACKS_GETPPID - #define ACE_LACKS_WCHAR_H - #define ACE_LACKS_WCTYPE_H - #define ACE_LACKS_WCSCAT - #define ACE_LACKS_WCSCHR - #define ACE_LACKS_WCSCMP - #define ACE_LACKS_WCSCPY - #define ACE_LACKS_WCSCSPN - #define ACE_LACKS_WCSLEN - #define ACE_LACKS_WCSNCAT - #define ACE_LACKS_WCSNCMP - #define ACE_LACKS_WCSNCPY - #define ACE_LACKS_WCSPBRK - #define ACE_LACKS_WCSRCHR - #define ACE_LACKS_WCSSPN - #define ACE_LACKS_WCSSTR - #define ACE_LACKS_WCSTOK - #define ACE_LACKS_TOWLOWER - #define ACE_LACKS_TOWUPPER - #define ACE_LACKS_WCSTOD - #define ACE_LACKS_WCSTOL - #define ACE_LACKS_WCSTOUL - #define ACE_LACKS_FGETWC - #define ACE_LACKS_FGETWS - #define ACE_LACKS_FPUTWS - #if !defined (ACE_MAIN) - # define ACE_MAIN ace_main - #endif /* ! ACE_MAIN */ -#endif - -// It is possible to enable pthread support with VxWorks, when the user decides -// to use this, we need some more defines -#if defined ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD -# define ACE_HAS_THREAD_SPECIFIC_STORAGE -# define ACE_HAS_POSIX_SEM -# define ACE_LACKS_MUTEXATTR_PSHARED -# define ACE_LACKS_CONDATTR_PSHARED -// Include this file, the sys/stat.h file shipped with VxWorks has old types -// and without this include we get a lot of compile errors. A TSR has been filed -// so that hopefully in the future we can zap this include -#include "types/vxTypesOld.h" -#else -# define ACE_LACKS_PTHREAD_H -# if !defined __RTP__ -// Only when building for kernel mode we can use TSS emulation, in rtp mode -// we can't use the WIND_TCB struct anymore -# define ACE_HAS_TSS_EMULATION -# endif -// VxWorks has no recursive mutexes. This was set in the past but it doesn't -// work with the pthread support, so only set it for the time being when pthread -// is disabled -# define ACE_HAS_RECURSIVE_MUTEXES -# define ACE_LACKS_COND_T -# define ACE_HAS_MUTEX_TIMEOUTS -#endif - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -// Needed include to get all VxWorks CPU types -#include "types/vxCpu.h" -#if (CPU == PENTIUM || CPU == PENTIUM2 || CPU == PENTIUM3 || CPU == PENTIUM4) -// If running an Intel Pentium the -// ACE_OS::gethrtime () can use the RDTSC instruction. -# define ACE_HAS_PENTIUM -#endif - -// VxWorks defines the CPU define MAP, undef it to prevent problems with -// application code -#if defined (MAP) -#undef MAP -#endif /* MAP */ - -#if !defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE) -# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 -#endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */ - -#if !defined (ACE_NTRACE) -# define ACE_NTRACE 1 -#endif /* ACE_NTRACE */ - -// By default, don't include RCS Id strings in object code. -#if !defined (ACE_USE_RCSID) -#define ACE_USE_RCSID 0 -#endif /* !ACE_USE_RCSID */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-win32-borland.h b/ace/config-win32-borland.h deleted file mode 100644 index 91b81ece8a1..00000000000 --- a/ace/config-win32-borland.h +++ /dev/null @@ -1,130 +0,0 @@ -// -*- C++ -*- -//$Id$ - -// The following configuration file contains defines for Borland compilers. - -#ifndef ACE_CONFIG_WIN32_BORLAND_H -#define ACE_CONFIG_WIN32_BORLAND_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -#include "config-borland-common.h" - -// Automatically define WIN32 macro if the compiler tells us it is our -// target platform. -# if defined (__WIN32__) && !defined (WIN32) -# define WIN32 1 -# endif - -// When building a VCL application, the main VCL header file should be -// included before anything else. You can define ACE_HAS_VCL=1 in your -// project settings to have this file included for you automatically. -# if defined (ACE_HAS_VCL) && (ACE_HAS_VCL != 0) -# include /**/ -# endif - -# define ACE_CC_PREPROCESSOR "CPP32.EXE" - -# include "ace/config-win32-common.h" - -// Borland on win32 has swab -# undef ACE_LACKS_SWAB - -# define ACE_WSTRING_HAS_USHORT_SUPPORT 1 -# define ACE_HAS_DIRENT - -#ifdef ACE_USES_STD_NAMESPACE_FOR_STDC_LIB -#undef ACE_USES_STD_NAMESPACE_FOR_STDC_LIB -#define ACE_USES_STD_NAMESPACE_FOR_STDC_LIB 1 -#endif - -#define ACE_NEEDS_DL_UNDERSCORE - -#define ACE_LACKS_TERMIOS_H -#define ACE_LACKS_NETINET_TCP_H -#define ACE_LACKS_REGEX_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_PWD_H -#define ACE_LACKS_POLL_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_STRINGS_H -#define ACE_LACKS_SEMAPHORE_H -#define ACE_LACKS_INTTYPES_H -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_SYS_TIME_H -#define ACE_LACKS_SYS_RESOURCE_H -#define ACE_LACKS_SYS_WAIT_H -#define ACE_LACKS_DLFCN_H -#define ACE_LACKS_SYS_MMAN_H -#define ACE_LACKS_SYS_UIO_H -#define ACE_LACKS_SYS_SOCKET_H -#define ACE_LACKS_NETINET_IN_H -#define ACE_LACKS_NETDB_H -#define ACE_LACKS_NET_IF_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_SYS_IOCTL_H -#define ACE_LACKS_STROPTS_H - -#undef ACE_LACKS_STRUCT_DIR -#undef ACE_LACKS_CLOSEDIR -#undef ACE_LACKS_OPENDIR -#undef ACE_LACKS_READDIR -#undef ACE_LACKS_REWINDDIR - -#define ACE_HAS_WOPENDIR -#define ACE_HAS_WCLOSEDIR -#define ACE_HAS_WREADDIR -#define ACE_HAS_WREWINDDIR - -#define ACE_LACKS_STRRECVFD -#define ACE_USES_EXPLICIT_STD_NAMESPACE - -#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -// must have _MT defined to include multithreading -// features from win32 headers -# if !defined(__MT__) -// *** DO NOT *** defeat this error message by defining __MT__ yourself. -// You must link with the multi threaded libraries. Add -tWM to your -// compiler options -# error You must link against multi-threaded libraries when using ACE (check your project settings) -# endif /* !_MT && !ACE_HAS_WINCE */ -#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ - -#if (__BORLANDC__ < 0x580) -# define ACE_LACKS_INTPTR_T -# define ACE_HAS_NONCONST_SWAB -# define ACE_HAS_NONCONST_FDOPEN -#endif - -#define ACE_HAS_NONCONST_TEMPNAM - -// The Borland compiler can't handle assembly in inline methods or -// templates (E2211). When we build for pentium optimized and we are inlining -// then we disable inline assembly -#if defined (ACE_HAS_PENTIUM) && defined(__ACE_INLINE__) -# define ACE_LACKS_INLINE_ASSEMBLY -#endif - -#if (__BORLANDC__ >= 0x600) -# define ACE_LACKS_PTRDIFF_T -# define ACE_PTRDIFF_T_TYPE std::ptrdiff_t -# define ACE_HAS_DINKUM_STL -# undef ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS -# define ACE_STRCASECMP_EQUIVALENT std::strcasecmp -# define ACE_STRNCASECMP_EQUIVALENT std::strncasecmp -# define ACE_LACKS_WCSDUP -# define ACE_HAS_3_PARAM_WCSTOK -#else -# define ACE_WCSDUP_EQUIVALENT ::_wcsdup -# define ACE_STRCASECMP_EQUIVALENT ::stricmp -# define ACE_STRNCASECMP_EQUIVALENT ::strnicmp -# define ACE_HAS_ITOA 1 -#endif - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_BORLAND_H */ diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h deleted file mode 100644 index d237e64aa95..00000000000 --- a/ace/config-win32-common.h +++ /dev/null @@ -1,623 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - - -#ifndef ACE_CONFIG_WIN32_COMMON_H -#define ACE_CONFIG_WIN32_COMMON_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - - -// Windows Mobile (CE) stuff is primarily further restrictions to what's -// in the rest of this file. Also, it defined ACE_HAS_WINCE, which is used -// in this file. -#if defined (_WIN32_WCE) -# include "ace/config-WinCE.h" -#endif /* _WIN32_WCE */ - -// Complain if WIN32 is not already defined. -#if !defined (WIN32) && !defined (ACE_HAS_WINCE) -# error Please define WIN32 in your project settings. -#endif - -#define ACE_WIN32 -#if defined (_WIN64) || defined (WIN64) -# define ACE_WIN64 -#endif /* _WIN64 || WIN64 */ - -// Define this if you're running NT >= 4.0 (Win2K == NT 5). -// Setting applies to : building ACE -// Runtime restrictions: System must be Windows NT => 4.0 -#if !defined (ACE_HAS_WINNT4) -# define ACE_HAS_WINNT4 1 /* assuming Win NT 4.0 or greater */ -#endif - -#if (defined (ACE_HAS_WINNT4) && ACE_HAS_WINNT4 != 0) -# if !defined (_WIN32_WINNT) -# define _WIN32_WINNT 0x0400 -# endif -#else -// On Win9X, a shared address SHOULD be between the 2nd and 3rd Gb. -// Note this will not work for NT: The addresses above 2Gb are -// reserved for the system, so this one will fail. -# if !defined (ACE_DEFAULT_BASE_ADDR) -# define ACE_DEFAULT_BASE_ADDR ((char*) ((2048UL+512UL)*1024UL*1024UL)) -# endif -#endif - -// If the invoking procedure turned off debugging by setting NDEBUG, then -// also set ACE_NDEBUG, unless the user has already set it. -#if defined (NDEBUG) -# if !defined (ACE_NDEBUG) -# define ACE_NDEBUG -# endif /* ACE_NDEBUG */ -#endif /* NDEBUG */ - -// Define ACE_HAS_MFC to 1, if you want ACE to use CWinThread. This should -// be defined, if your application uses MFC. -// Setting applies to : building ACE -// Runtime restrictions: MFC DLLs must be installed -// Additonal notes : If both ACE_HAS_MFC and ACE_MT_SAFE are -// defined, the MFC DLL (not the static lib) -// will be used from ACE. -#if !defined (ACE_HAS_MFC) -# define ACE_HAS_MFC 0 -#endif - -// ACE_USES_STATIC_MFC always implies ACE_HAS_MFC -#if defined (ACE_USES_STATIC_MFC) -# if defined (ACE_HAS_MFC) -# undef ACE_HAS_MFC -# endif -# define ACE_HAS_MFC 1 -#endif /* ACE_USES_STATIC_MFC */ - -// Define ACE_HAS_STRICT to 1 in your config.h file if you want to use -// STRICT type checking. It is disabled by default because it will -// break existing application code. However, if ACE_HAS_MFC is turned on, -// ACE_HAS_STRICT is required by MFC. -// Setting applies to : building ACE, linking with ACE -// Runtime restrictions: - -#if !defined (ACE_HAS_STRICT) -# define ACE_HAS_STRICT 0 -#endif - -// MFC itself defines STRICT. -#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) -# undef ACE_HAS_STRICT -# define ACE_HAS_STRICT 1 -#endif - -// Turn off the following define if you want to disable threading. -// Compile using multi-thread libraries. -// Setting applies to : building ACE, linking with ACE -// Runtime restrictions: multithreaded runtime DLL must be installed -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -// Build ACE services as DLLs. If you write a library and want it to -// use ACE_Svc_Export, this will cause those macros to build dlls. If -// you want your ACE service to be a static library, comment out this -// line. As far as I know, the only reason to have a library be an -// ACE "service" is to leverage the ACE_Svc_Export macros. It's just -// as easy to define your own export macros. -// #if !defined (ACE_SVC_HAS_DLL) -// # define ACE_SVC_HAS_DLL 1 -// #endif - -// Define the special export macros needed to export symbols outside a dll -#if !defined(__BORLANDC__) && !defined(__IBMCPP__) -#define ACE_HAS_CUSTOM_EXPORT_MACROS -#define ACE_Proper_Export_Flag __declspec (dllexport) -#define ACE_Proper_Import_Flag __declspec (dllimport) -#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T -#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE; -#define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T -#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE ; -#endif /* !__BORLANDC__ */ - -// Define ACE_HAS_WINSOCK2 to 0 in your config.h file if you do *not* -// want to compile with WinSock 2.0. -// Setting applies to : building ACE -// Runtime restrictions: winsock2 must be installed. -// #define ACE_HAS_WINSOCK2 0 - -// By default, we use non-static object manager on Win32. That is, -// the object manager is allocated in main's stack memory. If this -// does not suit your need, i.e., if your programs depend on the use -// of static object manager, you neet to disable the behavior by adding -// -// #undef ACE_HAS_NONSTATIC_OBJECT_MANAGER -// -// in the config.h after including config-win32.h -// -// MFC users: the main function is defined within a MFC library and -// therefore, ACE won't be able to meddle with main function and -// instantiate the non-static object manager for you. To solve the -// problem, you'll need to instantiate the ACE_Object_Manager by -// either: -// -// 1. Using static object manager (as described above), however, using -// the non-static object manager is prefered, therefore, -// 2. Instantiate the non-static object manager yourself by either 1) -// call ACE::init () at the beginning and ACE::fini () at the end, -// _or_ 2) instantiate the ACE_Object_Manager in your CWinApp -// derived class. -// -// Optionally, you can #define -// ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER in your -// ace/config.h and always take care of the business by yourself. -// ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER has no effect when -// using static object managers. -#if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) -# define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#elif (ACE_HAS_NONSTATIC_OBJECT_MANAGER == 0) -# undef ACE_HAS_NONSTATIC_OBJECT_MANAGER -#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */ - -#define ACE_HAS_GPERF - -// By default, don't include RCS Id strings in object code. -#if !defined (ACE_USE_RCSID) -# define ACE_USE_RCSID 0 -#endif /* ! ACE_USE_RCSID */ - -// ---------------- platform features or lack of them ------------- - -// By default WIN32 has FD_SETSIZE of 64, which places the limit -// between 61 and 64 on the number of clients a server using the -// Select Reactor can support at the same time (i.e., 64 - standard in, -// out, error). Here we raise the limit to 1024. Adjust the definition -// below if you need to raise or lower it. - -#if !defined (FD_SETSIZE) -#define FD_SETSIZE 1024 -#endif /* FD_SETSIZE */ - - -// Windows doesn't like 65536 ;-) If 65536 is specified, it is -// silently ignored by the OS, i.e., setsockopt does not fail, and you -// get stuck with the default size of 8k. -#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 - -// It seems like Win32 does not have a limit on the number of buffers -// that can be transferred by the scatter/gather type of I/O -// functions, e.g., WSASend and WSARecv. We are setting this to be 64 -// for now. The typically use case is to create an I/O vector array -// of size ACE_IOV_MAX on the stack and then filled in. Note that we -// probably don't want too big a value for ACE_IOV_MAX since it may -// mostly go to waste or the size of the activation record may become -// excessively large. - -#if !defined (ACE_IOV_MAX) -#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) -# define ACE_IOV_MAX 64 -#else -// Win 95/98/me need a smaller value than WinNT versions of Windows. -# define ACE_IOV_MAX 16 -#endif /* #if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */ -#endif /* ACE_IOV_MAX */ - -#if !defined (ACE_HAS_WINCE) -// Platform supports pread() and pwrite() -# define ACE_HAS_P_READ_WRITE -#endif /* ! ACE_HAS_WINCE */ - -#if !defined (__MINGW32__) -# define ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS -#endif /* __MINGW32__ */ - -#define ACE_DEFAULT_THREAD_PRIORITY 0 - -#define ACE_HAS_DIRENT -#define ACE_HAS_MSG -#define ACE_HAS_RECURSIVE_MUTEXES -#define ACE_HAS_SOCKADDR_MSG_NAME -#define ACE_HAS_THREAD_SAFE_ACCEPT - -/* LACKS dir-related facilities */ -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_REWINDDIR -#define ACE_LACKS_SEEKDIR -#define ACE_LACKS_TELLDIR - -/* LACKS gid/pid/sid/uid facilities */ -#define ACE_LACKS_GETPGID -#define ACE_LACKS_GETPPID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID -#define ACE_LACKS_SETSID -#define ACE_LACKS_SETEGID -#define ACE_LACKS_SETUID -#define ACE_LACKS_SETEUID -#define ACE_LACKS_GETGID -#define ACE_LACKS_GETEGID -#define ACE_LACKS_GETUID -#define ACE_LACKS_GETEUID -#define ACE_LACKS_SETGID - -/* LACKS miscellaneous */ -#define ACE_LACKS_ALARM -#define ACE_LACKS_ARPA_INET_H -#define ACE_LACKS_DUP2 -#define ACE_LACKS_FORK -#define ACE_LACKS_GETHOSTENT -#define ACE_LACKS_GETOPT -#define ACE_LACKS_KILL -#define ACE_LACKS_INET_ATON -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MKFIFO -#define ACE_LACKS_MODE_MASKS -#define ACE_LACKS_PTHREAD_H -#define ACE_LACKS_PWD_FUNCTIONS -#define ACE_LACKS_READLINK -#define ACE_LACKS_RLIMIT -#define ACE_LACKS_SBRK -#define ACE_LACKS_SCHED_H -#define ACE_LACKS_SEMBUF_T -#define ACE_LACKS_SIGACTION -#define ACE_LACKS_SIGSET -#define ACE_LACKS_SOCKETPAIR -#define ACE_LACKS_SUSECONDS_T -#define ACE_LACKS_USECONDS_T -#define ACE_LACKS_SYS_PARAM_H -#define ACE_LACKS_SYS_SYSCTL_H -#define ACE_LACKS_SYSCONF -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_UNISTD_H -#define ACE_LACKS_UNIX_SIGNALS -#define ACE_LACKS_UNIX_SYSLOG -#define ACE_LACKS_UTSNAME_T -#define ACE_LACKS_UNAME -#define ACE_LACKS_WAIT - -#define ACE_HAS_SNPRINTF -#define ACE_HAS_VFWPRINTF -#define ACE_HAS_VSWPRINTF - -#define ACE_MKDIR_LACKS_MODE - -#define ACE_SIZEOF_LONG_LONG 8 -// Green Hills Native x86 does not support __int64 keyword -// Neither does mingw32. -#if !defined (ACE_LACKS_LONGLONG_T) && !defined (__MINGW32__) -#define ACE_INT64_TYPE signed __int64 -#define ACE_UINT64_TYPE unsigned __int64 -#endif /* (ghs) */ - -#if defined (__MINGW32__) -#define ACE_INT64_TYPE signed long long -#define ACE_UINT64_TYPE unsigned long long -#endif - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Win32 has wide-char support. Use of the compiler-defined wchar_t type -// is controlled in compiler configs since it's a compiler switch. -#define ACE_HAS_WCHAR - -// Compiler/platform correctly calls init()/fini() for shared -// libraries. - applied for DLLs ? -//define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform supports POSIX O_NONBLOCK semantics. -//define ACE_HAS_POSIX_NONBLOCK - -// Platform contains . -//define ACE_HAS_POLL - -// Platform supports the /proc file system. -//define ACE_HAS_PROC_FS - -#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) -// Platform supports the rusage struct. -#define ACE_HAS_GETRUSAGE -#endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */ - -// Compiler/platform supports SVR4 signal typedef. -//define ACE_HAS_SVR4_SIGNAL_T - -// Platform provides header. -//define ACE_HAS_SYS_FILIO_H - -// Compiler/platform supports sys_siglist array. -//define ACE_HAS_SYS_SIGLIST - -// Platform supports ACE_TLI timod STREAMS module. -//define ACE_HAS_TIMOD_H - -// Platform supports ACE_TLI tiuser header. -//define ACE_HAS_TIUSER_H - -// Platform provides ACE_TLI function prototypes. -// For Win32, this is not really true, but saves a lot of hassle! -#define ACE_HAS_TLI_PROTOTYPES - -// Platform supports ACE_TLI. -//define ACE_HAS_TLI - -// I'm pretty sure NT lacks these -#define ACE_LACKS_UNIX_DOMAIN_SOCKETS - -// Windows NT needs readv() and writev() -#define ACE_LACKS_WRITEV -#define ACE_LACKS_READV - -#define ACE_LACKS_COND_T -#define ACE_LACKS_RWLOCK_T - -#define ACE_LACKS_KEY_T - -// No system support for replacing any previous mappings. -#define ACE_LACKS_AUTO_MMAP_REPLACEMENT - -// If you want to use highres timers, ensure that -// Build.Settings.C++.CodeGeneration.Processor is -// set to Pentium ! -#if !defined(ACE_HAS_PENTIUM) && (_M_IX86 > 400) -# define ACE_HAS_PENTIUM -#endif - -#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -// Platform supports threads. -# define ACE_HAS_THREADS - -// Platform supports Windows32 threads. -# define ACE_HAS_WTHREADS - -// Compiler/platform has thread-specific storage -# define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Win32 doesn't have fcntl -#define ACE_LACKS_FCNTL - -#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ - -#if !defined(_DEBUG) -// If we are making a release, and the user has not specified -// inline directives, we will default to inline -# if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ 1 -# endif /* __ACE_INLINE__ */ -#endif - -// If __ACE_INLINE__ is defined to be 0, we will undefine it -#if defined (__ACE_INLINE__) && (__ACE_INLINE__ == 0) -# undef __ACE_INLINE__ -#endif /* __ACE_INLINE__ */ - -// We are build ACE and want to use MFC (multithreaded) -#if defined(ACE_HAS_MFC) && (ACE_HAS_MFC != 0) && defined (_MT) -# if (ACE_HAS_DLL != 0) && defined(ACE_BUILD_DLL) && !defined (_WINDLL) -// force multithreaded MFC DLL -# define _WINDLL -# endif /* _AFXDLL */ -# if !defined (_AFXDLL) && !defined (ACE_USES_STATIC_MFC) -# define _AFXDLL -# endif /* _AFXDLL */ -#endif - -// and MFC's are mutually -// incompatible. is brain-dead about MFC; it doesn't check -// to see whether MFC stuff is anticipated or already in progress -// before doing its thing. ACE needs (practically always) , -// and winsock in turn needs support either from windows.h or from -// afxwin.h. One or the other, not both. -// -// The MSVC++ V4.0 environment defines preprocessor macros that -// indicate the programmer has chosen something from the -// Build-->Settings-->General-->MFC combo-box. defines a -// macro itself to protect against double inclusion. We'll take -// advantage of all this to select the proper support for winsock. - -// trl 26-July-1996 - -// This is necessary since MFC users apparently can't #include -// directly. -#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) -# include /**/ /* He is doing MFC */ -// Windows.h will be included via afxwin.h->afx.h->afx_ver_.h->afxv_w32.h -// #define _INC_WINDOWS // Prevent winsock.h from including windows.h -# if defined (ACE_HAS_WINCE) -# include /**/ -# endif /* ACE_HAS_WINCE */ -#elif defined (ACE_HAS_WINCE) -# include /**/ -#endif - -#if !defined (_INC_WINDOWS) /* Already include windows.h ? */ -// Must define strict before including windows.h ! -# if defined (ACE_HAS_STRICT) && (ACE_HAS_STRICT != 0) && !defined (STRICT) -# define STRICT 1 -# endif /* ACE_HAS_STRICT */ - -# if !defined (WIN32_LEAN_AND_MEAN) && !defined (ACE_NO_WIN32_LEAN_AND_MEAN) -# define WIN32_LEAN_AND_MEAN -# endif /* WIN32_LEAN_AND_MEAN */ - -#endif /* !defined (_INC_WINDOWS) */ - -// Always use WS2 when available -#if !defined(ACE_HAS_WINSOCK2) -# define ACE_HAS_WINSOCK2 1 -#endif /* !defined(ACE_HAS_WINSOCK2) */ - - -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) -# if !defined (_WINSOCK2API_) -// will also include windows.h, if not present -# include /**/ -// WinCE 4 doesn't define the Exxx values without the WSA prefix, so do that -// here. This is all lifted from the #if 0'd out part of winsock2.h. -# if defined (UNDER_CE) -# define EWOULDBLOCK WSAEWOULDBLOCK -# define EINPROGRESS WSAEINPROGRESS -# define EALREADY WSAEALREADY -# define ENOTSOCK WSAENOTSOCK -# define EDESTADDRREQ WSAEDESTADDRREQ -# define EMSGSIZE WSAEMSGSIZE -# define EPROTOTYPE WSAEPROTOTYPE -# define ENOPROTOOPT WSAENOPROTOOPT -# define EPROTONOSUPPORT WSAEPROTONOSUPPORT -# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT -# define EOPNOTSUPP WSAEOPNOTSUPP -# define EPFNOSUPPORT WSAEPFNOSUPPORT -# define EAFNOSUPPORT WSAEAFNOSUPPORT -# define EADDRINUSE WSAEADDRINUSE -# define EADDRNOTAVAIL WSAEADDRNOTAVAIL -# define ENETDOWN WSAENETDOWN -# define ENETUNREACH WSAENETUNREACH -# define ENETRESET WSAENETRESET -# define ECONNABORTED WSAECONNABORTED -# define ECONNRESET WSAECONNRESET -# define ENOBUFS WSAENOBUFS -# define EISCONN WSAEISCONN -# define ENOTCONN WSAENOTCONN -# define ESHUTDOWN WSAESHUTDOWN -# define ETOOMANYREFS WSAETOOMANYREFS -# define ETIMEDOUT WSAETIMEDOUT -# define ECONNREFUSED WSAECONNREFUSED -# define ELOOP WSAELOOP -# define ENAMETOOLONG WSAENAMETOOLONG -# define EHOSTDOWN WSAEHOSTDOWN -# define EHOSTUNREACH WSAEHOSTUNREACH -# define ENOTEMPTY WSAENOTEMPTY -# define EPROCLIM WSAEPROCLIM -# define EUSERS WSAEUSERS -# define EDQUOT WSAEDQUOT -# define ESTALE WSAESTALE -# define EREMOTE WSAEREMOTE -# endif /* UNDER_CE */ -# endif /* _WINSOCK2API */ - -# if defined (ACE_HAS_FORE_ATM_WS2) -# include /**/ -# endif /*ACE_HAS_FORE_ATM_WS2 */ - -// CE doesn't have Microsoft Winsock 2 extensions -# if !defined _MSWSOCK_ && !defined (ACE_HAS_WINCE) -# include /**/ -# endif /* _MSWSOCK_ */ - -# if defined (_MSC_VER) -# if defined (ACE_HAS_WINCE) -# pragma comment(lib, "ws2.lib") -# else -# pragma comment(lib, "ws2_32.lib") -# pragma comment(lib, "mswsock.lib") -# endif /* ACE_HAS_WINCE */ -# endif /* _MSC_VER */ - -# define ACE_WSOCK_VERSION 2, 0 -#else -# if !defined (_WINSOCKAPI_) - // will also include windows.h, if not present -# include /**/ -# endif /* _WINSOCKAPI */ - -// PharLap ETS has its own winsock lib, so don't grab the one -// supplied with the OS. -# if defined (_MSC_VER) && !defined (UNDER_CE) && !defined (ACE_HAS_PHARLAP) -# pragma comment(lib, "wsock32.lib") -# endif /* _MSC_VER */ - -// We can't use recvmsg and sendmsg unless WinSock 2 is available -# define ACE_LACKS_RECVMSG -# define ACE_LACKS_SENDMSG - -// Version 1.1 of WinSock -# define ACE_WSOCK_VERSION 1, 1 -#endif /* ACE_HAS_WINSOCK2 */ - -// Platform supports IP multicast on Winsock 2 -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) -# define ACE_HAS_IP_MULTICAST -#endif /* ACE_HAS_WINSOCK2 */ - -#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || \ - defined (ACE_HAS_WINCE) /* WinCE 3 has these */ -# if !defined (ACE_HAS_WINCE) || defined (PPC) /* CE only on some CPUs */ -# define ACE_HAS_INTERLOCKED_EXCHANGEADD -# endif -# define ACE_HAS_WIN32_TRYLOCK -#endif - -#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) && !defined (ACE_USES_WINCE_SEMA_SIMULATION) -# define ACE_HAS_SIGNAL_OBJECT_AND_WAIT - -// If CancelIO is undefined get the updated sp2-sdk from MS -# define ACE_HAS_CANCEL_IO -#endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) && !defined (ACE_USES_WINCE_SEMA_SIMULATION) */ - -#if !defined (ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION) -# define ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION EXCEPTION_CONTINUE_SEARCH -#endif /* ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION */ - -// ACE_HAS_QOS is defined in the qos.mpb base project. -// If qos=1 in default.features, then this macro will be defined. -#if defined (ACE_HAS_QOS) && !defined (ACE_HAS_WINSOCK2_GQOS) -# if defined (WINSOCK_VERSION) -# define ACE_HAS_WINSOCK2_GQOS 1 -# endif /* WINSOCK_VERSION */ -#endif /* ACE_HAS_WINSOCK2_GQOS */ - -#define ACE_SIZEOF_WCHAR 2 -#define ACE_HAS_MUTEX_TIMEOUTS -#define ACE_LACKS_STRUCT_DIR -#define ACE_LACKS_OPENDIR -#define ACE_LACKS_CLOSEDIR -#define ACE_LACKS_READDIR -#define ACE_LACKS_MKSTEMP -#define ACE_LACKS_LSTAT -// Looks like Win32 has a non-const swab function -#define ACE_HAS_NONCONST_SWAB - -// If we are using winsock2 then the SO_REUSEADDR feature is broken -// SO_REUSEADDR=1 behaves like SO_REUSEPORT=1. (SO_REUSEPORT is an -// extension to sockets on some platforms) -// We define SO_REUSEPORT here so that ACE_OS::setsockopt() can still -// allow the user to specify that a socketaddr can *always* be reused. -#if defined (ACE_HAS_WINSOCK2) && ACE_HAS_WINSOCK2 != 0 && ! defined(SO_REUSEPORT) -#define SO_REUSEPORT 0x0400 // We just have to pick a value that won't conflict -#endif - -#if defined (ACE_WIN64) -// Data must be aligned on 8-byte boundaries, at a minimum. -# define ACE_MALLOC_ALIGN 8 -// Void pointers are 8 bytes -# define ACE_SIZEOF_VOID_P 8 -#endif /* ACE_WIN64 */ - -#if !defined (ACE_DISABLES_THREAD_LIBRARY_CALLS) -# define ACE_DISABLES_THREAD_LIBRARY_CALLS 0 -#endif /* ACE_DISABLES_THREAD_LIBRARY_CALLS */ - -#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP) -# define ACE_HAS_LOG_MSG_NT_EVENT_LOG -#endif /* !ACE_HAS_WINCE && !ACE_HAS_PHARLAP */ - -#if !defined (ACE_HAS_WINCE) -# define ACE_HAS_LLSEEK -#endif /* !ACE_HAS_WINCE */ - -// Needed for obtaining the MAC address -// I dont believe this will work under CE, notice the -// check for ACE_HAS_WINCE. -# if !defined (ACE_HAS_WINCE) -# include -# if defined (_MSC_VER) -# pragma comment(lib, "netapi32.lib") // needed for obtaing MACaddress -# endif -# endif /* !ACE_HAS_WINCE */ - -#if !defined (ACE_DEFAULT_BACKLOG) -# define ACE_DEFAULT_BACKLOG SOMAXCONN -#endif /* ACE_DEFAULT_BACKLOG */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_COMMON_H */ diff --git a/ace/config-win32-dmc.h b/ace/config-win32-dmc.h deleted file mode 100644 index b320901221f..00000000000 --- a/ace/config-win32-dmc.h +++ /dev/null @@ -1,111 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// The following configuration file contains defines for Digital Mars compilers. - -#ifndef ACE_CONFIG_WIN32_DMC_H -#define ACE_CONFIG_WIN32_DMC_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -#ifndef WIN32 -# define WIN32 -#endif /* WIN32 */ - -#undef _M_IX86 -// This turns on ACE_HAS_PENTIUM -#define _M_IX86 500 - -#if defined ACE_LACKS_STRUCT_DIR -# undef ACE_LACKS_STRUCT_DIR -#endif - -// Changed ACE_TEXT to ACE_LIB_TEXT in the following line -# define ACE_CC_NAME ACE_LIB_TEXT ("Digital Mars") -# define ACE_CC_MAJOR_VERSION (1) -# define ACE_CC_MINOR_VERSION (8) -# define ACE_CC_BETA_VERSION (9) -# define ACE_CC_PREPROCESSOR "DMC.EXE" -# define ACE_CC_PREPROCESSOR_ARGS "-E" - -// Microsoft's standard cpp library auto_ptr doesn't have reset (). -# define ACE_AUTO_PTR_LACKS_RESET - -#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) - -// This section below was extracted from config-win32-msvc -#define ACE_HAS_ITOA -#define ACE_ITOA_EQUIVALENT ::_itoa -#define ACE_STRCASECMP_EQUIVALENT ::_stricmp -#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp -#define ACE_WCSDUP_EQUIVALENT ::_wcsdup -// This section above was extracted from config-win32-msvc - -# define ACE_EXPORT_NESTED_CLASSES 1 -# define ACE_HAS_CPLUSPLUS_HEADERS 1 -//# define ACE_HAS_EXCEPTIONS 1 -# define ACE_HAS_GNU_CSTRING_H 1 -# define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 -# define ACE_HAS_SIG_ATOMIC_T 1 -# define ACE_HAS_STANDARD_CPP_LIBRARY 0 -# define ACE_HAS_STDCPP_STL_INCLUDES 1 -# define ACE_HAS_STRERROR 1 -# define ACE_HAS_STRING_CLASS 1 -# define ACE_HAS_TEMPLATE_SPECIALIZATION 1 -# define ACE_HAS_TEMPLATE_TYPEDEFS 1 -# define ACE_HAS_TYPENAME_KEYWORD 1 -//# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION -# define ACE_HAS_USER_MODE_MASKS 1 -//# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 -# define ACE_LACKS_STRPTIME 1 -//# define ACE_LACKS_PRAGMA_ONCE 1 -//# define ACE_NEW_THROWS_EXCEPTIONS 1 -# define ACE_SIZEOF_LONG_DOUBLE 10 -# define ACE_TEMPLATES_REQUIRE_SOURCE 1 -// Changed ACE_TEXT to ACE_LIB_TEXT in the following two lines -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# define ACE_HAS_STRBUF_T -#define ACE_HAS_3_PARAM_WCSTOK -#define ACE_USES_OLD_IOSTREAMS -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_SYS_RESOURCE_H -#define ACE_LACKS_SYS_WAIT_H -#define ACE_LACKS_STRINGS_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_SEMAPHORE_H -#define ACE_LACKS_SYS_MMAN_H -#define ACE_LACKS_SYS_UIO_H -#define ACE_LACKS_SYS_SOCKET_H -#define ACE_LACKS_NETINET_IN_H -#define ACE_LACKS_SYS_IOCTL_H -#define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_NET_IF_H -#define ACE_LACKS_DLFCN_H -#define ACE_LACKS_NETDB_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_REGEX_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_NETINET_TCP_H -#define ACE_LACKS_UNISTD_H -#define ACE_LACKS_TERMIOS_H -#define ACE_LACKS_ACE_IOSTREAM -#define ACE_HAS_NONCONST_TEMPNAM - -// Typedefs which we expect DMC to do, but they don't do that -typedef long o_uid_t; -typedef long o_gid_t; - -#include "io.h" -#undef umask; -#undef tell; - -# if !defined (ACE_LD_DECORATOR_STR) && defined (_DEBUG) -# define ACE_LD_DECORATOR_STR ACE_LIB_TEXT ("d") -# endif - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_DMC_H */ diff --git a/ace/config-win32-ghs.h b/ace/config-win32-ghs.h deleted file mode 100644 index af8de96c541..00000000000 --- a/ace/config-win32-ghs.h +++ /dev/null @@ -1,97 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// The following configuration file contains defines for Green Hills compilers. - -#ifndef ACE_CONFIG_WIN32_GHS_H -#define ACE_CONFIG_WIN32_GHS_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -#ifndef WIN32 -# define WIN32 -#endif /* WIN32 */ - -#undef _M_IX86 -// This turns on ACE_HAS_PENTIUM -#define _M_IX86 500 -// GHS does not provide DLL support -#define ACE_HAS_DLL 0 -#define TAO_HAS_DLL 0 -#undef _DLL - -//Green Hills Native x86 does not support structural exceptions -# undef ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS -# undef ACE_HAS_WCHAR -# define ACE_CONFIG_INCLUDE_GHS_COMMON -# include "ace/config-ghs-common.h" - -// Changed ACE_TEXT to ACE_LIB_TEXT in the following line -# define ACE_CC_NAME ACE_LIB_TEXT ("Green Hills C++") -# define ACE_CC_MAJOR_VERSION (1) -# define ACE_CC_MINOR_VERSION (8) -# define ACE_CC_BETA_VERSION (9) -# define ACE_CC_PREPROCESSOR "GCX.EXE" -# define ACE_CC_PREPROCESSOR_ARGS "-E" - -// GHS uses Microsoft's standard cpp library, which has auto_ptr. -# undef ACE_LACKS_AUTO_PTR -// Microsoft's standard cpp library auto_ptr doesn't have reset (). -# define ACE_AUTO_PTR_LACKS_RESET - -#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) - -// This section below was extracted from config-win32-msvc -#define ACE_HAS_ITOA -#define ACE_ITOA_EQUIVALENT ::_itoa -#define ACE_STRCASECMP_EQUIVALENT ::_stricmp -#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp -#define ACE_WCSDUP_EQUIVALENT ::_wcsdup -// This section above was extracted from config-win32-msvc - -# define ACE_EXPORT_NESTED_CLASSES 1 -# define ACE_HAS_CPLUSPLUS_HEADERS 1 -//# define ACE_HAS_EXCEPTIONS 1 -# define ACE_HAS_GNU_CSTRING_H 1 -# define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 -# define ACE_HAS_SIG_ATOMIC_T 1 -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_HAS_STDCPP_STL_INCLUDES 1 -# define ACE_HAS_STRERROR 1 -# define ACE_HAS_STRING_CLASS 1 -# define ACE_HAS_TEMPLATE_SPECIALIZATION 1 -# define ACE_HAS_TEMPLATE_TYPEDEFS 1 -# define ACE_HAS_TYPENAME_KEYWORD 1 -//# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION -# define ACE_HAS_USER_MODE_MASKS 1 -# define ACE_LACKS_ACE_IOSTREAM 1 -//# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 -# define ACE_LACKS_STRPTIME 1 -//# define ACE_LACKS_PRAGMA_ONCE 1 -# define ACE_LACKS_STRRECVFD 1 -//# define ACE_NEW_THROWS_EXCEPTIONS 1 -# define ACE_SIZEOF_LONG_DOUBLE 10 -# define ACE_TEMPLATES_REQUIRE_SOURCE 1 -// Changed ACE_TEXT to ACE_LIB_TEXT in the following two lines -# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u") -# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d") -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -// Set the following to zero to placate SString.h ACE_WString CTOR -# undef ACE_WSTRING_HAS_USHORT_SUPPORT - -// Green Hills Native x86 does not support __int64 keyword -# define ACE_LACKS_LONGLONG_T - -/* need to ensure these are included before */ -# include -# include - -# if !defined (ACE_LD_DECORATOR_STR) && defined (_DEBUG) -# define ACE_LD_DECORATOR_STR ACE_LIB_TEXT ("d") -# endif - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_GHS_H */ diff --git a/ace/config-win32-interix.h b/ace/config-win32-interix.h deleted file mode 100644 index 53ace409799..00000000000 --- a/ace/config-win32-interix.h +++ /dev/null @@ -1,105 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// The following configuration file is designed to work for Interix -// platforms using GNU g++ (Interix == Microsoft's Services for Unix) - -#ifndef ACE_CONFIG_WIN32_INTERIX_H -#define ACE_CONFIG_WIN32_INTERIX_H -#include /**/ "ace/pre.h" -#include - -# define ACE_LACKS_SENDMSG -# define ACE_LACKS_RECVMSG -# define ACE_LACKS_STDINT_H -# define ACE_LACKS_INTTYPES_H -# define ACE_LACKS_PRAGMA_ONCE -# define ACE_LACKS_RWLOCK_T -# define ACE_LACKS_GETPGID // Don't have getpgid(), have setpgid() though... -# define ACE_LACKS_UCONTEXT_H -# define ACE_HAS_REENTRANT_FUNCTIONS -# define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS // Don't have gethostbyaddr_r and friends. -# define ACE_HAS_DIRENT -# define ACE_HAS_STDCPP_STL_INCLUDES -# define ACE_HAS_TYPENAME_KEYWORD -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# define ACE_HAS_NONCONST_SELECT_TIMEVAL -# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION -# define ACE_HAS_SIGWAIT -# define ACE_HAS_SIGINFO_T - -#include "ace/config-g++-common.h" - -#define ACE_HAS_NEW_NOTHROW // Need to know 'new's failure semantics. - -#if defined (ACE_HAS_THREADS) -#define ACE_HAS_THREADS -#define ACE_HAS_PTHREADS -#define _THREAD_SAFE -#define ACE_MTSAFE 1 -#define ACE_MT_SAFE 1 -#define ACE_HAS_PTHREADS_STD -#define ACE_LACKS_PTHREAD_YIELD -#define ACE_HAS_MUTEX_TIMEOUTS -#else - error "You need to enable threads for this Interix port." -#endif /* ACE_HAS_THREADS */ - -// INTERIX has the following, just an issue with porting for the moment -#define ACE_LACKS_ACCESS -// END INTERIX has the following.... - -#define ACE_SIZEOF_LONG_DOUBLE 12 -#define ACE_PAGE_SIZE 4096 - -#define ACE_HAS_SNPRINTF -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_SVR4_SIGNAL_T -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_POSIX_TIME // Supports POSIX timers via struct timespec. -#define ACE_LACKS_TIMESPEC_T // Defines struct timespec but not timespec_t. -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SETSCHED -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_RTLD_LAZY_V -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_GETRUSAGE -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SEMUN -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRERROR -#define ACE_HAS_SVR4_GETTIMEOFDAY -#define ACE_HAS_UALARM -#define ACE_HAS_TERMIOS -#define ACE_HAS_SIGWAIT -#define ACE_LACKS_RTTI // DLL_Test checks RTTI, and it fails so... - -// Turns off the tracing feature. -#if !defined (ACE_NTRACE) -#define ACE_NTRACE 1 -#endif /* ACE_NTRACE */ - -// NOTE: In debugging some of the test apps they would all memory fault in using -// ACE_Errno_Guard. Upon inspection of that code it uses TSS to save ERRNO in -// a TSS pointer. Access to that pointer caused the fault. The work around here -// is to tell ACE we have TSS and use emulation. More investigation is needed to -// determine whether Interix TSS is broken or the correct semantics for usage under -// Interix simply need to be ported. -// To get around the issue ACE_HAS_TSS_EMULATION is defined to use TSS emulation -// however while many test programs that use TSS pass the TSS_Test program fails. -#define ACE_HAS_THREAD_SPECIFIC_STORAGE // We need thread specific storage even though... -#define ACE_HAS_TSS_EMULATION // It would appear to be broken in Interix! - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_INTERIX_H */ - -/* -The following tests do not run. -Dynamic_Priority_Test.log ACE_HAS_TIMED_MESSAGE_BLOCKS -Enum_Interfaces_Test.log -IOStream_Test.log ACE_IOSTREAM not supported on this platform -*/ - - diff --git a/ace/config-win32-mingw.h b/ace/config-win32-mingw.h deleted file mode 100644 index 50b78b4f4ef..00000000000 --- a/ace/config-win32-mingw.h +++ /dev/null @@ -1,106 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// -// The following configuration file is designed to work for win32 -// platforms using gcc/g++ with mingw32 (http://www.mingw.org). -// - -#ifndef ACE_CONFIG_WIN32_MINGW_H -#define ACE_CONFIG_WIN32_MINGW_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -# error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -#define ACE_CC_NAME ACE_LIB_TEXT ("g++") -#define ACE_CC_PREPROCESSOR "cpp" -#define ACE_CC_PREPROCESOR_ARGS "" - -// Why all this is not in config-g++-common.h? -#define ACE_CC_MAJOR_VERSION __GNUC__ -#define ACE_CC_MINOR_VERSION __GNUC_MINOR__ -#define ACE_CC_BETA_VERSION (0) - -#if !defined(__MINGW32__) -# error You do not seem to be using mingw32 -#endif - -#include "ace/config-g++-common.h" - -#include /**/ <_mingw.h> -#include /**/ - -#define ACE_HAS_USER_MODE_MASKS - -#if (__MINGW32_MAJOR_VERSION < 2) -# error You need a newer version (>= 2.0) of mingw32/w32api -#endif - -#if (__MINGW32_MAJOR_VERSION >= 3) -# define ACE_HAS_SSIZE_T -# undef ACE_LACKS_STRUCT_DIR -# undef ACE_LACKS_OPENDIR -# undef ACE_LACKS_CLOSEDIR -# undef ACE_LACKS_READDIR -# undef ACE_LACKS_TELLDIR -# undef ACE_LACKS_SEEKDIR -# undef ACE_LACKS_REWINDDIR -#else -# define ACE_LACKS_DIRENT_H -#endif - -#undef ACE_LACKS_SIGSET - -#define ACE_LACKS_SIGSET_DEFINITIONS -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_TERMIOS_H -#define ACE_LACKS_NETINET_TCP_H -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_STRPTIME -#define ACE_HAS_STRERROR -#define ACE_LACKS_POLL_H -#define ACE_LACKS_REGEX_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_PWD_H -#define ACE_LACKS_SEMAPHORE_H -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_SYS_RESOURCE_H -#define ACE_LACKS_SYS_WAIT_H -#define ACE_LACKS_DLFCN_H -#define ACE_LACKS_SYS_MMAN_H -#define ACE_LACKS_SYS_UIO_H -#define ACE_LACKS_SYS_SOCKET_H -#define ACE_LACKS_NETINET_IN_H -#define ACE_LACKS_NETDB_H -#define ACE_LACKS_NET_IF_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_SYS_IOCTL_H -#define ACE_HAS_NONCONST_WCSDUP - -// We trust the user: He must have used -mpentiumpro or -mpentium -// if that is what he wants. -#if defined(pentiumpro) || defined(pentium) -# define ACE_HAS_PENTIUM -#endif - -#if !defined (ACE_HAS_WINNT4) -# if (defined (WINNT) && WINNT == 1) \ - || (defined (__WINNT__) && __WINNT__ == 1) -# define ACE_HAS_WINNT4 1 -# else -# define ACE_HAS_WINNT4 0 -# endif -#endif - -#define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d") -#define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u") - -#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) (STATUS)) - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_MINGW_H */ diff --git a/ace/config-win32-msvc-7.h b/ace/config-win32-msvc-7.h deleted file mode 100644 index 78c36b503f1..00000000000 --- a/ace/config-win32-msvc-7.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- C++ -*- */ -//============================================================================= -/** - * @file config-win32-msvc-7.h - * - * $Id$ - * - * @brief Microsoft Visual C++ 7.0 configuration file. - * - * This file is the ACE configuration file for Microsoft Visual C++ version 7. - * - * @note Do not include this file directly, include config-win32.h instead. - * - * @author Darrell Brunsch - */ -//============================================================================= - -#ifndef ACE_CONFIG_WIN32_MSVC_7_H -#define ACE_CONFIG_WIN32_MSVC_7_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -// Visual C++ 7.0 (.NET) deprecated the old iostreams -#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#endif - -#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#endif - -// Win64 SDK compiler claims std::auto_ptr<>::reset not available. -#if defined (_WIN64) || defined (WIN64) -#define ACE_AUTO_PTR_LACKS_RESET -#endif - -#define ACE_HAS_TYPENAME_KEYWORD - -#define ACE_HAS_ITOA - -#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR - -#define ACE_ITOA_EQUIVALENT ::_itoa -#define ACE_STRCASECMP_EQUIVALENT ::_stricmp -#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp -#define ACE_WCSDUP_EQUIVALENT ::_wcsdup - -#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_EXCEPTIONS) -#define ACE_HAS_EXCEPTIONS -#endif /* ACE_HAS_WINCE */ - -#define ACE_HAS_STRERROR -#define ACE_LACKS_STRPTIME - -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES -#define ACE_LACKS_STRRECVFD -#define ACE_HAS_CPLUSPLUS_HEADERS - -#define ACE_HAS_TEMPLATE_TYPEDEFS -#define ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_HAS_TEMPLATE_SPECIALIZATION - -#define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d") -#define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u") - -// Platform provides ACE_TLI function prototypes. -// For Win32, this is not really true, but saves a lot of hassle! -#define ACE_HAS_TLI_PROTOTYPES - -// Platform support linebuffered streaming is broken -#define ACE_LACKS_LINEBUFFERED_STREAMBUF - -#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) - -// Platform has its Standard C++ library in the namespace std -# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ - -// ace/iostream.h does not work with the standard cpp library (yet). -# if !defined (ACE_USES_OLD_IOSTREAMS) -# define ACE_LACKS_ACE_IOSTREAM -# endif /* ! ACE_USES_OLD_IOSTREAMS */ - -// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory. -// Since we don't support MSVC 7.0, don't test for it. -# define ACE_NEW_THROWS_EXCEPTIONS -# define ACE_HAS_NEW_NOTHROW - -#else - -// iostream header lacks ipfx (), isfx (), etc., declarations -# define ACE_LACKS_IOSTREAM_FX - -#endif - -// There are too many instances of this warning to fix it right now. -// Maybe in the future. -// 'this' : used in base member initializer list -#pragma warning(disable:4355) - -// 'class1' : inherits 'class2::member' via dominance -#pragma warning(disable:4250) - -// C++ Exception Specification ignored -#pragma warning(disable:4290) - -// Disable warning of using Microsoft Extension. -#pragma warning(disable:4231) - -// 'function' : unreferenced local function has been removed -# pragma warning(disable:4505) - -// A template can not be exported. Only an instantiation may be exported. -#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT - -// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to -// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC. -# define ACE_NEEDS_FUNC_DEFINITIONS - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_MSVC_7_H */ diff --git a/ace/config-win32-msvc-8.h b/ace/config-win32-msvc-8.h deleted file mode 100644 index 9fc2529dec0..00000000000 --- a/ace/config-win32-msvc-8.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- C++ -*- */ -//============================================================================= -/** - * @file config-win32-msvc-8.h - * - * $Id$ - * - * @brief Microsoft Visual C++ 8.0 configuration file. - * - * This file is the ACE configuration file for Microsoft Visual C++ version 8. - * - * @note Do not include this file directly, include config-win32.h instead. - * - * @author Darrell Brunsch - */ -//============================================================================= - -#ifndef ACE_CONFIG_WIN32_MSVC_8_H -#define ACE_CONFIG_WIN32_MSVC_8_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -// Visual C++ 8.0 (.NET) deprecated the old iostreams -#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#endif - -#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#endif - -#define ACE_HAS_TYPENAME_KEYWORD - -#define ACE_HAS_ITOA - -#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR - -#define ACE_ITOA_EQUIVALENT ::_itoa -#define ACE_STRCASECMP_EQUIVALENT ::_stricmp -#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp -#define ACE_WCSDUP_EQUIVALENT ::_wcsdup - -#define ACE_HAS_EXCEPTIONS -#define ACE_HAS_NEW_NOTHROW - -// Windows Mobile 5 doesn't do sig_atomic_t, but maybe future versions will. -# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x501) -# define ACE_HAS_SIG_ATOMIC_T -# endif /* !Win CE 5.0 or less */ - -#define ACE_HAS_STRERROR -#define ACE_LACKS_STRPTIME - -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES -#define ACE_LACKS_STRRECVFD -#define ACE_HAS_CPLUSPLUS_HEADERS - -#define ACE_HAS_TEMPLATE_TYPEDEFS -#define ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_HAS_TEMPLATE_SPECIALIZATION - -#define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d") -#define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u") - -// Platform provides ACE_TLI function prototypes. -// For Win32, this is not really true, but saves a lot of hassle! -#define ACE_HAS_TLI_PROTOTYPES - -// Platform support linebuffered streaming is broken -#define ACE_LACKS_LINEBUFFERED_STREAMBUF - -#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) - -// Platform has its Standard C++ library in the namespace std -# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ - -// ace/iostream.h does not work with the standard cpp library (yet). -# if !defined (ACE_USES_OLD_IOSTREAMS) -# define ACE_LACKS_ACE_IOSTREAM -# endif /* ! ACE_USES_OLD_IOSTREAMS */ - -#else - -// iostream header lacks ipfx (), isfx (), etc., declarations -# define ACE_LACKS_IOSTREAM_FX - -#endif - -// There are too many instances of this warning to fix it right now. -// Maybe in the future. - -// C++ Exception Specification ignored -#pragma warning(disable:4290) - -// 'this' : used in base member initializer list -#pragma warning(disable:4355) - -// 'class1' : inherits 'class2::member' via dominance -#pragma warning(disable:4250) - -// Disable warning of using Microsoft Extension. -# pragma warning(disable:4231) - -// Disable deprecation warnings, because setting _CRT_SECURE_NO_DEPRECATE -// did not prevent the warnings. -#pragma warning(disable:4996) - -// On CE w/o MFC config-WinCE.h needs to declare a placement new. This -// triggers a warning that there's no placement delete, which can be ignored. -#if defined (ACE_HAS_WINCE) && !defined (ACE_HAS_MFC) -# pragma warning(disable:4291) -#endif - -// A template can not be exported. Only an instantiation may be exported. -#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT - -// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to -// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC. -# define ACE_NEEDS_FUNC_DEFINITIONS - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_MSVC_8_H */ diff --git a/ace/config-win32-msvc.h b/ace/config-win32-msvc.h deleted file mode 100644 index 77bcedec66f..00000000000 --- a/ace/config-win32-msvc.h +++ /dev/null @@ -1,172 +0,0 @@ -//============================================================================= -/** - * @file config-win32-msvc.h - * - * $Id$ - * - * @brief Microsoft Visual C++ configuration file. - * - * This file is the ACE configuration file for Microsoft Visual C++ versions - * 5.0, 6.0, and 7.0 (.NET) - * - * @author Darrell Brunsch - */ -//============================================================================= - -#ifndef ACE_CONFIG_WIN32_MSVC_H -#define ACE_CONFIG_WIN32_MSVC_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -#define ACE_CC_NAME ACE_LIB_TEXT ("Visual C++") -#define ACE_CC_PREPROCESSOR "CL.EXE" -#define ACE_CC_PREPROCESSOR_ARGS "-nologo -E" - -#define ACE_CC_MAJOR_VERSION (_MSC_VER / 100 - 6) -#define ACE_CC_MINOR_VERSION (_MSC_VER % 100) -#define ACE_CC_BETA_VERSION (0) - -#if !defined (ACE_LD_DECORATOR_STR) -# if defined (_DEBUG) -# if ACE_HAS_MFC == 1 -# define ACE_LD_DECORATOR_STR ACE_LIB_TEXT ("mfcd") -# else -# define ACE_LD_DECORATOR_STR ACE_LIB_TEXT ("d") -# endif /* ACE_HAS_MFC */ -# else /* _NDEBUG */ -# if ACE_HAS_MFC == 1 -# define ACE_LD_DECORATOR_STR ACE_LIB_TEXT ("mfc") -# endif /* ACE_HAS_MFC */ -# endif /* _DEBUG */ -#endif /* ACE_LD_DECORATOR_STR */ - -// Compiler sets _CPPRTTI if rtti is enabled. -#if defined (_CPPRTTI) -# if defined (ACE_LACKS_RTTI) -# undef ACE_LACKS_RTTI -# endif -#else -# if !defined (ACE_LACKS_RTTI) -# define ACE_LACKS_RTTI -# endif -#endif /* _CPPRTTI */ - -#if ! defined(_NATIVE_WCHAR_T_DEFINED) - #define ACE_LACKS_NATIVE_WCHAR_T -#endif - -// Win Mobile still does thread exits differently than PC Windows. -#if defined (_WIN32_WCE) -# define ACE_ENDTHREADEX(STATUS) ExitThread ((DWORD) STATUS) -#else -# define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) -#endif /* _WIN32_WCE */ - -#if (_MSC_VER >= 1400) -# include "ace/config-win32-msvc-8.h" -#elif (_MSC_VER >= 1310) -# include "ace/config-win32-msvc-7.h" -#else -# error This version of Microsoft Visual C++ is not supported. -#endif - -// MFC changes the behavior of operator new at all MSVC versions from 6 up. -#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC == 1) -# if !defined (ACE_NEW_THROWS_EXCEPTIONS) -# define ACE_NEW_THROWS_EXCEPTIONS -# endif -# if defined (ACE_bad_alloc) -# undef ACE_bad_alloc -# endif -# define ACE_bad_alloc CMemoryException -#endif /* ACE_HAS_MFC && ACE_HAS_MFC==1 */ - -#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -// must have _MT defined to include multithreading -// features from win32 headers -# if !defined(_MT) && !defined (ACE_HAS_WINCE) -// *** DO NOT *** defeat this error message by defining _MT yourself. -// On MSVC, this is changed by selecting the Multithreaded -// DLL or Debug Multithreaded DLL in the Project Settings -// under C++ Code Generation. -# error You must link against multi-threaded libraries when using ACE (check your project settings) -# endif /* !_MT && !ACE_HAS_WINCE */ -#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ - -#include -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA 1 - -#define ACE_LACKS_DIRENT_H -#define ACE_LACKS_DLFCN_H -#define ACE_LACKS_INTTYPES_H -#define ACE_LACKS_NETDB_H -#define ACE_LACKS_NET_IF_H -#define ACE_LACKS_NETINET_IN_H -#define ACE_LACKS_STDINT_H -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_SYS_IOCTL_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_MMAN_H -#define ACE_LACKS_SYS_RESOURCE_H -#define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_SYS_SOCKET_H -#define ACE_LACKS_SYS_TIME_H -#define ACE_LACKS_SYS_UIO_H -#define ACE_LACKS_SYS_WAIT_H -#define ACE_LACKS_UCONTEXT_H - -#define ACE_LACKS_SEMAPHORE_H -#define ACE_LACKS_STRINGS_H -#define ACE_LACKS_PWD_H -#define ACE_LACKS_POLL_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_NETINET_TCP_H -#define ACE_LACKS_TERMIOS_H -#define ACE_LACKS_REGEX_H - - -// Turn off warnings for /W4 -// To resume any of these warning: #pragma warning(default: 4xxx) -// which should be placed after these defines - -# if !defined (ALL_WARNINGS) && defined(_MSC_VER) && !defined(ghs) && !defined(__MINGW32__) -// #pragma warning(disable: 4101) // unreferenced local variable -# pragma warning(disable: 4127) /* constant expression for TRACE/ASSERT */ -# pragma warning(disable: 4134) /* message map member fxn casts */ -# pragma warning(disable: 4511) /* private copy constructors are good to have */ -# pragma warning(disable: 4512) /* private operator= are good to have */ -# pragma warning(disable: 4514) /* unreferenced inlines are common */ -# pragma warning(disable: 4710) /* private constructors are disallowed */ -# pragma warning(disable: 4705) /* statement has no effect in optimized code */ -// #pragma warning(disable: 4701) // local variable *may* be used without init -// #pragma warning(disable: 4702) // unreachable code caused by optimizations -# pragma warning(disable: 4791) /* loss of debugging info in retail version */ -// #pragma warning(disable: 4204) // non-constant aggregate initializer -# pragma warning(disable: 4275) /* deriving exported class from non-exported */ -# pragma warning(disable: 4251) /* using non-exported as public in exported */ -# pragma warning(disable: 4786) /* identifier was truncated to '255' characters in the browser information */ -# pragma warning(disable: 4097) /* typedef-name used as synonym for class-name */ -# pragma warning(disable: 4800) /* converting int to boolean */ -# endif /* !ALL_WARNINGS && _MSV_VER && !ghs && !__MINGW32__ */ - -// STRICT type checking in WINDOWS.H enhances type safety for Windows -// programs by using distinct types to represent all the different -// HANDLES in Windows. So for example, STRICT prevents you from -// mistakenly passing an HPEN to a routine expecting an HBITMAP. -// Note that we only use this if we -# if defined (ACE_HAS_STRICT) && (ACE_HAS_STRICT != 0) -# if !defined (STRICT) /* may already be defined */ -# define STRICT -# endif /* !STRICT */ -# endif /* ACE_HAS_STRICT */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_MSVC_H */ diff --git a/ace/config-win32-visualage.h b/ace/config-win32-visualage.h deleted file mode 100644 index 62cc24037b1..00000000000 --- a/ace/config-win32-visualage.h +++ /dev/null @@ -1,137 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file config-win32-visualage.h - * - * $Id$ - * - * @brief Configuration file for VisualAge compilers - * - * @note Do not include this file directly, include config-win32.h instead. - * - * @author Darrell Brunsch - */ -//============================================================================= - -#ifndef ACE_CONFIG_WIN32_VISUALAGE_H -#define ACE_CONFIG_WIN32_VISUALAGE_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -#if defined (__IBMCPP__) && (__IBMCPP__ >= 400) - -#define ACE_CC_NAME ACE_LIB_TEXT ("IBM VisualAge C++") -#define ACE_CC_MAJOR_VERSION (__IBMCPP__ / 0x100) -#define ACE_CC_MINOR_VERSION (__IBMCPP__ % 0x100) -#define ACE_CC_BETA_VERSION (0) -#define ACE_CC_PREPROCESSOR "" -#define ACE_CC_PREPROCESSOR_ARGS "" - -#define ACE_HAS_CUSTOM_EXPORT_MACROS -#define ACE_Proper_Export_Flag __declspec (dllexport) -#define ACE_Proper_Import_Flag __declspec (dllimport) -#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class T -#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE; -#define ACE_IMPORT_SINGLETON_DECLARATION(T) template class T -#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class SINGLETON_TYPE ; - -// By default WIN32 has FD_SETSIZE of 64, which places the limit -// between 61 and 64 on the number of clients a server using the -// Select Reactor can support at the same time (i.e., 64 - standard in, -// out, error). He we raise the limit to 1024. Adjust the definition -// below if you need to raise or lower it. -// -#define FD_SETSIZE 1024 - -//These need to be defined for VisualAgeC++ -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES /* For signal handling */ -#define ACE_LACKS_MKTEMP -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define NSIG 23 /* Maximum no. of signals + 1 */ -#define ACE_HAS_CPLUSPLUS_HEADERS 1 -#define ACE_HAS_EXCEPTIONS 1 -#define ACE_HAS_GNU_CSTRING_H 1 -#define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 -#define ACE_HAS_SIG_ATOMIC_T 1 -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#define ACE_HAS_STDCPP_STL_INCLUDES 1 -#define ACE_HAS_STRERROR 1 -#define ACE_HAS_STRING_CLASS 1 -#define ACE_HAS_TEMPLATE_SPECIALIZATION 1 -#define ACE_HAS_TEMPLATE_TYPEDEFS 1 -#define ACE_HAS_TYPENAME_KEYWORD 1 -#define ACE_LACKS_ACE_IOSTREAM 1 -#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 -#define ACE_LACKS_STRPTIME 1 -#define ACE_LACKS_PRAGMA_ONCE 1 -#define ACE_LACKS_STRRECVFD 1 -#define ACE_NEW_THROWS_EXCEPTIONS 1 -#define ACE_SIZEOF_LONG_DOUBLE 10 -#define ACE_TEMPLATES_REQUIRE_SOURCE 1 -#define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS 1 -#define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u") -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -#define ACE_LACKS_NET_IF_H -#define ACE_LACKS_NETINET_IN_H -#define ACE_LACKS_DIRENT_H -#define ACE_LACKS_DLFCN_H -#define ACE_LACKS_NETDB_H -#define ACE_LACKS_PWD_H -#define ACE_LACKS_SEMAPHORE_H -#define ACE_LACKS_STDINT_H -#define ACE_LACKS_STRINGS_H -#define ACE_LACKS_SYS_IOCTL_H -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_MMAN_H -#define ACE_LACKS_SYS_RESOURCE_H -#define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_SYS_SOCKET_H -#define ACE_LACKS_SYS_TIME_H -#define ACE_LACKS_SYS_UIO_H -#define ACE_LACKS_SYS_WAIT_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_TERMIOS_H -#define ACE_LACKS_POLL_H -#define ACE_LACKS_NETINET_TCP_H -#define ACE_HAS_3_PARAM_WCSTOK -#define ACE_LACKS_STRCASECMP -#define ENOTEMPTY WSAENOTEMPTY - -#undef WIFEXITED -#undef WEXITSTATUS - -#define _O_CREAT O_CREAT -#define _O_TRUNC O_TRUNC -#define _O_TEMPORARY 0 -#define _O_EXCL O_EXCL -#define _O_RDWR O_RDWR -#define _O_WRONLY O_WRONLY -#define _O_RDONLY O_RDONLY -#define _O_APPEND O_APPEND -#define _O_BINARY O_BINARY -#define _O_TEXT O_TEXT - -#define _endthreadex _endthread -#define _beginthreadex _beginthread - -//Error codes that are in MS Visual C++ -#define EFAULT 99 /* Error code (should be in errno.h) */ -#define ENODEV 19 -#define EPIPE 32 -#define ENAMETOOLONG 38 - -#define ACE_ENDTHREADEX(STATUS) ::_endthread () - -#endif /* defined(__IBMCPP__) */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_VISUALAGE_H */ diff --git a/ace/config-win32.h b/ace/config-win32.h deleted file mode 100644 index 8e54f80c3f9..00000000000 --- a/ace/config-win32.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- C++ -*- */ -//============================================================================= -/** - * @file config-win32.h - * - * $Id$ - * - * @brief Microsoft Windows configuration file. - * - * This file is the ACE configuration file for all of Microsoft Windows - * platforms that ACE runs on. Based on preprocessor definitions, it - * includes other more specific configuration files. - * - * @author Darrell Brunsch - */ -//============================================================================= - -#ifndef ACE_CONFIG_WIN32_H -#define ACE_CONFIG_WIN32_H -#include /**/ "ace/pre.h" - -// NOTE: Please do not add anything besides #include's here. Put other stuff -// (definitions, etc.) in the included headers - -// We need to ensure that for Borland vcl.h can be included before -// windows.h. So we will not include config-win32-common.h from here, -// but instead let it be included at the appropriate place in -// config-win32-borland.h. -#if !defined (__BORLANDC__) -# include "ace/config-win32-common.h" -#endif /* !__BORLANDC__ */ - -// Include the config-win32-* file specific to the compiler -#if defined (__BORLANDC__) -# include "ace/config-win32-borland.h" -#elif defined (_MSC_VER) -# include "ace/config-win32-msvc.h" -#elif defined (__IBMCPP__) -# include "ace/config-win32-visualage.h" -#elif defined (ghs) -# include "ace/config-win32-ghs.h" -#elif defined (__MINGW32__) -# include "ace/config-win32-mingw.h" -#elif defined (__DMC__) -# include "ace/config-win32-dmc.h" -#else -# error Compiler is not supported -#endif - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_H */ diff --git a/ace/filecache.mpb b/ace/filecache.mpb deleted file mode 100644 index f5da84a3314..00000000000 --- a/ace/filecache.mpb +++ /dev/null @@ -1,8 +0,0 @@ -// -*- MPC -*- -// $Id$ - -feature(ace_filecache) { - Source_Files(ACE_COMPONENTS) { - Filecache.cpp - } -} diff --git a/ace/gethrtime.cpp b/ace/gethrtime.cpp deleted file mode 100644 index 74dbb62b689..00000000000 --- a/ace/gethrtime.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ -// -// Build this file with g++. It can be linked in to a ACE application -// that was compiled with GreenHills. It wouldn't be necessary if I -// knew a way to correctly move values from registers to a 64-bit -// variable in GHS asm code. That's easy with g++ asm. - -#include "ace/config-all.h" - -ACE_RCSID(ace, gethrtime, "$Id$") - -#if defined (ghs) && (defined (i386) || defined(__i386__)) - -#include "ace/OS_NS_time.h" - -extern "C" -ACE_hrtime_t -ACE_GETHRTIME_NAME (void) -{ -#if defined (ACE_HAS_PENTIUM) - // ACE_TRACE ("ACE_GETHRTIME_NAME"); - -#if defined (ACE_LACKS_LONGLONG_T) - double now; -#else /* ! ACE_LACKS_LONGLONG_T */ - ACE_hrtime_t now; -#endif /* ! ACE_LACKS_LONGLONG_T */ - - // See comments about the RDTSC Pentium instruction for the - // ACE_WIN32 version of ACE_OS::gethrtime () in ace/OS.i. - // - // Read the high-res tick counter directly into memory variable - // "now". The A constraint signifies a 64-bit int. -#if defined (__GNUG__) - asm volatile ("rdtsc" : "=A" (now) : : "memory"); -// #elif defined (ghs) -// The following doesn't work. For now, this file must be compile with g++. -// asm ("rdtsc"); -// asm ("movl %edx,-16(%ebp)"); -// asm ("movl %eax,-12(%ebp)"); -#else -# error unsupported compiler -#endif - -#if defined (ACE_LACKS_LONGLONG_T) - // ACE_U_LongLong doesn't have the same layout as now, so construct - // it "properly". - ACE_UINT32 least, most; - ACE_OS::memcpy (&least, &now, sizeof (ACE_UINT32)); - ACE_OS::memcpy (&most, (unsigned char *) &now + sizeof (ACE_UINT32), - sizeof (ACE_UINT32)); - - const ACE_hrtime_t ret (least, most); - return ret; -#else /* ! ACE_LACKS_LONGLONG_T */ - return now; -#endif /* ! ACE_LACKS_LONGLONG_T */ - -#else /* ! ACE_HAS_PENTIUM */ -# error This file can _only_ be compiled with ACE_HAS_PENTIUM. -#endif /* ! ACE_HAS_PENTIUM */ -} -#endif /* ghs */ diff --git a/ace/iosfwd.h b/ace/iosfwd.h deleted file mode 100644 index 4da758caa8f..00000000000 --- a/ace/iosfwd.h +++ /dev/null @@ -1,99 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file iosfwd.h - * - * $Id$ - * - * @author Irfan Pyarali - * - * This file contains the portability ugliness for the Standard C++ - * Library. As implementations of the "standard" emerge, this file - * will need to be updated. - * - * This files deals with forward declaration for the stream - * classes. Remember that since the new Standard C++ Library code - * for streams uses templates, simple forward declaration will not - * work. - */ -//============================================================================= - - -#ifndef ACE_IOSFWD_H -#define ACE_IOSFWD_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) - -#if defined (__APPLE_CC__) -// Should this really be here? dhinton -// FUZZ: disable check_for_streams_include -# include "ace/streams.h" -#endif - -#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ - (ACE_HAS_STANDARD_CPP_LIBRARY != 0) - -# if !defined (ACE_USES_OLD_IOSTREAMS) -# include /**/ -# else - // @note If these forward declarations don't work (e.g. aren't - // portable), we may have to include "ace/streams.h" as a last - // resort. Doing so would defeat the purpose of this header, - // unfortunately. - class ios; - class streambuf; - class istream; - class ostream; - class iostream; - class filebuf; - class ifstream; - class ofstream; - class fstream; -# endif /* ! ACE_USES_OLD_IOSTREAMS */ - -# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) - -# if !defined (ACE_USES_OLD_IOSTREAMS) - // Make these available in the global name space - using std::ios; - using std::streambuf; - using std::istream; - using std::ostream; - using std::iostream; - using std::filebuf; - using std::ifstream; - using std::ofstream; - using std::fstream; -# endif /* ! ACE_USES_OLD_IOSTREAMS */ - -# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ - -#else /* ! ACE_HAS_STANDARD_CPP_LIBRARY */ - - class ios; - class streambuf; - class istream; - class ostream; - class iostream; - class filebuf; - class ifstream; - class ofstream; - class fstream; - -# endif /* ! ACE_HAS_STANDARD_CPP_LIBRARY */ - -#include /**/ "ace/post.h" - -#endif /* ACE_LACKS_IOSTREAM_TOTALLY */ - -#endif /* ACE_IOSFWD_H */ diff --git a/ace/os_include/arpa/os_inet.h b/ace/os_include/arpa/os_inet.h deleted file mode 100644 index 3537a956abc..00000000000 --- a/ace/os_include/arpa/os_inet.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_inet.h - * - * definitions for internet operations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_ARPA_OS_INET_H -#define ACE_OS_INCLUDE_ARPA_OS_INET_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/netinet/os_in.h" - -#if !defined (ACE_LACKS_ARPA_INET_H) - extern "C" { -# include /**/ - } -#endif /* !ACE_LACKS_ARPA_INET_H */ - -#if defined (ACE_VXWORKS) -# include /**/ -#endif /* ACE_VXWORKS */ - -/** - * In some environments it is useful to swap the bytes on write, for - * instance: a fast server can be feeding a lot of slow clients that - * happen to have the wrong byte order. - * Because this is a rarely used feature we disable it by default to - * minimize footprint. - * This macro enables the functionality, but we still need a way to - * activate it on a per-connection basis. - */ -// #define ACE_ENABLE_SWAP_ON_WRITE - -/** - * In some environements we never need to swap bytes when reading, for - * instance embebbed systems (such as avionics) or homogenous - * networks. - * Setting this macro disables the capabilities to demarshall streams - * in the wrong byte order. - */ -// #define ACE_DISABLE_SWAP_ON_READ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_LACKS_INET_ATON_PROTOTYPE) - int inet_aton (const char *, struct in_addr *); -#endif /* ACE_LACKS_INET_ATON_PROTOTYPE */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_ARPA_OS_INET_H */ diff --git a/ace/os_include/net/os_if.h b/ace/os_include/net/os_if.h deleted file mode 100644 index 8ffcea9ff3d..00000000000 --- a/ace/os_include/net/os_if.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_if.h - * - * sockets local interfaces - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_NET_OS_IF_H -#define ACE_OS_INCLUDE_NET_OS_IF_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_NEEDS_IPC_1C_H) - // LynxOS 3.1.0 and later need this -# include /**/ -#endif /* ACE_NEEDS_IPC_1C_H */ - -#if !defined (ACE_LACKS_NET_IF_H) - // This part if to avoid STL name conflict with the map structure - // in net/if.h. -# if defined (ACE_HAS_STL_MAP_CONFLICT) -# define map _Resource_Allocation_Map_ -# endif /* ACE_HAS_STL_MAP_CONFLICT */ - extern "C" { -# include /**/ - } -# if defined (ACE_HAS_STL_MAP_CONFLICT) -# undef map -# endif /* ACE_HAS_STL_MAP_CONFLICT */ -# if defined (HPUX) && defined (IOR) - /* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h - and we don't want that definition. See IOP_IORC.h. - Thanks to Torsten Kopper for this patch.*/ -# undef IOR -# endif /* HPUX && IOR */ -#endif /* !ACE_LACKS_NET_IF_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_HAS_BROKEN_IF_HEADER) - struct ifafilt; -#endif /* ACE_HAS_BROKEN_IF_HEADER */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_NET_OS_IF_H */ diff --git a/ace/os_include/netinet/os_in.h b/ace/os_include/netinet/os_in.h deleted file mode 100644 index 8ad4cd853d6..00000000000 --- a/ace/os_include/netinet/os_in.h +++ /dev/null @@ -1,140 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_in.h - * - * Internet address family - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_NETINET_OS_IN_H -#define ACE_OS_INCLUDE_NETINET_OS_IN_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_inttypes.h" -#include "ace/os_include/sys/os_socket.h" - -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) -# include /**/ -#endif /* ACE_HAS_WINSOCK2 */ - -#if !defined (ACE_LACKS_NETINET_IN_H) -# if defined (ACE_HAS_STL_QUEUE_CONFLICT) -# define queue _Queue_ -# endif /* ACE_HAS_STL_QUEUE_CONFLICT */ - extern "C" { -# include /**/ - } -# if defined (ACE_HAS_STL_QUEUE_CONFLICT) -# undef queue -# endif /* ACE_HAS_STL_QUEUE_CONFLICT */ -#endif /* !ACE_LACKS_NETINET_IN_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -# if defined (ACE_HAS_PHARLAP_RT) -# define ACE_IPPROTO_TCP SOL_SOCKET -# else -# define ACE_IPPROTO_TCP IPPROTO_TCP -# endif /* ACE_HAS_PHARLAP_RT */ - -# if !defined (ACE_HAS_IP_MULTICAST) && defined (ACE_LACKS_IP_ADD_MEMBERSHIP) - // Even if ACE_HAS_IP_MULTICAST is not defined, if IP_ADD_MEMBERSHIP - // is defined, assume that the ip_mreq struct is also defined - // (presumably in netinet/in.h). - struct ip_mreq - { - /// IP multicast address of group - struct in_addr imr_multiaddr; - /// Local IP address of interface - struct in_addr imr_interface; - }; -# endif /* ! ACE_HAS_IP_MULTICAST && ACE_LACKS_IP_ADD_MEMBERSHIP */ - -#if !defined (IPPORT_RESERVED) -# define IPPORT_RESERVED 1024 -#endif /* !IPPORT_RESERVED */ - -#if !defined (IPPORT_USERRESERVED) -# define IPPORT_USERRESERVED 5000 -#endif /* !IPPORT_USERRESERVED */ - -// Define INET loopback address constant if it hasn't been defined -// Dotted Decimal 127.0.0.1 == Hexidecimal 0x7f000001 -#if !defined (INADDR_LOOPBACK) -# define INADDR_LOOPBACK ((ACE_UINT32) 0x7f000001) -#endif /* INADDR_LOOPBACK */ - -// The INADDR_NONE address is generally 255.255.255.255. -#if !defined (INADDR_NONE) -# define INADDR_NONE ((ACE_UINT32) 0xffffffff) -#endif /* INADDR_NONE */ - -// Define INET string length constants if they haven't been defined -// -// for IPv4 dotted-decimal -#if !defined (INET_ADDRSTRLEN) -# define INET_ADDRSTRLEN 16 -#endif /* INET_ADDRSTRLEN */ -// -// for IPv6 hex string -#if !defined (INET6_ADDRSTRLEN) -# define INET6_ADDRSTRLEN 46 -#endif /* INET6_ADDRSTRLEN */ - -# if !defined (IP_DROP_MEMBERSHIP) -# define IP_DROP_MEMBERSHIP 0 -# endif /* IP_DROP_MEMBERSHIP */ - -# if !defined (IP_ADD_MEMBERSHIP) -# define IP_ADD_MEMBERSHIP 0 -# define ACE_LACKS_IP_ADD_MEMBERSHIP -# endif /* IP_ADD_MEMBERSHIP */ - -# if !defined (IP_DEFAULT_MULTICAST_TTL) -# define IP_DEFAULT_MULTICAST_TTL 0 -# endif /* IP_DEFAULT_MULTICAST_TTL */ - -# if !defined (IP_DEFAULT_MULTICAST_LOOP) -# define IP_DEFAULT_MULTICAST_LOOP 0 -# endif /* IP_DEFAULT_MULTICAST_LOOP */ - -# if !defined (IP_MULTICAST_IF) -# define IP_MULTICAST_IF 0 -# endif /* IP_MULTICAST_IF */ - -# if !defined (IP_MULTICAST_TTL) -# define IP_MULTICAST_TTL 1 -# endif /* IP_MULTICAST_TTL */ - -# if !defined (IP_MULTICAST_LOOP) -# define IP_MULTICAST_LOOP 2 -# endif /* IP_MULTICAST_LOOP */ - -# if !defined (IP_MAX_MEMBERSHIPS) -# define IP_MAX_MEMBERSHIPS 0 -# endif /* IP_MAX_MEMBERSHIP */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_NETINET_OS_IN_H */ diff --git a/ace/os_include/netinet/os_tcp.h b/ace/os_include/netinet/os_tcp.h deleted file mode 100644 index 2d829320b45..00000000000 --- a/ace/os_include/netinet/os_tcp.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_tcp.h - * - * definitions for the Internet Transmission Control Protocol (TCP) - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_NETINET_OS_TCP_H -#define ACE_OS_INCLUDE_NETINET_OS_TCP_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_NETINET_TCP_H) -# include /**/ -#endif /* !ACE_LACKS_NETIINET_TCP_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_NETINET_OS_TCP_H */ diff --git a/ace/os_include/os_aio.h b/ace/os_include/os_aio.h deleted file mode 100644 index ea5dae9dfda..00000000000 --- a/ace/os_include/os_aio.h +++ /dev/null @@ -1,47 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_aio.h - * - * asynchronous input and output (REALTIME) - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_AIO_H -#define ACE_OS_INCLUDE_OS_AIO_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Inclusion of the header may make visible symbols defined in -// the headers , , , and . - -#include "ace/os_include/os_signal.h" // for sigevent - -#if !defined (ACE_LACKS_AIO_H) -# include /**/ -#endif /* !ACE_LACKS_AIO_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_AIO_H */ diff --git a/ace/os_include/os_assert.h b/ace/os_include/os_assert.h deleted file mode 100644 index bb39909b74e..00000000000 --- a/ace/os_include/os_assert.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_assert.h - * - * verify program assertion - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_ASSERT_H -#define ACE_OS_INCLUDE_OS_ASSERT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_ASSERT_H) -# include /**/ -#endif /* !ACE_LACKS_ASSERT_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_LACKS_ASSERT_MACRO) -# define assert(expr) -#endif - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_ASSERT_H */ diff --git a/ace/os_include/os_complex.h b/ace/os_include/os_complex.h deleted file mode 100644 index ce9f87fa8cb..00000000000 --- a/ace/os_include/os_complex.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_complex.h - * - * complex arithmetic - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_COMPLEX_H -#define ACE_OS_INCLUDE_OS_COMPLEX_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_COMPLEX_H) -# include /**/ -#endif /* !ACE_LACKS_COMPLEX_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_COMPLEX_H */ diff --git a/ace/os_include/os_cpio.h b/ace/os_include/os_cpio.h deleted file mode 100644 index efd108e8d0e..00000000000 --- a/ace/os_include/os_cpio.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_cpio.h - * - * cpio archive values - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_CPIO_H -#define ACE_OS_INCLUDE_OS_CPIO_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_CPIO_H) -# include /**/ -#endif /* !ACE_LACKS_CPIO_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_CPIO_H */ diff --git a/ace/os_include/os_ctype.h b/ace/os_include/os_ctype.h deleted file mode 100644 index 8dd449ad6af..00000000000 --- a/ace/os_include/os_ctype.h +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_ctype.h - * - * character types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_CTYPE_H -#define ACE_OS_INCLUDE_OS_CTYPE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_CTYPE_H) -# include /**/ -#endif /* !ACE_LACKS_CTYPE_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -// @todo move the is* and is* emulation methods in ACE_OS here -// and let ACE_OS just call them. - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_CTYPE_H */ diff --git a/ace/os_include/os_dirent.h b/ace/os_include/os_dirent.h deleted file mode 100644 index 0d17677c16c..00000000000 --- a/ace/os_include/os_dirent.h +++ /dev/null @@ -1,108 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_dirent.h - * - * format of directory entries - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_DIRENT_H -#define ACE_OS_INCLUDE_OS_DIRENT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" -#include "ace/os_include/os_limits.h" - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -# include "ace/os_include/os_unistd.h" // VxWorks needs this to compile -#endif /* ACE_VXWORKS */ - -#if !defined (ACE_LACKS_DIRENT_H) -# include /**/ -#endif /* !ACE_LACKS_DIRENT_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if !defined (MAXNAMLEN) -# define MAXNAMLEN NAME_MAX -#endif /* !MAXNAMLEN */ - -// At least compile on some of the platforms without info yet. -#if !defined (ACE_HAS_DIRENT) -typedef int ACE_DIR; -struct dirent { -}; -#endif /* ACE_HAS_DIRENT */ - -#if defined (ACE_LACKS_STRUCT_DIR) -struct dirent { - unsigned short d_ino; - unsigned short d_off; - unsigned short d_reclen; - // This must be a ACE_TCHAR * and not a one element - // ACE_TCHAR array. It causes problems on wide - // character builds with Visual C++ 6.0. - ACE_TCHAR *d_name; -}; - -#define ACE_DIRENT dirent - -struct ACE_DIR { - /// The name of the directory we are looking into - ACE_TCHAR *directory_name_; - - /// Remember the handle between calls. - HANDLE current_handle_; - - /// The struct for the results - ACE_DIRENT *dirent_; - - /// The struct for intermediate results. - ACE_TEXT_WIN32_FIND_DATA fdata_; - - /// A flag to remember if we started reading already. - int started_reading_; -}; -#elif defined (ACE_WIN32) && (__BORLANDC__) && defined (ACE_USES_WCHAR) -#define ACE_DIRENT wdirent -typedef wDIR ACE_DIR; -#else -#define ACE_DIRENT dirent -typedef DIR ACE_DIR; -#endif /* ACE_LACKS_STRUCT_DIR */ - -#if defined rewinddir -# undef rewinddir -#endif /* rewinddir */ - -#if defined (ACE_LACKS_SCANDIR_PROTOTYPE) -int scandir (const char *, - struct dirent ***, - int (*) (const struct dirent *), - int (*) (const void *, const void *)); -#endif /* ACE_LACKS_SCANDIR_PROTOTYPE */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_DIRENT_H */ diff --git a/ace/os_include/os_dlfcn.h b/ace/os_include/os_dlfcn.h deleted file mode 100644 index 373d345c196..00000000000 --- a/ace/os_include/os_dlfcn.h +++ /dev/null @@ -1,107 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_dlfcn.h - * - * dynamic linking - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_DLFCN_H -#define ACE_OS_INCLUDE_OS_DLFCN_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_DLFCN_H) -# if defined (ACE_HAS_DLFCN_H_BROKEN_EXTERN_C) - extern "C" { -# endif /* ACE_HAS_DLFCN_H_BROKEN_EXTERN_C */ -# include /**/ -# if defined (ACE_HAS_DLFCN_H_BROKEN_EXTERN_C) - } -# endif /* ACE_HAS_DLFCN_H_BROKEN_EXTERN_C */ -#endif /* !ACE_LACKS_DLFCN_H */ - -#if defined (__hpux) -# if defined(__GNUC__) || __cplusplus >= 199707L -# include /**/ -# else -# include /**/ -# endif /* (g++ || HP aC++) vs. HP C++ */ -#endif /* __hpux */ - -#if defined (ACE_VXWORKS) && !defined (__RTP__) -# include /**/ /* for module load */ -# include /**/ /* for module unload */ -# include /**/ /* for findSymbol */ -# include /**/ /* for global symbol table */ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (_M_UNIX) - int _dlclose (void *); - char *_dlerror (void); - void *_dlopen (const char *, int); - void * _dlsym (void *, const char *); -#endif /* _M_UNIX */ - -/* Set the proper handle type for dynamically-loaded libraries. */ -/* Also define a default 'mode' for loading a library - the names and values */ -/* differ between OSes, so if you write code that uses the mode, be careful */ -/* of the platform differences. */ -#if defined (ACE_WIN32) - // Dynamic loading-related types - used for dlopen and family. - typedef HINSTANCE ACE_SHLIB_HANDLE; -# define ACE_SHLIB_INVALID_HANDLE 0 -# define ACE_DEFAULT_SHLIB_MODE 0 -#elif defined (ACE_HAS_SVR4_DYNAMIC_LINKING) - typedef void *ACE_SHLIB_HANDLE; -# define ACE_SHLIB_INVALID_HANDLE 0 - // This is needed to for dynamic_cast to work properly on objects passed to - // libraries. -# define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY | RTLD_GLOBAL -#elif defined (__hpux) - typedef shl_t ACE_SHLIB_HANDLE; -# define ACE_SHLIB_INVALID_HANDLE 0 -# define ACE_DEFAULT_SHLIB_MODE BIND_DEFERRED -#else /* !ACE_WIN32 && !ACE_HAS_SVR4_DYNAMIC_LINKING && !__hpux */ - typedef void *ACE_SHLIB_HANDLE; -# define ACE_SHLIB_INVALID_HANDLE 0 -# define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY -#endif /* ACE_WIN32 */ - -#if !defined (RTLD_LAZY) -#define RTLD_LAZY 1 -#endif /* !RTLD_LAZY */ - -#if !defined (RTLD_NOW) -#define RTLD_NOW 2 -#endif /* !RTLD_NOW */ - -#if !defined (RTLD_GLOBAL) -#define RTLD_GLOBAL 3 -#endif /* !RTLD_GLOBAL */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_DLFCN_H */ diff --git a/ace/os_include/os_errno.h b/ace/os_include/os_errno.h deleted file mode 100644 index 9c9be161384..00000000000 --- a/ace/os_include/os_errno.h +++ /dev/null @@ -1,149 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_errno.h - * - * system error numbers - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_ERRNO_H -#define ACE_OS_INCLUDE_OS_ERRNO_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_ERRNO_H) -# include /**/ -#endif /* !ACE_LACKS_ERRNO_H */ - -#if defined (ACE_VXWORKS) -// Needed for VxWorks to pickup errnoSet() -#include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_WIN32) - // error code mapping for windows -# define ETIME ERROR_SEM_TIMEOUT -# define EWOULDBLOCK WSAEWOULDBLOCK -# define EINPROGRESS WSAEINPROGRESS -# define EALREADY WSAEALREADY -# define ENOTSOCK WSAENOTSOCK -# define EDESTADDRREQ WSAEDESTADDRREQ -# define EMSGSIZE WSAEMSGSIZE -# define EPROTOTYPE WSAEPROTOTYPE -# define ENOPROTOOPT WSAENOPROTOOPT -# define EPROTONOSUPPORT WSAEPROTONOSUPPORT -# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT -# define EOPNOTSUPP WSAEOPNOTSUPP -# define EPFNOSUPPORT WSAEPFNOSUPPORT -# define EAFNOSUPPORT WSAEAFNOSUPPORT -# define EADDRINUSE WSAEADDRINUSE -# define EADDRNOTAVAIL WSAEADDRNOTAVAIL -# define ENETDOWN WSAENETDOWN -# define ENETUNREACH WSAENETUNREACH -# define ENETRESET WSAENETRESET -# define ECONNABORTED WSAECONNABORTED -# define ECONNRESET WSAECONNRESET -# define ENOBUFS WSAENOBUFS -# define EISCONN WSAEISCONN -# define ENOTCONN WSAENOTCONN -# define ESHUTDOWN WSAESHUTDOWN -# define ETOOMANYREFS WSAETOOMANYREFS -# define ETIMEDOUT WSAETIMEDOUT -# define ECONNREFUSED WSAECONNREFUSED -# define ELOOP WSAELOOP -# define EHOSTDOWN WSAEHOSTDOWN -# define EHOSTUNREACH WSAEHOSTUNREACH -# define EPROCLIM WSAEPROCLIM -# define EUSERS WSAEUSERS -# define EDQUOT WSAEDQUOT -# define ESTALE WSAESTALE -# define EREMOTE WSAEREMOTE - // Grrr! ENAMETOOLONG and ENOTEMPTY are already defined by the horrible - // 'standard' library. - // #define ENAMETOOLONG WSAENAMETOOLONG -# define EADDRINUSE WSAEADDRINUSE - - // CE needs this... -# if !defined (EPERM) -# define EPERM ERROR_ACCESS_DENIED -# endif -#endif /* ACE_WIN32 */ - -#if defined (ACE_HAS_H_ERRNO) -void herror (const char *str); -#endif /* ACE_HAS_H_ERRNO */ - -#if !defined (ACE_WIN32) && defined (ACE_LACKS_T_ERRNO) -extern int t_errno; -#endif /* ACE_WIN32 && ACE_LACKS_T_ERRNO */ - -#if !defined (ENOSYS) -# define ENOSYS EFAULT /* Operation not supported or unknown error. */ -#endif /* !ENOSYS */ - -#if !defined (ENOTSUP) -# define ENOTSUP ENOSYS /* Operation not supported. */ -#endif /* !ENOTSUP */ - -#if !defined (ESUCCESS) -# define ESUCCESS 0 -#endif /* !ESUCCESS */ - -#if !defined (EIDRM) -# define EIDRM 0 -#endif /* !EIDRM */ - -#if !defined (ENFILE) -# define ENFILE EMFILE /* No more socket descriptors are available. */ -#endif /* !ENFILE */ - -#if !defined (ECOMM) - // Not the same, but ECONNABORTED is provided on NT. -# define ECOMM ECONNABORTED -#endif /* ECOMM */ - -#if !defined (EDEADLK) -# define EDEADLK 1000 /* Some large number.... */ -#endif /* !EDEADLK */ - -#if !defined (ENXIO) /* Needed in SOCK_Dgram_Mcast */ -# define ENXIO 6 -#endif /* ENXIO */ - -#if !defined (ETIMEDOUT) && defined (ETIME) -# define ETIMEDOUT ETIME -#endif /* ETIMEDOUT */ - -#if !defined (ETIME) && defined (ETIMEDOUT) -# define ETIME ETIMEDOUT -#endif /* ETIMED */ - -#if !defined (EBUSY) -# define EBUSY ETIME -#endif /* EBUSY */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_ERRNO_H */ diff --git a/ace/os_include/os_fcntl.h b/ace/os_include/os_fcntl.h deleted file mode 100644 index 275d131bb8f..00000000000 --- a/ace/os_include/os_fcntl.h +++ /dev/null @@ -1,106 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_fcntl.h - * - * file control options - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_FCNTL_H -#define ACE_OS_INCLUDE_OS_FCNTL_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_stat.h" -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_FCNTL_H) -# include /**/ -#endif /* !ACE_LACKS_FCNTL_H */ - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -// for creat(), open() -# include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (__BORLANDC__) -# define _O_CREAT O_CREAT -# define _O_EXCL O_EXCL -# define _O_TRUNC O_TRUNC - // 0x0800 is used for O_APPEND. 0x08 looks free. -# define _O_TEMPORARY 0x08 /* see fcntl.h */ -# define _O_RDWR O_RDWR -# define _O_WRONLY O_WRONLY -# define _O_RDONLY O_RDONLY -# define _O_APPEND O_APPEND -# define _O_BINARY O_BINARY -# define _O_TEXT O_TEXT -#endif /* __BORLANDC__ */ - -#if defined (__DMC__) -# define _O_TEMPORARY 0x08 /* see fcntl.h */ -#endif /* __DMC__ */ - -// defined Win32 specific macros for UNIX platforms -#if !defined (O_BINARY) -# define O_BINARY 0 -#endif /* O_BINARY */ -#if !defined (_O_BINARY) -# define _O_BINARY O_BINARY -#endif /* _O_BINARY */ -#if !defined (O_TEXT) -# define O_TEXT 0 -#endif /* O_TEXT */ -#if !defined (_O_TEXT) -# define _O_TEXT O_TEXT -#endif /* _O_TEXT */ -#if !defined (O_RAW) -# define O_RAW 0 -#endif /* O_RAW */ -#if !defined (_O_RAW) -# define _O_RAW O_RAW -#endif /* _O_RAW */ - -#if defined (ACE_WIN32) -# define O_NDELAY 1 -#endif /* ACE_WIN32 */ - -# if !defined (O_NONBLOCK) -# define O_NONBLOCK 1 -# endif /* O_NONBLOCK */ - -#if defined (ACE_HAS_POSIX_NONBLOCK) -# define ACE_NONBLOCK O_NONBLOCK -#else -# define ACE_NONBLOCK O_NDELAY -#endif /* ACE_HAS_POSIX_NONBLOCK */ - -# if !defined (F_GETFL) -# define F_GETFL 0 -# endif /* F_GETFL */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_FCNTL_H */ diff --git a/ace/os_include/os_fenv.h b/ace/os_include/os_fenv.h deleted file mode 100644 index 68df26c2d67..00000000000 --- a/ace/os_include/os_fenv.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_fenv.h - * - * floating-point environment - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_FENV_H -#define ACE_OS_INCLUDE_OS_FENV_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_FENV_H) -# include /**/ -#endif /* !ACE_LACKS_FENV_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_FENV_H */ diff --git a/ace/os_include/os_float.h b/ace/os_include/os_float.h deleted file mode 100644 index 94cfb3dc5ef..00000000000 --- a/ace/os_include/os_float.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_float.h - * - * floating types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_FLOAT_H -#define ACE_OS_INCLUDE_OS_FLOAT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_FLOAT_H) -# include /**/ -#endif /* !ACE_LACKS_FLOAT_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_FLOAT_H */ diff --git a/ace/os_include/os_fmtmsg.h b/ace/os_include/os_fmtmsg.h deleted file mode 100644 index 5b779e4b3a0..00000000000 --- a/ace/os_include/os_fmtmsg.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_fmtmsg.h - * - * message display structures - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_FMTMSG_H -#define ACE_OS_INCLUDE_OS_FMTMSG_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_FMTMSG_H) -# include /**/ -#endif /* !ACE_LACKS_FMTMSG_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_FMTMSG_H */ diff --git a/ace/os_include/os_fnmatch.h b/ace/os_include/os_fnmatch.h deleted file mode 100644 index 779e05b32f5..00000000000 --- a/ace/os_include/os_fnmatch.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_fnmatch.h - * - * filename-matching types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_FNMATCH_H -#define ACE_OS_INCLUDE_OS_FNMATCH_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_FNMATCH_H) -# include /**/ -#endif /* !ACE_LACKS_FNMATCH_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_FNMATCH_H */ diff --git a/ace/os_include/os_ftw.h b/ace/os_include/os_ftw.h deleted file mode 100644 index b77bf18ead1..00000000000 --- a/ace/os_include/os_ftw.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_ftw.h - * - * file tree traversal - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_FTW_H -#define ACE_OS_INCLUDE_OS_FTW_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_stat.h" - -#if !defined (ACE_LACKS_FTW_H) -# include /**/ -#endif /* !ACE_LACKS_FTW_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_FTW_H */ diff --git a/ace/os_include/os_glob.h b/ace/os_include/os_glob.h deleted file mode 100644 index daa47417e5f..00000000000 --- a/ace/os_include/os_glob.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_glob.h - * - * pathname pattern-matching types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_GLOB_H -#define ACE_OS_INCLUDE_OS_GLOB_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_GLOB_H) -# include /**/ -#endif /* !ACE_LACKS_GLOB_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_GLOB_H */ diff --git a/ace/os_include/os_grp.h b/ace/os_include/os_grp.h deleted file mode 100644 index 9f912a0750c..00000000000 --- a/ace/os_include/os_grp.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_grp.h - * - * group structure - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_GRP_H -#define ACE_OS_INCLUDE_OS_GRP_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" // for gid_t - -#if !defined (ACE_LACKS_GRP_H) -# include /**/ -#endif /* !ACE_LACKS_GRP_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_GRP_H */ diff --git a/ace/os_include/os_iconv.h b/ace/os_include/os_iconv.h deleted file mode 100644 index 36a81b3e25c..00000000000 --- a/ace/os_include/os_iconv.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_iconv.h - * - * codeset conversion facility - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_ICONV_H -#define ACE_OS_INCLUDE_OS_ICONV_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_ICONV_H) -# include /**/ -#endif /* !ACE_LACKS_ICONV_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_ICONV_H */ diff --git a/ace/os_include/os_inttypes.h b/ace/os_include/os_inttypes.h deleted file mode 100644 index 12ce23d9b8c..00000000000 --- a/ace/os_include/os_inttypes.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_inttypes.h - * - * fixed size integer types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_INTTYPES_H -#define ACE_OS_INCLUDE_OS_INTTYPES_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_stdint.h" - -#if !defined (ACE_LACKS_INTTYPES_H) -# include /**/ -#endif /* !ACE_LACKS_INTTYPES_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -// @todo if needbe, we can define the macros if they aren't available. - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_INTTYPES_H */ diff --git a/ace/os_include/os_iso646.h b/ace/os_include/os_iso646.h deleted file mode 100644 index 3d724a9bb62..00000000000 --- a/ace/os_include/os_iso646.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_iso646.h - * - * alternative spellings - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_ISO646_H -#define ACE_OS_INCLUDE_OS_ISO646_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_ISO646_H) -# include /**/ -#endif /* !ACE_LACKS_ISO646_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_ISO646_H */ diff --git a/ace/os_include/os_langinfo.h b/ace/os_include/os_langinfo.h deleted file mode 100644 index 9023750f8cd..00000000000 --- a/ace/os_include/os_langinfo.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_langinfo.h - * - * language information constants - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_LANGINFO_H -#define ACE_OS_INCLUDE_OS_LANGINFO_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_nl_types.h" - -#if !defined (ACE_LACKS_LANGINFO_H) -# include /**/ -#endif /* !ACE_LACKS_LANGINFO_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_LANGINFO_H */ diff --git a/ace/os_include/os_libgen.h b/ace/os_include/os_libgen.h deleted file mode 100644 index d4043f02480..00000000000 --- a/ace/os_include/os_libgen.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_libgen.h - * - * definitions for pattern matching functions - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_LIBGEN_H -#define ACE_OS_INCLUDE_OS_LIBGEN_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_LIBGEN_H) -# include /**/ -#endif /* !ACE_LACKS_LIBGEN_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_LIBGEN_H */ diff --git a/ace/os_include/os_limits.h b/ace/os_include/os_limits.h deleted file mode 100644 index 17dba75622a..00000000000 --- a/ace/os_include/os_limits.h +++ /dev/null @@ -1,143 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_limits.h - * - * implementation-defined constants - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_LIMITS_H -#define ACE_OS_INCLUDE_OS_LIMITS_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_unistd.h" -#include "ace/os_include/os_stdio.h" // for FILENAME_MAX on Windows - -#if !defined (ACE_LACKS_LIMITS_H) -# include /**/ -#endif /* !ACE_LACKS_LIMITS_H */ - -#if !defined (ACE_LACKS_SYS_PARAM_H) -# include /**/ -#endif /* ACE_LACKS_SYS_PARAM_H */ - -// On VxWorks 5.5.1 _POSIX_TIMER_MAX is defined in time.h -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -# include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if ! defined (howmany) -# define howmany(x, y) (((x)+((y)-1))/(y)) -#endif /* howmany */ - -#if !defined (NAME_MAX) -# if defined (MAXNAMLEN) -# define NAME_MAX MAXNAMLEN -# elif defined (MAXNAMELEN) -# define NAME_MAX MAXNAMELEN -# elif defined (FILENAME_MAX) -# define NAME_MAX FILENAME_MAX -# elif defined (_MAX_FNAME) -# define NAME_MAX _MAX_FNAME -# else /* _MAX_FNAME */ -# define NAME_MAX 256 -# endif /* MAXNAMLEN */ -#endif /* !NAME_MAX */ - -#if !defined (MAXNAMELEN) -# define MAXNAMELEN NAME_MAX -#endif /* MAXNAMELEN */ - -#if !defined (HOST_NAME_MAX) -# define HOST_NAME_MAX 256 -#endif /* !HOST_NAME_MAX */ - -// Note that we are using PATH_MAX instead of _POSIX_PATH_MAX, since -// _POSIX_PATH_MAX is the *minimun* maximum value for PATH_MAX and is -// defined by POSIX as 256. -#if !defined (PATH_MAX) -# if defined (_MAX_PATH) -# define PATH_MAX _MAX_PATH -# elif defined (MAX_PATH) -# define PATH_MAX MAX_PATH -# else /* !_MAX_PATH */ -# define PATH_MAX 1024 -# endif /* _MAX_PATH */ -#endif /* !PATH_MAX */ - -// Leaving this for backward compatibility, but PATH_MAX should always be -// used directly. -#if !defined (MAXPATHLEN) -# define MAXPATHLEN PATH_MAX -#endif /* !MAXPATHLEN */ - -// This is defined by XOPEN to be a minimum of 16. POSIX.1g -// also defines this value. platform-specific config.h can -// override this if need be. -#if !defined (IOV_MAX) -# define IOV_MAX 16 -#endif /* IOV_MAX */ - -#if !defined (ACE_IOV_MAX) -# define ACE_IOV_MAX IOV_MAX -#endif /* ACE_IOV_MAX */ - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x620) -# if defined (PIPE_BUF) && (PIPE_BUF == -1) -# undef PIPE_BUF -# endif -#endif /* ACE_VXWORKS == 0x620 */ - -#if !defined (PIPE_BUF) -# define PIPE_BUF 5120 -#endif /* PIPE_BUF */ - -#if defined (ACE_HAS_POSIX_REALTIME_SIGNALS) - // = Giving unique ACE scoped names for some important - // RTSignal-Related constants. Becuase sometimes, different - // platforms use different names for these constants. - - // Number of realtime signals provided in the system. - // _POSIX_RTSIG_MAX is the upper limit on the number of real time - // signals supported in a posix-4 compliant system. -# if defined (_POSIX_RTSIG_MAX) -# define ACE_RTSIG_MAX _POSIX_RTSIG_MAX -# else /* not _POSIX_RTSIG_MAX */ - // POSIX-4 compilant system has to provide atleast 8 RT signals. - // @@ Make sure the platform does *not* define this constant with - // some other name. If yes, use that instead of 8. -# define ACE_RTSIG_MAX 8 -# endif /* _POSIX_RTSIG_MAX */ -#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ - - // The maximum number of concurrent timers per process. -# if !defined (_POSIX_TIMER_MAX) -# define _POSIX_TIMER_MAX 44 -# endif /* _POSIX_TIMER_MAX */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_LIMITS_H */ diff --git a/ace/os_include/os_local.h b/ace/os_include/os_local.h deleted file mode 100644 index f50406a65de..00000000000 --- a/ace/os_include/os_local.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_local.h - * - * category macros - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_LOCAL_H -#define ACE_OS_INCLUDE_OS_LOCAL_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_stddef.h" - -#if !defined (ACE_LACKS_LOCAL_H) -# include /**/ -#endif /* !ACE_LACKS_LOCAL_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_LOCAL_H */ diff --git a/ace/os_include/os_math.h b/ace/os_include/os_math.h deleted file mode 100644 index 9d0ccadba72..00000000000 --- a/ace/os_include/os_math.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_math.h - * - * mathematical declarations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_MATH_H -#define ACE_OS_INCLUDE_OS_MATH_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// FUZZ: disable check_for_math_include - -#if !defined (ACE_LACKS_MATH_H) -# include /**/ -#endif /* !ACE_LACKS_MATH_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_MATH_H */ diff --git a/ace/os_include/os_monetary.h b/ace/os_include/os_monetary.h deleted file mode 100644 index 521347f351c..00000000000 --- a/ace/os_include/os_monetary.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_monetary.h - * - * monetary types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_MONETARY_H -#define ACE_OS_INCLUDE_OS_MONETARY_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_MONETARY_H) -# include /**/ -#endif /* !ACE_LACKS_MONETARY_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_MONETARY_H */ diff --git a/ace/os_include/os_mqueue.h b/ace/os_include/os_mqueue.h deleted file mode 100644 index a85128d6037..00000000000 --- a/ace/os_include/os_mqueue.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_mqueue.h - * - * message queues (REALTIME) - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_MQUEUE_H -#define ACE_OS_INCLUDE_OS_MQUEUE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_signal.h" - -#if !defined (ACE_LACKS_MQUEUE_H) -# include /**/ -#endif /* !ACE_LACKS_MQUEUE_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_MQUEUE_H */ diff --git a/ace/os_include/os_ndbm.h b/ace/os_include/os_ndbm.h deleted file mode 100644 index 4f8f66acc83..00000000000 --- a/ace/os_include/os_ndbm.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_ndbm.h - * - * definitions for ndbm database operations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_NDBM_H -#define ACE_OS_INCLUDE_OS_NDBM_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_NDBM_H) -# include /**/ -#endif /* !ACE_LACKS_NDBM_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_NDBM_H */ diff --git a/ace/os_include/os_netdb.h b/ace/os_include/os_netdb.h deleted file mode 100644 index 34e006f0f26..00000000000 --- a/ace/os_include/os_netdb.h +++ /dev/null @@ -1,80 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_netdb.h - * - * definitions for network database operations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_NETDB_H -#define ACE_OS_INCLUDE_OS_NETDB_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/netinet/os_in.h" -#include "ace/os_include/os_limits.h" - -#if !defined (ACE_LACKS_NETDB_H) -# if defined (ACE_HAS_STL_QUEUE_CONFLICT) -# define queue _Queue_ -# endif /* ACE_HAS_STL_QUEUE_CONFLICT */ - extern "C" { -# include /**/ - } -# if defined (ACE_HAS_STL_QUEUE_CONFLICT) -# undef queue -# endif /* ACE_HAS_STL_QUEUE_CONFLICT */ -#endif /* !ACE_LACKS_NETDB_H */ - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -# include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_HAS_STRUCT_NETDB_DATA) - typedef char ACE_HOSTENT_DATA[sizeof(struct hostent_data)]; - typedef char ACE_SERVENT_DATA[sizeof(struct servent_data)]; - typedef char ACE_PROTOENT_DATA[sizeof(struct protoent_data)]; -#else -# if !defined ACE_HOSTENT_DATA_SIZE -# define ACE_HOSTENT_DATA_SIZE (4*1024) -# endif /*ACE_HOSTENT_DATA_SIZE */ -# if !defined ACE_SERVENT_DATA_SIZE -# define ACE_SERVENT_DATA_SIZE (4*1024) -# endif /*ACE_SERVENT_DATA_SIZE */ -# if !defined ACE_PROTOENT_DATA_SIZE -# define ACE_PROTOENT_DATA_SIZE (2*1024) -# endif /*ACE_PROTOENT_DATA_SIZE */ - typedef char ACE_HOSTENT_DATA[ACE_HOSTENT_DATA_SIZE]; - typedef char ACE_SERVENT_DATA[ACE_SERVENT_DATA_SIZE]; - typedef char ACE_PROTOENT_DATA[ACE_PROTOENT_DATA_SIZE]; -#endif /* ACE_HAS_STRUCT_NETDB_DATA */ - -# if !defined(MAXHOSTNAMELEN) -# define MAXHOSTNAMELEN HOST_NAME_MAX -# endif /* MAXHOSTNAMELEN */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_NETDB_H */ diff --git a/ace/os_include/os_nl_types.h b/ace/os_include/os_nl_types.h deleted file mode 100644 index d84a8a734be..00000000000 --- a/ace/os_include/os_nl_types.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_nl_types.h - * - * data types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_NL_TYPES_H -#define ACE_OS_INCLUDE_OS_NL_TYPES_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_NL_TYPES_H) -# include /**/ -#endif /* !ACE_LACKS_nl_types_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_NL_TYPES_H */ diff --git a/ace/os_include/os_poll.h b/ace/os_include/os_poll.h deleted file mode 100644 index afb5bcc6993..00000000000 --- a/ace/os_include/os_poll.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_poll.h - * - * definitions for the poll() function - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_POLL_H -#define ACE_OS_INCLUDE_OS_POLL_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_POLL_H) -# include /**/ -#endif /* !ACE_LACKS_POLL_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_POLL_H */ diff --git a/ace/os_include/os_pthread.h b/ace/os_include/os_pthread.h deleted file mode 100644 index 782d15b35a3..00000000000 --- a/ace/os_include/os_pthread.h +++ /dev/null @@ -1,459 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_pthread.h - * - * threads - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_PTHREAD_H -#define ACE_OS_INCLUDE_OS_PTHREAD_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_PRIOCNTL) - // Need to #include thread.h before #defining THR_BOUND, etc., - // when building without threads on SunOS 5.x. -# if defined (sun) -# include /**/ -# endif /* sun */ - - // Need to #include these before #defining USYNC_PROCESS on SunOS 5.x. -# include /**/ -# include /**/ -#endif /* ACE_HAS_PRIOCNTL */ - -#include "ace/os_include/sys/os_types.h" - -// This needs to go here *first* to avoid problems with AIX. -# if defined (ACE_HAS_PTHREADS) -# define ACE_DONT_INCLUDE_ACE_SIGNAL_H -# include "ace/os_include/os_signal.h" -# undef ACE_DONT_INCLUDE_ACE_SIGNAL_H -# if defined (DIGITAL_UNIX) -# define pthread_self __pthread_self -extern "C" pthread_t pthread_self (void); -# endif /* DIGITAL_UNIX */ -# endif /* ACE_HAS_PTHREADS */ - - -#if !defined (ACE_LACKS_PTHREAD_H) - extern "C" { -# if defined (ACE_TANDEM_T1248_PTHREADS) -# include /**/ -# else -# include /**/ -# endif - } -#endif /* !ACE_LACKS_PTHREAD_H */ - -#if defined (ACE_HAS_PTHREAD_NP_H) -// FreeBSD declares _np (non-portable) pthread extensions in -# include /**/ -#endif - -// @todo: need to reoganize to put includes at the top and the rest of the -// code at the bottom. Also, move the classes out of this file. -#if defined (ACE_HAS_PTHREADS) -# define ACE_SCHED_OTHER SCHED_OTHER -# define ACE_SCHED_FIFO SCHED_FIFO -# define ACE_SCHED_RR SCHED_RR - -// Definitions for mapping POSIX pthreads draft 6 into 1003.1c names - -# if defined (ACE_HAS_PTHREADS_DRAFT6) -# define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL -# define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL -# define PTHREAD_CREATE_UNDETACHED 0 -# define PTHREAD_CREATE_DETACHED 1 -# define PTHREAD_CREATE_JOINABLE 0 -# define PTHREAD_EXPLICIT_SCHED 0 -# define PTHREAD_MIN_PRIORITY 0 -# define PTHREAD_MAX_PRIORITY 126 -# endif /* ACE_HAS_PTHREADS_DRAFT6 */ - -// Definitions for THREAD- and PROCESS-LEVEL priorities...some -// implementations define these while others don't. In order to -// further complicate matters, we don't redefine the default (*_DEF) -// values if they've already been defined, which allows individual -// programs to have their own ACE-wide "default". - -// PROCESS-level values -# if (defined (_POSIX_PRIORITY_SCHEDULING) || defined (ACE_TANDEM_T1248_PTHREADS)) \ - && !defined(_UNICOS) && !defined(UNIXWARE_7_1) -# define ACE_PROC_PRI_FIFO_MIN (sched_get_priority_min(SCHED_FIFO)) -# define ACE_PROC_PRI_RR_MIN (sched_get_priority_min(SCHED_RR)) -# if defined (HPUX) - // HP-UX's other is the SCHED_HPUX class, which uses historical - // values that have reverse semantics from POSIX (low value is - // more important priority). To use these in pthreads calls, - // the values need to be converted. The other scheduling classes - // don't need this special treatment. -# define ACE_PROC_PRI_OTHER_MIN \ - (sched_get_priority_min(SCHED_OTHER)) -# else -# define ACE_PROC_PRI_OTHER_MIN (sched_get_priority_min(SCHED_OTHER)) -# endif /* HPUX */ -# else /* UNICOS is missing a sched_get_priority_min() implementation, - SCO too */ -# define ACE_PROC_PRI_FIFO_MIN 0 -# define ACE_PROC_PRI_RR_MIN 0 -# define ACE_PROC_PRI_OTHER_MIN 0 -# endif - -# if defined (_POSIX_PRIORITY_SCHEDULING) && !defined(UNIXWARE_7_1) -# define ACE_PROC_PRI_FIFO_MAX (sched_get_priority_max(SCHED_FIFO)) -# define ACE_PROC_PRI_RR_MAX (sched_get_priority_max(SCHED_RR)) -# if defined (HPUX) -# define ACE_PROC_PRI_OTHER_MAX \ - (sched_get_priority_max(SCHED_OTHER)) -# else -# define ACE_PROC_PRI_OTHER_MAX (sched_get_priority_max(SCHED_OTHER)) -# endif /* HPUX */ -# else /* SCO missing sched_get_priority_max() implementation */ -# define ACE_PROC_PRI_FIFO_MAX 59 -# define ACE_PROC_PRI_RR_MAX 59 -# define ACE_PROC_PRI_OTHER_MAX 59 -# endif - -# if !defined(ACE_PROC_PRI_FIFO_DEF) -# define ACE_PROC_PRI_FIFO_DEF (ACE_PROC_PRI_FIFO_MIN + (ACE_PROC_PRI_FIFO_MAX - ACE_PROC_PRI_FIFO_MIN)/2) -# endif -# if !defined(ACE_PROC_PRI_RR_DEF) -# define ACE_PROC_PRI_RR_DEF (ACE_PROC_PRI_RR_MIN + (ACE_PROC_PRI_RR_MAX - ACE_PROC_PRI_RR_MIN)/2) -# endif -# if !defined(ACE_PROC_PRI_OTHER_DEF) -# define ACE_PROC_PRI_OTHER_DEF (ACE_PROC_PRI_OTHER_MIN + (ACE_PROC_PRI_OTHER_MAX - ACE_PROC_PRI_OTHER_MIN)/2) -# endif - -// THREAD-level values -# if defined(PRI_FIFO_MIN) && defined(PRI_FIFO_MAX) && defined(PRI_RR_MIN) && defined(PRI_RR_MAX) && defined(PRI_OTHER_MIN) && defined(PRI_OTHER_MAX) -# if !defined (ACE_THR_PRI_FIFO_MIN) -# define ACE_THR_PRI_FIFO_MIN (long) PRI_FIFO_MIN -# endif /* !ACE_THR_PRI_FIFO_MIN */ -# if !defined (ACE_THR_PRI_FIFO_MAX) -# define ACE_THR_PRI_FIFO_MAX (long) PRI_FIFO_MAX -# endif /* !ACE_THR_PRI_FIFO_MAX */ -# if !defined (ACE_THR_PRI_RR_MIN) -# define ACE_THR_PRI_RR_MIN (long) PRI_RR_MIN -# endif /* !ACE_THR_PRI_RR_MIN */ -# if !defined (ACE_THR_PRI_RR_MAX) -# define ACE_THR_PRI_RR_MAX (long) PRI_RR_MAX -# endif /* !ACE_THR_PRI_RR_MAX */ -# if !defined (ACE_THR_PRI_OTHER_MIN) -# define ACE_THR_PRI_OTHER_MIN (long) PRI_OTHER_MIN -# endif /* !ACE_THR_PRI_OTHER_MIN */ -# if !defined (ACE_THR_PRI_OTHER_MAX) -# define ACE_THR_PRI_OTHER_MAX (long) PRI_OTHER_MAX -# endif /* !ACE_THR_PRI_OTHER_MAX */ -# elif defined (AIX) - // AIX's priority range is 1 (low) to 127 (high). There aren't - // any preprocessor macros I can find. PRIORITY_MIN is for - // process priorities, as far as I can see, and does not apply - // to thread priority. The 1 to 127 range is from the - // pthread_attr_setschedparam man page (Steve Huston, 18-May-2001). -# if !defined (ACE_THR_PRI_FIFO_MIN) -# define ACE_THR_PRI_FIFO_MIN (long) 1 -# endif /* !ACE_THR_PRI_FIFO_MIN */ -# if !defined (ACE_THR_PRI_FIFO_MAX) -# define ACE_THR_PRI_FIFO_MAX (long) 127 -# endif /* !ACE_THR_PRI_FIFO_MAX */ -# if !defined (ACE_THR_PRI_RR_MIN) -# define ACE_THR_PRI_RR_MIN (long) 1 -# endif /* !ACE_THR_PRI_RR_MIN */ -# if !defined (ACE_THR_PRI_RR_MAX) -# define ACE_THR_PRI_RR_MAX (long) 127 -# endif /* !ACE_THR_PRI_RR_MAX */ -# if !defined (ACE_THR_PRI_OTHER_MIN) -# define ACE_THR_PRI_OTHER_MIN (long) 1 -# endif /* !ACE_THR_PRI_OTHER_MIN */ -# if !defined (ACE_THR_PRI_OTHER_MAX) -# define ACE_THR_PRI_OTHER_MAX (long) 127 -# endif /* !ACE_THR_PRI_OTHER_MAX */ -# elif defined (sun) -# if !defined (ACE_THR_PRI_FIFO_MIN) -# define ACE_THR_PRI_FIFO_MIN (long) 0 -# endif /* !ACE_THR_PRI_FIFO_MIN */ -# if !defined (ACE_THR_PRI_FIFO_MAX) -# define ACE_THR_PRI_FIFO_MAX (long) 59 -# endif /* !ACE_THR_PRI_FIFO_MAX */ -# if !defined (ACE_THR_PRI_RR_MIN) -# define ACE_THR_PRI_RR_MIN (long) 0 -# endif /* !ACE_THR_PRI_RR_MIN */ -# if !defined (ACE_THR_PRI_RR_MAX) -# define ACE_THR_PRI_RR_MAX (long) 59 -# endif /* !ACE_THR_PRI_RR_MAX */ -# if !defined (ACE_THR_PRI_OTHER_MIN) -# define ACE_THR_PRI_OTHER_MIN (long) 0 -# endif /* !ACE_THR_PRI_OTHER_MIN */ -# if !defined (ACE_THR_PRI_OTHER_MAX) -# define ACE_THR_PRI_OTHER_MAX (long) 127 -# endif /* !ACE_THR_PRI_OTHER_MAX */ -# else -# if !defined (ACE_THR_PRI_FIFO_MIN) -# define ACE_THR_PRI_FIFO_MIN (long) ACE_PROC_PRI_FIFO_MIN -# endif /* !ACE_THR_PRI_FIFO_MIN */ -# if !defined (ACE_THR_PRI_FIFO_MAX) -# define ACE_THR_PRI_FIFO_MAX (long) ACE_PROC_PRI_FIFO_MAX -# endif /* !ACE_THR_PRI_FIFO_MAX */ -# if !defined (ACE_THR_PRI_RR_MIN) -# define ACE_THR_PRI_RR_MIN (long) ACE_PROC_PRI_RR_MIN -# endif /* !ACE_THR_PRI_RR_MIN */ -# if !defined (ACE_THR_PRI_RR_MAX) -# define ACE_THR_PRI_RR_MAX (long) ACE_PROC_PRI_RR_MAX -# endif /* !ACE_THR_PRI_RR_MAX */ -# if !defined (ACE_THR_PRI_OTHER_MIN) -# define ACE_THR_PRI_OTHER_MIN (long) ACE_PROC_PRI_OTHER_MIN -# endif /* !ACE_THR_PRI_OTHER_MIN */ -# if !defined (ACE_THR_PRI_OTHER_MAX) -# define ACE_THR_PRI_OTHER_MAX (long) ACE_PROC_PRI_OTHER_MAX -# endif /* !ACE_THR_PRI_OTHER_MAX */ -# endif -# if !defined(ACE_THR_PRI_FIFO_DEF) -# define ACE_THR_PRI_FIFO_DEF ((ACE_THR_PRI_FIFO_MIN + ACE_THR_PRI_FIFO_MAX)/2) -# endif -# if !defined(ACE_THR_PRI_RR_DEF) -# define ACE_THR_PRI_RR_DEF ((ACE_THR_PRI_RR_MIN + ACE_THR_PRI_RR_MAX)/2) -# endif -# if !defined(ACE_THR_PRI_OTHER_DEF) -# define ACE_THR_PRI_OTHER_DEF ((ACE_THR_PRI_OTHER_MIN + ACE_THR_PRI_OTHER_MAX)/2) -# endif - // Typedefs to help compatibility with Windows NT and Pthreads. - typedef pthread_t ACE_hthread_t; - typedef pthread_t ACE_thread_t; - - // native TSS key type - typedef pthread_key_t ACE_OS_thread_key_t; - // TSS key type to be used by application -# if defined (ACE_HAS_TSS_EMULATION) - typedef u_int ACE_thread_key_t; -# else /* ! ACE_HAS_TSS_EMULATION */ - typedef ACE_OS_thread_key_t ACE_thread_key_t; -# endif /* ! ACE_HAS_TSS_EMULATION */ - -# if !defined (ACE_LACKS_COND_T) - typedef pthread_mutex_t ACE_mutex_t; - typedef pthread_cond_t ACE_cond_t; - typedef pthread_condattr_t ACE_condattr_t; - typedef pthread_mutexattr_t ACE_mutexattr_t; -# endif /* ! ACE_LACKS_COND_T */ - typedef pthread_mutex_t ACE_thread_mutex_t; - -# if !defined (PTHREAD_CANCEL_DISABLE) -# define PTHREAD_CANCEL_DISABLE 0 -# endif /* PTHREAD_CANCEL_DISABLE */ - -# if !defined (PTHREAD_CANCEL_ENABLE) -# define PTHREAD_CANCEL_ENABLE 0 -# endif /* PTHREAD_CANCEL_ENABLE */ - -# if !defined (PTHREAD_CANCEL_DEFERRED) -# define PTHREAD_CANCEL_DEFERRED 0 -# endif /* PTHREAD_CANCEL_DEFERRED */ - -# if !defined (PTHREAD_CANCEL_ASYNCHRONOUS) -# define PTHREAD_CANCEL_ASYNCHRONOUS 0 -# endif /* PTHREAD_CANCEL_ASYNCHRONOUS */ - -# define THR_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE -# define THR_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE -# define THR_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED -# define THR_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS - -# if !defined (PTHREAD_CREATE_JOINABLE) -# if defined (PTHREAD_CREATE_UNDETACHED) -# define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED -# else -# define PTHREAD_CREATE_JOINABLE 0 -# endif /* PTHREAD_CREATE_UNDETACHED */ -# endif /* PTHREAD_CREATE_JOINABLE */ - -# if !defined (PTHREAD_CREATE_DETACHED) -# define PTHREAD_CREATE_DETACHED 1 -# endif /* PTHREAD_CREATE_DETACHED */ - -# if !defined (PTHREAD_PROCESS_PRIVATE) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM) -# if defined (PTHREAD_MUTEXTYPE_FAST) -# define PTHREAD_PROCESS_PRIVATE PTHREAD_MUTEXTYPE_FAST -# else -# define PTHREAD_PROCESS_PRIVATE 0 -# endif /* PTHREAD_MUTEXTYPE_FAST */ -# endif /* PTHREAD_PROCESS_PRIVATE */ - -# if !defined (PTHREAD_PROCESS_SHARED) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM) -# if defined (PTHREAD_MUTEXTYPE_FAST) -# define PTHREAD_PROCESS_SHARED PTHREAD_MUTEXTYPE_FAST -# else -# define PTHREAD_PROCESS_SHARED 1 -# endif /* PTHREAD_MUTEXTYPE_FAST */ -# endif /* PTHREAD_PROCESS_SHARED */ - -# if defined (ACE_HAS_PTHREADS_DRAFT4) -# if defined (PTHREAD_PROCESS_PRIVATE) -# if !defined (USYNC_THREAD) -# define USYNC_THREAD PTHREAD_PROCESS_PRIVATE -# endif /* ! USYNC_THREAD */ -# else -# if !defined (USYNC_THREAD) -# define USYNC_THREAD MUTEX_NONRECURSIVE_NP -# endif /* ! USYNC_THREAD */ -# endif /* PTHREAD_PROCESS_PRIVATE */ - -# if defined (PTHREAD_PROCESS_SHARED) -# if !defined (USYNC_PROCESS) -# define USYNC_PROCESS PTHREAD_PROCESS_SHARED -# endif /* ! USYNC_PROCESS */ -# else -# if !defined (USYNC_PROCESS) -# define USYNC_PROCESS MUTEX_NONRECURSIVE_NP -# endif /* ! USYNC_PROCESS */ -# endif /* PTHREAD_PROCESS_SHARED */ -# elif !defined (ACE_HAS_STHREADS) -# if !defined (USYNC_THREAD) -# define USYNC_THREAD PTHREAD_PROCESS_PRIVATE -# endif /* ! USYNC_THREAD */ -# if !defined (USYNC_PROCESS) -# define USYNC_PROCESS PTHREAD_PROCESS_SHARED -# endif /* ! USYNC_PROCESS */ -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ - - /* MM-Graz: prevent warnings */ -# if !defined (UNIXWARE_7_1) -# undef THR_BOUND -# undef THR_NEW_LWP -# undef THR_DETACHED -# undef THR_SUSPENDED -# undef THR_DAEMON - -# define THR_BOUND 0x00000001 -# define THR_NEW_LWP 0x00000002 -# define THR_DETACHED 0x00000040 -# define THR_SUSPENDED 0x00000080 -# define THR_DAEMON 0x00000100 -# define THR_SCHED_FIFO 0x00020000 -# define THR_SCHED_RR 0x00040000 -# define THR_SCHED_DEFAULT 0x00080000 -# endif /* UNIXWARE_7_1 */ - -# define THR_JOINABLE 0x00010000 - -# if defined (ACE_HAS_IRIX62_THREADS) -# define THR_SCOPE_SYSTEM 0x00100000 -# else -# define THR_SCOPE_SYSTEM THR_BOUND -# endif /*ACE_HAS_IRIX62_THREADS*/ - -# define THR_SCOPE_PROCESS 0x00200000 -# define THR_INHERIT_SCHED 0x00400000 -# define THR_EXPLICIT_SCHED 0x00800000 -# define THR_SCHED_IO 0x01000000 - -# if !defined (ACE_HAS_STHREADS) -# if !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_USES_FIFO_SEM) - -// This needs to be moved out of here. -#include "ace/ACE_export.h" -/** - * @class ACE_sema_t - * - * @brief This is used to implement semaphores for platforms that support - * POSIX pthreads, but do *not* support POSIX semaphores, i.e., - * it's a different type than the POSIX . - */ -class ACE_Export ACE_sema_t -{ -public: - /// Serialize access to internal state. - ACE_mutex_t lock_; - - /// Block until there are no waiters. - ACE_cond_t count_nonzero_; - - /// Count of the semaphore. - u_long count_; - - /// Number of threads that have called . - u_long waiters_; -}; -# endif /* !ACE_HAS_POSIX_SEM */ - -# if defined (ACE_LACKS_PTHREAD_YIELD) && defined (ACE_HAS_THR_YIELD) - // If we are on Solaris we can just reuse the existing - // implementations of these synchronization types. -# if !defined (ACE_LACKS_RWLOCK_T) -# include /**/ - typedef rwlock_t ACE_rwlock_t; -# endif /* !ACE_LACKS_RWLOCK_T */ -# include /**/ -# endif /* (ACE_LACKS_PTHREAD_YIELD) && defined (ACE_HAS_THR_YIELD) */ - -# else -# if !defined (ACE_HAS_POSIX_SEM) - typedef sema_t ACE_sema_t; -# endif /* !ACE_HAS_POSIX_SEM */ -# endif /* !ACE_HAS_STHREADS */ - -# if defined (ACE_HAS_PTHREADS_UNIX98_EXT) - typedef pthread_rwlock_t ACE_rwlock_t; -# endif /* ACE_HAS_PTHREADS_UNIX98_EXT */ - -# if defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) - - // glibc 2.2.x or better has pthread_mutex_timedlock() -# ifndef ACE_HAS_MUTEX_TIMEOUTS -# define ACE_HAS_MUTEX_TIMEOUTS -# endif /* ACE_HAS_MUTEX_TIMEOUTS */ - - // Use new pthread_attr_setstack if XPG6 support is enabled. -# if defined (_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) >= 600 -# if !defined (ACE_HAS_PTHREAD_SETSTACK) -# define ACE_HAS_PTHREAD_SETSTACK -# endif /* ACE_HAS_PTHREAD_SETSTACK */ -# endif /* (_XOPEN_SOURCE - 0) >= 600 */ - -# if !defined (_XOPEN_SOURCE) \ - || (defined (_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) < 600) - // pthread_mutex_timedlock() prototype is not visible if _XOPEN_SOURCE - // is not >= 600 (i.e. for XPG6). - extern "C" int pthread_mutex_timedlock (pthread_mutex_t *mutex, - const struct timespec * abstime); -# endif /* _XOPEN_SOURCE && _XOPEN_SOURCE < 600 */ - -# endif /* linux && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) */ - -#elif defined (ACE_HAS_STHREADS) -# if !defined (ACE_THR_PRI_FIFO_MIN) -# define ACE_THR_PRI_FIFO_MIN (long) 0 -# endif /* !ACE_THR_PRI_FIFO_MIN */ -# if !defined (ACE_THR_PRI_FIFO_MAX) -# define ACE_THR_PRI_FIFO_MAX (long) 59 -# endif /* !ACE_THR_PRI_FIFO_MAX */ -# if !defined (ACE_THR_PRI_RR_MIN) -# define ACE_THR_PRI_RR_MIN (long) 0 -# endif /* !ACE_THR_PRI_RR_MIN */ -# if !defined (ACE_THR_PRI_RR_MAX) -# define ACE_THR_PRI_RR_MAX (long) 59 -# endif /* !ACE_THR_PRI_RR_MAX */ -# if !defined (ACE_THR_PRI_OTHER_MIN) -# define ACE_THR_PRI_OTHER_MIN (long) 0 -# endif /* !ACE_THR_PRI_OTHER_MIN */ -# if !defined (ACE_THR_PRI_OTHER_MAX) -# define ACE_THR_PRI_OTHER_MAX (long) 127 -# endif /* !ACE_THR_PRI_OTHER_MAX */ -#endif /* ACE_HAS_PTHREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_PTHREAD_H */ diff --git a/ace/os_include/os_pwd.h b/ace/os_include/os_pwd.h deleted file mode 100644 index da08eb17ab9..00000000000 --- a/ace/os_include/os_pwd.h +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_pwd.h - * - * password structure - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_PWD_H -#define ACE_OS_INCLUDE_OS_PWD_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_PWD_H) -# include /**/ -#endif /* !ACE_LACKS_PWD_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if !defined (ACE_WIN32) -// VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined -// in pwd.h, and that redefinition is used here -# if defined (_AIX) && defined (__IBMCPP__) && (__IBMCPP__ >= 400) - extern int _posix_getpwnam_r(const char *, struct passwd *, char *, - int, struct passwd **); -# endif /* AIX and VAC++ 4 */ -#endif /* !ACE_WIN32 */ - -#if defined (DIGITAL_UNIX) - extern int _Pgetpwnam_r (const char *, struct passwd *, - char *, size_t, struct passwd **); -#endif /* DIGITAL_UNIX */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_PWD_H */ diff --git a/ace/os_include/os_regex.h b/ace/os_include/os_regex.h deleted file mode 100644 index fdc323c2a6d..00000000000 --- a/ace/os_include/os_regex.h +++ /dev/null @@ -1,48 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_regex.h - * - * regular expression matching types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_REGEX_H -#define ACE_OS_INCLUDE_OS_REGEX_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_REGEX_H) -# include /**/ -#endif /* !ACE_LACKS_REGEX_H */ - -#if defined (ACE_HAS_REGEX) -# include /**/ -#endif /* ACE_HAS_REGEX */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_REGEX_H */ diff --git a/ace/os_include/os_sched.h b/ace/os_include/os_sched.h deleted file mode 100644 index 4a536703218..00000000000 --- a/ace/os_include/os_sched.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_sched.h - * - * execution scheduling (REALTIME) - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_SCHED_H -#define ACE_OS_INCLUDE_OS_SCHED_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_time.h" - -#if !defined (ACE_LACKS_SCHED_H) -# include /**/ -#endif /* !ACE_LACKS_SCHED_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if !defined (__cpu_set_t_defined) || !defined (ACE_HAS_CPU_SET_T) -# define ACE_CPU_SETSIZE 1024 - typedef struct - { - ACE_UINT32 bit_array_[ACE_CPU_SETSIZE / (8 * sizeof (ACE_UINT32))]; - } cpu_set_t; -#endif /* !ACE_HAS_CPU_SET_T || !__cpu_set_t_defined */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_SCHED_H */ diff --git a/ace/os_include/os_search.h b/ace/os_include/os_search.h deleted file mode 100644 index c27930b5e92..00000000000 --- a/ace/os_include/os_search.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_search.h - * - * search tables - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_SEARCH_H -#define ACE_OS_INCLUDE_OS_SEARCH_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_SEARCH_H) -# include /**/ -#endif /* !ACE_LACKS_SEARCH_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_SEARCH_H */ diff --git a/ace/os_include/os_semaphore.h b/ace/os_include/os_semaphore.h deleted file mode 100644 index a703c55d368..00000000000 --- a/ace/os_include/os_semaphore.h +++ /dev/null @@ -1,77 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_semaphore.h - * - * semaphores (REALTIME) - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_SEMAPHORE_H -#define ACE_OS_INCLUDE_OS_SEMAPHORE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_time.h" - -#if !defined (ACE_LACKS_SEMAPHORE_H) -# include /**/ -#endif /* !ACE_LACKS_SEMAPHORE_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_HAS_POSIX_SEM) -# if !defined (SEM_FAILED) && !defined (ACE_LACKS_NAMED_POSIX_SEM) -# define SEM_FAILED ((sem_t *) -1) -# endif /* !SEM_FAILED */ - - typedef struct - { - /// Pointer to semaphore handle. This is allocated by ACE if we are - /// working with an unnamed POSIX semaphore or by the OS if we are - /// working with a named POSIX semaphore. - sem_t *sema_; - - /// Name of the semaphore (if this is non-NULL then this is a named - /// POSIX semaphore, else its an unnamed POSIX semaphore). - char *name_; - -# if defined (ACE_LACKS_NAMED_POSIX_SEM) - /// this->sema_ doesn't always get created dynamically if a platform - /// doesn't support named posix semaphores. We use this flag to - /// remember if we need to delete or not. - int new_sema_; -# endif /* ACE_LACKS_NAMED_POSIX_SEM */ - -# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) - /// Serialize access to internal state. - ACE_mutex_t lock_; - - /// Block until there are no waiters. - ACE_cond_t count_nonzero_; -# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT */ - } ACE_sema_t; -#endif /* ACE_HAS_POSIX_SEM */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_SEMAPHORE_H */ diff --git a/ace/os_include/os_setjmp.h b/ace/os_include/os_setjmp.h deleted file mode 100644 index b4da93bfa0a..00000000000 --- a/ace/os_include/os_setjmp.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_setjmp.h - * - * stack environment declarations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_SETJMP_H -#define ACE_OS_INCLUDE_OS_SETJMP_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_SETJMP_H) -# include /**/ -#endif /* !ACE_LACKS_SETJMP_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_SETJMP_H */ diff --git a/ace/os_include/os_signal.h b/ace/os_include/os_signal.h deleted file mode 100644 index c85865af90e..00000000000 --- a/ace/os_include/os_signal.h +++ /dev/null @@ -1,280 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_signal.h - * - * signals - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_SIGNAL_H -#define ACE_OS_INCLUDE_OS_SIGNAL_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_SIGNAL_H) - extern "C" { -# include /**/ - } -#endif /* !ACE_LACKS_SIGNAL_H */ - -// This must come after signal.h is #included. -#if defined (SCO) -# define SIGIO SIGPOLL -# include /**/ -#endif /* SCO */ - -#if defined (ACE_HAS_SIGINFO_T) -# if !defined (ACE_LACKS_SIGINFO_H) -# if defined (__QNX__) || defined (__OpenBSD__) || defined (__INTERIX) -# include /**/ -# else /* __QNX__ || __OpenBSD__ */ -# include /**/ -# endif /* __QNX__ || __OpenBSD__ */ -# endif /* ACE_LACKS_SIGINFO_H */ -#endif /* ACE_HAS_SIGINFO_T */ - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) && !defined (__RTP__) -# include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_LACKS_SIGSET) - typedef u_int sigset_t; -#endif /* ACE_LACKS_SIGSET */ - -#if defined (ACE_HAS_SIG_MACROS) -# undef sigemptyset -# undef sigfillset -# undef sigaddset -# undef sigdelset -# undef sigismember -#endif /* ACE_HAS_SIG_MACROS */ - -// This must come after signal.h is #included. It's to counteract -// the sigemptyset and sigfillset #defines, which only happen -// when __OPTIMIZE__ is #defined (really!) on Linux. -#if defined (linux) && defined (__OPTIMIZE__) -# undef sigemptyset -# undef sigfillset -#endif /* linux && __OPTIMIZE__ */ - -#if !defined (ACE_HAS_SIG_ATOMIC_T) - typedef int sig_atomic_t; -#endif /* !ACE_HAS_SIG_ATOMIC_T */ - -# if !defined (SA_SIGINFO) -# define SA_SIGINFO 0 -# endif /* SA_SIGINFO */ - -# if !defined (SA_RESTART) -# define SA_RESTART 0 -# endif /* SA_RESTART */ - -#if !defined (SIGHUP) -# define SIGHUP 0 -#endif /* SIGHUP */ - -#if !defined (SIGINT) -# define SIGINT 0 -#endif /* SIGINT */ - -#if !defined (SIGSEGV) -# define SIGSEGV 0 -#endif /* SIGSEGV */ - -#if !defined (SIGIO) -# define SIGIO 0 -#endif /* SIGSEGV */ - -#if !defined (SIGUSR1) -# define SIGUSR1 0 -#endif /* SIGUSR1 */ - -#if !defined (SIGUSR2) -# define SIGUSR2 0 -#endif /* SIGUSR2 */ - -#if !defined (SIGCHLD) -# define SIGCHLD 0 -#endif /* SIGCHLD */ - -#if !defined (SIGCLD) -# define SIGCLD SIGCHLD -#endif /* SIGCLD */ - -#if !defined (SIGQUIT) -# define SIGQUIT 0 -#endif /* SIGQUIT */ - -#if !defined (SIGPIPE) -# define SIGPIPE 0 -#endif /* SIGPIPE */ - -#if !defined (SIGALRM) -# define SIGALRM 0 -#endif /* SIGALRM */ - -#if !defined (SIG_DFL) -# define SIG_DFL ((__sighandler_t) 0) -#endif /* SIG_DFL */ - -#if !defined (SIG_IGN) -# define SIG_IGN ((__sighandler_t) 1) /* ignore signal */ -#endif /* SIG_IGN */ - -#if !defined (SIG_ERR) -# define SIG_ERR ((__sighandler_t) -1) /* error return from signal */ -#endif /* SIG_ERR */ - -// These are used by the and -// methods. They must be unique and cannot -// conflict with the value of . We make the numbers -// negative here so they won't conflict with other values like SIGIO, -// etc. -# define ACE_SIGIO -1 -# define ACE_SIGURG -2 -# define ACE_CLOEXEC -3 - -#if defined (ACE_VXWORKS) -# define ACE_NSIG (_NSIGS + 1) -#elif defined (__Lynx__) -# define ACE_NSIG (NSIG + 1) -#elif defined (__rtems__) -# define ACE_NSIG (SIGRTMAX) -#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x600) -# define ACE_NSIG _NSIG -#else - // All other platforms set NSIG to one greater than the - // highest-numbered signal. -# define ACE_NSIG NSIG -#endif /* __Lynx__ */ - -#if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES) - // Prototypes for both signal() and struct sigaction are consistent.. - //# if defined (ACE_HAS_SIG_C_FUNC) - // extern "C" { - //# endif /* ACE_HAS_SIG_C_FUNC */ - typedef void (*ACE_SignalHandler)(int); - typedef void (*ACE_SignalHandlerV)(int); - //# if defined (ACE_HAS_SIG_C_FUNC) - // } - //# endif /* ACE_HAS_SIG_C_FUNC */ -#elif defined (ACE_HAS_LYNXOS_SIGNALS) - typedef void (*ACE_SignalHandler)(...); - typedef void (*ACE_SignalHandlerV)(...); -#elif defined (ACE_HAS_TANDEM_SIGNALS) - typedef void (*ACE_SignalHandler)(...); - typedef void (*ACE_SignalHandlerV)(...); -#elif defined (ACE_HAS_IRIX_53_SIGNALS) - typedef void (*ACE_SignalHandler)(...); - typedef void (*ACE_SignalHandlerV)(...); -#elif defined (ACE_HAS_SPARCWORKS_401_SIGNALS) - typedef void (*ACE_SignalHandler)(int, ...); - typedef void (*ACE_SignalHandlerV)(int,...); -#elif defined (ACE_HAS_SUNOS4_SIGNAL_T) - typedef void (*ACE_SignalHandler)(...); - typedef void (*ACE_SignalHandlerV)(...); -#elif defined (ACE_HAS_SVR4_SIGNAL_T) - // SVR4 Signals are inconsistent (e.g., see struct sigaction).. - typedef void (*ACE_SignalHandler)(int); -# if !defined (m88k) /* with SVR4_SIGNAL_T */ - typedef void (*ACE_SignalHandlerV)(void); -# else - typedef void (*ACE_SignalHandlerV)(int); -# endif /* m88k */ /* with SVR4_SIGNAL_T */ -#elif defined (ACE_WIN32) - typedef void (__cdecl *ACE_SignalHandler)(int); - typedef void (__cdecl *ACE_SignalHandlerV)(int); -#elif defined (ACE_HAS_UNIXWARE_SVR4_SIGNAL_T) - typedef void (*ACE_SignalHandler)(int); - typedef void (*ACE_SignalHandlerV)(...); -#elif defined (INTEGRITY) - typedef void (*ACE_SignalHandler)(); - typedef void (*ACE_SignalHandlerV)(int); -#else /* This is necessary for some older broken version of cfront */ -# if defined (SIG_PF) -# define ACE_SignalHandler SIG_PF -# else - typedef void (*ACE_SignalHandler)(int); -# endif /* SIG_PF */ - typedef void (*ACE_SignalHandlerV)(...); -#endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */ - -#if defined (ACE_LACKS_SIGACTION) - struct sigaction - { - int sa_flags; - ACE_SignalHandlerV sa_handler; - sigset_t sa_mask; - }; -#endif /* ACE_LACKS_SIGACTION */ - -// Defining POSIX4 real-time signal range. -#if defined(ACE_HAS_POSIX_REALTIME_SIGNALS) -#define ACE_SIGRTMIN SIGRTMIN -#define ACE_SIGRTMAX SIGRTMAX - -#else /* !ACE_HAS_POSIX_REALTIME_SIGNALS */ - -#ifndef ACE_SIGRTMIN -#define ACE_SIGRTMIN 0 -#endif /* ACE_SIGRTMIN */ - -#ifndef ACE_SIGRTMAX -#define ACE_SIGRTMAX 0 -#endif /* ACE_SIGRTMAX */ - -#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ - -#if defined (DIGITAL_UNIX) - // sigwait is yet another macro on Digital UNIX 4.0, just causing - // trouble when introducing member functions with the same name. - // Thanks to Thilo Kielmann" for - // this fix. -# if defined (__DECCXX_VER) -# undef sigwait - // cxx on Digital Unix 4.0 needs this declaration. With it, - // <::_Psigwait> works with cxx -pthread. g++ does _not_ need - // it. - int _Psigwait __((const sigset_t *set, int *sig)); -# endif /* __DECCXX_VER */ -#elif !defined (ACE_HAS_SIGWAIT) -# if defined(__rtems__) - int sigwait (const sigset_t *set, int *sig); -# else - int sigwait (sigset_t *set); -# endif /* __rtems__ */ -#endif /* ! DIGITAL_UNIX && ! ACE_HAS_SIGWAIT */ - -#if !defined (ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE) - int pthread_sigmask(int, const sigset_t *, sigset_t *); -#endif /*!ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include "ace/os_include/os_ucontext.h" - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_SIGNAL_H */ diff --git a/ace/os_include/os_spawn.h b/ace/os_include/os_spawn.h deleted file mode 100644 index 797e48af614..00000000000 --- a/ace/os_include/os_spawn.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_spawn.h - * - * spawn (ADVANCED REALTIME) - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_SPAWN_H -#define ACE_OS_INCLUDE_OS_SPAWN_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_signal.h" -#include "ace/os_include/sys/os_types.h" -#include "ace/os_include/os_sched.h" - -#if !defined (ACE_LACKS_SPAWN_H) -# include /**/ -#endif /* !ACE_LACKS_SPAWN_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_SPAWN_H */ diff --git a/ace/os_include/os_stdarg.h b/ace/os_include/os_stdarg.h deleted file mode 100644 index 313c92e4974..00000000000 --- a/ace/os_include/os_stdarg.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_stdarg.h - * - * handle variable argument list - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_STDARG_H -#define ACE_OS_INCLUDE_OS_STDARG_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_STDARG_H) -# include /**/ -#endif /* !ACE_LACKS_STDARG_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_STDARG_H */ diff --git a/ace/os_include/os_stdbool.h b/ace/os_include/os_stdbool.h deleted file mode 100644 index 440b0d67f29..00000000000 --- a/ace/os_include/os_stdbool.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_stdbool.h - * - * boolean type and values - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_STDBOOL_H -#define ACE_OS_INCLUDE_OS_STDBOOL_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_STDBOOL_H) -# include /**/ -#endif /* !ACE_LACKS_STDBOOL_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_STDBOOL_H */ diff --git a/ace/os_include/os_stddef.h b/ace/os_include/os_stddef.h deleted file mode 100644 index 87bcbdd2e36..00000000000 --- a/ace/os_include/os_stddef.h +++ /dev/null @@ -1,95 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_stddef.h - * - * standard type definitions - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -// From http://www.UNIX-systems.org/single_unix_specification/ - -#ifndef ACE_OS_INCLUDE_OS_STDDEF_H -#define ACE_OS_INCLUDE_OS_STDDEF_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_STDDEF_H) -# include /**/ -#endif /* !ACE_LACKS_STDDEF_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -// NULL pointer constant -#if defined (ACE_LACKS_NULL) -# undef NULL -# if defined(__cplusplus) -# define NULL 0 -# else -# define NULL ((void *)0) -# endif -#endif /* ACE_LACKS_NULL */ - -/* - Integer constant expression of type size_t, the value of which is the offset - in bytes to the structure member (member-designator), from the beginning of - its structure (type). -*/ -#if defined (ACE_LACKS_OFFSETOF) -# undef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif /* ACE_LACKS_OFFSETOF */ - -// Signed integer type of the result of subtracting two pointers. -#if defined (ACE_LACKS_PTRDIFF_T) -# if !defined (ACE_PTRDIFF_T_TYPE) -# define ACE_PTRDIFF_T_TYPE unsigned long -# endif /* !ACE_PTRDIFF_T_TYPE */ - typedef ACE_PTRDIFF_T_TYPE ptrdiff_t; -#endif /* ACE_LACKS_PTRDIFF_T */ - -/* - Integer type whose range of values can represent distinct wide-character - codes for all members of the largest character set specified among the - locales supported by the compilation environment: the null character has - the code value 0 and each member of the portable character set has a code - value equal to its value when used as the lone character in an integer - character constant. -*/ -#if defined (ACE_LACKS_WCHAR_T) -# if !defined (ACE_WCHAR_T_TYPE) -# define ACE_WCHAR_T_TYPE long; -# endif /* !ACE_WCHAR_T_TYPE */ - typedef ACE_WCHAR_T_TYPE wchar_t; -#endif /* ACE_LACKS_WCHAR_T */ - -// Unsigned integer type of the result of the sizeof operator. -#if defined (ACE_LACKS_SIZE_T) -# if !defined (ACE_SIZE_T_TYPE) -# define ACE_SIZE_T_TYPE unsigned int; -# endif /* !ACE_SIZE_T_TYPE */ - typedef ACE_SIZE_T_TYPE size_t; -#endif /* ACE_LACKS_SIZE_T */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_STDDEF_H */ diff --git a/ace/os_include/os_stdint.h b/ace/os_include/os_stdint.h deleted file mode 100644 index 97a6d4468d3..00000000000 --- a/ace/os_include/os_stdint.h +++ /dev/null @@ -1,141 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_stdint.h - * - * integer types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_STDINT_H -#define ACE_OS_INCLUDE_OS_STDINT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_STDINT_H) -# include /**/ -#endif /* !ACE_LACKS_STDINT_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -// BSD style types -#if defined (ACE_LACKS_SYS_TYPES_H) \ - || (defined (__GLIBC__) && !defined (_BSD_SOURCE)) - typedef unsigned char u_char; - typedef unsigned short u_short; - typedef unsigned int u_int; - typedef unsigned long u_long; - - typedef unsigned char uchar_t; - typedef unsigned short ushort_t; - typedef unsigned int uint_t; - typedef unsigned long ulong_t; -#endif /* ACE_LACKS_SYS_TYPES_H */ - -/* Define required types if missing */ - -#if defined (ACE_LACKS_INT8_T) -# if !defined (ACE_INT8_T_TYPE) -# define ACE_INT8_T_TYPE char -# endif /* !ACE_INT8_T_TYPE */ - typedef ACE_INT8_T_TYPE int8_t; -#endif /* ACE_LACKS_INT8_T */ - -#if defined (ACE_LACKS_UINT8_T) -# if !defined (ACE_UINT8_T_TYPE) -# define ACE_UINT8_T_TYPE unsigned char -# endif /* !ACE_UINT8_T_TYPE */ - typedef ACE_UINT8_T_TYPE int8_t; -#endif /* ACE_LACKS_UINT8_T */ - -#if defined (ACE_LACKS_INT16_T) -# if !defined (ACE_INT16_T_TYPE) -# define ACE_INT16_T_TYPE short -# endif /* !ACE_INT16_T_TYPE */ - typedef ACE_INT16_T_TYPE int16_t; -#endif /* ACE_LACKS_INT16_T */ - -#if defined (ACE_LACKS_UINT16_T) -# if !defined (ACE_UINT16_T_TYPE) -# define ACE_UINT16_T_TYPE unsigned short -# endif /* !ACE_UINT16_T_TYPE */ - typedef ACE_UINT16_T_TYPE int16_t; -#endif /* ACE_LACKS_UINT16_T */ - -#if defined (ACE_LACKS_INT32_T) -# if !defined (ACE_INT32_T_TYPE) -# define ACE_INT32_T_TYPE long -# endif /* !ACE_INT32_T_TYPE */ - typedef ACE_INT32_T_TYPE int32_t; -#endif /* ACE_LACKS_INT32_T */ - -#if defined (ACE_LACKS_UINT32_T) -# if !defined (ACE_UINT32_T_TYPE) -# define ACE_UINT32_T_TYPE unsigned long -# endif /* !ACE_UINT32_T_TYPE */ - typedef ACE_UINT32_T_TYPE int32_t; -#endif /* ACE_LACKS_UIN32_T */ - -// @todo pull in ACE class here -// 64 bit will be a problem, but stub it out for now -/* -If an implementation provides integer types with width 64 that meet -these requirements, then the following types are required: int64_t uint64_t - -In particular, this will be the case if any of the following are true: - -The implementation supports the _POSIX_V6_ILP32_OFFBIG programming -environment and the application is being built in the -_POSIX_V6_ILP32_OFFBIG programming environment (see the Shell and -Utilities volume of IEEE Std 1003.1-2001, c99, Programming Environments). - -The implementation supports the _POSIX_V6_LP64_OFF64 programming -environment and the application is being built in the -_POSIX_V6_LP64_OFF64 programming environment. - -The implementation supports the _POSIX_V6_LPBIG_OFFBIG programming -environment and the application is being built in the -_POSIX_V6_LPBIG_OFFBIG programming environment. -*/ -#if defined (ACE_LACKS_INT64_T) -# if !defined (ACE_INT64_T_TYPE) -# define ACE_INT64_T_TYPE long -# endif /* !ACE_INT64_T_TYPE */ - typedef ACE_INT64_T_TYPE int64_t; -#endif /* ACE_LACKS_INT64_T */ - -#if defined (ACE_LACKS_UINT64_T) -# if !defined (ACE_UINT64_T_TYPE) -# define ACE_UINT64_T_TYPE unsigned long -# endif /* !ACE_UINT64_T_TYPE */ - typedef ACE_UINT64_T_TYPE int64_t; -#endif /* ACE_LACKS_UIN64_T */ - -// @todo move the ACE_INT## typedefs here so that ACE_INT64 will -// always be available. - - -// @todo perhaps add macros - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_STDINT_H */ diff --git a/ace/os_include/os_stdio.h b/ace/os_include/os_stdio.h deleted file mode 100644 index feeb4371fec..00000000000 --- a/ace/os_include/os_stdio.h +++ /dev/null @@ -1,110 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_stdio.h - * - * standard buffered input/output - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_STDIO_H -#define ACE_OS_INCLUDE_OS_STDIO_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// NOTE: stdarg.h must be #included before stdio.h on LynxOS. -#include "ace/os_include/os_stdarg.h" -#include "ace/os_include/os_stddef.h" - -#if !defined (ACE_LACKS_STDIO_H) -# include /**/ -#endif /* !ACE_LACKS_STDIO_H */ - -#if defined (ACE_VXWORKS) -// for remove(), rename() -# include /**/ -// for remCurIdGet() -# include /**/ -# if defined (__RTP__) && ((ACE_VXWORKS == 0x620) || (ACE_VXWORKS == 0x630)) -# define L_cuserid _PARM_L_cuserid -# endif -#endif /* ACE_VXWORKS */ - -// Undefine "functions" that may be implemented as macros. -#ifdef fgetc -#undef fgetc -#endif -#ifdef fputc -#undef fputc -#endif - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -# if defined (INTEGRITY) -# define ACE_MAX_USERID 32 -# elif defined (ACE_WIN32) -# define ACE_MAX_USERID 32 -# else -# define ACE_MAX_USERID L_cuserid -#endif /* INTEGRITY */ - -#if defined (BUFSIZ) -# define ACE_STREAMBUF_SIZE BUFSIZ -#else -# define ACE_STREAMBUF_SIZE 1024 -#endif /* BUFSIZ */ - -#if defined (ACE_WIN32) -// The following are #defines and #includes that are specific to -// WIN32. -# if defined (ACE_HAS_WINCE) -# define ACE_STDIN _fileno (stdin) -# define ACE_STDOUT _fileno (stdout) -# define ACE_STDERR _fileno (stderr) -# else -# define ACE_STDIN GetStdHandle (STD_INPUT_HANDLE) -# define ACE_STDOUT GetStdHandle (STD_OUTPUT_HANDLE) -# define ACE_STDERR GetStdHandle (STD_ERROR_HANDLE) -# endif // ACE_HAS_WINCE -// The following are #defines and #includes that are specific to UNIX. -#else /* !ACE_WIN32 */ -# define ACE_STDIN 0 -# define ACE_STDOUT 1 -# define ACE_STDERR 2 -#endif /* ACE_WIN32 */ - -#if defined (ACE_WIN32) - typedef OVERLAPPED ACE_OVERLAPPED; -#else - struct ACE_OVERLAPPED - { - unsigned long Internal; - unsigned long InternalHigh; - unsigned long Offset; - unsigned long OffsetHigh; - ACE_HANDLE hEvent; - }; -#endif /* ACE_WIN32 */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_STDIO_H */ diff --git a/ace/os_include/os_stdlib.h b/ace/os_include/os_stdlib.h deleted file mode 100644 index c123bba0a9d..00000000000 --- a/ace/os_include/os_stdlib.h +++ /dev/null @@ -1,78 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_stdlib.h - * - * standard library definitions - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_STDLIB_H -#define ACE_OS_INCLUDE_OS_STDLIB_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_stddef.h" -#include "ace/os_include/sys/os_wait.h" - -#if defined (ACE_HAS_ALLOCA_H) -# include /**/ -#endif /* ACE_HAS_ALLOCA_H */ - -#if !defined (ACE_LACKS_STDLIB_H) -# include /**/ -#endif /* !ACE_LACKS_STDLIB_H */ - -#if defined (ACE_VXWORKS) && !defined (__RTP__) -# include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_HAS_BROKEN_RANDR) - // The SunOS 5.4.X version of rand_r is inconsistent with the header - // files... - typedef u_int ACE_RANDR_TYPE; - int rand_r (ACE_RANDR_TYPE seed); -#else - typedef u_int ACE_RANDR_TYPE; -#endif /* ACE_HAS_BROKEN_RANDR */ - -#if defined (DIGITAL_UNIX) - extern int _Prand_r (unsigned int *seedptr); -#endif /* DIGITAL_UNIX */ - -#if defined (ACE_LACKS_PUTENV_PROTOTYPE) - int putenv (char *); -#endif /* ACE_LACKS_PUTENV_PROTOTYPE */ - -#if defined (ACE_LACKS_MKTEMP_PROTOTYPE) - char *mktemp (char *); -#endif /* ACE_LACKS_MKTEMP_PROTOTYPE */ - -#if defined (ACE_LACKS_MKSTEMP_PROTOTYPE) - int mkstemp(char *); -#endif /* ACE_LACKS_MKSTEMP_PROTOTYPE */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_STDLIB_H */ diff --git a/ace/os_include/os_string.h b/ace/os_include/os_string.h deleted file mode 100644 index 0cd913e952e..00000000000 --- a/ace/os_include/os_string.h +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_string.h - * - * string operations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_STRING_H -#define ACE_OS_INCLUDE_OS_STRING_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_stddef.h" - -// Matthew Stevens 7-10-95 Fix GNU GCC 2.7 for memchr() problem. -#if defined (ACE_HAS_GNU_CSTRING_H) -// Define this file to keep /usr/include/memory.h from being included. -# include /**/ -#else -# if !defined (ACE_LACKS_MEMORY_H) -# include /**/ -# endif /* !ACE_LACKS_MEMORY_H */ -# if !defined (ACE_LACKS_STRING_H) -# include /**/ -# endif /* !ACE_LACKS_STRING_H */ -#endif /* ACE_HAS_GNU_CSTRING_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - // this looks fishy... dhinton -#if !defined (ACE_HAS_STRERROR) -# if defined (ACE_HAS_SYS_ERRLIST) - extern char *sys_errlist[]; -# define strerror(err) sys_errlist[err] -# else -# define strerror(err) "strerror is unsupported" -# endif /* ACE_HAS_SYS_ERRLIST */ -#endif /* !ACE_HAS_STRERROR */ - -#if defined (ACE_LACKS_STRTOK_R_PROTOTYPE) && !defined (_POSIX_SOURCE) - char *strtok_r (char *s, const char *delim, char **save_ptr); -#endif /* ACE_LACKS_STRTOK_R_PROTOTYPE */ - -#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) -# define _stricmp stricmp -# define _strnicmp strnicmp -#endif /* __BORLANDC__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_STRING_H */ diff --git a/ace/os_include/os_strings.h b/ace/os_include/os_strings.h deleted file mode 100644 index 2fdcf723bec..00000000000 --- a/ace/os_include/os_strings.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_strings.h - * - * string operations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_STRINGS_H -#define ACE_OS_INCLUDE_OS_STRINGS_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_stddef.h" - -#if !defined (ACE_LACKS_STRINGS_H) -# include /**/ -#endif /* !ACE_LACKS_STRINGS_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_LACKS_STRCASECMP_PROTOTYPE) - int strcasecmp(const char *, const char *); -#endif /* ACE_LACKS_STRCASECMP_PROTOTYPE */ - -#if defined (ACE_LACKS_STRNCASECMP_PROTOTYPE) - int strncasecmp(const char *, const char *, size_t); -#endif /* ACE_LACKS_STRNCASECMP_PROTOTYPE */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_STRINGS_H */ diff --git a/ace/os_include/os_stropts.h b/ace/os_include/os_stropts.h deleted file mode 100644 index c55e9125c86..00000000000 --- a/ace/os_include/os_stropts.h +++ /dev/null @@ -1,120 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_stropts.h - * - * STREAMS interface (STREAMS) - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_STROPTS_H -#define ACE_OS_INCLUDE_OS_STROPTS_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_unistd.h" - -#if defined (ACE_HAS_TIMOD_H) -# if defined (ACE_HAS_STL_QUEUE_CONFLICT) -# define queue _Queue_ -# endif /* ACE_HAS_STL_QUEUE_CONFLICT */ -# include /**/ -# if defined (ACE_HAS_STL_QUEUE_CONFLICT) -# undef queue -# endif /* ACE_HAS_STL_QUEUE_CONFLICT */ -#elif defined (ACE_HAS_OSF_TIMOD_H) -# include /**/ -#endif /* ACE_HAS_TIMOD_H */ - -#if !defined (ACE_LACKS_SYS_IOCTL_H) -# include /**/ -#endif /* !ACE_LACKS_IOCTL_H */ - -#if defined (ACE_HAS_SYS_FILIO_H) -# include /**/ -#endif /* ACE_HAS_SYS_FILIO_H */ - -#if defined (ACE_HAS_SYS_SOCKIO_H) -# include /**/ -#endif /* ACE_HAS_SOCKIO_H */ - -// This is sorta counter intuitive, but this is how it was done in OS.h -// @todo: fix this... dhinton -#if defined (ACE_HAS_STREAMS) -# if defined (AIX) -# if !defined (_XOPEN_EXTENDED_SOURCE) -# define _XOPEN_EXTENDED_SOURCE -# endif /* !_XOPEN_EXTENDED_SOURCE */ -# endif /* AIX */ -#endif /* ACE_HAS_STREAMS */ - -#if !defined (ACE_LACKS_STROPTS_H) -# include /**/ -#endif /* !ACE_LACKS_STROPTS_H */ - -// This is sorta counter intuitive, but this is how it was done in OS.h -// @todo: fix this... dhinton -#if defined (ACE_HAS_STREAMS) -# if defined (AIX) -# undef _XOPEN_EXTENDED_SOURCE -# endif /* AIX */ -#endif /* ACE_HAS_STREAMS */ - -#if defined (ACE_VXWORKS) -// for ioctl() -# include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_LACKS_STRRECVFD) - struct strrecvfd {}; -#endif /* ACE_LACKS_STRRECVFD */ - -# if !defined (SIOCGIFBRDADDR) -# define SIOCGIFBRDADDR 0 -# endif /* SIOCGIFBRDADDR */ - -# if !defined (SIOCGIFADDR) -# define SIOCGIFADDR 0 -# endif /* SIOCGIFADDR */ - -# if !defined (ACE_HAS_STRBUF_T) -struct strbuf -{ - /// No. of bytes in buffer. - int maxlen; - /// No. of bytes returned. - int len; - /// Pointer to data. - void *buf; -}; -# endif /* ACE_HAS_STRBUF_T */ - -// These prototypes are chronically lacking from many versions of UNIX. -#if !defined (ACE_WIN32) && !defined (ACE_HAS_ISASTREAM_PROTOTYPE) - int isastream (int); -#endif /* !ACE_WIN32 && ACE_HAS_ISASTREAM_PROTOTYPE */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_STROPTS_H */ diff --git a/ace/os_include/os_syslog.h b/ace/os_include/os_syslog.h deleted file mode 100644 index eff6a240520..00000000000 --- a/ace/os_include/os_syslog.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_syslog.h - * - * definitions for system error logging - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_SYSLOG_H -#define ACE_OS_INCLUDE_OS_SYSLOG_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_SYSLOG_H) -# include /**/ -#endif /* !ACE_LACKS_SYSLOG_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_SYSLOG_H */ diff --git a/ace/os_include/os_tar.h b/ace/os_include/os_tar.h deleted file mode 100644 index 5a781cf200d..00000000000 --- a/ace/os_include/os_tar.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_tar.h - * - * extended tar definitions - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_TAR_H -#define ACE_OS_INCLUDE_OS_TAR_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_TAR_H) -# include /**/ -#endif /* !ACE_LACKS_TAR_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_TAR_H */ diff --git a/ace/os_include/os_termios.h b/ace/os_include/os_termios.h deleted file mode 100644 index 30f1f9971b2..00000000000 --- a/ace/os_include/os_termios.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_termios.h - * - * define values for termios - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_TERMIOS_H -#define ACE_OS_INCLUDE_OS_TERMIOS_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_TERMIOS_H) -# include /**/ -#endif /* !ACE_LACKS_TERMIOS_H */ - -#if defined (HPUX) -# include /**/ -#endif /* HPUX */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_TERMIOS_H */ diff --git a/ace/os_include/os_tgmath.h b/ace/os_include/os_tgmath.h deleted file mode 100644 index c4ac48a6432..00000000000 --- a/ace/os_include/os_tgmath.h +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_tgmath.h - * - * type-generic macros - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_TGMATH_H -#define ACE_OS_INCLUDE_OS_TGMATH_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_math.h" -#include "ace/os_include/os_complex.h" - -#if !defined (ACE_LACKS_TGMATH_H) -# include /**/ -#endif /* !ACE_LACKS_TGMATH_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_TGMATH_H */ diff --git a/ace/os_include/os_time.h b/ace/os_include/os_time.h deleted file mode 100644 index 6f19ad1282b..00000000000 --- a/ace/os_include/os_time.h +++ /dev/null @@ -1,123 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_time.h - * - * time types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_TIME_H -#define ACE_OS_INCLUDE_OS_TIME_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// @todo should we include anything from signal.h? -#include "ace/os_include/sys/os_types.h" - -// To get the proper select() signature, this is required for HP-UX, and -// maybe other platforms that offer both int and fdset forms of select(). -// For HP-UX, sys/time.h must be included before time.h, or -// _XOPEN_SOURCE_EXTENDED must be defined. It's not nice to require -// the preprocessor macro, so we force our select() preference this way. -#if !defined (ACE_LACKS_SYS_TIME_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_TIME_H */ - -#if !defined (ACE_LACKS_TIME_H) -# include /**/ -#endif /* !ACE_LACKS_TIME_H */ - -# if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) -using std::tm; -# if !defined (ACE_HAS_DINKUM_STL) -# if defined (ACE_WIN32) -using std::_timezone; -# else -using std::timezone; -# endif -# endif -using std::difftime; -# endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ - -# if !defined (ACE_HAS_POSIX_TIME) -// Definition per POSIX. -typedef struct timespec -{ - /// Seconds - time_t tv_sec; - /// Nanoseconds - long tv_nsec; -} timespec_t; -# elif defined (ACE_HAS_BROKEN_POSIX_TIME) -# if defined (ACE_OPENVMS) -# include /**/ -# else -// OSF/1 defines struct timespec in - Tom Marrs -# include /**/ -# endif -# endif /* !ACE_HAS_POSIX_TIME */ - -# if defined(ACE_LACKS_TIMESPEC_T) -typedef struct timespec timespec_t; -# endif /* ACE_LACKS_TIMESPEC_T */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_HAS_BROKEN_CTIME) -# undef ctime -#endif /* ACE_HAS_BROKEN_CTIME */ - -// There are a lot of threads-related macro definitions in the config files. -// They came in at different times and from different places and platform -// requirements as threads evolved. They are probably not all needed - some -// overlap or are otherwise confused. This is an attempt to start -// straightening them out. -#if defined (ACE_HAS_PTHREADS_STD) /* POSIX.1c threads (pthreads) */ - // ... and 2-parameter asctime_r and ctime_r -# if !defined (ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R) && \ - !defined (ACE_HAS_STHREADS) && !defined (ACE_VXWORKS) -# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -# endif -#endif /* ACE_HAS_PTHREADS_STD */ - -#if defined (ACE_LACKS_STRPTIME_PROTOTYPE) && !defined (_XOPEN_SOURCE) - extern char *strptime (const char *s, const char *fmt, struct tm *tp); -#endif /* ACE_LACKS_STRPTIME_PROTOTYPE */ - -#if defined (ACE_LACKS_CONST_TIMESPEC_PTR) -typedef struct timespec * ACE_TIMESPEC_PTR; -#else -typedef const struct timespec * ACE_TIMESPEC_PTR; -#endif /* ACE_LACKS_CONST_TIMESPEC_PTR */ - -#if defined (DIGITAL_UNIX) - extern char *_Pctime_r (const time_t *, char *); - extern struct tm *_Plocaltime_r (const time_t *, struct tm *); - extern struct tm *_Pgmtime_r (const time_t *, struct tm *); - extern char *_Pasctime_r (const struct tm *, char *); -#endif /* DIGITAL_UNIX */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_TIME_H */ diff --git a/ace/os_include/os_trace.h b/ace/os_include/os_trace.h deleted file mode 100644 index cb4aa549fcf..00000000000 --- a/ace/os_include/os_trace.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_trace.h - * - * tracing - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_TRACE_H -#define ACE_OS_INCLUDE_OS_TRACE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_TRACE_H) -# include /**/ -#endif /* !ACE_LACKS_TRACE_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_TRACE_H */ diff --git a/ace/os_include/os_ucontext.h b/ace/os_include/os_ucontext.h deleted file mode 100644 index dd4b5001ba9..00000000000 --- a/ace/os_include/os_ucontext.h +++ /dev/null @@ -1,48 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_ucontext.h - * - * user context - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_UCONTEXT_H -#define ACE_OS_INCLUDE_OS_UCONTEXT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_signal.h" - -#if !defined (ACE_LACKS_UCONTEXT_H) -# include /**/ -#endif /* !ACE_LACKS_ucontext_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -# if !defined (ACE_HAS_UCONTEXT_T) -typedef int ucontext_t; -# endif /* ACE_HAS_UCONTEXT_T */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_UCONTEXT_H */ diff --git a/ace/os_include/os_ulimit.h b/ace/os_include/os_ulimit.h deleted file mode 100644 index 011dd32bc9c..00000000000 --- a/ace/os_include/os_ulimit.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_ulimit.h - * - * ulimit commands - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_ULIMIT_H -#define ACE_OS_INCLUDE_OS_ULIMIT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_ULIMIT_H) -# include /**/ -#endif /* !ACE_LACKS_ULIMIT_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_ULIMIT_H */ diff --git a/ace/os_include/os_unistd.h b/ace/os_include/os_unistd.h deleted file mode 100644 index 687557bfe26..00000000000 --- a/ace/os_include/os_unistd.h +++ /dev/null @@ -1,167 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_unistd.h - * - * standard symbolic constants and types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_UNISTD_H -#define ACE_OS_INCLUDE_OS_UNISTD_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" -#include "ace/os_include/os_inttypes.h" - -#if defined (__BORLANDC__) -# include "ace/os_include/os_fcntl.h" -#endif /* __BORLANDC */ - -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) -# include /**/ -# include /**/ -#endif /* ACE_WIN32 && !ACE_HAS_WINCE */ - -#if defined (ACE_HAS_SYSINFO) -# include /**/ -#endif /* ACE_HAS_SYS_INFO */ - -#if !defined (ACE_LACKS_UNISTD_H) -# include /**/ -#endif /* !ACE_LACKS_UNISTD_H */ - -#if defined (ACE_VXWORKS) -# if !defined (__RTP__) - // for unlink(), close(), read(), write(), lseek(), chdir(), getcwd(), - // getwd(), and isatty() - # include /**/ -# endif -// for gethostname() -# include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if (!defined (_BSD_SOURCE) && \ - !defined (_XOPEN_SOURCE) && !defined (_XOPEN_SOURCE_EXTENDED)) \ - || (defined (_XOPEN_SOURCE) && defined (__GNUC__)) - -# if defined (ACE_LACKS_SETREUID_PROTOTYPE) - extern int setreuid (uid_t ruid, uid_t euid); -# endif /* ACE_LACKS_SETREUID_PROTOTYPE */ - -# if defined (ACE_LACKS_SETREGID_PROTOTYPE) - extern int setregid (gid_t rgid, gid_t egid); -# endif /* ACE_LACKS_SETREGID_PROTOTYPE */ -#endif /* !_BSD_SOURCE && !_XOPEN_SOURCE && !_XOPEN_SOURCE_EXTENDED - || _XOPEN_SOURCE && __GNUC__ */ - - // for use by access() -# if !defined (R_OK) -# define R_OK 04 /* Test for Read permission. */ -# endif /* R_OK */ - -# if !defined (W_OK) -# define W_OK 02 /* Test for Write permission. */ -# endif /* W_OK */ - -# if !defined (X_OK) -# define X_OK 01 /* Test for eXecute permission. */ -# endif /* X_OK */ - -# if !defined (F_OK) -# define F_OK 0 /* Test for existence of File. */ -# endif /* F_OK */ - -#if defined (ACE_LACKS_UALARM_PROTOTYPE) - u_int ualarm (u_int usecs, u_int interval); -#endif /* ACE_LACKS_UALARM_PROTOTYPE */ - -#if defined (ACE_LACKS_PREAD_PROTOTYPE) && (_XOPEN_SOURCE - 0) < 500 - // _XOPEN_SOURCE == 500 Single Unix conformance - // It seems that _XOPEN_SOURCE == 500 means that the prototypes are - // already defined in the system headers. - ssize_t pread (int fd, - void *buf, - size_t nbytes, - off_t offset); - - ssize_t pwrite (int fd, - const void *buf, - size_t n, - off_t offset); -#endif /* ACE_LACKS_PREAD_PROTOTYPE && (_XOPEN_SOURCE - 0) < 500 */ - -#if defined (ACE_LACKS_GETPGID_PROTOTYPE) && \ - !defined (_XOPEN_SOURCE) && !defined (_XOPEN_SOURCE_EXTENDED) - pid_t getpgid (pid_t pid); -#endif /* ACE_LACKS_GETPGID_PROTOTYPE && - !_XOPEN_SOURCE && !_XOPEN_SOURCE_EXTENDED */ - -#if !defined (_LARGEFILE64_SOURCE) -# if defined (ACE_LACKS_LSEEK64_PROTOTYPE) && \ - defined (ACE_LACKS_LLSEEK_PROTOTYPE) -# error Define either ACE_LACKS_LSEEK64_PROTOTYPE or ACE_LACKS_LLSEEK_PROTOTYPE, not both! -# elif defined (ACE_LACKS_LSEEK64_PROTOTYPE) - ACE_LOFF_T lseek64 (int fd, ACE_LOFF_T offset, int whence); -# elif defined (ACE_LACKS_LLSEEK_PROTOTYPE) - ACE_LOFF_T llseek (int fd, ACE_LOFF_T offset, int whence); -# endif -#endif /* _LARGEFILE64_SOURCE */ - -#if defined (__BORLANDC__) -# if (__BORLANDC__ <= 0x540) -# define _getcwd getcwd -# define _chdir chdir -# undef _access -# define _access access -# endif -# define _isatty isatty -#endif /* __BORLANDC__ */ - -# if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES) - - ssize_t read_timedwait (ACE_HANDLE handle, - char *buf, - size_t n, - struct timespec *timeout); - - ssize_t write_timedwait (ACE_HANDLE handle, - const void *buf, - size_t n, - struct timespec *timeout); - -# endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */ - -#if defined (ACE_LACKS_SWAB_PROTOTYPE) - void swab(const void *, void *, ssize_t); -#endif /* ACE_LACKS_SWAB_PROTOTYPE */ - -#if defined (ACE_LACKS_GETOPT_PROTOTYPE) - int getopt(int, char * const [], const char *); -#endif /* ACE_LACKS_GETOPT_PROTOTYPE */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_UNISTD_H */ diff --git a/ace/os_include/os_utime.h b/ace/os_include/os_utime.h deleted file mode 100644 index 20e48b4ae0c..00000000000 --- a/ace/os_include/os_utime.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_utime.h - * - * access and modification times structure - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_UTIME_H -#define ACE_OS_INCLUDE_OS_UTIME_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_UTIME_H) -# include /**/ -#endif /* !ACE_LACKS_UTIME_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_UTIME_H */ diff --git a/ace/os_include/os_utmpx.h b/ace/os_include/os_utmpx.h deleted file mode 100644 index 88845f1e418..00000000000 --- a/ace/os_include/os_utmpx.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_utmpx.h - * - * user accounting database definitions - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_UTMPX_H -#define ACE_OS_INCLUDE_OS_UTMPX_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_time.h" - -#if !defined (ACE_LACKS_UTMPX_H) -# include /**/ -#endif /* !ACE_LACKS_UTMPX_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_UTMPX_H */ diff --git a/ace/os_include/os_wchar.h b/ace/os_include/os_wchar.h deleted file mode 100644 index 2ef9cc90ef9..00000000000 --- a/ace/os_include/os_wchar.h +++ /dev/null @@ -1,49 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_wchar.h - * - * wide-character handling - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_WCHAR_H -#define ACE_OS_INCLUDE_OS_WCHAR_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// ctype.h, string.h, stdarg.h, stdio.h, stdlib.h, time.h -#include "ace/os_include/os_stdio.h" -#include "ace/os_include/os_stdlib.h" -#include "ace/os_include/os_time.h" -#include "ace/os_include/os_string.h" -#include "ace/os_include/os_ctype.h" - -#if !defined (ACE_LACKS_WCHAR_H) -# include /**/ -#endif /* !ACE_LACKS_WCHAR_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_WCHAR_H */ diff --git a/ace/os_include/os_wctype.h b/ace/os_include/os_wctype.h deleted file mode 100644 index 8abb0f0df61..00000000000 --- a/ace/os_include/os_wctype.h +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_wctype.h - * - * wide-character classification and mapping utilities - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_WCTYPE_H -#define ACE_OS_INCLUDE_OS_WCTYPE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// ctype.h, string.h, stdarg.h, stdio.h, stdlib.h, time.h -#include "ace/os_include/os_wchar.h" - -#if !defined (ACE_LACKS_WCTYPE_H) -# include /**/ -#endif /* !ACE_LACKS_WCTYPE_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_WCTYPE_H */ diff --git a/ace/os_include/os_wordexp.h b/ace/os_include/os_wordexp.h deleted file mode 100644 index 2ff6eec0052..00000000000 --- a/ace/os_include/os_wordexp.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_wordexp.h - * - * word-expansion types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_OS_WORDEXP_H -#define ACE_OS_INCLUDE_OS_WORDEXP_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_stddef.h" // size_t - -#if !defined (ACE_LACKS_WORDEXP_H) -# include /**/ -#endif /* !ACE_LACKS_WORDEXP_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_OS_WORDEXP_H */ diff --git a/ace/os_include/sys/os_ipc.h b/ace/os_include/sys/os_ipc.h deleted file mode 100644 index 454c9e5b045..00000000000 --- a/ace/os_include/sys/os_ipc.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_ipc.h - * - * XSI interprocess communication access structure - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_IPC_H -#define ACE_OS_INCLUDE_SYS_OS_IPC_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_SYS_IPC_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_IPC_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_WIN32) -# define ACE_INVALID_SEM_KEY 0 -#else /* !ACE_WIN32 */ -# define ACE_INVALID_SEM_KEY -1 -#endif /* ACE_WIN32 */ - -#if !defined (IPC_PRIVATE) -# define IPC_PRIVATE ACE_INVALID_SEM_KEY -#endif /* IPC_PRIVATE */ - -#if !defined (IPC_STAT) -# define IPC_STAT 0 -#endif /* IPC_STAT */ - -#if !defined (IPC_CREAT) -# define IPC_CREAT 0 -#endif /* IPC_CREAT */ - -#if !defined (IPC_NOWAIT) -# define IPC_NOWAIT 0 -#endif /* IPC_NOWAIT */ - -#if !defined (IPC_RMID) -# define IPC_RMID 0 -#endif /* IPC_RMID */ - -#if !defined (IPC_EXCL) -# define IPC_EXCL 0 -#endif /* IPC_EXCL */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_IPC_H */ diff --git a/ace/os_include/sys/os_loadavg.h b/ace/os_include/sys/os_loadavg.h deleted file mode 100644 index da569084f3b..00000000000 --- a/ace/os_include/sys/os_loadavg.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_loadavg.h - * - * loadavg functions - * - * $Id$ - * - * @author Johnny Willemsen - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_LOADAVG_H -#define ACE_OS_INCLUDE_SYS_OS_LOADAVG_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_SYS_LOADAVG_H) -# include /**/ -#endif /* ACE_HAS_SYS_LOADAVG_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_LOADAVG_H */ diff --git a/ace/os_include/sys/os_mman.h b/ace/os_include/sys/os_mman.h deleted file mode 100644 index 74fef32f869..00000000000 --- a/ace/os_include/sys/os_mman.h +++ /dev/null @@ -1,122 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_mman.h - * - * memory management declarations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_MMAN_H -#define ACE_OS_INCLUDE_SYS_OS_MMAN_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if defined (ACE_LACKS_MMAP) -# define ACE_LACKS_SYS_MMAN_H -#endif /* ACE_LACKS_MMAP */ - -#if !defined (ACE_LACKS_SYS_MMAN_H) - // Fixes a problem with HP/UX. -# if defined (ACE_HAS_BROKEN_MMAP_H) - extern "C" { -# endif /* ACE_HAS_BROKEN_MMAP_H */ -# include /**/ -# if defined (ACE_HAS_BROKEN_MMAP_H) - } -# endif /* ACE_HAS_BROKEN_MMAP_H */ -#endif /* ACE_LACKS_SYS_MMAN_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_LACKS_SYS_MMAN_H) && !defined (ACE_WIN32) -# define PROT_READ 0 -# define PROT_WRITE 0 -# define PROT_EXEC 0 -# define PROT_NONE 0 -# define PROT_RDWR 0 -# define MAP_PRIVATE 0 -# define MAP_SHARED 0 -# define MAP_FIXED 0 -#elif defined (ACE_WIN32) - // These two may be used for internal flags soon: -# define MAP_PRIVATE 1 -# define MAP_SHARED 2 -# define MAP_FIXED 4 - // MMAP flags -# define PROT_READ PAGE_READONLY -# define PROT_WRITE PAGE_READWRITE -# define PROT_RDWR PAGE_READWRITE -/* If we can find suitable use for these flags, here they are: -PAGE_WRITECOPY -PAGE_EXECUTE -PAGE_EXECUTE_READ -PAGE_EXECUTE_READWRITE -PAGE_EXECUTE_WRITECOPY -PAGE_GUARD -PAGE_NOACCESS -PAGE_NOCACHE */ -#endif /* !ACE_LACKS_SYS_MMAN_H && !ACE_WIN32*/ - -# if !defined (ACE_MAP_PRIVATE) -# define ACE_MAP_PRIVATE MAP_PRIVATE -# endif /* ! ACE_MAP_PRIVATE */ - -# if !defined (ACE_MAP_SHARED) -# define ACE_MAP_SHARED MAP_SHARED -# endif /* ! ACE_MAP_SHARED */ - -# if !defined (ACE_MAP_FIXED) -# define ACE_MAP_FIXED MAP_FIXED -# endif /* ! ACE_MAP_FIXED */ - -# if !defined (MAP_FAILED) || defined (ACE_HAS_BROKEN_MAP_FAILED) -# undef MAP_FAILED -# define MAP_FAILED ((void *) -1) -# elif defined (ACE_HAS_LONG_MAP_FAILED) -# undef MAP_FAILED -# define MAP_FAILED ((void *) -1L) -# endif /* !MAP_FAILED || ACE_HAS_BROKEN_MAP_FAILED */ - -#if !defined (PROT_RDWR) -# define PROT_RDWR (PROT_READ|PROT_WRITE) -#endif /* PROT_RDWR */ - -# if defined (ACE_WIN32) - // Needed to map calls to NT transparently. -# define MS_ASYNC 0 -# define MS_INVALIDATE 0 -# endif /* ACE_WIN32 */ - -# if !defined (MS_SYNC) -# define MS_SYNC 0x0 -# endif /* !MS_SYNC */ - -#if !defined (ACE_LACKS_MADVISE) && defined (ACE_LACKS_MADVISE_PROTOTYPE) - extern "C" int madvise(caddr_t, size_t, int); -#endif /* !ACE_LACKS_MADVISE && ACE_LACKS_MADVISE_PROTOTYPE */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_MMAN_H */ diff --git a/ace/os_include/sys/os_msg.h b/ace/os_include/sys/os_msg.h deleted file mode 100644 index e6b2c6c1c63..00000000000 --- a/ace/os_include/sys/os_msg.h +++ /dev/null @@ -1,62 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_msg.h - * - * XSI message queue structures - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_MSG_H -#define ACE_OS_INCLUDE_SYS_OS_MSG_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_ipc.h" - -#if !defined (ACE_LACKS_SYS_MSG_H) -// OSF1 has problems with sys/msg.h and C++... -# if defined (ACE_HAS_BROKEN_MSG_H) -# define _KERNEL -# endif /* ACE_HAS_BROKEN_MSG_H */ -# include /**/ -# if defined (ACE_HAS_BROKEN_MSG_H) -# undef _KERNEL -# endif /* ACE_HAS_BROKEN_MSG_H */ -#endif /* !ACE_LACKS_SYS_MSG_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - // Declare opaque type. Needed for ACE_OS wrappers on systems - // without SysV IPC. - struct msqid_ds; - -#if defined (ACE_LACKS_SYSV_MSQ_PROTOS) - int msgget (key_t, int); - int msgrcv (int, void *, size_t, long, int); - int msgsnd (int, const void *, size_t, int); - int msgctl (int, int, struct msqid_ds *); -#endif /* ACE_LACKS_SYSV_MSQ_PROTOS */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_MSG_H */ diff --git a/ace/os_include/sys/os_pstat.h b/ace/os_include/sys/os_pstat.h deleted file mode 100644 index c6872fe53de..00000000000 --- a/ace/os_include/sys/os_pstat.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_pstat.h - * - * pstat functions - * - * $Id$ - * - * @author Johnny Willemsen - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_PSTAT_H -#define ACE_OS_INCLUDE_SYS_OS_PSTAT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_SYS_PSTAT_H) -# include /**/ -# include /**/ -#endif /* ACE_HAS_SYS_PSTAT_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_PSTAT_H */ diff --git a/ace/os_include/sys/os_resource.h b/ace/os_include/sys/os_resource.h deleted file mode 100644 index cd28e932fa1..00000000000 --- a/ace/os_include/sys/os_resource.h +++ /dev/null @@ -1,108 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_resource.h - * - * definitions for XSI resource operations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_RESOURCE_H -#define ACE_OS_INCLUDE_SYS_OS_RESOURCE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_time.h" -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_SYS_RESOURCE_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_RESOURCE_H */ - -#if defined (ACE_HAS_SYSINFO) -# include /**/ -#endif /* ACE_HAS_SYS_INFO */ - -#if defined (ACE_HAS_SYS_SYSCALL_H) -# include /**/ -#endif /* ACE_HAS_SYS_SYSCALL_H */ - -// prusage_t is defined in -#if defined (ACE_HAS_PROC_FS) -# include /**/ -#endif /* ACE_HAS_PROC_FS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -// There must be a better way to do this... -#if !defined (RLIMIT_NOFILE) -# if defined (linux) || defined (AIX) || defined (SCO) -# if defined (RLIMIT_OFILE) -# define RLIMIT_NOFILE RLIMIT_OFILE -# else -# define RLIMIT_NOFILE 200 -# endif /* RLIMIT_OFILE */ -# endif /* defined (linux) || defined (AIX) || defined (SCO) */ -#endif /* RLIMIT_NOFILE */ - -#if defined (ACE_WIN32) -# define RUSAGE_SELF 1 - /// Fake the UNIX rusage structure. Perhaps we can add more to this - /// later on? - struct rusage - { - FILETIME ru_utime; - FILETIME ru_stime; - }; -#else /* !ACE_WIN32 */ -# if defined (m88k) -# define RUSAGE_SELF 1 -# endif /* m88k */ -#endif /* ACE_WIN32 */ - -#if defined (ACE_LACKS_RLIMIT_PROTOTYPE) - int getrlimit (int resource, struct rlimit *rlp); - int setrlimit (int resource, const struct rlimit *rlp); -#endif /* ACE_LACKS_RLIMIT_PROTOTYPE */ - -#if defined (ACE_HAS_PRUSAGE_T) - typedef prusage_t ACE_Rusage; -#elif defined (ACE_HAS_GETRUSAGE) - typedef rusage ACE_Rusage; -#else - typedef int ACE_Rusage; -#endif /* ACE_HAS_PRUSAGE_T */ - -#if !defined (ACE_WIN32) -// These prototypes are chronically lacking from many versions of UNIX. -# if !defined (ACE_HAS_GETRUSAGE_PROTOTYPE) - int getrusage (int who, struct rusage *rusage); -# endif /* ! ACE_HAS_GETRUSAGE_PROTOTYPE */ - -# if defined (ACE_LACKS_SYSCALL) - int syscall (int, ACE_HANDLE, struct rusage *); -# endif /* ACE_LACKS_SYSCALL */ -#endif /* !ACE_WIN32 */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_RESOURCE_H */ diff --git a/ace/os_include/sys/os_select.h b/ace/os_include/sys/os_select.h deleted file mode 100644 index e330e625a07..00000000000 --- a/ace/os_include/sys/os_select.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_select.h - * - * select types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_SELECT_H -#define ACE_OS_INCLUDE_SYS_OS_SELECT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_time.h" -#include "ace/os_include/os_signal.h" -#include "ace/os_include/os_unistd.h" - -#if !defined (ACE_LACKS_SYS_SELECT_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_SELECT_H */ - -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_SYS_SELECT_H) -# include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_WIN32) - // This will help until we figure out everything: -# define NFDBITS 32 /* only used in unused functions... */ -#elif defined (__QNX__) -# if !defined (NFDBITS) -# define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ -# endif /* ! NFDBITS */ -#endif /* ACE_WIN32 */ - -#if defined (ACE_SELECT_USES_INT) - typedef int ACE_FD_SET_TYPE; -#else - typedef fd_set ACE_FD_SET_TYPE; -#endif /* ACE_SELECT_USES_INT */ - -#if defined (__rtems__) - int select (int n, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, const struct timeval *timeout); -#endif /* __rtems__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_SELECT_H */ diff --git a/ace/os_include/sys/os_sem.h b/ace/os_include/sys/os_sem.h deleted file mode 100644 index 93f669d2913..00000000000 --- a/ace/os_include/sys/os_sem.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_sem.h - * - * XSI semaphore facility - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_SEM_H -#define ACE_OS_INCLUDE_SYS_OS_SEM_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_ipc.h" - -#if !defined (ACE_LACKS_SYS_SEM_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_SEM_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -# if !defined (GETVAL) -# define GETVAL 0 -# endif /* GETVAL */ - -# if !defined (SETVAL) -# define SETVAL 0 -# endif /* SETVAL */ - -# if !defined (GETALL) -# define GETALL 0 -# endif /* GETALL */ - -# if !defined (SETALL) -# define SETALL 0 -# endif /* SETALL */ - -# if !defined (SEM_UNDO) -# define SEM_UNDO 0 -# endif /* SEM_UNDO */ - -#if defined (ACE_LACKS_SEMBUF_T) - struct sembuf - { - /// semaphore # - unsigned short sem_num; - - /// semaphore operation - short sem_op; - - /// operation flags - short sem_flg; - }; -#endif /* ACE_LACKS_SEMBUF_T */ - -#if !defined (ACE_HAS_SEMUN) || (defined (__GLIBC__) && defined (_SEM_SEMUN_UNDEFINED)) - union semun - { - /// value for SETVAL - int val; - /// buffer for IPC_STAT & IPC_SET - struct semid_ds *buf; - /// array for GETALL & SETALL - u_short *array; - }; -#endif /* !ACE_HAS_SEMUN || (defined (__GLIBC__) && defined (_SEM_SEMUN_UNDEFINED)) */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_SEM_H */ diff --git a/ace/os_include/sys/os_shm.h b/ace/os_include/sys/os_shm.h deleted file mode 100644 index af005e8dbb2..00000000000 --- a/ace/os_include/sys/os_shm.h +++ /dev/null @@ -1,48 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_shm.h - * - * XSI shared memory facility - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_SHM_H -#define ACE_OS_INCLUDE_SYS_OS_SHM_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_ipc.h" - -#if !defined (ACE_LACKS_SYS_SHM_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_SHM_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - // Declare opaque type. Needed for ACE_OS wrappers on systems - // without SysV IPC. - struct shmid_ds; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_SHM_H */ diff --git a/ace/os_include/sys/os_socket.h b/ace/os_include/sys/os_socket.h deleted file mode 100644 index 9fc554df4cd..00000000000 --- a/ace/os_include/sys/os_socket.h +++ /dev/null @@ -1,213 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_socket.h - * - * main sockets header - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_SOCKET_H -#define ACE_OS_INCLUDE_SYS_OS_SOCKET_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_uio.h" - -#if !defined (ACE_LACKS_SYS_SOCKET_H) -# if defined (ACE_HAS_AIX_BROKEN_SOCKET_HEADER) -# undef __cplusplus -# endif /* ACE_HAS_AIX_BROKEN_SOCKET_HEADER */ -# include /**/ -# if defined (ACE_HAS_AIX_BROKEN_SOCKET_HEADER) -# define __cplusplus -# endif /* ACE_HAS_AIX_BROKEN_SOCKET_HEADER */ -#endif /* !ACE_LACKS_SYS_SOCKET_H */ - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -# include /**/ -#endif /* ACE_VXWORKS */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if !defined (ACE_HAS_MSG) && !defined (SCO) - struct msghdr {}; -#endif /* ACE_HAS_MSG */ - -#if defined (ACE_HAS_MSG) && defined (ACE_LACKS_MSG_ACCRIGHTS) -# if !defined (msg_accrights) -# undef msg_control -# define msg_accrights msg_control -# endif /* ! msg_accrights */ - -# if !defined (msg_accrightslen) -# undef msg_controllen -# define msg_accrightslen msg_controllen -# endif /* ! msg_accrightslen */ -#endif /* ACE_HAS_MSG && ACE_LACKS_MSG_ACCRIGHTS */ - -#if defined (ACE_WIN32) - struct msghdr - { - /// Optional address - sockaddr * msg_name; - - /// Size of address - int msg_namelen; - - /// Scatter/gather array - iovec *msg_iov; - - /// # elements in msg_iov - int msg_iovlen; - - /// Access rights sent/received - caddr_t msg_accrights; - - int msg_accrightslen; - }; -#endif /* ACE_WIN32 */ - -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - // Control message size to pass a file descriptor. -# define ACE_BSD_CONTROL_MSG_LEN sizeof (struct cmsghdr) + sizeof (ACE_HANDLE) -# if defined (ACE_LACKS_CMSG_DATA_MACRO) -# if defined (ACE_LACKS_CMSG_DATA_MEMBER) -# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) -# else -# define CMSG_DATA(cmsg) ((cmsg)->cmsg_data) -# endif /* ACE_LACKS_CMSG_DATA_MEMBER */ -# endif /* ACE_LACKS_CMSG_DATA_MACRO */ -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - -// Increase the range of "address families". Please note that this -// must appear _after_ the include of sys/socket.h, for the AF_FILE -// definition on Linux/glibc2. -#if !defined (AF_ANY) -# define AF_ANY (-1) -#endif /* AF_ANY */ - -#define AF_SPIPE (AF_MAX + 1) -#if !defined (AF_FILE) -# define AF_FILE (AF_MAX + 2) -#endif /* ! AF_FILE */ -#define AF_DEV (AF_MAX + 3) -#define AF_UPIPE (AF_SPIPE) - -#if defined (ACE_HAS_IPV6) -# if defined (ACE_USES_IPV4_IPV6_MIGRATION) -# define ACE_ADDRESS_FAMILY_INET AF_UNSPEC -# define ACE_PROTOCOL_FAMILY_INET PF_UNSPEC -# else -# define ACE_ADDRESS_FAMILY_INET AF_INET6 -# define ACE_PROTOCOL_FAMILY_INET PF_INET6 -# endif /* ACE_USES_IPV4_IPV6_MIGRATION */ -#else /* !ACE_HAS_IPV6 */ -# define ACE_ADDRESS_FAMILY_INET AF_INET -# define ACE_PROTOCOL_FAMILY_INET PF_INET -#endif /* ACE_HAS_IPV6 */ - -#if defined (ACE_HAS_SOCKLEN_T) -# if defined (__hpux) - /* - ** HP-UX supplies the socklen_t type unless some feature set less than - ** _XOPEN_SOURCE_EXTENDED is specifically requested. However, it only - ** actually uses the socklen_t type in supplied socket functions if - ** _XOPEN_SOURCE_EXTENDED is specifically requested. So, for example, - ** the compile options ACE usually uses (includes -mt) cause _HPUX_SOURCE - ** to be set, which sets _INCLUDE_XOPEN_SOURCE_EXTENDED (causing socklen_t - ** to be defined) but _not_ _XOPEN_SOURCE_EXTENDED (causing socket functions - ** to use int, not socklen_t). React to this situation here... - */ -# if defined (_XOPEN_SOURCE_EXTENDED) -typedef socklen_t ACE_SOCKET_LEN; -# else -typedef int ACE_SOCKET_LEN; -# endif /* _XOPEN_SOURCE_EXTENDED */ -# else -typedef socklen_t ACE_SOCKET_LEN; -# endif /* __hpux */ -#elif defined (ACE_HAS_SIZET_SOCKET_LEN) -typedef size_t ACE_SOCKET_LEN; -#else -typedef int ACE_SOCKET_LEN; -#endif /* ACE_HAS_SIZET_SOCKET_LEN */ - -#if defined (ACE_HAS_NETLINK) -# include /**/ -# include /**/ -# define ACE_PROTOCOL_FAMILY_NETLINK AF_NETLINK -#endif - -#if defined (ACE_HAS_LKSCTP) -extern "C" -{ -#include /**/ -#include /**/ -} -#endif /* ACE_HAS_LKSCTP */ - -# if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES) - - ssize_t recv_timedwait (ACE_HANDLE handle, - char *buf, - int len, - int flags, - struct timespec *timeout); - - ssize_t recvmsg_timedwait (ACE_HANDLE handle, - struct msghdr *msg, - int flags, - struct timespec *timeout); - - ssize_t recvfrom_timedwait (ACE_HANDLE handle, - char *buf, - int len, - int flags, - struct sockaddr *addr, - int *addrlen, - struct timespec *timeout); - - ssize_t send_timedwait (ACE_HANDLE handle, - const char *buf, - int len, - int flags, - struct timespec *timeout); - - ssize_t sendmsg_timedwait (ACE_HANDLE handle, - const struct msghdr *msg, - int flags, - struct timespec *timeout); - - ssize_t sendto_timedwait (ACE_HANDLE handle, - const char *buf, - int len, - int flags, - const struct sockaddr *addr, - int addrlen, - struct timespec *timeout); - -# endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_SOCKET_H */ diff --git a/ace/os_include/sys/os_stat.h b/ace/os_include/sys/os_stat.h deleted file mode 100644 index 0c4a703f5f2..00000000000 --- a/ace/os_include/sys/os_stat.h +++ /dev/null @@ -1,127 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_stat.h - * - * data returned by the stat() function - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_STAT_H -#define ACE_OS_INCLUDE_SYS_OS_STAT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) -# include /**/ -#endif /* ACE_WIN32 && !ACE_HAS_WINCE */ - -#if !defined (ACE_LACKS_SYS_STAT_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_STAT_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_LACKS_MODE_MASKS) -// MODE MASKS - -// the following macros are for POSIX conformance. - -# if !defined (ACE_HAS_USER_MODE_MASKS) -# define S_IRWXU 00700 /* read, write, execute: owner. */ -# define S_IRUSR 00400 /* read permission: owner. */ -# define S_IWUSR 00200 /* write permission: owner. */ -# define S_IXUSR 00100 /* execute permission: owner. */ -# endif /* ACE_HAS_USER_MODE_MASKS */ -# define S_IRWXG 00070 /* read, write, execute: group. */ -# define S_IRGRP 00040 /* read permission: group. */ -# define S_IWGRP 00020 /* write permission: group. */ -# define S_IXGRP 00010 /* execute permission: group. */ -# define S_IRWXO 00007 /* read, write, execute: other. */ -# define S_IROTH 00004 /* read permission: other. */ -# define S_IWOTH 00002 /* write permission: other. */ -# define S_IXOTH 00001 /* execute permission: other. */ - -// WinCE's S_IFLNK is defined with the other bits, below. -#if !defined (S_IFLNK) && !defined (ACE_HAS_WINCE) -#define S_IFLNK 0200000 -#endif /* S_IFLNK && !ACE_HAS_WINCE */ - -#endif /* ACE_LACKS_MODE_MASKS */ - -// Some systems (VxWorks) don't define S_ISLNK -#if !defined (S_ISLNK) -# if defined (S_IFLNK) -# define S_ISLNK(mode) (((mode)&S_IFLNK) == S_IFLNK) -# else -# define S_ISLNK(mode) 0 -# endif /* S_IFLNK */ -#endif /* S_ISLNK */ - -#if defined (ACE_HAS_WINCE) -# include "ace/Time_Value.h" - -// Translate the WinCE bits into names expected by our callers. -// The dwFileAttributes parameter doesn't have protection info, so -// S_IFMT is the whole thing. Since there are no symbolic links, S_IFLNK is 0. -# define S_IFMT 0xFFFF -# define S_IFDIR FILE_ATTRIBUTE_DIRECTORY -# define S_IFREG FILE_ATTRIBUTE_NORMAL -# define S_IFLNK 0 - - struct stat - { - /// always 0 on Windows platforms - dev_t st_dev; - - /// always 0 on Windows platforms - dev_t st_rdev; - - /// file attribute - unsigned short st_mode; - - /// number of hard links - short st_nlink; - - /// time of last access - ACE_Time_Value st_atime; - - /// time of last data modification - ACE_Time_Value st_mtime; - - /// time of creation - ACE_Time_Value st_ctime; - - /// file size, in bytes - off_t st_size; - - // Following members do not have direct conversion in Window platforms. - //u_long st_blksize; // optimal blocksize for I/O - //u_long st_flags; // user defined flags for file - }; -#endif /* ACE_HAS_WINCE */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_STAT_H */ diff --git a/ace/os_include/sys/os_statvfs.h b/ace/os_include/sys/os_statvfs.h deleted file mode 100644 index 546c20b10f2..00000000000 --- a/ace/os_include/sys/os_statvfs.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_statvfs.h - * - * VFS File System information structure - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_STATVFS_H -#define ACE_OS_INCLUDE_SYS_OS_STATVFS_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_SYS_STATVFS_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_STATVFS_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_STATVFS_H */ diff --git a/ace/os_include/sys/os_sysctl.h b/ace/os_include/sys/os_sysctl.h deleted file mode 100644 index 680c2562cbf..00000000000 --- a/ace/os_include/sys/os_sysctl.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_sysctl.h - * - * declarations for sysctl - * - * $Id$ - * - * @author Johnny Willemsen - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_SYSCTL_H -#define ACE_OS_INCLUDE_SYS_OS_SYSCTL_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_SYS_SYSCTL_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_SYSCTL_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_SYSCTL_H */ diff --git a/ace/os_include/sys/os_time.h b/ace/os_include/sys/os_time.h deleted file mode 100644 index 7f65f5cb568..00000000000 --- a/ace/os_include/sys/os_time.h +++ /dev/null @@ -1,60 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_time.h - * - * time types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_TIME_H -#define ACE_OS_INCLUDE_SYS_OS_TIME_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_SYS_TIME_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_TIME_H */ - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x620) -# include /**/ // VxWorks 6.2 defined timeval in time.h -#endif - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_HAS_SVR4_GETTIMEOFDAY) -# if !defined (m88k) && !defined (SCO) - int gettimeofday (struct timeval *tp, void * = 0); -# else - int gettimeofday (struct timeval *tp); -# endif /* !m88k && !SCO */ -#elif defined (ACE_HAS_OSF1_GETTIMEOFDAY) - int gettimeofday (struct timeval *tp, struct timezone * = 0); -#elif defined (ACE_HAS_VOIDPTR_GETTIMEOFDAY) -# define ACE_HAS_SVR4_GETTIMEOFDAY -#endif /* ACE_HAS_SVR4_GETTIMEOFDAY */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_TIME_H */ diff --git a/ace/os_include/sys/os_timeb.h b/ace/os_include/sys/os_timeb.h deleted file mode 100644 index 2495097d344..00000000000 --- a/ace/os_include/sys/os_timeb.h +++ /dev/null @@ -1,49 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_timeb.h - * - * additional definitions for date and time - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_TIMEB_H -#define ACE_OS_INCLUDE_SYS_OS_TIMEB_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_SYS_TIMEB_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_TIMEB_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x560) -# define _ftime ftime -# define _timeb timeb -#endif /* __BORLANDC__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_TIMEB_H */ diff --git a/ace/os_include/sys/os_times.h b/ace/os_include/sys/os_times.h deleted file mode 100644 index c63b9e0098c..00000000000 --- a/ace/os_include/sys/os_times.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_times.h - * - * file access and modification times structure - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_TIMES_H -#define ACE_OS_INCLUDE_SYS_OS_TIMES_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_SYS_TIMES_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_TIMES_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_TIMES_H */ diff --git a/ace/os_include/sys/os_types.h b/ace/os_include/sys/os_types.h deleted file mode 100644 index 30672051185..00000000000 --- a/ace/os_include/sys/os_types.h +++ /dev/null @@ -1,151 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_types.h - * - * data types - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_TYPES_H -#define ACE_OS_INCLUDE_SYS_OS_TYPES_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_stddef.h" - -#if !defined (ACE_LACKS_SYS_TYPES_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_TYPES_H */ - -#if defined (ACE_HAS_WINCE) -# include /**/ -#endif /* ACE_HAS_WINCE */ - -# if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) -using std::time_t; -# endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -typedef double ACE_timer_t; - -// todo: don't forget to clean this up! ;-) -#if !defined (ACE_HAS_CLOCK_GETTIME) && !(defined (_CLOCKID_T_) || defined (_CLOCKID_T)) - typedef int clockid_t; -# if !defined (CLOCK_REALTIME) -# define CLOCK_REALTIME 0 -# endif /* CLOCK_REALTIME */ -#endif /* ! ACE_HAS_CLOCK_GETTIME && ! _CLOCKID_T_ */ - -#if defined (ACE_HAS_WINCE) - -// CE's add-on for c-style fstat/stat functionalities. This struct is -// by no mean complete compared to what you usually find in UNIX -// platforms. Only members that have direct conversion using Win32's -// BY_HANDLE_FILE_INFORMATION are defined so that users can discover -// non-supported members at compile time. Time values are of type -// ACE_Time_Value for easy comparison. - -// Since CE does not have _stat by default as NT/2000 does, the 'stat' -// struct defined here will be used. Also note that CE file system -// struct is only for the CE 3.0 or later. -// Refer to the WCHAR.H from Visual C++ and WIBASE.H from eVC 3.0. - - typedef unsigned int dev_t; -#endif /* ACE_HAS_WINCE */ - -#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8 - typedef off_t ACE_LOFF_T; -#elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || \ - (defined (ACE_OPENVMS) && defined (_LARGEFILE)) - typedef off_t ACE_LOFF_T; -#elif defined (__sgi) || defined (AIX) || defined (HPUX) || defined (__QNX__) - typedef off64_t ACE_LOFF_T; -#elif defined (__sun) - typedef offset_t ACE_LOFF_T; -#elif defined (WIN32) - typedef __int64 ACE_LOFF_T; -#elif (defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x630 || ACE_VXWORKS == 0x620 || ACE_VXWORKS == 0x551)) || \ - defined (ACE_LYNXOS_MAJOR) || \ - (defined (ACE_OPENVMS) && !defined (_LARGEFILE)) - typedef long long ACE_LOFF_T; -#else - typedef loff_t ACE_LOFF_T; -#endif - -#if defined (ACE_WIN32) -# if !defined (__BORLANDC__) - typedef DWORD nlink_t; -# if !defined(__MINGW32__) - typedef u_short mode_t; -# endif /* !__MINGW32__ */ - typedef long uid_t; - typedef long gid_t; -# endif /* __BORLANDC__ */ - typedef char *caddr_t; -#endif /* ACE_WIN32 */ - -#if defined (ACE_LACKS_KEY_T) -# if defined (ACE_WIN32) - // Win32 doesn't use numeric values to name its semaphores, it uses - // strings! - typedef char *key_t; -# else - typedef int key_t; -# endif /* ACE_WIN32 */ -#endif /* ACE_LACKS_KEY_T */ - -#if !defined (ACE_HAS_SSIZE_T) -# if defined (ACE_WIN64) - typedef SSIZE_T ssize_t; -# else - typedef int ssize_t; -# endif /* ACE_WIN64 */ -#endif /* ACE_HAS_SSIZE_T */ - -#if defined (ACE_WIN32) - typedef DWORD ACE_exitcode; -#else - typedef int ACE_exitcode; -#endif /* ACE_WIN32 */ - -#if defined (ACE_LACKS_SUSECONDS_T) - typedef long suseconds_t; -#endif - -#if defined (ACE_LACKS_USECONDS_T) - typedef unsigned long useconds_t; -#endif - -#if defined (ACE_WIN32) && !defined(__MINGW32__) - typedef long pid_t; -#endif /* ACE_WIN32 */ - -# if !defined (ACE_INVALID_PID) -# define ACE_INVALID_PID ((pid_t) -1) -# endif /* ACE_INVALID_PID */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_TYPES_H */ diff --git a/ace/os_include/sys/os_uio.h b/ace/os_include/sys/os_uio.h deleted file mode 100644 index 1a7fd505c39..00000000000 --- a/ace/os_include/sys/os_uio.h +++ /dev/null @@ -1,85 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_uio.h - * - * definitions for vector I/O operations - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_UIO_H -#define ACE_OS_INCLUDE_SYS_OS_UIO_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" -#include "ace/os_include/os_limits.h" - -#if !defined (ACE_LACKS_SYS_UIO_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_UIO_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -// todo: make this a regular ACE_LACKS macro test... -#if defined(__rtems__) - struct iovec { - /// Base address. - char *iov_base; - /// Length. - size_t iov_len; - }; -#elif defined (ACE_WIN32) - /// The ordering of the fields in this struct is important. It has to - /// match those in WSABUF. - struct iovec - { - /// byte count to read/write - u_long iov_len; - /// data to be read/written - char *iov_base; - - // WSABUF is a Winsock2-only type. -# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - operator WSABUF &(void) { return *((WSABUF *) this); } -# endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */ - }; -#endif /* __rtems__ */ - - -# if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES) - - ssize_t readv_timedwait (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - struct timespec* timeout); - - ssize_t writev_timedwait (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - struct timespec *timeout); - -# endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_UIO_H */ diff --git a/ace/os_include/sys/os_un.h b/ace/os_include/sys/os_un.h deleted file mode 100644 index a9bf2457dc1..00000000000 --- a/ace/os_include/sys/os_un.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_un.h - * - * definitions for UNIX domain sockets - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_UN_H -#define ACE_OS_INCLUDE_SYS_OS_UN_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_socket.h" - -#if !defined (ACE_LACKS_SYS_UN_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_UN_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x600) -struct sockaddr_un { - short sun_family; // AF_UNIX. - char sun_path[108]; // path name. -}; -#endif /* ACE_VXWORKS */ - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_UN_H */ diff --git a/ace/os_include/sys/os_utsname.h b/ace/os_include/sys/os_utsname.h deleted file mode 100644 index d707cbecc7d..00000000000 --- a/ace/os_include/sys/os_utsname.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_utsname.h - * - * system name structure - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_UTSNAME_H -#define ACE_OS_INCLUDE_SYS_OS_UTSNAME_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_SYS_UTSNAME_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_UTSNAME_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_UTSNAME_H */ diff --git a/ace/os_include/sys/os_wait.h b/ace/os_include/sys/os_wait.h deleted file mode 100644 index eb9f7e1d2de..00000000000 --- a/ace/os_include/sys/os_wait.h +++ /dev/null @@ -1,97 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file os_wait.h - * - * declarations for waiting - * - * $Id$ - * - * @author Don Hinton - * @author This code was originally in various places including ace/OS.h. - */ -//============================================================================= - -#ifndef ACE_OS_INCLUDE_SYS_OS_WAIT_H -#define ACE_OS_INCLUDE_SYS_OS_WAIT_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_signal.h" -#include "ace/os_include/sys/os_resource.h" - -#if !defined (ACE_LACKS_SYS_WAIT_H) -# include /**/ -#endif /* !ACE_LACKS_SYS_WAIT_H */ - -// Place all additions (especially function declarations) within extern "C" {} -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - // Wrapping around wait status macros for platforms that - // lack them. - -# if !defined (WCOREDUMP) -# define WCOREDUMP(stat) 0 -# endif /* WCOREDUMP */ - -# if !defined (WNOHANG) -# define WNOHANG 0100 -# endif /* !WNOHANG */ - - // If the value of WIFEXITED(stat) is non-zero, this macro evaluates - // to the exit code that the child process exit(3C), or the value - // that the child process returned from main. Peaceful exit code is - // 0. -# if !defined (WEXITSTATUS) -# define WEXITSTATUS(stat) stat -# endif /* WEXITSTATUS */ - -# if !defined (WIFCONTINUED) -# define WIFCONTINUED(stat) 0 -# endif /* WIFCONTINUED */ - - // Evaluates to a non-zero value if status was returned for a child - // process that terminated normally. 0 means status wasn't - // returned. -# if !defined (WIFEXITED) -# define WIFEXITED(stat) 1 -# endif /* WIFEXITED */ - - // Evaluates to a non-zero value if status was returned for a child - // process that terminated due to the receipt of a signal. 0 means - // status wasnt returned. -# if !defined (WIFSIGNALED) -# define WIFSIGNALED(stat) 0 -# endif /* WIFSIGNALED */ - -# if !defined (WIFSTOPPED) -# define WIFSTOPPED(stat) 0 -# endif /* WIFSTOPPED */ - -# if !defined (WSTOPSIG) -# define WSTOPSIG(stat) 0 -# endif /* WSTOPSIG */ - - // If the value of WIFSIGNALED(stat) is non-zero, this macro - // evaluates to the number of the signal that caused the - // termination of the child process. -# if !defined (WTERMSIG) -# define WTERMSIG(stat) 0 -# endif /* WTERMSIG */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include /**/ "ace/post.h" -#endif /* ACE_OS_INCLUDE_SYS_OS_WAIT_H */ diff --git a/ace/other.mpb b/ace/other.mpb deleted file mode 100644 index 9599ab8282b..00000000000 --- a/ace/other.mpb +++ /dev/null @@ -1,15 +0,0 @@ -// -*- MPC -*- -// $Id$ - -feature(ace_other) { - Source_Files(ACE_COMPONENTS) { - Local_Name_Space.cpp - Name_Proxy.cpp - Name_Request_Reply.cpp - Name_Space.cpp - Naming_Context.cpp - Registry_Name_Space.cpp - Remote_Name_Space.cpp - NT_Service.cpp - } -} diff --git a/ace/post.h b/ace/post.h deleted file mode 100644 index e39a3f9fa24..00000000000 --- a/ace/post.h +++ /dev/null @@ -1,22 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file post.h - * - * $Id$ - * - * @author Christopher Kohlhoff - * - * This file restores the original alignment rules. - */ -//============================================================================= - -// No header guard -#if defined (_MSC_VER) -# pragma pack (pop) -#elif defined (__BORLANDC__) -# pragma option pop -# pragma nopushoptwarn -# pragma nopackwarning -#endif diff --git a/ace/pre.h b/ace/pre.h deleted file mode 100644 index 8a7d7774c64..00000000000 --- a/ace/pre.h +++ /dev/null @@ -1,24 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file pre.h - * - * $Id$ - * - * @author Christopher Kohlhoff - * - * This file saves the original alignment rules and changes the alignment - * boundary to ACE's default. - */ -//============================================================================= - -// No header guard -#if defined (_MSC_VER) -# pragma warning (disable:4103) -# pragma pack (push, 8) -#elif defined (__BORLANDC__) -# pragma option push -a8 -b -Ve- -Vx- -w-rvl -w-rch -w-ccc -w-obs -w-aus -w-pia -w-inl -w-sig -# pragma nopushoptwarn -# pragma nopackwarning -#endif diff --git a/ace/streams.h b/ace/streams.h deleted file mode 100644 index 6a4de4a35e2..00000000000 --- a/ace/streams.h +++ /dev/null @@ -1,141 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file streams.h - * - * $Id$ - * - * @author Irfan Pyarali - * - * This file contains the portability ugliness for the Standard C++ - * Library. As implementations of the "standard" emerge, this file - * will need to be updated. - * - * This files deals with the streams includes. - * - * - */ -//============================================================================= - - -#ifndef ACE_STREAMS_H -#define ACE_STREAMS_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Do this so the #pragma warning in the MSVC headers do not -// affect our #pragma warning settings -#if defined (_MSC_VER) -#pragma warning(push) -#endif /* _MSC_VER*/ - - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) - -# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ - (ACE_HAS_STANDARD_CPP_LIBRARY != 0) - -# if defined (_MSC_VER) -# pragma warning(disable: 4018 4114 4146 4245) -# pragma warning(disable: 4663 4664 4665 4511 4512) -# endif /* _MSC_VER */ - -# if defined (ACE_USES_OLD_IOSTREAMS) -# include /**/ -# include /**/ - // This has been commented as it is not needed and causes problems with Qt. - // (brunsch) But has been uncommented since it should be included. Qt - // probably should have some sort of macro that will prevent including this - // when it is used. -# include /**/ -# else -# if defined (__BORLANDC__) && (__BORLANDC__ == 0x551) -# include /**/ -# endif /* __BORLANDC__ && __BORLANDC__ == 0x551 */ -# include /**/ -# include /**/ -# include /**/ -# include /**/ -# include /**/ -# include /**/ -# include /**/ -# endif /* ACE_USES_OLD_IOSTREAMS */ - -# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) - -# if !defined (ACE_USES_OLD_IOSTREAMS) - // Make these available in the global name space - using std::ios; - using std::ios_base; - using std::streambuf; - using std::istream; - using std::ostream; - using std::iostream; - using std::filebuf; - using std::ifstream; - using std::ofstream; - using std::fstream; - - using std::cin; - using std::cout; - using std::cerr; - using std::clog; - - using std::endl; - using std::ends; - using std::flush; - - using std::ws; - - using std::resetiosflags; - using std::setfill; - using std::setiosflags; - using std::setprecision; - using std::setw; - - using std::dec; - using std::hex; - using std::oct; -# endif /* ! ACE_USES_OLD_IOSTREAMS */ - -# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ - -# if defined (_MSC_VER) -# pragma warning(4: 4018 4114 4146 4245) -# pragma warning(4: 4663 4664 4665 4512 4511) -# endif /* _MSC_VER */ - -# else /* ! ACE_HAS_STANDARD_CPP_LIBRARY */ - -# include /**/ -# include /**/ -# include /**/ - -# if defined (ACE_WIN32) && !defined(__MINGW32__) -# if defined(_MSC_VER) // VSB -# include /**/ -# include /**/ -# include /**/ -# include /**/ -# endif /* _MSC_VER */ -# endif /* ACE_WIN32 && !__MINGW32__ */ - -# endif /* ! ACE_HAS_STANDARD_CPP_LIBRARY */ - -#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - -// Do this so the #pragma warning in the MSVC headers do not -// affect our #pragma warning settings -#if defined (_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ - -#include /**/ "ace/post.h" -#endif /* ACE_STREAMS_H */ diff --git a/ace/svc_export.h b/ace/svc_export.h deleted file mode 100644 index b10b4f33bc5..00000000000 --- a/ace/svc_export.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. - -// This file was generated by generate_export_file.pl -// but needed to be altered to support ACE_BUILD_SVC_DLL -// instead of ACE_SVC_BUILD_DLL which was already being -// used. - -// ------------------------------ -#if !defined (ACE_SVC_EXPORT_H) -#define ACE_SVC_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_SVC_HAS_DLL) -# define ACE_SVC_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_SVC_HAS_DLL */ - -#if !defined (ACE_SVC_HAS_DLL) -#define ACE_SVC_HAS_DLL 1 -#endif /* ! ACE_SVC_HAS_DLL */ - -#if defined (ACE_SVC_HAS_DLL) -# if (ACE_SVC_HAS_DLL == 1) -# if defined (ACE_BUILD_SVC_DLL) || defined (ACE_SVC_BUILD_DLL) -# define ACE_Svc_Export ACE_Proper_Export_Flag -# define ACE_SVC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# else -# define ACE_Svc_Export ACE_Proper_Import_Flag -# define ACE_SVC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# endif /* ACE_BUILD_SVC_DLL */ -# else -# define ACE_Svc_Export -# define ACE_SVC_SINGLETON_DECLARATION(T) -# endif /* ! ACE_SVC_HAS_DLL == 1 */ -#else -# define ACE_Svc_Export -# define ACE_SVC_SINGLETON_DECLARATION(T) -#endif /* ACE_SVC_HAS_DLL */ - -#endif /* ACE_SVC_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/svcconf.mpb b/ace/svcconf.mpb deleted file mode 100644 index 79fad93329a..00000000000 --- a/ace/svcconf.mpb +++ /dev/null @@ -1,64 +0,0 @@ -// -*- MPC -*- -// $Id$ - -feature(ace_svcconf) { - macros -= ACE_LACKS_ACE_SVCCONF - - Source_Files(ACE_COMPONENTS) { - DLL.cpp - Dynamic_Service_Base.cpp - Dynamic_Service_Dependency.cpp - Parse_Node.cpp - Service_Config.cpp - Service_Gestalt.cpp - Service_Manager.cpp - Service_Object.cpp - Service_Repository.cpp - Service_Types.cpp - Shared_Object.cpp - Svc_Conf_Lexer.cpp - Svc_Conf_y.cpp - Encoding_Converter.cpp - Encoding_Converter_Factory.cpp - UTF8_Encoding_Converter.cpp - UTF16_Encoding_Converter.cpp - UTF32_Encoding_Converter.cpp - XML_Svc_Conf.cpp - } - - verbatim(gnuace, local) { - "Svc_Conf_y.cpp: Svc_Conf.y" - "ifeq ($(notdir $(YACC)), bison)" - " $(YACC) -l -d Svc_Conf.y" - " sed -e 's/char \\*getenv/char *ace_foo/g' \\" // Eliminates getenv prototype, use ACE's - " -e 's/= getenv/= ACE_OS::getenv/g' \\" // ... like this - qualified. - " -e 's/fprintf/ACE_OS::fprintf/g' \\" // Use ACE's fprintf, not library's - " -e 's/yy/ace_yy/g' \\" - " -e 's/->ace_yyerrno/->yyerrno/g' \\" // These reverse the unwanted ace_ prefix - " -e 's/->ace_yylineno/->yylineno/g' \\" // added by the substitution, above. - " -e 's/YY/ACE_YY/g' \\" - " -e 's/^char /ACE_TCHAR /g' \\" - " -e 's/\([^d]\) char /\$1 ACE_TCHAR /g' \\" - " -e 's/(char/(ACE_TCHAR/g' \\" - " -e 's/ NULL/ 0/g' \\" - " -e 's/ace_yyerror[ ]*(\"/ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, \"/g' \\" - " -e 's/ace_yyerror[ ]*(ace_yymsg/ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, ace_yymsg/g' \\" - " -e 's/ace_yyerror (int ace_yyerrno, int ace_yylineno, const ACE_TCHAR/ace_yyerror (int ace_yyerrno, int ace_yylineno, const char/' \\" - " -e 's@#include @@' \\" - " -e 's/Svc_Conf\\.tab\\.c/Svc_Conf_y.cpp/g' < Svc_Conf.tab.c > /tmp/$@" - " cp /tmp/$@ $@" - " echo \/\/ '$$I''d:$$' >Svc_Conf_Tokens.h" - " echo '#ifndef BISON_SVC_CONF_TAB_H' >>Svc_Conf_Tokens.h" // Inclusion protection macros - " echo '# define BISON_SVC_CONF_TAB_H' >>Svc_Conf_Tokens.h" // ... same ... - " echo '# define ACE_YYSTYPE_IS_DECLARED 1' >>Svc_Conf_Tokens.h" // Don't use Svc_Conf_y.cpp's - " sed -e 's/yy/ace_yy/g' \\" - " -e 's/YY/ACE_YY/g' >Svc_Conf_Tokens.h" - " echo '#endif \/\* ifndef BISON_SVC_CONF_TAB_H \*\/' >>Svc_Conf_Tokens.h" - " $(RM) -f /tmp/$@ Svc_Conf.tab.c Svc_Conf.tab.h Svc_Conf_y.cpp.orig" - "else" - " @echo 'ERROR: You must use bison 1.35 or higher to process this file'" - " @/bin/false" - "endif" - - } -} diff --git a/ace/token.mpb b/ace/token.mpb deleted file mode 100644 index ce261141a76..00000000000 --- a/ace/token.mpb +++ /dev/null @@ -1,15 +0,0 @@ -// -*- MPC -*- -// $Id$ - -feature(ace_token) { - macros -= ACE_LACKS_ACE_TOKEN - - Source_Files(ACE_COMPONENTS) { - Local_Tokens.cpp - Remote_Tokens.cpp - Token_Collection.cpp - Token_Invariants.cpp - Token_Manager.cpp - Token_Request_Reply.cpp - } -} diff --git a/ace/uuid.mpb b/ace/uuid.mpb deleted file mode 100644 index 3357a6e61b8..00000000000 --- a/ace/uuid.mpb +++ /dev/null @@ -1,8 +0,0 @@ -// -*- MPC -*- -// $Id$ - -feature(ace_uuid) { - Source_Files(ACE_COMPONENTS) { - UUID.cpp - } -} -- cgit v1.2.1